4873 lines
1.1 MiB
4873 lines
1.1 MiB
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.bim-engine-wrapper{position:relative;width:100%;height:100%;font-family:sans-serif;box-sizing:border-box;overflow:hidden;background:linear-gradient(to bottom,#d6e0eb,#f6faff)}.bim-engine-opt-btn-container{z-index:100}.bim-construct-tree-btn{position:absolute;top:20px;left:20px!important;z-index:100}.bim-btn-group-root{display:flex;gap:8px;z-index:1000;position:absolute;pointer-events:auto}.bim-btn-group-root.static{position:relative;inset:auto;transform:none}.bim-btn-group-root.dir-row{flex-direction:row;align-items:center}.bim-btn-group-root.dir-column{flex-direction:column;align-items:stretch}.bim-btn-group-section{display:flex;gap:4px;background-color:var(--bim-btn-group-section-bg, rgba(17, 17, 17, .88));border-radius:6px;padding:4px;box-shadow:0 2px 8px #0000004d,0 1px 3px #0003}.bim-btn-group-root.dir-row .bim-btn-group-section{flex-direction:row;align-items:center}.bim-btn-group-root.dir-column .bim-btn-group-section{flex-direction:column}.opt-btn-wrapper{position:relative}.opt-btn{display:flex;cursor:pointer;border-radius:4px;transition:background-color .2s,color .2s,border-color .2s;color:var(--bim-btn-text-color, #ccc);background-color:var(--bim-btn-bg, transparent);padding:6px;align-items:center;position:relative;justify-content:center;border:1px solid transparent;outline:none}.opt-btn:hover{background-color:var(--bim-btn-hover-bg, #444)}.opt-btn.active{background-color:var(--bim-btn-active-bg, rgba(255, 255, 255, .15));color:var(--bim-btn-text-active-color, #fff)}.opt-btn.disabled{opacity:.5;cursor:not-allowed}.opt-btn-icon{width:var(--bim-icon-size, 24px);height:var(--bim-icon-size, 24px);display:flex;align-items:center;justify-content:center;color:var(--bim-icon-color, #ccc);flex-shrink:0}.opt-btn-icon svg{width:100%;height:100%;fill:currentColor}.opt-btn-arrow{font-size:10px;opacity:.6;transition:transform .2s;display:inline-block;margin-left:4px}.opt-btn-arrow.rotated{transform:rotate(180deg)}.opt-btn-text-wrapper{display:flex;align-items:center;justify-content:center;pointer-events:none}.opt-btn-label{display:inline}.opt-btn.no-label .opt-btn-label{display:none}.opt-btn.align-vertical:not(.no-label){flex-direction:column;text-align:center}.opt-btn.align-vertical:not(.no-label) .opt-btn-text-wrapper{margin-top:4px}.opt-btn.align-vertical:not(.no-label) .opt-btn-label{font-size:12px;line-height:1.2}.opt-btn.align-horizontal:not(.no-label){flex-direction:row}.opt-btn.align-horizontal:not(.no-label) .opt-btn-text-wrapper{margin-left:8px}.opt-btn.align-horizontal:not(.no-label) .opt-btn-label{font-size:14px}.opt-btn.no-label .opt-btn-text-wrapper{width:0;height:0;margin:0;padding:0;overflow:visible;position:absolute;top:0;right:0}.opt-btn.no-label .opt-btn-arrow{position:absolute;top:2px;right:2px;margin:0;font-size:8px}.opt-btn-dropdown{position:absolute;background-color:var(--bim-toolbar-bg, rgba(17, 17, 17, .95));border-radius:4px;padding:4px;box-shadow:0 4px 12px #0003;z-index:1001;display:flex;flex-direction:column;border:1px solid rgba(255,255,255,.1);opacity:0;visibility:hidden;transform:translateY(-10px);transition:opacity .2s ease,transform .2s cubic-bezier(.2,0,.2,1),visibility .2s}@keyframes dropdown-fade-in{0%{opacity:0;transform:translateY(-8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}.opt-btn-dropdown{animation:dropdown-fade-in .2s cubic-bezier(.2,0,.2,1) forwards;opacity:1;visibility:visible;transform:none}.opt-btn-dropdown-item{display:flex;align-items:center;padding:8px 12px;cursor:pointer;border-radius:4px;color:var(--bim-btn-text-color, #ccc);transition:background .2s,border-color .2s,color .2s;box-sizing:border-box;border:1px solid transparent;outline:none}.opt-btn-dropdown-item .opt-btn-icon{color:var(--bim-icon-color, #ccc)}.opt-btn-dropdown-item:hover{background-color:var(--bim-btn-hover-bg, #444)}.opt-btn-dropdown-item.active{background-color:var(--bim-btn-active-bg, rgba(255, 255, 255, .15));color:var(--bim-btn-text-active-color, #fff)}.opt-btn-dropdown-item.align-horizontal{flex-direction:row}.opt-btn-dropdown-item.align-horizontal .opt-btn-icon{width:18px;height:18px;margin-right:8px}.opt-btn-dropdown-item.align-vertical{flex-direction:column;text-align:center}.opt-btn-dropdown-item.align-vertical .opt-btn-icon{width:24px;height:24px;margin-bottom:4px}.opt-btn-dropdown-item.align-vertical .opt-btn-dropdown-label{font-size:12px}.bim-btn-group-root.is-bottom-toolbar .opt-btn-icon{width:32px;height:32px}.bim-btn-group-root.is-bottom-toolbar .opt-btn{padding:8px}.bim-btn-group-root.type-glass-pill .bim-btn-group-section{background:var(--bim-floating-bg);backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid var(--bim-floating-border);border-radius:9999px;box-shadow:var(--bim-floating-shadow);padding:8px;gap:10px}.bim-btn-group-root.type-glass-pill .opt-btn{width:48px;height:48px;min-width:48px;border-radius:9999px;background:var(--bim-floating-btn-bg);border:1px solid var(--bim-floating-btn-border);box-shadow:var(--bim-floating-btn-shadow);color:var(--bim-text-primary);padding:0;transition:all .2s ease-out}.bim-btn-group-root.type-glass-pill .opt-btn:hover{background:var(--bim-floating-btn-bg-hover);transform:scale(1.05);box-shadow:var(--bim-floating-btn-shadow-hover)}.bim-btn-group-root.type-glass-pill .opt-btn:active{transform:scale(.98)}.bim-btn-group-root.type-glass-pill .opt-btn.active{background:var(--bim-primary);border:1px solid var(--bim-primary-active);color:var(--bim-text-inverse);box-shadow:var(--bim-shadow-glow)}.bim-btn-group-root.type-glass-pill .opt-btn.active:hover{background:var(--bim-primary-hover);transform:scale(1.05)}.bim-btn-group-root.type-glass-pill .opt-btn.active:active{transform:scale(.98)}.bim-btn-group-root.type-glass-pill .opt-btn.active .opt-btn-icon{color:var(--bim-icon-inverse)}.bim-btn-group-root.type-glass-pill .opt-btn.disabled{opacity:.3;cursor:not-allowed;transform:none;box-shadow:none}.bim-btn-group-root.type-glass-pill .opt-btn-icon{width:18px;height:18px;color:var(--bim-floating-icon-color);transition:color .2s ease-out}.bim-btn-group-root.type-glass-pill .opt-btn-icon svg{width:18px;height:18px}.bim-btn-group-root.type-glass-pill .opt-btn:hover .opt-btn-icon{color:var(--bim-floating-icon-color-hover)}.bim-btn-group-root.type-glass-pill .opt-btn-label{display:none!important}.bim-btn-group-root.type-glass-pill .opt-btn-text-wrapper{position:absolute;top:2px;right:2px;width:0;height:0;margin:0;padding:0}.bim-btn-group-root.type-glass-pill .opt-btn-arrow{font-size:8px;position:absolute;top:0;right:0;color:var(--bim-text-tertiary)}.opt-btn-dropdown.type-glass-pill{background:#fffffff2;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border:1px solid rgba(226,232,240,.6);border-radius:12px;box-shadow:0 8px 24px #0000001f;padding:6px}.opt-btn-dropdown.type-glass-pill .opt-btn-dropdown-item{display:flex;flex-direction:row;align-items:center;gap:10px;border-radius:8px;color:#334155;padding:8px 12px;font-size:13px;font-weight:400;transition:all .1s ease-out}.opt-btn-dropdown.type-glass-pill .opt-btn-dropdown-item:hover{background:#f1f5f9}.opt-btn-dropdown.type-glass-pill .opt-btn-dropdown-item:active{background:#e2e8f0}.opt-btn-dropdown.type-glass-pill .opt-btn-dropdown-item.active{background:#3b82f6;color:#fff}.opt-btn-dropdown.type-glass-pill .opt-btn-dropdown-item.active .opt-btn-icon,.opt-btn-dropdown.type-glass-pill .opt-btn-dropdown-item.active .opt-btn-dropdown-label{color:#fff}.opt-btn-dropdown.type-glass-pill .opt-btn-dropdown-item .opt-btn-icon{width:18px;height:18px;color:#334155;flex-shrink:0}.opt-btn-dropdown.type-glass-pill .opt-btn-dropdown-item .opt-btn-icon svg{width:18px;height:18px}.opt-btn-dropdown.type-glass-pill .opt-btn-dropdown-item .opt-btn-dropdown-label{white-space:nowrap;color:#334155}.opt-btn-dropdown.type-glass-pill.theme-dark{background:#152232fa;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border:1px solid rgba(51,65,85,.5);box-shadow:0 8px 24px #00000040}.opt-btn-dropdown.type-glass-pill.theme-dark .opt-btn-dropdown-item{color:#fff}.opt-btn-dropdown.type-glass-pill.theme-dark .opt-btn-dropdown-item:hover{background:#1f2d3e}.opt-btn-dropdown.type-glass-pill.theme-dark .opt-btn-dropdown-item:active{background:#2a3f54}.opt-btn-dropdown.type-glass-pill.theme-dark .opt-btn-dropdown-item.active{background:#3b82f6;color:#fff}.opt-btn-dropdown.type-glass-pill.theme-dark .opt-btn-dropdown-item .opt-btn-icon,.opt-btn-dropdown.type-glass-pill.theme-dark .opt-btn-dropdown-item .opt-btn-dropdown-label{color:#fff}.bim-dialog{position:absolute;background-color:var(--bim-dialog-bg, var(--bim-bg-elevated));border:1px solid var(--bim-dialog-border-color, var(--bim-border-default));border-radius:6px;box-shadow:var(--bim-shadow-lg);display:flex;flex-direction:column;z-index:10001;color:var(--bim-dialog-title-color, var(--bim-text-primary));overflow:hidden;min-width:200px;min-height:100px;pointer-events:auto}.bim-dialog-header{height:32px;background-color:var(--bim-dialog-header-bg, var(--bim-bg-inset));display:flex;align-items:center;justify-content:space-between;padding:0 10px;cursor:default;-webkit-user-select:none;user-select:none;border-bottom:1px solid var(--bim-dialog-border-color, var(--bim-border-default));flex-shrink:0}.bim-dialog-header.draggable{cursor:move}.bim-dialog-title{font-size:14px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--bim-dialog-title-color)}.bim-dialog-close{cursor:pointer;font-size:18px;color:var(--bim-text-tertiary);line-height:1;margin-left:8px}.bim-dialog-close:hover{color:var(--bim-text-primary)}.bim-dialog-content{flex:1;overflow:auto;font-size:14px;color:var(--bim-dialog-text-color, var(--bim-text-secondary))}.bim-dialog-resize-handle{position:absolute;width:10px;height:10px;bottom:0;right:0;cursor:se-resize;z-index:10}.bim-dialog-resize-handle:after{content:"";position:absolute;bottom:3px;right:3px;width:6px;height:6px;border-right:2px solid var(--bim-text-tertiary);border-bottom:2px solid var(--bim-text-tertiary)}.bim-dialog-resize-handle:hover:after{border-color:var(--bim-text-primary)}.bim-info-dialog-content{padding:16px;font-family:sans-serif;color:#333}.bim-info-dialog-content h3{margin-top:0;margin-bottom:12px;border-bottom:1px solid #eee;padding-bottom:8px;color:#0078d4}.bim-info-dialog-content ul{list-style:none;padding:0;margin:0}.bim-info-dialog-content li{margin-bottom:8px;font-size:14px;display:flex}.bim-info-dialog-content li strong{width:80px;color:#555}.bim-right-key{position:fixed;z-index:10000;display:none;background:transparent}.bim-right-key.visible{display:block}.bim-menu{display:flex;flex-direction:column;background:var(--bim-bg-elevated);border-radius:4px;padding:4px 0;margin:0;list-style:none;min-width:160px;box-shadow:var(--bim-shadow-lg);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;-webkit-user-select:none;user-select:none;color:var(--bim-text-primary)}.bim-menu-group{display:flex;flex-direction:column}.bim-menu-divider{height:1px;background-color:var(--bim-divider);margin:4px 0}.bim-menu-item{display:flex;align-items:center;padding:6px 12px;cursor:pointer;transition:background-color .2s;font-size:13px;position:relative;color:var(--bim-text-primary)}.bim-menu-item:hover{background-color:var(--bim-component-bg-hover)}.bim-menu-item.disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.bim-menu-item-icon{width:16px;height:16px;margin-right:8px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.bim-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.bim-menu-item-label{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bim-menu-item-arrow{width:12px;height:12px;margin-left:8px;display:flex;align-items:center;justify-content:center;opacity:.7}.bim-menu-item-arrow svg{width:100%;height:100%;fill:currentColor}.bim-tree{width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;font-size:14px;color:var(--bim-text-primary);-webkit-user-select:none;user-select:none;position:relative;background:transparent}.bim-tree-search{padding:6px;background-color:transparent;flex-shrink:0;position:relative}.bim-tree-search-wrapper{position:relative;width:100%;display:flex;align-items:center}.bim-tree-search-icon{position:absolute;left:8px;width:16px;height:16px;color:var(--bim-text-secondary);pointer-events:none;display:flex;align-items:center;justify-content:center}.bim-tree-search-icon svg{width:100%;height:100%}.bim-tree-search-input{width:100%;height:30px;padding:4px 8px 4px 30px;border:1px solid var(--bim-border-default);border-radius:4px;outline:none;font-size:13px;color:inherit;background-color:var(--bim-bg-elevated);transition:all .2s;box-sizing:border-box}.bim-tree-search-input:focus{border-color:var(--bim-primary);box-shadow:var(--bim-focus-ring)}.bim-tree-search-results{position:absolute;top:100%;left:8px;right:8px;background-color:var(--bim-bg-elevated);border:1px solid var(--bim-border-default);box-shadow:var(--bim-shadow-md);border-radius:4px;max-height:200px;overflow-y:auto;z-index:10;display:none}.bim-tree-search-results.is-visible{display:block}.bim-tree-search-item{padding:8px 12px;cursor:pointer;border-bottom:1px solid rgba(0,0,0,.03)}.bim-tree-search-item:last-child{border-bottom:none}.bim-tree-search-item:hover{background-color:var(--bim-component-bg-hover)}.bim-tree-search-item-title{font-weight:500;display:block}.bim-tree-search-item-path{font-size:12px;color:var(--bim-text-secondary);margin-top:2px;display:block}.bim-tree-content{flex:1;overflow-y:auto;padding:2px 0;min-height:0}.bim-tree-node{display:flex;flex-direction:column}.bim-tree-node-content{display:flex;align-items:center;height:32px;cursor:pointer;transition:background-color .2s;border-radius:4px;padding-right:8px}.bim-tree-node-content:hover{background-color:var(--bim-component-bg-hover)}.bim-tree-switcher{width:24px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;color:var(--bim-text-secondary);transition:transform .2s;flex-shrink:0}.bim-tree-switcher svg{width:12px;height:12px;fill:currentColor;transition:transform .2s}.bim-tree-switcher.is-expanded svg{transform:rotate(90deg)}.bim-tree-switcher.is-hidden{visibility:hidden}.bim-tree-checkbox{width:16px;height:16px;border:1px solid var(--bim-border-default);border-radius:2px;margin-right:8px;background-color:var(--bim-bg-elevated);position:relative;cursor:pointer;flex-shrink:0;transition:all .2s}.bim-tree-checkbox:hover{border-color:var(--bim-primary)}.bim-tree-checkbox.is-checked{background-color:var(--bim-primary);border-color:var(--bim-primary)}.bim-tree-checkbox.is-checked:after{content:"";position:absolute;top:1px;left:4px;width:5px;height:9px;border:2px solid var(--bim-text-inverse);border-top:0;border-left:0;transform:rotate(45deg)}.bim-tree-checkbox.is-indeterminate{background-color:var(--bim-bg-elevated);border-color:var(--bim-primary)}.bim-tree-checkbox.is-indeterminate:after{content:"";position:absolute;top:6px;left:3px;width:8px;height:2px;background-color:var(--bim-primary)}.bim-tree-node.is-disabled .bim-tree-checkbox{background-color:var(--bim-component-bg-disabled);border-color:var(--bim-border-disabled);cursor:not-allowed}.bim-tree-node.is-disabled .bim-tree-checkbox.is-checked{background-color:var(--bim-text-disabled)}.bim-tree-node.is-disabled .bim-tree-node-content{color:var(--bim-text-disabled);cursor:not-allowed}.bim-tree-icon{width:16px;height:16px;margin-right:6px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.bim-tree-icon img,.bim-tree-icon svg{width:100%;height:100%}.bim-tree-title{flex:1;white-space:nowrap}.bim-tree-children{display:none;overflow:visible}.bim-tree-children.is-visible{display:block}.bim-tree-node-content.is-selected{background-color:var(--bim-component-bg-selected);color:var(--bim-primary)}.bim-tree-node-actions{display:none;align-items:center;margin-left:8px;flex-shrink:0}.bim-tree-node-content.is-selected .bim-tree-node-actions{display:flex}.bim-tree-content{flex:1;overflow:auto;padding:2px 0;min-height:0}.bim-tree-node{display:flex;flex-direction:column;width:fit-content;min-width:100%}.bim-tree-node-content{display:flex;align-items:center;height:32px;cursor:pointer;transition:background-color .2s;border-radius:4px;padding-right:8px;width:fit-content;min-width:100%;box-sizing:border-box}.bim-tab{display:flex;flex-direction:column;width:100%;height:100%;background:transparent;color:var(--bim-tab-text, #e6e6e6)}.bim-tab__nav{display:flex;align-items:center;justify-content:space-around;background:transparent}.bim-tab__item{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:4px 0;border:none;border-radius:0;background:transparent;color:var(--bim-tab-text, #e6e6e6);cursor:pointer;transition:all .2s ease;font-size:14px;border-bottom:4px solid transparent}.bim-tab__item:hover{color:var(--bim-tab-text, #e6e6e6);background-color:var(--bim-tab-hover-bg, rgba(255, 255, 255, .05));border-bottom-color:var(--bim-tab-hover-bg, rgba(255, 255, 255, .15))}.bim-tab__item.is-active{color:var(--bim-tab-text-active, #4da3ff);border-bottom-color:var(--bim-tab-text-active, #4da3ff)}.bim-tab__item.is-disabled{opacity:.5;cursor:not-allowed}.bim-tab__icon{width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;color:var(--bim-tab-icon, currentColor)}.bim-tab__icon svg{width:100%;height:100%;fill:currentColor}.bim-tab__title{white-space:nowrap}.bim-tab__content{flex:1;display:flex;position:relative;min-height:0;overflow:hidden}.bim-tab__panel{display:none;width:100%;height:100%;flex:1}.bim-tab__panel.is-active{display:flex;flex-direction:column;height:100%}.construct-tab__container{height:100%;display:flex;flex-direction:column}.construct-tab__panel-content{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden}.construct-tab__panel-content .bim-tree{flex:1}.bim-collapse{background-color:var(--bim-bg-color, #ffffff);border:1px solid var(--bim-border-color, #d9d9d9);border-radius:4px;font-size:14px;color:var(--bim-text-color, rgba(0, 0, 0, .88))}.bim-collapse.is-ghost{background-color:transparent;border:none}.bim-collapse.is-ghost .bim-collapse-item{border-bottom:none}.bim-collapse.is-ghost .bim-collapse-header{background-color:transparent;padding-left:0;padding-right:0}.bim-collapse.is-ghost .bim-collapse-content{background-color:transparent;border-top:none}.bim-collapse-item{border-bottom:1px solid var(--bim-border-color, #d9d9d9)}.bim-collapse-item:last-child{border-bottom:none}.bim-collapse-item.is-disabled .bim-collapse-header{color:var(--bim-disabled-color, rgba(0, 0, 0, .25));cursor:not-allowed}.bim-collapse-header{display:flex;align-items:center;padding:12px 16px;background-color:var(--bim-header-bg-color, rgba(0, 0, 0, .02));cursor:pointer;transition:all .3s;position:relative}.bim-collapse-header:hover{background-color:var(--bim-header-hover-bg-color, rgba(0, 0, 0, .05))}.bim-collapse-arrow{margin-right:12px;font-size:12px;width:12px;height:12px;transition:transform .24s;display:inline-flex;align-items:center;justify-content:center}.bim-collapse-arrow svg{width:100%;height:100%;fill:currentColor}.bim-collapse-item.is-active .bim-collapse-arrow{transform:rotate(90deg)}.bim-collapse-icon{margin-right:8px;display:inline-flex;align-items:center}.bim-collapse-icon svg{width:16px;height:16px;fill:currentColor}.bim-collapse-title{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bim-collapse-extra{margin-left:auto}.bim-collapse-content{overflow:hidden;background-color:var(--bim-content-bg-color, #ffffff);border-top:1px solid var(--bim-border-color, #d9d9d9);transition:height .2s ease-in-out,opacity .2s ease-in-out}.bim-collapse-content.is-hidden{display:none}.bim-description{display:flex;flex-direction:column;width:100%;font-size:var(--bim-desc-font-size, 14px);color:var(--bim-text-color, #333);padding:0}.bim-description-item{display:flex;align-items:stretch;padding:0;line-height:1.5}.bim-description.is-bordered{border-bottom:none}.bim-description.is-bordered .bim-description-item{border-bottom:1px solid var(--bim-border-color, #eee)}.bim-description-label{color:var(--bim-desc-label-color, var(--bim-label-color, #666));flex-shrink:0;padding:var(--bim-desc-label-padding, 4px 4px);display:flex;align-items:center}.bim-description.is-bordered .bim-description-label{border-right:1px solid var(--bim-border-color, #eee)}.bim-description-value{color:var(--bim-desc-value-color, var(--bim-value-color, #333));flex:1;word-break:break-all;padding:var(--bim-desc-value-padding, 4px 4px);display:flex;align-items:center}.bim-measure-panel{width:100%;display:flex;flex-direction:column;box-sizing:border-box;color:var(--bim-dialog-text-color, #ccc)}.bim-measure-settings{display:none;box-sizing:border-box;color:var(--bim-dialog-text-color, #ccc)}.bim-measure-settings-title{font-size:14px;font-weight:600;margin-bottom:10px}.bim-measure-settings-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}.bim-measure-settings-row .label{color:var(--bim-measure-label-color, rgba(255, 255, 255, .7));font-size:13px;flex:0 0 auto}.bim-measure-settings-select{flex:0 0 auto;width:120px;height:28px;border-radius:4px;border:1px solid var(--bim-measure-border, rgba(255, 255, 255, .12));background:#0000001f;color:var(--bim-dialog-text-color, #ccc);padding:0 8px;box-sizing:border-box;outline:none}.bim-measure-settings-hint{font-size:12px;line-height:1.4;color:var(--bim-measure-label-color, rgba(255, 255, 255, .7));margin-top:-4px;margin-bottom:8px}.bim-measure-settings-actions{margin-top:14px;display:flex;justify-content:flex-start;gap:10px}.bim-measure-settings-save,.bim-measure-settings-cancel{flex:0 0 auto!important;width:auto;min-width:0;height:30px;padding:0 12px;border-radius:4px;cursor:pointer;box-sizing:border-box}.bim-measure-settings-save{border:none;background:var(--bim-measure-primary, #0078d4);color:#fff}.bim-measure-settings-cancel{border:1px solid var(--bim-measure-border, rgba(255, 255, 255, .12));background:transparent;color:var(--bim-dialog-text-color, #ccc)}.bim-measure-settings-save:hover,.bim-measure-settings-save:active,.bim-measure-settings-save:focus,.bim-measure-settings-cancel:hover,.bim-measure-settings-cancel:active,.bim-measure-settings-cancel:focus{background:inherit;outline:none}.bim-measure-settings-save:hover{background:var(--bim-measure-primary-hover, #0063b1)}.bim-measure-tools{display:flex;flex-direction:column;gap:8px}.bim-measure-tool-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.bim-measure-tool-btn{width:100%;height:42px;border-radius:6px;border:1px solid var(--bim-measure-border, rgba(255, 255, 255, .12));background:var(--bim-measure-btn-bg, rgba(255, 255, 255, .06));cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .15s ease,border-color .15s ease;padding:0;box-sizing:border-box}.bim-measure-tool-btn:hover{background:var(--bim-measure-btn-hover-bg, rgba(255, 255, 255, .1))}.bim-measure-tool-btn.is-active{border-color:var(--bim-measure-active-border, rgba(255, 255, 255, .3));background:var(--bim-measure-btn-active-bg, rgba(255, 255, 255, .14))}.bim-measure-tool-icon{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;color:var(--bim-measure-icon-color, #ddd)}.bim-measure-tool-icon svg{width:100%;height:100%;fill:currentColor}.bim-measure-toggle{display:flex;justify-content:flex-end}.bim-measure-toggle-btn{height:22px;border-radius:4px;border:1px solid var(--bim-measure-border, rgba(255, 255, 255, .12));background:var(--bim-measure-btn-bg, rgba(255, 255, 255, .06));cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background-color .15s ease;padding:0 6px;gap:4px;font-size:12px;line-height:1}.bim-measure-toggle-btn:hover{background:var(--bim-measure-btn-hover-bg, rgba(255, 255, 255, .1))}.bim-measure-toggle-text{color:var(--bim-measure-label-color, rgba(255, 255, 255, .7))}.bim-measure-toggle-icon svg{width:14px;height:14px;fill:currentColor;color:var(--bim-measure-icon-color, #ddd);transition:transform .15s ease}.bim-measure-toggle-btn.is-expanded .bim-measure-toggle-icon svg{transform:rotate(180deg)}.bim-measure-result{margin-top:12px;padding-top:12px;border-top:1px solid var(--bim-measure-divider, rgba(255, 255, 255, .1));display:flex;flex-direction:column;gap:10px}.bim-measure-row{display:flex;align-items:baseline;gap:8px;font-size:13px;line-height:1.4}.bim-measure-row .label{color:var(--bim-measure-label-color, rgba(255, 255, 255, .7));min-width:84px}.bim-measure-row .value{color:var(--bim-measure-value-color, rgba(255, 255, 255, .9));flex:1;word-break:break-word}.bim-measure-main-number{color:#ffd24a}.bim-measure-main-number.is-laser-text,.bim-measure-main-unit{color:var(--bim-measure-value-color, rgba(255, 255, 255, .9))}.bim-measure-xyz{display:flex;flex-direction:column;gap:6px}.bim-measure-xyz .value{font-variant-numeric:tabular-nums}.bim-measure-xyz-x{color:#ff4d4f!important}.bim-measure-xyz-y{color:#52c41a!important}.bim-measure-xyz-z{color:#1677ff!important}.bim-measure-footer{margin-top:12px;padding-top:10px;border-top:1px solid var(--bim-measure-divider, rgba(255, 255, 255, .1));display:flex;align-items:center;justify-content:flex-start;gap:10px}.bim-measure-clear-btn{background:transparent;border:none;color:var(--bim-measure-danger, white);cursor:pointer;padding:0;font-size:13px;flex:0 0 auto!important;width:auto;min-width:0}.bim-measure-clear-btn:hover,.bim-measure-clear-btn:active,.bim-measure-clear-btn:focus{background:transparent;border:none;outline:none;text-decoration:none}.bim-measure-settings-btn{width:24px;height:24px;border-radius:4px;border:none;background:transparent;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0;margin-left:auto;flex:0 0 auto!important}.bim-measure-settings-btn:hover,.bim-measure-settings-btn:active,.bim-measure-settings-btn:focus{background:transparent;border:none;outline:none}.bim-measure-settings-btn svg{width:18px;height:18px;fill:currentColor;color:var(--bim-measure-icon-color, #ddd)}.section-plane-panel{display:flex;gap:8px;padding:12px 12px 16px;box-sizing:border-box}.section-plane-btn{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:8px;border:1px solid transparent;background:var(--bim-section-btn-bg, rgba(255, 255, 255, .06));border-radius:4px;cursor:pointer;transition:background-color .2s ease,border-color .2s ease,color .2s ease;min-width:60px;outline:none;color:var(--bim-text-color, rgba(255, 255, 255, .9))}.section-plane-btn:hover{background:var(--bim-section-btn-hover, rgba(255, 255, 255, .1))}.section-plane-btn:active{background:var(--bim-section-btn-active, rgba(255, 255, 255, .14));border-color:var(--bim-text-active-color, #fff);color:var(--bim-text-active-color, #fff)}.section-plane-btn-icon{width:24px;height:24px;display:flex;align-items:center;justify-content:center;color:var(--bim-icon-color, #ccc)}.section-plane-btn-icon svg{width:100%;height:100%;fill:currentColor}.section-plane-btn-label{font-size:12px;color:inherit;text-align:center;line-height:1.2}.section-axis-panel{display:flex;flex-direction:column;gap:8px;padding:12px 12px 16px;box-sizing:border-box}.section-axis-row-1{display:flex;gap:8px;padding-bottom:8px;border-bottom:1px solid rgba(255,255,255,.1)}.section-axis-row-2{display:flex;gap:8px;padding-top:8px}.section-axis-btn{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:8px;background:var(--bim-section-axis-btn-bg, rgba(255, 255, 255, .06));border:1px solid transparent;border-radius:4px;cursor:pointer;transition:all .2s;outline:none;color:var(--bim-text-color, rgba(255, 255, 255, .9));min-height:48px}.section-axis-btn:hover{background:var(--bim-section-axis-btn-hover, rgba(255, 255, 255, .1))}.section-axis-btn.active{background:var(--bim-section-axis-btn-active, rgba(255, 255, 255, .14));border-color:var(--bim-text-active-color, #fff);color:var(--bim-text-active-color, #fff)}.section-axis-btn-icon{width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;color:var(--bim-icon-color, #ccc)}.section-axis-btn-icon svg{width:100%;height:100%}.section-axis-btn-label{font-size:12px;color:inherit;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}.section-axis-btn-text{min-height:40px}.section-axis-btn-text .section-axis-btn-label{font-size:18px;font-weight:600}.section-box-panel{display:flex;flex-direction:column;padding:12px;box-sizing:border-box;-webkit-user-select:none;user-select:none}.section-box-row-buttons{display:flex;gap:6px;padding-bottom:12px;border-bottom:1px solid rgba(255,255,255,.1)}.section-box-btn{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:6px;background:var(--bim-section-box-btn-bg);border:1px solid transparent;border-radius:4px;cursor:pointer;color:var(--bim-text-color);min-height:44px;transition:all .2s}.section-box-btn:hover{background:var(--bim-section-box-btn-hover)}.section-box-btn.active{background:var(--bim-section-box-btn-active);border-color:var(--bim-text-active-color);color:var(--bim-text-active-color)}.section-box-btn-icon{width:24px;height:24px;color:var(--bim-icon-color)}.section-box-btn-icon svg{width:100%;height:100%}.section-box-btn-label{font-size:11px;white-space:nowrap}.section-box-sliders{display:flex;flex-direction:column;gap:16px;padding-top:16px}.section-box-slider{display:flex;align-items:center;gap:12px;position:relative;z-index:1}.section-box-slider:hover{z-index:10}.section-box-slider-label{font-size:13px;font-weight:700;color:var(--bim-text-color);min-width:14px}.section-box-slider-track{position:relative;flex:1;height:4px;background:#ffffff1a;border-radius:2px}.section-box-slider-range{position:absolute;top:0;height:100%;background:var(--bim-primary-color);border-radius:2px;pointer-events:none}.section-box-slider-handle{position:absolute;top:50%;width:14px;height:14px;background:#fff;border:2px solid var(--bim-primary-color);border-radius:50%;transform:translate(-50%,-50%);cursor:grab;z-index:5;touch-action:none;transition:transform .2s,box-shadow .2s}.section-box-slider-handle:hover{transform:translate(-50%,-50%) scale(1.2);box-shadow:0 0 0 4px #1890ff33}.section-box-slider-handle.dragging{cursor:grabbing;transform:translate(-50%,-50%) scale(1.2);background:var(--bim-primary-color)}.walk-control-panel{display:flex;align-items:center;gap:20px;padding:8px 16px;background:var(--bim-walk-control-bg, rgba(0, 0, 0, .8));border-radius:8px;-webkit-user-select:none;user-select:none}.walk-divider{width:1px;height:40px;background:var(--bim-divider-color, rgba(255, 255, 255, .2));flex-shrink:0}.walk-control-left{display:flex;gap:8px}.walk-icon-btn{width:48px;height:48px;display:flex;align-items:center;justify-content:center;background:transparent;border:2px solid transparent;border-radius:6px;cursor:pointer;transition:all .2s;color:var(--bim-icon-color, #ccc);padding:8px}.walk-icon-btn:hover{background:var(--bim-walk-btn-hover, rgba(255, 255, 255, .15))}.walk-icon-btn.active{background:var(--bim-walk-btn-active, rgba(255, 255, 255, .3))}.walk-icon-btn svg{width:32px;height:32px}.walk-control-settings{display:flex;align-items:center;gap:16px;flex:1}.walk-speed-control{display:flex;align-items:center;gap:12px}.walk-speed-label{color:var(--bim-text-color, #fff);font-size:14px;white-space:nowrap}.walk-speed-group{display:flex;align-items:center;gap:8px;background:var(--bim-speed-group-bg, rgba(255, 255, 255, .1));border-radius:4px;padding:4px}.walk-speed-btn{width:32px;height:32px;background:var(--bim-speed-btn-bg, rgba(255, 255, 255, .1));border:none;border-radius:4px;color:var(--bim-text-color, #fff);font-size:18px;cursor:pointer;transition:background .2s}.walk-speed-btn:hover{background:var(--bim-speed-btn-hover, rgba(255, 255, 255, .2))}.walk-speed-btn:disabled{opacity:.5;cursor:not-allowed}.walk-speed-display{min-width:40px;text-align:center;color:var(--bim-text-color, #fff);font-size:14px;font-weight:700}.walk-checkbox-wrapper{display:flex;align-items:center;gap:8px;cursor:pointer}.walk-checkbox{width:18px;height:18px;cursor:pointer}.walk-checkbox:disabled{opacity:.5;cursor:not-allowed}.walk-checkbox-label{color:var(--bim-text-color, #fff);font-size:14px;white-space:nowrap}.walk-checkbox-wrapper input:disabled+.walk-checkbox-label{opacity:.5}.walk-select-wrapper{display:flex;align-items:center;gap:8px}.walk-select-label{color:var(--bim-text-color, #fff);font-size:14px;white-space:nowrap}.walk-select{padding:6px 12px;background:var(--bim-select-bg, rgba(255, 255, 255, .1));border:1px solid var(--bim-select-border, rgba(255, 255, 255, .2));border-radius:4px;color:var(--bim-text-color, #fff);font-size:14px;cursor:pointer;min-width:120px}.walk-select option{background:var(--bim-select-option-bg, #333);color:var(--bim-text-color, #fff)}.walk-exit-btn{padding:10px 24px;background:var(--bim-primary-color, #1890ff);border:none;border-radius:6px;color:#fff;font-size:14px;font-weight:600;cursor:pointer;transition:all .2s;white-space:nowrap}.walk-exit-btn:hover{background:var(--bim-primary-hover, #40a9ff)}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
||
(function(Hi,Ds){typeof exports=="object"&&typeof module<"u"?Ds(exports):typeof define=="function"&&define.amd?define(["exports"],Ds):(Hi=typeof globalThis<"u"?globalThis:Hi||self,Ds(Hi.LyzBimEngineSDK={}))})(this,(function(Hi){"use strict";const Ds={common:{title:"BimEngine",description:"这是一个使用 BIM-ENGINE。",openTestDialog:"打开测试弹窗",openInfoDialog:"打开信息弹窗 (封装版)"},toolbar:{home:"首页",measure:"测量",zoomBox:"选框放大",info:"信息",location:"定位",setting:"设置",walk:"漫游",map:"地图",property:"构件详情",fullscreen:"全屏",walkMenu:"漫游菜单",walkPerson:"第一人称",walkBird:"第三人称",tree:"模型树",section:"剖切",sectionPlane:"拾取面剖切",sectionAxis:"轴向剖切",sectionBox:"剖切盒"},dialog:{testTitle:"测试弹窗",testContent:'<div style="padding: 10px;">这是一个 <b>可拖拽</b> 且 <b>可缩放</b> 的弹窗。<br><br>你可以尝试拖动标题栏,或者拖动右下角改变大小。</div>'},menu:{info:"信息",home:"首页"},tree:{searchPlaceholder:"请输入要搜索的内容"},constructTree:{title:"目录树"},tab:{component:"构件",system:"系统",space:"空间"},panel:{property:{title:"构件详情",base:"基本属性",material:"材质信息",advanced:"高级设置",tab:{props:"属性",material:"材质"}}},measure:{btnName:"测量",dialogTitle:"测量",modes:{distance:"距离",minDistance:"最小距离",angle:"角度",elevation:"标高",volume:"体积",laserDistance:"激光测距",slope:"坡度",spaceVolume:"空间体积"},actions:{expand:"展开",collapse:"收起",clearAll:"删除全部",settings:"设置"},labels:{currentMode:"当前测量方式:",x:"X:",y:"Y:",z:"Z:",value:{distance:"距离:",minDistance:"最小距离:",angle:"角度:",elevation:"标高:",volume:"体积:",laserDistance:"激光测距:",slope:"坡度:",spaceVolume:"空间体积:"}},units:{mm:"mm",cm:"cm",m:"m",km:"km",deg:"°",m3:"m³",percent:"%"},settings:{title:"设置",unit:"单位:",precision:"精度:",hint:"距离、最小距离和标高默认使用该单位;角度和体积有各自默认单位。",save:"保存设置",cancel:"取消"}},sectionPlane:{dialogTitle:"拾取面剖切",actions:{hide:"隐藏",reverse:"反向",reset:"重置"}},sectionAxis:{dialogTitle:"轴向剖切",actions:{hide:"隐藏",reverse:"反向",axisX:"X",axisY:"Y",axisZ:"Z"}},sectionBox:{dialogTitle:"剖切盒",actions:{hide:"隐藏",reverse:"反向",fitToModel:"适应",reset:"重置"},axes:{x:"X",y:"Y",z:"Z"}},walkControl:{speed:"移动速度:",gravity:"重力",collision:"碰撞",characterModel:{label:"建筑工人",constructionWorker:"建筑工人",officeMale:"办公室男性"},walkMode:{label:"行走模式",walk:"行走模式",run:"奔跑模式"},exit:"退出",path:{dialogTitle:"路径漫游"}},map:{dialogTitle:"地图"}},vf={common:{title:"BimEngine",description:"This is a BIM-ENGINE demo.",openTestDialog:"Open Test Dialog",openInfoDialog:"Open Info Dialog (Wrapped)"},toolbar:{home:"Home",measure:"Measure",zoomBox:"Zoom Box",info:"Info",location:"Location",setting:"Settings",walk:"Walk",map:"Map",property:"Property",fullscreen:"Fullscreen",walkPerson:"Person",walkBird:"Bird Eye",walkMenu:"Menu",tree:"Tree",section:"Section",sectionPlane:"Plane Section",sectionAxis:"Axis Section",sectionBox:"Section Box"},dialog:{testTitle:"Test Dialog",testContent:'<div style="padding: 10px;">This is a <b>draggable</b> and <b>resizable</b> dialog.<br><br>Try dragging the title bar or resizing from the bottom-right corner.</div>'},menu:{info:"Info",home:"Home"},tree:{searchPlaceholder:"Please enter content to search"},constructTree:{title:"Construct Tree"},tab:{component:"Component",system:"System",space:"Space"},panel:{property:{title:"Component Details",base:"Basic Info",material:"Material",advanced:"Advanced",tab:{props:"Properties",material:"Material"}}},measure:{btnName:"Measure",dialogTitle:"Measure",modes:{distance:"Distance",minDistance:"Min Distance",angle:"Angle",elevation:"Elevation",volume:"Volume",laserDistance:"Laser Distance",slope:"Slope",spaceVolume:"Space Volume"},actions:{expand:"Expand",collapse:"Collapse",clearAll:"Clear All",settings:"Settings"},labels:{currentMode:"Mode:",x:"X:",y:"Y:",z:"Z:",value:{distance:"Distance:",minDistance:"Min Distance:",angle:"Angle:",elevation:"Elevation:",volume:"Volume:",laserDistance:"Laser Distance:",slope:"Slope:",spaceVolume:"Space Volume:"}},units:{mm:"mm",cm:"cm",m:"m",km:"km",deg:"°",m3:"m³",percent:"%"},settings:{title:"Settings",unit:"Unit:",precision:"Precision:",hint:"Distance, min distance and elevation use this unit by default; angle and volume use their own units.",save:"Save",cancel:"Cancel"}},sectionPlane:{dialogTitle:"Plane Section",actions:{hide:"Hide",reverse:"Reverse",reset:"Reset"}},sectionAxis:{dialogTitle:"Axis Section",actions:{hide:"Hide",reverse:"Reverse",axisX:"X",axisY:"Y",axisZ:"Z"}},sectionBox:{dialogTitle:"Section Box",actions:{hide:"Hide",reverse:"Reverse",fitToModel:"Fit",reset:"Reset"},axes:{x:"X",y:"Y",z:"Z"}},walkControl:{speed:"Speed:",gravity:"Gravity",collision:"Collision",characterModel:{label:"Construction Worker",constructionWorker:"Construction Worker",officeMale:"Office Male"},walkMode:{label:"Walk Mode",walk:"Walk",run:"Run"},exit:"Exit",path:{dialogTitle:"Path Walk"}},map:{dialogTitle:"Map"}};class xf{currentLocale="zh-CN";messages={"zh-CN":Ds,"en-US":vf};listeners=[];constructor(){}getLocale(){return this.currentLocale}setLocale(e){this.currentLocale!==e&&(this.currentLocale=e,this.notifyListeners())}t(e){if(!e)return"";const t=e.split(".");let n=this.messages[this.currentLocale];for(const i of t)if(n&&typeof n=="object"&&i in n)n=n[i];else return e;return n}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}notifyListeners(){this.listeners.forEach(e=>e(this.currentLocale))}}const Ht=new xf,Ae=s=>Ht.t(s),Dc={name:"light",primary:"#2563eb",primaryHover:"#1d4ed8",primaryActive:"#1e40af",primarySubtle:"rgba(37, 99, 235, 0.1)",success:"#16a34a",successHover:"#15803d",successSubtle:"rgba(22, 163, 74, 0.1)",warning:"#d97706",warningHover:"#b45309",warningSubtle:"rgba(217, 119, 6, 0.1)",danger:"#dc2626",dangerHover:"#b91c1c",dangerSubtle:"rgba(220, 38, 38, 0.1)",info:"#0891b2",infoHover:"#0e7490",infoSubtle:"rgba(8, 145, 178, 0.1)",bgBase:"#f8fafc",bgElevated:"#ffffff",bgOverlay:"rgba(255, 255, 255, 0.98)",bgInset:"#f1f5f9",bgGlass:"rgba(255, 255, 255, 0.8)",bgGlassBlur:"24px",textPrimary:"#0f172a",textSecondary:"#475569",textTertiary:"#94a3b8",textDisabled:"#cbd5e1",textInverse:"#ffffff",textLink:"#2563eb",textLinkHover:"#1d4ed8",iconDefault:"#64748b",iconHover:"#334155",iconActive:"#2563eb",iconDisabled:"#cbd5e1",iconInverse:"#ffffff",borderDefault:"#e2e8f0",borderSubtle:"#f1f5f9",borderStrong:"#cbd5e1",borderDisabled:"#f1f5f9",divider:"#e2e8f0",componentBg:"transparent",componentBgHover:"rgba(15, 23, 42, 0.04)",componentBgActive:"rgba(15, 23, 42, 0.08)",componentBgSelected:"rgba(37, 99, 235, 0.08)",componentBgDisabled:"#f8fafc",focusRing:"rgba(37, 99, 235, 0.5)",focusRingOffset:"#ffffff",selectionBg:"rgba(37, 99, 235, 0.15)",selectionText:"#0f172a",shadowSm:"0 2px 8px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08)",shadowMd:"0 4px 12px rgba(0, 0, 0, 0.12), 0 6px 20px rgba(0, 0, 0, 0.1)",shadowLg:"0 10px 25px rgba(0, 0, 0, 0.15), 0 6px 10px rgba(0, 0, 0, 0.1)",shadowXl:"0 20px 40px rgba(0, 0, 0, 0.2), 0 10px 15px rgba(0, 0, 0, 0.1)",shadowGlow:"0 2px 8px rgba(59, 130, 246, 0.3), 0 4px 16px rgba(59, 130, 246, 0.2)",scrollbarTrack:"#f1f5f9",scrollbarThumb:"#cbd5e1",scrollbarThumbHover:"#94a3b8",floatingBg:"rgba(255, 255, 255, 0.8)",floatingBorder:"rgba(226, 232, 240, 0.5)",floatingShadow:"0 4px 24px rgba(0, 0, 0, 0.06)",floatingBtnBg:"rgba(255, 255, 255, 0.9)",floatingBtnBorder:"rgba(203, 213, 225, 0.6)",floatingBtnShadow:"0 2px 8px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08)",floatingBtnBgHover:"#ffffff",floatingBtnShadowHover:"0 4px 12px rgba(0, 0, 0, 0.12), 0 6px 20px rgba(0, 0, 0, 0.1)",floatingIconColor:"#334155",floatingIconColorHover:"#1e293b",overrides:{dialog:{headerBg:"#f8fafc"},toolbar:{bg:"rgba(255, 255, 255, 0.9)",buttonBg:"rgba(255, 255, 255, 0.95)",buttonBgHover:"#ffffff",buttonBgActive:"#2563eb"},input:{bg:"#ffffff",bgFocus:"#ffffff",placeholder:"#94a3b8"}}},_f={name:"dark",primary:"#3b82f6",primaryHover:"#60a5fa",primaryActive:"#2563eb",primarySubtle:"rgba(59, 130, 246, 0.15)",success:"#22c55e",successHover:"#4ade80",successSubtle:"rgba(34, 197, 94, 0.15)",warning:"#f59e0b",warningHover:"#fbbf24",warningSubtle:"rgba(245, 158, 11, 0.15)",danger:"#ef4444",dangerHover:"#f87171",dangerSubtle:"rgba(239, 68, 68, 0.15)",info:"#06b6d4",infoHover:"#22d3ee",infoSubtle:"rgba(6, 182, 212, 0.15)",bgBase:"#152232",bgElevated:"#1f2d3e",bgOverlay:"rgba(21, 34, 50, 0.98)",bgInset:"#152232",bgGlass:"rgba(21, 34, 50, 0.85)",bgGlassBlur:"24px",textPrimary:"#ffffff",textSecondary:"#94a3b8",textTertiary:"#64748b",textDisabled:"#475569",textInverse:"#152232",textLink:"#60a5fa",textLinkHover:"#93c5fd",iconDefault:"#ffffff",iconHover:"#ffffff",iconActive:"#3b82f6",iconDisabled:"#475569",iconInverse:"#152232",borderDefault:"rgba(51, 65, 85, 0.5)",borderSubtle:"rgba(51, 65, 85, 0.5)",borderStrong:"#475569",borderDisabled:"#1e293b",divider:"#334155",componentBg:"transparent",componentBgHover:"rgba(248, 250, 252, 0.06)",componentBgActive:"rgba(248, 250, 252, 0.1)",componentBgSelected:"rgba(59, 130, 246, 0.2)",componentBgDisabled:"#1e293b",focusRing:"rgba(59, 130, 246, 0.5)",focusRingOffset:"#1e293b",selectionBg:"rgba(59, 130, 246, 0.3)",selectionText:"#f8fafc",shadowSm:"0 2px 8px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3)",shadowMd:"0 4px 12px rgba(0, 0, 0, 0.5), 0 6px 20px rgba(0, 0, 0, 0.4)",shadowLg:"0 10px 25px rgba(0, 0, 0, 0.6), 0 6px 10px rgba(0, 0, 0, 0.4)",shadowXl:"0 20px 40px rgba(0, 0, 0, 0.7), 0 10px 15px rgba(0, 0, 0, 0.5)",shadowGlow:"0 2px 8px rgba(59, 130, 246, 0.4), 0 4px 16px rgba(59, 130, 246, 0.25)",scrollbarTrack:"#1e293b",scrollbarThumb:"#475569",scrollbarThumbHover:"#64748b",floatingBg:"rgba(15, 23, 42, 0.85)",floatingBorder:"rgba(51, 65, 85, 0.4)",floatingShadow:"0 4px 24px rgba(0, 0, 0, 0.25)",floatingBtnBg:"rgba(51, 65, 85, 0.6)",floatingBtnBorder:"rgba(100, 116, 139, 0.5)",floatingBtnShadow:"0 2px 8px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25)",floatingBtnBgHover:"rgba(71, 85, 105, 0.7)",floatingBtnShadowHover:"0 4px 12px rgba(0, 0, 0, 0.35), 0 6px 20px rgba(0, 0, 0, 0.3)",floatingIconColor:"#e2e8f0",floatingIconColorHover:"#f8fafc",overrides:{dialog:{headerBg:"#0f172a"},toolbar:{bg:"rgba(30, 41, 59, 0.9)",buttonBg:"rgba(51, 65, 85, 0.6)",buttonBgHover:"rgba(71, 85, 105, 0.7)",buttonBgActive:"#3b82f6"},input:{bg:"#0f172a",bgFocus:"#1e293b",placeholder:"#64748b"}}};class bf{currentTheme=Dc;listeners=[];constructor(){}getTheme(){return this.currentTheme}setTheme(e){e==="light"?this.applyTheme(Dc):this.applyTheme(_f)}setCustomTheme(e){this.applyTheme(e)}applyTheme(e){this.currentTheme=e,this.notifyListeners()}subscribe(e){return this.listeners.push(e),e(this.currentTheme),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}notifyListeners(){this.listeners.forEach(e=>e(this.currentTheme))}}const st=new bf;class Va{container;options;groups=[];activeBtnIds=new Set;btnRefs=new Map;dropdownElement=null;hoverTimeout=null;customColors=new Set;unsubscribeLocale=null;unsubscribeTheme=null;engine=null;DEFAULT_ICON='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect></svg>';constructor(e){const t=typeof e.container=="string"?document.getElementById(e.container):e.container;if(!t)throw new Error("Container not found");this.container=t,this.options={showLabel:!0,visibility:{},direction:"row",position:"static",align:"vertical",expand:"down",...e},["backgroundColor","btnBackgroundColor","btnHoverColor","btnActiveColor","iconColor","iconActiveColor","textColor","textActiveColor"].forEach(i=>{e[i]&&this.customColors.add(i)}),this.initContainer(),this.applyStyles()}setEngine(e){this.engine=e}emit(e,t){this.engine?this.engine.emit(e,t):console.warn("[BimButtonGroup] Engine not set, cannot emit event:",e)}initContainer(){this.container.innerHTML="",this.container.classList.add("bim-btn-group-root"),this.options.direction==="column"?this.container.classList.add("dir-column"):this.container.classList.add("dir-row"),this.options.className&&this.container.classList.add(this.options.className),this.options.type&&this.options.type!=="default"&&this.container.classList.add(`type-${this.options.type}`),this.updatePosition(),this.setupEventInterception(this.container)}setupEventInterception(e){const t=i=>{i.stopPropagation()};["click","dblclick","contextmenu","wheel","mousedown","mouseup","mousemove","touchstart","touchend","touchmove","pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointerover","pointerout"].forEach(i=>{e.addEventListener(i,t,{passive:!1})})}updatePosition(){const e=this.options.position,t=this.container.style;if(t.top="",t.bottom="",t.left="",t.right="",t.transform="",e==="static"){this.container.classList.add("static");return}if(this.container.classList.remove("static"),this.container.style.position="absolute",typeof e=="object"&&"x"in e)t.left=`${e.x}px`,t.top=`${e.y}px`;else{const n="20px";switch(e){case"top-left":t.top=n,t.left=n;break;case"top-center":t.top=n,t.left="50%",t.transform="translateX(-50%)";break;case"top-right":t.top=n,t.right=n;break;case"bottom-left":t.bottom=n,t.left=n;break;case"bottom-center":t.bottom=n,t.left="50%",t.transform="translateX(-50%)";break;case"bottom-right":t.bottom=n,t.right=n;break;case"left-center":t.left=n,t.top="50%",t.transform="translateY(-50%)";break;case"right-center":t.right=n,t.top="50%",t.transform="translateY(-50%)";break;case"center":t.top="50%",t.left="50%",t.transform="translate(-50%, -50%)";break}}}applyStyles(){const e=this.container.style;this.options.backgroundColor&&e.setProperty("--bim-btn-group-section-bg",this.options.backgroundColor),this.options.btnBackgroundColor&&e.setProperty("--bim-btn-bg",this.options.btnBackgroundColor),this.options.btnHoverColor&&e.setProperty("--bim-btn-hover-bg",this.options.btnHoverColor),this.options.btnActiveColor&&e.setProperty("--bim-btn-active-bg",this.options.btnActiveColor),this.options.iconColor&&e.setProperty("--bim-icon-color",this.options.iconColor),this.options.iconActiveColor&&e.setProperty("--bim-icon-active-color",this.options.iconActiveColor),this.options.textColor&&e.setProperty("--bim-btn-text-color",this.options.textColor),this.options.textActiveColor&&e.setProperty("--bim-btn-text-active-color",this.options.textActiveColor),document.querySelectorAll(".opt-btn-dropdown").forEach(n=>{const i=n.style;this.options.iconColor&&i.setProperty("--bim-icon-color",this.options.iconColor),this.options.iconActiveColor&&i.setProperty("--bim-icon-active-color",this.options.iconActiveColor),this.options.textColor&&i.setProperty("--bim-btn-text-color",this.options.textColor),this.options.textActiveColor&&i.setProperty("--bim-btn-text-active-color",this.options.textActiveColor),this.options.btnBackgroundColor&&i.setProperty("--bim-btn-bg",this.options.btnBackgroundColor),this.options.btnHoverColor&&i.setProperty("--bim-btn-hover-bg",this.options.btnHoverColor),this.options.btnActiveColor&&i.setProperty("--bim-btn-active-bg",this.options.btnActiveColor)})}setPrimaryColor(e){this.container.style.setProperty("--bim-primary-color",e),document.querySelectorAll(".opt-btn-dropdown").forEach(n=>{n.style.setProperty("--bim-primary-color",e)})}setTheme(e){const t={backgroundColor:e.bgElevated,btnBackgroundColor:e.componentBg,btnHoverColor:e.componentBgHover,btnActiveColor:e.componentBgActive,iconColor:e.iconDefault,iconActiveColor:e.iconActive,textColor:e.textSecondary,textActiveColor:e.textPrimary};Object.entries(t).forEach(([n,i])=>{const r=n;this.customColors.has(r)||(this.options[r]=i)}),this.container.classList.remove("theme-dark","theme-light"),this.container.classList.add(`theme-${e.name}`),this.applyStyles(),this.setPrimaryColor(e.primary),this.applyThemeCssVars(e)}applyThemeCssVars(e){const t=this.container.style;t.setProperty("--bim-primary",e.primary),t.setProperty("--bim-primary-hover",e.primaryHover),t.setProperty("--bim-primary-active",e.primaryActive),t.setProperty("--bim-bg-glass",e.bgGlass),t.setProperty("--bim-bg-glass-blur",e.bgGlassBlur),t.setProperty("--bim-bg-elevated",e.bgElevated),t.setProperty("--bim-bg-overlay",e.bgOverlay),t.setProperty("--bim-bg-inset",e.bgInset),t.setProperty("--bim-text-primary",e.textPrimary),t.setProperty("--bim-text-secondary",e.textSecondary),t.setProperty("--bim-text-tertiary",e.textTertiary),t.setProperty("--bim-text-inverse",e.textInverse),t.setProperty("--bim-icon-default",e.iconDefault),t.setProperty("--bim-icon-hover",e.iconHover),t.setProperty("--bim-icon-active",e.iconActive),t.setProperty("--bim-icon-inverse",e.iconInverse),t.setProperty("--bim-border-default",e.borderDefault),t.setProperty("--bim-border-subtle",e.borderSubtle),t.setProperty("--bim-component-bg-hover",e.componentBgHover),t.setProperty("--bim-component-bg-active",e.componentBgActive),t.setProperty("--bim-shadow-sm",e.shadowSm),t.setProperty("--bim-shadow-md",e.shadowMd),t.setProperty("--bim-shadow-lg",e.shadowLg),t.setProperty("--bim-shadow-glow",e.shadowGlow),t.setProperty("--bim-floating-bg",e.floatingBg),t.setProperty("--bim-floating-border",e.floatingBorder),t.setProperty("--bim-floating-shadow",e.floatingShadow),t.setProperty("--bim-floating-btn-bg",e.floatingBtnBg),t.setProperty("--bim-floating-btn-border",e.floatingBtnBorder),t.setProperty("--bim-floating-btn-shadow",e.floatingBtnShadow),t.setProperty("--bim-floating-btn-bg-hover",e.floatingBtnBgHover),t.setProperty("--bim-floating-btn-shadow-hover",e.floatingBtnShadowHover),t.setProperty("--bim-floating-icon-color",e.floatingIconColor),t.setProperty("--bim-floating-icon-color-hover",e.floatingIconColorHover),this.syncDropdownCssVars(e)}syncDropdownCssVars(e){document.querySelectorAll(".opt-btn-dropdown").forEach(n=>{const i=n.style;i.setProperty("--bim-primary",e.primary),i.setProperty("--bim-bg-overlay",e.bgOverlay),i.setProperty("--bim-bg-glass-blur",e.bgGlassBlur),i.setProperty("--bim-border-subtle",e.borderSubtle),i.setProperty("--bim-text-primary",e.textPrimary),i.setProperty("--bim-text-inverse",e.textInverse),i.setProperty("--bim-icon-default",e.iconDefault),i.setProperty("--bim-icon-inverse",e.iconInverse),i.setProperty("--bim-component-bg-hover",e.componentBgHover),i.setProperty("--bim-component-bg-active",e.componentBgActive),i.setProperty("--bim-shadow-lg",e.shadowLg)})}setColors(e){this.options={...this.options,...e},Object.keys(e).forEach(t=>{this.customColors.add(t)}),this.applyStyles()}async init(){this.render(),this.unsubscribeLocale=Ht.subscribe(()=>{this.setLocales()}),this.unsubscribeTheme=st.subscribe(e=>{this.setTheme(e)})}setLocales(){this.render()}addGroup(e,t){if(this.groups.some(i=>i.id===e))return;const n={id:e,buttons:[]};if(t){const i=this.groups.findIndex(r=>r.id===t);i!==-1?this.groups.splice(i,0,n):this.groups.push(n)}else this.groups.push(n)}addButton(e){const{groupId:t,parentId:n}=e,i=this.groups.find(a=>a.id===t);if(!i)return;const r={...e,children:e.children||[]};if(n){const a=this.findButton(i.buttons,n);a&&(a.children||(a.children=[]),a.children.push(r))}else i.buttons.push(r)}findButton(e,t){for(const n of e){if(n.id===t)return n;if(n.children){const i=this.findButton(n.children,t);if(i)return i}}}render(){this.container.innerHTML="",this.btnRefs.clear(),this.groups.forEach((e,t)=>{const n=this.renderGroup(e,t,this.groups.length);this.container.appendChild(n)})}renderGroup(e,t,n){const i=document.createElement("div");return i.className="bim-btn-group-section",t<n-1&&i.classList.add("has-divider"),e.buttons.forEach(r=>{if(this.isVisible(r.id)){const a=this.renderButton(r);i.appendChild(a)}}),i}renderButton(e){const t=document.createElement("div");t.className="opt-btn-wrapper";const n=document.createElement("div");n.className="opt-btn",e.isActive&&this.activeBtnIds.add(e.id),(e.align||this.options.align||"vertical")==="horizontal"?n.classList.add("align-horizontal"):n.classList.add("align-vertical"),this.activeBtnIds.has(e.id)&&n.classList.add("active"),e.disabled&&n.classList.add("disabled"),this.options.showLabel&&e.label||(n.classList.add("no-label"),e.label&&(n.title=Ae(e.label)));const a=e.iconSize||32,o=e.minWidth||50;n.style.minWidth=`${o}px`;const l=document.createElement("div");l.className="opt-btn-icon",l.style.width=`${a}px`,l.style.height=`${a}px`,l.innerHTML=this.getIcon(e.icon),n.appendChild(l);const c=document.createElement("div");if(c.className="opt-btn-text-wrapper",this.options.showLabel&&e.label){const h=document.createElement("span");h.className="opt-btn-label",h.textContent=Ae(e.label),c.appendChild(h)}return c.hasChildNodes()&&n.appendChild(c),n.addEventListener("click",()=>this.handleClick(e)),n.addEventListener("mouseenter",()=>this.handleMouseEnter(e,n)),n.addEventListener("mouseleave",()=>this.handleMouseLeave()),this.btnRefs.set(e.id,n),t.appendChild(n),t}setBtnActive(e,t){const n=this.findButtonById(e);if(!n)return;const i=t!==void 0?t:!this.activeBtnIds.has(e);i?this.activeBtnIds.add(e):this.activeBtnIds.delete(e),n.isActive=i,this.updateButtonState(e)}handleClick(e){if(!e.disabled&&(!e.children||e.children.length===0)){if(e.keepActive){const n=!this.activeBtnIds.has(e.id);this.setBtnActive(e.id,n),n&&e.exclusive&&e.groupId&&this.deactivateExclusiveSiblings(e)}this.closeDropdown(),e.onClick&&e.onClick(e)}}deactivateExclusiveSiblings(e){const t=this.groups.find(n=>n.id===e.groupId);if(t){if(e.parentId){const i=this.findButton(t.buttons,e.parentId)?.children||[];for(const r of i)r&&r.id!==e.id&&r.parentId===e.parentId&&r.groupId===e.groupId&&this.activeBtnIds.has(r.id)&&(this.setBtnActive(r.id,!1),r.onClick&&r.onClick(r));return}for(const n of t.buttons)n.id!==e.id&&n.groupId===e.groupId&&(n.parentId||this.activeBtnIds.has(n.id)&&(this.setBtnActive(n.id,!1),n.onClick&&n.onClick(n)))}}handleMouseEnter(e,t){this.hoverTimeout&&clearTimeout(this.hoverTimeout),e.children&&e.children.length>0?this.showDropdown(e,t):this.closeDropdown()}handleMouseLeave(){this.hoverTimeout=window.setTimeout(()=>this.closeDropdown(),200)}showDropdown(e,t){if(this.closeDropdown(),!e.children)return;const n=document.createElement("div");n.className="opt-btn-dropdown",this.options.backgroundColor&&n.style.setProperty("--bim-toolbar-bg",this.options.backgroundColor);const i=n.style;this.options.iconColor&&i.setProperty("--bim-icon-color",this.options.iconColor),this.options.iconActiveColor&&i.setProperty("--bim-icon-active-color",this.options.iconActiveColor),this.options.textColor&&i.setProperty("--bim-btn-text-color",this.options.textColor),this.options.textActiveColor&&i.setProperty("--bim-btn-text-active-color",this.options.textActiveColor),this.options.btnBackgroundColor&&i.setProperty("--bim-btn-bg",this.options.btnBackgroundColor),this.options.btnHoverColor&&i.setProperty("--bim-btn-hover-bg",this.options.btnHoverColor),this.options.btnActiveColor&&i.setProperty("--bim-btn-active-bg",this.options.btnActiveColor);const r=t.getBoundingClientRect(),a=this.options.expand||"down";this.options.direction==="row"?n.style.flexDirection="column":n.style.flexDirection="row",this.options.type&&this.options.type!=="default"&&n.classList.add(`type-${this.options.type}`);const o=st.getTheme();n.classList.add(`theme-${o.name}`),document.body.appendChild(n),this.setupEventInterception(n),e.children.forEach(c=>{if(this.isVisible(c.id)){const h=this.renderDropdownItem(c);n.appendChild(h)}});const l=n.getBoundingClientRect();a==="up"?(n.style.bottom=window.innerHeight-r.top+8+"px",n.style.left=r.left+(r.width-l.width)/2+"px"):a==="down"?(n.style.top=r.bottom+8+"px",n.style.left=r.left+(r.width-l.width)/2+"px"):a==="right"?(n.style.top=r.top+(r.height-l.height)/2+"px",n.style.left=r.right+8+"px"):a==="left"&&(n.style.top=r.top+(r.height-l.height)/2+"px",n.style.right=window.innerWidth-r.left+8+"px"),n.addEventListener("mouseenter",()=>{this.hoverTimeout&&clearTimeout(this.hoverTimeout)}),n.addEventListener("mouseleave",()=>this.handleMouseLeave()),this.dropdownElement=n}renderDropdownItem(e){const t=document.createElement("div");t.className="opt-btn-dropdown-item",(e.align||"horizontal")==="horizontal"?t.classList.add("align-horizontal"):t.classList.add("align-vertical"),(this.activeBtnIds.has(e.id)||e.isActive)&&t.classList.add("active");const i=e.iconSize||32,r=e.minWidth;r&&(t.style.minWidth=`${r}px`);const a=document.createElement("div");if(a.className="opt-btn-icon",a.style.width=`${i}px`,a.style.height=`${i}px`,a.innerHTML=this.getIcon(e.icon),t.appendChild(a),this.options.showLabel&&e.label){const o=document.createElement("span");o.className="opt-btn-dropdown-label",o.textContent=Ae(e.label),t.appendChild(o)}else e.label&&(t.title=Ae(e.label));return t.addEventListener("click",o=>{o.stopPropagation(),this.handleClick(e)}),t}closeDropdown(){this.dropdownElement&&(this.dropdownElement.remove(),this.dropdownElement=null),this.btnRefs.forEach(e=>{const t=e.querySelector(".opt-btn-arrow");t&&t.classList.remove("rotated")})}updateButtonState(e){const t=this.btnRefs.get(e);t&&(this.activeBtnIds.has(e)?t.classList.add("active"):t.classList.remove("active"))}getIcon(e){return e||this.DEFAULT_ICON}updateButtonVisibility(e,t){this.options.visibility||(this.options.visibility={}),this.options.visibility[e]=t,this.render()}setShowLabel(e){this.options.showLabel=e,this.updateLabelsVisibility()}updateLabelsVisibility(){this.btnRefs.forEach((e,t)=>{const n=this.findButtonById(t);if(!n)return;this.options.showLabel&&n.label?(e.classList.remove("no-label"),e.removeAttribute("title")):(e.classList.add("no-label"),n.label&&(e.title=Ae(n.label)))})}findButtonById(e){for(const t of this.groups){const n=this.findButton(t.buttons,e);if(n)return n}}setBackgroundColor(e){this.setColors({backgroundColor:e})}isVisible(e){return this.options.visibility?.[e]!==!1}destroy(){this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.closeDropdown(),this.container.innerHTML="",this.btnRefs.clear()}}class yf extends Va{async init(){await super.init();const{createHomeButton:e}=await Promise.resolve().then(()=>X2),{createZoomBoxButton:t}=await Promise.resolve().then(()=>j2),{createWalkMenuButton:n}=await Promise.resolve().then(()=>Z2),{createMapButton:i}=await Promise.resolve().then(()=>q2),{createPropertyButton:r}=await Promise.resolve().then(()=>Y2),{createSettingButton:a}=await Promise.resolve().then(()=>K2),{createInfoButton:o}=await Promise.resolve().then(()=>J2),{createFullscreenButton:l}=await Promise.resolve().then(()=>Q2),{createMeasureButton:c}=await Promise.resolve().then(()=>eM),{createSectionMenuButton:h}=await Promise.resolve().then(()=>tM),{createSectionPlaneButton:u}=await Promise.resolve().then(()=>nM),{createSectionAxisButton:f}=await Promise.resolve().then(()=>iM),{createSectionBoxButton:d}=await Promise.resolve().then(()=>sM);this.addGroup("group-1"),this.engine?(this.addButton(e(this.engine)),this.addButton(t(this.engine)),this.addButton(c(this.engine)),this.addButton(h(this.engine)),this.addButton(u(this.engine)),this.addButton(f(this.engine)),this.addButton(d(this.engine)),this.addButton(n(this.engine)),this.addButton(i(this.engine)),this.addButton(r(this.engine)),this.addGroup("group-2"),this.addButton(a(this.engine)),this.addButton(o(this.engine)),this.addButton(l(this.engine))):console.warn("[Toolbar] Engine not available when creating buttons."),this.render()}}class en{engine;constructor(e){this.engine=e}emit(e,t){this.engine.emit(e,t)}on(e,t){return this.engine.on(e,t)}}class Mf extends en{toolbar=null;toolbarContainer=null;container;constructor(e,t){super(e),this.container=t,this.init()}init(){this.toolbarContainer=document.createElement("div"),this.toolbarContainer.id="opt-btn-groups",this.toolbarContainer.className="bim-engine-opt-btn-container is-bottom-toolbar",this.container.appendChild(this.toolbarContainer),this.toolbar=new yf({container:this.toolbarContainer,type:"glass-pill",showLabel:!0,direction:"row",position:"bottom-right",align:"vertical",expand:"up"}),this.toolbar.setEngine(this.engine),this.toolbar.init()}updateTheme(e){this.toolbar?.setTheme(e)}refresh(){this.toolbar?.render()}destroy(){this.toolbar?.destroy(),this.toolbar=null}addGroup(e,t){this.toolbar?.addGroup(e,t),this.toolbar?.render()}addButton(e){this.toolbar?.addButton(e),this.toolbar?.render()}setButtonVisibility(e,t){this.toolbar?.updateButtonVisibility(e,t)}setShowLabel(e){this.toolbar?.setShowLabel(e)}setBtnActive(e,t){this.toolbar?.setBtnActive(e,t)}setVisible(e){this.toolbarContainer&&(this.toolbarContainer.style.visibility=e?"visible":"hidden")}setBackgroundColor(e){this.toolbar?.setBackgroundColor(e)}setColors(e){this.toolbar?.setColors(e)}hide(){this.toolbarContainer&&(this.toolbarContainer.style.display="none")}show(){this.toolbarContainer&&(this.toolbarContainer.style.display="")}getContainer(){return this.toolbarContainer}}class wf extends en{groups=new Map;container;constructor(e,t){super(e),this.container=t}create(e,t){const n=new Va({container:this.container,...t});return n.setEngine(this.engine),n.init(),this.groups.set(e,n),n}get(e){return this.groups.get(e)}updateTheme(e){this.groups.forEach(t=>t.setTheme(e))}destroy(){this.groups.forEach(e=>e.destroy()),this.groups.clear()}}class Ic{element;options;container;header;contentArea;_isDestroyed=!1;_isInitialized=!1;unsubscribeTheme=null;unsubscribeLocale=null;rafId=null;constructor(e){this.options={title:"Dialog",width:300,height:"auto",position:"center",draggable:!0,resizable:!1,minWidth:200,minHeight:100,...e},this.container=e.container,this.element=this.createDom(),this.header=this.element.querySelector(".bim-dialog-header"),this.contentArea=this.element.querySelector(".bim-dialog-content"),this.init()}setTheme(e){const t=this.element.style;this.options.backgroundColor||t.setProperty("--bim-dialog-bg",e.bgElevated),this.options.headerBackgroundColor||t.setProperty("--bim-dialog-header-bg",e.bgInset),this.options.titleColor||t.setProperty("--bim-dialog-title-color",e.textPrimary),this.options.textColor||t.setProperty("--bim-dialog-text-color",e.textSecondary),this.options.borderColor||t.setProperty("--bim-dialog-border-color",e.borderDefault),t.setProperty("--bim-bg-elevated",e.bgElevated),t.setProperty("--bim-bg-inset",e.bgInset),t.setProperty("--bim-text-primary",e.textPrimary),t.setProperty("--bim-text-secondary",e.textSecondary),t.setProperty("--bim-text-tertiary",e.textTertiary),t.setProperty("--bim-border-default",e.borderDefault),t.setProperty("--bim-shadow-lg",e.shadowLg)}init(){this._isInitialized||(this.container.appendChild(this.element),this.initPosition(),this.options.draggable&&this.initDrag(),this.options.resizable&&this.initResize(),this._isInitialized=!0,this.options.onOpen&&this.options.onOpen(),this.unsubscribeTheme=st.subscribe(e=>{this.setTheme(e)}),this.unsubscribeLocale=Ht.subscribe(()=>{this.setLocales()}))}setLocales(){if(this.options.title){const e=this.header.querySelector(".bim-dialog-title");e&&(e.textContent=Ae(this.options.title))}}createDom(){const e=document.createElement("div");e.className="bim-dialog",this.options.id&&(e.id=this.options.id);const t=e.style;this.options.backgroundColor&&t.setProperty("--bim-dialog-bg",this.options.backgroundColor),this.options.headerBackgroundColor&&t.setProperty("--bim-dialog-header-bg",this.options.headerBackgroundColor),this.options.titleColor&&t.setProperty("--bim-dialog-title-color",this.options.titleColor),this.options.textColor&&t.setProperty("--bim-dialog-text-color",this.options.textColor),this.options.borderColor&&t.setProperty("--bim-dialog-border-color",this.options.borderColor),this.setSize(e,this.options.width,this.options.height),this.options.minWidth&&(e.style.minWidth=`${this.options.minWidth}px`);const n=document.createElement("div");n.className="bim-dialog-header",this.options.draggable&&n.classList.add("draggable");const i=document.createElement("span");i.className="bim-dialog-title",i.textContent=this.options.title?Ae(this.options.title):"";const r=document.createElement("span");r.className="bim-dialog-close",r.innerHTML="×",r.onclick=()=>{this.close()},n.appendChild(i),n.appendChild(r);const a=document.createElement("div");if(a.className="bim-dialog-content",typeof this.options.content=="string"?a.innerHTML=this.options.content:this.options.content instanceof HTMLElement&&a.appendChild(this.options.content),e.appendChild(n),e.appendChild(a),this.options.resizable){const c=document.createElement("div");c.className="bim-dialog-resize-handle",e.appendChild(c)}const o=c=>{c.stopPropagation()};return["click","dblclick","contextmenu","wheel","mousedown","mouseup","mousemove","touchstart","touchend","touchmove","pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointerover","pointerout"].forEach(c=>{e.addEventListener(c,o,{passive:!1})}),e}setSize(e,t,n){t!==void 0&&(t==="auto"||t==="fit-content"?e.style.width=t:e.style.width=typeof t=="number"?`${t}px`:t),n!==void 0&&(n==="auto"||n==="fit-content"?e.style.height=n:e.style.height=typeof n=="number"?`${n}px`:n)}fitWidth(e=!1){this.element.style.width="fit-content",e&&this.initPosition()}fitHeight(e=!1){this.element.style.height="auto";const t=this.element.getBoundingClientRect().height,n=this.options.minHeight??100,i=this.container.clientHeight||0;let r=Math.max(n,t);i>0&&(r=Math.min(r,i)),this.element.style.height=`${r}px`,e?this.initPosition():this.clampToContainer()}clampToContainer(){const e=this.container.clientWidth,t=this.container.clientHeight,n=this.element.offsetWidth,i=this.element.offsetHeight,r=this.element.offsetLeft,a=this.element.offsetTop,o=Math.max(0,e-n),l=Math.max(0,t-i),c=Math.max(0,Math.min(r,o)),h=Math.max(0,Math.min(a,l));this.element.style.left=`${c}px`,this.element.style.top=`${h}px`}initPosition(){const e=this.options.position,t=this.element.getBoundingClientRect();let n=0,i=0;const r=this.container.clientWidth,a=this.container.clientHeight,o=t.width,l=t.height;if(typeof e=="object"&&"x"in e)n=e.x,i=e.y;else switch(e){case"center":n=(r-o)/2,i=(a-l)/2;break;case"top-left":n=0,i=0;break;case"top-center":n=(r-o)/2,i=0;break;case"top-right":n=r-o,i=0;break;case"left-center":n=0,i=(a-l)/2;break;case"right-center":n=r-o,i=(a-l)/2;break;case"bottom-left":n=0,i=a-l;break;case"bottom-center":n=(r-o)/2,i=a-l;break;case"bottom-right":n=r-o,i=a-l;break;default:n=(r-o)/2,i=(a-l)/2}n=Math.max(0,Math.min(n,r-o)),i=Math.max(0,Math.min(i,a-l)),this.element.style.left=`${n}px`,this.element.style.top=`${i}px`}initDrag(){let e=0,t=0,n=0,i=0,r=0,a=0,o=0,l=0;const c=f=>{f.preventDefault(),f.stopPropagation(),e=f.clientX,t=f.clientY,n=this.element.offsetLeft,i=this.element.offsetTop,r=this.container.clientWidth,a=this.container.clientHeight,o=this.element.offsetWidth,l=this.element.offsetHeight,document.addEventListener("mousemove",h,{capture:!0}),document.addEventListener("mouseup",u,{capture:!0})},h=f=>{f.preventDefault(),f.stopPropagation(),!this.rafId&&(this.rafId=requestAnimationFrame(()=>{const d=f.clientX-e,p=f.clientY-t;let g=n+d,v=i+p;const m=r-o,x=a-l;g=Math.max(0,Math.min(g,m)),v=Math.max(0,Math.min(v,x)),this.element.style.left=`${g}px`,this.element.style.top=`${v}px`,this.rafId=null}))},u=()=>{this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),document.removeEventListener("mousemove",h,{capture:!0}),document.removeEventListener("mouseup",u,{capture:!0})};this.header.addEventListener("mousedown",c)}initResize(){const e=this.element.querySelector(".bim-dialog-resize-handle");if(!e)return;let t=0,n=0,i=0,r=0;const a=c=>{c.preventDefault(),c.stopPropagation(),t=c.clientX,n=c.clientY,i=this.element.offsetWidth,r=this.element.offsetHeight,document.addEventListener("mousemove",o,{capture:!0}),document.addEventListener("mouseup",l,{capture:!0})},o=c=>{c.preventDefault(),c.stopPropagation(),!this.rafId&&(this.rafId=requestAnimationFrame(()=>{const h=c.clientX-t,u=c.clientY-n,f=Math.max(this.options.minWidth||100,i+h),d=Math.max(this.options.minHeight||50,r+u);this.element.style.width=`${f}px`,this.element.style.height=`${d}px`,this.rafId=null}))},l=()=>{this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),document.removeEventListener("mousemove",o,{capture:!0}),document.removeEventListener("mouseup",l,{capture:!0})};e.addEventListener("mousedown",a)}setContent(e){this.contentArea.innerHTML="",typeof e=="string"?this.contentArea.innerHTML=e:this.contentArea.appendChild(e)}close(){this._isDestroyed||(this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.element.remove(),this._isDestroyed=!0,this.options.onClose&&this.options.onClose())}destroy(){this.close()}}class Sf extends Ic{constructor(e){const t=document.createElement("div");t.className="bim-info-dialog-content";const n=document.createElement("h3");n.textContent="Model Information";const i=document.createElement("ul");i.innerHTML=`
|
||
<li><strong>Name:</strong> Sample Project</li>
|
||
<li><strong>Version:</strong> 1.0.0</li>
|
||
<li><strong>Date:</strong> ${new Date().toLocaleDateString()}</li>
|
||
<li><strong>Status:</strong> <span style="color: green;">Active</span></li>
|
||
`;const r=document.createElement("button");r.textContent="Update Status",r.style.marginTop="10px",r.onclick=()=>{alert("Status updated!")},t.appendChild(n),t.appendChild(i),t.appendChild(r),super({container:e,title:"dialog.testTitle",content:t,width:320,height:"auto",position:"center",resizable:!0,draggable:!0,onClose:()=>{console.log("Info dialog closed")},onOpen:()=>{console.log("Info dialog opened")}})}}class Ef extends en{container;activeDialogs=[];constructor(e,t){super(e),this.container=t,this.on("ui:open-dialog",n=>{console.log("[DialogManager] Received open-dialog event:",n),n.id==="info"&&this.showInfoDialog()})}create(e){const t=new Ic({container:this.container,...e,onClose:()=>{this.activeDialogs=this.activeDialogs.filter(n=>n!==t),e.onClose&&e.onClose()}});return t.setTheme(st.getTheme()),this.activeDialogs.push(t),t}showInfoDialog(){new Sf(this.container)}updateTheme(e){this.activeDialogs.forEach(t=>{t.setTheme&&t.setTheme(e)})}destroy(){this.activeDialogs.forEach(e=>e.destroy()),this.activeDialogs=[]}}const Ga="182",Vi={ROTATE:0,DOLLY:1,PAN:2},Gi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Tf=0,Nc=1,Cf=2,br=1,Uc=2,Is=3,Nn=0,tn=1,Vt=2,kt=0,Wi=1,Wa=2,Bc=3,kc=4,Oc=5,wn=100,Af=101,Pf=102,Rf=103,Lf=104,Ns=200,Df=201,If=202,Nf=203,Xa=204,ja=205,Za=206,Uf=207,qa=208,Bf=209,kf=210,Of=211,Ff=212,zf=213,Hf=214,Ya=0,Ka=1,$a=2,Xi=3,Ja=4,Qa=5,eo=6,to=7,yr=0,Vf=1,Gf=2,Un=0,no=1,io=2,so=3,Mr=4,ro=5,ao=6,oo=7,Fc="attached",Wf="detached",zc=300,_i=301,ji=302,lo=303,co=304,wr=306,Bn=1e3,kn=1001,Sr=1002,Pt=1003,Hc=1004,Us=1005,It=1006,Er=1007,Kn=1008,nn=1009,Vc=1010,Gc=1011,Bs=1012,ho=1013,On=1014,vn=1015,Yt=1016,uo=1017,fo=1018,Zi=1020,Wc=35902,Xc=35899,jc=1021,Zc=1022,hn=1023,$n=1026,li=1027,po=1028,mo=1029,qi=1030,go=1031,vo=1033,Tr=33776,Cr=33777,Ar=33778,Pr=33779,xo=35840,_o=35841,bo=35842,yo=35843,Mo=36196,wo=37492,So=37496,Eo=37488,To=37489,Co=37490,Ao=37491,Po=37808,Ro=37809,Lo=37810,Do=37811,Io=37812,No=37813,Uo=37814,Bo=37815,ko=37816,Oo=37817,Fo=37818,zo=37819,Ho=37820,Vo=37821,Go=36492,Wo=36494,Xo=36495,jo=36283,Zo=36284,qo=36285,Yo=36286,ks=2300,Os=2301,Ko=2302,qc=2400,Yc=2401,Kc=2402,Xf=2500,jf=0,$c=1,$o=2,Zf=3200,Fs=0,qf=1,ci="",ft="srgb",wt="srgb-linear",Rr="linear",at="srgb",Yi=7680,Jc=519,Yf=512,Kf=513,$f=514,Jo=515,Jf=516,Qf=517,Qo=518,ep=519,el=35044,Qc="300 es",Fn=2e3,Lr=2001;function eh(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}function tp(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function zs(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function np(){const s=zs("canvas");return s.style.display="block",s}const th={};function Dr(...s){const e="THREE."+s.shift();console.log(e,...s)}function ze(...s){const e="THREE."+s.shift();console.warn(e,...s)}function Xe(...s){const e="THREE."+s.shift();console.error(e,...s)}function Hs(...s){const e=s.join(" ");e in th||(th[e]=!0,ze(...s))}function ip(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}class bi{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,e);e.target=null}}}const Gt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let nh=1234567;const Vs=Math.PI/180,Ki=180/Math.PI;function xn(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Gt[s&255]+Gt[s>>8&255]+Gt[s>>16&255]+Gt[s>>24&255]+"-"+Gt[e&255]+Gt[e>>8&255]+"-"+Gt[e>>16&15|64]+Gt[e>>24&255]+"-"+Gt[t&63|128]+Gt[t>>8&255]+"-"+Gt[t>>16&255]+Gt[t>>24&255]+Gt[n&255]+Gt[n>>8&255]+Gt[n>>16&255]+Gt[n>>24&255]).toLowerCase()}function Je(s,e,t){return Math.max(e,Math.min(t,s))}function tl(s,e){return(s%e+e)%e}function sp(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function rp(s,e,t){return s!==e?(t-s)/(e-s):0}function Gs(s,e,t){return(1-t)*s+t*e}function ap(s,e,t,n){return Gs(s,e,1-Math.exp(-t*n))}function op(s,e=1){return e-Math.abs(tl(s,e*2)-e)}function lp(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function cp(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function hp(s,e){return s+Math.floor(Math.random()*(e-s+1))}function up(s,e){return s+Math.random()*(e-s)}function dp(s){return s*(.5-Math.random())}function fp(s){s!==void 0&&(nh=s);let e=nh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function pp(s){return s*Vs}function mp(s){return s*Ki}function gp(s){return(s&s-1)===0&&s!==0}function vp(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function xp(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function _p(s,e,t,n,i){const r=Math.cos,a=Math.sin,o=r(t/2),l=a(t/2),c=r((e+n)/2),h=a((e+n)/2),u=r((e-n)/2),f=a((e-n)/2),d=r((n-e)/2),p=a((n-e)/2);switch(i){case"XYX":s.set(o*h,l*u,l*f,o*c);break;case"YZY":s.set(l*f,o*h,l*u,o*c);break;case"ZXZ":s.set(l*u,l*f,o*h,o*c);break;case"XZX":s.set(o*h,l*p,l*d,o*c);break;case"YXY":s.set(l*d,o*h,l*p,o*c);break;case"ZYZ":s.set(l*p,l*d,o*h,o*c);break;default:ze("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Sn(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function ot(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const ih={DEG2RAD:Vs,RAD2DEG:Ki,generateUUID:xn,clamp:Je,euclideanModulo:tl,mapLinear:sp,inverseLerp:rp,lerp:Gs,damp:ap,pingpong:op,smoothstep:lp,smootherstep:cp,randInt:hp,randFloat:up,randFloatSpread:dp,seededRandom:fp,degToRad:pp,radToDeg:mp,isPowerOfTwo:gp,ceilPowerOfTwo:vp,floorPowerOfTwo:xp,setQuaternionFromProperEuler:_p,normalize:ot,denormalize:Sn};class de{constructor(e=0,t=0){de.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Je(this.x,e.x,t.x),this.y=Je(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Je(this.x,e,t),this.y=Je(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Je(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Je(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class En{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,o){let l=n[i+0],c=n[i+1],h=n[i+2],u=n[i+3],f=r[a+0],d=r[a+1],p=r[a+2],g=r[a+3];if(o<=0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(o>=1){e[t+0]=f,e[t+1]=d,e[t+2]=p,e[t+3]=g;return}if(u!==g||l!==f||c!==d||h!==p){let v=l*f+c*d+h*p+u*g;v<0&&(f=-f,d=-d,p=-p,g=-g,v=-v);let m=1-o;if(v<.9995){const x=Math.acos(v),_=Math.sin(x);m=Math.sin(m*x)/_,o=Math.sin(o*x)/_,l=l*m+f*o,c=c*m+d*o,h=h*m+p*o,u=u*m+g*o}else{l=l*m+f*o,c=c*m+d*o,h=h*m+p*o,u=u*m+g*o;const x=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=x,c*=x,h*=x,u*=x}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,a){const o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],u=r[a],f=r[a+1],d=r[a+2],p=r[a+3];return e[t]=o*p+h*u+l*d-c*f,e[t+1]=l*p+h*f+c*u-o*d,e[t+2]=c*p+h*d+o*f-l*u,e[t+3]=h*p-o*u-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),u=o(r/2),f=l(n/2),d=l(i/2),p=l(r/2);switch(a){case"XYZ":this._x=f*h*u+c*d*p,this._y=c*d*u-f*h*p,this._z=c*h*p+f*d*u,this._w=c*h*u-f*d*p;break;case"YXZ":this._x=f*h*u+c*d*p,this._y=c*d*u-f*h*p,this._z=c*h*p-f*d*u,this._w=c*h*u+f*d*p;break;case"ZXY":this._x=f*h*u-c*d*p,this._y=c*d*u+f*h*p,this._z=c*h*p+f*d*u,this._w=c*h*u-f*d*p;break;case"ZYX":this._x=f*h*u-c*d*p,this._y=c*d*u+f*h*p,this._z=c*h*p-f*d*u,this._w=c*h*u+f*d*p;break;case"YZX":this._x=f*h*u+c*d*p,this._y=c*d*u+f*h*p,this._z=c*h*p-f*d*u,this._w=c*h*u-f*d*p;break;case"XZY":this._x=f*h*u-c*d*p,this._y=c*d*u-f*h*p,this._z=c*h*p+f*d*u,this._w=c*h*u+f*d*p;break;default:ze("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[10],f=n+o+u;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(h-l)*d,this._y=(r-c)*d,this._z=(a-i)*d}else if(n>o&&n>u){const d=2*Math.sqrt(1+n-o-u);this._w=(h-l)/d,this._x=.25*d,this._y=(i+a)/d,this._z=(r+c)/d}else if(o>u){const d=2*Math.sqrt(1+o-n-u);this._w=(r-c)/d,this._x=(i+a)/d,this._y=.25*d,this._z=(l+h)/d}else{const d=2*Math.sqrt(1+u-n-o);this._w=(a-i)/d,this._x=(r+c)/d,this._y=(l+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Je(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+i*c-r*l,this._y=i*h+a*l+r*o-n*c,this._z=r*h+a*c+n*l-i*o,this._w=a*h-n*o-i*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,r=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,r=-r,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),h=Math.sin(c);l=Math.sin(l*c)/h,t=Math.sin(t*c)/h,this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+r*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+r*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class R{constructor(e=0,t=0,n=0){R.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(sh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(sh.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*n),h=2*(o*t-r*i),u=2*(r*n-a*t);return this.x=t+l*c+a*u-o*h,this.y=n+l*h+o*c-r*u,this.z=i+l*u+r*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Je(this.x,e.x,t.x),this.y=Je(this.y,e.y,t.y),this.z=Je(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Je(this.x,e,t),this.y=Je(this.y,e,t),this.z=Je(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Je(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-r*o,this.y=r*a-n*l,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return nl.copy(this).projectOnVector(e),this.sub(nl)}reflect(e){return this.sub(nl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Je(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const nl=new R,sh=new En;class Qe{constructor(e,t,n,i,r,a,o,l,c){Qe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,l,c)}set(e,t,n,i,r,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=r,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],f=n[2],d=n[5],p=n[8],g=i[0],v=i[3],m=i[6],x=i[1],_=i[4],M=i[7],T=i[2],A=i[5],L=i[8];return r[0]=a*g+o*x+l*T,r[3]=a*v+o*_+l*A,r[6]=a*m+o*M+l*L,r[1]=c*g+h*x+u*T,r[4]=c*v+h*_+u*A,r[7]=c*m+h*M+u*L,r[2]=f*g+d*x+p*T,r[5]=f*v+d*_+p*A,r[8]=f*m+d*M+p*L,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*r*h+n*o*l+i*r*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=h*a-o*c,f=o*l-h*r,d=c*r-a*l,p=t*u+n*f+i*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/p;return e[0]=u*g,e[1]=(i*c-h*n)*g,e[2]=(o*n-i*a)*g,e[3]=f*g,e[4]=(h*t-i*l)*g,e[5]=(i*r-o*t)*g,e[6]=d*g,e[7]=(n*l-c*t)*g,e[8]=(a*t-n*r)*g,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,o){const l=Math.cos(r),c=Math.sin(r);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(il.makeScale(e,t)),this}rotate(e){return this.premultiply(il.makeRotation(-e)),this}translate(e,t){return this.premultiply(il.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const il=new Qe,rh=new Qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ah=new Qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function bp(){const s={enabled:!0,workingColorSpace:wt,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===at&&(i.r=Jn(i.r),i.g=Jn(i.g),i.b=Jn(i.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===at&&(i.r=$i(i.r),i.g=$i(i.g),i.b=$i(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===ci?Rr:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,a){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return Hs("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return Hs("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[wt]:{primaries:e,whitePoint:n,transfer:Rr,toXYZ:rh,fromXYZ:ah,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:ft},outputColorSpaceConfig:{drawingBufferColorSpace:ft}},[ft]:{primaries:e,whitePoint:n,transfer:at,toXYZ:rh,fromXYZ:ah,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:ft}}}),s}const nt=bp();function Jn(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function $i(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let Ji;class yp{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Ji===void 0&&(Ji=zs("canvas")),Ji.width=e.width,Ji.height=e.height;const i=Ji.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Ji}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=zs("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let a=0;a<r.length;a++)r[a]=Jn(r[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Jn(t[n]/255)*255):t[n]=Jn(t[n]);return{data:t,width:e.width,height:e.height}}else return ze("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Mp=0;class sl{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Mp++}),this.uuid=xn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(rl(i[a].image)):r.push(rl(i[a]))}else r=rl(i);n.url=r}return t||(e.images[this.uuid]=n),n}}function rl(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?yp.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(ze("Texture: Unable to serialize Texture."),{})}let wp=0;const al=new R;class Ot extends bi{constructor(e=Ot.DEFAULT_IMAGE,t=Ot.DEFAULT_MAPPING,n=kn,i=kn,r=It,a=Kn,o=hn,l=nn,c=Ot.DEFAULT_ANISOTROPY,h=ci){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:wp++}),this.uuid=xn(),this.name="",this.source=new sl(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new de(0,0),this.repeat=new de(1,1),this.center=new de(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(al).x}get height(){return this.source.getSize(al).y}get depth(){return this.source.getSize(al).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ze(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ze(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==zc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Bn:e.x=e.x-Math.floor(e.x);break;case kn:e.x=e.x<0?0:1;break;case Sr:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Bn:e.y=e.y-Math.floor(e.y);break;case kn:e.y=e.y<0?0:1;break;case Sr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Ot.DEFAULT_IMAGE=null,Ot.DEFAULT_MAPPING=zc,Ot.DEFAULT_ANISOTROPY=1;class _t{constructor(e=0,t=0,n=0,i=1){_t.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const l=e.elements,c=l[0],h=l[4],u=l[8],f=l[1],d=l[5],p=l[9],g=l[2],v=l[6],m=l[10];if(Math.abs(h-f)<.01&&Math.abs(u-g)<.01&&Math.abs(p-v)<.01){if(Math.abs(h+f)<.1&&Math.abs(u+g)<.1&&Math.abs(p+v)<.1&&Math.abs(c+d+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(c+1)/2,M=(d+1)/2,T=(m+1)/2,A=(h+f)/4,L=(u+g)/4,U=(p+v)/4;return _>M&&_>T?_<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(_),i=A/n,r=L/n):M>T?M<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(M),n=A/i,r=U/i):T<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(T),n=L/r,i=U/r),this.set(n,i,r,t),this}let x=Math.sqrt((v-p)*(v-p)+(u-g)*(u-g)+(f-h)*(f-h));return Math.abs(x)<.001&&(x=1),this.x=(v-p)/x,this.y=(u-g)/x,this.z=(f-h)/x,this.w=Math.acos((c+d+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Je(this.x,e.x,t.x),this.y=Je(this.y,e.y,t.y),this.z=Je(this.z,e.z,t.z),this.w=Je(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Je(this.x,e,t),this.y=Je(this.y,e,t),this.z=Je(this.z,e,t),this.w=Je(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Je(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Sp extends bi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:It,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new _t(0,0,e,t),this.scissorTest=!1,this.viewport=new _t(0,0,e,t);const i={width:e,height:t,depth:n.depth},r=new Ot(i);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=r.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:It,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new sl(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Wt extends Sp{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class oh extends Ot{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Pt,this.minFilter=Pt,this.wrapR=kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ep extends Ot{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Pt,this.minFilter=Pt,this.wrapR=kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Xt{constructor(e=new R(1/0,1/0,1/0),t=new R(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Tn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Tn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Tn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Tn):Tn.fromBufferAttribute(r,a),Tn.applyMatrix4(e.matrixWorld),this.expandByPoint(Tn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ir.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Ir.copy(n.boundingBox)),Ir.applyMatrix4(e.matrixWorld),this.union(Ir)}const i=e.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Tn),Tn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ws),Nr.subVectors(this.max,Ws),Qi.subVectors(e.a,Ws),es.subVectors(e.b,Ws),ts.subVectors(e.c,Ws),hi.subVectors(es,Qi),ui.subVectors(ts,es),yi.subVectors(Qi,ts);let t=[0,-hi.z,hi.y,0,-ui.z,ui.y,0,-yi.z,yi.y,hi.z,0,-hi.x,ui.z,0,-ui.x,yi.z,0,-yi.x,-hi.y,hi.x,0,-ui.y,ui.x,0,-yi.y,yi.x,0];return!ol(t,Qi,es,ts,Nr)||(t=[1,0,0,0,1,0,0,0,1],!ol(t,Qi,es,ts,Nr))?!1:(Ur.crossVectors(hi,ui),t=[Ur.x,Ur.y,Ur.z],ol(t,Qi,es,ts,Nr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Tn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Tn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Qn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Qn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Qn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Qn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Qn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Qn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Qn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Qn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Qn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Qn=[new R,new R,new R,new R,new R,new R,new R,new R],Tn=new R,Ir=new Xt,Qi=new R,es=new R,ts=new R,hi=new R,ui=new R,yi=new R,Ws=new R,Nr=new R,Ur=new R,Mi=new R;function ol(s,e,t,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){Mi.fromArray(s,r);const o=i.x*Math.abs(Mi.x)+i.y*Math.abs(Mi.y)+i.z*Math.abs(Mi.z),l=e.dot(Mi),c=t.dot(Mi),h=n.dot(Mi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Tp=new Xt,Xs=new R,ll=new R;class zn{constructor(e=new R,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Tp.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Xs.subVectors(e,this.center);const t=Xs.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Xs,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ll.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Xs.copy(e.center).add(ll)),this.expandByPoint(Xs.copy(e.center).sub(ll))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const ei=new R,cl=new R,Br=new R,di=new R,hl=new R,kr=new R,ul=new R;class ns{constructor(e=new R,t=new R(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ei)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ei.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ei.copy(this.origin).addScaledVector(this.direction,t),ei.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){cl.copy(e).add(t).multiplyScalar(.5),Br.copy(t).sub(e).normalize(),di.copy(this.origin).sub(cl);const r=e.distanceTo(t)*.5,a=-this.direction.dot(Br),o=di.dot(this.direction),l=-di.dot(Br),c=di.lengthSq(),h=Math.abs(1-a*a);let u,f,d,p;if(h>0)if(u=a*l-o,f=a*o-l,p=r*h,u>=0)if(f>=-p)if(f<=p){const g=1/h;u*=g,f*=g,d=u*(u+a*f+2*o)+f*(a*u+f+2*l)+c}else f=r,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;else f=-r,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;else f<=-p?(u=Math.max(0,-(-a*r+o)),f=u>0?-r:Math.min(Math.max(-r,-l),r),d=-u*u+f*(f+2*l)+c):f<=p?(u=0,f=Math.min(Math.max(-r,-l),r),d=f*(f+2*l)+c):(u=Math.max(0,-(a*r+o)),f=u>0?r:Math.min(Math.max(-r,-l),r),d=-u*u+f*(f+2*l)+c);else f=a>0?-r:r,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(cl).addScaledVector(Br,f),d}intersectSphere(e,t){ei.subVectors(e.center,this.origin);const n=ei.dot(this.direction),i=ei.dot(ei)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),h>=0?(r=(e.min.y-f.y)*h,a=(e.max.y-f.y)*h):(r=(e.max.y-f.y)*h,a=(e.min.y-f.y)*h),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(o=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ei)!==null}intersectTriangle(e,t,n,i,r){hl.subVectors(t,e),kr.subVectors(n,e),ul.crossVectors(hl,kr);let a=this.direction.dot(ul),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;di.subVectors(this.origin,e);const l=o*this.direction.dot(kr.crossVectors(di,kr));if(l<0)return null;const c=o*this.direction.dot(hl.cross(di));if(c<0||l+c>a)return null;const h=-o*di.dot(ul);return h<0?null:this.at(h/a,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class je{constructor(e,t,n,i,r,a,o,l,c,h,u,f,d,p,g,v){je.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,l,c,h,u,f,d,p,g,v)}set(e,t,n,i,r,a,o,l,c,h,u,f,d,p,g,v){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=r,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=h,m[10]=u,m[14]=f,m[3]=d,m[7]=p,m[11]=g,m[15]=v,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new je().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/is.setFromMatrixColumn(e,0).length(),r=1/is.setFromMatrixColumn(e,1).length(),a=1/is.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const f=a*h,d=a*u,p=o*h,g=o*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=d+p*c,t[5]=f-g*c,t[9]=-o*l,t[2]=g-f*c,t[6]=p+d*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*h,d=l*u,p=c*h,g=c*u;t[0]=f+g*o,t[4]=p*o-d,t[8]=a*c,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=d*o-p,t[6]=g+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*h,d=l*u,p=c*h,g=c*u;t[0]=f-g*o,t[4]=-a*u,t[8]=p+d*o,t[1]=d+p*o,t[5]=a*h,t[9]=g-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*h,d=a*u,p=o*h,g=o*u;t[0]=l*h,t[4]=p*c-d,t[8]=f*c+g,t[1]=l*u,t[5]=g*c+f,t[9]=d*c-p,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,d=a*c,p=o*l,g=o*c;t[0]=l*h,t[4]=g-f*u,t[8]=p*u+d,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=d*u+p,t[10]=f-g*u}else if(e.order==="XZY"){const f=a*l,d=a*c,p=o*l,g=o*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=f*u+g,t[5]=a*h,t[9]=d*u-p,t[2]=p*u-d,t[6]=o*h,t[10]=g*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Cp,e,Ap)}lookAt(e,t,n){const i=this.elements;return un.subVectors(e,t),un.lengthSq()===0&&(un.z=1),un.normalize(),fi.crossVectors(n,un),fi.lengthSq()===0&&(Math.abs(n.z)===1?un.x+=1e-4:un.z+=1e-4,un.normalize(),fi.crossVectors(n,un)),fi.normalize(),Or.crossVectors(un,fi),i[0]=fi.x,i[4]=Or.x,i[8]=un.x,i[1]=fi.y,i[5]=Or.y,i[9]=un.y,i[2]=fi.z,i[6]=Or.z,i[10]=un.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],f=n[9],d=n[13],p=n[2],g=n[6],v=n[10],m=n[14],x=n[3],_=n[7],M=n[11],T=n[15],A=i[0],L=i[4],U=i[8],E=i[12],C=i[1],k=i[5],D=i[9],B=i[13],w=i[2],F=i[6],q=i[10],z=i[14],te=i[3],K=i[7],le=i[11],W=i[15];return r[0]=a*A+o*C+l*w+c*te,r[4]=a*L+o*k+l*F+c*K,r[8]=a*U+o*D+l*q+c*le,r[12]=a*E+o*B+l*z+c*W,r[1]=h*A+u*C+f*w+d*te,r[5]=h*L+u*k+f*F+d*K,r[9]=h*U+u*D+f*q+d*le,r[13]=h*E+u*B+f*z+d*W,r[2]=p*A+g*C+v*w+m*te,r[6]=p*L+g*k+v*F+m*K,r[10]=p*U+g*D+v*q+m*le,r[14]=p*E+g*B+v*z+m*W,r[3]=x*A+_*C+M*w+T*te,r[7]=x*L+_*k+M*F+T*K,r[11]=x*U+_*D+M*q+T*le,r[15]=x*E+_*B+M*z+T*W,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],u=e[6],f=e[10],d=e[14],p=e[3],g=e[7],v=e[11],m=e[15],x=l*d-c*f,_=o*d-c*u,M=o*f-l*u,T=a*d-c*h,A=a*f-l*h,L=a*u-o*h;return t*(g*x-v*_+m*M)-n*(p*x-v*T+m*A)+i*(p*_-g*T+m*L)-r*(p*M-g*A+v*L)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],f=e[10],d=e[11],p=e[12],g=e[13],v=e[14],m=e[15],x=u*v*c-g*f*c+g*l*d-o*v*d-u*l*m+o*f*m,_=p*f*c-h*v*c-p*l*d+a*v*d+h*l*m-a*f*m,M=h*g*c-p*u*c+p*o*d-a*g*d-h*o*m+a*u*m,T=p*u*l-h*g*l-p*o*f+a*g*f+h*o*v-a*u*v,A=t*x+n*_+i*M+r*T;if(A===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/A;return e[0]=x*L,e[1]=(g*f*r-u*v*r-g*i*d+n*v*d+u*i*m-n*f*m)*L,e[2]=(o*v*r-g*l*r+g*i*c-n*v*c-o*i*m+n*l*m)*L,e[3]=(u*l*r-o*f*r-u*i*c+n*f*c+o*i*d-n*l*d)*L,e[4]=_*L,e[5]=(h*v*r-p*f*r+p*i*d-t*v*d-h*i*m+t*f*m)*L,e[6]=(p*l*r-a*v*r-p*i*c+t*v*c+a*i*m-t*l*m)*L,e[7]=(a*f*r-h*l*r+h*i*c-t*f*c-a*i*d+t*l*d)*L,e[8]=M*L,e[9]=(p*u*r-h*g*r-p*n*d+t*g*d+h*n*m-t*u*m)*L,e[10]=(a*g*r-p*o*r+p*n*c-t*g*c-a*n*m+t*o*m)*L,e[11]=(h*o*r-a*u*r-h*n*c+t*u*c+a*n*d-t*o*d)*L,e[12]=T*L,e[13]=(h*g*i-p*u*i+p*n*f-t*g*f-h*n*v+t*u*v)*L,e[14]=(p*o*i-a*g*i-p*n*l+t*g*l+a*n*v-t*o*v)*L,e[15]=(a*u*i-h*o*i+h*n*l-t*u*l-a*n*f+t*o*f)*L,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,l=e.z,c=r*a,h=r*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,h*o+n,h*l-i*a,0,c*l-i*o,h*l+i*a,r*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,o=t._z,l=t._w,c=r+r,h=a+a,u=o+o,f=r*c,d=r*h,p=r*u,g=a*h,v=a*u,m=o*u,x=l*c,_=l*h,M=l*u,T=n.x,A=n.y,L=n.z;return i[0]=(1-(g+m))*T,i[1]=(d+M)*T,i[2]=(p-_)*T,i[3]=0,i[4]=(d-M)*A,i[5]=(1-(f+m))*A,i[6]=(v+x)*A,i[7]=0,i[8]=(p+_)*L,i[9]=(v-x)*L,i[10]=(1-(f+g))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let r=is.set(i[0],i[1],i[2]).length();const a=is.set(i[4],i[5],i[6]).length(),o=is.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),Cn.copy(this);const c=1/r,h=1/a,u=1/o;return Cn.elements[0]*=c,Cn.elements[1]*=c,Cn.elements[2]*=c,Cn.elements[4]*=h,Cn.elements[5]*=h,Cn.elements[6]*=h,Cn.elements[8]*=u,Cn.elements[9]*=u,Cn.elements[10]*=u,t.setFromRotationMatrix(Cn),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,i,r,a,o=Fn,l=!1){const c=this.elements,h=2*r/(t-e),u=2*r/(n-i),f=(t+e)/(t-e),d=(n+i)/(n-i);let p,g;if(l)p=r/(a-r),g=a*r/(a-r);else if(o===Fn)p=-(a+r)/(a-r),g=-2*a*r/(a-r);else if(o===Lr)p=-a/(a-r),g=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=u,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=g,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,a,o=Fn,l=!1){const c=this.elements,h=2/(t-e),u=2/(n-i),f=-(t+e)/(t-e),d=-(n+i)/(n-i);let p,g;if(l)p=1/(a-r),g=a/(a-r);else if(o===Fn)p=-2/(a-r),g=-(a+r)/(a-r);else if(o===Lr)p=-1/(a-r),g=-r/(a-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=f,c[1]=0,c[5]=u,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=p,c[14]=g,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const is=new R,Cn=new je,Cp=new R(0,0,0),Ap=new R(1,1,1),fi=new R,Or=new R,un=new R,lh=new je,ch=new En;class sn{constructor(e=0,t=0,n=0,i=sn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],a=i[4],o=i[8],l=i[1],c=i[5],h=i[9],u=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(Je(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Je(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Je(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Je(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Je(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Je(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,d),this._y=0);break;default:ze("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return lh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(lh,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ch.setFromEuler(this),this.setFromQuaternion(ch,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}sn.DEFAULT_ORDER="XYZ";class dl{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Pp=0;const hh=new R,ss=new En,ti=new je,Fr=new R,js=new R,Rp=new R,Lp=new En,uh=new R(1,0,0),dh=new R(0,1,0),fh=new R(0,0,1),ph={type:"added"},Dp={type:"removed"},rs={type:"childadded",child:null},fl={type:"childremoved",child:null};class yt extends bi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Pp++}),this.uuid=xn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=yt.DEFAULT_UP.clone();const e=new R,t=new sn,n=new En,i=new R(1,1,1);function r(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new je},normalMatrix:{value:new Qe}}),this.matrix=new je,this.matrixWorld=new je,this.matrixAutoUpdate=yt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=yt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new dl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ss.setFromAxisAngle(e,t),this.quaternion.multiply(ss),this}rotateOnWorldAxis(e,t){return ss.setFromAxisAngle(e,t),this.quaternion.premultiply(ss),this}rotateX(e){return this.rotateOnAxis(uh,e)}rotateY(e){return this.rotateOnAxis(dh,e)}rotateZ(e){return this.rotateOnAxis(fh,e)}translateOnAxis(e,t){return hh.copy(e).applyQuaternion(this.quaternion),this.position.add(hh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(uh,e)}translateY(e){return this.translateOnAxis(dh,e)}translateZ(e){return this.translateOnAxis(fh,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ti.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Fr.copy(e):Fr.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),js.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ti.lookAt(js,Fr,this.up):ti.lookAt(Fr,js,this.up),this.quaternion.setFromRotationMatrix(ti),i&&(ti.extractRotation(i.matrixWorld),ss.setFromRotationMatrix(ti),this.quaternion.premultiply(ss.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Xe("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ph),rs.child=e,this.dispatchEvent(rs),rs.child=null):Xe("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Dp),fl.child=e,this.dispatchEvent(fl),fl.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ti.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ti.multiply(e.parent.matrixWorld)),e.applyMatrix4(ti),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ph),rs.child=e,this.dispatchEvent(rs),rs.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(js,e,Rp),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(js,Lp,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];r(e.shapes,u)}else r(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(r(e.materials,this.material[l]));i.material=o}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(r(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),u=a(e.shapes),f=a(e.skeletons),d=a(e.animations),p=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),p.length>0&&(n.nodes=p)}return n.object=i,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}yt.DEFAULT_UP=new R(0,1,0),yt.DEFAULT_MATRIX_AUTO_UPDATE=!0,yt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const An=new R,ni=new R,pl=new R,ii=new R,as=new R,os=new R,mh=new R,ml=new R,gl=new R,vl=new R,xl=new _t,_l=new _t,bl=new _t;class Pn{constructor(e=new R,t=new R,n=new R){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),An.subVectors(e,t),i.cross(An);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){An.subVectors(i,t),ni.subVectors(n,t),pl.subVectors(e,t);const a=An.dot(An),o=An.dot(ni),l=An.dot(pl),c=ni.dot(ni),h=ni.dot(pl),u=a*c-o*o;if(u===0)return r.set(0,0,0),null;const f=1/u,d=(c*l-o*h)*f,p=(a*h-o*l)*f;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,ii)===null?!1:ii.x>=0&&ii.y>=0&&ii.x+ii.y<=1}static getInterpolation(e,t,n,i,r,a,o,l){return this.getBarycoord(e,t,n,i,ii)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,ii.x),l.addScaledVector(a,ii.y),l.addScaledVector(o,ii.z),l)}static getInterpolatedAttribute(e,t,n,i,r,a){return xl.setScalar(0),_l.setScalar(0),bl.setScalar(0),xl.fromBufferAttribute(e,t),_l.fromBufferAttribute(e,n),bl.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(xl,r.x),a.addScaledVector(_l,r.y),a.addScaledVector(bl,r.z),a}static isFrontFacing(e,t,n,i){return An.subVectors(n,t),ni.subVectors(e,t),An.cross(ni).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return An.subVectors(this.c,this.b),ni.subVectors(this.a,this.b),An.cross(ni).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Pn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Pn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Pn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Pn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Pn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,o;as.subVectors(i,n),os.subVectors(r,n),ml.subVectors(e,n);const l=as.dot(ml),c=os.dot(ml);if(l<=0&&c<=0)return t.copy(n);gl.subVectors(e,i);const h=as.dot(gl),u=os.dot(gl);if(h>=0&&u<=h)return t.copy(i);const f=l*u-h*c;if(f<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(as,a);vl.subVectors(e,r);const d=as.dot(vl),p=os.dot(vl);if(p>=0&&d<=p)return t.copy(r);const g=d*c-l*p;if(g<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(os,o);const v=h*p-d*u;if(v<=0&&u-h>=0&&d-p>=0)return mh.subVectors(r,i),o=(u-h)/(u-h+(d-p)),t.copy(i).addScaledVector(mh,o);const m=1/(v+g+f);return a=g*m,o=f*m,t.copy(n).addScaledVector(as,a).addScaledVector(os,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const gh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},pi={h:0,s:0,l:0},zr={h:0,s:0,l:0};function yl(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class ke{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ft){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,nt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=nt.workingColorSpace){return this.r=e,this.g=t,this.b=n,nt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=nt.workingColorSpace){if(e=tl(e,1),t=Je(t,0,1),n=Je(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=yl(a,r,e+1/3),this.g=yl(a,r,e),this.b=yl(a,r,e-1/3)}return nt.colorSpaceToWorking(this,i),this}setStyle(e,t=ft){function n(r){r!==void 0&&parseFloat(r)<1&&ze("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:ze("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(r,16),t);ze("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ft){const n=gh[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ze("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Jn(e.r),this.g=Jn(e.g),this.b=Jn(e.b),this}copyLinearToSRGB(e){return this.r=$i(e.r),this.g=$i(e.g),this.b=$i(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ft){return nt.workingToColorSpace(jt.copy(this),e),Math.round(Je(jt.r*255,0,255))*65536+Math.round(Je(jt.g*255,0,255))*256+Math.round(Je(jt.b*255,0,255))}getHexString(e=ft){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=nt.workingColorSpace){nt.workingToColorSpace(jt.copy(this),t);const n=jt.r,i=jt.g,r=jt.b,a=Math.max(n,i,r),o=Math.min(n,i,r);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(i-r)/u+(i<r?6:0);break;case i:l=(r-n)/u+2;break;case r:l=(n-i)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=nt.workingColorSpace){return nt.workingToColorSpace(jt.copy(this),t),e.r=jt.r,e.g=jt.g,e.b=jt.b,e}getStyle(e=ft){nt.workingToColorSpace(jt.copy(this),e);const t=jt.r,n=jt.g,i=jt.b;return e!==ft?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(pi),this.setHSL(pi.h+e,pi.s+t,pi.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(pi),e.getHSL(zr);const n=Gs(pi.h,zr.h,t),i=Gs(pi.s,zr.s,t),r=Gs(pi.l,zr.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const jt=new ke;ke.NAMES=gh;let Ip=0;class dn extends bi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ip++}),this.uuid=xn(),this.name="",this.type="Material",this.blending=Wi,this.side=Nn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Xa,this.blendDst=ja,this.blendEquation=wn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ke(0,0,0),this.blendAlpha=0,this.depthFunc=Xi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Jc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Yi,this.stencilZFail=Yi,this.stencilZPass=Yi,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ze(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ze(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Wi&&(n.blending=this.blending),this.side!==Nn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Xa&&(n.blendSrc=this.blendSrc),this.blendDst!==ja&&(n.blendDst=this.blendDst),this.blendEquation!==wn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Xi&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Jc&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Yi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Yi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Yi&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){const a=[];for(const o in r){const l=r[o];delete l.metadata,a.push(l)}return a}if(t){const r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ft extends dn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new sn,this.combine=yr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Dt=new R,Hr=new de;let Np=0;class mt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Np++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=el,this.updateRanges=[],this.gpuType=vn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Hr.fromBufferAttribute(this,t),Hr.applyMatrix3(e),this.setXY(t,Hr.x,Hr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Dt.fromBufferAttribute(this,t),Dt.applyMatrix3(e),this.setXYZ(t,Dt.x,Dt.y,Dt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Dt.fromBufferAttribute(this,t),Dt.applyMatrix4(e),this.setXYZ(t,Dt.x,Dt.y,Dt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Dt.fromBufferAttribute(this,t),Dt.applyNormalMatrix(e),this.setXYZ(t,Dt.x,Dt.y,Dt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Dt.fromBufferAttribute(this,t),Dt.transformDirection(e),this.setXYZ(t,Dt.x,Dt.y,Dt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Sn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ot(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Sn(t,this.array)),t}setX(e,t){return this.normalized&&(t=ot(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Sn(t,this.array)),t}setY(e,t){return this.normalized&&(t=ot(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Sn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ot(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Sn(t,this.array)),t}setW(e,t){return this.normalized&&(t=ot(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ot(t,this.array),n=ot(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=ot(t,this.array),n=ot(n,this.array),i=ot(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=ot(t,this.array),n=ot(n,this.array),i=ot(i,this.array),r=ot(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==el&&(e.usage=this.usage),e}}class vh extends mt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class xh extends mt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Kt extends mt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Up=0;const _n=new je,Ml=new yt,ls=new R,fn=new Xt,Zs=new Xt,zt=new R;class gt extends bi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Up++}),this.uuid=xn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(eh(e)?xh:vh)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new Qe().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return _n.makeRotationFromQuaternion(e),this.applyMatrix4(_n),this}rotateX(e){return _n.makeRotationX(e),this.applyMatrix4(_n),this}rotateY(e){return _n.makeRotationY(e),this.applyMatrix4(_n),this}rotateZ(e){return _n.makeRotationZ(e),this.applyMatrix4(_n),this}translate(e,t,n){return _n.makeTranslation(e,t,n),this.applyMatrix4(_n),this}scale(e,t,n){return _n.makeScale(e,t,n),this.applyMatrix4(_n),this}lookAt(e){return Ml.lookAt(e),Ml.updateMatrix(),this.applyMatrix4(Ml.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ls).negate(),this.translate(ls.x,ls.y,ls.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,r=e.length;i<r;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Kt(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&ze("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Xt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Xe("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new R(-1/0,-1/0,-1/0),new R(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const r=t[n];fn.setFromBufferAttribute(r),this.morphTargetsRelative?(zt.addVectors(this.boundingBox.min,fn.min),this.boundingBox.expandByPoint(zt),zt.addVectors(this.boundingBox.max,fn.max),this.boundingBox.expandByPoint(zt)):(this.boundingBox.expandByPoint(fn.min),this.boundingBox.expandByPoint(fn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Xe('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Xe("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new R,1/0);return}if(e){const n=this.boundingSphere.center;if(fn.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];Zs.setFromBufferAttribute(o),this.morphTargetsRelative?(zt.addVectors(fn.min,Zs.min),fn.expandByPoint(zt),zt.addVectors(fn.max,Zs.max),fn.expandByPoint(zt)):(fn.expandByPoint(Zs.min),fn.expandByPoint(Zs.max))}fn.getCenter(n);let i=0;for(let r=0,a=e.count;r<a;r++)zt.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(zt));if(t)for(let r=0,a=t.length;r<a;r++){const o=t[r],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)zt.fromBufferAttribute(o,c),l&&(ls.fromBufferAttribute(e,c),zt.add(ls)),i=Math.max(i,n.distanceToSquared(zt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Xe('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Xe("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new mt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let U=0;U<n.count;U++)o[U]=new R,l[U]=new R;const c=new R,h=new R,u=new R,f=new de,d=new de,p=new de,g=new R,v=new R;function m(U,E,C){c.fromBufferAttribute(n,U),h.fromBufferAttribute(n,E),u.fromBufferAttribute(n,C),f.fromBufferAttribute(r,U),d.fromBufferAttribute(r,E),p.fromBufferAttribute(r,C),h.sub(c),u.sub(c),d.sub(f),p.sub(f);const k=1/(d.x*p.y-p.x*d.y);isFinite(k)&&(g.copy(h).multiplyScalar(p.y).addScaledVector(u,-d.y).multiplyScalar(k),v.copy(u).multiplyScalar(d.x).addScaledVector(h,-p.x).multiplyScalar(k),o[U].add(g),o[E].add(g),o[C].add(g),l[U].add(v),l[E].add(v),l[C].add(v))}let x=this.groups;x.length===0&&(x=[{start:0,count:e.count}]);for(let U=0,E=x.length;U<E;++U){const C=x[U],k=C.start,D=C.count;for(let B=k,w=k+D;B<w;B+=3)m(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const _=new R,M=new R,T=new R,A=new R;function L(U){T.fromBufferAttribute(i,U),A.copy(T);const E=o[U];_.copy(E),_.sub(T.multiplyScalar(T.dot(E))).normalize(),M.crossVectors(A,E);const k=M.dot(l[U])<0?-1:1;a.setXYZW(U,_.x,_.y,_.z,k)}for(let U=0,E=x.length;U<E;++U){const C=x[U],k=C.start,D=C.count;for(let B=k,w=k+D;B<w;B+=3)L(e.getX(B+0)),L(e.getX(B+1)),L(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new mt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);const i=new R,r=new R,a=new R,o=new R,l=new R,c=new R,h=new R,u=new R;if(e)for(let f=0,d=e.count;f<d;f+=3){const p=e.getX(f+0),g=e.getX(f+1),v=e.getX(f+2);i.fromBufferAttribute(t,p),r.fromBufferAttribute(t,g),a.fromBufferAttribute(t,v),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,g),c.fromBufferAttribute(n,v),o.add(h),l.add(h),c.add(h),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(g,l.x,l.y,l.z),n.setXYZ(v,c.x,c.y,c.z)}else for(let f=0,d=t.count;f<d;f+=3)i.fromBufferAttribute(t,f+0),r.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),n.setXYZ(f+0,h.x,h.y,h.z),n.setXYZ(f+1,h.x,h.y,h.z),n.setXYZ(f+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)zt.fromBufferAttribute(e,t),zt.normalize(),e.setXYZ(t,zt.x,zt.y,zt.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,u=o.normalized,f=new c.constructor(l.length*h);let d=0,p=0;for(let g=0,v=l.length;g<v;g++){o.isInterleavedBufferAttribute?d=l[g]*o.data.stride+o.offset:d=l[g]*h;for(let m=0;m<h;m++)f[p++]=c[d++]}return new mt(f,h,u)}if(this.index===null)return ze("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new gt,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,n);t.setAttribute(o,c)}const r=this.morphAttributes;for(const o in r){const l=[],c=r[o];for(let h=0,u=c.length;h<u;h++){const f=c[h],d=e(f,n);l.push(d)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,f=c.length;u<f;u++){const d=c[u];h.push(d.toJSON(e.data))}h.length>0&&(i[l]=h,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(t))}const r=e.morphAttributes;for(const c in r){const h=[],u=r[c];for(let f=0,d=u.length;f<d;f++)h.push(u[f].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const _h=new je,wi=new ns,Vr=new zn,bh=new R,Gr=new R,Wr=new R,Xr=new R,wl=new R,jr=new R,yh=new R,Zr=new R;class bt extends yt{constructor(e=new gt,t=new Ft){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){jr.set(0,0,0);for(let l=0,c=r.length;l<c;l++){const h=o[l],u=r[l];h!==0&&(wl.fromBufferAttribute(u,e),a?jr.addScaledVector(wl,h):jr.addScaledVector(wl.sub(t),h))}t.add(jr)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Vr.copy(n.boundingSphere),Vr.applyMatrix4(r),wi.copy(e.ray).recast(e.near),!(Vr.containsPoint(wi.origin)===!1&&(wi.intersectSphere(Vr,bh)===null||wi.origin.distanceToSquared(bh)>(e.far-e.near)**2))&&(_h.copy(r).invert(),wi.copy(e.ray).applyMatrix4(_h),!(n.boundingBox!==null&&wi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,wi)))}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,o=r.index,l=r.attributes.position,c=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,f=r.groups,d=r.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,g=f.length;p<g;p++){const v=f[p],m=a[v.materialIndex],x=Math.max(v.start,d.start),_=Math.min(o.count,Math.min(v.start+v.count,d.start+d.count));for(let M=x,T=_;M<T;M+=3){const A=o.getX(M),L=o.getX(M+1),U=o.getX(M+2);i=qr(this,m,e,n,c,h,u,A,L,U),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=v.materialIndex,t.push(i))}}else{const p=Math.max(0,d.start),g=Math.min(o.count,d.start+d.count);for(let v=p,m=g;v<m;v+=3){const x=o.getX(v),_=o.getX(v+1),M=o.getX(v+2);i=qr(this,a,e,n,c,h,u,x,_,M),i&&(i.faceIndex=Math.floor(v/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let p=0,g=f.length;p<g;p++){const v=f[p],m=a[v.materialIndex],x=Math.max(v.start,d.start),_=Math.min(l.count,Math.min(v.start+v.count,d.start+d.count));for(let M=x,T=_;M<T;M+=3){const A=M,L=M+1,U=M+2;i=qr(this,m,e,n,c,h,u,A,L,U),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=v.materialIndex,t.push(i))}}else{const p=Math.max(0,d.start),g=Math.min(l.count,d.start+d.count);for(let v=p,m=g;v<m;v+=3){const x=v,_=v+1,M=v+2;i=qr(this,a,e,n,c,h,u,x,_,M),i&&(i.faceIndex=Math.floor(v/3),t.push(i))}}}}function Bp(s,e,t,n,i,r,a,o){let l;if(e.side===tn?l=n.intersectTriangle(a,r,i,!0,o):l=n.intersectTriangle(i,r,a,e.side===Nn,o),l===null)return null;Zr.copy(o),Zr.applyMatrix4(s.matrixWorld);const c=t.ray.origin.distanceTo(Zr);return c<t.near||c>t.far?null:{distance:c,point:Zr.clone(),object:s}}function qr(s,e,t,n,i,r,a,o,l,c){s.getVertexPosition(o,Gr),s.getVertexPosition(l,Wr),s.getVertexPosition(c,Xr);const h=Bp(s,e,t,n,Gr,Wr,Xr,yh);if(h){const u=new R;Pn.getBarycoord(yh,Gr,Wr,Xr,u),i&&(h.uv=Pn.getInterpolatedAttribute(i,o,l,c,u,new de)),r&&(h.uv1=Pn.getInterpolatedAttribute(r,o,l,c,u,new de)),a&&(h.normal=Pn.getInterpolatedAttribute(a,o,l,c,u,new R),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new R,materialIndex:0};Pn.getNormal(Gr,Wr,Xr,f.normal),h.face=f,h.barycoord=u}return h}class Si extends gt{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const l=[],c=[],h=[],u=[];let f=0,d=0;p("z","y","x",-1,-1,n,t,e,a,r,0),p("z","y","x",1,-1,n,t,-e,a,r,1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(l),this.setAttribute("position",new Kt(c,3)),this.setAttribute("normal",new Kt(h,3)),this.setAttribute("uv",new Kt(u,2));function p(g,v,m,x,_,M,T,A,L,U,E){const C=M/L,k=T/U,D=M/2,B=T/2,w=A/2,F=L+1,q=U+1;let z=0,te=0;const K=new R;for(let le=0;le<q;le++){const W=le*k-B;for(let j=0;j<F;j++){const me=j*C-D;K[g]=me*x,K[v]=W*_,K[m]=w,c.push(K.x,K.y,K.z),K[g]=0,K[v]=0,K[m]=A>0?1:-1,h.push(K.x,K.y,K.z),u.push(j/L),u.push(1-le/U),z+=1}}for(let le=0;le<U;le++)for(let W=0;W<L;W++){const j=f+W+F*le,me=f+W+F*(le+1),ge=f+(W+1)+F*(le+1),ue=f+(W+1)+F*le;l.push(j,me,ue),l.push(me,ge,ue),te+=6}o.addGroup(d,te,E),d+=te,f+=z}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Si(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function cs(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(ze("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function $t(s){const e={};for(let t=0;t<s.length;t++){const n=cs(s[t]);for(const i in n)e[i]=n[i]}return e}function kp(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function Mh(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:nt.workingColorSpace}const Hn={clone:cs,merge:$t};var Op=`void main() {
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,Fp=`void main() {
|
||
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
||
}`;class Rt extends dn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Op,this.fragmentShader=Fp,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=cs(e.uniforms),this.uniformsGroups=kp(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class wh extends yt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new je,this.projectionMatrix=new je,this.projectionMatrixInverse=new je,this.coordinateSystem=Fn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const mi=new R,Sh=new de,Eh=new de;class Zt extends wh{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ki*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Vs*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ki*2*Math.atan(Math.tan(Vs*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){mi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(mi.x,mi.y).multiplyScalar(-e/mi.z),mi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(mi.x,mi.y).multiplyScalar(-e/mi.z)}getViewSize(e,t){return this.getViewBounds(e,Sh,Eh),t.subVectors(Eh,Sh)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Vs*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;r+=a.offsetX*i/l,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const hs=-90,us=1;class zp extends yt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Zt(hs,us,e,t);i.layers=this.layers,this.add(i);const r=new Zt(hs,us,e,t);r.layers=this.layers,this.add(r);const a=new Zt(hs,us,e,t);a.layers=this.layers,this.add(a);const o=new Zt(hs,us,e,t);o.layers=this.layers,this.add(o);const l=new Zt(hs,us,e,t);l.layers=this.layers,this.add(l);const c=new Zt(hs,us,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,l]=t;for(const c of t)this.remove(c);if(e===Fn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Lr)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,l,c,h]=this.children,u=e.getRenderTarget(),f=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const g=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=g,e.setRenderTarget(n,5,i),e.render(t,h),e.setRenderTarget(u,f,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class Th extends Ot{constructor(e=[],t=_i,n,i,r,a,o,l,c,h){super(e,t,n,i,r,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Ch extends Wt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Th(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
||
|
||
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
|
||
}
|
||
`,fragmentShader:`
|
||
|
||
uniform sampler2D tEquirect;
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 direction = normalize( vWorldDirection );
|
||
|
||
vec2 sampleUV = equirectUv( direction );
|
||
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
|
||
}
|
||
`},i=new Si(5,5,5),r=new Rt({name:"CubemapFromEquirect",uniforms:cs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:tn,blending:kt});r.uniforms.tEquirect.value=t;const a=new bt(i,r),o=t.minFilter;return t.minFilter===Kn&&(t.minFilter=It),new zp(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}class bn extends yt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Hp={type:"move"};class Sl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new bn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new bn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new bn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const g of e.hand.values()){const v=t.getJointPose(g,n),m=this._getHandJoint(c,g);v!==null&&(m.matrix.fromArray(v.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=v.radius),m.visible=v!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,p=.005;c.inputState.pinching&&f>d+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Hp)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new bn;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Ah extends yt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new sn,this.environmentIntensity=1,this.environmentRotation=new sn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Ph{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=el,this.updateRanges=[],this.version=0,this.uuid=xn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=xn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=xn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Jt=new R;class Yr{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Jt.fromBufferAttribute(this,t),Jt.applyMatrix4(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Jt.fromBufferAttribute(this,t),Jt.applyNormalMatrix(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Jt.fromBufferAttribute(this,t),Jt.transformDirection(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Sn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ot(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=ot(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=ot(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Sn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Sn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Sn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Sn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=ot(t,this.array),n=ot(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=ot(t,this.array),n=ot(n,this.array),i=ot(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=ot(t,this.array),n=ot(n,this.array),i=ot(i,this.array),r=ot(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){Dr("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new mt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Yr(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){Dr("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const Rh=new R,Lh=new _t,Dh=new _t,Vp=new R,Ih=new je,Kr=new R,El=new zn,Nh=new je,Tl=new ns;class Gp extends bt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Fc,this.bindMatrix=new je,this.bindMatrixInverse=new je,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Xt),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Kr),this.boundingBox.expandByPoint(Kr)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new zn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Kr),this.boundingSphere.expandByPoint(Kr)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),El.copy(this.boundingSphere),El.applyMatrix4(i),e.ray.intersectsSphere(El)!==!1&&(Nh.copy(i).invert(),Tl.copy(e.ray).applyMatrix4(Nh),!(this.boundingBox!==null&&Tl.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Tl)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new _t,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Fc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Wf?this.bindMatrixInverse.copy(this.bindMatrix).invert():ze("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Lh.fromBufferAttribute(i.attributes.skinIndex,e),Dh.fromBufferAttribute(i.attributes.skinWeight,e),Rh.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const a=Dh.getComponent(r);if(a!==0){const o=Lh.getComponent(r);Ih.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Vp.copy(Rh).applyMatrix4(Ih),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Uh extends yt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class qs extends Ot{constructor(e=null,t=1,n=1,i,r,a,o,l,c=Pt,h=Pt,u,f){super(null,a,o,l,c,h,i,r,u,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Bh=new je,Wp=new je;class Cl{constructor(e=[],t=[]){this.uuid=xn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){ze("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new je)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new je;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,a=e.length;r<a;r++){const o=e[r]?e[r].matrixWorld:Wp;Bh.multiplyMatrices(o,t[r]),Bh.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Cl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new qs(t,e,e,hn,vn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const r=e.bones[n];let a=t[r];a===void 0&&(ze("Skeleton: No bone found with UUID:",r),a=new Uh),this.bones.push(a),this.boneInverses.push(new je().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}class Al extends mt{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const ds=new je,kh=new je,$r=[],Oh=new Xt,Xp=new je,Ys=new bt,Ks=new zn;class Pl extends bt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Al(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Xp)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Xt),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ds),Oh.copy(e.boundingBox).applyMatrix4(ds),this.boundingBox.union(Oh)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new zn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ds),Ks.copy(e.boundingSphere).applyMatrix4(ds),this.boundingSphere.union(Ks)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,a=e*r+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ys.geometry=this.geometry,Ys.material=this.material,Ys.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ks.copy(this.boundingSphere),Ks.applyMatrix4(n),e.ray.intersectsSphere(Ks)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,ds),kh.multiplyMatrices(n,ds),Ys.matrixWorld=kh,Ys.raycast(e,$r);for(let a=0,o=$r.length;a<o;a++){const l=$r[a];l.instanceId=r,l.object=this,t.push(l)}$r.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Al(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new qs(new Float32Array(i*this.count),i,this.count,po,vn));const r=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=i*e;r[l]=o,r.set(n,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Rl=new R,jp=new R,Zp=new Qe;class St{constructor(e=new R(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Rl.subVectors(n,t).cross(jp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Rl),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Zp.getNormalMatrix(e),i=this.coplanarPoint(Rl).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ei=new zn,qp=new de(.5,.5),Jr=new R;class Ll{constructor(e=new St,t=new St,n=new St,i=new St,r=new St,a=new St){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Fn,n=!1){const i=this.planes,r=e.elements,a=r[0],o=r[1],l=r[2],c=r[3],h=r[4],u=r[5],f=r[6],d=r[7],p=r[8],g=r[9],v=r[10],m=r[11],x=r[12],_=r[13],M=r[14],T=r[15];if(i[0].setComponents(c-a,d-h,m-p,T-x).normalize(),i[1].setComponents(c+a,d+h,m+p,T+x).normalize(),i[2].setComponents(c+o,d+u,m+g,T+_).normalize(),i[3].setComponents(c-o,d-u,m-g,T-_).normalize(),n)i[4].setComponents(l,f,v,M).normalize(),i[5].setComponents(c-l,d-f,m-v,T-M).normalize();else if(i[4].setComponents(c-l,d-f,m-v,T-M).normalize(),t===Fn)i[5].setComponents(c+l,d+f,m+v,T+M).normalize();else if(t===Lr)i[5].setComponents(l,f,v,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ei.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ei.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ei)}intersectsSprite(e){Ei.center.set(0,0,0);const t=qp.distanceTo(e.center);return Ei.radius=.7071067811865476+t,Ei.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ei)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Jr.x=i.normal.x>0?e.max.x:e.min.x,Jr.y=i.normal.y>0?e.max.y:e.min.y,Jr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Jr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class fs extends dn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ke(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Qr=new R,ea=new R,Fh=new je,$s=new ns,ta=new zn,Dl=new R,zh=new R;class Ti extends yt{constructor(e=new gt,t=new fs){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)Qr.fromBufferAttribute(t,i-1),ea.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Qr.distanceTo(ea);e.setAttribute("lineDistance",new Kt(n,1))}else ze("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ta.copy(n.boundingSphere),ta.applyMatrix4(i),ta.radius+=r,e.ray.intersectsSphere(ta)===!1)return;Fh.copy(i).invert(),$s.copy(e.ray).applyMatrix4(Fh);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,f=n.attributes.position;if(h!==null){const d=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let g=d,v=p-1;g<v;g+=c){const m=h.getX(g),x=h.getX(g+1),_=na(this,e,$s,l,m,x,g);_&&t.push(_)}if(this.isLineLoop){const g=h.getX(p-1),v=h.getX(d),m=na(this,e,$s,l,g,v,p-1);m&&t.push(m)}}else{const d=Math.max(0,a.start),p=Math.min(f.count,a.start+a.count);for(let g=d,v=p-1;g<v;g+=c){const m=na(this,e,$s,l,g,g+1,g);m&&t.push(m)}if(this.isLineLoop){const g=na(this,e,$s,l,p-1,d,p-1);g&&t.push(g)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function na(s,e,t,n,i,r,a){const o=s.geometry.attributes.position;if(Qr.fromBufferAttribute(o,i),ea.fromBufferAttribute(o,r),t.distanceSqToSegment(Qr,ea,Dl,zh)>n)return;Dl.applyMatrix4(s.matrixWorld);const c=e.ray.origin.distanceTo(Dl);if(!(c<e.near||c>e.far))return{distance:c,point:zh.clone().applyMatrix4(s.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:s}}const Hh=new R,Vh=new R;class Yp extends Ti{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)Hh.fromBufferAttribute(t,i),Vh.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Hh.distanceTo(Vh);e.setAttribute("lineDistance",new Kt(n,1))}else ze("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Kp extends Ti{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Gh extends dn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ke(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Wh=new je,Il=new ns,ia=new zn,sa=new R;class $p extends yt{constructor(e=new gt,t=new Gh){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ia.copy(n.boundingSphere),ia.applyMatrix4(i),ia.radius+=r,e.ray.intersectsSphere(ia)===!1)return;Wh.copy(i).invert(),Il.copy(e.ray).applyMatrix4(Wh);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const f=Math.max(0,a.start),d=Math.min(c.count,a.start+a.count);for(let p=f,g=d;p<g;p++){const v=c.getX(p);sa.fromBufferAttribute(u,v),Xh(sa,v,l,i,e,t,this)}}else{const f=Math.max(0,a.start),d=Math.min(u.count,a.start+a.count);for(let p=f,g=d;p<g;p++)sa.fromBufferAttribute(u,p),Xh(sa,p,l,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Xh(s,e,t,n,i,r,a){const o=Il.distanceSqToPoint(s);if(o<t){const l=new R;Il.closestPointToPoint(s,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;r.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class ps extends Ot{constructor(e,t,n=On,i,r,a,o=Pt,l=Pt,c,h=$n,u=1){if(h!==$n&&h!==li)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:u};super(f,i,r,a,o,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new sl(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Jp extends ps{constructor(e,t=On,n=_i,i,r,a=Pt,o=Pt,l,c=$n){const h={width:e,height:e,depth:1},u=[h,h,h,h,h,h];super(e,e,t,n,i,r,a,o,l,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class jh extends Ot{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Vn{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ze("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const r=n.length;let a;t?a=t:a=e*n[r-1];let o=0,l=r-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=n[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(r-1);const h=n[i],f=n[i+1]-h,d=(a-h)/f;return(i+d)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const a=this.getPoint(i),o=this.getPoint(r),l=t||(a.isVector2?new de:new R);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new R,i=[],r=[],a=[],o=new R,l=new je;for(let d=0;d<=e;d++){const p=d/e;i[d]=this.getTangentAt(p,new R)}r[0]=new R,a[0]=new R;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),f<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(let d=1;d<=e;d++){if(r[d]=r[d-1].clone(),a[d]=a[d-1].clone(),o.crossVectors(i[d-1],i[d]),o.length()>Number.EPSILON){o.normalize();const p=Math.acos(Je(i[d-1].dot(i[d]),-1,1));r[d].applyMatrix4(l.makeRotationAxis(o,p))}a[d].crossVectors(i[d],r[d])}if(t===!0){let d=Math.acos(Je(r[0].dot(r[e]),-1,1));d/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(d=-d);for(let p=1;p<=e;p++)r[p].applyMatrix4(l.makeRotationAxis(i[p],d*p)),a[p].crossVectors(i[p],r[p])}return{tangents:i,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Nl extends Vn{constructor(e=0,t=0,n=1,i=1,r=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new de){const n=t,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(a?r=0:r=i),this.aClockwise===!0&&!a&&(r===i?r=-i:r=r-i);const o=this.aStartAngle+e*r;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),f=l-this.aX,d=c-this.aY;l=f*h-d*u+this.aX,c=f*u+d*h+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class Qp extends Nl{constructor(e,t,n,i,r,a){super(e,t,n,n,i,r,a),this.isArcCurve=!0,this.type="ArcCurve"}}function Ul(){let s=0,e=0,t=0,n=0;function i(r,a,o,l){s=r,e=o,t=-3*r+3*a-2*o-l,n=2*r-2*a+o+l}return{initCatmullRom:function(r,a,o,l,c){i(a,o,c*(o-r),c*(l-a))},initNonuniformCatmullRom:function(r,a,o,l,c,h,u){let f=(a-r)/c-(o-r)/(c+h)+(o-a)/h,d=(o-a)/h-(l-a)/(h+u)+(l-o)/u;f*=h,d*=h,i(a,o,f,d)},calc:function(r){const a=r*r,o=a*r;return s+e*r+t*a+n*o}}}const ra=new R,Bl=new Ul,kl=new Ul,Ol=new Ul;class em extends Vn{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new R){const n=t,i=this.points,r=i.length,a=(r-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:l===0&&o===r-1&&(o=r-2,l=1);let c,h;this.closed||o>0?c=i[(o-1)%r]:(ra.subVectors(i[0],i[1]).add(i[0]),c=ra);const u=i[o%r],f=i[(o+1)%r];if(this.closed||o+2<r?h=i[(o+2)%r]:(ra.subVectors(i[r-1],i[r-2]).add(i[r-1]),h=ra),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let p=Math.pow(c.distanceToSquared(u),d),g=Math.pow(u.distanceToSquared(f),d),v=Math.pow(f.distanceToSquared(h),d);g<1e-4&&(g=1),p<1e-4&&(p=g),v<1e-4&&(v=g),Bl.initNonuniformCatmullRom(c.x,u.x,f.x,h.x,p,g,v),kl.initNonuniformCatmullRom(c.y,u.y,f.y,h.y,p,g,v),Ol.initNonuniformCatmullRom(c.z,u.z,f.z,h.z,p,g,v)}else this.curveType==="catmullrom"&&(Bl.initCatmullRom(c.x,u.x,f.x,h.x,this.tension),kl.initCatmullRom(c.y,u.y,f.y,h.y,this.tension),Ol.initCatmullRom(c.z,u.z,f.z,h.z,this.tension));return n.set(Bl.calc(l),kl.calc(l),Ol.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new R().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Zh(s,e,t,n,i){const r=(n-e)*.5,a=(i-t)*.5,o=s*s,l=s*o;return(2*t-2*n+r+a)*l+(-3*t+3*n-2*r-a)*o+r*s+t}function tm(s,e){const t=1-s;return t*t*e}function nm(s,e){return 2*(1-s)*s*e}function im(s,e){return s*s*e}function Js(s,e,t,n){return tm(s,e)+nm(s,t)+im(s,n)}function sm(s,e){const t=1-s;return t*t*t*e}function rm(s,e){const t=1-s;return 3*t*t*s*e}function am(s,e){return 3*(1-s)*s*s*e}function om(s,e){return s*s*s*e}function Qs(s,e,t,n,i){return sm(s,e)+rm(s,t)+am(s,n)+om(s,i)}class qh extends Vn{constructor(e=new de,t=new de,n=new de,i=new de){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new de){const n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Qs(e,i.x,r.x,a.x,o.x),Qs(e,i.y,r.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class lm extends Vn{constructor(e=new R,t=new R,n=new R,i=new R){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new R){const n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Qs(e,i.x,r.x,a.x,o.x),Qs(e,i.y,r.y,a.y,o.y),Qs(e,i.z,r.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Yh extends Vn{constructor(e=new de,t=new de){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new de){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new de){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class cm extends Vn{constructor(e=new R,t=new R){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new R){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new R){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Kh extends Vn{constructor(e=new de,t=new de,n=new de){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new de){const n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(Js(e,i.x,r.x,a.x),Js(e,i.y,r.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class hm extends Vn{constructor(e=new R,t=new R,n=new R){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new R){const n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(Js(e,i.x,r.x,a.x),Js(e,i.y,r.y,a.y),Js(e,i.z,r.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class $h extends Vn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new de){const n=t,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,l=i[a===0?a:a-1],c=i[a],h=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(Zh(o,l.x,c.x,h.x,u.x),Zh(o,l.y,c.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new de().fromArray(i))}return this}}var Fl=Object.freeze({__proto__:null,ArcCurve:Qp,CatmullRomCurve3:em,CubicBezierCurve:qh,CubicBezierCurve3:lm,EllipseCurve:Nl,LineCurve:Yh,LineCurve3:cm,QuadraticBezierCurve:Kh,QuadraticBezierCurve3:hm,SplineCurve:$h});class um extends Vn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Fl[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const a=i[r]-n,o=this.curves[r],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const a=r[i],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const h=l[c];n&&n.equals(h)||(t.push(h),n=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Fl[i.type]().fromJSON(i))}return this}}class Jh extends um{constructor(e){super(),this.type="Path",this.currentPoint=new de,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Yh(this.currentPoint.clone(),new de(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new Kh(this.currentPoint.clone(),new de(e,t),new de(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,a){const o=new qh(this.currentPoint.clone(),new de(e,t),new de(n,i),new de(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new $h(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,n,i,r,a),this}absarc(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this}ellipse(e,t,n,i,r,a,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,n,i,r,a,o,l),this}absellipse(e,t,n,i,r,a,o,l){const c=new Nl(e,t,n,i,r,a,o,l);if(this.curves.length>0){const u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Qh extends Jh{constructor(e){super(e),this.uuid=xn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Jh().fromJSON(i))}return this}}function dm(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let r=eu(s,0,i,t,!0);const a=[];if(!r||r.next===r.prev)return a;let o,l,c;if(n&&(r=vm(s,e,r,t)),s.length>80*t){o=s[0],l=s[1];let h=o,u=l;for(let f=t;f<i;f+=t){const d=s[f],p=s[f+1];d<o&&(o=d),p<l&&(l=p),d>h&&(h=d),p>u&&(u=p)}c=Math.max(h-o,u-l),c=c!==0?32767/c:0}return er(r,a,t,o,l,c,0),a}function eu(s,e,t,n,i){let r;if(i===Am(s,e,t,n)>0)for(let a=e;a<t;a+=n)r=su(a/n|0,s[a],s[a+1],r);else for(let a=t-n;a>=e;a-=n)r=su(a/n|0,s[a],s[a+1],r);return r&&ms(r,r.next)&&(ir(r),r=r.next),r}function Ci(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(ms(t,t.next)||Mt(t.prev,t,t.next)===0)){if(ir(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function er(s,e,t,n,i,r,a){if(!s)return;!a&&r&&Mm(s,n,i,r);let o=s;for(;s.prev!==s.next;){const l=s.prev,c=s.next;if(r?pm(s,n,i,r):fm(s)){e.push(l.i,s.i,c.i),ir(s),s=c.next,o=c.next;continue}if(s=c,s===o){a?a===1?(s=mm(Ci(s),e),er(s,e,t,n,i,r,2)):a===2&&gm(s,e,t,n,i,r):er(Ci(s),e,t,n,i,r,1);break}}}function fm(s){const e=s.prev,t=s,n=s.next;if(Mt(e,t,n)>=0)return!1;const i=e.x,r=t.x,a=n.x,o=e.y,l=t.y,c=n.y,h=Math.min(i,r,a),u=Math.min(o,l,c),f=Math.max(i,r,a),d=Math.max(o,l,c);let p=n.next;for(;p!==e;){if(p.x>=h&&p.x<=f&&p.y>=u&&p.y<=d&&tr(i,o,r,l,a,c,p.x,p.y)&&Mt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function pm(s,e,t,n){const i=s.prev,r=s,a=s.next;if(Mt(i,r,a)>=0)return!1;const o=i.x,l=r.x,c=a.x,h=i.y,u=r.y,f=a.y,d=Math.min(o,l,c),p=Math.min(h,u,f),g=Math.max(o,l,c),v=Math.max(h,u,f),m=zl(d,p,e,t,n),x=zl(g,v,e,t,n);let _=s.prevZ,M=s.nextZ;for(;_&&_.z>=m&&M&&M.z<=x;){if(_.x>=d&&_.x<=g&&_.y>=p&&_.y<=v&&_!==i&&_!==a&&tr(o,h,l,u,c,f,_.x,_.y)&&Mt(_.prev,_,_.next)>=0||(_=_.prevZ,M.x>=d&&M.x<=g&&M.y>=p&&M.y<=v&&M!==i&&M!==a&&tr(o,h,l,u,c,f,M.x,M.y)&&Mt(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;_&&_.z>=m;){if(_.x>=d&&_.x<=g&&_.y>=p&&_.y<=v&&_!==i&&_!==a&&tr(o,h,l,u,c,f,_.x,_.y)&&Mt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;M&&M.z<=x;){if(M.x>=d&&M.x<=g&&M.y>=p&&M.y<=v&&M!==i&&M!==a&&tr(o,h,l,u,c,f,M.x,M.y)&&Mt(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function mm(s,e){let t=s;do{const n=t.prev,i=t.next.next;!ms(n,i)&&nu(n,t,t.next,i)&&nr(n,i)&&nr(i,n)&&(e.push(n.i,t.i,i.i),ir(t),ir(t.next),t=s=i),t=t.next}while(t!==s);return Ci(t)}function gm(s,e,t,n,i,r){let a=s;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Em(a,o)){let l=iu(a,o);a=Ci(a,a.next),l=Ci(l,l.next),er(a,e,t,n,i,r,0),er(l,e,t,n,i,r,0);return}o=o.next}a=a.next}while(a!==s)}function vm(s,e,t,n){const i=[];for(let r=0,a=e.length;r<a;r++){const o=e[r]*n,l=r<a-1?e[r+1]*n:s.length,c=eu(s,o,l,n,!1);c===c.next&&(c.steiner=!0),i.push(Sm(c))}i.sort(xm);for(let r=0;r<i.length;r++)t=_m(i[r],t);return t}function xm(s,e){let t=s.x-e.x;if(t===0&&(t=s.y-e.y,t===0)){const n=(s.next.y-s.y)/(s.next.x-s.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function _m(s,e){const t=bm(s,e);if(!t)return e;const n=iu(t,s);return Ci(n,n.next),Ci(t,t.next)}function bm(s,e){let t=e;const n=s.x,i=s.y;let r=-1/0,a;if(ms(s,t))return t;do{if(ms(s,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const u=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>r&&(r=u,a=t.x<t.next.x?t:t.next,u===n))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,l=a.x,c=a.y;let h=1/0;t=a;do{if(n>=t.x&&t.x>=l&&n!==t.x&&tu(i<c?n:r,i,l,c,i<c?r:n,i,t.x,t.y)){const u=Math.abs(i-t.y)/(n-t.x);nr(t,s)&&(u<h||u===h&&(t.x>a.x||t.x===a.x&&ym(a,t)))&&(a=t,h=u)}t=t.next}while(t!==o);return a}function ym(s,e){return Mt(s.prev,s,e.prev)<0&&Mt(e.next,s,s.next)<0}function Mm(s,e,t,n){let i=s;do i.z===0&&(i.z=zl(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,wm(i)}function wm(s){let e,t=1;do{let n=s,i;s=null;let r=null;for(e=0;n;){e++;let a=n,o=0;for(let c=0;c<t&&(o++,a=a.nextZ,!!a);c++);let l=t;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,o--):(i=a,a=a.nextZ,l--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;n=a}r.nextZ=null,t*=2}while(e>1);return s}function zl(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function Sm(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function tu(s,e,t,n,i,r,a,o){return(i-a)*(e-o)>=(s-a)*(r-o)&&(s-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(r-o)>=(i-a)*(n-o)}function tr(s,e,t,n,i,r,a,o){return!(s===a&&e===o)&&tu(s,e,t,n,i,r,a,o)}function Em(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!Tm(s,e)&&(nr(s,e)&&nr(e,s)&&Cm(s,e)&&(Mt(s.prev,s,e.prev)||Mt(s,e.prev,e))||ms(s,e)&&Mt(s.prev,s,s.next)>0&&Mt(e.prev,e,e.next)>0)}function Mt(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function ms(s,e){return s.x===e.x&&s.y===e.y}function nu(s,e,t,n){const i=oa(Mt(s,e,t)),r=oa(Mt(s,e,n)),a=oa(Mt(t,n,s)),o=oa(Mt(t,n,e));return!!(i!==r&&a!==o||i===0&&aa(s,t,e)||r===0&&aa(s,n,e)||a===0&&aa(t,s,n)||o===0&&aa(t,e,n))}function aa(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function oa(s){return s>0?1:s<0?-1:0}function Tm(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&nu(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function nr(s,e){return Mt(s.prev,s,s.next)<0?Mt(s,e,s.next)>=0&&Mt(s,s.prev,e)>=0:Mt(s,e,s.prev)<0||Mt(s,s.next,e)<0}function Cm(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function iu(s,e){const t=Hl(s.i,s.x,s.y),n=Hl(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function su(s,e,t,n){const i=Hl(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ir(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Hl(s,e,t){return{i:s,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Am(s,e,t,n){let i=0;for(let r=e,a=t-n;r<t;r+=n)i+=(s[a]-s[r])*(s[r+1]+s[a+1]),a=r;return i}class Pm{static triangulate(e,t,n=2){return dm(e,t,n)}}class gs{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5}static isClockWise(e){return gs.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];ru(e),au(n,e);let a=e.length;t.forEach(ru);for(let l=0;l<t.length;l++)i.push(a),a+=t[l].length,au(n,t[l]);const o=Pm.triangulate(n,i);for(let l=0;l<o.length;l+=3)r.push(o.slice(l,l+3));return r}}function ru(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function au(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class Vl extends gt{constructor(e=new Qh([new de(.5,.5),new de(-.5,.5),new de(-.5,-.5),new de(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new Kt(i,3)),this.setAttribute("uv",new Kt(r,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,h=t.steps!==void 0?t.steps:1,u=t.depth!==void 0?t.depth:1;let f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:d-.1,g=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3;const m=t.extrudePath,x=t.UVGenerator!==void 0?t.UVGenerator:Rm;let _,M=!1,T,A,L,U;if(m){_=m.getSpacedPoints(h),M=!0,f=!1;const b=m.isCatmullRomCurve3?m.closed:!1;T=m.computeFrenetFrames(h,b),A=new R,L=new R,U=new R}f||(v=0,d=0,p=0,g=0);const E=o.extractPoints(c);let C=E.shape;const k=E.holes;if(!gs.isClockWise(C)){C=C.reverse();for(let b=0,X=k.length;b<X;b++){const H=k[b];gs.isClockWise(H)&&(k[b]=H.reverse())}}function B(b){const H=10000000000000001e-36;let N=b[0];for(let y=1;y<=b.length;y++){const G=y%b.length,$=b[G],ne=$.x-N.x,V=$.y-N.y,P=ne*ne+V*V,S=Math.max(Math.abs($.x),Math.abs($.y),Math.abs(N.x),Math.abs(N.y)),O=H*S*S;if(P<=O){b.splice(G,1),y--;continue}N=$}}B(C),k.forEach(B);const w=k.length,F=C;for(let b=0;b<w;b++){const X=k[b];C=C.concat(X)}function q(b,X,H){return X||Xe("ExtrudeGeometry: vec does not exist"),b.clone().addScaledVector(X,H)}const z=C.length;function te(b,X,H){let N,y,G;const $=b.x-X.x,ne=b.y-X.y,V=H.x-b.x,P=H.y-b.y,S=$*$+ne*ne,O=$*P-ne*V;if(Math.abs(O)>Number.EPSILON){const Y=Math.sqrt(S),oe=Math.sqrt(V*V+P*P),Q=X.x-ne/Y,Se=X.y+$/Y,_e=H.x-P/oe,Te=H.y+V/oe,He=((_e-Q)*P-(Te-Se)*V)/($*P-ne*V);N=Q+$*He-b.x,y=Se+ne*He-b.y;const he=N*N+y*y;if(he<=2)return new de(N,y);G=Math.sqrt(he/2)}else{let Y=!1;$>Number.EPSILON?V>Number.EPSILON&&(Y=!0):$<-Number.EPSILON?V<-Number.EPSILON&&(Y=!0):Math.sign(ne)===Math.sign(P)&&(Y=!0),Y?(N=-ne,y=$,G=Math.sqrt(S)):(N=$,y=ne,G=Math.sqrt(S/2))}return new de(N/G,y/G)}const K=[];for(let b=0,X=F.length,H=X-1,N=b+1;b<X;b++,H++,N++)H===X&&(H=0),N===X&&(N=0),K[b]=te(F[b],F[H],F[N]);const le=[];let W,j=K.concat();for(let b=0,X=w;b<X;b++){const H=k[b];W=[];for(let N=0,y=H.length,G=y-1,$=N+1;N<y;N++,G++,$++)G===y&&(G=0),$===y&&($=0),W[N]=te(H[N],H[G],H[$]);le.push(W),j=j.concat(W)}let me;if(v===0)me=gs.triangulateShape(F,k);else{const b=[],X=[];for(let H=0;H<v;H++){const N=H/v,y=d*Math.cos(N*Math.PI/2),G=p*Math.sin(N*Math.PI/2)+g;for(let $=0,ne=F.length;$<ne;$++){const V=q(F[$],K[$],G);be(V.x,V.y,-y),N===0&&b.push(V)}for(let $=0,ne=w;$<ne;$++){const V=k[$];W=le[$];const P=[];for(let S=0,O=V.length;S<O;S++){const Y=q(V[S],W[S],G);be(Y.x,Y.y,-y),N===0&&P.push(Y)}N===0&&X.push(P)}}me=gs.triangulateShape(b,X)}const ge=me.length,ue=p+g;for(let b=0;b<z;b++){const X=f?q(C[b],j[b],ue):C[b];M?(L.copy(T.normals[0]).multiplyScalar(X.x),A.copy(T.binormals[0]).multiplyScalar(X.y),U.copy(_[0]).add(L).add(A),be(U.x,U.y,U.z)):be(X.x,X.y,0)}for(let b=1;b<=h;b++)for(let X=0;X<z;X++){const H=f?q(C[X],j[X],ue):C[X];M?(L.copy(T.normals[b]).multiplyScalar(H.x),A.copy(T.binormals[b]).multiplyScalar(H.y),U.copy(_[b]).add(L).add(A),be(U.x,U.y,U.z)):be(H.x,H.y,u/h*b)}for(let b=v-1;b>=0;b--){const X=b/v,H=d*Math.cos(X*Math.PI/2),N=p*Math.sin(X*Math.PI/2)+g;for(let y=0,G=F.length;y<G;y++){const $=q(F[y],K[y],N);be($.x,$.y,u+H)}for(let y=0,G=k.length;y<G;y++){const $=k[y];W=le[y];for(let ne=0,V=$.length;ne<V;ne++){const P=q($[ne],W[ne],N);M?be(P.x,P.y+_[h-1].y,_[h-1].x+H):be(P.x,P.y,u+H)}}}ie(),ce();function ie(){const b=i.length/3;if(f){let X=0,H=z*X;for(let N=0;N<ge;N++){const y=me[N];ye(y[2]+H,y[1]+H,y[0]+H)}X=h+v*2,H=z*X;for(let N=0;N<ge;N++){const y=me[N];ye(y[0]+H,y[1]+H,y[2]+H)}}else{for(let X=0;X<ge;X++){const H=me[X];ye(H[2],H[1],H[0])}for(let X=0;X<ge;X++){const H=me[X];ye(H[0]+z*h,H[1]+z*h,H[2]+z*h)}}n.addGroup(b,i.length/3-b,0)}function ce(){const b=i.length/3;let X=0;fe(F,X),X+=F.length;for(let H=0,N=k.length;H<N;H++){const y=k[H];fe(y,X),X+=y.length}n.addGroup(b,i.length/3-b,1)}function fe(b,X){let H=b.length;for(;--H>=0;){const N=H;let y=H-1;y<0&&(y=b.length-1);for(let G=0,$=h+v*2;G<$;G++){const ne=z*G,V=z*(G+1),P=X+N+ne,S=X+y+ne,O=X+y+V,Y=X+N+V;Oe(P,S,O,Y)}}}function be(b,X,H){l.push(b),l.push(X),l.push(H)}function ye(b,X,H){Ke(b),Ke(X),Ke(H);const N=i.length/3,y=x.generateTopUV(n,i,N-3,N-2,N-1);Fe(y[0]),Fe(y[1]),Fe(y[2])}function Oe(b,X,H,N){Ke(b),Ke(X),Ke(N),Ke(X),Ke(H),Ke(N);const y=i.length/3,G=x.generateSideWallUV(n,i,y-6,y-3,y-2,y-1);Fe(G[0]),Fe(G[1]),Fe(G[3]),Fe(G[1]),Fe(G[2]),Fe(G[3])}function Ke(b){i.push(l[b*3+0]),i.push(l[b*3+1]),i.push(l[b*3+2])}function Fe(b){r.push(b.x),r.push(b.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Lm(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,a=e.shapes.length;r<a;r++){const o=t[e.shapes[r]];n.push(o)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new Fl[i.type]().fromJSON(i)),new Vl(n,e.options)}}const Rm={generateTopUV:function(s,e,t,n,i){const r=e[t*3],a=e[t*3+1],o=e[n*3],l=e[n*3+1],c=e[i*3],h=e[i*3+1];return[new de(r,a),new de(o,l),new de(c,h)]},generateSideWallUV:function(s,e,t,n,i,r){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[n*3],h=e[n*3+1],u=e[n*3+2],f=e[i*3],d=e[i*3+1],p=e[i*3+2],g=e[r*3],v=e[r*3+1],m=e[r*3+2];return Math.abs(o-h)<Math.abs(a-c)?[new de(a,1-l),new de(c,1-u),new de(f,1-p),new de(g,1-m)]:[new de(o,1-l),new de(h,1-u),new de(d,1-p),new de(v,1-m)]}};function Lm(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];t.shapes.push(r.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class la extends gt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,o=Math.floor(n),l=Math.floor(i),c=o+1,h=l+1,u=e/o,f=t/l,d=[],p=[],g=[],v=[];for(let m=0;m<h;m++){const x=m*f-a;for(let _=0;_<c;_++){const M=_*u-r;p.push(M,-x,0),g.push(0,0,1),v.push(_/o),v.push(1-m/l)}}for(let m=0;m<l;m++)for(let x=0;x<o;x++){const _=x+c*m,M=x+c*(m+1),T=x+1+c*(m+1),A=x+1+c*m;d.push(_,M,A),d.push(M,T,A)}this.setIndex(d),this.setAttribute("position",new Kt(p,3)),this.setAttribute("normal",new Kt(g,3)),this.setAttribute("uv",new Kt(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new la(e.width,e.height,e.widthSegments,e.heightSegments)}}class ou extends Rt{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ca extends dn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new ke(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Fs,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new sn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Rn extends ca{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new de(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Je(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ke(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ke(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ke(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Dm extends dn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ke(16777215),this.specular=new ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Fs,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new sn,this.combine=yr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Im extends dn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Fs,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class lu extends dn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Fs,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new sn,this.combine=yr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Nm extends dn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Zf,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Um extends dn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function ha(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function Bm(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function cu(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){const o=t[r]*e;for(let l=0;l!==e;++l)i[a++]=s[o+l]}return i}function hu(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(e.push(r.time),t.push(...a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(e.push(r.time),a.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=s[i++];while(r!==void 0)}class sr{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=r)){const o=t[1];e<o&&(n=2,r=o);for(let l=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let a=0;a!==i;++a)t[a]=n[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class km extends sr{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:qc,endingEnd:qc}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,o=i[r],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Yc:r=e,o=2*t-n;break;case Kc:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case Yc:a=e,l=2*n-t;break;case Kc:a=1,l=n+i[1]-i[0];break;default:a=e-1,l=t}const c=(n-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),g=p*p,v=g*p,m=-f*v+2*f*g-f*p,x=(1+f)*v+(-1.5-2*f)*g+(-.5+f)*p+1,_=(-1-d)*v+(1.5+d)*g+.5*p,M=d*v-d*g;for(let T=0;T!==o;++T)r[T]=m*a[h+T]+x*a[c+T]+_*a[l+T]+M*a[u+T];return r}}class Om extends sr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(n-t)/(i-t),u=1-h;for(let f=0;f!==o;++f)r[f]=a[c+f]*u+a[l+f]*h;return r}}class Fm extends sr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Ln{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ha(t,this.TimeBufferType),this.values=ha(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ha(e.times,Array),values:ha(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Fm(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Om(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new km(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ks:t=this.InterpolantFactoryMethodDiscrete;break;case Os:t=this.InterpolantFactoryMethodLinear;break;case Ko:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return ze("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ks;case this.InterpolantFactoryMethodLinear:return Os;case this.InterpolantFactoryMethodSmooth:return Ko}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Xe("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(Xe("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){Xe("KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){Xe("KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&tp(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){Xe("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Ko,r=e.length-1;let a=1;for(let o=1;o<r;++o){let l=!1;const c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(i)l=!0;else{const u=o*n,f=u-n,d=u+n;for(let p=0;p!==n;++p){const g=t[u+p];if(g!==t[f+p]||g!==t[d+p]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const u=o*n,f=a*n;for(let d=0;d!==n;++d)t[f+d]=t[u+d]}++a}}if(r>0){e[a]=e[r];for(let o=r*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Ln.prototype.ValueTypeName="",Ln.prototype.TimeBufferType=Float32Array,Ln.prototype.ValueBufferType=Float32Array,Ln.prototype.DefaultInterpolation=Os;class vs extends Ln{constructor(e,t,n){super(e,t,n)}}vs.prototype.ValueTypeName="bool",vs.prototype.ValueBufferType=Array,vs.prototype.DefaultInterpolation=ks,vs.prototype.InterpolantFactoryMethodLinear=void 0,vs.prototype.InterpolantFactoryMethodSmooth=void 0;class uu extends Ln{constructor(e,t,n,i){super(e,t,n,i)}}uu.prototype.ValueTypeName="color";class xs extends Ln{constructor(e,t,n,i){super(e,t,n,i)}}xs.prototype.ValueTypeName="number";class zm extends sr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(i-t);let c=e*o;for(let h=c+o;c!==h;c+=4)En.slerpFlat(r,0,a,c-o,a,c,l);return r}}class _s extends Ln{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new zm(this.times,this.values,this.getValueSize(),e)}}_s.prototype.ValueTypeName="quaternion",_s.prototype.InterpolantFactoryMethodSmooth=void 0;class bs extends Ln{constructor(e,t,n){super(e,t,n)}}bs.prototype.ValueTypeName="string",bs.prototype.ValueBufferType=Array,bs.prototype.DefaultInterpolation=ks,bs.prototype.InterpolantFactoryMethodLinear=void 0,bs.prototype.InterpolantFactoryMethodSmooth=void 0;class ys extends Ln{constructor(e,t,n,i){super(e,t,n,i)}}ys.prototype.ValueTypeName="vector";class Hm{constructor(e="",t=-1,n=[],i=Xf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=xn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Gm(n[a]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,a=n.length;r!==a;++r)t.push(Ln.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let o=0;o<r;o++){let l=[],c=[];l.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);const h=Bm(l);l=cu(l,1,h),c=cu(c,1,h),!i&&l[0]===0&&(l.push(r),c.push(c[0])),a.push(new xs(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],h=c.name.match(r);if(h&&h.length>1){const u=h[1];let f=i[u];f||(i[u]=f=[]),f.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(ze("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Xe("AnimationClip: No animation in JSONLoader data."),null;const n=function(u,f,d,p,g){if(d.length!==0){const v=[],m=[];hu(d,v,m,p),v.length!==0&&g.push(new u(f,v,m))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u<c.length;u++){const f=c[u].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let p;for(p=0;p<f.length;p++)if(f[p].morphTargets)for(let g=0;g<f[p].morphTargets.length;g++)d[f[p].morphTargets[g]]=-1;for(const g in d){const v=[],m=[];for(let x=0;x!==f[p].morphTargets.length;++x){const _=f[p];v.push(_.time),m.push(_.morphTarget===g?1:0)}i.push(new xs(".morphTargetInfluence["+g+"]",v,m))}l=d.length*a}else{const d=".bones["+t[u].name+"]";n(ys,d+".position",f,"pos",i),n(_s,d+".quaternion",f,"rot",i),n(ys,d+".scale",f,"scl",i)}}return i.length===0?null:new this(r,l,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Vm(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return xs;case"vector":case"vector2":case"vector3":case"vector4":return ys;case"color":return uu;case"quaternion":return _s;case"bool":case"boolean":return vs;case"string":return bs}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function Gm(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Vm(s.type);if(s.times===void 0){const t=[],n=[];hu(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const si={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class Wm{constructor(e,t,n){const i=this;let r=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(h){o++,r===!1&&i.onStart!==void 0&&i.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,f=c.length;u<f;u+=2){const d=c[u],p=c[u+1];if(d.global&&(d.lastIndex=0),d.test(h))return p}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const Xm=new Wm;class Ai{constructor(e){this.manager=e!==void 0?e:Xm,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Ai.DEFAULT_MATERIAL_NAME="__DEFAULT";const ri={};class jm extends Error{constructor(e,t){super(e),this.response=t}}class ua extends Ai{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=si.get(`file:${e}`);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(ri[e]!==void 0){ri[e].push({onLoad:t,onProgress:n,onError:i});return}ri[e]=[],ri[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&ze("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=ri[e],u=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),d=f?parseInt(f):0,p=d!==0;let g=0;const v=new ReadableStream({start(m){x();function x(){u.read().then(({done:_,value:M})=>{if(_)m.close();else{g+=M.byteLength;const T=new ProgressEvent("progress",{lengthComputable:p,loaded:g,total:d});for(let A=0,L=h.length;A<L;A++){const U=h[A];U.onProgress&&U.onProgress(T)}m.enqueue(M),x()}},_=>{m.error(_)})}}});return new Response(v)}else throw new jm(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o==="")return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(p=>d.decode(p))}}}).then(c=>{si.add(`file:${e}`,c);const h=ri[e];delete ri[e];for(let u=0,f=h.length;u<f;u++){const d=h[u];d.onLoad&&d.onLoad(c)}}).catch(c=>{const h=ri[e];if(h===void 0)throw this.manager.itemError(e),c;delete ri[e];for(let u=0,f=h.length;u<f;u++){const d=h[u];d.onError&&d.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const Ms=new WeakMap;class Zm extends Ai{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=si.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);else{let u=Ms.get(a);u===void 0&&(u=[],Ms.set(a,u)),u.push({onLoad:t,onError:i})}return a}const o=zs("img");function l(){h(),t&&t(this);const u=Ms.get(this)||[];for(let f=0;f<u.length;f++){const d=u[f];d.onLoad&&d.onLoad(this)}Ms.delete(this),r.manager.itemEnd(e)}function c(u){h(),i&&i(u),si.remove(`image:${e}`);const f=Ms.get(this)||[];for(let d=0;d<f.length;d++){const p=f[d];p.onError&&p.onError(u)}Ms.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),si.add(`image:${e}`,o),r.manager.itemStart(e),o.src=e,o}}class du extends Ai{constructor(e){super(e)}load(e,t,n,i){const r=new Ot,a=new Zm(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){r.image=o,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class da extends yt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ke(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}const Gl=new je,fu=new R,pu=new R;class Wl{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new de(512,512),this.mapType=nn,this.map=null,this.mapPass=null,this.matrix=new je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ll,this._frameExtents=new de(1,1),this._viewportCount=1,this._viewports=[new _t(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;fu.setFromMatrixPosition(e.matrixWorld),t.position.copy(fu),pu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(pu),t.updateMatrixWorld(),Gl.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Gl,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Gl)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class qm extends Wl{constructor(){super(new Zt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=Ki*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Ym extends da{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.target=new yt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new qm}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class Km extends Wl{constructor(){super(new Zt(90,1,.5,500)),this.isPointLightShadow=!0}}class $m extends da{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Km}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class gi extends wh{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,o=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,a=r+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Jm extends Wl{constructor(){super(new gi(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class mu extends da{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(yt.DEFAULT_UP),this.updateMatrix(),this.target=new yt,this.shadow=new Jm}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class gu extends da{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class rr{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}const Xl=new WeakMap;class Qm extends Ai{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&ze("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ze("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=si.get(`image-bitmap:${e}`);if(a!==void 0){if(r.manager.itemStart(e),a.then){a.then(c=>{if(Xl.has(a)===!0)i&&i(Xl.get(a)),r.manager.itemError(e),r.manager.itemEnd(e);else return t&&t(c),r.manager.itemEnd(e),c});return}return setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){return si.add(`image-bitmap:${e}`,c),t&&t(c),r.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Xl.set(l,c),si.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});si.add(`image-bitmap:${e}`,l),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class eg extends Zt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class tg{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const jl="\\[\\]\\.:\\/",ng=new RegExp("["+jl+"]","g"),Zl="[^"+jl+"]",ig="[^"+jl.replace("\\.","")+"]",sg=/((?:WC+[\/:])*)/.source.replace("WC",Zl),rg=/(WCOD+)?/.source.replace("WCOD",ig),ag=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Zl),og=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Zl),lg=new RegExp("^"+sg+rg+ag+og+"$"),cg=["material","materials","bones","map"];class hg{constructor(e,t,n){const i=n||lt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class lt{constructor(e,t,n){this.path=t,this.parsedPath=n||lt.parseTrackName(t),this.node=lt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new lt.Composite(e,t,n):new lt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ng,"")}static parseTrackName(e){const t=lg.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);cg.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r){for(let a=0;a<r.length;a++){const o=r[a];if(o.name===t||o.uuid===t)return o;const l=n(o.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=lt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){ze("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Xe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Xe("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Xe("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Xe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Xe("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Xe("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Xe("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[i];if(a===void 0){const c=t.nodeName;Xe("PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Xe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Xe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}lt.Composite=hg,lt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},lt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},lt.prototype.GetterByBindingType=[lt.prototype._getValue_direct,lt.prototype._getValue_array,lt.prototype._getValue_arrayElement,lt.prototype._getValue_toArray],lt.prototype.SetterByBindingTypeAndVersioning=[[lt.prototype._setValue_direct,lt.prototype._setValue_direct_setNeedsUpdate,lt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_array,lt.prototype._setValue_array_setNeedsUpdate,lt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_arrayElement,lt.prototype._setValue_arrayElement_setNeedsUpdate,lt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_fromArray,lt.prototype._setValue_fromArray_setNeedsUpdate,lt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];const vu=new je;class ar{constructor(e,t,n=0,i=1/0){this.ray=new ns(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new dl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Xe("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return vu.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(vu),this}intersectObject(e,t=!0,n=[]){return ql(e,this,n,t),n.sort(xu),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)ql(e[i],this,n,t);return n.sort(xu),n}}function xu(s,e){return s.distance-e.distance}function ql(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const r=s.children;for(let a=0,o=r.length;a<o;a++)ql(r[a],e,t,!0)}}class _u{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Je(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Je(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class ug extends bi{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){ze("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function bu(s,e,t,n){const i=dg(n);switch(t){case jc:return s*e;case po:return s*e/i.components*i.byteLength;case mo:return s*e/i.components*i.byteLength;case qi:return s*e*2/i.components*i.byteLength;case go:return s*e*2/i.components*i.byteLength;case Zc:return s*e*3/i.components*i.byteLength;case hn:return s*e*4/i.components*i.byteLength;case vo:return s*e*4/i.components*i.byteLength;case Tr:case Cr:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Ar:case Pr:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case _o:case yo:return Math.max(s,16)*Math.max(e,8)/4;case xo:case bo:return Math.max(s,8)*Math.max(e,8)/2;case Mo:case wo:case Eo:case To:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case So:case Co:case Ao:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Po:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Ro:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case Lo:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case Do:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case Io:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case No:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case Uo:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case Bo:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case ko:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case Oo:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case Fo:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case zo:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case Ho:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case Vo:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case Go:case Wo:case Xo:return Math.ceil(s/4)*Math.ceil(e/4)*16;case jo:case Zo:return Math.ceil(s/4)*Math.ceil(e/4)*8;case qo:case Yo:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function dg(s){switch(s){case nn:case Vc:return{byteLength:1,components:1};case Bs:case Gc:case Yt:return{byteLength:2,components:1};case uo:case fo:return{byteLength:2,components:4};case On:case ho:case vn:return{byteLength:4,components:1};case Wc:case Xc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ga}})),typeof window<"u"&&(window.__THREE__?ze("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ga);function yu(){let s=null,e=!1,t=null,n=null;function i(r,a){t(r,a),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function fg(s){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,u=c.byteLength,f=s.createBuffer();s.bindBuffer(l,f),s.bufferData(l,c,h),o.onUploadCallback();let d;if(c instanceof Float32Array)d=s.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)d=s.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?d=s.HALF_FLOAT:d=s.UNSIGNED_SHORT;else if(c instanceof Int16Array)d=s.SHORT;else if(c instanceof Uint32Array)d=s.UNSIGNED_INT;else if(c instanceof Int32Array)d=s.INT;else if(c instanceof Int8Array)d=s.BYTE;else if(c instanceof Uint8Array)d=s.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)d=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:d,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l.updateRanges;if(s.bindBuffer(c,o),u.length===0)s.bufferSubData(c,0,h);else{u.sort((d,p)=>d.start-p.start);let f=0;for(let d=1;d<u.length;d++){const p=u[f],g=u[d];g.start<=p.start+p.count+1?p.count=Math.max(p.count,g.start+g.count-p.start):(++f,u[f]=g)}u.length=f+1;for(let d=0,p=u.length;d<p;d++){const g=u[d];s.bufferSubData(c,g.start*h.BYTES_PER_ELEMENT,h,g.start,g.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(s.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:i,remove:r,update:a}}var pg=`#ifdef USE_ALPHAHASH
|
||
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
||
#endif`,mg=`#ifdef USE_ALPHAHASH
|
||
const float ALPHA_HASH_SCALE = 0.05;
|
||
float hash2D( vec2 value ) {
|
||
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
||
}
|
||
float hash3D( vec3 value ) {
|
||
return hash2D( vec2( hash2D( value.xy ), value.z ) );
|
||
}
|
||
float getAlphaHashThreshold( vec3 position ) {
|
||
float maxDeriv = max(
|
||
length( dFdx( position.xyz ) ),
|
||
length( dFdy( position.xyz ) )
|
||
);
|
||
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
|
||
vec2 pixScales = vec2(
|
||
exp2( floor( log2( pixScale ) ) ),
|
||
exp2( ceil( log2( pixScale ) ) )
|
||
);
|
||
vec2 alpha = vec2(
|
||
hash3D( floor( pixScales.x * position.xyz ) ),
|
||
hash3D( floor( pixScales.y * position.xyz ) )
|
||
);
|
||
float lerpFactor = fract( log2( pixScale ) );
|
||
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
|
||
float a = min( lerpFactor, 1.0 - lerpFactor );
|
||
vec3 cases = vec3(
|
||
x * x / ( 2.0 * a * ( 1.0 - a ) ),
|
||
( x - 0.5 * a ) / ( 1.0 - a ),
|
||
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
|
||
);
|
||
float threshold = ( x < ( 1.0 - a ) )
|
||
? ( ( x < a ) ? cases.x : cases.y )
|
||
: cases.z;
|
||
return clamp( threshold , 1.0e-6, 1.0 );
|
||
}
|
||
#endif`,gg=`#ifdef USE_ALPHAMAP
|
||
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
||
#endif`,vg=`#ifdef USE_ALPHAMAP
|
||
uniform sampler2D alphaMap;
|
||
#endif`,xg=`#ifdef USE_ALPHATEST
|
||
#ifdef ALPHA_TO_COVERAGE
|
||
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
||
if ( diffuseColor.a == 0.0 ) discard;
|
||
#else
|
||
if ( diffuseColor.a < alphaTest ) discard;
|
||
#endif
|
||
#endif`,_g=`#ifdef USE_ALPHATEST
|
||
uniform float alphaTest;
|
||
#endif`,bg=`#ifdef USE_AOMAP
|
||
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
||
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
||
#if defined( USE_CLEARCOAT )
|
||
clearcoatSpecularIndirect *= ambientOcclusion;
|
||
#endif
|
||
#if defined( USE_SHEEN )
|
||
sheenSpecularIndirect *= ambientOcclusion;
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
||
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
||
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
||
#endif
|
||
#endif`,yg=`#ifdef USE_AOMAP
|
||
uniform sampler2D aoMap;
|
||
uniform float aoMapIntensity;
|
||
#endif`,Mg=`#ifdef USE_BATCHING
|
||
#if ! defined( GL_ANGLE_multi_draw )
|
||
#define gl_DrawID _gl_DrawID
|
||
uniform int _gl_DrawID;
|
||
#endif
|
||
uniform highp sampler2D batchingTexture;
|
||
uniform highp usampler2D batchingIdTexture;
|
||
mat4 getBatchingMatrix( const in float i ) {
|
||
int size = textureSize( batchingTexture, 0 ).x;
|
||
int j = int( i ) * 4;
|
||
int x = j % size;
|
||
int y = j / size;
|
||
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
|
||
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
|
||
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
|
||
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
||
return mat4( v1, v2, v3, v4 );
|
||
}
|
||
float getIndirectIndex( const in int i ) {
|
||
int size = textureSize( batchingIdTexture, 0 ).x;
|
||
int x = i % size;
|
||
int y = i / size;
|
||
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
|
||
}
|
||
#endif
|
||
#ifdef USE_BATCHING_COLOR
|
||
uniform sampler2D batchingColorTexture;
|
||
vec3 getBatchingColor( const in float i ) {
|
||
int size = textureSize( batchingColorTexture, 0 ).x;
|
||
int j = int( i );
|
||
int x = j % size;
|
||
int y = j / size;
|
||
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
|
||
}
|
||
#endif`,wg=`#ifdef USE_BATCHING
|
||
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
||
#endif`,Sg=`vec3 transformed = vec3( position );
|
||
#ifdef USE_ALPHAHASH
|
||
vPosition = vec3( position );
|
||
#endif`,Eg=`vec3 objectNormal = vec3( normal );
|
||
#ifdef USE_TANGENT
|
||
vec3 objectTangent = vec3( tangent.xyz );
|
||
#endif`,Tg=`float G_BlinnPhong_Implicit( ) {
|
||
return 0.25;
|
||
}
|
||
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
||
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
||
}
|
||
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float dotVH = saturate( dot( viewDir, halfDir ) );
|
||
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
||
float G = G_BlinnPhong_Implicit( );
|
||
float D = D_BlinnPhong( shininess, dotNH );
|
||
return F * ( G * D );
|
||
} // validated`,Cg=`#ifdef USE_IRIDESCENCE
|
||
const mat3 XYZ_TO_REC709 = mat3(
|
||
3.2404542, -0.9692660, 0.0556434,
|
||
-1.5371385, 1.8760108, -0.2040259,
|
||
-0.4985314, 0.0415560, 1.0572252
|
||
);
|
||
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
|
||
vec3 sqrtF0 = sqrt( fresnel0 );
|
||
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
|
||
}
|
||
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
|
||
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
|
||
}
|
||
float IorToFresnel0( float transmittedIor, float incidentIor ) {
|
||
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
|
||
}
|
||
vec3 evalSensitivity( float OPD, vec3 shift ) {
|
||
float phase = 2.0 * PI * OPD * 1.0e-9;
|
||
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
|
||
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
|
||
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
|
||
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
|
||
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
|
||
xyz /= 1.0685e-7;
|
||
vec3 rgb = XYZ_TO_REC709 * xyz;
|
||
return rgb;
|
||
}
|
||
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
|
||
vec3 I;
|
||
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
|
||
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
|
||
float cosTheta2Sq = 1.0 - sinTheta2Sq;
|
||
if ( cosTheta2Sq < 0.0 ) {
|
||
return vec3( 1.0 );
|
||
}
|
||
float cosTheta2 = sqrt( cosTheta2Sq );
|
||
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
|
||
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
|
||
float T121 = 1.0 - R12;
|
||
float phi12 = 0.0;
|
||
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
|
||
float phi21 = PI - phi12;
|
||
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
|
||
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
|
||
vec3 phi23 = vec3( 0.0 );
|
||
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
|
||
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
|
||
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
|
||
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
|
||
vec3 phi = vec3( phi21 ) + phi23;
|
||
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
|
||
vec3 r123 = sqrt( R123 );
|
||
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
|
||
vec3 C0 = R12 + Rs;
|
||
I = C0;
|
||
vec3 Cm = Rs - T121;
|
||
for ( int m = 1; m <= 2; ++ m ) {
|
||
Cm *= r123;
|
||
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
|
||
I += Cm * Sm;
|
||
}
|
||
return max( I, vec3( 0.0 ) );
|
||
}
|
||
#endif`,Ag=`#ifdef USE_BUMPMAP
|
||
uniform sampler2D bumpMap;
|
||
uniform float bumpScale;
|
||
vec2 dHdxy_fwd() {
|
||
vec2 dSTdx = dFdx( vBumpMapUv );
|
||
vec2 dSTdy = dFdy( vBumpMapUv );
|
||
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
|
||
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
|
||
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
|
||
return vec2( dBx, dBy );
|
||
}
|
||
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
||
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
|
||
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
|
||
vec3 vN = surf_norm;
|
||
vec3 R1 = cross( vSigmaY, vN );
|
||
vec3 R2 = cross( vN, vSigmaX );
|
||
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
||
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
||
return normalize( abs( fDet ) * surf_norm - vGrad );
|
||
}
|
||
#endif`,Pg=`#if NUM_CLIPPING_PLANES > 0
|
||
vec4 plane;
|
||
#ifdef ALPHA_TO_COVERAGE
|
||
float distanceToPlane, distanceGradient;
|
||
float clipOpacity = 1.0;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
||
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
||
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
||
if ( clipOpacity == 0.0 ) discard;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
||
float unionClipOpacity = 1.0;
|
||
#pragma unroll_loop_start
|
||
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
||
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
||
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
||
}
|
||
#pragma unroll_loop_end
|
||
clipOpacity *= 1.0 - unionClipOpacity;
|
||
#endif
|
||
diffuseColor.a *= clipOpacity;
|
||
if ( diffuseColor.a == 0.0 ) discard;
|
||
#else
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
||
bool clipped = true;
|
||
#pragma unroll_loop_start
|
||
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
||
}
|
||
#pragma unroll_loop_end
|
||
if ( clipped ) discard;
|
||
#endif
|
||
#endif
|
||
#endif`,Rg=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
||
#endif`,Lg=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
#endif`,Dg=`#if NUM_CLIPPING_PLANES > 0
|
||
vClipPosition = - mvPosition.xyz;
|
||
#endif`,Ig=`#if defined( USE_COLOR_ALPHA )
|
||
diffuseColor *= vColor;
|
||
#elif defined( USE_COLOR )
|
||
diffuseColor.rgb *= vColor;
|
||
#endif`,Ng=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,Ug=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,Bg=`#if defined( USE_COLOR_ALPHA )
|
||
vColor = vec4( 1.0 );
|
||
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
||
vColor = vec3( 1.0 );
|
||
#endif
|
||
#ifdef USE_COLOR
|
||
vColor *= color;
|
||
#endif
|
||
#ifdef USE_INSTANCING_COLOR
|
||
vColor.xyz *= instanceColor.xyz;
|
||
#endif
|
||
#ifdef USE_BATCHING_COLOR
|
||
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
||
vColor.xyz *= batchingColor.xyz;
|
||
#endif`,kg=`#define PI 3.141592653589793
|
||
#define PI2 6.283185307179586
|
||
#define PI_HALF 1.5707963267948966
|
||
#define RECIPROCAL_PI 0.3183098861837907
|
||
#define RECIPROCAL_PI2 0.15915494309189535
|
||
#define EPSILON 1e-6
|
||
#ifndef saturate
|
||
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
||
#endif
|
||
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
||
float pow2( const in float x ) { return x*x; }
|
||
vec3 pow2( const in vec3 x ) { return x*x; }
|
||
float pow3( const in float x ) { return x*x*x; }
|
||
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
||
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
||
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
|
||
highp float rand( const in vec2 uv ) {
|
||
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
||
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
||
return fract( sin( sn ) * c );
|
||
}
|
||
#ifdef HIGH_PRECISION
|
||
float precisionSafeLength( vec3 v ) { return length( v ); }
|
||
#else
|
||
float precisionSafeLength( vec3 v ) {
|
||
float maxComponent = max3( abs( v ) );
|
||
return length( v / maxComponent ) * maxComponent;
|
||
}
|
||
#endif
|
||
struct IncidentLight {
|
||
vec3 color;
|
||
vec3 direction;
|
||
bool visible;
|
||
};
|
||
struct ReflectedLight {
|
||
vec3 directDiffuse;
|
||
vec3 directSpecular;
|
||
vec3 indirectDiffuse;
|
||
vec3 indirectSpecular;
|
||
};
|
||
#ifdef USE_ALPHAHASH
|
||
varying vec3 vPosition;
|
||
#endif
|
||
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
||
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
||
}
|
||
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
||
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
||
}
|
||
bool isPerspectiveMatrix( mat4 m ) {
|
||
return m[ 2 ][ 3 ] == - 1.0;
|
||
}
|
||
vec2 equirectUv( in vec3 dir ) {
|
||
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
||
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
||
return vec2( u, v );
|
||
}
|
||
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
||
return RECIPROCAL_PI * diffuseColor;
|
||
}
|
||
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
||
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
||
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
||
}
|
||
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
||
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
||
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
||
} // validated`,Og=`#ifdef ENVMAP_TYPE_CUBE_UV
|
||
#define cubeUV_minMipLevel 4.0
|
||
#define cubeUV_minTileSize 16.0
|
||
float getFace( vec3 direction ) {
|
||
vec3 absDirection = abs( direction );
|
||
float face = - 1.0;
|
||
if ( absDirection.x > absDirection.z ) {
|
||
if ( absDirection.x > absDirection.y )
|
||
face = direction.x > 0.0 ? 0.0 : 3.0;
|
||
else
|
||
face = direction.y > 0.0 ? 1.0 : 4.0;
|
||
} else {
|
||
if ( absDirection.z > absDirection.y )
|
||
face = direction.z > 0.0 ? 2.0 : 5.0;
|
||
else
|
||
face = direction.y > 0.0 ? 1.0 : 4.0;
|
||
}
|
||
return face;
|
||
}
|
||
vec2 getUV( vec3 direction, float face ) {
|
||
vec2 uv;
|
||
if ( face == 0.0 ) {
|
||
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
||
} else if ( face == 1.0 ) {
|
||
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
||
} else if ( face == 2.0 ) {
|
||
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
||
} else if ( face == 3.0 ) {
|
||
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
||
} else if ( face == 4.0 ) {
|
||
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
||
} else {
|
||
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
||
}
|
||
return 0.5 * ( uv + 1.0 );
|
||
}
|
||
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
||
float face = getFace( direction );
|
||
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
||
mipInt = max( mipInt, cubeUV_minMipLevel );
|
||
float faceSize = exp2( mipInt );
|
||
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
|
||
if ( face > 2.0 ) {
|
||
uv.y += faceSize;
|
||
face -= 3.0;
|
||
}
|
||
uv.x += face * faceSize;
|
||
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
|
||
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
|
||
uv.x *= CUBEUV_TEXEL_WIDTH;
|
||
uv.y *= CUBEUV_TEXEL_HEIGHT;
|
||
#ifdef texture2DGradEXT
|
||
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
|
||
#else
|
||
return texture2D( envMap, uv ).rgb;
|
||
#endif
|
||
}
|
||
#define cubeUV_r0 1.0
|
||
#define cubeUV_m0 - 2.0
|
||
#define cubeUV_r1 0.8
|
||
#define cubeUV_m1 - 1.0
|
||
#define cubeUV_r4 0.4
|
||
#define cubeUV_m4 2.0
|
||
#define cubeUV_r5 0.305
|
||
#define cubeUV_m5 3.0
|
||
#define cubeUV_r6 0.21
|
||
#define cubeUV_m6 4.0
|
||
float roughnessToMip( float roughness ) {
|
||
float mip = 0.0;
|
||
if ( roughness >= cubeUV_r1 ) {
|
||
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
|
||
} else if ( roughness >= cubeUV_r4 ) {
|
||
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
|
||
} else if ( roughness >= cubeUV_r5 ) {
|
||
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
|
||
} else if ( roughness >= cubeUV_r6 ) {
|
||
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
|
||
} else {
|
||
mip = - 2.0 * log2( 1.16 * roughness ); }
|
||
return mip;
|
||
}
|
||
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
||
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
|
||
float mipF = fract( mip );
|
||
float mipInt = floor( mip );
|
||
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
||
if ( mipF == 0.0 ) {
|
||
return vec4( color0, 1.0 );
|
||
} else {
|
||
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
||
return vec4( mix( color0, color1, mipF ), 1.0 );
|
||
}
|
||
}
|
||
#endif`,Fg=`vec3 transformedNormal = objectNormal;
|
||
#ifdef USE_TANGENT
|
||
vec3 transformedTangent = objectTangent;
|
||
#endif
|
||
#ifdef USE_BATCHING
|
||
mat3 bm = mat3( batchingMatrix );
|
||
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
|
||
transformedNormal = bm * transformedNormal;
|
||
#ifdef USE_TANGENT
|
||
transformedTangent = bm * transformedTangent;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_INSTANCING
|
||
mat3 im = mat3( instanceMatrix );
|
||
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
|
||
transformedNormal = im * transformedNormal;
|
||
#ifdef USE_TANGENT
|
||
transformedTangent = im * transformedTangent;
|
||
#endif
|
||
#endif
|
||
transformedNormal = normalMatrix * transformedNormal;
|
||
#ifdef FLIP_SIDED
|
||
transformedNormal = - transformedNormal;
|
||
#endif
|
||
#ifdef USE_TANGENT
|
||
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
|
||
#ifdef FLIP_SIDED
|
||
transformedTangent = - transformedTangent;
|
||
#endif
|
||
#endif`,zg=`#ifdef USE_DISPLACEMENTMAP
|
||
uniform sampler2D displacementMap;
|
||
uniform float displacementScale;
|
||
uniform float displacementBias;
|
||
#endif`,Hg=`#ifdef USE_DISPLACEMENTMAP
|
||
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
||
#endif`,Vg=`#ifdef USE_EMISSIVEMAP
|
||
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
||
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
||
#endif
|
||
totalEmissiveRadiance *= emissiveColor.rgb;
|
||
#endif`,Gg=`#ifdef USE_EMISSIVEMAP
|
||
uniform sampler2D emissiveMap;
|
||
#endif`,Wg="gl_FragColor = linearToOutputTexel( gl_FragColor );",Xg=`vec4 LinearTransferOETF( in vec4 value ) {
|
||
return value;
|
||
}
|
||
vec4 sRGBTransferEOTF( in vec4 value ) {
|
||
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
|
||
}
|
||
vec4 sRGBTransferOETF( in vec4 value ) {
|
||
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
||
}`,jg=`#ifdef USE_ENVMAP
|
||
#ifdef ENV_WORLDPOS
|
||
vec3 cameraToFrag;
|
||
if ( isOrthographic ) {
|
||
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
||
} else {
|
||
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
||
}
|
||
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
||
#ifdef ENVMAP_MODE_REFLECTION
|
||
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
||
#else
|
||
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
||
#endif
|
||
#else
|
||
vec3 reflectVec = vReflect;
|
||
#endif
|
||
#ifdef ENVMAP_TYPE_CUBE
|
||
vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
||
#else
|
||
vec4 envColor = vec4( 0.0 );
|
||
#endif
|
||
#ifdef ENVMAP_BLENDING_MULTIPLY
|
||
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
||
#elif defined( ENVMAP_BLENDING_MIX )
|
||
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
||
#elif defined( ENVMAP_BLENDING_ADD )
|
||
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
||
#endif
|
||
#endif`,Zg=`#ifdef USE_ENVMAP
|
||
uniform float envMapIntensity;
|
||
uniform float flipEnvMap;
|
||
uniform mat3 envMapRotation;
|
||
#ifdef ENVMAP_TYPE_CUBE
|
||
uniform samplerCube envMap;
|
||
#else
|
||
uniform sampler2D envMap;
|
||
#endif
|
||
#endif`,qg=`#ifdef USE_ENVMAP
|
||
uniform float reflectivity;
|
||
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
||
#define ENV_WORLDPOS
|
||
#endif
|
||
#ifdef ENV_WORLDPOS
|
||
varying vec3 vWorldPosition;
|
||
uniform float refractionRatio;
|
||
#else
|
||
varying vec3 vReflect;
|
||
#endif
|
||
#endif`,Yg=`#ifdef USE_ENVMAP
|
||
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
||
#define ENV_WORLDPOS
|
||
#endif
|
||
#ifdef ENV_WORLDPOS
|
||
|
||
varying vec3 vWorldPosition;
|
||
#else
|
||
varying vec3 vReflect;
|
||
uniform float refractionRatio;
|
||
#endif
|
||
#endif`,Kg=`#ifdef USE_ENVMAP
|
||
#ifdef ENV_WORLDPOS
|
||
vWorldPosition = worldPosition.xyz;
|
||
#else
|
||
vec3 cameraToVertex;
|
||
if ( isOrthographic ) {
|
||
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
||
} else {
|
||
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
||
}
|
||
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
||
#ifdef ENVMAP_MODE_REFLECTION
|
||
vReflect = reflect( cameraToVertex, worldNormal );
|
||
#else
|
||
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
||
#endif
|
||
#endif
|
||
#endif`,$g=`#ifdef USE_FOG
|
||
vFogDepth = - mvPosition.z;
|
||
#endif`,Jg=`#ifdef USE_FOG
|
||
varying float vFogDepth;
|
||
#endif`,Qg=`#ifdef USE_FOG
|
||
#ifdef FOG_EXP2
|
||
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
||
#else
|
||
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
||
#endif
|
||
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
||
#endif`,e0=`#ifdef USE_FOG
|
||
uniform vec3 fogColor;
|
||
varying float vFogDepth;
|
||
#ifdef FOG_EXP2
|
||
uniform float fogDensity;
|
||
#else
|
||
uniform float fogNear;
|
||
uniform float fogFar;
|
||
#endif
|
||
#endif`,t0=`#ifdef USE_GRADIENTMAP
|
||
uniform sampler2D gradientMap;
|
||
#endif
|
||
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
||
float dotNL = dot( normal, lightDirection );
|
||
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
||
#ifdef USE_GRADIENTMAP
|
||
return vec3( texture2D( gradientMap, coord ).r );
|
||
#else
|
||
vec2 fw = fwidth( coord ) * 0.5;
|
||
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
||
#endif
|
||
}`,n0=`#ifdef USE_LIGHTMAP
|
||
uniform sampler2D lightMap;
|
||
uniform float lightMapIntensity;
|
||
#endif`,i0=`LambertMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularStrength = specularStrength;`,s0=`varying vec3 vViewPosition;
|
||
struct LambertMaterial {
|
||
vec3 diffuseColor;
|
||
float specularStrength;
|
||
};
|
||
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
#define RE_Direct RE_Direct_Lambert
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,r0=`uniform bool receiveShadow;
|
||
uniform vec3 ambientLightColor;
|
||
#if defined( USE_LIGHT_PROBES )
|
||
uniform vec3 lightProbe[ 9 ];
|
||
#endif
|
||
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
||
float x = normal.x, y = normal.y, z = normal.z;
|
||
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
||
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
||
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
||
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
||
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
||
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
||
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
||
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
||
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
||
return result;
|
||
}
|
||
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
||
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
||
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
||
return irradiance;
|
||
}
|
||
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
||
vec3 irradiance = ambientLightColor;
|
||
return irradiance;
|
||
}
|
||
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
||
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
||
if ( cutoffDistance > 0.0 ) {
|
||
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
||
}
|
||
return distanceFalloff;
|
||
}
|
||
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
||
return smoothstep( coneCosine, penumbraCosine, angleCosine );
|
||
}
|
||
#if NUM_DIR_LIGHTS > 0
|
||
struct DirectionalLight {
|
||
vec3 direction;
|
||
vec3 color;
|
||
};
|
||
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
||
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
|
||
light.color = directionalLight.color;
|
||
light.direction = directionalLight.direction;
|
||
light.visible = true;
|
||
}
|
||
#endif
|
||
#if NUM_POINT_LIGHTS > 0
|
||
struct PointLight {
|
||
vec3 position;
|
||
vec3 color;
|
||
float distance;
|
||
float decay;
|
||
};
|
||
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
||
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
||
vec3 lVector = pointLight.position - geometryPosition;
|
||
light.direction = normalize( lVector );
|
||
float lightDistance = length( lVector );
|
||
light.color = pointLight.color;
|
||
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
|
||
light.visible = ( light.color != vec3( 0.0 ) );
|
||
}
|
||
#endif
|
||
#if NUM_SPOT_LIGHTS > 0
|
||
struct SpotLight {
|
||
vec3 position;
|
||
vec3 direction;
|
||
vec3 color;
|
||
float distance;
|
||
float decay;
|
||
float coneCos;
|
||
float penumbraCos;
|
||
};
|
||
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
||
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
||
vec3 lVector = spotLight.position - geometryPosition;
|
||
light.direction = normalize( lVector );
|
||
float angleCos = dot( light.direction, spotLight.direction );
|
||
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
||
if ( spotAttenuation > 0.0 ) {
|
||
float lightDistance = length( lVector );
|
||
light.color = spotLight.color * spotAttenuation;
|
||
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
|
||
light.visible = ( light.color != vec3( 0.0 ) );
|
||
} else {
|
||
light.color = vec3( 0.0 );
|
||
light.visible = false;
|
||
}
|
||
}
|
||
#endif
|
||
#if NUM_RECT_AREA_LIGHTS > 0
|
||
struct RectAreaLight {
|
||
vec3 color;
|
||
vec3 position;
|
||
vec3 halfWidth;
|
||
vec3 halfHeight;
|
||
};
|
||
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
||
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
||
#endif
|
||
#if NUM_HEMI_LIGHTS > 0
|
||
struct HemisphereLight {
|
||
vec3 direction;
|
||
vec3 skyColor;
|
||
vec3 groundColor;
|
||
};
|
||
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
||
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
|
||
float dotNL = dot( normal, hemiLight.direction );
|
||
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
||
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
||
return irradiance;
|
||
}
|
||
#endif`,a0=`#ifdef USE_ENVMAP
|
||
vec3 getIBLIrradiance( const in vec3 normal ) {
|
||
#ifdef ENVMAP_TYPE_CUBE_UV
|
||
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
||
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
|
||
return PI * envMapColor.rgb * envMapIntensity;
|
||
#else
|
||
return vec3( 0.0 );
|
||
#endif
|
||
}
|
||
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
||
#ifdef ENVMAP_TYPE_CUBE_UV
|
||
vec3 reflectVec = reflect( - viewDir, normal );
|
||
reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
|
||
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
||
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
|
||
return envMapColor.rgb * envMapIntensity;
|
||
#else
|
||
return vec3( 0.0 );
|
||
#endif
|
||
}
|
||
#ifdef USE_ANISOTROPY
|
||
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
|
||
#ifdef ENVMAP_TYPE_CUBE_UV
|
||
vec3 bentNormal = cross( bitangent, viewDir );
|
||
bentNormal = normalize( cross( bentNormal, bitangent ) );
|
||
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
|
||
return getIBLRadiance( viewDir, bentNormal, roughness );
|
||
#else
|
||
return vec3( 0.0 );
|
||
#endif
|
||
}
|
||
#endif
|
||
#endif`,o0=`ToonMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;`,l0=`varying vec3 vViewPosition;
|
||
struct ToonMaterial {
|
||
vec3 diffuseColor;
|
||
};
|
||
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
#define RE_Direct RE_Direct_Toon
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,c0=`BlinnPhongMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularColor = specular;
|
||
material.specularShininess = shininess;
|
||
material.specularStrength = specularStrength;`,h0=`varying vec3 vViewPosition;
|
||
struct BlinnPhongMaterial {
|
||
vec3 diffuseColor;
|
||
vec3 specularColor;
|
||
float specularShininess;
|
||
float specularStrength;
|
||
};
|
||
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
||
}
|
||
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
#define RE_Direct RE_Direct_BlinnPhong
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,u0=`PhysicalMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
||
material.metalness = metalnessFactor;
|
||
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
||
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
||
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
||
material.roughness = min( material.roughness, 1.0 );
|
||
#ifdef IOR
|
||
material.ior = ior;
|
||
#ifdef USE_SPECULAR
|
||
float specularIntensityFactor = specularIntensity;
|
||
vec3 specularColorFactor = specularColor;
|
||
#ifdef USE_SPECULAR_COLORMAP
|
||
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
|
||
#endif
|
||
#ifdef USE_SPECULAR_INTENSITYMAP
|
||
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
|
||
#endif
|
||
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
||
#else
|
||
float specularIntensityFactor = 1.0;
|
||
vec3 specularColorFactor = vec3( 1.0 );
|
||
material.specularF90 = 1.0;
|
||
#endif
|
||
material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
|
||
material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
|
||
#else
|
||
material.specularColor = vec3( 0.04 );
|
||
material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
|
||
material.specularF90 = 1.0;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
material.clearcoat = clearcoat;
|
||
material.clearcoatRoughness = clearcoatRoughness;
|
||
material.clearcoatF0 = vec3( 0.04 );
|
||
material.clearcoatF90 = 1.0;
|
||
#ifdef USE_CLEARCOATMAP
|
||
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
|
||
#endif
|
||
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
||
material.clearcoatRoughness += geometryRoughness;
|
||
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
||
#endif
|
||
#ifdef USE_DISPERSION
|
||
material.dispersion = dispersion;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE
|
||
material.iridescence = iridescence;
|
||
material.iridescenceIOR = iridescenceIOR;
|
||
#ifdef USE_IRIDESCENCEMAP
|
||
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
|
||
#else
|
||
material.iridescenceThickness = iridescenceThicknessMaximum;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
material.sheenColor = sheenColor;
|
||
#ifdef USE_SHEEN_COLORMAP
|
||
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
|
||
#endif
|
||
material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
|
||
#ifdef USE_SHEEN_ROUGHNESSMAP
|
||
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_ANISOTROPY
|
||
#ifdef USE_ANISOTROPYMAP
|
||
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
|
||
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
|
||
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
|
||
#else
|
||
vec2 anisotropyV = anisotropyVector;
|
||
#endif
|
||
material.anisotropy = length( anisotropyV );
|
||
if( material.anisotropy == 0.0 ) {
|
||
anisotropyV = vec2( 1.0, 0.0 );
|
||
} else {
|
||
anisotropyV /= material.anisotropy;
|
||
material.anisotropy = saturate( material.anisotropy );
|
||
}
|
||
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
||
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
||
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
||
#endif`,d0=`uniform sampler2D dfgLUT;
|
||
struct PhysicalMaterial {
|
||
vec3 diffuseColor;
|
||
vec3 diffuseContribution;
|
||
vec3 specularColor;
|
||
vec3 specularColorBlended;
|
||
float roughness;
|
||
float metalness;
|
||
float specularF90;
|
||
float dispersion;
|
||
#ifdef USE_CLEARCOAT
|
||
float clearcoat;
|
||
float clearcoatRoughness;
|
||
vec3 clearcoatF0;
|
||
float clearcoatF90;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE
|
||
float iridescence;
|
||
float iridescenceIOR;
|
||
float iridescenceThickness;
|
||
vec3 iridescenceFresnel;
|
||
vec3 iridescenceF0;
|
||
vec3 iridescenceFresnelDielectric;
|
||
vec3 iridescenceFresnelMetallic;
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
vec3 sheenColor;
|
||
float sheenRoughness;
|
||
#endif
|
||
#ifdef IOR
|
||
float ior;
|
||
#endif
|
||
#ifdef USE_TRANSMISSION
|
||
float transmission;
|
||
float transmissionAlpha;
|
||
float thickness;
|
||
float attenuationDistance;
|
||
vec3 attenuationColor;
|
||
#endif
|
||
#ifdef USE_ANISOTROPY
|
||
float anisotropy;
|
||
float alphaT;
|
||
vec3 anisotropyT;
|
||
vec3 anisotropyB;
|
||
#endif
|
||
};
|
||
vec3 clearcoatSpecularDirect = vec3( 0.0 );
|
||
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
|
||
vec3 sheenSpecularDirect = vec3( 0.0 );
|
||
vec3 sheenSpecularIndirect = vec3(0.0 );
|
||
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
|
||
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
|
||
float x2 = x * x;
|
||
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
|
||
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
|
||
}
|
||
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
||
float a2 = pow2( alpha );
|
||
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
||
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
||
return 0.5 / max( gv + gl, EPSILON );
|
||
}
|
||
float D_GGX( const in float alpha, const in float dotNH ) {
|
||
float a2 = pow2( alpha );
|
||
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
||
return RECIPROCAL_PI * a2 / pow2( denom );
|
||
}
|
||
#ifdef USE_ANISOTROPY
|
||
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
|
||
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
|
||
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
|
||
float v = 0.5 / ( gv + gl );
|
||
return v;
|
||
}
|
||
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
|
||
float a2 = alphaT * alphaB;
|
||
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
|
||
highp float v2 = dot( v, v );
|
||
float w2 = a2 / v2;
|
||
return RECIPROCAL_PI * a2 * pow2 ( w2 );
|
||
}
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
|
||
vec3 f0 = material.clearcoatF0;
|
||
float f90 = material.clearcoatF90;
|
||
float roughness = material.clearcoatRoughness;
|
||
float alpha = pow2( roughness );
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNL = saturate( dot( normal, lightDir ) );
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float dotVH = saturate( dot( viewDir, halfDir ) );
|
||
vec3 F = F_Schlick( f0, f90, dotVH );
|
||
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
||
float D = D_GGX( alpha, dotNH );
|
||
return F * ( V * D );
|
||
}
|
||
#endif
|
||
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
|
||
vec3 f0 = material.specularColorBlended;
|
||
float f90 = material.specularF90;
|
||
float roughness = material.roughness;
|
||
float alpha = pow2( roughness );
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNL = saturate( dot( normal, lightDir ) );
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float dotVH = saturate( dot( viewDir, halfDir ) );
|
||
vec3 F = F_Schlick( f0, f90, dotVH );
|
||
#ifdef USE_IRIDESCENCE
|
||
F = mix( F, material.iridescenceFresnel, material.iridescence );
|
||
#endif
|
||
#ifdef USE_ANISOTROPY
|
||
float dotTL = dot( material.anisotropyT, lightDir );
|
||
float dotTV = dot( material.anisotropyT, viewDir );
|
||
float dotTH = dot( material.anisotropyT, halfDir );
|
||
float dotBL = dot( material.anisotropyB, lightDir );
|
||
float dotBV = dot( material.anisotropyB, viewDir );
|
||
float dotBH = dot( material.anisotropyB, halfDir );
|
||
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
|
||
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
|
||
#else
|
||
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
||
float D = D_GGX( alpha, dotNH );
|
||
#endif
|
||
return F * ( V * D );
|
||
}
|
||
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
||
const float LUT_SIZE = 64.0;
|
||
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
||
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
||
float dotNV = saturate( dot( N, V ) );
|
||
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
||
uv = uv * LUT_SCALE + LUT_BIAS;
|
||
return uv;
|
||
}
|
||
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
||
float l = length( f );
|
||
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
||
}
|
||
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
||
float x = dot( v1, v2 );
|
||
float y = abs( x );
|
||
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
||
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
||
float v = a / b;
|
||
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
||
return cross( v1, v2 ) * theta_sintheta;
|
||
}
|
||
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
||
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
||
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
||
vec3 lightNormal = cross( v1, v2 );
|
||
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
||
vec3 T1, T2;
|
||
T1 = normalize( V - N * dot( V, N ) );
|
||
T2 = - cross( N, T1 );
|
||
mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
|
||
vec3 coords[ 4 ];
|
||
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
||
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
||
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
||
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
||
coords[ 0 ] = normalize( coords[ 0 ] );
|
||
coords[ 1 ] = normalize( coords[ 1 ] );
|
||
coords[ 2 ] = normalize( coords[ 2 ] );
|
||
coords[ 3 ] = normalize( coords[ 3 ] );
|
||
vec3 vectorFormFactor = vec3( 0.0 );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
||
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
||
return vec3( result );
|
||
}
|
||
#if defined( USE_SHEEN )
|
||
float D_Charlie( float roughness, float dotNH ) {
|
||
float alpha = pow2( roughness );
|
||
float invAlpha = 1.0 / alpha;
|
||
float cos2h = dotNH * dotNH;
|
||
float sin2h = max( 1.0 - cos2h, 0.0078125 );
|
||
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
|
||
}
|
||
float V_Neubelt( float dotNV, float dotNL ) {
|
||
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
|
||
}
|
||
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNL = saturate( dot( normal, lightDir ) );
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float D = D_Charlie( sheenRoughness, dotNH );
|
||
float V = V_Neubelt( dotNV, dotNL );
|
||
return sheenColor * ( D * V );
|
||
}
|
||
#endif
|
||
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float r2 = roughness * roughness;
|
||
float rInv = 1.0 / ( roughness + 0.1 );
|
||
float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
|
||
float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
|
||
float DG = exp( a * dotNV + b );
|
||
return saturate( DG );
|
||
}
|
||
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
|
||
return specularColor * fab.x + specularF90 * fab.y;
|
||
}
|
||
#ifdef USE_IRIDESCENCE
|
||
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
||
#else
|
||
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
||
#endif
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
|
||
#ifdef USE_IRIDESCENCE
|
||
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
|
||
#else
|
||
vec3 Fr = specularColor;
|
||
#endif
|
||
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
|
||
float Ess = fab.x + fab.y;
|
||
float Ems = 1.0 - Ess;
|
||
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
||
singleScatter += FssEss;
|
||
multiScatter += Fms * Ems;
|
||
}
|
||
vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
|
||
vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
|
||
float dotNL = saturate( dot( normal, lightDir ) );
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
|
||
vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
|
||
vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
|
||
vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
|
||
float Ess_V = dfgV.x + dfgV.y;
|
||
float Ess_L = dfgL.x + dfgL.y;
|
||
float Ems_V = 1.0 - Ess_V;
|
||
float Ems_L = 1.0 - Ess_L;
|
||
vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
|
||
vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
|
||
float compensationFactor = Ems_V * Ems_L;
|
||
vec3 multiScatter = Fms * compensationFactor;
|
||
return singleScatter + multiScatter;
|
||
}
|
||
#if NUM_RECT_AREA_LIGHTS > 0
|
||
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
vec3 normal = geometryNormal;
|
||
vec3 viewDir = geometryViewDir;
|
||
vec3 position = geometryPosition;
|
||
vec3 lightPos = rectAreaLight.position;
|
||
vec3 halfWidth = rectAreaLight.halfWidth;
|
||
vec3 halfHeight = rectAreaLight.halfHeight;
|
||
vec3 lightColor = rectAreaLight.color;
|
||
float roughness = material.roughness;
|
||
vec3 rectCoords[ 4 ];
|
||
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
||
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
||
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
||
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
||
vec4 t1 = texture2D( ltc_1, uv );
|
||
vec4 t2 = texture2D( ltc_2, uv );
|
||
mat3 mInv = mat3(
|
||
vec3( t1.x, 0, t1.y ),
|
||
vec3( 0, 1, 0 ),
|
||
vec3( t1.z, 0, t1.w )
|
||
);
|
||
vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );
|
||
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
||
reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
||
}
|
||
#endif
|
||
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
#ifdef USE_CLEARCOAT
|
||
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
|
||
vec3 ccIrradiance = dotNLcc * directLight.color;
|
||
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
|
||
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
|
||
|
||
float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
||
float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
|
||
|
||
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
|
||
|
||
irradiance *= sheenEnergyComp;
|
||
|
||
#endif
|
||
reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
|
||
}
|
||
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
|
||
#ifdef USE_SHEEN
|
||
float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
||
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
|
||
diffuse *= sheenEnergyComp;
|
||
#endif
|
||
reflectedLight.indirectDiffuse += diffuse;
|
||
}
|
||
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
||
#ifdef USE_CLEARCOAT
|
||
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
|
||
#endif
|
||
vec3 singleScatteringDielectric = vec3( 0.0 );
|
||
vec3 multiScatteringDielectric = vec3( 0.0 );
|
||
vec3 singleScatteringMetallic = vec3( 0.0 );
|
||
vec3 multiScatteringMetallic = vec3( 0.0 );
|
||
#ifdef USE_IRIDESCENCE
|
||
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
|
||
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
|
||
#else
|
||
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
|
||
computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
|
||
#endif
|
||
vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
|
||
vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
|
||
vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
|
||
vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
|
||
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
||
vec3 indirectSpecular = radiance * singleScattering;
|
||
indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
||
vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
|
||
#ifdef USE_SHEEN
|
||
float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
||
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
|
||
indirectSpecular *= sheenEnergyComp;
|
||
indirectDiffuse *= sheenEnergyComp;
|
||
#endif
|
||
reflectedLight.indirectSpecular += indirectSpecular;
|
||
reflectedLight.indirectDiffuse += indirectDiffuse;
|
||
}
|
||
#define RE_Direct RE_Direct_Physical
|
||
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
||
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
||
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
||
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
||
}`,f0=`
|
||
vec3 geometryPosition = - vViewPosition;
|
||
vec3 geometryNormal = normal;
|
||
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
||
vec3 geometryClearcoatNormal = vec3( 0.0 );
|
||
#ifdef USE_CLEARCOAT
|
||
geometryClearcoatNormal = clearcoatNormal;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE
|
||
float dotNVi = saturate( dot( normal, geometryViewDir ) );
|
||
if ( material.iridescenceThickness == 0.0 ) {
|
||
material.iridescence = 0.0;
|
||
} else {
|
||
material.iridescence = saturate( material.iridescence );
|
||
}
|
||
if ( material.iridescence > 0.0 ) {
|
||
material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
|
||
material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
|
||
material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
|
||
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
|
||
}
|
||
#endif
|
||
IncidentLight directLight;
|
||
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
||
PointLight pointLight;
|
||
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
||
PointLightShadow pointLightShadow;
|
||
#endif
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
||
pointLight = pointLights[ i ];
|
||
getPointLightInfo( pointLight, geometryPosition, directLight );
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
|
||
pointLightShadow = pointLightShadows[ i ];
|
||
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
||
SpotLight spotLight;
|
||
vec4 spotColor;
|
||
vec3 spotLightCoord;
|
||
bool inSpotLightMap;
|
||
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
||
SpotLightShadow spotLightShadow;
|
||
#endif
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
||
spotLight = spotLights[ i ];
|
||
getSpotLightInfo( spotLight, geometryPosition, directLight );
|
||
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
||
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
|
||
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
||
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
|
||
#else
|
||
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
||
#endif
|
||
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
|
||
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
|
||
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
|
||
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
|
||
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
|
||
#endif
|
||
#undef SPOT_LIGHT_MAP_INDEX
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
||
spotLightShadow = spotLightShadows[ i ];
|
||
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
||
DirectionalLight directionalLight;
|
||
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
||
DirectionalLightShadow directionalLightShadow;
|
||
#endif
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
||
directionalLight = directionalLights[ i ];
|
||
getDirectionalLightInfo( directionalLight, directLight );
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
||
directionalLightShadow = directionalLightShadows[ i ];
|
||
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
||
RectAreaLight rectAreaLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
||
rectAreaLight = rectAreaLights[ i ];
|
||
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if defined( RE_IndirectDiffuse )
|
||
vec3 iblIrradiance = vec3( 0.0 );
|
||
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
||
#if defined( USE_LIGHT_PROBES )
|
||
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
|
||
#endif
|
||
#if ( NUM_HEMI_LIGHTS > 0 )
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
||
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif
|
||
#if defined( RE_IndirectSpecular )
|
||
vec3 radiance = vec3( 0.0 );
|
||
vec3 clearcoatRadiance = vec3( 0.0 );
|
||
#endif`,p0=`#if defined( RE_IndirectDiffuse )
|
||
#ifdef USE_LIGHTMAP
|
||
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
||
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
||
irradiance += lightMapIrradiance;
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
||
iblIrradiance += getIBLIrradiance( geometryNormal );
|
||
#endif
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
||
#ifdef USE_ANISOTROPY
|
||
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
|
||
#else
|
||
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
||
#endif
|
||
#endif`,m0=`#if defined( RE_IndirectDiffuse )
|
||
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
#endif
|
||
#if defined( RE_IndirectSpecular )
|
||
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
||
#endif`,g0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
||
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
||
#endif`,v0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
||
uniform float logDepthBufFC;
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,x0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,_0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
||
vFragDepth = 1.0 + gl_Position.w;
|
||
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
||
#endif`,b0=`#ifdef USE_MAP
|
||
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE
|
||
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
||
#endif
|
||
diffuseColor *= sampledDiffuseColor;
|
||
#endif`,y0=`#ifdef USE_MAP
|
||
uniform sampler2D map;
|
||
#endif`,M0=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
||
#if defined( USE_POINTS_UV )
|
||
vec2 uv = vUv;
|
||
#else
|
||
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_MAP
|
||
diffuseColor *= texture2D( map, uv );
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
||
#endif`,w0=`#if defined( USE_POINTS_UV )
|
||
varying vec2 vUv;
|
||
#else
|
||
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
||
uniform mat3 uvTransform;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_MAP
|
||
uniform sampler2D map;
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
uniform sampler2D alphaMap;
|
||
#endif`,S0=`float metalnessFactor = metalness;
|
||
#ifdef USE_METALNESSMAP
|
||
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
||
metalnessFactor *= texelMetalness.b;
|
||
#endif`,E0=`#ifdef USE_METALNESSMAP
|
||
uniform sampler2D metalnessMap;
|
||
#endif`,T0=`#ifdef USE_INSTANCING_MORPH
|
||
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
||
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
||
}
|
||
#endif`,C0=`#if defined( USE_MORPHCOLORS )
|
||
vColor *= morphTargetBaseInfluence;
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
#if defined( USE_COLOR_ALPHA )
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
|
||
#elif defined( USE_COLOR )
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
||
#endif
|
||
}
|
||
#endif`,A0=`#ifdef USE_MORPHNORMALS
|
||
objectNormal *= morphTargetBaseInfluence;
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
||
}
|
||
#endif`,P0=`#ifdef USE_MORPHTARGETS
|
||
#ifndef USE_INSTANCING_MORPH
|
||
uniform float morphTargetBaseInfluence;
|
||
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
||
#endif
|
||
uniform sampler2DArray morphTargetsTexture;
|
||
uniform ivec2 morphTargetsTextureSize;
|
||
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
|
||
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
|
||
int y = texelIndex / morphTargetsTextureSize.x;
|
||
int x = texelIndex - y * morphTargetsTextureSize.x;
|
||
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
||
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
||
}
|
||
#endif`,R0=`#ifdef USE_MORPHTARGETS
|
||
transformed *= morphTargetBaseInfluence;
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
||
}
|
||
#endif`,L0=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
||
#ifdef FLAT_SHADED
|
||
vec3 fdx = dFdx( vViewPosition );
|
||
vec3 fdy = dFdy( vViewPosition );
|
||
vec3 normal = normalize( cross( fdx, fdy ) );
|
||
#else
|
||
vec3 normal = normalize( vNormal );
|
||
#ifdef DOUBLE_SIDED
|
||
normal *= faceDirection;
|
||
#endif
|
||
#endif
|
||
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
|
||
#ifdef USE_TANGENT
|
||
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
||
#else
|
||
mat3 tbn = getTangentFrame( - vViewPosition, normal,
|
||
#if defined( USE_NORMALMAP )
|
||
vNormalMapUv
|
||
#elif defined( USE_CLEARCOAT_NORMALMAP )
|
||
vClearcoatNormalMapUv
|
||
#else
|
||
vUv
|
||
#endif
|
||
);
|
||
#endif
|
||
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
||
tbn[0] *= faceDirection;
|
||
tbn[1] *= faceDirection;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
#ifdef USE_TANGENT
|
||
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
||
#else
|
||
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
|
||
#endif
|
||
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
||
tbn2[0] *= faceDirection;
|
||
tbn2[1] *= faceDirection;
|
||
#endif
|
||
#endif
|
||
vec3 nonPerturbedNormal = normal;`,D0=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
||
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
||
#ifdef FLIP_SIDED
|
||
normal = - normal;
|
||
#endif
|
||
#ifdef DOUBLE_SIDED
|
||
normal = normal * faceDirection;
|
||
#endif
|
||
normal = normalize( normalMatrix * normal );
|
||
#elif defined( USE_NORMALMAP_TANGENTSPACE )
|
||
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
||
mapN.xy *= normalScale;
|
||
normal = normalize( tbn * mapN );
|
||
#elif defined( USE_BUMPMAP )
|
||
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
||
#endif`,I0=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,N0=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,U0=`#ifndef FLAT_SHADED
|
||
vNormal = normalize( transformedNormal );
|
||
#ifdef USE_TANGENT
|
||
vTangent = normalize( transformedTangent );
|
||
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
||
#endif
|
||
#endif`,B0=`#ifdef USE_NORMALMAP
|
||
uniform sampler2D normalMap;
|
||
uniform vec2 normalScale;
|
||
#endif
|
||
#ifdef USE_NORMALMAP_OBJECTSPACE
|
||
uniform mat3 normalMatrix;
|
||
#endif
|
||
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
|
||
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
|
||
vec3 q0 = dFdx( eye_pos.xyz );
|
||
vec3 q1 = dFdy( eye_pos.xyz );
|
||
vec2 st0 = dFdx( uv.st );
|
||
vec2 st1 = dFdy( uv.st );
|
||
vec3 N = surf_norm;
|
||
vec3 q1perp = cross( q1, N );
|
||
vec3 q0perp = cross( N, q0 );
|
||
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
||
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
||
float det = max( dot( T, T ), dot( B, B ) );
|
||
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
||
return mat3( T * scale, B * scale, N );
|
||
}
|
||
#endif`,k0=`#ifdef USE_CLEARCOAT
|
||
vec3 clearcoatNormal = nonPerturbedNormal;
|
||
#endif`,O0=`#ifdef USE_CLEARCOAT_NORMALMAP
|
||
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
||
clearcoatMapN.xy *= clearcoatNormalScale;
|
||
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
||
#endif`,F0=`#ifdef USE_CLEARCOATMAP
|
||
uniform sampler2D clearcoatMap;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
uniform sampler2D clearcoatNormalMap;
|
||
uniform vec2 clearcoatNormalScale;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
uniform sampler2D clearcoatRoughnessMap;
|
||
#endif`,z0=`#ifdef USE_IRIDESCENCEMAP
|
||
uniform sampler2D iridescenceMap;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
uniform sampler2D iridescenceThicknessMap;
|
||
#endif`,H0=`#ifdef OPAQUE
|
||
diffuseColor.a = 1.0;
|
||
#endif
|
||
#ifdef USE_TRANSMISSION
|
||
diffuseColor.a *= material.transmissionAlpha;
|
||
#endif
|
||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,V0=`vec3 packNormalToRGB( const in vec3 normal ) {
|
||
return normalize( normal ) * 0.5 + 0.5;
|
||
}
|
||
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
||
return 2.0 * rgb.xyz - 1.0;
|
||
}
|
||
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
|
||
const float Inv255 = 1. / 255.;
|
||
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
|
||
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
|
||
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
|
||
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
|
||
vec4 packDepthToRGBA( const in float v ) {
|
||
if( v <= 0.0 )
|
||
return vec4( 0., 0., 0., 0. );
|
||
if( v >= 1.0 )
|
||
return vec4( 1., 1., 1., 1. );
|
||
float vuf;
|
||
float af = modf( v * PackFactors.a, vuf );
|
||
float bf = modf( vuf * ShiftRight8, vuf );
|
||
float gf = modf( vuf * ShiftRight8, vuf );
|
||
return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
|
||
}
|
||
vec3 packDepthToRGB( const in float v ) {
|
||
if( v <= 0.0 )
|
||
return vec3( 0., 0., 0. );
|
||
if( v >= 1.0 )
|
||
return vec3( 1., 1., 1. );
|
||
float vuf;
|
||
float bf = modf( v * PackFactors.b, vuf );
|
||
float gf = modf( vuf * ShiftRight8, vuf );
|
||
return vec3( vuf * Inv255, gf * PackUpscale, bf );
|
||
}
|
||
vec2 packDepthToRG( const in float v ) {
|
||
if( v <= 0.0 )
|
||
return vec2( 0., 0. );
|
||
if( v >= 1.0 )
|
||
return vec2( 1., 1. );
|
||
float vuf;
|
||
float gf = modf( v * 256., vuf );
|
||
return vec2( vuf * Inv255, gf );
|
||
}
|
||
float unpackRGBAToDepth( const in vec4 v ) {
|
||
return dot( v, UnpackFactors4 );
|
||
}
|
||
float unpackRGBToDepth( const in vec3 v ) {
|
||
return dot( v, UnpackFactors3 );
|
||
}
|
||
float unpackRGToDepth( const in vec2 v ) {
|
||
return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
|
||
}
|
||
vec4 pack2HalfToRGBA( const in vec2 v ) {
|
||
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
||
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
||
}
|
||
vec2 unpackRGBATo2Half( const in vec4 v ) {
|
||
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
||
}
|
||
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
||
return ( viewZ + near ) / ( near - far );
|
||
}
|
||
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
||
return depth * ( near - far ) - near;
|
||
}
|
||
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
||
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
|
||
}
|
||
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
||
return ( near * far ) / ( ( far - near ) * depth - far );
|
||
}`,G0=`#ifdef PREMULTIPLIED_ALPHA
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
#endif`,W0=`vec4 mvPosition = vec4( transformed, 1.0 );
|
||
#ifdef USE_BATCHING
|
||
mvPosition = batchingMatrix * mvPosition;
|
||
#endif
|
||
#ifdef USE_INSTANCING
|
||
mvPosition = instanceMatrix * mvPosition;
|
||
#endif
|
||
mvPosition = modelViewMatrix * mvPosition;
|
||
gl_Position = projectionMatrix * mvPosition;`,X0=`#ifdef DITHERING
|
||
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
||
#endif`,j0=`#ifdef DITHERING
|
||
vec3 dithering( vec3 color ) {
|
||
float grid_position = rand( gl_FragCoord.xy );
|
||
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
||
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
||
return color + dither_shift_RGB;
|
||
}
|
||
#endif`,Z0=`float roughnessFactor = roughness;
|
||
#ifdef USE_ROUGHNESSMAP
|
||
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
||
roughnessFactor *= texelRoughness.g;
|
||
#endif`,q0=`#ifdef USE_ROUGHNESSMAP
|
||
uniform sampler2D roughnessMap;
|
||
#endif`,Y0=`#if NUM_SPOT_LIGHT_COORDS > 0
|
||
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_MAPS > 0
|
||
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
|
||
#endif
|
||
#ifdef USE_SHADOWMAP
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
#if defined( SHADOWMAP_TYPE_PCF )
|
||
uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
||
#else
|
||
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
||
#endif
|
||
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
||
struct DirectionalLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
||
#if defined( SHADOWMAP_TYPE_PCF )
|
||
uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
#else
|
||
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
#endif
|
||
struct SpotLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
#if defined( SHADOWMAP_TYPE_PCF )
|
||
uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
||
#elif defined( SHADOWMAP_TYPE_BASIC )
|
||
uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
||
#endif
|
||
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
||
struct PointLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
float shadowCameraNear;
|
||
float shadowCameraFar;
|
||
};
|
||
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if defined( SHADOWMAP_TYPE_PCF )
|
||
float interleavedGradientNoise( vec2 position ) {
|
||
return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
|
||
}
|
||
vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
|
||
const float goldenAngle = 2.399963229728653;
|
||
float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
|
||
float theta = float( sampleIndex ) * goldenAngle + phi;
|
||
return vec2( cos( theta ), sin( theta ) ) * r;
|
||
}
|
||
#endif
|
||
#if defined( SHADOWMAP_TYPE_PCF )
|
||
float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
||
float shadow = 1.0;
|
||
shadowCoord.xyz /= shadowCoord.w;
|
||
shadowCoord.z += shadowBias;
|
||
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
||
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
||
if ( frustumTest ) {
|
||
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
||
float radius = shadowRadius * texelSize.x;
|
||
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
|
||
shadow = (
|
||
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
|
||
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
|
||
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
|
||
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
|
||
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
|
||
) * 0.2;
|
||
}
|
||
return mix( 1.0, shadow, shadowIntensity );
|
||
}
|
||
#elif defined( SHADOWMAP_TYPE_VSM )
|
||
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
||
float shadow = 1.0;
|
||
shadowCoord.xyz /= shadowCoord.w;
|
||
shadowCoord.z += shadowBias;
|
||
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
||
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
||
if ( frustumTest ) {
|
||
vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
|
||
float mean = distribution.x;
|
||
float variance = distribution.y * distribution.y;
|
||
#ifdef USE_REVERSED_DEPTH_BUFFER
|
||
float hard_shadow = step( mean, shadowCoord.z );
|
||
#else
|
||
float hard_shadow = step( shadowCoord.z, mean );
|
||
#endif
|
||
if ( hard_shadow == 1.0 ) {
|
||
shadow = 1.0;
|
||
} else {
|
||
variance = max( variance, 0.0000001 );
|
||
float d = shadowCoord.z - mean;
|
||
float p_max = variance / ( variance + d * d );
|
||
p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
|
||
shadow = max( hard_shadow, p_max );
|
||
}
|
||
}
|
||
return mix( 1.0, shadow, shadowIntensity );
|
||
}
|
||
#else
|
||
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
||
float shadow = 1.0;
|
||
shadowCoord.xyz /= shadowCoord.w;
|
||
shadowCoord.z += shadowBias;
|
||
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
||
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
||
if ( frustumTest ) {
|
||
float depth = texture2D( shadowMap, shadowCoord.xy ).r;
|
||
#ifdef USE_REVERSED_DEPTH_BUFFER
|
||
shadow = step( depth, shadowCoord.z );
|
||
#else
|
||
shadow = step( shadowCoord.z, depth );
|
||
#endif
|
||
}
|
||
return mix( 1.0, shadow, shadowIntensity );
|
||
}
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
#if defined( SHADOWMAP_TYPE_PCF )
|
||
float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
||
float shadow = 1.0;
|
||
vec3 lightToPosition = shadowCoord.xyz;
|
||
vec3 bd3D = normalize( lightToPosition );
|
||
vec3 absVec = abs( lightToPosition );
|
||
float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
|
||
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
|
||
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
||
dp += shadowBias;
|
||
float texelSize = shadowRadius / shadowMapSize.x;
|
||
vec3 absDir = abs( bd3D );
|
||
vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
|
||
tangent = normalize( cross( bd3D, tangent ) );
|
||
vec3 bitangent = cross( bd3D, tangent );
|
||
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
|
||
shadow = (
|
||
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +
|
||
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +
|
||
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +
|
||
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +
|
||
texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )
|
||
) * 0.2;
|
||
}
|
||
return mix( 1.0, shadow, shadowIntensity );
|
||
}
|
||
#elif defined( SHADOWMAP_TYPE_BASIC )
|
||
float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
||
float shadow = 1.0;
|
||
vec3 lightToPosition = shadowCoord.xyz;
|
||
vec3 bd3D = normalize( lightToPosition );
|
||
vec3 absVec = abs( lightToPosition );
|
||
float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
|
||
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
|
||
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
||
dp += shadowBias;
|
||
float depth = textureCube( shadowMap, bd3D ).r;
|
||
#ifdef USE_REVERSED_DEPTH_BUFFER
|
||
shadow = step( depth, dp );
|
||
#else
|
||
shadow = step( dp, depth );
|
||
#endif
|
||
}
|
||
return mix( 1.0, shadow, shadowIntensity );
|
||
}
|
||
#endif
|
||
#endif
|
||
#endif`,K0=`#if NUM_SPOT_LIGHT_COORDS > 0
|
||
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
||
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
||
#endif
|
||
#ifdef USE_SHADOWMAP
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
||
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
||
struct DirectionalLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
||
struct SpotLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
||
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
||
struct PointLightShadow {
|
||
float shadowIntensity;
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
float shadowCameraNear;
|
||
float shadowCameraFar;
|
||
};
|
||
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#endif`,$0=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
||
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
||
vec4 shadowWorldPosition;
|
||
#endif
|
||
#if defined( USE_SHADOWMAP )
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
||
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
||
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
||
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
||
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_COORDS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
|
||
shadowWorldPosition = worldPosition;
|
||
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
||
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
|
||
#endif
|
||
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif`,J0=`float getShadowMask() {
|
||
float shadow = 1.0;
|
||
#ifdef USE_SHADOWMAP
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
DirectionalLightShadow directionalLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
||
directionalLight = directionalLightShadows[ i ];
|
||
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
||
SpotLightShadow spotLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
||
spotLight = spotLightShadows[ i ];
|
||
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
|
||
PointLightShadow pointLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
||
pointLight = pointLightShadows[ i ];
|
||
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif
|
||
return shadow;
|
||
}`,Q0=`#ifdef USE_SKINNING
|
||
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
||
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
||
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
||
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
||
#endif`,ev=`#ifdef USE_SKINNING
|
||
uniform mat4 bindMatrix;
|
||
uniform mat4 bindMatrixInverse;
|
||
uniform highp sampler2D boneTexture;
|
||
mat4 getBoneMatrix( const in float i ) {
|
||
int size = textureSize( boneTexture, 0 ).x;
|
||
int j = int( i ) * 4;
|
||
int x = j % size;
|
||
int y = j / size;
|
||
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
|
||
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
|
||
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
|
||
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
||
return mat4( v1, v2, v3, v4 );
|
||
}
|
||
#endif`,tv=`#ifdef USE_SKINNING
|
||
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
||
vec4 skinned = vec4( 0.0 );
|
||
skinned += boneMatX * skinVertex * skinWeight.x;
|
||
skinned += boneMatY * skinVertex * skinWeight.y;
|
||
skinned += boneMatZ * skinVertex * skinWeight.z;
|
||
skinned += boneMatW * skinVertex * skinWeight.w;
|
||
transformed = ( bindMatrixInverse * skinned ).xyz;
|
||
#endif`,nv=`#ifdef USE_SKINNING
|
||
mat4 skinMatrix = mat4( 0.0 );
|
||
skinMatrix += skinWeight.x * boneMatX;
|
||
skinMatrix += skinWeight.y * boneMatY;
|
||
skinMatrix += skinWeight.z * boneMatZ;
|
||
skinMatrix += skinWeight.w * boneMatW;
|
||
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
||
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
||
#ifdef USE_TANGENT
|
||
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
||
#endif
|
||
#endif`,iv=`float specularStrength;
|
||
#ifdef USE_SPECULARMAP
|
||
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
||
specularStrength = texelSpecular.r;
|
||
#else
|
||
specularStrength = 1.0;
|
||
#endif`,sv=`#ifdef USE_SPECULARMAP
|
||
uniform sampler2D specularMap;
|
||
#endif`,rv=`#if defined( TONE_MAPPING )
|
||
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
||
#endif`,av=`#ifndef saturate
|
||
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
||
#endif
|
||
uniform float toneMappingExposure;
|
||
vec3 LinearToneMapping( vec3 color ) {
|
||
return saturate( toneMappingExposure * color );
|
||
}
|
||
vec3 ReinhardToneMapping( vec3 color ) {
|
||
color *= toneMappingExposure;
|
||
return saturate( color / ( vec3( 1.0 ) + color ) );
|
||
}
|
||
vec3 CineonToneMapping( vec3 color ) {
|
||
color *= toneMappingExposure;
|
||
color = max( vec3( 0.0 ), color - 0.004 );
|
||
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
||
}
|
||
vec3 RRTAndODTFit( vec3 v ) {
|
||
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
||
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
||
return a / b;
|
||
}
|
||
vec3 ACESFilmicToneMapping( vec3 color ) {
|
||
const mat3 ACESInputMat = mat3(
|
||
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
||
vec3( 0.04823, 0.01566, 0.83777 )
|
||
);
|
||
const mat3 ACESOutputMat = mat3(
|
||
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
||
vec3( -0.07367, -0.00605, 1.07602 )
|
||
);
|
||
color *= toneMappingExposure / 0.6;
|
||
color = ACESInputMat * color;
|
||
color = RRTAndODTFit( color );
|
||
color = ACESOutputMat * color;
|
||
return saturate( color );
|
||
}
|
||
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
|
||
vec3( 1.6605, - 0.1246, - 0.0182 ),
|
||
vec3( - 0.5876, 1.1329, - 0.1006 ),
|
||
vec3( - 0.0728, - 0.0083, 1.1187 )
|
||
);
|
||
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
|
||
vec3( 0.6274, 0.0691, 0.0164 ),
|
||
vec3( 0.3293, 0.9195, 0.0880 ),
|
||
vec3( 0.0433, 0.0113, 0.8956 )
|
||
);
|
||
vec3 agxDefaultContrastApprox( vec3 x ) {
|
||
vec3 x2 = x * x;
|
||
vec3 x4 = x2 * x2;
|
||
return + 15.5 * x4 * x2
|
||
- 40.14 * x4 * x
|
||
+ 31.96 * x4
|
||
- 6.868 * x2 * x
|
||
+ 0.4298 * x2
|
||
+ 0.1191 * x
|
||
- 0.00232;
|
||
}
|
||
vec3 AgXToneMapping( vec3 color ) {
|
||
const mat3 AgXInsetMatrix = mat3(
|
||
vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
|
||
vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
|
||
vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
|
||
);
|
||
const mat3 AgXOutsetMatrix = mat3(
|
||
vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
|
||
vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
|
||
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
|
||
);
|
||
const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
|
||
color *= toneMappingExposure;
|
||
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
|
||
color = AgXInsetMatrix * color;
|
||
color = max( color, 1e-10 ); color = log2( color );
|
||
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
|
||
color = clamp( color, 0.0, 1.0 );
|
||
color = agxDefaultContrastApprox( color );
|
||
color = AgXOutsetMatrix * color;
|
||
color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
|
||
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
|
||
color = clamp( color, 0.0, 1.0 );
|
||
return color;
|
||
}
|
||
vec3 NeutralToneMapping( vec3 color ) {
|
||
const float StartCompression = 0.8 - 0.04;
|
||
const float Desaturation = 0.15;
|
||
color *= toneMappingExposure;
|
||
float x = min( color.r, min( color.g, color.b ) );
|
||
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
|
||
color -= offset;
|
||
float peak = max( color.r, max( color.g, color.b ) );
|
||
if ( peak < StartCompression ) return color;
|
||
float d = 1. - StartCompression;
|
||
float newPeak = 1. - d * d / ( peak + d - StartCompression );
|
||
color *= newPeak / peak;
|
||
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
||
return mix( color, vec3( newPeak ), g );
|
||
}
|
||
vec3 CustomToneMapping( vec3 color ) { return color; }`,ov=`#ifdef USE_TRANSMISSION
|
||
material.transmission = transmission;
|
||
material.transmissionAlpha = 1.0;
|
||
material.thickness = thickness;
|
||
material.attenuationDistance = attenuationDistance;
|
||
material.attenuationColor = attenuationColor;
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
|
||
#endif
|
||
vec3 pos = vWorldPosition;
|
||
vec3 v = normalize( cameraPosition - pos );
|
||
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
||
vec4 transmitted = getIBLVolumeRefraction(
|
||
n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
|
||
pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
|
||
material.attenuationColor, material.attenuationDistance );
|
||
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
||
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
||
#endif`,lv=`#ifdef USE_TRANSMISSION
|
||
uniform float transmission;
|
||
uniform float thickness;
|
||
uniform float attenuationDistance;
|
||
uniform vec3 attenuationColor;
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
uniform sampler2D transmissionMap;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
uniform sampler2D thicknessMap;
|
||
#endif
|
||
uniform vec2 transmissionSamplerSize;
|
||
uniform sampler2D transmissionSamplerMap;
|
||
uniform mat4 modelMatrix;
|
||
uniform mat4 projectionMatrix;
|
||
varying vec3 vWorldPosition;
|
||
float w0( float a ) {
|
||
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
|
||
}
|
||
float w1( float a ) {
|
||
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
|
||
}
|
||
float w2( float a ){
|
||
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
|
||
}
|
||
float w3( float a ) {
|
||
return ( 1.0 / 6.0 ) * ( a * a * a );
|
||
}
|
||
float g0( float a ) {
|
||
return w0( a ) + w1( a );
|
||
}
|
||
float g1( float a ) {
|
||
return w2( a ) + w3( a );
|
||
}
|
||
float h0( float a ) {
|
||
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
|
||
}
|
||
float h1( float a ) {
|
||
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
|
||
}
|
||
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
|
||
uv = uv * texelSize.zw + 0.5;
|
||
vec2 iuv = floor( uv );
|
||
vec2 fuv = fract( uv );
|
||
float g0x = g0( fuv.x );
|
||
float g1x = g1( fuv.x );
|
||
float h0x = h0( fuv.x );
|
||
float h1x = h1( fuv.x );
|
||
float h0y = h0( fuv.y );
|
||
float h1y = h1( fuv.y );
|
||
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
||
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
||
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
||
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
||
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
|
||
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
|
||
}
|
||
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
|
||
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
|
||
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
|
||
vec2 fLodSizeInv = 1.0 / fLodSize;
|
||
vec2 cLodSizeInv = 1.0 / cLodSize;
|
||
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
|
||
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
|
||
return mix( fSample, cSample, fract( lod ) );
|
||
}
|
||
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
||
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
||
vec3 modelScale;
|
||
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
||
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
||
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
||
return normalize( refractionVector ) * thickness * modelScale;
|
||
}
|
||
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
||
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
||
}
|
||
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
||
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
||
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
|
||
}
|
||
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
||
if ( isinf( attenuationDistance ) ) {
|
||
return vec3( 1.0 );
|
||
} else {
|
||
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
||
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
|
||
}
|
||
}
|
||
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
||
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
||
const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
|
||
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
||
vec4 transmittedLight;
|
||
vec3 transmittance;
|
||
#ifdef USE_DISPERSION
|
||
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
|
||
vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
|
||
for ( int i = 0; i < 3; i ++ ) {
|
||
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
|
||
vec3 refractedRayExit = position + transmissionRay;
|
||
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
||
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
||
refractionCoords += 1.0;
|
||
refractionCoords /= 2.0;
|
||
vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
|
||
transmittedLight[ i ] = transmissionSample[ i ];
|
||
transmittedLight.a += transmissionSample.a;
|
||
transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
|
||
}
|
||
transmittedLight.a /= 3.0;
|
||
#else
|
||
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
||
vec3 refractedRayExit = position + transmissionRay;
|
||
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
||
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
||
refractionCoords += 1.0;
|
||
refractionCoords /= 2.0;
|
||
transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
||
transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
|
||
#endif
|
||
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
|
||
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
||
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
||
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
||
}
|
||
#endif`,cv=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
||
varying vec2 vUv;
|
||
#endif
|
||
#ifdef USE_MAP
|
||
varying vec2 vMapUv;
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
varying vec2 vAlphaMapUv;
|
||
#endif
|
||
#ifdef USE_LIGHTMAP
|
||
varying vec2 vLightMapUv;
|
||
#endif
|
||
#ifdef USE_AOMAP
|
||
varying vec2 vAoMapUv;
|
||
#endif
|
||
#ifdef USE_BUMPMAP
|
||
varying vec2 vBumpMapUv;
|
||
#endif
|
||
#ifdef USE_NORMALMAP
|
||
varying vec2 vNormalMapUv;
|
||
#endif
|
||
#ifdef USE_EMISSIVEMAP
|
||
varying vec2 vEmissiveMapUv;
|
||
#endif
|
||
#ifdef USE_METALNESSMAP
|
||
varying vec2 vMetalnessMapUv;
|
||
#endif
|
||
#ifdef USE_ROUGHNESSMAP
|
||
varying vec2 vRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_ANISOTROPYMAP
|
||
varying vec2 vAnisotropyMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOATMAP
|
||
varying vec2 vClearcoatMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
varying vec2 vClearcoatNormalMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
varying vec2 vClearcoatRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCEMAP
|
||
varying vec2 vIridescenceMapUv;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
varying vec2 vIridescenceThicknessMapUv;
|
||
#endif
|
||
#ifdef USE_SHEEN_COLORMAP
|
||
varying vec2 vSheenColorMapUv;
|
||
#endif
|
||
#ifdef USE_SHEEN_ROUGHNESSMAP
|
||
varying vec2 vSheenRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULARMAP
|
||
varying vec2 vSpecularMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULAR_COLORMAP
|
||
varying vec2 vSpecularColorMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULAR_INTENSITYMAP
|
||
varying vec2 vSpecularIntensityMapUv;
|
||
#endif
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
uniform mat3 transmissionMapTransform;
|
||
varying vec2 vTransmissionMapUv;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
uniform mat3 thicknessMapTransform;
|
||
varying vec2 vThicknessMapUv;
|
||
#endif`,hv=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
||
varying vec2 vUv;
|
||
#endif
|
||
#ifdef USE_MAP
|
||
uniform mat3 mapTransform;
|
||
varying vec2 vMapUv;
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
uniform mat3 alphaMapTransform;
|
||
varying vec2 vAlphaMapUv;
|
||
#endif
|
||
#ifdef USE_LIGHTMAP
|
||
uniform mat3 lightMapTransform;
|
||
varying vec2 vLightMapUv;
|
||
#endif
|
||
#ifdef USE_AOMAP
|
||
uniform mat3 aoMapTransform;
|
||
varying vec2 vAoMapUv;
|
||
#endif
|
||
#ifdef USE_BUMPMAP
|
||
uniform mat3 bumpMapTransform;
|
||
varying vec2 vBumpMapUv;
|
||
#endif
|
||
#ifdef USE_NORMALMAP
|
||
uniform mat3 normalMapTransform;
|
||
varying vec2 vNormalMapUv;
|
||
#endif
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
uniform mat3 displacementMapTransform;
|
||
varying vec2 vDisplacementMapUv;
|
||
#endif
|
||
#ifdef USE_EMISSIVEMAP
|
||
uniform mat3 emissiveMapTransform;
|
||
varying vec2 vEmissiveMapUv;
|
||
#endif
|
||
#ifdef USE_METALNESSMAP
|
||
uniform mat3 metalnessMapTransform;
|
||
varying vec2 vMetalnessMapUv;
|
||
#endif
|
||
#ifdef USE_ROUGHNESSMAP
|
||
uniform mat3 roughnessMapTransform;
|
||
varying vec2 vRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_ANISOTROPYMAP
|
||
uniform mat3 anisotropyMapTransform;
|
||
varying vec2 vAnisotropyMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOATMAP
|
||
uniform mat3 clearcoatMapTransform;
|
||
varying vec2 vClearcoatMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
uniform mat3 clearcoatNormalMapTransform;
|
||
varying vec2 vClearcoatNormalMapUv;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
uniform mat3 clearcoatRoughnessMapTransform;
|
||
varying vec2 vClearcoatRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_SHEEN_COLORMAP
|
||
uniform mat3 sheenColorMapTransform;
|
||
varying vec2 vSheenColorMapUv;
|
||
#endif
|
||
#ifdef USE_SHEEN_ROUGHNESSMAP
|
||
uniform mat3 sheenRoughnessMapTransform;
|
||
varying vec2 vSheenRoughnessMapUv;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCEMAP
|
||
uniform mat3 iridescenceMapTransform;
|
||
varying vec2 vIridescenceMapUv;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
uniform mat3 iridescenceThicknessMapTransform;
|
||
varying vec2 vIridescenceThicknessMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULARMAP
|
||
uniform mat3 specularMapTransform;
|
||
varying vec2 vSpecularMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULAR_COLORMAP
|
||
uniform mat3 specularColorMapTransform;
|
||
varying vec2 vSpecularColorMapUv;
|
||
#endif
|
||
#ifdef USE_SPECULAR_INTENSITYMAP
|
||
uniform mat3 specularIntensityMapTransform;
|
||
varying vec2 vSpecularIntensityMapUv;
|
||
#endif
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
uniform mat3 transmissionMapTransform;
|
||
varying vec2 vTransmissionMapUv;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
uniform mat3 thicknessMapTransform;
|
||
varying vec2 vThicknessMapUv;
|
||
#endif`,uv=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
||
vUv = vec3( uv, 1 ).xy;
|
||
#endif
|
||
#ifdef USE_MAP
|
||
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_LIGHTMAP
|
||
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_AOMAP
|
||
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_BUMPMAP
|
||
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_NORMALMAP
|
||
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_EMISSIVEMAP
|
||
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_METALNESSMAP
|
||
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_ROUGHNESSMAP
|
||
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_ANISOTROPYMAP
|
||
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_CLEARCOATMAP
|
||
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCEMAP
|
||
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
||
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_SHEEN_COLORMAP
|
||
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_SHEEN_ROUGHNESSMAP
|
||
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_SPECULARMAP
|
||
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_SPECULAR_COLORMAP
|
||
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_SPECULAR_INTENSITYMAP
|
||
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
||
#endif`,dv=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
||
vec4 worldPosition = vec4( transformed, 1.0 );
|
||
#ifdef USE_BATCHING
|
||
worldPosition = batchingMatrix * worldPosition;
|
||
#endif
|
||
#ifdef USE_INSTANCING
|
||
worldPosition = instanceMatrix * worldPosition;
|
||
#endif
|
||
worldPosition = modelMatrix * worldPosition;
|
||
#endif`;const et={alphahash_fragment:pg,alphahash_pars_fragment:mg,alphamap_fragment:gg,alphamap_pars_fragment:vg,alphatest_fragment:xg,alphatest_pars_fragment:_g,aomap_fragment:bg,aomap_pars_fragment:yg,batching_pars_vertex:Mg,batching_vertex:wg,begin_vertex:Sg,beginnormal_vertex:Eg,bsdfs:Tg,iridescence_fragment:Cg,bumpmap_pars_fragment:Ag,clipping_planes_fragment:Pg,clipping_planes_pars_fragment:Rg,clipping_planes_pars_vertex:Lg,clipping_planes_vertex:Dg,color_fragment:Ig,color_pars_fragment:Ng,color_pars_vertex:Ug,color_vertex:Bg,common:kg,cube_uv_reflection_fragment:Og,defaultnormal_vertex:Fg,displacementmap_pars_vertex:zg,displacementmap_vertex:Hg,emissivemap_fragment:Vg,emissivemap_pars_fragment:Gg,colorspace_fragment:Wg,colorspace_pars_fragment:Xg,envmap_fragment:jg,envmap_common_pars_fragment:Zg,envmap_pars_fragment:qg,envmap_pars_vertex:Yg,envmap_physical_pars_fragment:a0,envmap_vertex:Kg,fog_vertex:$g,fog_pars_vertex:Jg,fog_fragment:Qg,fog_pars_fragment:e0,gradientmap_pars_fragment:t0,lightmap_pars_fragment:n0,lights_lambert_fragment:i0,lights_lambert_pars_fragment:s0,lights_pars_begin:r0,lights_toon_fragment:o0,lights_toon_pars_fragment:l0,lights_phong_fragment:c0,lights_phong_pars_fragment:h0,lights_physical_fragment:u0,lights_physical_pars_fragment:d0,lights_fragment_begin:f0,lights_fragment_maps:p0,lights_fragment_end:m0,logdepthbuf_fragment:g0,logdepthbuf_pars_fragment:v0,logdepthbuf_pars_vertex:x0,logdepthbuf_vertex:_0,map_fragment:b0,map_pars_fragment:y0,map_particle_fragment:M0,map_particle_pars_fragment:w0,metalnessmap_fragment:S0,metalnessmap_pars_fragment:E0,morphinstance_vertex:T0,morphcolor_vertex:C0,morphnormal_vertex:A0,morphtarget_pars_vertex:P0,morphtarget_vertex:R0,normal_fragment_begin:L0,normal_fragment_maps:D0,normal_pars_fragment:I0,normal_pars_vertex:N0,normal_vertex:U0,normalmap_pars_fragment:B0,clearcoat_normal_fragment_begin:k0,clearcoat_normal_fragment_maps:O0,clearcoat_pars_fragment:F0,iridescence_pars_fragment:z0,opaque_fragment:H0,packing:V0,premultiplied_alpha_fragment:G0,project_vertex:W0,dithering_fragment:X0,dithering_pars_fragment:j0,roughnessmap_fragment:Z0,roughnessmap_pars_fragment:q0,shadowmap_pars_fragment:Y0,shadowmap_pars_vertex:K0,shadowmap_vertex:$0,shadowmask_pars_fragment:J0,skinbase_vertex:Q0,skinning_pars_vertex:ev,skinning_vertex:tv,skinnormal_vertex:nv,specularmap_fragment:iv,specularmap_pars_fragment:sv,tonemapping_fragment:rv,tonemapping_pars_fragment:av,transmission_fragment:ov,transmission_pars_fragment:lv,uv_pars_fragment:cv,uv_pars_vertex:hv,uv_vertex:uv,worldpos_vertex:dv,background_vert:`varying vec2 vUv;
|
||
uniform mat3 uvTransform;
|
||
void main() {
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
||
}`,background_frag:`uniform sampler2D t2D;
|
||
uniform float backgroundIntensity;
|
||
varying vec2 vUv;
|
||
void main() {
|
||
vec4 texColor = texture2D( t2D, vUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE
|
||
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
|
||
#endif
|
||
texColor.rgb *= backgroundIntensity;
|
||
gl_FragColor = texColor;
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,backgroundCube_vert:`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE
|
||
uniform samplerCube envMap;
|
||
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
||
uniform sampler2D envMap;
|
||
#endif
|
||
uniform float flipEnvMap;
|
||
uniform float backgroundBlurriness;
|
||
uniform float backgroundIntensity;
|
||
uniform mat3 backgroundRotation;
|
||
varying vec3 vWorldDirection;
|
||
#include <cube_uv_reflection_fragment>
|
||
void main() {
|
||
#ifdef ENVMAP_TYPE_CUBE
|
||
vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
|
||
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
||
vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
|
||
#else
|
||
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
||
#endif
|
||
texColor.rgb *= backgroundIntensity;
|
||
gl_FragColor = texColor;
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,cube_vert:`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,cube_frag:`uniform samplerCube tCube;
|
||
uniform float tFlip;
|
||
uniform float opacity;
|
||
varying vec3 vWorldDirection;
|
||
void main() {
|
||
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
|
||
gl_FragColor = texColor;
|
||
gl_FragColor.a *= opacity;
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,depth_vert:`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
varying vec2 vHighPrecisionZW;
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <morphinstance_vertex>
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vHighPrecisionZW = gl_Position.zw;
|
||
}`,depth_frag:`#if DEPTH_PACKING == 3200
|
||
uniform float opacity;
|
||
#endif
|
||
#include <common>
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
varying vec2 vHighPrecisionZW;
|
||
void main() {
|
||
vec4 diffuseColor = vec4( 1.0 );
|
||
#include <clipping_planes_fragment>
|
||
#if DEPTH_PACKING == 3200
|
||
diffuseColor.a = opacity;
|
||
#endif
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#ifdef USE_REVERSED_DEPTH_BUFFER
|
||
float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
|
||
#else
|
||
float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
|
||
#endif
|
||
#if DEPTH_PACKING == 3200
|
||
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
||
#elif DEPTH_PACKING == 3201
|
||
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
||
#elif DEPTH_PACKING == 3202
|
||
gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
|
||
#elif DEPTH_PACKING == 3203
|
||
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
||
#endif
|
||
}`,distance_vert:`#define DISTANCE
|
||
varying vec3 vWorldPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <morphinstance_vertex>
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vWorldPosition = worldPosition.xyz;
|
||
}`,distance_frag:`#define DISTANCE
|
||
uniform vec3 referencePosition;
|
||
uniform float nearDistance;
|
||
uniform float farDistance;
|
||
varying vec3 vWorldPosition;
|
||
#include <common>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main () {
|
||
vec4 diffuseColor = vec4( 1.0 );
|
||
#include <clipping_planes_fragment>
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
float dist = length( vWorldPosition - referencePosition );
|
||
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
||
dist = saturate( dist );
|
||
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
|
||
}`,equirect_vert:`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
}`,equirect_frag:`uniform sampler2D tEquirect;
|
||
varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vec3 direction = normalize( vWorldDirection );
|
||
vec2 sampleUV = equirectUv( direction );
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
}`,linedashed_vert:`uniform float scale;
|
||
attribute float lineDistance;
|
||
varying float vLineDistance;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
vLineDistance = scale * lineDistance;
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
}`,linedashed_frag:`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform float dashSize;
|
||
uniform float totalSize;
|
||
varying float vLineDistance;
|
||
#include <common>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
||
discard;
|
||
}
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
}`,meshbasic_vert:`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,meshbasic_frag:`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#endif
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
#ifdef USE_LIGHTMAP
|
||
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
||
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
|
||
#else
|
||
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
||
#endif
|
||
#include <aomap_fragment>
|
||
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
||
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,meshlambert_vert:`#define LAMBERT
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,meshlambert_frag:`#define LAMBERT
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_lambert_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_lambert_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,meshmatcap_vert:`#define MATCAP
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
}`,meshmatcap_frag:`#define MATCAP
|
||
uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform sampler2D matcap;
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <normal_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
vec3 viewDir = normalize( vViewPosition );
|
||
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
||
vec3 y = cross( viewDir, x );
|
||
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
||
#ifdef USE_MATCAP
|
||
vec4 matcapColor = texture2D( matcap, uv );
|
||
#else
|
||
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
|
||
#endif
|
||
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,meshnormal_vert:`#define NORMAL
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
varying vec3 vViewPosition;
|
||
#endif
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
vViewPosition = - mvPosition.xyz;
|
||
#endif
|
||
}`,meshnormal_frag:`#define NORMAL
|
||
uniform float opacity;
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
||
varying vec3 vViewPosition;
|
||
#endif
|
||
#include <uv_pars_fragment>
|
||
#include <normal_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
|
||
#ifdef OPAQUE
|
||
gl_FragColor.a = 1.0;
|
||
#endif
|
||
}`,meshphong_vert:`#define PHONG
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,meshphong_frag:`#define PHONG
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform vec3 specular;
|
||
uniform float shininess;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_phong_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <specularmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_phong_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
||
#include <envmap_fragment>
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,meshphysical_vert:`#define STANDARD
|
||
varying vec3 vViewPosition;
|
||
#ifdef USE_TRANSMISSION
|
||
varying vec3 vWorldPosition;
|
||
#endif
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
#ifdef USE_TRANSMISSION
|
||
vWorldPosition = worldPosition.xyz;
|
||
#endif
|
||
}`,meshphysical_frag:`#define STANDARD
|
||
#ifdef PHYSICAL
|
||
#define IOR
|
||
#define USE_SPECULAR
|
||
#endif
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float roughness;
|
||
uniform float metalness;
|
||
uniform float opacity;
|
||
#ifdef IOR
|
||
uniform float ior;
|
||
#endif
|
||
#ifdef USE_SPECULAR
|
||
uniform float specularIntensity;
|
||
uniform vec3 specularColor;
|
||
#ifdef USE_SPECULAR_COLORMAP
|
||
uniform sampler2D specularColorMap;
|
||
#endif
|
||
#ifdef USE_SPECULAR_INTENSITYMAP
|
||
uniform sampler2D specularIntensityMap;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
uniform float clearcoat;
|
||
uniform float clearcoatRoughness;
|
||
#endif
|
||
#ifdef USE_DISPERSION
|
||
uniform float dispersion;
|
||
#endif
|
||
#ifdef USE_IRIDESCENCE
|
||
uniform float iridescence;
|
||
uniform float iridescenceIOR;
|
||
uniform float iridescenceThicknessMinimum;
|
||
uniform float iridescenceThicknessMaximum;
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
uniform vec3 sheenColor;
|
||
uniform float sheenRoughness;
|
||
#ifdef USE_SHEEN_COLORMAP
|
||
uniform sampler2D sheenColorMap;
|
||
#endif
|
||
#ifdef USE_SHEEN_ROUGHNESSMAP
|
||
uniform sampler2D sheenRoughnessMap;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_ANISOTROPY
|
||
uniform vec2 anisotropyVector;
|
||
#ifdef USE_ANISOTROPYMAP
|
||
uniform sampler2D anisotropyMap;
|
||
#endif
|
||
#endif
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <iridescence_fragment>
|
||
#include <cube_uv_reflection_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_physical_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_physical_pars_fragment>
|
||
#include <transmission_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <clearcoat_pars_fragment>
|
||
#include <iridescence_pars_fragment>
|
||
#include <roughnessmap_pars_fragment>
|
||
#include <metalnessmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <roughnessmap_fragment>
|
||
#include <metalnessmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <clearcoat_normal_fragment_begin>
|
||
#include <clearcoat_normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_physical_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
||
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
||
#include <transmission_fragment>
|
||
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
||
#ifdef USE_SHEEN
|
||
|
||
outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
|
||
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
|
||
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
||
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
|
||
#endif
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,meshtoon_vert:`#define TOON
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,meshtoon_frag:`#define TOON
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <gradientmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_toon_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_toon_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,points_vert:`uniform float size;
|
||
uniform float scale;
|
||
#include <common>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
#ifdef USE_POINTS_UV
|
||
varying vec2 vUv;
|
||
uniform mat3 uvTransform;
|
||
#endif
|
||
void main() {
|
||
#ifdef USE_POINTS_UV
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
#endif
|
||
#include <color_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <project_vertex>
|
||
gl_PointSize = size;
|
||
#ifdef USE_SIZEATTENUATION
|
||
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
||
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
||
#endif
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <fog_vertex>
|
||
}`,points_frag:`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <color_pars_fragment>
|
||
#include <map_particle_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_particle_fragment>
|
||
#include <color_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
}`,shadow_vert:`#include <common>
|
||
#include <batching_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
void main() {
|
||
#include <batching_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphinstance_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,shadow_frag:`uniform vec3 color;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <shadowmask_pars_fragment>
|
||
void main() {
|
||
#include <logdepthbuf_fragment>
|
||
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
}`,sprite_vert:`uniform float rotation;
|
||
uniform vec2 center;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
vec4 mvPosition = modelViewMatrix[ 3 ];
|
||
vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
|
||
#ifndef USE_SIZEATTENUATION
|
||
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
||
if ( isPerspective ) scale *= - mvPosition.z;
|
||
#endif
|
||
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
||
vec2 rotatedPosition;
|
||
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
||
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
||
mvPosition.xy += rotatedPosition;
|
||
gl_Position = projectionMatrix * mvPosition;
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
}`,sprite_frag:`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <alphahash_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <clipping_planes_fragment>
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <alphahash_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <opaque_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <colorspace_fragment>
|
||
#include <fog_fragment>
|
||
}`},Re={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Qe},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Qe}},envmap:{envMap:{value:null},envMapRotation:{value:new Qe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Qe},normalScale:{value:new de(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0},uvTransform:{value:new Qe}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new de(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Qe},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0}}},Gn={basic:{uniforms:$t([Re.common,Re.specularmap,Re.envmap,Re.aomap,Re.lightmap,Re.fog]),vertexShader:et.meshbasic_vert,fragmentShader:et.meshbasic_frag},lambert:{uniforms:$t([Re.common,Re.specularmap,Re.envmap,Re.aomap,Re.lightmap,Re.emissivemap,Re.bumpmap,Re.normalmap,Re.displacementmap,Re.fog,Re.lights,{emissive:{value:new ke(0)}}]),vertexShader:et.meshlambert_vert,fragmentShader:et.meshlambert_frag},phong:{uniforms:$t([Re.common,Re.specularmap,Re.envmap,Re.aomap,Re.lightmap,Re.emissivemap,Re.bumpmap,Re.normalmap,Re.displacementmap,Re.fog,Re.lights,{emissive:{value:new ke(0)},specular:{value:new ke(1118481)},shininess:{value:30}}]),vertexShader:et.meshphong_vert,fragmentShader:et.meshphong_frag},standard:{uniforms:$t([Re.common,Re.envmap,Re.aomap,Re.lightmap,Re.emissivemap,Re.bumpmap,Re.normalmap,Re.displacementmap,Re.roughnessmap,Re.metalnessmap,Re.fog,Re.lights,{emissive:{value:new ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:et.meshphysical_vert,fragmentShader:et.meshphysical_frag},toon:{uniforms:$t([Re.common,Re.aomap,Re.lightmap,Re.emissivemap,Re.bumpmap,Re.normalmap,Re.displacementmap,Re.gradientmap,Re.fog,Re.lights,{emissive:{value:new ke(0)}}]),vertexShader:et.meshtoon_vert,fragmentShader:et.meshtoon_frag},matcap:{uniforms:$t([Re.common,Re.bumpmap,Re.normalmap,Re.displacementmap,Re.fog,{matcap:{value:null}}]),vertexShader:et.meshmatcap_vert,fragmentShader:et.meshmatcap_frag},points:{uniforms:$t([Re.points,Re.fog]),vertexShader:et.points_vert,fragmentShader:et.points_frag},dashed:{uniforms:$t([Re.common,Re.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:et.linedashed_vert,fragmentShader:et.linedashed_frag},depth:{uniforms:$t([Re.common,Re.displacementmap]),vertexShader:et.depth_vert,fragmentShader:et.depth_frag},normal:{uniforms:$t([Re.common,Re.bumpmap,Re.normalmap,Re.displacementmap,{opacity:{value:1}}]),vertexShader:et.meshnormal_vert,fragmentShader:et.meshnormal_frag},sprite:{uniforms:$t([Re.sprite,Re.fog]),vertexShader:et.sprite_vert,fragmentShader:et.sprite_frag},background:{uniforms:{uvTransform:{value:new Qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:et.background_vert,fragmentShader:et.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Qe}},vertexShader:et.backgroundCube_vert,fragmentShader:et.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:et.cube_vert,fragmentShader:et.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:et.equirect_vert,fragmentShader:et.equirect_frag},distance:{uniforms:$t([Re.common,Re.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:et.distance_vert,fragmentShader:et.distance_frag},shadow:{uniforms:$t([Re.lights,Re.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:et.shadow_vert,fragmentShader:et.shadow_frag}};Gn.physical={uniforms:$t([Gn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Qe},clearcoatNormalScale:{value:new de(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Qe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Qe},sheen:{value:0},sheenColor:{value:new ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Qe},transmissionSamplerSize:{value:new de},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Qe},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Qe},anisotropyVector:{value:new de},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Qe}}]),vertexShader:et.meshphysical_vert,fragmentShader:et.meshphysical_frag};const fa={r:0,b:0,g:0},Pi=new sn,fv=new je;function pv(s,e,t,n,i,r,a){const o=new ke(0);let l=r===!0?0:1,c,h,u=null,f=0,d=null;function p(_){let M=_.isScene===!0?_.background:null;return M&&M.isTexture&&(M=(_.backgroundBlurriness>0?t:e).get(M)),M}function g(_){let M=!1;const T=p(_);T===null?m(o,l):T&&T.isColor&&(m(T,1),M=!0);const A=s.xr.getEnvironmentBlendMode();A==="additive"?n.buffers.color.setClear(0,0,0,1,a):A==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(s.autoClear||M)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function v(_,M){const T=p(M);T&&(T.isCubeTexture||T.mapping===wr)?(h===void 0&&(h=new bt(new Si(1,1,1),new Rt({name:"BackgroundCubeMaterial",uniforms:cs(Gn.backgroundCube.uniforms),vertexShader:Gn.backgroundCube.vertexShader,fragmentShader:Gn.backgroundCube.fragmentShader,side:tn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(A,L,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),Pi.copy(M.backgroundRotation),Pi.x*=-1,Pi.y*=-1,Pi.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Pi.y*=-1,Pi.z*=-1),h.material.uniforms.envMap.value=T,h.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(fv.makeRotationFromEuler(Pi)),h.material.toneMapped=nt.getTransfer(T.colorSpace)!==at,(u!==T||f!==T.version||d!==s.toneMapping)&&(h.material.needsUpdate=!0,u=T,f=T.version,d=s.toneMapping),h.layers.enableAll(),_.unshift(h,h.geometry,h.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new bt(new la(2,2),new Rt({name:"BackgroundMaterial",uniforms:cs(Gn.background.uniforms),vertexShader:Gn.background.vertexShader,fragmentShader:Gn.background.fragmentShader,side:Nn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,c.material.toneMapped=nt.getTransfer(T.colorSpace)!==at,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(u!==T||f!==T.version||d!==s.toneMapping)&&(c.material.needsUpdate=!0,u=T,f=T.version,d=s.toneMapping),c.layers.enableAll(),_.unshift(c,c.geometry,c.material,0,0,null))}function m(_,M){_.getRGB(fa,Mh(s)),n.buffers.color.setClear(fa.r,fa.g,fa.b,M,a)}function x(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(_,M=1){o.set(_),l=M,m(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(_){l=_,m(o,l)},render:g,addToRenderList:v,dispose:x}}function mv(s,e){const t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=f(null);let r=i,a=!1;function o(C,k,D,B,w){let F=!1;const q=u(B,D,k);r!==q&&(r=q,c(r.object)),F=d(C,B,D,w),F&&p(C,B,D,w),w!==null&&e.update(w,s.ELEMENT_ARRAY_BUFFER),(F||a)&&(a=!1,M(C,k,D,B),w!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(w).buffer))}function l(){return s.createVertexArray()}function c(C){return s.bindVertexArray(C)}function h(C){return s.deleteVertexArray(C)}function u(C,k,D){const B=D.wireframe===!0;let w=n[C.id];w===void 0&&(w={},n[C.id]=w);let F=w[k.id];F===void 0&&(F={},w[k.id]=F);let q=F[B];return q===void 0&&(q=f(l()),F[B]=q),q}function f(C){const k=[],D=[],B=[];for(let w=0;w<t;w++)k[w]=0,D[w]=0,B[w]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:k,enabledAttributes:D,attributeDivisors:B,object:C,attributes:{},index:null}}function d(C,k,D,B){const w=r.attributes,F=k.attributes;let q=0;const z=D.getAttributes();for(const te in z)if(z[te].location>=0){const le=w[te];let W=F[te];if(W===void 0&&(te==="instanceMatrix"&&C.instanceMatrix&&(W=C.instanceMatrix),te==="instanceColor"&&C.instanceColor&&(W=C.instanceColor)),le===void 0||le.attribute!==W||W&&le.data!==W.data)return!0;q++}return r.attributesNum!==q||r.index!==B}function p(C,k,D,B){const w={},F=k.attributes;let q=0;const z=D.getAttributes();for(const te in z)if(z[te].location>=0){let le=F[te];le===void 0&&(te==="instanceMatrix"&&C.instanceMatrix&&(le=C.instanceMatrix),te==="instanceColor"&&C.instanceColor&&(le=C.instanceColor));const W={};W.attribute=le,le&&le.data&&(W.data=le.data),w[te]=W,q++}r.attributes=w,r.attributesNum=q,r.index=B}function g(){const C=r.newAttributes;for(let k=0,D=C.length;k<D;k++)C[k]=0}function v(C){m(C,0)}function m(C,k){const D=r.newAttributes,B=r.enabledAttributes,w=r.attributeDivisors;D[C]=1,B[C]===0&&(s.enableVertexAttribArray(C),B[C]=1),w[C]!==k&&(s.vertexAttribDivisor(C,k),w[C]=k)}function x(){const C=r.newAttributes,k=r.enabledAttributes;for(let D=0,B=k.length;D<B;D++)k[D]!==C[D]&&(s.disableVertexAttribArray(D),k[D]=0)}function _(C,k,D,B,w,F,q){q===!0?s.vertexAttribIPointer(C,k,D,w,F):s.vertexAttribPointer(C,k,D,B,w,F)}function M(C,k,D,B){g();const w=B.attributes,F=D.getAttributes(),q=k.defaultAttributeValues;for(const z in F){const te=F[z];if(te.location>=0){let K=w[z];if(K===void 0&&(z==="instanceMatrix"&&C.instanceMatrix&&(K=C.instanceMatrix),z==="instanceColor"&&C.instanceColor&&(K=C.instanceColor)),K!==void 0){const le=K.normalized,W=K.itemSize,j=e.get(K);if(j===void 0)continue;const me=j.buffer,ge=j.type,ue=j.bytesPerElement,ie=ge===s.INT||ge===s.UNSIGNED_INT||K.gpuType===ho;if(K.isInterleavedBufferAttribute){const ce=K.data,fe=ce.stride,be=K.offset;if(ce.isInstancedInterleavedBuffer){for(let ye=0;ye<te.locationSize;ye++)m(te.location+ye,ce.meshPerAttribute);C.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=ce.meshPerAttribute*ce.count)}else for(let ye=0;ye<te.locationSize;ye++)v(te.location+ye);s.bindBuffer(s.ARRAY_BUFFER,me);for(let ye=0;ye<te.locationSize;ye++)_(te.location+ye,W/te.locationSize,ge,le,fe*ue,(be+W/te.locationSize*ye)*ue,ie)}else{if(K.isInstancedBufferAttribute){for(let ce=0;ce<te.locationSize;ce++)m(te.location+ce,K.meshPerAttribute);C.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=K.meshPerAttribute*K.count)}else for(let ce=0;ce<te.locationSize;ce++)v(te.location+ce);s.bindBuffer(s.ARRAY_BUFFER,me);for(let ce=0;ce<te.locationSize;ce++)_(te.location+ce,W/te.locationSize,ge,le,W*ue,W/te.locationSize*ce*ue,ie)}}else if(q!==void 0){const le=q[z];if(le!==void 0)switch(le.length){case 2:s.vertexAttrib2fv(te.location,le);break;case 3:s.vertexAttrib3fv(te.location,le);break;case 4:s.vertexAttrib4fv(te.location,le);break;default:s.vertexAttrib1fv(te.location,le)}}}}x()}function T(){U();for(const C in n){const k=n[C];for(const D in k){const B=k[D];for(const w in B)h(B[w].object),delete B[w];delete k[D]}delete n[C]}}function A(C){if(n[C.id]===void 0)return;const k=n[C.id];for(const D in k){const B=k[D];for(const w in B)h(B[w].object),delete B[w];delete k[D]}delete n[C.id]}function L(C){for(const k in n){const D=n[k];if(D[C.id]===void 0)continue;const B=D[C.id];for(const w in B)h(B[w].object),delete B[w];delete D[C.id]}}function U(){E(),a=!0,r!==i&&(r=i,c(r.object))}function E(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:U,resetDefaultState:E,dispose:T,releaseStatesOfGeometry:A,releaseStatesOfProgram:L,initAttributes:g,enableAttribute:v,disableUnusedAttributes:x}}function gv(s,e,t){let n;function i(c){n=c}function r(c,h){s.drawArrays(n,c,h),t.update(h,n,1)}function a(c,h,u){u!==0&&(s.drawArraysInstanced(n,c,h,u),t.update(h,n,u))}function o(c,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,u);let d=0;for(let p=0;p<u;p++)d+=h[p];t.update(d,n,1)}function l(c,h,u,f){if(u===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let p=0;p<c.length;p++)a(c[p],h[p],f[p]);else{d.multiDrawArraysInstancedWEBGL(n,c,0,h,0,f,0,u);let p=0;for(let g=0;g<u;g++)p+=h[g]*f[g];t.update(p,n,1)}}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function vv(s,e,t,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const L=e.get("EXT_texture_filter_anisotropic");i=s.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(L){return!(L!==hn&&n.convert(L)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(L){const U=L===Yt&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==nn&&n.convert(L)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==vn&&!U)}function l(L){if(L==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(ze("WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=t.logarithmicDepthBuffer===!0,f=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),d=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),p=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=s.getParameter(s.MAX_TEXTURE_SIZE),v=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),m=s.getParameter(s.MAX_VERTEX_ATTRIBS),x=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),_=s.getParameter(s.MAX_VARYING_VECTORS),M=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),T=s.getParameter(s.MAX_SAMPLES),A=s.getParameter(s.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reversedDepthBuffer:f,maxTextures:d,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:v,maxAttributes:m,maxVertexUniforms:x,maxVaryings:_,maxFragmentUniforms:M,maxSamples:T,samples:A}}function xv(s){const e=this;let t=null,n=0,i=!1,r=!1;const a=new St,o=new Qe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const d=u.length!==0||f||n!==0||i;return i=f,n=u.length,d},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,f){t=h(u,f,0)},this.setState=function(u,f,d){const p=u.clippingPlanes,g=u.clipIntersection,v=u.clipShadows,m=s.get(u);if(!i||p===null||p.length===0||r&&!v)r?h(null):c();else{const x=r?0:n,_=x*4;let M=m.clippingState||null;l.value=M,M=h(p,f,_,d);for(let T=0;T!==_;++T)M[T]=t[T];m.clippingState=M,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,f,d,p){const g=u!==null?u.length:0;let v=null;if(g!==0){if(v=l.value,p!==!0||v===null){const m=d+g*4,x=f.matrixWorldInverse;o.getNormalMatrix(x),(v===null||v.length<m)&&(v=new Float32Array(m));for(let _=0,M=d;_!==g;++_,M+=4)a.copy(u[_]).applyMatrix4(x,o),a.normal.toArray(v,M),v[M+3]=a.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,v}}function _v(s){let e=new WeakMap;function t(a,o){return o===lo?a.mapping=_i:o===co&&(a.mapping=ji),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===lo||o===co)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new Ch(l.height);return c.fromEquirectangularTexture(s,a),e.set(a,c),a.addEventListener("dispose",i),t(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}const vi=4,Mu=[.125,.215,.35,.446,.526,.582],Ri=20,bv=256,or=new gi,wu=new ke;let Yl=null,Kl=0,$l=0,Jl=!1;const yv=new R;class Su{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,r={}){const{size:a=256,position:o=yv}=r;Yl=this._renderer.getRenderTarget(),Kl=this._renderer.getActiveCubeFace(),$l=this._renderer.getActiveMipmapLevel(),Jl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,i,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Cu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Tu(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Yl,Kl,$l),this._renderer.xr.enabled=Jl,e.scissorTest=!1,ws(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===_i||e.mapping===ji?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Yl=this._renderer.getRenderTarget(),Kl=this._renderer.getActiveCubeFace(),$l=this._renderer.getActiveMipmapLevel(),Jl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:It,minFilter:It,generateMipmaps:!1,type:Yt,format:hn,colorSpace:wt,depthBuffer:!1},i=Eu(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Eu(e,t,n);const{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Mv(r)),this._blurMaterial=Sv(r,e,t),this._ggxMaterial=wv(r,e,t)}return i}_compileMaterial(e){const t=new bt(new gt,e);this._renderer.compile(t,or)}_sceneToCubeUV(e,t,n,i,r){const l=new Zt(90,1,t,n),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,f=u.autoClear,d=u.toneMapping;u.getClearColor(wu),u.toneMapping=Un,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new bt(new Si,new Ft({name:"PMREM.Background",side:tn,depthWrite:!1,depthTest:!1})));const g=this._backgroundBox,v=g.material;let m=!1;const x=e.background;x?x.isColor&&(v.color.copy(x),e.background=null,m=!0):(v.color.copy(wu),m=!0);for(let _=0;_<6;_++){const M=_%3;M===0?(l.up.set(0,c[_],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x+h[_],r.y,r.z)):M===1?(l.up.set(0,0,c[_]),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y+h[_],r.z)):(l.up.set(0,c[_],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y,r.z+h[_]));const T=this._cubeSize;ws(i,M*T,_>2?T:0,T,T),u.setRenderTarget(i),m&&u.render(g,l),u.render(e,l)}u.toneMapping=d,u.autoClear=f,e.background=x}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===_i||e.mapping===ji;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Cu()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Tu());const r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;const o=r.uniforms;o.envMap.value=e;const l=this._cubeSize;ws(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,or)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,r=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const l=a.uniforms,c=n/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-h*h),f=0+c*1.25,d=u*f,{_lodMax:p}=this,g=this._sizeLods[n],v=3*g*(n>p-vi?n-p+vi:0),m=4*(this._cubeSize-g);l.envMap.value=e.texture,l.roughness.value=d,l.mipInt.value=p-t,ws(r,v,m,3*g,2*g),i.setRenderTarget(r),i.render(o,or),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=p-n,ws(e,v,m,3*g,2*g),i.setRenderTarget(e),i.render(o,or)}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Xe("blur direction must be either latitudinal or longitudinal!");const h=3,u=this._lodMeshes[i];u.material=c;const f=c.uniforms,d=this._sizeLods[n]-1,p=isFinite(r)?Math.PI/(2*d):2*Math.PI/(2*Ri-1),g=r/p,v=isFinite(r)?1+Math.floor(h*g):Ri;v>Ri&&ze(`sigmaRadians, ${r}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${Ri}`);const m=[];let x=0;for(let L=0;L<Ri;++L){const U=L/g,E=Math.exp(-U*U/2);m.push(E),L===0?x+=E:L<v&&(x+=2*E)}for(let L=0;L<m.length;L++)m[L]=m[L]/x;f.envMap.value=e.texture,f.samples.value=v,f.weights.value=m,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:_}=this;f.dTheta.value=p,f.mipInt.value=_-n;const M=this._sizeLods[i],T=3*M*(i>_-vi?i-_+vi:0),A=4*(this._cubeSize-M);ws(t,T,A,3*M,2*M),l.setRenderTarget(t),l.render(u,or)}}function Mv(s){const e=[],t=[],n=[];let i=s;const r=s-vi+1+Mu.length;for(let a=0;a<r;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>s-vi?l=Mu[a-s+vi-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),h=-c,u=1+c,f=[h,h,u,h,u,u,h,h,u,u,h,u],d=6,p=6,g=3,v=2,m=1,x=new Float32Array(g*p*d),_=new Float32Array(v*p*d),M=new Float32Array(m*p*d);for(let A=0;A<d;A++){const L=A%3*2/3-1,U=A>2?0:-1,E=[L,U,0,L+2/3,U,0,L+2/3,U+1,0,L,U,0,L+2/3,U+1,0,L,U+1,0];x.set(E,g*p*A),_.set(f,v*p*A);const C=[A,A,A,A,A,A];M.set(C,m*p*A)}const T=new gt;T.setAttribute("position",new mt(x,g)),T.setAttribute("uv",new mt(_,v)),T.setAttribute("faceIndex",new mt(M,m)),n.push(new bt(T,null)),i>vi&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Eu(s,e,t){const n=new Wt(s,e,t);return n.texture.mapping=wr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ws(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function wv(s,e,t){return new Rt({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:bv,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:pa(),fragmentShader:`
|
||
|
||
precision highp float;
|
||
precision highp int;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform sampler2D envMap;
|
||
uniform float roughness;
|
||
uniform float mipInt;
|
||
|
||
#define ENVMAP_TYPE_CUBE_UV
|
||
#include <cube_uv_reflection_fragment>
|
||
|
||
#define PI 3.14159265359
|
||
|
||
// Van der Corput radical inverse
|
||
float radicalInverse_VdC(uint bits) {
|
||
bits = (bits << 16u) | (bits >> 16u);
|
||
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
||
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
||
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
||
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
||
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
||
}
|
||
|
||
// Hammersley sequence
|
||
vec2 hammersley(uint i, uint N) {
|
||
return vec2(float(i) / float(N), radicalInverse_VdC(i));
|
||
}
|
||
|
||
// GGX VNDF importance sampling (Eric Heitz 2018)
|
||
// "Sampling the GGX Distribution of Visible Normals"
|
||
// https://jcgt.org/published/0007/04/01/
|
||
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
|
||
float alpha = roughness * roughness;
|
||
|
||
// Section 3.2: Transform view direction to hemisphere configuration
|
||
vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
|
||
|
||
// Section 4.1: Orthonormal basis
|
||
float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
|
||
vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
|
||
vec3 T2 = cross(Vh, T1);
|
||
|
||
// Section 4.2: Parameterization of projected area
|
||
float r = sqrt(Xi.x);
|
||
float phi = 2.0 * PI * Xi.y;
|
||
float t1 = r * cos(phi);
|
||
float t2 = r * sin(phi);
|
||
float s = 0.5 * (1.0 + Vh.z);
|
||
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
|
||
|
||
// Section 4.3: Reprojection onto hemisphere
|
||
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
|
||
|
||
// Section 3.4: Transform back to ellipsoid configuration
|
||
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
|
||
}
|
||
|
||
void main() {
|
||
vec3 N = normalize(vOutputDirection);
|
||
vec3 V = N; // Assume view direction equals normal for pre-filtering
|
||
|
||
vec3 prefilteredColor = vec3(0.0);
|
||
float totalWeight = 0.0;
|
||
|
||
// For very low roughness, just sample the environment directly
|
||
if (roughness < 0.001) {
|
||
gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
|
||
return;
|
||
}
|
||
|
||
// Tangent space basis for VNDF sampling
|
||
vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
||
vec3 tangent = normalize(cross(up, N));
|
||
vec3 bitangent = cross(N, tangent);
|
||
|
||
for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
|
||
vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
|
||
|
||
// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
|
||
vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
|
||
|
||
// Transform H back to world space
|
||
vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
|
||
vec3 L = normalize(2.0 * dot(V, H) * H - V);
|
||
|
||
float NdotL = max(dot(N, L), 0.0);
|
||
|
||
if(NdotL > 0.0) {
|
||
// Sample environment at fixed mip level
|
||
// VNDF importance sampling handles the distribution filtering
|
||
vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
|
||
|
||
// Weight by NdotL for the split-sum approximation
|
||
// VNDF PDF naturally accounts for the visible microfacet distribution
|
||
prefilteredColor += sampleColor * NdotL;
|
||
totalWeight += NdotL;
|
||
}
|
||
}
|
||
|
||
if (totalWeight > 0.0) {
|
||
prefilteredColor = prefilteredColor / totalWeight;
|
||
}
|
||
|
||
gl_FragColor = vec4(prefilteredColor, 1.0);
|
||
}
|
||
`,blending:kt,depthTest:!1,depthWrite:!1})}function Sv(s,e,t){const n=new Float32Array(Ri),i=new R(0,1,0);return new Rt({name:"SphericalGaussianBlur",defines:{n:Ri,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:pa(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform sampler2D envMap;
|
||
uniform int samples;
|
||
uniform float weights[ n ];
|
||
uniform bool latitudinal;
|
||
uniform float dTheta;
|
||
uniform float mipInt;
|
||
uniform vec3 poleAxis;
|
||
|
||
#define ENVMAP_TYPE_CUBE_UV
|
||
#include <cube_uv_reflection_fragment>
|
||
|
||
vec3 getSample( float theta, vec3 axis ) {
|
||
|
||
float cosTheta = cos( theta );
|
||
// Rodrigues' axis-angle rotation
|
||
vec3 sampleDirection = vOutputDirection * cosTheta
|
||
+ cross( axis, vOutputDirection ) * sin( theta )
|
||
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
||
|
||
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
||
|
||
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
||
|
||
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
||
|
||
}
|
||
|
||
axis = normalize( axis );
|
||
|
||
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
||
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
||
|
||
for ( int i = 1; i < n; i++ ) {
|
||
|
||
if ( i >= samples ) {
|
||
|
||
break;
|
||
|
||
}
|
||
|
||
float theta = dTheta * float( i );
|
||
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
||
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
||
|
||
}
|
||
|
||
}
|
||
`,blending:kt,depthTest:!1,depthWrite:!1})}function Tu(){return new Rt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:pa(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform sampler2D envMap;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 outputDirection = normalize( vOutputDirection );
|
||
vec2 uv = equirectUv( outputDirection );
|
||
|
||
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
||
|
||
}
|
||
`,blending:kt,depthTest:!1,depthWrite:!1})}function Cu(){return new Rt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:pa(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
uniform float flipEnvMap;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform samplerCube envMap;
|
||
|
||
void main() {
|
||
|
||
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
||
|
||
}
|
||
`,blending:kt,depthTest:!1,depthWrite:!1})}function pa(){return`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
attribute float faceIndex;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
// RH coordinate system; PMREM face-indexing convention
|
||
vec3 getDirection( vec2 uv, float face ) {
|
||
|
||
uv = 2.0 * uv - 1.0;
|
||
|
||
vec3 direction = vec3( uv, 1.0 );
|
||
|
||
if ( face == 0.0 ) {
|
||
|
||
direction = direction.zyx; // ( 1, v, u ) pos x
|
||
|
||
} else if ( face == 1.0 ) {
|
||
|
||
direction = direction.xzy;
|
||
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
||
|
||
} else if ( face == 2.0 ) {
|
||
|
||
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
||
|
||
} else if ( face == 3.0 ) {
|
||
|
||
direction = direction.zyx;
|
||
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
||
|
||
} else if ( face == 4.0 ) {
|
||
|
||
direction = direction.xzy;
|
||
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
||
|
||
} else if ( face == 5.0 ) {
|
||
|
||
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
||
|
||
}
|
||
|
||
return direction;
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vOutputDirection = getDirection( uv, faceIndex );
|
||
gl_Position = vec4( position, 1.0 );
|
||
|
||
}
|
||
`}function Ev(s){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===lo||l===co,h=l===_i||l===ji;if(c||h){let u=e.get(o);const f=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==f)return t===null&&(t=new Su(s)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const d=o.image;return c&&d&&d.height>0||h&&d&&i(d)?(t===null&&(t=new Su(s)),u=c?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",r),u.texture):null}}}return o}function i(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function r(o){const l=o.target;l.removeEventListener("dispose",r);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function Tv(s){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=s.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&Hs("WebGLRenderer: "+n+" extension not supported."),i}}}function Cv(s,e,t,n){const i={},r=new WeakMap;function a(u){const f=u.target;f.index!==null&&e.remove(f.index);for(const p in f.attributes)e.remove(f.attributes[p]);f.removeEventListener("dispose",a),delete i[f.id];const d=r.get(f);d&&(e.remove(d),r.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function o(u,f){return i[f.id]===!0||(f.addEventListener("dispose",a),i[f.id]=!0,t.memory.geometries++),f}function l(u){const f=u.attributes;for(const d in f)e.update(f[d],s.ARRAY_BUFFER)}function c(u){const f=[],d=u.index,p=u.attributes.position;let g=0;if(d!==null){const x=d.array;g=d.version;for(let _=0,M=x.length;_<M;_+=3){const T=x[_+0],A=x[_+1],L=x[_+2];f.push(T,A,A,L,L,T)}}else if(p!==void 0){const x=p.array;g=p.version;for(let _=0,M=x.length/3-1;_<M;_+=3){const T=_+0,A=_+1,L=_+2;f.push(T,A,A,L,L,T)}}else return;const v=new(eh(f)?xh:vh)(f,1);v.version=g;const m=r.get(u);m&&e.remove(m),r.set(u,v)}function h(u){const f=r.get(u);if(f){const d=u.index;d!==null&&f.version<d.version&&c(u)}else c(u);return r.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function Av(s,e,t){let n;function i(f){n=f}let r,a;function o(f){r=f.type,a=f.bytesPerElement}function l(f,d){s.drawElements(n,d,r,f*a),t.update(d,n,1)}function c(f,d,p){p!==0&&(s.drawElementsInstanced(n,d,r,f*a,p),t.update(d,n,p))}function h(f,d,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,r,f,0,p);let v=0;for(let m=0;m<p;m++)v+=d[m];t.update(v,n,1)}function u(f,d,p,g){if(p===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let m=0;m<f.length;m++)c(f[m]/a,d[m],g[m]);else{v.multiDrawElementsInstancedWEBGL(n,d,0,r,f,0,g,0,p);let m=0;for(let x=0;x<p;x++)m+=d[x]*g[x];t.update(m,n,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function Pv(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(t.calls++,a){case s.TRIANGLES:t.triangles+=o*(r/3);break;case s.LINES:t.lines+=o*(r/2);break;case s.LINE_STRIP:t.lines+=o*(r-1);break;case s.LINE_LOOP:t.lines+=o*r;break;case s.POINTS:t.points+=o*r;break;default:Xe("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function Rv(s,e,t){const n=new WeakMap,i=new _t;function r(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let f=n.get(o);if(f===void 0||f.count!==u){let E=function(){L.dispose(),n.delete(o),o.removeEventListener("dispose",E)};f!==void 0&&f.texture.dispose();const d=o.morphAttributes.position!==void 0,p=o.morphAttributes.normal!==void 0,g=o.morphAttributes.color!==void 0,v=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],x=o.morphAttributes.color||[];let _=0;d===!0&&(_=1),p===!0&&(_=2),g===!0&&(_=3);let M=o.attributes.position.count*_,T=1;M>e.maxTextureSize&&(T=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const A=new Float32Array(M*T*4*u),L=new oh(A,M,T,u);L.type=vn,L.needsUpdate=!0;const U=_*4;for(let C=0;C<u;C++){const k=v[C],D=m[C],B=x[C],w=M*T*4*C;for(let F=0;F<k.count;F++){const q=F*U;d===!0&&(i.fromBufferAttribute(k,F),A[w+q+0]=i.x,A[w+q+1]=i.y,A[w+q+2]=i.z,A[w+q+3]=0),p===!0&&(i.fromBufferAttribute(D,F),A[w+q+4]=i.x,A[w+q+5]=i.y,A[w+q+6]=i.z,A[w+q+7]=0),g===!0&&(i.fromBufferAttribute(B,F),A[w+q+8]=i.x,A[w+q+9]=i.y,A[w+q+10]=i.z,A[w+q+11]=B.itemSize===4?i.w:1)}}f={count:u,texture:L,size:new de(M,T)},n.set(o,f),o.addEventListener("dispose",E)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(s,"morphTexture",a.morphTexture,t);else{let d=0;for(let g=0;g<c.length;g++)d+=c[g];const p=o.morphTargetsRelative?1:1-d;l.getUniforms().setValue(s,"morphTargetBaseInfluence",p),l.getUniforms().setValue(s,"morphTargetInfluences",c)}l.getUniforms().setValue(s,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(s,"morphTargetsTextureSize",f.size)}return{update:r}}function Lv(s,e,t,n){let i=new WeakMap;function r(l){const c=n.render.frame,h=l.geometry,u=e.get(l,h);if(i.get(u)!==c&&(e.update(u),i.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.get(l)!==c&&(t.update(l.instanceMatrix,s.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,s.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;i.get(f)!==c&&(f.update(),i.set(f,c))}return u}function a(){i=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:r,dispose:a}}const Dv={[no]:"LINEAR_TONE_MAPPING",[io]:"REINHARD_TONE_MAPPING",[so]:"CINEON_TONE_MAPPING",[Mr]:"ACES_FILMIC_TONE_MAPPING",[ao]:"AGX_TONE_MAPPING",[oo]:"NEUTRAL_TONE_MAPPING",[ro]:"CUSTOM_TONE_MAPPING"};function Iv(s,e,t,n,i){const r=new Wt(e,t,{type:s,depthBuffer:n,stencilBuffer:i}),a=new Wt(e,t,{type:Yt,depthBuffer:!1,stencilBuffer:!1}),o=new gt;o.setAttribute("position",new Kt([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new Kt([0,2,0,0,2,0],2));const l=new ou({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
||
precision highp float;
|
||
|
||
uniform mat4 modelViewMatrix;
|
||
uniform mat4 projectionMatrix;
|
||
|
||
attribute vec3 position;
|
||
attribute vec2 uv;
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`
|
||
precision highp float;
|
||
|
||
uniform sampler2D tDiffuse;
|
||
|
||
varying vec2 vUv;
|
||
|
||
#include <tonemapping_pars_fragment>
|
||
#include <colorspace_pars_fragment>
|
||
|
||
void main() {
|
||
gl_FragColor = texture2D( tDiffuse, vUv );
|
||
|
||
#ifdef LINEAR_TONE_MAPPING
|
||
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
|
||
#elif defined( REINHARD_TONE_MAPPING )
|
||
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
|
||
#elif defined( CINEON_TONE_MAPPING )
|
||
gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
|
||
#elif defined( ACES_FILMIC_TONE_MAPPING )
|
||
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
|
||
#elif defined( AGX_TONE_MAPPING )
|
||
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
|
||
#elif defined( NEUTRAL_TONE_MAPPING )
|
||
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
|
||
#elif defined( CUSTOM_TONE_MAPPING )
|
||
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
|
||
#endif
|
||
|
||
#ifdef SRGB_TRANSFER
|
||
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
||
#endif
|
||
}`,depthTest:!1,depthWrite:!1}),c=new bt(o,l),h=new gi(-1,1,1,-1,0,1);let u=null,f=null,d=!1,p,g=null,v=[],m=!1;this.setSize=function(x,_){r.setSize(x,_),a.setSize(x,_);for(let M=0;M<v.length;M++){const T=v[M];T.setSize&&T.setSize(x,_)}},this.setEffects=function(x){v=x,m=v.length>0&&v[0].isRenderPass===!0;const _=r.width,M=r.height;for(let T=0;T<v.length;T++){const A=v[T];A.setSize&&A.setSize(_,M)}},this.begin=function(x,_){if(d||x.toneMapping===Un&&v.length===0)return!1;if(g=_,_!==null){const M=_.width,T=_.height;(r.width!==M||r.height!==T)&&this.setSize(M,T)}return m===!1&&x.setRenderTarget(r),p=x.toneMapping,x.toneMapping=Un,!0},this.hasRenderPass=function(){return m},this.end=function(x,_){x.toneMapping=p,d=!0;let M=r,T=a;for(let A=0;A<v.length;A++){const L=v[A];if(L.enabled!==!1&&(L.render(x,T,M,_),L.needsSwap!==!1)){const U=M;M=T,T=U}}if(u!==x.outputColorSpace||f!==x.toneMapping){u=x.outputColorSpace,f=x.toneMapping,l.defines={},nt.getTransfer(u)===at&&(l.defines.SRGB_TRANSFER="");const A=Dv[f];A&&(l.defines[A]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=M.texture,x.setRenderTarget(g),x.render(c,h),g=null,d=!1},this.isCompositing=function(){return d},this.dispose=function(){r.dispose(),a.dispose(),o.dispose(),l.dispose()}}const Au=new Ot,Ql=new ps(1,1),Pu=new oh,Ru=new Ep,Lu=new Th,Du=[],Iu=[],Nu=new Float32Array(16),Uu=new Float32Array(9),Bu=new Float32Array(4);function Ss(s,e,t){const n=s[0];if(n<=0||n>0)return s;const i=e*t;let r=Du[i];if(r===void 0&&(r=new Float32Array(i),Du[i]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,s[a].toArray(r,o)}return r}function Nt(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function Ut(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function ma(s,e){let t=Iu[e];t===void 0&&(t=new Int32Array(e),Iu[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function Nv(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function Uv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Nt(t,e))return;s.uniform2fv(this.addr,e),Ut(t,e)}}function Bv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Nt(t,e))return;s.uniform3fv(this.addr,e),Ut(t,e)}}function kv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Nt(t,e))return;s.uniform4fv(this.addr,e),Ut(t,e)}}function Ov(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Nt(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),Ut(t,e)}else{if(Nt(t,n))return;Bu.set(n),s.uniformMatrix2fv(this.addr,!1,Bu),Ut(t,n)}}function Fv(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Nt(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),Ut(t,e)}else{if(Nt(t,n))return;Uu.set(n),s.uniformMatrix3fv(this.addr,!1,Uu),Ut(t,n)}}function zv(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Nt(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),Ut(t,e)}else{if(Nt(t,n))return;Nu.set(n),s.uniformMatrix4fv(this.addr,!1,Nu),Ut(t,n)}}function Hv(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function Vv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Nt(t,e))return;s.uniform2iv(this.addr,e),Ut(t,e)}}function Gv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Nt(t,e))return;s.uniform3iv(this.addr,e),Ut(t,e)}}function Wv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Nt(t,e))return;s.uniform4iv(this.addr,e),Ut(t,e)}}function Xv(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function jv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Nt(t,e))return;s.uniform2uiv(this.addr,e),Ut(t,e)}}function Zv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Nt(t,e))return;s.uniform3uiv(this.addr,e),Ut(t,e)}}function qv(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Nt(t,e))return;s.uniform4uiv(this.addr,e),Ut(t,e)}}function Yv(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);let r;this.type===s.SAMPLER_2D_SHADOW?(Ql.compareFunction=t.isReversedDepthBuffer()?Qo:Jo,r=Ql):r=Au,t.setTexture2D(e||r,i)}function Kv(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Ru,i)}function $v(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Lu,i)}function Jv(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Pu,i)}function Qv(s){switch(s){case 5126:return Nv;case 35664:return Uv;case 35665:return Bv;case 35666:return kv;case 35674:return Ov;case 35675:return Fv;case 35676:return zv;case 5124:case 35670:return Hv;case 35667:case 35671:return Vv;case 35668:case 35672:return Gv;case 35669:case 35673:return Wv;case 5125:return Xv;case 36294:return jv;case 36295:return Zv;case 36296:return qv;case 35678:case 36198:case 36298:case 36306:case 35682:return Yv;case 35679:case 36299:case 36307:return Kv;case 35680:case 36300:case 36308:case 36293:return $v;case 36289:case 36303:case 36311:case 36292:return Jv}}function e1(s,e){s.uniform1fv(this.addr,e)}function t1(s,e){const t=Ss(e,this.size,2);s.uniform2fv(this.addr,t)}function n1(s,e){const t=Ss(e,this.size,3);s.uniform3fv(this.addr,t)}function i1(s,e){const t=Ss(e,this.size,4);s.uniform4fv(this.addr,t)}function s1(s,e){const t=Ss(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function r1(s,e){const t=Ss(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function a1(s,e){const t=Ss(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function o1(s,e){s.uniform1iv(this.addr,e)}function l1(s,e){s.uniform2iv(this.addr,e)}function c1(s,e){s.uniform3iv(this.addr,e)}function h1(s,e){s.uniform4iv(this.addr,e)}function u1(s,e){s.uniform1uiv(this.addr,e)}function d1(s,e){s.uniform2uiv(this.addr,e)}function f1(s,e){s.uniform3uiv(this.addr,e)}function p1(s,e){s.uniform4uiv(this.addr,e)}function m1(s,e,t){const n=this.cache,i=e.length,r=ma(t,i);Nt(n,r)||(s.uniform1iv(this.addr,r),Ut(n,r));let a;this.type===s.SAMPLER_2D_SHADOW?a=Ql:a=Au;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,r[o])}function g1(s,e,t){const n=this.cache,i=e.length,r=ma(t,i);Nt(n,r)||(s.uniform1iv(this.addr,r),Ut(n,r));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||Ru,r[a])}function v1(s,e,t){const n=this.cache,i=e.length,r=ma(t,i);Nt(n,r)||(s.uniform1iv(this.addr,r),Ut(n,r));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Lu,r[a])}function x1(s,e,t){const n=this.cache,i=e.length,r=ma(t,i);Nt(n,r)||(s.uniform1iv(this.addr,r),Ut(n,r));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Pu,r[a])}function _1(s){switch(s){case 5126:return e1;case 35664:return t1;case 35665:return n1;case 35666:return i1;case 35674:return s1;case 35675:return r1;case 35676:return a1;case 5124:case 35670:return o1;case 35667:case 35671:return l1;case 35668:case 35672:return c1;case 35669:case 35673:return h1;case 5125:return u1;case 36294:return d1;case 36295:return f1;case 36296:return p1;case 35678:case 36198:case 36298:case 36306:case 35682:return m1;case 35679:case 36299:case 36307:return g1;case 35680:case 36300:case 36308:case 36293:return v1;case 36289:case 36303:case 36311:case 36292:return x1}}class b1{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Qv(t.type)}}class y1{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=_1(t.type)}}class M1{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const o=i[r];o.setValue(e,t[o.id],n)}}}const ec=/(\w+)(\])?(\[|\.)?/g;function ku(s,e){s.seq.push(e),s.map[e.id]=e}function w1(s,e,t){const n=s.name,i=n.length;for(ec.lastIndex=0;;){const r=ec.exec(n),a=ec.lastIndex;let o=r[1];const l=r[2]==="]",c=r[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){ku(t,c===void 0?new b1(o,s,e):new y1(o,s,e));break}else{let u=t.map[o];u===void 0&&(u=new M1(o),ku(t,u)),t=u}}}class ga{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);w1(o,l,this)}const i=[],r=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):r.push(a);i.length>0&&(this.seq=i.concat(r))}setValue(e,t,n,i){const r=this.map[t];r!==void 0&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const o=t[r],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function Ou(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}const S1=37297;let E1=0;function T1(s,e){const t=s.split(`
|
||
`),n=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=i;a<r;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
|
||
`)}const Fu=new Qe;function C1(s){nt._getMatrix(Fu,nt.workingColorSpace,s);const e=`mat3( ${Fu.elements.map(t=>t.toFixed(4))} )`;switch(nt.getTransfer(s)){case Rr:return[e,"LinearTransferOETF"];case at:return[e,"sRGBTransferOETF"];default:return ze("WebGLProgram: Unsupported color space: ",s),[e,"LinearTransferOETF"]}}function zu(s,e,t){const n=s.getShaderParameter(e,s.COMPILE_STATUS),r=(s.getShaderInfoLog(e)||"").trim();if(n&&r==="")return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
|
||
|
||
`+r+`
|
||
|
||
`+T1(s.getShaderSource(e),o)}else return r}function A1(s,e){const t=C1(e);return[`vec4 ${s}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
|
||
`)}const P1={[no]:"Linear",[io]:"Reinhard",[so]:"Cineon",[Mr]:"ACESFilmic",[ao]:"AgX",[oo]:"Neutral",[ro]:"Custom"};function R1(s,e){const t=P1[e];return t===void 0?(ze("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+s+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const va=new R;function L1(){nt.getLuminanceCoefficients(va);const s=va.x.toFixed(4),e=va.y.toFixed(4),t=va.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${s}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
|
||
`)}function D1(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(lr).join(`
|
||
`)}function I1(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
||
`)}function N1(s,e){const t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const r=s.getActiveAttrib(e,i),a=r.name;let o=1;r.type===s.FLOAT_MAT2&&(o=2),r.type===s.FLOAT_MAT3&&(o=3),r.type===s.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:s.getAttribLocation(e,a),locationSize:o}}return t}function lr(s){return s!==""}function Hu(s,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Vu(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const U1=/^[ \t]*#include +<([\w\d./]+)>/gm;function tc(s){return s.replace(U1,k1)}const B1=new Map;function k1(s,e){let t=et[e];if(t===void 0){const n=B1.get(e);if(n!==void 0)t=et[n],ze('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return tc(t)}const O1=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Gu(s){return s.replace(O1,F1)}function F1(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function Wu(s){let e=`precision ${s.precision} float;
|
||
precision ${s.precision} int;
|
||
precision ${s.precision} sampler2D;
|
||
precision ${s.precision} samplerCube;
|
||
precision ${s.precision} sampler3D;
|
||
precision ${s.precision} sampler2DArray;
|
||
precision ${s.precision} sampler2DShadow;
|
||
precision ${s.precision} samplerCubeShadow;
|
||
precision ${s.precision} sampler2DArrayShadow;
|
||
precision ${s.precision} isampler2D;
|
||
precision ${s.precision} isampler3D;
|
||
precision ${s.precision} isamplerCube;
|
||
precision ${s.precision} isampler2DArray;
|
||
precision ${s.precision} usampler2D;
|
||
precision ${s.precision} usampler3D;
|
||
precision ${s.precision} usamplerCube;
|
||
precision ${s.precision} usampler2DArray;
|
||
`;return s.precision==="highp"?e+=`
|
||
#define HIGH_PRECISION`:s.precision==="mediump"?e+=`
|
||
#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`
|
||
#define LOW_PRECISION`),e}const z1={[br]:"SHADOWMAP_TYPE_PCF",[Is]:"SHADOWMAP_TYPE_VSM"};function H1(s){return z1[s.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const V1={[_i]:"ENVMAP_TYPE_CUBE",[ji]:"ENVMAP_TYPE_CUBE",[wr]:"ENVMAP_TYPE_CUBE_UV"};function G1(s){return s.envMap===!1?"ENVMAP_TYPE_CUBE":V1[s.envMapMode]||"ENVMAP_TYPE_CUBE"}const W1={[ji]:"ENVMAP_MODE_REFRACTION"};function X1(s){return s.envMap===!1?"ENVMAP_MODE_REFLECTION":W1[s.envMapMode]||"ENVMAP_MODE_REFLECTION"}const j1={[yr]:"ENVMAP_BLENDING_MULTIPLY",[Vf]:"ENVMAP_BLENDING_MIX",[Gf]:"ENVMAP_BLENDING_ADD"};function Z1(s){return s.envMap===!1?"ENVMAP_BLENDING_NONE":j1[s.combine]||"ENVMAP_BLENDING_NONE"}function q1(s){const e=s.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function Y1(s,e,t,n){const i=s.getContext(),r=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=H1(t),c=G1(t),h=X1(t),u=Z1(t),f=q1(t),d=D1(t),p=I1(r),g=i.createProgram();let v,m,x=t.glslVersion?"#version "+t.glslVersion+`
|
||
`:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(lr).join(`
|
||
`),v.length>0&&(v+=`
|
||
`),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(lr).join(`
|
||
`),m.length>0&&(m+=`
|
||
`)):(v=[Wu(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
||
`].filter(lr).join(`
|
||
`),m=[Wu(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Un?"#define TONE_MAPPING":"",t.toneMapping!==Un?et.tonemapping_pars_fragment:"",t.toneMapping!==Un?R1("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",et.colorspace_pars_fragment,A1("linearToOutputTexel",t.outputColorSpace),L1(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
||
`].filter(lr).join(`
|
||
`)),a=tc(a),a=Hu(a,t),a=Vu(a,t),o=tc(o),o=Hu(o,t),o=Vu(o,t),a=Gu(a),o=Gu(o),t.isRawShaderMaterial!==!0&&(x=`#version 300 es
|
||
`,v=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
||
`)+`
|
||
`+v,m=["#define varying in",t.glslVersion===Qc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Qc?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
||
`)+`
|
||
`+m);const _=x+v+a,M=x+m+o,T=Ou(i,i.VERTEX_SHADER,_),A=Ou(i,i.FRAGMENT_SHADER,M);i.attachShader(g,T),i.attachShader(g,A),t.index0AttributeName!==void 0?i.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(g,0,"position"),i.linkProgram(g);function L(k){if(s.debug.checkShaderErrors){const D=i.getProgramInfoLog(g)||"",B=i.getShaderInfoLog(T)||"",w=i.getShaderInfoLog(A)||"",F=D.trim(),q=B.trim(),z=w.trim();let te=!0,K=!0;if(i.getProgramParameter(g,i.LINK_STATUS)===!1)if(te=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,g,T,A);else{const le=zu(i,T,"vertex"),W=zu(i,A,"fragment");Xe("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(g,i.VALIDATE_STATUS)+`
|
||
|
||
Material Name: `+k.name+`
|
||
Material Type: `+k.type+`
|
||
|
||
Program Info Log: `+F+`
|
||
`+le+`
|
||
`+W)}else F!==""?ze("WebGLProgram: Program Info Log:",F):(q===""||z==="")&&(K=!1);K&&(k.diagnostics={runnable:te,programLog:F,vertexShader:{log:q,prefix:v},fragmentShader:{log:z,prefix:m}})}i.deleteShader(T),i.deleteShader(A),U=new ga(i,g),E=N1(i,g)}let U;this.getUniforms=function(){return U===void 0&&L(this),U};let E;this.getAttributes=function(){return E===void 0&&L(this),E};let C=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return C===!1&&(C=i.getProgramParameter(g,S1)),C},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=E1++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=T,this.fragmentShader=A,this}let K1=0;class $1{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new J1(e),t.set(e,n)),n}}class J1{constructor(e){this.id=K1++,this.code=e,this.usedTimes=0}}function Q1(s,e,t,n,i,r,a){const o=new dl,l=new $1,c=new Set,h=[],u=new Map,f=i.logarithmicDepthBuffer;let d=i.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(E){return c.add(E),E===0?"uv":`uv${E}`}function v(E,C,k,D,B){const w=D.fog,F=B.geometry,q=E.isMeshStandardMaterial?D.environment:null,z=(E.isMeshStandardMaterial?t:e).get(E.envMap||q),te=z&&z.mapping===wr?z.image.height:null,K=p[E.type];E.precision!==null&&(d=i.getMaxPrecision(E.precision),d!==E.precision&&ze("WebGLProgram.getParameters:",E.precision,"not supported, using",d,"instead."));const le=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,W=le!==void 0?le.length:0;let j=0;F.morphAttributes.position!==void 0&&(j=1),F.morphAttributes.normal!==void 0&&(j=2),F.morphAttributes.color!==void 0&&(j=3);let me,ge,ue,ie;if(K){const ct=Gn[K];me=ct.vertexShader,ge=ct.fragmentShader}else me=E.vertexShader,ge=E.fragmentShader,l.update(E),ue=l.getVertexShaderID(E),ie=l.getFragmentShaderID(E);const ce=s.getRenderTarget(),fe=s.state.buffers.depth.getReversed(),be=B.isInstancedMesh===!0,ye=B.isBatchedMesh===!0,Oe=!!E.map,Ke=!!E.matcap,Fe=!!z,b=!!E.aoMap,X=!!E.lightMap,H=!!E.bumpMap,N=!!E.normalMap,y=!!E.displacementMap,G=!!E.emissiveMap,$=!!E.metalnessMap,ne=!!E.roughnessMap,V=E.anisotropy>0,P=E.clearcoat>0,S=E.dispersion>0,O=E.iridescence>0,Y=E.sheen>0,oe=E.transmission>0,Q=V&&!!E.anisotropyMap,Se=P&&!!E.clearcoatMap,_e=P&&!!E.clearcoatNormalMap,Te=P&&!!E.clearcoatRoughnessMap,He=O&&!!E.iridescenceMap,he=O&&!!E.iridescenceThicknessMap,we=Y&&!!E.sheenColorMap,Ne=Y&&!!E.sheenRoughnessMap,Ie=!!E.specularMap,Me=!!E.specularColorMap,qe=!!E.specularIntensityMap,Z=oe&&!!E.transmissionMap,Ee=oe&&!!E.thicknessMap,xe=!!E.gradientMap,Le=!!E.alphaMap,ve=E.alphaTest>0,pe=!!E.alphaHash,Ce=!!E.extensions;let Ye=Un;E.toneMapped&&(ce===null||ce.isXRRenderTarget===!0)&&(Ye=s.toneMapping);const vt={shaderID:K,shaderType:E.type,shaderName:E.name,vertexShader:me,fragmentShader:ge,defines:E.defines,customVertexShaderID:ue,customFragmentShaderID:ie,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:d,batching:ye,batchingColor:ye&&B._colorsTexture!==null,instancing:be,instancingColor:be&&B.instanceColor!==null,instancingMorph:be&&B.morphTexture!==null,outputColorSpace:ce===null?s.outputColorSpace:ce.isXRRenderTarget===!0?ce.texture.colorSpace:wt,alphaToCoverage:!!E.alphaToCoverage,map:Oe,matcap:Ke,envMap:Fe,envMapMode:Fe&&z.mapping,envMapCubeUVHeight:te,aoMap:b,lightMap:X,bumpMap:H,normalMap:N,displacementMap:y,emissiveMap:G,normalMapObjectSpace:N&&E.normalMapType===qf,normalMapTangentSpace:N&&E.normalMapType===Fs,metalnessMap:$,roughnessMap:ne,anisotropy:V,anisotropyMap:Q,clearcoat:P,clearcoatMap:Se,clearcoatNormalMap:_e,clearcoatRoughnessMap:Te,dispersion:S,iridescence:O,iridescenceMap:He,iridescenceThicknessMap:he,sheen:Y,sheenColorMap:we,sheenRoughnessMap:Ne,specularMap:Ie,specularColorMap:Me,specularIntensityMap:qe,transmission:oe,transmissionMap:Z,thicknessMap:Ee,gradientMap:xe,opaque:E.transparent===!1&&E.blending===Wi&&E.alphaToCoverage===!1,alphaMap:Le,alphaTest:ve,alphaHash:pe,combine:E.combine,mapUv:Oe&&g(E.map.channel),aoMapUv:b&&g(E.aoMap.channel),lightMapUv:X&&g(E.lightMap.channel),bumpMapUv:H&&g(E.bumpMap.channel),normalMapUv:N&&g(E.normalMap.channel),displacementMapUv:y&&g(E.displacementMap.channel),emissiveMapUv:G&&g(E.emissiveMap.channel),metalnessMapUv:$&&g(E.metalnessMap.channel),roughnessMapUv:ne&&g(E.roughnessMap.channel),anisotropyMapUv:Q&&g(E.anisotropyMap.channel),clearcoatMapUv:Se&&g(E.clearcoatMap.channel),clearcoatNormalMapUv:_e&&g(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Te&&g(E.clearcoatRoughnessMap.channel),iridescenceMapUv:He&&g(E.iridescenceMap.channel),iridescenceThicknessMapUv:he&&g(E.iridescenceThicknessMap.channel),sheenColorMapUv:we&&g(E.sheenColorMap.channel),sheenRoughnessMapUv:Ne&&g(E.sheenRoughnessMap.channel),specularMapUv:Ie&&g(E.specularMap.channel),specularColorMapUv:Me&&g(E.specularColorMap.channel),specularIntensityMapUv:qe&&g(E.specularIntensityMap.channel),transmissionMapUv:Z&&g(E.transmissionMap.channel),thicknessMapUv:Ee&&g(E.thicknessMap.channel),alphaMapUv:Le&&g(E.alphaMap.channel),vertexTangents:!!F.attributes.tangent&&(N||V),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!F.attributes.uv&&(Oe||Le),fog:!!w,useFog:E.fog===!0,fogExp2:!!w&&w.isFogExp2,flatShading:E.flatShading===!0&&E.wireframe===!1,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:fe,skinning:B.isSkinnedMesh===!0,morphTargets:F.morphAttributes.position!==void 0,morphNormals:F.morphAttributes.normal!==void 0,morphColors:F.morphAttributes.color!==void 0,morphTargetsCount:W,morphTextureStride:j,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:E.dithering,shadowMapEnabled:s.shadowMap.enabled&&k.length>0,shadowMapType:s.shadowMap.type,toneMapping:Ye,decodeVideoTexture:Oe&&E.map.isVideoTexture===!0&&nt.getTransfer(E.map.colorSpace)===at,decodeVideoTextureEmissive:G&&E.emissiveMap.isVideoTexture===!0&&nt.getTransfer(E.emissiveMap.colorSpace)===at,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Vt,flipSided:E.side===tn,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Ce&&E.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ce&&E.extensions.multiDraw===!0||ye)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return vt.vertexUv1s=c.has(1),vt.vertexUv2s=c.has(2),vt.vertexUv3s=c.has(3),c.clear(),vt}function m(E){const C=[];if(E.shaderID?C.push(E.shaderID):(C.push(E.customVertexShaderID),C.push(E.customFragmentShaderID)),E.defines!==void 0)for(const k in E.defines)C.push(k),C.push(E.defines[k]);return E.isRawShaderMaterial===!1&&(x(C,E),_(C,E),C.push(s.outputColorSpace)),C.push(E.customProgramCacheKey),C.join()}function x(E,C){E.push(C.precision),E.push(C.outputColorSpace),E.push(C.envMapMode),E.push(C.envMapCubeUVHeight),E.push(C.mapUv),E.push(C.alphaMapUv),E.push(C.lightMapUv),E.push(C.aoMapUv),E.push(C.bumpMapUv),E.push(C.normalMapUv),E.push(C.displacementMapUv),E.push(C.emissiveMapUv),E.push(C.metalnessMapUv),E.push(C.roughnessMapUv),E.push(C.anisotropyMapUv),E.push(C.clearcoatMapUv),E.push(C.clearcoatNormalMapUv),E.push(C.clearcoatRoughnessMapUv),E.push(C.iridescenceMapUv),E.push(C.iridescenceThicknessMapUv),E.push(C.sheenColorMapUv),E.push(C.sheenRoughnessMapUv),E.push(C.specularMapUv),E.push(C.specularColorMapUv),E.push(C.specularIntensityMapUv),E.push(C.transmissionMapUv),E.push(C.thicknessMapUv),E.push(C.combine),E.push(C.fogExp2),E.push(C.sizeAttenuation),E.push(C.morphTargetsCount),E.push(C.morphAttributeCount),E.push(C.numDirLights),E.push(C.numPointLights),E.push(C.numSpotLights),E.push(C.numSpotLightMaps),E.push(C.numHemiLights),E.push(C.numRectAreaLights),E.push(C.numDirLightShadows),E.push(C.numPointLightShadows),E.push(C.numSpotLightShadows),E.push(C.numSpotLightShadowsWithMaps),E.push(C.numLightProbes),E.push(C.shadowMapType),E.push(C.toneMapping),E.push(C.numClippingPlanes),E.push(C.numClipIntersection),E.push(C.depthPacking)}function _(E,C){o.disableAll(),C.instancing&&o.enable(0),C.instancingColor&&o.enable(1),C.instancingMorph&&o.enable(2),C.matcap&&o.enable(3),C.envMap&&o.enable(4),C.normalMapObjectSpace&&o.enable(5),C.normalMapTangentSpace&&o.enable(6),C.clearcoat&&o.enable(7),C.iridescence&&o.enable(8),C.alphaTest&&o.enable(9),C.vertexColors&&o.enable(10),C.vertexAlphas&&o.enable(11),C.vertexUv1s&&o.enable(12),C.vertexUv2s&&o.enable(13),C.vertexUv3s&&o.enable(14),C.vertexTangents&&o.enable(15),C.anisotropy&&o.enable(16),C.alphaHash&&o.enable(17),C.batching&&o.enable(18),C.dispersion&&o.enable(19),C.batchingColor&&o.enable(20),C.gradientMap&&o.enable(21),E.push(o.mask),o.disableAll(),C.fog&&o.enable(0),C.useFog&&o.enable(1),C.flatShading&&o.enable(2),C.logarithmicDepthBuffer&&o.enable(3),C.reversedDepthBuffer&&o.enable(4),C.skinning&&o.enable(5),C.morphTargets&&o.enable(6),C.morphNormals&&o.enable(7),C.morphColors&&o.enable(8),C.premultipliedAlpha&&o.enable(9),C.shadowMapEnabled&&o.enable(10),C.doubleSided&&o.enable(11),C.flipSided&&o.enable(12),C.useDepthPacking&&o.enable(13),C.dithering&&o.enable(14),C.transmission&&o.enable(15),C.sheen&&o.enable(16),C.opaque&&o.enable(17),C.pointsUvs&&o.enable(18),C.decodeVideoTexture&&o.enable(19),C.decodeVideoTextureEmissive&&o.enable(20),C.alphaToCoverage&&o.enable(21),E.push(o.mask)}function M(E){const C=p[E.type];let k;if(C){const D=Gn[C];k=Hn.clone(D.uniforms)}else k=E.uniforms;return k}function T(E,C){let k=u.get(C);return k!==void 0?++k.usedTimes:(k=new Y1(s,C,E,r),h.push(k),u.set(C,k)),k}function A(E){if(--E.usedTimes===0){const C=h.indexOf(E);h[C]=h[h.length-1],h.pop(),u.delete(E.cacheKey),E.destroy()}}function L(E){l.remove(E)}function U(){l.dispose()}return{getParameters:v,getProgramCacheKey:m,getUniforms:M,acquireProgram:T,releaseProgram:A,releaseShaderCache:L,programs:h,dispose:U}}function ex(){let s=new WeakMap;function e(a){return s.has(a)}function t(a){let o=s.get(a);return o===void 0&&(o={},s.set(a,o)),o}function n(a){s.delete(a)}function i(a,o,l){s.get(a)[o]=l}function r(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:r}}function tx(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function Xu(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function ju(){const s=[];let e=0;const t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function a(u,f,d,p,g,v){let m=s[e];return m===void 0?(m={id:u.id,object:u,geometry:f,material:d,groupOrder:p,renderOrder:u.renderOrder,z:g,group:v},s[e]=m):(m.id=u.id,m.object=u,m.geometry=f,m.material=d,m.groupOrder=p,m.renderOrder=u.renderOrder,m.z=g,m.group=v),e++,m}function o(u,f,d,p,g,v){const m=a(u,f,d,p,g,v);d.transmission>0?n.push(m):d.transparent===!0?i.push(m):t.push(m)}function l(u,f,d,p,g,v){const m=a(u,f,d,p,g,v);d.transmission>0?n.unshift(m):d.transparent===!0?i.unshift(m):t.unshift(m)}function c(u,f){t.length>1&&t.sort(u||tx),n.length>1&&n.sort(f||Xu),i.length>1&&i.sort(f||Xu)}function h(){for(let u=e,f=s.length;u<f;u++){const d=s[u];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:o,unshift:l,finish:h,sort:c}}function nx(){let s=new WeakMap;function e(n,i){const r=s.get(n);let a;return r===void 0?(a=new ju,s.set(n,[a])):i>=r.length?(a=new ju,r.push(a)):a=r[i],a}function t(){s=new WeakMap}return{get:e,dispose:t}}function ix(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new R,color:new ke};break;case"SpotLight":t={position:new R,direction:new R,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new R,color:new ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new R,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":t={color:new ke,position:new R,halfWidth:new R,halfHeight:new R};break}return s[e.id]=t,t}}}function sx(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let rx=0;function ax(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function ox(s){const e=new ix,t=sx(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new R);const i=new R,r=new je,a=new je;function o(c){let h=0,u=0,f=0;for(let E=0;E<9;E++)n.probe[E].set(0,0,0);let d=0,p=0,g=0,v=0,m=0,x=0,_=0,M=0,T=0,A=0,L=0;c.sort(ax);for(let E=0,C=c.length;E<C;E++){const k=c[E],D=k.color,B=k.intensity,w=k.distance;let F=null;if(k.shadow&&k.shadow.map&&(k.shadow.map.texture.format===qi?F=k.shadow.map.texture:F=k.shadow.map.depthTexture||k.shadow.map.texture),k.isAmbientLight)h+=D.r*B,u+=D.g*B,f+=D.b*B;else if(k.isLightProbe){for(let q=0;q<9;q++)n.probe[q].addScaledVector(k.sh.coefficients[q],B);L++}else if(k.isDirectionalLight){const q=e.get(k);if(q.color.copy(k.color).multiplyScalar(k.intensity),k.castShadow){const z=k.shadow,te=t.get(k);te.shadowIntensity=z.intensity,te.shadowBias=z.bias,te.shadowNormalBias=z.normalBias,te.shadowRadius=z.radius,te.shadowMapSize=z.mapSize,n.directionalShadow[d]=te,n.directionalShadowMap[d]=F,n.directionalShadowMatrix[d]=k.shadow.matrix,x++}n.directional[d]=q,d++}else if(k.isSpotLight){const q=e.get(k);q.position.setFromMatrixPosition(k.matrixWorld),q.color.copy(D).multiplyScalar(B),q.distance=w,q.coneCos=Math.cos(k.angle),q.penumbraCos=Math.cos(k.angle*(1-k.penumbra)),q.decay=k.decay,n.spot[g]=q;const z=k.shadow;if(k.map&&(n.spotLightMap[T]=k.map,T++,z.updateMatrices(k),k.castShadow&&A++),n.spotLightMatrix[g]=z.matrix,k.castShadow){const te=t.get(k);te.shadowIntensity=z.intensity,te.shadowBias=z.bias,te.shadowNormalBias=z.normalBias,te.shadowRadius=z.radius,te.shadowMapSize=z.mapSize,n.spotShadow[g]=te,n.spotShadowMap[g]=F,M++}g++}else if(k.isRectAreaLight){const q=e.get(k);q.color.copy(D).multiplyScalar(B),q.halfWidth.set(k.width*.5,0,0),q.halfHeight.set(0,k.height*.5,0),n.rectArea[v]=q,v++}else if(k.isPointLight){const q=e.get(k);if(q.color.copy(k.color).multiplyScalar(k.intensity),q.distance=k.distance,q.decay=k.decay,k.castShadow){const z=k.shadow,te=t.get(k);te.shadowIntensity=z.intensity,te.shadowBias=z.bias,te.shadowNormalBias=z.normalBias,te.shadowRadius=z.radius,te.shadowMapSize=z.mapSize,te.shadowCameraNear=z.camera.near,te.shadowCameraFar=z.camera.far,n.pointShadow[p]=te,n.pointShadowMap[p]=F,n.pointShadowMatrix[p]=k.shadow.matrix,_++}n.point[p]=q,p++}else if(k.isHemisphereLight){const q=e.get(k);q.skyColor.copy(k.color).multiplyScalar(B),q.groundColor.copy(k.groundColor).multiplyScalar(B),n.hemi[m]=q,m++}}v>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Re.LTC_FLOAT_1,n.rectAreaLTC2=Re.LTC_FLOAT_2):(n.rectAreaLTC1=Re.LTC_HALF_1,n.rectAreaLTC2=Re.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=f;const U=n.hash;(U.directionalLength!==d||U.pointLength!==p||U.spotLength!==g||U.rectAreaLength!==v||U.hemiLength!==m||U.numDirectionalShadows!==x||U.numPointShadows!==_||U.numSpotShadows!==M||U.numSpotMaps!==T||U.numLightProbes!==L)&&(n.directional.length=d,n.spot.length=g,n.rectArea.length=v,n.point.length=p,n.hemi.length=m,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=_,n.pointShadowMap.length=_,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=_,n.spotLightMatrix.length=M+T-A,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=A,n.numLightProbes=L,U.directionalLength=d,U.pointLength=p,U.spotLength=g,U.rectAreaLength=v,U.hemiLength=m,U.numDirectionalShadows=x,U.numPointShadows=_,U.numSpotShadows=M,U.numSpotMaps=T,U.numLightProbes=L,n.version=rx++)}function l(c,h){let u=0,f=0,d=0,p=0,g=0;const v=h.matrixWorldInverse;for(let m=0,x=c.length;m<x;m++){const _=c[m];if(_.isDirectionalLight){const M=n.directional[u];M.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(v),u++}else if(_.isSpotLight){const M=n.spot[d];M.position.setFromMatrixPosition(_.matrixWorld),M.position.applyMatrix4(v),M.direction.setFromMatrixPosition(_.matrixWorld),i.setFromMatrixPosition(_.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(v),d++}else if(_.isRectAreaLight){const M=n.rectArea[p];M.position.setFromMatrixPosition(_.matrixWorld),M.position.applyMatrix4(v),a.identity(),r.copy(_.matrixWorld),r.premultiply(v),a.extractRotation(r),M.halfWidth.set(_.width*.5,0,0),M.halfHeight.set(0,_.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),p++}else if(_.isPointLight){const M=n.point[f];M.position.setFromMatrixPosition(_.matrixWorld),M.position.applyMatrix4(v),f++}else if(_.isHemisphereLight){const M=n.hemi[g];M.direction.setFromMatrixPosition(_.matrixWorld),M.direction.transformDirection(v),g++}}}return{setup:o,setupView:l,state:n}}function Zu(s){const e=new ox(s),t=[],n=[];function i(h){c.camera=h,t.length=0,n.length=0}function r(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function l(h){e.setupView(t,h)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:r,pushShadow:a}}function lx(s){let e=new WeakMap;function t(i,r=0){const a=e.get(i);let o;return a===void 0?(o=new Zu(s),e.set(i,[o])):r>=a.length?(o=new Zu(s),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const cx=`void main() {
|
||
gl_Position = vec4( position, 1.0 );
|
||
}`,hx=`uniform sampler2D shadow_pass;
|
||
uniform vec2 resolution;
|
||
uniform float radius;
|
||
void main() {
|
||
const float samples = float( VSM_SAMPLES );
|
||
float mean = 0.0;
|
||
float squared_mean = 0.0;
|
||
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
|
||
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
|
||
for ( float i = 0.0; i < samples; i ++ ) {
|
||
float uvOffset = uvStart + i * uvStride;
|
||
#ifdef HORIZONTAL_PASS
|
||
vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
|
||
mean += distribution.x;
|
||
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
||
#else
|
||
float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
|
||
mean += depth;
|
||
squared_mean += depth * depth;
|
||
#endif
|
||
}
|
||
mean = mean / samples;
|
||
squared_mean = squared_mean / samples;
|
||
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
|
||
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
|
||
}`,ux=[new R(1,0,0),new R(-1,0,0),new R(0,1,0),new R(0,-1,0),new R(0,0,1),new R(0,0,-1)],dx=[new R(0,-1,0),new R(0,-1,0),new R(0,0,1),new R(0,0,-1),new R(0,-1,0),new R(0,-1,0)],qu=new je,cr=new R,nc=new R;function fx(s,e,t){let n=new Ll;const i=new de,r=new de,a=new _t,o=new Nm,l=new Um,c={},h=t.maxTextureSize,u={[Nn]:tn,[tn]:Nn,[Vt]:Vt},f=new Rt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new de},radius:{value:4}},vertexShader:cx,fragmentShader:hx}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const p=new gt;p.setAttribute("position",new mt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new bt(p,f),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=br;let m=this.type;this.render=function(A,L,U){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||A.length===0)return;A.type===Uc&&(ze("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),A.type=br);const E=s.getRenderTarget(),C=s.getActiveCubeFace(),k=s.getActiveMipmapLevel(),D=s.state;D.setBlending(kt),D.buffers.depth.getReversed()===!0?D.buffers.color.setClear(0,0,0,0):D.buffers.color.setClear(1,1,1,1),D.buffers.depth.setTest(!0),D.setScissorTest(!1);const B=m!==this.type;B&&L.traverse(function(w){w.material&&(Array.isArray(w.material)?w.material.forEach(F=>F.needsUpdate=!0):w.material.needsUpdate=!0)});for(let w=0,F=A.length;w<F;w++){const q=A[w],z=q.shadow;if(z===void 0){ze("WebGLShadowMap:",q,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;i.copy(z.mapSize);const te=z.getFrameExtents();if(i.multiply(te),r.copy(z.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/te.x),i.x=r.x*te.x,z.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/te.y),i.y=r.y*te.y,z.mapSize.y=r.y)),z.map===null||B===!0){if(z.map!==null&&(z.map.depthTexture!==null&&(z.map.depthTexture.dispose(),z.map.depthTexture=null),z.map.dispose()),this.type===Is){if(q.isPointLight){ze("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}z.map=new Wt(i.x,i.y,{format:qi,type:Yt,minFilter:It,magFilter:It,generateMipmaps:!1}),z.map.texture.name=q.name+".shadowMap",z.map.depthTexture=new ps(i.x,i.y,vn),z.map.depthTexture.name=q.name+".shadowMapDepth",z.map.depthTexture.format=$n,z.map.depthTexture.compareFunction=null,z.map.depthTexture.minFilter=Pt,z.map.depthTexture.magFilter=Pt}else{q.isPointLight?(z.map=new Ch(i.x),z.map.depthTexture=new Jp(i.x,On)):(z.map=new Wt(i.x,i.y),z.map.depthTexture=new ps(i.x,i.y,On)),z.map.depthTexture.name=q.name+".shadowMap",z.map.depthTexture.format=$n;const le=s.state.buffers.depth.getReversed();this.type===br?(z.map.depthTexture.compareFunction=le?Qo:Jo,z.map.depthTexture.minFilter=It,z.map.depthTexture.magFilter=It):(z.map.depthTexture.compareFunction=null,z.map.depthTexture.minFilter=Pt,z.map.depthTexture.magFilter=Pt)}z.camera.updateProjectionMatrix()}const K=z.map.isWebGLCubeRenderTarget?6:1;for(let le=0;le<K;le++){if(z.map.isWebGLCubeRenderTarget)s.setRenderTarget(z.map,le),s.clear();else{le===0&&(s.setRenderTarget(z.map),s.clear());const W=z.getViewport(le);a.set(r.x*W.x,r.y*W.y,r.x*W.z,r.y*W.w),D.viewport(a)}if(q.isPointLight){const W=z.camera,j=z.matrix,me=q.distance||W.far;me!==W.far&&(W.far=me,W.updateProjectionMatrix()),cr.setFromMatrixPosition(q.matrixWorld),W.position.copy(cr),nc.copy(W.position),nc.add(ux[le]),W.up.copy(dx[le]),W.lookAt(nc),W.updateMatrixWorld(),j.makeTranslation(-cr.x,-cr.y,-cr.z),qu.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),z._frustum.setFromProjectionMatrix(qu,W.coordinateSystem,W.reversedDepth)}else z.updateMatrices(q);n=z.getFrustum(),M(L,U,z.camera,q,this.type)}z.isPointLightShadow!==!0&&this.type===Is&&x(z,U),z.needsUpdate=!1}m=this.type,v.needsUpdate=!1,s.setRenderTarget(E,C,k)};function x(A,L){const U=e.update(g);f.defines.VSM_SAMPLES!==A.blurSamples&&(f.defines.VSM_SAMPLES=A.blurSamples,d.defines.VSM_SAMPLES=A.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new Wt(i.x,i.y,{format:qi,type:Yt})),f.uniforms.shadow_pass.value=A.map.depthTexture,f.uniforms.resolution.value=A.mapSize,f.uniforms.radius.value=A.radius,s.setRenderTarget(A.mapPass),s.clear(),s.renderBufferDirect(L,null,U,f,g,null),d.uniforms.shadow_pass.value=A.mapPass.texture,d.uniforms.resolution.value=A.mapSize,d.uniforms.radius.value=A.radius,s.setRenderTarget(A.map),s.clear(),s.renderBufferDirect(L,null,U,d,g,null)}function _(A,L,U,E){let C=null;const k=U.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(k!==void 0)C=k;else if(C=U.isPointLight===!0?l:o,s.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){const D=C.uuid,B=L.uuid;let w=c[D];w===void 0&&(w={},c[D]=w);let F=w[B];F===void 0&&(F=C.clone(),w[B]=F,L.addEventListener("dispose",T)),C=F}if(C.visible=L.visible,C.wireframe=L.wireframe,E===Is?C.side=L.shadowSide!==null?L.shadowSide:L.side:C.side=L.shadowSide!==null?L.shadowSide:u[L.side],C.alphaMap=L.alphaMap,C.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,C.map=L.map,C.clipShadows=L.clipShadows,C.clippingPlanes=L.clippingPlanes,C.clipIntersection=L.clipIntersection,C.displacementMap=L.displacementMap,C.displacementScale=L.displacementScale,C.displacementBias=L.displacementBias,C.wireframeLinewidth=L.wireframeLinewidth,C.linewidth=L.linewidth,U.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const D=s.properties.get(C);D.light=U}return C}function M(A,L,U,E,C){if(A.visible===!1)return;if(A.layers.test(L.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&C===Is)&&(!A.frustumCulled||n.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse,A.matrixWorld);const B=e.update(A),w=A.material;if(Array.isArray(w)){const F=B.groups;for(let q=0,z=F.length;q<z;q++){const te=F[q],K=w[te.materialIndex];if(K&&K.visible){const le=_(A,K,E,C);A.onBeforeShadow(s,A,L,U,B,le,te),s.renderBufferDirect(U,null,B,le,A,te),A.onAfterShadow(s,A,L,U,B,le,te)}}}else if(w.visible){const F=_(A,w,E,C);A.onBeforeShadow(s,A,L,U,B,F,null),s.renderBufferDirect(U,null,B,F,A,null),A.onAfterShadow(s,A,L,U,B,F,null)}}const D=A.children;for(let B=0,w=D.length;B<w;B++)M(D[B],L,U,E,C)}function T(A){A.target.removeEventListener("dispose",T);for(const U in c){const E=c[U],C=A.target.uuid;C in E&&(E[C].dispose(),delete E[C])}}}const px={[Ya]:Ka,[$a]:eo,[Ja]:to,[Xi]:Qa,[Ka]:Ya,[eo]:$a,[to]:Ja,[Qa]:Xi};function mx(s,e){function t(){let Z=!1;const Ee=new _t;let xe=null;const Le=new _t(0,0,0,0);return{setMask:function(ve){xe!==ve&&!Z&&(s.colorMask(ve,ve,ve,ve),xe=ve)},setLocked:function(ve){Z=ve},setClear:function(ve,pe,Ce,Ye,vt){vt===!0&&(ve*=Ye,pe*=Ye,Ce*=Ye),Ee.set(ve,pe,Ce,Ye),Le.equals(Ee)===!1&&(s.clearColor(ve,pe,Ce,Ye),Le.copy(Ee))},reset:function(){Z=!1,xe=null,Le.set(-1,0,0,0)}}}function n(){let Z=!1,Ee=!1,xe=null,Le=null,ve=null;return{setReversed:function(pe){if(Ee!==pe){const Ce=e.get("EXT_clip_control");pe?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),Ee=pe;const Ye=ve;ve=null,this.setClear(Ye)}},getReversed:function(){return Ee},setTest:function(pe){pe?ce(s.DEPTH_TEST):fe(s.DEPTH_TEST)},setMask:function(pe){xe!==pe&&!Z&&(s.depthMask(pe),xe=pe)},setFunc:function(pe){if(Ee&&(pe=px[pe]),Le!==pe){switch(pe){case Ya:s.depthFunc(s.NEVER);break;case Ka:s.depthFunc(s.ALWAYS);break;case $a:s.depthFunc(s.LESS);break;case Xi:s.depthFunc(s.LEQUAL);break;case Ja:s.depthFunc(s.EQUAL);break;case Qa:s.depthFunc(s.GEQUAL);break;case eo:s.depthFunc(s.GREATER);break;case to:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}Le=pe}},setLocked:function(pe){Z=pe},setClear:function(pe){ve!==pe&&(Ee&&(pe=1-pe),s.clearDepth(pe),ve=pe)},reset:function(){Z=!1,xe=null,Le=null,ve=null,Ee=!1}}}function i(){let Z=!1,Ee=null,xe=null,Le=null,ve=null,pe=null,Ce=null,Ye=null,vt=null;return{setTest:function(ct){Z||(ct?ce(s.STENCIL_TEST):fe(s.STENCIL_TEST))},setMask:function(ct){Ee!==ct&&!Z&&(s.stencilMask(ct),Ee=ct)},setFunc:function(ct,Yn,oi){(xe!==ct||Le!==Yn||ve!==oi)&&(s.stencilFunc(ct,Yn,oi),xe=ct,Le=Yn,ve=oi)},setOp:function(ct,Yn,oi){(pe!==ct||Ce!==Yn||Ye!==oi)&&(s.stencilOp(ct,Yn,oi),pe=ct,Ce=Yn,Ye=oi)},setLocked:function(ct){Z=ct},setClear:function(ct){vt!==ct&&(s.clearStencil(ct),vt=ct)},reset:function(){Z=!1,Ee=null,xe=null,Le=null,ve=null,pe=null,Ce=null,Ye=null,vt=null}}}const r=new t,a=new n,o=new i,l=new WeakMap,c=new WeakMap;let h={},u={},f=new WeakMap,d=[],p=null,g=!1,v=null,m=null,x=null,_=null,M=null,T=null,A=null,L=new ke(0,0,0),U=0,E=!1,C=null,k=null,D=null,B=null,w=null;const F=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,z=0;const te=s.getParameter(s.VERSION);te.indexOf("WebGL")!==-1?(z=parseFloat(/^WebGL (\d)/.exec(te)[1]),q=z>=1):te.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL ES (\d)/.exec(te)[1]),q=z>=2);let K=null,le={};const W=s.getParameter(s.SCISSOR_BOX),j=s.getParameter(s.VIEWPORT),me=new _t().fromArray(W),ge=new _t().fromArray(j);function ue(Z,Ee,xe,Le){const ve=new Uint8Array(4),pe=s.createTexture();s.bindTexture(Z,pe),s.texParameteri(Z,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(Z,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let Ce=0;Ce<xe;Ce++)Z===s.TEXTURE_3D||Z===s.TEXTURE_2D_ARRAY?s.texImage3D(Ee,0,s.RGBA,1,1,Le,0,s.RGBA,s.UNSIGNED_BYTE,ve):s.texImage2D(Ee+Ce,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,ve);return pe}const ie={};ie[s.TEXTURE_2D]=ue(s.TEXTURE_2D,s.TEXTURE_2D,1),ie[s.TEXTURE_CUBE_MAP]=ue(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[s.TEXTURE_2D_ARRAY]=ue(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),ie[s.TEXTURE_3D]=ue(s.TEXTURE_3D,s.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ce(s.DEPTH_TEST),a.setFunc(Xi),H(!1),N(Nc),ce(s.CULL_FACE),b(kt);function ce(Z){h[Z]!==!0&&(s.enable(Z),h[Z]=!0)}function fe(Z){h[Z]!==!1&&(s.disable(Z),h[Z]=!1)}function be(Z,Ee){return u[Z]!==Ee?(s.bindFramebuffer(Z,Ee),u[Z]=Ee,Z===s.DRAW_FRAMEBUFFER&&(u[s.FRAMEBUFFER]=Ee),Z===s.FRAMEBUFFER&&(u[s.DRAW_FRAMEBUFFER]=Ee),!0):!1}function ye(Z,Ee){let xe=d,Le=!1;if(Z){xe=f.get(Ee),xe===void 0&&(xe=[],f.set(Ee,xe));const ve=Z.textures;if(xe.length!==ve.length||xe[0]!==s.COLOR_ATTACHMENT0){for(let pe=0,Ce=ve.length;pe<Ce;pe++)xe[pe]=s.COLOR_ATTACHMENT0+pe;xe.length=ve.length,Le=!0}}else xe[0]!==s.BACK&&(xe[0]=s.BACK,Le=!0);Le&&s.drawBuffers(xe)}function Oe(Z){return p!==Z?(s.useProgram(Z),p=Z,!0):!1}const Ke={[wn]:s.FUNC_ADD,[Af]:s.FUNC_SUBTRACT,[Pf]:s.FUNC_REVERSE_SUBTRACT};Ke[Rf]=s.MIN,Ke[Lf]=s.MAX;const Fe={[Ns]:s.ZERO,[Df]:s.ONE,[If]:s.SRC_COLOR,[Xa]:s.SRC_ALPHA,[kf]:s.SRC_ALPHA_SATURATE,[qa]:s.DST_COLOR,[Za]:s.DST_ALPHA,[Nf]:s.ONE_MINUS_SRC_COLOR,[ja]:s.ONE_MINUS_SRC_ALPHA,[Bf]:s.ONE_MINUS_DST_COLOR,[Uf]:s.ONE_MINUS_DST_ALPHA,[Of]:s.CONSTANT_COLOR,[Ff]:s.ONE_MINUS_CONSTANT_COLOR,[zf]:s.CONSTANT_ALPHA,[Hf]:s.ONE_MINUS_CONSTANT_ALPHA};function b(Z,Ee,xe,Le,ve,pe,Ce,Ye,vt,ct){if(Z===kt){g===!0&&(fe(s.BLEND),g=!1);return}if(g===!1&&(ce(s.BLEND),g=!0),Z!==Oc){if(Z!==v||ct!==E){if((m!==wn||M!==wn)&&(s.blendEquation(s.FUNC_ADD),m=wn,M=wn),ct)switch(Z){case Wi:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Wa:s.blendFunc(s.ONE,s.ONE);break;case Bc:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case kc:s.blendFuncSeparate(s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ZERO,s.ONE);break;default:Xe("WebGLState: Invalid blending: ",Z);break}else switch(Z){case Wi:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Wa:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE,s.ONE,s.ONE);break;case Bc:Xe("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case kc:Xe("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Xe("WebGLState: Invalid blending: ",Z);break}x=null,_=null,T=null,A=null,L.set(0,0,0),U=0,v=Z,E=ct}return}ve=ve||Ee,pe=pe||xe,Ce=Ce||Le,(Ee!==m||ve!==M)&&(s.blendEquationSeparate(Ke[Ee],Ke[ve]),m=Ee,M=ve),(xe!==x||Le!==_||pe!==T||Ce!==A)&&(s.blendFuncSeparate(Fe[xe],Fe[Le],Fe[pe],Fe[Ce]),x=xe,_=Le,T=pe,A=Ce),(Ye.equals(L)===!1||vt!==U)&&(s.blendColor(Ye.r,Ye.g,Ye.b,vt),L.copy(Ye),U=vt),v=Z,E=!1}function X(Z,Ee){Z.side===Vt?fe(s.CULL_FACE):ce(s.CULL_FACE);let xe=Z.side===tn;Ee&&(xe=!xe),H(xe),Z.blending===Wi&&Z.transparent===!1?b(kt):b(Z.blending,Z.blendEquation,Z.blendSrc,Z.blendDst,Z.blendEquationAlpha,Z.blendSrcAlpha,Z.blendDstAlpha,Z.blendColor,Z.blendAlpha,Z.premultipliedAlpha),a.setFunc(Z.depthFunc),a.setTest(Z.depthTest),a.setMask(Z.depthWrite),r.setMask(Z.colorWrite);const Le=Z.stencilWrite;o.setTest(Le),Le&&(o.setMask(Z.stencilWriteMask),o.setFunc(Z.stencilFunc,Z.stencilRef,Z.stencilFuncMask),o.setOp(Z.stencilFail,Z.stencilZFail,Z.stencilZPass)),G(Z.polygonOffset,Z.polygonOffsetFactor,Z.polygonOffsetUnits),Z.alphaToCoverage===!0?ce(s.SAMPLE_ALPHA_TO_COVERAGE):fe(s.SAMPLE_ALPHA_TO_COVERAGE)}function H(Z){C!==Z&&(Z?s.frontFace(s.CW):s.frontFace(s.CCW),C=Z)}function N(Z){Z!==Tf?(ce(s.CULL_FACE),Z!==k&&(Z===Nc?s.cullFace(s.BACK):Z===Cf?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):fe(s.CULL_FACE),k=Z}function y(Z){Z!==D&&(q&&s.lineWidth(Z),D=Z)}function G(Z,Ee,xe){Z?(ce(s.POLYGON_OFFSET_FILL),(B!==Ee||w!==xe)&&(s.polygonOffset(Ee,xe),B=Ee,w=xe)):fe(s.POLYGON_OFFSET_FILL)}function $(Z){Z?ce(s.SCISSOR_TEST):fe(s.SCISSOR_TEST)}function ne(Z){Z===void 0&&(Z=s.TEXTURE0+F-1),K!==Z&&(s.activeTexture(Z),K=Z)}function V(Z,Ee,xe){xe===void 0&&(K===null?xe=s.TEXTURE0+F-1:xe=K);let Le=le[xe];Le===void 0&&(Le={type:void 0,texture:void 0},le[xe]=Le),(Le.type!==Z||Le.texture!==Ee)&&(K!==xe&&(s.activeTexture(xe),K=xe),s.bindTexture(Z,Ee||ie[Z]),Le.type=Z,Le.texture=Ee)}function P(){const Z=le[K];Z!==void 0&&Z.type!==void 0&&(s.bindTexture(Z.type,null),Z.type=void 0,Z.texture=void 0)}function S(){try{s.compressedTexImage2D(...arguments)}catch(Z){Xe("WebGLState:",Z)}}function O(){try{s.compressedTexImage3D(...arguments)}catch(Z){Xe("WebGLState:",Z)}}function Y(){try{s.texSubImage2D(...arguments)}catch(Z){Xe("WebGLState:",Z)}}function oe(){try{s.texSubImage3D(...arguments)}catch(Z){Xe("WebGLState:",Z)}}function Q(){try{s.compressedTexSubImage2D(...arguments)}catch(Z){Xe("WebGLState:",Z)}}function Se(){try{s.compressedTexSubImage3D(...arguments)}catch(Z){Xe("WebGLState:",Z)}}function _e(){try{s.texStorage2D(...arguments)}catch(Z){Xe("WebGLState:",Z)}}function Te(){try{s.texStorage3D(...arguments)}catch(Z){Xe("WebGLState:",Z)}}function He(){try{s.texImage2D(...arguments)}catch(Z){Xe("WebGLState:",Z)}}function he(){try{s.texImage3D(...arguments)}catch(Z){Xe("WebGLState:",Z)}}function we(Z){me.equals(Z)===!1&&(s.scissor(Z.x,Z.y,Z.z,Z.w),me.copy(Z))}function Ne(Z){ge.equals(Z)===!1&&(s.viewport(Z.x,Z.y,Z.z,Z.w),ge.copy(Z))}function Ie(Z,Ee){let xe=c.get(Ee);xe===void 0&&(xe=new WeakMap,c.set(Ee,xe));let Le=xe.get(Z);Le===void 0&&(Le=s.getUniformBlockIndex(Ee,Z.name),xe.set(Z,Le))}function Me(Z,Ee){const Le=c.get(Ee).get(Z);l.get(Ee)!==Le&&(s.uniformBlockBinding(Ee,Le,Z.__bindingPointIndex),l.set(Ee,Le))}function qe(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),a.setReversed(!1),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),h={},K=null,le={},u={},f=new WeakMap,d=[],p=null,g=!1,v=null,m=null,x=null,_=null,M=null,T=null,A=null,L=new ke(0,0,0),U=0,E=!1,C=null,k=null,D=null,B=null,w=null,me.set(0,0,s.canvas.width,s.canvas.height),ge.set(0,0,s.canvas.width,s.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:ce,disable:fe,bindFramebuffer:be,drawBuffers:ye,useProgram:Oe,setBlending:b,setMaterial:X,setFlipSided:H,setCullFace:N,setLineWidth:y,setPolygonOffset:G,setScissorTest:$,activeTexture:ne,bindTexture:V,unbindTexture:P,compressedTexImage2D:S,compressedTexImage3D:O,texImage2D:He,texImage3D:he,updateUBOMapping:Ie,uniformBlockBinding:Me,texStorage2D:_e,texStorage3D:Te,texSubImage2D:Y,texSubImage3D:oe,compressedTexSubImage2D:Q,compressedTexSubImage3D:Se,scissor:we,viewport:Ne,reset:qe}}function gx(s,e,t,n,i,r,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new de,h=new WeakMap;let u;const f=new WeakMap;let d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(P,S){return d?new OffscreenCanvas(P,S):zs("canvas")}function g(P,S,O){let Y=1;const oe=V(P);if((oe.width>O||oe.height>O)&&(Y=O/Math.max(oe.width,oe.height)),Y<1)if(typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&P instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&P instanceof ImageBitmap||typeof VideoFrame<"u"&&P instanceof VideoFrame){const Q=Math.floor(Y*oe.width),Se=Math.floor(Y*oe.height);u===void 0&&(u=p(Q,Se));const _e=S?p(Q,Se):u;return _e.width=Q,_e.height=Se,_e.getContext("2d").drawImage(P,0,0,Q,Se),ze("WebGLRenderer: Texture has been resized from ("+oe.width+"x"+oe.height+") to ("+Q+"x"+Se+")."),_e}else return"data"in P&&ze("WebGLRenderer: Image in DataTexture is too big ("+oe.width+"x"+oe.height+")."),P;return P}function v(P){return P.generateMipmaps}function m(P){s.generateMipmap(P)}function x(P){return P.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:P.isWebGL3DRenderTarget?s.TEXTURE_3D:P.isWebGLArrayRenderTarget||P.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function _(P,S,O,Y,oe=!1){if(P!==null){if(s[P]!==void 0)return s[P];ze("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let Q=S;if(S===s.RED&&(O===s.FLOAT&&(Q=s.R32F),O===s.HALF_FLOAT&&(Q=s.R16F),O===s.UNSIGNED_BYTE&&(Q=s.R8)),S===s.RED_INTEGER&&(O===s.UNSIGNED_BYTE&&(Q=s.R8UI),O===s.UNSIGNED_SHORT&&(Q=s.R16UI),O===s.UNSIGNED_INT&&(Q=s.R32UI),O===s.BYTE&&(Q=s.R8I),O===s.SHORT&&(Q=s.R16I),O===s.INT&&(Q=s.R32I)),S===s.RG&&(O===s.FLOAT&&(Q=s.RG32F),O===s.HALF_FLOAT&&(Q=s.RG16F),O===s.UNSIGNED_BYTE&&(Q=s.RG8)),S===s.RG_INTEGER&&(O===s.UNSIGNED_BYTE&&(Q=s.RG8UI),O===s.UNSIGNED_SHORT&&(Q=s.RG16UI),O===s.UNSIGNED_INT&&(Q=s.RG32UI),O===s.BYTE&&(Q=s.RG8I),O===s.SHORT&&(Q=s.RG16I),O===s.INT&&(Q=s.RG32I)),S===s.RGB_INTEGER&&(O===s.UNSIGNED_BYTE&&(Q=s.RGB8UI),O===s.UNSIGNED_SHORT&&(Q=s.RGB16UI),O===s.UNSIGNED_INT&&(Q=s.RGB32UI),O===s.BYTE&&(Q=s.RGB8I),O===s.SHORT&&(Q=s.RGB16I),O===s.INT&&(Q=s.RGB32I)),S===s.RGBA_INTEGER&&(O===s.UNSIGNED_BYTE&&(Q=s.RGBA8UI),O===s.UNSIGNED_SHORT&&(Q=s.RGBA16UI),O===s.UNSIGNED_INT&&(Q=s.RGBA32UI),O===s.BYTE&&(Q=s.RGBA8I),O===s.SHORT&&(Q=s.RGBA16I),O===s.INT&&(Q=s.RGBA32I)),S===s.RGB&&(O===s.UNSIGNED_INT_5_9_9_9_REV&&(Q=s.RGB9_E5),O===s.UNSIGNED_INT_10F_11F_11F_REV&&(Q=s.R11F_G11F_B10F)),S===s.RGBA){const Se=oe?Rr:nt.getTransfer(Y);O===s.FLOAT&&(Q=s.RGBA32F),O===s.HALF_FLOAT&&(Q=s.RGBA16F),O===s.UNSIGNED_BYTE&&(Q=Se===at?s.SRGB8_ALPHA8:s.RGBA8),O===s.UNSIGNED_SHORT_4_4_4_4&&(Q=s.RGBA4),O===s.UNSIGNED_SHORT_5_5_5_1&&(Q=s.RGB5_A1)}return(Q===s.R16F||Q===s.R32F||Q===s.RG16F||Q===s.RG32F||Q===s.RGBA16F||Q===s.RGBA32F)&&e.get("EXT_color_buffer_float"),Q}function M(P,S){let O;return P?S===null||S===On||S===Zi?O=s.DEPTH24_STENCIL8:S===vn?O=s.DEPTH32F_STENCIL8:S===Bs&&(O=s.DEPTH24_STENCIL8,ze("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):S===null||S===On||S===Zi?O=s.DEPTH_COMPONENT24:S===vn?O=s.DEPTH_COMPONENT32F:S===Bs&&(O=s.DEPTH_COMPONENT16),O}function T(P,S){return v(P)===!0||P.isFramebufferTexture&&P.minFilter!==Pt&&P.minFilter!==It?Math.log2(Math.max(S.width,S.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?S.mipmaps.length:1}function A(P){const S=P.target;S.removeEventListener("dispose",A),U(S),S.isVideoTexture&&h.delete(S)}function L(P){const S=P.target;S.removeEventListener("dispose",L),C(S)}function U(P){const S=n.get(P);if(S.__webglInit===void 0)return;const O=P.source,Y=f.get(O);if(Y){const oe=Y[S.__cacheKey];oe.usedTimes--,oe.usedTimes===0&&E(P),Object.keys(Y).length===0&&f.delete(O)}n.remove(P)}function E(P){const S=n.get(P);s.deleteTexture(S.__webglTexture);const O=P.source,Y=f.get(O);delete Y[S.__cacheKey],a.memory.textures--}function C(P){const S=n.get(P);if(P.depthTexture&&(P.depthTexture.dispose(),n.remove(P.depthTexture)),P.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(S.__webglFramebuffer[Y]))for(let oe=0;oe<S.__webglFramebuffer[Y].length;oe++)s.deleteFramebuffer(S.__webglFramebuffer[Y][oe]);else s.deleteFramebuffer(S.__webglFramebuffer[Y]);S.__webglDepthbuffer&&s.deleteRenderbuffer(S.__webglDepthbuffer[Y])}else{if(Array.isArray(S.__webglFramebuffer))for(let Y=0;Y<S.__webglFramebuffer.length;Y++)s.deleteFramebuffer(S.__webglFramebuffer[Y]);else s.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&s.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&s.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRenderbuffer)for(let Y=0;Y<S.__webglColorRenderbuffer.length;Y++)S.__webglColorRenderbuffer[Y]&&s.deleteRenderbuffer(S.__webglColorRenderbuffer[Y]);S.__webglDepthRenderbuffer&&s.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const O=P.textures;for(let Y=0,oe=O.length;Y<oe;Y++){const Q=n.get(O[Y]);Q.__webglTexture&&(s.deleteTexture(Q.__webglTexture),a.memory.textures--),n.remove(O[Y])}n.remove(P)}let k=0;function D(){k=0}function B(){const P=k;return P>=i.maxTextures&&ze("WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+i.maxTextures),k+=1,P}function w(P){const S=[];return S.push(P.wrapS),S.push(P.wrapT),S.push(P.wrapR||0),S.push(P.magFilter),S.push(P.minFilter),S.push(P.anisotropy),S.push(P.internalFormat),S.push(P.format),S.push(P.type),S.push(P.generateMipmaps),S.push(P.premultiplyAlpha),S.push(P.flipY),S.push(P.unpackAlignment),S.push(P.colorSpace),S.join()}function F(P,S){const O=n.get(P);if(P.isVideoTexture&&$(P),P.isRenderTargetTexture===!1&&P.isExternalTexture!==!0&&P.version>0&&O.__version!==P.version){const Y=P.image;if(Y===null)ze("WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)ze("WebGLRenderer: Texture marked for update but image is incomplete");else{ie(O,P,S);return}}else P.isExternalTexture&&(O.__webglTexture=P.sourceTexture?P.sourceTexture:null);t.bindTexture(s.TEXTURE_2D,O.__webglTexture,s.TEXTURE0+S)}function q(P,S){const O=n.get(P);if(P.isRenderTargetTexture===!1&&P.version>0&&O.__version!==P.version){ie(O,P,S);return}else P.isExternalTexture&&(O.__webglTexture=P.sourceTexture?P.sourceTexture:null);t.bindTexture(s.TEXTURE_2D_ARRAY,O.__webglTexture,s.TEXTURE0+S)}function z(P,S){const O=n.get(P);if(P.isRenderTargetTexture===!1&&P.version>0&&O.__version!==P.version){ie(O,P,S);return}t.bindTexture(s.TEXTURE_3D,O.__webglTexture,s.TEXTURE0+S)}function te(P,S){const O=n.get(P);if(P.isCubeDepthTexture!==!0&&P.version>0&&O.__version!==P.version){ce(O,P,S);return}t.bindTexture(s.TEXTURE_CUBE_MAP,O.__webglTexture,s.TEXTURE0+S)}const K={[Bn]:s.REPEAT,[kn]:s.CLAMP_TO_EDGE,[Sr]:s.MIRRORED_REPEAT},le={[Pt]:s.NEAREST,[Hc]:s.NEAREST_MIPMAP_NEAREST,[Us]:s.NEAREST_MIPMAP_LINEAR,[It]:s.LINEAR,[Er]:s.LINEAR_MIPMAP_NEAREST,[Kn]:s.LINEAR_MIPMAP_LINEAR},W={[Yf]:s.NEVER,[ep]:s.ALWAYS,[Kf]:s.LESS,[Jo]:s.LEQUAL,[$f]:s.EQUAL,[Qo]:s.GEQUAL,[Jf]:s.GREATER,[Qf]:s.NOTEQUAL};function j(P,S){if(S.type===vn&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===It||S.magFilter===Er||S.magFilter===Us||S.magFilter===Kn||S.minFilter===It||S.minFilter===Er||S.minFilter===Us||S.minFilter===Kn)&&ze("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(P,s.TEXTURE_WRAP_S,K[S.wrapS]),s.texParameteri(P,s.TEXTURE_WRAP_T,K[S.wrapT]),(P===s.TEXTURE_3D||P===s.TEXTURE_2D_ARRAY)&&s.texParameteri(P,s.TEXTURE_WRAP_R,K[S.wrapR]),s.texParameteri(P,s.TEXTURE_MAG_FILTER,le[S.magFilter]),s.texParameteri(P,s.TEXTURE_MIN_FILTER,le[S.minFilter]),S.compareFunction&&(s.texParameteri(P,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(P,s.TEXTURE_COMPARE_FUNC,W[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===Pt||S.minFilter!==Us&&S.minFilter!==Kn||S.type===vn&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const O=e.get("EXT_texture_filter_anisotropic");s.texParameterf(P,O.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,i.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function me(P,S){let O=!1;P.__webglInit===void 0&&(P.__webglInit=!0,S.addEventListener("dispose",A));const Y=S.source;let oe=f.get(Y);oe===void 0&&(oe={},f.set(Y,oe));const Q=w(S);if(Q!==P.__cacheKey){oe[Q]===void 0&&(oe[Q]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,O=!0),oe[Q].usedTimes++;const Se=oe[P.__cacheKey];Se!==void 0&&(oe[P.__cacheKey].usedTimes--,Se.usedTimes===0&&E(S)),P.__cacheKey=Q,P.__webglTexture=oe[Q].texture}return O}function ge(P,S,O){return Math.floor(Math.floor(P/O)/S)}function ue(P,S,O,Y){const Q=P.updateRanges;if(Q.length===0)t.texSubImage2D(s.TEXTURE_2D,0,0,0,S.width,S.height,O,Y,S.data);else{Q.sort((he,we)=>he.start-we.start);let Se=0;for(let he=1;he<Q.length;he++){const we=Q[Se],Ne=Q[he],Ie=we.start+we.count,Me=ge(Ne.start,S.width,4),qe=ge(we.start,S.width,4);Ne.start<=Ie+1&&Me===qe&&ge(Ne.start+Ne.count-1,S.width,4)===Me?we.count=Math.max(we.count,Ne.start+Ne.count-we.start):(++Se,Q[Se]=Ne)}Q.length=Se+1;const _e=s.getParameter(s.UNPACK_ROW_LENGTH),Te=s.getParameter(s.UNPACK_SKIP_PIXELS),He=s.getParameter(s.UNPACK_SKIP_ROWS);s.pixelStorei(s.UNPACK_ROW_LENGTH,S.width);for(let he=0,we=Q.length;he<we;he++){const Ne=Q[he],Ie=Math.floor(Ne.start/4),Me=Math.ceil(Ne.count/4),qe=Ie%S.width,Z=Math.floor(Ie/S.width),Ee=Me,xe=1;s.pixelStorei(s.UNPACK_SKIP_PIXELS,qe),s.pixelStorei(s.UNPACK_SKIP_ROWS,Z),t.texSubImage2D(s.TEXTURE_2D,0,qe,Z,Ee,xe,O,Y,S.data)}P.clearUpdateRanges(),s.pixelStorei(s.UNPACK_ROW_LENGTH,_e),s.pixelStorei(s.UNPACK_SKIP_PIXELS,Te),s.pixelStorei(s.UNPACK_SKIP_ROWS,He)}}function ie(P,S,O){let Y=s.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(Y=s.TEXTURE_2D_ARRAY),S.isData3DTexture&&(Y=s.TEXTURE_3D);const oe=me(P,S),Q=S.source;t.bindTexture(Y,P.__webglTexture,s.TEXTURE0+O);const Se=n.get(Q);if(Q.version!==Se.__version||oe===!0){t.activeTexture(s.TEXTURE0+O);const _e=nt.getPrimaries(nt.workingColorSpace),Te=S.colorSpace===ci?null:nt.getPrimaries(S.colorSpace),He=S.colorSpace===ci||_e===Te?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,S.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,S.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,He);let he=g(S.image,!1,i.maxTextureSize);he=ne(S,he);const we=r.convert(S.format,S.colorSpace),Ne=r.convert(S.type);let Ie=_(S.internalFormat,we,Ne,S.colorSpace,S.isVideoTexture);j(Y,S);let Me;const qe=S.mipmaps,Z=S.isVideoTexture!==!0,Ee=Se.__version===void 0||oe===!0,xe=Q.dataReady,Le=T(S,he);if(S.isDepthTexture)Ie=M(S.format===li,S.type),Ee&&(Z?t.texStorage2D(s.TEXTURE_2D,1,Ie,he.width,he.height):t.texImage2D(s.TEXTURE_2D,0,Ie,he.width,he.height,0,we,Ne,null));else if(S.isDataTexture)if(qe.length>0){Z&&Ee&&t.texStorage2D(s.TEXTURE_2D,Le,Ie,qe[0].width,qe[0].height);for(let ve=0,pe=qe.length;ve<pe;ve++)Me=qe[ve],Z?xe&&t.texSubImage2D(s.TEXTURE_2D,ve,0,0,Me.width,Me.height,we,Ne,Me.data):t.texImage2D(s.TEXTURE_2D,ve,Ie,Me.width,Me.height,0,we,Ne,Me.data);S.generateMipmaps=!1}else Z?(Ee&&t.texStorage2D(s.TEXTURE_2D,Le,Ie,he.width,he.height),xe&&ue(S,he,we,Ne)):t.texImage2D(s.TEXTURE_2D,0,Ie,he.width,he.height,0,we,Ne,he.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){Z&&Ee&&t.texStorage3D(s.TEXTURE_2D_ARRAY,Le,Ie,qe[0].width,qe[0].height,he.depth);for(let ve=0,pe=qe.length;ve<pe;ve++)if(Me=qe[ve],S.format!==hn)if(we!==null)if(Z){if(xe)if(S.layerUpdates.size>0){const Ce=bu(Me.width,Me.height,S.format,S.type);for(const Ye of S.layerUpdates){const vt=Me.data.subarray(Ye*Ce/Me.data.BYTES_PER_ELEMENT,(Ye+1)*Ce/Me.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,ve,0,0,Ye,Me.width,Me.height,1,we,vt)}S.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,ve,0,0,0,Me.width,Me.height,he.depth,we,Me.data)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,ve,Ie,Me.width,Me.height,he.depth,0,Me.data,0,0);else ze("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Z?xe&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,ve,0,0,0,Me.width,Me.height,he.depth,we,Ne,Me.data):t.texImage3D(s.TEXTURE_2D_ARRAY,ve,Ie,Me.width,Me.height,he.depth,0,we,Ne,Me.data)}else{Z&&Ee&&t.texStorage2D(s.TEXTURE_2D,Le,Ie,qe[0].width,qe[0].height);for(let ve=0,pe=qe.length;ve<pe;ve++)Me=qe[ve],S.format!==hn?we!==null?Z?xe&&t.compressedTexSubImage2D(s.TEXTURE_2D,ve,0,0,Me.width,Me.height,we,Me.data):t.compressedTexImage2D(s.TEXTURE_2D,ve,Ie,Me.width,Me.height,0,Me.data):ze("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Z?xe&&t.texSubImage2D(s.TEXTURE_2D,ve,0,0,Me.width,Me.height,we,Ne,Me.data):t.texImage2D(s.TEXTURE_2D,ve,Ie,Me.width,Me.height,0,we,Ne,Me.data)}else if(S.isDataArrayTexture)if(Z){if(Ee&&t.texStorage3D(s.TEXTURE_2D_ARRAY,Le,Ie,he.width,he.height,he.depth),xe)if(S.layerUpdates.size>0){const ve=bu(he.width,he.height,S.format,S.type);for(const pe of S.layerUpdates){const Ce=he.data.subarray(pe*ve/he.data.BYTES_PER_ELEMENT,(pe+1)*ve/he.data.BYTES_PER_ELEMENT);t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,pe,he.width,he.height,1,we,Ne,Ce)}S.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,he.width,he.height,he.depth,we,Ne,he.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,Ie,he.width,he.height,he.depth,0,we,Ne,he.data);else if(S.isData3DTexture)Z?(Ee&&t.texStorage3D(s.TEXTURE_3D,Le,Ie,he.width,he.height,he.depth),xe&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,he.width,he.height,he.depth,we,Ne,he.data)):t.texImage3D(s.TEXTURE_3D,0,Ie,he.width,he.height,he.depth,0,we,Ne,he.data);else if(S.isFramebufferTexture){if(Ee)if(Z)t.texStorage2D(s.TEXTURE_2D,Le,Ie,he.width,he.height);else{let ve=he.width,pe=he.height;for(let Ce=0;Ce<Le;Ce++)t.texImage2D(s.TEXTURE_2D,Ce,Ie,ve,pe,0,we,Ne,null),ve>>=1,pe>>=1}}else if(qe.length>0){if(Z&&Ee){const ve=V(qe[0]);t.texStorage2D(s.TEXTURE_2D,Le,Ie,ve.width,ve.height)}for(let ve=0,pe=qe.length;ve<pe;ve++)Me=qe[ve],Z?xe&&t.texSubImage2D(s.TEXTURE_2D,ve,0,0,we,Ne,Me):t.texImage2D(s.TEXTURE_2D,ve,Ie,we,Ne,Me);S.generateMipmaps=!1}else if(Z){if(Ee){const ve=V(he);t.texStorage2D(s.TEXTURE_2D,Le,Ie,ve.width,ve.height)}xe&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,we,Ne,he)}else t.texImage2D(s.TEXTURE_2D,0,Ie,we,Ne,he);v(S)&&m(Y),Se.__version=Q.version,S.onUpdate&&S.onUpdate(S)}P.__version=S.version}function ce(P,S,O){if(S.image.length!==6)return;const Y=me(P,S),oe=S.source;t.bindTexture(s.TEXTURE_CUBE_MAP,P.__webglTexture,s.TEXTURE0+O);const Q=n.get(oe);if(oe.version!==Q.__version||Y===!0){t.activeTexture(s.TEXTURE0+O);const Se=nt.getPrimaries(nt.workingColorSpace),_e=S.colorSpace===ci?null:nt.getPrimaries(S.colorSpace),Te=S.colorSpace===ci||Se===_e?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,S.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,S.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Te);const He=S.isCompressedTexture||S.image[0].isCompressedTexture,he=S.image[0]&&S.image[0].isDataTexture,we=[];for(let pe=0;pe<6;pe++)!He&&!he?we[pe]=g(S.image[pe],!0,i.maxCubemapSize):we[pe]=he?S.image[pe].image:S.image[pe],we[pe]=ne(S,we[pe]);const Ne=we[0],Ie=r.convert(S.format,S.colorSpace),Me=r.convert(S.type),qe=_(S.internalFormat,Ie,Me,S.colorSpace),Z=S.isVideoTexture!==!0,Ee=Q.__version===void 0||Y===!0,xe=oe.dataReady;let Le=T(S,Ne);j(s.TEXTURE_CUBE_MAP,S);let ve;if(He){Z&&Ee&&t.texStorage2D(s.TEXTURE_CUBE_MAP,Le,qe,Ne.width,Ne.height);for(let pe=0;pe<6;pe++){ve=we[pe].mipmaps;for(let Ce=0;Ce<ve.length;Ce++){const Ye=ve[Ce];S.format!==hn?Ie!==null?Z?xe&&t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Ce,0,0,Ye.width,Ye.height,Ie,Ye.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Ce,qe,Ye.width,Ye.height,0,Ye.data):ze("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Z?xe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Ce,0,0,Ye.width,Ye.height,Ie,Me,Ye.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Ce,qe,Ye.width,Ye.height,0,Ie,Me,Ye.data)}}}else{if(ve=S.mipmaps,Z&&Ee){ve.length>0&&Le++;const pe=V(we[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,Le,qe,pe.width,pe.height)}for(let pe=0;pe<6;pe++)if(he){Z?xe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,0,0,we[pe].width,we[pe].height,Ie,Me,we[pe].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,qe,we[pe].width,we[pe].height,0,Ie,Me,we[pe].data);for(let Ce=0;Ce<ve.length;Ce++){const vt=ve[Ce].image[pe].image;Z?xe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Ce+1,0,0,vt.width,vt.height,Ie,Me,vt.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Ce+1,qe,vt.width,vt.height,0,Ie,Me,vt.data)}}else{Z?xe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,0,0,Ie,Me,we[pe]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,qe,Ie,Me,we[pe]);for(let Ce=0;Ce<ve.length;Ce++){const Ye=ve[Ce];Z?xe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Ce+1,0,0,Ie,Me,Ye.image[pe]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Ce+1,qe,Ie,Me,Ye.image[pe])}}}v(S)&&m(s.TEXTURE_CUBE_MAP),Q.__version=oe.version,S.onUpdate&&S.onUpdate(S)}P.__version=S.version}function fe(P,S,O,Y,oe,Q){const Se=r.convert(O.format,O.colorSpace),_e=r.convert(O.type),Te=_(O.internalFormat,Se,_e,O.colorSpace),He=n.get(S),he=n.get(O);if(he.__renderTarget=S,!He.__hasExternalTextures){const we=Math.max(1,S.width>>Q),Ne=Math.max(1,S.height>>Q);oe===s.TEXTURE_3D||oe===s.TEXTURE_2D_ARRAY?t.texImage3D(oe,Q,Te,we,Ne,S.depth,0,Se,_e,null):t.texImage2D(oe,Q,Te,we,Ne,0,Se,_e,null)}t.bindFramebuffer(s.FRAMEBUFFER,P),G(S)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,Y,oe,he.__webglTexture,0,y(S)):(oe===s.TEXTURE_2D||oe>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&oe<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,Y,oe,he.__webglTexture,Q),t.bindFramebuffer(s.FRAMEBUFFER,null)}function be(P,S,O){if(s.bindRenderbuffer(s.RENDERBUFFER,P),S.depthBuffer){const Y=S.depthTexture,oe=Y&&Y.isDepthTexture?Y.type:null,Q=M(S.stencilBuffer,oe),Se=S.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;G(S)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,y(S),Q,S.width,S.height):O?s.renderbufferStorageMultisample(s.RENDERBUFFER,y(S),Q,S.width,S.height):s.renderbufferStorage(s.RENDERBUFFER,Q,S.width,S.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,Se,s.RENDERBUFFER,P)}else{const Y=S.textures;for(let oe=0;oe<Y.length;oe++){const Q=Y[oe],Se=r.convert(Q.format,Q.colorSpace),_e=r.convert(Q.type),Te=_(Q.internalFormat,Se,_e,Q.colorSpace);G(S)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,y(S),Te,S.width,S.height):O?s.renderbufferStorageMultisample(s.RENDERBUFFER,y(S),Te,S.width,S.height):s.renderbufferStorage(s.RENDERBUFFER,Te,S.width,S.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}function ye(P,S,O){const Y=S.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(s.FRAMEBUFFER,P),!(S.depthTexture&&S.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const oe=n.get(S.depthTexture);if(oe.__renderTarget=S,(!oe.__webglTexture||S.depthTexture.image.width!==S.width||S.depthTexture.image.height!==S.height)&&(S.depthTexture.image.width=S.width,S.depthTexture.image.height=S.height,S.depthTexture.needsUpdate=!0),Y){if(oe.__webglInit===void 0&&(oe.__webglInit=!0,S.depthTexture.addEventListener("dispose",A)),oe.__webglTexture===void 0){oe.__webglTexture=s.createTexture(),t.bindTexture(s.TEXTURE_CUBE_MAP,oe.__webglTexture),j(s.TEXTURE_CUBE_MAP,S.depthTexture);const He=r.convert(S.depthTexture.format),he=r.convert(S.depthTexture.type);let we;S.depthTexture.format===$n?we=s.DEPTH_COMPONENT24:S.depthTexture.format===li&&(we=s.DEPTH24_STENCIL8);for(let Ne=0;Ne<6;Ne++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,we,S.width,S.height,0,He,he,null)}}else F(S.depthTexture,0);const Q=oe.__webglTexture,Se=y(S),_e=Y?s.TEXTURE_CUBE_MAP_POSITIVE_X+O:s.TEXTURE_2D,Te=S.depthTexture.format===li?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;if(S.depthTexture.format===$n)G(S)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,Te,_e,Q,0,Se):s.framebufferTexture2D(s.FRAMEBUFFER,Te,_e,Q,0);else if(S.depthTexture.format===li)G(S)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,Te,_e,Q,0,Se):s.framebufferTexture2D(s.FRAMEBUFFER,Te,_e,Q,0);else throw new Error("Unknown depthTexture format")}function Oe(P){const S=n.get(P),O=P.isWebGLCubeRenderTarget===!0;if(S.__boundDepthTexture!==P.depthTexture){const Y=P.depthTexture;if(S.__depthDisposeCallback&&S.__depthDisposeCallback(),Y){const oe=()=>{delete S.__boundDepthTexture,delete S.__depthDisposeCallback,Y.removeEventListener("dispose",oe)};Y.addEventListener("dispose",oe),S.__depthDisposeCallback=oe}S.__boundDepthTexture=Y}if(P.depthTexture&&!S.__autoAllocateDepthBuffer)if(O)for(let Y=0;Y<6;Y++)ye(S.__webglFramebuffer[Y],P,Y);else{const Y=P.texture.mipmaps;Y&&Y.length>0?ye(S.__webglFramebuffer[0],P,0):ye(S.__webglFramebuffer,P,0)}else if(O){S.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)if(t.bindFramebuffer(s.FRAMEBUFFER,S.__webglFramebuffer[Y]),S.__webglDepthbuffer[Y]===void 0)S.__webglDepthbuffer[Y]=s.createRenderbuffer(),be(S.__webglDepthbuffer[Y],P,!1);else{const oe=P.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Q=S.__webglDepthbuffer[Y];s.bindRenderbuffer(s.RENDERBUFFER,Q),s.framebufferRenderbuffer(s.FRAMEBUFFER,oe,s.RENDERBUFFER,Q)}}else{const Y=P.texture.mipmaps;if(Y&&Y.length>0?t.bindFramebuffer(s.FRAMEBUFFER,S.__webglFramebuffer[0]):t.bindFramebuffer(s.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer===void 0)S.__webglDepthbuffer=s.createRenderbuffer(),be(S.__webglDepthbuffer,P,!1);else{const oe=P.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Q=S.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,Q),s.framebufferRenderbuffer(s.FRAMEBUFFER,oe,s.RENDERBUFFER,Q)}}t.bindFramebuffer(s.FRAMEBUFFER,null)}function Ke(P,S,O){const Y=n.get(P);S!==void 0&&fe(Y.__webglFramebuffer,P,P.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),O!==void 0&&Oe(P)}function Fe(P){const S=P.texture,O=n.get(P),Y=n.get(S);P.addEventListener("dispose",L);const oe=P.textures,Q=P.isWebGLCubeRenderTarget===!0,Se=oe.length>1;if(Se||(Y.__webglTexture===void 0&&(Y.__webglTexture=s.createTexture()),Y.__version=S.version,a.memory.textures++),Q){O.__webglFramebuffer=[];for(let _e=0;_e<6;_e++)if(S.mipmaps&&S.mipmaps.length>0){O.__webglFramebuffer[_e]=[];for(let Te=0;Te<S.mipmaps.length;Te++)O.__webglFramebuffer[_e][Te]=s.createFramebuffer()}else O.__webglFramebuffer[_e]=s.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){O.__webglFramebuffer=[];for(let _e=0;_e<S.mipmaps.length;_e++)O.__webglFramebuffer[_e]=s.createFramebuffer()}else O.__webglFramebuffer=s.createFramebuffer();if(Se)for(let _e=0,Te=oe.length;_e<Te;_e++){const He=n.get(oe[_e]);He.__webglTexture===void 0&&(He.__webglTexture=s.createTexture(),a.memory.textures++)}if(P.samples>0&&G(P)===!1){O.__webglMultisampledFramebuffer=s.createFramebuffer(),O.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let _e=0;_e<oe.length;_e++){const Te=oe[_e];O.__webglColorRenderbuffer[_e]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,O.__webglColorRenderbuffer[_e]);const He=r.convert(Te.format,Te.colorSpace),he=r.convert(Te.type),we=_(Te.internalFormat,He,he,Te.colorSpace,P.isXRRenderTarget===!0),Ne=y(P);s.renderbufferStorageMultisample(s.RENDERBUFFER,Ne,we,P.width,P.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+_e,s.RENDERBUFFER,O.__webglColorRenderbuffer[_e])}s.bindRenderbuffer(s.RENDERBUFFER,null),P.depthBuffer&&(O.__webglDepthRenderbuffer=s.createRenderbuffer(),be(O.__webglDepthRenderbuffer,P,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(Q){t.bindTexture(s.TEXTURE_CUBE_MAP,Y.__webglTexture),j(s.TEXTURE_CUBE_MAP,S);for(let _e=0;_e<6;_e++)if(S.mipmaps&&S.mipmaps.length>0)for(let Te=0;Te<S.mipmaps.length;Te++)fe(O.__webglFramebuffer[_e][Te],P,S,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+_e,Te);else fe(O.__webglFramebuffer[_e],P,S,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0);v(S)&&m(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Se){for(let _e=0,Te=oe.length;_e<Te;_e++){const He=oe[_e],he=n.get(He);let we=s.TEXTURE_2D;(P.isWebGL3DRenderTarget||P.isWebGLArrayRenderTarget)&&(we=P.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(we,he.__webglTexture),j(we,He),fe(O.__webglFramebuffer,P,He,s.COLOR_ATTACHMENT0+_e,we,0),v(He)&&m(we)}t.unbindTexture()}else{let _e=s.TEXTURE_2D;if((P.isWebGL3DRenderTarget||P.isWebGLArrayRenderTarget)&&(_e=P.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(_e,Y.__webglTexture),j(_e,S),S.mipmaps&&S.mipmaps.length>0)for(let Te=0;Te<S.mipmaps.length;Te++)fe(O.__webglFramebuffer[Te],P,S,s.COLOR_ATTACHMENT0,_e,Te);else fe(O.__webglFramebuffer,P,S,s.COLOR_ATTACHMENT0,_e,0);v(S)&&m(_e),t.unbindTexture()}P.depthBuffer&&Oe(P)}function b(P){const S=P.textures;for(let O=0,Y=S.length;O<Y;O++){const oe=S[O];if(v(oe)){const Q=x(P),Se=n.get(oe).__webglTexture;t.bindTexture(Q,Se),m(Q),t.unbindTexture()}}}const X=[],H=[];function N(P){if(P.samples>0){if(G(P)===!1){const S=P.textures,O=P.width,Y=P.height;let oe=s.COLOR_BUFFER_BIT;const Q=P.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Se=n.get(P),_e=S.length>1;if(_e)for(let He=0;He<S.length;He++)t.bindFramebuffer(s.FRAMEBUFFER,Se.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+He,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,Se.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+He,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,Se.__webglMultisampledFramebuffer);const Te=P.texture.mipmaps;Te&&Te.length>0?t.bindFramebuffer(s.DRAW_FRAMEBUFFER,Se.__webglFramebuffer[0]):t.bindFramebuffer(s.DRAW_FRAMEBUFFER,Se.__webglFramebuffer);for(let He=0;He<S.length;He++){if(P.resolveDepthBuffer&&(P.depthBuffer&&(oe|=s.DEPTH_BUFFER_BIT),P.stencilBuffer&&P.resolveStencilBuffer&&(oe|=s.STENCIL_BUFFER_BIT)),_e){s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,Se.__webglColorRenderbuffer[He]);const he=n.get(S[He]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,he,0)}s.blitFramebuffer(0,0,O,Y,0,0,O,Y,oe,s.NEAREST),l===!0&&(X.length=0,H.length=0,X.push(s.COLOR_ATTACHMENT0+He),P.depthBuffer&&P.resolveDepthBuffer===!1&&(X.push(Q),H.push(Q),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,H)),s.invalidateFramebuffer(s.READ_FRAMEBUFFER,X))}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),_e)for(let He=0;He<S.length;He++){t.bindFramebuffer(s.FRAMEBUFFER,Se.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+He,s.RENDERBUFFER,Se.__webglColorRenderbuffer[He]);const he=n.get(S[He]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,Se.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+He,s.TEXTURE_2D,he,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,Se.__webglMultisampledFramebuffer)}else if(P.depthBuffer&&P.resolveDepthBuffer===!1&&l){const S=P.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[S])}}}function y(P){return Math.min(i.maxSamples,P.samples)}function G(P){const S=n.get(P);return P.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function $(P){const S=a.render.frame;h.get(P)!==S&&(h.set(P,S),P.update())}function ne(P,S){const O=P.colorSpace,Y=P.format,oe=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||O!==wt&&O!==ci&&(nt.getTransfer(O)===at?(Y!==hn||oe!==nn)&&ze("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Xe("WebGLTextures: Unsupported texture color space:",O)),S}function V(P){return typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement?(c.width=P.naturalWidth||P.width,c.height=P.naturalHeight||P.height):typeof VideoFrame<"u"&&P instanceof VideoFrame?(c.width=P.displayWidth,c.height=P.displayHeight):(c.width=P.width,c.height=P.height),c}this.allocateTextureUnit=B,this.resetTextureUnits=D,this.setTexture2D=F,this.setTexture2DArray=q,this.setTexture3D=z,this.setTextureCube=te,this.rebindTextures=Ke,this.setupRenderTarget=Fe,this.updateRenderTargetMipmap=b,this.updateMultisampleRenderTarget=N,this.setupDepthRenderbuffer=Oe,this.setupFrameBufferTexture=fe,this.useMultisampledRTT=G,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function vx(s,e){function t(n,i=ci){let r;const a=nt.getTransfer(i);if(n===nn)return s.UNSIGNED_BYTE;if(n===uo)return s.UNSIGNED_SHORT_4_4_4_4;if(n===fo)return s.UNSIGNED_SHORT_5_5_5_1;if(n===Wc)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===Xc)return s.UNSIGNED_INT_10F_11F_11F_REV;if(n===Vc)return s.BYTE;if(n===Gc)return s.SHORT;if(n===Bs)return s.UNSIGNED_SHORT;if(n===ho)return s.INT;if(n===On)return s.UNSIGNED_INT;if(n===vn)return s.FLOAT;if(n===Yt)return s.HALF_FLOAT;if(n===jc)return s.ALPHA;if(n===Zc)return s.RGB;if(n===hn)return s.RGBA;if(n===$n)return s.DEPTH_COMPONENT;if(n===li)return s.DEPTH_STENCIL;if(n===po)return s.RED;if(n===mo)return s.RED_INTEGER;if(n===qi)return s.RG;if(n===go)return s.RG_INTEGER;if(n===vo)return s.RGBA_INTEGER;if(n===Tr||n===Cr||n===Ar||n===Pr)if(a===at)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Tr)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Cr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ar)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Pr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Tr)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Cr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ar)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Pr)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===xo||n===_o||n===bo||n===yo)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===xo)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===_o)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===bo)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===yo)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Mo||n===wo||n===So||n===Eo||n===To||n===Co||n===Ao)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Mo||n===wo)return a===at?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===So)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===Eo)return r.COMPRESSED_R11_EAC;if(n===To)return r.COMPRESSED_SIGNED_R11_EAC;if(n===Co)return r.COMPRESSED_RG11_EAC;if(n===Ao)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Po||n===Ro||n===Lo||n===Do||n===Io||n===No||n===Uo||n===Bo||n===ko||n===Oo||n===Fo||n===zo||n===Ho||n===Vo)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===Po)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ro)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Lo)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Do)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Io)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===No)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Uo)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Bo)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ko)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Oo)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Fo)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===zo)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ho)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Vo)return a===at?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Go||n===Wo||n===Xo)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===Go)return a===at?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Wo)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Xo)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===jo||n===Zo||n===qo||n===Yo)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===jo)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Zo)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===qo)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Yo)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Zi?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}const xx=`
|
||
void main() {
|
||
|
||
gl_Position = vec4( position, 1.0 );
|
||
|
||
}`,_x=`
|
||
uniform sampler2DArray depthColor;
|
||
uniform float depthWidth;
|
||
uniform float depthHeight;
|
||
|
||
void main() {
|
||
|
||
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
|
||
|
||
if ( coord.x >= 1.0 ) {
|
||
|
||
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
|
||
|
||
} else {
|
||
|
||
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
|
||
|
||
}
|
||
|
||
}`;class bx{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new jh(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Rt({vertexShader:xx,fragmentShader:_x,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bt(new la(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class yx extends bi{constructor(e,t){super();const n=this;let i=null,r=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,f=null,d=null,p=null;const g=typeof XRWebGLBinding<"u",v=new bx,m={},x=t.getContextAttributes();let _=null,M=null;const T=[],A=[],L=new de;let U=null;const E=new Zt;E.viewport=new _t;const C=new Zt;C.viewport=new _t;const k=[E,C],D=new eg;let B=null,w=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let ce=T[ie];return ce===void 0&&(ce=new Sl,T[ie]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(ie){let ce=T[ie];return ce===void 0&&(ce=new Sl,T[ie]=ce),ce.getGripSpace()},this.getHand=function(ie){let ce=T[ie];return ce===void 0&&(ce=new Sl,T[ie]=ce),ce.getHandSpace()};function F(ie){const ce=A.indexOf(ie.inputSource);if(ce===-1)return;const fe=T[ce];fe!==void 0&&(fe.update(ie.inputSource,ie.frame,c||a),fe.dispatchEvent({type:ie.type,data:ie.inputSource}))}function q(){i.removeEventListener("select",F),i.removeEventListener("selectstart",F),i.removeEventListener("selectend",F),i.removeEventListener("squeeze",F),i.removeEventListener("squeezestart",F),i.removeEventListener("squeezeend",F),i.removeEventListener("end",q),i.removeEventListener("inputsourceschange",z);for(let ie=0;ie<T.length;ie++){const ce=A[ie];ce!==null&&(A[ie]=null,T[ie].disconnect(ce))}B=null,w=null,v.reset();for(const ie in m)delete m[ie];e.setRenderTarget(_),d=null,f=null,u=null,i=null,M=null,ue.stop(),n.isPresenting=!1,e.setPixelRatio(U),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ie){r=ie,n.isPresenting===!0&&ze("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ie){o=ie,n.isPresenting===!0&&ze("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ie){c=ie},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return u===null&&g&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(ie){if(i=ie,i!==null){if(_=e.getRenderTarget(),i.addEventListener("select",F),i.addEventListener("selectstart",F),i.addEventListener("selectend",F),i.addEventListener("squeeze",F),i.addEventListener("squeezestart",F),i.addEventListener("squeezeend",F),i.addEventListener("end",q),i.addEventListener("inputsourceschange",z),x.xrCompatible!==!0&&await t.makeXRCompatible(),U=e.getPixelRatio(),e.getSize(L),g&&"createProjectionLayer"in XRWebGLBinding.prototype){let fe=null,be=null,ye=null;x.depth&&(ye=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,fe=x.stencil?li:$n,be=x.stencil?Zi:On);const Oe={colorFormat:t.RGBA8,depthFormat:ye,scaleFactor:r};u=this.getBinding(),f=u.createProjectionLayer(Oe),i.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),M=new Wt(f.textureWidth,f.textureHeight,{format:hn,type:nn,depthTexture:new ps(f.textureWidth,f.textureHeight,be,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{const fe={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,t,fe),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),M=new Wt(d.framebufferWidth,d.framebufferHeight,{format:hn,type:nn,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),ue.setContext(i),ue.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return v.getDepthTexture()};function z(ie){for(let ce=0;ce<ie.removed.length;ce++){const fe=ie.removed[ce],be=A.indexOf(fe);be>=0&&(A[be]=null,T[be].disconnect(fe))}for(let ce=0;ce<ie.added.length;ce++){const fe=ie.added[ce];let be=A.indexOf(fe);if(be===-1){for(let Oe=0;Oe<T.length;Oe++)if(Oe>=A.length){A.push(fe),be=Oe;break}else if(A[Oe]===null){A[Oe]=fe,be=Oe;break}if(be===-1)break}const ye=T[be];ye&&ye.connect(fe)}}const te=new R,K=new R;function le(ie,ce,fe){te.setFromMatrixPosition(ce.matrixWorld),K.setFromMatrixPosition(fe.matrixWorld);const be=te.distanceTo(K),ye=ce.projectionMatrix.elements,Oe=fe.projectionMatrix.elements,Ke=ye[14]/(ye[10]-1),Fe=ye[14]/(ye[10]+1),b=(ye[9]+1)/ye[5],X=(ye[9]-1)/ye[5],H=(ye[8]-1)/ye[0],N=(Oe[8]+1)/Oe[0],y=Ke*H,G=Ke*N,$=be/(-H+N),ne=$*-H;if(ce.matrixWorld.decompose(ie.position,ie.quaternion,ie.scale),ie.translateX(ne),ie.translateZ($),ie.matrixWorld.compose(ie.position,ie.quaternion,ie.scale),ie.matrixWorldInverse.copy(ie.matrixWorld).invert(),ye[10]===-1)ie.projectionMatrix.copy(ce.projectionMatrix),ie.projectionMatrixInverse.copy(ce.projectionMatrixInverse);else{const V=Ke+$,P=Fe+$,S=y-ne,O=G+(be-ne),Y=b*Fe/P*V,oe=X*Fe/P*V;ie.projectionMatrix.makePerspective(S,O,Y,oe,V,P),ie.projectionMatrixInverse.copy(ie.projectionMatrix).invert()}}function W(ie,ce){ce===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(ce.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(i===null)return;let ce=ie.near,fe=ie.far;v.texture!==null&&(v.depthNear>0&&(ce=v.depthNear),v.depthFar>0&&(fe=v.depthFar)),D.near=C.near=E.near=ce,D.far=C.far=E.far=fe,(B!==D.near||w!==D.far)&&(i.updateRenderState({depthNear:D.near,depthFar:D.far}),B=D.near,w=D.far),D.layers.mask=ie.layers.mask|6,E.layers.mask=D.layers.mask&3,C.layers.mask=D.layers.mask&5;const be=ie.parent,ye=D.cameras;W(D,be);for(let Oe=0;Oe<ye.length;Oe++)W(ye[Oe],be);ye.length===2?le(D,E,C):D.projectionMatrix.copy(E.projectionMatrix),j(ie,D,be)};function j(ie,ce,fe){fe===null?ie.matrix.copy(ce.matrixWorld):(ie.matrix.copy(fe.matrixWorld),ie.matrix.invert(),ie.matrix.multiply(ce.matrixWorld)),ie.matrix.decompose(ie.position,ie.quaternion,ie.scale),ie.updateMatrixWorld(!0),ie.projectionMatrix.copy(ce.projectionMatrix),ie.projectionMatrixInverse.copy(ce.projectionMatrixInverse),ie.isPerspectiveCamera&&(ie.fov=Ki*2*Math.atan(1/ie.projectionMatrix.elements[5]),ie.zoom=1)}this.getCamera=function(){return D},this.getFoveation=function(){if(!(f===null&&d===null))return l},this.setFoveation=function(ie){l=ie,f!==null&&(f.fixedFoveation=ie),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=ie)},this.hasDepthSensing=function(){return v.texture!==null},this.getDepthSensingMesh=function(){return v.getMesh(D)},this.getCameraTexture=function(ie){return m[ie]};let me=null;function ge(ie,ce){if(h=ce.getViewerPose(c||a),p=ce,h!==null){const fe=h.views;d!==null&&(e.setRenderTargetFramebuffer(M,d.framebuffer),e.setRenderTarget(M));let be=!1;fe.length!==D.cameras.length&&(D.cameras.length=0,be=!0);for(let Fe=0;Fe<fe.length;Fe++){const b=fe[Fe];let X=null;if(d!==null)X=d.getViewport(b);else{const N=u.getViewSubImage(f,b);X=N.viewport,Fe===0&&(e.setRenderTargetTextures(M,N.colorTexture,N.depthStencilTexture),e.setRenderTarget(M))}let H=k[Fe];H===void 0&&(H=new Zt,H.layers.enable(Fe),H.viewport=new _t,k[Fe]=H),H.matrix.fromArray(b.transform.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale),H.projectionMatrix.fromArray(b.projectionMatrix),H.projectionMatrixInverse.copy(H.projectionMatrix).invert(),H.viewport.set(X.x,X.y,X.width,X.height),Fe===0&&(D.matrix.copy(H.matrix),D.matrix.decompose(D.position,D.quaternion,D.scale)),be===!0&&D.cameras.push(H)}const ye=i.enabledFeatures;if(ye&&ye.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&g){u=n.getBinding();const Fe=u.getDepthInformation(fe[0]);Fe&&Fe.isValid&&Fe.texture&&v.init(Fe,i.renderState)}if(ye&&ye.includes("camera-access")&&g){e.state.unbindTexture(),u=n.getBinding();for(let Fe=0;Fe<fe.length;Fe++){const b=fe[Fe].camera;if(b){let X=m[b];X||(X=new jh,m[b]=X);const H=u.getCameraImage(b);X.sourceTexture=H}}}}for(let fe=0;fe<T.length;fe++){const be=A[fe],ye=T[fe];be!==null&&ye!==void 0&&ye.update(be,ce,c||a)}me&&me(ie,ce),ce.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ce}),p=null}const ue=new yu;ue.setAnimationLoop(ge),this.setAnimationLoop=function(ie){me=ie},this.dispose=function(){}}}const Li=new sn,Mx=new je;function wx(s,e){function t(v,m){v.matrixAutoUpdate===!0&&v.updateMatrix(),m.value.copy(v.matrix)}function n(v,m){m.color.getRGB(v.fogColor.value,Mh(s)),m.isFog?(v.fogNear.value=m.near,v.fogFar.value=m.far):m.isFogExp2&&(v.fogDensity.value=m.density)}function i(v,m,x,_,M){m.isMeshBasicMaterial||m.isMeshLambertMaterial?r(v,m):m.isMeshToonMaterial?(r(v,m),u(v,m)):m.isMeshPhongMaterial?(r(v,m),h(v,m)):m.isMeshStandardMaterial?(r(v,m),f(v,m),m.isMeshPhysicalMaterial&&d(v,m,M)):m.isMeshMatcapMaterial?(r(v,m),p(v,m)):m.isMeshDepthMaterial?r(v,m):m.isMeshDistanceMaterial?(r(v,m),g(v,m)):m.isMeshNormalMaterial?r(v,m):m.isLineBasicMaterial?(a(v,m),m.isLineDashedMaterial&&o(v,m)):m.isPointsMaterial?l(v,m,x,_):m.isSpriteMaterial?c(v,m):m.isShadowMaterial?(v.color.value.copy(m.color),v.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function r(v,m){v.opacity.value=m.opacity,m.color&&v.diffuse.value.copy(m.color),m.emissive&&v.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(v.map.value=m.map,t(m.map,v.mapTransform)),m.alphaMap&&(v.alphaMap.value=m.alphaMap,t(m.alphaMap,v.alphaMapTransform)),m.bumpMap&&(v.bumpMap.value=m.bumpMap,t(m.bumpMap,v.bumpMapTransform),v.bumpScale.value=m.bumpScale,m.side===tn&&(v.bumpScale.value*=-1)),m.normalMap&&(v.normalMap.value=m.normalMap,t(m.normalMap,v.normalMapTransform),v.normalScale.value.copy(m.normalScale),m.side===tn&&v.normalScale.value.negate()),m.displacementMap&&(v.displacementMap.value=m.displacementMap,t(m.displacementMap,v.displacementMapTransform),v.displacementScale.value=m.displacementScale,v.displacementBias.value=m.displacementBias),m.emissiveMap&&(v.emissiveMap.value=m.emissiveMap,t(m.emissiveMap,v.emissiveMapTransform)),m.specularMap&&(v.specularMap.value=m.specularMap,t(m.specularMap,v.specularMapTransform)),m.alphaTest>0&&(v.alphaTest.value=m.alphaTest);const x=e.get(m),_=x.envMap,M=x.envMapRotation;_&&(v.envMap.value=_,Li.copy(M),Li.x*=-1,Li.y*=-1,Li.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(Li.y*=-1,Li.z*=-1),v.envMapRotation.value.setFromMatrix4(Mx.makeRotationFromEuler(Li)),v.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,v.reflectivity.value=m.reflectivity,v.ior.value=m.ior,v.refractionRatio.value=m.refractionRatio),m.lightMap&&(v.lightMap.value=m.lightMap,v.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,v.lightMapTransform)),m.aoMap&&(v.aoMap.value=m.aoMap,v.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,v.aoMapTransform))}function a(v,m){v.diffuse.value.copy(m.color),v.opacity.value=m.opacity,m.map&&(v.map.value=m.map,t(m.map,v.mapTransform))}function o(v,m){v.dashSize.value=m.dashSize,v.totalSize.value=m.dashSize+m.gapSize,v.scale.value=m.scale}function l(v,m,x,_){v.diffuse.value.copy(m.color),v.opacity.value=m.opacity,v.size.value=m.size*x,v.scale.value=_*.5,m.map&&(v.map.value=m.map,t(m.map,v.uvTransform)),m.alphaMap&&(v.alphaMap.value=m.alphaMap,t(m.alphaMap,v.alphaMapTransform)),m.alphaTest>0&&(v.alphaTest.value=m.alphaTest)}function c(v,m){v.diffuse.value.copy(m.color),v.opacity.value=m.opacity,v.rotation.value=m.rotation,m.map&&(v.map.value=m.map,t(m.map,v.mapTransform)),m.alphaMap&&(v.alphaMap.value=m.alphaMap,t(m.alphaMap,v.alphaMapTransform)),m.alphaTest>0&&(v.alphaTest.value=m.alphaTest)}function h(v,m){v.specular.value.copy(m.specular),v.shininess.value=Math.max(m.shininess,1e-4)}function u(v,m){m.gradientMap&&(v.gradientMap.value=m.gradientMap)}function f(v,m){v.metalness.value=m.metalness,m.metalnessMap&&(v.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,v.metalnessMapTransform)),v.roughness.value=m.roughness,m.roughnessMap&&(v.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,v.roughnessMapTransform)),m.envMap&&(v.envMapIntensity.value=m.envMapIntensity)}function d(v,m,x){v.ior.value=m.ior,m.sheen>0&&(v.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),v.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(v.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,v.sheenColorMapTransform)),m.sheenRoughnessMap&&(v.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,v.sheenRoughnessMapTransform))),m.clearcoat>0&&(v.clearcoat.value=m.clearcoat,v.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(v.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,v.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(v.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===tn&&v.clearcoatNormalScale.value.negate())),m.dispersion>0&&(v.dispersion.value=m.dispersion),m.iridescence>0&&(v.iridescence.value=m.iridescence,v.iridescenceIOR.value=m.iridescenceIOR,v.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(v.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,v.iridescenceMapTransform)),m.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),m.transmission>0&&(v.transmission.value=m.transmission,v.transmissionSamplerMap.value=x.texture,v.transmissionSamplerSize.value.set(x.width,x.height),m.transmissionMap&&(v.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,v.transmissionMapTransform)),v.thickness.value=m.thickness,m.thicknessMap&&(v.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=m.attenuationDistance,v.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(v.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(v.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=m.specularIntensity,v.specularColor.value.copy(m.specularColor),m.specularColorMap&&(v.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,v.specularColorMapTransform)),m.specularIntensityMap&&(v.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,v.specularIntensityMapTransform))}function p(v,m){m.matcap&&(v.matcap.value=m.matcap)}function g(v,m){const x=e.get(m).light;v.referencePosition.value.setFromMatrixPosition(x.matrixWorld),v.nearDistance.value=x.shadow.camera.near,v.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Sx(s,e,t,n){let i={},r={},a=[];const o=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function l(x,_){const M=_.program;n.uniformBlockBinding(x,M)}function c(x,_){let M=i[x.id];M===void 0&&(p(x),M=h(x),i[x.id]=M,x.addEventListener("dispose",v));const T=_.program;n.updateUBOMapping(x,T);const A=e.render.frame;r[x.id]!==A&&(f(x),r[x.id]=A)}function h(x){const _=u();x.__bindingPointIndex=_;const M=s.createBuffer(),T=x.__size,A=x.usage;return s.bindBuffer(s.UNIFORM_BUFFER,M),s.bufferData(s.UNIFORM_BUFFER,T,A),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,_,M),M}function u(){for(let x=0;x<o;x++)if(a.indexOf(x)===-1)return a.push(x),x;return Xe("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(x){const _=i[x.id],M=x.uniforms,T=x.__cache;s.bindBuffer(s.UNIFORM_BUFFER,_);for(let A=0,L=M.length;A<L;A++){const U=Array.isArray(M[A])?M[A]:[M[A]];for(let E=0,C=U.length;E<C;E++){const k=U[E];if(d(k,A,E,T)===!0){const D=k.__offset,B=Array.isArray(k.value)?k.value:[k.value];let w=0;for(let F=0;F<B.length;F++){const q=B[F],z=g(q);typeof q=="number"||typeof q=="boolean"?(k.__data[0]=q,s.bufferSubData(s.UNIFORM_BUFFER,D+w,k.__data)):q.isMatrix3?(k.__data[0]=q.elements[0],k.__data[1]=q.elements[1],k.__data[2]=q.elements[2],k.__data[3]=0,k.__data[4]=q.elements[3],k.__data[5]=q.elements[4],k.__data[6]=q.elements[5],k.__data[7]=0,k.__data[8]=q.elements[6],k.__data[9]=q.elements[7],k.__data[10]=q.elements[8],k.__data[11]=0):(q.toArray(k.__data,w),w+=z.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,D,k.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function d(x,_,M,T){const A=x.value,L=_+"_"+M;if(T[L]===void 0)return typeof A=="number"||typeof A=="boolean"?T[L]=A:T[L]=A.clone(),!0;{const U=T[L];if(typeof A=="number"||typeof A=="boolean"){if(U!==A)return T[L]=A,!0}else if(U.equals(A)===!1)return U.copy(A),!0}return!1}function p(x){const _=x.uniforms;let M=0;const T=16;for(let L=0,U=_.length;L<U;L++){const E=Array.isArray(_[L])?_[L]:[_[L]];for(let C=0,k=E.length;C<k;C++){const D=E[C],B=Array.isArray(D.value)?D.value:[D.value];for(let w=0,F=B.length;w<F;w++){const q=B[w],z=g(q),te=M%T,K=te%z.boundary,le=te+K;M+=K,le!==0&&T-le<z.storage&&(M+=T-le),D.__data=new Float32Array(z.storage/Float32Array.BYTES_PER_ELEMENT),D.__offset=M,M+=z.storage}}}const A=M%T;return A>0&&(M+=T-A),x.__size=M,x.__cache={},this}function g(x){const _={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(_.boundary=4,_.storage=4):x.isVector2?(_.boundary=8,_.storage=8):x.isVector3||x.isColor?(_.boundary=16,_.storage=12):x.isVector4?(_.boundary=16,_.storage=16):x.isMatrix3?(_.boundary=48,_.storage=48):x.isMatrix4?(_.boundary=64,_.storage=64):x.isTexture?ze("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ze("WebGLRenderer: Unsupported uniform value type.",x),_}function v(x){const _=x.target;_.removeEventListener("dispose",v);const M=a.indexOf(_.__bindingPointIndex);a.splice(M,1),s.deleteBuffer(i[_.id]),delete i[_.id],delete r[_.id]}function m(){for(const x in i)s.deleteBuffer(i[x]);a=[],i={},r={}}return{bind:l,update:c,dispose:m}}const Ex=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Wn=null;function Tx(){return Wn===null&&(Wn=new qs(Ex,16,16,qi,Yt),Wn.name="DFG_LUT",Wn.minFilter=It,Wn.magFilter=It,Wn.wrapS=kn,Wn.wrapT=kn,Wn.generateMipmaps=!1,Wn.needsUpdate=!0),Wn}class Yu{constructor(e={}){const{canvas:t=np(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:f=!1,outputBufferType:d=nn}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const g=d,v=new Set([vo,go,mo]),m=new Set([nn,On,Bs,Zi,uo,fo]),x=new Uint32Array(4),_=new Int32Array(4);let M=null,T=null;const A=[],L=[];let U=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Un,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const E=this;let C=!1;this._outputColorSpace=ft;let k=0,D=0,B=null,w=-1,F=null;const q=new _t,z=new _t;let te=null;const K=new ke(0);let le=0,W=t.width,j=t.height,me=1,ge=null,ue=null;const ie=new _t(0,0,W,j),ce=new _t(0,0,W,j);let fe=!1;const be=new Ll;let ye=!1,Oe=!1;const Ke=new je,Fe=new R,b=new _t,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let H=!1;function N(){return B===null?me:1}let y=n;function G(I,J){return t.getContext(I,J)}try{const I={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ga}`),t.addEventListener("webglcontextlost",Ye,!1),t.addEventListener("webglcontextrestored",vt,!1),t.addEventListener("webglcontextcreationerror",ct,!1),y===null){const J="webgl2";if(y=G(J,I),y===null)throw G(J)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(I){throw Xe("WebGLRenderer: "+I.message),I}let $,ne,V,P,S,O,Y,oe,Q,Se,_e,Te,He,he,we,Ne,Ie,Me,qe,Z,Ee,xe,Le,ve;function pe(){$=new Tv(y),$.init(),xe=new vx(y,$),ne=new vv(y,$,e,xe),V=new mx(y,$),ne.reversedDepthBuffer&&f&&V.buffers.depth.setReversed(!0),P=new Pv(y),S=new ex,O=new gx(y,$,V,S,ne,xe,P),Y=new _v(E),oe=new Ev(E),Q=new fg(y),Le=new mv(y,Q),Se=new Cv(y,Q,P,Le),_e=new Lv(y,Se,Q,P),qe=new Rv(y,ne,O),Ne=new xv(S),Te=new Q1(E,Y,oe,$,ne,Le,Ne),He=new wx(E,S),he=new nx,we=new lx($),Me=new pv(E,Y,oe,V,_e,p,l),Ie=new fx(E,_e,ne),ve=new Sx(y,P,ne,V),Z=new gv(y,$,P),Ee=new Av(y,$,P),P.programs=Te.programs,E.capabilities=ne,E.extensions=$,E.properties=S,E.renderLists=he,E.shadowMap=Ie,E.state=V,E.info=P}pe(),g!==nn&&(U=new Iv(g,t.width,t.height,i,r));const Ce=new yx(E,y);this.xr=Ce,this.getContext=function(){return y},this.getContextAttributes=function(){return y.getContextAttributes()},this.forceContextLoss=function(){const I=$.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=$.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return me},this.setPixelRatio=function(I){I!==void 0&&(me=I,this.setSize(W,j,!1))},this.getSize=function(I){return I.set(W,j)},this.setSize=function(I,J,ae=!0){if(Ce.isPresenting){ze("WebGLRenderer: Can't change size while VR device is presenting.");return}W=I,j=J,t.width=Math.floor(I*me),t.height=Math.floor(J*me),ae===!0&&(t.style.width=I+"px",t.style.height=J+"px"),U!==null&&U.setSize(t.width,t.height),this.setViewport(0,0,I,J)},this.getDrawingBufferSize=function(I){return I.set(W*me,j*me).floor()},this.setDrawingBufferSize=function(I,J,ae){W=I,j=J,me=ae,t.width=Math.floor(I*ae),t.height=Math.floor(J*ae),this.setViewport(0,0,I,J)},this.setEffects=function(I){if(g===nn){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(I){for(let J=0;J<I.length;J++)if(I[J].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}U.setEffects(I||[])},this.getCurrentViewport=function(I){return I.copy(q)},this.getViewport=function(I){return I.copy(ie)},this.setViewport=function(I,J,ae,se){I.isVector4?ie.set(I.x,I.y,I.z,I.w):ie.set(I,J,ae,se),V.viewport(q.copy(ie).multiplyScalar(me).round())},this.getScissor=function(I){return I.copy(ce)},this.setScissor=function(I,J,ae,se){I.isVector4?ce.set(I.x,I.y,I.z,I.w):ce.set(I,J,ae,se),V.scissor(z.copy(ce).multiplyScalar(me).round())},this.getScissorTest=function(){return fe},this.setScissorTest=function(I){V.setScissorTest(fe=I)},this.setOpaqueSort=function(I){ge=I},this.setTransparentSort=function(I){ue=I},this.getClearColor=function(I){return I.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor(...arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha(...arguments)},this.clear=function(I=!0,J=!0,ae=!0){let se=0;if(I){let ee=!1;if(B!==null){const Pe=B.texture.format;ee=v.has(Pe)}if(ee){const Pe=B.texture.type,Ue=m.has(Pe),De=Me.getClearColor(),Be=Me.getClearAlpha(),Ve=De.r,Ze=De.g,Ge=De.b;Ue?(x[0]=Ve,x[1]=Ze,x[2]=Ge,x[3]=Be,y.clearBufferuiv(y.COLOR,0,x)):(_[0]=Ve,_[1]=Ze,_[2]=Ge,_[3]=Be,y.clearBufferiv(y.COLOR,0,_))}else se|=y.COLOR_BUFFER_BIT}J&&(se|=y.DEPTH_BUFFER_BIT),ae&&(se|=y.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),y.clear(se)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ye,!1),t.removeEventListener("webglcontextrestored",vt,!1),t.removeEventListener("webglcontextcreationerror",ct,!1),Me.dispose(),he.dispose(),we.dispose(),S.dispose(),Y.dispose(),oe.dispose(),_e.dispose(),Le.dispose(),ve.dispose(),Te.dispose(),Ce.dispose(),Ce.removeEventListener("sessionstart",cf),Ce.removeEventListener("sessionend",hf),Fi.stop()};function Ye(I){I.preventDefault(),Dr("WebGLRenderer: Context Lost."),C=!0}function vt(){Dr("WebGLRenderer: Context Restored."),C=!1;const I=P.autoReset,J=Ie.enabled,ae=Ie.autoUpdate,se=Ie.needsUpdate,ee=Ie.type;pe(),P.autoReset=I,Ie.enabled=J,Ie.autoUpdate=ae,Ie.needsUpdate=se,Ie.type=ee}function ct(I){Xe("WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function Yn(I){const J=I.target;J.removeEventListener("dispose",Yn),oi(J)}function oi(I){rM(I),S.remove(I)}function rM(I){const J=S.get(I).programs;J!==void 0&&(J.forEach(function(ae){Te.releaseProgram(ae)}),I.isShaderMaterial&&Te.releaseShaderCache(I))}this.renderBufferDirect=function(I,J,ae,se,ee,Pe){J===null&&(J=X);const Ue=ee.isMesh&&ee.matrixWorld.determinant()<0,De=oM(I,J,ae,se,ee);V.setMaterial(se,Ue);let Be=ae.index,Ve=1;if(se.wireframe===!0){if(Be=Se.getWireframeAttribute(ae),Be===void 0)return;Ve=2}const Ze=ae.drawRange,Ge=ae.attributes.position;let tt=Ze.start*Ve,dt=(Ze.start+Ze.count)*Ve;Pe!==null&&(tt=Math.max(tt,Pe.start*Ve),dt=Math.min(dt,(Pe.start+Pe.count)*Ve)),Be!==null?(tt=Math.max(tt,0),dt=Math.min(dt,Be.count)):Ge!=null&&(tt=Math.max(tt,0),dt=Math.min(dt,Ge.count));const Ct=dt-tt;if(Ct<0||Ct===1/0)return;Le.setup(ee,se,De,ae,Be);let At,pt=Z;if(Be!==null&&(At=Q.get(Be),pt=Ee,pt.setIndex(At)),ee.isMesh)se.wireframe===!0?(V.setLineWidth(se.wireframeLinewidth*N()),pt.setMode(y.LINES)):pt.setMode(y.TRIANGLES);else if(ee.isLine){let We=se.linewidth;We===void 0&&(We=1),V.setLineWidth(We*N()),ee.isLineSegments?pt.setMode(y.LINES):ee.isLineLoop?pt.setMode(y.LINE_LOOP):pt.setMode(y.LINE_STRIP)}else ee.isPoints?pt.setMode(y.POINTS):ee.isSprite&&pt.setMode(y.TRIANGLES);if(ee.isBatchedMesh)if(ee._multiDrawInstances!==null)Hs("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),pt.renderMultiDrawInstances(ee._multiDrawStarts,ee._multiDrawCounts,ee._multiDrawCount,ee._multiDrawInstances);else if($.get("WEBGL_multi_draw"))pt.renderMultiDraw(ee._multiDrawStarts,ee._multiDrawCounts,ee._multiDrawCount);else{const We=ee._multiDrawStarts,ht=ee._multiDrawCounts,rt=ee._multiDrawCount,mn=Be?Q.get(Be).bytesPerElement:1,Ls=S.get(se).currentProgram.getUniforms();for(let gn=0;gn<rt;gn++)Ls.setValue(y,"_gl_DrawID",gn),pt.render(We[gn]/mn,ht[gn])}else if(ee.isInstancedMesh)pt.renderInstances(tt,Ct,ee.count);else if(ae.isInstancedBufferGeometry){const We=ae._maxInstanceCount!==void 0?ae._maxInstanceCount:1/0,ht=Math.min(ae.instanceCount,We);pt.renderInstances(tt,Ct,ht)}else pt.render(tt,Ct)};function lf(I,J,ae){I.transparent===!0&&I.side===Vt&&I.forceSinglePass===!1?(I.side=tn,I.needsUpdate=!0,Ha(I,J,ae),I.side=Nn,I.needsUpdate=!0,Ha(I,J,ae),I.side=Vt):Ha(I,J,ae)}this.compile=function(I,J,ae=null){ae===null&&(ae=I),T=we.get(ae),T.init(J),L.push(T),ae.traverseVisible(function(ee){ee.isLight&&ee.layers.test(J.layers)&&(T.pushLight(ee),ee.castShadow&&T.pushShadow(ee))}),I!==ae&&I.traverseVisible(function(ee){ee.isLight&&ee.layers.test(J.layers)&&(T.pushLight(ee),ee.castShadow&&T.pushShadow(ee))}),T.setupLights();const se=new Set;return I.traverse(function(ee){if(!(ee.isMesh||ee.isPoints||ee.isLine||ee.isSprite))return;const Pe=ee.material;if(Pe)if(Array.isArray(Pe))for(let Ue=0;Ue<Pe.length;Ue++){const De=Pe[Ue];lf(De,ae,ee),se.add(De)}else lf(Pe,ae,ee),se.add(Pe)}),T=L.pop(),se},this.compileAsync=function(I,J,ae=null){const se=this.compile(I,J,ae);return new Promise(ee=>{function Pe(){if(se.forEach(function(Ue){S.get(Ue).currentProgram.isReady()&&se.delete(Ue)}),se.size===0){ee(I);return}setTimeout(Pe,10)}$.get("KHR_parallel_shader_compile")!==null?Pe():setTimeout(Pe,10)})};let Pc=null;function aM(I){Pc&&Pc(I)}function cf(){Fi.stop()}function hf(){Fi.start()}const Fi=new yu;Fi.setAnimationLoop(aM),typeof self<"u"&&Fi.setContext(self),this.setAnimationLoop=function(I){Pc=I,Ce.setAnimationLoop(I),I===null?Fi.stop():Fi.start()},Ce.addEventListener("sessionstart",cf),Ce.addEventListener("sessionend",hf),this.render=function(I,J){if(J!==void 0&&J.isCamera!==!0){Xe("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;const ae=Ce.enabled===!0&&Ce.isPresenting===!0,se=U!==null&&(B===null||ae)&&U.begin(E,B);if(I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),J.parent===null&&J.matrixWorldAutoUpdate===!0&&J.updateMatrixWorld(),Ce.enabled===!0&&Ce.isPresenting===!0&&(U===null||U.isCompositing()===!1)&&(Ce.cameraAutoUpdate===!0&&Ce.updateCamera(J),J=Ce.getCamera()),I.isScene===!0&&I.onBeforeRender(E,I,J,B),T=we.get(I,L.length),T.init(J),L.push(T),Ke.multiplyMatrices(J.projectionMatrix,J.matrixWorldInverse),be.setFromProjectionMatrix(Ke,Fn,J.reversedDepth),Oe=this.localClippingEnabled,ye=Ne.init(this.clippingPlanes,Oe),M=he.get(I,A.length),M.init(),A.push(M),Ce.enabled===!0&&Ce.isPresenting===!0){const Ue=E.xr.getDepthSensingMesh();Ue!==null&&Rc(Ue,J,-1/0,E.sortObjects)}Rc(I,J,0,E.sortObjects),M.finish(),E.sortObjects===!0&&M.sort(ge,ue),H=Ce.enabled===!1||Ce.isPresenting===!1||Ce.hasDepthSensing()===!1,H&&Me.addToRenderList(M,I),this.info.render.frame++,ye===!0&&Ne.beginShadows();const ee=T.state.shadowsArray;if(Ie.render(ee,I,J),ye===!0&&Ne.endShadows(),this.info.autoReset===!0&&this.info.reset(),(se&&U.hasRenderPass())===!1){const Ue=M.opaque,De=M.transmissive;if(T.setupLights(),J.isArrayCamera){const Be=J.cameras;if(De.length>0)for(let Ve=0,Ze=Be.length;Ve<Ze;Ve++){const Ge=Be[Ve];df(Ue,De,I,Ge)}H&&Me.render(I);for(let Ve=0,Ze=Be.length;Ve<Ze;Ve++){const Ge=Be[Ve];uf(M,I,Ge,Ge.viewport)}}else De.length>0&&df(Ue,De,I,J),H&&Me.render(I),uf(M,I,J)}B!==null&&D===0&&(O.updateMultisampleRenderTarget(B),O.updateRenderTargetMipmap(B)),se&&U.end(E),I.isScene===!0&&I.onAfterRender(E,I,J),Le.resetDefaultState(),w=-1,F=null,L.pop(),L.length>0?(T=L[L.length-1],ye===!0&&Ne.setGlobalState(E.clippingPlanes,T.state.camera)):T=null,A.pop(),A.length>0?M=A[A.length-1]:M=null};function Rc(I,J,ae,se){if(I.visible===!1)return;if(I.layers.test(J.layers)){if(I.isGroup)ae=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(J);else if(I.isLight)T.pushLight(I),I.castShadow&&T.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||be.intersectsSprite(I)){se&&b.setFromMatrixPosition(I.matrixWorld).applyMatrix4(Ke);const Ue=_e.update(I),De=I.material;De.visible&&M.push(I,Ue,De,ae,b.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(!I.frustumCulled||be.intersectsObject(I))){const Ue=_e.update(I),De=I.material;if(se&&(I.boundingSphere!==void 0?(I.boundingSphere===null&&I.computeBoundingSphere(),b.copy(I.boundingSphere.center)):(Ue.boundingSphere===null&&Ue.computeBoundingSphere(),b.copy(Ue.boundingSphere.center)),b.applyMatrix4(I.matrixWorld).applyMatrix4(Ke)),Array.isArray(De)){const Be=Ue.groups;for(let Ve=0,Ze=Be.length;Ve<Ze;Ve++){const Ge=Be[Ve],tt=De[Ge.materialIndex];tt&&tt.visible&&M.push(I,Ue,tt,ae,b.z,Ge)}}else De.visible&&M.push(I,Ue,De,ae,b.z,null)}}const Pe=I.children;for(let Ue=0,De=Pe.length;Ue<De;Ue++)Rc(Pe[Ue],J,ae,se)}function uf(I,J,ae,se){const{opaque:ee,transmissive:Pe,transparent:Ue}=I;T.setupLightsView(ae),ye===!0&&Ne.setGlobalState(E.clippingPlanes,ae),se&&V.viewport(q.copy(se)),ee.length>0&&za(ee,J,ae),Pe.length>0&&za(Pe,J,ae),Ue.length>0&&za(Ue,J,ae),V.buffers.depth.setTest(!0),V.buffers.depth.setMask(!0),V.buffers.color.setMask(!0),V.setPolygonOffset(!1)}function df(I,J,ae,se){if((ae.isScene===!0?ae.overrideMaterial:null)!==null)return;if(T.state.transmissionRenderTarget[se.id]===void 0){const tt=$.has("EXT_color_buffer_half_float")||$.has("EXT_color_buffer_float");T.state.transmissionRenderTarget[se.id]=new Wt(1,1,{generateMipmaps:!0,type:tt?Yt:nn,minFilter:Kn,samples:ne.samples,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:nt.workingColorSpace})}const Pe=T.state.transmissionRenderTarget[se.id],Ue=se.viewport||q;Pe.setSize(Ue.z*E.transmissionResolutionScale,Ue.w*E.transmissionResolutionScale);const De=E.getRenderTarget(),Be=E.getActiveCubeFace(),Ve=E.getActiveMipmapLevel();E.setRenderTarget(Pe),E.getClearColor(K),le=E.getClearAlpha(),le<1&&E.setClearColor(16777215,.5),E.clear(),H&&Me.render(ae);const Ze=E.toneMapping;E.toneMapping=Un;const Ge=se.viewport;if(se.viewport!==void 0&&(se.viewport=void 0),T.setupLightsView(se),ye===!0&&Ne.setGlobalState(E.clippingPlanes,se),za(I,ae,se),O.updateMultisampleRenderTarget(Pe),O.updateRenderTargetMipmap(Pe),$.has("WEBGL_multisampled_render_to_texture")===!1){let tt=!1;for(let dt=0,Ct=J.length;dt<Ct;dt++){const At=J[dt],{object:pt,geometry:We,material:ht,group:rt}=At;if(ht.side===Vt&&pt.layers.test(se.layers)){const mn=ht.side;ht.side=tn,ht.needsUpdate=!0,ff(pt,ae,se,We,ht,rt),ht.side=mn,ht.needsUpdate=!0,tt=!0}}tt===!0&&(O.updateMultisampleRenderTarget(Pe),O.updateRenderTargetMipmap(Pe))}E.setRenderTarget(De,Be,Ve),E.setClearColor(K,le),Ge!==void 0&&(se.viewport=Ge),E.toneMapping=Ze}function za(I,J,ae){const se=J.isScene===!0?J.overrideMaterial:null;for(let ee=0,Pe=I.length;ee<Pe;ee++){const Ue=I[ee],{object:De,geometry:Be,group:Ve}=Ue;let Ze=Ue.material;Ze.allowOverride===!0&&se!==null&&(Ze=se),De.layers.test(ae.layers)&&ff(De,J,ae,Be,Ze,Ve)}}function ff(I,J,ae,se,ee,Pe){I.onBeforeRender(E,J,ae,se,ee,Pe),I.modelViewMatrix.multiplyMatrices(ae.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),ee.onBeforeRender(E,J,ae,se,I,Pe),ee.transparent===!0&&ee.side===Vt&&ee.forceSinglePass===!1?(ee.side=tn,ee.needsUpdate=!0,E.renderBufferDirect(ae,J,se,ee,I,Pe),ee.side=Nn,ee.needsUpdate=!0,E.renderBufferDirect(ae,J,se,ee,I,Pe),ee.side=Vt):E.renderBufferDirect(ae,J,se,ee,I,Pe),I.onAfterRender(E,J,ae,se,ee,Pe)}function Ha(I,J,ae){J.isScene!==!0&&(J=X);const se=S.get(I),ee=T.state.lights,Pe=T.state.shadowsArray,Ue=ee.state.version,De=Te.getParameters(I,ee.state,Pe,J,ae),Be=Te.getProgramCacheKey(De);let Ve=se.programs;se.environment=I.isMeshStandardMaterial?J.environment:null,se.fog=J.fog,se.envMap=(I.isMeshStandardMaterial?oe:Y).get(I.envMap||se.environment),se.envMapRotation=se.environment!==null&&I.envMap===null?J.environmentRotation:I.envMapRotation,Ve===void 0&&(I.addEventListener("dispose",Yn),Ve=new Map,se.programs=Ve);let Ze=Ve.get(Be);if(Ze!==void 0){if(se.currentProgram===Ze&&se.lightsStateVersion===Ue)return mf(I,De),Ze}else De.uniforms=Te.getUniforms(I),I.onBeforeCompile(De,E),Ze=Te.acquireProgram(De,Be),Ve.set(Be,Ze),se.uniforms=De.uniforms;const Ge=se.uniforms;return(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(Ge.clippingPlanes=Ne.uniform),mf(I,De),se.needsLights=cM(I),se.lightsStateVersion=Ue,se.needsLights&&(Ge.ambientLightColor.value=ee.state.ambient,Ge.lightProbe.value=ee.state.probe,Ge.directionalLights.value=ee.state.directional,Ge.directionalLightShadows.value=ee.state.directionalShadow,Ge.spotLights.value=ee.state.spot,Ge.spotLightShadows.value=ee.state.spotShadow,Ge.rectAreaLights.value=ee.state.rectArea,Ge.ltc_1.value=ee.state.rectAreaLTC1,Ge.ltc_2.value=ee.state.rectAreaLTC2,Ge.pointLights.value=ee.state.point,Ge.pointLightShadows.value=ee.state.pointShadow,Ge.hemisphereLights.value=ee.state.hemi,Ge.directionalShadowMap.value=ee.state.directionalShadowMap,Ge.directionalShadowMatrix.value=ee.state.directionalShadowMatrix,Ge.spotShadowMap.value=ee.state.spotShadowMap,Ge.spotLightMatrix.value=ee.state.spotLightMatrix,Ge.spotLightMap.value=ee.state.spotLightMap,Ge.pointShadowMap.value=ee.state.pointShadowMap,Ge.pointShadowMatrix.value=ee.state.pointShadowMatrix),se.currentProgram=Ze,se.uniformsList=null,Ze}function pf(I){if(I.uniformsList===null){const J=I.currentProgram.getUniforms();I.uniformsList=ga.seqWithValue(J.seq,I.uniforms)}return I.uniformsList}function mf(I,J){const ae=S.get(I);ae.outputColorSpace=J.outputColorSpace,ae.batching=J.batching,ae.batchingColor=J.batchingColor,ae.instancing=J.instancing,ae.instancingColor=J.instancingColor,ae.instancingMorph=J.instancingMorph,ae.skinning=J.skinning,ae.morphTargets=J.morphTargets,ae.morphNormals=J.morphNormals,ae.morphColors=J.morphColors,ae.morphTargetsCount=J.morphTargetsCount,ae.numClippingPlanes=J.numClippingPlanes,ae.numIntersection=J.numClipIntersection,ae.vertexAlphas=J.vertexAlphas,ae.vertexTangents=J.vertexTangents,ae.toneMapping=J.toneMapping}function oM(I,J,ae,se,ee){J.isScene!==!0&&(J=X),O.resetTextureUnits();const Pe=J.fog,Ue=se.isMeshStandardMaterial?J.environment:null,De=B===null?E.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:wt,Be=(se.isMeshStandardMaterial?oe:Y).get(se.envMap||Ue),Ve=se.vertexColors===!0&&!!ae.attributes.color&&ae.attributes.color.itemSize===4,Ze=!!ae.attributes.tangent&&(!!se.normalMap||se.anisotropy>0),Ge=!!ae.morphAttributes.position,tt=!!ae.morphAttributes.normal,dt=!!ae.morphAttributes.color;let Ct=Un;se.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(Ct=E.toneMapping);const At=ae.morphAttributes.position||ae.morphAttributes.normal||ae.morphAttributes.color,pt=At!==void 0?At.length:0,We=S.get(se),ht=T.state.lights;if(ye===!0&&(Oe===!0||I!==F)){const Qt=I===F&&se.id===w;Ne.setState(se,I,Qt)}let rt=!1;se.version===We.__version?(We.needsLights&&We.lightsStateVersion!==ht.state.version||We.outputColorSpace!==De||ee.isBatchedMesh&&We.batching===!1||!ee.isBatchedMesh&&We.batching===!0||ee.isBatchedMesh&&We.batchingColor===!0&&ee.colorTexture===null||ee.isBatchedMesh&&We.batchingColor===!1&&ee.colorTexture!==null||ee.isInstancedMesh&&We.instancing===!1||!ee.isInstancedMesh&&We.instancing===!0||ee.isSkinnedMesh&&We.skinning===!1||!ee.isSkinnedMesh&&We.skinning===!0||ee.isInstancedMesh&&We.instancingColor===!0&&ee.instanceColor===null||ee.isInstancedMesh&&We.instancingColor===!1&&ee.instanceColor!==null||ee.isInstancedMesh&&We.instancingMorph===!0&&ee.morphTexture===null||ee.isInstancedMesh&&We.instancingMorph===!1&&ee.morphTexture!==null||We.envMap!==Be||se.fog===!0&&We.fog!==Pe||We.numClippingPlanes!==void 0&&(We.numClippingPlanes!==Ne.numPlanes||We.numIntersection!==Ne.numIntersection)||We.vertexAlphas!==Ve||We.vertexTangents!==Ze||We.morphTargets!==Ge||We.morphNormals!==tt||We.morphColors!==dt||We.toneMapping!==Ct||We.morphTargetsCount!==pt)&&(rt=!0):(rt=!0,We.__version=se.version);let mn=We.currentProgram;rt===!0&&(mn=Ha(se,J,ee));let Ls=!1,gn=!1,_r=!1;const xt=mn.getUniforms(),ln=We.uniforms;if(V.useProgram(mn.program)&&(Ls=!0,gn=!0,_r=!0),se.id!==w&&(w=se.id,gn=!0),Ls||F!==I){V.buffers.depth.getReversed()&&I.reversedDepth!==!0&&(I._reversedDepth=!0,I.updateProjectionMatrix()),xt.setValue(y,"projectionMatrix",I.projectionMatrix),xt.setValue(y,"viewMatrix",I.matrixWorldInverse);const cn=xt.map.cameraPosition;cn!==void 0&&cn.setValue(y,Fe.setFromMatrixPosition(I.matrixWorld)),ne.logarithmicDepthBuffer&&xt.setValue(y,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&xt.setValue(y,"isOrthographic",I.isOrthographicCamera===!0),F!==I&&(F=I,gn=!0,_r=!0)}if(We.needsLights&&(ht.state.directionalShadowMap.length>0&&xt.setValue(y,"directionalShadowMap",ht.state.directionalShadowMap,O),ht.state.spotShadowMap.length>0&&xt.setValue(y,"spotShadowMap",ht.state.spotShadowMap,O),ht.state.pointShadowMap.length>0&&xt.setValue(y,"pointShadowMap",ht.state.pointShadowMap,O)),ee.isSkinnedMesh){xt.setOptional(y,ee,"bindMatrix"),xt.setOptional(y,ee,"bindMatrixInverse");const Qt=ee.skeleton;Qt&&(Qt.boneTexture===null&&Qt.computeBoneTexture(),xt.setValue(y,"boneTexture",Qt.boneTexture,O))}ee.isBatchedMesh&&(xt.setOptional(y,ee,"batchingTexture"),xt.setValue(y,"batchingTexture",ee._matricesTexture,O),xt.setOptional(y,ee,"batchingIdTexture"),xt.setValue(y,"batchingIdTexture",ee._indirectTexture,O),xt.setOptional(y,ee,"batchingColorTexture"),ee._colorsTexture!==null&&xt.setValue(y,"batchingColorTexture",ee._colorsTexture,O));const Mn=ae.morphAttributes;if((Mn.position!==void 0||Mn.normal!==void 0||Mn.color!==void 0)&&qe.update(ee,ae,mn),(gn||We.receiveShadow!==ee.receiveShadow)&&(We.receiveShadow=ee.receiveShadow,xt.setValue(y,"receiveShadow",ee.receiveShadow)),se.isMeshGouraudMaterial&&se.envMap!==null&&(ln.envMap.value=Be,ln.flipEnvMap.value=Be.isCubeTexture&&Be.isRenderTargetTexture===!1?-1:1),se.isMeshStandardMaterial&&se.envMap===null&&J.environment!==null&&(ln.envMapIntensity.value=J.environmentIntensity),ln.dfgLUT!==void 0&&(ln.dfgLUT.value=Tx()),gn&&(xt.setValue(y,"toneMappingExposure",E.toneMappingExposure),We.needsLights&&lM(ln,_r),Pe&&se.fog===!0&&He.refreshFogUniforms(ln,Pe),He.refreshMaterialUniforms(ln,se,me,j,T.state.transmissionRenderTarget[I.id]),ga.upload(y,pf(We),ln,O)),se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(ga.upload(y,pf(We),ln,O),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&xt.setValue(y,"center",ee.center),xt.setValue(y,"modelViewMatrix",ee.modelViewMatrix),xt.setValue(y,"normalMatrix",ee.normalMatrix),xt.setValue(y,"modelMatrix",ee.matrixWorld),se.isShaderMaterial||se.isRawShaderMaterial){const Qt=se.uniformsGroups;for(let cn=0,Lc=Qt.length;cn<Lc;cn++){const zi=Qt[cn];ve.update(zi,mn),ve.bind(zi,mn)}}return mn}function lM(I,J){I.ambientLightColor.needsUpdate=J,I.lightProbe.needsUpdate=J,I.directionalLights.needsUpdate=J,I.directionalLightShadows.needsUpdate=J,I.pointLights.needsUpdate=J,I.pointLightShadows.needsUpdate=J,I.spotLights.needsUpdate=J,I.spotLightShadows.needsUpdate=J,I.rectAreaLights.needsUpdate=J,I.hemisphereLights.needsUpdate=J}function cM(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return k},this.getActiveMipmapLevel=function(){return D},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(I,J,ae){const se=S.get(I);se.__autoAllocateDepthBuffer=I.resolveDepthBuffer===!1,se.__autoAllocateDepthBuffer===!1&&(se.__useRenderToTexture=!1),S.get(I.texture).__webglTexture=J,S.get(I.depthTexture).__webglTexture=se.__autoAllocateDepthBuffer?void 0:ae,se.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(I,J){const ae=S.get(I);ae.__webglFramebuffer=J,ae.__useDefaultFramebuffer=J===void 0};const hM=y.createFramebuffer();this.setRenderTarget=function(I,J=0,ae=0){B=I,k=J,D=ae;let se=null,ee=!1,Pe=!1;if(I){const De=S.get(I);if(De.__useDefaultFramebuffer!==void 0){V.bindFramebuffer(y.FRAMEBUFFER,De.__webglFramebuffer),q.copy(I.viewport),z.copy(I.scissor),te=I.scissorTest,V.viewport(q),V.scissor(z),V.setScissorTest(te),w=-1;return}else if(De.__webglFramebuffer===void 0)O.setupRenderTarget(I);else if(De.__hasExternalTextures)O.rebindTextures(I,S.get(I.texture).__webglTexture,S.get(I.depthTexture).__webglTexture);else if(I.depthBuffer){const Ze=I.depthTexture;if(De.__boundDepthTexture!==Ze){if(Ze!==null&&S.has(Ze)&&(I.width!==Ze.image.width||I.height!==Ze.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");O.setupDepthRenderbuffer(I)}}const Be=I.texture;(Be.isData3DTexture||Be.isDataArrayTexture||Be.isCompressedArrayTexture)&&(Pe=!0);const Ve=S.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(Array.isArray(Ve[J])?se=Ve[J][ae]:se=Ve[J],ee=!0):I.samples>0&&O.useMultisampledRTT(I)===!1?se=S.get(I).__webglMultisampledFramebuffer:Array.isArray(Ve)?se=Ve[ae]:se=Ve,q.copy(I.viewport),z.copy(I.scissor),te=I.scissorTest}else q.copy(ie).multiplyScalar(me).floor(),z.copy(ce).multiplyScalar(me).floor(),te=fe;if(ae!==0&&(se=hM),V.bindFramebuffer(y.FRAMEBUFFER,se)&&V.drawBuffers(I,se),V.viewport(q),V.scissor(z),V.setScissorTest(te),ee){const De=S.get(I.texture);y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_CUBE_MAP_POSITIVE_X+J,De.__webglTexture,ae)}else if(Pe){const De=J;for(let Be=0;Be<I.textures.length;Be++){const Ve=S.get(I.textures[Be]);y.framebufferTextureLayer(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0+Be,Ve.__webglTexture,ae,De)}}else if(I!==null&&ae!==0){const De=S.get(I.texture);y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,De.__webglTexture,ae)}w=-1},this.readRenderTargetPixels=function(I,J,ae,se,ee,Pe,Ue,De=0){if(!(I&&I.isWebGLRenderTarget)){Xe("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Be=S.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&Ue!==void 0&&(Be=Be[Ue]),Be){V.bindFramebuffer(y.FRAMEBUFFER,Be);try{const Ve=I.textures[De],Ze=Ve.format,Ge=Ve.type;if(!ne.textureFormatReadable(Ze)){Xe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ne.textureTypeReadable(Ge)){Xe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}J>=0&&J<=I.width-se&&ae>=0&&ae<=I.height-ee&&(I.textures.length>1&&y.readBuffer(y.COLOR_ATTACHMENT0+De),y.readPixels(J,ae,se,ee,xe.convert(Ze),xe.convert(Ge),Pe))}finally{const Ve=B!==null?S.get(B).__webglFramebuffer:null;V.bindFramebuffer(y.FRAMEBUFFER,Ve)}}},this.readRenderTargetPixelsAsync=async function(I,J,ae,se,ee,Pe,Ue,De=0){if(!(I&&I.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Be=S.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&Ue!==void 0&&(Be=Be[Ue]),Be)if(J>=0&&J<=I.width-se&&ae>=0&&ae<=I.height-ee){V.bindFramebuffer(y.FRAMEBUFFER,Be);const Ve=I.textures[De],Ze=Ve.format,Ge=Ve.type;if(!ne.textureFormatReadable(Ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ne.textureTypeReadable(Ge))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const tt=y.createBuffer();y.bindBuffer(y.PIXEL_PACK_BUFFER,tt),y.bufferData(y.PIXEL_PACK_BUFFER,Pe.byteLength,y.STREAM_READ),I.textures.length>1&&y.readBuffer(y.COLOR_ATTACHMENT0+De),y.readPixels(J,ae,se,ee,xe.convert(Ze),xe.convert(Ge),0);const dt=B!==null?S.get(B).__webglFramebuffer:null;V.bindFramebuffer(y.FRAMEBUFFER,dt);const Ct=y.fenceSync(y.SYNC_GPU_COMMANDS_COMPLETE,0);return y.flush(),await ip(y,Ct,4),y.bindBuffer(y.PIXEL_PACK_BUFFER,tt),y.getBufferSubData(y.PIXEL_PACK_BUFFER,0,Pe),y.deleteBuffer(tt),y.deleteSync(Ct),Pe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(I,J=null,ae=0){const se=Math.pow(2,-ae),ee=Math.floor(I.image.width*se),Pe=Math.floor(I.image.height*se),Ue=J!==null?J.x:0,De=J!==null?J.y:0;O.setTexture2D(I,0),y.copyTexSubImage2D(y.TEXTURE_2D,ae,0,0,Ue,De,ee,Pe),V.unbindTexture()};const uM=y.createFramebuffer(),dM=y.createFramebuffer();this.copyTextureToTexture=function(I,J,ae=null,se=null,ee=0,Pe=null){Pe===null&&(ee!==0?(Hs("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Pe=ee,ee=0):Pe=0);let Ue,De,Be,Ve,Ze,Ge,tt,dt,Ct;const At=I.isCompressedTexture?I.mipmaps[Pe]:I.image;if(ae!==null)Ue=ae.max.x-ae.min.x,De=ae.max.y-ae.min.y,Be=ae.isBox3?ae.max.z-ae.min.z:1,Ve=ae.min.x,Ze=ae.min.y,Ge=ae.isBox3?ae.min.z:0;else{const Mn=Math.pow(2,-ee);Ue=Math.floor(At.width*Mn),De=Math.floor(At.height*Mn),I.isDataArrayTexture?Be=At.depth:I.isData3DTexture?Be=Math.floor(At.depth*Mn):Be=1,Ve=0,Ze=0,Ge=0}se!==null?(tt=se.x,dt=se.y,Ct=se.z):(tt=0,dt=0,Ct=0);const pt=xe.convert(J.format),We=xe.convert(J.type);let ht;J.isData3DTexture?(O.setTexture3D(J,0),ht=y.TEXTURE_3D):J.isDataArrayTexture||J.isCompressedArrayTexture?(O.setTexture2DArray(J,0),ht=y.TEXTURE_2D_ARRAY):(O.setTexture2D(J,0),ht=y.TEXTURE_2D),y.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,J.flipY),y.pixelStorei(y.UNPACK_PREMULTIPLY_ALPHA_WEBGL,J.premultiplyAlpha),y.pixelStorei(y.UNPACK_ALIGNMENT,J.unpackAlignment);const rt=y.getParameter(y.UNPACK_ROW_LENGTH),mn=y.getParameter(y.UNPACK_IMAGE_HEIGHT),Ls=y.getParameter(y.UNPACK_SKIP_PIXELS),gn=y.getParameter(y.UNPACK_SKIP_ROWS),_r=y.getParameter(y.UNPACK_SKIP_IMAGES);y.pixelStorei(y.UNPACK_ROW_LENGTH,At.width),y.pixelStorei(y.UNPACK_IMAGE_HEIGHT,At.height),y.pixelStorei(y.UNPACK_SKIP_PIXELS,Ve),y.pixelStorei(y.UNPACK_SKIP_ROWS,Ze),y.pixelStorei(y.UNPACK_SKIP_IMAGES,Ge);const xt=I.isDataArrayTexture||I.isData3DTexture,ln=J.isDataArrayTexture||J.isData3DTexture;if(I.isDepthTexture){const Mn=S.get(I),Qt=S.get(J),cn=S.get(Mn.__renderTarget),Lc=S.get(Qt.__renderTarget);V.bindFramebuffer(y.READ_FRAMEBUFFER,cn.__webglFramebuffer),V.bindFramebuffer(y.DRAW_FRAMEBUFFER,Lc.__webglFramebuffer);for(let zi=0;zi<Be;zi++)xt&&(y.framebufferTextureLayer(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,S.get(I).__webglTexture,ee,Ge+zi),y.framebufferTextureLayer(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,S.get(J).__webglTexture,Pe,Ct+zi)),y.blitFramebuffer(Ve,Ze,Ue,De,tt,dt,Ue,De,y.DEPTH_BUFFER_BIT,y.NEAREST);V.bindFramebuffer(y.READ_FRAMEBUFFER,null),V.bindFramebuffer(y.DRAW_FRAMEBUFFER,null)}else if(ee!==0||I.isRenderTargetTexture||S.has(I)){const Mn=S.get(I),Qt=S.get(J);V.bindFramebuffer(y.READ_FRAMEBUFFER,uM),V.bindFramebuffer(y.DRAW_FRAMEBUFFER,dM);for(let cn=0;cn<Be;cn++)xt?y.framebufferTextureLayer(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,Mn.__webglTexture,ee,Ge+cn):y.framebufferTexture2D(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,Mn.__webglTexture,ee),ln?y.framebufferTextureLayer(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,Qt.__webglTexture,Pe,Ct+cn):y.framebufferTexture2D(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,Qt.__webglTexture,Pe),ee!==0?y.blitFramebuffer(Ve,Ze,Ue,De,tt,dt,Ue,De,y.COLOR_BUFFER_BIT,y.NEAREST):ln?y.copyTexSubImage3D(ht,Pe,tt,dt,Ct+cn,Ve,Ze,Ue,De):y.copyTexSubImage2D(ht,Pe,tt,dt,Ve,Ze,Ue,De);V.bindFramebuffer(y.READ_FRAMEBUFFER,null),V.bindFramebuffer(y.DRAW_FRAMEBUFFER,null)}else ln?I.isDataTexture||I.isData3DTexture?y.texSubImage3D(ht,Pe,tt,dt,Ct,Ue,De,Be,pt,We,At.data):J.isCompressedArrayTexture?y.compressedTexSubImage3D(ht,Pe,tt,dt,Ct,Ue,De,Be,pt,At.data):y.texSubImage3D(ht,Pe,tt,dt,Ct,Ue,De,Be,pt,We,At):I.isDataTexture?y.texSubImage2D(y.TEXTURE_2D,Pe,tt,dt,Ue,De,pt,We,At.data):I.isCompressedTexture?y.compressedTexSubImage2D(y.TEXTURE_2D,Pe,tt,dt,At.width,At.height,pt,At.data):y.texSubImage2D(y.TEXTURE_2D,Pe,tt,dt,Ue,De,pt,We,At);y.pixelStorei(y.UNPACK_ROW_LENGTH,rt),y.pixelStorei(y.UNPACK_IMAGE_HEIGHT,mn),y.pixelStorei(y.UNPACK_SKIP_PIXELS,Ls),y.pixelStorei(y.UNPACK_SKIP_ROWS,gn),y.pixelStorei(y.UNPACK_SKIP_IMAGES,_r),Pe===0&&J.generateMipmaps&&y.generateMipmap(ht),V.unbindTexture()},this.initRenderTarget=function(I){S.get(I).__webglFramebuffer===void 0&&O.setupRenderTarget(I)},this.initTexture=function(I){I.isCubeTexture?O.setTextureCube(I,0):I.isData3DTexture?O.setTexture3D(I,0):I.isDataArrayTexture||I.isCompressedArrayTexture?O.setTexture2DArray(I,0):O.setTexture2D(I,0),V.unbindTexture()},this.resetState=function(){k=0,D=0,B=null,V.reset(),Le.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Fn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=nt._getDrawingBufferColorSpace(e),t.unpackColorSpace=nt._getUnpackColorSpace()}}class Cx{engine;scene;constructor(e){this.engine=e,this.scene=new Ah}}class Ax{engine;perspectiveCamera;orthographicCamera;constructor(e){this.engine=e,this.perspectiveCamera=new Zt(60,this.engine.container.clientWidth/this.engine.container.clientHeight,.1,1e3),this.perspectiveCamera.position.set(2,2,2),this.perspectiveCamera.lookAt(0,0,0);const t=50,n=this.engine.container.clientWidth/this.engine.container.clientHeight;this.orthographicCamera=new gi(t*n/-2,t*n/2,t/2,t/-2,.1,1e3)}switchToPerspectiveCamera(){const e=this.engine.camera.position.clone(),t=this.engine.controls.target.clone();this.engine.camera=this.perspectiveCamera,this.engine.scene.camera=this.perspectiveCamera,this.perspectiveCamera.position.copy(e),this.perspectiveCamera.lookAt(t),this.engine.controlModule.orbitControls.object=this.perspectiveCamera,this.engine.controlModule.firstPersonControls.camera=this.perspectiveCamera,this.engine.composerModule.init()}switchToOrthographicCamera(){const e=this.engine.camera.position.clone(),t=this.engine.controls.target.clone();this.engine.camera=this.orthographicCamera,this.engine.scene.camera=this.orthographicCamera,this.orthographicCamera.position.copy(e),this.orthographicCamera.lookAt(t),this.engine.controlModule.orbitControls.object=this.orthographicCamera,this.engine.controlModule.firstPersonControls.camera=this.orthographicCamera,this.engine.composerModule.init()}getCameraType(){return this.engine.camera===this.perspectiveCamera?"perspective":this.engine.camera===this.orthographicCamera?"orthographic":"perspective"}getCameraPose(){const e=this.engine.camera,t=this.getCameraType(),n={type:t,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x,y:e.rotation.y,z:e.rotation.z},quaternion:{x:e.quaternion.x,y:e.quaternion.y,z:e.quaternion.z,w:e.quaternion.w}};return this.engine.controls&&this.engine.controls.target&&(n.target={x:this.engine.controls.target.x,y:this.engine.controls.target.y,z:this.engine.controls.target.z}),t==="orthographic"&&(n.zoom=e.zoom),n}restoreCameraPose(e){this.getCameraType()!==e.type&&(e.type==="perspective"?this.switchToPerspectiveCamera():this.switchToOrthographicCamera());const t=this.engine.camera;t.position.set(e.position.x,e.position.y,e.position.z),e.quaternion?t.quaternion.set(e.quaternion.x,e.quaternion.y,e.quaternion.z,e.quaternion.w):e.rotation&&t.rotation.set(e.rotation.x,e.rotation.y,e.rotation.z),e.target&&this.engine.controls&&this.engine.controls.target&&this.engine.controls.target.set(e.target.x,e.target.y,e.target.z),e.type==="orthographic"&&e.zoom!==void 0&&(t.zoom=e.zoom,t.updateProjectionMatrix()),t.updateMatrix(),t.updateMatrixWorld(!0),this.engine.controls&&this.engine.controls.update&&this.engine.controls.update()}}class Px{engine;deviceType;constructor(e){this.engine=e,this.deviceType="PC"}getDeviceType(){return this.deviceType}getContainerSize(){return{width:this.engine.container.clientWidth,height:this.engine.container.clientHeight}}}class Rx{engine;renderer;constructor(e){this.engine=e,this.renderer=null}createRenderer(){const{width:e,height:t}=this.engine.deviceModule.getContainerSize();return this.renderer=new Yu({antialias:this.engine.options.antialias??!0,alpha:!0,premultipliedAlpha:!1}),this.renderer.setClearColor(0,0),this.renderer.setSize(e,t),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=Uc,this.renderer.localClippingEnabled=!0,this.renderer.outputColorSpace=ft,this.renderer.toneMapping=Mr,this.renderer.toneMappingExposure=1.5,this.engine.container.appendChild(this.renderer.domElement),this.renderer}disposeRenderer(){this.renderer?.dispose()}}const Ku={type:"change"},ic={type:"start"},$u={type:"end"},xa=new ns,Ju=new St,Lx=Math.cos(70*ih.DEG2RAD),Bt=new R,rn=2*Math.PI,ut={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},sc=1e-6;class Dx extends ug{constructor(e,t,n=null){super(t,n),this.engine=e,this.state=ut.NONE,this.target=new R,this.cursor=new R,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Vi.ROTATE,MIDDLE:Vi.DOLLY,RIGHT:Vi.PAN},this.touches={ONE:Gi.ROTATE,TWO:Gi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new R,this._lastQuaternion=new En,this._lastTargetPosition=new R,this._quat=new En().setFromUnitVectors(t.up,new R(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new _u,this._sphericalDelta=new _u,this._scale=1,this._panOffset=new R,this._rotateStart=new de,this._rotateEnd=new de,this._rotateDelta=new de,this._panStart=new de,this._panEnd=new de,this._panDelta=new de,this._dollyStart=new de,this._dollyEnd=new de,this._dollyDelta=new de,this._dollyDirection=new R,this._mouse=new de,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Nx.bind(this),this._onPointerDown=Ix.bind(this),this._onPointerUp=Ux.bind(this),this._onContextMenu=Vx.bind(this),this._onMouseWheel=Ox.bind(this),this._onKeyDown=Fx.bind(this),this._onTouchStart=zx.bind(this),this._onTouchMove=Hx.bind(this),this._onMouseDown=Bx.bind(this),this._onMouseMove=kx.bind(this),this._interceptControlDown=Gx.bind(this),this._interceptControlUp=Wx.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Ku),this.update(),this.state=ut.NONE}update(e=null){const t=this.object.position;Bt.copy(t).sub(this.target),Bt.applyQuaternion(this._quat),this._spherical.setFromVector3(Bt),this.autoRotate&&this.state===ut.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=rn:n>Math.PI&&(n-=rn),i<-Math.PI?i+=rn:i>Math.PI&&(i-=rn),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=a!=this._spherical.radius}if(Bt.setFromSpherical(this._spherical),Bt.applyQuaternion(this._quatInverse),t.copy(this.target).add(Bt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=Bt.length();a=this._clampDistance(o*this._scale);const l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),r=!!l}else if(this.object.isOrthographicCamera){const o=new R(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=l!==this.object.zoom;const c=new R(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=Bt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(xa.origin.copy(this.object.position),xa.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(xa.direction))<Lx?this.object.lookAt(this.target):(Ju.setFromNormalAndCoplanarPoint(this.object.up,this.target),xa.intersectPlane(Ju,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),r=!0)}return this._scale=1,this._performCursorZoom=!1,r||this._lastPosition.distanceToSquared(this.object.position)>sc||8*(1-this._lastQuaternion.dot(this.object.quaternion))>sc||this._lastTargetPosition.distanceToSquared(this.target)>sc?(this.dispatchEvent(Ku),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?rn/60*this.autoRotateSpeed*e:rn/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Bt.setFromMatrixColumn(t,0),Bt.multiplyScalar(-e),this._panOffset.add(Bt)}_panUp(e,t){this.screenSpacePanning===!0?Bt.setFromMatrixColumn(t,1):(Bt.setFromMatrixColumn(t,0),Bt.crossVectors(this.object.up,Bt)),Bt.multiplyScalar(e),this._panOffset.add(Bt)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;Bt.copy(i).sub(this.target);let r=Bt.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*r/n.clientHeight,this.object.matrix),this._panUp(2*t*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=e-n.left,r=t-n.top,a=n.width,o=n.height;this._mouse.x=i/a*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(rn*this._rotateDelta.x/t.clientHeight),this._rotateUp(rn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(rn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-rn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(rn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-rn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateEnd.set(i,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(rn*this._rotateDelta.x/t.clientHeight),this._rotateUp(rn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new de,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function Ix(s){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(s.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(s)&&(this._addPointer(s),s.pointerType==="touch"?this._onTouchStart(s):this._onMouseDown(s)))}function Nx(s){this.enabled!==!1&&(s.pointerType==="touch"?this._onTouchMove(s):this._onMouseMove(s))}function Ux(s){switch(this._removePointer(s),this._pointers.length){case 0:this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent($u),this.state=ut.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function Bx(s){let e;switch(s.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Vi.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(s),this.state=ut.DOLLY;break;case Vi.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=ut.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=ut.ROTATE}break;case Vi.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(s),this.state=ut.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(s),this.state=ut.PAN}break;default:this.state=ut.NONE}this.state!==ut.NONE&&this.dispatchEvent(ic)}function kx(s){switch(this.state){case ut.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(s);break;case ut.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(s);break;case ut.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(s);break}}function Ox(s){this.enabled===!1||this.enableZoom===!1||this.state!==ut.NONE||(s.preventDefault(),this.dispatchEvent(ic),this._handleMouseWheel(this._customWheelEvent(s)),this.dispatchEvent($u))}function Fx(s){this.enabled!==!1&&this._handleKeyDown(s)}function zx(s){switch(this._trackPointer(s),this._pointers.length){case 1:switch(this.touches.ONE){case Gi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(s),this.state=ut.TOUCH_ROTATE;break;case Gi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(s),this.state=ut.TOUCH_PAN;break;default:this.state=ut.NONE}break;case 2:switch(this.touches.TWO){case Gi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(s),this.state=ut.TOUCH_DOLLY_PAN;break;case Gi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(s),this.state=ut.TOUCH_DOLLY_ROTATE;break;default:this.state=ut.NONE}break;default:this.state=ut.NONE}this.state!==ut.NONE&&this.dispatchEvent(ic)}function Hx(s){switch(this._trackPointer(s),this.state){case ut.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(s),this.update();break;case ut.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(s),this.update();break;case ut.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(s),this.update();break;case ut.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(s),this.update();break;default:this.state=ut.NONE}}function Vx(s){this.enabled!==!1&&s.preventDefault()}function Gx(s){s.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Wx(s){s.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class Qu{constructor(e,t,n,i){this._Engine=e,this.camera=t,this.domElement=n,this._isEnabled=!1,this._rayOriginOffset=new R(0,-1,0),this._camerLocalDirection=new R,this._tmpVector=new R,this._rayCaster=new ar,this._fallingTime=0,this._euler=new sn(0,0,0,"YZX"),this._prevMouseX=0,this._prevMouseY=0,this.applyGravity=!1,this.gravityMinHeight=!0,this.applyCollision=!0,this.positionEasing=!0,this.lookflag=1,this.lookSpeed=.008,this.moveSpeed=.02,this.playerHeight=1.4,this.maxRotateX=.8,this.g=9.8,this.bindmousedown=this._Engine&&this._Engine.DeviceType!=="PC"?this.onTouchStart.bind(this):this.onMouseDown.bind(this),this.bindmouseup=this._Engine&&this._Engine.DeviceType!=="PC"?this.onTouchEnd.bind(this):this.onMouseUp.bind(this),this.bindmousemove=this._Engine&&this._Engine.DeviceType!=="PC"?this.onTouchMove.bind(this):this.onMouseMove.bind(this),this.bindonKeyDown=this.onKeyDown.bind(this),this.bindonKeyUp=this.onKeyUp.bind(this),this.bindMousewheel=this.onMousewheel.bind(this),this.needMousewheel=!1,this.moveWheelRun=!0,this.moveWheelStop=!1,this.wheelClock,this.keydown=!1,this.GetEngine=()=>e}set colliders(e){this._rayCastObjects=e}set enabled(e){this._isEnabled!==e&&(this._isEnabled=e,this._euler.setFromQuaternion(this.camera.quaternion),e?this.addEvents():this.removeEvents())}get enabled(){return this._isEnabled}addEvents(){const e=this._Engine?.DeviceType,t=e==="PC"||!e;console.log("[FirstPersonCameraControl] addEvents - DeviceType:",e,"isPC:",t),t?(console.log("[FirstPersonCameraControl] 添加鼠标事件监听器 - mousedown, mouseup"),this.domElement.addEventListener("mousedown",this.bindmousedown,!1),this.domElement.addEventListener("mouseup",this.bindmouseup,!1)):(console.log("[FirstPersonCameraControl] 添加触摸事件监听器"),this.domElement.addEventListener("touchstart",this.bindmousedown,!1),this.domElement.addEventListener("touchend",this.bindmouseup,!1)),window.addEventListener("keydown",this.bindonKeyDown,!1),window.addEventListener("keyup",this.bindonKeyUp,!1),this.needMousewheel&&(document.addEventListener&&document.addEventListener("DOMMouseScroll",this.bindMousewheel,!1),window.addEventListener("mousewheel",this.bindMousewheel,!1))}removeEvents(){this._Engine&&this._Engine.DeviceType!=="PC"?(this.domElement.removeEventListener("touchstart",this.bindmousedown),this.domElement.removeEventListener("touchend",this.bindmouseup),this.domElement.removeEventListener("touchmove",this.bindmousemove)):(this.domElement.removeEventListener("mousedown",this.bindmousedown),this.domElement.removeEventListener("mouseup",this.bindmouseup),this.domElement.removeEventListener("mousemove",this.bindmousemove)),window.removeEventListener("keydown",this.bindonKeyDown),window.removeEventListener("keyup",this.bindonKeyUp),this.needMousewheel&&(document.addEventListener&&document.removeEventListener("DOMMouseScroll",this.bindMousewheel),window.removeEventListener("mousewheel",this.bindMousewheel))}onMousewheel(e){debugger;let t;switch(e.wheelDelta?(e.wheelDelta>0&&(t="up"),e.wheelDelta<0&&(t="down")):e.detail&&(e.detail<0&&(t="up"),e.detail>0&&(t="down")),t){case"up":this._camerLocalDirection.z=1;break;case"down":this._camerLocalDirection.z=-1;break}this.moveWheelRun==!0?(this.moveWheelRun=!1,this.moveWheelStop=!0,this.wheelClock=setTimeout(()=>{this.moveWheelStop==!0&&(this.moveWheelStop=!1,this.moveWheelRun=!0,this._camerLocalDirection.z=0)},200)):(clearTimeout(this.wheelClock),this.wheelClock=setTimeout(()=>{this.moveWheelStop==!0&&(this.moveWheelStop=!1,this.moveWheelRun=!0,this._camerLocalDirection.z=0)},150))}onMouseDown(e){console.log("[FirstPersonCameraControl] onMouseDown 被调用",e),this.domElement.addEventListener("mousemove",this.bindmousemove,!1),this._prevMouseX=e.screenX,this._prevMouseY=e.screenY}onMouseMove(e){if(this._isEnabled==!1)return;let t=this._prevMouseX?e.screenX-this._prevMouseX:0,n=this._prevMouseY?e.screenY-this._prevMouseY:0,i=this._euler.x-n*this.lookflag*this.lookSpeed;i>=0?i<this.maxRotateX?this._euler.x=i:this._euler.x=this.maxRotateX:i>-this.maxRotateX?this._euler.x=i:this._euler.x=-this.maxRotateX,this._euler.y-=t*this.lookSpeed,this.camera.quaternion.setFromEuler(this._euler),this._prevMouseX=e.screenX,this._prevMouseY=e.screenY;let r=this.GetEngine();r.movefirst=!0;var a=new CustomEvent("bimengine:camerachange",{detail:""});window.dispatchEvent(a)}onMouseUp(e){let t=this.GetEngine();t.movefirst=!1,this.domElement.removeEventListener("mousemove",this.bindmousemove)}onTouchStart(e){this.domElement.addEventListener("touchmove",this.bindmousemove,!1),this._prevMouseX=e.targetTouches[0].clientX,this._prevMouseY=e.targetTouches[0].clientY}onTouchMove(e){if(this._isEnabled==!1)return;let t=this._prevMouseX?e.targetTouches[0].clientX-this._prevMouseX:0,n=this._prevMouseY?e.targetTouches[0].clientY-this._prevMouseY:0,i=this._euler.x-n*this.lookflag*this.lookSpeed;i>=0?i<this.maxRotateX?this._euler.x=i:this._euler.x=this.maxRotateX:i>-this.maxRotateX?this._euler.x=i:this._euler.x=-this.maxRotateX,this._euler.y-=t*this.lookSpeed,this.camera.quaternion.setFromEuler(this._euler),this._prevMouseX=e.targetTouches[0].clientX,this._prevMouseY=e.targetTouches[0].clientY;let r=this.GetEngine();r.movefirst=!0;var a=new CustomEvent("bimengine:camerachange",{detail:""});window.dispatchEvent(a)}onTouchEnd(e){let t=this.GetEngine();t.movefirst=!1,this.domElement.removeEventListener("touchmove",this.bindmousemove)}onKeyDown(e){var t=new CustomEvent("bimengine:camerachange",{detail:""});let n=this.GetEngine();switch(n.movefirst=!0,window.dispatchEvent(t),e.keyCode){case 38:this.rotateY(-1);break;case 81:this.keydown=!0,this._camerLocalDirection.y=1;break;case 69:this._camerLocalDirection.y=-1;break;case 87:this._camerLocalDirection.z=1;break;case 37:this.rotateX(-1);break;case 65:this._camerLocalDirection.x=-1;break;case 40:this.rotateY(1);break;case 83:this._camerLocalDirection.z=-1;break;case 39:this.rotateX(1);break;case 68:this._camerLocalDirection.x=1;break}}onKeyUp(e){let t=this.GetEngine();switch(t.movefirst=!1,e.keyCode){case 38:case 87:this._camerLocalDirection.z=0;break;case 37:case 65:this._camerLocalDirection.x=0;break;case 40:case 83:this._camerLocalDirection.z=0;break;case 39:case 68:this._camerLocalDirection.x=0;break;case 81:case 69:this.keydown=!1,this._camerLocalDirection.y=0;break}}rotateX(e){this._euler.y-=e*this.lookSpeed,this.camera.quaternion.setFromEuler(this._euler)}rotateY(e){let t=this._euler.x-e*this.lookflag*.5*this.lookSpeed;t>=0?t<this.maxRotateX?this._euler.x=t:this._euler.x=this.maxRotateX:t>-this.maxRotateX?this._euler.x=t:this._euler.x=-this.maxRotateX,this.camera.quaternion.setFromEuler(this._euler)}update(){this.keydown||this.gravityTest(),this.collisionTest()}gravityTest(){if(this.applyGravity){let e=!0;this._fallingTime+=.01,this._tmpVector.set(0,-1,0);const t=this.hitTest();if(t){const n=t.point.add(new R(0,this.playerHeight,0));if(this.positionEasing){if(n.y>=this.camera.position.y||n.y-this.camera.position.y<.2){this.setCameraHeight(this.camera.position.y+(n.y-this.camera.position.y)*.08),this._fallingTime=0,e=!1;return}}else t.distance<this.playerHeight&&(this.setCameraHeight(n.y),this._fallingTime=0,e=!1)}e&&this.setCameraHeight(this.camera.position.y-this.g*Math.pow(this._fallingTime,2))}else this.setCameraHeight(this.camera.position.y)}collisionTest(){this._camerLocalDirection.x!==0&&this.collisionTestX(),this._camerLocalDirection.z!==0&&this.collisionTestZ(),this._camerLocalDirection.y!==0&&this.collisionTestY()}collisionTestX(){let e=this.GetEngine();if(e.movefirst=!0,this._tmpVector.setFromMatrixColumn(this.camera.matrix,0),this._tmpVector.multiplyScalar(this._camerLocalDirection.x),this.applyCollision){const t=this.hitTest();if(t&&t.distance<.3)return}this.camera.position.addScaledVector(this._tmpVector,this.moveSpeed)}collisionTestZ(){let e=this.GetEngine();if(e.movefirst=!0,this._tmpVector.setFromMatrixColumn(this.camera.matrix,0),this._tmpVector.crossVectors(this.camera.up,this._tmpVector),this._tmpVector.multiplyScalar(this._camerLocalDirection.z),this.applyCollision){const t=this.hitTest();if(t&&t.distance<.3)return}this.camera.position.addScaledVector(this._tmpVector,this.moveSpeed)}collisionTestY(){let e=this.GetEngine();if(e.movefirst=!0,this._tmpVector.setFromMatrixColumn(this.camera.matrix,0),this._tmpVector=new R(0,1,0),this._tmpVector.multiplyScalar(this._camerLocalDirection.y),this.applyCollision){const n=this.hitTest();if(n&&n.distance<.3)return}let t=this.camera.position.clone().addScaledVector(this._tmpVector,this.moveSpeed);this.setCameraHeight(t.y)}setCameraHeight(e){let t=this.getMinHeight();this.gravityMinHeight&&t!==void 0&&e<t?this.camera.position.y=t:this.camera.position.y=e}getMinHeight(){let e,t=this.GetEngine(),n=t.ToolUntils?t.ToolUntils.GetBoundingBox(t):null;return t&&n&&(e=n.min.y),e}hitTest(){const e=this.camera.position.clone().add(this._rayOriginOffset);this._rayCaster.ray.origin=e,this._rayCaster.ray.direction=this._tmpVector;var t=this.GetEngine().scene.ground;return t&&t.material.type,null}}class Xx{engine;orbitControls;firstPersonControls;isActive=!0;constructor(e){this.engine=e,this.init()}init(){this.orbitControls=new Dx(this.engine,this.engine.camera,this.engine.renderer.domElement),this.firstPersonControls=new Qu(this.engine,this.engine.camera,this.engine.renderer.domElement)}active(){this.isActive=!0,this.orbitControls.enabled=!0}disActive(){this.isActive=!1,this.orbitControls.enabled=!1}switchFirstPersonMode(){this.firstPersonControls=new Qu(this.engine,this.engine.camera,this.engine.renderer.domElement,[]),this.orbitControls.enabled=!1,this.firstPersonControls.enabled=!0,this.firstPersonControls.isActive=!0}switchDefaultMode(){this.firstPersonControls&&(this.firstPersonControls.enabled=!1),this.orbitControls.enabled=!0}update(){this.firstPersonControls.enabled&&this.firstPersonControls.update()}}const Di={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
uniform float opacity;
|
||
|
||
uniform sampler2D tDiffuse;
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vec4 texel = texture2D( tDiffuse, vUv );
|
||
gl_FragColor = opacity * texel;
|
||
|
||
|
||
}`};class Ii{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const jx=new gi(-1,1,1,-1,0,1);class Zx extends gt{constructor(){super(),this.setAttribute("position",new Kt([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Kt([0,2,0,0,2,0],2))}}const qx=new Zx;class _a{constructor(e){this._mesh=new bt(qx,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,jx)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class ba extends Ii{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof Rt?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Hn.clone(e.uniforms),this.material=new Rt({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new _a(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class ed extends Ii{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const i=e.getContext(),r=e.state;r.buffers.color.setMask(!1),r.buffers.depth.setMask(!1),r.buffers.color.setLocked(!0),r.buffers.depth.setLocked(!0);let a,o;this.inverse?(a=0,o=1):(a=1,o=0),r.buffers.stencil.setTest(!0),r.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),r.buffers.stencil.setFunc(i.ALWAYS,a,4294967295),r.buffers.stencil.setClear(o),r.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),r.buffers.color.setLocked(!1),r.buffers.depth.setLocked(!1),r.buffers.color.setMask(!0),r.buffers.depth.setMask(!0),r.buffers.stencil.setLocked(!1),r.buffers.stencil.setFunc(i.EQUAL,1,4294967295),r.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),r.buffers.stencil.setLocked(!0)}}class Yx extends Ii{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class Kx{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new de);this._width=n.width,this._height=n.height,t=new Wt(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Yt}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new ba(Di),this.copyPass.material.blending=kt,this.clock=new tg}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let i=0,r=this.passes.length;i<r;i++){const a=this.passes[i];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(i),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),a.needsSwap){if(n){const o=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(o.EQUAL,1,4294967295)}this.swapBuffers()}ed!==void 0&&(a instanceof ed?n=!0:a instanceof Yx&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new de);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(n,i),this.renderTarget2.setSize(n,i);for(let r=0;r<this.passes.length;r++)this.passes[r].setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class $x extends Ii{constructor(e,t,n=null,i=null,r=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=r,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new ke}render(e,t,n){const i=e.autoClear;e.autoClear=!1;let r,a;this.overrideMaterial!==null&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(r=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(r),this.overrideMaterial!==null&&(this.scene.overrideMaterial=a),e.autoClear=i}}const ya={defines:{PERSPECTIVE_CAMERA:1,SAMPLES:16,NORMAL_VECTOR_TYPE:1,DEPTH_SWIZZLING:"x",SCREEN_SPACE_RADIUS:0,SCREEN_SPACE_RADIUS_SCALE:100,SCENE_CLIP_BOX:0},uniforms:{tNormal:{value:null},tDepth:{value:null},tNoise:{value:null},resolution:{value:new de},cameraNear:{value:null},cameraFar:{value:null},cameraProjectionMatrix:{value:new je},cameraProjectionMatrixInverse:{value:new je},cameraWorldMatrix:{value:new je},radius:{value:.25},distanceExponent:{value:1},thickness:{value:1},distanceFallOff:{value:1},scale:{value:1},sceneBoxMin:{value:new R(-1,-1,-1)},sceneBoxMax:{value:new R(1,1,1)}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`
|
||
varying vec2 vUv;
|
||
uniform highp sampler2D tNormal;
|
||
uniform highp sampler2D tDepth;
|
||
uniform sampler2D tNoise;
|
||
uniform vec2 resolution;
|
||
uniform float cameraNear;
|
||
uniform float cameraFar;
|
||
uniform mat4 cameraProjectionMatrix;
|
||
uniform mat4 cameraProjectionMatrixInverse;
|
||
uniform mat4 cameraWorldMatrix;
|
||
uniform float radius;
|
||
uniform float distanceExponent;
|
||
uniform float thickness;
|
||
uniform float distanceFallOff;
|
||
uniform float scale;
|
||
#if SCENE_CLIP_BOX == 1
|
||
uniform vec3 sceneBoxMin;
|
||
uniform vec3 sceneBoxMax;
|
||
#endif
|
||
|
||
#include <common>
|
||
#include <packing>
|
||
|
||
#ifndef FRAGMENT_OUTPUT
|
||
#define FRAGMENT_OUTPUT vec4(vec3(ao), 1.)
|
||
#endif
|
||
|
||
vec3 getViewPosition(const in vec2 screenPosition, const in float depth) {
|
||
vec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0);
|
||
vec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition;
|
||
return viewSpacePosition.xyz / viewSpacePosition.w;
|
||
}
|
||
|
||
float getDepth(const vec2 uv) {
|
||
return textureLod(tDepth, uv.xy, 0.0).DEPTH_SWIZZLING;
|
||
}
|
||
|
||
float fetchDepth(const ivec2 uv) {
|
||
return texelFetch(tDepth, uv.xy, 0).DEPTH_SWIZZLING;
|
||
}
|
||
|
||
float getViewZ(const in float depth) {
|
||
#if PERSPECTIVE_CAMERA == 1
|
||
return perspectiveDepthToViewZ(depth, cameraNear, cameraFar);
|
||
#else
|
||
return orthographicDepthToViewZ(depth, cameraNear, cameraFar);
|
||
#endif
|
||
}
|
||
|
||
vec3 computeNormalFromDepth(const vec2 uv) {
|
||
vec2 size = vec2(textureSize(tDepth, 0));
|
||
ivec2 p = ivec2(uv * size);
|
||
float c0 = fetchDepth(p);
|
||
float l2 = fetchDepth(p - ivec2(2, 0));
|
||
float l1 = fetchDepth(p - ivec2(1, 0));
|
||
float r1 = fetchDepth(p + ivec2(1, 0));
|
||
float r2 = fetchDepth(p + ivec2(2, 0));
|
||
float b2 = fetchDepth(p - ivec2(0, 2));
|
||
float b1 = fetchDepth(p - ivec2(0, 1));
|
||
float t1 = fetchDepth(p + ivec2(0, 1));
|
||
float t2 = fetchDepth(p + ivec2(0, 2));
|
||
float dl = abs((2.0 * l1 - l2) - c0);
|
||
float dr = abs((2.0 * r1 - r2) - c0);
|
||
float db = abs((2.0 * b1 - b2) - c0);
|
||
float dt = abs((2.0 * t1 - t2) - c0);
|
||
vec3 ce = getViewPosition(uv, c0).xyz;
|
||
vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;
|
||
vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;
|
||
return normalize(cross(dpdx, dpdy));
|
||
}
|
||
|
||
vec3 getViewNormal(const vec2 uv) {
|
||
#if NORMAL_VECTOR_TYPE == 2
|
||
return normalize(textureLod(tNormal, uv, 0.).rgb);
|
||
#elif NORMAL_VECTOR_TYPE == 1
|
||
return unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb);
|
||
#else
|
||
return computeNormalFromDepth(uv);
|
||
#endif
|
||
}
|
||
|
||
vec3 getSceneUvAndDepth(vec3 sampleViewPos) {
|
||
vec4 sampleClipPos = cameraProjectionMatrix * vec4(sampleViewPos, 1.);
|
||
vec2 sampleUv = sampleClipPos.xy / sampleClipPos.w * 0.5 + 0.5;
|
||
float sampleSceneDepth = getDepth(sampleUv);
|
||
return vec3(sampleUv, sampleSceneDepth);
|
||
}
|
||
|
||
void main() {
|
||
float depth = getDepth(vUv.xy);
|
||
if (depth >= 1.0) {
|
||
discard;
|
||
return;
|
||
}
|
||
vec3 viewPos = getViewPosition(vUv, depth);
|
||
vec3 viewNormal = getViewNormal(vUv);
|
||
|
||
float radiusToUse = radius;
|
||
float distanceFalloffToUse = thickness;
|
||
#if SCREEN_SPACE_RADIUS == 1
|
||
float radiusScale = getViewPosition(vec2(0.5 + float(SCREEN_SPACE_RADIUS_SCALE) / resolution.x, 0.0), depth).x;
|
||
radiusToUse *= radiusScale;
|
||
distanceFalloffToUse *= radiusScale;
|
||
#endif
|
||
|
||
#if SCENE_CLIP_BOX == 1
|
||
vec3 worldPos = (cameraWorldMatrix * vec4(viewPos, 1.0)).xyz;
|
||
float boxDistance = length(max(vec3(0.0), max(sceneBoxMin - worldPos, worldPos - sceneBoxMax)));
|
||
if (boxDistance > radiusToUse) {
|
||
discard;
|
||
return;
|
||
}
|
||
#endif
|
||
|
||
vec2 noiseResolution = vec2(textureSize(tNoise, 0));
|
||
vec2 noiseUv = vUv * resolution / noiseResolution;
|
||
vec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0);
|
||
vec3 randomVec = noiseTexel.xyz * 2.0 - 1.0;
|
||
vec3 tangent = normalize(vec3(randomVec.xy, 0.));
|
||
vec3 bitangent = vec3(-tangent.y, tangent.x, 0.);
|
||
mat3 kernelMatrix = mat3(tangent, bitangent, vec3(0., 0., 1.));
|
||
|
||
const int DIRECTIONS = SAMPLES < 30 ? 3 : 5;
|
||
const int STEPS = (SAMPLES + DIRECTIONS - 1) / DIRECTIONS;
|
||
float ao = 0.0;
|
||
for (int i = 0; i < DIRECTIONS; ++i) {
|
||
|
||
float angle = float(i) / float(DIRECTIONS) * PI;
|
||
vec4 sampleDir = vec4(cos(angle), sin(angle), 0., 0.5 + 0.5 * noiseTexel.w);
|
||
sampleDir.xyz = normalize(kernelMatrix * sampleDir.xyz);
|
||
|
||
vec3 viewDir = normalize(-viewPos.xyz);
|
||
vec3 sliceBitangent = normalize(cross(sampleDir.xyz, viewDir));
|
||
vec3 sliceTangent = cross(sliceBitangent, viewDir);
|
||
vec3 normalInSlice = normalize(viewNormal - sliceBitangent * dot(viewNormal, sliceBitangent));
|
||
|
||
vec3 tangentToNormalInSlice = cross(normalInSlice, sliceBitangent);
|
||
vec2 cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice), dot(viewDir, -tangentToNormalInSlice));
|
||
|
||
for (int j = 0; j < STEPS; ++j) {
|
||
vec3 sampleViewOffset = sampleDir.xyz * radiusToUse * sampleDir.w * pow(float(j + 1) / float(STEPS), distanceExponent);
|
||
|
||
vec3 sampleSceneUvDepth = getSceneUvAndDepth(viewPos + sampleViewOffset);
|
||
vec3 sampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z);
|
||
vec3 viewDelta = sampleSceneViewPos - viewPos;
|
||
if (abs(viewDelta.z) < thickness) {
|
||
float sampleCosHorizon = dot(viewDir, normalize(viewDelta));
|
||
cosHorizons.x += max(0., (sampleCosHorizon - cosHorizons.x) * mix(1., 2. / float(j + 2), distanceFallOff));
|
||
}
|
||
|
||
sampleSceneUvDepth = getSceneUvAndDepth(viewPos - sampleViewOffset);
|
||
sampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z);
|
||
viewDelta = sampleSceneViewPos - viewPos;
|
||
if (abs(viewDelta.z) < thickness) {
|
||
float sampleCosHorizon = dot(viewDir, normalize(viewDelta));
|
||
cosHorizons.y += max(0., (sampleCosHorizon - cosHorizons.y) * mix(1., 2. / float(j + 2), distanceFallOff));
|
||
}
|
||
}
|
||
|
||
vec2 sinHorizons = sqrt(1. - cosHorizons * cosHorizons);
|
||
float nx = dot(normalInSlice, sliceTangent);
|
||
float ny = dot(normalInSlice, viewDir);
|
||
float nxb = 1. / 2. * (acos(cosHorizons.y) - acos(cosHorizons.x) + sinHorizons.x * cosHorizons.x - sinHorizons.y * cosHorizons.y);
|
||
float nyb = 1. / 2. * (2. - cosHorizons.x * cosHorizons.x - cosHorizons.y * cosHorizons.y);
|
||
float occlusion = nx * nxb + ny * nyb;
|
||
ao += occlusion;
|
||
}
|
||
|
||
ao = clamp(ao / float(DIRECTIONS), 0., 1.);
|
||
#if SCENE_CLIP_BOX == 1
|
||
ao = mix(ao, 1., smoothstep(0., radiusToUse, boxDistance));
|
||
#endif
|
||
ao = pow(ao, scale);
|
||
|
||
gl_FragColor = FRAGMENT_OUTPUT;
|
||
}`},Ma={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:`
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`
|
||
uniform sampler2D tDepth;
|
||
uniform float cameraNear;
|
||
uniform float cameraFar;
|
||
varying vec2 vUv;
|
||
|
||
#include <packing>
|
||
|
||
float getLinearDepth( const in vec2 screenPosition ) {
|
||
#if PERSPECTIVE_CAMERA == 1
|
||
float fragCoordZ = texture2D( tDepth, screenPosition ).x;
|
||
float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );
|
||
return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );
|
||
#else
|
||
return texture2D( tDepth, screenPosition ).x;
|
||
#endif
|
||
}
|
||
|
||
void main() {
|
||
float depth = getLinearDepth( vUv );
|
||
gl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );
|
||
|
||
}`},rc={uniforms:{tDiffuse:{value:null},intensity:{value:1}},vertexShader:`
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`
|
||
uniform float intensity;
|
||
uniform sampler2D tDiffuse;
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
vec4 texel = texture2D( tDiffuse, vUv );
|
||
gl_FragColor = vec4(mix(vec3(1.), texel.rgb, intensity), texel.a);
|
||
}`};function Jx(s=5){const e=Math.floor(s)%2===0?Math.floor(s)+1:Math.floor(s),t=Qx(e),n=t.length,i=new Uint8Array(n*4);for(let a=0;a<n;++a){const o=t[a],l=2*Math.PI*o/n,c=new R(Math.cos(l),Math.sin(l),0).normalize();i[a*4]=(c.x*.5+.5)*255,i[a*4+1]=(c.y*.5+.5)*255,i[a*4+2]=127,i[a*4+3]=255}const r=new qs(i,e,e);return r.wrapS=Bn,r.wrapT=Bn,r.needsUpdate=!0,r}function Qx(s){const e=Math.floor(s)%2===0?Math.floor(s)+1:Math.floor(s),t=e*e,n=Array(t).fill(0);let i=Math.floor(e/2),r=e-1;for(let a=1;a<=t;){if(i===-1&&r===e?(r=e-2,i=0):(r===e&&(r=0),i<0&&(i=e-1)),n[i*e+r]!==0){r-=2,i++;continue}else n[i*e+r]=a++;r++,i--}return n}const wa={defines:{SAMPLES:16,SAMPLE_VECTORS:td(16,2,1),NORMAL_VECTOR_TYPE:1,DEPTH_VALUE_SOURCE:0},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tDepth:{value:null},tNoise:{value:null},resolution:{value:new de},cameraProjectionMatrixInverse:{value:new je},lumaPhi:{value:5},depthPhi:{value:5},normalPhi:{value:5},radius:{value:4},index:{value:0}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
uniform sampler2D tDiffuse;
|
||
uniform sampler2D tNormal;
|
||
uniform sampler2D tDepth;
|
||
uniform sampler2D tNoise;
|
||
uniform vec2 resolution;
|
||
uniform mat4 cameraProjectionMatrixInverse;
|
||
uniform float lumaPhi;
|
||
uniform float depthPhi;
|
||
uniform float normalPhi;
|
||
uniform float radius;
|
||
uniform int index;
|
||
|
||
#include <common>
|
||
#include <packing>
|
||
|
||
#ifndef SAMPLE_LUMINANCE
|
||
#define SAMPLE_LUMINANCE dot(vec3(0.2125, 0.7154, 0.0721), a)
|
||
#endif
|
||
|
||
#ifndef FRAGMENT_OUTPUT
|
||
#define FRAGMENT_OUTPUT vec4(denoised, 1.)
|
||
#endif
|
||
|
||
float getLuminance(const in vec3 a) {
|
||
return SAMPLE_LUMINANCE;
|
||
}
|
||
|
||
const vec3 poissonDisk[SAMPLES] = SAMPLE_VECTORS;
|
||
|
||
vec3 getViewPosition(const in vec2 screenPosition, const in float depth) {
|
||
vec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0);
|
||
vec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition;
|
||
return viewSpacePosition.xyz / viewSpacePosition.w;
|
||
}
|
||
|
||
float getDepth(const vec2 uv) {
|
||
#if DEPTH_VALUE_SOURCE == 1
|
||
return textureLod(tDepth, uv.xy, 0.0).a;
|
||
#else
|
||
return textureLod(tDepth, uv.xy, 0.0).r;
|
||
#endif
|
||
}
|
||
|
||
float fetchDepth(const ivec2 uv) {
|
||
#if DEPTH_VALUE_SOURCE == 1
|
||
return texelFetch(tDepth, uv.xy, 0).a;
|
||
#else
|
||
return texelFetch(tDepth, uv.xy, 0).r;
|
||
#endif
|
||
}
|
||
|
||
vec3 computeNormalFromDepth(const vec2 uv) {
|
||
vec2 size = vec2(textureSize(tDepth, 0));
|
||
ivec2 p = ivec2(uv * size);
|
||
float c0 = fetchDepth(p);
|
||
float l2 = fetchDepth(p - ivec2(2, 0));
|
||
float l1 = fetchDepth(p - ivec2(1, 0));
|
||
float r1 = fetchDepth(p + ivec2(1, 0));
|
||
float r2 = fetchDepth(p + ivec2(2, 0));
|
||
float b2 = fetchDepth(p - ivec2(0, 2));
|
||
float b1 = fetchDepth(p - ivec2(0, 1));
|
||
float t1 = fetchDepth(p + ivec2(0, 1));
|
||
float t2 = fetchDepth(p + ivec2(0, 2));
|
||
float dl = abs((2.0 * l1 - l2) - c0);
|
||
float dr = abs((2.0 * r1 - r2) - c0);
|
||
float db = abs((2.0 * b1 - b2) - c0);
|
||
float dt = abs((2.0 * t1 - t2) - c0);
|
||
vec3 ce = getViewPosition(uv, c0).xyz;
|
||
vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz
|
||
: -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;
|
||
vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz
|
||
: -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;
|
||
return normalize(cross(dpdx, dpdy));
|
||
}
|
||
|
||
vec3 getViewNormal(const vec2 uv) {
|
||
#if NORMAL_VECTOR_TYPE == 2
|
||
return normalize(textureLod(tNormal, uv, 0.).rgb);
|
||
#elif NORMAL_VECTOR_TYPE == 1
|
||
return unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb);
|
||
#else
|
||
return computeNormalFromDepth(uv);
|
||
#endif
|
||
}
|
||
|
||
void denoiseSample(in vec3 center, in vec3 viewNormal, in vec3 viewPos, in vec2 sampleUv, inout vec3 denoised, inout float totalWeight) {
|
||
vec4 sampleTexel = textureLod(tDiffuse, sampleUv, 0.0);
|
||
float sampleDepth = getDepth(sampleUv);
|
||
vec3 sampleNormal = getViewNormal(sampleUv);
|
||
vec3 neighborColor = sampleTexel.rgb;
|
||
vec3 viewPosSample = getViewPosition(sampleUv, sampleDepth);
|
||
|
||
float normalDiff = dot(viewNormal, sampleNormal);
|
||
float normalSimilarity = pow(max(normalDiff, 0.), normalPhi);
|
||
float lumaDiff = abs(getLuminance(neighborColor) - getLuminance(center));
|
||
float lumaSimilarity = max(1.0 - lumaDiff / lumaPhi, 0.0);
|
||
float depthDiff = abs(dot(viewPos - viewPosSample, viewNormal));
|
||
float depthSimilarity = max(1. - depthDiff / depthPhi, 0.);
|
||
float w = lumaSimilarity * depthSimilarity * normalSimilarity;
|
||
|
||
denoised += w * neighborColor;
|
||
totalWeight += w;
|
||
}
|
||
|
||
void main() {
|
||
float depth = getDepth(vUv.xy);
|
||
vec3 viewNormal = getViewNormal(vUv);
|
||
if (depth == 1. || dot(viewNormal, viewNormal) == 0.) {
|
||
discard;
|
||
return;
|
||
}
|
||
vec4 texel = textureLod(tDiffuse, vUv, 0.0);
|
||
vec3 center = texel.rgb;
|
||
vec3 viewPos = getViewPosition(vUv, depth);
|
||
|
||
vec2 noiseResolution = vec2(textureSize(tNoise, 0));
|
||
vec2 noiseUv = vUv * resolution / noiseResolution;
|
||
vec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0);
|
||
vec2 noiseVec = vec2(sin(noiseTexel[index % 4] * 2. * PI), cos(noiseTexel[index % 4] * 2. * PI));
|
||
mat2 rotationMatrix = mat2(noiseVec.x, -noiseVec.y, noiseVec.x, noiseVec.y);
|
||
|
||
float totalWeight = 1.0;
|
||
vec3 denoised = texel.rgb;
|
||
for (int i = 0; i < SAMPLES; i++) {
|
||
vec3 sampleDir = poissonDisk[i];
|
||
vec2 offset = rotationMatrix * (sampleDir.xy * (1. + sampleDir.z * (radius - 1.)) / resolution);
|
||
vec2 sampleUv = vUv + offset;
|
||
denoiseSample(center, viewNormal, viewPos, sampleUv, denoised, totalWeight);
|
||
}
|
||
|
||
if (totalWeight > 0.) {
|
||
denoised /= totalWeight;
|
||
}
|
||
gl_FragColor = FRAGMENT_OUTPUT;
|
||
}`};function td(s,e,t){const n=e_(s,e,t);let i="vec3[SAMPLES](";for(let r=0;r<s;r++){const a=n[r];i+=`vec3(${a.x}, ${a.y}, ${a.z})${r<s-1?",":")"}`}return i}function e_(s,e,t){const n=[];for(let i=0;i<s;i++){const r=2*Math.PI*e*i/s,a=Math.pow(i/(s-1),t);n.push(new R(Math.cos(r),Math.sin(r),a))}return n}class t_{constructor(e=Math){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.grad4=[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]],this.p=[];for(let t=0;t<256;t++)this.p[t]=Math.floor(e.random()*256);this.perm=[];for(let t=0;t<512;t++)this.perm[t]=this.p[t&255];this.simplex=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]}noise(e,t){let n,i,r;const a=.5*(Math.sqrt(3)-1),o=(e+t)*a,l=Math.floor(e+o),c=Math.floor(t+o),h=(3-Math.sqrt(3))/6,u=(l+c)*h,f=l-u,d=c-u,p=e-f,g=t-d;let v,m;p>g?(v=1,m=0):(v=0,m=1);const x=p-v+h,_=g-m+h,M=p-1+2*h,T=g-1+2*h,A=l&255,L=c&255,U=this.perm[A+this.perm[L]]%12,E=this.perm[A+v+this.perm[L+m]]%12,C=this.perm[A+1+this.perm[L+1]]%12;let k=.5-p*p-g*g;k<0?n=0:(k*=k,n=k*k*this._dot(this.grad3[U],p,g));let D=.5-x*x-_*_;D<0?i=0:(D*=D,i=D*D*this._dot(this.grad3[E],x,_));let B=.5-M*M-T*T;return B<0?r=0:(B*=B,r=B*B*this._dot(this.grad3[C],M,T)),70*(n+i+r)}noise3d(e,t,n){let i,r,a,o;const l=(e+t+n)*.3333333333333333,c=Math.floor(e+l),h=Math.floor(t+l),u=Math.floor(n+l),f=1/6,d=(c+h+u)*f,p=c-d,g=h-d,v=u-d,m=e-p,x=t-g,_=n-v;let M,T,A,L,U,E;m>=x?x>=_?(M=1,T=0,A=0,L=1,U=1,E=0):m>=_?(M=1,T=0,A=0,L=1,U=0,E=1):(M=0,T=0,A=1,L=1,U=0,E=1):x<_?(M=0,T=0,A=1,L=0,U=1,E=1):m<_?(M=0,T=1,A=0,L=0,U=1,E=1):(M=0,T=1,A=0,L=1,U=1,E=0);const C=m-M+f,k=x-T+f,D=_-A+f,B=m-L+2*f,w=x-U+2*f,F=_-E+2*f,q=m-1+3*f,z=x-1+3*f,te=_-1+3*f,K=c&255,le=h&255,W=u&255,j=this.perm[K+this.perm[le+this.perm[W]]]%12,me=this.perm[K+M+this.perm[le+T+this.perm[W+A]]]%12,ge=this.perm[K+L+this.perm[le+U+this.perm[W+E]]]%12,ue=this.perm[K+1+this.perm[le+1+this.perm[W+1]]]%12;let ie=.6-m*m-x*x-_*_;ie<0?i=0:(ie*=ie,i=ie*ie*this._dot3(this.grad3[j],m,x,_));let ce=.6-C*C-k*k-D*D;ce<0?r=0:(ce*=ce,r=ce*ce*this._dot3(this.grad3[me],C,k,D));let fe=.6-B*B-w*w-F*F;fe<0?a=0:(fe*=fe,a=fe*fe*this._dot3(this.grad3[ge],B,w,F));let be=.6-q*q-z*z-te*te;return be<0?o=0:(be*=be,o=be*be*this._dot3(this.grad3[ue],q,z,te)),32*(i+r+a+o)}noise4d(e,t,n,i){const r=this.grad4,a=this.simplex,o=this.perm,l=(Math.sqrt(5)-1)/4,c=(5-Math.sqrt(5))/20;let h,u,f,d,p;const g=(e+t+n+i)*l,v=Math.floor(e+g),m=Math.floor(t+g),x=Math.floor(n+g),_=Math.floor(i+g),M=(v+m+x+_)*c,T=v-M,A=m-M,L=x-M,U=_-M,E=e-T,C=t-A,k=n-L,D=i-U,B=E>C?32:0,w=E>k?16:0,F=C>k?8:0,q=E>D?4:0,z=C>D?2:0,te=k>D?1:0,K=B+w+F+q+z+te,le=a[K][0]>=3?1:0,W=a[K][1]>=3?1:0,j=a[K][2]>=3?1:0,me=a[K][3]>=3?1:0,ge=a[K][0]>=2?1:0,ue=a[K][1]>=2?1:0,ie=a[K][2]>=2?1:0,ce=a[K][3]>=2?1:0,fe=a[K][0]>=1?1:0,be=a[K][1]>=1?1:0,ye=a[K][2]>=1?1:0,Oe=a[K][3]>=1?1:0,Ke=E-le+c,Fe=C-W+c,b=k-j+c,X=D-me+c,H=E-ge+2*c,N=C-ue+2*c,y=k-ie+2*c,G=D-ce+2*c,$=E-fe+3*c,ne=C-be+3*c,V=k-ye+3*c,P=D-Oe+3*c,S=E-1+4*c,O=C-1+4*c,Y=k-1+4*c,oe=D-1+4*c,Q=v&255,Se=m&255,_e=x&255,Te=_&255,He=o[Q+o[Se+o[_e+o[Te]]]]%32,he=o[Q+le+o[Se+W+o[_e+j+o[Te+me]]]]%32,we=o[Q+ge+o[Se+ue+o[_e+ie+o[Te+ce]]]]%32,Ne=o[Q+fe+o[Se+be+o[_e+ye+o[Te+Oe]]]]%32,Ie=o[Q+1+o[Se+1+o[_e+1+o[Te+1]]]]%32;let Me=.6-E*E-C*C-k*k-D*D;Me<0?h=0:(Me*=Me,h=Me*Me*this._dot4(r[He],E,C,k,D));let qe=.6-Ke*Ke-Fe*Fe-b*b-X*X;qe<0?u=0:(qe*=qe,u=qe*qe*this._dot4(r[he],Ke,Fe,b,X));let Z=.6-H*H-N*N-y*y-G*G;Z<0?f=0:(Z*=Z,f=Z*Z*this._dot4(r[we],H,N,y,G));let Ee=.6-$*$-ne*ne-V*V-P*P;Ee<0?d=0:(Ee*=Ee,d=Ee*Ee*this._dot4(r[Ne],$,ne,V,P));let xe=.6-S*S-O*O-Y*Y-oe*oe;return xe<0?p=0:(xe*=xe,p=xe*xe*this._dot4(r[Ie],S,O,Y,oe)),27*(h+u+f+d+p)}_dot(e,t,n){return e[0]*t+e[1]*n}_dot3(e,t,n,i){return e[0]*t+e[1]*n+e[2]*i}_dot4(e,t,n,i,r){return e[0]*t+e[1]*n+e[2]*i+e[3]*r}}class Dn extends Ii{constructor(e,t,n=512,i=512,r,a,o){super(),this.width=n,this.height=i,this.clear=!0,this.camera=t,this.scene=e,this.output=0,this._renderGBuffer=!0,this._visibilityCache=[],this.blendIntensity=1,this.pdRings=2,this.pdRadiusExponent=2,this.pdSamples=16,this.gtaoNoiseTexture=Jx(),this.pdNoiseTexture=this._generateNoise(),this.gtaoRenderTarget=new Wt(this.width,this.height,{type:Yt}),this.pdRenderTarget=this.gtaoRenderTarget.clone(),this.gtaoMaterial=new Rt({defines:Object.assign({},ya.defines),uniforms:Hn.clone(ya.uniforms),vertexShader:ya.vertexShader,fragmentShader:ya.fragmentShader,blending:kt,depthTest:!1,depthWrite:!1}),this.gtaoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.gtaoMaterial.uniforms.tNoise.value=this.gtaoNoiseTexture,this.gtaoMaterial.uniforms.resolution.value.set(this.width,this.height),this.gtaoMaterial.uniforms.cameraNear.value=this.camera.near,this.gtaoMaterial.uniforms.cameraFar.value=this.camera.far,this.normalMaterial=new Im,this.normalMaterial.blending=kt,this.pdMaterial=new Rt({defines:Object.assign({},wa.defines),uniforms:Hn.clone(wa.uniforms),vertexShader:wa.vertexShader,fragmentShader:wa.fragmentShader,depthTest:!1,depthWrite:!1}),this.pdMaterial.uniforms.tDiffuse.value=this.gtaoRenderTarget.texture,this.pdMaterial.uniforms.tNoise.value=this.pdNoiseTexture,this.pdMaterial.uniforms.resolution.value.set(this.width,this.height),this.pdMaterial.uniforms.lumaPhi.value=10,this.pdMaterial.uniforms.depthPhi.value=2,this.pdMaterial.uniforms.normalPhi.value=3,this.pdMaterial.uniforms.radius.value=8,this.depthRenderMaterial=new Rt({defines:Object.assign({},Ma.defines),uniforms:Hn.clone(Ma.uniforms),vertexShader:Ma.vertexShader,fragmentShader:Ma.fragmentShader,blending:kt}),this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new Rt({uniforms:Hn.clone(Di.uniforms),vertexShader:Di.vertexShader,fragmentShader:Di.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:qa,blendDst:Ns,blendEquation:wn,blendSrcAlpha:Za,blendDstAlpha:Ns,blendEquationAlpha:wn}),this.blendMaterial=new Rt({uniforms:Hn.clone(rc.uniforms),vertexShader:rc.vertexShader,fragmentShader:rc.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blending:Oc,blendSrc:qa,blendDst:Ns,blendEquation:wn,blendSrcAlpha:Za,blendDstAlpha:Ns,blendEquationAlpha:wn}),this._fsQuad=new _a(null),this._originalClearColor=new ke,this.setGBuffer(r?r.depthTexture:void 0,r?r.normalTexture:void 0),a!==void 0&&this.updateGtaoMaterial(a),o!==void 0&&this.updatePdMaterial(o)}setSize(e,t){this.width=e,this.height=t,this.gtaoRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.pdRenderTarget.setSize(e,t),this.gtaoMaterial.uniforms.resolution.value.set(e,t),this.gtaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.gtaoMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse),this.pdMaterial.uniforms.resolution.value.set(e,t),this.pdMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse)}dispose(){this.gtaoNoiseTexture.dispose(),this.pdNoiseTexture.dispose(),this.normalRenderTarget.dispose(),this.gtaoRenderTarget.dispose(),this.pdRenderTarget.dispose(),this.normalMaterial.dispose(),this.pdMaterial.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this._fsQuad.dispose()}get gtaoMap(){return this.pdRenderTarget.texture}setGBuffer(e,t){e!==void 0?(this.depthTexture=e,this.normalTexture=t,this._renderGBuffer=!1):(this.depthTexture=new ps,this.depthTexture.format=li,this.depthTexture.type=Zi,this.normalRenderTarget=new Wt(this.width,this.height,{minFilter:Pt,magFilter:Pt,type:Yt,depthTexture:this.depthTexture}),this.normalTexture=this.normalRenderTarget.texture,this._renderGBuffer=!0);const n=this.normalTexture?1:0,i=this.depthTexture===this.normalTexture?"w":"x";this.gtaoMaterial.defines.NORMAL_VECTOR_TYPE=n,this.gtaoMaterial.defines.DEPTH_SWIZZLING=i,this.gtaoMaterial.uniforms.tNormal.value=this.normalTexture,this.gtaoMaterial.uniforms.tDepth.value=this.depthTexture,this.pdMaterial.defines.NORMAL_VECTOR_TYPE=n,this.pdMaterial.defines.DEPTH_SWIZZLING=i,this.pdMaterial.uniforms.tNormal.value=this.normalTexture,this.pdMaterial.uniforms.tDepth.value=this.depthTexture,this.depthRenderMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture}setSceneClipBox(e){e?(this.gtaoMaterial.needsUpdate=this.gtaoMaterial.defines.SCENE_CLIP_BOX!==1,this.gtaoMaterial.defines.SCENE_CLIP_BOX=1,this.gtaoMaterial.uniforms.sceneBoxMin.value.copy(e.min),this.gtaoMaterial.uniforms.sceneBoxMax.value.copy(e.max)):(this.gtaoMaterial.needsUpdate=this.gtaoMaterial.defines.SCENE_CLIP_BOX===0,this.gtaoMaterial.defines.SCENE_CLIP_BOX=0)}updateGtaoMaterial(e){e.radius!==void 0&&(this.gtaoMaterial.uniforms.radius.value=e.radius),e.distanceExponent!==void 0&&(this.gtaoMaterial.uniforms.distanceExponent.value=e.distanceExponent),e.thickness!==void 0&&(this.gtaoMaterial.uniforms.thickness.value=e.thickness),e.distanceFallOff!==void 0&&(this.gtaoMaterial.uniforms.distanceFallOff.value=e.distanceFallOff,this.gtaoMaterial.needsUpdate=!0),e.scale!==void 0&&(this.gtaoMaterial.uniforms.scale.value=e.scale),e.samples!==void 0&&e.samples!==this.gtaoMaterial.defines.SAMPLES&&(this.gtaoMaterial.defines.SAMPLES=e.samples,this.gtaoMaterial.needsUpdate=!0),e.screenSpaceRadius!==void 0&&(e.screenSpaceRadius?1:0)!==this.gtaoMaterial.defines.SCREEN_SPACE_RADIUS&&(this.gtaoMaterial.defines.SCREEN_SPACE_RADIUS=e.screenSpaceRadius?1:0,this.gtaoMaterial.needsUpdate=!0)}updatePdMaterial(e){let t=!1;e.lumaPhi!==void 0&&(this.pdMaterial.uniforms.lumaPhi.value=e.lumaPhi),e.depthPhi!==void 0&&(this.pdMaterial.uniforms.depthPhi.value=e.depthPhi),e.normalPhi!==void 0&&(this.pdMaterial.uniforms.normalPhi.value=e.normalPhi),e.radius!==void 0&&e.radius!==this.radius&&(this.pdMaterial.uniforms.radius.value=e.radius),e.radiusExponent!==void 0&&e.radiusExponent!==this.pdRadiusExponent&&(this.pdRadiusExponent=e.radiusExponent,t=!0),e.rings!==void 0&&e.rings!==this.pdRings&&(this.pdRings=e.rings,t=!0),e.samples!==void 0&&e.samples!==this.pdSamples&&(this.pdSamples=e.samples,t=!0),t&&(this.pdMaterial.defines.SAMPLES=this.pdSamples,this.pdMaterial.defines.SAMPLE_VECTORS=td(this.pdSamples,this.pdRings,this.pdRadiusExponent),this.pdMaterial.needsUpdate=!0)}render(e,t,n){switch(this._renderGBuffer&&(this._overrideVisibility(),this._renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this._restoreVisibility()),this.gtaoMaterial.uniforms.cameraNear.value=this.camera.near,this.gtaoMaterial.uniforms.cameraFar.value=this.camera.far,this.gtaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.gtaoMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse),this.gtaoMaterial.uniforms.cameraWorldMatrix.value.copy(this.camera.matrixWorld),this._renderPass(e,this.gtaoMaterial,this.gtaoRenderTarget,16777215,1),this.pdMaterial.uniforms.cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse),this._renderPass(e,this.pdMaterial,this.pdRenderTarget,16777215,1),this.output){case Dn.OUTPUT.Off:break;case Dn.OUTPUT.Diffuse:this.copyMaterial.uniforms.tDiffuse.value=n.texture,this.copyMaterial.blending=kt,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Dn.OUTPUT.AO:this.copyMaterial.uniforms.tDiffuse.value=this.gtaoRenderTarget.texture,this.copyMaterial.blending=kt,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Dn.OUTPUT.Denoise:this.copyMaterial.uniforms.tDiffuse.value=this.pdRenderTarget.texture,this.copyMaterial.blending=kt,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Dn.OUTPUT.Depth:this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this._renderPass(e,this.depthRenderMaterial,this.renderToScreen?null:t);break;case Dn.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=kt,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case Dn.OUTPUT.Default:this.copyMaterial.uniforms.tDiffuse.value=n.texture,this.copyMaterial.blending=kt,this._renderPass(e,this.copyMaterial,this.renderToScreen?null:t),this.blendMaterial.uniforms.intensity.value=this.blendIntensity,this.blendMaterial.uniforms.tDiffuse.value=this.pdRenderTarget.texture,this._renderPass(e,this.blendMaterial,this.renderToScreen?null:t);break;default:console.warn("THREE.GTAOPass: Unknown output type.")}}_renderPass(e,t,n,i,r){e.getClearColor(this._originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,i!=null&&(e.setClearColor(i),e.setClearAlpha(r||0),e.clear()),this._fsQuad.material=t,this._fsQuad.render(e),e.autoClear=o,e.setClearColor(this._originalClearColor),e.setClearAlpha(a)}_renderOverride(e,t,n,i,r){e.getClearColor(this._originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,i=t.clearColor||i,r=t.clearAlpha||r,i!=null&&(e.setClearColor(i),e.setClearAlpha(r||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this._originalClearColor),e.setClearAlpha(a)}_overrideVisibility(){const e=this.scene,t=this._visibilityCache;e.traverse(function(n){(n.isPoints||n.isLine||n.isLine2)&&n.visible&&(n.visible=!1,t.push(n))})}_restoreVisibility(){const e=this._visibilityCache;for(let t=0;t<e.length;t++)e[t].visible=!0;e.length=0}_generateNoise(e=64){const t=new t_,n=e*e*4,i=new Uint8Array(n);for(let a=0;a<e;a++)for(let o=0;o<e;o++){const l=a,c=o;i[(a*e+o)*4]=(t.noise(l,c)*.5+.5)*255,i[(a*e+o)*4+1]=(t.noise(l+e,c)*.5+.5)*255,i[(a*e+o)*4+2]=(t.noise(l,c+e)*.5+.5)*255,i[(a*e+o)*4+3]=(t.noise(l+e,c+e)*.5+.5)*255}const r=new qs(i,e,e,hn,nn);return r.wrapS=Bn,r.wrapT=Bn,r.needsUpdate=!0,r}}Dn.OUTPUT={Off:-1,Default:0,Diffuse:1,Depth:2,Normal:3,AO:4,Denoise:5};const n_={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new ke(0)},defaultOpacity:{value:0}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
uniform sampler2D tDiffuse;
|
||
uniform vec3 defaultColor;
|
||
uniform float defaultOpacity;
|
||
uniform float luminosityThreshold;
|
||
uniform float smoothWidth;
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vec4 texel = texture2D( tDiffuse, vUv );
|
||
|
||
float v = luminance( texel.xyz );
|
||
|
||
vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
|
||
|
||
float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
|
||
|
||
gl_FragColor = mix( outputColor, texel, alpha );
|
||
|
||
}`};class Es extends Ii{constructor(e,t=1,n,i){super(),this.strength=t,this.radius=n,this.threshold=i,this.resolution=e!==void 0?new de(e.x,e.y):new de(256,256),this.clearColor=new ke(0,0,0),this.needsSwap=!1,this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new Wt(r,a,{type:Yt}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let h=0;h<this.nMips;h++){const u=new Wt(r,a,{type:Yt});u.texture.name="UnrealBloomPass.h"+h,u.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(u);const f=new Wt(r,a,{type:Yt});f.texture.name="UnrealBloomPass.v"+h,f.texture.generateMipmaps=!1,this.renderTargetsVertical.push(f),r=Math.round(r/2),a=Math.round(a/2)}const o=n_;this.highPassUniforms=Hn.clone(o.uniforms),this.highPassUniforms.luminosityThreshold.value=i,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new Rt({uniforms:this.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.separableBlurMaterials=[];const l=[6,10,14,18,22];r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let h=0;h<this.nMips;h++)this.separableBlurMaterials.push(this._getSeparableBlurMaterial(l[h])),this.separableBlurMaterials[h].uniforms.invSize.value=new de(1/r,1/a),r=Math.round(r/2),a=Math.round(a/2);this.compositeMaterial=this._getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1;const c=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=c,this.bloomTintColors=[new R(1,1,1),new R(1,1,1),new R(1,1,1),new R(1,1,1),new R(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,this.copyUniforms=Hn.clone(Di.uniforms),this.blendMaterial=new Rt({uniforms:this.copyUniforms,vertexShader:Di.vertexShader,fragmentShader:Di.fragmentShader,blending:Wa,depthTest:!1,depthWrite:!1,transparent:!0}),this._oldClearColor=new ke,this._oldClearAlpha=1,this._basic=new Ft,this._fsQuad=new _a(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this._basic.dispose(),this._fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(n,i);for(let r=0;r<this.nMips;r++)this.renderTargetsHorizontal[r].setSize(n,i),this.renderTargetsVertical[r].setSize(n,i),this.separableBlurMaterials[r].uniforms.invSize.value=new de(1/n,1/i),n=Math.round(n/2),i=Math.round(i/2)}render(e,t,n,i,r){e.getClearColor(this._oldClearColor),this._oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),r&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this._fsQuad.material=this._basic,this._basic.map=n.texture,e.setRenderTarget(null),e.clear(),this._fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this._fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this._fsQuad.render(e);let o=this.renderTargetBright;for(let l=0;l<this.nMips;l++)this._fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=Es.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this._fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=Es.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this._fsQuad.render(e),o=this.renderTargetsVertical[l];this._fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this._fsQuad.render(e),this._fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,r&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(n),this._fsQuad.render(e)),e.setClearColor(this._oldClearColor,this._oldClearAlpha),e.autoClear=a}_getSeparableBlurMaterial(e){const t=[],n=e/3;for(let i=0;i<e;i++)t.push(.39894*Math.exp(-.5*i*i/(n*n))/n);return new Rt({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new de(.5,.5)},direction:{value:new de(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:`varying vec2 vUv;
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`#include <common>
|
||
varying vec2 vUv;
|
||
uniform sampler2D colorTexture;
|
||
uniform vec2 invSize;
|
||
uniform vec2 direction;
|
||
uniform float gaussianCoefficients[KERNEL_RADIUS];
|
||
|
||
void main() {
|
||
float weightSum = gaussianCoefficients[0];
|
||
vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;
|
||
for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
|
||
float x = float(i);
|
||
float w = gaussianCoefficients[i];
|
||
vec2 uvOffset = direction * invSize * x;
|
||
vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;
|
||
vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;
|
||
diffuseSum += ( sample1 + sample2 ) * w;
|
||
}
|
||
gl_FragColor = vec4( diffuseSum, 1.0 );
|
||
}`})}_getCompositeMaterial(e){return new Rt({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv;
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`varying vec2 vUv;
|
||
uniform sampler2D blurTexture1;
|
||
uniform sampler2D blurTexture2;
|
||
uniform sampler2D blurTexture3;
|
||
uniform sampler2D blurTexture4;
|
||
uniform sampler2D blurTexture5;
|
||
uniform float bloomStrength;
|
||
uniform float bloomRadius;
|
||
uniform float bloomFactors[NUM_MIPS];
|
||
uniform vec3 bloomTintColors[NUM_MIPS];
|
||
|
||
float lerpBloomFactor(const in float factor) {
|
||
float mirrorFactor = 1.2 - factor;
|
||
return mix(factor, mirrorFactor, bloomRadius);
|
||
}
|
||
|
||
void main() {
|
||
gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
|
||
lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
|
||
lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
|
||
lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
|
||
lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
|
||
}`})}}Es.BlurDirectionX=new de(1,0),Es.BlurDirectionY=new de(0,1);const Sa={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:`
|
||
precision highp float;
|
||
|
||
uniform mat4 modelViewMatrix;
|
||
uniform mat4 projectionMatrix;
|
||
|
||
attribute vec3 position;
|
||
attribute vec2 uv;
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
precision highp float;
|
||
|
||
uniform sampler2D tDiffuse;
|
||
|
||
#include <tonemapping_pars_fragment>
|
||
#include <colorspace_pars_fragment>
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
gl_FragColor = texture2D( tDiffuse, vUv );
|
||
|
||
// tone mapping
|
||
|
||
#ifdef LINEAR_TONE_MAPPING
|
||
|
||
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
|
||
|
||
#elif defined( REINHARD_TONE_MAPPING )
|
||
|
||
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
|
||
|
||
#elif defined( CINEON_TONE_MAPPING )
|
||
|
||
gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
|
||
|
||
#elif defined( ACES_FILMIC_TONE_MAPPING )
|
||
|
||
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
|
||
|
||
#elif defined( AGX_TONE_MAPPING )
|
||
|
||
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
|
||
|
||
#elif defined( NEUTRAL_TONE_MAPPING )
|
||
|
||
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
|
||
|
||
#elif defined( CUSTOM_TONE_MAPPING )
|
||
|
||
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
|
||
|
||
#endif
|
||
|
||
// color space
|
||
|
||
#ifdef SRGB_TRANSFER
|
||
|
||
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
||
|
||
#endif
|
||
|
||
}`};class i_ extends Ii{constructor(){super(),this.uniforms=Hn.clone(Sa.uniforms),this.material=new ou({name:Sa.name,uniforms:this.uniforms,vertexShader:Sa.vertexShader,fragmentShader:Sa.fragmentShader}),this._fsQuad=new _a(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,n){this.uniforms.tDiffuse.value=n.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,(this._outputColorSpace!==e.outputColorSpace||this._toneMapping!==e.toneMapping)&&(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},nt.getTransfer(this._outputColorSpace)===at&&(this.material.defines.SRGB_TRANSFER=""),this._toneMapping===no?this.material.defines.LINEAR_TONE_MAPPING="":this._toneMapping===io?this.material.defines.REINHARD_TONE_MAPPING="":this._toneMapping===so?this.material.defines.CINEON_TONE_MAPPING="":this._toneMapping===Mr?this.material.defines.ACES_FILMIC_TONE_MAPPING="":this._toneMapping===ao?this.material.defines.AGX_TONE_MAPPING="":this._toneMapping===oo?this.material.defines.NEUTRAL_TONE_MAPPING="":this._toneMapping===ro&&(this.material.defines.CUSTOM_TONE_MAPPING=""),this.material.needsUpdate=!0),this.renderToScreen===!0?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}}const s_={name:"FXAAShader",uniforms:{tDiffuse:{value:null},resolution:{value:new de(1/1024,1/512)}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
uniform sampler2D tDiffuse;
|
||
uniform vec2 resolution;
|
||
varying vec2 vUv;
|
||
|
||
#define EDGE_STEP_COUNT 6
|
||
#define EDGE_GUESS 8.0
|
||
#define EDGE_STEPS 1.0, 1.5, 2.0, 2.0, 2.0, 4.0
|
||
const float edgeSteps[EDGE_STEP_COUNT] = float[EDGE_STEP_COUNT]( EDGE_STEPS );
|
||
|
||
float _ContrastThreshold = 0.0312;
|
||
float _RelativeThreshold = 0.063;
|
||
float _SubpixelBlending = 1.0;
|
||
|
||
vec4 Sample( sampler2D tex2D, vec2 uv ) {
|
||
|
||
return texture( tex2D, uv );
|
||
|
||
}
|
||
|
||
float SampleLuminance( sampler2D tex2D, vec2 uv ) {
|
||
|
||
return dot( Sample( tex2D, uv ).rgb, vec3( 0.3, 0.59, 0.11 ) );
|
||
|
||
}
|
||
|
||
float SampleLuminance( sampler2D tex2D, vec2 texSize, vec2 uv, float uOffset, float vOffset ) {
|
||
|
||
uv += texSize * vec2(uOffset, vOffset);
|
||
return SampleLuminance(tex2D, uv);
|
||
|
||
}
|
||
|
||
struct LuminanceData {
|
||
|
||
float m, n, e, s, w;
|
||
float ne, nw, se, sw;
|
||
float highest, lowest, contrast;
|
||
|
||
};
|
||
|
||
LuminanceData SampleLuminanceNeighborhood( sampler2D tex2D, vec2 texSize, vec2 uv ) {
|
||
|
||
LuminanceData l;
|
||
l.m = SampleLuminance( tex2D, uv );
|
||
l.n = SampleLuminance( tex2D, texSize, uv, 0.0, 1.0 );
|
||
l.e = SampleLuminance( tex2D, texSize, uv, 1.0, 0.0 );
|
||
l.s = SampleLuminance( tex2D, texSize, uv, 0.0, -1.0 );
|
||
l.w = SampleLuminance( tex2D, texSize, uv, -1.0, 0.0 );
|
||
|
||
l.ne = SampleLuminance( tex2D, texSize, uv, 1.0, 1.0 );
|
||
l.nw = SampleLuminance( tex2D, texSize, uv, -1.0, 1.0 );
|
||
l.se = SampleLuminance( tex2D, texSize, uv, 1.0, -1.0 );
|
||
l.sw = SampleLuminance( tex2D, texSize, uv, -1.0, -1.0 );
|
||
|
||
l.highest = max( max( max( max( l.n, l.e ), l.s ), l.w ), l.m );
|
||
l.lowest = min( min( min( min( l.n, l.e ), l.s ), l.w ), l.m );
|
||
l.contrast = l.highest - l.lowest;
|
||
return l;
|
||
|
||
}
|
||
|
||
bool ShouldSkipPixel( LuminanceData l ) {
|
||
|
||
float threshold = max( _ContrastThreshold, _RelativeThreshold * l.highest );
|
||
return l.contrast < threshold;
|
||
|
||
}
|
||
|
||
float DeterminePixelBlendFactor( LuminanceData l ) {
|
||
|
||
float f = 2.0 * ( l.n + l.e + l.s + l.w );
|
||
f += l.ne + l.nw + l.se + l.sw;
|
||
f *= 1.0 / 12.0;
|
||
f = abs( f - l.m );
|
||
f = clamp( f / l.contrast, 0.0, 1.0 );
|
||
|
||
float blendFactor = smoothstep( 0.0, 1.0, f );
|
||
return blendFactor * blendFactor * _SubpixelBlending;
|
||
|
||
}
|
||
|
||
struct EdgeData {
|
||
|
||
bool isHorizontal;
|
||
float pixelStep;
|
||
float oppositeLuminance, gradient;
|
||
|
||
};
|
||
|
||
EdgeData DetermineEdge( vec2 texSize, LuminanceData l ) {
|
||
|
||
EdgeData e;
|
||
float horizontal =
|
||
abs( l.n + l.s - 2.0 * l.m ) * 2.0 +
|
||
abs( l.ne + l.se - 2.0 * l.e ) +
|
||
abs( l.nw + l.sw - 2.0 * l.w );
|
||
float vertical =
|
||
abs( l.e + l.w - 2.0 * l.m ) * 2.0 +
|
||
abs( l.ne + l.nw - 2.0 * l.n ) +
|
||
abs( l.se + l.sw - 2.0 * l.s );
|
||
e.isHorizontal = horizontal >= vertical;
|
||
|
||
float pLuminance = e.isHorizontal ? l.n : l.e;
|
||
float nLuminance = e.isHorizontal ? l.s : l.w;
|
||
float pGradient = abs( pLuminance - l.m );
|
||
float nGradient = abs( nLuminance - l.m );
|
||
|
||
e.pixelStep = e.isHorizontal ? texSize.y : texSize.x;
|
||
|
||
if (pGradient < nGradient) {
|
||
|
||
e.pixelStep = -e.pixelStep;
|
||
e.oppositeLuminance = nLuminance;
|
||
e.gradient = nGradient;
|
||
|
||
} else {
|
||
|
||
e.oppositeLuminance = pLuminance;
|
||
e.gradient = pGradient;
|
||
|
||
}
|
||
|
||
return e;
|
||
|
||
}
|
||
|
||
float DetermineEdgeBlendFactor( sampler2D tex2D, vec2 texSize, LuminanceData l, EdgeData e, vec2 uv ) {
|
||
|
||
vec2 uvEdge = uv;
|
||
vec2 edgeStep;
|
||
if (e.isHorizontal) {
|
||
|
||
uvEdge.y += e.pixelStep * 0.5;
|
||
edgeStep = vec2( texSize.x, 0.0 );
|
||
|
||
} else {
|
||
|
||
uvEdge.x += e.pixelStep * 0.5;
|
||
edgeStep = vec2( 0.0, texSize.y );
|
||
|
||
}
|
||
|
||
float edgeLuminance = ( l.m + e.oppositeLuminance ) * 0.5;
|
||
float gradientThreshold = e.gradient * 0.25;
|
||
|
||
vec2 puv = uvEdge + edgeStep * edgeSteps[0];
|
||
float pLuminanceDelta = SampleLuminance( tex2D, puv ) - edgeLuminance;
|
||
bool pAtEnd = abs( pLuminanceDelta ) >= gradientThreshold;
|
||
|
||
for ( int i = 1; i < EDGE_STEP_COUNT && !pAtEnd; i++ ) {
|
||
|
||
puv += edgeStep * edgeSteps[i];
|
||
pLuminanceDelta = SampleLuminance( tex2D, puv ) - edgeLuminance;
|
||
pAtEnd = abs( pLuminanceDelta ) >= gradientThreshold;
|
||
|
||
}
|
||
|
||
if ( !pAtEnd ) {
|
||
|
||
puv += edgeStep * EDGE_GUESS;
|
||
|
||
}
|
||
|
||
vec2 nuv = uvEdge - edgeStep * edgeSteps[0];
|
||
float nLuminanceDelta = SampleLuminance( tex2D, nuv ) - edgeLuminance;
|
||
bool nAtEnd = abs( nLuminanceDelta ) >= gradientThreshold;
|
||
|
||
for ( int i = 1; i < EDGE_STEP_COUNT && !nAtEnd; i++ ) {
|
||
|
||
nuv -= edgeStep * edgeSteps[i];
|
||
nLuminanceDelta = SampleLuminance( tex2D, nuv ) - edgeLuminance;
|
||
nAtEnd = abs( nLuminanceDelta ) >= gradientThreshold;
|
||
|
||
}
|
||
|
||
if ( !nAtEnd ) {
|
||
|
||
nuv -= edgeStep * EDGE_GUESS;
|
||
|
||
}
|
||
|
||
float pDistance, nDistance;
|
||
if ( e.isHorizontal ) {
|
||
|
||
pDistance = puv.x - uv.x;
|
||
nDistance = uv.x - nuv.x;
|
||
|
||
} else {
|
||
|
||
pDistance = puv.y - uv.y;
|
||
nDistance = uv.y - nuv.y;
|
||
|
||
}
|
||
|
||
float shortestDistance;
|
||
bool deltaSign;
|
||
if ( pDistance <= nDistance ) {
|
||
|
||
shortestDistance = pDistance;
|
||
deltaSign = pLuminanceDelta >= 0.0;
|
||
|
||
} else {
|
||
|
||
shortestDistance = nDistance;
|
||
deltaSign = nLuminanceDelta >= 0.0;
|
||
|
||
}
|
||
|
||
if ( deltaSign == ( l.m - edgeLuminance >= 0.0 ) ) {
|
||
|
||
return 0.0;
|
||
|
||
}
|
||
|
||
return 0.5 - shortestDistance / ( pDistance + nDistance );
|
||
|
||
}
|
||
|
||
vec4 ApplyFXAA( sampler2D tex2D, vec2 texSize, vec2 uv ) {
|
||
|
||
LuminanceData luminance = SampleLuminanceNeighborhood( tex2D, texSize, uv );
|
||
if ( ShouldSkipPixel( luminance ) ) {
|
||
|
||
return Sample( tex2D, uv );
|
||
|
||
}
|
||
|
||
float pixelBlend = DeterminePixelBlendFactor( luminance );
|
||
EdgeData edge = DetermineEdge( texSize, luminance );
|
||
float edgeBlend = DetermineEdgeBlendFactor( tex2D, texSize, luminance, edge, uv );
|
||
float finalBlend = max( pixelBlend, edgeBlend );
|
||
|
||
if (edge.isHorizontal) {
|
||
|
||
uv.y += edge.pixelStep * finalBlend;
|
||
|
||
} else {
|
||
|
||
uv.x += edge.pixelStep * finalBlend;
|
||
|
||
}
|
||
|
||
return Sample( tex2D, uv );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
gl_FragColor = ApplyFXAA( tDiffuse, resolution.xy, vUv );
|
||
|
||
}`},r_={uniforms:{tDiffuse:{value:null},saturation:{value:1.2},contrast:{value:1.2}},vertexShader:`
|
||
varying vec2 vUv;
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
||
}
|
||
`,fragmentShader:`
|
||
uniform sampler2D tDiffuse;
|
||
uniform float saturation;
|
||
uniform float contrast;
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
vec4 color = texture2D(tDiffuse, vUv);
|
||
|
||
// 转换为灰度值用于饱和度调整
|
||
float gray = dot(color.rgb, vec3(0.299, 0.587, 0.114));
|
||
|
||
// 混合原始颜色和灰度值来调整饱和度
|
||
color.rgb = mix(vec3(gray), color.rgb, saturation);
|
||
|
||
// 调整对比度
|
||
color.rgb = (color.rgb - 0.5) * contrast + 0.5;
|
||
|
||
gl_FragColor = color;
|
||
}
|
||
`};class a_{engine;composer;saturationPass;constructor(e){this.engine=e}resize(){const{width:e,height:t}=this.engine.deviceModule.getContainerSize(),n=e/t;if(this.composer){this.composer.setPixelRatio(n),this.composer.setSize(e,t);const i=this.composer.passes.find(r=>r instanceof ba&&r.material.uniforms.resolution);i&&(i.material.uniforms.resolution.value.x=1/(e*n),i.material.uniforms.resolution.value.y=1/(t*n))}}init(){const{width:e,height:t}=this.engine.deviceModule.getContainerSize(),n=this.engine.scene,i=this.engine.camera,r=this.engine.renderer,a=e/t;this.composer=new Kx(r),this.composer.setPixelRatio(a),this.composer.setSize(e,t);const o=new $x(n,i);this.composer.addPass(o);const l=new Dn(n,i,e,t);l.output=Dn.OUTPUT.Default,l.blendIntensity=.5,l.updateGtaoMaterial&&l.updateGtaoMaterial({radius:1,distanceExponent:1,thickness:1,scale:1,distanceFallOff:1,screenSpaceRadius:!0}),new Es(new de(e,t),.1,.1,.5),this.saturationPass=new ba(r_),this.saturationPass.uniforms.saturation.value=1.3,this.saturationPass.uniforms.contrast.value=1.1,this.composer.addPass(this.saturationPass);const c=new i_;this.composer.addPass(c);const h=new ba(s_);h.material.uniforms.resolution.value.x=1/(e*a),h.material.uniforms.resolution.value.y=1/(t*a),this.composer.addPass(h)}}var Ea=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nd(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Ta(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var id={exports:{}},sd;function o_(){return sd||(sd=1,(function(s,e){(function(t){s.exports=t()})(function(){return(function t(n,i,r){function a(c,h){if(!i[c]){if(!n[c]){var u=typeof Ta=="function"&&Ta;if(!h&&u)return u(c,!0);if(o)return o(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var d=i[c]={exports:{}};n[c][0].call(d.exports,function(p){var g=n[c][1][p];return a(g||p)},d,d.exports,t,n,i,r)}return i[c].exports}for(var o=typeof Ta=="function"&&Ta,l=0;l<r.length;l++)a(r[l]);return a})({1:[function(t,n,i){var r=t("./utils"),a=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(l){for(var c,h,u,f,d,p,g,v=[],m=0,x=l.length,_=x,M=r.getTypeOf(l)!=="string";m<l.length;)_=x-m,u=M?(c=l[m++],h=m<x?l[m++]:0,m<x?l[m++]:0):(c=l.charCodeAt(m++),h=m<x?l.charCodeAt(m++):0,m<x?l.charCodeAt(m++):0),f=c>>2,d=(3&c)<<4|h>>4,p=1<_?(15&h)<<2|u>>6:64,g=2<_?63&u:64,v.push(o.charAt(f)+o.charAt(d)+o.charAt(p)+o.charAt(g));return v.join("")},i.decode=function(l){var c,h,u,f,d,p,g=0,v=0,m="data:";if(l.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var x,_=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===o.charAt(64)&&_--,l.charAt(l.length-2)===o.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(x=a.uint8array?new Uint8Array(0|_):new Array(0|_);g<l.length;)c=o.indexOf(l.charAt(g++))<<2|(f=o.indexOf(l.charAt(g++)))>>4,h=(15&f)<<4|(d=o.indexOf(l.charAt(g++)))>>2,u=(3&d)<<6|(p=o.indexOf(l.charAt(g++))),x[v++]=c,d!==64&&(x[v++]=h),p!==64&&(x[v++]=u);return x}},{"./support":30,"./utils":32}],2:[function(t,n,i){var r=t("./external"),a=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(h,u,f,d,p){this.compressedSize=h,this.uncompressedSize=u,this.crc32=f,this.compression=d,this.compressedContent=p}c.prototype={getContentWorker:function(){var h=new a(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return h.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new a(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(h,u,f){return h.pipe(new o).pipe(new l("uncompressedSize")).pipe(u.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},n.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,n,i){var r=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,n,i){var r=t("./utils"),a=(function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l})();n.exports=function(o,l){return o!==void 0&&o.length?r.getTypeOf(o)!=="string"?(function(c,h,u,f){var d=a,p=f+u;c^=-1;for(var g=f;g<p;g++)c=c>>>8^d[255&(c^h[g])];return-1^c})(0|l,o,o.length,0):(function(c,h,u,f){var d=a,p=f+u;c^=-1;for(var g=f;g<p;g++)c=c>>>8^d[255&(c^h.charCodeAt(g))];return-1^c})(0|l,o,o.length,0):0}},{"./utils":32}],5:[function(t,n,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,n,i){var r=null;r=typeof Promise<"u"?Promise:t("lie"),n.exports={Promise:r}},{lie:37}],7:[function(t,n,i){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=t("pako"),o=t("./utils"),l=t("./stream/GenericWorker"),c=r?"uint8array":"array";function h(u,f){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,this.meta={}}i.magic="\b\0",o.inherits(h,l),h.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(c,u.data),!1)},h.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(f){u.push({data:f,meta:u.meta})}},i.compressWorker=function(u){return new h("Deflate",u)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,n,i){function r(d,p){var g,v="";for(g=0;g<p;g++)v+=String.fromCharCode(255&d),d>>>=8;return v}function a(d,p,g,v,m,x){var _,M,T=d.file,A=d.compression,L=x!==c.utf8encode,U=o.transformTo("string",x(T.name)),E=o.transformTo("string",c.utf8encode(T.name)),C=T.comment,k=o.transformTo("string",x(C)),D=o.transformTo("string",c.utf8encode(C)),B=E.length!==T.name.length,w=D.length!==C.length,F="",q="",z="",te=T.dir,K=T.date,le={crc32:0,compressedSize:0,uncompressedSize:0};p&&!g||(le.crc32=d.crc32,le.compressedSize=d.compressedSize,le.uncompressedSize=d.uncompressedSize);var W=0;p&&(W|=8),L||!B&&!w||(W|=2048);var j=0,me=0;te&&(j|=16),m==="UNIX"?(me=798,j|=(function(ue,ie){var ce=ue;return ue||(ce=ie?16893:33204),(65535&ce)<<16})(T.unixPermissions,te)):(me=20,j|=(function(ue){return 63&(ue||0)})(T.dosPermissions)),_=K.getUTCHours(),_<<=6,_|=K.getUTCMinutes(),_<<=5,_|=K.getUTCSeconds()/2,M=K.getUTCFullYear()-1980,M<<=4,M|=K.getUTCMonth()+1,M<<=5,M|=K.getUTCDate(),B&&(q=r(1,1)+r(h(U),4)+E,F+="up"+r(q.length,2)+q),w&&(z=r(1,1)+r(h(k),4)+D,F+="uc"+r(z.length,2)+z);var ge="";return ge+=`
|
||
\0`,ge+=r(W,2),ge+=A.magic,ge+=r(_,2),ge+=r(M,2),ge+=r(le.crc32,4),ge+=r(le.compressedSize,4),ge+=r(le.uncompressedSize,4),ge+=r(U.length,2),ge+=r(F.length,2),{fileRecord:u.LOCAL_FILE_HEADER+ge+U+F,dirRecord:u.CENTRAL_FILE_HEADER+r(me,2)+ge+r(k.length,2)+"\0\0\0\0"+r(j,4)+r(v,4)+U+F+k}}var o=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),h=t("../crc32"),u=t("../signature");function f(d,p,g,v){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=g,this.encodeFileName=v,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(f,l),f.prototype.push=function(d){var p=d.meta.percent||0,g=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,l.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:g?(p+100*(g-v-1))/g:100}}))},f.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var p=this.streamFiles&&!d.file.dir;if(p){var g=a(d,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(d){this.accumulate=!1;var p=this.streamFiles&&!d.file.dir,g=a(d,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),p)this.push({data:(function(v){return u.DATA_DESCRIPTOR+r(v.crc32,4)+r(v.compressedSize,4)+r(v.uncompressedSize,4)})(d),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var d=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var g=this.bytesWritten-d,v=(function(m,x,_,M,T){var A=o.transformTo("string",T(M));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(m,2)+r(m,2)+r(x,4)+r(_,4)+r(A.length,2)+A})(this.dirRecords.length,g,d,this.zipComment,this.encodeFileName);this.push({data:v,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(d){this._sources.push(d);var p=this;return d.on("data",function(g){p.processChunk(g)}),d.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),d.on("error",function(g){p.error(g)}),this},f.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(d){var p=this._sources;if(!l.prototype.error.call(this,d))return!1;for(var g=0;g<p.length;g++)try{p[g].error(d)}catch{}return!0},f.prototype.lock=function(){l.prototype.lock.call(this);for(var d=this._sources,p=0;p<d.length;p++)d[p].lock()},n.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,n,i){var r=t("../compressions"),a=t("./ZipFileWorker");i.generateWorker=function(o,l,c){var h=new a(l.streamFiles,c,l.platform,l.encodeFileName),u=0;try{o.forEach(function(f,d){u++;var p=(function(x,_){var M=x||_,T=r[M];if(!T)throw new Error(M+" is not a valid compression method !");return T})(d.options.compression,l.compression),g=d.options.compressionOptions||l.compressionOptions||{},v=d.dir,m=d.date;d._compressWorker(p,g).withStreamInfo("file",{name:f,dir:v,date:m,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(h)}),h.entriesCount=u}catch(f){h.error(f)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,n,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new r;for(var o in this)typeof this[o]!="function"&&(a[o]=this[o]);return a}}(r.prototype=t("./object")).loadAsync=t("./load"),r.support=t("./support"),r.defaults=t("./defaults"),r.version="3.10.1",r.loadAsync=function(a,o){return new r().loadAsync(a,o)},r.external=t("./external"),n.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,n,i){var r=t("./utils"),a=t("./external"),o=t("./utf8"),l=t("./zipEntries"),c=t("./stream/Crc32Probe"),h=t("./nodejsUtils");function u(f){return new a.Promise(function(d,p){var g=f.decompressed.getContentWorker().pipe(new c);g.on("error",function(v){p(v)}).on("end",function(){g.streamInfo.crc32!==f.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}n.exports=function(f,d){var p=this;return d=r.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),h.isNode&&h.isStream(f)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",f,!0,d.optimizedBinaryString,d.base64).then(function(g){var v=new l(d);return v.load(g),v}).then(function(g){var v=[a.Promise.resolve(g)],m=g.files;if(d.checkCRC32)for(var x=0;x<m.length;x++)v.push(u(m[x]));return a.Promise.all(v)}).then(function(g){for(var v=g.shift(),m=v.files,x=0;x<m.length;x++){var _=m[x],M=_.fileNameStr,T=r.resolve(_.fileNameStr);p.file(T,_.decompressed,{binary:!0,optimizedBinaryString:!0,date:_.date,dir:_.dir,comment:_.fileCommentStr.length?_.fileCommentStr:null,unixPermissions:_.unixPermissions,dosPermissions:_.dosPermissions,createFolders:d.createFolders}),_.dir||(p.file(T).unsafeOriginalName=M)}return v.zipComment.length&&(p.comment=v.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,n,i){var r=t("../utils"),a=t("../stream/GenericWorker");function o(l,c){a.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}r.inherits(o,a),o.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(h){c.push({data:h,meta:{percent:0}})}).on("error",function(h){c.isPaused?this.generatedError=h:c.error(h)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},o.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,n,i){var r=t("readable-stream").Readable;function a(o,l,c){r.call(this,l),this._helper=o;var h=this;o.on("data",function(u,f){h.push(u)||h._helper.pause(),c&&c(f)}).on("error",function(u){h.emit("error",u)}).on("end",function(){h.push(null)})}t("../utils").inherits(a,r),a.prototype._read=function(){this._helper.resume()},n.exports=a},{"../utils":32,"readable-stream":16}],14:[function(t,n,i){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,a);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,a)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var a=new Buffer(r);return a.fill(0),a},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(t,n,i){function r(T,A,L){var U,E=o.getTypeOf(A),C=o.extend(L||{},h);C.date=C.date||new Date,C.compression!==null&&(C.compression=C.compression.toUpperCase()),typeof C.unixPermissions=="string"&&(C.unixPermissions=parseInt(C.unixPermissions,8)),C.unixPermissions&&16384&C.unixPermissions&&(C.dir=!0),C.dosPermissions&&16&C.dosPermissions&&(C.dir=!0),C.dir&&(T=m(T)),C.createFolders&&(U=v(T))&&x.call(this,U,!0);var k=E==="string"&&C.binary===!1&&C.base64===!1;L&&L.binary!==void 0||(C.binary=!k),(A instanceof u&&A.uncompressedSize===0||C.dir||!A||A.length===0)&&(C.base64=!1,C.binary=!0,A="",C.compression="STORE",E="string");var D=null;D=A instanceof u||A instanceof l?A:p.isNode&&p.isStream(A)?new g(T,A):o.prepareContent(T,A,C.binary,C.optimizedBinaryString,C.base64);var B=new f(T,D,C);this.files[T]=B}var a=t("./utf8"),o=t("./utils"),l=t("./stream/GenericWorker"),c=t("./stream/StreamHelper"),h=t("./defaults"),u=t("./compressedObject"),f=t("./zipObject"),d=t("./generate"),p=t("./nodejsUtils"),g=t("./nodejs/NodejsStreamInputAdapter"),v=function(T){T.slice(-1)==="/"&&(T=T.substring(0,T.length-1));var A=T.lastIndexOf("/");return 0<A?T.substring(0,A):""},m=function(T){return T.slice(-1)!=="/"&&(T+="/"),T},x=function(T,A){return A=A!==void 0?A:h.createFolders,T=m(T),this.files[T]||r.call(this,T,null,{dir:!0,createFolders:A}),this.files[T]};function _(T){return Object.prototype.toString.call(T)==="[object RegExp]"}var M={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(T){var A,L,U;for(A in this.files)U=this.files[A],(L=A.slice(this.root.length,A.length))&&A.slice(0,this.root.length)===this.root&&T(L,U)},filter:function(T){var A=[];return this.forEach(function(L,U){T(L,U)&&A.push(U)}),A},file:function(T,A,L){if(arguments.length!==1)return T=this.root+T,r.call(this,T,A,L),this;if(_(T)){var U=T;return this.filter(function(C,k){return!k.dir&&U.test(C)})}var E=this.files[this.root+T];return E&&!E.dir?E:null},folder:function(T){if(!T)return this;if(_(T))return this.filter(function(E,C){return C.dir&&T.test(E)});var A=this.root+T,L=x.call(this,A),U=this.clone();return U.root=L.name,U},remove:function(T){T=this.root+T;var A=this.files[T];if(A||(T.slice(-1)!=="/"&&(T+="/"),A=this.files[T]),A&&!A.dir)delete this.files[T];else for(var L=this.filter(function(E,C){return C.name.slice(0,T.length)===T}),U=0;U<L.length;U++)delete this.files[L[U].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(T){var A,L={};try{if((L=o.extend(T||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=L.type.toLowerCase(),L.compression=L.compression.toUpperCase(),L.type==="binarystring"&&(L.type="string"),!L.type)throw new Error("No output type specified.");o.checkSupport(L.type),L.platform!=="darwin"&&L.platform!=="freebsd"&&L.platform!=="linux"&&L.platform!=="sunos"||(L.platform="UNIX"),L.platform==="win32"&&(L.platform="DOS");var U=L.comment||this.comment||"";A=d.generateWorker(this,L,U)}catch(E){(A=new l("error")).error(E)}return new c(A,L.type||"string",L.mimeType)},generateAsync:function(T,A){return this.generateInternalStream(T).accumulate(A)},generateNodeStream:function(T,A){return(T=T||{}).type||(T.type="nodebuffer"),this.generateInternalStream(T).toNodejsStream(A)}};n.exports=M},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,n,i){n.exports=t("stream")},{stream:void 0}],17:[function(t,n,i){var r=t("./DataReader");function a(o){r.call(this,o);for(var l=0;l<this.data.length;l++)o[l]=255&o[l]}t("../utils").inherits(a,r),a.prototype.byteAt=function(o){return this.data[this.zero+o]},a.prototype.lastIndexOfSignature=function(o){for(var l=o.charCodeAt(0),c=o.charCodeAt(1),h=o.charCodeAt(2),u=o.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===l&&this.data[f+1]===c&&this.data[f+2]===h&&this.data[f+3]===u)return f-this.zero;return-1},a.prototype.readAndCheckSignature=function(o){var l=o.charCodeAt(0),c=o.charCodeAt(1),h=o.charCodeAt(2),u=o.charCodeAt(3),f=this.readData(4);return l===f[0]&&c===f[1]&&h===f[2]&&u===f[3]},a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},n.exports=a},{"../utils":32,"./DataReader":18}],18:[function(t,n,i){var r=t("../utils");function a(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var l,c=0;for(this.checkOffset(o),l=this.index+o-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=o,c},readString:function(o){return r.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},n.exports=a},{"../utils":32}],19:[function(t,n,i){var r=t("./Uint8ArrayReader");function a(o){r.call(this,o)}t("../utils").inherits(a,r),a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},n.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,n,i){var r=t("./DataReader");function a(o){r.call(this,o)}t("../utils").inherits(a,r),a.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},a.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},a.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},n.exports=a},{"../utils":32,"./DataReader":18}],21:[function(t,n,i){var r=t("./ArrayReader");function a(o){r.call(this,o)}t("../utils").inherits(a,r),a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},n.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(t,n,i){var r=t("../utils"),a=t("../support"),o=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");n.exports=function(u){var f=r.getTypeOf(u);return r.checkSupport(f),f!=="string"||a.uint8array?f==="nodebuffer"?new c(u):a.uint8array?new h(r.transformTo("uint8array",u)):new o(r.transformTo("array",u)):new l(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,n,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,n,i){var r=t("./GenericWorker"),a=t("../utils");function o(l){r.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(o,r),o.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},n.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,n,i){var r=t("./GenericWorker"),a=t("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,r),o.prototype.processChunk=function(l){this.streamInfo.crc32=a(l.data,this.streamInfo.crc32||0),this.push(l)},n.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,n,i){var r=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}r.inherits(o,a),o.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}a.prototype.processChunk.call(this,l)},n.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,n,i){var r=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(h){c.dataIsReady=!0,c.data=h,c.max=h&&h.length||0,c.type=r.getTypeOf(h),c.isPaused||c._tickAndRepeat()},function(h){c.error(h)})}r.inherits(o,a),o.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,n,i){function r(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var l=0;l<this._listeners[a].length;l++)this._listeners[a][l].call(this,o)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var o=this;return a.on("data",function(l){o.processChunk(l)}),a.on("end",function(){o.end()}),a.on("error",function(l){o.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,o){return this.extraStreamInfo[a]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},n.exports=r},{}],29:[function(t,n,i){var r=t("../utils"),a=t("./ConvertWorker"),o=t("./GenericWorker"),l=t("../base64"),c=t("../support"),h=t("../external"),u=null;if(c.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(p,g){return new h.Promise(function(v,m){var x=[],_=p._internalType,M=p._outputType,T=p._mimeType;p.on("data",function(A,L){x.push(A),g&&g(L)}).on("error",function(A){x=[],m(A)}).on("end",function(){try{var A=(function(L,U,E){switch(L){case"blob":return r.newBlob(r.transformTo("arraybuffer",U),E);case"base64":return l.encode(U);default:return r.transformTo(L,U)}})(M,(function(L,U){var E,C=0,k=null,D=0;for(E=0;E<U.length;E++)D+=U[E].length;switch(L){case"string":return U.join("");case"array":return Array.prototype.concat.apply([],U);case"uint8array":for(k=new Uint8Array(D),E=0;E<U.length;E++)k.set(U[E],C),C+=U[E].length;return k;case"nodebuffer":return Buffer.concat(U);default:throw new Error("concat : unsupported type '"+L+"'")}})(_,x),T);v(A)}catch(L){m(L)}x=[]}).resume()})}function d(p,g,v){var m=g;switch(g){case"blob":case"arraybuffer":m="uint8array";break;case"base64":m="string"}try{this._internalType=m,this._outputType=g,this._mimeType=v,r.checkSupport(m),this._worker=p.pipe(new a(m)),p.lock()}catch(x){this._worker=new o("error"),this._worker.error(x)}}d.prototype={accumulate:function(p){return f(this,p)},on:function(p,g){var v=this;return p==="data"?this._worker.on(p,function(m){g.call(v,m.data,m.meta)}):this._worker.on(p,function(){r.delay(g,arguments,v)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:this._outputType!=="nodebuffer"},p)}},n.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,n,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(r),i.blob=a.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,n,i){for(var r=t("./utils"),a=t("./support"),o=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),h=0;h<256;h++)c[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;c[254]=c[254]=1;function u(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}i.utf8encode=function(d){return a.nodebuffer?o.newBufferFrom(d,"utf-8"):(function(p){var g,v,m,x,_,M=p.length,T=0;for(x=0;x<M;x++)(64512&(v=p.charCodeAt(x)))==55296&&x+1<M&&(64512&(m=p.charCodeAt(x+1)))==56320&&(v=65536+(v-55296<<10)+(m-56320),x++),T+=v<128?1:v<2048?2:v<65536?3:4;for(g=a.uint8array?new Uint8Array(T):new Array(T),x=_=0;_<T;x++)(64512&(v=p.charCodeAt(x)))==55296&&x+1<M&&(64512&(m=p.charCodeAt(x+1)))==56320&&(v=65536+(v-55296<<10)+(m-56320),x++),v<128?g[_++]=v:(v<2048?g[_++]=192|v>>>6:(v<65536?g[_++]=224|v>>>12:(g[_++]=240|v>>>18,g[_++]=128|v>>>12&63),g[_++]=128|v>>>6&63),g[_++]=128|63&v);return g})(d)},i.utf8decode=function(d){return a.nodebuffer?r.transformTo("nodebuffer",d).toString("utf-8"):(function(p){var g,v,m,x,_=p.length,M=new Array(2*_);for(g=v=0;g<_;)if((m=p[g++])<128)M[v++]=m;else if(4<(x=c[m]))M[v++]=65533,g+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&g<_;)m=m<<6|63&p[g++],x--;1<x?M[v++]=65533:m<65536?M[v++]=m:(m-=65536,M[v++]=55296|m>>10&1023,M[v++]=56320|1023&m)}return M.length!==v&&(M.subarray?M=M.subarray(0,v):M.length=v),r.applyFromCharCode(M)})(d=r.transformTo(a.uint8array?"uint8array":"array",d))},r.inherits(u,l),u.prototype.processChunk=function(d){var p=r.transformTo(a.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var g=p;(p=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),p.set(g,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var v=(function(x,_){var M;for((_=_||x.length)>x.length&&(_=x.length),M=_-1;0<=M&&(192&x[M])==128;)M--;return M<0||M===0?_:M+c[x[M]]>_?M:_})(p),m=p;v!==p.length&&(a.uint8array?(m=p.subarray(0,v),this.leftOver=p.subarray(v,p.length)):(m=p.slice(0,v),this.leftOver=p.slice(v,p.length))),this.push({data:i.utf8decode(m),meta:d.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,r.inherits(f,l),f.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,n,i){var r=t("./support"),a=t("./base64"),o=t("./nodejsUtils"),l=t("./external");function c(g){return g}function h(g,v){for(var m=0;m<g.length;++m)v[m]=255&g.charCodeAt(m);return v}t("setimmediate"),i.newBlob=function(g,v){i.checkSupport("blob");try{return new Blob([g],{type:v})}catch{try{var m=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return m.append(g),m.getBlob(v)}catch{throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(g,v,m){var x=[],_=0,M=g.length;if(M<=m)return String.fromCharCode.apply(null,g);for(;_<M;)v==="array"||v==="nodebuffer"?x.push(String.fromCharCode.apply(null,g.slice(_,Math.min(_+m,M)))):x.push(String.fromCharCode.apply(null,g.subarray(_,Math.min(_+m,M)))),_+=m;return x.join("")},stringifyByChar:function(g){for(var v="",m=0;m<g.length;m++)v+=String.fromCharCode(g[m]);return v},applyCanBeUsed:{uint8array:(function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function f(g){var v=65536,m=i.getTypeOf(g),x=!0;if(m==="uint8array"?x=u.applyCanBeUsed.uint8array:m==="nodebuffer"&&(x=u.applyCanBeUsed.nodebuffer),x)for(;1<v;)try{return u.stringifyByChunk(g,m,v)}catch{v=Math.floor(v/2)}return u.stringifyByChar(g)}function d(g,v){for(var m=0;m<g.length;m++)v[m]=g[m];return v}i.applyFromCharCode=f;var p={};p.string={string:c,array:function(g){return h(g,new Array(g.length))},arraybuffer:function(g){return p.string.uint8array(g).buffer},uint8array:function(g){return h(g,new Uint8Array(g.length))},nodebuffer:function(g){return h(g,o.allocBuffer(g.length))}},p.array={string:f,array:c,arraybuffer:function(g){return new Uint8Array(g).buffer},uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return o.newBufferFrom(g)}},p.arraybuffer={string:function(g){return f(new Uint8Array(g))},array:function(g){return d(new Uint8Array(g),new Array(g.byteLength))},arraybuffer:c,uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return o.newBufferFrom(new Uint8Array(g))}},p.uint8array={string:f,array:function(g){return d(g,new Array(g.length))},arraybuffer:function(g){return g.buffer},uint8array:c,nodebuffer:function(g){return o.newBufferFrom(g)}},p.nodebuffer={string:f,array:function(g){return d(g,new Array(g.length))},arraybuffer:function(g){return p.nodebuffer.uint8array(g).buffer},uint8array:function(g){return d(g,new Uint8Array(g.length))},nodebuffer:c},i.transformTo=function(g,v){if(v=v||"",!g)return v;i.checkSupport(g);var m=i.getTypeOf(v);return p[m][g](v)},i.resolve=function(g){for(var v=g.split("/"),m=[],x=0;x<v.length;x++){var _=v[x];_==="."||_===""&&x!==0&&x!==v.length-1||(_===".."?m.pop():m.push(_))}return m.join("/")},i.getTypeOf=function(g){return typeof g=="string"?"string":Object.prototype.toString.call(g)==="[object Array]"?"array":r.nodebuffer&&o.isBuffer(g)?"nodebuffer":r.uint8array&&g instanceof Uint8Array?"uint8array":r.arraybuffer&&g instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(g){if(!r[g.toLowerCase()])throw new Error(g+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(g){var v,m,x="";for(m=0;m<(g||"").length;m++)x+="\\x"+((v=g.charCodeAt(m))<16?"0":"")+v.toString(16).toUpperCase();return x},i.delay=function(g,v,m){setImmediate(function(){g.apply(m||null,v||[])})},i.inherits=function(g,v){function m(){}m.prototype=v.prototype,g.prototype=new m},i.extend=function(){var g,v,m={};for(g=0;g<arguments.length;g++)for(v in arguments[g])Object.prototype.hasOwnProperty.call(arguments[g],v)&&m[v]===void 0&&(m[v]=arguments[g][v]);return m},i.prepareContent=function(g,v,m,x,_){return l.Promise.resolve(v).then(function(M){return r.blob&&(M instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(M))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,A){var L=new FileReader;L.onload=function(U){T(U.target.result)},L.onerror=function(U){A(U.target.error)},L.readAsArrayBuffer(M)}):M}).then(function(M){var T=i.getTypeOf(M);return T?(T==="arraybuffer"?M=i.transformTo("uint8array",M):T==="string"&&(_?M=a.decode(M):m&&x!==!0&&(M=(function(A){return h(A,r.uint8array?new Uint8Array(A.length):new Array(A.length))})(M))),M):l.Promise.reject(new Error("Can't read the data of '"+g+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,n,i){var r=t("./reader/readerFor"),a=t("./utils"),o=t("./signature"),l=t("./zipEntry"),c=t("./support");function h(u){this.files=[],this.loadOptions=u}h.prototype={checkSignature:function(u){if(!this.reader.readAndCheckSignature(u)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(f)+", expected "+a.pretty(u)+")")}},isSignature:function(u,f){var d=this.reader.index;this.reader.setIndex(u);var p=this.reader.readString(4)===f;return this.reader.setIndex(d),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var u=this.reader.readData(this.zipCommentLength),f=c.uint8array?"uint8array":"array",d=a.transformTo(f,u);this.zipComment=this.loadOptions.decodeFileName(d)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var u,f,d,p=this.zip64EndOfCentralSize-44;0<p;)u=this.reader.readInt(2),f=this.reader.readInt(4),d=this.reader.readData(f),this.zip64ExtensibleData[u]={id:u,length:f,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var u,f;for(u=0;u<this.files.length;u++)f=this.files[u],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var u;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(u=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(u);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var u=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(u<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(u);var f=u;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(u=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(u),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var p=f-d;if(0<p)this.isSignature(f,o.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(u){this.reader=r(u)},load:function(u){this.prepareReader(u),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,n,i){var r=t("./reader/readerFor"),a=t("./utils"),o=t("./compressedObject"),l=t("./crc32"),c=t("./utf8"),h=t("./compressions"),u=t("./support");function f(d,p){this.options=d,this.loadOptions=p}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var p,g;if(d.skip(22),this.fileNameLength=d.readInt(2),g=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(g),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=(function(v){for(var m in h)if(Object.prototype.hasOwnProperty.call(h,m)&&h[m].magic===v)return h[m];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,p,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var p=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(p),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=r(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var p,g,v,m=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<m;)p=d.readInt(2),g=d.readInt(2),v=d.readData(g),this.extraFields[p]={id:p,length:g,value:v};d.setIndex(m)},handleUTF8:function(){var d=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var g=a.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var v=this.findExtraFieldUnicodeComment();if(v!==null)this.fileCommentStr=v;else{var m=a.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(m)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var p=r(d.value);return p.readInt(1)!==1||l(this.fileName)!==p.readInt(4)?null:c.utf8decode(p.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var p=r(d.value);return p.readInt(1)!==1||l(this.fileComment)!==p.readInt(4)?null:c.utf8decode(p.readData(d.length-5))}return null}},n.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,n,i){function r(p,g,v){this.name=p,this.dir=v.dir,this.date=v.date,this.comment=v.comment,this.unixPermissions=v.unixPermissions,this.dosPermissions=v.dosPermissions,this._data=g,this._dataBinary=v.binary,this.options={compression:v.compression,compressionOptions:v.compressionOptions}}var a=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),l=t("./utf8"),c=t("./compressedObject"),h=t("./stream/GenericWorker");r.prototype={internalStream:function(p){var g=null,v="string";try{if(!p)throw new Error("No output type specified.");var m=(v=p.toLowerCase())==="string"||v==="text";v!=="binarystring"&&v!=="text"||(v="string"),g=this._decompressWorker();var x=!this._dataBinary;x&&!m&&(g=g.pipe(new l.Utf8EncodeWorker)),!x&&m&&(g=g.pipe(new l.Utf8DecodeWorker))}catch(_){(g=new h("error")).error(_)}return new a(g,v,"")},async:function(p,g){return this.internalStream(p).accumulate(g)},nodeStream:function(p,g){return this.internalStream(p||"nodebuffer").toNodejsStream(g)},_compressWorker:function(p,g){if(this._data instanceof c&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var v=this._decompressWorker();return this._dataBinary||(v=v.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(v,p,g)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof h?this._data:new o(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<u.length;d++)r.prototype[u[d]]=f;n.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,n,i){(function(r){var a,o,l=r.MutationObserver||r.WebKitMutationObserver;if(l){var c=0,h=new l(p),u=r.document.createTextNode("");h.observe(u,{characterData:!0}),a=function(){u.data=c=++c%2}}else if(r.setImmediate||r.MessageChannel===void 0)a="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var g=r.document.createElement("script");g.onreadystatechange=function(){p(),g.onreadystatechange=null,g.parentNode.removeChild(g),g=null},r.document.documentElement.appendChild(g)}:function(){setTimeout(p,0)};else{var f=new r.MessageChannel;f.port1.onmessage=p,a=function(){f.port2.postMessage(0)}}var d=[];function p(){var g,v;o=!0;for(var m=d.length;m;){for(v=d,d=[],g=-1;++g<m;)v[g]();m=d.length}o=!1}n.exports=function(g){d.push(g)!==1||o||a()}}).call(this,typeof Ea<"u"?Ea:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,n,i){var r=t("immediate");function a(){}var o={},l=["REJECTED"],c=["FULFILLED"],h=["PENDING"];function u(m){if(typeof m!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,m!==a&&g(this,m)}function f(m,x,_){this.promise=m,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function d(m,x,_){r(function(){var M;try{M=x(_)}catch(T){return o.reject(m,T)}M===m?o.reject(m,new TypeError("Cannot resolve promise with itself")):o.resolve(m,M)})}function p(m){var x=m&&m.then;if(m&&(typeof m=="object"||typeof m=="function")&&typeof x=="function")return function(){x.apply(m,arguments)}}function g(m,x){var _=!1;function M(L){_||(_=!0,o.reject(m,L))}function T(L){_||(_=!0,o.resolve(m,L))}var A=v(function(){x(T,M)});A.status==="error"&&M(A.value)}function v(m,x){var _={};try{_.value=m(x),_.status="success"}catch(M){_.status="error",_.value=M}return _}(n.exports=u).prototype.finally=function(m){if(typeof m!="function")return this;var x=this.constructor;return this.then(function(_){return x.resolve(m()).then(function(){return _})},function(_){return x.resolve(m()).then(function(){throw _})})},u.prototype.catch=function(m){return this.then(null,m)},u.prototype.then=function(m,x){if(typeof m!="function"&&this.state===c||typeof x!="function"&&this.state===l)return this;var _=new this.constructor(a);return this.state!==h?d(_,this.state===c?m:x,this.outcome):this.queue.push(new f(_,m,x)),_},f.prototype.callFulfilled=function(m){o.resolve(this.promise,m)},f.prototype.otherCallFulfilled=function(m){d(this.promise,this.onFulfilled,m)},f.prototype.callRejected=function(m){o.reject(this.promise,m)},f.prototype.otherCallRejected=function(m){d(this.promise,this.onRejected,m)},o.resolve=function(m,x){var _=v(p,x);if(_.status==="error")return o.reject(m,_.value);var M=_.value;if(M)g(m,M);else{m.state=c,m.outcome=x;for(var T=-1,A=m.queue.length;++T<A;)m.queue[T].callFulfilled(x)}return m},o.reject=function(m,x){m.state=l,m.outcome=x;for(var _=-1,M=m.queue.length;++_<M;)m.queue[_].callRejected(x);return m},u.resolve=function(m){return m instanceof this?m:o.resolve(new this(a),m)},u.reject=function(m){var x=new this(a);return o.reject(x,m)},u.all=function(m){var x=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=m.length,M=!1;if(!_)return this.resolve([]);for(var T=new Array(_),A=0,L=-1,U=new this(a);++L<_;)E(m[L],L);return U;function E(C,k){x.resolve(C).then(function(D){T[k]=D,++A!==_||M||(M=!0,o.resolve(U,T))},function(D){M||(M=!0,o.reject(U,D))})}},u.race=function(m){var x=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=m.length,M=!1;if(!_)return this.resolve([]);for(var T=-1,A=new this(a);++T<_;)L=m[T],x.resolve(L).then(function(U){M||(M=!0,o.resolve(A,U))},function(U){M||(M=!0,o.reject(A,U))});var L;return A}},{immediate:36}],38:[function(t,n,i){var r={};(0,t("./lib/utils/common").assign)(r,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),n.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,n,i){var r=t("./zlib/deflate"),a=t("./utils/common"),o=t("./utils/strings"),l=t("./zlib/messages"),c=t("./zlib/zstream"),h=Object.prototype.toString,u=0,f=-1,d=0,p=8;function g(m){if(!(this instanceof g))return new g(m);this.options=a.assign({level:f,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},m||{});var x=this.options;x.raw&&0<x.windowBits?x.windowBits=-x.windowBits:x.gzip&&0<x.windowBits&&x.windowBits<16&&(x.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var _=r.deflateInit2(this.strm,x.level,x.method,x.windowBits,x.memLevel,x.strategy);if(_!==u)throw new Error(l[_]);if(x.header&&r.deflateSetHeader(this.strm,x.header),x.dictionary){var M;if(M=typeof x.dictionary=="string"?o.string2buf(x.dictionary):h.call(x.dictionary)==="[object ArrayBuffer]"?new Uint8Array(x.dictionary):x.dictionary,(_=r.deflateSetDictionary(this.strm,M))!==u)throw new Error(l[_]);this._dict_set=!0}}function v(m,x){var _=new g(x);if(_.push(m,!0),_.err)throw _.msg||l[_.err];return _.result}g.prototype.push=function(m,x){var _,M,T=this.strm,A=this.options.chunkSize;if(this.ended)return!1;M=x===~~x?x:x===!0?4:0,typeof m=="string"?T.input=o.string2buf(m):h.call(m)==="[object ArrayBuffer]"?T.input=new Uint8Array(m):T.input=m,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new a.Buf8(A),T.next_out=0,T.avail_out=A),(_=r.deflate(T,M))!==1&&_!==u)return this.onEnd(_),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||M!==4&&M!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(a.shrinkBuf(T.output,T.next_out))):this.onData(a.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&_!==1);return M===4?(_=r.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===u):M!==2||(this.onEnd(u),!(T.avail_out=0))},g.prototype.onData=function(m){this.chunks.push(m)},g.prototype.onEnd=function(m){m===u&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},i.Deflate=g,i.deflate=v,i.deflateRaw=function(m,x){return(x=x||{}).raw=!0,v(m,x)},i.gzip=function(m,x){return(x=x||{}).gzip=!0,v(m,x)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,n,i){var r=t("./zlib/inflate"),a=t("./utils/common"),o=t("./utils/strings"),l=t("./zlib/constants"),c=t("./zlib/messages"),h=t("./zlib/zstream"),u=t("./zlib/gzheader"),f=Object.prototype.toString;function d(g){if(!(this instanceof d))return new d(g);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},g||{});var v=this.options;v.raw&&0<=v.windowBits&&v.windowBits<16&&(v.windowBits=-v.windowBits,v.windowBits===0&&(v.windowBits=-15)),!(0<=v.windowBits&&v.windowBits<16)||g&&g.windowBits||(v.windowBits+=32),15<v.windowBits&&v.windowBits<48&&(15&v.windowBits)==0&&(v.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var m=r.inflateInit2(this.strm,v.windowBits);if(m!==l.Z_OK)throw new Error(c[m]);this.header=new u,r.inflateGetHeader(this.strm,this.header)}function p(g,v){var m=new d(v);if(m.push(g,!0),m.err)throw m.msg||c[m.err];return m.result}d.prototype.push=function(g,v){var m,x,_,M,T,A,L=this.strm,U=this.options.chunkSize,E=this.options.dictionary,C=!1;if(this.ended)return!1;x=v===~~v?v:v===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof g=="string"?L.input=o.binstring2buf(g):f.call(g)==="[object ArrayBuffer]"?L.input=new Uint8Array(g):L.input=g,L.next_in=0,L.avail_in=L.input.length;do{if(L.avail_out===0&&(L.output=new a.Buf8(U),L.next_out=0,L.avail_out=U),(m=r.inflate(L,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&E&&(A=typeof E=="string"?o.string2buf(E):f.call(E)==="[object ArrayBuffer]"?new Uint8Array(E):E,m=r.inflateSetDictionary(this.strm,A)),m===l.Z_BUF_ERROR&&C===!0&&(m=l.Z_OK,C=!1),m!==l.Z_STREAM_END&&m!==l.Z_OK)return this.onEnd(m),!(this.ended=!0);L.next_out&&(L.avail_out!==0&&m!==l.Z_STREAM_END&&(L.avail_in!==0||x!==l.Z_FINISH&&x!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=o.utf8border(L.output,L.next_out),M=L.next_out-_,T=o.buf2string(L.output,_),L.next_out=M,L.avail_out=U-M,M&&a.arraySet(L.output,L.output,_,M,0),this.onData(T)):this.onData(a.shrinkBuf(L.output,L.next_out)))),L.avail_in===0&&L.avail_out===0&&(C=!0)}while((0<L.avail_in||L.avail_out===0)&&m!==l.Z_STREAM_END);return m===l.Z_STREAM_END&&(x=l.Z_FINISH),x===l.Z_FINISH?(m=r.inflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===l.Z_OK):x!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(L.avail_out=0))},d.prototype.onData=function(g){this.chunks.push(g)},d.prototype.onEnd=function(g){g===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},i.Inflate=d,i.inflate=p,i.inflateRaw=function(g,v){return(v=v||{}).raw=!0,p(g,v)},i.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,n,i){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var h=c.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var u in h)h.hasOwnProperty(u)&&(l[u]=h[u])}}return l},i.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var a={arraySet:function(l,c,h,u,f){if(c.subarray&&l.subarray)l.set(c.subarray(h,h+u),f);else for(var d=0;d<u;d++)l[f+d]=c[h+d]},flattenChunks:function(l){var c,h,u,f,d,p;for(c=u=0,h=l.length;c<h;c++)u+=l[c].length;for(p=new Uint8Array(u),c=f=0,h=l.length;c<h;c++)d=l[c],p.set(d,f),f+=d.length;return p}},o={arraySet:function(l,c,h,u,f){for(var d=0;d<u;d++)l[f+d]=c[h+d]},flattenChunks:function(l){return[].concat.apply([],l)}};i.setTyped=function(l){l?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,a)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(r)},{}],42:[function(t,n,i){var r=t("./common"),a=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var l=new r.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function h(u,f){if(f<65537&&(u.subarray&&o||!u.subarray&&a))return String.fromCharCode.apply(null,r.shrinkBuf(u,f));for(var d="",p=0;p<f;p++)d+=String.fromCharCode(u[p]);return d}l[254]=l[254]=1,i.string2buf=function(u){var f,d,p,g,v,m=u.length,x=0;for(g=0;g<m;g++)(64512&(d=u.charCodeAt(g)))==55296&&g+1<m&&(64512&(p=u.charCodeAt(g+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),g++),x+=d<128?1:d<2048?2:d<65536?3:4;for(f=new r.Buf8(x),g=v=0;v<x;g++)(64512&(d=u.charCodeAt(g)))==55296&&g+1<m&&(64512&(p=u.charCodeAt(g+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),g++),d<128?f[v++]=d:(d<2048?f[v++]=192|d>>>6:(d<65536?f[v++]=224|d>>>12:(f[v++]=240|d>>>18,f[v++]=128|d>>>12&63),f[v++]=128|d>>>6&63),f[v++]=128|63&d);return f},i.buf2binstring=function(u){return h(u,u.length)},i.binstring2buf=function(u){for(var f=new r.Buf8(u.length),d=0,p=f.length;d<p;d++)f[d]=u.charCodeAt(d);return f},i.buf2string=function(u,f){var d,p,g,v,m=f||u.length,x=new Array(2*m);for(d=p=0;d<m;)if((g=u[d++])<128)x[p++]=g;else if(4<(v=l[g]))x[p++]=65533,d+=v-1;else{for(g&=v===2?31:v===3?15:7;1<v&&d<m;)g=g<<6|63&u[d++],v--;1<v?x[p++]=65533:g<65536?x[p++]=g:(g-=65536,x[p++]=55296|g>>10&1023,x[p++]=56320|1023&g)}return h(x,p)},i.utf8border=function(u,f){var d;for((f=f||u.length)>u.length&&(f=u.length),d=f-1;0<=d&&(192&u[d])==128;)d--;return d<0||d===0?f:d+l[u[d]]>f?d:f}},{"./common":41}],43:[function(t,n,i){n.exports=function(r,a,o,l){for(var c=65535&r|0,h=r>>>16&65535|0,u=0;o!==0;){for(o-=u=2e3<o?2e3:o;h=h+(c=c+a[l++]|0)|0,--u;);c%=65521,h%=65521}return c|h<<16|0}},{}],44:[function(t,n,i){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,n,i){var r=(function(){for(var a,o=[],l=0;l<256;l++){a=l;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;o[l]=a}return o})();n.exports=function(a,o,l,c){var h=r,u=c+l;a^=-1;for(var f=c;f<u;f++)a=a>>>8^h[255&(a^o[f])];return-1^a}},{}],46:[function(t,n,i){var r,a=t("../utils/common"),o=t("./trees"),l=t("./adler32"),c=t("./crc32"),h=t("./messages"),u=0,f=4,d=0,p=-2,g=-1,v=4,m=2,x=8,_=9,M=286,T=30,A=19,L=2*M+1,U=15,E=3,C=258,k=C+E+1,D=42,B=113,w=1,F=2,q=3,z=4;function te(b,X){return b.msg=h[X],X}function K(b){return(b<<1)-(4<b?9:0)}function le(b){for(var X=b.length;0<=--X;)b[X]=0}function W(b){var X=b.state,H=X.pending;H>b.avail_out&&(H=b.avail_out),H!==0&&(a.arraySet(b.output,X.pending_buf,X.pending_out,H,b.next_out),b.next_out+=H,X.pending_out+=H,b.total_out+=H,b.avail_out-=H,X.pending-=H,X.pending===0&&(X.pending_out=0))}function j(b,X){o._tr_flush_block(b,0<=b.block_start?b.block_start:-1,b.strstart-b.block_start,X),b.block_start=b.strstart,W(b.strm)}function me(b,X){b.pending_buf[b.pending++]=X}function ge(b,X){b.pending_buf[b.pending++]=X>>>8&255,b.pending_buf[b.pending++]=255&X}function ue(b,X){var H,N,y=b.max_chain_length,G=b.strstart,$=b.prev_length,ne=b.nice_match,V=b.strstart>b.w_size-k?b.strstart-(b.w_size-k):0,P=b.window,S=b.w_mask,O=b.prev,Y=b.strstart+C,oe=P[G+$-1],Q=P[G+$];b.prev_length>=b.good_match&&(y>>=2),ne>b.lookahead&&(ne=b.lookahead);do if(P[(H=X)+$]===Q&&P[H+$-1]===oe&&P[H]===P[G]&&P[++H]===P[G+1]){G+=2,H++;do;while(P[++G]===P[++H]&&P[++G]===P[++H]&&P[++G]===P[++H]&&P[++G]===P[++H]&&P[++G]===P[++H]&&P[++G]===P[++H]&&P[++G]===P[++H]&&P[++G]===P[++H]&&G<Y);if(N=C-(Y-G),G=Y-C,$<N){if(b.match_start=X,ne<=($=N))break;oe=P[G+$-1],Q=P[G+$]}}while((X=O[X&S])>V&&--y!=0);return $<=b.lookahead?$:b.lookahead}function ie(b){var X,H,N,y,G,$,ne,V,P,S,O=b.w_size;do{if(y=b.window_size-b.lookahead-b.strstart,b.strstart>=O+(O-k)){for(a.arraySet(b.window,b.window,O,O,0),b.match_start-=O,b.strstart-=O,b.block_start-=O,X=H=b.hash_size;N=b.head[--X],b.head[X]=O<=N?N-O:0,--H;);for(X=H=O;N=b.prev[--X],b.prev[X]=O<=N?N-O:0,--H;);y+=O}if(b.strm.avail_in===0)break;if($=b.strm,ne=b.window,V=b.strstart+b.lookahead,P=y,S=void 0,S=$.avail_in,P<S&&(S=P),H=S===0?0:($.avail_in-=S,a.arraySet(ne,$.input,$.next_in,S,V),$.state.wrap===1?$.adler=l($.adler,ne,S,V):$.state.wrap===2&&($.adler=c($.adler,ne,S,V)),$.next_in+=S,$.total_in+=S,S),b.lookahead+=H,b.lookahead+b.insert>=E)for(G=b.strstart-b.insert,b.ins_h=b.window[G],b.ins_h=(b.ins_h<<b.hash_shift^b.window[G+1])&b.hash_mask;b.insert&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[G+E-1])&b.hash_mask,b.prev[G&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=G,G++,b.insert--,!(b.lookahead+b.insert<E)););}while(b.lookahead<k&&b.strm.avail_in!==0)}function ce(b,X){for(var H,N;;){if(b.lookahead<k){if(ie(b),b.lookahead<k&&X===u)return w;if(b.lookahead===0)break}if(H=0,b.lookahead>=E&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+E-1])&b.hash_mask,H=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),H!==0&&b.strstart-H<=b.w_size-k&&(b.match_length=ue(b,H)),b.match_length>=E)if(N=o._tr_tally(b,b.strstart-b.match_start,b.match_length-E),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&b.lookahead>=E){for(b.match_length--;b.strstart++,b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+E-1])&b.hash_mask,H=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart,--b.match_length!=0;);b.strstart++}else b.strstart+=b.match_length,b.match_length=0,b.ins_h=b.window[b.strstart],b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+1])&b.hash_mask;else N=o._tr_tally(b,0,b.window[b.strstart]),b.lookahead--,b.strstart++;if(N&&(j(b,!1),b.strm.avail_out===0))return w}return b.insert=b.strstart<E-1?b.strstart:E-1,X===f?(j(b,!0),b.strm.avail_out===0?q:z):b.last_lit&&(j(b,!1),b.strm.avail_out===0)?w:F}function fe(b,X){for(var H,N,y;;){if(b.lookahead<k){if(ie(b),b.lookahead<k&&X===u)return w;if(b.lookahead===0)break}if(H=0,b.lookahead>=E&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+E-1])&b.hash_mask,H=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),b.prev_length=b.match_length,b.prev_match=b.match_start,b.match_length=E-1,H!==0&&b.prev_length<b.max_lazy_match&&b.strstart-H<=b.w_size-k&&(b.match_length=ue(b,H),b.match_length<=5&&(b.strategy===1||b.match_length===E&&4096<b.strstart-b.match_start)&&(b.match_length=E-1)),b.prev_length>=E&&b.match_length<=b.prev_length){for(y=b.strstart+b.lookahead-E,N=o._tr_tally(b,b.strstart-1-b.prev_match,b.prev_length-E),b.lookahead-=b.prev_length-1,b.prev_length-=2;++b.strstart<=y&&(b.ins_h=(b.ins_h<<b.hash_shift^b.window[b.strstart+E-1])&b.hash_mask,H=b.prev[b.strstart&b.w_mask]=b.head[b.ins_h],b.head[b.ins_h]=b.strstart),--b.prev_length!=0;);if(b.match_available=0,b.match_length=E-1,b.strstart++,N&&(j(b,!1),b.strm.avail_out===0))return w}else if(b.match_available){if((N=o._tr_tally(b,0,b.window[b.strstart-1]))&&j(b,!1),b.strstart++,b.lookahead--,b.strm.avail_out===0)return w}else b.match_available=1,b.strstart++,b.lookahead--}return b.match_available&&(N=o._tr_tally(b,0,b.window[b.strstart-1]),b.match_available=0),b.insert=b.strstart<E-1?b.strstart:E-1,X===f?(j(b,!0),b.strm.avail_out===0?q:z):b.last_lit&&(j(b,!1),b.strm.avail_out===0)?w:F}function be(b,X,H,N,y){this.good_length=b,this.max_lazy=X,this.nice_length=H,this.max_chain=N,this.func=y}function ye(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=x,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*L),this.dyn_dtree=new a.Buf16(2*(2*T+1)),this.bl_tree=new a.Buf16(2*(2*A+1)),le(this.dyn_ltree),le(this.dyn_dtree),le(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(U+1),this.heap=new a.Buf16(2*M+1),le(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*M+1),le(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Oe(b){var X;return b&&b.state?(b.total_in=b.total_out=0,b.data_type=m,(X=b.state).pending=0,X.pending_out=0,X.wrap<0&&(X.wrap=-X.wrap),X.status=X.wrap?D:B,b.adler=X.wrap===2?0:1,X.last_flush=u,o._tr_init(X),d):te(b,p)}function Ke(b){var X=Oe(b);return X===d&&(function(H){H.window_size=2*H.w_size,le(H.head),H.max_lazy_match=r[H.level].max_lazy,H.good_match=r[H.level].good_length,H.nice_match=r[H.level].nice_length,H.max_chain_length=r[H.level].max_chain,H.strstart=0,H.block_start=0,H.lookahead=0,H.insert=0,H.match_length=H.prev_length=E-1,H.match_available=0,H.ins_h=0})(b.state),X}function Fe(b,X,H,N,y,G){if(!b)return p;var $=1;if(X===g&&(X=6),N<0?($=0,N=-N):15<N&&($=2,N-=16),y<1||_<y||H!==x||N<8||15<N||X<0||9<X||G<0||v<G)return te(b,p);N===8&&(N=9);var ne=new ye;return(b.state=ne).strm=b,ne.wrap=$,ne.gzhead=null,ne.w_bits=N,ne.w_size=1<<ne.w_bits,ne.w_mask=ne.w_size-1,ne.hash_bits=y+7,ne.hash_size=1<<ne.hash_bits,ne.hash_mask=ne.hash_size-1,ne.hash_shift=~~((ne.hash_bits+E-1)/E),ne.window=new a.Buf8(2*ne.w_size),ne.head=new a.Buf16(ne.hash_size),ne.prev=new a.Buf16(ne.w_size),ne.lit_bufsize=1<<y+6,ne.pending_buf_size=4*ne.lit_bufsize,ne.pending_buf=new a.Buf8(ne.pending_buf_size),ne.d_buf=1*ne.lit_bufsize,ne.l_buf=3*ne.lit_bufsize,ne.level=X,ne.strategy=G,ne.method=H,Ke(b)}r=[new be(0,0,0,0,function(b,X){var H=65535;for(H>b.pending_buf_size-5&&(H=b.pending_buf_size-5);;){if(b.lookahead<=1){if(ie(b),b.lookahead===0&&X===u)return w;if(b.lookahead===0)break}b.strstart+=b.lookahead,b.lookahead=0;var N=b.block_start+H;if((b.strstart===0||b.strstart>=N)&&(b.lookahead=b.strstart-N,b.strstart=N,j(b,!1),b.strm.avail_out===0)||b.strstart-b.block_start>=b.w_size-k&&(j(b,!1),b.strm.avail_out===0))return w}return b.insert=0,X===f?(j(b,!0),b.strm.avail_out===0?q:z):(b.strstart>b.block_start&&(j(b,!1),b.strm.avail_out),w)}),new be(4,4,8,4,ce),new be(4,5,16,8,ce),new be(4,6,32,32,ce),new be(4,4,16,16,fe),new be(8,16,32,32,fe),new be(8,16,128,128,fe),new be(8,32,128,256,fe),new be(32,128,258,1024,fe),new be(32,258,258,4096,fe)],i.deflateInit=function(b,X){return Fe(b,X,x,15,8,0)},i.deflateInit2=Fe,i.deflateReset=Ke,i.deflateResetKeep=Oe,i.deflateSetHeader=function(b,X){return b&&b.state?b.state.wrap!==2?p:(b.state.gzhead=X,d):p},i.deflate=function(b,X){var H,N,y,G;if(!b||!b.state||5<X||X<0)return b?te(b,p):p;if(N=b.state,!b.output||!b.input&&b.avail_in!==0||N.status===666&&X!==f)return te(b,b.avail_out===0?-5:p);if(N.strm=b,H=N.last_flush,N.last_flush=X,N.status===D)if(N.wrap===2)b.adler=0,me(N,31),me(N,139),me(N,8),N.gzhead?(me(N,(N.gzhead.text?1:0)+(N.gzhead.hcrc?2:0)+(N.gzhead.extra?4:0)+(N.gzhead.name?8:0)+(N.gzhead.comment?16:0)),me(N,255&N.gzhead.time),me(N,N.gzhead.time>>8&255),me(N,N.gzhead.time>>16&255),me(N,N.gzhead.time>>24&255),me(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),me(N,255&N.gzhead.os),N.gzhead.extra&&N.gzhead.extra.length&&(me(N,255&N.gzhead.extra.length),me(N,N.gzhead.extra.length>>8&255)),N.gzhead.hcrc&&(b.adler=c(b.adler,N.pending_buf,N.pending,0)),N.gzindex=0,N.status=69):(me(N,0),me(N,0),me(N,0),me(N,0),me(N,0),me(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),me(N,3),N.status=B);else{var $=x+(N.w_bits-8<<4)<<8;$|=(2<=N.strategy||N.level<2?0:N.level<6?1:N.level===6?2:3)<<6,N.strstart!==0&&($|=32),$+=31-$%31,N.status=B,ge(N,$),N.strstart!==0&&(ge(N,b.adler>>>16),ge(N,65535&b.adler)),b.adler=1}if(N.status===69)if(N.gzhead.extra){for(y=N.pending;N.gzindex<(65535&N.gzhead.extra.length)&&(N.pending!==N.pending_buf_size||(N.gzhead.hcrc&&N.pending>y&&(b.adler=c(b.adler,N.pending_buf,N.pending-y,y)),W(b),y=N.pending,N.pending!==N.pending_buf_size));)me(N,255&N.gzhead.extra[N.gzindex]),N.gzindex++;N.gzhead.hcrc&&N.pending>y&&(b.adler=c(b.adler,N.pending_buf,N.pending-y,y)),N.gzindex===N.gzhead.extra.length&&(N.gzindex=0,N.status=73)}else N.status=73;if(N.status===73)if(N.gzhead.name){y=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>y&&(b.adler=c(b.adler,N.pending_buf,N.pending-y,y)),W(b),y=N.pending,N.pending===N.pending_buf_size)){G=1;break}G=N.gzindex<N.gzhead.name.length?255&N.gzhead.name.charCodeAt(N.gzindex++):0,me(N,G)}while(G!==0);N.gzhead.hcrc&&N.pending>y&&(b.adler=c(b.adler,N.pending_buf,N.pending-y,y)),G===0&&(N.gzindex=0,N.status=91)}else N.status=91;if(N.status===91)if(N.gzhead.comment){y=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>y&&(b.adler=c(b.adler,N.pending_buf,N.pending-y,y)),W(b),y=N.pending,N.pending===N.pending_buf_size)){G=1;break}G=N.gzindex<N.gzhead.comment.length?255&N.gzhead.comment.charCodeAt(N.gzindex++):0,me(N,G)}while(G!==0);N.gzhead.hcrc&&N.pending>y&&(b.adler=c(b.adler,N.pending_buf,N.pending-y,y)),G===0&&(N.status=103)}else N.status=103;if(N.status===103&&(N.gzhead.hcrc?(N.pending+2>N.pending_buf_size&&W(b),N.pending+2<=N.pending_buf_size&&(me(N,255&b.adler),me(N,b.adler>>8&255),b.adler=0,N.status=B)):N.status=B),N.pending!==0){if(W(b),b.avail_out===0)return N.last_flush=-1,d}else if(b.avail_in===0&&K(X)<=K(H)&&X!==f)return te(b,-5);if(N.status===666&&b.avail_in!==0)return te(b,-5);if(b.avail_in!==0||N.lookahead!==0||X!==u&&N.status!==666){var ne=N.strategy===2?(function(V,P){for(var S;;){if(V.lookahead===0&&(ie(V),V.lookahead===0)){if(P===u)return w;break}if(V.match_length=0,S=o._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++,S&&(j(V,!1),V.strm.avail_out===0))return w}return V.insert=0,P===f?(j(V,!0),V.strm.avail_out===0?q:z):V.last_lit&&(j(V,!1),V.strm.avail_out===0)?w:F})(N,X):N.strategy===3?(function(V,P){for(var S,O,Y,oe,Q=V.window;;){if(V.lookahead<=C){if(ie(V),V.lookahead<=C&&P===u)return w;if(V.lookahead===0)break}if(V.match_length=0,V.lookahead>=E&&0<V.strstart&&(O=Q[Y=V.strstart-1])===Q[++Y]&&O===Q[++Y]&&O===Q[++Y]){oe=V.strstart+C;do;while(O===Q[++Y]&&O===Q[++Y]&&O===Q[++Y]&&O===Q[++Y]&&O===Q[++Y]&&O===Q[++Y]&&O===Q[++Y]&&O===Q[++Y]&&Y<oe);V.match_length=C-(oe-Y),V.match_length>V.lookahead&&(V.match_length=V.lookahead)}if(V.match_length>=E?(S=o._tr_tally(V,1,V.match_length-E),V.lookahead-=V.match_length,V.strstart+=V.match_length,V.match_length=0):(S=o._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++),S&&(j(V,!1),V.strm.avail_out===0))return w}return V.insert=0,P===f?(j(V,!0),V.strm.avail_out===0?q:z):V.last_lit&&(j(V,!1),V.strm.avail_out===0)?w:F})(N,X):r[N.level].func(N,X);if(ne!==q&&ne!==z||(N.status=666),ne===w||ne===q)return b.avail_out===0&&(N.last_flush=-1),d;if(ne===F&&(X===1?o._tr_align(N):X!==5&&(o._tr_stored_block(N,0,0,!1),X===3&&(le(N.head),N.lookahead===0&&(N.strstart=0,N.block_start=0,N.insert=0))),W(b),b.avail_out===0))return N.last_flush=-1,d}return X!==f?d:N.wrap<=0?1:(N.wrap===2?(me(N,255&b.adler),me(N,b.adler>>8&255),me(N,b.adler>>16&255),me(N,b.adler>>24&255),me(N,255&b.total_in),me(N,b.total_in>>8&255),me(N,b.total_in>>16&255),me(N,b.total_in>>24&255)):(ge(N,b.adler>>>16),ge(N,65535&b.adler)),W(b),0<N.wrap&&(N.wrap=-N.wrap),N.pending!==0?d:1)},i.deflateEnd=function(b){var X;return b&&b.state?(X=b.state.status)!==D&&X!==69&&X!==73&&X!==91&&X!==103&&X!==B&&X!==666?te(b,p):(b.state=null,X===B?te(b,-3):d):p},i.deflateSetDictionary=function(b,X){var H,N,y,G,$,ne,V,P,S=X.length;if(!b||!b.state||(G=(H=b.state).wrap)===2||G===1&&H.status!==D||H.lookahead)return p;for(G===1&&(b.adler=l(b.adler,X,S,0)),H.wrap=0,S>=H.w_size&&(G===0&&(le(H.head),H.strstart=0,H.block_start=0,H.insert=0),P=new a.Buf8(H.w_size),a.arraySet(P,X,S-H.w_size,H.w_size,0),X=P,S=H.w_size),$=b.avail_in,ne=b.next_in,V=b.input,b.avail_in=S,b.next_in=0,b.input=X,ie(H);H.lookahead>=E;){for(N=H.strstart,y=H.lookahead-(E-1);H.ins_h=(H.ins_h<<H.hash_shift^H.window[N+E-1])&H.hash_mask,H.prev[N&H.w_mask]=H.head[H.ins_h],H.head[H.ins_h]=N,N++,--y;);H.strstart=N,H.lookahead=E-1,ie(H)}return H.strstart+=H.lookahead,H.block_start=H.strstart,H.insert=H.lookahead,H.lookahead=0,H.match_length=H.prev_length=E-1,H.match_available=0,b.next_in=ne,b.input=V,b.avail_in=$,H.wrap=G,d},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,n,i){n.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,n,i){n.exports=function(r,a){var o,l,c,h,u,f,d,p,g,v,m,x,_,M,T,A,L,U,E,C,k,D,B,w,F;o=r.state,l=r.next_in,w=r.input,c=l+(r.avail_in-5),h=r.next_out,F=r.output,u=h-(a-r.avail_out),f=h+(r.avail_out-257),d=o.dmax,p=o.wsize,g=o.whave,v=o.wnext,m=o.window,x=o.hold,_=o.bits,M=o.lencode,T=o.distcode,A=(1<<o.lenbits)-1,L=(1<<o.distbits)-1;e:do{_<15&&(x+=w[l++]<<_,_+=8,x+=w[l++]<<_,_+=8),U=M[x&A];t:for(;;){if(x>>>=E=U>>>24,_-=E,(E=U>>>16&255)===0)F[h++]=65535&U;else{if(!(16&E)){if((64&E)==0){U=M[(65535&U)+(x&(1<<E)-1)];continue t}if(32&E){o.mode=12;break e}r.msg="invalid literal/length code",o.mode=30;break e}C=65535&U,(E&=15)&&(_<E&&(x+=w[l++]<<_,_+=8),C+=x&(1<<E)-1,x>>>=E,_-=E),_<15&&(x+=w[l++]<<_,_+=8,x+=w[l++]<<_,_+=8),U=T[x&L];n:for(;;){if(x>>>=E=U>>>24,_-=E,!(16&(E=U>>>16&255))){if((64&E)==0){U=T[(65535&U)+(x&(1<<E)-1)];continue n}r.msg="invalid distance code",o.mode=30;break e}if(k=65535&U,_<(E&=15)&&(x+=w[l++]<<_,(_+=8)<E&&(x+=w[l++]<<_,_+=8)),d<(k+=x&(1<<E)-1)){r.msg="invalid distance too far back",o.mode=30;break e}if(x>>>=E,_-=E,(E=h-u)<k){if(g<(E=k-E)&&o.sane){r.msg="invalid distance too far back",o.mode=30;break e}if(B=m,(D=0)===v){if(D+=p-E,E<C){for(C-=E;F[h++]=m[D++],--E;);D=h-k,B=F}}else if(v<E){if(D+=p+v-E,(E-=v)<C){for(C-=E;F[h++]=m[D++],--E;);if(D=0,v<C){for(C-=E=v;F[h++]=m[D++],--E;);D=h-k,B=F}}}else if(D+=v-E,E<C){for(C-=E;F[h++]=m[D++],--E;);D=h-k,B=F}for(;2<C;)F[h++]=B[D++],F[h++]=B[D++],F[h++]=B[D++],C-=3;C&&(F[h++]=B[D++],1<C&&(F[h++]=B[D++]))}else{for(D=h-k;F[h++]=F[D++],F[h++]=F[D++],F[h++]=F[D++],2<(C-=3););C&&(F[h++]=F[D++],1<C&&(F[h++]=F[D++]))}break}}break}}while(l<c&&h<f);l-=C=_>>3,x&=(1<<(_-=C<<3))-1,r.next_in=l,r.next_out=h,r.avail_in=l<c?c-l+5:5-(l-c),r.avail_out=h<f?f-h+257:257-(h-f),o.hold=x,o.bits=_}},{}],49:[function(t,n,i){var r=t("../utils/common"),a=t("./adler32"),o=t("./crc32"),l=t("./inffast"),c=t("./inftrees"),h=1,u=2,f=0,d=-2,p=1,g=852,v=592;function m(D){return(D>>>24&255)+(D>>>8&65280)+((65280&D)<<8)+((255&D)<<24)}function x(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(D){var B;return D&&D.state?(B=D.state,D.total_in=D.total_out=B.total=0,D.msg="",B.wrap&&(D.adler=1&B.wrap),B.mode=p,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new r.Buf32(g),B.distcode=B.distdyn=new r.Buf32(v),B.sane=1,B.back=-1,f):d}function M(D){var B;return D&&D.state?((B=D.state).wsize=0,B.whave=0,B.wnext=0,_(D)):d}function T(D,B){var w,F;return D&&D.state?(F=D.state,B<0?(w=0,B=-B):(w=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15<B)?d:(F.window!==null&&F.wbits!==B&&(F.window=null),F.wrap=w,F.wbits=B,M(D))):d}function A(D,B){var w,F;return D?(F=new x,(D.state=F).window=null,(w=T(D,B))!==f&&(D.state=null),w):d}var L,U,E=!0;function C(D){if(E){var B;for(L=new r.Buf32(512),U=new r.Buf32(32),B=0;B<144;)D.lens[B++]=8;for(;B<256;)D.lens[B++]=9;for(;B<280;)D.lens[B++]=7;for(;B<288;)D.lens[B++]=8;for(c(h,D.lens,0,288,L,0,D.work,{bits:9}),B=0;B<32;)D.lens[B++]=5;c(u,D.lens,0,32,U,0,D.work,{bits:5}),E=!1}D.lencode=L,D.lenbits=9,D.distcode=U,D.distbits=5}function k(D,B,w,F){var q,z=D.state;return z.window===null&&(z.wsize=1<<z.wbits,z.wnext=0,z.whave=0,z.window=new r.Buf8(z.wsize)),F>=z.wsize?(r.arraySet(z.window,B,w-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(F<(q=z.wsize-z.wnext)&&(q=F),r.arraySet(z.window,B,w-F,q,z.wnext),(F-=q)?(r.arraySet(z.window,B,w-F,F,0),z.wnext=F,z.whave=z.wsize):(z.wnext+=q,z.wnext===z.wsize&&(z.wnext=0),z.whave<z.wsize&&(z.whave+=q))),0}i.inflateReset=M,i.inflateReset2=T,i.inflateResetKeep=_,i.inflateInit=function(D){return A(D,15)},i.inflateInit2=A,i.inflate=function(D,B){var w,F,q,z,te,K,le,W,j,me,ge,ue,ie,ce,fe,be,ye,Oe,Ke,Fe,b,X,H,N,y=0,G=new r.Buf8(4),$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!D||!D.state||!D.output||!D.input&&D.avail_in!==0)return d;(w=D.state).mode===12&&(w.mode=13),te=D.next_out,q=D.output,le=D.avail_out,z=D.next_in,F=D.input,K=D.avail_in,W=w.hold,j=w.bits,me=K,ge=le,X=f;e:for(;;)switch(w.mode){case p:if(w.wrap===0){w.mode=13;break}for(;j<16;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}if(2&w.wrap&&W===35615){G[w.check=0]=255&W,G[1]=W>>>8&255,w.check=o(w.check,G,2,0),j=W=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&W)<<8)+(W>>8))%31){D.msg="incorrect header check",w.mode=30;break}if((15&W)!=8){D.msg="unknown compression method",w.mode=30;break}if(j-=4,b=8+(15&(W>>>=4)),w.wbits===0)w.wbits=b;else if(b>w.wbits){D.msg="invalid window size",w.mode=30;break}w.dmax=1<<b,D.adler=w.check=1,w.mode=512&W?10:12,j=W=0;break;case 2:for(;j<16;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}if(w.flags=W,(255&w.flags)!=8){D.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){D.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=W>>8&1),512&w.flags&&(G[0]=255&W,G[1]=W>>>8&255,w.check=o(w.check,G,2,0)),j=W=0,w.mode=3;case 3:for(;j<32;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}w.head&&(w.head.time=W),512&w.flags&&(G[0]=255&W,G[1]=W>>>8&255,G[2]=W>>>16&255,G[3]=W>>>24&255,w.check=o(w.check,G,4,0)),j=W=0,w.mode=4;case 4:for(;j<16;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}w.head&&(w.head.xflags=255&W,w.head.os=W>>8),512&w.flags&&(G[0]=255&W,G[1]=W>>>8&255,w.check=o(w.check,G,2,0)),j=W=0,w.mode=5;case 5:if(1024&w.flags){for(;j<16;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}w.length=W,w.head&&(w.head.extra_len=W),512&w.flags&&(G[0]=255&W,G[1]=W>>>8&255,w.check=o(w.check,G,2,0)),j=W=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(K<(ue=w.length)&&(ue=K),ue&&(w.head&&(b=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),r.arraySet(w.head.extra,F,z,ue,b)),512&w.flags&&(w.check=o(w.check,F,ue,z)),K-=ue,z+=ue,w.length-=ue),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(K===0)break e;for(ue=0;b=F[z+ue++],w.head&&b&&w.length<65536&&(w.head.name+=String.fromCharCode(b)),b&&ue<K;);if(512&w.flags&&(w.check=o(w.check,F,ue,z)),K-=ue,z+=ue,b)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(K===0)break e;for(ue=0;b=F[z+ue++],w.head&&b&&w.length<65536&&(w.head.comment+=String.fromCharCode(b)),b&&ue<K;);if(512&w.flags&&(w.check=o(w.check,F,ue,z)),K-=ue,z+=ue,b)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;j<16;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}if(W!==(65535&w.check)){D.msg="header crc mismatch",w.mode=30;break}j=W=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),D.adler=w.check=0,w.mode=12;break;case 10:for(;j<32;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}D.adler=w.check=m(W),j=W=0,w.mode=11;case 11:if(w.havedict===0)return D.next_out=te,D.avail_out=le,D.next_in=z,D.avail_in=K,w.hold=W,w.bits=j,2;D.adler=w.check=1,w.mode=12;case 12:if(B===5||B===6)break e;case 13:if(w.last){W>>>=7&j,j-=7&j,w.mode=27;break}for(;j<3;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}switch(w.last=1&W,j-=1,3&(W>>>=1)){case 0:w.mode=14;break;case 1:if(C(w),w.mode=20,B!==6)break;W>>>=2,j-=2;break e;case 2:w.mode=17;break;case 3:D.msg="invalid block type",w.mode=30}W>>>=2,j-=2;break;case 14:for(W>>>=7&j,j-=7&j;j<32;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}if((65535&W)!=(W>>>16^65535)){D.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&W,j=W=0,w.mode=15,B===6)break e;case 15:w.mode=16;case 16:if(ue=w.length){if(K<ue&&(ue=K),le<ue&&(ue=le),ue===0)break e;r.arraySet(q,F,z,ue,te),K-=ue,z+=ue,le-=ue,te+=ue,w.length-=ue;break}w.mode=12;break;case 17:for(;j<14;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}if(w.nlen=257+(31&W),W>>>=5,j-=5,w.ndist=1+(31&W),W>>>=5,j-=5,w.ncode=4+(15&W),W>>>=4,j-=4,286<w.nlen||30<w.ndist){D.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;j<3;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}w.lens[$[w.have++]]=7&W,W>>>=3,j-=3}for(;w.have<19;)w.lens[$[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,H={bits:w.lenbits},X=c(0,w.lens,0,19,w.lencode,0,w.work,H),w.lenbits=H.bits,X){D.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;be=(y=w.lencode[W&(1<<w.lenbits)-1])>>>16&255,ye=65535&y,!((fe=y>>>24)<=j);){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}if(ye<16)W>>>=fe,j-=fe,w.lens[w.have++]=ye;else{if(ye===16){for(N=fe+2;j<N;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}if(W>>>=fe,j-=fe,w.have===0){D.msg="invalid bit length repeat",w.mode=30;break}b=w.lens[w.have-1],ue=3+(3&W),W>>>=2,j-=2}else if(ye===17){for(N=fe+3;j<N;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}j-=fe,b=0,ue=3+(7&(W>>>=fe)),W>>>=3,j-=3}else{for(N=fe+7;j<N;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}j-=fe,b=0,ue=11+(127&(W>>>=fe)),W>>>=7,j-=7}if(w.have+ue>w.nlen+w.ndist){D.msg="invalid bit length repeat",w.mode=30;break}for(;ue--;)w.lens[w.have++]=b}}if(w.mode===30)break;if(w.lens[256]===0){D.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,H={bits:w.lenbits},X=c(h,w.lens,0,w.nlen,w.lencode,0,w.work,H),w.lenbits=H.bits,X){D.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,H={bits:w.distbits},X=c(u,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,H),w.distbits=H.bits,X){D.msg="invalid distances set",w.mode=30;break}if(w.mode=20,B===6)break e;case 20:w.mode=21;case 21:if(6<=K&&258<=le){D.next_out=te,D.avail_out=le,D.next_in=z,D.avail_in=K,w.hold=W,w.bits=j,l(D,ge),te=D.next_out,q=D.output,le=D.avail_out,z=D.next_in,F=D.input,K=D.avail_in,W=w.hold,j=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;be=(y=w.lencode[W&(1<<w.lenbits)-1])>>>16&255,ye=65535&y,!((fe=y>>>24)<=j);){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}if(be&&(240&be)==0){for(Oe=fe,Ke=be,Fe=ye;be=(y=w.lencode[Fe+((W&(1<<Oe+Ke)-1)>>Oe)])>>>16&255,ye=65535&y,!(Oe+(fe=y>>>24)<=j);){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}W>>>=Oe,j-=Oe,w.back+=Oe}if(W>>>=fe,j-=fe,w.back+=fe,w.length=ye,be===0){w.mode=26;break}if(32&be){w.back=-1,w.mode=12;break}if(64&be){D.msg="invalid literal/length code",w.mode=30;break}w.extra=15&be,w.mode=22;case 22:if(w.extra){for(N=w.extra;j<N;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}w.length+=W&(1<<w.extra)-1,W>>>=w.extra,j-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;be=(y=w.distcode[W&(1<<w.distbits)-1])>>>16&255,ye=65535&y,!((fe=y>>>24)<=j);){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}if((240&be)==0){for(Oe=fe,Ke=be,Fe=ye;be=(y=w.distcode[Fe+((W&(1<<Oe+Ke)-1)>>Oe)])>>>16&255,ye=65535&y,!(Oe+(fe=y>>>24)<=j);){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}W>>>=Oe,j-=Oe,w.back+=Oe}if(W>>>=fe,j-=fe,w.back+=fe,64&be){D.msg="invalid distance code",w.mode=30;break}w.offset=ye,w.extra=15&be,w.mode=24;case 24:if(w.extra){for(N=w.extra;j<N;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}w.offset+=W&(1<<w.extra)-1,W>>>=w.extra,j-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){D.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(le===0)break e;if(ue=ge-le,w.offset>ue){if((ue=w.offset-ue)>w.whave&&w.sane){D.msg="invalid distance too far back",w.mode=30;break}ie=ue>w.wnext?(ue-=w.wnext,w.wsize-ue):w.wnext-ue,ue>w.length&&(ue=w.length),ce=w.window}else ce=q,ie=te-w.offset,ue=w.length;for(le<ue&&(ue=le),le-=ue,w.length-=ue;q[te++]=ce[ie++],--ue;);w.length===0&&(w.mode=21);break;case 26:if(le===0)break e;q[te++]=w.length,le--,w.mode=21;break;case 27:if(w.wrap){for(;j<32;){if(K===0)break e;K--,W|=F[z++]<<j,j+=8}if(ge-=le,D.total_out+=ge,w.total+=ge,ge&&(D.adler=w.check=w.flags?o(w.check,q,ge,te-ge):a(w.check,q,ge,te-ge)),ge=le,(w.flags?W:m(W))!==w.check){D.msg="incorrect data check",w.mode=30;break}j=W=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;j<32;){if(K===0)break e;K--,W+=F[z++]<<j,j+=8}if(W!==(4294967295&w.total)){D.msg="incorrect length check",w.mode=30;break}j=W=0}w.mode=29;case 29:X=1;break e;case 30:X=-3;break e;case 31:return-4;case 32:default:return d}return D.next_out=te,D.avail_out=le,D.next_in=z,D.avail_in=K,w.hold=W,w.bits=j,(w.wsize||ge!==D.avail_out&&w.mode<30&&(w.mode<27||B!==4))&&k(D,D.output,D.next_out,ge-D.avail_out)?(w.mode=31,-4):(me-=D.avail_in,ge-=D.avail_out,D.total_in+=me,D.total_out+=ge,w.total+=ge,w.wrap&&ge&&(D.adler=w.check=w.flags?o(w.check,q,ge,D.next_out-ge):a(w.check,q,ge,D.next_out-ge)),D.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(me==0&&ge===0||B===4)&&X===f&&(X=-5),X)},i.inflateEnd=function(D){if(!D||!D.state)return d;var B=D.state;return B.window&&(B.window=null),D.state=null,f},i.inflateGetHeader=function(D,B){var w;return D&&D.state?(2&(w=D.state).wrap)==0?d:((w.head=B).done=!1,f):d},i.inflateSetDictionary=function(D,B){var w,F=B.length;return D&&D.state?(w=D.state).wrap!==0&&w.mode!==11?d:w.mode===11&&a(1,B,F,0)!==w.check?-3:k(D,B,F,F)?(w.mode=31,-4):(w.havedict=1,f):d},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,n,i){var r=t("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(h,u,f,d,p,g,v,m){var x,_,M,T,A,L,U,E,C,k=m.bits,D=0,B=0,w=0,F=0,q=0,z=0,te=0,K=0,le=0,W=0,j=null,me=0,ge=new r.Buf16(16),ue=new r.Buf16(16),ie=null,ce=0;for(D=0;D<=15;D++)ge[D]=0;for(B=0;B<d;B++)ge[u[f+B]]++;for(q=k,F=15;1<=F&&ge[F]===0;F--);if(F<q&&(q=F),F===0)return p[g++]=20971520,p[g++]=20971520,m.bits=1,0;for(w=1;w<F&&ge[w]===0;w++);for(q<w&&(q=w),D=K=1;D<=15;D++)if(K<<=1,(K-=ge[D])<0)return-1;if(0<K&&(h===0||F!==1))return-1;for(ue[1]=0,D=1;D<15;D++)ue[D+1]=ue[D]+ge[D];for(B=0;B<d;B++)u[f+B]!==0&&(v[ue[u[f+B]]++]=B);if(L=h===0?(j=ie=v,19):h===1?(j=a,me-=257,ie=o,ce-=257,256):(j=l,ie=c,-1),D=w,A=g,te=B=W=0,M=-1,T=(le=1<<(z=q))-1,h===1&&852<le||h===2&&592<le)return 1;for(;;){for(U=D-te,C=v[B]<L?(E=0,v[B]):v[B]>L?(E=ie[ce+v[B]],j[me+v[B]]):(E=96,0),x=1<<D-te,w=_=1<<z;p[A+(W>>te)+(_-=x)]=U<<24|E<<16|C|0,_!==0;);for(x=1<<D-1;W&x;)x>>=1;if(x!==0?(W&=x-1,W+=x):W=0,B++,--ge[D]==0){if(D===F)break;D=u[f+v[B]]}if(q<D&&(W&T)!==M){for(te===0&&(te=q),A+=w,K=1<<(z=D-te);z+te<F&&!((K-=ge[z+te])<=0);)z++,K<<=1;if(le+=1<<z,h===1&&852<le||h===2&&592<le)return 1;p[M=W&T]=q<<24|z<<16|A-g|0}}return W!==0&&(p[A+W]=D-te<<24|64<<16|0),m.bits=q,0}},{"../utils/common":41}],51:[function(t,n,i){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,n,i){var r=t("../utils/common"),a=0,o=1;function l(y){for(var G=y.length;0<=--G;)y[G]=0}var c=0,h=29,u=256,f=u+1+h,d=30,p=19,g=2*f+1,v=15,m=16,x=7,_=256,M=16,T=17,A=18,L=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],U=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],k=new Array(2*(f+2));l(k);var D=new Array(2*d);l(D);var B=new Array(512);l(B);var w=new Array(256);l(w);var F=new Array(h);l(F);var q,z,te,K=new Array(d);function le(y,G,$,ne,V){this.static_tree=y,this.extra_bits=G,this.extra_base=$,this.elems=ne,this.max_length=V,this.has_stree=y&&y.length}function W(y,G){this.dyn_tree=y,this.max_code=0,this.stat_desc=G}function j(y){return y<256?B[y]:B[256+(y>>>7)]}function me(y,G){y.pending_buf[y.pending++]=255&G,y.pending_buf[y.pending++]=G>>>8&255}function ge(y,G,$){y.bi_valid>m-$?(y.bi_buf|=G<<y.bi_valid&65535,me(y,y.bi_buf),y.bi_buf=G>>m-y.bi_valid,y.bi_valid+=$-m):(y.bi_buf|=G<<y.bi_valid&65535,y.bi_valid+=$)}function ue(y,G,$){ge(y,$[2*G],$[2*G+1])}function ie(y,G){for(var $=0;$|=1&y,y>>>=1,$<<=1,0<--G;);return $>>>1}function ce(y,G,$){var ne,V,P=new Array(v+1),S=0;for(ne=1;ne<=v;ne++)P[ne]=S=S+$[ne-1]<<1;for(V=0;V<=G;V++){var O=y[2*V+1];O!==0&&(y[2*V]=ie(P[O]++,O))}}function fe(y){var G;for(G=0;G<f;G++)y.dyn_ltree[2*G]=0;for(G=0;G<d;G++)y.dyn_dtree[2*G]=0;for(G=0;G<p;G++)y.bl_tree[2*G]=0;y.dyn_ltree[2*_]=1,y.opt_len=y.static_len=0,y.last_lit=y.matches=0}function be(y){8<y.bi_valid?me(y,y.bi_buf):0<y.bi_valid&&(y.pending_buf[y.pending++]=y.bi_buf),y.bi_buf=0,y.bi_valid=0}function ye(y,G,$,ne){var V=2*G,P=2*$;return y[V]<y[P]||y[V]===y[P]&&ne[G]<=ne[$]}function Oe(y,G,$){for(var ne=y.heap[$],V=$<<1;V<=y.heap_len&&(V<y.heap_len&&ye(G,y.heap[V+1],y.heap[V],y.depth)&&V++,!ye(G,ne,y.heap[V],y.depth));)y.heap[$]=y.heap[V],$=V,V<<=1;y.heap[$]=ne}function Ke(y,G,$){var ne,V,P,S,O=0;if(y.last_lit!==0)for(;ne=y.pending_buf[y.d_buf+2*O]<<8|y.pending_buf[y.d_buf+2*O+1],V=y.pending_buf[y.l_buf+O],O++,ne===0?ue(y,V,G):(ue(y,(P=w[V])+u+1,G),(S=L[P])!==0&&ge(y,V-=F[P],S),ue(y,P=j(--ne),$),(S=U[P])!==0&&ge(y,ne-=K[P],S)),O<y.last_lit;);ue(y,_,G)}function Fe(y,G){var $,ne,V,P=G.dyn_tree,S=G.stat_desc.static_tree,O=G.stat_desc.has_stree,Y=G.stat_desc.elems,oe=-1;for(y.heap_len=0,y.heap_max=g,$=0;$<Y;$++)P[2*$]!==0?(y.heap[++y.heap_len]=oe=$,y.depth[$]=0):P[2*$+1]=0;for(;y.heap_len<2;)P[2*(V=y.heap[++y.heap_len]=oe<2?++oe:0)]=1,y.depth[V]=0,y.opt_len--,O&&(y.static_len-=S[2*V+1]);for(G.max_code=oe,$=y.heap_len>>1;1<=$;$--)Oe(y,P,$);for(V=Y;$=y.heap[1],y.heap[1]=y.heap[y.heap_len--],Oe(y,P,1),ne=y.heap[1],y.heap[--y.heap_max]=$,y.heap[--y.heap_max]=ne,P[2*V]=P[2*$]+P[2*ne],y.depth[V]=(y.depth[$]>=y.depth[ne]?y.depth[$]:y.depth[ne])+1,P[2*$+1]=P[2*ne+1]=V,y.heap[1]=V++,Oe(y,P,1),2<=y.heap_len;);y.heap[--y.heap_max]=y.heap[1],(function(Q,Se){var _e,Te,He,he,we,Ne,Ie=Se.dyn_tree,Me=Se.max_code,qe=Se.stat_desc.static_tree,Z=Se.stat_desc.has_stree,Ee=Se.stat_desc.extra_bits,xe=Se.stat_desc.extra_base,Le=Se.stat_desc.max_length,ve=0;for(he=0;he<=v;he++)Q.bl_count[he]=0;for(Ie[2*Q.heap[Q.heap_max]+1]=0,_e=Q.heap_max+1;_e<g;_e++)Le<(he=Ie[2*Ie[2*(Te=Q.heap[_e])+1]+1]+1)&&(he=Le,ve++),Ie[2*Te+1]=he,Me<Te||(Q.bl_count[he]++,we=0,xe<=Te&&(we=Ee[Te-xe]),Ne=Ie[2*Te],Q.opt_len+=Ne*(he+we),Z&&(Q.static_len+=Ne*(qe[2*Te+1]+we)));if(ve!==0){do{for(he=Le-1;Q.bl_count[he]===0;)he--;Q.bl_count[he]--,Q.bl_count[he+1]+=2,Q.bl_count[Le]--,ve-=2}while(0<ve);for(he=Le;he!==0;he--)for(Te=Q.bl_count[he];Te!==0;)Me<(He=Q.heap[--_e])||(Ie[2*He+1]!==he&&(Q.opt_len+=(he-Ie[2*He+1])*Ie[2*He],Ie[2*He+1]=he),Te--)}})(y,G),ce(P,oe,y.bl_count)}function b(y,G,$){var ne,V,P=-1,S=G[1],O=0,Y=7,oe=4;for(S===0&&(Y=138,oe=3),G[2*($+1)+1]=65535,ne=0;ne<=$;ne++)V=S,S=G[2*(ne+1)+1],++O<Y&&V===S||(O<oe?y.bl_tree[2*V]+=O:V!==0?(V!==P&&y.bl_tree[2*V]++,y.bl_tree[2*M]++):O<=10?y.bl_tree[2*T]++:y.bl_tree[2*A]++,P=V,oe=(O=0)===S?(Y=138,3):V===S?(Y=6,3):(Y=7,4))}function X(y,G,$){var ne,V,P=-1,S=G[1],O=0,Y=7,oe=4;for(S===0&&(Y=138,oe=3),ne=0;ne<=$;ne++)if(V=S,S=G[2*(ne+1)+1],!(++O<Y&&V===S)){if(O<oe)for(;ue(y,V,y.bl_tree),--O!=0;);else V!==0?(V!==P&&(ue(y,V,y.bl_tree),O--),ue(y,M,y.bl_tree),ge(y,O-3,2)):O<=10?(ue(y,T,y.bl_tree),ge(y,O-3,3)):(ue(y,A,y.bl_tree),ge(y,O-11,7));P=V,oe=(O=0)===S?(Y=138,3):V===S?(Y=6,3):(Y=7,4)}}l(K);var H=!1;function N(y,G,$,ne){ge(y,(c<<1)+(ne?1:0),3),(function(V,P,S,O){be(V),me(V,S),me(V,~S),r.arraySet(V.pending_buf,V.window,P,S,V.pending),V.pending+=S})(y,G,$)}i._tr_init=function(y){H||((function(){var G,$,ne,V,P,S=new Array(v+1);for(V=ne=0;V<h-1;V++)for(F[V]=ne,G=0;G<1<<L[V];G++)w[ne++]=V;for(w[ne-1]=V,V=P=0;V<16;V++)for(K[V]=P,G=0;G<1<<U[V];G++)B[P++]=V;for(P>>=7;V<d;V++)for(K[V]=P<<7,G=0;G<1<<U[V]-7;G++)B[256+P++]=V;for($=0;$<=v;$++)S[$]=0;for(G=0;G<=143;)k[2*G+1]=8,G++,S[8]++;for(;G<=255;)k[2*G+1]=9,G++,S[9]++;for(;G<=279;)k[2*G+1]=7,G++,S[7]++;for(;G<=287;)k[2*G+1]=8,G++,S[8]++;for(ce(k,f+1,S),G=0;G<d;G++)D[2*G+1]=5,D[2*G]=ie(G,5);q=new le(k,L,u+1,f,v),z=new le(D,U,0,d,v),te=new le(new Array(0),E,0,p,x)})(),H=!0),y.l_desc=new W(y.dyn_ltree,q),y.d_desc=new W(y.dyn_dtree,z),y.bl_desc=new W(y.bl_tree,te),y.bi_buf=0,y.bi_valid=0,fe(y)},i._tr_stored_block=N,i._tr_flush_block=function(y,G,$,ne){var V,P,S=0;0<y.level?(y.strm.data_type===2&&(y.strm.data_type=(function(O){var Y,oe=4093624447;for(Y=0;Y<=31;Y++,oe>>>=1)if(1&oe&&O.dyn_ltree[2*Y]!==0)return a;if(O.dyn_ltree[18]!==0||O.dyn_ltree[20]!==0||O.dyn_ltree[26]!==0)return o;for(Y=32;Y<u;Y++)if(O.dyn_ltree[2*Y]!==0)return o;return a})(y)),Fe(y,y.l_desc),Fe(y,y.d_desc),S=(function(O){var Y;for(b(O,O.dyn_ltree,O.l_desc.max_code),b(O,O.dyn_dtree,O.d_desc.max_code),Fe(O,O.bl_desc),Y=p-1;3<=Y&&O.bl_tree[2*C[Y]+1]===0;Y--);return O.opt_len+=3*(Y+1)+5+5+4,Y})(y),V=y.opt_len+3+7>>>3,(P=y.static_len+3+7>>>3)<=V&&(V=P)):V=P=$+5,$+4<=V&&G!==-1?N(y,G,$,ne):y.strategy===4||P===V?(ge(y,2+(ne?1:0),3),Ke(y,k,D)):(ge(y,4+(ne?1:0),3),(function(O,Y,oe,Q){var Se;for(ge(O,Y-257,5),ge(O,oe-1,5),ge(O,Q-4,4),Se=0;Se<Q;Se++)ge(O,O.bl_tree[2*C[Se]+1],3);X(O,O.dyn_ltree,Y-1),X(O,O.dyn_dtree,oe-1)})(y,y.l_desc.max_code+1,y.d_desc.max_code+1,S+1),Ke(y,y.dyn_ltree,y.dyn_dtree)),fe(y),ne&&be(y)},i._tr_tally=function(y,G,$){return y.pending_buf[y.d_buf+2*y.last_lit]=G>>>8&255,y.pending_buf[y.d_buf+2*y.last_lit+1]=255&G,y.pending_buf[y.l_buf+y.last_lit]=255&$,y.last_lit++,G===0?y.dyn_ltree[2*$]++:(y.matches++,G--,y.dyn_ltree[2*(w[$]+u+1)]++,y.dyn_dtree[2*j(G)]++),y.last_lit===y.lit_bufsize-1},i._tr_align=function(y){ge(y,2,3),ue(y,_,k),(function(G){G.bi_valid===16?(me(G,G.bi_buf),G.bi_buf=0,G.bi_valid=0):8<=G.bi_valid&&(G.pending_buf[G.pending++]=255&G.bi_buf,G.bi_buf>>=8,G.bi_valid-=8)})(y)}},{"../utils/common":41}],53:[function(t,n,i){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,n,i){(function(r){(function(a,o){if(!a.setImmediate){var l,c,h,u,f=1,d={},p=!1,g=a.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(a);v=v&&v.setTimeout?v:a,l={}.toString.call(a.process)==="[object process]"?function(M){process.nextTick(function(){x(M)})}:(function(){if(a.postMessage&&!a.importScripts){var M=!0,T=a.onmessage;return a.onmessage=function(){M=!1},a.postMessage("","*"),a.onmessage=T,M}})()?(u="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",_,!1):a.attachEvent("onmessage",_),function(M){a.postMessage(u+M,"*")}):a.MessageChannel?((h=new MessageChannel).port1.onmessage=function(M){x(M.data)},function(M){h.port2.postMessage(M)}):g&&"onreadystatechange"in g.createElement("script")?(c=g.documentElement,function(M){var T=g.createElement("script");T.onreadystatechange=function(){x(M),T.onreadystatechange=null,c.removeChild(T),T=null},c.appendChild(T)}):function(M){setTimeout(x,0,M)},v.setImmediate=function(M){typeof M!="function"&&(M=new Function(""+M));for(var T=new Array(arguments.length-1),A=0;A<T.length;A++)T[A]=arguments[A+1];var L={callback:M,args:T};return d[f]=L,l(f),f++},v.clearImmediate=m}function m(M){delete d[M]}function x(M){if(p)setTimeout(x,0,M);else{var T=d[M];if(T){p=!0;try{(function(A){var L=A.callback,U=A.args;switch(U.length){case 0:L();break;case 1:L(U[0]);break;case 2:L(U[0],U[1]);break;case 3:L(U[0],U[1],U[2]);break;default:L.apply(o,U)}})(T)}finally{m(M),p=!1}}}}function _(M){M.source===a&&typeof M.data=="string"&&M.data.indexOf(u)===0&&x(+M.data.slice(u.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,typeof Ea<"u"?Ea:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(id)),id.exports}var l_=o_();const c_=nd(l_);function rd(s,e){return function(){return s.apply(e,arguments)}}const{toString:h_}=Object.prototype,{getPrototypeOf:ac}=Object,{iterator:Ca,toStringTag:ad}=Symbol,Aa=(s=>e=>{const t=h_.call(e);return s[t]||(s[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),In=s=>(s=s.toLowerCase(),e=>Aa(e)===s),Pa=s=>e=>typeof e===s,{isArray:Ts}=Array,Cs=Pa("undefined");function hr(s){return s!==null&&!Cs(s)&&s.constructor!==null&&!Cs(s.constructor)&&an(s.constructor.isBuffer)&&s.constructor.isBuffer(s)}const od=In("ArrayBuffer");function u_(s){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(s):e=s&&s.buffer&&od(s.buffer),e}const d_=Pa("string"),an=Pa("function"),ld=Pa("number"),ur=s=>s!==null&&typeof s=="object",f_=s=>s===!0||s===!1,Ra=s=>{if(Aa(s)!=="object")return!1;const e=ac(s);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(ad in s)&&!(Ca in s)},p_=s=>{if(!ur(s)||hr(s))return!1;try{return Object.keys(s).length===0&&Object.getPrototypeOf(s)===Object.prototype}catch{return!1}},m_=In("Date"),g_=In("File"),v_=In("Blob"),x_=In("FileList"),__=s=>ur(s)&&an(s.pipe),b_=s=>{let e;return s&&(typeof FormData=="function"&&s instanceof FormData||an(s.append)&&((e=Aa(s))==="formdata"||e==="object"&&an(s.toString)&&s.toString()==="[object FormData]"))},y_=In("URLSearchParams"),[M_,w_,S_,E_]=["ReadableStream","Request","Response","Headers"].map(In),T_=s=>s.trim?s.trim():s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function dr(s,e,{allOwnKeys:t=!1}={}){if(s===null||typeof s>"u")return;let n,i;if(typeof s!="object"&&(s=[s]),Ts(s))for(n=0,i=s.length;n<i;n++)e.call(null,s[n],n,s);else{if(hr(s))return;const r=t?Object.getOwnPropertyNames(s):Object.keys(s),a=r.length;let o;for(n=0;n<a;n++)o=r[n],e.call(null,s[o],o,s)}}function cd(s,e){if(hr(s))return null;e=e.toLowerCase();const t=Object.keys(s);let n=t.length,i;for(;n-- >0;)if(i=t[n],e===i.toLowerCase())return i;return null}const Ni=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,hd=s=>!Cs(s)&&s!==Ni;function oc(){const{caseless:s,skipUndefined:e}=hd(this)&&this||{},t={},n=(i,r)=>{const a=s&&cd(t,r)||r;Ra(t[a])&&Ra(i)?t[a]=oc(t[a],i):Ra(i)?t[a]=oc({},i):Ts(i)?t[a]=i.slice():(!e||!Cs(i))&&(t[a]=i)};for(let i=0,r=arguments.length;i<r;i++)arguments[i]&&dr(arguments[i],n);return t}const C_=(s,e,t,{allOwnKeys:n}={})=>(dr(e,(i,r)=>{t&&an(i)?s[r]=rd(i,t):s[r]=i},{allOwnKeys:n}),s),A_=s=>(s.charCodeAt(0)===65279&&(s=s.slice(1)),s),P_=(s,e,t,n)=>{s.prototype=Object.create(e.prototype,n),s.prototype.constructor=s,Object.defineProperty(s,"super",{value:e.prototype}),t&&Object.assign(s.prototype,t)},R_=(s,e,t,n)=>{let i,r,a;const o={};if(e=e||{},s==null)return e;do{for(i=Object.getOwnPropertyNames(s),r=i.length;r-- >0;)a=i[r],(!n||n(a,s,e))&&!o[a]&&(e[a]=s[a],o[a]=!0);s=t!==!1&&ac(s)}while(s&&(!t||t(s,e))&&s!==Object.prototype);return e},L_=(s,e,t)=>{s=String(s),(t===void 0||t>s.length)&&(t=s.length),t-=e.length;const n=s.indexOf(e,t);return n!==-1&&n===t},D_=s=>{if(!s)return null;if(Ts(s))return s;let e=s.length;if(!ld(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=s[e];return t},I_=(s=>e=>s&&e instanceof s)(typeof Uint8Array<"u"&&ac(Uint8Array)),N_=(s,e)=>{const t=(s&&s[Ca]).call(s);let n;for(;(n=t.next())&&!n.done;){const i=n.value;e.call(s,i[0],i[1])}},U_=(s,e)=>{let t;const n=[];for(;(t=s.exec(e))!==null;)n.push(t);return n},B_=In("HTMLFormElement"),k_=s=>s.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),ud=(({hasOwnProperty:s})=>(e,t)=>s.call(e,t))(Object.prototype),O_=In("RegExp"),dd=(s,e)=>{const t=Object.getOwnPropertyDescriptors(s),n={};dr(t,(i,r)=>{let a;(a=e(i,r,s))!==!1&&(n[r]=a||i)}),Object.defineProperties(s,n)},F_=s=>{dd(s,(e,t)=>{if(an(s)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=s[t];if(an(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},z_=(s,e)=>{const t={},n=i=>{i.forEach(r=>{t[r]=!0})};return Ts(s)?n(s):n(String(s).split(e)),t},H_=()=>{},V_=(s,e)=>s!=null&&Number.isFinite(s=+s)?s:e;function G_(s){return!!(s&&an(s.append)&&s[ad]==="FormData"&&s[Ca])}const W_=s=>{const e=new Array(10),t=(n,i)=>{if(ur(n)){if(e.indexOf(n)>=0)return;if(hr(n))return n;if(!("toJSON"in n)){e[i]=n;const r=Ts(n)?[]:{};return dr(n,(a,o)=>{const l=t(a,i+1);!Cs(l)&&(r[o]=l)}),e[i]=void 0,r}}return n};return t(s,0)},X_=In("AsyncFunction"),j_=s=>s&&(ur(s)||an(s))&&an(s.then)&&an(s.catch),fd=((s,e)=>s?setImmediate:e?((t,n)=>(Ni.addEventListener("message",({source:i,data:r})=>{i===Ni&&r===t&&n.length&&n.shift()()},!1),i=>{n.push(i),Ni.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",an(Ni.postMessage)),Z_=typeof queueMicrotask<"u"?queueMicrotask.bind(Ni):typeof process<"u"&&process.nextTick||fd,q_=s=>s!=null&&an(s[Ca]),re={isArray:Ts,isArrayBuffer:od,isBuffer:hr,isFormData:b_,isArrayBufferView:u_,isString:d_,isNumber:ld,isBoolean:f_,isObject:ur,isPlainObject:Ra,isEmptyObject:p_,isReadableStream:M_,isRequest:w_,isResponse:S_,isHeaders:E_,isUndefined:Cs,isDate:m_,isFile:g_,isBlob:v_,isRegExp:O_,isFunction:an,isStream:__,isURLSearchParams:y_,isTypedArray:I_,isFileList:x_,forEach:dr,merge:oc,extend:C_,trim:T_,stripBOM:A_,inherits:P_,toFlatObject:R_,kindOf:Aa,kindOfTest:In,endsWith:L_,toArray:D_,forEachEntry:N_,matchAll:U_,isHTMLForm:B_,hasOwnProperty:ud,hasOwnProp:ud,reduceDescriptors:dd,freezeMethods:F_,toObjectSet:z_,toCamelCase:k_,noop:H_,toFiniteNumber:V_,findKey:cd,global:Ni,isContextDefined:hd,isSpecCompliantForm:G_,toJSONObject:W_,isAsyncFn:X_,isThenable:j_,setImmediate:fd,asap:Z_,isIterable:q_};function $e(s,e,t,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=s,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}re.inherits($e,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.status}}});const pd=$e.prototype,md={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(s=>{md[s]={value:s}}),Object.defineProperties($e,md),Object.defineProperty(pd,"isAxiosError",{value:!0}),$e.from=(s,e,t,n,i,r)=>{const a=Object.create(pd);re.toFlatObject(s,a,function(c){return c!==Error.prototype},c=>c!=="isAxiosError");const o=s&&s.message?s.message:"Error",l=e==null&&s?s.code:e;return $e.call(a,o,l,t,n,i),s&&a.cause==null&&Object.defineProperty(a,"cause",{value:s,configurable:!0}),a.name=s&&s.name||"Error",r&&Object.assign(a,r),a};const Y_=null;function lc(s){return re.isPlainObject(s)||re.isArray(s)}function gd(s){return re.endsWith(s,"[]")?s.slice(0,-2):s}function vd(s,e,t){return s?s.concat(e).map(function(n,i){return n=gd(n),!t&&i?"["+n+"]":n}).join(t?".":""):e}function K_(s){return re.isArray(s)&&!s.some(lc)}const $_=re.toFlatObject(re,{},null,function(s){return/^is[A-Z]/.test(s)});function La(s,e,t){if(!re.isObject(s))throw new TypeError("target must be an object");e=e||new FormData,t=re.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,p){return!re.isUndefined(p[d])});const n=t.metaTokens,i=t.visitor||c,r=t.dots,a=t.indexes,o=(t.Blob||typeof Blob<"u"&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(i))throw new TypeError("visitor must be a function");function l(d){if(d===null)return"";if(re.isDate(d))return d.toISOString();if(re.isBoolean(d))return d.toString();if(!o&&re.isBlob(d))throw new $e("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(d)||re.isTypedArray(d)?o&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function c(d,p,g){let v=d;if(d&&!g&&typeof d=="object"){if(re.endsWith(p,"{}"))p=n?p:p.slice(0,-2),d=JSON.stringify(d);else if(re.isArray(d)&&K_(d)||(re.isFileList(d)||re.endsWith(p,"[]"))&&(v=re.toArray(d)))return p=gd(p),v.forEach(function(m,x){!(re.isUndefined(m)||m===null)&&e.append(a===!0?vd([p],x,r):a===null?p:p+"[]",l(m))}),!1}return lc(d)?!0:(e.append(vd(g,p,r),l(d)),!1)}const h=[],u=Object.assign($_,{defaultVisitor:c,convertValue:l,isVisitable:lc});function f(d,p){if(!re.isUndefined(d)){if(h.indexOf(d)!==-1)throw Error("Circular reference detected in "+p.join("."));h.push(d),re.forEach(d,function(g,v){(!(re.isUndefined(g)||g===null)&&i.call(e,g,re.isString(v)?v.trim():v,p,u))===!0&&f(g,p?p.concat(v):[v])}),h.pop()}}if(!re.isObject(s))throw new TypeError("data must be an object");return f(s),e}function xd(s){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(s).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function cc(s,e){this._pairs=[],s&&La(s,this,e)}const _d=cc.prototype;_d.append=function(s,e){this._pairs.push([s,e])},_d.toString=function(s){const e=s?function(t){return s.call(this,t,xd)}:xd;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};function J_(s){return encodeURIComponent(s).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function bd(s,e,t){if(!e)return s;const n=t&&t.encode||J_;re.isFunction(t)&&(t={serialize:t});const i=t&&t.serialize;let r;if(i?r=i(e,t):r=re.isURLSearchParams(e)?e.toString():new cc(e,t).toString(n),r){const a=s.indexOf("#");a!==-1&&(s=s.slice(0,a)),s+=(s.indexOf("?")===-1?"?":"&")+r}return s}class yd{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){re.forEach(this.handlers,function(t){t!==null&&e(t)})}}const Md={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Q_=typeof URLSearchParams<"u"?URLSearchParams:cc,eb=typeof FormData<"u"?FormData:null,tb=typeof Blob<"u"?Blob:null,nb={isBrowser:!0,classes:{URLSearchParams:Q_,FormData:eb,Blob:tb},protocols:["http","https","file","blob","url","data"]},hc=typeof window<"u"&&typeof document<"u",uc=typeof navigator=="object"&&navigator||void 0,ib=hc&&(!uc||["ReactNative","NativeScript","NS"].indexOf(uc.product)<0),sb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",rb=hc&&window.location.href||"http://localhost",ab=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:hc,hasStandardBrowserEnv:ib,hasStandardBrowserWebWorkerEnv:sb,navigator:uc,origin:rb},Symbol.toStringTag,{value:"Module"})),qt={...ab,...nb};function ob(s,e){return La(s,new qt.classes.URLSearchParams,{visitor:function(t,n,i,r){return qt.isNode&&re.isBuffer(t)?(this.append(n,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...e})}function lb(s){return re.matchAll(/\w+|\[(\w*)]/g,s).map(e=>e[0]==="[]"?"":e[1]||e[0])}function cb(s){const e={},t=Object.keys(s);let n;const i=t.length;let r;for(n=0;n<i;n++)r=t[n],e[r]=s[r];return e}function wd(s){function e(t,n,i,r){let a=t[r++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),l=r>=t.length;return a=!a&&re.isArray(i)?i.length:a,l?(re.hasOwnProp(i,a)?i[a]=[i[a],n]:i[a]=n,!o):((!i[a]||!re.isObject(i[a]))&&(i[a]=[]),e(t,n,i[a],r)&&re.isArray(i[a])&&(i[a]=cb(i[a])),!o)}if(re.isFormData(s)&&re.isFunction(s.entries)){const t={};return re.forEachEntry(s,(n,i)=>{e(lb(n),i,t,0)}),t}return null}function hb(s,e,t){if(re.isString(s))try{return(e||JSON.parse)(s),re.trim(s)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(s)}const fr={transitional:Md,adapter:["xhr","http","fetch"],transformRequest:[function(s,e){const t=e.getContentType()||"",n=t.indexOf("application/json")>-1,i=re.isObject(s);if(i&&re.isHTMLForm(s)&&(s=new FormData(s)),re.isFormData(s))return n?JSON.stringify(wd(s)):s;if(re.isArrayBuffer(s)||re.isBuffer(s)||re.isStream(s)||re.isFile(s)||re.isBlob(s)||re.isReadableStream(s))return s;if(re.isArrayBufferView(s))return s.buffer;if(re.isURLSearchParams(s))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),s.toString();let r;if(i){if(t.indexOf("application/x-www-form-urlencoded")>-1)return ob(s,this.formSerializer).toString();if((r=re.isFileList(s))||t.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return La(r?{"files[]":s}:s,a&&new a,this.formSerializer)}}return i||n?(e.setContentType("application/json",!1),hb(s)):s}],transformResponse:[function(s){const e=this.transitional||fr.transitional,t=e&&e.forcedJSONParsing,n=this.responseType==="json";if(re.isResponse(s)||re.isReadableStream(s))return s;if(s&&re.isString(s)&&(t&&!this.responseType||n)){const i=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(s,this.parseReviver)}catch(r){if(i)throw r.name==="SyntaxError"?$e.from(r,$e.ERR_BAD_RESPONSE,this,null,this.response):r}}return s}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qt.classes.FormData,Blob:qt.classes.Blob},validateStatus:function(s){return s>=200&&s<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],s=>{fr.headers[s]={}});const ub=re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),db=s=>{const e={};let t,n,i;return s&&s.split(`
|
||
`).forEach(function(r){i=r.indexOf(":"),t=r.substring(0,i).trim().toLowerCase(),n=r.substring(i+1).trim(),!(!t||e[t]&&ub[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e},Sd=Symbol("internals");function pr(s){return s&&String(s).trim().toLowerCase()}function Da(s){return s===!1||s==null?s:re.isArray(s)?s.map(Da):String(s)}function fb(s){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=t.exec(s);)e[n[1]]=n[2];return e}const pb=s=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(s.trim());function dc(s,e,t,n,i){if(re.isFunction(n))return n.call(this,e,t);if(i&&(e=t),!!re.isString(e)){if(re.isString(n))return e.indexOf(n)!==-1;if(re.isRegExp(n))return n.test(e)}}function mb(s){return s.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function gb(s,e){const t=re.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(s,n+t,{value:function(i,r,a){return this[n].call(this,e,i,r,a)},configurable:!0})})}let on=class{constructor(s){s&&this.set(s)}set(s,e,t){const n=this;function i(a,o,l){const c=pr(o);if(!c)throw new Error("header name must be a non-empty string");const h=re.findKey(n,c);(!h||n[h]===void 0||l===!0||l===void 0&&n[h]!==!1)&&(n[h||o]=Da(a))}const r=(a,o)=>re.forEach(a,(l,c)=>i(l,c,o));if(re.isPlainObject(s)||s instanceof this.constructor)r(s,e);else if(re.isString(s)&&(s=s.trim())&&!pb(s))r(db(s),e);else if(re.isObject(s)&&re.isIterable(s)){let a={},o,l;for(const c of s){if(!re.isArray(c))throw TypeError("Object iterator must return a key-value pair");a[l=c[0]]=(o=a[l])?re.isArray(o)?[...o,c[1]]:[o,c[1]]:c[1]}r(a,e)}else s!=null&&i(e,s,t);return this}get(s,e){if(s=pr(s),s){const t=re.findKey(this,s);if(t){const n=this[t];if(!e)return n;if(e===!0)return fb(n);if(re.isFunction(e))return e.call(this,n,t);if(re.isRegExp(e))return e.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(s,e){if(s=pr(s),s){const t=re.findKey(this,s);return!!(t&&this[t]!==void 0&&(!e||dc(this,this[t],t,e)))}return!1}delete(s,e){const t=this;let n=!1;function i(r){if(r=pr(r),r){const a=re.findKey(t,r);a&&(!e||dc(t,t[a],a,e))&&(delete t[a],n=!0)}}return re.isArray(s)?s.forEach(i):i(s),n}clear(s){const e=Object.keys(this);let t=e.length,n=!1;for(;t--;){const i=e[t];(!s||dc(this,this[i],i,s,!0))&&(delete this[i],n=!0)}return n}normalize(s){const e=this,t={};return re.forEach(this,(n,i)=>{const r=re.findKey(t,i);if(r){e[r]=Da(n),delete e[i];return}const a=s?mb(i):String(i).trim();a!==i&&delete e[i],e[a]=Da(n),t[a]=!0}),this}concat(...s){return this.constructor.concat(this,...s)}toJSON(s){const e=Object.create(null);return re.forEach(this,(t,n)=>{t!=null&&t!==!1&&(e[n]=s&&re.isArray(t)?t.join(", "):t)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([s,e])=>s+": "+e).join(`
|
||
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(s){return s instanceof this?s:new this(s)}static concat(s,...e){const t=new this(s);return e.forEach(n=>t.set(n)),t}static accessor(s){const e=(this[Sd]=this[Sd]={accessors:{}}).accessors,t=this.prototype;function n(i){const r=pr(i);e[r]||(gb(t,i),e[r]=!0)}return re.isArray(s)?s.forEach(n):n(s),this}};on.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),re.reduceDescriptors(on.prototype,({value:s},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>s,set(n){this[t]=n}}}),re.freezeMethods(on);function fc(s,e){const t=this||fr,n=e||t,i=on.from(n.headers);let r=n.data;return re.forEach(s,function(a){r=a.call(t,r,i.normalize(),e?e.status:void 0)}),i.normalize(),r}function Ed(s){return!!(s&&s.__CANCEL__)}function As(s,e,t){$e.call(this,s??"canceled",$e.ERR_CANCELED,e,t),this.name="CanceledError"}re.inherits(As,$e,{__CANCEL__:!0});function Td(s,e,t){const n=t.config.validateStatus;!t.status||!n||n(t.status)?s(t):e(new $e("Request failed with status code "+t.status,[$e.ERR_BAD_REQUEST,$e.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function vb(s){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(s);return e&&e[1]||""}function xb(s,e){s=s||10;const t=new Array(s),n=new Array(s);let i=0,r=0,a;return e=e!==void 0?e:1e3,function(o){const l=Date.now(),c=n[r];a||(a=l),t[i]=o,n[i]=l;let h=r,u=0;for(;h!==i;)u+=t[h++],h=h%s;if(i=(i+1)%s,i===r&&(r=(r+1)%s),l-a<e)return;const f=c&&l-c;return f?Math.round(u*1e3/f):void 0}}function _b(s,e){let t=0,n=1e3/e,i,r;const a=(o,l=Date.now())=>{t=l,i=null,r&&(clearTimeout(r),r=null),s(...o)};return[(...o)=>{const l=Date.now(),c=l-t;c>=n?a(o,l):(i=o,r||(r=setTimeout(()=>{r=null,a(i)},n-c)))},()=>i&&a(i)]}const Ia=(s,e,t=3)=>{let n=0;const i=xb(50,250);return _b(r=>{const a=r.loaded,o=r.lengthComputable?r.total:void 0,l=a-n,c=i(l),h=a<=o;n=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&h?(o-a)/c:void 0,event:r,lengthComputable:o!=null,[e?"download":"upload"]:!0};s(u)},t)},Cd=(s,e)=>{const t=s!=null;return[n=>e[0]({lengthComputable:t,total:s,loaded:n}),e[1]]},Ad=s=>(...e)=>re.asap(()=>s(...e)),bb=qt.hasStandardBrowserEnv?((s,e)=>t=>(t=new URL(t,qt.origin),s.protocol===t.protocol&&s.host===t.host&&(e||s.port===t.port)))(new URL(qt.origin),qt.navigator&&/(msie|trident)/i.test(qt.navigator.userAgent)):()=>!0,yb=qt.hasStandardBrowserEnv?{write(s,e,t,n,i,r,a){if(typeof document>"u")return;const o=[`${s}=${encodeURIComponent(e)}`];re.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),re.isString(n)&&o.push(`path=${n}`),re.isString(i)&&o.push(`domain=${i}`),r===!0&&o.push("secure"),re.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(s){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+s+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(s){this.write(s,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Mb(s){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s)}function wb(s,e){return e?s.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):s}function Pd(s,e,t){let n=!Mb(e);return s&&(n||t==!1)?wb(s,e):e}const Rd=s=>s instanceof on?{...s}:s;function Ui(s,e){e=e||{};const t={};function n(c,h,u,f){return re.isPlainObject(c)&&re.isPlainObject(h)?re.merge.call({caseless:f},c,h):re.isPlainObject(h)?re.merge({},h):re.isArray(h)?h.slice():h}function i(c,h,u,f){if(re.isUndefined(h)){if(!re.isUndefined(c))return n(void 0,c,u,f)}else return n(c,h,u,f)}function r(c,h){if(!re.isUndefined(h))return n(void 0,h)}function a(c,h){if(re.isUndefined(h)){if(!re.isUndefined(c))return n(void 0,c)}else return n(void 0,h)}function o(c,h,u){if(u in e)return n(c,h);if(u in s)return n(void 0,c)}const l={url:r,method:r,data:r,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(c,h,u)=>i(Rd(c),Rd(h),u,!0)};return re.forEach(Object.keys({...s,...e}),function(c){const h=l[c]||i,u=h(s[c],e[c],c);re.isUndefined(u)&&h!==o||(t[c]=u)}),t}const Ld=s=>{const e=Ui({},s);let{data:t,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:r,headers:a,auth:o}=e;if(e.headers=a=on.from(a),e.url=bd(Pd(e.baseURL,e.url,e.allowAbsoluteUrls),s.params,s.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),re.isFormData(t)){if(qt.hasStandardBrowserEnv||qt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(re.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([h,u])=>{c.includes(h.toLowerCase())&&a.set(h,u)})}}if(qt.hasStandardBrowserEnv&&(n&&re.isFunction(n)&&(n=n(e)),n||n!==!1&&bb(e.url))){const l=i&&r&&yb.read(r);l&&a.set(i,l)}return e},Sb=typeof XMLHttpRequest<"u",Eb=Sb&&function(s){return new Promise(function(e,t){const n=Ld(s);let i=n.data;const r=on.from(n.headers).normalize();let{responseType:a,onUploadProgress:o,onDownloadProgress:l}=n,c,h,u,f,d;function p(){f&&f(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(c),n.signal&&n.signal.removeEventListener("abort",c)}let g=new XMLHttpRequest;g.open(n.method.toUpperCase(),n.url,!0),g.timeout=n.timeout;function v(){if(!g)return;const x=on.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),_={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:x,config:s,request:g};Td(function(M){e(M),p()},function(M){t(M),p()},_),g=null}"onloadend"in g?g.onloadend=v:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(v)},g.onabort=function(){g&&(t(new $e("Request aborted",$e.ECONNABORTED,s,g)),g=null)},g.onerror=function(x){const _=x&&x.message?x.message:"Network Error",M=new $e(_,$e.ERR_NETWORK,s,g);M.event=x||null,t(M),g=null},g.ontimeout=function(){let x=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const _=n.transitional||Md;n.timeoutErrorMessage&&(x=n.timeoutErrorMessage),t(new $e(x,_.clarifyTimeoutError?$e.ETIMEDOUT:$e.ECONNABORTED,s,g)),g=null},i===void 0&&r.setContentType(null),"setRequestHeader"in g&&re.forEach(r.toJSON(),function(x,_){g.setRequestHeader(_,x)}),re.isUndefined(n.withCredentials)||(g.withCredentials=!!n.withCredentials),a&&a!=="json"&&(g.responseType=n.responseType),l&&([u,d]=Ia(l,!0),g.addEventListener("progress",u)),o&&g.upload&&([h,f]=Ia(o),g.upload.addEventListener("progress",h),g.upload.addEventListener("loadend",f)),(n.cancelToken||n.signal)&&(c=x=>{g&&(t(!x||x.type?new As(null,s,g):x),g.abort(),g=null)},n.cancelToken&&n.cancelToken.subscribe(c),n.signal&&(n.signal.aborted?c():n.signal.addEventListener("abort",c)));const m=vb(n.url);if(m&&qt.protocols.indexOf(m)===-1){t(new $e("Unsupported protocol "+m+":",$e.ERR_BAD_REQUEST,s));return}g.send(i||null)})},Tb=(s,e)=>{const{length:t}=s=s?s.filter(Boolean):[];if(e||t){let n=new AbortController,i;const r=function(c){if(!i){i=!0,o();const h=c instanceof Error?c:this.reason;n.abort(h instanceof $e?h:new As(h instanceof Error?h.message:h))}};let a=e&&setTimeout(()=>{a=null,r(new $e(`timeout ${e} of ms exceeded`,$e.ETIMEDOUT))},e);const o=()=>{s&&(a&&clearTimeout(a),a=null,s.forEach(c=>{c.unsubscribe?c.unsubscribe(r):c.removeEventListener("abort",r)}),s=null)};s.forEach(c=>c.addEventListener("abort",r));const{signal:l}=n;return l.unsubscribe=()=>re.asap(o),l}},Cb=function*(s,e){let t=s.byteLength;if(t<e){yield s;return}let n=0,i;for(;n<t;)i=n+e,yield s.slice(n,i),n=i},Ab=async function*(s,e){for await(const t of Pb(s))yield*Cb(t,e)},Pb=async function*(s){if(s[Symbol.asyncIterator]){yield*s;return}const e=s.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},Dd=(s,e,t,n)=>{const i=Ab(s,e);let r=0,a,o=l=>{a||(a=!0,n&&n(l))};return new ReadableStream({async pull(l){try{const{done:c,value:h}=await i.next();if(c){o(),l.close();return}let u=h.byteLength;if(t){let f=r+=u;t(f)}l.enqueue(new Uint8Array(h))}catch(c){throw o(c),c}},cancel(l){return o(l),i.return()}},{highWaterMark:2})},Id=64*1024,{isFunction:Na}=re,Rb=(({Request:s,Response:e})=>({Request:s,Response:e}))(re.global),{ReadableStream:Nd,TextEncoder:Ud}=re.global,Bd=(s,...e)=>{try{return!!s(...e)}catch{return!1}},Lb=s=>{s=re.merge.call({skipUndefined:!0},Rb,s);const{fetch:e,Request:t,Response:n}=s,i=e?Na(e):typeof fetch=="function",r=Na(t),a=Na(n);if(!i)return!1;const o=i&&Na(Nd),l=i&&(typeof Ud=="function"?(p=>g=>p.encode(g))(new Ud):async p=>new Uint8Array(await new t(p).arrayBuffer())),c=r&&o&&Bd(()=>{let p=!1;const g=new t(qt.origin,{body:new Nd,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!g}),h=a&&o&&Bd(()=>re.isReadableStream(new n("").body)),u={stream:h&&(p=>p.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!u[p]&&(u[p]=(g,v)=>{let m=g&&g[p];if(m)return m.call(g);throw new $e(`Response type '${p}' is not supported`,$e.ERR_NOT_SUPPORT,v)})});const f=async p=>{if(p==null)return 0;if(re.isBlob(p))return p.size;if(re.isSpecCompliantForm(p))return(await new t(qt.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(re.isArrayBufferView(p)||re.isArrayBuffer(p))return p.byteLength;if(re.isURLSearchParams(p)&&(p=p+""),re.isString(p))return(await l(p)).byteLength},d=async(p,g)=>re.toFiniteNumber(p.getContentLength())??f(g);return async p=>{let{url:g,method:v,data:m,signal:x,cancelToken:_,timeout:M,onDownloadProgress:T,onUploadProgress:A,responseType:L,headers:U,withCredentials:E="same-origin",fetchOptions:C}=Ld(p),k=e||fetch;L=L?(L+"").toLowerCase():"text";let D=Tb([x,_&&_.toAbortSignal()],M),B=null;const w=D&&D.unsubscribe&&(()=>{D.unsubscribe()});let F;try{if(A&&c&&v!=="get"&&v!=="head"&&(F=await d(U,m))!==0){let W=new t(g,{method:"POST",body:m,duplex:"half"}),j;if(re.isFormData(m)&&(j=W.headers.get("content-type"))&&U.setContentType(j),W.body){const[me,ge]=Cd(F,Ia(Ad(A)));m=Dd(W.body,Id,me,ge)}}re.isString(E)||(E=E?"include":"omit");const q=r&&"credentials"in t.prototype,z={...C,signal:D,method:v.toUpperCase(),headers:U.normalize().toJSON(),body:m,duplex:"half",credentials:q?E:void 0};B=r&&new t(g,z);let te=await(r?k(B,C):k(g,z));const K=h&&(L==="stream"||L==="response");if(h&&(T||K&&w)){const W={};["status","statusText","headers"].forEach(ue=>{W[ue]=te[ue]});const j=re.toFiniteNumber(te.headers.get("content-length")),[me,ge]=T&&Cd(j,Ia(Ad(T),!0))||[];te=new n(Dd(te.body,Id,me,()=>{ge&&ge(),w&&w()}),W)}L=L||"text";let le=await u[re.findKey(u,L)||"text"](te,p);return!K&&w&&w(),await new Promise((W,j)=>{Td(W,j,{data:le,headers:on.from(te.headers),status:te.status,statusText:te.statusText,config:p,request:B})})}catch(q){throw w&&w(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new $e("Network Error",$e.ERR_NETWORK,p,B),{cause:q.cause||q}):$e.from(q,q&&q.code,p,B)}}},Db=new Map,kd=s=>{let e=s&&s.env||{};const{fetch:t,Request:n,Response:i}=e,r=[n,i,t];let a=r.length,o=a,l,c,h=Db;for(;o--;)l=r[o],c=h.get(l),c===void 0&&h.set(l,c=o?new Map:Lb(e)),h=c;return c};kd();const pc={http:Y_,xhr:Eb,fetch:{get:kd}};re.forEach(pc,(s,e)=>{if(s){try{Object.defineProperty(s,"name",{value:e})}catch{}Object.defineProperty(s,"adapterName",{value:e})}});const Od=s=>`- ${s}`,Ib=s=>re.isFunction(s)||s===null||s===!1;function Nb(s,e){s=re.isArray(s)?s:[s];const{length:t}=s;let n,i;const r={};for(let a=0;a<t;a++){n=s[a];let o;if(i=n,!Ib(n)&&(i=pc[(o=String(n)).toLowerCase()],i===void 0))throw new $e(`Unknown adapter '${o}'`);if(i&&(re.isFunction(i)||(i=i.get(e))))break;r[o||"#"+a]=i}if(!i){const a=Object.entries(r).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?a.length>1?`since :
|
||
`+a.map(Od).join(`
|
||
`):" "+Od(a[0]):"as no adapter specified";throw new $e("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i}const Fd={getAdapter:Nb,adapters:pc};function mc(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new As(null,s)}function zd(s){return mc(s),s.headers=on.from(s.headers),s.data=fc.call(s,s.transformRequest),["post","put","patch"].indexOf(s.method)!==-1&&s.headers.setContentType("application/x-www-form-urlencoded",!1),Fd.getAdapter(s.adapter||fr.adapter,s)(s).then(function(e){return mc(s),e.data=fc.call(s,s.transformResponse,e),e.headers=on.from(e.headers),e},function(e){return Ed(e)||(mc(s),e&&e.response&&(e.response.data=fc.call(s,s.transformResponse,e.response),e.response.headers=on.from(e.response.headers))),Promise.reject(e)})}const Hd="1.13.2",Ua={};["object","boolean","number","function","string","symbol"].forEach((s,e)=>{Ua[s]=function(t){return typeof t===s||"a"+(e<1?"n ":" ")+s}});const Vd={};Ua.transitional=function(s,e,t){function n(i,r){return"[Axios v"+Hd+"] Transitional option '"+i+"'"+r+(t?". "+t:"")}return(i,r,a)=>{if(s===!1)throw new $e(n(r," has been removed"+(e?" in "+e:"")),$e.ERR_DEPRECATED);return e&&!Vd[r]&&(Vd[r]=!0,console.warn(n(r," has been deprecated since v"+e+" and will be removed in the near future"))),s?s(i,r,a):!0}},Ua.spelling=function(s){return(e,t)=>(console.warn(`${t} is likely a misspelling of ${s}`),!0)};function Ub(s,e,t){if(typeof s!="object")throw new $e("options must be an object",$e.ERR_BAD_OPTION_VALUE);const n=Object.keys(s);let i=n.length;for(;i-- >0;){const r=n[i],a=e[r];if(a){const o=s[r],l=o===void 0||a(o,r,s);if(l!==!0)throw new $e("option "+r+" must be "+l,$e.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new $e("Unknown option "+r,$e.ERR_BAD_OPTION)}}const Ba={assertOptions:Ub,validators:Ua},Xn=Ba.validators;let Bi=class{constructor(s){this.defaults=s||{},this.interceptors={request:new yd,response:new yd}}async request(s,e){try{return await this._request(s,e)}catch(t){if(t instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const i=n.stack?n.stack.replace(/^.+\n/,""):"";try{t.stack?i&&!String(t.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(t.stack+=`
|
||
`+i):t.stack=i}catch{}}throw t}}_request(s,e){typeof s=="string"?(e=e||{},e.url=s):e=s||{},e=Ui(this.defaults,e);const{transitional:t,paramsSerializer:n,headers:i}=e;t!==void 0&&Ba.assertOptions(t,{silentJSONParsing:Xn.transitional(Xn.boolean),forcedJSONParsing:Xn.transitional(Xn.boolean),clarifyTimeoutError:Xn.transitional(Xn.boolean)},!1),n!=null&&(re.isFunction(n)?e.paramsSerializer={serialize:n}:Ba.assertOptions(n,{encode:Xn.function,serialize:Xn.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Ba.assertOptions(e,{baseUrl:Xn.spelling("baseURL"),withXsrfToken:Xn.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let r=i&&re.merge(i.common,i[e.method]);i&&re.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),e.headers=on.concat(r,i);const a=[];let o=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(o=o&&d.synchronous,a.unshift(d.fulfilled,d.rejected))});const l=[];this.interceptors.response.forEach(function(d){l.push(d.fulfilled,d.rejected)});let c,h=0,u;if(!o){const d=[zd.bind(this),void 0];for(d.unshift(...a),d.push(...l),u=d.length,c=Promise.resolve(e);h<u;)c=c.then(d[h++],d[h++]);return c}u=a.length;let f=e;for(;h<u;){const d=a[h++],p=a[h++];try{f=d(f)}catch(g){p.call(this,g);break}}try{c=zd.call(this,f)}catch(d){return Promise.reject(d)}for(h=0,u=l.length;h<u;)c=c.then(l[h++],l[h++]);return c}getUri(s){s=Ui(this.defaults,s);const e=Pd(s.baseURL,s.url,s.allowAbsoluteUrls);return bd(e,s.params,s.paramsSerializer)}};re.forEach(["delete","get","head","options"],function(s){Bi.prototype[s]=function(e,t){return this.request(Ui(t||{},{method:s,url:e,data:(t||{}).data}))}}),re.forEach(["post","put","patch"],function(s){function e(t){return function(n,i,r){return this.request(Ui(r||{},{method:s,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}Bi.prototype[s]=e(),Bi.prototype[s+"Form"]=e(!0)});let Bb=class gf{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});const n=this;this.promise.then(i=>{if(!n._listeners)return;let r=n._listeners.length;for(;r-- >0;)n._listeners[r](i);n._listeners=null}),this.promise.then=i=>{let r;const a=new Promise(o=>{n.subscribe(o),r=o}).then(i);return a.cancel=function(){n.unsubscribe(r)},a},e(function(i,r,a){n.reason||(n.reason=new As(i,r,a),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new gf(function(t){e=t}),cancel:e}}};function kb(s){return function(e){return s.apply(null,e)}}function Ob(s){return re.isObject(s)&&s.isAxiosError===!0}const gc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(gc).forEach(([s,e])=>{gc[e]=s});function Gd(s){const e=new Bi(s),t=rd(Bi.prototype.request,e);return re.extend(t,Bi.prototype,e,{allOwnKeys:!0}),re.extend(t,e,null,{allOwnKeys:!0}),t.create=function(n){return Gd(Ui(s,n))},t}const Lt=Gd(fr);Lt.Axios=Bi,Lt.CanceledError=As,Lt.CancelToken=Bb,Lt.isCancel=Ed,Lt.VERSION=Hd,Lt.toFormData=La,Lt.AxiosError=$e,Lt.Cancel=Lt.CanceledError,Lt.all=function(s){return Promise.all(s)},Lt.spread=kb,Lt.isAxiosError=Ob,Lt.mergeConfig=Ui,Lt.AxiosHeaders=on,Lt.formToJSON=s=>wd(re.isHTMLForm(s)?new FormData(s):s),Lt.getAdapter=Fd.getAdapter,Lt.HttpStatusCode=gc,Lt.default=Lt;const{Axios:ZM,AxiosError:qM,CanceledError:YM,isCancel:KM,CancelToken:$M,VERSION:JM,all:QM,Cancel:ew,isAxiosError:tw,spread:nw,toFormData:iw,AxiosHeaders:sw,HttpStatusCode:rw,formToJSON:aw,getAdapter:ow,mergeConfig:lw}=Lt;function Fb(s,e){var t;if(window.XMLHttpRequest?t=new XMLHttpRequest:window.ActiveXObject?t=new window.ActiveXObject:alert("请升级至最新版本的浏览器"),t!=null){let n=s+"?timestamp="+new Date().getTime();t.open("GET",n,!0),t.send(null),t.onreadystatechange=function(){t.readyState==4&&t.status==200&&(t.responseText.includes("</html>",0)&&t.responseText.includes("</body>",0)&&t.responseText.includes("</head>",0)?e(null):e(t.responseText))},t.onloadend=function(){t.readyState==4&&t.status==404&&t.status==502&&e(null)}}}function Wd(s,e){Lt({method:"get",responseType:"blob",url:s+"?timestamp="+new Date().getTime()}).then(n=>{let i=new window.File([n.data],"semantics",{type:"zip"});c_.loadAsync(i).then(r=>{for(let a in r.files)r.file(r.files[a].name).async("blob").then(o=>{t(o,"utf-8",function(l,c){e(c)})})})});function t(n,i,r){var a=new FileReader,o=new Blob([n]);a.onload=function(l){r(null,l.target.result)},a.onerror=function(l){r(l.error,null)},a.readAsText(o,i)}}const vc=new WeakMap;class zb extends Ai{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const r=new ua(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,a=>{this.parse(a,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,ft,n).catch(n)}decodeDracoFile(e,t,n,i,r=wt,a=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,o).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(vc.has(e)){const l=vc.get(e);if(l.key===n)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(r,a).then(l=>(i=l,new Promise((c,h)=>{i._callbacks[r]={resolve:c,reject:h},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return o.catch(()=>!0).then(()=>{i&&r&&this._releaseTask(i,r)}),vc.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new gt;e.index&&t.setIndex(new mt(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const{name:i,array:r,itemSize:a,stride:o,vertexColorSpace:l}=e.attributes[n];let c;if(a===o)c=new mt(r,a);else{const h=new Ph(r,o);c=new Yr(h,a,0)}i==="color"&&(this._assignVertexColorSpace(c,l),c.normalized=!(r instanceof Float32Array)),t.setAttribute(i,c)}return t}_assignVertexColorSpace(e,t){if(t!==ft)return;const n=new ke;for(let i=0,r=e.count;i<r;i++)n.fromBufferAttribute(e,i),nt.colorSpaceToWorking(n,ft),e.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new ua(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,r)=>{n.load(e,i,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const r=Hb.toString(),a=["/* draco decoder */",i,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
|
||
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(r){const a=r.data;switch(a.type){case"decode":i._callbacks[a.id].resolve(a);break;case"error":i._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,r){return i._taskLoad>r._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function Hb(){let s,e;onmessage=function(a){const o=a.data;switch(o.type){case"init":s=o.decoderConfig,e=new Promise(function(h){s.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(s)});break;case"decode":const l=o.buffer,c=o.taskConfig;e.then(h=>{const u=h.draco,f=new u.Decoder;try{const d=t(u,f,new Int8Array(l),c),p=d.attributes.map(g=>g.array.buffer);d.index&&p.push(d.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:d},p)}catch(d){console.error(d),self.postMessage({type:"error",id:o.id,error:d.message})}finally{u.destroy(f)}});break}};function t(a,o,l,c){const h=c.attributeIDs,u=c.attributeTypes;let f,d;const p=o.GetEncodedGeometryType(l);if(p===a.TRIANGULAR_MESH)f=new a.Mesh,d=o.DecodeArrayToMesh(l,l.byteLength,f);else if(p===a.POINT_CLOUD)f=new a.PointCloud,d=o.DecodeArrayToPointCloud(l,l.byteLength,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());const g={index:null,attributes:[]};for(const v in h){const m=self[u[v]];let x,_;if(c.useUniqueIDs)_=h[v],x=o.GetAttributeByUniqueId(f,_);else{if(_=o.GetAttributeId(f,a[h[v]]),_===-1)continue;x=o.GetAttribute(f,_)}const M=i(a,o,f,v,m,x);v==="color"&&(M.vertexColorSpace=c.vertexColorSpace),g.attributes.push(M)}return p===a.TRIANGULAR_MESH&&(g.index=n(a,o,f)),a.destroy(f),g}function n(a,o,l){const c=l.num_faces()*3,h=c*4,u=a._malloc(h);o.GetTrianglesUInt32Array(l,h,u);const f=new Uint32Array(a.HEAPF32.buffer,u,c).slice();return a._free(u),{array:f,itemSize:1}}function i(a,o,l,c,h,u){const f=l.num_points(),d=u.num_components(),p=r(a,h),g=d*h.BYTES_PER_ELEMENT,v=Math.ceil(g/4)*4,m=v/h.BYTES_PER_ELEMENT,x=f*g,_=f*v,M=a._malloc(x);o.GetAttributeDataArrayForAllPoints(l,u,p,x,M);const T=new h(a.HEAPF32.buffer,M,x/h.BYTES_PER_ELEMENT);let A;if(g===v)A=T.slice();else{A=new h(_/h.BYTES_PER_ELEMENT);let L=0;for(let U=0,E=T.length;U<E;U++){for(let C=0;C<d;C++)A[L+C]=T[U*d+C];L+=m}}return a._free(M),{name:c,count:f,itemSize:d,array:A,stride:m}}function r(a,o){switch(o){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}var mr=(s=>(s.ModelLoadStart="model-load-start",s.ModelLoadProgress="model-load-progress",s.ModelLoaded="model-loaded",s.ModelError="model-error",s.SelectionChanged="selection-changed",s.HoverChanged="hover-changed",s.Click="click",s.MouseMove="mouse-move",s.CameraChanged="camera-changed",s.CameraIdle="camera-idle",s.EngineFree="engine-free",s.EngineBusy="engine-busy",s))(mr||{});function Vb(s,e,t,n){let i=0,r=0,a=0,o=s.models.find(d=>d.url==t),l=e.circularMeps,c=e.rectMeps.filter(d=>d.type==="风管"),h=e.rectMeps.filter(d=>d.type==="桥架"),u=e.ellipseMeps,f=s.scene;if(new Ft,new gt,ka(f,"InstancedMesh"),l&&l.length){let d=[];for(let p of l)p.color=new ke(`rgb(${p.color})`),p.position={x:p.startPoint.X*.3048+i,y:p.startPoint.Z*.3048+r,z:-p.startPoint.Y*.3048+a},p.rotation={x:0,y:0,z:0},o.nodesMap.set(p.id,[p]),d.push(p);Oa("Circle",f,d,2)}if(ka(f,"InstancedMesh"),c&&c.length){let d=[];for(let p of c)p.color=new ke(`rgb(${p.color})`),p.position={x:p.startPoint.X*.3048+i,y:p.startPoint.Z*.3048+r,z:-p.startPoint.Y*.3048+a},p.rotation={x:0,y:0,z:0},o.nodesMap.set(p.id,[p]),d.push(p);Oa("Rect",f,d,3)}if(ka(f,"InstancedMesh"),u&&u.length){let d=[];for(let p of u)p.color=new ke(`rgb(${p.color})`),p.position={x:p.startPoint.X*.3048+i,y:p.startPoint.Z*.3048+r,z:-p.startPoint.Y*.3048+a},p.rotation={x:0,y:0,z:0},o.nodesMap.set(p.id,[p]),d.push(p);Oa("Ellipse",f,d,4)}if(ka(f,"InstancedMesh"),h&&h.length){let d=[];for(let p of h)p.color=new ke(`rgb(${p.color})`),p.position={x:p.startPoint.X*.3048+i,y:p.startPoint.Z*.3048+r,z:-p.startPoint.Y*.3048+a},p.rotation={x:0,y:0,z:0},o.nodesMap.set(p.id,[p]),d.push(p);Oa("Bridge",f,d,5)}}function ka(s,e){let t=new Pl(e.geometry,e.material,1);t.index=e.index,t.dataType=e.type,t.url=e.url,t.relativeIndex=e.relativeIndex,t.name="机电",s.add(t)}function Oa(s,e,t,n,i){let r,a,o={width:1,height:1,length:1,diameter:1,color:new ke,position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0}};switch(s){case"Rect":a=Fa("Rect",o);break;case"Bridge":a=Fa("Bridge",o);break;case"Circle":a=Fa("Circle",o);break;case"Ellipse":a=Fa("Ellipse",o);break}a&&(r=new Pl(a.geometry,a.material,t.length));let l=[];for(var c=0;c<t.length;c++){let f=t[c],d=new R(f.startPoint.X,0,-f.startPoint.Y),p=new R(f.endPoint.X,0,-f.endPoint.Y),g=new R(f.startPoint.X,f.startPoint.Z,-f.startPoint.Y),v=new R(f.endPoint.X,f.endPoint.Z,-f.endPoint.Y),m=0,x=0,_=0;if(Math.abs(p.clone().sub(d.clone()).z)<.01&&Math.abs(p.clone().sub(d.clone()).x)<.01){if(m=(f.startPoint.Z>f.endPoint.Z?1:-1)*Math.PI*.5,f.base_x!=null){var h=new R(f.base_x.X,0,-f.base_x.Y);x=(h.clone().cross(new R(0,0,1)).y<=0?1:-1)*h.angleTo(new R(0,0,1))+Math.PI*.5}}else x=(p.clone().sub(d.clone()).cross(new R(0,0,1)).y>0?-1:1)*p.clone().sub(d.clone()).angleTo(new R(0,0,1)),m=(f.startPoint.Z>f.endPoint.Z?1:-1)*p.clone().sub(d.clone()).angleTo(v.clone().sub(g.clone()));let M=new je;const T=new sn(m,x,_,"YXZ");let A=M.clone().makeRotationFromEuler(T),L,U;s==="Circle"?(L=f.diameter,U=f.diameter):(L=f.width,U=f.height);let E=M.clone().makeScale(L,U,f.length);M.multiplyMatrices(A,E),M.setPosition(f.position.x,f.position.y,f.position.z),r.setMatrixAt(c,M.clone()),r.setColorAt(c,f.color),r.geometry.computeBoundingBox();let C=r.geometry.boundingBox.min.clone().applyMatrix4(M.clone()),k=r.geometry.boundingBox.max.clone().applyMatrix4(M.clone()),D=new R(Math.min(C.x,k.x),Math.min(C.y,k.y),Math.min(C.z,k.z)),B=new R(Math.max(C.x,k.x),Math.max(C.y,k.y),Math.max(C.z,k.z)),w=D.clone().add(B.clone()).multiplyScalar(.5),F={name:f.name,min:D,max:B,center:w,dbid:c,materialName:a.material.name},q=null,z=null;s==="Circle"&&(q={x:f.startPoint.X*.3048,y:f.startPoint.Z*.3048,z:-f.startPoint.Y*.3048},z={x:f.endPoint.X*.3048,y:f.endPoint.Z*.3048,z:-f.endPoint.Y*.3048},F.minC=q,F.maxC=z),l.push(F)}r.castShadow=!0,r.ElementInfos=l,r.name="rootModel",r.TypeName="InstancedMesh-Pipe",r.PipeType=s,r.MeshId=null,r.realMaterial=r.material.clone(),r.originalMaterial=r.material.clone();let u=[];u={geometry:r.geometry,matrix:r.matrix,position:r.position,rotation:r.rotation},r.meshs=u,r.instanceMatrix&&r.instanceMatrix.array&&(r.cloneInstanceMatrix=Array.from(r.instanceMatrix.array)),r.index=n,r.Version="V1",e.children[n]=r}function Fa(s,e,t){let n=new Qh;switch(e.width=e.width*.3048,e.height=e.height*.3048,e.diameter=e.diameter*.3048,s){case"Rect":n.moveTo(-e.width/2,-e.height/2),n.lineTo(-e.width/2,e.height/2),n.lineTo(e.width/2,e.height/2),n.lineTo(e.width/2,-e.height/2),n.lineTo(-e.width/2,-e.height/2);break;case"Ellipse":n.moveTo(-e.width/2,-e.height/2),n.lineTo(-e.width/2,e.height/2),n.lineTo(e.width/2,e.height/2),n.lineTo(e.width/2,-e.height/2),n.lineTo(-e.width/2,-e.height/2);break;case"Bridge":n.moveTo(-e.width/2,-e.height/2),n.lineTo(-e.width/2,e.height/2),n.lineTo(-e.width/2+.01,e.height/2),n.lineTo(-e.width/2+.01,-e.height/2+.01),n.lineTo(e.width/2-.01,-e.height/2+.01),n.lineTo(e.width/2-.01,e.height/2),n.lineTo(e.width/2,e.height/2),n.lineTo(e.width/2,-e.height/2),n.lineTo(-e.width/2,-e.height/2);break;case"Circle":n.moveTo(0,0),n.absarc(0,0,e.diameter*.5,0,Math.PI*2,!1);break}const i={depth:e.length*.3048,bevelEnabled:!1};return r(n,i,e.color,e.position,e.rotation);function r(a,o,l,c,h){let u=new Vl(a,o),f=new Dm({color:l,side:Vt}),d=new bt(u,f);return d.position.set(c.x,c.y,c.z),d.rotation._order="YXZ",d.rotation.set(h.x,h.y,h.z),d}}function Gb(s,e=!1){const t=s[0].index!==null,n=new Set(Object.keys(s[0].attributes)),i=new Set(Object.keys(s[0].morphAttributes)),r={},a={},o=s[0].morphTargetsRelative,l=new gt;let c=0;for(let h=0;h<s.length;++h){const u=s[h];let f=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const d in u.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;r[d]===void 0&&(r[d]=[]),r[d].push(u.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const d in u.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[d]===void 0&&(a[d]=[]),a[d].push(u.morphAttributes[d])}if(e){let d;if(t)d=u.index.count;else if(u.attributes.position!==void 0)d=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,h),c+=d}}if(t){let h=0;const u=[];for(let f=0;f<s.length;++f){const d=s[f].index;for(let p=0;p<d.count;++p)u.push(d.getX(p)+h);h+=s[f].attributes.position.count}l.setIndex(u)}for(const h in r){const u=Xd(r[h]);if(!u)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,u)}for(const h in a){const u=a[h][0].length;if(u===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let f=0;f<u;++f){const d=[];for(let g=0;g<a[h].length;++g)d.push(a[h][g][f]);const p=Xd(d);if(!p)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(p)}}return l}function Xd(s){let e,t,n,i=-1,r=0;for(let c=0;c<s.length;++c){const h=s[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=h.itemSize),t!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=h.gpuType),i!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;r+=h.count*t}const a=new e(r),o=new mt(a,t,n);let l=0;for(let c=0;c<s.length;++c){const h=s[c];if(h.isInterleavedBufferAttribute){const u=l/t;for(let f=0,d=h.count;f<d;f++)for(let p=0;p<t;p++){const g=h.getComponent(f,p);o.setComponent(f+u,p,g)}}else a.set(h.array,l);l+=h.count*t}return i!==void 0&&(o.gpuType=i),o}function jd(s,e){if(e===jf)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===$o||e===$c){let t=s.getIndex();if(t===null){const a=[],o=s.getAttribute("position");if(o!==void 0){for(let l=0;l<o.count;l++)a.push(l);s.setIndex(a),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,i=[];if(e===$o)for(let a=1;a<=n;a++)i.push(t.getX(0)),i.push(t.getX(a)),i.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(t.getX(a)),i.push(t.getX(a+1)),i.push(t.getX(a+2))):(i.push(t.getX(a+2)),i.push(t.getX(a+1)),i.push(t.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=s.clone();return r.setIndex(i),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}class Wb extends Ai{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Yb(t)}),this.register(function(t){return new Kb(t)}),this.register(function(t){return new ry(t)}),this.register(function(t){return new ay(t)}),this.register(function(t){return new oy(t)}),this.register(function(t){return new Jb(t)}),this.register(function(t){return new Qb(t)}),this.register(function(t){return new ey(t)}),this.register(function(t){return new ty(t)}),this.register(function(t){return new qb(t)}),this.register(function(t){return new ny(t)}),this.register(function(t){return new $b(t)}),this.register(function(t){return new sy(t)}),this.register(function(t){return new iy(t)}),this.register(function(t){return new jb(t)}),this.register(function(t){return new ly(t)}),this.register(function(t){return new cy(t)})}load(e,t,n,i){const r=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const c=rr.extractUrlBase(e);a=rr.resolveURL(c,this.path)}else a=rr.extractUrlBase(e);this.manager.itemStart(e);const o=function(c){i?i(c):console.error(c),r.manager.itemError(e),r.manager.itemEnd(e)},l=new ua(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{r.parse(c,a,function(h){t(h),r.manager.itemEnd(e)},o)}catch(h){o(h)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const a={},o={},l=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===Zd){try{a[it.KHR_BINARY_GLTF]=new hy(e)}catch(h){i&&i(h);return}r=JSON.parse(a[it.KHR_BINARY_GLTF].content)}else r=JSON.parse(l.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new wy(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[u.name]=u,a[u.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){const u=r.extensionsUsed[h],f=r.extensionsRequired||[];switch(u){case it.KHR_MATERIALS_UNLIT:a[u]=new Zb;break;case it.KHR_DRACO_MESH_COMPRESSION:a[u]=new uy(r,this.dracoLoader);break;case it.KHR_TEXTURE_TRANSFORM:a[u]=new dy;break;case it.KHR_MESH_QUANTIZATION:a[u]=new fy;break;default:f.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(a),c.setPlugins(o),c.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function Xb(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}const it={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class jb{constructor(e){this.parser=e,this.name=it.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,a=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let o;const l=new ke(16777215);a.color!==void 0&&l.setRGB(a.color[0],a.color[1],a.color[2],wt);const c=a.range!==void 0?a.range:0;switch(a.type){case"directional":o=new mu(l),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new $m(l),o.distance=c;break;case"spot":o=new Ym(l),o.distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),jn(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(o),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return r===void 0?null:this._loadLight(r).then(function(a){return n._getNodeRef(t.cache,r,a)})}}class Zb{constructor(){this.name=it.KHR_MATERIALS_UNLIT}getMaterialType(){return Ft}extendParams(e,t,n){const i=[];e.color=new ke(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const a=r.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],wt),e.opacity=a[3]}r.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",r.baseColorTexture,ft))}return Promise.all(i)}}class qb{constructor(e){this.parser=e,this.name=it.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return i!==void 0&&(t.emissiveIntensity=i),Promise.resolve()}}class Yb{constructor(e){this.parser=e,this.name=it.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];if(a.clearcoatFactor!==void 0&&(t.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new de(o,o)}return Promise.all(r)}}class Kb{constructor(e){this.parser=e,this.name=it.KHR_MATERIALS_DISPERSION}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=i.dispersion!==void 0?i.dispersion:0,Promise.resolve()}}class $b{constructor(e){this.parser=e,this.name=it.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return a.iridescenceFactor!==void 0&&(t.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(t.iridescenceIOR=a.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class Jb{constructor(e){this.parser=e,this.name=it.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new ke(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(a.sheenColorFactor!==void 0){const o=a.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],wt)}return a.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,ft)),a.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class Qb{constructor(e){this.parser=e,this.name=it.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return a.transmissionFactor!==void 0&&(t.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class ey{constructor(e){this.parser=e,this.name=it.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=new ke().setRGB(o[0],o[1],o[2],wt),Promise.all(r)}}class ty{constructor(e){this.parser=e,this.name=it.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}}class ny{constructor(e){this.parser=e,this.name=it.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=new ke().setRGB(o[0],o[1],o[2],wt),a.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,ft)),Promise.all(r)}}class iy{constructor(e){this.parser=e,this.name=it.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return t.bumpScale=a.bumpFactor!==void 0?a.bumpFactor:1,a.bumpTexture!==void 0&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class sy{constructor(e){this.parser=e,this.name=it.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:Rn}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return a.anisotropyStrength!==void 0&&(t.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(t.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class ry{constructor(e){this.parser=e,this.name=it.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class ay{constructor(e){this.parser=e,this.name=it.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let l=n.textureLoader;if(o.uri){const c=n.options.manager.getHandler(o.uri);c!==null&&(l=c)}return n.loadTextureImage(e,a.source,l)}}class oy{constructor(e){this.parser=e,this.name=it.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let l=n.textureLoader;if(o.uri){const c=n.options.manager.getHandler(o.uri);c!==null&&(l=c)}return n.loadTextureImage(e,a.source,l)}}class ly{constructor(e){this.name=it.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(o){const l=i.byteOffset||0,c=i.byteLength||0,h=i.count,u=i.byteStride,f=new Uint8Array(o,l,c);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,f,i.mode,i.filter).then(function(d){return d.buffer}):a.ready.then(function(){const d=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(d),h,u,f,i.mode,i.filter),d})})}else return null}}class cy{constructor(e){this.name=it.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const l of i.primitives)if(l.mode!==yn.TRIANGLES&&l.mode!==yn.TRIANGLE_STRIP&&l.mode!==yn.TRIANGLE_FAN&&l.mode!==void 0)return null;const r=n.extensions[this.name].attributes,a=[],o={};for(const l in r)a.push(this.parser.getDependency("accessor",r[l]).then(c=>(o[l]=c,o[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(l=>{const c=l.pop(),h=c.isGroup?c.children:[c],u=l[0].count,f=[];for(const d of h){const p=new je,g=new R,v=new En,m=new R(1,1,1),x=new Pl(d.geometry,d.material,u);for(let _=0;_<u;_++)o.TRANSLATION&&g.fromBufferAttribute(o.TRANSLATION,_),o.ROTATION&&v.fromBufferAttribute(o.ROTATION,_),o.SCALE&&m.fromBufferAttribute(o.SCALE,_),x.setMatrixAt(_,p.compose(g,v,m));for(const _ in o)if(_==="_COLOR_0"){const M=o[_];x.instanceColor=new Al(M.array,M.itemSize,M.normalized)}else _!=="TRANSLATION"&&_!=="ROTATION"&&_!=="SCALE"&&d.geometry.setAttribute(_,o[_]);yt.prototype.copy.call(x,d),this.parser.assignFinalMaterial(x),f.push(x)}return c.isGroup?(c.clear(),c.add(...f),c):f[0]}))}}const Zd="glTF",gr=12,qd={JSON:1313821514,BIN:5130562};class hy{constructor(e){this.name=it.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,gr),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Zd)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-gr,r=new DataView(e,gr);let a=0;for(;a<i;){const o=r.getUint32(a,!0);a+=4;const l=r.getUint32(a,!0);if(a+=4,l===qd.JSON){const c=new Uint8Array(e,gr+a,o);this.content=n.decode(c)}else if(l===qd.BIN){const c=gr+a;this.body=e.slice(c,c+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class uy{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=it.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},l={},c={};for(const h in a){const u=_c[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=_c[h]||h.toLowerCase();if(a[h]!==void 0){const f=n.accessors[e.attributes[h]],d=Ps[f.componentType];c[u]=d.name,l[u]=f.normalized===!0}}return t.getDependency("bufferView",r).then(function(h){return new Promise(function(u,f){i.decodeDracoFile(h,function(d){for(const p in d.attributes){const g=d.attributes[p],v=l[p];v!==void 0&&(g.normalized=v)}u(d)},o,c,wt,f)})})}}class dy{constructor(){this.name=it.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class fy{constructor(){this.name=it.KHR_MESH_QUANTIZATION}}class Yd extends sr{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let a=0;a!==i;a++)t[a]=n[r+a];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=o*2,c=o*3,h=i-t,u=(n-t)/h,f=u*u,d=f*u,p=e*c,g=p-c,v=-2*d+3*f,m=d-f,x=1-v,_=m-f+u;for(let M=0;M!==o;M++){const T=a[g+M+o],A=a[g+M+l]*h,L=a[p+M+o],U=a[p+M]*h;r[M]=x*T+_*A+v*L+m*U}return r}}const py=new En;class my extends Yd{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return py.fromArray(r).normalize().toArray(r),r}}const yn={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Ps={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Kd={9728:Pt,9729:It,9984:Hc,9985:Er,9986:Us,9987:Kn},$d={33071:kn,33648:Sr,10497:Bn},xc={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},_c={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},xi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},gy={CUBICSPLINE:void 0,LINEAR:Os,STEP:ks},bc={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function vy(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new ca({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Nn})),s.DefaultMaterial}function ki(s,e,t){for(const n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function jn(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function xy(s,e,t){let n=!1,i=!1,r=!1;for(let c=0,h=e.length;c<h;c++){const u=e[c];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(i=!0),u.COLOR_0!==void 0&&(r=!0),n&&i&&r)break}if(!n&&!i&&!r)return Promise.resolve(s);const a=[],o=[],l=[];for(let c=0,h=e.length;c<h;c++){const u=e[c];if(n){const f=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):s.attributes.position;a.push(f)}if(i){const f=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):s.attributes.normal;o.push(f)}if(r){const f=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):s.attributes.color;l.push(f)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(c){const h=c[0],u=c[1],f=c[2];return n&&(s.morphAttributes.position=h),i&&(s.morphAttributes.normal=u),r&&(s.morphAttributes.color=f),s.morphTargetsRelative=!0,s})}function _y(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function by(s){let e;const t=s.extensions&&s.extensions[it.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+yc(t.attributes):e=s.indices+":"+yc(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+yc(s.targets[n]);return e}function yc(s){let e="";const t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function Mc(s){switch(s){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function yy(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":s.search(/\.ktx2($|\?)/i)>0||s.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const My=new je;class wy{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Xb,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;const l=o.match(/Version\/(\d+)/);i=n&&l?parseInt(l[1],10):-1,r=o.indexOf("Firefox")>-1,a=r?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||r&&a<98?this.textureLoader=new du(this.options.manager):this.textureLoader=new Qm(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ua(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return ki(r,o,i),jn(o,i),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(o)})).then(function(){for(const l of o.scenes)l.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){const a=t[i].joints;for(let o=0,l=a.length;o<l;o++)e[a[o]].isBone=!0}for(let i=0,r=e.length;i<r;i++){const a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(a,o)=>{const l=this.associations.get(a);l!=null&&this.associations.set(o,l);for(const[c,h]of a.children.entries())r(h,o.children[c])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[it.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(r,a){n.load(rr.resolveURL(t.uri,i.path),r,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const a=xc[i.type],o=Ps[i.componentType],l=i.normalized===!0,c=new o(i.count*a);return Promise.resolve(new mt(c,a,l))}const r=[];return i.bufferView!==void 0?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),i.sparse!==void 0&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(a){const o=a[0],l=xc[i.type],c=Ps[i.componentType],h=c.BYTES_PER_ELEMENT,u=h*l,f=i.byteOffset||0,d=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,p=i.normalized===!0;let g,v;if(d&&d!==u){const m=Math.floor(f/d),x="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+m+":"+i.count;let _=t.cache.get(x);_||(g=new c(o,m*d,i.count*d/h),_=new Ph(g,d/h),t.cache.add(x,_)),v=new Yr(_,l,f%d/h,p)}else o===null?g=new c(i.count*l):g=new c(o,f,i.count*l),v=new mt(g,l,p);if(i.sparse!==void 0){const m=xc.SCALAR,x=Ps[i.sparse.indices.componentType],_=i.sparse.indices.byteOffset||0,M=i.sparse.values.byteOffset||0,T=new x(a[1],_,i.sparse.count*m),A=new c(a[2],M,i.sparse.count*l);o!==null&&(v=new mt(v.array.slice(),v.itemSize,v.normalized)),v.normalized=!1;for(let L=0,U=T.length;L<U;L++){const E=T[L];if(v.setX(E,A[L*l]),l>=2&&v.setY(E,A[L*l+1]),l>=3&&v.setZ(E,A[L*l+2]),l>=4&&v.setW(E,A[L*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}v.normalized=p}return v})}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let a=this.textureLoader;if(r.uri){const o=n.manager.getHandler(r.uri);o!==null&&(a=o)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],o=r.images[t],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=a.name||o.name||"",h.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(h.name=o.uri);const u=(r.samplers||{})[a.sampler]||{};return h.magFilter=Kd[u.magFilter]||It,h.minFilter=Kd[u.minFilter]||Kn,h.wrapS=$d[u.wrapS]||Bn,h.wrapT=$d[u.wrapT]||Bn,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==Pt&&h.minFilter!==It,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=i.images[e],o=self.URL||self.webkitURL;let l=a.uri||"",c=!1;if(a.bufferView!==void 0)l=n.getDependency("bufferView",a.bufferView).then(function(u){c=!0;const f=new Blob([u],{type:a.mimeType});return l=o.createObjectURL(f),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(l).then(function(u){return new Promise(function(f,d){let p=f;t.isImageBitmapLoader===!0&&(p=function(g){const v=new Ot(g);v.needsUpdate=!0,f(v)}),t.load(rr.resolveURL(u,r.path),p,void 0,d)})}).then(function(u){return c===!0&&o.revokeObjectURL(l),jn(u,a),u.userData.mimeType=a.mimeType||yy(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),r.extensions[it.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[it.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const l=r.associations.get(a);a=r.extensions[it.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,l)}}return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let l=this.cache.get(o);l||(l=new Gh,dn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(o,l)),n=l}else if(e.isLine){const o="LineBasicMaterial:"+n.uuid;let l=this.cache.get(o);l||(l=new fs,dn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(o,l)),n=l}if(i||r||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),r&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let l=this.cache.get(o);l||(l=n.clone(),r&&(l.vertexColors=!0),a&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(o,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return ca}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const o={},l=r.extensions||{},c=[];if(l[it.KHR_MATERIALS_UNLIT]){const u=i[it.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),c.push(u.extendParams(o,r,t))}else{const u=r.pbrMetallicRoughness||{};if(o.color=new ke(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;o.color.setRGB(f[0],f[1],f[2],wt),o.opacity=f[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(o,"map",u.baseColorTexture,ft)),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,o)})))}r.doubleSided===!0&&(o.side=Vt);const h=r.alphaMode||bc.OPAQUE;if(h===bc.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===bc.MASK&&(o.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&a!==Ft&&(c.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new de(1,1),r.normalTexture.scale!==void 0)){const u=r.normalTexture.scale;o.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&a!==Ft&&(c.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&a!==Ft){const u=r.emissiveFactor;o.emissive=new ke().setRGB(u[0],u[1],u[2],wt)}return r.emissiveTexture!==void 0&&a!==Ft&&c.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,ft)),Promise.all(c).then(function(){const u=new a(o);return r.name&&(u.name=r.name),jn(u,r),t.associations.set(u,{materials:e}),r.extensions&&ki(i,u,r),u})}createUniqueName(e){const t=lt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(o){return n[it.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(l){return Jd(l,o,t)})}const a=[];for(let o=0,l=e.length;o<l;o++){const c=e[o],h=by(c),u=i[h];if(u)a.push(u.promise);else{let f;c.extensions&&c.extensions[it.KHR_DRACO_MESH_COMPRESSION]?f=r(c):f=Jd(new gt,c,t),i[h]={primitive:c,promise:f},a.push(f)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let l=0,c=a.length;l<c;l++){const h=a[l].material===void 0?vy(this.cache):this.getDependency("material",a[l].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(l){const c=l.slice(0,l.length-1),h=l[l.length-1],u=[];for(let d=0,p=h.length;d<p;d++){const g=h[d],v=a[d];let m;const x=c[d];if(v.mode===yn.TRIANGLES||v.mode===yn.TRIANGLE_STRIP||v.mode===yn.TRIANGLE_FAN||v.mode===void 0)m=r.isSkinnedMesh===!0?new Gp(g,x):new bt(g,x),m.isSkinnedMesh===!0&&m.normalizeSkinWeights(),v.mode===yn.TRIANGLE_STRIP?m.geometry=jd(m.geometry,$c):v.mode===yn.TRIANGLE_FAN&&(m.geometry=jd(m.geometry,$o));else if(v.mode===yn.LINES)m=new Yp(g,x);else if(v.mode===yn.LINE_STRIP)m=new Ti(g,x);else if(v.mode===yn.LINE_LOOP)m=new Kp(g,x);else if(v.mode===yn.POINTS)m=new $p(g,x);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+v.mode);Object.keys(m.geometry.morphAttributes).length>0&&_y(m,r),m.name=t.createUniqueName(r.name||"mesh_"+e),jn(m,r),v.extensions&&ki(i,m,v),t.assignFinalMaterial(m),u.push(m)}for(let d=0,p=u.length;d<p;d++)t.associations.set(u[d],{meshes:e,primitives:d});if(u.length===1)return r.extensions&&ki(i,u[0],r),u[0];const f=new bn;r.extensions&&ki(i,f,r),t.associations.set(f,{meshes:e});for(let d=0,p=u.length;d<p;d++)f.add(u[d]);return f})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new Zt(ih.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new gi(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),jn(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const r=i.pop(),a=i,o=[],l=[];for(let c=0,h=a.length;c<h;c++){const u=a[c];if(u){o.push(u);const f=new je;r!==null&&f.fromArray(r.array,c*16),l.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new Cl(o,l)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],o=[],l=[],c=[],h=[];for(let u=0,f=i.channels.length;u<f;u++){const d=i.channels[u],p=i.samplers[d.sampler],g=d.target,v=g.node,m=i.parameters!==void 0?i.parameters[p.input]:p.input,x=i.parameters!==void 0?i.parameters[p.output]:p.output;g.node!==void 0&&(a.push(this.getDependency("node",v)),o.push(this.getDependency("accessor",m)),l.push(this.getDependency("accessor",x)),c.push(p),h.push(g))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l),Promise.all(c),Promise.all(h)]).then(function(u){const f=u[0],d=u[1],p=u[2],g=u[3],v=u[4],m=[];for(let _=0,M=f.length;_<M;_++){const T=f[_],A=d[_],L=p[_],U=g[_],E=v[_];if(T===void 0)continue;T.updateMatrix&&T.updateMatrix();const C=n._createAnimationTracks(T,A,L,U,E);if(C)for(let k=0;k<C.length;k++)m.push(C[k])}const x=new Hm(r,void 0,m);return jn(x,i),x})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(r){const a=n._getNodeRef(n.meshCache,i.mesh,r);return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let l=0,c=i.weights.length;l<c;l++)o.morphTargetInfluences[l]=i.weights[l]}),a})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),a=[],o=i.children||[];for(let c=0,h=o.length;c<h;c++)a.push(n.getDependency("node",o[c]));const l=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(a),l]).then(function(c){const h=c[0],u=c[1],f=c[2];f!==null&&h.traverse(function(d){d.isSkinnedMesh&&d.bind(f,My)});for(let d=0,p=u.length;d<p;d++)h.add(u[d]);return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",o=[],l=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&o.push(l),r.camera!==void 0&&o.push(i.getDependency("camera",r.camera).then(function(c){return i._getNodeRef(i.cameraCache,r.camera,c)})),i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){o.push(c)}),this.nodeCache[e]=Promise.all(o).then(function(c){let h;if(r.isBone===!0?h=new Uh:c.length>1?h=new bn:c.length===1?h=c[0]:h=new yt,h!==c[0])for(let u=0,f=c.length;u<f;u++)h.add(c[u]);if(r.name&&(h.userData.name=r.name,h.name=a),jn(h,r),r.extensions&&ki(n,h,r),r.matrix!==void 0){const u=new je;u.fromArray(r.matrix),h.applyMatrix4(u)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);if(!i.associations.has(h))i.associations.set(h,{});else if(r.mesh!==void 0&&i.meshCache.refs[r.mesh]>1){const u=i.associations.get(h);i.associations.set(h,{...u})}return i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new bn;n.name&&(r.name=i.createUniqueName(n.name)),jn(r,n),n.extensions&&ki(t,r,n);const a=n.nodes||[],o=[];for(let l=0,c=a.length;l<c;l++)o.push(i.getDependency("node",a[l]));return Promise.all(o).then(function(l){for(let h=0,u=l.length;h<u;h++)r.add(l[h]);const c=h=>{const u=new Map;for(const[f,d]of i.associations)(f instanceof dn||f instanceof Ot)&&u.set(f,d);return h.traverse(f=>{const d=i.associations.get(f);d!=null&&u.set(f,d)}),u};return i.associations=c(r),r})}_createAnimationTracks(e,t,n,i,r){const a=[],o=e.name?e.name:e.uuid,l=[];xi[r.path]===xi.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(o);let c;switch(xi[r.path]){case xi.weights:c=xs;break;case xi.rotation:c=_s;break;case xi.translation:case xi.scale:c=ys;break;default:switch(n.itemSize){case 1:c=xs;break;case 2:case 3:default:c=ys;break}break}const h=i.interpolation!==void 0?gy[i.interpolation]:Os,u=this._getArrayFromAccessor(n);for(let f=0,d=l.length;f<d;f++){const p=new c(l[f]+"."+xi[r.path],t.array,u,h);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(p),a.push(p)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Mc(t.constructor),i=new Float32Array(t.length);for(let r=0,a=t.length;r<a;r++)i[r]=t[r]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(t){const n=this instanceof _s?my:Yd;return new n(this.times,this.values,this.getValueSize()/3,t)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Sy(s,e,t){const n=e.attributes,i=new Xt;if(n.POSITION!==void 0){const o=t.json.accessors[n.POSITION],l=o.min,c=o.max;if(l!==void 0&&c!==void 0){if(i.set(new R(l[0],l[1],l[2]),new R(c[0],c[1],c[2])),o.normalized){const h=Mc(Ps[o.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const o=new R,l=new R;for(let c=0,h=r.length;c<h;c++){const u=r[c];if(u.POSITION!==void 0){const f=t.json.accessors[u.POSITION],d=f.min,p=f.max;if(d!==void 0&&p!==void 0){if(l.setX(Math.max(Math.abs(d[0]),Math.abs(p[0]))),l.setY(Math.max(Math.abs(d[1]),Math.abs(p[1]))),l.setZ(Math.max(Math.abs(d[2]),Math.abs(p[2]))),f.normalized){const g=Mc(Ps[f.componentType]);l.multiplyScalar(g)}o.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(o)}s.boundingBox=i;const a=new zn;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=a}function Jd(s,e,t){const n=e.attributes,i=[];function r(a,o){return t.getDependency("accessor",a).then(function(l){s.setAttribute(o,l)})}for(const a in n){const o=_c[a]||a.toLowerCase();o in s.attributes||i.push(r(n[a],o))}if(e.indices!==void 0&&!s.index){const a=t.getDependency("accessor",e.indices).then(function(o){s.setIndex(o)});i.push(a)}return nt.workingColorSpace!==wt&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${nt.workingColorSpace}" not supported.`),jn(s,e),Sy(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?xy(s,e.targets,t):s})}function Ey(s,e,t){let n=new bn;n.name=e,s.scene.add(n),Wd(e+"/info.zip?v="+Date.now(),i=>{let r=JSON.parse(i);s.engineStatus.models.push({type:"light",info:r,name:r.baseInfo.name,status:"loading",url:e,elements:new Map}),s.models==null&&(s.models=[]),s.models.push({url:e,nodesMap:new Map,boundingBox:{min:new R(r.baseInfo.min.X*.3048,r.baseInfo.min.Z*.3048,-r.baseInfo.min.Y*.3048),max:new R(r.baseInfo.max.X*.3048,r.baseInfo.max.Z*.3048,-r.baseInfo.max.Y*.3048)}}),s.events.trigger(mr.EngineFree,null)})}function Ty(s){s.engineStatus.models.forEach(e=>{e.loadStatus==null&&(e.loadStatus={mep:!1,instance:!1,normal:!1}),e.status==="loading"&&e.type==="light"&&(e.loadStatus.modelMep!=!0&&(e.loadStatus.modelMep=!0,Vb(s,e.info.modelMep,e.url)),e.loadStatus.normal!=!0&&Cy(s,e))})}function Cy(s,e){if(s.camera.position,e.size,e.info==null||e.info.lods==null)return;e.info.lods.forEach(n=>{if(n.status!=!0)if(n.glbs==null)console.log("加载GLB............."),n.glbs={},Fb(e.url+n.path+"/nodes.json?v="+Date.now(),i=>{let r=JSON.parse(i),a=new Map;s.models.find(l=>l.url==e.url).nodesMap=a;let o=0;for(let l in r){r[l].forEach(u=>{u.glb=l,a.has(u.id)==!1?a.set(u.id,{infos:[u]}):a.get(u.id).infos.push(u)});let c=new Wb;const h=new zb;h.setDecoderPath("/static/js/draco/"),h.preload(),c.setDRACOLoader(h),c.load(e.url+n.path+l+".glb",u=>{n.glbs[l]=u.scene.children,o++,o==Object.keys(r).length&&s.engineStatus.isFree&&(s.events.trigger(mr.EngineFree,null),s.viewCube.CameraGoHome())})}});else{console.log("加载模型.............");let i=t(e,n,n.octreeBox),r=[],a=s.models.find(o=>o.url==e.url);i.forEach(o=>{a.nodesMap.has(o)&&a.nodesMap.get(o).infos.forEach(l=>{let c=n.glbs[l.glb][l.mesh];if(c!=null&&c.geometry!=null&&c.material!=null){let h=new je;h.elements=l.matrix;let u=new bt(c.geometry.clone().applyMatrix4(h),c.material),f=new Xt().setFromObject(u);l.box=f,l.mesh=u,u.name=o,u.glb=l.glb,u.url=e.url,r.push(u)}})}),console.log("加载模型数量",r.length),Ay(e.url,s,r)}});function t(n,i,r){let a=[];if(r.status!=!0){if(!s.engineStatus.isFree)return a;let o=new R(r.min.X,r.min.Z,-r.min.Y),l=new R(r.max.X,r.max.Z,-r.max.Y);l.distanceTo(o);let c=s.camera.position,h=new R(o.x+l.x/2,o.y+l.y/2,o.z+l.z/2);c.distanceTo(h),r.elements.forEach(u=>{a.push(u)}),r.children.forEach(u=>{a.push(...t(n,i,u))}),r.children.findIndex(u=>u.status!=!0)==-1&&(r.status=!0),r.children.length==0&&(r.status=!0)}return a}}function Ay(s,e,t){let n=[];t.forEach(i=>{n.findIndex(a=>a.glb==i.glb)==-1?n.push({glb:i.glb,meshes:[i],currentIndex:i.geometry.index.count,indexes:new Map}):(n.find(a=>a.glb==i.glb).meshes.push(i),n.find(a=>a.glb==i.glb).currentIndex+=i.geometry.index.count);let r=n.find(a=>a.glb==i.glb);r.indexes.set(Number(i.name),[r.currentIndex-i.geometry.index.count,r.currentIndex])}),n.forEach(i=>{let r=e.scene.children.find(a=>a instanceof bt&&a.url==s&&a.glb==i.glb);if(r!=null)r.castShadow=!0,r.receiveShadow=!0;else{let a=new gt;i.meshes.map(c=>c.material),a=Gb(i.meshes.map(c=>c.geometry),!0);let o=new bt(a,i.meshes.map(c=>c.material));o.castShadow=!0,o.receiveShadow=!0,e.scene.add(o),o.index=e.scene.children.length-1,o.url=s,o.glb=i.glb,o.indexes=i.indexes,o.materialClone=i.meshes[0].material;let l=e.models.find(c=>c.url==s);if(l!=null){let c=0;i.indexes.forEach(h=>{l.nodesMap.get(Number(i.meshes[c].name)).indexes==null&&(l.nodesMap.get(Number(i.meshes[c].name)).indexes=[]),l.nodesMap.get(Number(i.meshes[c].name)).indexes.push([o.index,c++,h[0],h[1]])})}Py(o.material)}})}function Py(s){s.shadowSide=Nn,s.roughness=.6,s.metalness=0,s.map!=null&&(s.map.colorSpace=ft,s.map.needsUpdate=!0,console.log("优化贴图")),s instanceof ca&&(s.map&&(s.map.colorSpace=ft,s.map.needsUpdate=!0),s.emissiveMap&&(s.emissiveMap.colorSpace=ft,s.emissiveMap.needsUpdate=!0),s.roughnessMap&&(s.roughnessMap.colorSpace=wt,s.roughnessMap.needsUpdate=!0),s.metalnessMap&&(s.metalnessMap.colorSpace=wt,s.metalnessMap.needsUpdate=!0),s.normalMap&&(s.normalMap.colorSpace=wt,s.normalMap.needsUpdate=!0),s.aoMap&&(s.aoMap.colorSpace=wt,s.aoMap.needsUpdate=!0),s.roughness=Math.max(.1,Math.min(1,s.roughness)),s.metalness=Math.max(0,Math.min(1,s.metalness)),s.envMapIntensity=s.envMapIntensity||1,s.needsUpdate=!0),s instanceof Rn&&(this.optimizeMaterial(s),s.transmissionMap&&(s.transmissionMap.colorSpace=wt,s.transmissionMap.needsUpdate=!0),s.thicknessMap&&(s.thicknessMap.colorSpace=wt,s.thicknessMap.needsUpdate=!0),s.transmission=Math.max(0,Math.min(1,s.transmission)),s.thickness=Math.max(0,Math.min(10,s.thickness))),s instanceof Ft&&s.map&&(s.map.colorSpace=ft,s.map.needsUpdate=!0),s instanceof lu&&(s.map&&(s.map.colorSpace=ft,s.map.needsUpdate=!0),s.emissiveMap&&(s.emissiveMap.colorSpace=ft,s.emissiveMap.needsUpdate=!0))}class Ry{engine;constructor(e){this.engine=e}async loadModels(e,t){for(const i of e)n(i)==="light"&&Ey(this.engine,i);function n(i){const r=i.split(".").pop();return r==="glb"||r==="gltf"?"gltf":"light"}}}class Ly{engine;isFree;highlightModels;hideModels;models;constructor(e){this.engine=e,this.isFree=!0,this.highlightModels=[],this.hideModels=[],this.models=[]}init(){this.engine.events.on(mr.EngineFree,()=>{this.updateFree(!0),console.log("引擎空闲"),Ty(this.engine)}),this.engine.events.on(mr.EngineBusy,()=>{this.updateFree(!1),console.log("引擎繁忙")})}updateFree(e){this.isFree=e}closeAllFunction=()=>{}}class Dy{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}off(e,t){if(!this.listeners.has(e))return;const n=this.listeners.get(e),i=n.indexOf(t);i!==-1&&n.splice(i,1)}trigger(e,t){this.listeners.has(e)&&this.listeners.get(e).forEach(n=>{try{n(t)}catch(i){console.error(`Error in event listener for ${e}:`,i)}})}}class Iy{engine;constructor(e){this.engine=e}init(){const e=new mu(16777215,2);e.position.set(10,20,10),e.castShadow=!0,e.shadow.mapSize.width=4096,e.shadow.mapSize.height=4096,e.shadow.camera.near=.1,e.shadow.camera.far=500,e.shadow.bias=-5e-5,e.shadow.normalBias=.02;const t=50;e.shadow.camera.left=-t,e.shadow.camera.right=t,e.shadow.camera.top=t,e.shadow.camera.bottom=-t,e.shadow.radius=2,this.engine.scene.add(e);const n=new gu(16777215,1);this.engine.scene.add(n)}}var Zn=(s=>(s.ModelLoadStart="model-load-start",s.ModelLoadProgress="model-load-progress",s.ModelLoaded="model-loaded",s.ModelError="model-error",s.SelectionChanged="selection-changed",s.HoverChanged="hover-changed",s.Click="click",s.MouseMove="mouse-move",s.CameraChanged="camera-changed",s.CameraIdle="camera-idle",s.EngineFree="engine-free",s.EngineBusy="engine-busy",s.MeasureChanged="measure-changed",s))(Zn||{});class Ny{engine;behavior;isCtrlDown=!1;constructor(e){this.engine=e}init(){this.behavior=this.engine.handelBehaved,this.behavior.init(this)}active(){this.behavior.active()}disActive(){this.behavior.disActive()}handelKeyCtrlUp(){this.isCtrlDown=!1}handelKeyCtrlDown(){this.isCtrlDown=!0}handleMouseClick(e){if(e.catch){const t=e.catch;t.object,this.engine.events.trigger(Zn.Click,t);let n=t.object;this.isCtrlDown||this.engine.modelToolModule.unhighlightAllModels(),console.log([{url:n.url,ids:[n.name]}]),this.engine.modelToolModule.highlightModel([{url:n.url,ids:[n.name]}])}else this.engine.modelToolModule.unhighlightAllModels()}handleMouseDoubleClick(e){if(e.catch){const n=e.catch;n.object,this.engine.events.trigger(Zn.Click,n);let i=n.object,r=this.engine.models.find(o=>o.url===i.url).nodesMap.get(i.name).infos.map(o=>o.box),a=t(r);this.engine.viewCube.zoomToModel(a)}function t(n){let i=new R(1e8,1e9,1e10),r=new R(-1e8,-1e9,-1e10);return n.forEach(a=>{a.min.x<i.x&&(i.x=a.min.x),a.min.y<i.y&&(i.y=a.min.y),a.min.z<i.z&&(i.z=a.min.z),a.max.x>r.x&&(r.x=a.max.x),a.max.y>r.y&&(r.y=a.max.y),a.max.z>r.z&&(r.z=a.max.z)}),new Xt(i,r)}}}class Uy{engine;highlightMaterial;hideMaterial;constructor(e){this.engine=e,this.highlightMaterial=new Ft({color:43775,depthTest:!1,depthWrite:!1,transparent:!0,opacity:.5,side:Vt}),this.hideMaterial=new Ft({color:0,depthTest:!1,depthWrite:!1,transparent:!0,opacity:0,side:Vt})}highlightModel(e){e.forEach(t=>{t.ids.forEach(n=>{this.engine.models.find(i=>i.url==t.url).nodesMap.get(n).indexes.forEach(i=>{Qd(this.engine.scene.children[i[0]]),this.engine.scene.children[i[0]].material[i[1]]=this.highlightMaterial})}),this.engine.engineStatus.highlightModels.push(t)})}unhighlightModel(e){e.forEach(t=>{t.ids.forEach(n=>{this.engine.models.find(i=>i.url==t.url).nodesMap.get(n).indexes.forEach(i=>{this.engine.scene.children[i[0]].material[i[1]]=this.engine.scene.children[i[0]].materialClone})})})}unhighlightAllModels(){this.engine.engineStatus.highlightModels.forEach(e=>{this.unhighlightModel([e])}),this.engine.engineStatus.highlightModels=[]}hideModel(e){e.forEach(t=>{t.ids.forEach(i=>{this.engine.models.find(r=>r.url==t.url).nodesMap.get(i).indexes.forEach(r=>{Qd(this.engine.scene.children[r[0]]),this.engine.scene.children[r[0]].material[r[1]]=this.hideMaterial})});let n=this.engine.engineStatus.hideModels.find(i=>i.url==t.url);n!=null?n.ids.push(...t.ids):this.engine.engineStatus.hideModels.push({url:t.url,ids:t.ids}),this.engine.engineStatus.highlightModels=[]})}showModel(e){e.forEach(t=>{t.ids.forEach(n=>{this.engine.models.find(i=>i.url==t.url).nodesMap.get(n).indexes.forEach(i=>{this.engine.scene.children[i[0]].material[i[1]]=this.engine.scene.children[i[0]].materialClone})}),this.engine.engineStatus.hideModels.push(t)})}showAllModels(){this.engine.scene.children.forEach(e=>{e.isMesh&&this.showModel(e)}),this.engine.engineStatus.hideModels=[]}setModelColor(e,t){e.material.color.set(t)}setAllModelsColor(e){this.engine.scene.children.forEach(t=>{t.isMesh})}restoreAllModelsColor(){this.engine.scene.children.forEach(e=>{e.isMesh})}getModelsBox(e){new Xt;let t=[];return e.forEach(i=>{let r=this.engine.models.find(a=>a.url==i.url);i.ids.forEach(a=>{r.nodesMap.get(a).infos.forEach(o=>{t.push(o.box)})})}),n(t);function n(i){let r=new R(1e8,1e9,1e10),a=new R(-1e8,-1e9,-1e10);return i.forEach(o=>{o.min.x<r.x&&(r.x=o.min.x),o.min.y<r.y&&(r.y=o.min.y),o.min.z<r.z&&(r.z=o.min.z),o.max.x>a.x&&(a.x=o.max.x),o.max.y>a.y&&(a.y=o.max.y),o.max.z>a.z&&(a.z=o.max.z)}),new Xt(r,a)}}getModelDescription(e){}}function Qd(s){(s.isSplit==null||s.isSplit==null||s.isSplit==!1)&&(s.isSplit=!0)}function By(s){const e={self:null,options:null,mouseDownTime:0,lastClickTime:0};e.init=function(u,f){e.self!=null&&e.self.disActive!=null&&e.self.disActive(),e.self=u,e.options=f},e.render=function(){e.self&&e.self.render!=null&&e.self.render()},e.active=function(){s.container.addEventListener("mousedown",o),s.container.addEventListener("mouseup",c),s.container.addEventListener("mousemove",l),window.addEventListener("keydown",t),window.addEventListener("keyup",n)},e.disActive=function(){s.container.removeEventListener("mousedown",o),s.container.removeEventListener("mouseup",c),s.container.removeEventListener("mousemove",l),window.removeEventListener("keydown",t),window.removeEventListener("keyup",n)};function t(u){(u.keyCode===8||u.keyCode===46)&&e.self&&e.self.handelKeyDeleteDown!=null&&e.self.handelKeyDeleteDown(),u.keyCode===27&&e.self&&e.self.handelKeyEscDown!=null&&e.self.handelKeyEscDown(),u.keyCode===13&&e.self&&e.self.handelKeyEnterDown!=null&&e.self.handelKeyEnterDown(),u.keyCode===32&&e.self&&e.self.handelKeySpaceDown!=null&&e.self.handelKeySpaceDown(),u.key==="Control"&&e.self&&e.self.handelKeyCtrlDown!=null&&e.self.handelKeyCtrlDown(),u.key==="Shift"&&e.self&&e.self.handelKeyShiftDown!=null&&e.self.handelKeyShiftDown(),u.key==="Meta"&&e.self&&e.self.handelKeyMetaDown!=null&&e.self.handelKeyMetaDown()}function n(u){u.key==="Alt"&&e.self&&e.self.handelKeyAltUp!=null&&e.self.handelKeyAltUp(),u.key==="Tab"&&e.self&&e.self.handelKeyTabUp!=null&&e.self.handelKeyTabUp(),u.key==="Control"&&e.self&&e.self.handelKeyCtrlUp!=null&&e.self.handelKeyCtrlUp(),u.key==="Shift"&&e.self&&e.self.handelKeyShiftUp!=null&&e.self.handelKeyShiftUp(),u.key==="Meta"&&e.self&&e.self.handelKeyMetaUp!=null&&e.self.handelKeyMetaUp(),u.key==="Command"&&e.self&&e.self.handelKeyCommandUp!=null&&e.self.handelKeyCommandUp(),u.key==="Windows"&&e.self&&e.self.handelKeyWindowsUp!=null&&e.self.handelKeyWindowsUp()}function i(u){const f=new de,d=s.renderer.domElement.clientWidth,p=s.renderer.domElement.clientHeight;return f.x=u.clientX/d*2-1,f.y=-(u.clientY/p)*2+1,f}function r(u){const f=new ar,d=i(u);return f.setFromCamera(d,s.camera),f}function a(u,f=!1){const d=r(u);if(u.raycaster=d,f){const p=h(d);u.catch=p}}function o(u){u.button===0&&(e.mouseDownTime=Date.now(),e.self&&e.self.handleMouseDown!=null&&(a(u,!0),e.self.handleMouseDown(u)))}function l(u){e.self&&e.self.handleMouseMove!=null&&(a(u,!0),e.self.handleMouseMove(u))}function c(u){if(u.button!==0)return;const f=Date.now(),d=f-e.mouseDownTime;if(e.self&&e.self.handleMouseUp!=null&&(a(u,!1),e.self.handleMouseUp(u)),d<100&&e.self&&e.self.handleMouseClick!=null){a(u,!0);const p=f-e.lastClickTime;console.log(p),p<200?e.self.handleMouseDoubleClick(u):e.self.handleMouseClick(u),e.lastClickTime=Date.now()}}function h(u){const f=s.octreeBox.rayInterationModel(u);if(f.length!==0)return f[0]}return e}var wc={exports:{}},ky=wc.exports,ef;function Oy(){return ef||(ef=1,(function(s,e){(function(t,n){s.exports=n()})(ky,function(){var t=function(){function n(d){return a.appendChild(d.dom),d}function i(d){for(var p=0;p<a.children.length;p++)a.children[p].style.display=p===d?"block":"none";r=d}var r=0,a=document.createElement("div");a.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",a.addEventListener("click",function(d){d.preventDefault(),i(++r%a.children.length)},!1);var o=(performance||Date).now(),l=o,c=0,h=n(new t.Panel("FPS","#0ff","#002")),u=n(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var f=n(new t.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:a,addPanel:n,showPanel:i,begin:function(){o=(performance||Date).now()},end:function(){c++;var d=(performance||Date).now();if(u.update(d-o,200),d>l+1e3&&(h.update(1e3*c/(d-l),100),l=d,c=0,f)){var p=performance.memory;f.update(p.usedJSHeapSize/1048576,p.jsHeapSizeLimit/1048576)}return d},update:function(){o=this.end()},domElement:a,setMode:i}};return t.Panel=function(n,i,r){var a=1/0,o=0,l=Math.round,c=l(window.devicePixelRatio||1),h=80*c,u=48*c,f=3*c,d=2*c,p=3*c,g=15*c,v=74*c,m=30*c,x=document.createElement("canvas");x.width=h,x.height=u,x.style.cssText="width:80px;height:48px";var _=x.getContext("2d");return _.font="bold "+9*c+"px Helvetica,Arial,sans-serif",_.textBaseline="top",_.fillStyle=r,_.fillRect(0,0,h,u),_.fillStyle=i,_.fillText(n,f,d),_.fillRect(p,g,v,m),_.fillStyle=r,_.globalAlpha=.9,_.fillRect(p,g,v,m),{dom:x,update:function(M,T){a=Math.min(a,M),o=Math.max(o,M),_.fillStyle=r,_.globalAlpha=1,_.fillRect(0,0,h,g),_.fillStyle=i,_.fillText(l(M)+" "+n+" ("+l(a)+"-"+l(o)+")",f,d),_.drawImage(x,p+c,g,v-c,m,p,g,v-c,m),_.fillRect(p+v-c,g,c,m),_.fillStyle=r,_.globalAlpha=.9,_.fillRect(p+v-c,g,c,l((1-M/T)*m))}}},t})})(wc)),wc.exports}var Fy=Oy();const zy=nd(Fy);var Rs=Object.freeze({Linear:Object.freeze({None:function(s){return s},In:function(s){return s},Out:function(s){return s},InOut:function(s){return s}}),Quadratic:Object.freeze({In:function(s){return s*s},Out:function(s){return s*(2-s)},InOut:function(s){return(s*=2)<1?.5*s*s:-.5*(--s*(s-2)-1)}}),Cubic:Object.freeze({In:function(s){return s*s*s},Out:function(s){return--s*s*s+1},InOut:function(s){return(s*=2)<1?.5*s*s*s:.5*((s-=2)*s*s+2)}}),Quartic:Object.freeze({In:function(s){return s*s*s*s},Out:function(s){return 1- --s*s*s*s},InOut:function(s){return(s*=2)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2)}}),Quintic:Object.freeze({In:function(s){return s*s*s*s*s},Out:function(s){return--s*s*s*s*s+1},InOut:function(s){return(s*=2)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2)}}),Sinusoidal:Object.freeze({In:function(s){return 1-Math.sin((1-s)*Math.PI/2)},Out:function(s){return Math.sin(s*Math.PI/2)},InOut:function(s){return .5*(1-Math.sin(Math.PI*(.5-s)))}}),Exponential:Object.freeze({In:function(s){return s===0?0:Math.pow(1024,s-1)},Out:function(s){return s===1?1:1-Math.pow(2,-10*s)},InOut:function(s){return s===0?0:s===1?1:(s*=2)<1?.5*Math.pow(1024,s-1):.5*(-Math.pow(2,-10*(s-1))+2)}}),Circular:Object.freeze({In:function(s){return 1-Math.sqrt(1-s*s)},Out:function(s){return Math.sqrt(1- --s*s)},InOut:function(s){return(s*=2)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1)}}),Elastic:Object.freeze({In:function(s){return s===0?0:s===1?1:-Math.pow(2,10*(s-1))*Math.sin((s-1.1)*5*Math.PI)},Out:function(s){return s===0?0:s===1?1:Math.pow(2,-10*s)*Math.sin((s-.1)*5*Math.PI)+1},InOut:function(s){return s===0?0:s===1?1:(s*=2,s<1?-.5*Math.pow(2,10*(s-1))*Math.sin((s-1.1)*5*Math.PI):.5*Math.pow(2,-10*(s-1))*Math.sin((s-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(s){var e=1.70158;return s===1?1:s*s*((e+1)*s-e)},Out:function(s){var e=1.70158;return s===0?0:--s*s*((e+1)*s+e)+1},InOut:function(s){var e=2.5949095;return(s*=2)<1?.5*(s*s*((e+1)*s-e)):.5*((s-=2)*s*((e+1)*s+e)+2)}}),Bounce:Object.freeze({In:function(s){return 1-Rs.Bounce.Out(1-s)},Out:function(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},InOut:function(s){return s<.5?Rs.Bounce.In(s*2)*.5:Rs.Bounce.Out(s*2-1)*.5+.5}}),generatePow:function(s){return s===void 0&&(s=4),s=s<Number.EPSILON?Number.EPSILON:s,s=s>1e4?1e4:s,{In:function(e){return Math.pow(e,s)},Out:function(e){return 1-Math.pow(1-e,s)},InOut:function(e){return e<.5?Math.pow(e*2,s)/2:(1-Math.pow(2-e*2,s))/2+.5}}}}),vr=function(){return performance.now()},Hy=(function(){function s(){this._tweens={},this._tweensAddedDuringUpdate={}}return s.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},s.prototype.removeAll=function(){this._tweens={}},s.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},s.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},s.prototype.update=function(e,t){e===void 0&&(e=vr()),t===void 0&&(t=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]],a=!t;r&&r.update(e,a)===!1&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},s})(),Sc={Linear:function(s,e){var t=s.length-1,n=t*e,i=Math.floor(n),r=Sc.Utils.Linear;return e<0?r(s[0],s[1],n):e>1?r(s[t],s[t-1],t-n):r(s[i],s[i+1>t?t:i+1],n-i)},Utils:{Linear:function(s,e,t){return(e-s)*t+s}}},tf=(function(){function s(){}return s.nextId=function(){return s._nextId++},s._nextId=0,s})(),Ec=new Hy,Vy=(function(){function s(e,t){t===void 0&&(t=Ec),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Rs.Linear.None,this._interpolationFunction=Sc.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=tf.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return s.prototype.getId=function(){return this._id},s.prototype.isPlaying=function(){return this._isPlaying},s.prototype.isPaused=function(){return this._isPaused},s.prototype.getDuration=function(){return this._duration},s.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},s.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},s.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},s.prototype.start=function(e,t){if(e===void 0&&(e=vr()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var r in this._valuesEnd)i[r]=this._valuesEnd[r];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},s.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},s.prototype._setupProperties=function(e,t,n,i,r){for(var a in n){var o=e[a],l=Array.isArray(o),c=l?"array":typeof o,h=!l&&Array.isArray(n[a]);if(!(c==="undefined"||c==="function")){if(h){var u=n[a];if(u.length===0)continue;for(var f=[o],d=0,p=u.length;d<p;d+=1){var g=this._handleRelativeValue(o,u[d]);if(isNaN(g)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(g)}h&&(n[a]=f)}if((c==="object"||l)&&o&&!h){t[a]=l?[]:{};var v=o;for(var m in v)t[a][m]=v[m];i[a]=l?[]:{};var u=n[a];if(!this._isDynamic){var x={};for(var m in u)x[m]=u[m];n[a]=u=x}this._setupProperties(v,t[a],u,i[a],r)}else(typeof t[a]>"u"||r)&&(t[a]=o),l||(t[a]*=1),h?i[a]=n[a].slice().reverse():i[a]=t[a]||0}}},s.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},s.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},s.prototype.pause=function(e){return e===void 0&&(e=vr()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},s.prototype.resume=function(e){return e===void 0&&(e=vr()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},s.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},s.prototype.group=function(e){return e===void 0&&(e=Ec),this._group=e,this},s.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},s.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},s.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},s.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},s.prototype.easing=function(e){return e===void 0&&(e=Rs.Linear.None),this._easingFunction=e,this},s.prototype.interpolation=function(e){return e===void 0&&(e=Sc.Linear),this._interpolationFunction=e,this},s.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},s.prototype.onStart=function(e){return this._onStartCallback=e,this},s.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},s.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},s.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},s.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},s.prototype.onStop=function(e){return this._onStopCallback=e,this},s.prototype.update=function(e,t){var n=this,i;if(e===void 0&&(e=vr()),t===void 0&&(t=!0),this._isPaused)return!0;var r,a=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>a)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,l=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),c=this._duration+this._repeat*l,h=function(){if(n._duration===0||o>c)return 1;var v=Math.trunc(o/l),m=o-v*l,x=Math.min(m/n._duration,1);return x===0&&o===n._duration?1:x},u=h(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var d=Math.min(Math.trunc((o-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=d);for(r in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[r]=="string"&&(this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(this._valuesEnd[r])),this._yoyo&&this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*d,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var p=0,g=this._chainedTweens.length;p<g;p++)this._chainedTweens[p].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},s.prototype._updateProperties=function(e,t,n,i){for(var r in n)if(t[r]!==void 0){var a=t[r]||0,o=n[r],l=Array.isArray(e[r]),c=Array.isArray(o),h=!l&&c;h?e[r]=this._interpolationFunction(o,i):typeof o=="object"&&o?this._updateProperties(e[r],a,o,i):(o=this._handleRelativeValue(a,o),typeof o=="number"&&(e[r]=a+(o-a)*i))}},s.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},s.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},s})();tf.nextId;var qn=Ec;qn.getAll.bind(qn),qn.removeAll.bind(qn),qn.add.bind(qn),qn.remove.bind(qn),qn.update.bind(qn);var Tc={Easing:Rs,Tween:Vy};function Gy(){return new Ah}function Wy(s,e){s.appendChild(e.domElement)}function Xy(s,e,t){var n=new Object;n.visible=!0;let i=null,r,a,o=[];n.init=function(){r||(c(),h(),u())},n.Hide=function(){r.style.display="none",n.visible=!1},n.Show=function(){r.style.display="block",n.visible=!0},n.RenderScene=function(){n.camera.quaternion.copy(e.camera.quaternion);let p=new R(0,0,-1).clone().applyMatrix4(e.camera.matrixWorld.clone()),g=e.camera.position.clone().sub(p.clone()).setLength(100);n.camera.position.copy(g),n.camera.lookAt(new R),n.sceneOrtho.renderer.render(n.sceneOrtho,n.camera)},n.ToggleDirectionView=function(p){console.log(p);var g=new R(0,0,0);p=="top"?g=new R(0,1,0):p=="down"?g=new R(0,-1,0):p=="front"?g=new R(0,0,1):p=="left"?g=new R(-1,0,0):p=="back"?g=new R(0,0,-1):p=="right"?g=new R(1,0,0):p=="top_front"?g=new R(1,1,0):p=="top_left"?g=new R(0,1,-1):p=="top_back"?g=new R(-1,1,0):p=="top_right"?g=new R(0,1,1):p=="down_front"?g=new R(1,-1,0):p=="down_left"?g=new R(0,-1,-1):p=="down_back"?g=new R(-1,-1,0):p=="down_right"?g=new R(0,-1,1):p=="front_right"?g=new R(1,0,1):p=="right_back"?g=new R(-1,0,1):p=="back_left"?g=new R(-1,0,-1):p=="left_front"?g=new R(1,0,-1):p=="top_left_front"?g=new R(1,1,-1):p=="top_front_right"?g=new R(1,1,1):p=="top_right_back"?g=new R(-1,1,1):p=="top_back_left"?g=new R(-1,1,-1):p=="button_left_front"?g=new R(1,-1,-1):p=="button_front_right"?g=new R(1,-1,1):p=="button_right_back"?g=new R(-1,1,1):p=="button_back_left"&&(g=new R(-1,-1,-1));var v=s.octreeBox.getBoundingBox(),m=v.min,x=v.max,_=m.clone().add(x.clone()).multiplyScalar(.5),M=_.clone().add(g.multiplyScalar(1*x.distanceTo(m)));l(e.camera.position,M,s.controls.target.clone(),_)},n.GetCameraPose=function(){var p=e.camera.quaternion,g=e.camera.position,v=s.controls.target,m={quaternion:p,position:g,target:v};return m},n.ReductionCameraPose=function(p,g=1e3,v){var m=new En(p.quaternion._x,p.quaternion._y,p.quaternion._z,p.quaternion._w),x=new R(p.position.x,p.position.y,p.position.z),_=new R(p.target.x,p.target.y,p.target.z);let M=!1;l(e.camera.position,x,s.controls.target.clone(),_,e.camera.quaternion,m,g,T=>{v&&(M||(v(T),M=!0))}),v&&setTimeout(()=>{M||(v(!0),M=!0)},g+10)},n.CameraGoHome=function(){var p=s.octreeBox.getBoundingBox();console.log(p.min,p.max);var g=p.min.clone().add(p.max.clone()).multiplyScalar(.5);let v=new R(1,1,1);var m=g.clone().add(v.multiplyScalar(1*p.max.distanceTo(p.min)));l(e.camera.position,m,s.controls.target.clone(),g)},n.zoomToBox=function(p){var g=p.min.clone().add(p.max.clone()).multiplyScalar(.5);let v=e.camera.position.clone().sub(s.controls.target.clone()).normalize();var m=g.clone().add(v.multiplyScalar(1*p.max.distanceTo(p.min)));l(e.camera.position,m,s.controls.target.clone(),g)};function l(p,g,v,m,x,_,M=1e3,T){var A;x&&_?(A=new Tc.Tween({x1:p.x,y1:p.y,z1:p.z,x2:v.x,y2:v.y,z2:v.z,_x:x._x,_y:x._y,_z:x._z,_w:x._w}),A.to({x1:g.x,y1:g.y,z1:g.z,x2:m.x,y2:m.y,z2:m.z,_x:_._x,_y:_._y,_z:_._z,_w:_._w},M)):(A=new Tc.Tween({x1:p.x,y1:p.y,z1:p.z,x2:v.x,y2:v.y,z2:v.z}),A.to({x1:g.x,y1:g.y,z1:g.z,x2:m.x,y2:m.y,z2:m.z},M)),A.onUpdate(function(U){x&&_?(e.camera.quaternion._x=U._x,e.camera.quaternion._y=U._y,e.camera.quaternion._z=U._z,e.camera.quaternion._w=U._w):s.controls.auto=!0,e.camera.position.x=U.x1,e.camera.position.y=U.y1,e.camera.position.z=U.z1,s.controls.target.x=U.x2,s.controls.target.y=U.y2,s.controls.target.z=U.z2,s.controls.update(),n.RenderScene()}),A.onComplete(function(U){s.controls.auto=!1,n.RenderScene(),T&&T(!0),cancelAnimationFrame(i),i=null}),A.easing(Tc.Easing.Cubic.InOut);function L(U){i=requestAnimationFrame(L),A.update()}A.start(),L()}function c(){r=document.createElement("div"),r.className="ViewCube",t.appendChild(r),a=document.createElement("div"),a.className="ViewAttr",t.appendChild(a);var p=document.createElement("div");p.className="homeViewWrapper",p.addEventListener("mousedown",function(){console.log("归位"),n.CameraGoHome()}),r.appendChild(p)}function h(){n.sceneOrtho=Gy();var v=t.clientWidth,m=t.clientWidth,p=v>m?v/m:m/v,g=300;n.camera=new gi(g*p/-2,g*p/2,g/2,g/-2,.01,1e4);var v=r.clientWidth,m=r.clientHeight,x=new Yu({alpha:!0});x.setSize(v,m),x.setClearAlpha(0),n.sceneOrtho.renderer=x;let _=new gu(16777215,.8);n.sceneOrtho.add(_),Wy(r,x)}function u(){const p="/assets/viewcube/";let g=[{label:"右",icon:p+"cn_right.png"},{label:"左",icon:p+"cn_left.png"},{label:"顶",icon:p+"cn_top.png"},{label:"底",icon:p+"cn_bottom.png"},{label:"前",icon:p+"cn_front.png"},{label:"后",icon:p+"cn_back.png"}];var v=[];for(const x of g)v.push(new Ft({color:16777215,map:new du().load(x.icon)}));new lu({color:255});var m=new bt(new Si(110,110,110),v);n.sceneOrtho.add(m),f(122),r.addEventListener("mousedown",x=>{var _={};_.x=x.offsetX/r.clientWidth*2-1,_.y=-(x.offsetY/r.clientHeight)*2+1;var M=new ar;M.setFromCamera(_,n.camera);const T=M.intersectObjects(o,!1);T.length>0&&n.ToggleDirectionView(T[0].object.name)}),r.addEventListener("mousemove",x=>{var _={};_.x=x.offsetX/r.clientWidth*2-1,_.y=-(x.offsetY/r.clientHeight)*2+1;var M=new ar;M.setFromCamera(_,n.camera);const T=M.intersectObjects(o,!1);for(var A of o)A.material.opacity=.01;T.length>0&&(T[0].object.material.opacity=.2)})}function f(p){for(var g=p*.5-20,v=[{name:"right",a:30,b:75,c:75,point:new R(g,0,0)},{name:"back",a:75,b:75,c:30,point:new R(0,0,-g)},{name:"left",a:30,b:75,c:75,point:new R(-g,0,0)},{name:"front",a:75,b:75,c:30,point:new R(0,0,g)},{name:"top",a:75,b:30,c:75,point:new R(0,g,0)},{name:"button",a:75,b:30,c:75,point:new R(0,-g,0)}],m=[{name:"top_right_back",a:30,b:30,c:30,point:new R(-g,g,g)},{name:"button_front_right",a:30,b:30,c:30,point:new R(-g,-g,g)},{name:"top_front_right",a:30,b:30,c:30,point:new R(g,g,g)},{name:"button_right_back",a:30,b:30,c:30,point:new R(g,-g,g)},{name:"top_back_left",a:30,b:30,c:30,point:new R(-g,g,-g)},{name:"button_back_left",a:30,b:30,c:30,point:new R(-g,-g,-g)},{name:"top_left_front",a:30,b:30,c:30,point:new R(g,g,-g)},{name:"button_left_front",a:30,b:30,c:30,point:new R(g,-g,-g)}],x=[{name:"top_front",a:30,b:30,c:75,point:new R(g,g,0)},{name:"top_right",a:75,b:30,c:30,point:new R(0,g,g)},{name:"top_back",a:30,b:30,c:75,point:new R(-g,g,0)},{name:"top_left",a:75,b:30,c:30,point:new R(0,g,-g)},{name:"button_front",a:30,b:30,c:75,point:new R(g,-g,0)},{name:"button_right",a:75,b:30,c:30,point:new R(0,-g,g)},{name:"button_back",a:30,b:30,c:75,point:new R(-g,-g,0)},{name:"button_left",a:75,b:30,c:30,point:new R(0,-g,-g)},{name:"front_right",a:30,b:75,c:30,point:new R(g,0,g)},{name:"right_back",a:30,b:75,c:30,point:new R(-g,0,g)},{name:"back_left",a:30,b:75,c:30,point:new R(-g,0,-g)},{name:"left_front",a:30,b:75,c:30,point:new R(g,0,-g)}],_=0;_<v.length;_++)o.push(d(v[_]));for(var _=0;_<m.length;_++)o.push(d(m[_]));for(var _=0;_<x.length;_++)o.push(d(x[_]))}function d(p){const g=new Si(p.a,p.b,p.c),v=new Ft({color:"blue",transparent:!0,opacity:.01}),m=new je().makeTranslation(p.point.x,p.point.y,p.point.z);let x=g.applyMatrix4(m),_=new bt(x,v);return _.name=p.name,n.sceneOrtho.add(_),_}return n}class jy{engine;cubeTool;constructor(e){this.engine=e}init(){this.cubeTool=Xy(this.engine,this.engine.scene,this.engine.container),this.cubeTool.init()}CameraGoHome(){this.cubeTool.CameraGoHome()}zoomToModel(e){this.cubeTool.zoomToBox(e)}}function Zy(s){let e=new Object;return e.getBoundingBox=function(){let t=s.models,n=new R(1e8,1e9,1e10),i=new R(-1e8,-1e9,-1e10);t.forEach(u=>{let f=u.boundingBox.min,d=u.boundingBox.max;f.x<n.x&&(n.x=f.x),f.y<n.y&&(n.y=f.y),f.z<n.z&&(n.z=f.z),d.x>i.x&&(i.x=d.x),d.y>i.y&&(i.y=d.y),d.z>i.z&&(i.z=d.z)});let r=Math.min(n.x,i.x),a=Math.min(n.y,i.y),o=Math.min(n.z,i.z),l=Math.max(n.x,i.x),c=Math.max(n.y,i.y),h=Math.max(n.z,i.z);return{min:new R(r,a,o),max:new R(l,c,h)}},e.rayInterationModel=function(t){let n=[];return s.engineStatus.models.forEach(r=>{r.info.lods.forEach(a=>{let o=a.octreeBox;i(t,o,r)})}),t.intersectObjects(n,!1);function i(r,a,o){if(a==null)return;let l=new R(a.min.X*.3048,a.min.Z*.3048,-a.min.Y*.3048),c=new R(a.max.X*.3048,a.max.Z*.3048,-a.max.Y*.3048),h=new R(Math.min(l.x,c.X),Math.min(l.y,c.y),Math.min(l.z,c.z)),u=new R(Math.max(c.x,l.x),Math.max(c.y,l.y),Math.max(c.z,l.z)),f=new Xt(h,u),d=r.ray.intersectsBox(f);if(!(d==null||d==!1))if(a.children==null||a.children.length==0){if(a.elements!=null)for(var p of a.elements){let g=s.engineStatus.hideModels.find(m=>m.url==o.url)?.ids;if(g!=null&&g.includes(p))continue;s.models.find(m=>m.url==o.url).nodesMap.get(p)?.infos.map(m=>m.mesh).forEach(m=>{n.push(m)})}}else{if(a.elements!=null)for(var p of a.elements){let v=s.engineStatus.hideModels.find(x=>x.url==o.url)?.ids;if(v!=null&&v.includes(p))continue;s.models.find(x=>x.url==o.url).nodesMap.get(p)?.infos.map(x=>x.mesh).forEach(x=>{n.push(x)})}for(let g of a.children)i(r,g,o)}}},e}class pn{constructor(e,t,n){this.camera=e,this.renderer=t,this.scene=n,this.raycaster=new ar}raycaster;worldToScreenNormalized(e){const t=e.clone();return t.project(this.camera),new de(t.x,t.y)}worldToScreen(e){const t=this.worldToScreenNormalized(e),n=this.renderer.domElement.width,i=this.renderer.domElement.height,r=(t.x+1)*n/2,a=(1-t.y)*i/2;return new de(r,a)}screenToNormalized(e,t){const n=this.renderer.domElement.width,i=this.renderer.domElement.height,r=e/n*2-1,a=-(t/i*2-1);return new de(r,a)}screenToWorld(e,t,n){if(!this.scene&&!n)return console.warn("WorldToScreen: 需要提供 scene 或 objects 参数才能进行屏幕坐标转世界坐标"),null;const i=this.screenToNormalized(e,t);this.raycaster.setFromCamera(i,this.camera);const r=n||this.scene.children,a=this.raycaster.intersectObjects(r,!0);return a.length>0?a[0].point:null}screenToWorldWithDepth(e,t,n=0){const i=this.screenToNormalized(e,t),r=new R(i.x,i.y,n);return r.unproject(this.camera),r}updateCamera(e){this.camera=e}updateRenderer(e){this.renderer=e}updateScene(e){this.scene=e}}class qy{engine;isDrawing=!1;startPoint=new de;endPoint=new de;selectionBox=null;worldToScreen=null;boundMouseDown;boundMouseMove;boundMouseUp;boundKeyDown;constructor(e){this.engine=e,this.boundMouseDown=this.onMouseDown.bind(this),this.boundMouseMove=this.onMouseMove.bind(this),this.boundMouseUp=this.onMouseUp.bind(this),this.boundKeyDown=this.onKeyDown.bind(this)}init(){this.createSelectionBoxElement(),this.engine.scene&&this.engine.camera&&this.engine.renderer&&(this.worldToScreen=new pn(this.engine.camera,this.engine.renderer,this.engine.scene))}active(){this.engine.controlModule.disActive();const e=this.engine.renderer?.domElement;e&&(e.addEventListener("mousedown",this.boundMouseDown),e.addEventListener("mousemove",this.boundMouseMove),e.addEventListener("mouseup",this.boundMouseUp),e.style.cursor="crosshair"),window.addEventListener("keydown",this.boundKeyDown)}disActive(){this.engine.controlModule.active();const e=this.engine.renderer?.domElement;e&&(e.removeEventListener("mousedown",this.boundMouseDown),e.removeEventListener("mousemove",this.boundMouseMove),e.removeEventListener("mouseup",this.boundMouseUp),e.style.cursor="default"),window.removeEventListener("keydown",this.boundKeyDown),this.isDrawing&&this.endDrawing()}createSelectionBoxElement(){this.selectionBox=document.createElement("div"),this.selectionBox.style.position="absolute",this.selectionBox.style.border="2px dashed #00aaff",this.selectionBox.style.backgroundColor="rgba(0, 170, 255, 0.1)",this.selectionBox.style.pointerEvents="none",this.selectionBox.style.display="none",this.selectionBox.style.zIndex="1000",this.selectionBox.style.boxSizing="border-box";const e=this.engine.renderer?.domElement;e&&e.parentElement&&e.parentElement.appendChild(this.selectionBox)}onMouseDown(e){if(e.button!==0)return;const t=this.engine.renderer?.domElement;if(!t)return;const n=t.getBoundingClientRect();this.startPoint.set(e.clientX-n.left,e.clientY-n.top),this.endPoint.copy(this.startPoint),this.isDrawing=!0,this.selectionBox&&(this.selectionBox.style.display="block",this.updateSelectionBoxUI()),e.preventDefault(),e.stopPropagation()}onMouseMove(e){if(!this.isDrawing)return;const t=this.engine.renderer?.domElement;if(!t)return;const n=t.getBoundingClientRect();this.endPoint.set(e.clientX-n.left,e.clientY-n.top),this.updateSelectionBoxUI(),e.preventDefault(),e.stopPropagation()}onMouseUp(e){this.isDrawing&&(this.endDrawing(),this.performZoom(),e.preventDefault(),e.stopPropagation(),this.disActive())}onKeyDown(e){e.key==="Escape"&&(this.disActive(),e.preventDefault(),e.stopPropagation())}endDrawing(){this.isDrawing&&(this.isDrawing=!1,this.selectionBox&&(this.selectionBox.style.display="none"))}updateSelectionBoxUI(){if(!this.selectionBox)return;const e=Math.min(this.startPoint.x,this.endPoint.x),t=Math.min(this.startPoint.y,this.endPoint.y),n=Math.abs(this.endPoint.x-this.startPoint.x),i=Math.abs(this.endPoint.y-this.startPoint.y);this.selectionBox.style.left=`${e}px`,this.selectionBox.style.top=`${t}px`,this.selectionBox.style.width=`${n}px`,this.selectionBox.style.height=`${i}px`}performZoom(){const e=Math.abs(this.endPoint.x-this.startPoint.x),t=Math.abs(this.endPoint.y-this.startPoint.y);if(e<5||t<5)return;if(!this.worldToScreen){console.warn("RangeScale: 坐标转换工具未初始化");return}const n=Math.min(this.startPoint.x,this.endPoint.x),i=Math.max(this.startPoint.x,this.endPoint.x),r=Math.min(this.startPoint.y,this.endPoint.y),a=Math.max(this.startPoint.y,this.endPoint.y),o=[],l=[{x:n,y:r},{x:i,y:r},{x:i,y:a},{x:n,y:a}];for(const h of l){const u=this.worldToScreen.screenToWorld(h.x,h.y);u&&o.push(u)}if(o.length<3){const h=this.engine.camera,u=this.engine.scene,f=new Xt;if(u.traverse(d=>{if(d.isMesh&&d.visible&&d.geometry&&(d.geometry.computeBoundingBox(),d.geometry.boundingBox)){const p=d.geometry.boundingBox.clone();p.applyMatrix4(d.matrixWorld),f.union(p)}}),f.isEmpty())for(const d of l){const p=this.worldToScreen.screenToWorldWithDepth(d.x,d.y,10);o.push(p)}else{const d=new R;f.getCenter(d);const p=d.clone().sub(h.position).length();for(const g of l){const v=this.worldToScreen.screenToWorldWithDepth(g.x,g.y,p);o.push(v)}}}if(o.length<3){console.warn("RangeScale: 无法将屏幕区域转换为世界坐标");return}const c=new Xt;for(const h of o)c.expandByPoint(h);if(c.isEmpty()){console.warn("RangeScale: 计算得到的包围盒无效");return}this.fitCameraToBoundingBox(c)}fitCameraToBoundingBox(e){const t=this.engine.camera,n=this.engine.controls;if(!t||!n){console.warn("RangeScale: 相机或控制器未初始化");return}const i=new R;e.getCenter(i);const r=new R;e.getSize(r);const a=Math.max(r.x,r.y,r.z);if(t instanceof Zt){const o=t.fov*(Math.PI/180),l=a/(2*Math.tan(o/2))*1.2,c=new R;t.getWorldDirection(c);const h=i.clone().sub(t.position);c.dot(h.normalize())<0&&c.negate();const u=i.clone().sub(c.multiplyScalar(l));t.position.copy(u),n.target&&n.target.copy(i),t.lookAt(i),n.update()}else if(t instanceof gi){const o=a*1.2,l=this.engine.renderer?.domElement,c=l?l.width/l.height:1;t.left=-o*c/2,t.right=o*c/2,t.top=o/2,t.bottom=-o/2,t.updateProjectionMatrix();const h=new R;t.getWorldDirection(h);const u=a*1.5,f=i.clone().sub(h.multiplyScalar(u));t.position.copy(f),n.target&&n.target.copy(i),t.lookAt(i),n.update()}}}class Yy{engine;constructor(e){this.engine=e}init(){}}class ai{engine;constructor(e){this.engine=e}renderCatchElementEvent(e){}renderCatchElement(e){const t=this.engine.measure.annotationContainer.getElementsByClassName("catch-point");if(t.length>0){let n=new de(-1e3,-1e3);e!=null&&(n=new pn(this.engine.camera,this.engine.renderer,this.engine.scene).worldToScreen(e.point));const i=t[0];i.style.left=n.x+"px",i.style.top=n.y+"px",console.log("更新位置")}else{if(e==null)return;const n=new pn(this.engine.camera,this.engine.renderer,this.engine.scene).worldToScreen(e.point),i=document.createElement("div");i.className="catch-point",i.style.left=n.x+"px",i.style.top=n.y+"px",i.style.width="10px",i.style.height="10px",i.style.backgroundColor="red",i.style.borderRadius="50%",i.style.pointerEvents="none",i.style.position="absolute",i.style.zIndex="1000",this.engine.measure.annotationContainer.appendChild(i)}return e}drawNormalAnnotation(){let e=this;this.engine.measure.annotationData.normalAnnotation.forEach(l=>{o(l)}),this.engine.measure.annotationData.elevationAnnotation.forEach(l=>{a(l)}),this.engine.measure.annotationData.coordinateAnnotation.forEach(l=>{r(l)}),this.engine.measure.annotationData.angleAnnotation.forEach(l=>{t(l)}),this.engine.measure.annotationData.areaAnnotation.forEach(l=>{n(l)}),this.engine.measure.annotationData.slopeAnnotation.forEach(l=>{i(l)});function t(l){if(l.container==null){let g=['<svg class="measureSvg">','<circle cx="50" cy="50" r="5" fill="#f99d0b" />','<circle cx="50" cy="50" r="5" fill="#f99d0b" />','<circle cx="50" cy="50" r="5" fill="#f99d0b" />','<polyline stroke="orange" stroke-width="2" points="0,0 0,0" style="fill: none; opacity: 1;"/>','<polyline stroke="orange" stroke-width="2" points="0,0 0,0" style="fill: none; opacity: 1;"/>','<rect x="0" y="0" width="80" height="25" class="measureBack" />','<text x="40" y="16" text-anchor="middle" class="measureLabel">'+l.text+"</text>","</svg>"].join("");l.container=document.createElement("div"),l.container.className="angle-annotation",l.container.id=l.id,l.container.innerHTML=g,e.engine.measure.annotationContainer.appendChild(l.container),l.container.getElementsByTagName("svg")[0].addEventListener("click",function(){l.container.getElementsByTagName("svg")[0].classList.add("Hight")})}let c=new pn(e.engine.camera,e.engine.renderer,e.engine.scene).worldToScreen(l.point1),h=new pn(e.engine.camera,e.engine.renderer,e.engine.scene).worldToScreen(l.point2),u=new pn(e.engine.camera,e.engine.renderer,e.engine.scene).worldToScreen(l.point3),f=l.container;f.getElementsByTagName("circle")[0].setAttribute("cx",c.x),f.getElementsByTagName("circle")[0].setAttribute("cy",c.y),f.getElementsByTagName("circle")[1].setAttribute("cx",h.x),f.getElementsByTagName("circle")[1].setAttribute("cy",h.y),f.getElementsByTagName("circle")[2].setAttribute("cx",u.x),f.getElementsByTagName("circle")[2].setAttribute("cy",u.y),f.getElementsByTagName("polyline")[0].setAttribute("points",c.x+","+c.y+" "+h.x+","+h.y),f.getElementsByTagName("polyline")[1].setAttribute("points",h.x+","+h.y+" "+u.x+","+u.y);let d=h.x,p=h.y-30;f.getElementsByTagName("rect")[0].setAttribute("x",d-40),f.getElementsByTagName("rect")[0].setAttribute("y",p-12.5),f.getElementsByTagName("text")[0].setAttribute("x",d),f.getElementsByTagName("text")[0].setAttribute("y",p+4),f.getElementsByTagName("text")[0].innerHTML=l.text,f.style.top="0px",f.style.left="0px"}function n(l){if(l.container==null){let v=['<svg class="measureSvg">','<polygon fill="rgba(255, 165, 0, 0.3)" stroke="orange" stroke-width="2" points="" style="opacity: 0.3;"/>','<polyline stroke="orange" stroke-width="2" points="" style="fill: none; opacity: 1;"/>','<rect x="0" y="0" width="80" height="25" class="measureBack" />','<text x="40" y="16" text-anchor="middle" class="measureLabel">'+l.text+"</text>","</svg>"].join("");l.container=document.createElement("div"),l.container.className="area-annotation",l.container.id=l.id,l.container.innerHTML=v,e.engine.measure.annotationContainer.appendChild(l.container),l.container.getElementsByTagName("svg")[0].addEventListener("click",function(){l.container.getElementsByTagName("svg")[0].classList.add("Hight")})}if(!l.points||l.points.length<3)return;let c=[],h=0,u=0;for(let v=0;v<l.points.length;v++){let m=new pn(e.engine.camera,e.engine.renderer,e.engine.scene).worldToScreen(l.points[v]);c.push(m),h+=m.x,u+=m.y}h=h/c.length,u=u/c.length;let f=c.map(v=>v.x+","+v.y).join(" "),d=l.container;d.getElementsByTagName("polygon")[0].setAttribute("points",f),d.getElementsByTagName("polyline")[0].setAttribute("points",f);let p=h,g=u;d.getElementsByTagName("rect")[0].setAttribute("x",p-40),d.getElementsByTagName("rect")[0].setAttribute("y",g-12.5),d.getElementsByTagName("text")[0].setAttribute("x",p),d.getElementsByTagName("text")[0].setAttribute("y",g+4),d.getElementsByTagName("text")[0].innerHTML=l.text,d.style.top="0px",d.style.left="0px"}function i(l){if(l.container==null){let p=['<svg class="measureSvg">',"<defs>",'<marker id="slope-arrow-'+l.id+'" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto" markerUnits="strokeWidth">','<path d="M0,0 L0,6 L9,3 z" fill="orange" stroke="orange" />',"</marker>","</defs>",'<polyline stroke="orange" stroke-width="2" points="0,0 0,0" marker-end="url(#slope-arrow-'+l.id+')" style="fill: none; opacity: 1;"/>','<rect x="0" y="0" width="100" height="25" class="measureBack" />','<text x="50" y="16" text-anchor="middle" class="measureLabel">'+l.text+"</text>","</svg>"].join("");l.container=document.createElement("div"),l.container.className="slope-annotation",l.container.id=l.id,l.container.innerHTML=p,e.engine.measure.annotationContainer.appendChild(l.container),l.container.getElementsByTagName("svg")[0].addEventListener("click",function(){l.container.getElementsByTagName("svg")[0].classList.add("Hight")})}let c=new pn(e.engine.camera,e.engine.renderer,e.engine.scene).worldToScreen(l.point1),h=new pn(e.engine.camera,e.engine.renderer,e.engine.scene).worldToScreen(l.point2),u=l.container;u.getElementsByTagName("polyline")[0].setAttribute("points",c.x+","+c.y+" "+h.x+","+h.y);let f=(c.x+h.x)/2,d=(c.y+h.y)/2-30;u.getElementsByTagName("rect")[0].setAttribute("x",f-50),u.getElementsByTagName("rect")[0].setAttribute("y",d-12.5),u.getElementsByTagName("text")[0].setAttribute("x",f),u.getElementsByTagName("text")[0].setAttribute("y",d+4),u.getElementsByTagName("text")[0].innerHTML=l.text,u.style.top="0px",u.style.left="0px"}function r(l){if(l.container==null){let g=['<svg class="measureSvg">','<circle cx="0" cy="0" r="5" fill="#f99d0b" />','<rect x="0" y="-25" width="100" height="25" class="measureBack" />','<text x="40" y="-11" text-anchor="middle" class="measureLabel">'+l.textX+"</text>",'<rect x="0" y="-10" width="100" height="25" class="measureBack" />','<text x="40" y="25" text-anchor="middle" class="measureLabel">'+l.textY+"</text>",'<rect x="0" y="10" width="100" height="25" class="measureBack" />','<text x="40" y="51" text-anchor="middle" class="measureLabel">'+l.textZ+"</text>","</svg>"].join("");l.container=document.createElement("div"),l.container.className="coordinate-annotation",l.container.id=l.id,l.container.style.position="absolute",l.container.style.pointerEvents="none",l.container.innerHTML=g,e.engine.measure.annotationContainer.appendChild(l.container),l.container.getElementsByTagName("svg")[0].addEventListener("click",function(){l.container.getElementsByTagName("svg")[0].classList.add("Hight")})}let c=l.container,h=new pn(e.engine.camera,e.engine.renderer,e.engine.scene).worldToScreen(l.point);c.style.top="0px",c.style.left="0px";let u=c.getElementsByTagName("circle")[0];u&&(u.setAttribute("cx",h.x),u.setAttribute("cy",h.y));let f=c.getElementsByTagName("rect"),d=c.getElementsByTagName("text"),p=-55;f[0]&&(f[0].setAttribute("x",h.x+10),f[0].setAttribute("y",h.y+10+p)),d[0]&&(d[0].setAttribute("x",h.x+10+40),d[0].setAttribute("y",h.y+10+16+p)),f[1]&&(f[1].setAttribute("x",h.x+10),f[1].setAttribute("y",h.y+10+30+p)),d[1]&&(d[1].setAttribute("x",h.x+10+40),d[1].setAttribute("y",h.y+10+46+p)),f[2]&&(f[2].setAttribute("x",h.x+10),f[2].setAttribute("y",h.y+10+60+p)),d[2]&&(d[2].setAttribute("x",h.x+10+40),d[2].setAttribute("y",h.y+10+76+p)),d[0]&&(d[0].innerHTML=l.textX),d[1]&&(d[1].innerHTML=l.textY),d[2]&&(d[2].innerHTML=l.textZ)}function a(l){if(l.container==null){let u=['<svg width="100" height="50" class="measureSvg">','<rect x="0" y="0" width="80" height="25" class="measureBack" />','<text x="40" y="16" text-anchor="middle" class="measureLabel">'+l.text+"</text>",'<polyline stroke="#f99d0b" stroke-width="2" points="80,32 0,32 16,48 32,32" style="fill: none; opacity: 1;"/>',"</svg>"].join("");l.container=document.createElement("div"),l.container.className="elevation-annotation",l.container.id=l.id,l.container.style.position="absolute",l.container.style.pointerEvents="none",l.container.innerHTML=u,e.engine.measure.annotationContainer.appendChild(l.container),l.container.getElementsByTagName("svg")[0].addEventListener("click",function(){l.container.getElementsByTagName("svg")[0].classList.add("Hight")})}let c=l.container,h=new pn(e.engine.camera,e.engine.renderer,e.engine.scene).worldToScreen(l.point);c.style.top=h.y-48+"px",c.style.left=h.x-16+"px",c.getElementsByTagName("text")[0].innerHTML=l.text}function o(l){if(l.container==null){let f=['<svg class="measureSvg">','<circle cx="50" cy="50" r="5" fill="#f99d0b" />','<circle cx="50" cy="50" r="5" fill="#f99d0b" />','<polyline stroke="orange" stroke-width="2" points="80,32 0,32" style="fill: none; opacity: 1;"/>','<rect x="0" y="0" width="80" height="25" class="measureBack" />','<text x="40" y="16" text-anchor="middle" class="measureLabel">'+l.text+"</text>","</svg>"].join("");l.container=document.createElement("div"),l.container.className="normal-annotation",l.container.id=l.id,l.container.innerHTML=f,e.engine.measure.annotationContainer.appendChild(l.container),l.container.getElementsByTagName("svg")[0].addEventListener("click",function(){l.container.getElementsByTagName("svg")[0].classList.add("Hight")})}let c=new pn(e.engine.camera,e.engine.renderer,e.engine.scene).worldToScreen(l.point1),h=new pn(e.engine.camera,e.engine.renderer,e.engine.scene).worldToScreen(l.point2),u=l.container;u.getElementsByTagName("polyline")[0].setAttribute("points",c.x+","+c.y+" "+h.x+","+h.y),u.getElementsByTagName("circle")[0].setAttribute("cx",c.x),u.getElementsByTagName("circle")[0].setAttribute("cy",c.y),u.getElementsByTagName("circle")[1].setAttribute("cx",h.x),u.getElementsByTagName("circle")[1].setAttribute("cy",h.y),u.getElementsByTagName("rect")[0].setAttribute("x",c.x*.5+h.x*.5-40),u.getElementsByTagName("rect")[0].setAttribute("y",c.y*.5+h.y*.5-12.5),u.getElementsByTagName("text")[0].setAttribute("x",c.x*.5+h.x*.5+40-40),u.getElementsByTagName("text")[0].setAttribute("y",c.y*.5+h.y*.5+16-12.5),u.getElementsByTagName("text")[0].innerHTML=l.text,u.style.top="0px",u.style.left="0px"}}drawTextAnnotation(e){console.log(e)}drawCoordinateAnnotation(e){console.log(e)}drawAngleAnnotation(e){console.log(e)}drawDistanceAnnotation(e){console.log(e)}drawAreaAnnotation(e){console.log(e)}drawVolumeAnnotation(e){console.log(e)}}class Ky{engine;isActive=!1;tools;constructor(e){this.engine=e,this.tools=new ai(e)}active(){this.isActive=!0,this.listenMouseMove()}disActive(){this.isActive=!1}listenMouseMove(){this.engine.events.on(Zn.MouseMove,e=>{this.tools.renderCatchElement(e)})}}function Oi(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){var e=Math.random()*16|0,t=s=="x"?e:e&3|8;return t.toString(16)})}class $y{engine;tools;isActive=!1;points=[];behavior;constructor(e){this.engine=e,this.tools=new ai(e)}active(){this.isActive=!0,this.points=[],this.behavior=this.engine.handelBehaved,this.behavior.init(this),this.behavior.active()}disActive(){this.points=[],this.isActive=!1,this.behavior.disActive()}handleMouseClick(e){if(e.catch==null)return;let t=this.tools.renderCatchElement(e.catch);if(this.points.length==0)this.points.push(t.point);else if(this.points.length==1){let n=this.engine.measure.annotationData.normalAnnotation.find(i=>i.isSelect==!0);if(n==null)return;n.point2=t.point,n.isSelect=!1,this.points=[],this.engine.events.trigger(Zn.MeasureChanged,n)}}handleMouseMove(e){if(e.catch==null)return;let t=this.tools.renderCatchElement(e.catch);if(t!=null&&this.points.length==1){let n=this.engine.measure.annotationData.normalAnnotation.find(i=>i.isSelect==!0);n==null&&(n={id:Oi(),point1:this.points[0].clone(),point2:t.point.clone(),text:this.points[0].clone().distanceTo(t.point.clone()).toFixed(2)+" m",isSelect:!0},this.engine.measure.annotationData.normalAnnotation.push(n)),n.point2=t.point,n.text=n.point1.clone().distanceTo(n.point2.clone()).toFixed(2)+" m",console.log("距离",n.text)}}}class Jy{engine;isActive=!1;tools;constructor(e){this.engine=e,this.tools=new ai(e)}active(){this.isActive=!0}disActive(){this.isActive=!1}}class Qy{engine;isActive=!1;tools;behavior;constructor(e){this.engine=e,this.tools=new ai(e)}active(){this.behavior=this.engine.handelBehaved,this.behavior.init(this),this.behavior.active(),this.isActive=!0}disActive(){this.isActive=!1,this.behavior.disActive()}handleMouseMove(e){if(e.catch==null)return;let t=this.engine.measure.annotationData.elevationAnnotation.find(n=>n.isSelect==!0);t==null&&(t={id:Oi(),point:e.catch.point.clone(),text:Math.round(e.catch.point.y)+" m",isSelect:!0},this.engine.measure.annotationData.elevationAnnotation.push(t)),t.point=e.catch.point.clone(),t.text=Math.round(e.catch.point.y)+" m"}handleMouseClick(e){if(e.catch==null)return;let t=this.engine.measure.annotationData.elevationAnnotation.find(n=>n.isSelect==!0);t!=null&&(t.isSelect=!1,t.point=e.catch.point.clone(),t.text=Math.round(e.catch.point.y)+" m",this.engine.events.trigger(Zn.MeasureChanged,t))}}class e2{engine;isActive=!1;tools;behavior;constructor(e){this.engine=e,this.tools=new ai(e)}active(){this.behavior=this.engine.handelBehaved,this.behavior.init(this),this.behavior.active(),this.isActive=!0}disActive(){this.isActive=!1,this.behavior.disActive()}handleMouseMove(e){if(e.catch==null)return;let t=this.engine.measure.annotationData.coordinateAnnotation.find(n=>n.isSelect==!0);t==null&&(t={id:Oi(),point:e.catch.point.clone(),text:Math.round(e.catch.point.y)+" m",isSelect:!0},this.engine.measure.annotationData.coordinateAnnotation.push(t)),t.point=e.catch.point.clone(),t.textX=Math.round(e.catch.point.x)+" m",t.textY=Math.round(e.catch.point.y)+" m",t.textZ=Math.round(e.catch.point.z)+" m"}handleMouseClick(e){if(e.catch==null)return;let t=this.engine.measure.annotationData.coordinateAnnotation.find(n=>n.isSelect==!0);t!=null&&(t.isSelect=!1,t.point=e.catch.point.clone(),t.textX=Math.round(e.catch.point.x)+" m",t.textY=Math.round(e.catch.point.y)+" m",t.textZ=Math.round(e.catch.point.z)+" m",this.engine.events.trigger(Zn.MeasureChanged,t))}}class t2{engine;tools;points=[];behavior;constructor(e){this.engine=e,this.tools=new ai(e)}active(){this.points=[],this.behavior=this.engine.handelBehaved,this.behavior.init(this),this.behavior.active()}disActive(){this.points=[],this.behavior.disActive()}calculateAngle(e,t,n){const i=new R().subVectors(e,t),r=new R().subVectors(n,t),a=i.length(),o=r.length();if(a===0||o===0)return 0;const l=i.dot(r)/(a*o),c=Math.max(-1,Math.min(1,l));return Math.acos(c)*(180/Math.PI)}handleMouseClick(e){if(e.catch==null)return;let t=this.tools.renderCatchElement(e.catch);if(this.points.length==0)this.points.push(t.point);else if(this.points.length==1)this.points.push(t.point);else if(this.points.length==2){let n=this.engine.measure.annotationData.angleAnnotation.find(i=>i.isSelect==!0);if(n==null)return;n.point3=t.point.clone(),n.angle=this.calculateAngle(n.point1,n.point2,n.point3),n.text=n.angle.toFixed(2)+"°",n.isSelect=!1,this.points=[],this.engine.events.trigger(Zn.MeasureChanged,n)}}handleMouseMove(e){if(e.catch==null)return;let t=this.tools.renderCatchElement(e.catch);if(t!=null&&this.points.length!=1&&this.points.length==2){let n=this.engine.measure.annotationData.angleAnnotation.find(i=>i.isSelect==!0);n==null&&(n={id:Oi(),point1:this.points[0].clone(),point2:this.points[1].clone(),point3:t.point.clone(),angle:0,text:"0.00°",isSelect:!0},this.engine.measure.annotationData.angleAnnotation.push(n)),n.point3=t.point.clone(),n.angle=this.calculateAngle(n.point1,n.point2,n.point3),n.text=n.angle.toFixed(2)+"°",console.log("角度",n.text)}}}class n2{engine;tools;points=[];behavior;constructor(e){this.engine=e,this.tools=new ai(e)}active(){this.points=[],this.behavior=this.engine.handelBehaved,this.behavior.init(this),this.behavior.active()}disActive(){this.points=[],this.behavior.disActive()}calculateArea(e){if(e.length<3)return 0;let t=0;const n=e.length;for(let i=0;i<n;i++){const r=(i+1)%n;t+=e[i].x*e[r].z,t-=e[r].x*e[i].z}return t=Math.abs(t)/2,t}handleMouseClick(e){if(e.catch==null)return;let t=this.tools.renderCatchElement(e.catch);if(this.points.push(t.point.clone()),this.points.length>=3){let n=this.engine.measure.annotationData.areaAnnotation.find(i=>i.isSelect==!0);n==null?(n={id:Oi(),points:this.points.map(i=>i.clone()),area:0,text:"0.00 m²",isSelect:!0},this.engine.measure.annotationData.areaAnnotation.push(n)):n.points=this.points.map(i=>i.clone()),n.area=this.calculateArea(n.points),n.text=n.area.toFixed(2)+" m²",console.log("面积",n.text)}}handleMouseMove(e){if(e.catch==null)return;let t=this.tools.renderCatchElement(e.catch);if(t!=null&&this.points.length>=2){let n=this.engine.measure.annotationData.areaAnnotation.find(i=>i.isSelect==!0);if(n==null){if(this.points.length>=2){let i=this.points.map(r=>r.clone());i.push(t.point.clone()),i.length>=3&&(n={id:Oi(),points:i,area:0,text:"0.00 m²",isSelect:!0},this.engine.measure.annotationData.areaAnnotation.push(n))}}else if(n.points.length>0){const i=n.points.length-1;n.points[i]=t.point.clone()}else n.points=this.points.map(i=>i.clone()),n.points.push(t.point.clone());n&&n.points.length>=3&&(n.area=this.calculateArea(n.points),n.text=n.area.toFixed(2)+" m²")}}finishMeasure(){let e=this.engine.measure.annotationData.areaAnnotation.find(t=>t.isSelect==!0);e!=null&&e.points.length>=3&&(e.points.length>this.points.length&&(e.points=this.points.map(t=>t.clone())),e.area=this.calculateArea(e.points),e.text=e.area.toFixed(2)+" m²",e.isSelect=!1,this.points=[],this.engine.events.trigger(Zn.MeasureChanged,e))}}class i2{engine;tools;points=[];behavior;constructor(e){this.engine=e,this.tools=new ai(e)}active(){this.points=[],this.behavior=this.engine.handelBehaved,this.behavior.init(this),this.behavior.active()}disActive(){this.points=[],this.behavior.disActive()}calculateSlope(e,t){const n=t.y-e.y,i=t.x-e.x,r=t.z-e.z,a=Math.sqrt(i*i+r*r);if(a===0)return{percentage:0,angle:0,heightDiff:n,horizontalDist:0};const o=n/a*100,l=Math.atan(n/a)*(180/Math.PI);return{percentage:o,angle:l,heightDiff:n,horizontalDist:a}}handleMouseClick(e){if(e.catch==null)return;let t=this.tools.renderCatchElement(e.catch);if(this.points.length==0)this.points.push(t.point);else if(this.points.length==1){let n=this.engine.measure.annotationData.slopeAnnotation.find(r=>r.isSelect==!0);if(n==null)return;n.point2=t.point.clone();const i=this.calculateSlope(n.point1,n.point2);n.slopePercentage=i.percentage,n.slopeAngle=i.angle,n.heightDiff=i.heightDiff,n.horizontalDist=i.horizontalDist,n.text=i.percentage.toFixed(2)+"% ("+i.angle.toFixed(2)+"°)",n.isSelect=!1,this.points=[],this.engine.events.trigger(Zn.MeasureChanged,n)}}handleMouseMove(e){if(e.catch==null)return;let t=this.tools.renderCatchElement(e.catch);if(t!=null&&this.points.length==1){let n=this.engine.measure.annotationData.slopeAnnotation.find(r=>r.isSelect==!0);n==null&&(n={id:Oi(),point1:this.points[0].clone(),point2:t.point.clone(),slopePercentage:0,slopeAngle:0,heightDiff:0,horizontalDist:0,text:"0.00% (0.00°)",isSelect:!0},this.engine.measure.annotationData.slopeAnnotation.push(n)),n.point2=t.point.clone();const i=this.calculateSlope(n.point1,n.point2);n.slopePercentage=i.percentage,n.slopeAngle=i.angle,n.heightDiff=i.heightDiff,n.horizontalDist=i.horizontalDist,n.text=i.percentage.toFixed(2)+"% ("+i.angle.toFixed(2)+"°)",console.log("坡度",n.text)}}}class s2{isActive=!1;engine;clearHeightMeasure;distanceMeasure;clearDistanceMeasure;elevationMeasure;pointMeasure;angleMeasure;areaMeasure;slopeMeasure;tools;annotationContainer;annotationData={normalAnnotation:[],textAnnotation:[],coordinateAnnotation:[],angleAnnotation:[],distanceAnnotation:[],areaAnnotation:[],slopeAnnotation:[],elevationAnnotation:[],volumeAnnotation:[]};constructor(e){this.engine=e,this.clearHeightMeasure=new Ky(e),this.distanceMeasure=new $y(e),this.clearDistanceMeasure=new Jy(e),this.elevationMeasure=new Qy(e),this.pointMeasure=new e2(e),this.angleMeasure=new t2(e),this.areaMeasure=new n2(e),this.slopeMeasure=new i2(e),this.tools=new ai(e),this.annotationContainer=document.createElement("div"),this.annotationContainer.className="annotation-container",e.container.parentElement.appendChild(this.annotationContainer)}active(){this.isActive=!0}disActive(){this.clearAll(),this.isActive=!1}clearAll(){this.annotationData.normalAnnotation=[],this.annotationData.textAnnotation=[],this.annotationData.coordinateAnnotation=[],this.annotationData.angleAnnotation=[],this.annotationData.distanceAnnotation=[],this.annotationData.areaAnnotation=[],this.annotationData.slopeAnnotation=[],this.annotationData.elevationAnnotation=[],this.annotationData.volumeAnnotation=[]}update(){this.isActive&&this.tools.drawNormalAnnotation()}}class r2{engine;isActive=!1;isDrag=!1;meshs=[];box;pickPoint;pickNormal;pickMesh;box_;plane;constructor(e){this.engine=e,this.meshs=[],this.box=null}active(){this.isActive!=!0&&(this.isActive=!0,this.init(),this.engine.handelBehaved.init(this),this.engine.handelBehaved.active())}disActive(){this.isActive=!1,this.engine.handelBehaved.disActive()}init(){let e=this.engine.octreeBox.getBoundingBox();this.box=e,this.updata_face(e)}updata_face(e){let t=this,n=t.engine.scene.children.find(a=>a.type=="Group"&&a.name=="ClippingBox");n==null&&(n=new bn,n.name="ClippingBox",t.engine.scene.add(n));let i=[new R(e.min.x,e.min.y,e.min.z),new R(e.max.x,e.min.y,e.min.z),new R(e.max.x,e.max.y,e.min.z),new R(e.min.x,e.max.y,e.min.z)];r(i,new R(0,0,-1),"前");function r(a,o,l){const c=new gt,h=new Float32Array([a[0].x,a[0].y,a[0].z,a[1].x,a[1].y,a[1].z,a[2].x,a[2].y,a[2].z,a[3].x,a[3].y,a[3].z]),u=[0,1,2,0,2,3];c.setAttribute("position",new mt(h,3)),c.setIndex(u);let f=t.meshs.find(m=>m.name==l);if(f==null){const m=new Ft({color:65280,transparent:!0,opacity:.02,side:Vt}),x=new bt(c,m);x.normal=o,x.name=l,n.add(x),t.meshs.push(x)}else f.geometry=c;const d=new Float32Array([a[0].x,a[0].y,a[0].z,a[1].x,a[1].y,a[1].z,a[2].x,a[2].y,a[2].z,a[3].x,a[3].y,a[3].z,a[0].x,a[0].y,a[0].z]);let p=new fs({color:255}),g=new gt;g.setAttribute("position",new mt(d,3));let v=t.meshs.find(m=>m.name==l+"Line");v==null&&(v=new Ti(g,p),v.name=l+"Line",n.add(v),t.meshs.push(v)),v.geometry=g,v.material=p,t.engine.sectionPlane.find(m=>m.name==l).setFromNormalAndCoplanarPoint(o.clone().setLength(-1),e.min),t.engine.scene.children.filter(m=>m.type=="Mesh"&&m.url).forEach(m=>{m.material&&Array.isArray(m.material)?m.material.forEach(x=>{x.clippingPlanes=t.engine.sectionPlane}):m.material.clippingPlanes=t.engine.sectionPlane})}}handleMouseDown(e){this.isDrag=!0;const t=e.raycaster.intersectObjects(this.meshs,!1);if(t!=null&&t.length>0)if(this.pickPoint=t[0].point,this.pickNormal=t[0].face.normal,this.engine.controls.enabled=!1,this.pickMesh=t[0].object,this.box_={min:this.box.min.clone(),max:this.box.max.clone()},this.pickNormal.y==0){const n=new St;n.setFromNormalAndCoplanarPoint(new R(0,1,0),this.pickPoint),this.plane=n}else{let n=new R(this.engine.camera.position.x,this.pickPoint.y,this.engine.camera.position.z);const i=new St;i.setFromNormalAndCoplanarPoint(n.clone().sub(this.pickPoint.clone()).setLength(1),this.pickPoint),this.plane=i}}handleMouseUp(e){this.isDrag=!1,this.pickPoint=null,this.pickNormal=null,this.pickMesh=null,this.engine.controls.enabled=!0}handleMouseMove(e){this.meshs.forEach(n=>{n.material.opacity=0});const t=e.raycaster.intersectObjects(this.meshs,!1);if(t!=null&&t.length>0&&(t[0].object.material.opacity=.05),this.pickPoint!=null){const n=new R;if(e.raycaster.ray.intersectPlane(this.plane,n)){let i=n.clone().sub(this.pickPoint.clone()).dot(this.pickNormal.clone());this.pickMesh.name=="前"||this.pickMesh.name=="左"||this.pickMesh.name=="底"?this.box.min=this.box_.min.clone().add(this.pickNormal.clone().setLength(i)):this.box.max=this.box_.max.clone().add(this.pickNormal.clone().setLength(i)),this.updata_face(this.box)}}}}class a2{engine;isActive=!1;isDrag=!1;meshs=[];box;pickPoint;pickNormal;pickMesh;box_;plane;constructor(e){this.engine=e,this.meshs=[],this.box=null}active(){this.isActive!=!0&&(this.isActive=!0,this.init(),this.engine.handelBehaved.init(this),this.engine.handelBehaved.active())}disActive(){this.isActive=!1,this.engine.handelBehaved.disActive()}init(){let e=this.engine.octreeBox.getBoundingBox();this.box=e,this.updata_face(e)}updata_face(e){let t=this,n=t.engine.scene.children.find(a=>a.type=="Group"&&a.name=="ClippingBox");n==null&&(n=new bn,n.name="ClippingBox",t.engine.scene.add(n));let i=[new R(e.min.x,e.max.y,e.min.z),new R(e.max.x,e.max.y,e.min.z),new R(e.max.x,e.max.y,e.max.z),new R(e.min.x,e.max.y,e.max.z)];r(i,new R(0,1,0),"顶");function r(a,o,l){const c=new gt,h=new Float32Array([a[0].x,a[0].y,a[0].z,a[1].x,a[1].y,a[1].z,a[2].x,a[2].y,a[2].z,a[3].x,a[3].y,a[3].z]),u=[0,1,2,0,2,3];c.setAttribute("position",new mt(h,3)),c.setIndex(u);let f=t.meshs.find(m=>m.name==l);if(f==null){const m=new Ft({color:65280,transparent:!0,opacity:.02,side:Vt}),x=new bt(c,m);x.normal=o,x.name=l,n.add(x),t.meshs.push(x)}else f.geometry=c;const d=new Float32Array([a[0].x,a[0].y,a[0].z,a[1].x,a[1].y,a[1].z,a[2].x,a[2].y,a[2].z,a[3].x,a[3].y,a[3].z,a[0].x,a[0].y,a[0].z]);let p=new fs({color:255}),g=new gt;g.setAttribute("position",new mt(d,3));let v=t.meshs.find(m=>m.name==l+"Line");v==null&&(v=new Ti(g,p),v.name=l+"Line",n.add(v),t.meshs.push(v)),v.geometry=g,v.material=p,t.engine.sectionPlane.find(m=>m.name==l).setFromNormalAndCoplanarPoint(o.clone().setLength(-1),e.max),t.engine.scene.children.filter(m=>m.type=="Mesh"&&m.url).forEach(m=>{m.material&&Array.isArray(m.material)?m.material.forEach(x=>{x.clippingPlanes=t.engine.sectionPlane}):m.material.clippingPlanes=t.engine.sectionPlane})}}handleMouseDown(e){this.isDrag=!0;const t=e.raycaster.intersectObjects(this.meshs,!1);if(t!=null&&t.length>0)if(this.pickPoint=t[0].point,this.pickNormal=t[0].face.normal,this.engine.controls.enabled=!1,this.pickMesh=t[0].object,this.box_={min:this.box.min.clone(),max:this.box.max.clone()},this.pickNormal.y==0){const n=new St;n.setFromNormalAndCoplanarPoint(new R(0,1,0),this.pickPoint),this.plane=n}else{let n=new R(this.engine.camera.position.x,this.pickPoint.y,this.engine.camera.position.z);const i=new St;i.setFromNormalAndCoplanarPoint(n.clone().sub(this.pickPoint.clone()).setLength(1),this.pickPoint),this.plane=i}}handleMouseUp(e){this.isDrag=!1,this.pickPoint=null,this.pickNormal=null,this.pickMesh=null,this.engine.controls.enabled=!0}handleMouseMove(e){this.meshs.forEach(n=>{n.material.opacity=0});const t=e.raycaster.intersectObjects(this.meshs,!1);if(t!=null&&t.length>0&&(t[0].object.material.opacity=.05),this.pickPoint!=null){const n=new R;if(e.raycaster.ray.intersectPlane(this.plane,n)){let i=n.clone().sub(this.pickPoint.clone()).dot(this.pickNormal.clone());this.pickMesh.name=="前"||this.pickMesh.name=="左"||this.pickMesh.name=="底"?this.box.min=this.box_.min.clone().add(this.pickNormal.clone().setLength(i)):this.box.max=this.box_.max.clone().add(this.pickNormal.clone().setLength(i)),this.updata_face(this.box)}}}}class o2{engine;isActive=!1;isDrag=!1;meshs=[];box;pickPoint;pickNormal;pickMesh;box_;plane;constructor(e){this.engine=e,this.meshs=[],this.box=null}active(){this.isActive!=!0&&(this.isActive=!0,this.init(),this.engine.handelBehaved.init(this),this.engine.handelBehaved.active())}disActive(){this.isActive=!1,this.engine.handelBehaved.disActive()}init(){let e=this.engine.octreeBox.getBoundingBox();this.box=e,this.updata_face(e)}updata_face(e){let t=this,n=t.engine.scene.children.find(a=>a.type=="Group"&&a.name=="ClippingBox");n==null&&(n=new bn,n.name="ClippingBox",t.engine.scene.add(n));let i=[new R(e.min.x,e.min.y,e.max.z),new R(e.min.x,e.min.y,e.min.z),new R(e.min.x,e.max.y,e.min.z),new R(e.min.x,e.max.y,e.max.z)];r(i,new R(-1,0,0),"左");function r(a,o,l){const c=new gt,h=new Float32Array([a[0].x,a[0].y,a[0].z,a[1].x,a[1].y,a[1].z,a[2].x,a[2].y,a[2].z,a[3].x,a[3].y,a[3].z]),u=[0,1,2,0,2,3];c.setAttribute("position",new mt(h,3)),c.setIndex(u);let f=t.meshs.find(m=>m.name==l);if(f==null){const m=new Ft({color:65280,transparent:!0,opacity:.02,side:Vt}),x=new bt(c,m);x.normal=o,x.name=l,n.add(x),t.meshs.push(x)}else f.geometry=c;const d=new Float32Array([a[0].x,a[0].y,a[0].z,a[1].x,a[1].y,a[1].z,a[2].x,a[2].y,a[2].z,a[3].x,a[3].y,a[3].z,a[0].x,a[0].y,a[0].z]);let p=new fs({color:255}),g=new gt;g.setAttribute("position",new mt(d,3));let v=t.meshs.find(m=>m.name==l+"Line");v==null&&(v=new Ti(g,p),v.name=l+"Line",n.add(v),t.meshs.push(v)),v.geometry=g,v.material=p,t.engine.sectionPlane.find(m=>m.name==l).setFromNormalAndCoplanarPoint(o.clone().setLength(-1),e.min),t.engine.scene.children.filter(m=>m.type=="Mesh"&&m.url).forEach(m=>{m.material&&Array.isArray(m.material)?m.material.forEach(x=>{x.clippingPlanes=t.engine.sectionPlane}):m.material.clippingPlanes=t.engine.sectionPlane})}}handleMouseDown(e){this.isDrag=!0;const t=e.raycaster.intersectObjects(this.meshs,!1);if(t!=null&&t.length>0)if(this.pickPoint=t[0].point,this.pickNormal=t[0].face.normal,this.engine.controls.enabled=!1,this.pickMesh=t[0].object,this.box_={min:this.box.min.clone(),max:this.box.max.clone()},this.pickNormal.y==0){const n=new St;n.setFromNormalAndCoplanarPoint(new R(0,1,0),this.pickPoint),this.plane=n}else{let n=new R(this.engine.camera.position.x,this.pickPoint.y,this.engine.camera.position.z);const i=new St;i.setFromNormalAndCoplanarPoint(n.clone().sub(this.pickPoint.clone()).setLength(1),this.pickPoint),this.plane=i}}handleMouseUp(e){this.isDrag=!1,this.pickPoint=null,this.pickNormal=null,this.pickMesh=null,this.engine.controls.enabled=!0}handleMouseMove(e){this.meshs.forEach(n=>{n.material.opacity=0});const t=e.raycaster.intersectObjects(this.meshs,!1);if(t!=null&&t.length>0&&(t[0].object.material.opacity=.05),this.pickPoint!=null){const n=new R;if(e.raycaster.ray.intersectPlane(this.plane,n)){let i=n.clone().sub(this.pickPoint.clone()).dot(this.pickNormal.clone());this.pickMesh.name=="前"||this.pickMesh.name=="左"||this.pickMesh.name=="底"?this.box.min=this.box_.min.clone().add(this.pickNormal.clone().setLength(i)):this.box.max=this.box_.max.clone().add(this.pickNormal.clone().setLength(i)),this.updata_face(this.box)}}}}class l2{engine;isActive=!1;box;pickPoint;pickNormal;pickMesh;box_;plane;meshs;isDrag=!1;constructor(e){this.engine=e,this.meshs=[]}active(){this.isActive=!0,this.init(),this.engine.handelBehaved.init(this),this.engine.handelBehaved.active()}disActive(){this.isActive=!1,this.engine.handelBehaved.disActive()}init(){let e=this.engine.octreeBox.getBoundingBox();this.box=e,this.updata_face(e)}getboxXyz(){return{minX:this.box.min.x,minY:this.box.min.y,minZ:this.box.min.z,maxX:this.box.max.x,maxY:this.box.max.y,maxZ:this.box.max.z}}setboxXyz(e){this.box.min.x=e.minX,this.box.min.y=e.minY,this.box.min.z=e.minZ,this.box.max.x=e.maxX,this.box.max.y=e.maxY,this.box.max.z=e.maxZ,this.updata_face(this.box)}setBox(e){this.box=e,this.updata_face(e)}reverseBox(){}handleMouseDown(e){this.isDrag=!0;const t=e.raycaster.intersectObjects(this.meshs,!1);if(t!=null&&t.length>0)if(this.pickPoint=t[0].point,this.pickNormal=t[0].face.normal,this.engine.controls.enabled=!1,this.pickMesh=t[0].object,this.box_={min:this.box.min.clone(),max:this.box.max.clone()},this.pickNormal.y==0){const n=new St;n.setFromNormalAndCoplanarPoint(new R(0,1,0),this.pickPoint),this.plane=n}else{let n=new R(this.engine.camera.position.x,this.pickPoint.y,this.engine.camera.position.z);const i=new St;i.setFromNormalAndCoplanarPoint(n.clone().sub(this.pickPoint.clone()).setLength(1),this.pickPoint),this.plane=i}}handleMouseUp(e){this.isDrag=!1,this.pickPoint=null,this.pickNormal=null,this.pickMesh=null,this.engine.controls.enabled=!0}handleMouseMove(e){this.meshs.forEach(n=>{n.material.opacity=0});const t=e.raycaster.intersectObjects(this.meshs,!1);if(t!=null&&t.length>0&&(t[0].object.material.opacity=.05),this.pickPoint!=null){const n=new R;if(e.raycaster.ray.intersectPlane(this.plane,n)){let i=n.clone().sub(this.pickPoint.clone()).dot(this.pickNormal.clone());this.pickMesh.name=="前"||this.pickMesh.name=="左"||this.pickMesh.name=="底"?this.box.min=this.box_.min.clone().add(this.pickNormal.clone().setLength(i)):this.box.max=this.box_.max.clone().add(this.pickNormal.clone().setLength(i)),this.updata_face(this.box)}}}updata_face(e){let t=this,n=[new R(e.min.x,e.min.y,e.min.z),new R(e.max.x,e.min.y,e.min.z),new R(e.max.x,e.max.y,e.min.z),new R(e.min.x,e.max.y,e.min.z)],i=[new R(e.min.x,e.min.y,e.max.z),new R(e.max.x,e.min.y,e.max.z),new R(e.max.x,e.max.y,e.max.z),new R(e.min.x,e.max.y,e.max.z)],r=[new R(e.max.x,e.min.y,e.max.z),new R(e.max.x,e.min.y,e.min.z),new R(e.max.x,e.max.y,e.min.z),new R(e.max.x,e.max.y,e.max.z)],a=[new R(e.min.x,e.min.y,e.min.z),new R(e.min.x,e.min.y,e.max.z),new R(e.min.x,e.max.y,e.max.z),new R(e.min.x,e.max.y,e.min.z)],o=[new R(e.min.x,e.max.y,e.min.z),new R(e.max.x,e.max.y,e.min.z),new R(e.max.x,e.max.y,e.max.z),new R(e.min.x,e.max.y,e.max.z)],l=[new R(e.min.x,e.min.y,e.min.z),new R(e.max.x,e.min.y,e.min.z),new R(e.max.x,e.min.y,e.max.z),new R(e.min.x,e.min.y,e.max.z)];c(n,new R(0,0,-1),"前"),c(i,new R(0,0,1),"后"),c(r,new R(1,0,0),"右"),c(a,new R(-1,0,0),"左"),c(o,new R(0,1,0),"顶"),c(l,new R(0,-1,0),"底");function c(h,u,f){const d=new gt,p=new Float32Array([h[0].x,h[0].y,h[0].z,h[1].x,h[1].y,h[1].z,h[2].x,h[2].y,h[2].z,h[3].x,h[3].y,h[3].z]),g=[0,1,2,0,2,3];d.setAttribute("position",new mt(p,3)),d.setIndex(g);let v=t.engine.scene.children.find(A=>A.type=="Group"&&A.name=="ClippingBox");v==null&&(v=new bn,v.name="ClippingBox",t.engine.scene.add(v));let m=t.meshs.find(A=>A.name==f);if(m==null){const A=new Ft({color:65280,transparent:!0,opacity:0,side:Vt}),L=new bt(d,A);L.normal=u,L.name=f,v.add(L),t.meshs.push(L)}else m.geometry=d;const x=new Float32Array([h[0].x,h[0].y,h[0].z,h[1].x,h[1].y,h[1].z,h[2].x,h[2].y,h[2].z,h[3].x,h[3].y,h[3].z,h[0].x,h[0].y,h[0].z]);let _=new fs({color:255}),M=new gt;M.setAttribute("position",new mt(x,3));let T=t.meshs.find(A=>A.name==f+"Line");T==null&&(T=new Ti(M,_),T.name=f+"Line",v.add(T),t.meshs.push(T)),T.geometry=M,T.material=_,f=="前"||f=="左"||f=="底"?t.engine.sectionPlane.find(A=>A.name==f).setFromNormalAndCoplanarPoint(u.clone().setLength(-1),e.min):t.engine.sectionPlane.find(A=>A.name==f).setFromNormalAndCoplanarPoint(u.clone().setLength(-1),e.max),t.engine.scene.children.filter(A=>A.type=="Mesh"&&A.url).forEach(A=>{A.material&&Array.isArray(A.material)?A.material.forEach(L=>{L.clippingPlanes=t.engine.sectionPlane}):A.material.clippingPlanes=t.engine.sectionPlane})}}}class c2{engine;sectionPlaneX;sectionPlaneY;sectionPlaneZ;sectionBox;constructor(e){this.engine=e,this.sectionPlaneX=new r2(e),this.sectionPlaneY=new a2(e),this.sectionPlaneZ=new o2(e),this.sectionBox=new l2(e);let t=new St(new R(0,0,1),1e5);t.name="前";let n=new St(new R(0,0,1),1e5);n.name="左";let i=new St(new R(0,0,1),1e5);i.name="后";let r=new St(new R(0,0,1),1e5);r.name="右";let a=new St(new R(0,0,1),1e5);a.name="顶";let o=new St(new R(0,0,1),1e5);o.name="底",this.engine.sectionPlane=[t,n,i,r,a,o]}disActive(){this.sectionPlaneX.disActive(),this.sectionPlaneY.disActive(),this.sectionPlaneZ.disActive(),this.sectionBox.disActive()}}class h2{engine;constructor(e){this.engine=e}getTreeData(){let e=[];return this.engine.engineStatus.models.forEach(t=>{e.push({children:t.info.modelTree.modelTreeLevel,name:t.info.baseInfo.name})}),e}}class u2{engine;constructor(e){this.engine=e}getEngineInfo(){let e=0,t=0,n=0;return!this.engine||!this.engine.scene?{totalVertices:0,totalTriangles:0,meshCount:0}:(this.engine.scene.traverse(i=>{if(i instanceof bt){const r=i.geometry;if(r&&r.attributes){const a=r.attributes.position;if(a){const o=a.count;e+=o;let l=0;r.index?l=r.index.count/3:l=o/3,t+=l,n++}}}}),{totalVertices:Math.floor(e),totalTriangles:Math.floor(t),meshCount:n})}}class d2{engine;constructor(e){this.engine=e}init(){}getModelProperties(e,t,n){let i=this.engine.engineStatus.models.find(a=>a.url===e);i.properties==null&&Wd(e+"/property.zip",a=>{let o=JSON.parse(a);i.properties=o,setTimeout(()=>{r(o,t,n)},100)}),r(i.properties,t,n);function r(a,o,l){let c=[],h=a.models[o.toString()||""],u=h.map(f=>f[0]);u=u.filter((f,d)=>u.indexOf(f)===d),u.forEach(f=>{let d={name:a.categorys[f],children:[]};c.push(d),h.filter(p=>p[0]===f).forEach(p=>{d.children.push({name:a.names[p[1]],value:a.values[p[2]]})})}),l?.({properties:c,materials:[]})}}}class f2{engine;constructor(e){this.engine=e}getModelTypes(){let e=[];this.engine.engineStatus.models.forEach(t=>{t.info.modelMapper.forEach(n=>{e.push(n.typeName)})})}getModelMajors(){let e=[];this.engine.engineStatus.models.forEach(t=>{t.info.modelMapper.forEach(n=>{e.push(n.majorName)})})}getModelLevels(){let e=[];this.engine.engineStatus.models.forEach(t=>{t.info.modelMapper.forEach(n=>{e.push(n.levelName)})})}getModelMappers(e){}getModelMapper(e,t){let n=this.engine.engineStatus.models.find(i=>i.url==e);return n?n.info.modelMapper.find(i=>i.id==t):null}getModelSWithType(e,t){let n=[];return this.engine.engineStatus.models.forEach(i=>{let r={url:i.url,ids:[]};n.push(r),i.info.modelMapper.filter(a=>a.typeName===e).forEach(a=>{r.ids.push(Number(a.id))})}),t(n),n}getModelSWithLevel(e,t){let n=[];return this.engine.engineStatus.models.forEach(i=>{let r={url:i.url,ids:[]};n.push(r),i.info.modelMapper.filter(a=>a.levelName===e).forEach(a=>{r.ids.push(Number(a.id))})}),t(n),n}getModelsWithMajor(e,t){let n=[];return this.engine.engineStatus.models.forEach(i=>{let r={url:i.url,ids:[]};n.push(r),i.info.modelMapper.filter(a=>a.majorName===e).forEach(a=>{r.ids.push(Number(a.id))})}),t(n),n}}class p2{options;DeviceType;animationId=null;animate;scene;camera;renderer;sceneModule;cameraModule;deviceModule;renderModule;controlModule;composerModule;loaderModule;engineStatus;events;lightModule;interactionModule;modelToolModule;handelBehaved;octreeBox;controls;stats;viewCube;rangeScale;setting;measure;clipping;modelTree;engineInfo;modelProperties;modelMapperBatch;models=[];container;constructor(e){if(this.options=e,this.container=document.getElementById(e.containerId),!this.container)throw new Error(`Container ${e.containerId} not found`);this.deviceModule=new Px(this),this.DeviceType=this.deviceModule.getDeviceType(),this.cameraModule=new Ax(this),this.sceneModule=new Cx(this),this.scene=this.sceneModule.scene,this.renderModule=new Rx(this),this.renderer=this.renderModule.createRenderer(),this.camera=this.cameraModule.orthographicCamera,this.scene.camera=this.camera,this.controlModule=new Xx(this),this.controlModule.switchDefaultMode(),this.controls=this.controlModule.orbitControls,this.composerModule=new a_(this),this.composerModule.init(),this.events=new Dy,this.engineStatus=new Ly(this),this.engineStatus.init(),this.loaderModule=new Ry(this),this.lightModule=new Iy(this),this.lightModule.init(),this.viewCube=new jy(this),this.viewCube.init(),this.octreeBox=Zy(this),this.rangeScale=new qy(this),this.rangeScale.init(),this.clipping=new c2(this),this.setting=new Yy(this),this.setting.init(),this.handelBehaved=By(this),this.modelMapperBatch=new f2(this),this.measure=new s2(this),this.modelToolModule=new Uy(this),this.modelProperties=new d2(this),this.interactionModule=new Ny(this),this.interactionModule.init(),this.interactionModule.active(),this.modelTree=new h2(this),this.engineInfo=new u2(this),this.stats=new zy,this.stats.showPanel(0),this.stats.dom.style.position="absolute",this.stats.dom.style.top="0px",this.stats.dom.style.left="0px",this.stats.dom.style.zIndex="1000",this.container.appendChild(this.stats.dom),this.animate=()=>{this.animationId=requestAnimationFrame(this.animate),this.stats&&this.stats.begin(),this.composerModule&&this.composerModule.composer.render(),this.viewCube.cubeTool.RenderScene(),this.measure.update(),this.controlModule.update(),this.stats&&this.stats.end()},this.animate()}}function m2(s){return new p2(s)}class g2{engine=null;container;containerId;options;_isInitialized=!1;_isDestroyed=!1;unsubscribeTheme=null;currentMeasureType=null;isMeasureActive=!1;constructor(e){this.container=e.container,this.container.id?this.containerId=this.container.id:(this.containerId=`engine-container-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,this.container.id=this.containerId),this.options={backgroundColor:"linear-gradient(to bottom, rgb(214, 224, 235), rgb(246, 250, 255))",version:e.version??"v1",showStats:e.showStats??!1,showViewCube:e.showViewCube??!0}}init(){if(this._isInitialized){console.warn("[Engine] Engine already initialized.");return}if(this._isDestroyed){console.error("[Engine] Cannot initialize destroyed engine.");return}try{typeof this.options.backgroundColor=="string"&&(this.container.style.background=this.options.backgroundColor);const e={containerId:this.containerId,backgroundColor:this.options.backgroundColor,version:this.options.version,showStats:this.options.showStats,showViewCube:this.options.showViewCube};if(console.log("引擎配置信息:",e),this.engine=m2(e),!this.engine)throw new Error("Failed to create engine instance");this._isInitialized=!0,this.unsubscribeTheme=st.subscribe(t=>{this.setTheme(t)}),this.setTheme(st.getTheme())}catch(e){throw console.error("[Engine] Failed to initialize engine:",e),this._isInitialized=!1,e}}setTheme(e){}setLocales(){}isInitialized(){return this._isInitialized}loadModel(e,t){if(!this._isInitialized||!this.engine){console.error("[Engine] Engine not initialized. Please call init() first.");return}if(!e){console.error("[Engine] Model URL is required.");return}this.engine.loaderModule.loadModels([e],t)}CameraGoHome(){this.engine.viewCube.CameraGoHome()}getEngine(){return this.engine}activateMeasureType(e,t){if(!this._isInitialized||!this.engine){console.error("Cannot activate measure: engine not initialized.");return}if(!this.engine.measure){console.error("Measure module not available.");return}this.isMeasureActive||(console.log("激活测测量功能"),this.engine.measure.active(),this.isMeasureActive=!0),t(),this.currentMeasureType=e}activateDistanceMeasure(){this.activateMeasureType("distance",()=>{console.log("激活距离测量"),this.engine.measure.distanceMeasure.active()})}activateMinDistanceMeasure(){this.activateMeasureType("minDistance",()=>{console.log("激活最小距离测量"),this.engine.measure.minDistanceMeasure.active()})}activateAngleMeasure(){this.activateMeasureType("angle",()=>{console.log("激活角度测量"),this.engine.measure.angleMeasure.active(),console.log("[Engine] Angle measure activated (placeholder)")})}activateElevationMeasure(){this.activateMeasureType("elevation",()=>{console.log("激活标高测量"),this.engine.measure.elevationMeasure.active()})}activateVolumeMeasure(){this.activateMeasureType("volume",()=>{console.log("激活体积测量"),this.engine.measure.volumeMeasure.active()})}activateLaserDistanceMeasure(){this.activateMeasureType("laserDistance",()=>{console.log("[Engine] Laser distance measure activated (placeholder)")})}activateSlopeMeasure(){this.activateMeasureType("slope",()=>{console.log("激活坡度测量"),this.engine.measure.slopeMeasure.active()})}activateSpaceVolumeMeasure(){this.activateMeasureType("spaceVolume",()=>{console.log("[Engine] Space volume measure activated (placeholder)")})}activateMeasure(e){switch(e){case"distance":this.activateDistanceMeasure();break;case"minDistance":this.activateMinDistanceMeasure();break;case"angle":this.activateAngleMeasure();break;case"elevation":this.activateElevationMeasure();break;case"volume":this.activateVolumeMeasure();break;case"laserDistance":this.activateLaserDistanceMeasure();break;case"slope":this.activateSlopeMeasure();break;case"spaceVolume":this.activateSpaceVolumeMeasure();break}}deactivateMeasure(){!this._isInitialized||!this.engine?.measure||this.isMeasureActive&&(console.log("停用测量功能"),this.engine.measure.disActive(),this.isMeasureActive=!1,this.currentMeasureType=null)}getCurrentMeasureType(){return this.currentMeasureType}destroy(){this._isDestroyed||(this.deactivateMeasure(),this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.container.innerHTML="",this.currentMeasureType=null,this.isMeasureActive=!1,this._isDestroyed=!0,this._isInitialized=!1)}}class v2{element;content=null;isVisible=!1;onCloseCallback;options;mouseDownTime=0;CLICK_THRESHOLD=200;constructor(e){this.options=e,this.element=document.createElement("div"),this.element.className=`bim-right-key ${e?.className||""}`,e?.zIndex&&(this.element.style.zIndex=e.zIndex.toString()),document.body.appendChild(this.element)}init(){document.addEventListener("mousedown",this.handleGlobalClick),this.element.addEventListener("contextmenu",e=>{e.preventDefault(),e.stopPropagation()}),this.options?.container&&(this.options.container.addEventListener("mousedown",this.handleContainerMouseDown),this.options.container.addEventListener("mouseup",this.handleContainerMouseUp),this.options.container.addEventListener("contextmenu",this.handleContainerContextMenu))}setTheme(e){}setLocales(){}destroy(){document.removeEventListener("mousedown",this.handleGlobalClick),this.options?.container&&(this.options.container.removeEventListener("mousedown",this.handleContainerMouseDown),this.options.container.removeEventListener("mouseup",this.handleContainerMouseUp),this.options.container.removeEventListener("contextmenu",this.handleContainerContextMenu)),this.unmountContent(),this.element.remove()}handleContainerMouseDown=e=>{e.button===2&&(this.mouseDownTime=Date.now())};handleContainerMouseUp=e=>{e.button!==2||Date.now()-this.mouseDownTime>this.CLICK_THRESHOLD||this.options?.onContext&&this.options.onContext(e)};handleContainerContextMenu=e=>{e.preventDefault()};setOnClose(e){this.onCloseCallback=e}mount(e){this.unmountContent(),this.content=e,this.element.appendChild(e.getElement())}unmountContent(){this.content&&(this.content.destroy(),this.element.innerHTML="",this.content=null)}show(e,t){this.element.classList.add("visible"),this.isVisible=!0,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`;const n=this.element.getBoundingClientRect(),i=window.innerWidth,r=window.innerHeight;let a=e,o=t;e+n.width>i&&(a=e-n.width),t+n.height>r&&(o=t-n.height),this.element.style.left=`${a}px`,this.element.style.top=`${o}px`}hide(){this.element.classList.remove("visible"),this.isVisible=!1,this.unmountContent(),this.onCloseCallback&&this.onCloseCallback()}handleGlobalClick=e=>{this.isVisible&&(this.element.contains(e.target)||this.hide())}}class Cc{element;options;unsubscribeLocale=null;unsubscribeTheme=null;activeSubMenu=null;constructor(e){this.options=e,this.element=document.createElement("ul"),this.element.className="bim-menu"}init(){this.render(),this.unsubscribeLocale=Ht.subscribe(()=>{this.setLocales()}),this.unsubscribeTheme=st.subscribe(e=>{this.setTheme(e)})}setTheme(e){const t=this.element.style;t.setProperty("--bim-bg-elevated",e.bgElevated),t.setProperty("--bim-text-primary",e.textPrimary),t.setProperty("--bim-divider",e.divider),t.setProperty("--bim-component-bg-hover",e.componentBgHover),t.setProperty("--bim-shadow-lg",e.shadowLg)}setLocales(){this.element.innerHTML="",this.render()}destroy(){this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.closeSubMenu(),this.element.remove()}getElement(){return this.element}render(){const{items:e,groupOrder:t}=this.options,n=new Map,i="default";e.forEach(a=>{const o=a.group||i;n.has(o)||n.set(o,[]),n.get(o).push(a)});let r=[];if(t){r=t.filter(a=>n.has(a));for(const a of n.keys())r.includes(a)||r.push(a)}else r=Array.from(n.keys());r.forEach((a,o)=>{if(o>0){const c=document.createElement("li");c.className="bim-menu-divider",this.element.appendChild(c)}const l=n.get(a);l.sort((c,h)=>(c.order||0)-(h.order||0)),l.forEach(c=>{c.visible!==!1&&this.element.appendChild(this.createItemElement(c))})})}createItemElement(e){const t=document.createElement("li"),n=!e.disabled;t.className=`bim-menu-item ${n?"":"disabled"}`;const i=document.createElement("div");i.className="bim-menu-item-icon",e.icon&&(i.innerHTML=e.icon),t.appendChild(i);const r=document.createElement("div");r.className="bim-menu-item-label",r.textContent=Ae(e.label),t.appendChild(r);const a=e.children,o=a&&a.length>0;if(o){const l=document.createElement("div");l.className="bim-menu-item-arrow",l.innerHTML='<svg viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>',t.appendChild(l),t.addEventListener("mouseenter",()=>this.openSubMenu(e,t))}else t.addEventListener("mouseenter",()=>this.closeSubMenu());return n&&t.addEventListener("click",l=>{l.stopPropagation(),console.log(`[BimMenu] Clicked item: ${e.id}`),o||(e.onClick?(console.log(`[BimMenu] Executing onClick for ${e.id}`),e.onClick()):console.warn(`[BimMenu] No onClick handler for ${e.id}`))}),t}openSubMenu(e,t){const n=e.children;if(!n||n.length===0)return;this.closeSubMenu();const i=document.createElement("div");i.style.position="fixed",i.style.zIndex="10001";const r=t.getBoundingClientRect();i.style.top=`${r.top}px`,i.style.left=`${r.right}px`,i.addEventListener("mousedown",l=>l.stopPropagation());const a=new Cc({items:n});a.init(),i.appendChild(a.element),document.body.appendChild(i),this.activeSubMenu={menu:a,container:i};const o=i.getBoundingClientRect();o.right>window.innerWidth&&(i.style.left=`${r.left-o.width}px`)}closeSubMenu(){this.activeSubMenu&&(this.activeSubMenu.menu.destroy(),this.activeSubMenu.container.remove(),this.activeSubMenu=null)}}class nf extends en{container;rightKeyPanel;contextHandlers=[];constructor(e,t){super(e),this.container=t,this.rightKeyPanel=new v2({zIndex:9e3,container:this.container,onContext:this.handleContextMenu}),this.rightKeyPanel.init()}destroy(){this.rightKeyPanel.destroy()}registerHandler(e){this.contextHandlers.push(e)}showMenu(e,t,n,i){if(!n||n.length===0)return;const r=new Cc({items:n,groupOrder:i});r.init(),this.rightKeyPanel.mount(r),this.rightKeyPanel.show(e,t)}hide(){this.rightKeyPanel.hide()}handleContextMenu=e=>{let t=null;for(const n of this.contextHandlers){const i=n(e);i&&i.length>0&&(t||(t=[]),t=t.concat(i))}t&&t.length>0?this.showMenu(e.clientX,e.clientY,t):this.hide()}}const x2=s=>({id:"infoMenu",label:"menu.info",group:"info",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 7q.425 0 .713-.288T13 6t-.288-.712T12 5t-.712.288T11 6t.288.713T12 7m0 8q.425 0 .713-.288T13 14v-4q0-.425-.288-.712T12 9t-.712.288T11 10v4q0 .425.288.713T12 15m-6 3l-2.3 2.3q-.475.475-1.088.213T2 19.575V4q0-.825.588-1.412T4 2h16q.825 0 1.413.588T22 4v12q0 .825-.587 1.413T20 18z"/></svg>',onClick:()=>{console.log("dianjile"),s.dialog?.showInfoDialog(),s.engine?.rightKey?.hide()}}),_2=s=>({id:"fourMenu",label:"menu.info",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 7q.425 0 .713-.288T13 6t-.288-.712T12 5t-.712.288T11 6t.288.713T12 7m0 8q.425 0 .713-.288T13 14v-4q0-.425-.288-.712T12 9t-.712.288T11 10v4q0 .425.288.713T12 15m-6 3l-2.3 2.3q-.475.475-1.088.213T2 19.575V4q0-.825.588-1.412T4 2h16q.825 0 1.413.588T22 4v12q0 .825-.587 1.413T20 18z"/></svg>',onClick:()=>{console.log("dianjile"),s.dialog?.showInfoDialog(),s.engine?.rightKey?.hide()}}),b2=s=>({id:"infoMenu",label:"menu.info",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 7q.425 0 .713-.288T13 6t-.288-.712T12 5t-.712.288T11 6t.288.713T12 7m0 8q.425 0 .713-.288T13 14v-4q0-.425-.288-.712T12 9t-.712.288T11 10v4q0 .425.288.713T12 15m-6 3l-2.3 2.3q-.475.475-1.088.213T2 19.575V4q0-.825.588-1.412T4 2h16q.825 0 1.413.588T22 4v12q0 .825-.587 1.413T20 18z"/></svg>',onClick:()=>{console.log("dianjile"),s.dialog?.showInfoDialog(),s.engine?.rightKey?.hide()}}),y2=s=>({id:"homeMenu",label:"menu.home",group:"home",children:[b2(s),_2(s)],icon:'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 7q.425 0 .713-.288T13 6t-.288-.712T12 5t-.712.288T11 6t.288.713T12 7m0 8q.425 0 .713-.288T13 14v-4q0-.425-.288-.712T12 9t-.712.288T11 10v4q0 .425.288.713T12 15m-6 3l-2.3 2.3q-.475.475-1.088.213T2 19.575V4q0-.825.588-1.412T4 2h16q.825 0 1.413.588T22 4v12q0 .825-.587 1.413T20 18z"/></svg>',onClick:()=>{s.dialog?.showInfoDialog(),s.engine?.rightKey?.hide()}});class M2 extends en{container;engineInstance=null;rightKey=null;constructor(e,t){super(e),this.container=t}initialize(e){this.engineInstance&&this.engineInstance.isInitialized()&&(console.warn("[EngineManager] 3D Engine already initialized. Destroying old instance..."),this.engineInstance.destroy(),this.engineInstance=null);try{return this.engineInstance=new g2({container:this.container,...e}),this.engineInstance.init(),this.rightKey=new nf(this.engine,this.container),this.rightKey.registerHandler(t=>[x2(this.engine),y2(this.engine)]),this.engineInstance.isInitialized()}catch(t){return console.error("[EngineManager] Failed to initialize 3D engine:",t),this.engineInstance=null,!1}}isInitialized(){return this.engineInstance!==null&&this.engineInstance.isInitialized()}loadModel(e,t){if(!this.engineInstance){console.warn("[EngineManager] 3D Engine not initialized.");return}this.engineInstance.loadModel(e,t)}getEngine(){return this.engineInstance?this.engineInstance.getEngine():(console.warn("[EngineManager] 3D Engine not initialized."),null)}CameraGoHome(){if(!this.engineInstance){console.warn("[EngineManager] 3D Engine not initialized.");return}this.engineInstance.CameraGoHome()}activateMeasure(e){if(!this.engineInstance){console.warn("[EngineManager] 3D Engine not initialized.");return}this.engineInstance.activateMeasure(e)}deactivateMeasure(){this.engineInstance&&this.engineInstance.deactivateMeasure()}getCurrentMeasureType(){return this.engineInstance?this.engineInstance.getCurrentMeasureType():null}destroy(){this.engineInstance&&(this.engineInstance.destroy(),this.engineInstance=null),this.rightKey&&(this.rightKey.destroy(),this.rightKey=null)}}var Et=(s=>(s[s.Unchecked=0]="Unchecked",s[s.Checked=1]="Checked",s[s.Indeterminate=2]="Indeterminate",s))(Et||{});class w2{config;element;children=[];parent=null;checkState=Et.Unchecked;contentEl;switcherEl;checkboxEl=null;titleEl;actionsEl;childrenContainer;onExpandChange;onCheckChange;onNodeClick;renderActions;constructor(e,t,n){this.config=e,this.onExpandChange=n.onExpand,this.onCheckChange=n.onCheck,this.onNodeClick=n.onClick,this.renderActions=t.renderActions,this.checkState=e.checked?Et.Checked:Et.Unchecked,this.element=this.createDom(t)}createDom(e){const t=document.createElement("div");t.className="bim-tree-node",this.config.disabled&&t.classList.add("is-disabled"),this.contentEl=document.createElement("div"),this.contentEl.className="bim-tree-node-content",this.switcherEl=document.createElement("span"),this.switcherEl.className="bim-tree-switcher",this.switcherEl.innerHTML='<svg viewBox="0 0 1024 1024"><path d="M288 192l448 320-448 320z"></path></svg>';const n=this.config.children&&this.config.children.length>0;if(n?this.config.expanded&&this.switcherEl.classList.add("is-expanded"):this.switcherEl.classList.add("is-hidden"),this.switcherEl.addEventListener("click",r=>{r.stopPropagation(),this.toggleExpand()}),this.contentEl.appendChild(this.switcherEl),e.checkable!==!1&&(this.checkboxEl=document.createElement("span"),this.checkboxEl.className="bim-tree-checkbox",this.updateCheckboxUI(),this.checkboxEl.addEventListener("click",r=>{r.stopPropagation(),!this.config.disabled&&this.toggleCheck()}),this.contentEl.appendChild(this.checkboxEl)),this.config.icon){const r=document.createElement("span");r.className="bim-tree-icon",r.innerHTML=this.config.icon.includes("<svg")?this.config.icon:`<img src="${this.config.icon}" />`,this.contentEl.appendChild(r)}this.titleEl=document.createElement("span"),this.titleEl.className="bim-tree-title",this.updateLabel(),this.contentEl.appendChild(this.titleEl),this.actionsEl=document.createElement("div"),this.actionsEl.className="bim-tree-node-actions",this.actionsEl.addEventListener("click",r=>{r.stopPropagation()}),this.contentEl.appendChild(this.actionsEl),this.contentEl.addEventListener("click",r=>{if(r.stopPropagation(),this.config.disabled)return;(this.config.clickAction||"select")==="expand"?this.toggleExpand():this.onNodeClick(this)}),t.appendChild(this.contentEl),this.childrenContainer=document.createElement("div"),this.childrenContainer.className="bim-tree-children";const i=e.indent||24;return this.childrenContainer.style.paddingLeft=`${i}px`,this.config.expanded&&n&&this.childrenContainer.classList.add("is-visible"),t.appendChild(this.childrenContainer),t}setSelected(e){if(e){if(this.contentEl.classList.add("is-selected"),this.renderActions){const t=this.renderActions(this.config);this.actionsEl.innerHTML="",typeof t=="string"?this.actionsEl.innerHTML=t:t instanceof HTMLElement&&this.actionsEl.appendChild(t)}}else this.contentEl.classList.remove("is-selected"),this.actionsEl.innerHTML=""}updateLabel(){this.titleEl&&(this.titleEl.textContent=this.config.label)}toggleExpand(e){if(!this.config.children||this.config.children.length===0)return;const t=e!==void 0?e:!this.config.expanded;this.config.expanded=t,t?(this.switcherEl.classList.add("is-expanded"),this.childrenContainer.classList.add("is-visible")):(this.switcherEl.classList.remove("is-expanded"),this.childrenContainer.classList.remove("is-visible")),e===void 0&&this.onExpandChange(this)}toggleCheck(){const e=this.checkState!==Et.Checked;this.setChecked(e?Et.Checked:Et.Unchecked,!0)}setChecked(e,t=!1){this.checkState!==e&&(this.checkState=e,this.config.checked=e===Et.Checked,this.updateCheckboxUI(),t&&this.onCheckChange(this))}updateCheckboxUI(){this.checkboxEl&&(this.checkboxEl.classList.remove("is-checked","is-indeterminate"),this.checkState===Et.Checked?this.checkboxEl.classList.add("is-checked"):this.checkState===Et.Indeterminate&&this.checkboxEl.classList.add("is-indeterminate"))}appendChild(e){e.parent=this,this.children.push(e),this.childrenContainer.appendChild(e.element),this.children.length===1&&this.switcherEl.classList.remove("is-hidden")}destroy(){this.children.forEach(e=>e.destroy()),this.children=[],this.element.remove(),this.parent=null}}class S2{element;contentElement;searchInput=null;searchResults=null;options;nodeMap=new Map;rootNodes=[];selectedNode=null;unsubscribeLocale=null;unsubscribeTheme=null;clickOutsideHandler=null;onNodeCheck;onNodeSelect;onNodeExpand;constructor(e){this.options={checkable:!0,checkStrictly:!0,indent:24,defaultExpandAll:!0,enableSearch:!1,searchPlaceholder:"tree.searchPlaceholder",...e},this.element=document.createElement("div"),this.element.className="bim-tree",this.options.enableSearch&&this.createSearchDOM(),this.contentElement=document.createElement("div"),this.contentElement.className="bim-tree-content",this.element.appendChild(this.contentElement),e.onNodeCheck&&(this.onNodeCheck=e.onNodeCheck),e.onNodeSelect&&(this.onNodeSelect=e.onNodeSelect),e.onNodeExpand&&(this.onNodeExpand=e.onNodeExpand)}createSearchDOM(){const e=document.createElement("div");e.className="bim-tree-search";const t=document.createElement("div");t.className="bim-tree-search-wrapper";const n=document.createElement("span");n.className="bim-tree-search-icon",n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m21 21l-4.343-4.343m0 0A8 8 0 1 0 5.343 5.343a8 8 0 0 0 11.314 11.314"/></svg>',t.appendChild(n),this.searchInput=document.createElement("input"),this.searchInput.className="bim-tree-search-input",this.searchInput.type="text",this.searchInput.placeholder=Ae(this.options.searchPlaceholder||"搜索..."),this.searchInput.addEventListener("input",i=>{const r=i.target.value;this.handleSearch(r)}),t.appendChild(this.searchInput),e.appendChild(t),this.searchResults=document.createElement("div"),this.searchResults.className="bim-tree-search-results",e.appendChild(this.searchResults),this.element.appendChild(e),this.clickOutsideHandler=i=>{this.searchResults&&!this.searchResults.contains(i.target)&&!this.searchInput?.contains(i.target)&&this.searchResults.classList.remove("is-visible")},document.addEventListener("click",this.clickOutsideHandler)}init(){this.render(),this.unsubscribeLocale=Ht.subscribe(()=>this.setLocales()),this.unsubscribeTheme=st.subscribe(e=>this.setTheme(e)),this.setTheme(st.getTheme())}handleSearch(e){if(!this.searchResults)return;if(!e.trim()){this.searchResults.classList.remove("is-visible"),this.searchResults.innerHTML="";return}const t=[],n=e.toLowerCase();this.nodeMap.forEach(i=>{const r=i.config.label;r.toLowerCase().includes(n)&&t.push({node:i,label:r,path:this.getNodePath(i)})}),this.renderSearchResults(t)}getNodePath(e){const t=[];let n=e.parent;for(;n;)t.unshift(n.config.label),n=n.parent;return t.join(" > ")}renderSearchResults(e){if(this.searchResults){if(this.searchResults.innerHTML="",e.length===0){const t=document.createElement("div");t.className="bim-tree-search-item",t.style.cursor="default",t.style.color="#999",t.textContent="No results",this.searchResults.appendChild(t)}else e.forEach(t=>{const n=document.createElement("div");n.className="bim-tree-search-item";const i=document.createElement("span");i.className="bim-tree-search-item-title",i.textContent=t.label;const r=document.createElement("span");r.className="bim-tree-search-item-path",r.textContent=t.path,n.appendChild(i),t.path&&n.appendChild(r),n.addEventListener("click",()=>{this.revealNode(t.node)}),this.searchResults.appendChild(n)});this.searchResults.classList.add("is-visible")}}revealNode(e){this.searchResults&&(this.searchResults.classList.remove("is-visible"),this.searchInput&&(this.searchInput.value=""));let t=e.parent;for(;t;)t.toggleExpand(!0),t=t.parent;this.handleNodeSelect(e),setTimeout(()=>{e.element.scrollIntoView({behavior:"smooth",block:"center"})},100)}setTheme(e){const t=this.element.style;t.setProperty("--bim-primary",e.primary),t.setProperty("--bim-bg-elevated",e.bgElevated),t.setProperty("--bim-text-primary",e.textPrimary),t.setProperty("--bim-text-secondary",e.textSecondary),t.setProperty("--bim-text-tertiary",e.textTertiary),t.setProperty("--bim-text-disabled",e.textDisabled),t.setProperty("--bim-text-inverse",e.textInverse),t.setProperty("--bim-border-default",e.borderDefault),t.setProperty("--bim-border-disabled",e.borderDisabled),t.setProperty("--bim-component-bg-hover",e.componentBgHover),t.setProperty("--bim-component-bg-selected",e.componentBgSelected),t.setProperty("--bim-component-bg-disabled",e.componentBgDisabled),t.setProperty("--bim-shadow-md",e.shadowMd),t.setProperty("--bim-focus-ring",e.focusRing)}setLocales(){this.nodeMap.forEach(e=>e.updateLabel()),this.searchInput&&(this.searchInput.placeholder=Ae(this.options.searchPlaceholder||"tree.searchPlaceholder"))}destroy(){this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.clickOutsideHandler&&(document.removeEventListener("click",this.clickOutsideHandler),this.clickOutsideHandler=null),this.rootNodes.forEach(e=>e.destroy()),this.rootNodes=[],this.nodeMap.clear(),this.element.remove(),this.selectedNode=null}render(){this.contentElement.innerHTML="",this.nodeMap.clear(),this.rootNodes=[],this.options.data.forEach(e=>{this.createNodeRecursively(e,null)})}createNodeRecursively(e,t){e.expanded===void 0&&(e.expanded=this.options.defaultExpandAll);const n=new w2(e,this.options,{onExpand:i=>{this.onNodeExpand&&this.onNodeExpand(i)},onCheck:i=>this.handleNodeCheck(i),onClick:i=>this.handleNodeSelect(i)});this.nodeMap.set(e.id,n),t?t.appendChild(n):(this.rootNodes.push(n),this.contentElement.appendChild(n.element)),e.children&&e.children.length>0&&e.children.forEach(i=>{this.createNodeRecursively(i,n)})}handleNodeSelect(e){this.selectedNode&&this.selectedNode!==e&&this.selectedNode.setSelected(!1),e.setSelected(!0),this.selectedNode=e,this.onNodeSelect&&this.onNodeSelect(e)}handleNodeCheck(e){const t=e.checkState===Et.Checked;if(this.onNodeCheck&&this.onNodeCheck(e),this.options.checkStrictly===!1)return;const n=(r,a)=>{r.children.forEach(o=>{o.config.disabled||(o.setChecked(a,!1),n(o,a))})};t?n(e,Et.Checked):n(e,Et.Unchecked);let i=e.parent;for(;i;){if(i.config.disabled){i=i.parent;continue}const r=i.children,a=r.every(l=>l.checkState===Et.Checked),o=r.every(l=>l.checkState===Et.Unchecked);a?i.setChecked(Et.Checked,!1):o?i.setChecked(Et.Unchecked,!1):i.setChecked(Et.Indeterminate,!1),i=i.parent}}getNode(e){return this.nodeMap.get(e)}checkNode(e,t){const n=this.nodeMap.get(e);n&&n.setChecked(t?Et.Checked:Et.Unchecked,!0)}expandAll(e){this.nodeMap.forEach(t=>t.toggleExpand(e))}getCheckedNodes(e=!1){const t=[];return this.nodeMap.forEach(n=>{(n.checkState===Et.Checked||e&&n.checkState===Et.Indeterminate)&&t.push(n.config)}),t}}class sf{element;navElement;contentElement;options;activeId;tabMap=new Map;panelMap=new Map;unsubscribeLocale=null;unsubscribeTheme=null;navClickHandler=null;constructor(e){this.options=e,this.activeId=e.activeId||(e.tabs[0]?.id??null),e.tabs.forEach(t=>this.tabMap.set(t.id,t)),this.element=document.createElement("div"),this.element.className="bim-tab",this.navElement=document.createElement("div"),this.navElement.className="bim-tab__nav",this.navElement.setAttribute("role","tablist"),this.element.appendChild(this.navElement),this.contentElement=document.createElement("div"),this.contentElement.className="bim-tab__content",this.element.appendChild(this.contentElement),this.options.container.appendChild(this.element)}init(){this.renderNav(),this.renderPanels(),this.setLocales(),this.setTheme(st.getTheme()),this.unsubscribeLocale=Ht.subscribe(()=>this.setLocales()),this.unsubscribeTheme=st.subscribe(e=>this.setTheme(e))}renderNav(){this.navElement.innerHTML="",this.navClickHandler=e=>{const t=e.target.closest(".bim-tab__item");if(!t)return;const n=t.dataset.id;!n||this.tabMap.get(n)?.disabled||this.activateTab(n)},this.navElement.addEventListener("click",this.navClickHandler),this.options.tabs.forEach(e=>{const t=document.createElement("button");if(t.type="button",t.className="bim-tab__item",t.dataset.id=e.id,t.setAttribute("role","tab"),t.id=`tab-${e.id}`,t.setAttribute("aria-selected",`${e.id===this.activeId}`),e.disabled&&(t.disabled=!0,t.setAttribute("aria-disabled","true"),t.classList.add("is-disabled")),e.icon){const i=document.createElement("span");i.className="bim-tab__icon",i.innerHTML=e.icon,t.appendChild(i)}const n=document.createElement("span");n.className="bim-tab__title",n.textContent=this.resolveTitle(e.title),t.appendChild(n),e.id===this.activeId&&t.classList.add("is-active"),this.navElement.appendChild(t)})}renderPanels(){this.contentElement.innerHTML="",this.panelMap.clear(),this.options.tabs.forEach(e=>{const t=document.createElement("div");t.className="bim-tab__panel",t.dataset.id=e.id,t.setAttribute("role","tabpanel"),t.setAttribute("aria-labelledby",`tab-${e.id}`),e.content instanceof HTMLElement?t.appendChild(e.content):typeof e.content=="string"&&(t.innerHTML=e.content),e.id===this.activeId?t.classList.add("is-active"):t.style.display="none",this.panelMap.set(e.id,t),this.contentElement.appendChild(t)})}activateTab(e){if(this.activeId===e)return;const t=this.tabMap.get(e);if(!t||t.disabled)return;this.activeId=e,this.navElement.querySelectorAll(".bim-tab__item").forEach(i=>{const r=i.dataset.id===e;i.classList.toggle("is-active",r),i.setAttribute("aria-selected",`${r}`)}),this.panelMap.forEach((i,r)=>{const a=r===e;i.classList.toggle("is-active",a),i.style.display=a?"block":"none"}),this.options.onChange&&this.options.onChange(e,t)}setTheme(e){const t=this.element.style;t.setProperty("--bim-tab-bg",e.bgElevated),t.setProperty("--bim-tab-nav-bg",e.bgElevated),t.setProperty("--bim-tab-text",e.textPrimary),t.setProperty("--bim-tab-text-secondary",e.textSecondary),t.setProperty("--bim-tab-text-active",e.primary),t.setProperty("--bim-tab-border",e.borderDefault),t.setProperty("--bim-tab-hover-bg",e.componentBgHover),t.setProperty("--bim-tab-active-bg",e.componentBgActive),t.setProperty("--bim-tab-icon",e.iconDefault)}setLocales(){this.navElement.querySelectorAll(".bim-tab__item").forEach(t=>{const n=t.dataset.id;if(!n)return;const i=this.tabMap.get(n);if(!i)return;const r=t.querySelector(".bim-tab__title");r&&(r.textContent=this.resolveTitle(i.title))})}destroy(){this.navClickHandler&&(this.navElement.removeEventListener("click",this.navClickHandler),this.navClickHandler=null),this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.panelMap.clear(),this.tabMap.clear(),this.element.remove()}resolveTitle(e){try{return Ae(e)||e}catch{return e}}}const rf={测量:'<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M0,28.207H3.429v3.526H44.571V28.207H48v7.052H0ZM0,3.526v14.1a3.478,3.478,0,0,0,3.429,3.526H6.857V17.629h3.429v3.526h3.429V17.629h3.429v3.526h3.429V10.578H24V21.155h3.429V17.629h3.429v3.526h3.429V17.629h3.429v3.526h3.429V10.578h3.429V21.155A3.478,3.478,0,0,0,48,17.629V3.526A3.478,3.478,0,0,0,44.571,0H3.429A3.478,3.478,0,0,0,0,3.526Z" transform="translate(0 5.456)"/></svg>',地图:'<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M32.984,563.2H26.329a66.982,66.982,0,0,1-5.471,7.121l-1.455,1.61-1.455-1.61a66.978,66.978,0,0,1-5.471-7.121H5.821L0,580.662H38.8Z" transform="translate(4.598 -537.259)"/><path fill="currentColor" d="M275.4,9.7a9.7,9.7,0,1,0-19.4,0c0,6.636,9.7,17.462,9.7,17.462S275.4,16.337,275.4,9.7Zm-13.582,0a3.88,3.88,0,1,1,3.88,3.88,3.88,3.88,0,0,1-3.88-3.88Z" transform="translate(-241.701 4.598)"/></svg>',框选放大:'<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M336.351,336.158l-5.5.037-.037-5.5-3.665.025.037,5.5-5.491.037.025,3.665,5.491-.037.041,5.491,3.661-.025-.037-5.491,5.5-.041Z" transform="translate(-305.467 -314.477)"/><path fill="currentColor" d="M41.88,40.861l-.227-.223-7.167-7.068a14.787,14.787,0,1,0-2.832,2.4l7.4,7.3.227.223.021-.021a1.821,1.821,0,0,0,1.065.33,1.849,1.849,0,0,0,1.837-1.862,1.868,1.868,0,0,0-.343-1.061l.017-.021ZM23.648,34.668A11.1,11.1,0,1,1,34.675,23.487,11.106,11.106,0,0,1,23.648,34.668ZM3,41.492H6.241v3.241H3ZM3,15.564H6.241v3.241H3ZM3,2.6H6.241V5.841H3Zm12.964,0h3.241V5.841H15.964Zm-6.482,0h3.241V5.841H9.482Zm12.964,0h3.241V5.841H22.446Zm6.482,0h3.241V5.841H28.928Zm6.482,0h3.241V5.841H35.41Zm6.482,0h3.241V5.841H41.892Zm0,6.482h3.241v3.241H41.892Zm0,6.482h3.241v3.241H41.892Zm0,6.482h3.241v3.241H41.892ZM9.482,41.492h3.241v3.241H9.482Zm6.482,0h3.241v3.241H15.964Zm6.482,0h3.241v3.241H22.446ZM3,9.082H6.241v3.241H3ZM3,22.046H6.241v3.241H3Zm38.892,6.482h3.241v3.241H41.892ZM3,28.528H6.241v3.241H3ZM3,35.01H6.241v3.241H3Z" transform="translate(-0.067 0.333)"/></svg>',漫游:'<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M327.239,38.548a6.01,6.01,0,1,0-6.358-6A6.144,6.144,0,0,0,327.239,38.548Zm8.006,5.76a3.082,3.082,0,0,0-3.061-2.64h-1.648c-.471,0-.706.24-1.177.48l-2.119,1.68-2.119-1.92a1.781,1.781,0,0,0-1.177-.48h-1.648a2.914,2.914,0,0,0-3.061,2.64l-1.413,10.8c0,.48,0,.96.471,1.2a1.781,1.781,0,0,0,1.177.48h1.648l1.413,15.36a3.082,3.082,0,0,0,3.061,2.64h3.532a2.914,2.914,0,0,0,3.061-2.64l1.413-15.36h1.648a1.781,1.781,0,0,0,1.177-.48,2.2,2.2,0,0,0,.235-1.2Z" transform="translate(-303.239 -26.548)"/></svg>',目录树:'<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M116.8,153.474h12a1.2,1.2,0,0,0,1.2-1.185v-7.111a1.2,1.2,0,0,0-1.2-1.184h-12a1.2,1.2,0,0,0-1.2,1.184v1.629H93.553v-7.554H100a1.2,1.2,0,0,0,1.2-1.185v-7.112a1.2,1.2,0,0,0-1.2-1.185H83.2a1.2,1.2,0,0,0-1.2,1.185v7.112a1.2,1.2,0,0,0,1.2,1.185h6.45v28a2.383,2.383,0,0,0,2.4,2.37H115.6v1.63a1.2,1.2,0,0,0,1.2,1.185h12a1.2,1.2,0,0,0,1.2-1.185v-7.112a1.2,1.2,0,0,0-1.2-1.185h-12a1.2,1.2,0,0,0-1.2,1.185v1.63H93.553V150.657H115.6v1.629a1.2,1.2,0,0,0,1.2,1.185Z" transform="translate(-82 -126.874)"/></svg>',剖切:'<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="currentColor"><g transform="translate(-176.967 -101.068)"><path d="M306.33,364.55h14.737v19.115H306.33Z" transform="translate(-118.068 -248.554)"/><path d="M487.114,140.356a1.6,1.6,0,0,1-1.744-1.393V99.573a1.787,1.787,0,0,1,3.487,0v39.389A1.6,1.6,0,0,1,487.114,140.356Z" transform="translate(-285.677 6.11)"/><path d="M508.34,274.031H487.114a1.743,1.743,0,1,1,0-3.487h17.739V242.767H487.114a1.744,1.744,0,1,1,0-3.487H508.34Z" transform="translate(-285.677 -131.282)"/><path d="M201.437,274.031h-3.278a1.743,1.743,0,1,1,0-3.487h3.278a1.743,1.743,0,1,1,0,3.487Zm-8.858,0H187a1.743,1.743,0,1,1,0-3.487h5.579a1.743,1.743,0,1,1,0,3.487Zm-10.626-.532a1.743,1.743,0,0,1-1.743-1.744v-5.579a1.743,1.743,0,1,1,3.487,0v5.579A1.743,1.743,0,0,1,181.953,273.5Zm0-11.159a1.743,1.743,0,0,1-1.743-1.743v-5.579a1.743,1.743,0,1,1,3.487,0V260.6A1.743,1.743,0,0,1,181.953,262.34Zm0-11.158a1.744,1.744,0,0,1-1.743-1.744v-5.579a1.743,1.743,0,1,1,3.487,0v5.579A1.744,1.744,0,0,1,181.953,251.181Zm19.484-8.414h-5.579a1.744,1.744,0,1,1,0-3.487h5.579a1.744,1.744,0,0,1,0,3.487Zm-11.159,0H184.7a1.744,1.744,0,1,1,0-3.487h5.579a1.744,1.744,0,1,1,0,3.487Z" transform="translate(0 -131.282)"/></g></svg>',剖切盒:'<svg width="48" height="48" viewBox="0 0 48 48" fill="currentColor"><g transform="translate(-56.83 2.793)"><path d="M194.963,19.168a1.69,1.69,0,0,1-.607-.119l-19.027-8.292a1.253,1.253,0,0,1,0-2.35L191.289.112a1.592,1.592,0,0,1,1.24,0l18.663,8.294a1.267,1.267,0,0,1,.791,1.175,1.308,1.308,0,0,1-.791,1.175l-15.6,8.278a1.519,1.519,0,0,1-.633.143Zm-15.7-9.586,15.7,6.832,12.331-6.832L191.9,2.749Z" transform="translate(-109.947 0)"/><path d="M195.008,417.821a1.691,1.691,0,0,1-.607-.119l-19.025-8.294a1.253,1.253,0,0,1,0-2.35l15.958-8.294a1.592,1.592,0,0,1,1.24,0l18.657,8.294a1.267,1.267,0,0,1,.791,1.175,1.308,1.308,0,0,1-.791,1.175l-15.6,8.278c-.211.095-3.483.143-3.694.143Zm-15.6-9.588,15.6,6.832,12.329-6.832L191.948,401.4Z" transform="translate(-109.992 -382.638)"/><path d="M200.046,603.93a1.976,1.976,0,0,1-.634-.119l-18.774-8.3a1.257,1.257,0,0,1-.655-1.754,1.512,1.512,0,0,1,1.931-.595l18.131,8.013,14.971-8.007a1.51,1.51,0,0,1,1.928.6,1.256,1.256,0,0,1-.661,1.75l-15.6,8.282a1.489,1.489,0,0,1-.634.119Z" transform="translate(-115.041 -568.787)"/><path d="M101.029,216.82a1.467,1.467,0,0,1-1-.377,1.237,1.237,0,0,1-.41-.917V198.817a1.413,1.413,0,0,1,2.816,0V215.5a1.241,1.241,0,0,1-.4.931A1.472,1.472,0,0,1,101.029,216.82Zm-34.377.143a1.467,1.467,0,0,1-1-.377,1.237,1.237,0,0,1-.41-.917V198.817a1.413,1.413,0,0,1,2.816,0v16.852a1.237,1.237,0,0,1-.41.917A1.467,1.467,0,0,1,66.652,216.964Zm-5.215,2.8a1.467,1.467,0,0,1-1-.377,1.237,1.237,0,0,1-.41-.917V201.621a1.413,1.413,0,0,1,2.816,0v16.852a1.237,1.237,0,0,1-.41.917A1.467,1.467,0,0,1,61.436,219.768Z" transform="translate(-0.4 -189.683)"/><path d="M60.922,37.617A1.32,1.32,0,0,1,60,37.258a1.2,1.2,0,0,1-.378-.876V20.295a1.3,1.3,0,0,1,2.588,0V36.382a1.276,1.276,0,0,1-1.294,1.235Zm-1.175,8.411a1.341,1.341,0,0,1,1.75-.578l15.126,7.071a1.224,1.224,0,0,1,.6,1.671,1.337,1.337,0,0,1-1.75.572L60.347,47.708a1.228,1.228,0,0,1-.606-1.671Z" transform="translate(0 -18.25)"/><path d="M71.756,44.947a1.337,1.337,0,0,1,1.75-.582l15.126,7.118a1.235,1.235,0,0,1,.6,1.682,1.333,1.333,0,0,1-1.75.576L72.356,46.629a1.239,1.239,0,0,1-.606-1.682ZM59.915,12.652a1.337,1.337,0,0,1,1.75-.582L76.79,19.194a1.235,1.235,0,0,1,.6,1.682,1.333,1.333,0,0,1-1.75.576L60.515,14.334A1.247,1.247,0,0,1,59.915,12.652Z" transform="translate(-0.168 -11.442)"/><path d="M334.418,146.671a1.341,1.341,0,0,1,1.75-.578l15.126,7.073a1.224,1.224,0,0,1,.6,1.671,1.337,1.337,0,0,1-1.75.573l-15.126-7.09a1.25,1.25,0,0,1-.663-.7,1.177,1.177,0,0,1,.058-.945Zm16.3,35.276a1.32,1.32,0,0,1-.917-.36,1.2,1.2,0,0,1-.377-.875v-16.1a1.3,1.3,0,0,1,2.588,0V180.7a1.2,1.2,0,0,1-.38.878,1.321,1.321,0,0,1-.922.357Z" transform="translate(-260.918 -139.687)"/><path d="M576.438,360.4a1.288,1.288,0,0,1-1.294-1.294V342.253a1.294,1.294,0,1,1,2.588,0v16.852A1.3,1.3,0,0,1,576.438,360.4ZM572.8,344.248,573,361.1l-2.613.024-.2-16.857Z" transform="translate(-486.154 -327.316)"/><path d="M508.543,26.833l.192,16.852-2.613.024-.192-16.852Z" transform="translate(-425.253 -25.689)"/></g></svg>',全屏:'<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M6.241,3.671H12.85a1.734,1.734,0,0,0,1.836-1.836A1.734,1.734,0,0,0,12.85,0H1.469C1.1,0,.734.367.367.734A1.349,1.349,0,0,0,0,1.836V12.85a1.734,1.734,0,0,0,1.836,1.836A1.734,1.734,0,0,0,3.671,12.85V6.241l9.913,9.913a1.817,1.817,0,1,0,2.57-2.57ZM13.584,27.9,6.975,34.51l-3.3,3.3V31.206a1.734,1.734,0,0,0-1.836-1.836A1.734,1.734,0,0,0,0,31.206V42.22a1.734,1.734,0,0,0,1.836,1.836H12.85a1.836,1.836,0,0,0,0-3.671H6.241l3.3-3.3,6.608-6.608a1.817,1.817,0,1,0-2.57-2.57ZM42.22,29.371a1.734,1.734,0,0,0-1.836,1.836v6.608l-3.3-3.3L30.472,27.9a1.817,1.817,0,1,0-2.57,2.57L34.51,37.08l3.3,3.3H31.206a1.836,1.836,0,1,0,0,3.671H42.22a1.734,1.734,0,0,0,1.836-1.836V31.206a1.734,1.734,0,0,0-1.836-1.836ZM42.22,0H31.206a1.734,1.734,0,0,0-1.836,1.836,1.734,1.734,0,0,0,1.836,1.836h6.608l-3.3,3.3L27.9,13.584a1.817,1.817,0,1,0,2.57,2.57L37.08,9.545l3.3-3.3V12.85a1.836,1.836,0,0,0,3.671,0V1.836A1.734,1.734,0,0,0,42.22,0Z" transform="translate(1.972 1.972)"/></svg>',设置:'<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M112.388,106.443l-2.668-.373a1.687,1.687,0,0,1-1.306-1.031,16.337,16.337,0,0,0-2-3.475,1.681,1.681,0,0,1-.243-1.646l1.012-2.5a1.652,1.652,0,0,0-.709-2.057l-5.769-3.335a1.654,1.654,0,0,0-2.136.415L96.919,94.56a1.693,1.693,0,0,1-1.562.62,15.32,15.32,0,0,0-3.992,0,1.693,1.693,0,0,1-1.562-.62l-1.651-2.113a1.654,1.654,0,0,0-2.136-.415l-5.769,3.33a1.659,1.659,0,0,0-.709,2.057l1.012,2.5a1.679,1.679,0,0,1-.243,1.646,16.141,16.141,0,0,0-2,3.475A1.669,1.669,0,0,1,77,106.066l-2.668.373a1.663,1.663,0,0,0-1.432,1.646v6.665a1.662,1.662,0,0,0,1.427,1.642l2.668.373a1.687,1.687,0,0,1,1.306,1.031,16.338,16.338,0,0,0,2,3.475,1.681,1.681,0,0,1,.243,1.646l-1.012,2.5a1.652,1.652,0,0,0,.709,2.057l5.769,3.33a1.654,1.654,0,0,0,2.136-.415L89.8,128.27a1.693,1.693,0,0,1,1.562-.62,15.321,15.321,0,0,0,3.992,0,1.693,1.693,0,0,1,1.562.62l1.651,2.113a1.654,1.654,0,0,0,2.136.415l5.769-3.33a1.659,1.659,0,0,0,.709-2.057l-1.012-2.5a1.681,1.681,0,0,1,.243-1.646,16.141,16.141,0,0,0,2-3.475,1.669,1.669,0,0,1,1.306-1.031l2.668-.373a1.658,1.658,0,0,0,1.427-1.642v-6.665A1.639,1.639,0,0,0,112.388,106.443ZM93.36,117.893a6.478,6.478,0,1,1,6.478-6.478A6.479,6.479,0,0,1,93.36,117.893Z" transform="translate(-69.355 -87.415)"/></svg>',拾曲面剖切:'<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="currentColor"><g transform="translate(-59.63 -21.333)"><path d="M302.465,495.393l2.363-4.363a.842.842,0,0,1,1.091-.273.914.914,0,0,1,.454,1l-1.636,3,11.453-3.454c.091,0,.091,0,.182-.091a.785.785,0,1,1,.273,1.545l-11.453,3.454,3,1.545h.091a.645.645,0,0,1,.182,1,.842.842,0,0,1-1.091.273l-4.545-2.363c-.091,0-.182-.091-.273-.182A.742.742,0,0,1,302.465,495.393Z" transform="translate(205.84 -520.136) rotate(43)"/><path d="M88.23,54.014v2.86l-21.123,8.17V34l21.123-8.17V47.069h2.9l-.207-25.736L64,31.75V69.333L91.129,58.916v-4.9Z"/><path d="M199,255.9l-15.532,6.268v-21.23L199,234.667Z" transform="translate(-113.668 -202.979)"/></g></svg>',轴向剖切:'<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="currentColor"><g transform="translate(-59.63 -21.333)"><path d="M.194,3.727,2.558,8.089a.842.842,0,0,0,1.091.273.914.914,0,0,0,.454-1l-1.636-3L13.919,7.817c.091,0,.091,0,.182.091a.785.785,0,1,0,.273-1.545L2.921,2.909l3-1.545h.091a.645.645,0,0,0,.182-1A.842.842,0,0,0,5.1.091L.558,2.454c-.091,0-.182.091-.273.182A.742.742,0,0,0,.194,3.727Z" transform="translate(102.244 57.563) rotate(-178)"/><path d="M88.23,54.014v2.86l-21.123,8.17V34l21.123-8.17V47.069h2.9l-.207-25.736L64,31.75V69.333L91.129,58.916v-4.9Z"/><path d="M199,255.9l-15.532,6.268v-21.23L199,234.667Z" transform="translate(-113.668 -202.979)"/></g></svg>',主视角:'<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M122.32,181.835v-13.16h-9.87V163.74h19.74v18.095Zm-19.74,0V163.74h9.87v18.095ZM96,163.74,117.385,144l21.385,19.74Z" transform="translate(-93.385 -138.917)"/></svg>',文档:'<svg width="48" height="48" viewBox="0 0 48 48"><path fill="currentColor" d="M64,128h1.714v41.143H64Zm46.286,0H112v41.143h-1.714Zm-44.571,0h44.571v3.429H65.714Zm0,6.857h44.571v3.429H65.714Zm0-3.429h3.429v3.429H65.714Zm8.571,0h3.429v3.429H74.286Zm8.571,0h27.429v3.429H82.857Zm-17.143,36h44.571v1.714H65.714Zm5.143-24H76v1.714H70.857Zm10.286,0h24v1.714h-24Zm-10.286,6.857H76V152H70.857Zm10.286,0h24V152h-24Zm-10.286,6.857H76v1.714H70.857Zm10.286,0h24v1.714h-24Z" transform="translate(-64 -124.571)"/></svg>',第一人称漫游:'<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="currentColor"><path d="M178.325,132.27a6.411,6.411,0,0,0,0-9.429,7.359,7.359,0,0,0-9.984,0,6.411,6.411,0,0,0,0,9.429,7.359,7.359,0,0,0,9.984,0Zm-2-7.543a3.845,3.845,0,0,1,0,5.657,4.414,4.414,0,0,1-5.99,0,3.847,3.847,0,0,1,0-5.657,4.414,4.414,0,0,1,5.99,0Zm6.618,31.639q4.975,1.006,4.975,3.189t-4.975,3.189a57.4,57.4,0,0,1-19.226,0q-4.973-1.006-4.973-3.189t4.975-3.189q.777-.156,1.613-.284v-2.521a4.488,4.488,0,0,1-1.412.217,4.761,4.761,0,0,1-.587-.036l-.038,0a29.007,29.007,0,0,0-7.657,2.332q-3.482,1.712-3.482,3.484a2.944,2.944,0,0,0,1.3,2.116,14.359,14.359,0,0,0,4.4,2.293,46.614,46.614,0,0,0,15.477,2.258,46.614,46.614,0,0,0,15.477-2.258,14.362,14.362,0,0,0,4.4-2.293,2.943,2.943,0,0,0,1.3-2.116q0-1.772-3.482-3.484a29.007,29.007,0,0,0-7.657-2.332,4.908,4.908,0,0,1-.625.039,4.488,4.488,0,0,1-1.412-.217v2.521q.836.128,1.613.284Zm-14.788-6.588v5.979q2.391-.2,5.176-.2t5.176.2v-12.2h2.824v6.222a1.25,1.25,0,0,0,.414.942v0l.081.071q.744.1,1.457.22a1.41,1.41,0,0,0,.457-.293,1.25,1.25,0,0,0,.414-.942v-8a3.75,3.75,0,0,0-1.24-2.828,4.2,4.2,0,0,0-2.995-1.172H166.745a4.2,4.2,0,0,0-2.995,1.172,3.75,3.75,0,0,0-1.24,2.828v8a1.268,1.268,0,0,0,.414.942,1.415,1.415,0,0,0,.456.293q.715-.119,1.459-.222.041-.034.081-.071a1.25,1.25,0,0,0,.414-.942v-6.222h2.824Zm-8.471-6.222v-1.778a6.253,6.253,0,0,1,2.067-4.715,7.013,7.013,0,0,1,4.992-1.952h13.176a7.013,7.013,0,0,1,4.992,1.952,6.253,6.253,0,0,1,2.067,4.715v8a3.722,3.722,0,0,1-.484,1.881l0,.005a28.526,28.526,0,0,1,5.841,2.041q5,2.462,5,5.851,0,4.238-7.531,6.9a49.5,49.5,0,0,1-16.469,2.428,49.5,49.5,0,0,1-16.469-2.428q-7.531-2.667-7.531-6.9,0-3.388,5-5.849a28.381,28.381,0,0,1,5.841-2.044,3.707,3.707,0,0,1-.488-1.884Zm24.8,16a13.145,13.145,0,0,0-2.129-.581,54.5,54.5,0,0,0-18.044,0,13.079,13.079,0,0,0-2.127.581,13.078,13.078,0,0,0,2.127.581,54.5,54.5,0,0,0,18.044,0,13.078,13.078,0,0,0,2.127-.581Z" transform="translate(-149.333 -120.889)"/></svg>',反向:'<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="currentColor"><g transform="translate(0.364 4.658)"><path d="M0,287.1m0-.817v-2.042a.722.722,0,0,1,.817-.817H44.509a.722.722,0,0,1,.817.817v2.042a.722.722,0,0,1-.817.817H.817A.722.722,0,0,1,0,286.28Z" transform="translate(-0.001 -272.164)"/><path d="M829.7,13.238l-1.443,1.444a.817.817,0,0,1-1.155,0L815.263,2.844a.817.817,0,0,1,0-1.156L816.706.244a.817.817,0,0,1,1.155,0L829.7,12.083a.817.817,0,0,1,0,1.155Z" transform="translate(-782.667)"/><path d="M94.367,648m0,.817v2.042a.722.722,0,0,1-.817.817H49.858a.722.722,0,0,1-.817-.817v-2.042a.722.722,0,0,1,.817-.817H93.55A.722.722,0,0,1,94.367,648.816Z" transform="translate(-47.095 -622.268)"/><path d="M.239,649.97l1.443-1.444a.817.817,0,0,1,1.155,0l11.838,11.838a.817.817,0,0,1,0,1.156l-1.443,1.443a.817.817,0,0,1-1.155,0L.239,651.124a.817.817,0,0,1,0-1.155Z" transform="translate(0 -622.544)"/></g></svg>',路径漫游:'<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="currentColor"><g transform="translate(0 -4.9)"><path d="M43.755,35.8a23.352,23.352,0,0,1-8.074-3.095c-1.131-.912-2.263-1.819-2.263-3.458,0-.364-.164-.548-.486-.548-1.776-.364-2.263,0-1.935,2.183a5,5,0,0,0,1.776,3.095,14.337,14.337,0,0,0,4.521,2.551c2.1.912,4.521,1.276,6.461,2.551,1.935,1.091,2.1,2.551.809,4.37A12.572,12.572,0,0,1,37.3,48.187a30.594,30.594,0,0,1-17.115-1.455c-2.585-.912-4.2-.364-5.488,2,0,.184-.164.184-.323.548,2.1.728,3.876,1.455,5.811,2,5.811,1.639,11.786,2.367,17.76.548A14.453,14.453,0,0,0,46.663,45.1c2.422-4.2,1.613-8.381-2.908-9.293Zm-19.7-7.97a11.943,11.943,0,0,0-7.382-10.952A12.17,12.17,0,0,0,3.457,19.546a10.951,10.951,0,0,0-2.3,12.879c2.459,5.329,6.456,9.77,10.453,14.06.463.444.617.444,1.075,0,3.689-4.143,7.382-8.287,10-13.172A11.6,11.6,0,0,0,24.059,27.833Zm-4.151,3.255c-1.692,3.851-4.614,6.955-7.382,10.215-.463.444-.617.3-.921,0A44.891,44.891,0,0,1,4.228,31.088a7.684,7.684,0,0,1-.767-3.109A8.664,8.664,0,0,1,18.22,21.909a8.155,8.155,0,0,1,1.688,9.18ZM33.007,4.9c-5.685,0-9.785,6.416-7.274,11.76,1.454,3.34,4.1,5.745,6.746,8.15a.492.492,0,0,0,.795,0c2.908-2.537,5.554-5.211,7.008-8.821A8.117,8.117,0,0,0,33.007,4.9Zm4.366,10.422A16.825,16.825,0,0,1,33.4,20c-.4.269-.659.269-.926,0a16.342,16.342,0,0,1-3.969-4.545,5.033,5.033,0,1,1,8.864-.132Z"/><path d="M183.031,141.935a2.136,2.136,0,0,0,2.053-2.18,2.084,2.084,0,0,0-2.18-2.18,2.171,2.171,0,0,0-2.053,2.307A2.058,2.058,0,0,0,183.031,141.935Zm-20.094,7.854a4.7,4.7,0,0,0-4.6,4.881,4.913,4.913,0,0,0,4.74,4.881,4.882,4.882,0,0,0-.14-9.762Zm0,6.417a1.77,1.77,0,0,1-1.532-1.532A1.79,1.79,0,0,1,162.937,153a1.611,1.611,0,0,1,1.672,1.672A1.578,1.578,0,0,1,162.937,156.206Z" transform="translate(-150.629 -126.653)"/></g></svg>',适应到模型:'<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="currentColor"><g transform="translate(-84.667 -84.667)"><path d="M87.667,97V87.667H97V85.333H86.733a1.4,1.4,0,0,0-1.4,1.4V97Zm0,23.333H85.333V130.6a1.4,1.4,0,0,0,1.4,1.4H97v-2.333H87.667v-9.333Zm32.667,9.333V132H130.6a1.4,1.4,0,0,0,1.4-1.4V120.333h-2.333v9.333h-9.333ZM129.667,97H132V86.733a1.4,1.4,0,0,0-1.4-1.4H120.333v2.333h9.333Z"/><path d="M270.857,243.5l11.3-6.652V223.387l-11.3,6.361V243.5Zm-1.8,0v-13.75l-11.3-6.361v13.456l11.3,6.652Zm-10.278-21.621,11.177,6.284,11.177-6.284L269.958,215.3l-11.177,6.573Zm11.622-8.426,13.1,7.709a.919.919,0,0,1,.448.793v15.419a.926.926,0,0,1-.448.793l-13.1,7.709a.887.887,0,0,1-.9,0l-13.1-7.709a.905.905,0,0,1-.448-.793V221.954a.919.919,0,0,1,.448-.793l13.1-7.709A.887.887,0,0,1,270.4,213.452Z" transform="translate(-161.292 -120.997)"/></g></svg>',隐藏:'<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="currentColor"><path d="M61.274,76.178l0-.007-.007,0a32.458,32.458,0,0,0-7.014-9.981L51.53,68.91a28.382,28.382,0,0,1,6.124,8.635c-4.472,9.25-10.809,13.636-19.472,13.636A20.615,20.615,0,0,1,30.6,89.838l-2.937,2.933a23.916,23.916,0,0,0,10.514,2.277q15.472,0,23.088-16.116a3.229,3.229,0,0,0,0-2.755ZM57.839,58.351l-2.274-2.277a.429.429,0,0,0-.608,0l-6.265,6.262a23.775,23.775,0,0,0-10.51-2.281q-15.472,0-23.088,16.116v.007a3.236,3.236,0,0,0,0,2.765,32.617,32.617,0,0,0,7.014,9.985L16.7,94.32a.429.429,0,0,0,0,.608l2.274,2.277a.429.429,0,0,0,.608,0L57.839,58.949a.426.426,0,0,0,0-.6ZM32.113,78.915a6.011,6.011,0,0,1,7.22-7.22l-7.223,7.22Zm9.9-9.9A9.452,9.452,0,0,0,29.43,81.6l-4.6,4.6a28.424,28.424,0,0,1-6.124-8.635c4.475-9.25,10.816-13.636,19.472-13.636a20.615,20.615,0,0,1,7.577,1.343Zm-4.046,14.55a5.752,5.752,0,0,1-1.01-.086l-2.744,2.741A9.446,9.446,0,0,0,46.638,73.794L43.9,76.538a6.018,6.018,0,0,1-5.932,7.024Z" transform="translate(-14.182 -52.64)"/></svg>',重置:'<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48" fill="currentColor"><path d="M32.936,32.658a15.914,15.914,0,0,1-9.6,3.064c-.451-.006-.9-.042-1.342-.077-.182-.018-.357-.047-.539-.077-.352-.047-.7-.089-1.037-.164-.211-.036-.422-.1-.621-.148-.334-.077-.668-.154-.99-.254-.153-.059-.3-.11-.457-.177-.381-.124-.755-.26-1.113-.414-.082-.036-.162-.071-.24-.1-.422-.2-.844-.408-1.248-.627-.017-.012-.035-.018-.054-.03a16.485,16.485,0,0,1-3.732-2.9c-.017-.018-.035-.042-.054-.059-.34-.355-.668-.721-.979-1.118-.065-.083-.123-.16-.194-.254A17.286,17.286,0,0,1,7.149,18.751h3.98L6.318,9.076,0,18.874H3.942a20.809,20.809,0,0,0,3.5,11.57.871.871,0,0,0,.075.14c.225.34.486.648.724.961.1.113.177.232.274.362.354.443.746.869,1.133,1.285.043.043.075.076.108.113a19.778,19.778,0,0,0,4.436,3.446c.043.027.08.043.128.076.467.259.949.5,1.432.719.124.055.242.113.359.164.419.184.847.335,1.277.493.2.076.4.14.611.21.378.113.762.21,1.153.3.257.065.509.129.772.184a2.252,2.252,0,0,0,.316.076c.37.07.735.1,1.1.151.134.027.27.049.4.065.66.065,1.314.11,1.974.11,4.006,0,8.852-1.3,11.85-4.177a1.908,1.908,0,0,0,.333-2.484,2.228,2.228,0,0,0-2.952.023ZM44.053,20.424a20.728,20.728,0,0,0-3.47-11.537c-.032-.055-.054-.113-.08-.164-.284-.405-.574-.778-.869-1.161a1.289,1.289,0,0,1-.1-.14A19.86,19.86,0,0,0,32.168,1.7c-.086-.032-.155-.076-.242-.11-.456-.195-.922-.362-1.394-.53C30.37,1,30.2.937,30.033.883,29.62.754,29.212.651,28.792.548c-.231-.055-.467-.113-.7-.164-.113-.022-.22-.055-.338-.081-.311-.055-.617-.081-.933-.124C26.6.151,26.392.119,26.18.1,25.655.042,25.135.021,24.616.016c-.1,0-.188-.016-.284-.016-.016,0-.032.005-.049.005A19.124,19.124,0,0,0,13.02,3.695a1.682,1.682,0,0,0-.466,2.515,1.777,1.777,0,0,0,2.309.3A15.251,15.251,0,0,1,24.374,3.45c.486.006.971.03,1.441.077.147.012.287.036.432.059a11.3,11.3,0,0,1,1.16.189c.162.03.334.077.493.11.381.089.744.178,1.107.3a2.577,2.577,0,0,1,.34.124c.422.142.832.29,1.23.467.047.012.082.047.123.059a16.492,16.492,0,0,1,6.182,4.8.367.367,0,0,0,.024.036A17.308,17.308,0,0,1,40.629,20.43H36.645l5.048,9.787L48,20.424Zm0,0" transform="translate(0 4.349)"/></svg>',标高:'<svg width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M84.131,193.119a1.056,1.056,0,0,1,1.116.982v7.857a1.056,1.056,0,0,1-1.116.982H54.367a1.056,1.056,0,0,1-1.116-.982V194.1a1.056,1.056,0,0,1,1.116-.982Zm-1.116,1.964H55.483v5.893H83.015Zm1.116-13.749a1.064,1.064,0,0,1,1.114.935,1.032,1.032,0,0,1-1.007,1.025l-.107,0H71.2l-7.858,6.914a1.227,1.227,0,0,1-1.578,0l-8.185-7.2-.018-.016-.032-.031.049.047a1.107,1.107,0,0,1-.092-.092l-.011-.014a.869.869,0,0,1-.182-.857l0-.008L53.31,182l.012-.029.02-.045.019-.035a1.1,1.1,0,0,1,.891-.552h.007q.053,0,.107,0ZM68.043,183.3H57.06l5.492,4.831Z" transform="translate(-53.247 -176.136)"/></svg>',距离:'<svg width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M29.692,3.03,27.55.919a.529.529,0,0,1-.014-.756A.549.549,0,0,1,28.3.15l.014.013,3.067,3.023a.529.529,0,0,1,0,.756L28.317,6.966a.549.549,0,0,1-.767.013.529.529,0,0,1-.014-.756l.014-.013L29.692,4.1H2.31L4.452,6.21a.528.528,0,0,1,.013.756.547.547,0,0,1-.766.013l-.014-.013L.616,3.942a.531.531,0,0,1,0-.756L3.685.163a.548.548,0,0,1,.767.014.528.528,0,0,1,0,.742L2.31,3.03ZM24.136,15.055H23.051V18H21.966v-2.94H20.882V18H19.8v-2.94H18.712V18H17.627v-2.94H16.543v5.078H15.458V15.055H14.373V18H13.288v-2.94H12.2V18H11.119v-2.94H10.034V18H8.949v-2.94H7.865V18H6.78v-2.94H5.7v5.078H4.61V15.055H1.9a.27.27,0,0,0-.272.268v6.413A.269.269,0,0,0,1.9,22H30.1a.268.268,0,0,0,.271-.267V15.323a.269.269,0,0,0-.271-.268H27.39v5.078H26.305V15.055H25.221V18H24.136Zm5.966-1.6A1.884,1.884,0,0,1,32,15.323v6.413a1.885,1.885,0,0,1-1.9,1.871H1.9A1.885,1.885,0,0,1,0,21.736V15.323a1.885,1.885,0,0,1,1.9-1.871Z" transform="translate(0 4.197)"/></svg>',最小距离:'<svg width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M-5.839,24.8H-34.16A1.875,1.875,0,0,1-36,22.933V16.52a1.887,1.887,0,0,1,1.9-1.871H-5.9A1.887,1.887,0,0,1-4,16.52v6.412A1.875,1.875,0,0,1-5.839,24.8ZM-34.1,16.252a.27.27,0,0,0-.272.268v6.412a.27.27,0,0,0,.272.267H-5.9a.269.269,0,0,0,.271-.267V16.52a.27.27,0,0,0-.271-.268H-8.61V21.33H-9.695V16.252h-1.085v2.939h-1.085V16.252h-1.085v2.939h-1.085V16.252h-1.084v2.939H-16.2V16.252h-1.085v2.939h-1.085V16.252h-1.084V21.33h-1.084V16.252h-1.085v2.939h-1.085V16.252H-23.8v2.939h-1.085V16.252h-1.085v2.939h-1.085V16.252h-1.084v2.939H-29.22V16.252H-30.3V21.33H-31.39V16.252Z" transform="translate(36 2)"/><path fill="currentColor" d="M23.716,7.947V4.875c0-.8-.232-1.085-.765-1.085a1.573,1.573,0,0,0-1.133.585V7.947H20.4V2.75h1.163l.1.687H21.7a2.547,2.547,0,0,1,1.763-.817c1.172,0,1.676.78,1.676,2.089V7.947Zm-7.26,0V2.62h1.58V7.947Zm-3.8,0V4.875c0-.8-.243-1.085-.76-1.085a1.606,1.606,0,0,0-1.049.585V7.947H9.421V4.875c0-.8-.243-1.085-.758-1.085a1.608,1.608,0,0,0-1.05.585V7.947H6.194V2.75H7.36l.1.7H7.5A2.326,2.326,0,0,1,9.169,2.62a1.486,1.486,0,0,1,1.5.91A2.445,2.445,0,0,1,12.4,2.62c1.156,0,1.691.78,1.691,2.089V7.947Zm3.8-6.849a.79.79,0,0,1,1.58,0,.79.79,0,0,1-1.58,0Z" transform="translate(0.333 3.053)"/></svg>',激光边距:'<svg width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M0,1.293v31.96H32V1.293ZM30.97,32.182H1.03V2.323H30.97Z"/><path fill="currentColor" d="M160.026,291.9l1.6,1.6,7.305-7.305-7.305-7.305-1.6,1.6,4.794,4.566h-6.392v2.283h6.392Zm-5.251,0-4.566-4.566h6.164v-2.283H150.21l4.566-4.566-1.37-1.6L146.1,286.19l7.305,7.305Z" transform="translate(-141.535 -268.917)"/></svg>',角度:'<svg width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M39.587,50.766h13.7a1,1,0,0,1,0,2H23.171a1,1,0,0,1,0-2h1.418l6.582-7.006v-.006a.517.517,0,0,1,.14-.357.456.456,0,0,1,.337-.144l12.1-12.876a.451.451,0,0,1,.665,0,.524.524,0,0,1,0,.708L32.883,43.355a8.3,8.3,0,0,1,6.7,7.411Zm-.949,0a7.254,7.254,0,0,0-6.611-6.5l-6.108,6.5Z" transform="translate(-22.229 -26.489)"/></svg>',坡度:'<svg width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M202.1,188.337l2.629-2.191-8.447-3.106,1.533,8.871,2.629-2.194,9.341,11.209,1.656-1.379Zm-13.726-.435a1.075,1.075,0,0,0-1.07-.341,1.057,1.057,0,0,0-.5.277l-5.11,4.08a1.08,1.08,0,0,0-.406.84l-.007,17.386a1.079,1.079,0,0,0,1.077,1.077L205.7,211.2a1.078,1.078,0,0,0,.822-1.774Zm-4.934,21.164.007-15.788,3.968-3.171,15.974,18.941Z" transform="translate(-180.36 -181.131)"/></svg>',体积:'<svg width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M94.74,86.658V71.189a.371.371,0,0,1,.2-.329l13.869-7.22a.371.371,0,0,1,.344,0l13.053,6.891h0l.819.431a.371.371,0,0,1,.2.328v15.3a.371.371,0,0,1-.2.328l-13.872,7.255a.371.371,0,0,1-.342,0L94.94,86.987a.371.371,0,0,1-.2-.329Zm2.119-.837,11.2,5.8a.024.024,0,0,0,.035-.022V79.483a.371.371,0,0,0-.2-.328l-11.2-5.909a.024.024,0,0,0-.035.021V85.492A.371.371,0,0,0,96.859,85.821Zm13.151-6.459v12a.12.12,0,0,0,.176.106L114,89.474l3.334-1.745,3.771-1.978a.371.371,0,0,0,.2-.328V73.5a.193.193,0,0,0-.284-.171l-10.812,5.708A.371.371,0,0,0,110.01,79.362ZM97.925,71.725l10.839,5.72a.371.371,0,0,0,.346,0L119.8,71.808a.214.214,0,0,0,0-.378l-10.649-5.621a.371.371,0,0,0-.344,0L97.925,71.47A.144.144,0,0,0,97.925,71.725Z" transform="translate(-92.982 -62.907)"/></svg>',空间体积:'<svg width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M125.977,128.829l13.076-7.363v-13.6l-13.076,6.8Zm-3.126-15.655a.565.565,0,0,1-.258-.064L109.3,106.323a.567.567,0,0,1-.011-1L122.578,98a.567.567,0,0,1,.55,0l13.288,7.325a.567.567,0,0,1-.011,1l-13.292,6.79A.63.63,0,0,1,122.851,113.174ZM110.773,105.8l12.078,6.172,12.078-6.172-12.078-6.657Z" transform="translate(-1.922)"/><path fill="currentColor" d="M120.649,322.52a.58.58,0,0,1-.262-.064l-13.08-6.8a.573.573,0,0,1-.307-.5V301a.566.566,0,0,1,.273-.486.573.573,0,0,1,.558-.019l13.076,6.8a.573.573,0,0,1,.307.5v14.161a.57.57,0,0,1-.565.569Zm-12.511-7.708,11.942,6.206V308.136l-11.942-6.206Zm15.917,9.408a.585.585,0,0,1-.288-.076.567.567,0,0,1-.281-.489V309.49a.562.562,0,0,1,.307-.5l13.076-6.8a.573.573,0,0,1,.558.019.562.562,0,0,1,.273.486v13.6a.568.568,0,0,1-.288.493l-13.076,7.359A.557.557,0,0,1,124.055,324.22Zm.569-14.385V322.68l11.942-6.722V303.629Z" transform="translate(0 -194.822)"/></svg>',close:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z"/></svg>',check:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M9 16.17L4.83 12l-1.42 1.41L9 19L21 7l-1.41-1.41z"/></svg>',warning:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M1 21h22L12 2L1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/></svg>',error:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>',success:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5l1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>',plus:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>',minus:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M19 13H5v-2h14v2z"/></svg>',arrowUp:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6z"/></svg>',arrowDown:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6l-6-6z"/></svg>',arrowLeft:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M15.41 7.41L14 6l-6 6l6 6l1.41-1.41L10.83 12z"/></svg>',arrowRight:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M10 6L8.59 7.41L13.17 12l-4.58 4.59L10 18l6-6z"/></svg>',search:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5A6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5S14 7.01 14 9.5S11.99 14 9.5 14z"/></svg>',refresh:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/></svg>',delete:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>',edit:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83l3.75 3.75l1.83-1.83z"/></svg>',save:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M17 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3s3 1.34 3 3s-1.34 3-3 3zm3-10H5V5h10v4z"/></svg>',expand:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M16.59 8.59L12 13.17L7.41 8.59L6 10l6 6l6-6z"/></svg>',collapse:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 8l-6 6l1.41 1.41L12 10.83l4.59 4.58L18 14z"/></svg>',default:'<svg width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/></svg>'};function Tt(s){const e=rf[s];return e||(console.warn(`[IconManager] Icon "${s}" not found, using default icon`),rf.default)}const E2=[{id:"root",label:"全部构件",expanded:!0,clickAction:"expand",children:[{id:"level-1",label:"一层",expanded:!1,icon:'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M20.73 16.52V7.59a.7.7 0 0 0-.08-.33a.74.74 0 0 0-.36-.36l-8-3.58a.75.75 0 0 0-.62 0l-8 3.58a.8.8 0 0 0-.44.69v8.82a.83.83 0 0 0 .44.69l8 3.58a.72.72 0 0 0 .62 0l8-3.58a.77.77 0 0 0 .44-.58m-16-7.78l6.5 2.92v7.18l-6.5-2.91Zm8 2.92l6.5-2.92v7.19l-6.5 2.91ZM12 4.82l6.17 2.77L12 10.35L5.83 7.59Z"/></svg>',clickAction:"expand",children:[{id:"l1-wall",label:"墙体(128)"},{id:"l1-column",label:"柱(46)"},{id:"l1-beam",label:"梁(82)"},{id:"l1-slab",label:"楼板(12)"},{id:"l1-door",label:"门(24)"},{id:"l1-window",label:"窗(36)"}]},{id:"level-2",label:"二层",expanded:!1,clickAction:"expand",children:[{id:"l2-wall",label:"墙体(141)"},{id:"l2-column",label:"柱(52)"},{id:"l2-beam",label:"梁(90)"},{id:"l2-slab",label:"楼板(12)"},{id:"l2-door",label:"门(18)"},{id:"l2-window",label:"窗(40)"}]},{id:"level-3",label:"三层",expanded:!1,clickAction:"expand",children:[{id:"l3-wall",label:"墙体(136)"},{id:"l3-column",label:"柱(48)"},{id:"l3-beam",label:"梁(88)"},{id:"l3-slab",label:"楼板(12)"},{id:"l3-door",label:"门(16)"},{id:"l3-window",label:"窗(38)"}]},{id:"level-roof",label:"屋面层",expanded:!1,clickAction:"expand",children:[{id:"rf-slab",label:"屋面板(6)"},{id:"rf-beam",label:"屋面梁(24)"},{id:"rf-parapet",label:"女儿墙(18)"}]}]}];class T2 extends en{toolbar=null;toolbarContainer=null;container;dialog=null;constructor(e,t){super(e),this.container=t,this.init()}init(){this.toolbarContainer=document.createElement("div"),this.toolbarContainer.id="bim-construct-tree",this.container.appendChild(this.toolbarContainer),this.toolbar=new Va({container:this.toolbarContainer,showLabel:!1,direction:"column",position:"top-left",align:"vertical",expand:"up"}),this.toolbar.init(),this.toolbar.setEngine(this.engine),this.toolbar.addGroup("construct-tree"),this.toolbar.addButton({id:"construct-tree-btn",groupId:"construct-tree",type:"button",label:"construct-tree",icon:Tt("目录树"),onClick:()=>{this.openConstructTreeDialog()}}),this.toolbar.render()}openConstructTreeDialog(){this.setVisible(!1);const e=new S2({data:E2,checkable:!0,indent:0,enableSearch:!0,checkStrictly:!0,defaultExpandAll:!0,renderActions:o=>'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.5" d="m14.828 6.343l2.829 2.829m1.414-1.415L8.464 18.364l-3.535.707l.707-3.536L16.243 4.93a2 2 0 0 1 2.828 2.828Z"/></svg>',onNodeCheck:o=>{console.log("onNodeCheck",o)},onNodeSelect:o=>{console.log("onNodeSelect",o)},onNodeExpand:o=>{console.log("onNodeExpand",o),this.dialog?.fitWidth()}});e.init();const t=document.createElement("div");t.className="construct-tab__panel-content";const n=document.createElement("div");n.className="construct-tab__panel-content";const i=document.createElement("div");i.className="construct-tab__panel-content",i.appendChild(e.element);const r=document.createElement("div");r.className="construct-tab__container",r.style.height="100%",r.style.overflow="hidden";const a=new sf({container:r,tabs:[{id:"component",title:"tab.component",content:i},{id:"system",title:"tab.system",content:t},{id:"space",title:"tab.space",content:n}],activeId:"component",onChange:()=>{this.dialog?.fitWidth()}});a.init(),this.dialog=this.engine.dialog.create({title:"constructTree.title",minWidth:320,height:420,content:r,position:{x:20,y:20},resizable:!1,onClose:()=>{a.destroy(),e.destroy(),this.setVisible(!0)}}),this.dialog?.fitWidth()}refresh(){this.toolbar?.render()}destroy(){this.toolbar?.destroy(),this.toolbar=null}addGroup(e,t){this.toolbar?.addGroup(e,t),this.toolbar?.render()}addButton(e){this.toolbar?.addButton(e),this.toolbar?.render()}setButtonVisibility(e,t){this.toolbar?.updateButtonVisibility(e,t)}setShowLabel(e){this.toolbar?.setShowLabel(e)}setVisible(e){this.toolbarContainer&&(this.toolbarContainer.style.visibility=e?"visible":"hidden")}setBackgroundColor(e){this.toolbar?.setBackgroundColor(e)}setColors(e){this.toolbar?.setColors(e)}}class C2{element;headerEl;contentEl;contentBoxEl;arrowEl;titleEl;config;parent;constructor(e,t){this.config=e,this.parent=t,this.element=this.createDom()}createDom(){const e=document.createElement("div");if(e.className=`bim-collapse-item ${this.config.className||""}`,this.config.disabled&&e.classList.add("is-disabled"),e.dataset.id=this.config.id,this.headerEl=document.createElement("div"),this.headerEl.className="bim-collapse-header",this.arrowEl=document.createElement("span"),this.arrowEl.className="bim-collapse-arrow",this.arrowEl.innerHTML='<svg viewBox="0 0 1024 1024"><path d="M288 192l448 320-448 320z"></path></svg>',this.headerEl.appendChild(this.arrowEl),this.config.icon){const t=document.createElement("span");t.className="bim-collapse-icon",t.innerHTML=this.config.icon,this.headerEl.appendChild(t)}if(this.titleEl=document.createElement("span"),this.titleEl.className="bim-collapse-title",this.titleEl.textContent=Ae(this.config.title),this.headerEl.appendChild(this.titleEl),this.config.extra){const t=document.createElement("div");t.className="bim-collapse-extra",typeof this.config.extra=="string"?t.innerHTML=this.config.extra:t.appendChild(this.config.extra),this.headerEl.appendChild(t)}return this.headerEl.addEventListener("click",()=>{this.config.disabled||this.parent.toggleItem(this.config.id)}),e.appendChild(this.headerEl),this.contentEl=document.createElement("div"),this.contentEl.className="bim-collapse-content is-hidden",this.contentBoxEl=document.createElement("div"),this.contentBoxEl.className="bim-collapse-content-box",typeof this.config.content=="string"?this.contentBoxEl.innerHTML=this.config.content:this.contentBoxEl.appendChild(this.config.content),this.contentEl.appendChild(this.contentBoxEl),e.appendChild(this.contentEl),e}updateLocale(){this.titleEl&&(this.titleEl.textContent=Ae(this.config.title))}setActive(e){e?(this.element.classList.add("is-active"),this.contentEl.classList.remove("is-hidden")):(this.element.classList.remove("is-active"),this.contentEl.classList.add("is-hidden"))}}class af{element;options;items=new Map;activeIds=new Set;unsubscribeLocale=null;unsubscribeTheme=null;constructor(e){this.options={bordered:!0,accordion:!1,...e},this.element=document.createElement("div"),this.element.className=`bim-collapse ${this.options.className||""}`,this.options.bordered||(this.element.style.border="none"),this.options.ghost&&this.element.classList.add("is-ghost");const t=typeof this.options.container=="string"?document.getElementById(this.options.container):this.options.container;t&&t.appendChild(this.element),this.options.activeIds&&this.options.activeIds.forEach(n=>this.activeIds.add(n)),this.init()}init(){this.options.items.forEach(e=>{const t=new C2(e,this);this.items.set(e.id,t),this.element.appendChild(t.element),this.activeIds.has(e.id)&&t.setActive(!0)}),this.unsubscribeLocale=Ht.subscribe(()=>{this.setLocales()}),this.unsubscribeTheme=st.subscribe(e=>{this.setTheme(e)}),this.setTheme(st.getTheme())}toggleItem(e){const t=this.activeIds.has(e);this.options.accordion?(this.activeIds.clear(),t||this.activeIds.add(e)):t?this.activeIds.delete(e):this.activeIds.add(e),this.refreshState(),this.options.onChange&&this.options.onChange(Array.from(this.activeIds))}refreshState(){this.items.forEach((e,t)=>{e.setActive(this.activeIds.has(t))})}setTheme(e){const t=this.element.style;t.setProperty("--bim-bg-color",e.bgElevated),t.setProperty("--bim-border-color",e.borderDefault),t.setProperty("--bim-text-color",e.textPrimary),t.setProperty("--bim-header-bg-color",e.componentBgHover),t.setProperty("--bim-header-hover-bg-color",e.componentBgActive),t.setProperty("--bim-content-bg-color",e.bgElevated),t.setProperty("--bim-disabled-color",e.textDisabled)}setLocales(){this.items.forEach(e=>e.updateLocale())}destroy(){this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.element.remove(),this.items.clear()}}class Ac{element;options;unsubscribeTheme=null;constructor(e){this.options={bordered:!1,...e},this.element=this.createDom();const t=typeof this.options.container=="string"?document.getElementById(this.options.container):this.options.container;t&&t.appendChild(this.element),this.init()}init(){this.applyCustomStyles(),this.renderItems(),this.unsubscribeTheme=st.subscribe(e=>{this.setTheme(e)}),this.setTheme(st.getTheme())}createDom(){const e=document.createElement("div");return e.className=`bim-description ${this.options.className||""}`,this.options.bordered&&e.classList.add("is-bordered"),e}applyCustomStyles(){const e=this.element.style;this.options.fontSize&&e.setProperty("--bim-desc-font-size",this.options.fontSize),this.options.labelColor&&e.setProperty("--bim-desc-label-color",this.options.labelColor),this.options.valueColor&&e.setProperty("--bim-desc-value-color",this.options.valueColor),this.options.labelPadding&&e.setProperty("--bim-desc-label-padding",this.options.labelPadding),this.options.valuePadding&&e.setProperty("--bim-desc-value-padding",this.options.valuePadding)}renderItems(){this.element.innerHTML="",this.options.items.forEach(e=>{const t=document.createElement("div");t.className=`bim-description-item ${e.className||""}`;const n=document.createElement("div");n.className="bim-description-label",e.labelColor&&(n.style.color=e.labelColor),this.options.labelWidth&&(n.style.width=this.options.labelWidth),n.textContent=this.options.bordered?e.label:e.label+":";const i=document.createElement("div");i.className="bim-description-value",e.valueColor&&(i.style.color=e.valueColor),typeof e.value=="string"?i.innerHTML=e.value:i.appendChild(e.value),t.appendChild(n),t.appendChild(i),this.element.appendChild(t)})}setItems(e){this.options.items=e,this.renderItems()}setTheme(e){const t=this.element.style;t.setProperty("--bim-text-color",e.textPrimary),t.setProperty("--bim-label-color",e.textSecondary),t.setProperty("--bim-value-color",e.textPrimary),t.setProperty("--bim-border-color",e.borderDefault)}setLocales(){}destroy(){this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.element.remove()}}class A2 extends en{dialogId="property-panel-dialog";dialog=null;constructor(e){super(e)}init(){document.addEventListener("bim-demo:open-property-panel",()=>{this.show()})}show(){if(!this.engine.dialog){console.warn("Dialog manager is not initialized");return}if(this.isOpen())return;const e=360,t=document.body.clientWidth-e-40;console.log("x",t),this.dialog=this.engine.dialog.create({id:this.dialogId,title:"panel.property.title",content:"",width:`${e}px`,height:"500px",position:{x:t,y:20},showMask:!1,resizable:!0,onClose:()=>{this.hide()}});const n=document.createElement("div");n.style.height="100%",n.style.display="flex",n.style.flexDirection="column",this.dialog.setContent(n),new sf({container:n,tabs:[{id:"props",title:"panel.property.tab.props",content:this.createPropsTabContent()},{id:"material",title:"panel.property.tab.material",content:this.createMaterialTabContent()}]}).init()}createPropsTabContent(){const e=document.createElement("div");return e.style.height="100%",e.style.overflowY="auto",new af({container:e,accordion:!0,activeIds:["base","location"],items:[{id:"base",title:"panel.property.base",content:this.createBaseInfoContent()},{id:"advanced",title:"panel.property.advanced",content:this.createAdvancedInfoContent(),disabled:!1}]}),e}createMaterialTabContent(){const e=document.createElement("div");return e.style.height="100%",e.style.overflowY="auto",new af({container:e,accordion:!0,activeIds:["material"],items:[{id:"material",title:"panel.property.material",content:this.createMaterialContent()}]}),e}createBaseInfoContent(){const e=document.createElement("div");return new Ac({container:e,labelWidth:"80px",bordered:!0,items:[{label:"Guid",value:'<span style="color:#666">1f8d-4a2e-9c</span>'},{label:"Name",value:"<b>Basic Wall: Generic - 200mm</b>"},{label:"Type",value:"Basic Wall"},{label:"Level",value:"Trane - Centrifugal Water Chiller - CVHF 2 Stage direct drive TAG(BP-RHS-1100RT) 0202104531 1"}]}),e}createAdvancedInfoContent(){const e=document.createElement("div");return new Ac({container:e,labelWidth:"100px",bordered:!0,items:[{label:"Area",value:"32.5 m²"},{label:"Volume",value:"6.5 m³"},{label:"Length",value:"5000 mm"},{label:"Phase",value:"New Construction"}]}),e}createMaterialContent(){const e=document.createElement("div"),t=document.createElement("div");t.style.display="flex",t.style.alignItems="center",t.style.marginBottom="4px",t.innerHTML=`
|
||
<div style="width:24px;height:24px;background:#9ca3af;margin-right:8px;border:1px solid #6b7280;border-radius:2px;"></div>
|
||
<span>Concrete - Cast-in-Place Gray</span>
|
||
`;const n=document.createElement("div");return new Ac({container:n,items:[{label:"Preview",value:t},{label:"Class",value:"Concrete"},{label:"Density",value:"2400 kg/m³"},{label:"Thermal",value:"0.6 W/(m·K)"}]}),e.appendChild(n),e}isOpen(){return this.dialog!==null}hide(){this.dialog&&(this.dialog.destroy(),this.dialog=null)}destroy(){this.hide()}}const P2={distance:'<svg viewBox="0 0 32 32" aria-hidden="true"><g transform="translate(0 4.197)"><path fill="currentColor" d="M29.692,3.03,27.55.919a.529.529,0,0,1-.014-.756A.549.549,0,0,1,28.3.15l.014.013,3.067,3.023a.529.529,0,0,1,0,.756L28.317,6.966a.549.549,0,0,1-.767.013.529.529,0,0,1-.014-.756l.014-.013L29.692,4.1H2.31L4.452,6.21a.528.528,0,0,1,.013.756.547.547,0,0,1-.766.013l-.014-.013L.616,3.942a.531.531,0,0,1,0-.756L3.685.163a.548.548,0,0,1,.767.014.528.528,0,0,1,0,.742L2.31,3.03ZM24.136,15.055H23.051V18H21.966v-2.94H20.882V18H19.8v-2.94H18.712V18H17.627v-2.94H16.543v5.078H15.458V15.055H14.373V18H13.288v-2.94H12.2V18H11.119v-2.94H10.034V18H8.949v-2.94H7.865V18H6.78v-2.94H5.7v5.078H4.61V15.055H1.9a.27.27,0,0,0-.272.268v6.413A.269.269,0,0,0,1.9,22H30.1a.268.268,0,0,0,.271-.267V15.323a.269.269,0,0,0-.271-.268H27.39v5.078H26.305V15.055H25.221V18H24.136Zm5.966-1.6A1.884,1.884,0,0,1,32,15.323v6.413a1.885,1.885,0,0,1-1.9,1.871H1.9A1.885,1.885,0,0,1,0,21.736V15.323a1.885,1.885,0,0,1,1.9-1.871Z"/></g></svg>',minDistance:'<svg viewBox="0 0 32 32" aria-hidden="true"><path fill="currentColor" d="M-5.839,24.8H-34.16A1.875,1.875,0,0,1-36,22.933V16.52a1.887,1.887,0,0,1,1.9-1.871H-5.9A1.887,1.887,0,0,1-4,16.52v6.412A1.875,1.875,0,0,1-5.839,24.8ZM-34.1,16.252a.27.27,0,0,0-.272.268v6.412a.27.27,0,0,0,.272.267H-5.9a.269.269,0,0,0,.271-.267V16.52a.27.27,0,0,0-.271-.268H-8.61V21.33H-9.695V16.252h-1.085v2.939h-1.085V16.252h-1.085v2.939h-1.085V16.252h-1.084v2.939H-16.2V16.252h-1.085v2.939h-1.085V16.252h-1.084V21.33h-1.084V16.252h-1.085v2.939h-1.085V16.252H-23.8v2.939h-1.085V16.252h-1.085v2.939h-1.085V16.252h-1.084v2.939H-29.22V16.252H-30.3V21.33H-31.39V16.252Z" transform="translate(36 2)"/><path fill="currentColor" d="M23.716,7.947V4.875c0-.8-.232-1.085-.765-1.085a1.573,1.573,0,0,0-1.133.585V7.947H20.4V2.75h1.163l.1.687H21.7a2.547,2.547,0,0,1,1.763-.817c1.172,0,1.676.78,1.676,2.089V7.947Zm-7.26,0V2.62h1.58V7.947Zm-3.8,0V4.875c0-.8-.243-1.085-.76-1.085a1.606,1.606,0,0,0-1.049.585V7.947H9.421V4.875c0-.8-.243-1.085-.758-1.085a1.608,1.608,0,0,0-1.05.585V7.947H6.194V2.75H7.36l.1.7H7.5A2.326,2.326,0,0,1,9.169,2.62a1.486,1.486,0,0,1,1.5.91A2.445,2.445,0,0,1,12.4,2.62c1.156,0,1.691.78,1.691,2.089V7.947Zm3.8-6.849a.79.79,0,0,1,1.58,0,.79.79,0,0,1-1.58,0Z" transform="translate(0.333 3.053)"/></svg>',angle:'<svg viewBox="0 0 32 32" aria-hidden="true"><path fill="currentColor" d="M39.587,50.766h13.7a1,1,0,0,1,0,2H23.171a1,1,0,0,1,0-2h1.418l6.582-7.006v-.006a.517.517,0,0,1,.14-.357.456.456,0,0,1,.337-.144l12.1-12.876a.451.451,0,0,1,.665,0,.524.524,0,0,1,0,.708L32.883,43.355a8.3,8.3,0,0,1,6.7,7.411Zm-.949,0a7.254,7.254,0,0,0-6.611-6.5l-6.108,6.5Z" transform="translate(-22.229 -26.489)"/></svg>',elevation:'<svg viewBox="0 0 32 32" aria-hidden="true"><path fill="currentColor" d="M84.131,193.119a1.056,1.056,0,0,1,1.116.982v7.857a1.056,1.056,0,0,1-1.116.982H54.367a1.056,1.056,0,0,1-1.116-.982V194.1a1.056,1.056,0,0,1,1.116-.982Zm-1.116,1.964H55.483v5.893H83.015Zm1.116-13.749a1.064,1.064,0,0,1,1.114.935,1.032,1.032,0,0,1-1.007,1.025l-.107,0H71.2l-7.858,6.914a1.227,1.227,0,0,1-1.578,0l-8.185-7.2-.018-.016-.032-.031.049.047a1.107,1.107,0,0,1-.092-.092l-.011-.014a.869.869,0,0,1-.182-.857l0-.008L53.31,182l.012-.029.02-.045.019-.035a1.1,1.1,0,0,1,.891-.552h.007q.053,0,.107,0ZM68.043,183.3H57.06l5.492,4.831Z" transform="translate(-53.247 -176.136)"/></svg>',volume:'<svg viewBox="0 0 32 32" aria-hidden="true"><path fill="currentColor" d="M94.74,86.658V71.189a.371.371,0,0,1,.2-.329l13.869-7.22a.371.371,0,0,1,.344,0l13.053,6.891h0l.819.431a.371.371,0,0,1,.2.328v15.3a.371.371,0,0,1-.2.328l-13.872,7.255a.371.371,0,0,1-.342,0L94.94,86.987a.371.371,0,0,1-.2-.329Zm2.119-.837,11.2,5.8a.024.024,0,0,0,.035-.022V79.483a.371.371,0,0,0-.2-.328l-11.2-5.909a.024.024,0,0,0-.035.021V85.492A.371.371,0,0,0,96.859,85.821Zm13.151-6.459v12a.12.12,0,0,0,.176.106L114,89.474l3.334-1.745,3.771-1.978a.371.371,0,0,0,.2-.328V73.5a.193.193,0,0,0-.284-.171l-10.812,5.708A.371.371,0,0,0,110.01,79.362ZM97.925,71.725l10.839,5.72a.371.371,0,0,0,.346,0L119.8,71.808a.214.214,0,0,0,0-.378l-10.649-5.621a.371.371,0,0,0-.344,0L97.925,71.47A.144.144,0,0,0,97.925,71.725Z" transform="translate(-92.982 -62.907)"/></svg>',laserDistance:'<svg viewBox="0 0 32 32" aria-hidden="true"><g transform="translate(0 -1.293)"><path fill="currentColor" d="M0,1.293v31.96H32V1.293ZM30.97,32.182H1.03V2.323H30.97Z"/><path fill="currentColor" d="M160.026,291.9l1.6,1.6,7.305-7.305-7.305-7.305-1.6,1.6,4.794,4.566h-6.392v2.283h6.392Zm-5.251,0-4.566-4.566h6.164v-2.283H150.21l4.566-4.566-1.37-1.6L146.1,286.19l7.305,7.305Z" transform="translate(-141.535 -268.917)"/></g></svg>',slope:'<svg viewBox="0 0 32 32" aria-hidden="true"><path fill="currentColor" d="M202.1,188.337l2.629-2.191-8.447-3.106,1.533,8.871,2.629-2.194,9.341,11.209,1.656-1.379Zm-13.726-.435a1.075,1.075,0,0,0-1.07-.341,1.057,1.057,0,0,0-.5.277l-5.11,4.08a1.08,1.08,0,0,0-.406.84l-.007,17.386a1.079,1.079,0,0,0,1.077,1.077L205.7,211.2a1.078,1.078,0,0,0,.822-1.774Zm-4.934,21.164.007-15.788,3.968-3.171,15.974,18.941Z" transform="translate(-180.36 -181.131)"/></svg>',spaceVolume:'<svg viewBox="0 0 32 32" aria-hidden="true"><g transform="translate(-106.35 -97.661)"><path fill="currentColor" d="M125.977,128.829l13.076-7.363v-13.6l-13.076,6.8Zm-3.126-15.655a.565.565,0,0,1-.258-.064L109.3,106.323a.567.567,0,0,1-.011-1L122.578,98a.567.567,0,0,1,.55,0l13.288,7.325a.567.567,0,0,1-.011,1l-13.292,6.79A.63.63,0,0,1,122.851,113.174ZM110.773,105.8l12.078,6.172,12.078-6.172-12.078-6.657Z" transform="translate(-1.922)"/><path fill="currentColor" d="M120.649,322.52a.58.58,0,0,1-.262-.064l-13.08-6.8a.573.573,0,0,1-.307-.5V301a.566.566,0,0,1,.273-.486.573.573,0,0,1,.558-.019l13.076,6.8a.573.573,0,0,1,.307.5v14.161a.57.57,0,0,1-.565.569Zm-12.511-7.708,11.942,6.206V308.136l-11.942-6.206Zm15.917,9.408a.585.585,0,0,1-.288-.076.567.567,0,0,1-.281-.489V309.49a.562.562,0,0,1,.307-.5l13.076-6.8a.573.573,0,0,1,.558.019.562.562,0,0,1,.273.486v13.6a.568.568,0,0,1-.288.493l-13.076,7.359A.557.557,0,0,1,124.055,324.22Zm.569-14.385V322.68l11.942-6.722V303.629Z" transform="translate(0 -194.822)"/></g></svg>'};class xr{element;options;activeMode;isExpanded;result=null;config;draftConfig=null;view="main";static CONFIG_CACHE_KEY="bim-engine:measure:config";static DEFAULT_CONFIG={unit:"mm",precision:2};toolButtons=new Map;toggleBtn;toggleTextEl;mainValueValueEl;mainValueLabelEl;mainNumberEl;mainUnitEl;xyzBoxEl;xyzXEl;xyzYEl;xyzZEl;clearBtn;settingsBtn;mainViewEl;settingsViewEl;unitSelectEl;precisionSelectEl;saveSettingsBtn;cancelSettingsBtn;unsubscribeLocale=null;unsubscribeTheme=null;constructor(e={}){this.options=e,this.activeMode=e.defaultMode??"distance",this.isExpanded=e.defaultExpanded??!1,this.config=this.loadConfigFromCache()??{...xr.DEFAULT_CONFIG},this.element=this.createDom()}init(){this.unsubscribeLocale=Ht.subscribe(()=>{this.setLocales()}),this.unsubscribeTheme=st.subscribe(e=>{this.setTheme(e)}),this.setLocales(),this.setTheme(st.getTheme()),this.applyExpandedState(),this.applyActiveModeState(),this.applyViewState(),this.renderResult(),this.options.onModeChange&&this.options.onModeChange(this.activeMode)}setTheme(e){const t=this.element.style;t.setProperty("--bim-measure-border",e.borderDefault??"rgba(255, 255, 255, 0.12)"),t.setProperty("--bim-measure-divider",e.borderDefault??"rgba(255, 255, 255, 0.10)"),t.setProperty("--bim-measure-icon-color",e.iconDefault??"#ddd"),t.setProperty("--bim-measure-label-color",e.textSecondary??"rgba(255, 255, 255, 0.70)"),t.setProperty("--bim-measure-value-color",e.textPrimary??"rgba(255, 255, 255, 0.90)"),t.setProperty("--bim-measure-danger",e.primary??"#46d369"),t.setProperty("--bim-measure-primary",e.primary??"#0078d4"),t.setProperty("--bim-measure-primary-hover",e.primaryHover??"#0063b1"),t.setProperty("--bim-measure-btn-bg",e.componentBg??"rgba(255, 255, 255, 0.06)"),t.setProperty("--bim-measure-btn-hover-bg",e.componentBgHover??"rgba(255, 255, 255, 0.10)"),t.setProperty("--bim-measure-btn-active-bg",e.componentBgActive??"rgba(255, 255, 255, 0.14)")}setLocales(){for(const[t,n]of this.toolButtons.entries())n.title=Ae(this.getModeI18nKey(t)),n.setAttribute("aria-label",n.title);this.toggleBtn.title=this.isExpanded?Ae("measure.actions.collapse"):Ae("measure.actions.expand"),this.toggleBtn.setAttribute("aria-label",this.toggleBtn.title),this.toggleTextEl&&(this.toggleTextEl.textContent=this.toggleBtn.title),this.clearBtn.textContent=Ae("measure.actions.clearAll"),this.settingsBtn.title=Ae("measure.actions.settings"),this.settingsBtn.setAttribute("aria-label",this.settingsBtn.title),this.mainValueLabelEl.textContent=Ae(this.getModeValueLabelI18nKey(this.activeMode)),this.element.querySelectorAll("[data-i18n-key]").forEach(t=>{const n=t.dataset.i18nKey;n&&(t.textContent=Ae(n))}),this.saveSettingsBtn.textContent=Ae("measure.settings.save"),this.cancelSettingsBtn.textContent=Ae("measure.settings.cancel")}destroy(){this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.element.remove()}getActiveMode(){return this.activeMode}switchMode(e){this.setActiveMode(e)}setActiveMode(e){this.activeMode!==e&&(this.activeMode=e,this.applyActiveModeState(),this.mainValueLabelEl.textContent=Ae(this.getModeValueLabelI18nKey(this.activeMode)),this.options.onModeChange&&this.options.onModeChange(e),this.renderResult(),this.options.onExpandedChange&&this.options.onExpandedChange(this.isExpanded))}setResult(e){this.result=e,this.renderResult()}clearAll(){this.result=null,this.renderResult(),this.options.onClearAll&&this.options.onClearAll()}openSettings(){this.enterSettingsView(),this.options.onSettings&&this.options.onSettings()}getConfig(){return{...this.config}}setConfig(e,t=!1){const n={unit:e.unit??this.config.unit,precision:e.precision??this.config.precision};this.config=n,t&&this.saveConfigToCache(n),this.renderResult(),this.view==="settings"&&this.syncSettingsFormFromConfig(n)}setExpanded(e){this.isExpanded!==e&&(this.isExpanded=e,this.applyExpandedState(),this.setLocales(),this.options.onExpandedChange&&this.options.onExpandedChange(this.isExpanded))}getExpanded(){return this.isExpanded}createDom(){const e=document.createElement("div");e.className="bim-measure-panel",this.mainViewEl=document.createElement("div"),this.mainViewEl.className="bim-measure-main";const t=document.createElement("div");t.className="bim-measure-tools";const n=document.createElement("div");n.className="bim-measure-tool-grid";const i=["distance","minDistance","angle","elevation","volume","laserDistance","slope","spaceVolume"],r=`
|
||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||
<circle cx="12" cy="12" r="9"></circle>
|
||
</svg>
|
||
`;for(let g=0;g<i.length;g++){const v=i[g],m=document.createElement("button");m.type="button",m.className="bim-measure-tool-btn",m.dataset.mode=v;const x=document.createElement("span");x.className="bim-measure-tool-icon",x.innerHTML=P2[v]||r,m.appendChild(x),m.addEventListener("click",()=>{this.setActiveMode(v)}),this.toolButtons.set(v,m),n.appendChild(m)}t.appendChild(n);const a=document.createElement("div");a.className="bim-measure-toggle",this.toggleBtn=document.createElement("button"),this.toggleBtn.type="button",this.toggleBtn.className="bim-measure-toggle-btn",this.toggleTextEl=document.createElement("span"),this.toggleTextEl.className="bim-measure-toggle-text";const o=document.createElement("span");o.className="bim-measure-toggle-icon",o.innerHTML=`
|
||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||
<path d="M7 10l5 5 5-5z"></path>
|
||
</svg>
|
||
`,this.toggleBtn.appendChild(this.toggleTextEl),this.toggleBtn.appendChild(o),this.toggleBtn.addEventListener("click",()=>{this.isExpanded=!this.isExpanded,this.applyExpandedState(),this.setLocales(),this.options.onExpandedChange&&this.options.onExpandedChange(this.isExpanded)}),a.appendChild(this.toggleBtn),t.appendChild(a),this.mainViewEl.appendChild(t);const l=document.createElement("div");l.className="bim-measure-result";const c=document.createElement("div");c.className="bim-measure-row";const h=document.createElement("span");h.className="label",this.mainValueLabelEl=h;const u=document.createElement("span");u.className="value",this.mainValueValueEl=u,this.mainNumberEl=document.createElement("span"),this.mainNumberEl.className="bim-measure-main-number",this.mainUnitEl=document.createElement("span"),this.mainUnitEl.className="bim-measure-main-unit",this.mainValueValueEl.appendChild(this.mainNumberEl),this.mainValueValueEl.appendChild(document.createTextNode(" ")),this.mainValueValueEl.appendChild(this.mainUnitEl),c.appendChild(h),c.appendChild(u),l.appendChild(c);const f=document.createElement("div");f.className="bim-measure-xyz",this.xyzBoxEl=f;const d=(g,v,m)=>{const x=document.createElement("div");x.className="bim-measure-row";const _=document.createElement("span");_.className="label",_.dataset.i18nKey=g;const M=document.createElement("span");return M.className=`value ${v}`,m(M),x.appendChild(_),x.appendChild(M),x};f.appendChild(d("measure.labels.x","bim-measure-xyz-x",g=>this.xyzXEl=g)),f.appendChild(d("measure.labels.y","bim-measure-xyz-y",g=>this.xyzYEl=g)),f.appendChild(d("measure.labels.z","bim-measure-xyz-z",g=>this.xyzZEl=g)),l.appendChild(f),this.mainViewEl.appendChild(l);const p=document.createElement("div");return p.className="bim-measure-footer",this.clearBtn=document.createElement("button"),this.clearBtn.type="button",this.clearBtn.className="bim-measure-clear-btn",this.clearBtn.addEventListener("click",()=>{this.clearAll()}),this.settingsBtn=document.createElement("button"),this.settingsBtn.type="button",this.settingsBtn.className="bim-measure-settings-btn",this.settingsBtn.innerHTML=`
|
||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||
<path d="M19.14 12.94c.04-.31.06-.63.06-.94s-.02-.63-.06-.94l2.03-1.58a.5.5 0 0 0 .12-.64l-1.92-3.32a.5.5 0 0 0-.6-.22l-2.39.96a7.27 7.27 0 0 0-1.63-.94l-.36-2.54A.5.5 0 0 0 13.9 1h-3.8a.5.5 0 0 0-.49.42l-.36 2.54c-.58.23-1.12.54-1.63.94l-2.39-.96a.5.5 0 0 0-.6.22L2.71 7.48a.5.5 0 0 0 .12.64l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94L2.83 14.52a.5.5 0 0 0-.12.64l1.92 3.32c.13.22.39.3.6.22l2.39-.96c.5.4 1.05.71 1.63.94l.36 2.54c.04.24.25.42.49.42h3.8c.24 0 .45-.18.49-.42l.36-2.54c.58-.23 1.12-.54 1.63-.94l2.39.96c.22.09.47 0 .6-.22l1.92-3.32a.5.5 0 0 0-.12-.64l-2.03-1.58zM12 15.5A3.5 3.5 0 1 1 12 8a3.5 3.5 0 0 1 0 7.5z"></path>
|
||
</svg>
|
||
`,this.settingsBtn.addEventListener("click",()=>{this.openSettings()}),p.appendChild(this.clearBtn),p.appendChild(this.settingsBtn),this.mainViewEl.appendChild(p),this.settingsViewEl=this.createSettingsDom(),e.appendChild(this.mainViewEl),e.appendChild(this.settingsViewEl),e}createSettingsDom(){const e=document.createElement("div");e.className="bim-measure-settings";const t=document.createElement("div");t.className="bim-measure-settings-title",t.dataset.i18nKey="measure.settings.title",e.appendChild(t);const n=document.createElement("div");n.className="bim-measure-settings-row";const i=document.createElement("div");i.className="label",i.dataset.i18nKey="measure.settings.unit",this.unitSelectEl=document.createElement("select"),this.unitSelectEl.className="bim-measure-settings-select",this.unitSelectEl.appendChild(this.makeOption("m")),this.unitSelectEl.appendChild(this.makeOption("cm")),this.unitSelectEl.appendChild(this.makeOption("mm")),this.unitSelectEl.appendChild(this.makeOption("km")),n.appendChild(i),n.appendChild(this.unitSelectEl),e.appendChild(n);const r=document.createElement("div");r.className="bim-measure-settings-hint",r.dataset.i18nKey="measure.settings.hint",e.appendChild(r);const a=document.createElement("div");a.className="bim-measure-settings-row";const o=document.createElement("div");o.className="label",o.dataset.i18nKey="measure.settings.precision",this.precisionSelectEl=document.createElement("select"),this.precisionSelectEl.className="bim-measure-settings-select",this.precisionSelectEl.appendChild(this.makePrecisionOption(0)),this.precisionSelectEl.appendChild(this.makePrecisionOption(1)),this.precisionSelectEl.appendChild(this.makePrecisionOption(2)),this.precisionSelectEl.appendChild(this.makePrecisionOption(3)),a.appendChild(o),a.appendChild(this.precisionSelectEl),e.appendChild(a);const l=document.createElement("div");return l.className="bim-measure-settings-actions",this.saveSettingsBtn=document.createElement("button"),this.saveSettingsBtn.type="button",this.saveSettingsBtn.className="bim-measure-settings-save",this.saveSettingsBtn.addEventListener("click",()=>{this.saveSettings()}),this.cancelSettingsBtn=document.createElement("button"),this.cancelSettingsBtn.type="button",this.cancelSettingsBtn.className="bim-measure-settings-cancel",this.cancelSettingsBtn.addEventListener("click",()=>{this.cancelSettings()}),l.appendChild(this.saveSettingsBtn),l.appendChild(this.cancelSettingsBtn),e.appendChild(l),this.syncSettingsFormFromConfig(this.config),e}makeOption(e){const t=document.createElement("option");return t.value=e,t.textContent=e,t}makePrecisionOption(e){const t=document.createElement("option");return t.value=String(e),t.textContent=e===0?"0":`0.${"0".repeat(e)}`,t}enterSettingsView(){this.draftConfig={...this.config},this.view="settings",this.syncSettingsFormFromConfig(this.config),this.applyViewState()}saveSettings(){const e=this.unitSelectEl.value||this.config.unit,t=Number(this.precisionSelectEl.value),n={unit:e,precision:this.isValidPrecision(t)?t:this.config.precision};this.config=n,this.saveConfigToCache(n),this.draftConfig=null,this.view="main",this.applyViewState(),this.renderResult(),this.options.onExpandedChange&&this.options.onExpandedChange(this.isExpanded)}cancelSettings(){this.draftConfig&&(this.config={...this.draftConfig}),this.draftConfig=null,this.view="main",this.applyViewState(),this.renderResult(),this.options.onExpandedChange&&this.options.onExpandedChange(this.isExpanded)}syncSettingsFormFromConfig(e){this.unitSelectEl.value=e.unit,this.precisionSelectEl.value=String(e.precision)}applyViewState(){this.view==="settings"?(this.mainViewEl.style.display="none",this.settingsViewEl.style.display="block"):(this.mainViewEl.style.display="block",this.settingsViewEl.style.display="none")}loadConfigFromCache(){try{const e=localStorage.getItem(xr.CONFIG_CACHE_KEY);if(!e)return null;const t=JSON.parse(e);if(!t||typeof t!="object")return null;const n=t.unit,i=t.precision;return!this.isValidUnit(n)||!this.isValidPrecision(i)?null:{unit:n,precision:i}}catch{return null}}saveConfigToCache(e){try{localStorage.setItem(xr.CONFIG_CACHE_KEY,JSON.stringify(e))}catch{}}isValidUnit(e){return e==="m"||e==="cm"||e==="mm"||e==="km"}isValidPrecision(e){return e===0||e===1||e===2||e===3}applyExpandedState(){let e=0;for(const t of this.toolButtons.values())e>=4?t.style.display=this.isExpanded?"":"none":t.style.display="",e++;this.isExpanded?this.toggleBtn.classList.add("is-expanded"):this.toggleBtn.classList.remove("is-expanded")}applyActiveModeState(){for(const[e,t]of this.toolButtons.entries())e===this.activeMode?t.classList.add("is-active"):t.classList.remove("is-active")}renderResult(){if(this.activeMode==="laserDistance")this.mainValueLabelEl.style.display="none",this.mainNumberEl.textContent=Ae(this.getModeI18nKey("laserDistance")),this.mainUnitEl.textContent="",this.mainNumberEl.classList.add("is-laser-text");else{this.mainValueLabelEl.style.display="",this.mainValueLabelEl.textContent=Ae(this.getModeValueLabelI18nKey(this.activeMode));const e=this.formatMainValueParts(this.activeMode,this.result);this.mainNumberEl.textContent=e.numberText,this.mainUnitEl.textContent=e.unitText,this.mainNumberEl.classList.remove("is-laser-text")}if(this.activeMode==="distance"){this.xyzBoxEl.style.display="";const e=this.result?.xyz;if(!e){this.xyzXEl.textContent="--",this.xyzYEl.textContent="--",this.xyzZEl.textContent="--";return}this.xyzXEl.textContent=this.formatNumberWithPrecision(e.x,this.config.precision),this.xyzYEl.textContent=this.formatNumberWithPrecision(e.y,this.config.precision),this.xyzZEl.textContent=this.formatNumberWithPrecision(e.z,this.config.precision);return}this.xyzBoxEl.style.display="none"}getModeI18nKey(e){return`measure.modes.${e}`}getModeValueLabelI18nKey(e){return`measure.labels.value.${e}`}formatNumberWithPrecision(e,t){return e.toFixed(t)}convertMmToUnit(e,t){switch(t){case"mm":return e;case"cm":return e/10;case"m":return e/1e3;case"km":return e/1e6;default:return e}}getUnitI18nKey(e){return`measure.units.${e}`}convertMm3ToUnit3(e,t){switch(t){case"mm":return e;case"cm":return e/1e3;case"m":return e/1e9;case"km":return e/1e18;default:return e}}formatMainValueParts(e,t){if(e==="laserDistance")return{numberText:Ae(this.getModeI18nKey("laserDistance")),unitText:""};if(!t)return this.getEmptyValuePartsByMode(e);switch(e){case"distance":return this.formatLengthParts(t.distanceMm);case"minDistance":return this.formatLengthParts(t.minDistanceMm);case"angle":return this.formatFixedUnitParts(t.angleDeg,Ae("measure.units.deg"));case"elevation":return this.formatFixedUnitParts(t.elevationMm===void 0?void 0:t.elevationMm/1e3,Ae("measure.units.m"));case"volume":return this.formatVolumeParts(t.volumeM3);case"slope":return this.formatFixedUnitParts(t.slopePercent,Ae("measure.units.percent"));case"spaceVolume":return this.formatVolumeParts(t.spaceVolumeM3);default:return{numberText:"--",unitText:""}}}getEmptyValuePartsByMode(e){switch(e){case"distance":case"minDistance":return{numberText:"--",unitText:Ae(this.getUnitI18nKey(this.config.unit))};case"angle":return{numberText:"--",unitText:Ae("measure.units.deg")};case"elevation":return{numberText:"--",unitText:Ae("measure.units.m")};case"volume":case"spaceVolume":return{numberText:"--",unitText:`${this.config.unit}³`};case"slope":return{numberText:"--",unitText:Ae("measure.units.percent")};default:return{numberText:"--",unitText:""}}}formatFixedUnitParts(e,t){return e==null||Number.isNaN(e)?{numberText:"--",unitText:t}:{numberText:this.formatNumberWithPrecision(e,this.config.precision),unitText:t}}formatLengthParts(e){const t=Ae(this.getUnitI18nKey(this.config.unit));if(e==null||Number.isNaN(e))return{numberText:"--",unitText:t};const n=this.convertMmToUnit(e,this.config.unit);return{numberText:this.formatNumberWithPrecision(n,this.config.precision),unitText:t}}formatVolumeParts(e){const t=`${this.config.unit}³`;if(e==null||Number.isNaN(e))return{numberText:"--",unitText:t};const n=this.convertMm3ToUnit3(e,this.config.unit);return{numberText:this.formatNumberWithPrecision(n,this.config.precision),unitText:t}}}class R2 extends en{dialogId="measure-dialog";dialog=null;panel=null;config=null;constructor(e){super(e)}init(){}show(){if(!this.engine.dialog||!this.engine.container){console.warn("Dialog manager or container is not initialized");return}const e=250,t=300,n=20,i=this.engine.container,r=i.clientWidth,a=i.clientHeight,o=r-e-n,l=(a-t)/2;this.destroy(),this.panel=new xr({defaultMode:"distance",defaultExpanded:!1,onModeChange:h=>{console.log("[MeasureDialogManager] 当前测量方式已切换:",h),this.engine.engine?.activateMeasure(h)},onClearAll:()=>{console.log("[MeasureDialogManager] 删除全部(仅 UI 清空,本次不清理引擎侧内容)")},onSettings:()=>{console.log("[MeasureDialogManager] 打开设置(仅预留接口)")},onExpandedChange:()=>{this.dialog?.fitHeight(!1)}}),this.panel.init(),this.config=this.panel.getConfig();const c=document.createElement("div");c.style.padding="12px",c.appendChild(this.panel.element),this.dialog=this.engine.dialog.create({id:this.dialogId,title:"measure.dialogTitle",content:c,width:e,height:"auto",position:{x:o,y:l},onClose:()=>{this.engine.toolbar?.setBtnActive("measure",!1),this.destroy()}}),this.dialog.init(),this.dialog.fitHeight(!1)}getActiveMode(){return this.panel?this.panel.getActiveMode():null}switchMode(e){this.panel&&this.panel.switchMode(e)}setMeasureResult(e){this.panel&&this.panel.setResult(e)}getConfig(){return this.panel&&(this.config=this.panel.getConfig()),this.config?{...this.config}:null}setConfig(e,t=!0){if(this.panel){this.panel.setConfig(e,t),this.config=this.panel.getConfig(),this.dialog?.fitHeight(!1);return}const n=this.config,i={unit:e.unit??n?.unit??"mm",precision:e.precision??n?.precision??2};this.config=i}clearAll(){this.panel&&this.panel.clearAll()}openSettings(){this.panel&&this.panel.openSettings()}destroy(){this.engine.engine&&this.engine.engine.deactivateMeasure(),this.dialog&&(this.dialog.destroy(),this.dialog=null),this.panel&&(this.panel.destroy(),this.panel=null)}}class L2{element;options;hideBtn;reverseBtn;resetBtn;hideLabelEl;reverseLabelEl;resetLabelEl;unsubscribeLocale=null;unsubscribeTheme=null;constructor(e={}){this.options=e,this.element=this.createDom()}init(){this.unsubscribeLocale=Ht.subscribe(()=>{this.setLocales()}),this.unsubscribeTheme=st.subscribe(e=>{this.setTheme(e)}),this.setLocales(),this.setTheme(st.getTheme())}setTheme(e){const t=this.element.style;t.setProperty("--bim-section-btn-bg",e.componentBg??"rgba(255, 255, 255, 0.06)"),t.setProperty("--bim-section-btn-hover",e.componentBgHover??"rgba(255, 255, 255, 0.10)"),t.setProperty("--bim-section-btn-active",e.componentBgActive??"rgba(255, 255, 255, 0.14)"),t.setProperty("--bim-primary-color",e.primary??"#1890ff"),t.setProperty("--bim-icon-color",e.iconDefault??"#ccc"),t.setProperty("--bim-text-color",e.textSecondary??"rgba(255, 255, 255, 0.90)"),t.setProperty("--bim-text-active-color",e.textPrimary??"#fff")}setLocales(){this.hideLabelEl.textContent=Ae("sectionPlane.actions.hide"),this.reverseLabelEl.textContent=Ae("sectionPlane.actions.reverse"),this.resetLabelEl.textContent=Ae("sectionPlane.actions.reset"),this.hideBtn.title=Ae("sectionPlane.actions.hide"),this.reverseBtn.title=Ae("sectionPlane.actions.reverse"),this.resetBtn.title=Ae("sectionPlane.actions.reset")}destroy(){this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.element.remove()}createDom(){const e=document.createElement("div");return e.className="section-plane-panel",this.hideBtn=this.createButton("hide",Tt("隐藏"),()=>{this.options.onHide&&this.options.onHide()}),this.reverseBtn=this.createButton("reverse",Tt("反向"),()=>{this.options.onReverse&&this.options.onReverse()}),this.resetBtn=this.createButton("reset",Tt("重置"),()=>{this.options.onReset&&this.options.onReset()}),e.appendChild(this.hideBtn),e.appendChild(this.reverseBtn),e.appendChild(this.resetBtn),e}createButton(e,t,n){const i=document.createElement("button");i.type="button",i.className="section-plane-btn";const r=document.createElement("div");r.className="section-plane-btn-icon",r.innerHTML=t,i.appendChild(r);const a=document.createElement("div");return a.className="section-plane-btn-label",i.appendChild(a),e==="hide"?this.hideLabelEl=a:e==="reverse"?this.reverseLabelEl=a:this.resetLabelEl=a,i.addEventListener("click",n),i}}class D2 extends en{dialogId="section-plane-dialog";dialog=null;panel=null;constructor(e){super(e)}init(){}show(){if(!this.engine.dialog||!this.engine.container){console.warn("Dialog manager or container is not initialized");return}this.destroy(),this.panel=new L2({onHide:()=>{console.log("[SectionPlaneDialogManager] 隐藏")},onReverse:()=>{console.log("[SectionPlaneDialogManager] 反向")},onReset:()=>{console.log("[SectionPlaneDialogManager] 重置")}}),this.panel.init();const e=240,t=120,n=20,i=50,r=this.engine.container,a=r.clientWidth,o=r.clientHeight,l=a-e-n,c=o-t-i;this.dialog=this.engine.dialog.create({id:this.dialogId,title:"sectionPlane.dialogTitle",width:e,height:t,position:{x:l,y:c},draggable:!0,resizable:!1,content:this.panel.element,onClose:()=>{this.engine.toolbar?.setBtnActive("section-plane",!1),this.hide()}})}hide(){this.destroy()}destroy(){this.dialog&&(this.dialog.destroy(),this.dialog=null),this.panel&&(this.panel.destroy(),this.panel=null)}}class I2{element;options;isHidden=!1;activeAxis="x";hideBtn;reverseBtn;hideLabelEl;reverseLabelEl;axisXBtn;axisYBtn;axisZBtn;unsubscribeLocale=null;unsubscribeTheme=null;constructor(e={}){this.options=e,this.isHidden=e.defaultHidden??!1,this.activeAxis=e.defaultAxis??"x",this.element=this.createDom()}init(){this.unsubscribeLocale=Ht.subscribe(()=>{this.setLocales()}),this.unsubscribeTheme=st.subscribe(e=>{this.setTheme(e)}),this.setLocales(),this.setTheme(st.getTheme()),this.updateHideButtonState(),this.updateAxisButtonsState()}setTheme(e){const t=this.element.style;t.setProperty("--bim-section-axis-btn-bg",e.componentBg??"rgba(255, 255, 255, 0.06)"),t.setProperty("--bim-section-axis-btn-hover",e.componentBgHover??"rgba(255, 255, 255, 0.10)"),t.setProperty("--bim-section-axis-btn-active",e.componentBgActive??"rgba(255, 255, 255, 0.14)"),t.setProperty("--bim-primary-color",e.primary??"#1890ff"),t.setProperty("--bim-icon-color",e.iconDefault??"#ccc"),t.setProperty("--bim-text-color",e.textSecondary??"rgba(255, 255, 255, 0.90)"),t.setProperty("--bim-text-active-color",e.textPrimary??"#fff")}setLocales(){this.hideLabelEl.textContent=Ae("sectionAxis.actions.hide"),this.reverseLabelEl.textContent=Ae("sectionAxis.actions.reverse"),this.hideBtn.title=Ae("sectionAxis.actions.hide"),this.reverseBtn.title=Ae("sectionAxis.actions.reverse"),this.axisXBtn.title=Ae("sectionAxis.actions.axisX"),this.axisYBtn.title=Ae("sectionAxis.actions.axisY"),this.axisZBtn.title=Ae("sectionAxis.actions.axisZ")}setHiddenState(e){this.isHidden=e,this.updateHideButtonState()}getHiddenState(){return this.isHidden}setActiveAxis(e){this.activeAxis=e,this.updateAxisButtonsState()}getActiveAxis(){return this.activeAxis}destroy(){this.unsubscribeLocale&&(this.unsubscribeLocale(),this.unsubscribeLocale=null),this.unsubscribeTheme&&(this.unsubscribeTheme(),this.unsubscribeTheme=null),this.element.remove()}createDom(){const e=document.createElement("div");e.className="section-axis-panel";const t=document.createElement("div");t.className="section-axis-row-1",this.hideBtn=this.createButton("hide",Tt("隐藏"),()=>this.handleHideToggle()),this.reverseBtn=this.createButton("reverse",Tt("反向"),()=>this.handleReverse()),t.appendChild(this.hideBtn),t.appendChild(this.reverseBtn);const n=document.createElement("div");return n.className="section-axis-row-2",this.axisXBtn=this.createAxisButton("axisX","X",()=>this.handleAxisChange("x")),this.axisYBtn=this.createAxisButton("axisY","Y",()=>this.handleAxisChange("y")),this.axisZBtn=this.createAxisButton("axisZ","Z",()=>this.handleAxisChange("z")),n.appendChild(this.axisXBtn),n.appendChild(this.axisYBtn),n.appendChild(this.axisZBtn),e.appendChild(t),e.appendChild(n),e}createButton(e,t,n){const i=document.createElement("button");i.type="button",i.className="section-axis-btn";const r=document.createElement("div");r.className="section-axis-btn-icon",r.innerHTML=t,i.appendChild(r);const a=document.createElement("div");return a.className="section-axis-btn-label",i.appendChild(a),e==="hide"?this.hideLabelEl=a:e==="reverse"&&(this.reverseLabelEl=a),i.addEventListener("click",n),i}createAxisButton(e,t,n){const i=document.createElement("button");i.type="button",i.className="section-axis-btn section-axis-btn-text";const r=document.createElement("div");return r.className="section-axis-btn-label",r.textContent=t,i.appendChild(r),i.addEventListener("click",n),i}handleHideToggle(){this.isHidden=!this.isHidden,this.updateHideButtonState(),this.options.onHideToggle&&this.options.onHideToggle(this.isHidden)}handleReverse(){this.options.onReverse&&this.options.onReverse()}handleAxisChange(e){this.activeAxis!==e&&(this.activeAxis=e,this.updateAxisButtonsState(),this.options.onAxisChange&&this.options.onAxisChange(e))}updateHideButtonState(){this.isHidden?this.hideBtn.classList.add("active"):this.hideBtn.classList.remove("active")}updateAxisButtonsState(){this.axisXBtn.classList.toggle("active",this.activeAxis==="x"),this.axisYBtn.classList.toggle("active",this.activeAxis==="y"),this.axisZBtn.classList.toggle("active",this.activeAxis==="z")}}class N2 extends en{dialogId="section-axis-dialog";dialog=null;panel=null;constructor(e){super(e)}init(){}show(){if(!this.engine.dialog||!this.engine.container){console.warn("Dialog manager or container is not initialized");return}this.destroy(),this.panel=new I2({defaultAxis:"x",defaultHidden:!1,onHideToggle:c=>{console.log("[SectionAxisDialogManager] 隐藏切换:",c)},onReverse:()=>{console.log("[SectionAxisDialogManager] 反向剖切")},onAxisChange:c=>{console.log("[SectionAxisDialogManager] 切换轴向:",c)}}),this.panel.init();const e=240,t=20,n=50,i=this.engine.container,r=i.clientWidth,a=i.clientHeight,o=r-e-t,l=a-n-200;this.dialog=this.engine.dialog.create({id:this.dialogId,title:"sectionAxis.dialogTitle",width:e,height:"auto",position:{x:o,y:l},draggable:!0,resizable:!1,content:this.panel.element,onClose:()=>{this.engine.toolbar?.setBtnActive("section-axis",!1),this.hide()}}),this.dialog.init(),this.dialog.fitHeight(!1)}hide(){this.destroy()}getHiddenState(){return this.panel?.getHiddenState()??!1}setHiddenState(e){this.panel?.setHiddenState(e)}getActiveAxis(){return this.panel?.getActiveAxis()??"x"}setActiveAxis(e){this.panel?.setActiveAxis(e)}destroy(){this.dialog&&(this.dialog.destroy(),this.dialog=null),this.panel&&(this.panel.destroy(),this.panel=null)}}const of={x:{min:0,max:100},y:{min:0,max:100},z:{min:0,max:100}};class U2{element;options;isHidden=!1;isReversed=!1;range;hideBtn;reverseBtn;fitBtn;resetBtn;hideLabelEl;reverseLabelEl;fitLabelEl;resetLabelEl;xLabelEl;yLabelEl;zLabelEl;unsubscribeLocale=null;unsubscribeTheme=null;xSlider;ySlider;zSlider;xMinHandle;xMaxHandle;yMinHandle;yMaxHandle;zMinHandle;zMaxHandle;dragState={isDragging:!1,axis:null,handleType:null,pointerId:null};constructor(e={}){this.options=e,this.isHidden=e.defaultHidden??!1,this.isReversed=e.defaultReversed??!1,this.range=JSON.parse(JSON.stringify(e.defaultRange??of))}init(){this.element=this.createPanel(),this.unsubscribeLocale=Ht.subscribe(()=>this.setLocales()),this.unsubscribeTheme=st.subscribe(e=>this.setTheme(e)),this.setLocales(),this.setTheme(st.getTheme()),this.updateButtonStates(),this.updateAllSlidersUI(),this.setupDragListeners()}setHiddenState(e){this.isHidden=e,this.updateButtonStates()}getHiddenState(){return this.isHidden}setReversedState(e){this.isReversed=e,this.updateButtonStates()}getReversedState(){return this.isReversed}setRange(e){e.x&&(this.range.x={...this.range.x,...e.x}),e.y&&(this.range.y={...this.range.y,...e.y}),e.z&&(this.range.z={...this.range.z,...e.z}),this.updateAllSlidersUI()}getRange(){return JSON.parse(JSON.stringify(this.range))}reset(){this.isHidden=this.options.defaultHidden??!1,this.isReversed=this.options.defaultReversed??!1,this.range=JSON.parse(JSON.stringify(this.options.defaultRange??of)),this.updateButtonStates(),this.updateAllSlidersUI(),this.options.onReset?.(),this.options.onRangeChange?.(this.range)}createPanel(){const e=document.createElement("div");e.className="section-box-panel";const t=document.createElement("div");t.className="section-box-row-buttons",this.hideBtn=this.createButton("hide",Ae("sectionBox.actions.hide"),()=>{this.isHidden=!this.isHidden,this.updateButtonStates(),this.options.onHideToggle?.(this.isHidden)},"hide"),this.reverseBtn=this.createButton("reverse",Ae("sectionBox.actions.reverse"),()=>{this.isReversed=!this.isReversed,this.updateButtonStates(),this.options.onReverseToggle?.(this.isReversed)},"reverse"),this.fitBtn=this.createButton("fit",Ae("sectionBox.actions.fitToModel"),()=>{this.options.onFitToModel?.()},"fit"),this.resetBtn=this.createButton("reset",Ae("sectionBox.actions.reset"),()=>this.reset(),"reset"),[this.hideBtn,this.reverseBtn,this.fitBtn,this.resetBtn].forEach(i=>t.appendChild(i));const n=document.createElement("div");return n.className="section-box-sliders",n.addEventListener("pointerdown",i=>i.stopPropagation()),this.xSlider=this.createSlider("x",Ae("sectionBox.axes.x")),this.ySlider=this.createSlider("y",Ae("sectionBox.axes.y")),this.zSlider=this.createSlider("z",Ae("sectionBox.axes.z")),[this.xSlider,this.ySlider,this.zSlider].forEach(i=>n.appendChild(i)),e.appendChild(t),e.appendChild(n),e}createButton(e,t,n,i){const r=document.createElement("button");r.className="section-box-btn",r.title=t;const a={hide:"隐藏",reverse:"反向",fit:"适应到模型",reset:"重置"},o=document.createElement("div");o.className="section-box-btn-icon",o.innerHTML=Tt(a[e]||e);const l=document.createElement("div");return l.className="section-box-btn-label",l.textContent=t,i==="hide"?this.hideLabelEl=l:i==="reverse"?this.reverseLabelEl=l:i==="fit"?this.fitLabelEl=l:i==="reset"&&(this.resetLabelEl=l),r.appendChild(o),r.appendChild(l),r.addEventListener("click",n),r}createSlider(e,t){const n=document.createElement("div");n.className="section-box-slider";const i=document.createElement("div");i.className="section-box-slider-label",i.textContent=t,e==="x"?this.xLabelEl=i:e==="y"?this.yLabelEl=i:this.zLabelEl=i;const r=document.createElement("div");r.className="section-box-slider-track";const a=document.createElement("div");a.className="section-box-slider-range";const o=document.createElement("div");o.className="section-box-slider-handle",o.setAttribute("data-axis",e),o.setAttribute("data-handle","min");const l=document.createElement("div");return l.className="section-box-slider-handle",l.setAttribute("data-axis",e),l.setAttribute("data-handle","max"),r.append(a,o,l),n.append(i,r),e==="x"?(this.xMinHandle=o,this.xMaxHandle=l):e==="y"?(this.yMinHandle=o,this.yMaxHandle=l):(this.zMinHandle=o,this.zMaxHandle=l),n}setupDragListeners(){[this.xMinHandle,this.xMaxHandle,this.yMinHandle,this.yMaxHandle,this.zMinHandle,this.zMaxHandle].forEach(t=>{t.addEventListener("pointerdown",i=>{i.preventDefault(),i.stopPropagation(),t.setPointerCapture(i.pointerId),this.dragState={isDragging:!0,axis:t.getAttribute("data-axis"),handleType:t.getAttribute("data-handle"),pointerId:i.pointerId},t.classList.add("dragging"),t.closest(".section-box-slider").style.zIndex="100"}),t.addEventListener("pointermove",i=>{this.dragState.isDragging&&this.dragState.pointerId===i.pointerId&&this.onDragging(i)});const n=i=>{this.dragState.isDragging&&this.dragState.pointerId===i.pointerId&&(t.releasePointerCapture(i.pointerId),t.closest(".section-box-slider").style.zIndex="",t.classList.remove("dragging"),this.dragState.isDragging=!1,this.dragState.pointerId=null)};t.addEventListener("pointerup",n),t.addEventListener("pointercancel",n)})}onDragging(e){const{axis:t,handleType:n}=this.dragState;if(!t||!n)return;const a=(t==="x"?this.xSlider:t==="y"?this.ySlider:this.zSlider).querySelector(".section-box-slider-track").getBoundingClientRect();let o=(e.clientX-a.left)/a.width*100;o=Math.max(0,Math.min(100,o));const l=this.range[t];n==="min"?l.min=Math.min(o,l.max):l.max=Math.max(o,l.min),this.updateSliderUI(t),this.options.onRangeChange?.(this.range)}updateSliderUI(e){const t=this.range[e],n=e==="x"?this.xMinHandle:e==="y"?this.yMinHandle:this.zMinHandle,i=e==="x"?this.xMaxHandle:e==="y"?this.yMaxHandle:this.zMaxHandle,a=(e==="x"?this.xSlider:e==="y"?this.ySlider:this.zSlider).querySelector(".section-box-slider-range");n.style.left=`${t.min}%`,i.style.left=`${t.max}%`,a.style.left=`${t.min}%`,a.style.width=`${t.max-t.min}%`,n.setAttribute("data-value",Math.round(t.min).toString()),i.setAttribute("data-value",Math.round(t.max).toString())}updateAllSlidersUI(){["x","y","z"].forEach(e=>this.updateSliderUI(e))}updateButtonStates(){this.hideBtn&&this.hideBtn.classList.toggle("active",this.isHidden),this.reverseBtn&&this.reverseBtn.classList.toggle("active",this.isReversed)}setLocales(){this.hideLabelEl&&(this.hideLabelEl.textContent=Ae("sectionBox.actions.hide"),this.reverseLabelEl.textContent=Ae("sectionBox.actions.reverse"),this.fitLabelEl.textContent=Ae("sectionBox.actions.fitToModel"),this.resetLabelEl.textContent=Ae("sectionBox.actions.reset"),this.xLabelEl.textContent=Ae("sectionBox.axes.x"),this.yLabelEl.textContent=Ae("sectionBox.axes.y"),this.zLabelEl.textContent=Ae("sectionBox.axes.z"),this.hideBtn.title=Ae("sectionBox.actions.hide"),this.reverseBtn.title=Ae("sectionBox.actions.reverse"),this.fitBtn.title=Ae("sectionBox.actions.fitToModel"),this.resetBtn.title=Ae("sectionBox.actions.reset"))}setTheme(e){if(!this.element)return;const t=this.element.style;t.setProperty("--bim-section-box-btn-bg",e.componentBg??"rgba(255, 255, 255, 0.06)"),t.setProperty("--bim-section-box-btn-hover",e.componentBgHover??"rgba(255, 255, 255, 0.10)"),t.setProperty("--bim-section-box-btn-active",e.componentBgActive??"rgba(255, 255, 255, 0.14)"),t.setProperty("--bim-primary-color",e.primary??"#1890ff"),t.setProperty("--bim-icon-color",e.iconDefault??"#ccc"),t.setProperty("--bim-text-color",e.textSecondary??"rgba(255, 255, 255, 0.90)"),t.setProperty("--bim-text-active-color",e.textPrimary??"#fff")}destroy(){this.unsubscribeLocale?.(),this.unsubscribeTheme?.(),this.element&&this.element.parentElement&&this.element.parentElement.removeChild(this.element)}}class B2 extends en{dialogId="section-box-dialog";dialog=null;panel=null;constructor(e){super(e)}init(){}show(){if(!this.engine.dialog||!this.engine.container){console.warn("Dialog manager or container is not initialized");return}this.destroy(),this.panel=new U2({defaultHidden:!1,defaultReversed:!1,onHideToggle:c=>{console.log("[SectionBoxDialogManager] 隐藏切换:",c)},onReverseToggle:c=>{console.log("[SectionBoxDialogManager] 反向切换:",c)},onFitToModel:()=>{console.log("[SectionBoxDialogManager] 适应到模型")},onReset:()=>{console.log("[SectionBoxDialogManager] 重置")},onRangeChange:c=>{console.log("[SectionBoxDialogManager] 范围变化:",c)}}),this.panel.init();const e=280,t=20,n=50,i=this.engine.container,r=i.clientWidth,a=i.clientHeight,o=r-e-t,l=a-n-300;this.dialog=this.engine.dialog.create({id:this.dialogId,title:"sectionBox.dialogTitle",width:e,height:"auto",position:{x:o,y:l},draggable:!0,resizable:!1,content:this.panel.element,onClose:()=>{this.engine.toolbar?.setBtnActive("section-box",!1),this.hide()}}),this.dialog.init(),this.dialog.fitHeight(!1)}hide(){this.destroy()}getHiddenState(){return this.panel?.getHiddenState()??!1}setHiddenState(e){this.panel?.setHiddenState(e)}getReversedState(){return this.panel?.getReversedState()??!1}setReversedState(e){this.panel?.setReversedState(e)}getRange(){return this.panel?.getRange()??null}setRange(e){this.panel?.setRange(e)}destroy(){this.dialog&&(this.dialog.destroy(),this.dialog=null),this.panel&&(this.panel.destroy(),this.panel=null)}}class k2{element;options;state={mode:"none",isPlanViewActive:!1,speed:1,gravity:!1,collision:!1,characterModel:"construction-worker",walkMode:"walk"};planViewBtn;pathModeBtn;walkModeBtn;settingsContainer;speedControl;speedDecreaseBtn;speedIncreaseBtn;speedDisplay;gravityCheckbox;gravityLabel;collisionCheckbox;collisionLabel;characterModelSelect;characterModelLabel;walkModeSelect;walkModeLabel;exitBtn;unsubscribeLocale=null;unsubscribeTheme=null;constructor(e={}){this.options=e,this.state.speed=e.defaultSpeed??1,this.state.gravity=e.defaultGravity??!1,this.state.collision=e.defaultCollision??!1,this.state.characterModel=e.defaultCharacterModel??"construction-worker",this.state.walkMode=e.defaultWalkMode??"walk"}init(){this.element=this.createPanel(),this.updateSettingsView(),this.unsubscribeLocale=Ht.subscribe(()=>this.setLocales()),this.unsubscribeTheme=st.subscribe(e=>this.setTheme(e)),this.setLocales(),this.setTheme(st.getTheme())}setPlanViewActive(e){this.state.isPlanViewActive=e,this.updateButtonStates()}setPathModeActive(e){if(!e&&this.state.mode!=="path")return;const t=e?"path":"none";this.setMode(t)}getState(){return{...this.state}}createPanel(){const e=document.createElement("div");e.className="walk-control-panel";const t=this.createLeftButtons(),n=document.createElement("div");n.className="walk-divider",this.settingsContainer=this.createSettingsContainer();const i=document.createElement("div");i.className="walk-divider";const r=this.createExitButton();return e.appendChild(t),e.appendChild(n),e.appendChild(this.settingsContainer),e.appendChild(i),e.appendChild(r),e}createLeftButtons(){const e=document.createElement("div");return e.className="walk-control-left",this.planViewBtn=this.createIconButton("plan-view",()=>{this.state.isPlanViewActive=!this.state.isPlanViewActive,this.updateButtonStates(),this.options.onPlanViewToggle?.(this.state.isPlanViewActive)}),this.pathModeBtn=this.createIconButton("path",()=>{const t=this.state.mode==="path"?"none":"path";this.setMode(t),this.options.onPathModeToggle?.(t==="path")}),this.walkModeBtn=this.createIconButton("walk",()=>{const t=this.state.mode==="walk"?"none":"walk";this.setMode(t),this.options.onWalkModeToggle?.(t==="walk")}),e.appendChild(this.planViewBtn),e.appendChild(this.pathModeBtn),e.appendChild(this.walkModeBtn),e}createSettingsContainer(){const e=document.createElement("div");e.className="walk-control-settings",this.speedControl=this.createSpeedControl();const t=document.createElement("label");t.className="walk-checkbox-wrapper walk-checkbox-gravity",this.gravityCheckbox=document.createElement("input"),this.gravityCheckbox.type="checkbox",this.gravityCheckbox.className="walk-checkbox",this.gravityCheckbox.checked=this.state.gravity,this.gravityCheckbox.addEventListener("change",()=>{this.state.gravity=this.gravityCheckbox.checked,this.options.onGravityToggle?.(this.state.gravity)}),this.gravityLabel=document.createElement("span"),this.gravityLabel.className="walk-checkbox-label",t.appendChild(this.gravityCheckbox),t.appendChild(this.gravityLabel);const n=document.createElement("label");n.className="walk-checkbox-wrapper walk-checkbox-collision",this.collisionCheckbox=document.createElement("input"),this.collisionCheckbox.type="checkbox",this.collisionCheckbox.className="walk-checkbox",this.collisionCheckbox.checked=this.state.collision,this.collisionCheckbox.addEventListener("change",()=>{this.state.collision=this.collisionCheckbox.checked,this.options.onCollisionToggle?.(this.state.collision)}),this.collisionLabel=document.createElement("span"),this.collisionLabel.className="walk-checkbox-label",n.appendChild(this.collisionCheckbox),n.appendChild(this.collisionLabel);const i=document.createElement("div");i.className="walk-select-wrapper walk-select-wrapper-character-model",this.characterModelLabel=document.createElement("label"),this.characterModelLabel.className="walk-select-label",this.characterModelSelect=document.createElement("select"),this.characterModelSelect.className="walk-select walk-select-character-model",this.characterModelSelect.addEventListener("change",()=>{this.state.characterModel=this.characterModelSelect.value,this.options.onCharacterModelChange?.(this.state.characterModel)}),i.appendChild(this.characterModelLabel),i.appendChild(this.characterModelSelect);const r=document.createElement("div");return r.className="walk-select-wrapper walk-select-wrapper-walk-mode",this.walkModeLabel=document.createElement("label"),this.walkModeLabel.className="walk-select-label",this.walkModeSelect=document.createElement("select"),this.walkModeSelect.className="walk-select walk-select-walk-mode",this.walkModeSelect.addEventListener("change",()=>{this.state.walkMode=this.walkModeSelect.value,this.options.onWalkModeChange?.(this.state.walkMode)}),r.appendChild(this.walkModeLabel),r.appendChild(this.walkModeSelect),e.appendChild(this.speedControl),e.appendChild(i),e.appendChild(r),e.appendChild(t),e.appendChild(n),e}createSpeedControl(){const e=document.createElement("div");e.className="walk-speed-control";const t=document.createElement("label");t.className="walk-speed-label",t.textContent=Ae("walkControl.speed");const n=document.createElement("div");return n.className="walk-speed-group",this.speedDecreaseBtn=document.createElement("button"),this.speedDecreaseBtn.className="walk-speed-btn",this.speedDecreaseBtn.textContent="-",this.speedDecreaseBtn.addEventListener("click",()=>{this.state.speed>1&&(this.state.speed--,this.updateSpeedDisplay(),this.options.onSpeedChange?.(this.state.speed))}),this.speedDisplay=document.createElement("div"),this.speedDisplay.className="walk-speed-display",this.speedDisplay.textContent=`${this.state.speed}X`,this.speedIncreaseBtn=document.createElement("button"),this.speedIncreaseBtn.className="walk-speed-btn",this.speedIncreaseBtn.textContent="+",this.speedIncreaseBtn.addEventListener("click",()=>{this.state.speed<10&&(this.state.speed++,this.updateSpeedDisplay(),this.options.onSpeedChange?.(this.state.speed))}),n.appendChild(this.speedDecreaseBtn),n.appendChild(this.speedDisplay),n.appendChild(this.speedIncreaseBtn),e.appendChild(t),e.appendChild(n),e}createIconButton(e,t){const n=document.createElement("button");return n.className=`walk-icon-btn walk-icon-btn-${e}`,n.innerHTML=this.getIconSVG(e),n.addEventListener("click",t),n}createExitButton(){const e=document.createElement("button");return e.className="walk-exit-btn",e.addEventListener("click",()=>{this.options.onExit?.()}),this.exitBtn=e,e}setMode(e){const t=this.state.mode;t==="walk"&&e!=="walk"&&this.options.onWalkModeToggle?.(!1),t==="path"&&e!=="path"&&this.options.onPathModeToggle?.(!1),this.state.mode=e,e==="path"?(this.state.gravity=!1,this.state.collision=!1,this.gravityCheckbox.checked=!1,this.gravityCheckbox.disabled=!0,this.collisionCheckbox.checked=!1,this.collisionCheckbox.disabled=!0):(this.gravityCheckbox.disabled=!1,this.collisionCheckbox.disabled=!1),this.updateButtonStates(),this.updateSettingsView(),this.updateSpeedButtonStates()}updateButtonStates(){this.planViewBtn.classList.toggle("active",this.state.isPlanViewActive),this.pathModeBtn.classList.toggle("active",this.state.mode==="path"),this.walkModeBtn.classList.toggle("active",this.state.mode==="walk")}updateSettingsView(){const e=this.speedControl,t=this.gravityCheckbox.parentElement,n=this.collisionCheckbox.parentElement,i=this.characterModelSelect.parentElement,r=this.walkModeSelect.parentElement;this.state.mode==="walk"?(e.style.display="none",t.style.display="flex",n.style.display="flex",i.style.display="flex",r.style.display="flex"):(e.style.display="flex",t.style.display="flex",n.style.display="flex",i.style.display="none",r.style.display="none")}updateSpeedDisplay(){this.speedDisplay.textContent=`${this.state.speed}X`,this.updateSpeedButtonStates()}updateSpeedButtonStates(){this.speedDecreaseBtn.disabled=this.state.speed<=1,this.speedIncreaseBtn.disabled=this.state.speed>=10}getIconSVG(e){return{"plan-view":Tt("地图"),path:Tt("路径漫游"),walk:Tt("第一人称漫游")}[e]||""}setLocales(){const e=this.speedControl.querySelector(".walk-speed-label");e&&(e.textContent=Ae("walkControl.speed")),this.gravityLabel.textContent=Ae("walkControl.gravity"),this.collisionLabel.textContent=Ae("walkControl.collision"),this.characterModelLabel.textContent=Ae("walkControl.characterModel.label"),this.characterModelSelect.innerHTML="";const t=document.createElement("option");t.value="construction-worker",t.textContent=Ae("walkControl.characterModel.constructionWorker"),t.selected=this.state.characterModel==="construction-worker",this.characterModelSelect.appendChild(t);const n=document.createElement("option");n.value="office-male",n.textContent=Ae("walkControl.characterModel.officeMale"),n.selected=this.state.characterModel==="office-male",this.characterModelSelect.appendChild(n),this.walkModeLabel.textContent=Ae("walkControl.walkMode.label"),this.walkModeSelect.innerHTML="";const i=document.createElement("option");i.value="walk",i.textContent=Ae("walkControl.walkMode.walk"),i.selected=this.state.walkMode==="walk",this.walkModeSelect.appendChild(i);const r=document.createElement("option");r.value="run",r.textContent=Ae("walkControl.walkMode.run"),r.selected=this.state.walkMode==="run",this.walkModeSelect.appendChild(r),this.exitBtn.textContent=Ae("walkControl.exit")}setTheme(e){if(!this.element)return;const t=this.element.style;t.setProperty("--bim-walk-control-bg",e.bgElevated??"rgba(0, 0, 0, 0.8)"),t.setProperty("--bim-walk-btn-hover",e.componentBgHover??"rgba(255, 255, 255, 0.15)"),t.setProperty("--bim-walk-btn-active",e.componentBgActive??"rgba(255, 255, 255, 0.3)"),t.setProperty("--bim-primary-color",e.primary??"#1890ff"),t.setProperty("--bim-primary-hover",e.primaryHover??"#40a9ff"),t.setProperty("--bim-icon-color",e.iconDefault??"#ccc"),t.setProperty("--bim-text-color",e.textPrimary??"#fff"),t.setProperty("--bim-divider-color",e.borderDefault??"rgba(255, 255, 255, 0.2)"),t.setProperty("--bim-speed-group-bg",e.componentBgHover??"rgba(255, 255, 255, 0.1)"),t.setProperty("--bim-speed-btn-bg",e.componentBgHover??"rgba(255, 255, 255, 0.1)"),t.setProperty("--bim-speed-btn-hover",e.componentBgActive??"rgba(255, 255, 255, 0.2)"),t.setProperty("--bim-select-bg",e.componentBgHover??"rgba(255, 255, 255, 0.1)"),t.setProperty("--bim-select-border",e.borderDefault??"rgba(255, 255, 255, 0.2)"),t.setProperty("--bim-select-option-bg",e.bgElevated??"#333")}destroy(){this.unsubscribeLocale?.(),this.unsubscribeTheme?.(),this.element&&this.element.parentElement&&this.element.parentElement.removeChild(this.element)}}class O2{element;unsubscribeLocale=null;unsubscribeTheme=null;constructor(){}init(){this.element=this.createPanel(),this.unsubscribeLocale=Ht.subscribe(()=>this.setLocales()),this.unsubscribeTheme=st.subscribe(e=>this.setTheme(e)),this.setLocales(),this.setTheme(st.getTheme())}createPanel(){const e=document.createElement("div");return e.className="walk-path-panel",e.style.padding="20px",e.style.color="var(--bim-text-color, #fff)",e.textContent="路径漫游内容待实现",e}setLocales(){}setTheme(e){}destroy(){this.unsubscribeLocale?.(),this.unsubscribeTheme?.(),this.element&&this.element.parentElement&&this.element.parentElement.removeChild(this.element)}}class F2 extends en{dialogId="walk-path-dialog";dialog=null;panel=null;constructor(e){super(e)}init(){}show(){if(!this.engine.dialog||!this.engine.container){console.warn("Dialog manager or container is not initialized");return}this.destroy(),this.panel=new O2,this.panel.init();const e=300,t=400,n=20,i=this.engine.container,r=i.clientHeight,o=i.clientWidth-e-n,l=(r-t)/2;this.dialog=this.engine.dialog.create({id:this.dialogId,title:"walkControl.path.dialogTitle",width:e,height:t,position:{x:o,y:l},draggable:!0,resizable:!1,content:this.panel.element,onClose:()=>{this.engine.walkControl&&this.engine.walkControl.panel&&this.engine.walkControl.panel.setPathModeActive(!1),this.hide()}}),this.dialog.init()}hide(){this.destroy()}destroy(){const e=this.dialog;this.dialog=null,e&&e.destroy(),this.panel&&(this.panel.destroy(),this.panel=null)}}class z2 extends en{panel=null;pathManager=null;constructor(e){super(e)}init(){this.pathManager=new F2(this.engine),this.pathManager.init()}show(){if(!this.engine.toolbar){console.warn("Toolbar not initialized");return}this.engine.toolbar.hide(),this.panel=new k2({onPlanViewToggle:e=>{console.log("[WalkControl] 地图:",e),e?this.engine.map?.show():this.engine.map?.hide(),this.emit("walk:plan-view-toggle",{isActive:e})},onPathModeToggle:e=>{console.log("[WalkControl] 路径漫游:",e),e?this.pathManager?.show():this.pathManager?.hide(),this.emit("walk:path-mode-toggle",{isActive:e})},onWalkModeToggle:e=>{console.log("[WalkControl] 漫游模式:",e),e&&this.pathManager?.hide(),this.emit("walk:walk-mode-toggle",{isActive:e})},onSpeedChange:e=>{console.log("[WalkControl] 速度变化:",e),this.emit("walk:speed-change",{speed:e})},onGravityToggle:e=>{console.log("[WalkControl] 重力:",e),this.emit("walk:gravity-toggle",{enabled:e})},onCollisionToggle:e=>{console.log("[WalkControl] 碰撞:",e),this.emit("walk:collision-toggle",{enabled:e})},onCharacterModelChange:e=>{console.log("[WalkControl] 角色模型:",e)},onWalkModeChange:e=>{console.log("[WalkControl] 行走模式:",e)},onExit:()=>{this.hide()}}),this.panel.init(),this.engine.map?.isOpen()&&this.panel.setPlanViewActive(!0),this.engine.on("map:opened",()=>{this.panel?.setPlanViewActive(!0)}),this.engine.on("map:closed",()=>{this.panel?.setPlanViewActive(!1)}),this.engine.container?(this.panel.element.style.position="absolute",this.panel.element.style.bottom="20px",this.panel.element.style.left="50%",this.panel.element.style.transform="translateX(-50%)",this.panel.element.style.zIndex="1000",this.engine.container.appendChild(this.panel.element)):console.warn("[WalkControlManager] Container not found")}hide(){this.pathManager?.hide(),this.panel&&(this.panel.destroy(),this.panel=null),this.engine.toolbar&&this.engine.toolbar.show()}destroy(){this.hide(),this.pathManager?.destroy(),this.pathManager=null}}class H2{element;unsubscribeLocale=null;unsubscribeTheme=null;constructor(){}init(){this.element=this.createPanel(),this.unsubscribeLocale=Ht.subscribe(()=>this.setLocales()),this.unsubscribeTheme=st.subscribe(e=>this.setTheme(e)),this.setLocales(),this.setTheme(st.getTheme())}createPanel(){const e=document.createElement("div");return e.className="map-panel",e.style.padding="20px",e.style.color="#fff",e.textContent="地图内容待实现",e}setLocales(){}setTheme(e){}destroy(){this.unsubscribeLocale?.(),this.unsubscribeTheme?.(),this.element&&this.element.parentElement&&this.element.parentElement.removeChild(this.element)}}class V2 extends en{dialogId="map-dialog";dialog=null;panel=null;constructor(e){super(e)}init(){}show(){if(!this.engine.dialog||!this.engine.container){console.warn("Dialog manager or container is not initialized");return}if(this.isOpen())return;this.panel=new H2,this.panel.init();const e=300,t=400,n=20,i=20,a=this.engine.container.clientHeight,o=n,l=a-t-i;this.dialog=this.engine.dialog.create({id:this.dialogId,title:"map.dialogTitle",width:e,height:t,position:{x:o,y:l},draggable:!0,resizable:!1,content:this.panel.element,onClose:()=>{this.hide()}}),this.dialog.init(),this.emit("map:opened",{})}hide(){this.destroy(),this.emit("map:closed",{})}isOpen(){return this.dialog!==null}destroy(){const e=this.dialog;this.dialog=null,e&&e.destroy(),this.panel&&(this.panel.destroy(),this.panel=null)}}class G2{events=new Map;on(e,t){return this.events.has(e)||this.events.set(e,[]),this.events.get(e).push(t),()=>this.off(e,t)}off(e,t){const n=this.events.get(e);if(!n)return;const i=n.indexOf(t);i!==-1&&n.splice(i,1)}emit(e,t){const n=this.events.get(e);n&&n.forEach(i=>{try{i(t)}catch(r){console.error(`[EventEmitter] Error in listener for event "${e}":`,r)}})}clear(){this.events.clear()}}class W2 extends G2{container;wrapper=null;toolbar=null;constructTreeBtn=null;buttonGroup=null;dialog=null;engine=null;rightKey=null;propertyPanel=null;measure=null;sectionPlane=null;sectionAxis=null;sectionBox=null;walkControl=null;map=null;constructor(e,t){super();const n=typeof e=="string"?document.getElementById(e):e;if(!n)throw new Error("Container not found");this.container=n,t?.locale&&Ht.setLocale(t.locale),t?.theme&&(t.theme==="custom"?console.warn("Custom theme should be set via setCustomTheme()."):st.setTheme(t.theme)),this.init()}emit(e,t){super.emit(e,t)}on(e,t){return super.on(e,t)}setLocale(e){Ht.setLocale(e)}getLocale(){return Ht.getLocale()}setTheme(e){st.setTheme(e)}setCustomTheme(e){st.setCustomTheme(e)}init(){this.container.innerHTML="",this.wrapper=document.createElement("div"),this.wrapper.className="bim-engine-wrapper",this.container.appendChild(this.wrapper),this.engine=new M2(this,this.wrapper),this.dialog=new Ef(this,this.wrapper),this.toolbar=new Mf(this,this.wrapper),this.buttonGroup=new wf(this,this.wrapper),this.rightKey=new nf(this,this.wrapper),this.constructTreeBtn=new T2(this,this.wrapper),this.propertyPanel=new A2(this),this.measure=new R2(this),this.sectionPlane=new D2(this),this.sectionAxis=new N2(this),this.sectionBox=new B2(this),this.walkControl=new z2(this),this.walkControl.init(),this.map=new V2(this),this.map.init(),this.updateTheme(st.getTheme()),st.subscribe(e=>{this.updateTheme(e)})}updateTheme(e){this.wrapper&&(this.wrapper.style.color=e.textPrimary)}destroy(){this.toolbar?.destroy(),this.buttonGroup?.destroy(),this.engine?.destroy(),this.dialog?.destroy(),this.rightKey?.destroy(),this.propertyPanel?.destroy(),this.measure?.destroy(),this.sectionPlane?.destroy(),this.sectionAxis?.destroy(),this.sectionBox?.destroy(),this.walkControl?.destroy(),this.container.innerHTML="",this.clear()}}const X2=Object.freeze(Object.defineProperty({__proto__:null,createHomeButton:s=>({id:"home",groupId:"group-1",type:"button",label:"toolbar.home",icon:Tt("主视角"),keepActive:!1,onClick:e=>{console.log("首页按钮被点击:",e.id),s.engine?.CameraGoHome()}})},Symbol.toStringTag,{value:"Module"})),j2=Object.freeze(Object.defineProperty({__proto__:null,createZoomBoxButton:s=>({id:"zoom-box",groupId:"group-1",keepActive:!1,type:"button",label:"toolbar.zoomBox",icon:Tt("框选放大"),onClick:()=>{s.engine?.getEngine().rangeScale.active()}})},Symbol.toStringTag,{value:"Module"})),Z2=Object.freeze(Object.defineProperty({__proto__:null,createWalkMenuButton:s=>({id:"walk",groupId:"group-1",type:"button",label:"toolbar.walk",align:"vertical",icon:Tt("漫游"),onClick:()=>{console.log("漫游按钮被点击"),s.walkControl?.show()}})},Symbol.toStringTag,{value:"Module"})),q2=Object.freeze(Object.defineProperty({__proto__:null,createMapButton:s=>(s.on("map:opened",()=>{s.toolbar?.setBtnActive("map",!0)}),s.on("map:closed",()=>{s.toolbar?.setBtnActive("map",!1)}),{id:"map",groupId:"group-1",type:"button",label:"toolbar.map",align:"vertical",keepActive:!0,icon:Tt("地图"),onClick:()=>{s.map?.isOpen()?s.map?.hide():s.map?.show()}})},Symbol.toStringTag,{value:"Module"})),Y2=Object.freeze(Object.defineProperty({__proto__:null,createPropertyButton:s=>({id:"property",groupId:"group-1",type:"button",label:"toolbar.property",align:"vertical",icon:Tt("文档"),onClick:()=>{console.log("构件详情按钮被点击"),s.propertyPanel?.show()}})},Symbol.toStringTag,{value:"Module"})),K2=Object.freeze(Object.defineProperty({__proto__:null,createSettingButton:s=>({id:"setting",groupId:"group-2",type:"button",label:"toolbar.setting",icon:Tt("设置"),keepActive:!1,onClick:e=>{console.log("设置按钮被点击:",e.id)}})},Symbol.toStringTag,{value:"Module"})),$2='<svg viewBox="0 0 1024 1024"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" fill="currentColor"/><path d="M464 336a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" fill="currentColor"/></svg>',J2=Object.freeze(Object.defineProperty({__proto__:null,createInfoButton:s=>({id:"toolbar-info",groupId:"group-2",type:"button",label:"toolbar.info",icon:$2,onClick:()=>{document.dispatchEvent(new CustomEvent("bim-demo:open-property-panel"))}})},Symbol.toStringTag,{value:"Module"})),Q2=Object.freeze(Object.defineProperty({__proto__:null,createFullscreenButton:s=>({id:"fullscreen",groupId:"group-2",type:"button",label:"toolbar.fullscreen",align:"vertical",icon:Tt("全屏"),onClick:async()=>{console.log("全屏按钮被点击"),window.self!==window.top&&console.warn('检测到在 Iframe 中运行,请确保父级 iframe 标签拥有 allow="fullscreen" 属性');try{const t=document,i=!!(t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement);console.log("当前是否全屏:",i);const a=document.querySelector(".bim-engine-container")||document.body,o=a;if(i){console.log("准备退出全屏...");const l=t.exitFullscreen||t.webkitExitFullscreen||t.mozCancelFullScreen||t.msExitFullscreen;l&&(await l.call(t),console.log("退出全屏请求已发送"))}else{console.log("准备进入全屏..."),(a.style.backgroundColor===""||a.style.backgroundColor==="transparent")&&(a.style.backgroundColor="#ffffff");const l=o.requestFullscreen||o.webkitRequestFullscreen||o.mozRequestFullScreen||o.msRequestFullscreen;l?(await l.call(o,{navigationUI:"hide"}),console.log("全屏请求已发送")):(console.warn("当前浏览器不支持全屏 API"),alert("当前浏览器不支持全屏功能"))}}catch(t){console.error("全屏操作失败:",t),t&&t.message&&t.message.includes("denied")&&console.error('全屏请求被拒绝。如果是 Iframe,请检查 allow="fullscreen"。如果是自动触发,请确保由用户点击触发。')}}})},Symbol.toStringTag,{value:"Module"})),eM=Object.freeze(Object.defineProperty({__proto__:null,createMeasureButton:s=>({id:"measure",groupId:"group-1",type:"button",label:"toolbar.measure",icon:Tt("测量"),keepActive:!0,onClick:e=>{e.isActive?s.measure?.show():s.measure?.destroy()}})},Symbol.toStringTag,{value:"Module"})),tM=Object.freeze(Object.defineProperty({__proto__:null,createSectionMenuButton:s=>({id:"section",groupId:"group-1",type:"menu",label:"toolbar.section",align:"vertical",icon:Tt("剖切"),keepActive:!0,onClick:e=>{console.log("剖切按钮被点击:",e.id)}})},Symbol.toStringTag,{value:"Module"})),nM=Object.freeze(Object.defineProperty({__proto__:null,createSectionPlaneButton:s=>({id:"section-plane",groupId:"group-1",parentId:"section",type:"button",keepActive:!0,exclusive:!0,align:"vertical",label:"toolbar.sectionPlane",icon:Tt("拾曲面剖切"),onClick:e=>{console.log("拾取面剖切被点击:",e.id,"激活状态:",e.isActive),e.isActive?s.sectionPlane?.show():s.sectionPlane?.hide()}})},Symbol.toStringTag,{value:"Module"})),iM=Object.freeze(Object.defineProperty({__proto__:null,createSectionAxisButton:s=>({id:"section-axis",groupId:"group-1",parentId:"section",type:"button",keepActive:!0,exclusive:!0,align:"vertical",label:"toolbar.sectionAxis",icon:Tt("轴向剖切"),onClick:e=>{e.isActive?s.sectionAxis?.show():s.sectionAxis?.destroy()}})},Symbol.toStringTag,{value:"Module"})),sM=Object.freeze(Object.defineProperty({__proto__:null,createSectionBoxButton:s=>({id:"section-box",groupId:"group-1",parentId:"section",type:"button",keepActive:!0,exclusive:!0,align:"vertical",label:"toolbar.sectionBox",icon:Tt("剖切盒"),onClick:e=>{console.log("剖切盒被点击:",e.id,"激活状态:",e.isActive),e.isActive?s.sectionBox?.show():s.sectionBox?.hide()}})},Symbol.toStringTag,{value:"Module"}));Hi.BimEngine=W2,Object.defineProperty(Hi,Symbol.toStringTag,{value:"Module"})}));
|
||
//# sourceMappingURL=bim-engine-sdk.umd.js.map
|