diff --git a/.gitea/workflows/README.md b/.gitea/workflows/README.md deleted file mode 100644 index 60dd24f..0000000 --- a/.gitea/workflows/README.md +++ /dev/null @@ -1,121 +0,0 @@ -# NGINX CI/CD 配置说明 - -本目录包含了为 NGINX 项目定制的 Git Action 工作流配置文件。 - -## 工作流文件说明 - -### 1. `build-ubuntu.yaml` - 主要构建流程 -这是主要的构建和部署流水线,适用于生产环境: - -- **触发条件**: 代码推送和 Pull Request -- **功能**: - - 在 Ubuntu 22.04 上编译 NGINX - - 包含完整的模块配置(SSL、流处理、图像处理等) - - 创建 Docker 镜像并推送到 Harbor 仓库 - - 进行基本的功能测试 - - 上传构建产物 - -### 2. `build-multi-platform.yaml` - 多平台构建 -用于发布版本的完整构建流程: - -- **触发条件**: 标签推送、工作流手动触发 -- **功能**: - - 多 Ubuntu 版本支持(20.04、22.04) - - 配置验证和编译测试 - - 安全漏洞扫描 - - 完整的 Docker 镜像构建和发布 - -### 3. `build-dev.yaml` - 开发测试流程 -用于日常开发的快速验证: - -- **触发条件**: develop 分支和 feature 分支推送 -- **功能**: - - 快速构建(最小配置) - - 代码质量检查 - - 多编译器兼容性测试(GCC、Clang) - - 构建缓存优化 - -## 配置要点 - -### 依赖库安装 -根据 NGINX 官方文档,安装了以下依赖: -- `libpcre3-dev` - 正则表达式支持 -- `zlib1g-dev` - 压缩支持 -- `libssl-dev` - SSL/TLS 支持 -- `libxslt1-dev` - XSLT 模块 -- `libgd-dev` - 图像处理模块 -- `libgeoip-dev` - GeoIP 模块 - -### 编译配置 -使用 `./auto/configure` 脚本进行配置,主要特性: -- HTTP/2 支持 -- SSL/TLS 加密 -- 流处理模块 -- 图像过滤器 -- 地理位置模块 -- 负载均衡功能 - -### Docker 镜像 -- 基于 Ubuntu 22.04 -- 运行时优化(仅包含必要的运行时库) -- 健康检查配置 -- 非 root 用户运行 - -## 环境变量配置 - -需要在仓库设置中配置以下 Secrets: - -``` -HARBOR_REGISTRY # Harbor 仓库地址 -HARBOR_USERNAME # Harbor 用户名 -HARBOR_PASSWORD # Harbor 密码 -``` - -## 使用说明 - -### 开发流程 -1. 在 `develop` 或 `feature/*` 分支上工作 -2. 推送代码会触发 `build-dev.yaml`,进行快速验证 -3. 创建 Pull Request 到 `main` 分支 -4. 会触发完整的构建测试 - -### 发布流程 -1. 合并到 `main` 分支后,创建版本标签 -2. 推送标签会触发 `build-multi-platform.yaml` -3. 执行完整的多平台构建和安全扫描 -4. 自动构建并推送 Docker 镜像 - -### 手动触发 -可以在 Actions 页面手动触发 `build-multi-platform.yaml` 工作流。 - -## 构建产物 - -- **二进制文件**: 上传到 GitHub Actions Artifacts -- **Docker 镜像**: 推送到配置的 Harbor 仓库 -- **版本标记**: 支持语义化版本标签 - -## 故障排除 - -### 常见问题 -1. **依赖安装失败**: 检查 Ubuntu 版本和包名称 -2. **编译错误**: 查看具体的编译器错误信息 -3. **Docker 推送失败**: 检查 Harbor 凭据配置 -4. **测试失败**: 检查 NGINX 配置文件语法 - -### 调试建议 -- 查看 Actions 日志中的详细输出 -- 本地使用相同的命令进行测试 -- 检查依赖库版本兼容性 - -## 性能优化 - -- 使用 `make -j$(nproc)` 进行并行编译 -- 配置构建缓存减少重复下载 -- 分阶段构建减少单次运行时间 - -## 安全考虑 - -- 定期更新基础镜像 -- 运行 Trivy 安全扫描 -- 使用非 root 用户运行容器 -- 及时更新依赖库版本 diff --git a/.gitea/workflows/build-ubuntu.yaml b/.gitea/workflows/build-ubuntu.yaml index 141da9c..5200a17 100644 --- a/.gitea/workflows/build-ubuntu.yaml +++ b/.gitea/workflows/build-ubuntu.yaml @@ -111,6 +111,20 @@ jobs: echo "复制 nginx 文件到构建上下文..." sudo cp -r /usr/local/nginx ./nginx-install sudo chown -R $(whoami):$(whoami) ./nginx-install + + # 检查并复制前端文件 + echo "检查 app 目录..." + if [ -d "./app" ]; then + echo "发现前端应用目录,准备复制到 Nginx HTML 目录..." + mkdir -p ./nginx-install/html + cp -r ./app/* ./nginx-install/html/ + echo "前端文件已复制到 Nginx HTML 目录" + ls -la ./nginx-install/html/ + else + echo "未找到 app 目录,将使用默认 HTML 内容" + mkdir -p ./nginx-install/html + echo "

Nginx Default Page

Replace this with your application.

" > ./nginx-install/html/index.html + fi - name: 创建 Dockerfile run: | diff --git a/app/404.html b/app/404.html new file mode 100644 index 0000000..a420a1c --- /dev/null +++ b/app/404.html @@ -0,0 +1,125 @@ + +Not Found

\ No newline at end of file diff --git a/app/build-your-Quartz-og-image.webp b/app/build-your-Quartz-og-image.webp new file mode 100644 index 0000000..7be6750 Binary files /dev/null and b/app/build-your-Quartz-og-image.webp differ diff --git a/app/build-your-Quartz.html b/app/build-your-Quartz.html new file mode 100644 index 0000000..b2493cf --- /dev/null +++ b/app/build-your-Quartz.html @@ -0,0 +1,147 @@ + +build-your-Quartz

在您初始化 Quartz 之后,我们可以来看看它在本地构建出来的样子:

+
npx quartz build --serve
+
+

这将在您的计算机上启动一个本地 Web 服务器来运行 Quartz,打开浏览器并访问 http://localhost:8080/ 进行查看。

+

其他参数选项

+

要获得完整的帮助选项,您可以运行 npx quartz build --help.

+

其中大多数都有合理的默认值,但如果您需要自定义设置,则可以覆盖它们:

+

-d--directory: 内容文件夹,一般即 content

+

-v--verbose: 输出额外的日志信息

+

-o--output: 输出文件夹,一般即 public

+

--serve: 在本地运行一个支持热重载的服务器来预览您的 Quartz

+

--port: 本地服务器运行的端口

+

--concurrency: 解析文档内容所使用的线程数


\ No newline at end of file diff --git a/app/favicon.ico b/app/favicon.ico new file mode 100644 index 0000000..15b247f Binary files /dev/null and b/app/favicon.ico differ diff --git a/app/index-og-image.webp b/app/index-og-image.webp new file mode 100644 index 0000000..7edcf8f Binary files /dev/null and b/app/index-og-image.webp differ diff --git a/app/index.css b/app/index.css new file mode 100644 index 0000000..1b84cfd --- /dev/null +++ b/app/index.css @@ -0,0 +1 @@ +header{flex-direction:row;align-items:center;gap:1.5rem;margin:2rem 0;display:flex}header h1{flex:auto;margin:0}.clipboard-button{float:right;color:var(--gray);border-color:var(--dark);background-color:var(--light);opacity:0;border:1px solid;border-radius:5px;margin:.3rem;padding:.4rem;transition:all .2s;display:flex;position:absolute;right:0}.clipboard-button>svg{fill:var(--light);filter:contrast(.3)}.clipboard-button:hover{cursor:pointer;border-color:var(--secondary)}.clipboard-button:focus{outline:0}pre:hover>.clipboard-button{opacity:1;transition:all .2s}.breadcrumb-container{flex-flow:wrap;gap:.5rem;margin:.75rem 0 0;padding:0;display:flex}.breadcrumb-element{flex-direction:row;justify-content:center;align-items:center;display:flex}.breadcrumb-element p{margin:0 0 0 .5rem;padding:0;line-height:normal}.article-title{margin:2rem 0 0}.content-meta{color:var(--darkgray);margin-top:0}.content-meta[show-comma=true]>:not(:last-child){margin-right:8px}.content-meta[show-comma=true]>:not(:last-child):after{content:","}.tags{flex-wrap:wrap;gap:.4rem;margin:1rem 0;padding-left:0;list-style:none;display:flex}.section-li>.section>.tags{justify-content:flex-end}.tags>li{white-space:nowrap;overflow-wrap:normal;margin:0;display:inline-block}a.internal.tag-link{background-color:var(--highlight);border-radius:8px;margin:0 .1rem;padding:.2rem .4rem}.page-title{font-size:1.75rem;font-family:var(--titleFont);margin:0}.search{min-width:fit-content;max-width:14rem}@media (max-width:800px){.search{flex-grow:.3}}.search>.search-button{background-color:color-mix(in srgb,var(--lightgray)60%,var(--light));font-family:inherit;font-size:inherit;height:2rem;text-align:inherit;cursor:pointer;white-space:nowrap;border:none;border-radius:4px;justify-content:space-between;align-items:center;width:100%;padding:0;display:flex}.search>.search-button>p{padding:0 1rem;display:inline}.search>.search-button svg{cursor:pointer;width:18px;min-width:18px;margin:0 .5rem}.search>.search-button svg .search-path{stroke:var(--darkgray);stroke-width:2px;transition:stroke .5s}.search>.search-container{contain:layout;z-index:999;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);width:100vw;height:100vh;display:none;position:fixed;top:0;left:0;overflow-y:auto}.search>.search-container.active{display:inline-block}.search>.search-container>.search-space{width:65%;margin-top:12vh;margin-left:auto;margin-right:auto}@media not (min-width:1200px){.search>.search-container>.search-space{width:90%}}.search>.search-container>.search-space>*{background:var(--light);border-radius:7px;width:100%;margin-bottom:2em;box-shadow:0 14px 50px #1b21301f,0 10px 30px #1b213029}.search>.search-container>.search-space>input{box-sizing:border-box;font-family:var(--bodyFont);color:var(--dark);border:1px solid var(--lightgray);padding:.5em 1em;font-size:1.1em}.search>.search-container>.search-space>input:focus{outline:none}.search>.search-container>.search-space>.search-layout{border:1px solid var(--lightgray);box-sizing:border-box;flex-direction:row;flex:0 0 100%;display:none}.search>.search-container>.search-space>.search-layout.display-results{display:flex}.search>.search-container>.search-space>.search-layout[data-preview]>.results-container{flex:0 0 min(30%,450px)}@media not (max-width:800px){.search>.search-container>.search-space>.search-layout[data-preview] .result-card>p.preview{display:none}.search>.search-container>.search-space>.search-layout[data-preview]>div:first-child{border-right:1px solid var(--lightgray);border-top-right-radius:unset;border-bottom-right-radius:unset}.search>.search-container>.search-space>.search-layout[data-preview]>div:last-child{border-top-left-radius:unset;border-bottom-left-radius:unset}}.search>.search-container>.search-space>.search-layout>div{border-radius:5px;height:63vh}@media (max-width:800px){.search>.search-container>.search-space>.search-layout{flex-direction:column}.search>.search-container>.search-space>.search-layout>.preview-container{display:none!important}.search>.search-container>.search-space>.search-layout[data-preview]>.results-container{flex:0 0 100%;width:100%;height:auto}}.search>.search-container>.search-space>.search-layout .highlight{background:color-mix(in srgb,var(--tertiary)60%,#fff0);border-radius:5px;scroll-margin-top:2rem}.search>.search-container>.search-space>.search-layout>.preview-container{color:var(--dark);flex-grow:1;padding:0 2rem;font-family:inherit;font-weight:400;line-height:1.5em;display:block;overflow:hidden auto}.search>.search-container>.search-space>.search-layout>.preview-container .preview-inner{width:min(800px,100%);margin:0 auto}.search>.search-container>.search-space>.search-layout>.preview-container a[role=anchor]{background-color:#0000}.search>.search-container>.search-space>.search-layout>.results-container{overflow-y:auto}.search>.search-container>.search-space>.search-layout>.results-container .result-card{cursor:pointer;border-bottom:1px solid var(--lightgray);box-sizing:border-box;text-transform:none;text-align:left;width:100%;font-family:inherit;font-size:100%;line-height:1.15;font-weight:inherit;outline:none;margin:0;padding:1em;transition:background .2s;display:block;overflow:hidden}.search>.search-container>.search-space>.search-layout>.results-container .result-card:hover,.search>.search-container>.search-space>.search-layout>.results-container .result-card:focus,.search>.search-container>.search-space>.search-layout>.results-container .result-card.focus{background:var(--lightgray)}.search>.search-container>.search-space>.search-layout>.results-container .result-card>h3{margin:0}@media not (max-width:800px){.search>.search-container>.search-space>.search-layout>.results-container .result-card>p.card-description{display:none}}.search>.search-container>.search-space>.search-layout>.results-container .result-card>ul.tags{margin-top:.45rem;margin-bottom:0}.search>.search-container>.search-space>.search-layout>.results-container .result-card>ul>li>p{background-color:var(--highlight);color:var(--secondary);border-radius:8px;margin:0 .1rem;padding:.2rem .4rem;font-weight:700;line-height:1.4rem}.search>.search-container>.search-space>.search-layout>.results-container .result-card>ul>li>p.match-tag{color:var(--tertiary)}.search>.search-container>.search-space>.search-layout>.results-container .result-card>p{margin-bottom:0}.darkmode{cursor:pointer;width:20px;height:20px;text-align:inherit;background:0 0;border:none;flex-shrink:0;margin:0;padding:0;position:relative}.darkmode svg{width:20px;height:20px;fill:var(--darkgray);transition:opacity .1s;position:absolute;top:calc(50% - 10px)}:root[saved-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}:root[saved-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}:root[saved-theme=dark] .darkmode>.dayIcon{display:none}:root[saved-theme=dark] .darkmode>.nightIcon,:root .darkmode>.dayIcon{display:inline}:root .darkmode>.nightIcon{display:none}.readermode{cursor:pointer;width:20px;height:20px;text-align:inherit;background:0 0;border:none;flex-shrink:0;margin:0;padding:0;position:relative}.readermode svg{width:20px;height:20px;fill:var(--darkgray);stroke:var(--darkgray);transition:opacity .1s;position:absolute;top:calc(50% - 10px)}:root[reader-mode=on] .sidebar.left,:root[reader-mode=on] .sidebar.right{opacity:0;transition:opacity .2s}:root[reader-mode=on] .sidebar.left:hover,:root[reader-mode=on] .sidebar.right:hover{opacity:1}@media (max-width:800px){.page>#quartz-body>:not(.sidebar.left:has(.explorer)){transition:transform .3s ease-in-out}.page>#quartz-body.lock-scroll>:not(.sidebar.left:has(.explorer)){transition:transform .3s ease-in-out;transform:translate(100dvw)}.page>#quartz-body .sidebar.left:has(.explorer){box-sizing:border-box;background-color:var(--light);margin:0;padding:1rem 0;position:sticky}.page>#quartz-body .hide-until-loaded~.explorer-content{display:none}}.explorer{flex-direction:column;flex:0 auto;min-height:1.2rem;display:flex;overflow-y:hidden}.explorer.collapsed{flex:0 1.2rem}.explorer.collapsed .fold{transform:rotate(-90deg)}.explorer .fold{opacity:.8;margin-left:.5rem;transition:transform .3s}@media (max-width:800px){.explorer{height:initial;flex-shrink:0;order:-1;align-self:flex-start;margin-top:auto;margin-bottom:auto;overflow:hidden}}.explorer button.mobile-explorer{display:none}.explorer button.desktop-explorer{display:flex}@media (max-width:800px){.explorer button.mobile-explorer{display:flex}.explorer button.desktop-explorer{display:none}}@media not (max-width:800px){.explorer.desktop-only{display:flex}}.explorer svg{pointer-events:all;transition:transform .35s}.explorer svg>polyline{pointer-events:none}button.mobile-explorer,button.desktop-explorer{text-align:left;cursor:pointer;color:var(--dark);background-color:#0000;border:none;align-items:center;padding:0;display:flex}button.mobile-explorer h2,button.desktop-explorer h2{margin:0;font-size:1rem;display:inline-block}.explorer-content{margin-top:.5rem;list-style:none;overflow:hidden auto}.explorer-content ul{overscroll-behavior:contain;margin:0;padding:0;list-style:none}.explorer-content ul li>a{color:var(--dark);opacity:.75;pointer-events:all}.explorer-content ul li>a.active{opacity:1;color:var(--tertiary)}.explorer-content .folder-outer{grid-template-rows:0fr;transition:grid-template-rows .3s ease-in-out;display:grid}.explorer-content .folder-outer.open{grid-template-rows:1fr}.explorer-content .folder-outer>ul{border-left:1px solid var(--lightgray);margin-left:6px;padding-left:.8rem;overflow:hidden}.folder-container{-webkit-user-select:none;user-select:none;flex-direction:row;align-items:center;display:flex}.folder-container div>a{color:var(--secondary);font-family:var(--headerFont);font-size:.95rem;font-weight:600;line-height:1.5rem;display:inline-block}.folder-container div>a:hover{color:var(--tertiary)}.folder-container div>button{color:var(--dark);text-align:left;cursor:pointer;font-family:var(--headerFont);background-color:#0000;border:none;align-items:center;padding-left:0;padding-right:0;display:flex}.folder-container div>button span{color:var(--secondary);pointer-events:none;margin:0;font-size:.95rem;font-weight:600;line-height:1.5rem;display:inline-block}.folder-icon{color:var(--secondary);cursor:pointer;backface-visibility:visible;flex-shrink:0;margin-right:5px;transition:transform .3s}li:has(>.folder-outer:not(.open))>.folder-container>svg{transform:rotate(-90deg)}.folder-icon:hover{color:var(--tertiary)}@media (max-width:800px){.explorer.collapsed{flex:0 0 34px}.explorer.collapsed>.explorer-content{visibility:hidden;transform:translate(-100vw)}.explorer:not(.collapsed){flex:0 0 34px}.explorer:not(.collapsed)>.explorer-content{visibility:visible;transform:translate(0)}.explorer .explorer-content{box-sizing:border-box;z-index:100;background-color:var(--light);visibility:hidden;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin-top:0;padding:4rem 0 2rem;transition:transform .2s,visibility .2s;position:absolute;top:0;left:0;overflow:hidden;transform:translate(-100vw)}.explorer .mobile-explorer{z-index:101;margin:0;padding:5px}.explorer .mobile-explorer .lucide-menu{stroke:var(--darkgray)}.mobile-no-scroll{overscroll-behavior:none}}.graph>h3{margin:0;font-size:1rem}.graph>.graph-outer{border:1px solid var(--lightgray);box-sizing:border-box;border-radius:5px;height:250px;margin:.5em 0;position:relative;overflow:hidden}.graph>.graph-outer>.global-graph-icon{cursor:pointer;color:var(--dark);opacity:.5;cursor:pointer;background:0 0;border:none;border-radius:4px;width:24px;height:24px;margin:.3rem;padding:.2rem;transition:background-color .5s;position:absolute;top:0;right:0}.graph>.graph-outer>.global-graph-icon:hover{background-color:var(--lightgray)}.graph>.global-graph-outer{z-index:9999;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);width:100vw;height:100%;display:none;position:fixed;top:0;left:0;overflow:hidden}.graph>.global-graph-outer.active{display:inline-block}.graph>.global-graph-outer>.global-graph-container{border:1px solid var(--lightgray);background-color:var(--light);box-sizing:border-box;border-radius:5px;width:80vw;height:80vh;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}@media not (min-width:1200px){.graph>.global-graph-outer>.global-graph-container{width:90%}}.toc{flex-direction:column;flex:0 .5 auto;min-height:1.4rem;display:flex;overflow-y:hidden}.toc:has(button.toc-header.collapsed){flex:0 1.4rem}button.toc-header{text-align:left;cursor:pointer;color:var(--dark);background-color:#0000;border:none;align-items:center;padding:0;display:flex}button.toc-header h3{margin:0;font-size:1rem;display:inline-block}button.toc-header .fold{opacity:.8;margin-left:.5rem;transition:transform .3s}button.toc-header.collapsed .fold{transform:rotate(-90deg)}ul.toc-content.overflow{overscroll-behavior:contain;max-height:calc(100% - 2rem);margin:.5rem 0;padding:0;list-style:none;position:relative}ul.toc-content.overflow>li>a{color:var(--dark);opacity:.35;transition:opacity .5s,color .3s}ul.toc-content.overflow>li>a.in-view{opacity:.75}ul.toc-content.overflow .depth-0{padding-left:0}ul.toc-content.overflow .depth-1{padding-left:1rem}ul.toc-content.overflow .depth-2{padding-left:2rem}ul.toc-content.overflow .depth-3{padding-left:3rem}ul.toc-content.overflow .depth-4{padding-left:4rem}ul.toc-content.overflow .depth-5{padding-left:5rem}ul.toc-content.overflow .depth-6{padding-left:6rem}.backlinks{flex-direction:column}.backlinks>h3{margin:0;font-size:1rem}.backlinks>ul.overflow{overscroll-behavior:contain;max-height:calc(100% - 2rem);margin:.5rem 0;padding:0;list-style:none}.backlinks>ul.overflow>li>a{background-color:#0000}footer{text-align:left;opacity:.7;margin-bottom:4rem}footer ul{flex-direction:row;gap:1rem;margin:-1rem 0 0;padding:0;list-style:none;display:flex}ul.section-ul{margin-top:2em;padding-left:0;list-style:none}li.section-li{margin-bottom:1em}li.section-li>.section{grid-template-columns:fit-content(8em) 3fr 1fr;display:grid}@media (max-width:800px){li.section-li>.section>.tags{display:none}}li.section-li>.section>.desc>h3>a{background-color:#0000}li.section-li>.section .meta{opacity:.6;margin:0 1em 0 0}.popover .section{grid-template-columns:fit-content(8em) 1fr!important}.popover .section>.tags{display:none}.section h3,.section>.tags{margin:0}@keyframes dropin{0%{opacity:0;visibility:hidden}1%{opacity:0}to{opacity:1;visibility:visible}}.popover{z-index:999;will-change:transform;visibility:hidden;opacity:0;padding:1rem;transition:opacity .3s,visibility .3s;position:fixed;top:0;left:0;overflow:visible}.popover>.popover-inner{width:30rem;max-height:20rem;font-weight:initial;font-style:initial;line-height:normal;font-size:initial;font-family:var(--bodyFont);border:1px solid var(--lightgray);background-color:var(--light);overscroll-behavior:contain;white-space:normal;-webkit-user-select:none;user-select:none;cursor:default;border-radius:5px;padding:0 1rem 1rem;position:relative;overflow:auto;box-shadow:6px 6px 36px #00000040}.popover>.popover-inner[data-content-type][data-content-type*=pdf],.popover>.popover-inner[data-content-type][data-content-type*=image]{max-height:100%;padding:0}.popover>.popover-inner[data-content-type][data-content-type*=image] img{border-radius:0;margin:0;display:block}.popover>.popover-inner[data-content-type][data-content-type*=pdf] iframe{width:100%}.popover h1{font-size:1.5rem}@media (max-width:800px){.popover{display:none!important}}.active-popover,.popover:hover{animation:.3s .2s forwards dropin}code[data-theme*=\ ]{color:var(--shiki-light);background-color:var(--shiki-light-bg)}code[data-theme*=\ ] span{color:var(--shiki-light)}[saved-theme=dark] code[data-theme*=\ ]{color:var(--shiki-dark);background-color:var(--shiki-dark-bg)}[saved-theme=dark] code[data-theme*=\ ] span{color:var(--shiki-dark)}.callout{border:1px solid var(--border);background-color:var(--bg);box-sizing:border-box;--callout-icon-note:url("data:image/svg+xml; utf8, ");--callout-icon-abstract:url("data:image/svg+xml; utf8, ");--callout-icon-info:url("data:image/svg+xml; utf8, ");--callout-icon-todo:url("data:image/svg+xml; utf8, ");--callout-icon-tip:url("data:image/svg+xml; utf8, ");--callout-icon-success:url("data:image/svg+xml; utf8, ");--callout-icon-question:url("data:image/svg+xml; utf8, ");--callout-icon-warning:url("data:image/svg+xml; utf8, ");--callout-icon-failure:url("data:image/svg+xml; utf8, ");--callout-icon-danger:url("data:image/svg+xml; utf8, ");--callout-icon-bug:url("data:image/svg+xml; utf8, ");--callout-icon-example:url("data:image/svg+xml; utf8, ");--callout-icon-quote:url("data:image/svg+xml; utf8, ");--callout-icon-fold:url("data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"%3E%3Cpolyline points=\"6 9 12 15 18 9\"%3E%3C/polyline%3E%3C/svg%3E");border-radius:5px;padding:0 1rem;overflow-y:hidden}.callout>.callout-content{transition:grid-template-rows .3s;display:grid}.callout>.callout-content>.callout-content-inner{overflow:hidden}.callout>.callout-content>.callout-content-inner>:first-child{margin-top:0}.callout[data-callout]{--color:#448aff;--border:#448aff44;--bg:#448aff10;--callout-icon:var(--callout-icon-note)}.callout[data-callout=abstract]{--color:#00b0ff;--border:#00b0ff44;--bg:#00b0ff10;--callout-icon:var(--callout-icon-abstract)}.callout[data-callout=info],.callout[data-callout=todo]{--color:#00b8d4;--border:#00b8d444;--bg:#00b8d410;--callout-icon:var(--callout-icon-info)}.callout[data-callout=todo]{--callout-icon:var(--callout-icon-todo)}.callout[data-callout=tip]{--color:#00bfa5;--border:#00bfa544;--bg:#00bfa510;--callout-icon:var(--callout-icon-tip)}.callout[data-callout=success]{--color:#09ad7a;--border:#09ad7144;--bg:#09ad7110;--callout-icon:var(--callout-icon-success)}.callout[data-callout=question]{--color:#dba642;--border:#dba64244;--bg:#dba64210;--callout-icon:var(--callout-icon-question)}.callout[data-callout=warning]{--color:#db8942;--border:#db894244;--bg:#db894210;--callout-icon:var(--callout-icon-warning)}.callout[data-callout=failure],.callout[data-callout=danger],.callout[data-callout=bug]{--color:#db4242;--border:#db424244;--bg:#db424210;--callout-icon:var(--callout-icon-failure)}.callout[data-callout=bug]{--callout-icon:var(--callout-icon-bug)}.callout[data-callout=danger]{--callout-icon:var(--callout-icon-danger)}.callout[data-callout=example]{--color:#7a43b5;--border:#7a43b544;--bg:#7a43b510;--callout-icon:var(--callout-icon-example)}.callout[data-callout=quote]{--color:var(--secondary);--border:var(--lightgray);--callout-icon:var(--callout-icon-quote)}.callout.is-collapsed>.callout-title>.fold-callout-icon{transform:rotate(-90deg)}.callout-title{color:var(--color);--icon-size:18px;align-items:flex-start;gap:5px;padding:1rem 0;display:flex}.callout-title .fold-callout-icon{opacity:.8;cursor:pointer;--callout-icon:var(--callout-icon-fold);transition:transform .15s}.callout-title>.callout-title-inner>p{color:var(--color);margin:0}.callout-title .callout-icon,.callout-title .fold-callout-icon{width:var(--icon-size);height:var(--icon-size);flex:0 0 var(--icon-size);background-size:var(--icon-size)var(--icon-size);background-position:50%;background-color:var(--color);-webkit-mask-image:var(--callout-icon);mask-image:var(--callout-icon);-webkit-mask-size:var(--icon-size)var(--icon-size);mask-size:var(--icon-size)var(--icon-size);padding:.2rem 0;-webkit-mask-position:50%;mask-position:50%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.callout-title .callout-title-inner{font-weight:600}html{scroll-behavior:smooth;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;width:100vw;overflow-x:hidden}body{box-sizing:border-box;background-color:var(--light);font-family:var(--bodyFont);color:var(--darkgray);margin:0}.text-highlight{background-color:var(--textHighlight);border-radius:5px;padding:0 .1rem}::selection{background:color-mix(in srgb,var(--tertiary)60%,#fff0);color:var(--darkgray)}p,ul,text,a,tr,td,li,ol,ul,.katex,.math{color:var(--darkgray);fill:var(--darkgray);-webkit-hyphens:auto;hyphens:auto}p,ul,text,a,li,ol,ul,.katex,.math{overflow-wrap:anywhere}.math.math-display{text-align:center}article>mjx-container.MathJax,article blockquote>div>mjx-container.MathJax{display:flex}article>mjx-container.MathJax>svg,article blockquote>div>mjx-container.MathJax>svg{margin-left:auto;margin-right:auto}article blockquote>div>mjx-container.MathJax>svg{margin-top:1rem;margin-bottom:1rem}strong{font-weight:600}a{color:var(--secondary);font-weight:600;text-decoration:none;transition:color .2s}a:hover{color:var(--tertiary)}a.internal{background-color:var(--highlight);border-radius:5px;padding:0 .1rem;line-height:1.4rem;text-decoration:none}a.internal.broken{color:var(--secondary);opacity:.5;transition:opacity .2s}a.internal.broken:hover{opacity:.8}a.internal:has(>img){background-color:#0000;border-radius:0;padding:0}a.internal.tag-link:before{content:"#"}a.external .external-icon{height:1ex;margin:0 .15em}a.external .external-icon>path{fill:var(--dark)}.flex-component{display:flex}.desktop-only{display:initial}.desktop-only.flex-component{display:flex}@media (max-width:800px){.desktop-only,.desktop-only.flex-component{display:none}}.mobile-only,.mobile-only.flex-component{display:none}@media (max-width:800px){.mobile-only{display:initial}.mobile-only.flex-component{display:flex}}.page{max-width:1500px;margin:0 auto}.page article>h1{font-size:2rem}.page article li:has(>input[type=checkbox]){padding-left:0;list-style-type:none}.page article li:has(>input[type=checkbox]:checked){text-decoration:line-through;-webkit-text-decoration-color:var(--gray);text-decoration-color:var(--gray);color:var(--gray)}.page article li>*{margin-top:0;margin-bottom:0}.page article p>strong{color:var(--dark)}.page>#quartz-body{grid-template:"grid-sidebar-left grid-header grid-sidebar-right""grid-sidebar-left grid-center grid-sidebar-right""grid-sidebar-left grid-footer grid-sidebar-right"/320px auto 320px;gap:5px;display:grid}@media (min-width:800px) and (max-width:1200px){.page>#quartz-body{grid-template:"grid-sidebar-left grid-header""grid-sidebar-left grid-center""grid-sidebar-left grid-sidebar-right""grid-sidebar-left grid-footer"/320px auto;gap:5px}}@media (max-width:800px){.page>#quartz-body{grid-template:"grid-sidebar-left""grid-header""grid-center""grid-sidebar-right""grid-footer"/auto;gap:5px}}@media not (min-width:1200px){.page>#quartz-body{padding:0 1rem}}@media (max-width:800px){.page>#quartz-body{margin:0 auto}}.page>#quartz-body .sidebar{box-sizing:border-box;gap:2rem;height:100vh;padding:6rem 2rem 2rem;display:flex;position:sticky;top:0}.page>#quartz-body .sidebar.left{z-index:1;flex-direction:column;grid-area:grid-sidebar-left}@media (max-width:800px){.page>#quartz-body .sidebar.left{position:initial;height:unset;flex-direction:row;align-items:center;gap:0;padding:2rem 0 0;display:flex}}.page>#quartz-body .sidebar.right{flex-direction:column;grid-area:grid-sidebar-right;margin-right:0}@media (max-width:800px){.page>#quartz-body .sidebar.right{margin-left:inherit;margin-right:inherit}}@media not (min-width:1200px){.page>#quartz-body .sidebar.right{position:initial;height:unset;flex-direction:row;width:100%;padding:0}.page>#quartz-body .sidebar.right>*{flex:1;max-height:24rem}.page>#quartz-body .sidebar.right>.toc{display:none}}.page>#quartz-body .page-header,.page>#quartz-body .page-footer{margin-top:1rem}.page>#quartz-body .page-header{grid-area:grid-header;margin:6rem 0 0}@media (max-width:800px){.page>#quartz-body .page-header{margin-top:0;padding:0}}.page>#quartz-body .center>article{grid-area:grid-center}.page>#quartz-body footer{grid-area:grid-footer}.page>#quartz-body .center,.page>#quartz-body footer{min-width:100%;max-width:100%;margin-left:auto;margin-right:auto}@media (min-width:800px) and (max-width:1200px){.page>#quartz-body .center,.page>#quartz-body footer{margin-right:0}}@media (max-width:800px){.page>#quartz-body .center,.page>#quartz-body footer{margin-left:0;margin-right:0}}.page>#quartz-body footer{margin-left:0}.footnotes{border-top:1px solid var(--lightgray);margin-top:2rem}input[type=checkbox]{color:var(--secondary);border:1px solid var(--lightgray);background-color:var(--light);appearance:none;border-radius:3px;width:16px;height:16px;margin-inline:-1.4rem .2rem;position:relative;transform:translateY(2px)}input[type=checkbox]:checked{border-color:var(--secondary);background-color:var(--secondary)}input[type=checkbox]:checked:after{content:"";border:solid var(--light);border-width:0 2px 2px 0;width:4px;height:8px;display:block;position:absolute;top:1px;left:4px;transform:rotate(45deg)}blockquote{border-left:3px solid var(--secondary);margin:1rem 0;padding-left:1rem;transition:border-color .2s}h1,h2,h3,h4,h5,h6,thead{font-family:var(--headerFont);color:var(--dark);font-weight:revert;margin-bottom:0}article>h1>a[role=anchor],article>h2>a[role=anchor],article>h3>a[role=anchor],article>h4>a[role=anchor],article>h5>a[role=anchor],article>h6>a[role=anchor],article>thead>a[role=anchor]{color:var(--dark);background-color:#0000}h1[id]>a[href^=\#],h2[id]>a[href^=\#],h3[id]>a[href^=\#],h4[id]>a[href^=\#],h5[id]>a[href^=\#],h6[id]>a[href^=\#]{opacity:0;font-family:var(--codeFont);-webkit-user-select:none;user-select:none;margin:0 .5rem;transition:opacity .2s;transform:translateY(-.1rem)}h1[id]:hover>a,h2[id]:hover>a,h3[id]:hover>a,h4[id]:hover>a,h5[id]:hover>a,h6[id]:hover>a{opacity:1}h1:not([id])>a[role=anchor],h2:not([id])>a[role=anchor],h3:not([id])>a[role=anchor],h4:not([id])>a[role=anchor],h5:not([id])>a[role=anchor],h6:not([id])>a[role=anchor]{display:none}h1{margin-top:2.25rem;margin-bottom:1rem;font-size:1.75rem}h2{margin-top:1.9rem;margin-bottom:1rem;font-size:1.4rem}h3{margin-top:1.62rem;margin-bottom:1rem;font-size:1.12rem}h4,h5,h6{margin-top:1.5rem;margin-bottom:1rem;font-size:1rem}figure[data-rehype-pretty-code-figure]{margin:0;line-height:1.6rem;position:relative}figure[data-rehype-pretty-code-figure]>[data-rehype-pretty-code-title]{font-family:var(--codeFont);border:1px solid var(--lightgray);width:fit-content;color:var(--darkgray);border-radius:5px;margin-bottom:-.5rem;padding:.1rem .5rem;font-size:.9rem}figure[data-rehype-pretty-code-figure]>pre{padding:0}pre{font-family:var(--codeFont);border:1px solid var(--lightgray);border-radius:5px;padding:0 .5rem;position:relative;overflow-x:auto}pre:has(>code.mermaid){border:none}pre>code{counter-reset:line;counter-increment:line 0;background:0 0;padding:.5rem 0;font-size:.85rem;display:grid;overflow-x:auto}pre>code [data-highlighted-chars]{background-color:var(--highlight);border-radius:5px}pre>code>[data-line]{box-sizing:border-box;border-left:3px solid #0000;padding:0 .25rem}pre>code>[data-line][data-highlighted-line]{background-color:var(--highlight);border-left:3px solid var(--secondary)}pre>code>[data-line]:before{content:counter(line);counter-increment:line;text-align:right;color:#738a9499;width:1rem;margin-right:1rem;display:inline-block}pre>code[data-line-numbers-max-digits="2"]>[data-line]:before{width:2rem}pre>code[data-line-numbers-max-digits="3"]>[data-line]:before{width:3rem}code{color:var(--dark);font-size:.9em;font-family:var(--codeFont);background:var(--lightgray);border-radius:5px;padding:.1rem .2rem}tbody,li,p{line-height:1.6rem}.table-container{overflow-x:auto}.table-container>table{border-collapse:collapse;margin:1rem;padding:1.5rem}.table-container>table th,.table-container>table td{min-width:75px}.table-container>table>*{line-height:2rem}th{text-align:left;border-bottom:2px solid var(--gray);padding:.4rem .7rem}td{padding:.2rem .7rem}tr{border-bottom:1px solid var(--lightgray)}tr:last-child{border-bottom:none}img{content-visibility:auto;border-radius:5px;max-width:100%;margin:1rem 0}p>img+em{display:block;transform:translateY(-1rem)}hr{background-color:var(--lightgray);border:none;width:100%;height:1px;margin:2rem auto}audio,video{border-radius:5px;width:100%}.spacer{flex:2 auto}div:has(>.overflow){max-height:100%;overflow-y:hidden}ul.overflow,ol.overflow{content:"";clear:both;width:100%;max-height:100%;margin-bottom:0;overflow-y:auto}ul.overflow>li.overflow-end,ol.overflow>li.overflow-end{height:.5rem;margin:0}ul.overflow.gradient-active,ol.overflow.gradient-active{-webkit-mask-image:linear-gradient(#000 calc(100% - 50px),#0000 100%);mask-image:linear-gradient(#000 calc(100% - 50px),#0000 100%)}.transclude ul{padding-left:1rem}.katex-display{display:initial;overflow:auto hidden}.external-embed.youtube,iframe.pdf{aspect-ratio:16/9;border-radius:5px;width:100%;height:100%}.navigation-progress{background:var(--secondary);z-index:9999;width:0;height:3px;transition:width .2s;position:fixed;top:0;left:0}:root{--light:#faf8f8;--lightgray:#e5e5e5;--gray:#b8b8b8;--darkgray:#4e4e4e;--dark:#2b2b2b;--secondary:#284b63;--tertiary:#84a59d;--highlight:#8f9fa926;--textHighlight:#fff23688;--titleFont:"Schibsted Grotesk",system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--headerFont:"Schibsted Grotesk",system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--bodyFont:"Source Sans Pro",system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--codeFont:"IBM Plex Mono",ui-monospace,SFMono-Regular,SF Mono,Menlo,monospace}:root[saved-theme=dark]{--light:#161618;--lightgray:#393639;--gray:#646464;--darkgray:#d4d4d4;--dark:#ebebec;--secondary:#7b97aa;--tertiary:#84a59d;--highlight:#8f9fa926;--textHighlight:#b3aa0288} \ No newline at end of file diff --git a/app/index.html b/app/index.html new file mode 100644 index 0000000..301273d --- /dev/null +++ b/app/index.html @@ -0,0 +1,136 @@ + +Welcome to Quartz

This is a blank Quartz installation. +See the documentation for how to get started.


\ No newline at end of file diff --git a/app/index.xml b/app/index.xml new file mode 100644 index 0000000..106bcc5 --- /dev/null +++ b/app/index.xml @@ -0,0 +1,22 @@ + + + + Quartz 4 + https://quartz.jzhao.xyz + Last 10 notes on Quartz 4 + Quartz -- quartz.jzhao.xyz + + build-your-Quartz + https://quartz.jzhao.xyz/build-your-Quartz + https://quartz.jzhao.xyz/build-your-Quartz + 在您初始化 Quartz 之后,我们可以来看看它在本地构建出来的样子: npx quartz build --serve 这将在您的计算机上启动一个本地 Web 服务器来运行 Quartz,打开浏览器并访问 http://localhost:8080/ 进行查看。 其他参数选项 要获得完整的帮助选项,您可以运行 npx quartz build --help. + Tue, 10 Jun 2025 02:33:41 GMT + + Welcome to Quartz + https://quartz.jzhao.xyz/ + https://quartz.jzhao.xyz/ + This is a blank Quartz installation. See the documentation for how to get started. + Wed, 23 Aug 2023 19:09:04 GMT + + + \ No newline at end of file diff --git a/app/postscript.js b/app/postscript.js new file mode 100644 index 0000000..cef03f1 --- /dev/null +++ b/app/postscript.js @@ -0,0 +1,1097 @@ +(function(){var Ut='',xt='';document.addEventListener("nav",()=>{let Bt=document.getElementsByTagName("pre");for(let Et=0;Et{Ft.blur(),Ft.innerHTML=xt,setTimeout(()=>{Ft.innerHTML=Ut,Ft.style.borderColor=""},2e3)},Lr=>console.error(Lr))};var bt=_;let nr=(Ct.dataset.clipboard?JSON.parse(Ct.dataset.clipboard):Ct.innerText).replace(/\n\n/g,` +`),Ft=document.createElement("button");Ft.className="clipboard-button",Ft.type="button",Ft.innerHTML=Ut,Ft.ariaLabel="Copy source",Ft.addEventListener("click",_),window.addCleanup(()=>Ft.removeEventListener("click",_)),Bt[Et].prepend(Ft)}}})})(),function(){var Ut=Object.create,xt=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,bt=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty,_=(g,b)=>()=>(b||g((b={exports:{}}).exports,b),b.exports),nr=(g,b,S,p)=>{if(b&&typeof b=="object"||typeof b=="function")for(let m of bt(b))!Ct.call(g,m)&&m!==S&&xt(g,m,{get:()=>b[m],enumerable:!(p=Bt(b,m))||p.enumerable});return g},Ft=(g,b,S)=>(S=g!=null?Ut(Et(g)):{},nr(b||!g||!g.__esModule?xt(S,"default",{value:g,enumerable:!0}):S,g)),Lr=_(()=>{}),Qt=_((g,b)=>{"use strict";b.exports=p;function S(T){return T instanceof Buffer?Buffer.from(T):new T.constructor(T.buffer.slice(),T.byteOffset,T.length)}function p(T){if(T=T||{},T.circles)return m(T);let E=new Map;if(E.set(Date,W=>new Date(W)),E.set(Map,(W,q)=>new Map(M(Array.from(W),q))),E.set(Set,(W,q)=>new Set(M(Array.from(W),q))),T.constructorHandlers)for(let W of T.constructorHandlers)E.set(W[0],W[1]);let C=null;return T.proto?V:F;function M(W,q){let z=Object.keys(W),I=new Array(z.length);for(let Q=0;Qnew Date(z)),M.set(Map,(z,I)=>new Map(V(Array.from(z),I))),M.set(Set,(z,I)=>new Set(V(Array.from(z),I))),T.constructorHandlers)for(let z of T.constructorHandlers)M.set(z[0],z[1]);let F=null;return T.proto?q:W;function V(z,I){let Q=Object.keys(z),j=new Array(Q.length);for(let re=0;re=this.B&&(W||!V[I])){var T=Ae(q,p,z),E="";switch(this.G){case"full":if(2T;C--)if(C-T>=this.B){var M=Ae(q,p,z,m,T);E=I.substring(T,C),Le(this,V,E,M,g,S)}break}case"reverse":if(1=this.B&&Le(this,V,E,Ae(q,p,z,m,C),g,S);E=""}case"forward":if(1=this.B&&Le(this,V,E,T,g,S);break}default:if(this.C&&(T=Math.min(T/this.C(b,I,z)|0,q-1)),Le(this,V,I,T,g,S),W&&1=this.B&&!m[I]){m[I]=1;let Q=this.l&&I>T;Le(this,F,Q?T:I,Ae(E+(p/2>E?0:1),p,z,C-1,M-1),g,S,Q?I:T)}}}}}this.m||(this.register[g]=1)}}return this};function Ae(g,b,S,p,m){return S&&1=this.B&&!S[q])if(this.s||T||this.map[q])M[W++]=q,S[q]=1;else return p;g=M,m=g.length}if(!m)return p;b||(b=100),C=this.depth&&1=p))));q++);if(V){if(T)return Te(M,p,0);b[b.length]=M;return}}return!S&&M}function Te(g,b,S){return g=g.length===1?g[0]:[].concat.apply([],g),S||g.length>b?g.slice(S,S+b):g}function Ve(g,b,S,p){return S?(p=p&&b>S,g=(g=g[p?b:S])&&g[p?S:b]):g=g[b],g}O.contain=function(g){return!!this.register[g]},O.update=function(g,b){return this.remove(g).add(g,b)},O.remove=function(g,b){let S=this.register[g];if(S){if(this.m)for(let p=0,m;p"u"&&(E=new Promise(F=>{T=F}));let C,M;switch(m||(m=0)){case 0:if(C="reg",this.m){M=xe();for(let F in this.register)M[F]=1}else M=this.register;break;case 1:C="cfg",M={doc:0,opt:this.s?1:0};break;case 2:C="map",M=this.map;break;case 3:C="ctx",M=this.h;break;default:typeof S>"u"&&T&&T();return}return St(g,b||this,S,C,p,m,M,T),E},O.import=function(g,b){if(b)switch(At(b)&&(b=JSON.parse(b)),g){case"cfg":this.s=!!b.opt;break;case"reg":this.m=!1,this.register=b;break;case"map":this.map=b;break;case"ctx":this.h=b}},pe(ut.prototype);function Ke(g){g=g.data;var b=self._index;let S=g.args;var p=g.task;switch(p){case"init":p=g.options||{},g=g.factory,b=p.encode,p.cache=!1,b&&b.indexOf("function")===0&&(p.encode=Function("return "+b)()),g?(Function("return "+g)()(self),self._index=new self.FlexSearch.Index(p),delete self.FlexSearch):self._index=new ut(p);break;default:g=g.id,b=b[p].apply(b,S),postMessage(p==="search"?{id:g,msg:b}:{id:g})}}var ct=0;function D(g){if(!(this instanceof D))return new D(g);var b;g?at(b=g.encode)&&(g.encode=b.toString()):g={},(b=(self||window)._factory)&&(b=b.toString());let S=typeof window>"u"&&self.exports,p=this;this.o=ye(b,S,g.worker),this.h=xe(),this.o&&(S?this.o.on("message",function(m){p.h[m.id](m.msg),delete p.h[m.id]}):this.o.onmessage=function(m){m=m.data,p.h[m.id](m.msg),delete p.h[m.id]},this.o.postMessage({task:"init",factory:b,options:g}))}ie("add"),ie("append"),ie("search"),ie("update"),ie("remove");function ie(g){D.prototype[g]=D.prototype[g+"Async"]=function(){let b=this,S=[].slice.call(arguments);var p=S[S.length-1];let m;return at(p)&&(m=p,S.splice(S.length-1,1)),p=new Promise(function(T){setTimeout(function(){b.h[++ct]=T,b.o.postMessage({task:g,id:ct,args:S})})}),m?(p.then(m),this):p}}function ye(g,b,S){let p;try{p=b?new(Lr()).Worker(__dirname+"/node/node.js"):g?new Worker(URL.createObjectURL(new Blob(["onmessage="+Ke.toString()],{type:"text/javascript"}))):new Worker(At(S)?S:"worker/worker.js",{type:"module"})}catch{}return p}function Ie(g){if(!(this instanceof Ie))return new Ie(g);var b=g.document||g.doc||g,S;this.K=[],this.h=[],this.A=[],this.register=xe(),this.key=(S=b.key||b.id)&&ze(S,this.A)||"id",this.m=sr(g.fastupdate),this.C=(S=b.store)&&S!==!0&&[],this.store=S&&xe(),this.I=(S=b.tag)&&ze(S,this.A),this.l=S&&xe(),this.cache=(S=g.cache)&&new $e(S),g.cache=!1,this.o=g.worker,this.async=!1,S=xe();let p=b.index||b.field||b;At(p)&&(p=[p]);for(let m=0,T,E;mb||S)&&(m=m.slice(S,S+b)),p&&(m=gt.call(this,m)),{tag:g,result:m}}function gt(g){let b=Array(g.length);for(let S=0,p;S"u"&&(E=new Promise(C=>{T=C})),m||(m=0),p||(p=0),pg?.removeEventListener("click",S)),document.addEventListener("keydown",p),window.addCleanup(()=>document.removeEventListener("keydown",p))}function Wt(g){for(;g.firstChild;)g.removeChild(g.firstChild)}var Qe=Object.hasOwnProperty,Fi=Ft(Qt(),1),ot=(0,Fi.default)();function Di(g){let b=Li(Ui(g,"index"),!0);return b.length===0?"/":b}var kt=(g,b,S)=>{let p=new URL(g.getAttribute(b),S);g.setAttribute(b,p.pathname+p.hash)};function Ti(g,b){g.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach(S=>kt(S,"href",b)),g.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach(S=>kt(S,"src",b))}function ln(g){let b=g.split("/").filter(S=>S!=="").slice(0,-1).map(S=>"..").join("/");return b.length===0&&(b="."),b}function hn(g,b){return it(ln(g),Di(b))}function it(...g){if(g.length===0)return"";let b=g.filter(S=>S!==""&&S!=="/").map(S=>Li(S)).join("/");return g[0].startsWith("/")&&(b="/"+b),g[g.length-1].endsWith("/")&&(b=b+"/"),b}function Zt(g,b){return g===b||g.endsWith("/"+b)}function Ui(g,b){return Zt(g,b)&&(g=g.slice(0,-b.length)),g}function Li(g,b){return g.startsWith("/")&&(g=g.substring(1)),!b&&g.endsWith("/")&&(g=g.slice(0,-1)),g}var Sr="basic",ir="",un=g=>g.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/),di=new Mt.Document({charset:"latin:extra",encode:un,document:{id:"id",tag:"tags",index:[{field:"title",tokenize:"forward"},{field:"content",tokenize:"forward"},{field:"tags",tokenize:"forward"}]}}),cn=new DOMParser,Ni=new Map,kr=30,fi=8,dn=5,Si=g=>{let b=g.split(/\s+/).filter(p=>p.trim()!==""),S=b.length;if(S>1)for(let p=1;pm.length-p.length)};function Hi(g,b,S){let p=Si(g),m=b.split(/\s+/).filter(M=>M!==""),T=0,E=m.length-1;if(S){let M=q=>p.some(z=>q.toLowerCase().startsWith(z.toLowerCase())),F=m.map(M),V=0,W=0;for(let q=0;qI+(Q?1:0),0);z>=V&&(V=z,W=q)}T=Math.max(W-kr,0),E=Math.min(T+2*kr,m.length-1),m=m.slice(T,E)}let C=m.map(M=>{for(let F of p)if(M.toLowerCase().includes(F.toLowerCase())){let V=new RegExp(F.toLowerCase(),"gi");return M.replace(V,'$&')}return M}).join(" ");return`${T===0?"":"..."}${C}${E===m.length-1?"":"..."}`}function fn(g,b){let S=new DOMParser,p=Si(g),m=S.parseFromString(b.innerHTML,"text/html"),T=C=>{let M=document.createElement("span");return M.className="highlight",M.textContent=C,M},E=(C,M)=>{if(C.nodeType===Node.TEXT_NODE){let F=C.nodeValue??"",V=new RegExp(M.toLowerCase(),"gi"),W=F.match(V);if(!W||W.length===0)return;let q=document.createElement("span"),z=0;for(let I of W){let Q=F.indexOf(I,z);q.appendChild(document.createTextNode(F.slice(z,Q))),q.appendChild(T(I)),z=Q+I.length}q.appendChild(document.createTextNode(F.slice(z))),C.parentNode?.replaceChild(q,C)}else if(C.nodeType===Node.ELEMENT_NODE){if(C.classList.contains("highlight"))return;Array.from(C.childNodes).forEach(F=>E(F,M))}};for(let C of p)E(m.body,C);return m.body}async function jn(g,b,S){let p=g.querySelector(".search-container");if(!p)return;let m=p.closest(".sidebar"),T=g.querySelector(".search-button");if(!T)return;let E=g.querySelector(".search-bar");if(!E)return;let C=g.querySelector(".search-layout");if(!C)return;let M=Object.keys(S),F=Ge=>{C.appendChild(Ge)},V=C.dataset.preview==="true",W,q,z=document.createElement("div");z.className="results-container",F(z),V&&(W=document.createElement("div"),W.className="preview-container",F(W));function I(){p.classList.remove("active"),E.value="",m&&(m.style.zIndex=""),Wt(z),W&&Wt(W),C.classList.remove("display-results"),Sr="basic",T.focus()}function Q(Ge){Sr=Ge,m&&(m.style.zIndex="1"),p.classList.add("active"),E.focus()}let j=null;async function re(Ge){if(Ge.key==="k"&&(Ge.ctrlKey||Ge.metaKey)&&!Ge.shiftKey){Ge.preventDefault(),p.classList.contains("active")?I():Q("basic");return}else if(Ge.shiftKey&&(Ge.ctrlKey||Ge.metaKey)&&Ge.key.toLowerCase()==="k"){Ge.preventDefault(),p.classList.contains("active")?I():Q("tags"),E.value="#";return}if(j&&j.classList.remove("focus"),!!p.classList.contains("active")){if(Ge.key==="Enter")if(z.contains(document.activeElement)){let Se=document.activeElement;if(Se.classList.contains("no-match"))return;await Be(Se),Se.click()}else{let Se=document.getElementsByClassName("result-card")[0];if(!Se||Se.classList.contains("no-match"))return;await Be(Se),Se.click()}else if(Ge.key==="ArrowUp"||Ge.shiftKey&&Ge.key==="Tab"){if(Ge.preventDefault(),z.contains(document.activeElement)){let Se=j||document.activeElement,et=Se?.previousElementSibling;Se?.classList.remove("focus"),et?.focus(),et&&(j=et),await Be(et)}}else if((Ge.key==="ArrowDown"||Ge.key==="Tab")&&(Ge.preventDefault(),document.activeElement===E||j!==null)){let Se=j||document.getElementsByClassName("result-card")[0],et=Se?.nextElementSibling;Se?.classList.remove("focus"),et?.focus(),et&&(j=et),await Be(et)}}}let he=(Ge,Se)=>{let et=M[Se];return{id:Se,slug:et,title:Sr==="tags"?S[et].title:Hi(Ge,S[et].title??""),content:Hi(Ge,S[et].content??"",!0),tags:oe(Ge.substring(1),S[et].tags)}};function oe(Ge,Se){return!Se||Sr!=="tags"?[]:Se.map(et=>et.toLowerCase().includes(Ge.toLowerCase())?`
  • #${et}

  • `:`
  • #${et}

  • `).slice(0,dn)}function Re(Ge){return new URL(hn(b,Ge),location.toString())}let Je=({slug:Ge,title:Se,content:et,tags:pt})=>{let Ot=pt.length>0?`
      ${pt.join("")}
    `:"",zt=document.createElement("a");zt.classList.add("result-card"),zt.id=Ge,zt.href=Re(Ge).toString(),zt.innerHTML=` +

    ${Se}

    + ${Ot} +

    ${et}

    + `,zt.addEventListener("click",Gt=>{Gt.altKey||Gt.ctrlKey||Gt.metaKey||Gt.shiftKey||I()});let hr=Gt=>{Gt.altKey||Gt.ctrlKey||Gt.metaKey||Gt.shiftKey||I()};async function vr(Gt){if(!Gt.target)return;let qr=Gt.target;await Be(qr)}return zt.addEventListener("mouseenter",vr),window.addCleanup(()=>zt.removeEventListener("mouseenter",vr)),zt.addEventListener("click",hr),window.addCleanup(()=>zt.removeEventListener("click",hr)),zt};async function Xe(Ge){if(Wt(z),Ge.length===0?z.innerHTML=` +

    No results.

    +

    Try another search term?

    +
    `:z.append(...Ge.map(Je)),Ge.length===0&&W)Wt(W);else{let Se=z.firstElementChild;Se.classList.add("focus"),j=Se,await Be(Se)}}async function Rt(Ge){if(Ni.has(Ge))return Ni.get(Ge);let Se=Re(Ge).toString(),et=await fetch(Se).then(pt=>pt.text()).then(pt=>{if(pt===void 0)throw new Error(`Could not fetch ${Se}`);let Ot=cn.parseFromString(pt??"","text/html");return Ti(Ot,Se),[...Ot.getElementsByClassName("popover-hint")]});return Ni.set(Ge,et),et}async function Be(Ge){if(!C||!V||!Ge||!W)return;let Se=Ge.id,et=await Rt(Se).then(pt=>pt.flatMap(Ot=>[...fn(ir,Ot).children]));q=document.createElement("div"),q.classList.add("preview-inner"),q.append(...et),W.replaceChildren(q),[...W.getElementsByClassName("highlight")].sort((pt,Ot)=>Ot.innerHTML.length-pt.innerHTML.length)[0]?.scrollIntoView({block:"start"})}async function _r(Ge){if(!C||!di)return;ir=Ge.target.value,C.classList.toggle("display-results",ir!==""),Sr=ir.startsWith("#")?"tags":"basic";let Se;if(Sr==="tags"){ir=ir.substring(1).trim();let Ot=ir.indexOf(" ");if(Ot!=-1){let zt=ir.substring(0,Ot),hr=ir.substring(Ot+1).trim();Se=await di.searchAsync({query:hr,limit:Math.max(fi,1e4),index:["title","content"],tag:zt});for(let vr of Se)vr.result=vr.result.slice(0,fi);Sr="basic",ir=hr}else Se=await di.searchAsync({query:ir,limit:fi,index:["tags"]})}else Sr==="basic"&&(Se=await di.searchAsync({query:ir,limit:fi,index:["title","content"]}));let et=Ot=>{let zt=Se.filter(hr=>hr.field===Ot);return zt.length===0?[]:[...zt[0].result]},pt=[...new Set([...et("title"),...et("content"),...et("tags")])].map(Ot=>he(ir,Ot));await Xe(pt)}document.addEventListener("keydown",re),window.addCleanup(()=>document.removeEventListener("keydown",re)),T.addEventListener("click",()=>Q("basic")),window.addCleanup(()=>T.removeEventListener("click",()=>Q("basic"))),E.addEventListener("input",_r),window.addCleanup(()=>E.removeEventListener("input",_r)),wi(p,I),await Vn(S)}var zi=!1;async function Vn(g){if(zi)return;let b=0,S=[];for(let[p,m]of Object.entries(g))S.push(di.addAsync(b++,{id:b,slug:p,title:m.title,content:m.content,tags:m.tags}));await Promise.all(S),zi=!0}document.addEventListener("nav",async g=>{let b=g.detail.url,S=await fetchData,p=document.getElementsByClassName("search");for(let m of p)await jn(m,b,S)})}(),function(){var Ut=Object.create,xt=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,bt=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty,_=(ge,Z)=>()=>(Z||ge((Z={exports:{}}).exports,Z),Z.exports),nr=(ge,Z,pe,Ne)=>{if(Z&&typeof Z=="object"||typeof Z=="function")for(let je of bt(Z))!Ct.call(ge,je)&&je!==pe&&xt(ge,je,{get:()=>Z[je],enumerable:!(Ne=Bt(Z,je))||Ne.enumerable});return ge},Ft=(ge,Z,pe)=>(pe=ge!=null?Ut(Et(ge)):{},nr(Z||!ge||!ge.__esModule?xt(pe,"default",{value:ge,enumerable:!0}):pe,ge)),Lr=_((ge,Z)=>{"use strict";Z.exports=Ne;function pe(rt){return rt instanceof Buffer?Buffer.from(rt):new rt.constructor(rt.buffer.slice(),rt.byteOffset,rt.length)}function Ne(rt){if(rt=rt||{},rt.circles)return je(rt);let $e=new Map;if($e.set(Date,Ae=>new Date(Ae)),$e.set(Map,(Ae,Le)=>new Map(Tt(Array.from(Ae),Le))),$e.set(Set,(Ae,Le)=>new Set(Tt(Array.from(Ae),Le))),rt.constructorHandlers)for(let Ae of rt.constructorHandlers)$e.set(Ae[0],Ae[1]);let ht=null;return rt.proto?ut:St;function Tt(Ae,Le){let be=Object.keys(Ae),Te=new Array(be.length);for(let Ve=0;Venew Date(be)),Tt.set(Map,(be,Te)=>new Map(ut(Array.from(be),Te))),Tt.set(Set,(be,Te)=>new Set(ut(Array.from(be),Te))),rt.constructorHandlers)for(let be of rt.constructorHandlers)Tt.set(be[0],be[1]);let St=null;return rt.proto?Le:Ae;function ut(be,Te){let Ve=Object.keys(be),ve=new Array(Ve.length);for(let Ke=0;Kepe!=="").slice(0,-1).map(pe=>"..").join("/");return Z.length===0&&(Z="."),Z}function J(ge,Z){return At(xe(ge),Ht(Z))}function At(...ge){if(ge.length===0)return"";let Z=ge.filter(pe=>pe!==""&&pe!=="/").map(pe=>It(pe)).join("/");return ge[0].startsWith("/")&&(Z="/"+Z),ge[ge.length-1].endsWith("/")&&(Z=Z+"/"),Z}function qt(ge,Z){return ge===Z||ge.endsWith("/"+Z)}function at(ge,Z){return qt(ge,Z)&&(ge=ge.slice(0,-Z.length)),ge}function It(ge,Z){return ge.startsWith("/")&&(ge=ge.substring(1)),!Z&&ge.endsWith("/")&&(ge=ge.slice(0,-1)),ge}var Mr=class Lc{isFolder;children;slugSegments;fileSegmentHint;displayNameOverride;data;constructor(Z,pe){this.children=[],this.slugSegments=Z,this.data=pe??null,this.isFolder=!1,this.displayNameOverride=void 0}get displayName(){let Z=this.data?.title==="index"?void 0:this.data?.title;return this.displayNameOverride??Z??this.fileSegmentHint??this.slugSegment??""}set displayName(Z){this.displayNameOverride=Z}get slug(){let Z=At(...this.slugSegments);return this.isFolder?At(Z,"index"):Z}get slugSegment(){return this.slugSegments[this.slugSegments.length-1]}makeChild(Z,pe){let Ne=[...this.slugSegments,Z[0]],je=new Lc(Ne,pe);return this.children.push(je),je}insert(Z,pe){if(Z.length===0)throw new Error("path is empty");this.isFolder=!0;let Ne=Z[0];if(Z.length===1)Ne==="index"?this.data??=pe:this.makeChild(Z,pe);else if(Z.length>1){let je=this.children.find($e=>$e.slugSegment===Ne)??this.makeChild(Z,void 0),rt=pe.filePath.split("/");je.fileSegmentHint=rt.at(-Z.length),je.insert(Z.slice(1),pe)}}add(Z){this.insert(Z.slug.split("/"),Z)}findNode(Z){return Z.length===0||Z.length===1&&Z[0]==="index"?this:this.children.find(pe=>pe.slugSegment===Z[0])?.findNode(Z.slice(1))}ancestryChain(Z){if(Z.length===0||Z.length===1&&Z[0]==="index")return[this];let pe=this.children.find(je=>je.slugSegment===Z[0]);if(!pe)return;let Ne=pe.ancestryChain(Z.slice(1));if(Ne)return[this,...Ne]}filter(Z){this.children=this.children.filter(Z),this.children.forEach(pe=>pe.filter(Z))}map(Z){Z(this),this.children.forEach(pe=>pe.map(Z))}sort(Z){this.children=this.children.sort(Z),this.children.forEach(pe=>pe.sort(Z))}static fromEntries(Z){let pe=new Lc([]);return Z.forEach(([,Ne])=>pe.add(Ne)),pe}entries(){let Z=pe=>[[pe.slug,pe]].concat(...pe.children.map(Z));return Z(this)}getFolderPaths(){return this.entries().filter(([Z,pe])=>pe.isFolder).map(([Z,pe])=>Z)}},Lt;function lt(){let ge=this.closest(".explorer");if(!ge)return;let Z=ge.classList.toggle("collapsed");ge.setAttribute("aria-expanded",ge.getAttribute("aria-expanded")==="true"?"false":"true"),Z?document.documentElement.classList.remove("mobile-no-scroll"):document.documentElement.classList.add("mobile-no-scroll")}function Pt(ge){ge.stopPropagation();let Z=ge.target;if(!Z)return;let pe=Z.nodeName==="svg"?Z.parentElement:Z.parentElement?.parentElement;if(!pe)return;let Ne=pe.nextElementSibling;if(!Ne)return;Ne.classList.toggle("open");let je=!Ne.classList.contains("open");Yr(Ne,je);let rt=Lt.find(ht=>ht.path===pe.dataset.folderpath);rt?rt.collapsed=je:Lt.push({path:pe.dataset.folderpath,collapsed:je});let $e=JSON.stringify(Lt);localStorage.setItem("fileTree",$e)}function wt(ge,Z){let pe=document.getElementById("template-file").content.cloneNode(!0).querySelector("li"),Ne=pe.querySelector("a");return Ne.href=J(ge,Z.slug),Ne.dataset.for=Z.slug,Ne.textContent=Z.displayName,ge===Z.slug&&Ne.classList.add("active"),pe}function Rr(ge,Z,pe){let Ne=document.getElementById("template-folder").content.cloneNode(!0).querySelector("li"),je=Ne.querySelector(".folder-container"),rt=je.querySelector("div"),$e=Ne.querySelector(".folder-outer"),ht=$e.querySelector("ul"),Tt=Z.slug;if(je.dataset.folderpath=Tt,pe.folderClickBehavior==="link"){let Le=rt.querySelector(".folder-button"),be=document.createElement("a");be.href=J(ge,Tt),be.dataset.for=Tt,be.className="folder-title",be.textContent=Z.displayName,Le.replaceWith(be)}else{let Le=rt.querySelector(".folder-title");Le.textContent=Z.displayName}let St=Lt.find(Le=>Le.path===Tt)?.collapsed??pe.folderDefaultState==="collapsed",ut=Ht(Tt),Ae=ut===ge.slice(0,ut.length);(!St||Ae)&&$e.classList.add("open");for(let Le of Z.children){let be=Le.isFolder?Rr(ge,Le,pe):wt(ge,Le);ht.appendChild(be)}return Ne}async function mr(ge){let Z=document.querySelectorAll("div.explorer");for(let pe of Z){let Ne=JSON.parse(pe.dataset.dataFns||"{}"),je={folderClickBehavior:pe.dataset.behavior||"collapse",folderDefaultState:pe.dataset.collapsed||"collapsed",useSavedState:pe.dataset.savestate==="true",order:Ne.order||["filter","map","sort"],sortFn:new Function("return "+(Ne.sortFn||"undefined"))(),filterFn:new Function("return "+(Ne.filterFn||"undefined"))(),mapFn:new Function("return "+(Ne.mapFn||"undefined"))()},rt=localStorage.getItem("fileTree"),$e=rt&&je.useSavedState?JSON.parse(rt):[],ht=new Map($e.map(ve=>[ve.path,ve.collapsed])),Tt=await fetchData,St=[...Object.entries(Tt)],ut=Mr.fromEntries(St);for(let ve of je.order)switch(ve){case"filter":je.filterFn&&ut.filter(je.filterFn);break;case"map":je.mapFn&&ut.map(je.mapFn);break;case"sort":je.sortFn&&ut.sort(je.sortFn);break}Lt=ut.getFolderPaths().map(ve=>{let Ke=ht.get(ve);return{path:ve,collapsed:Ke===void 0?je.folderDefaultState==="collapsed":Ke}});let Ae=pe.querySelector(".explorer-ul");if(!Ae)continue;let Le=document.createDocumentFragment();for(let ve of ut.children){let Ke=ve.isFolder?Rr(ge,ve,je):wt(ge,ve);Le.appendChild(Ke)}Ae.insertBefore(Le,Ae.firstChild);let be=sessionStorage.getItem("explorerScrollTop");if(be)Ae.scrollTop=parseInt(be);else{let ve=Ae.querySelector(".active");ve&&ve.scrollIntoView({behavior:"smooth"})}let Te=pe.getElementsByClassName("explorer-toggle");for(let ve of Te)ve.addEventListener("click",lt),window.addCleanup(()=>ve.removeEventListener("click",lt));if(je.folderClickBehavior==="collapse"){let ve=pe.getElementsByClassName("folder-button");for(let Ke of ve)Ke.addEventListener("click",Pt),window.addCleanup(()=>Ke.removeEventListener("click",Pt))}let Ve=pe.getElementsByClassName("folder-icon");for(let ve of Ve)ve.addEventListener("click",Pt),window.addCleanup(()=>ve.removeEventListener("click",Pt))}}document.addEventListener("prenav",async()=>{let ge=document.querySelector(".explorer-ul");ge&&sessionStorage.setItem("explorerScrollTop",ge.scrollTop.toString())}),document.addEventListener("nav",async ge=>{let Z=ge.detail.url;await mr(Z);for(let pe of document.getElementsByClassName("explorer")){let Ne=pe.querySelector(".mobile-explorer");if(!Ne)return;Ne.checkVisibility()&&(pe.classList.add("collapsed"),pe.setAttribute("aria-expanded","false"),document.documentElement.classList.remove("mobile-no-scroll")),Ne.classList.remove("hide-until-loaded")}}),window.addEventListener("resize",function(){let ge=document.querySelector(".explorer");if(ge&&!ge.classList.contains("collapsed")){document.documentElement.classList.add("mobile-no-scroll");return}});function Yr(ge,Z){return Z?ge.classList.remove("open"):ge.classList.add("open")}}(),function(){document.addEventListener("nav",Ut=>{const xt=new IntersectionObserver(Et=>{for(const Ct of Et){const _=Ct.target.parentElement;if(!_)return;Ct.isIntersecting?_.classList.remove("gradient-active"):_.classList.add("gradient-active")}}),Bt=document.getElementById("list-0");if(!Bt)return;const bt=Bt.querySelector(".overflow-end");bt&&(xt.observe(bt),window.addCleanup(()=>xt.disconnect()))})}(),function(){var Ut=Object.create,xt=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,bt=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty,_=(t,e)=>()=>(t&&(e=t(t=0)),e),nr=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ft=(t,e)=>{for(var r in e)xt(t,r,{get:e[r],enumerable:!0})},Lr=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of bt(e))!Ct.call(t,n)&&n!==r&&xt(t,n,{get:()=>e[n],enumerable:!(i=Bt(e,n))||i.enumerable});return t},Qt=(t,e,r)=>(r=t!=null?Ut(Et(t)):{},Lr(e||!t||!t.__esModule?xt(r,"default",{value:t,enumerable:!0}):r,t)),O,sr,Ht,xe,J=_(()=>{"use strict";O=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(O||{}),sr=t=>{if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={...typeof t.extension!="object"?{type:t.extension}:t.extension,ref:t}}if(typeof t=="object")t={...t};else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},Ht=(t,e)=>sr(t).priority??e,xe={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(sr).forEach(e=>{e.type.forEach(r=>this._removeHandlers[r]?.(e))}),this},add(...t){return t.map(sr).forEach(e=>{e.type.forEach(r=>{let i=this._addHandlers,n=this._queue;i[r]?i[r]?.(e):(n[r]=n[r]||[],n[r]?.push(e))})}),this},handle(t,e,r){let i=this._addHandlers,n=this._removeHandlers;if(i[t]||n[t])throw new Error(`Extension type ${t} already has a handler`);i[t]=e,n[t]=r;let s=this._queue;return s[t]&&(s[t]?.forEach(a=>e(a)),delete s[t]),this},handleByMap(t,e){return this.handle(t,r=>{r.name&&(e[r.name]=r.ref)},r=>{r.name&&delete e[r.name]})},handleByNamedList(t,e,r=-1){return this.handle(t,i=>{e.findIndex(n=>n.name===i.name)>=0||(e.push({name:i.name,value:i.ref}),e.sort((n,s)=>Ht(s.value,r)-Ht(n.value,r)))},i=>{let n=e.findIndex(s=>s.name===i.name);n!==-1&&e.splice(n,1)})},handleByList(t,e,r=-1){return this.handle(t,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((n,s)=>Ht(s,r)-Ht(n,r)))},i=>{let n=e.indexOf(i.ref);n!==-1&&e.splice(n,1)})},mixin(t,...e){for(let r of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(r))}}}),At=nr((t,e)=>{"use strict";var r=Object.prototype.hasOwnProperty,i="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(i=!1));function s(h,u,c){this.fn=h,this.context=u,this.once=c||!1}function a(h,u,c,f,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var y=new s(c,f||h,d),x=i?i+u:u;return h._events[x]?h._events[x].fn?h._events[x]=[h._events[x],y]:h._events[x].push(y):(h._events[x]=y,h._eventsCount++),h}function o(h,u){--h._eventsCount===0?h._events=new n:delete h._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var h=[],u,c;if(this._eventsCount===0)return h;for(c in u=this._events)r.call(u,c)&&h.push(i?c.slice(1):c);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(u)):h},l.prototype.listeners=function(h){var u=i?i+h:h,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var f=0,d=c.length,y=new Array(d);f{qt=Qt(At(),1),at=qt.default}),Mr,Lt,lt,Pt,wt,Rr,mr,Yr,ge,Z,pe,Ne,je,rt,$e,ht,Tt,St,ut,Ae,Le,be,Te,Ve,ve,Ke,ct,D,ie,ye=_(()=>{Mr={grad:.9,turn:360,rad:360/(2*Math.PI)},Lt=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},lt=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},Pt=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},wt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Rr=function(t){return{r:Pt(t.r,0,255),g:Pt(t.g,0,255),b:Pt(t.b,0,255),a:Pt(t.a)}},mr=function(t){return{r:lt(t.r),g:lt(t.g),b:lt(t.b),a:lt(t.a,3)}},Yr=/^#([0-9a-f]{3,8})$/i,ge=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Z=function(t){var e=t.r,r=t.g,i=t.b,n=t.a,s=Math.max(e,r,i),a=s-Math.min(e,r,i),o=a?s===e?(r-i)/a:s===r?2+(i-e)/a:4+(e-r)/a:0;return{h:60*(o<0?o+6:o),s:s?a/s*100:0,v:s/255*100,a:n}},pe=function(t){var e=t.h,r=t.s,i=t.v,n=t.a;e=e/360*6,r/=100,i/=100;var s=Math.floor(e),a=i*(1-r),o=i*(1-(e-s)*r),l=i*(1-(1-e+s)*r),h=s%6;return{r:255*[i,o,a,a,l,i][h],g:255*[l,i,i,o,a,a][h],b:255*[a,a,l,i,i,o][h],a:n}},Ne=function(t){return{h:wt(t.h),s:Pt(t.s,0,100),l:Pt(t.l,0,100),a:Pt(t.a)}},je=function(t){return{h:lt(t.h),s:lt(t.s),l:lt(t.l),a:lt(t.a,3)}},rt=function(t){return pe((r=(e=t).s,{h:e.h,s:(r*=((i=e.l)<50?i:100-i)/100)>0?2*r/(i+r)*100:0,v:i+r,a:e.a}));var e,r,i},$e=function(t){return{h:(e=Z(t)).h,s:(n=(200-(r=e.s))*(i=e.v)/100)>0&&n<200?r*i/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,r,i,n},ht=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Tt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,St=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ut=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ae={string:[[function(t){var e=Yr.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?lt(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?lt(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=St.exec(t)||ut.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Rr({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=ht.exec(t)||Tt.exec(t);if(!e)return null;var r,i,n=Ne({h:(r=e[1],i=e[2],i===void 0&&(i="deg"),Number(r)*(Mr[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return rt(n)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,i=t.b,n=t.a,s=n===void 0?1:n;return Lt(e)&&Lt(r)&&Lt(i)?Rr({r:Number(e),g:Number(r),b:Number(i),a:Number(s)}):null},"rgb"],[function(t){var e=t.h,r=t.s,i=t.l,n=t.a,s=n===void 0?1:n;if(!Lt(e)||!Lt(r)||!Lt(i))return null;var a=Ne({h:Number(e),s:Number(r),l:Number(i),a:Number(s)});return rt(a)},"hsl"],[function(t){var e=t.h,r=t.s,i=t.v,n=t.a,s=n===void 0?1:n;if(!Lt(e)||!Lt(r)||!Lt(i))return null;var a=function(o){return{h:wt(o.h),s:Pt(o.s,0,100),v:Pt(o.v,0,100),a:Pt(o.a)}}({h:Number(e),s:Number(r),v:Number(i),a:Number(s)});return pe(a)},"hsv"]]},Le=function(t,e){for(var r=0;r=.5},t.prototype.toHex=function(){return e=mr(this.rgba),r=e.r,i=e.g,n=e.b,a=(s=e.a)<1?ge(lt(255*s)):"","#"+ge(r)+ge(i)+ge(n)+a;var e,r,i,n,s,a},t.prototype.toRgb=function(){return mr(this.rgba)},t.prototype.toRgbString=function(){return e=mr(this.rgba),r=e.r,i=e.g,n=e.b,(s=e.a)<1?"rgba("+r+", "+i+", "+n+", "+s+")":"rgb("+r+", "+i+", "+n+")";var e,r,i,n,s},t.prototype.toHsl=function(){return je($e(this.rgba))},t.prototype.toHslString=function(){return e=je($e(this.rgba)),r=e.h,i=e.s,n=e.l,(s=e.a)<1?"hsla("+r+", "+i+"%, "+n+"%, "+s+")":"hsl("+r+", "+i+"%, "+n+"%)";var e,r,i,n,s},t.prototype.toHsv=function(){return e=Z(this.rgba),{h:lt(e.h),s:lt(e.s),v:lt(e.v),a:lt(e.a,3)};var e},t.prototype.invert=function(){return ct({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),ct(Te(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),ct(Te(this.rgba,-e))},t.prototype.grayscale=function(){return ct(Te(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),ct(ve(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),ct(ve(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?ct({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):lt(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=$e(this.rgba);return typeof e=="number"?ct({h:e,s:r.s,l:r.l,a:r.a}):lt(r.h)},t.prototype.isEqual=function(e){return this.toHex()===ct(e).toHex()},t}(),ct=function(t){return t instanceof Ke?t:new Ke(t)},D=[],ie=function(t){t.forEach(function(e){D.indexOf(e)<0&&(e(Ke,Ae),D.push(e))})}});function Ie(t,e){var r={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var n in r)i[r[n]]=n;var s={};t.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,l,h=i[this.toHex()];if(h)return h;if(a?.closest){var u=this.toRgb(),c=1/0,f="black";if(!s.length)for(var d in r)s[d]=new t(r[d]).toRgb();for(var y in r){var x=(o=u,l=s[y],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));x{}),Ce,ce,De=_(()=>{ye(),ze(),ie([Ie]),Ce=class Vs{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof Vs)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,r){let i=typeof e;if(i!==typeof r)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===r;if(Array.isArray(e)&&Array.isArray(r)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(r))return e.length!==r.length?!1:e.every((n,s)=>n===r[s]);if(e!==null&&r!==null){let n=Object.keys(e),s=Object.keys(r);return n.length!==s.length?!1:n.every(a=>e[a]===r[a])}return e===r}toRgba(){let[e,r,i,n]=this._components;return{r:e,g:r,b:i,a:n}}toRgb(){let[e,r,i]=this._components;return{r:e,g:r,b:i}}toRgbaString(){let[e,r,i]=this.toUint8RgbArray();return`rgba(${e},${r},${i},${this.alpha})`}toUint8RgbArray(e){let[r,i,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(r*255),e[1]=Math.round(i*255),e[2]=Math.round(n*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);let[r,i,n,s]=this._components;return e[0]=r,e[1]=i,e[2]=n,e[3]=s,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);let[r,i,n]=this._components;return e[0]=r,e[1]=i,e[2]=n,e}toNumber(){return this._int}toBgrNumber(){let[e,r,i]=this.toUint8RgbArray();return(i<<16)+(r<<8)+e}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[r,i,n,s]=Vs._temp.setValue(e)._components;return this._components[0]*=r,this._components[1]*=i,this._components[2]*=n,this._components[3]*=s,this._refreshInt(),this._value=null,this}premultiply(e,r=!0){return r&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,r=!0){if(e===1)return(255<<24)+this._int;if(e===0)return r?0:this._int;let i=this._int>>16&255,n=this._int>>8&255,s=this._int&255;return r&&(i=i*e+.5|0,n=n*e+.5|0,s=s*e+.5|0),(e*255<<24)+(i<<16)+(n<<8)+s}toHex(){let e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}_normalize(e){let r,i,n,s;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let a=e;r=(a>>16&255)/255,i=(a>>8&255)/255,n=(a&255)/255,s=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[r,i,n,s=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[r,i,n,s=255]=e,r/=255,i/=255,n/=255,s/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let o=Vs.HEX_PATTERN.exec(e);o&&(e=`#${o[2]}`)}let a=ct(e);a.isValid()&&({r,g:i,b:n,a:s}=a.rgba,r/=255,i/=255,n/=255)}if(r!==void 0)this._components[0]=r,this._components[1]=i,this._components[2]=n,this._components[3]=s,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);let[e,r,i]=this._components;this._int=(e*255<<16)+(r*255<<8)+(i*255|0)}_clamp(e,r=0,i=1){return typeof e=="number"?Math.min(Math.max(e,r),i):(e.forEach((n,s)=>{e[s]=Math.min(Math.max(n,r),i)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof Vs||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}},Ce.shared=new Ce,Ce._temp=new Ce,Ce.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i,ce=Ce}),ft,gt=_(()=>{"use strict";ft={cullArea:null,cullable:!1,cullableChildren:!0}}),Kt,Ue,mt,Me=_(()=>{"use strict";Kt=Math.PI*2,Ue=180/Math.PI,mt=Math.PI/180}),_e,_t,He=_(()=>{"use strict";_e=class Vv{constructor(e=0,r=0){this.x=0,this.y=0,this.x=e,this.y=r}clone(){return new Vv(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,r=e){return this.x=e,this.y=r,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return _t.x=0,_t.y=0,_t}},_t=new _e}),me,Tr,Jt,Ze=_(()=>{Me(),He(),me=class Wv{constructor(e=1,r=0,i=0,n=1,s=0,a=0){this.array=null,this.a=e,this.b=r,this.c=i,this.d=n,this.tx=s,this.ty=a}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,r,i,n,s,a){return this.a=e,this.b=r,this.c=i,this.d=n,this.tx=s,this.ty=a,this}toArray(e,r){this.array||(this.array=new Float32Array(9));let i=r||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(e,r){r=r||new _e;let i=e.x,n=e.y;return r.x=this.a*i+this.c*n+this.tx,r.y=this.b*i+this.d*n+this.ty,r}applyInverse(e,r){r=r||new _e;let i=this.a,n=this.b,s=this.c,a=this.d,o=this.tx,l=this.ty,h=1/(i*a+s*-n),u=e.x,c=e.y;return r.x=a*h*u+-s*h*c+(l*s-o*a)*h,r.y=i*h*c+-n*h*u+(-l*i+o*n)*h,r}translate(e,r){return this.tx+=e,this.ty+=r,this}scale(e,r){return this.a*=e,this.d*=r,this.c*=e,this.b*=r,this.tx*=e,this.ty*=r,this}rotate(e){let r=Math.cos(e),i=Math.sin(e),n=this.a,s=this.c,a=this.tx;return this.a=n*r-this.b*i,this.b=n*i+this.b*r,this.c=s*r-this.d*i,this.d=s*i+this.d*r,this.tx=a*r-this.ty*i,this.ty=a*i+this.ty*r,this}append(e){let r=this.a,i=this.b,n=this.c,s=this.d;return this.a=e.a*r+e.b*n,this.b=e.a*i+e.b*s,this.c=e.c*r+e.d*n,this.d=e.c*i+e.d*s,this.tx=e.tx*r+e.ty*n+this.tx,this.ty=e.tx*i+e.ty*s+this.ty,this}appendFrom(e,r){let i=e.a,n=e.b,s=e.c,a=e.d,o=e.tx,l=e.ty,h=r.a,u=r.b,c=r.c,f=r.d;return this.a=i*h+n*c,this.b=i*u+n*f,this.c=s*h+a*c,this.d=s*u+a*f,this.tx=o*h+l*c+r.tx,this.ty=o*u+l*f+r.ty,this}setTransform(e,r,i,n,s,a,o,l,h){return this.a=Math.cos(o+h)*s,this.b=Math.sin(o+h)*s,this.c=-Math.sin(o-l)*a,this.d=Math.cos(o-l)*a,this.tx=e-(i*this.a+n*this.c),this.ty=r-(i*this.b+n*this.d),this}prepend(e){let r=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,n=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty,this}decompose(e){let r=this.a,i=this.b,n=this.c,s=this.d,a=e.pivot,o=-Math.atan2(-n,s),l=Math.atan2(i,r),h=Math.abs(o+l);return h<1e-5||Math.abs(Kt-h)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=l),e.scale.x=Math.sqrt(r*r+i*i),e.scale.y=Math.sqrt(n*n+s*s),e.position.x=this.tx+(a.x*r+a.y*n),e.position.y=this.ty+(a.x*i+a.y*s),e}invert(){let e=this.a,r=this.b,i=this.c,n=this.d,s=this.tx,a=e*n-r*i;return this.a=n/a,this.b=-r/a,this.c=-i/a,this.d=e/a,this.tx=(i*this.ty-n*s)/a,this.ty=-(e*this.ty-r*s)/a,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let e=new Wv;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return Jt.identity()}static get shared(){return Tr.identity()}},Tr=new me,Jt=new me}),Yt,ci=_(()=>{"use strict";Yt=class $v{constructor(e,r,i){this._x=r||0,this._y=i||0,this._observer=e}clone(e){return new $v(e??this._observer,this._x,this._y)}set(e=0,r=e){return(this._x!==e||this._y!==r)&&(this._x=e,this._y=r,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}});function Mt(t="default"){return wi[t]===void 0&&(wi[t]=-1),++wi[t]}var wi,Wt=_(()=>{"use strict";wi={default:-1}});function Qe(t,e,r=3){if(Fi[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} +Deprecated since v${t}`):(i=i.split(` +`).splice(r).join(` +`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e} +Deprecated since v${t}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e} +Deprecated since v${t}`),console.warn(i))),Fi[e]=!0}var Fi,ot,Di,kt=_(()=>{"use strict";Fi={},ot="8.0.0",Di="8.3.4"}),Ti,ln=_(()=>{"use strict";Ti=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}}),hn,it,Zt=_(()=>{ln(),hn=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new Ti(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},it=new hn}),Ui,Li=_(()=>{kt(),Ui={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(t){typeof t=="boolean"&&t===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(t===!0?{}:t))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){Qe("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}}});function Sr(t,e,r){let i=t.length,n;if(e>=i||r===0)return;r=e+r>i?i-e:r;let s=i-r;for(n=e;n{"use strict"}),un,di=_(()=>{ir(),kt(),un={allowChildren:!0,removeChildren(t=0,e){let r=e??this.children.length,i=r-t,n=[];if(i>0&&i<=r){for(let a=r-1;a>=t;a--){let o=this.children[a];o&&(n.push(o),o.parent=null)}Sr(this.children,t,r);let s=this.renderGroup||this.parentRenderGroup;s&&s.removeChildren(n);for(let a=0;a0&&this._didViewChangeTick++,n}else if(i===0&&this.children.length===0)return n;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){let e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){let e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||Qe(ot,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:r}=this;if(e<0||e>r.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${r.length}`);if(t.parent){let n=t.parent.children.indexOf(t);if(t.parent===this&&n===e)return t;n!==-1&&t.parent.children.splice(n,1)}e===r.length?r.push(t):r.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(t),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",t,this,e),t.emit("added",this),t},swapChildren(t,e){if(t===e)return;let r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t;let n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...t){return t.length===1?this.reparentChildAt(t[0],this.children.length):(t.forEach(e=>this.reparentChildAt(e,this.children.length)),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;let r=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);let i=this.worldTransform.clone();return i.invert(),r.prepend(i),t.setFromMatrix(r),t}}}),cn,Ni=_(()=>{"use strict";cn={collectRenderables(t,e,r){this.parentRenderLayer&&this.parentRenderLayer!==r||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,r):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,r))},collectRenderablesSimple(t,e,r){let i=this.children,n=i.length;for(let s=0;s=0;n--){let s=this.effects[n];i[s.pipe].pop(s,this,t)}}}}),kr,fi=_(()=>{"use strict";kr=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t{J(),Zt(),dn=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e{fi(),Hi(),fn={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){this.effects.indexOf(t)===-1&&(this.effects.push(t),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){let e=this.effects.indexOf(t);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){let e=this._maskEffect;e?.mask!==t&&(e&&(this.removeEffect(e),Si.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=Si.getMaskEffect(t),this.addEffect(this._maskEffect)))},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(t){!Array.isArray(t)&&t&&(t=[t]);let e=this._filterEffect||(this._filterEffect=new kr);t=t;let r=t?.length>0,i=e.filters?.length>0,n=r!==i;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),n&&(r?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){return this._filterEffect?.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new kr),this._filterEffect.filterArea=t},get filterArea(){return this._filterEffect?.filterArea}}}),zi,Vn=_(()=>{kt(),zi={label:null,get name(){return Qe(ot,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){Qe(ot,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){let r=this.children;for(let i=0;i{He(),g=[new _e,new _e,new _e,new _e],b=class zo{constructor(e=0,r=0,i=0,n=0){this.type="rectangle",this.x=Number(e),this.y=Number(r),this.width=Number(i),this.height=Number(n)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new zo(0,0,0,0)}clone(){return new zo(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,r){return this.width<=0||this.height<=0?!1:e>=this.x&&e=this.y&&r=c&&e<=f&&r>=d&&r<=y&&!(e>x&&ew&&re.right?e.right:this.right)<=fe)return!1;let ue=this.ye.bottom?e.bottom:this.bottom)>ue}let i=this.left,n=this.right,s=this.top,a=this.bottom;if(n<=i||a<=s)return!1;let o=g[0].set(e.left,e.top),l=g[1].set(e.left,e.bottom),h=g[2].set(e.right,e.top),u=g[3].set(e.right,e.bottom);if(h.x<=o.x||l.y<=o.y)return!1;let c=Math.sign(r.a*r.d-r.b*r.c);if(c===0||(r.apply(o,o),r.apply(l,l),r.apply(h,h),r.apply(u,u),Math.max(o.x,l.x,h.x,u.x)<=i||Math.min(o.x,l.x,h.x,u.x)>=n||Math.max(o.y,l.y,h.y,u.y)<=s||Math.min(o.y,l.y,h.y,u.y)>=a))return!1;let f=c*(l.y-o.y),d=c*(o.x-l.x),y=f*i+d*s,x=f*n+d*s,v=f*i+d*a,w=f*n+d*a;if(Math.max(y,x,v,w)<=f*o.x+d*o.y||Math.min(y,x,v,w)>=f*u.x+d*u.y)return!1;let P=c*(o.y-h.y),G=c*(h.x-o.x),k=P*i+G*s,L=P*n+G*s,N=P*i+G*a,H=P*n+G*a;return!(Math.max(k,L,N,H)<=P*o.x+G*o.y||Math.min(k,L,N,H)>=P*u.x+G*u.y)}pad(e=0,r=e){return this.x-=e,this.y-=r,this.width+=e*2,this.height+=r*2,this}fit(e){let r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=r,this.width=Math.max(i-r,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(e=1,r=.001){let i=Math.ceil((this.x+this.width-r)*e)/e,n=Math.ceil((this.y+this.height-r)*e)/e;return this.x=Math.floor((this.x+r)*e)/e,this.y=Math.floor((this.y+r)*e)/e,this.width=i-this.x,this.height=n-this.y,this}enlarge(e){let r=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=r,this.width=i-r,this.y=n,this.height=s-n,this}getBounds(e){return e||(e=new zo),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;let r=e.x,i=e.y,n=e.x+e.width,s=e.y+e.height;return r>=this.x&&r=this.y&&i=this.x&&n=this.y&&s{Ze(),S(),p=new me,m=class Xv{constructor(e=1/0,r=1/0,i=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=p,this.minX=e,this.minY=r,this.maxX=i,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new b);let e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=p,this}set(e,r,i,n){this.minX=e,this.minY=r,this.maxX=i,this.maxY=n}addFrame(e,r,i,n,s){s||(s=this.matrix);let a=s.a,o=s.b,l=s.c,h=s.d,u=s.tx,c=s.ty,f=this.minX,d=this.minY,y=this.maxX,x=this.maxY,v=a*e+l*r+u,w=o*e+h*r+c;vy&&(y=v),w>x&&(x=w),v=a*i+l*r+u,w=o*i+h*r+c,vy&&(y=v),w>x&&(x=w),v=a*e+l*n+u,w=o*e+h*n+c,vy&&(y=v),w>x&&(x=w),v=a*i+l*n+u,w=o*i+h*n+c,vy&&(y=v),w>x&&(x=w),this.minX=f,this.minY=d,this.maxX=y,this.maxY=x}addRect(e,r){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,r)}addBounds(e,r){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,r)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxXthis.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=a*r+l*s+u,d=o*r+h*s+c,this.minX=fthis.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=a*n+l*s+u,d=o*n+h*s+c,this.minX=fthis.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(e){return this.minXe.right&&(this.maxX=e.right),this.minYe.bottom&&(this.maxY=e.bottom),this}fitBounds(e,r,i,n){return this.minXr&&(this.maxX=r),this.minYn&&(this.maxY=n),this}pad(e,r=e){return this.minX-=e,this.maxX+=e,this.minY-=r,this.maxY+=r,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new Xv(this.minX,this.minY,this.maxX,this.maxY)}scale(e,r=e){return this.minX*=e,this.minY*=r,this.maxX*=e,this.maxY*=r,this}get x(){return this.minX}set x(e){let r=this.maxX-this.minX;this.minX=e,this.maxX=e+r}get y(){return this.minY}set y(e){let r=this.maxY-this.minY;this.minY=e,this.maxY=e+r}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,r,i,n){let s=this.minX,a=this.minY,o=this.maxX,l=this.maxY;n||(n=this.matrix);let h=n.a,u=n.b,c=n.c,f=n.d,d=n.tx,y=n.ty;for(let x=r;xo?P:o,l=G>l?G:l}this.minX=s,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(e,r){return this.minX<=e&&this.minY<=r&&this.maxX>=e&&this.maxY>=r}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}}),E,C,M=_(()=>{Ze(),ln(),T(),E=new Ti(me),C=new Ti(m)}),F,V,W=_(()=>{Ze(),T(),M(),F=new me,V={getFastGlobalBounds(t,e){e||(e=new m),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let r=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(r.worldTransform),e},_getGlobalBoundsRecursive(t,e,r){let i=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==r||this.localDisplayStatus!==7||!this.measurable)return;let n=!!this.effects.length;if((this.renderGroup||n)&&(i=C.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let a=this.bounds;i.addFrame(a.minX,a.minY,a.maxX,a.maxY,this.groupTransform)}let s=this.children;for(let a=0;a{Ze(),M()});function j(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;let r=t>>16&255,i=t>>8&255,n=t&255,s=e>>16&255,a=e>>8&255,o=e&255,l=r*s/255|0,h=i*a/255|0,u=n*o/255|0;return(l<<16)+(h<<8)+u}var re=_(()=>{"use strict"});function he(t,e){return t===oe?e:e===oe?t:j(t,e)}var oe,Re=_(()=>{re(),oe=16777215});function Je(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}var Xe,Rt=_(()=>{Q(),M(),Re(),Xe={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,r=this.parent;for(;r;)e*=r.alpha,r=r.parent;return e},getGlobalTransform(t,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();let r=I(this,E.get().identity());return t.appendFrom(this.localTransform,r),E.return(r),t},getGlobalTint(t){if(t)return this.renderGroup?Je(this.renderGroup.worldColor):this.parentRenderGroup?Je(he(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,r=this.parent;for(;r;)e=he(e,r.localColor),r=r.parent;return Je(e)}}});function Be(...t){_r!==Ge&&(_r++,_r===Ge?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}var _r,Ge,Se=_(()=>{"use strict";_r=0,Ge=500});function et(t,e,r){return e.clear(),r||(r=me.IDENTITY),pt(t,e,r,t,!0),e.isValid||e.set(0,0,0,0),e}function pt(t,e,r,i,n){let s;if(n)s=E.get(),s=r.copyTo(s);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();let l=t.localTransform;s=E.get(),s.appendFrom(l,r)}let a=e,o=!!t.effects.length;if(o&&(e=C.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{t.renderPipeId&&(e.matrix=s,e.addBounds(t.bounds));let l=t.children;for(let h=0;h{Ze(),M()});function zt(t,e){let r=t.children;for(let i=0;i{"use strict"}),vr,Gt,qr=_(()=>{Ze(),T(),Q(),Ot(),hr(),vr=new me,Gt={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){let r=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*r:this.scale.x=r},_setHeight(t,e){let r=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*r:this.scale.y=r},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new m});let t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),zt(this,t),t.didChange&&et(this,t.localBounds,vr),t.localBounds},getBounds(t,e){return q(this,t,e||new m)}}}),Kr,Br=_(()=>{"use strict";Kr={_onRender:null,set onRender(t){let e=this.renderGroup||this.parentRenderGroup;if(!t){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}}});function Ir(t,e){return t._zIndex-e._zIndex}var Nr,Vo=_(()=>{"use strict";Nr={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(Ir))}}}),qc,Cy=_(()=>{He(),M(),qc={getGlobalPosition(t=new _e,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,r=!1){let i=this.getGlobalTransform(E.get(),r);return e=i.apply(t,e),E.return(i),e},toLocal(t,e,r,i){e&&(t=e.toGlobal(t,r,i));let n=this.getGlobalTransform(E.get(),i);return r=n.applyInverse(t,r),E.return(n),r}}}),Wo,Kc=_(()=>{Wt(),Wo=class{constructor(){this.uid=Mt("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function pn(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function Zc(t){return!(t&t-1)&&!!t}var $s=_(()=>{"use strict"});function Qc(t){let e={};for(let r in t)t[r]!==void 0&&(e[r]=t[r]);return e}var Jc=_(()=>{"use strict"});function Ay(t){let e=$o[t];return e===void 0&&($o[t]=Mt("resource")),e}var $o,Xo,Yo,ed=_(()=>{It(),Wt(),kt(),$o=Object.create(null),Xo=class Yv extends at{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...Yv.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){Qe(ot,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Ay(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}},Xo.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"},Yo=Xo}),qo,er,Er=_(()=>{It(),$s(),Jc(),Wt(),ed(),qo=class qv extends at{constructor(e={}){super(),this.options=e,this.uid=Mt("textureSource"),this._resourceType="textureSource",this._resourceId=Mt("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...qv.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new Yo(Qc(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=Mt("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){let{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,r,i){i||(i=this._resolution),e||(e=this.width),r||(r=this.height);let n=Math.round(e*i),s=Math.round(r*i);return this.width=n/i,this.height=s/i,this._resolution=i,this.pixelWidth===n&&this.pixelHeight===s?!1:(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=s,this.emit("resize",this),this._resourceId=Mt("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Zc(this.pixelWidth)&&Zc(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}},qo.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1},er=qo});function Py(){for(let t=0;t<16;t++){let e=[];Xs.push(e);for(let r=0;r<16;r++){let i=Wn(Ei[t]*Ei[r]+Ai[t]*Ci[r]),n=Wn(Ci[t]*Ei[r]+Pi[t]*Ci[r]),s=Wn(Ei[t]*Ai[r]+Ai[t]*Pi[r]),a=Wn(Ci[t]*Ai[r]+Pi[t]*Pi[r]);for(let o=0;o<16;o++)if(Ei[o]===i&&Ci[o]===n&&Ai[o]===s&&Pi[o]===a){e.push(o);break}}}for(let t=0;t<16;t++){let e=new me;e.set(Ei[t],Ci[t],Ai[t],Pi[t],0,0),Ko.push(e)}}var Ei,Ci,Ai,Pi,Xs,Ko,Wn,jt,My=_(()=>{Ze(),Ei=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ci=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ai=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Pi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Xs=[],Ko=[],Wn=Math.sign,Py(),jt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>Ei[t],uY:t=>Ci[t],vX:t=>Ai[t],vY:t=>Pi[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>Xs[t][e],sub:(t,e)=>Xs[t][jt.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?jt.S:jt.N:Math.abs(e)*2<=Math.abs(t)?t>0?jt.E:jt.W:e>0?t>0?jt.SE:jt.SW:t>0?jt.NE:jt.NW,matrixAppendRotationInv:(t,e,r=0,i=0)=>{let n=Ko[jt.inv(e)];n.tx=r,n.ty=i,t.append(n)}}}),Zo,Ry=_(()=>{"use strict";Zo=()=>{}}),Ys,td=_(()=>{J(),Er(),Ys=class extends er{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}},Ys.extension=O.TextureSource}),Qo,Jo,rd=_(()=>{Ze(),Qo=new me,Jo=class{constructor(t,e){this.mapCoord=new me,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let i=0;i{It(),My(),S(),Wt(),kt(),Ry(),td(),Er(),rd(),Fe=class extends at{constructor({source:t,label:e,frame:r,orig:i,trim:n,defaultAnchor:s,defaultBorders:a,rotate:o,dynamic:l}={}){if(super(),this.uid=Mt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new b,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new er,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=i||this.frame,this.trim=n,this.rotate=o??0,this.defaultAnchor=s,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Jo(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:i}=this._source,n=e.x/r,s=e.y/i,a=e.width/r,o=e.height/i,l=this.rotate;if(l){let h=a/2,u=o/2,c=n+h,f=s+u;l=jt.add(l,jt.NW),t.x0=c+h*jt.uX(l),t.y0=f+u*jt.uY(l),l=jt.add(l,2),t.x1=c+h*jt.uX(l),t.y1=f+u*jt.uY(l),l=jt.add(l,2),t.x2=c+h*jt.uX(l),t.y2=f+u*jt.uY(l),l=jt.add(l,2),t.x3=c+h*jt.uX(l),t.y3=f+u*jt.uY(l)}else t.x0=n,t.y0=s,t.x1=n+a,t.y1=s,t.x2=n+a,t.y2=s+o,t.x3=n,t.y3=s+o}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return Qe(ot,"Texture.baseTexture is now Texture.source"),this._source}},Fe.EMPTY=new Fe({label:"EMPTY",source:new er({label:"EMPTY"})}),Fe.EMPTY.destroy=Zo,Fe.WHITE=new Fe({source:new Ys({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),Fe.WHITE.destroy=Zo}),id,nd,ar,ji=_(()=>{$s(),Er(),Dt(),id=0,nd=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let i=new er({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new Fe({source:i,label:`texturePool_${id++}`})}getOptimalTexture(t,e,r=1,i){let n=Math.ceil(t*r-1e-6),s=Math.ceil(e*r-1e-6);n=pn(n),s=pn(s);let a=(n<<17)+(s<<1)+(i?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let o=this._texturePool[a].pop();return o||(o=this.createTexture(n,s,i)),o.source._resolution=r,o.source.width=n/r,o.source.height=s/r,o.source.pixelWidth=n,o.source.pixelHeight=s,o.frame.x=0,o.frame.y=0,o.frame.width=t,o.frame.height=e,o.updateUvs(),this._poolKeyHash[o.uid]=a,o}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let i=0;i{Ze(),Kc(),ji(),sd=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new me,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Wo,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let r=0;r-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e{"use strict"}),qs,Ks,Zs,$n,Qs,gn,dr,Zr=_(()=>{It(),De(),gt(),J(),Ze(),Me(),ci(),Wt(),kt(),Zt(),Li(),di(),Ni(),jn(),Vn(),W(),Rt(),qr(),Br(),Vo(),Cy(),ky(),Iy(),qs=new Yt(null),Ks=new Yt(null),Zs=new Yt(null,1,1),$n=1,Qs=2,gn=4,dr=class Kv extends at{constructor(e={}){super(),this.uid=Mt("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new me,this.relativeGroupTransform=new me,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Yt(this,0,0),this._scale=Zs,this._pivot=Ks,this._skew=qs,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],By(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(r=>this.addChild(r)),e.parent?.addChild(this)}static mixin(e){Qe("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),xe.mixin(Kv,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||Qe(ot,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let n=0;n1){for(let n=0;n-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(r):this.parentRenderGroup&&this.parentRenderGroup.removeChild(r),r.parentRenderLayer&&r.parentRenderLayer.detach(r),r.parent=null,this.emit("childRemoved",r,this,i),r.emit("removed",this)),r}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=it.get(sd,this),this.groupTransform=me.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),it.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new me),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*Ue}set angle(e){this.rotation=e*mt}get pivot(){return this._pivot===Ks&&(this._pivot=new Yt(this,0,0)),this._pivot}set pivot(e){this._pivot===Ks&&(this._pivot=new Yt(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===qs&&(this._skew=new Yt(this,0,0)),this._skew}set skew(e){this._skew===qs&&(this._skew=new Yt(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Zs&&(this._scale=new Yt(this,1,1)),this._scale}set scale(e){this._scale===Zs&&(this._scale=new Yt(this,0,0)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let r=this.getLocalBounds().width;this._setWidth(e,r)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let r=this.getLocalBounds().height;this._setHeight(e,r)}getSize(e){e||(e={});let r=this.getLocalBounds();return e.width=Math.abs(this.scale.x*r.width),e.height=Math.abs(this.scale.y*r.height),e}setSize(e,r){let i=this.getLocalBounds();typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,i.width),r!==void 0&&this._setHeight(r,i.height)}_updateSkew(){let e=this._rotation,r=this._skew;this._cx=Math.cos(e+r._y),this._sx=Math.sin(e+r._y),this._cy=-Math.sin(e-r._x),this._sy=Math.cos(e-r._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let r=this.localTransform,i=this._scale,n=this._pivot,s=this._position,a=i._x,o=i._y,l=n._x,h=n._y;r.a=this._cx*a,r.b=this._sx*a,r.c=this._cy*o,r.d=this._sy*o,r.tx=s._x-(l*r.a+h*r.c),r.ty=s._y-(l*r.b+h*r.d)}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=$n,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let r=ce.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=$n,this._onUpdate())}get tint(){return Je(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Qs,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let r=e?2:0;(this.localDisplayStatus&2)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=gn,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let r=e?0:4;(this.localDisplayStatus&4)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=gn,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let r=e?1:0;(this.localDisplayStatus&1)!==r&&(this._updateFlags|=gn,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let r;if(this.children.length&&(r=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof e=="boolean"?e:e?.children)&&r)for(let i=0;i{He(),Js=class Zv{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Zv.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new _e,this.page=new _e,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,r,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,r,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function Oy(t){return function(e){return e.test(t)}}function ad(t){var e={userAgent:"",platform:"",maxTouchPoints:0};!t&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof t=="string"?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0});var r=e.userAgent,i=r.split("[FBAN");typeof i[1]<"u"&&(r=i[0]),i=r.split("Twitter"),typeof i[1]<"u"&&(r=i[0]);var n=Oy(r),s={apple:{phone:n(ea)&&!n(Qr),ipod:n(tl),tablet:!n(ea)&&(n(rl)||cl(e))&&!n(Qr),universal:n(il),device:(n(ea)||n(tl)||n(rl)||n(il)||cl(e))&&!n(Qr)},amazon:{phone:n(Vi),tablet:!n(Vi)&&n(Xn),device:n(Vi)||n(Xn)},android:{phone:!n(Qr)&&n(Vi)||!n(Qr)&&n(ta),tablet:!n(Qr)&&!n(Vi)&&!n(ta)&&(n(Xn)||n(nl)),device:!n(Qr)&&(n(Vi)||n(Xn)||n(ta)||n(nl))||n(/\bokhttp\b/i)},windows:{phone:n(Qr),tablet:n(sl),device:n(Qr)||n(sl)},other:{blackberry:n(al),blackberry10:n(ol),opera:n(ll),firefox:n(ul),chrome:n(hl),device:n(al)||n(ol)||n(ll)||n(ul)||n(hl)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var ea,tl,rl,il,ta,nl,Vi,Xn,Qr,sl,al,ol,ll,hl,ul,cl,od=_(()=>{ea=/iPhone/i,tl=/iPod/i,rl=/iPad/i,il=/\biOS-universal(?:.+)Mac\b/i,ta=/\bAndroid(?:.+)Mobile\b/i,nl=/Android/i,Vi=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Xn=/Silk/i,Qr=/Windows Phone/i,sl=/\bWindows(?:.+)ARM\b/i,al=/BlackBerry/i,ol=/BB10/i,ll=/Opera Mini/i,hl=/\b(CriOS|Chrome)(?:.+)Mobile/i,ul=/Mobile(?:.+)Firefox\b/i,cl=function(t){return typeof t<"u"&&t.platform==="MacIntel"&&typeof t.maxTouchPoints=="number"&&t.maxTouchPoints>1&&typeof MSStream>"u"}}),Gy=_(()=>{od(),od()}),ld,hd,Fy=_(()=>{Gy(),ld=ad.default??ad,hd=ld(globalThis.navigator)}),ud,Yn,cd,dd,dl,fl,fd,pd,gd,ra,md,Dy=_(()=>{el(),J(),Fy(),ir(),ud=9,Yn=100,cd=0,dd=0,dl=2,fl=1,fd=-1e3,pd=-1e3,gd=2,ra=class Qv{constructor(e,r=hd){this._mobileInfo=r,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(r.tablet||r.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${fl}px`,e.style.height=`${fl}px`,e.style.position="absolute",e.style.top=`${fd}px`,e.style.left=`${pd}px`,e.style.zIndex=gd.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${Yn}px`,this._div.style.height=`${Yn}px`,this._div.style.position="absolute",this._div.style.top=`${cd}px`,this._div.style.left=`${dd}px`,this._div.style.zIndex=dl.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let e=this._renderer.view.canvas;if(e.parentNode)e.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let r=new MutationObserver(()=>{e.parentNode&&(e.parentNode.appendChild(this._div),r.disconnect(),this._initAccessibilitySetup())});r.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let e of this._children)e._accessibleDiv&&e._accessibleDiv.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;this._pool.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let r=e.children;if(r)for(let i=0;i=0;i--){let n=this._children[i];r.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._pool.push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,Sr(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:n,width:s,height:a}=this._renderer.screen,o=this._div;o.style.left=`${i}px`,o.style.top=`${n}px`,o.style.width=`${s}px`,o.style.height=`${a}px`}for(let i=0;i title : ${e.title}
    tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:r,height:i}=this._renderer;e.x+e.width>r&&(e.width=r-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let r=this._pool.pop();r||(e.accessibleType==="button"?r=document.createElement("button"):(r=document.createElement(e.accessibleType),r.style.cssText=` + color: transparent; + pointer-events: none; + padding: 0; + margin: 0; + border: 0; + outline: 0; + background: transparent; + box-sizing: border-box; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + `,e.accessibleText&&(r.innerText=e.accessibleText)),r.style.width=`${Yn}px`,r.style.height=`${Yn}px`,r.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",r.style.position="absolute",r.style.zIndex=dl.toString(),r.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?r.setAttribute("aria-live","off"):r.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?r.setAttribute("aria-relevant","additions"):r.setAttribute("aria-relevant","text"),r.addEventListener("click",this._onClick.bind(this)),r.addEventListener("focus",this._onFocus.bind(this)),r.addEventListener("focusout",this._onFocusOut.bind(this))),r.style.pointerEvents=e.accessiblePointerEvents,r.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?r.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(r.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&r.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(r),e._accessibleActive=!0,e._accessibleDiv=r,r.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e.interactive&&(e._accessibleDiv.tabIndex=e.tabIndex)}_dispatchEvent(e,r){let{container:i}=e.target,n=this._renderer.events.rootBoundary,s=Object.assign(new Js(n),{target:i});n.rootTarget=this._renderer.lastObjectRendered,r.forEach(a=>n.dispatchEvent(s,a))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode!==ud||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}},ra.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"accessibility"},ra.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0},md=ra}),_d,Uy=_(()=>{"use strict";_d={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}}),Ly=_(()=>{J(),Zr(),Dy(),Uy(),xe.add(md),xe.mixin(dr,_d)}),pl,Ny=_(()=>{J(),pl=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:i,clientHeight:n}=this._resizeTo;e=i,r=n}this.renderer.resize(e,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}},pl.extension=O.Application}),mn,gl=_(()=>{"use strict";mn=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(mn||{})}),ia,Hy=_(()=>{"use strict";ia=class{constructor(t,e=null,r=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=i}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}}),ml,Hr,na=_(()=>{gl(),Hy(),ml=class Pr{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new ia(null,null,1/0),this.deltaMS=1/Pr.targetFPMS,this.elapsedMS=1/Pr.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,r,i=mn.NORMAL){return this._addListener(new ia(e,r,i))}addOnce(e,r,i=mn.NORMAL){return this._addListener(new ia(e,r,i,!0))}_addListener(e){let r=this._head.next,i=this._head;if(!r)e.connect(i);else{for(;r;){if(e.priority>r.priority){e.connect(i);break}i=r,r=r.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,r){let i=this._head.next;for(;i;)i.match(e,r)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,r=this._head;for(;r=r.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let r;if(e>this.lastTime){if(r=this.elapsedMS=e-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){let s=e-this._lastFrame|0;if(s{J(),gl(),na(),_l=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,mn.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Hr.shared:new Hr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}},_l.extension=O.Application}),vd=_(()=>{J(),Ny(),zy(),xe.add(pl),xe.add(_l)}),yd,pi,xd=_(()=>{gl(),na(),yd=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(Hr.system.add(this._tickerUpdate,this,mn.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Hr.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime{He(),el(),qn=class extends Js{constructor(){super(...arguments),this.client=new _e,this.movement=new _e,this.offset=new _e,this.global=new _e,this.screen=new _e}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,i,n,s,a,o,l,h,u,c,f,d,y){throw new Error("Method not implemented.")}}}),Or,bd=_(()=>{vl(),Or=class extends qn{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}}),Wi,wd=_(()=>{vl(),Wi=class extends qn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}},Wi.DOM_DELTA_PIXEL=0,Wi.DOM_DELTA_LINE=1,Wi.DOM_DELTA_PAGE=2}),Td,Sd,_n,Ed,jy=_(()=>{It(),He(),Se(),xd(),vl(),bd(),wd(),Td=2048,Sd=new _e,_n=new _e,Ed=class{constructor(t){this.dispatch=new at,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,i)=>r.priority-i.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,i=e.length;r=0;i--)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let i=Array.isArray(e)?e:[e];for(let n=r.length-1;n>=0;n--)i.forEach(s=>{t.currentTarget=r[n],this.notifyTarget(t,s)})}propagationPath(t){let e=[t];for(let r=0;r=0;u--){let c=h[u],f=this.hitTestMoveRecursive(c,this._isInteractive(e)?e:c.eventMode,r,i,n,s||n(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let d=t.isInteractive();(f.length>0||d)&&(d&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let o=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),s||this._hitElements.length>0?null:a?this._hitElements:o&&!n(t,r)&&i(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,i,n){if(this._interactivePrune(t)||n(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(pi.pauseUpdate=!1),t.interactiveChildren&&t.children){let o=t.children,l=r;for(let h=o.length-1;h>=0;h--){let u=o[h],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,i,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;let f=t.isInteractive();return(c.length>0||f)&&c.push(t),c}}}let s=this._isInteractive(e),a=t.isInteractive();return s&&i(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,_n),!t.hitArea.contains(_n.x,_n.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r0&&n!==e.target){let o=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,o,n);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(n)){let h=this.createPointerEvent(t,"pointerleave",n);for(h.eventPhase=h.AT_TARGET;h.target&&!e.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),r&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(n!==e.target){let o=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,o);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let h=n?.parent;for(;h&&h!==this.rootTarget.parent&&h!==e.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let u=this.clonePointerEvent(e,"pointerenter");for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==n&&u.target!==this.rootTarget.parent;)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseenter"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(l)}let s=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?s.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&s.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?s.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&s.push("globaltouchmove")),r&&(this.moveOnAll?s.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&s.push("globalmousemove"),this.cursor=e.target?.cursor),s.length>0&&this.all(e,s),this._allInteractiveElements.length=0,this._hitElements.length=0,i.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Or)){Be("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),i=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),i&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let n=this.clonePointerEvent(r,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Or)){Be("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",i=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(n),r&&this.dispatchEvent(n,"mouseout");let s=this.createPointerEvent(t,"pointerleave",i);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),r&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(s)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Or)){Be("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=n;if(n&&!r.composedPath().includes(n)){let a=n;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let o=r.button===2;this.notifyTarget(r,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete i.pressTargetsByButton[t.button],s=a}if(s){let a=this.clonePointerEvent(r,"click");a.target=s,a.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let o=i.clicksByButton[t.button];if(o.target===a.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=a.target,o.timeStamp=e,a.detail=o.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Or)){Be("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),i=this.createPointerEvent(t);if(r){let n=r;for(;n;)i.currentTarget=n,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch"?this.notifyTarget(i,"touchendoutside"):(i.pointerType==="mouse"||i.pointerType==="pen")&&this.notifyTarget(i,i.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof Wi)){Be("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r{J(),jy(),xd(),bd(),wd(),Cd=1,Ad={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},sa=class Nc{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new Ed(null),pi.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Or(null),this._rootWheelEvent=new Wi(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Nc.defaultEventFeatures},{set:(r,i,n)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),r[i]=n,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){let{canvas:r,resolution:i}=this.renderer;this.setTargetElement(r),this.resolution=i,Nc._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let r=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(r=!1),this._currentCursor===e)return;this._currentCursor=e;let i=this.cursorStyles[e];if(i)switch(typeof i){case"string":r&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":r&&Object.assign(this.domElement.style,i);break}else r&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=this._normalizeToPointerData(e);this.autoPreventDefault&&r[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,n=r.length;i0&&(r=e.composedPath()[0]);let i=r!==this.domElement?"outside":"",n=this._normalizeToPointerData(e);for(let s=0,a=n.length;s"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=e.type,r.push(s)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=Cd),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,r.push(i)}else r.push(e);return r}normalizeWheelEvent(e){let r=this._rootWheelEvent;return this._transferMouseData(r,e),r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ,r.deltaMode=e.deltaMode,this.mapPositionToPoint(r.screen,e.clientX,e.clientY),r.global.copyFrom(r.screen),r.offset.copyFrom(r.screen),r.nativeEvent=e,r.type=e.type,r}_bootstrapEvent(e,r){return e.originalEvent=null,e.nativeEvent=r,e.pointerId=r.pointerId,e.width=r.width,e.height=r.height,e.isPrimary=r.isPrimary,e.pointerType=r.pointerType,e.pressure=r.pressure,e.tangentialPressure=r.tangentialPressure,e.tiltX=r.tiltX,e.tiltY=r.tiltY,e.twist=r.twist,this._transferMouseData(e,r),this.mapPositionToPoint(e.screen,r.clientX,r.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=r.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=Ad[e.type]||e.type),e}_transferMouseData(e,r){e.isTrusted=r.isTrusted,e.srcElement=r.srcElement,e.timeStamp=performance.now(),e.type=r.type,e.altKey=r.altKey,e.button=r.button,e.buttons=r.buttons,e.client.x=r.clientX,e.client.y=r.clientY,e.ctrlKey=r.ctrlKey,e.metaKey=r.metaKey,e.movement.x=r.movementX,e.movement.y=r.movementY,e.page.x=r.pageX,e.page.y=r.pageY,e.relatedTarget=null,e.shiftKey=r.shiftKey}},sa.extension={name:"events",type:[O.WebGLSystem,O.CanvasSystem,O.WebGPUSystem],priority:-1},sa.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},yl=sa}),Md,Vy=_(()=>{Pd(),el(),Md={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(t){this.eventMode=t?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??yl.defaultEventMode},set eventMode(t){this._internalEventMode=t},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(t,e,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,n=typeof r=="object"?r.signal:void 0,s=typeof r=="object"?r.once===!0:!1,a=typeof e=="function"?void 0:e;t=i?`${t}capture`:t;let o=typeof e=="function"?e:e.handleEvent,l=this;n&&n.addEventListener("abort",()=>{l.off(t,o,a)}),s?l.once(t,o,a):l.on(t,o,a)},removeEventListener(t,e,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,n=typeof e=="function"?void 0:e;t=i?`${t}capture`:t,e=typeof e=="function"?e:e.handleEvent,this.off(t,e,n)},dispatchEvent(t){if(!(t instanceof Js))throw new Error("Container cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}}}),Wy=_(()=>{J(),Zr(),Pd(),Vy(),xe.add(yl),xe.mixin(dr,Md)}),xl,$y=_(()=>{J(),xl=class{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r{T(),Zr(),aa=class extends dr{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new m(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:r,y:i}=t;return r>=e.minX&&r<=e.maxX&&i>=e.minY&&i<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:i,renderableGC:n}=e;i.blendMode.setBlendMode(this,this.groupBlendMode,t),i[this.renderPipeId].addRenderable(this,t),n.addRenderable(this),this.didViewUpdate=!1;let s=this.children,a=s.length;for(let o=0;o{J(),$y(),xe.add(xl)}),wl,Yy=_(()=>{"use strict";wl=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(wl||{})}),Rd,qy=_(()=>{"use strict";Rd={createCanvas:(t,e)=>{let r=document.createElement("canvas");return r.width=t,r.height=e,r},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")}}),Tl,Nt,tr=_(()=>{qy(),Tl=Rd,Nt={get(){return Tl},set(t){Tl=t}}});function zr(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function Kn(t){return t.split("?")[0].split("#")[0]}function Ky(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zy(t,e,r){return t.replace(new RegExp(Ky(e),"g"),r)}function Qy(t,e){let r="",i=0,n=-1,s=0,a=-1;for(let o=0;o<=t.length;++o){if(o2){let l=r.lastIndexOf("/");if(l!==r.length-1){l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}}else if(r.length===2||r.length===1){r="",i=0,n=o,s=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+=`/${t.slice(n+1,o)}`:r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return r}var vn,kd=_(()=>{tr(),vn={toPosix(t){return Zy(t,"\\","/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},isBlobUrl(t){return t.startsWith("blob:")},hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){zr(t),t=this.toPosix(t);let e=/^file:\/\/\//.exec(t);if(e)return e[0];let r=/^[^/:]+:\/{0,2}/.exec(t);return r?r[0]:""},toAbsolute(t,e,r){if(zr(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;let i=Kn(this.toPosix(e??Nt.get().getBaseUrl())),n=Kn(this.toPosix(r??this.rootname(i)));return t=this.toPosix(t),t.startsWith("/")?vn.join(n,t.slice(1)):this.isAbsolute(t)?t:this.join(i,t)},normalize(t){if(zr(t),t.length===0)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="",r=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));let i=t.endsWith("/");return t=Qy(t,!1),t.length>0&&i&&(t+="/"),r?`/${t}`:e+t},isAbsolute(t){return zr(t),t=this.toPosix(t),this.hasProtocol(t)?!0:t.startsWith("/")},join(...t){if(t.length===0)return".";let e;for(let r=0;r0)if(e===void 0)e=i;else{let n=t[r-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(t){if(zr(t),t.length===0)return".";t=this.toPosix(t);let e=t.charCodeAt(0),r=e===47,i=-1,n=!0,s=this.getProtocol(t),a=t;t=t.slice(s.length);for(let o=t.length-1;o>=1;--o)if(e=t.charCodeAt(o),e===47){if(!n){i=o;break}}else n=!1;return i===-1?r?"/":this.isUrl(a)?s+t:s:r&&i===1?"//":s+t.slice(0,i)},rootname(t){zr(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){let r=t.indexOf("/",e.length);r!==-1?e=t.slice(0,r):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){zr(t),e&&zr(e),t=Kn(this.toPosix(t));let r=0,i=-1,n=!0,s;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let a=e.length-1,o=-1;for(s=t.length-1;s>=0;--s){let l=t.charCodeAt(s);if(l===47){if(!n){r=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(l===e.charCodeAt(a)?--a===-1&&(i=s):(a=-1,i=o))}return r===i?i=o:i===-1&&(i=t.length),t.slice(r,i)}for(s=t.length-1;s>=0;--s)if(t.charCodeAt(s)===47){if(!n){r=s+1;break}}else i===-1&&(n=!1,i=s+1);return i===-1?"":t.slice(r,i)},extname(t){zr(t),t=Kn(this.toPosix(t));let e=-1,r=0,i=-1,n=!0,s=0;for(let a=t.length-1;a>=0;--a){let o=t.charCodeAt(a);if(o===47){if(!n){r=a+1;break}continue}i===-1&&(n=!1,i=a+1),o===46?e===-1?e=a:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||i===-1||s===0||s===1&&e===i-1&&e===r+1?"":t.slice(e,i)},parse(t){zr(t);let e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=Kn(this.toPosix(t));let r=t.charCodeAt(0),i=this.isAbsolute(t),n,s="";e.root=this.rootname(t),i||this.hasProtocol(t)?n=1:n=0;let a=-1,o=0,l=-1,h=!0,u=t.length-1,c=0;for(;u>=n;--u){if(r=t.charCodeAt(u),r===47){if(!h){o=u+1;break}continue}l===-1&&(h=!1,l=u+1),r===46?a===-1?a=u:c!==1&&(c=1):a!==-1&&(c=-1)}return a===-1||l===-1||c===0||c===1&&a===l-1&&a===o+1?l!==-1&&(o===0&&i?e.base=e.name=t.slice(1,l):e.base=e.name=t.slice(o,l)):(o===0&&i?(e.name=t.slice(1,a),e.base=t.slice(1,l)):(e.name=t.slice(o,a),e.base=t.slice(o,l)),e.ext=t.slice(a,l)),e.dir=this.dirname(t),s&&(e.dir=s+e.dir),e},sep:"/",delimiter:":",joinExtensions:[".html"]}}),$i,Bd=_(()=>{"use strict";$i=(t,e,r=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(i=>typeof i=="string"||r?e(i):i):t)});function Id(t,e,r,i,n){let s=e[r];for(let a=0;a{let a=s.substring(1,s.length-1).split(",");n.push(a)}),Id(t,n,0,r,i)}else i.push(t);return i}var ex=_(()=>{"use strict"}),Sl,tx=_(()=>{"use strict";Sl=t=>!Array.isArray(t)});function rx(t){return t.split(".").pop().split("?").shift().split("#").shift()}var El,ix=_(()=>{Se(),kd(),Bd(),ex(),tx(),El=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return $i(e||r,i=>typeof i=="string"?i:Array.isArray(i)?i.map(n=>n?.src??n):i?.src?i.src:i,!0)}addManifest(t){this._manifest&&Be("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let r=[],i=e;Array.isArray(e)||(i=Object.entries(e).map(([n,s])=>typeof s=="string"||Array.isArray(s)?{alias:n,src:s}:{alias:n,...s})),i.forEach(n=>{let s=n.src,a=n.alias,o;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),o=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(t,h));r.push(...l),o=[...a,...l]}this.add({...n,alias:o,src:s})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=i=>{this.hasKey(i)&&Be(`[Resolver] already has key: ${i} overwriting`)},$i(e).forEach(i=>{let{src:n}=i,{data:s,format:a,loadParser:o}=i,l=$i(n).map(c=>typeof c=="string"?Jy(c):Array.isArray(c)?c:[c]),h=this.getAlias(i);Array.isArray(h)?h.forEach(r):r(h);let u=[];l.forEach(c=>{c.forEach(f=>{let d={};if(typeof f!="object"){d.src=f;for(let y=0;y{this._assetMap[c]=u})})}resolveBundle(t){let e=Sl(t);t=$i(t);let r={};return t.forEach(i=>{let n=this._bundles[i];if(n){let s=this.resolve(n),a={};for(let o in s){let l=s[o];a[this._extractAssetIdFromBundle(i,o)]=l}r[i]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let i in e)r[i]=e[i].src;return r}return e.src}resolve(t){let e=Sl(t);t=$i(t);let r={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let n=this._assetMap[i],s=this._getPreferredOrder(n);s?.priority.forEach(a=>{s.params[a].forEach(o=>{let l=n.filter(h=>h[a]?h[a]===o:!1);l.length&&(n=l)})}),this._resolverHash[i]=n[0]}else this._resolverHash[i]=this._buildResolvedAsset({alias:[i],src:i},{});r[i]=this._resolverHash[i]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(r.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:i,loadParser:n,format:s}=e;return(this._basePath||this._rootPath)&&(t.src=vn.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=n??t.loadParser,t.format=s??t.format??rx(t.src),t}},El.RETINA_PREFIX=/@([0-9\.]+)x/}),Cl,nx=_(()=>{"use strict";Cl=(t,e)=>{let r=e.split("?")[1];return r&&(t+=`?${r}`),t}}),Al,Pl,sx=_(()=>{S(),Dt(),Al=class Ws{constructor(e,r){this.linkedSheets=[],this._texture=e instanceof Fe?e:null,this.textureSource=e.source,this.textures={},this.animations={},this.data=r;let i=parseFloat(r.meta.scale);i?(this.resolution=i,e.source.resolution=this.resolution):this.resolution=e.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=Ws.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let r=e,i=Ws.BATCH_SIZE;for(;r-e{this._batchIndex*Ws.BATCH_SIZE{i[n]=e}),Object.keys(e.textures).forEach(n=>{i[n]=e.textures[n]}),!r){let n=vn.dirname(t[0]);e.linkedSheets.forEach((s,a)=>{let o=Od([`${n}/${e.data.meta.related_multi_packs[a]}`],s,!0);Object.assign(i,o)})}return i}var Gd,Fd,ax=_(()=>{Yy(),ix(),nx(),J(),Dt(),kd(),sx(),Gd=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"],Fd={extension:O.Asset,cache:{test:t=>t instanceof Pl,getCacheableAssets:(t,e)=>Od(t,e,!1)},resolver:{extension:{type:O.ResolveParser,name:"resolveSpritesheet"},test:t=>{let e=t.split("?")[0].split("."),r=e.pop(),i=e.pop();return r==="json"&&Gd.includes(i)},parse:t=>{let e=t.split(".");return{resolution:parseFloat(El.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:O.LoadParser,priority:wl.Normal,name:"spritesheetLoader"},async testParse(t,e){return vn.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,r){let{texture:i,imageFilename:n,textureOptions:s}=e?.data??{},a=vn.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let o;if(i instanceof Fe)o=i;else{let u=Cl(a+(n??t.meta.image),e.src);o=(await r.load([{src:u,data:s}]))[u]}let l=new Pl(o.source,t);await l.parse();let h=t?.meta?.related_multi_packs;if(Array.isArray(h)){let u=[];for(let f of h){if(typeof f!="string")continue;let d=a+f;e.data?.ignoreMultiPack||(d=Cl(d,e.src),u.push(r.load({src:d,data:{textureOptions:s,ignoreMultiPack:!0}})))}let c=await Promise.all(u);l.linkedSheets=c,c.forEach(f=>{f.linkedSheets=[l].concat(l.linkedSheets.filter(d=>d!==f))})}return l},async unload(t,e,r){await r.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}}}),Ml=_(()=>{J(),ax(),xe.add(Fd)});function Dd(t,e,r){let{width:i,height:n}=r.orig,s=r.trim;if(s){let a=s.width,o=s.height;t.minX=s.x-e._x*i,t.maxX=t.minX+a,t.minY=s.y-e._y*n,t.maxY=t.minY+o}else t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}var Ud=_(()=>{"use strict"}),oa,Ld=_(()=>{ci(),Dt(),Ud(),kt(),bl(),oa=class Hc extends aa{constructor(e=Fe.EMPTY){e instanceof Fe&&(e={texture:e});let{texture:r=Fe.EMPTY,anchor:i,roundPixels:n,width:s,height:a,...o}=e;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Yt({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:r.defaultAnchor&&(this.anchor=r.defaultAnchor),this.texture=r,this.allowChildren=!1,this.roundPixels=n??!1,s!==void 0&&(this.width=s),a!==void 0&&(this.height=a)}static from(e,r=!1){return e instanceof Fe?new Hc(e):new Hc(Fe.from(e,r))}set texture(e){e||(e=Fe.EMPTY);let r=this._texture;r!==e&&(r&&r.dynamic&&r.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return Dd(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return Qe("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let e=this._anchor,r=this._texture,i=this._bounds,{width:n,height:s}=r.orig;i.minX=-e._x*n,i.maxX=i.minX+n,i.minY=-e._y*s,i.maxY=i.minY+s}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e?.texture){let r=typeof e=="boolean"?e:e?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,r){typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),r!==void 0&&this._setHeight(r,this._texture.orig.height)}}});function Nd(t,e,r){let i=Hd;t.measurable=!0,q(t,r,i),e.addBoundsMask(i),t.measurable=!1}var Hd,zd=_(()=>{T(),Q(),Hd=new m});function jd(t,e,r){let i=C.get();t.measurable=!0;let n=E.get().identity(),s=Vd(t,r,n);et(t,i,s),t.measurable=!1,e.addBoundsMask(i),E.return(n),C.return(i)}function Vd(t,e,r){return t?(t!==e&&(Vd(t.parent,e,r),t.updateLocalTransform(),r.append(t.localTransform)),r):(Be("Mask bounds, renderable is not inside the root container"),r)}var Wd=_(()=>{Ot(),M(),Se()}),Rl,ox=_(()=>{J(),Ld(),zd(),Wd(),Rl=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof oa),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||Nd(this.mask,t,e)}addLocalBounds(t,e){jd(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof oa}},Rl.extension=O.MaskEffect}),kl,lx=_(()=>{J(),kl=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}},kl.extension=O.MaskEffect}),Bl,hx=_(()=>{J(),Zr(),zd(),Wd(),Bl=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){Nd(this.mask,t,e)}addLocalBounds(t,e){jd(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof dr}},Bl.extension=O.MaskEffect}),Jr,Zn=_(()=>{tr(),J(),Er(),Jr=class extends er{constructor(t){t.resource||(t.resource=Nt.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,r=this._resolution){let i=super.resize(t,e,r);return i&&this.resizeCanvas(),i}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}},Jr.extension=O.TextureSource}),yn,Il=_(()=>{tr(),J(),Se(),Er(),yn=class extends er{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=Nt.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,Be("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}},yn.extension=O.TextureSource});async function ux(){return Ol??(Ol=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(s=>{let a=document.createElement("video");a.onloadeddata=()=>s(a),a.onerror=()=>s(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(i),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Ol}var Ol,cx=_(()=>{"use strict"}),Qn,$d,dx=_(()=>{J(),na(),cx(),Er(),Qn=class Jv extends er{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...Jv.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let e=Hr.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let e=this.resource,r=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(r.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.alphaMode=await ux(),this._load=new Promise((i,n)=>{this.isValid?i(this):(this._resolve=i,this._reject=n,r.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${r.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Hr.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Hr.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Hr.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}},Qn.extension=O.TextureSource,Qn.defaultOptions={...er.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},Qn.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},$d=Qn}),Xd,or,la=_(()=>{Se(),Bd(),Xd=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||Be(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=$i(t),i;for(let o=0;o{n.set(o,e)});let s=[...n.keys()],a={cacheKeys:s,keys:r};r.forEach(o=>{this._cacheMap.set(o,a)}),s.forEach(o=>{let l=i?i[o]:e;this._cache.has(o)&&this._cache.get(o)!==l&&Be("[Cache] already has key:",o),this._cache.set(o,n.get(o))})}remove(t){if(!this._cacheMap.has(t)){Be(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}},or=new Xd});function Yd(t={}){let e=t&&t.resource,r=e?t.resource:t,i=e?t:{resource:t};for(let n=0;n{or.has(i)&&or.remove(i)}),e||or.set(i,s),s}function px(t,e=!1){return typeof t=="string"?or.get(t):t instanceof er?new Fe({source:t}):fx(t,e)}var ha,qd=_(()=>{la(),J(),Er(),Dt(),ha=[],xe.handleByList(O.TextureSource,ha),Fe.from=px,er.from=Yd}),Gl=_(()=>{J(),ox(),lx(),hx(),td(),Zn(),Il(),dx(),qd(),xe.add(Rl,kl,Bl,$d,yn,Jr,Ys)}),ei,Xi=_(()=>{"use strict";ei=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let i=t[r];this.setResource(i,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function Kd(){return(!ua||ua?.isContextLost())&&(ua=Nt.get().createCanvas().getContext("webgl",{})),ua}var ua,Zd=_(()=>{tr()});function gx(t){let e="";for(let r=0;r0&&(e+=` +else `),r{"use strict";Qd=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +`)});function xn(){if(Yi)return Yi;let t=Kd();return Yi=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Yi=mx(Yi,t),t.getExtension("WEBGL_lose_context")?.loseContext(),Yi}var Yi,bn=_(()=>{Zd(),_x(),Yi=null});function Fl(t,e){let r=2166136261;for(let i=0;i>>=0;return Dl[r]||vx(t,e,r)}function vx(t,e,r){let i={},n=0;ca||(ca=xn());for(let a=0;a{Xi(),Dt(),bn(),Dl={},ca=0}),qi,Jd=_(()=>{"use strict";qi=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function Ll(t,e){let r=t.byteLength/8|0,i=new Float64Array(t,0,r);new Float64Array(e,0,r).set(i);let n=t.byteLength-r*8;if(n>0){let s=new Uint8Array(t,r*8,n);new Uint8Array(e,r*8,n).set(s)}}var ef=_(()=>{"use strict"}),tf,$t,wn=_(()=>{"use strict";tf={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},$t=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))($t||{})});function Jn(t,e){return e.alphaMode==="no-premultiply-alpha"&&tf[t]||t}var da=_(()=>{wn()}),rf,yx=_(()=>{"use strict";rf=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t0?Nl[--fa]:new af}function sf(t){Nl[fa++]=t}var af,Nl,fa,Tn,Hl,of,xx=_(()=>{Wt(),Jd(),ef(),da(),bn(),yx(),af=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new rf,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Nl=[],fa=0,Tn=0,Hl=class jo{constructor(e={}){this.uid=Mt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],jo.defaultOptions.maxTextures=jo.defaultOptions.maxTextures??xn(),e={...jo.defaultOptions,...e};let{maxTextures:r,attributesInitialSize:i,indicesInitialSize:n}=e;this.attributeBuffer=new qi(i*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=r}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;ethis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,u=this.indexBuffer,c=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",y=this.maxTextures;for(let x=this.elementStart;x=y||G)&&(this._finishBatch(i,f,c-f,n,a,o,e,d),d="renderBatch",f=c,a=P,o=v.topology,i=nf(),n=i.textures,n.clear(),++Tn),v._textureId=w._textureBindLocation=n.count,n.ids[w.uid]=n.count,n.textures[n.count++]=w,v._batch=i,c+=v.indexSize,v.packAsQuad?(this.packQuadAttributes(v,l,h,v._attributeStart,v._textureId),this.packQuadIndex(u,v._indexStart,v._attributeStart/this.vertexSize)):(this.packAttributes(v,l,h,v._attributeStart,v._textureId),this.packIndex(v,u,v._indexStart,v._attributeStart/this.vertexSize))}n.count>0&&(this._finishBatch(i,f,c-f,n,a,o,e,d),f=c,++Tn),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=c}_finishBatch(e,r,i,n,s,a,o,l){e.gpuBindGroup=null,e.bindGroup=null,e.action=l,e.batcher=this,e.textures=n,e.blendMode=s,e.topology=a,e.start=r,e.size=i,++Tn,this.batches[this.batchIndex++]=e,o.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){let r=Math.max(e,this.attributeBuffer.size*2),i=new qi(r);Ll(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(e){let r=this.indexBuffer,i=Math.max(e,r.length*1.5);i+=i%2;let n=i>65535?new Uint32Array(i):new Uint16Array(i);if(n.BYTES_PER_ELEMENT!==r.BYTES_PER_ELEMENT)for(let s=0;s{"use strict";dt=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(dt||{})}),yr,Ki=_(()=>{It(),Wt(),Mi(),yr=class extends at{constructor(t){let{data:e,size:r}=t,{usage:i,label:n,shrinkToFit:s}=t;super(),this.uid=Mt("buffer"),this._resourceType="buffer",this._resourceId=Mt("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:i,mappedAtCreation:a,label:n},this.shrinkToFit=s??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&dt.STATIC)}set static(t){t?this.descriptor.usage|=dt.STATIC:this.descriptor.usage&=~dt.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let i=this._data;if(this._data=t,this._dataInt32=null,!i||i.length!==t.length){!this.shrinkToFit&&i&&t.byteLength{Ki(),Mi()});function wx(t,e,r){let i=t.getAttribute(e);if(!i)return r.minX=0,r.minY=0,r.maxX=0,r.maxY=0,r;let n=i.buffer.data,s=1/0,a=1/0,o=-1/0,l=-1/0,h=n.BYTES_PER_ELEMENT,u=(i.offset||0)/h,c=(i.stride||2*4)/h;for(let f=u;fo&&(o=d),y>l&&(l=y),d{"use strict"});function Sx(t){return(t instanceof yr||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=lf(t.buffer,!1),t}var Sn,es=_(()=>{It(),T(),Wt(),Ki(),bx(),Tx(),Sn=class extends at{constructor(t={}){super(),this.uid=Mt("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new m,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:i}=t;if(this.buffers=[],this.attributes={},e)for(let n in e)this.addAttribute(n,e[n]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=i||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=Sx(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=lf(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,wx(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}}),hf,uf,cf,Ex=_(()=>{Ki(),Mi(),es(),hf=new Float32Array(1),uf=new Uint32Array(1),cf=class extends Sn{constructor(){let t=new yr({data:hf,label:"attribute-batch-buffer",usage:dt.VERTEX|dt.COPY_DST,shrinkToFit:!1}),e=new yr({data:uf,label:"index-batch-buffer",usage:dt.INDEX|dt.COPY_DST,shrinkToFit:!1}),r=6*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:r,offset:0},aUV:{buffer:t,format:"float32x2",stride:r,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:r,offset:4*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:r,offset:5*4}},indexBuffer:e})}}});function ts(t,e){let r=zl[t];return r===void 0&&(pa[e]===void 0&&(pa[e]=1),zl[t]=r=pa[e]++),r}var pa,zl,ga=_(()=>{"use strict";pa=Object.create(null),zl=Object.create(null)});function Cx(){if(!ma){ma="mediump";let t=Kd();t&&t.getShaderPrecisionFormat&&(ma=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return ma}var ma,Ax=_(()=>{Zd()});function Px(t,e,r){return e?t:r?(t=t.replace("out vec4 finalColor;",""),` + + #ifdef GL_ES // This checks if it is WebGL1 + #define in varying + #define finalColor gl_FragColor + #define texture texture2D + #endif + ${t} + `):` + + #ifdef GL_ES // This checks if it is WebGL1 + #define in attribute + #define out varying + #endif + ${t} + `}var Mx=_(()=>{"use strict"});function Rx(t,e,r){let i=r?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(t.substring(0,9)!=="precision"){let n=r?e.requestedFragmentPrecision:e.requestedVertexPrecision;return n==="highp"&&i!=="highp"&&(n="mediump"),`precision ${n} float; +${t}`}else if(i!=="highp"&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}var kx=_(()=>{"use strict"});function Bx(t,e){return e?`#version 300 es +${t}`:t}var Ix=_(()=>{"use strict"});function Ox(t,{name:e="pixi-program"},r=!0){e=e.replace(/\s+/g,"-"),e+=r?"-fragment":"-vertex";let i=r?df:ff;return i[e]?(i[e]++,e+=`-${i[e]}`):i[e]=1,t.indexOf("#define SHADER_NAME")!==-1?t:`${`#define SHADER_NAME ${e}`} +${t}`}var df,ff,Gx=_(()=>{"use strict";df={},ff={}});function Fx(t,e){return e?t.replace("#version 300 es",""):t}var Dx=_(()=>{"use strict"}),_a,va,jl,Zi,En=_(()=>{ga(),Ax(),Mx(),kx(),Ix(),Gx(),Dx(),_a={stripVersion:Fx,ensurePrecision:Rx,addProgramDefines:Px,setProgramName:Ox,insertVersion:Bx},va=Object.create(null),jl=class zc{constructor(e){e={...zc.defaultOptions,...e};let r=e.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:r,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Cx()},setProgramName:{name:e.name},addProgramDefines:r,insertVersion:r},n=e.fragment,s=e.vertex;Object.keys(_a).forEach(a=>{let o=i[a];n=_a[a](n,o,!0),s=_a[a](s,o,!1)}),this.fragment=n,this.vertex=s,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=ts(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(e){let r=`${e.vertex}:${e.fragment}`;return va[r]||(va[r]=new zc(e)),va[r]}},jl.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"},Zi=jl});function Ri(t){return Vl[t]??Vl.float32}var Vl,Cn=_(()=>{"use strict";Vl={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function Ux({source:t,entryPoint:e}){let r={},i=t.indexOf(`fn ${e}`);if(i!==-1){let n=t.indexOf("->",i);if(n!==-1){let s=t.substring(i,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,o;for(;(o=a.exec(s))!==null;){let l=pf[o[3]]??"float32";r[o[2]]={location:parseInt(o[1],10),format:l,stride:Ri(l).stride,offset:0,instance:!1,start:0}}}}return r}var pf,Lx=_(()=>{Cn(),pf={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"}});function Wl(t){let e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,r=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,s=/:\s*(\w+)/,a=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=t.match(e)?.map(c=>({group:parseInt(c.match(r)[1],10),binding:parseInt(c.match(i)[1],10),name:c.match(n)[2],isUniform:c.match(n)[1]==="",type:c.match(s)[1]}));if(!h)return{groups:[],structs:[]};let u=t.match(a)?.map(c=>{let f=c.match(l)[1],d=c.match(o).reduce((y,x)=>{let[v,w]=x.split(":");return y[v.trim()]=w.trim(),y},{});return d?{name:f,members:d}:null}).filter(({name:c})=>h.some(f=>f.type===c))??[];return{groups:h,structs:u}}var Nx=_(()=>{"use strict"}),An,Hx=_(()=>{"use strict";An=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(An||{})});function zx({groups:t}){let e=[];for(let r=0;r{Hx()});function Vx({groups:t}){let e=[];for(let r=0;r{"use strict"});function $x(t,e){let r=new Set,i=new Set,n=[...t.structs,...e.structs].filter(a=>r.has(a.name)?!1:(r.add(a.name),!0)),s=[...t.groups,...e.groups].filter(a=>{let o=`${a.name}-${a.binding}`;return i.has(o)?!1:(i.add(o),!0)});return{structs:n,groups:s}}var Xx=_(()=>{"use strict"}),ya,Pn,rs=_(()=>{ga(),Lx(),Nx(),jx(),Wx(),Xx(),ya=Object.create(null),Pn=class ey{constructor(e){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:r,vertex:i,layout:n,gpuLayout:s,name:a}=e;if(this.name=a,this.fragment=r,this.vertex=i,r.source===i.source){let o=Wl(r.source);this.structsAndGroups=o}else{let o=Wl(i.source),l=Wl(r.source);this.structsAndGroups=$x(o,l)}this.layout=n??Vx(this.structsAndGroups),this.gpuLayout=s??zx(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:e,fragment:r}=this,i=e.source+r.source+e.entryPoint+r.entryPoint;this._layoutKey=ts(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Ux(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(e){let r=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return ya[r]||(ya[r]=new ey(e)),ya[r]}}});function gf(t,e,r){if(t)for(let i in t){let n=i.toLocaleLowerCase(),s=e[n];if(s){let a=t[i];i==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),r&&s.push(`//----${r}----//`),s.push(a)}else Be(`${i} placement hook does not exist in shader`)}}var Yx=_(()=>{Se()});function mf(t){let e={};return(t.match(_f)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{e[r]=[]}),e}var _f,qx=_(()=>{"use strict";_f=/\{\{(.*?)\}\}/g});function vf(t,e){let r,i=/@in\s+([^;]+);/g;for(;(r=i.exec(t))!==null;)e.push(r[1])}function yf(t,e,r=!1){let i=[];vf(e,i),t.forEach(o=>{o.header&&vf(o.header,i)});let n=i;r&&n.sort();let s=n.map((o,l)=>` @location(${l}) ${o},`).join(` +`),a=e.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",` +${s} +`),a}var Kx=_(()=>{"use strict"});function xf(t,e){let r,i=/@out\s+([^;]+);/g;for(;(r=i.exec(t))!==null;)e.push(r[1])}function Zx(t){let e=/\b(\w+)\s*:/g.exec(t);return e?e[1]:""}function Qx(t){let e=/@.*?\s+/g;return t.replace(e,"")}function Jx(t,e){let r=[];xf(e,r),t.forEach(l=>{l.header&&xf(l.header,r)});let i=0,n=r.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`, +`),s=r.sort().map(l=>` var ${Qx(l)};`).join(` +`),a=`return VSOutput( + ${r.sort().map(l=>` ${Zx(l)}`).join(`, +`)});`,o=e.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",` +${n} +`),o=o.replace("{{start}}",` +${s} +`),o=o.replace("{{return}}",` +${a} +`),o}var eb=_(()=>{"use strict"});function bf(t,e){let r=t;for(let i in e){let n=e[i];n.join(` +`).length?r=r.replace(`{{${i}}}`,`//-----${i} START-----// +${n.join(` +`)} +//----${i} FINISH----//`):r=r.replace(`{{${i}}}`,"")}return r}var tb=_(()=>{"use strict"});function rb({template:t,bits:e}){let r=wf(t,e);if(ki[r])return ki[r];let{vertex:i,fragment:n}=nb(t,e);return ki[r]=Tf(i,n,e),ki[r]}function ib({template:t,bits:e}){let r=wf(t,e);return ki[r]||(ki[r]=Tf(t.vertex,t.fragment,e)),ki[r]}function nb(t,e){let r=e.map(a=>a.vertex).filter(a=>!!a),i=e.map(a=>a.fragment).filter(a=>!!a),n=yf(r,t.vertex,!0);n=Jx(r,n);let s=yf(i,t.fragment,!0);return{vertex:n,fragment:s}}function wf(t,e){return e.map(r=>(xa.has(r)||xa.set(r,Sf++),xa.get(r))).sort((r,i)=>r-i).join("-")+t.vertex+t.fragment}function Tf(t,e,r){let i=mf(t),n=mf(e);return r.forEach(s=>{gf(s.vertex,i,s.name),gf(s.fragment,n,s.name)}),{vertex:bf(t,i),fragment:bf(e,n)}}var ki,xa,Sf,sb=_(()=>{Yx(),qx(),Kx(),eb(),tb(),ki=Object.create(null),xa=new Map,Sf=0}),Ef,Cf,Af,Pf,ab=_(()=>{"use strict";Ef=` + @in aPosition: vec2; + @in aUV: vec2; + + @out @builtin(position) vPosition: vec4; + @out vUV : vec2; + @out vColor : vec4; + + {{header}} + + struct VSOutput { + {{struct}} + }; + + @vertex + fn main( {{in}} ) -> VSOutput { + + var worldTransformMatrix = globalUniforms.uWorldTransformMatrix; + var modelMatrix = mat3x3( + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0 + ); + var position = aPosition; + var uv = aUV; + + {{start}} + + vColor = vec4(1., 1., 1., 1.); + + {{main}} + + vUV = uv; + + var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix; + + vPosition = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + + vColor *= globalUniforms.uWorldColorAlpha; + + {{end}} + + {{return}} + }; +`,Cf=` + @in vUV : vec2; + @in vColor : vec4; + + {{header}} + + @fragment + fn main( + {{in}} + ) -> @location(0) vec4 { + + {{start}} + + var outColor:vec4; + + {{main}} + + var finalColor:vec4 = outColor * vColor; + + {{end}} + + return finalColor; + }; +`,Af=` + in vec2 aPosition; + in vec2 aUV; + + out vec4 vColor; + out vec2 vUV; + + {{header}} + + void main(void){ + + mat3 worldTransformMatrix = uWorldTransformMatrix; + mat3 modelMatrix = mat3( + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0 + ); + vec2 position = aPosition; + vec2 uv = aUV; + + {{start}} + + vColor = vec4(1.); + + {{main}} + + vUV = uv; + + mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix; + + gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + + vColor *= uWorldColorAlpha; + + {{end}} + } +`,Pf=` + + in vec4 vColor; + in vec2 vUV; + + out vec4 finalColor; + + {{header}} + + void main(void) { + + {{start}} + + vec4 outColor; + + {{main}} + + finalColor = outColor * vColor; + + {{end}} + } +`}),Mf,Rf,ob=_(()=>{"use strict";Mf={name:"global-uniforms-bit",vertex:{header:` + struct GlobalUniforms { + uProjectionMatrix:mat3x3, + uWorldTransformMatrix:mat3x3, + uWorldColorAlpha: vec4, + uResolution: vec2, + } + + @group(0) @binding(0) var globalUniforms : GlobalUniforms; + `}},Rf={name:"global-uniforms-bit",vertex:{header:` + uniform mat3 uProjectionMatrix; + uniform mat3 uWorldTransformMatrix; + uniform vec4 uWorldColorAlpha; + uniform vec2 uResolution; + `}}});function is({bits:t,name:e}){let r=rb({template:{fragment:Cf,vertex:Ef},bits:[Mf,...t]});return Pn.from({name:e,vertex:{source:r.vertex,entryPoint:"main"},fragment:{source:r.fragment,entryPoint:"main"}})}function ns({bits:t,name:e}){return new Zi({name:e,...ib({template:{vertex:Af,fragment:Pf},bits:[Rf,...t]})})}var Qi=_(()=>{En(),rs(),sb(),ab(),ob()}),ba,wa,Ta=_(()=>{"use strict";ba={name:"color-bit",vertex:{header:` + @in aColor: vec4; + `,main:` + vColor *= vec4(aColor.rgb * aColor.a, aColor.a); + `}},wa={name:"color-bit",vertex:{header:` + in vec4 aColor; + `,main:` + vColor *= vec4(aColor.rgb * aColor.a, aColor.a); + `}}});function lb(t){let e=[];if(t===1)e.push("@group(1) @binding(0) var textureSource1: texture_2d;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let r=0;for(let i=0;i;`),e.push(`@group(1) @binding(${r++}) var textureSampler${i+1}: sampler;`)}return e.join(` +`)}function hb(t){let e=[];if(t===1)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let r=0;r; + @out @interpolate(flat) vTextureId : u32; + `,main:` + vTextureId = aTextureIdAndRound.y; + `,end:` + if(aTextureIdAndRound.x == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `},fragment:{header:` + @in @interpolate(flat) vTextureId: u32; + + ${lb(t)} + `,main:` + var uvDx = dpdx(vUV); + var uvDy = dpdy(vUV); + + ${hb(t)} + `}}),Sa[t]}function ub(t){let e=[];for(let r=0;r0&&e.push("else"),r{"use strict";Sa={},Ea={}}),Mn,Rn,Ji=_(()=>{"use strict";Mn={name:"round-pixels-bit",vertex:{header:` + fn roundPixels(position: vec2, targetSize: vec2) -> vec2 + { + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; + } + `}},Rn={name:"round-pixels-bit",vertex:{header:` + vec2 roundPixels(vec2 position, vec2 targetSize) + { + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; + } + `}}}),Yl,kf,cb=_(()=>{"use strict";Yl=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4","vec2","vec3","vec4"],kf=Yl.reduce((t,e)=>(t[e]=!0,t),{})});function db(t,e){switch(t){case"f32":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var fb=_(()=>{"use strict"}),ql,ur,xr=_(()=>{Wt(),ga(),cb(),fb(),ql=class ty{constructor(e,r){this._touched=0,this.uid=Mt("uniform"),this._resourceType="uniformGroup",this._resourceId=Mt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,r={...ty.defaultOptions,...r},this.uniformStructures=e;let i={};for(let n in e){let s=e[n];if(s.name=n,s.size=s.size??1,!kf[s.type])throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${Yl.join(", ")}`);s.value??(s.value=db(s.type,s.size)),i[n]=s.value}this.uniforms=i,this._dirtyId=1,this.ubo=r.ubo,this.isStatic=r.isStatic,this._signature=ts(Object.keys(i).map(n=>`${n}-${e[n].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}},ql.defaultOptions={ubo:!1,isStatic:!1},ur=ql});function Kl(t){let e=Zl[t];if(e)return e;let r=new Int32Array(t);for(let i=0;i{xr(),Zl={}}),Gr,gi=_(()=>{"use strict";Gr=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.BOTH=3]="BOTH",t))(Gr||{})}),jr,ti=_(()=>{It(),Wt(),En(),Xi(),rs(),gi(),xr(),jr=class ry extends at{constructor(e){super(),this.uid=Mt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:r,glProgram:i,groups:n,resources:s,compatibleRenderers:a,groupMap:o}=e;this.gpuProgram=r,this.glProgram=i,a===void 0&&(a=0,r&&(a|=Gr.WEBGPU),i&&(a|=Gr.WEBGL)),this.compatibleRenderers=a;let l={};if(!s&&!n&&(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!r&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!r&&n&&o)for(let h in o)for(let u in o[h]){let c=o[h][u];l[c]={group:h,binding:u,name:c}}else if(r&&n&&!o){let h=r.structsAndGroups.groups;o={},h.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u})}else if(s){n={},o={},r&&r.structsAndGroups.groups.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let u in s)l[u]||(n[99]||(n[99]=new ei,this._ownedBindGroups.push(n[99])),l[u]={group:99,binding:h,name:u},o[99]=o[99]||{},o[99][h]=u,h++);for(let u in s){let c=u,f=s[u];!f.source&&!f._resourceType&&(f=new ur(f));let d=l[c];d&&(n[d.group]||(n[d.group]=new ei,this._ownedBindGroups.push(n[d.group])),n[d.group].setResource(f,d.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,l)}addResource(e,r,i){var n,s;(n=this._uniformBindMap)[r]||(n[r]={}),(s=this._uniformBindMap[r])[i]||(s[i]=e),this.groups[r]||(this.groups[r]=new ei,this._ownedBindGroups.push(this.groups[r]))}_buildResourceAccessor(e,r){let i={};for(let n in r){let s=r[n];Object.defineProperty(i,s.name,{get(){return e[s.group].getResource(s.binding)},set(a){e[s.group].setResource(a,s.binding)}})}return i}destroy(e=!1){this.emit("destroy",this),e&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(e){let{gpu:r,gl:i,...n}=e,s,a;return r&&(s=Pn.from(r)),i&&(a=Zi.from(i)),new ry({gpuProgram:s,glProgram:a,...n})}}}),Bf,pb=_(()=>{Qi(),Ta(),Ca(),Ji(),Ql(),ti(),Bf=class extends jr{constructor(t){let e=ns({name:"batch",bits:[wa,Xl(t),Rn]}),r=is({name:"batch",bits:[ba,$l(t),Mn]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:Kl(t)}})}}}),Jl,eh,Aa,If=_(()=>{J(),xx(),Ex(),pb(),Jl=null,eh=class iy extends of{constructor(){super(...arguments),this.geometry=new cf,this.shader=Jl||(Jl=new Bf(this.maxTextures)),this.name=iy.extension.name,this.vertexSize=6}packAttributes(e,r,i,n,s){let a=s<<16|e.roundPixels&65535,o=e.transform,l=o.a,h=o.b,u=o.c,c=o.d,f=o.tx,d=o.ty,{positions:y,uvs:x}=e,v=e.color,w=e.attributeOffset,P=w+e.attributeSize;for(let G=w;G{"use strict"});function Of(t,e,r,i,n){let s=e.a,a=e.b,o=e.c,l=e.d,h=e.tx,u=e.ty;r||(r=0),i||(i=2),n||(n=t.length/i-r);let c=r*i;for(let f=0;f{"use strict"}),Gf,Pa,Ff=_(()=>{Ze(),re(),Gf=new me,Pa=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?j(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||Gf}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}}),kn,Df,Uf,yb=_(()=>{J(),kn={extension:{type:O.ShapeBuilder,name:"circle"},build(t,e){let r,i,n,s,a,o;if(t.type==="circle"){let k=t;r=k.x,i=k.y,a=o=k.radius,n=s=0}else if(t.type==="ellipse"){let k=t;r=k.x,i=k.y,a=k.halfWidth,o=k.halfHeight,n=s=0}else{let k=t,L=k.width/2,N=k.height/2;r=k.x+L,i=k.y+N,a=o=Math.max(0,Math.min(k.radius,Math.min(L,N))),n=L-a,s=N-o}if(!(a>=0&&o>=0&&n>=0&&s>=0))return e;let l=Math.ceil(2.3*Math.sqrt(a+o)),h=l*8+(n?4:0)+(s?4:0);if(h===0)return e;if(l===0)return e[0]=e[6]=r+n,e[1]=e[3]=i+s,e[2]=e[4]=r-n,e[5]=e[7]=i-s,e;let u=0,c=l*4+(n?2:0)+2,f=c,d=h,y=n+a,x=s,v=r+y,w=r-y,P=i+x;if(e[u++]=v,e[u++]=P,e[--c]=P,e[--c]=w,s){let k=i-x;e[f++]=w,e[f++]=k,e[--d]=k,e[--d]=v}for(let k=1;k0&&(n[s++]=l,n[s++]=h,n[s++]=l-1),l++;n[s++]=h+1,n[s++]=h,n[s++]=l-1}},Df={...kn,extension:{...kn.extension,name:"ellipse"}},Uf={...kn,extension:{...kn.extension,name:"roundedRectangle"}}});function xb(t){let e=t.length;if(e<6)return 1;let r=0;for(let i=0,n=t[e-2],s=t[e-1];i{"use strict"});function Lf(t,e,r,i,n,s,a,o){let l=t-r*n,h=e-i*n,u=t+r*s,c=e+i*s,f,d;a?(f=i,d=-r):(f=-i,d=r);let y=l+f,x=h+d,v=u+f,w=c+d;return o.push(y,x),o.push(v,w),2}function en(t,e,r,i,n,s,a,o){let l=r-t,h=i-e,u=Math.atan2(l,h),c=Math.atan2(n-t,s-e);o&&uc&&(c+=Math.PI*2);let f=u,d=c-u,y=Math.abs(d),x=Math.sqrt(l*l+h*h),v=(15*y*Math.sqrt(x)/Math.PI>>0)+1,w=d/v;if(f+=w,o){a.push(t,e),a.push(r,i);for(let P=1,G=f;P=0&&(o.join==="round"?x+=en(N,H,N-ae*X,H-le*X,N-ke*X,H-We*X,d,!1)+4:x+=2,d.push(N-ke*se,H-We*se),d.push(N+ke*X,H+We*X));continue}let Ee=(-ae+k)*(-le+H)-(-ae+N)*(-le+L),nt=(-ke+fe)*(-We+H)-(-ke+N)*(-We+ue),Ye=(R*nt-K*Ee)/de,tt=(ee*Ee-Y*nt)/de,Vt=(Ye-N)*(Ye-N)+(tt-H)*(tt-H),st=N+(Ye-N)*X,cr=H+(tt-H)*X,lr=N-(Ye-N)*se,Ar=H-(tt-H)*se,on=Math.min(R*R+Y*Y,K*K+ee*ee),$=Pe?X:se,ne=on+$*$*P;Vt<=ne?o.join==="bevel"||Vt/P>G?(Pe?(d.push(st,cr),d.push(N+ae*se,H+le*se),d.push(st,cr),d.push(N+ke*se,H+We*se)):(d.push(N-ae*X,H-le*X),d.push(lr,Ar),d.push(N-ke*X,H-We*X),d.push(lr,Ar)),x+=2):o.join==="round"?Pe?(d.push(st,cr),d.push(N+ae*se,H+le*se),x+=en(N,H,N+ae*se,H+le*se,N+ke*se,H+We*se,d,!0)+4,d.push(st,cr),d.push(N+ke*se,H+We*se)):(d.push(N-ae*X,H-le*X),d.push(lr,Ar),x+=en(N,H,N-ae*X,H-le*X,N-ke*X,H-We*X,d,!1)+4,d.push(N-ke*X,H-We*X),d.push(lr,Ar)):(d.push(st,cr),d.push(lr,Ar)):(d.push(N-ae*X,H-le*X),d.push(N+ae*se,H+le*se),o.join==="round"?Pe?x+=en(N,H,N+ae*se,H+le*se,N+ke*se,H+We*se,d,!0)+2:x+=en(N,H,N-ae*X,H-le*X,N-ke*X,H-We*X,d,!1)+2:o.join==="miter"&&Vt/P<=G&&(Pe?(d.push(lr,Ar),d.push(lr,Ar)):(d.push(st,cr),d.push(st,cr)),x+=2),d.push(N-ke*X,H-We*X),d.push(N+ke*se,H+We*se),x+=2)}k=t[(y-2)*2],L=t[(y-2)*2+1],N=t[(y-1)*2],H=t[(y-1)*2+1],ae=-(L-H),le=k-N,U=Math.sqrt(ae*ae+le*le),ae/=U,le/=U,ae*=w,le*=w,d.push(N-ae*X,H-le*X),d.push(N+ae*se,H+le*se),c||(o.cap==="round"?x+=en(N-ae*(X-se)*.5,H-le*(X-se)*.5,N-ae*X,H-le*X,N+ae*se,H+le*se,d,!1)+2:o.cap==="square"&&(x+=Lf(N,H,ae,le,X,se,!1,d)));let A=1e-4*1e-4;for(let B=v;B{He(),bb()});function Sb(t,e,r,i){let n=1e-4;if(t.length===0)return;let s=t[0],a=t[1],o=t[t.length-2],l=t[t.length-1],h=e||Math.abs(s-o){}),Nf=nr((t,e)=>{"use strict";e.exports=r,e.exports.default=r;function r(A,B,R){R=R||2;var Y=B&&B.length,K=Y?B[0]*R:A.length,ee=i(A,0,K,R,!0),te=[];if(!ee||ee.next===ee.prev)return te;var de,Pe,Ee,nt,Ye,tt,Vt;if(Y&&(ee=u(A,B,ee,R)),A.length>80*R){de=Ee=A[0],Pe=nt=A[1];for(var st=R;stEe&&(Ee=Ye),tt>nt&&(nt=tt);Vt=Math.max(Ee-de,nt-Pe),Vt=Vt!==0?32767/Vt:0}return s(ee,te,R,de,Pe,Vt,0),te}function i(A,B,R,Y,K){var ee,te;if(K===se(A,B,R,Y)>0)for(ee=B;ee=B;ee-=Y)te=U(ee,A[ee],A[ee+1],te);return te&&N(te,te.next)&&(we(te),te=te.next),te}function n(A,B){if(!A)return A;B||(B=A);var R=A,Y;do if(Y=!1,!R.steiner&&(N(R,R.next)||L(R.prev,R,R.next)===0)){if(we(R),R=B=R.prev,R===R.next)break;Y=!0}else R=R.next;while(Y||R!==B);return B}function s(A,B,R,Y,K,ee,te){if(A){!te&&ee&&x(A,Y,K,ee);for(var de=A,Pe,Ee;A.prev!==A.next;){if(Pe=A.prev,Ee=A.next,ee?o(A,Y,K,ee):a(A)){B.push(Pe.i/R|0),B.push(A.i/R|0),B.push(Ee.i/R|0),we(A),A=Ee.next,de=Ee.next;continue}if(A=Ee,A===de){te?te===1?(A=l(n(A),B,R),s(A,B,R,Y,K,ee,2)):te===2&&h(A,B,R,Y,K,ee):s(n(A),B,R,Y,K,ee,1);break}}}}function a(A){var B=A.prev,R=A,Y=A.next;if(L(B,R,Y)>=0)return!1;for(var K=B.x,ee=R.x,te=Y.x,de=B.y,Pe=R.y,Ee=Y.y,nt=Kee?K>te?K:te:ee>te?ee:te,Vt=de>Pe?de>Ee?de:Ee:Pe>Ee?Pe:Ee,st=Y.next;st!==B;){if(st.x>=nt&&st.x<=tt&&st.y>=Ye&&st.y<=Vt&&G(K,de,ee,Pe,te,Ee,st.x,st.y)&&L(st.prev,st,st.next)>=0)return!1;st=st.next}return!0}function o(A,B,R,Y){var K=A.prev,ee=A,te=A.next;if(L(K,ee,te)>=0)return!1;for(var de=K.x,Pe=ee.x,Ee=te.x,nt=K.y,Ye=ee.y,tt=te.y,Vt=dePe?de>Ee?de:Ee:Pe>Ee?Pe:Ee,lr=nt>Ye?nt>tt?nt:tt:Ye>tt?Ye:tt,Ar=w(Vt,st,B,R,Y),on=w(cr,lr,B,R,Y),$=A.prevZ,ne=A.nextZ;$&&$.z>=Ar&&ne&&ne.z<=on;){if($.x>=Vt&&$.x<=cr&&$.y>=st&&$.y<=lr&&$!==K&&$!==te&&G(de,nt,Pe,Ye,Ee,tt,$.x,$.y)&&L($.prev,$,$.next)>=0||($=$.prevZ,ne.x>=Vt&&ne.x<=cr&&ne.y>=st&&ne.y<=lr&&ne!==K&&ne!==te&&G(de,nt,Pe,Ye,Ee,tt,ne.x,ne.y)&&L(ne.prev,ne,ne.next)>=0))return!1;ne=ne.nextZ}for(;$&&$.z>=Ar;){if($.x>=Vt&&$.x<=cr&&$.y>=st&&$.y<=lr&&$!==K&&$!==te&&G(de,nt,Pe,Ye,Ee,tt,$.x,$.y)&&L($.prev,$,$.next)>=0)return!1;$=$.prevZ}for(;ne&&ne.z<=on;){if(ne.x>=Vt&&ne.x<=cr&&ne.y>=st&&ne.y<=lr&&ne!==K&&ne!==te&&G(de,nt,Pe,Ye,Ee,tt,ne.x,ne.y)&&L(ne.prev,ne,ne.next)>=0)return!1;ne=ne.nextZ}return!0}function l(A,B,R){var Y=A;do{var K=Y.prev,ee=Y.next.next;!N(K,ee)&&H(K,Y,Y.next,ee)&&le(K,ee)&&le(ee,K)&&(B.push(K.i/R|0),B.push(Y.i/R|0),B.push(ee.i/R|0),we(Y),we(Y.next),Y=A=ee),Y=Y.next}while(Y!==A);return n(Y)}function h(A,B,R,Y,K,ee){var te=A;do{for(var de=te.next.next;de!==te.prev;){if(te.i!==de.i&&k(te,de)){var Pe=We(te,de);te=n(te,te.next),Pe=n(Pe,Pe.next),s(te,B,R,Y,K,ee,0),s(Pe,B,R,Y,K,ee,0);return}de=de.next}te=te.next}while(te!==A)}function u(A,B,R,Y){var K=[],ee,te,de,Pe,Ee;for(ee=0,te=B.length;ee=R.next.y&&R.next.y!==R.y){var de=R.x+(K-R.y)*(R.next.x-R.x)/(R.next.y-R.y);if(de<=Y&&de>ee&&(ee=de,te=R.x=R.x&&R.x>=Ee&&Y!==R.x&&G(Kte.x||R.x===te.x&&y(te,R)))&&(te=R,Ye=tt)),R=R.next;while(R!==Pe);return te}function y(A,B){return L(A.prev,A,B.prev)<0&&L(B.next,A,A.next)<0}function x(A,B,R,Y){var K=A;do K.z===0&&(K.z=w(K.x,K.y,B,R,Y)),K.prevZ=K.prev,K.nextZ=K.next,K=K.next;while(K!==A);K.prevZ.nextZ=null,K.prevZ=null,v(K)}function v(A){var B,R,Y,K,ee,te,de,Pe,Ee=1;do{for(R=A,A=null,ee=null,te=0;R;){for(te++,Y=R,de=0,B=0;B0||Pe>0&&Y;)de!==0&&(Pe===0||!Y||R.z<=Y.z)?(K=R,R=R.nextZ,de--):(K=Y,Y=Y.nextZ,Pe--),ee?ee.nextZ=K:A=K,K.prevZ=ee,ee=K;R=Y}ee.nextZ=null,Ee*=2}while(te>1);return A}function w(A,B,R,Y,K){return A=(A-R)*K|0,B=(B-Y)*K|0,A=(A|A<<8)&16711935,A=(A|A<<4)&252645135,A=(A|A<<2)&858993459,A=(A|A<<1)&1431655765,B=(B|B<<8)&16711935,B=(B|B<<4)&252645135,B=(B|B<<2)&858993459,B=(B|B<<1)&1431655765,A|B<<1}function P(A){var B=A,R=A;do(B.x=(A-te)*(ee-de)&&(A-te)*(Y-de)>=(R-te)*(B-de)&&(R-te)*(ee-de)>=(K-te)*(Y-de)}function k(A,B){return A.next.i!==B.i&&A.prev.i!==B.i&&!ae(A,B)&&(le(A,B)&&le(B,A)&&ke(A,B)&&(L(A.prev,A,B.prev)||L(A,B.prev,B))||N(A,B)&&L(A.prev,A,A.next)>0&&L(B.prev,B,B.next)>0)}function L(A,B,R){return(B.y-A.y)*(R.x-B.x)-(B.x-A.x)*(R.y-B.y)}function N(A,B){return A.x===B.x&&A.y===B.y}function H(A,B,R,Y){var K=ue(L(A,B,R)),ee=ue(L(A,B,Y)),te=ue(L(R,Y,A)),de=ue(L(R,Y,B));return!!(K!==ee&&te!==de||K===0&&fe(A,R,B)||ee===0&&fe(A,Y,B)||te===0&&fe(R,A,Y)||de===0&&fe(R,B,Y))}function fe(A,B,R){return B.x<=Math.max(A.x,R.x)&&B.x>=Math.min(A.x,R.x)&&B.y<=Math.max(A.y,R.y)&&B.y>=Math.min(A.y,R.y)}function ue(A){return A>0?1:A<0?-1:0}function ae(A,B){var R=A;do{if(R.i!==A.i&&R.next.i!==A.i&&R.i!==B.i&&R.next.i!==B.i&&H(R,R.next,A,B))return!0;R=R.next}while(R!==A);return!1}function le(A,B){return L(A.prev,A,A.next)<0?L(A,B,A.next)>=0&&L(A,A.prev,B)>=0:L(A,B,A.prev)<0||L(A,A.next,B)<0}function ke(A,B){var R=A,Y=!1,K=(A.x+B.x)/2,ee=(A.y+B.y)/2;do R.y>ee!=R.next.y>ee&&R.next.y!==R.y&&K<(R.next.x-R.x)*(ee-R.y)/(R.next.y-R.y)+R.x&&(Y=!Y),R=R.next;while(R!==A);return Y}function We(A,B){var R=new X(A.i,A.x,A.y),Y=new X(B.i,B.x,B.y),K=A.next,ee=B.prev;return A.next=B,B.prev=A,R.next=K,K.prev=R,Y.next=R,R.prev=Y,ee.next=Y,Y.prev=ee,Y}function U(A,B,R,Y){var K=new X(A,B,R);return Y?(K.next=Y.next,K.prev=Y,Y.next.prev=K,Y.next=K):(K.prev=K,K.next=K),K}function we(A){A.next.prev=A.prev,A.prev.next=A.next,A.prevZ&&(A.prevZ.nextZ=A.nextZ),A.nextZ&&(A.nextZ.prevZ=A.prevZ)}function X(A,B,R){this.i=A,this.x=B,this.y=R,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(A,B,R,Y){var K=B&&B.length,ee=K?B[0]*R:A.length,te=Math.abs(se(A,0,ee,R));if(K)for(var de=0,Pe=B.length;de0&&(Y+=A[K-1].length,R.holes.push(Y))}return R}});function Hf(t,e,r,i,n,s,a){let o=(0,zf.default)(t,e,2);if(!o)return;for(let h=0;h{zf=Qt(Nf(),1)}),Vf,Wf,Cb=_(()=>{J(),jf(),Vf=[],Wf={extension:{type:O.ShapeBuilder,name:"polygon"},build(t,e){for(let r=0;r{J(),$f={extension:{type:O.ShapeBuilder,name:"rectangle"},build(t,e){let r=t,i=r.x,n=r.y,s=r.width,a=r.height;return s>=0&&a>=0&&(e[0]=i,e[1]=n,e[2]=i+s,e[3]=n,e[4]=i+s,e[5]=n+a,e[6]=i,e[7]=n+a),e},triangulate(t,e,r,i,n,s){let a=0;i*=r,e[i+a]=t[0],e[i+a+1]=t[1],a+=r,e[i+a]=t[2],e[i+a+1]=t[3],a+=r,e[i+a]=t[6],e[i+a+1]=t[7],a+=r,e[i+a]=t[4],e[i+a+1]=t[5],a+=r;let o=i/r;n[s++]=o,n[s++]=o+1,n[s++]=o+2,n[s++]=o+1,n[s++]=o+3,n[s++]=o+2}}}),Xf,Pb=_(()=>{J(),Xf={extension:{type:O.ShapeBuilder,name:"triangle"},build(t,e){return e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,e},triangulate(t,e,r,i,n,s){let a=0;i*=r,e[i+a]=t[0],e[i+a+1]=t[1],a+=r,e[i+a]=t[2],e[i+a+1]=t[3],a+=r,e[i+a]=t[4],e[i+a+1]=t[5];let o=i/r;n[s++]=o,n[s++]=o+1,n[s++]=o+2}}});function Yf(t,e){for(let r=0;r{De(),tr(),Ze(),Il(),Dt(),Wt(),kt(),Jc(),th=[{offset:0,color:"white"},{offset:1,color:"black"}],Ma=class jc{constructor(...e){this.uid=Mt("fillGradient"),this.type="linear",this.colorStops=[];let r=Mb(e);r={...r.type==="radial"?jc.defaultRadialOptions:jc.defaultLinearOptions,...Qc(r)},this._textureSize=r.textureSize,this._wrapMode=r.wrapMode,r.type==="radial"?(this.center=r.center,this.outerCenter=r.outerCenter??this.center,this.innerRadius=r.innerRadius,this.outerRadius=r.outerRadius,this.scale=r.scale,this.rotation=r.rotation):(this.start=r.start,this.end=r.end),this.textureSpace=r.textureSpace,this.type=r.type,r.colorStops.forEach(i=>{this.addColorStop(i.offset,i.color)})}addColorStop(e,r){return this.colorStops.push({offset:e,color:ce.shared.setValue(r).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:r}=this.start,{x:i,y:n}=this.end,s=i-e,a=n-r,o=s<0||a<0;if(this._wrapMode==="clamp-to-edge"){if(s<0){let v=e;e=i,i=v,s*=-1}if(a<0){let v=r;r=n,n=v,a*=-1}}let l=this.colorStops.length?this.colorStops:th,h=this._textureSize,{canvas:u,context:c}=qf(h,1),f=o?c.createLinearGradient(this._textureSize,0,0,0):c.createLinearGradient(0,0,this._textureSize,0);Yf(f,l),c.fillStyle=f,c.fillRect(0,0,h,1),this.texture=new Fe({source:new yn({resource:u,addressMode:this._wrapMode})});let d=Math.sqrt(s*s+a*a),y=Math.atan2(a,s),x=new me;x.scale(d/h,1),x.rotate(y),x.translate(e,r),this.textureSpace==="local"&&x.scale(h,h),this.transform=x}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:th,r=this._textureSize,{canvas:i,context:n}=qf(r,r),{x:s,y:a}=this.center,{x:o,y:l}=this.outerCenter,h=this.innerRadius,u=this.outerRadius,c=o-u,f=l-u,d=r/(u*2),y=(s-c)*d,x=(a-f)*d,v=n.createRadialGradient(y,x,h*d,(o-c)*d,(l-f)*d,u*d);Yf(v,e),n.fillStyle=e[e.length-1].color,n.fillRect(0,0,r,r),n.fillStyle=v,n.translate(y,x),n.rotate(this.rotation),n.scale(1,this.scale),n.translate(-y,-x),n.fillRect(0,0,r,r),this.texture=new Fe({source:new yn({resource:i,addressMode:this._wrapMode})});let w=new me;w.scale(1/d,1/d),w.translate(c,f),this.textureSpace==="local"&&w.scale(r,r),this.transform=w}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}},Ma.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"},Ma.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"},ri=Ma});function Rb(t,e,r,i){let n=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){let a=r.getBounds(Zf);e.width&&a.pad(e.width);let{x:o,y:l}=a,h=1/a.width,u=1/a.height,c=-o*h,f=-l*u,d=n.a,y=n.b,x=n.c,v=n.d;n.a*=h,n.b*=h,n.c*=u,n.d*=u,n.tx=c*d+f*x+n.tx,n.ty=c*y+f*v+n.ty}else n.translate(e.texture.frame.x,e.texture.frame.y),n.scale(1/e.texture.source.width,1/e.texture.source.height);let s=e.texture.source.style;return!(e.fill instanceof ri)&&s.addressMode==="clamp-to-edge"&&(s.addressMode="repeat",s.update()),i&&n.append(Kf.copyFrom(i).invert()),n}var Kf,Zf,kb=_(()=>{Ze(),S(),ss(),Kf=new me,Zf=new b});function Bb(t,e){let{geometryData:r,batches:i}=e;i.length=0,r.indices.length=0,r.vertices.length=0,r.uvs.length=0;for(let n=0;n{let c=o.length,f=s.length/2,d=[],y=as[l.type],x="triangle-list";if(y.build(l,d),h&&Of(d,h),r){let G=l.closePath??!0,k=e;k.pixelLine?(Sb(d,G,s,o),x="line-list"):wb(d,k,!1,G,s,o)}else if(u){let G=[],k=d.slice();Ob(u).forEach(L=>{G.push(k.length/2),k.push(...L)}),Hf(k,G,s,2,f,o,c)}else y.triangulate(d,s,2,f,o,c);let v=a.length/2,w=e.texture;if(w!==Fe.WHITE){let G=Rb(ep,e,l,h);gb(s,2,f,a,v,2,s.length/2-f,G)}else mb(a,v,2,s.length/2-f);let P=it.get(Pa);P.indexOffset=c,P.indexSize=o.length-c,P.attributeOffset=f,P.attributeSize=s.length/2-f,P.baseColor=e.color,P.alpha=e.alpha,P.texture=w,P.geometryData=n,P.topology=x,i.push(P)})}function Ob(t){let e=[];for(let r=0;r{J(),Ze(),S(),_b(),vb(),Dt(),Zt(),Ff(),yb(),Tb(),Eb(),Cb(),Ab(),Pb(),kb(),jf(),as={},xe.handleByMap(O.ShapeBuilder,as),xe.add($f,Wf,Xf,kn,Df,Uf),Jf=new b,ep=new me}),tp,rp,Ra,ka,rh=_(()=>{J(),Ul(),If(),Kc(),kt(),Zt(),Gb(),tp=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},rp=class{constructor(){this.batcher=new Aa,this.instructions=new Wo}init(){this.instructions.reset()}get geometry(){return Qe(Di,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},Ra=class Vc{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){Vc.defaultOptions.bezierSmoothness=e?.bezierSmoothness??Vc.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let r=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){r?this._cleanGraphicsContextData(e):r=this._initContext(e),Bb(e,r);let i=e.batchMode;e.customShader||i==="no-batch"?r.isBatchable=!1:i==="auto"&&(r.isBatchable=r.geometryData.vertices.length<400),e.dirty=!1}return r}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let r=it.get(rp),{batches:i,geometryData:n}=this._gpuContextHash[e.uid],s=n.vertices.length,a=n.indices.length;for(let u=0;u{it.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}},Ra.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"graphicsContext"},Ra.defaultOptions={bezierSmoothness:.5},ka=Ra}),ip,Ba,Ia,Oa,Ga,Fa,Da,Ua,Fr,ii=_(()=>{"use strict";ip={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Ba=0,Ia=1,Oa=2,Ga=3,Fa=4,Da=5,Ua=class ny{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<>24&255)/255;e[r++]=(t&255)/255*i,e[r++]=(t>>8&255)/255*i,e[r++]=(t>>16&255)/255*i,e[r++]=i}var ls=_(()=>{"use strict"}),ih,Fb=_(()=>{J(),ii(),Zt(),ls(),Ff(),ih=class{constructor(t,e){this.state=Fr.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(e);return!!(i.isBatchable||r!==i.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r{let a=it.get(Pa);return s.copyTo(a),a.renderable=t,a.roundPixels=i,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=n,n}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{it.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}},ih.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"graphics"}}),np=_(()=>{J(),rh(),Fb(),xe.add(ih),xe.add(ka)}),La,nh=_(()=>{"use strict";La=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let t=this.geometry.getBuffer("aUV"),e=t.data,r=e,i=this.texture.textureMatrix;return i.isSimple||(r=this._transformedUvs,(this._textureMatrixUpdateId!==i._updateID||this._uvUpdateId!==t._updateID)&&((!r||r.length{J(),Ze(),Xi(),xr(),da(),Zt(),ls(),nh(),sh=class{constructor(t,e){this.localUniforms=new ur({uTransformMatrix:{value:new me,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new ei({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,i=t.batched;if(e.batched=i,r!==i)return!0;if(i){let n=t._geometry;if(n.indices.length!==e.indexSize||n.positions.length!==e.vertexSize)return e.indexSize=n.indices.length,e.vertexSize=n.positions.length,!0;let s=this._getBatchableMesh(t);return s.texture.uid!==t._texture.uid&&(s._textureMatrixUpdateId=-1),!s._batcher.checkAndUpdateTexture(s,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:i}=this._getMeshData(t);if(i){let n=this._getBatchableMesh(t);n.setTexture(t._texture),n.geometry=t._geometry,r.addToBatch(n,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(it.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Jn(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),os(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=it.get(La);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&it.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}},sh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"mesh"}}),sp=_(()=>{J(),Db(),xe.add(sh)}),ap,Ub=_(()=>{"use strict";ap=class{execute(t,e){let r=t.state,i=t.renderer,n=e.shader||t.defaultShader;n.resources.uTexture=e.texture._source,n.resources.uniforms=t.localUniforms;let s=i.gl,a=t.getBuffers(e);i.shader.bind(n),i.state.set(r),i.geometry.bind(a.geometry,n.glProgram);let o=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;s.drawElements(s.TRIANGLES,e.particleChildren.length*6,o,0)}}});function op(t,e=null){let r=t*6;if(r>65535?e||(e=new Uint32Array(r)):e||(e=new Uint16Array(r)),e.length!==r)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${r}`);for(let i=0,n=0;i{"use strict"});function Nb(t){return{dynamicUpdate:lp(t,!0),staticUpdate:lp(t,!1)}}function lp(t,e){let r=[];r.push(` + + var index = 0; + + for (let i = 0; i < ps.length; ++i) + { + const p = ps[i]; + + `);let i=0;for(let s in t){let a=t[s];if(e!==a.dynamic)continue;r.push(`offset = index + ${i}`),r.push(a.code);let o=Ri(a.format);i+=o.stride/4}r.push(` + index += stride * 4; + } + `),r.unshift(` + var stride = ${i}; + `);let n=r.join(` +`);return new Function("ps","f32v","u32v",n)}var Hb=_(()=>{Cn()});function zb(t){let e=[];for(let r in t){let i=t[r];e.push(r,i.code,i.dynamic?"d":"s")}return e.join("_")}var hp,jb=_(()=>{Ki(),Mi(),es(),Cn(),Jd(),Lb(),Hb(),hp=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,i=0,n=0;for(let h in r){let u=r[h],c=Ri(u.format);u.dynamic?n+=c.stride:i+=c.stride}this._dynamicStride=n/4,this._staticStride=i/4,this.staticAttributeBuffer=new qi(e*4*i),this.dynamicAttributeBuffer=new qi(e*4*n),this.indexBuffer=op(e);let s=new Sn,a=0,o=0;this._staticBuffer=new yr({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:dt.VERTEX|dt.COPY_DST}),this._dynamicBuffer=new yr({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:dt.VERTEX|dt.COPY_DST});for(let h in r){let u=r[h],c=Ri(u.format);u.dynamic?(s.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=c.size):(s.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:o*4,format:u.format}),o+=c.size)}s.addIndex(this.indexBuffer);let l=this.getParticleUpdate(r);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=s}getParticleUpdate(t){let e=zb(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return Nb(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new qi(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new qi(this._size*this._dynamicStride*4*4),this.indexBuffer=op(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let i=this.staticAttributeBuffer;this._staticUpload(t,i.float32View,i.uint32View),this._staticBuffer.setDataWithSize(i.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}}),up,Vb=_(()=>{up=`varying vec2 vUV; +varying vec4 vColor; + +uniform sampler2D uTexture; + +void main(void){ + vec4 color = texture2D(uTexture, vUV) * vColor; + gl_FragColor = color; +}`}),cp,Wb=_(()=>{cp=`attribute vec2 aVertex; +attribute vec2 aUV; +attribute vec4 aColor; + +attribute vec2 aPosition; +attribute float aRotation; + +uniform mat3 uTranslationMatrix; +uniform float uRound; +uniform vec2 uResolution; +uniform vec4 uColor; + +varying vec2 vUV; +varying vec4 vColor; + +vec2 roundPixels(vec2 position, vec2 targetSize) +{ + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; +} + +void main(void){ + float cosRotation = cos(aRotation); + float sinRotation = sin(aRotation); + float x = aVertex.x * cosRotation - aVertex.y * sinRotation; + float y = aVertex.x * sinRotation + aVertex.y * cosRotation; + + vec2 v = vec2(x, y); + v = v + aPosition; + + gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); + + if(uRound == 1.0) + { + gl_Position.xy = roundPixels(gl_Position.xy, uResolution); + } + + vUV = aUV; + vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor; +} +`}),ah,$b=_(()=>{ah=` +struct ParticleUniforms { + uProjectionMatrix:mat3x3, + uColor:vec4, + uResolution:vec2, + uRoundPixels:f32, +}; + +@group(0) @binding(0) var uniforms: ParticleUniforms; + +@group(1) @binding(0) var uTexture: texture_2d; +@group(1) @binding(1) var uSampler : sampler; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + @location(1) color : vec4, + }; +@vertex +fn mainVertex( + @location(0) aVertex: vec2, + @location(1) aPosition: vec2, + @location(2) aUV: vec2, + @location(3) aColor: vec4, + @location(4) aRotation: f32, +) -> VSOutput { + + let v = vec2( + aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation), + aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation) + ) + aPosition; + + let position = vec4((uniforms.uProjectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); + + let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor; + + return VSOutput( + position, + aUV, + vColor, + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @location(1) color: vec4, + @builtin(position) position: vec4, +) -> @location(0) vec4 { + + var sample = textureSample(uTexture, uSampler, uv) * color; + + return sample; +}`}),dp,Xb=_(()=>{De(),Ze(),En(),rs(),ti(),Dt(),ed(),Vb(),Wb(),$b(),dp=class extends jr{constructor(){let t=Zi.from({vertex:cp,fragment:up}),e=Pn.from({fragment:{source:ah,entryPoint:"mainFragment"},vertex:{source:ah,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:Fe.WHITE.source,uSampler:new Yo({}),uniforms:{uTranslationMatrix:{value:new me,type:"mat3x3"},uColor:{value:new ce(16777215),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}}})}}}),oh,fp=_(()=>{Ze(),xr(),da(),ii(),ls(),jb(),Xb(),oh=class{constructor(t,e){this.state=Fr.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new ur({uTranslationMatrix:{value:new me,type:"mat3x3"},uColor:{value:new Float32Array(4),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new dp,this.state=Fr.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new hp({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,i=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let n=this.state;i.update(e,t._childrenDirty),t._childrenDirty=!1,n.blendMode=Jn(t.blendMode,t.texture._source);let s=this.localUniforms.uniforms,a=s.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),s.uResolution=r.globalUniforms.globalUniformData.resolution,s.uRound=r._roundPixels|t._roundPixels,os(t.groupColorAlpha,s.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}}),lh,Yb=_(()=>{J(),Ub(),fp(),lh=class extends oh{constructor(t){super(t,new ap)}},lh.extension={type:[O.WebGLPipes],name:"particle"}}),pp,qb=_(()=>{"use strict";pp=class{execute(t,e){let r=t.renderer,i=e.shader||t.defaultShader;i.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),i.groups[1]=r.texture.getTextureBindGroup(e.texture);let n=t.state,s=t.getBuffers(e);r.encoder.draw({geometry:s.geometry,shader:e.shader||t.defaultShader,state:n,size:e.particleChildren.length*6})}}}),hh,Kb=_(()=>{J(),qb(),fp(),hh=class extends oh{constructor(t){super(t,new pp)}},hh.extension={type:[O.WebGPUPipes],name:"particle"}}),gp=_(()=>{J(),Yb(),Kb(),xe.add(lh),xe.add(hh)}),hs,Na=_(()=>{"use strict";hs=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function uh(t,e){let{texture:r,bounds:i}=t;Dd(i,e._anchor,r);let n=e._style.padding;i.minX-=n,i.minY-=n,i.maxX-=n,i.maxY-=n}var mp=_(()=>{Ud()}),ch,Zb=_(()=>{J(),Zt(),Na(),mp(),ch=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),it.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),i=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,uh(i,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:it.get(hs)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}},ch.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"text"}}),_p,ni,us=_(()=>{tr(),$s(),_p=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=Nt.get().createCanvas();r.width=t,r.height=e;let i=r.getContext("2d");return{canvas:r,context:i}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=pn(t),e=pn(e);let i=(t<<17)+(e<<1);this._canvasPool[i]||(this._canvasPool[i]=[]);let n=this._canvasPool[i].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:i}=e,n=(r<<17)+(i<<1);t.context.clearRect(0,0,r,i),this._canvasPool[n].push(t)}clear(){this._canvasPool={}}},ni=new _p});function vp(t,e,r){for(let i=0,n=4*r*e;i{S()}),dh,cs,fh=_(()=>{Ze(),Wt(),dh={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},cs=class{constructor(t,e){this.uid=Mt("fillPattern"),this.transform=new me,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=dh[e].addressModeU,t.source.style.addressModeV=dh[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}}),e0=nr((t,e)=>{e.exports=n;var r={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(o){var l=[];return o.replace(i,function(h,u,c){var f=u.toLowerCase();for(c=a(c),f=="m"&&c.length>2&&(l.push([u].concat(c.splice(0,2))),f="l",u=u=="m"?"l":"L");;){if(c.length==r[f])return c.unshift(u),l.push(c);if(c.length0&&(n=i.pop(),n?(s=n.startX,a=n.startY):(s=0,a=0)),n=null;break;default:Be(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&n===null&&(n={startX:s,startY:a},i.push(n))}return e}var xp,r0=_(()=>{xp=Qt(e0(),1),Se()}),ph,bp=_(()=>{S(),ph=class sy{constructor(e=0,r=0,i=0){this.type="circle",this.x=e,this.y=r,this.radius=i}clone(){return new sy(this.x,this.y,this.radius)}contains(e,r){if(this.radius<=0)return!1;let i=this.radius*this.radius,n=this.x-e,s=this.y-r;return n*=n,s*=s,n+s<=i}strokeContains(e,r,i,n=.5){if(this.radius===0)return!1;let s=this.x-e,a=this.y-r,o=this.radius,l=(1-n)*i,h=Math.sqrt(s*s+a*a);return h<=o+l&&h>o-(i-l)}getBounds(e){return e||(e=new b),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}}),wp,i0=_(()=>{S(),wp=class ay{constructor(e=0,r=0,i=0,n=0){this.type="ellipse",this.x=e,this.y=r,this.halfWidth=i,this.halfHeight=n}clone(){return new ay(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,r){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(e-this.x)/this.halfWidth,n=(r-this.y)/this.halfHeight;return i*=i,n*=n,i+n<=1}strokeContains(e,r,i,n=.5){let{halfWidth:s,halfHeight:a}=this;if(s<=0||a<=0)return!1;let o=i*(1-n),l=i-o,h=s-l,u=a-l,c=s+o,f=a+o,d=e-this.x,y=r-this.y,x=d*d/(h*h)+y*y/(u*u),v=d*d/(c*c)+y*y/(f*f);return x>1&&v<=1}getBounds(e){return e||(e=new b),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function n0(t,e,r,i,n,s){let a=t-r,o=e-i,l=n-r,h=s-i,u=a*l+o*h,c=l*l+h*h,f=-1;c!==0&&(f=u/c);let d,y;f<0?(d=r,y=i):f>1?(d=n,y=s):(d=r+f*l,y=i+f*h);let x=t-d,v=e-y;return x*x+v*v}var s0=_(()=>{"use strict"}),a0,o0,Ha,l0=_(()=>{s0(),S(),Ha=class oy{constructor(...e){this.type="polygon";let r=Array.isArray(e[0])?e[0]:e;if(typeof r[0]!="number"){let i=[];for(let n=0,s=r.length;nr!=u>r&&e<(h-o)*((r-l)/(u-l))+o&&(i=!i)}return i}strokeContains(e,r,i,n=.5){let s=i*i,a=s*(1-n),o=s-a,{points:l}=this,h=l.length-(this.closePath?0:2);for(let u=0;un?h:n,s=ua?u:a}return e.x=i,e.width=n-i,e.y=s,e.height=a-s,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,r)=>`${e}, ${r}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}}),ds,Tp,h0=_(()=>{S(),ds=(t,e,r,i,n,s,a)=>{let o=t-r,l=e-i,h=Math.sqrt(o*o+l*l);return h>=n-s&&h<=n+a},Tp=class ly{constructor(e=0,r=0,i=0,n=0,s=20){this.type="roundedRectangle",this.x=e,this.y=r,this.width=i,this.height=n,this.radius=s}getBounds(e){return e||(e=new b),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new ly(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,r){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&r>=this.y&&r<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(r>=this.y+i&&r<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let n=e-(this.x+i),s=r-(this.y+i),a=i*i;if(n*n+s*s<=a||(n=e-(this.x+this.width-i),n*n+s*s<=a)||(s=r-(this.y+this.height-i),n*n+s*s<=a)||(n=e-(this.x+i),n*n+s*s<=a))return!0}return!1}strokeContains(e,r,i,n=.5){let{x:s,y:a,width:o,height:l,radius:h}=this,u=i*(1-n),c=i-u,f=s+h,d=a+h,y=o-h*2,x=l-h*2,v=s+o,w=a+l;return(e>=s-u&&e<=s+c||e>=v-c&&e<=v+u)&&r>=d&&r<=d+x||(r>=a-u&&r<=a+c||r>=w-c&&r<=w+u)&&e>=f&&e<=f+y?!0:ev-h&&rv-h&&r>w-h&&ds(e,r,v-h,w-h,h,c,u)||ew-h&&ds(e,r,f,w-h,h,c,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Sp(t,e,r,i,n,s,a,o,l,h){let u=Math.min(.99,Math.max(0,h??ka.defaultOptions.bezierSmoothness)),c=(Cp-u)/1;return c*=c,u0(e,r,i,n,s,a,o,l,t,c),t}function u0(t,e,r,i,n,s,a,o,l,h){gh(t,e,r,i,n,s,a,o,l,h,0),l.push(a,o)}function gh(t,e,r,i,n,s,a,o,l,h,u){if(u>Ep)return;let c=Math.PI,f=(t+r)/2,d=(e+i)/2,y=(r+n)/2,x=(i+s)/2,v=(n+a)/2,w=(s+o)/2,P=(f+y)/2,G=(d+x)/2,k=(y+v)/2,L=(x+w)/2,N=(P+k)/2,H=(G+L)/2;if(u>0){let fe=a-t,ue=o-e,ae=Math.abs((r-a)*ue-(i-o)*fe),le=Math.abs((n-a)*ue-(s-o)*fe),ke,We;if(ae>fs&&le>fs){if((ae+le)*(ae+le)<=h*(fe*fe+ue*ue)){if(tn=c&&(ke=2*c-ke),We>=c&&(We=2*c-We),ke+WeBi){l.push(r,i);return}if(We>Bi){l.push(n,s);return}}}}else if(ae>fs){if(ae*ae<=h*(fe*fe+ue*ue)){if(tn=c&&(ke=2*c-ke),keBi){l.push(r,i);return}}}else if(le>fs){if(le*le<=h*(fe*fe+ue*ue)){if(tn=c&&(ke=2*c-ke),keBi){l.push(n,s);return}}}else if(fe=N-(t+a)/2,ue=H-(e+o)/2,fe*fe+ue*ue<=h){l.push(N,H);return}}gh(t,e,f,d,P,G,N,H,l,h,u+1),gh(N,H,k,L,v,w,a,o,l,h,u+1)}var Ep,fs,Cp,za,tn,Bi,Ap=_(()=>{rh(),Ep=8,fs=11920929e-14,Cp=1,za=.01,tn=0,Bi=0});function c0(t,e,r,i,n,s,a,o){let l=Math.min(.99,Math.max(0,o??ka.defaultOptions.bezierSmoothness)),h=(Rp-l)/1;return h*=h,d0(e,r,i,n,s,a,t,h),t}function d0(t,e,r,i,n,s,a,o){mh(a,t,e,r,i,n,s,o,0),a.push(n,s)}function mh(t,e,r,i,n,s,a,o,l){if(l>Pp)return;let h=Math.PI,u=(e+i)/2,c=(r+n)/2,f=(i+s)/2,d=(n+a)/2,y=(u+f)/2,x=(c+d)/2,v=s-e,w=a-r,P=Math.abs((i-s)*w-(n-a)*v);if(P>Mp){if(P*P<=o*(v*v+w*w)){if(_h=h&&(G=2*h-G),G<_h){t.push(y,x);return}}}else if(v=y-(e+s)/2,w=x-(r+a)/2,v*v+w*w<=o){t.push(y,x);return}mh(t,e,r,u,c,y,x,o,l+1),mh(t,y,x,f,d,s,a,o,l+1)}var Pp,Mp,Rp,kp,_h,f0=_(()=>{rh(),Pp=8,Mp=11920929e-14,Rp=1,kp=.01,_h=0});function Bp(t,e,r,i,n,s,a,o){let l=Math.abs(n-s);(!a&&n>s||a&&s>n)&&(l=2*Math.PI-l),o||(o=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),o=Math.max(o,3);let h=l/o,u=n;h*=a?-1:1;for(let c=0;c{"use strict"});function p0(t,e,r,i,n,s){let a=t[t.length-2],o=t[t.length-1]-r,l=a-e,h=n-r,u=i-e,c=Math.abs(o*u-l*h);if(c<1e-8||s===0){(t[t.length-2]!==e||t[t.length-1]!==r)&&t.push(e,r);return}let f=o*o+l*l,d=h*h+u*u,y=o*h+l*u,x=s*Math.sqrt(f)/c,v=s*Math.sqrt(d)/c,w=x*y/f,P=v*y/d,G=x*u+v*l,k=x*h+v*o,L=l*(v+w),N=o*(v+w),H=u*(x+P),fe=h*(x+P),ue=Math.atan2(N-k,L-G),ae=Math.atan2(fe-k,H-G);Bp(t,G+e,k+r,s,ue,ae,l*h>u*o)}var g0=_(()=>{Ip()});function m0(t,e){let r=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=e===1.5707963267948966?.551915024494:r,n=Math.cos(t),s=Math.sin(t),a=Math.cos(t+e),o=Math.sin(t+e);return[{x:n-s*i,y:s+n*i},{x:a+o*i,y:o-a*i},{x:a,y:o}]}function _0(t,e,r,i,n,s,a,o=0,l=0,h=0){if(s===0||a===0)return;let u=Math.sin(o*Bn/360),c=Math.cos(o*Bn/360),f=c*(e-i)/2+u*(r-n)/2,d=-u*(e-i)/2+c*(r-n)/2;if(f===0&&d===0)return;s=Math.abs(s),a=Math.abs(a);let y=Math.pow(f,2)/Math.pow(s,2)+Math.pow(d,2)/Math.pow(a,2);y>1&&(s*=Math.sqrt(y),a*=Math.sqrt(y)),Op(e,r,i,n,s,a,l,h,u,c,f,d,ja);let{ang1:x,ang2:v}=ja,{centerX:w,centerY:P}=ja,G=Math.abs(v)/(Bn/4);Math.abs(1-G)<1e-7&&(G=1);let k=Math.max(Math.ceil(G),1);v/=k;let L=t[t.length-2],N=t[t.length-1],H={x:0,y:0};for(let fe=0;fe{Ap(),Bn=Math.PI*2,ja={centerX:0,centerY:0,ang1:0,ang2:0},Va=({x:t,y:e},r,i,n,s,a,o,l)=>{t*=r,e*=i;let h=n*t-s*e,u=s*t+n*e;return l.x=h+a,l.y=u+o,l},vh=(t,e,r,i)=>{let n=t*i-e*r<0?-1:1,s=t*r+e*i;return s>1&&(s=1),s<-1&&(s=-1),n*Math.acos(s)},Op=(t,e,r,i,n,s,a,o,l,h,u,c,f)=>{let d=Math.pow(n,2),y=Math.pow(s,2),x=Math.pow(u,2),v=Math.pow(c,2),w=d*y-d*v-y*x;w<0&&(w=0),w/=d*v+y*x,w=Math.sqrt(w)*(a===o?-1:1);let P=w*n/s*c,G=w*-s/n*u,k=h*P-l*G+(t+r)/2,L=l*P+h*G+(e+i)/2,N=(u-P)/n,H=(c-G)/s,fe=(-u-P)/n,ue=(-c-G)/s,ae=vh(1,0,N,H),le=vh(N,H,fe,ue);o===0&&le>0&&(le-=Bn),o===1&&le<0&&(le+=Bn),f.centerX=k,f.centerY=L,f.ang1=ae,f.ang2=le}});function y0(t,e,r){let i=(a,o)=>{let l=o.x-a.x,h=o.y-a.y,u=Math.sqrt(l*l+h*h),c=l/u,f=h/u;return{len:u,nx:c,ny:f}},n=(a,o)=>{a===0?t.moveTo(o.x,o.y):t.lineTo(o.x,o.y)},s=e[e.length-1];for(let a=0;a0&&(d=-1,y=!0);let x=f/2,v,w=Math.abs(Math.cos(x)*l/Math.sin(x));w>Math.min(u.len/2,c.len/2)?(w=Math.min(u.len/2,c.len/2),v=Math.abs(w*Math.sin(x)/Math.cos(x))):v=l;let P=o.x+c.nx*w+-c.ny*v*d,G=o.y+c.ny*w+c.nx*v*d,k=Math.atan2(u.ny,u.nx)+Math.PI/2*d,L=Math.atan2(c.ny,c.nx)-Math.PI/2*d;a===0&&t.moveTo(P+Math.cos(k)*v,G+Math.sin(k)*v),t.arc(P,G,v,k,L,y),s=o}}function x0(t,e,r,i){let n=(o,l)=>Math.sqrt((o.x-l.x)**2+(o.y-l.y)**2),s=(o,l,h)=>({x:o.x+(l.x-o.x)*h,y:o.y+(l.y-o.y)*h}),a=e.length;for(let o=0;o{"use strict"}),Gp,Fp,w0=_(()=>{bp(),i0(),l0(),S(),h0(),T(),Ap(),f0(),Ip(),g0(),v0(),b0(),Gp=new b,Fp=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new m,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,i=r[r.length-2],n=r[r.length-1];return(i!==t||n!==e)&&r.push(t,e),this}arc(t,e,r,i,n,s){this._ensurePoly(!1);let a=this._currentPoly.points;return Bp(a,t,e,r,i,n,s),this}arcTo(t,e,r,i,n){this._ensurePoly();let s=this._currentPoly.points;return p0(s,t,e,r,i,n),this}arcToSvg(t,e,r,i,n,s,a){let o=this._currentPoly.points;return _0(o,this._currentPoly.lastX,this._currentPoly.lastY,s,a,t,e,r,i,n),this}bezierCurveTo(t,e,r,i,n,s,a){this._ensurePoly();let o=this._currentPoly;return Sp(this._currentPoly.points,o.lastX,o.lastY,t,e,r,i,n,s,a),this}quadraticCurveTo(t,e,r,i,n){this._ensurePoly();let s=this._currentPoly;return c0(this._currentPoly.points,s.lastX,s.lastY,t,e,r,i,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let r=this.shapePrimitives,i=r.length;for(let n=0;n1){let n=null;for(let s=i;s=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,s)}ellipse(t,e,r,i,n){return this.drawShape(new wp(t,e,r,i),n),this}roundRect(t,e,r,i,n,s){return this.drawShape(new Tp(t,e,r,i,n),s),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new Ha,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Ha,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,i=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let n=e.transform,s=r;r=n.a*r+n.c*i+n.tx,i=n.b*s+n.d*i+n.ty}this._currentPoly.points.push(r,i)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e{He(),Wt(),Se(),r0(),w0(),gs=class hy{constructor(e,r=!1){this.instructions=[],this.uid=Mt("graphicsPath"),this._dirty=!0,this.checkForHoles=r,typeof e=="string"?t0(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Fp(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,r){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,r]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,r,i,n,s){let a=this.instructions[this.instructions.length-1],o=this.getLastPoint(_e.shared),l=0,h=0;if(!a||a.action!=="bezierCurveTo")l=o.x,h=o.y;else{l=a.data[2],h=a.data[3];let u=o.x,c=o.y;l=u+(u-l),h=c+(c-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,e,r,i,n,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,r,i){let n=this.instructions[this.instructions.length-1],s=this.getLastPoint(_e.shared),a=0,o=0;if(!n||n.action!=="quadraticCurveTo")a=s.x,o=s.y;else{a=n.data[0],o=n.data[1];let l=s.x,h=s.y;a=l+(l-a),o=h+(h-o)}return this.instructions.push({action:"quadraticCurveTo",data:[a,o,e,r,i]}),this._dirty=!0,this}rect(e,r,i,n,s){return this.instructions.push({action:"rect",data:[e,r,i,n,s]}),this._dirty=!0,this}circle(e,r,i,n){return this.instructions.push({action:"circle",data:[e,r,i,n]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,r,i,n,s,a,o){s||(s=n/2);let l=-1*Math.PI/2+a,h=i*2,u=Math.PI*2/h,c=[];for(let f=0;f{"use strict"});function T0(t,e){let r=t.querySelectorAll("defs");for(let i=0;i{De(),Se(),ss(),Up()});function Lp(t){let e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var A0=_(()=>{"use strict"});function Np(t,e){let r=t.getAttribute("style"),i={},n={},s={strokeStyle:i,fillStyle:n,useFill:!1,useStroke:!1};for(let a in yh){let o=t.getAttribute(a);o&&Hp(e,s,a,o.trim())}if(r){let a=r.split(";");for(let o=0;o{De(),A0(),yh={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function M0(t,e){if(typeof t=="string"){let a=document.createElement("div");a.innerHTML=t.trim(),t=a.querySelector("svg")}let r={context:e,defs:{},path:new gs};T0(t,r);let i=t.children,{fillStyle:n,strokeStyle:s}=Np(t,r);for(let a=0;aparseInt(ue,10)),e.context.poly(G,!0),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"polyline":k=t.getAttribute("points"),G=k.match(/\d+/g).map(ue=>parseInt(ue,10)),e.context.poly(G,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{Be(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}o&&(r=null);for(let ue=0;ue{Se(),Dp(),C0(),Up(),P0()});function k0(t){return ce.isColorLike(t)}function jp(t){return t instanceof cs}function Vp(t){return t instanceof ri}function B0(t){return t instanceof Fe}function I0(t,e,r){let i=ce.shared.setValue(e??0);return t.color=i.toNumber(),t.alpha=i.alpha===1?r.alpha:i.alpha,t.texture=Fe.WHITE,{...r,...t}}function O0(t,e,r){return t.texture=e,{...r,...t}}function Wp(t,e,r){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...r,...t}}function $p(t,e,r){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...r,...t}}function G0(t,e){let r={...e,...t},i=ce.shared.setValue(r.color);return r.alpha*=i.alpha,r.color=i.toNumber(),r}function rn(t,e){if(t==null)return null;let r={},i=t;return k0(t)?I0(r,t,e):B0(t)?O0(r,t,e):jp(t)?Wp(r,t,e):Vp(t)?$p(r,t,e):i.fill&&jp(i.fill)?Wp(i,i.fill,e):i.fill&&Vp(i.fill)?$p(i,i.fill,e):G0(i,e)}function Wa(t,e){let{width:r,alignment:i,miterLimit:n,cap:s,join:a,pixelLine:o,...l}=e,h=rn(t,l);return h?{width:r,alignment:i,miterLimit:n,cap:s,join:a,pixelLine:o,...h}:null}var Xp=_(()=>{De(),Dt(),ss(),fh()}),Yp,xh,$a,Dr,qp=_(()=>{It(),De(),Ze(),He(),Dt(),Wt(),kt(),T(),Dp(),R0(),Xp(),Yp=new _e,xh=new me,$a=class ui extends at{constructor(){super(...arguments),this.uid=Mt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new gs,this._transform=new me,this._fillStyle={...ui.defaultFillStyle},this._strokeStyle={...ui.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new m,this._boundsDirty=!0}clone(){let e=new ui;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=rn(e,ui.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=Wa(e,ui.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=rn(e,ui.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=rn(e,ui.defaultStrokeStyle),this}texture(e,r,i,n,s,a){return this.instructions.push({action:"texture",data:{image:e,dx:i||0,dy:n||0,dw:s||e.frame.width,dh:a||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:r?ce.shared.setValue(r).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new gs,this}fill(e,r){let i,n=this.instructions[this.instructions.length-1];return this._tick===0&&n&&n.action==="stroke"?i=n.data.path:i=this._activePath.clone(),i?(e!=null&&(r!==void 0&&typeof e=="number"&&(Qe(ot,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:r}),this._fillStyle=rn(e,ui.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:r}=this._activePath.getLastPoint(_e.shared);this._activePath.clear(),this._activePath.moveTo(e,r)}stroke(e){let r,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?r=i.data.path:r=this._activePath.clone(),r?(e!=null&&(this._strokeStyle=Wa(e,ui.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let r=this.instructions[this.instructions.length-1-e],i=this._activePath.clone();if(r&&(r.action==="stroke"||r.action==="fill"))if(r.data.hole)r.data.hole.addPath(i);else{r.data.hole=i;break}}return this._initNextPathLocation(),this}arc(e,r,i,n,s,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*e+o.c*r+o.tx,o.b*e+o.d*r+o.ty,i,n,s,a),this}arcTo(e,r,i,n,s){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*e+a.c*r+a.tx,a.b*e+a.d*r+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,s),this}arcToSvg(e,r,i,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,r,i,n,s,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(e,r,i,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*r+l.tx,l.b*e+l.d*r+l.ty,l.a*i+l.c*n+l.tx,l.b*i+l.d*n+l.ty,l.a*s+l.c*a+l.tx,l.b*s+l.d*a+l.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(e,r,i,n){return this._tick++,this._activePath.ellipse(e,r,i,n,this._transform.clone()),this}circle(e,r,i){return this._tick++,this._activePath.circle(e,r,i,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,r){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*e+i.c*r+i.tx,i.b*e+i.d*r+i.ty),this}moveTo(e,r){this._tick++;let i=this._transform,n=this._activePath.instructions,s=i.a*e+i.c*r+i.tx,a=i.b*e+i.d*r+i.ty;return n.length===1&&n[0].action==="moveTo"?(n[0].data[0]=s,n[0].data[1]=a,this):(this._activePath.moveTo(s,a),this)}quadraticCurveTo(e,r,i,n,s){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*e+a.c*r+a.tx,a.b*e+a.d*r+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,s),this}rect(e,r,i,n){return this._tick++,this._activePath.rect(e,r,i,n,this._transform.clone()),this}roundRect(e,r,i,n,s){return this._tick++,this._activePath.roundRect(e,r,i,n,s,this._transform.clone()),this}poly(e,r){return this._tick++,this._activePath.poly(e,r,this._transform.clone()),this}regularPoly(e,r,i,n,s=0,a){return this._tick++,this._activePath.regularPoly(e,r,i,n,s,a),this}roundPoly(e,r,i,n,s,a){return this._tick++,this._activePath.roundPoly(e,r,i,n,s,a),this}roundShape(e,r,i,n){return this._tick++,this._activePath.roundShape(e,r,i,n),this}filletRect(e,r,i,n,s){return this._tick++,this._activePath.filletRect(e,r,i,n,s),this}chamferRect(e,r,i,n,s,a){return this._tick++,this._activePath.chamferRect(e,r,i,n,s,a),this}star(e,r,i,n,s=0,a=0){return this._tick++,this._activePath.star(e,r,i,n,s,a,this._transform.clone()),this}svg(e){return this._tick++,M0(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,r=e){return this._transform.scale(e,r),this}setTransform(e,r,i,n,s,a){return e instanceof me?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,r,i,n,s,a),this)}transform(e,r,i,n,s,a){return e instanceof me?(this._transform.append(e),this):(xh.set(e,r,i,n,s,a),this._transform.append(xh),this)}translate(e,r=e){return this._transform.translate(e,r),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let e=this._bounds;e.clear();for(let r=0;r{De(),bh=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function U0(t){let e=t;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let r=si.defaultDropShadow;t.dropShadow={alpha:e.dropShadowAlpha??r.alpha,angle:e.dropShadowAngle??r.angle,blur:e.dropShadowBlur??r.blur,color:e.dropShadowColor??r.color,distance:e.dropShadowDistance??r.distance}}if(e.strokeThickness!==void 0){Qe(ot,"strokeThickness is now a part of stroke");let r=e.stroke,i={};if(ce.isColorLike(r))i.color=r;else if(r instanceof ri||r instanceof cs)i.fill=r;else if(Object.hasOwnProperty.call(r,"color")||Object.hasOwnProperty.call(r,"fill"))i=r;else throw new Error("Invalid stroke value.");t.stroke={...i,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){Qe(ot,"gradient fill is now a fill pattern: `new FillGradient(...)`");let r;t.fontSize==null?t.fontSize=si.defaultTextStyle.fontSize:typeof t.fontSize=="string"?r=parseInt(t.fontSize,10):r=t.fontSize;let i=new ri({start:{x:0,y:0},end:{x:0,y:(r||0)*1.7}}),n=e.fillGradientStops.map(s=>ce.shared.setValue(s).toNumber());n.forEach((s,a)=>{let o=a/(n.length-1);i.addColorStop(o,s)}),t.fill={fill:i}}}var Xa,si,ms=_(()=>{It(),De(),kt(),ss(),fh(),qp(),Xp(),Qp(),Xa=class zn extends at{constructor(e={}){super(),U0(e);let r={...zn.defaultTextStyle,...e};for(let i in r){let n=i;this[n]=r[i]}this.update()}get align(){return this._align}set align(e){this._align=e,this.update()}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords=e,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(e){e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...zn.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...zn.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily=e,this.update()}get fontSize(){return this._fontSize}set fontSize(e){typeof e=="string"?this._fontSize=parseInt(e,10):this._fontSize=e,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle=e.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant=e,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight=e,this.update()}get leading(){return this._leading}set leading(e){this._leading=e,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing=e,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight=e,this.update()}get padding(){return this._padding}set padding(e){this._padding=e,this.update()}get trim(){return this._trim}set trim(e){this._trim=e,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline=e,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace=e,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap=e,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth=e,this.update()}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...Dr.defaultFillStyle,...e},()=>{this._fill=rn({...this._originalFill},Dr.defaultFillStyle)})),this._fill=rn(e===0?"black":e,Dr.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...Dr.defaultStrokeStyle,...e},()=>{this._stroke=Wa({...this._originalStroke},Dr.defaultStrokeStyle)})),this._stroke=Wa(e,Dr.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Kp(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=zn.defaultTextStyle;for(let r in e)this[r]=e[r]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new zn({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(e=!1){if(this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let r=typeof e=="boolean"?e:e?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(e,r){return new Proxy(e,{set:(i,n,s)=>(i[n]=s,r?.(n,s),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(ce.isColorLike(e)||e instanceof ri||e instanceof cs)}},Xa.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},Xa.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100},si=Xa});function Jp(t,e,r,i){let n=eg;n.minX=0,n.minY=0,n.maxX=t.width/i|0,n.maxY=t.height/i|0;let s=ar.getOptimalTexture(n.width,n.height,i,!1);return s.source.uploadMethodId="image",s.source.resource=t,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=e/i,s.frame.height=r/i,s.source.emit("update",s.source),s.updateUvs(),s}var eg,tg=_(()=>{ji(),T(),eg=new m});function Ya(t){let e=typeof t.fontSize=="number"?`${t.fontSize}px`:t.fontSize,r=t.fontFamily;Array.isArray(t.fontFamily)||(r=t.fontFamily.split(","));for(let i=r.length-1;i>=0;i--){let n=r[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!rg.includes(n)&&(n=`"${n}"`),r[i]=n}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${r.join(",")}`}var rg,wh=_(()=>{"use strict";rg=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]}),qa,Ur,ai,Th=_(()=>{tr(),wh(),qa={willReadFrequently:!0},Ur=class Oe{static get experimentalLetterSpacingSupported(){let e=Oe._experimentalLetterSpacingSupported;if(e!==void 0){let r=Nt.get().getCanvasRenderingContext2D().prototype;e=Oe._experimentalLetterSpacingSupported="letterSpacing"in r||"textLetterSpacing"in r}return e}constructor(e,r,i,n,s,a,o,l,h){this.text=e,this.style=r,this.width=i,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=l,this.fontProperties=h}static measureText(e=" ",r,i=Oe._canvas,n=r.wordWrap){let s=`${e}:${r.styleKey}`;if(Oe._measurementCache[s])return Oe._measurementCache[s];let a=Ya(r),o=Oe.measureFont(a);o.fontSize===0&&(o.fontSize=r.fontSize,o.ascent=r.fontSize);let l=Oe.__context;l.font=a;let h=(n?Oe._wordWrap(e,r,i):e).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),c=0;for(let v=0;v0)if(n)a-=r,l-=r;else{let h=(Oe.graphemeSegmenter(e).length-1)*r;a+=h,l+=h}return Math.max(a,l)}static _wordWrap(e,r,i=Oe._canvas){let n=i.getContext("2d",qa),s=0,a="",o="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=r,c=Oe._collapseSpaces(u),f=Oe._collapseNewlines(u),d=!c,y=r.wordWrapWidth+h,x=Oe._tokenize(e);for(let v=0;vy)if(a!==""&&(o+=Oe._addLine(a),a="",s=0),Oe.canBreakWords(w,r.breakWords)){let G=Oe.wordWrapSplit(w);for(let k=0;ky&&(o+=Oe._addLine(a),d=!1,a="",s=0),a+=L,s+=fe}}else{a.length>0&&(o+=Oe._addLine(a),a="",s=0);let G=v===x.length-1;o+=Oe._addLine(w,!G),d=!1,a="",s=0}else P+s>y&&(d=!1,o+=Oe._addLine(a),a="",s=0),(a.length>0||!Oe.isBreakingSpace(w)||d)&&(a+=w,s+=P)}return o+=Oe._addLine(a,!1),o}static _addLine(e,r=!0){return e=Oe._trimRight(e),e=r?`${e} +`:e,e}static _getFromCache(e,r,i,n){let s=i[e];return typeof s!="number"&&(s=Oe._measureText(e,r,n)+r,i[e]=s),s}static _collapseSpaces(e){return e==="normal"||e==="pre-line"}static _collapseNewlines(e){return e==="normal"}static _trimRight(e){if(typeof e!="string")return"";for(let r=e.length-1;r>=0;r--){let i=e[r];if(!Oe.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:Oe._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,r){return typeof e!="string"?!1:Oe._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let r=[],i="";if(typeof e!="string")return r;for(let n=0;n{if(typeof Intl?.Segmenter=="function"){let t=new Intl.Segmenter;return e=>[...t.segment(e)].map(r=>r.segment)}return t=>[...t]})(),Ur.experimentalLetterSpacing=!1,Ur._fonts={},Ur._newlines=[10,13],Ur._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Ur._measurementCache={},ai=Ur});function Ka(t,e,r,i=0){if(t.texture===Fe.WHITE&&!t.fill)return ce.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa();if(t.fill){if(t.fill instanceof cs){let n=t.fill,s=e.createPattern(n.texture.source.resource,"repeat"),a=n.transform.copyTo(me.shared);return a.scale(n.texture.frame.width,n.texture.frame.height),s.setTransform(a),s}else if(t.fill instanceof ri){let n=t.fill,s=n.type==="linear",a=n.textureSpace==="local",o=1,l=1;a&&r&&(o=r.width+i,l=r.height+i);let h,u=!1;if(s){let{start:c,end:f}=n;h=e.createLinearGradient(c.x*o,c.y*l,f.x*o,f.y*l),u=Math.abs(f.x-c.x){let x=d+y.offset*c;h.addColorStop(Math.floor(x*Sh)/Sh,ce.shared.setValue(y.color).toHex())})}}else n.colorStops.forEach(c=>{h.addColorStop(c.offset,ce.shared.setValue(c.color).toHex())});return h}}else{let n=e.createPattern(t.texture.source.resource,"repeat"),s=t.matrix.copyTo(me.shared);return s.scale(t.texture.frame.width,t.texture.frame.height),n.setTransform(s),n}return Be("FillStyle not recognised",t),"red"}var Sh,ig=_(()=>{De(),Ze(),Dt(),Se(),ss(),fh(),Sh=1e5}),Eh,L0=_(()=>{De(),J(),$s(),us(),ji(),Jb(),kt(),ms(),tg(),Th(),wh(),ig(),Eh=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let i=ai.measureText(t||" ",r),n=Math.ceil(Math.ceil(Math.max(1,i.width)+r.padding*2)*e),s=Math.ceil(Math.ceil(Math.max(1,i.height)+r.padding*2)*e);return n=Math.ceil(n-1e-6),s=Math.ceil(s-1e-6),n=pn(n),s=pn(s),{width:n,height:s}}getTexture(t,e,r,i){typeof t=="string"&&(Qe("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof si||(t.style=new si(t.style));let{texture:n,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(n._source),ni.returnCanvasAndContext(s),n}createTextureAndCanvas(t){let{text:e,style:r}=t,i=t.resolution??this._renderer.resolution,n=ai.measureText(e||" ",r),s=Math.ceil(Math.ceil(Math.max(1,n.width)+r.padding*2)*i),a=Math.ceil(Math.ceil(Math.max(1,n.height)+r.padding*2)*i),o=ni.getOptimalCanvasAndContext(s,a),{canvas:l}=o;this.renderTextToCanvas(e,r,i,o);let h=Jp(l,s,a,i);if(r.trim){let u=Qb(l,i);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:o}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:i}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:i,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",ar.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(ni.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,i){let{canvas:n,context:s}=i,a=Ya(e),o=ai.measureText(t||" ",e),l=o.lines,h=o.lineHeight,u=o.lineWidths,c=o.maxLineWidth,f=o.fontProperties,d=n.height;if(s.resetTransform(),s.scale(r,r),s.textBaseline=e.textBaseline,e._stroke?.width){let w=e._stroke;s.lineWidth=w.width,s.miterLimit=w.miterLimit,s.lineJoin=w.join,s.lineCap=w.cap}s.font=a;let y,x,v=e.dropShadow?2:1;for(let w=0;w{J(),Zb(),L0(),xe.add(Eh),xe.add(ch)}),Za,sg=_(()=>{kt(),bl(),qp(),Za=class Wc extends aa{constructor(e){e instanceof Dr&&(e={context:e});let{context:r,roundPixels:i,...n}=e||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",r?this._context=r:this._context=this._ownedContext=new Dr,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(e){e!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=e,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(e){return this._context.containsPoint(e)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||e?.context===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_callContextMethod(e,r){return this.context[e](...r),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new Wc(this._context.clone()):(this._ownedContext=null,new Wc(this._context))}lineStyle(e,r,i){Qe(ot,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let n={};return e&&(n.width=e),r&&(n.color=r),i&&(n.alpha=i),this.context.strokeStyle=n,this}beginFill(e,r){Qe(ot,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return e!==void 0&&(i.color=e),r!==void 0&&(i.alpha=r),this.context.fillStyle=i,this}endFill(){Qe(ot,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let e=this.context.strokeStyle;return(e.width!==Dr.defaultStrokeStyle.width||e.color!==Dr.defaultStrokeStyle.color||e.alpha!==Dr.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return Qe(ot,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return Qe(ot,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return Qe(ot,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return Qe(ot,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return Qe(ot,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return Qe(ot,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}}),ag,og,N0=_(()=>{"use strict";ag={name:"local-uniform-msdf-bit",vertex:{header:` + struct LocalUniforms { + uColor:vec4, + uTransformMatrix:mat3x3, + uDistance: f32, + uRound:f32, + } + + @group(2) @binding(0) var localUniforms : LocalUniforms; + `,main:` + vColor *= localUniforms.uColor; + modelMatrix *= localUniforms.uTransformMatrix; + `,end:` + if(localUniforms.uRound == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `},fragment:{header:` + struct LocalUniforms { + uColor:vec4, + uTransformMatrix:mat3x3, + uDistance: f32 + } + + @group(2) @binding(0) var localUniforms : LocalUniforms; + `,main:` + outColor = vec4(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance)); + `}},og={name:"local-uniform-msdf-bit",vertex:{header:` + uniform mat3 uTransformMatrix; + uniform vec4 uColor; + uniform float uRound; + `,main:` + vColor *= uColor; + modelMatrix *= uTransformMatrix; + `,end:` + if(uRound == 1.) + { + gl_Position.xy = roundPixels(gl_Position.xy, uResolution); + } + `},fragment:{header:` + uniform float uDistance; + `,main:` + outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance)); + `}}}),lg,hg,H0=_(()=>{"use strict";lg={name:"msdf-bit",fragment:{header:` + fn calculateMSDFAlpha(msdfColor:vec4, shapeColor:vec4, distance:f32) -> f32 { + + // MSDF + var median = msdfColor.r + msdfColor.g + msdfColor.b - + min(msdfColor.r, min(msdfColor.g, msdfColor.b)) - + max(msdfColor.r, max(msdfColor.g, msdfColor.b)); + + // SDF + median = min(median, msdfColor.a); + + var screenPxDistance = distance * (median - 0.5); + var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0); + if (median < 0.01) { + alpha = 0.0; + } else if (median > 0.99) { + alpha = 1.0; + } + + // Gamma correction for coverage-like alpha + var luma: f32 = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114)); + var gamma: f32 = mix(1.0, 1.0 / 2.2, luma); + var coverage: f32 = pow(shapeColor.a * alpha, gamma); + + return coverage; + + } + `}},hg={name:"msdf-bit",fragment:{header:` + float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) { + + // MSDF + float median = msdfColor.r + msdfColor.g + msdfColor.b - + min(msdfColor.r, min(msdfColor.g, msdfColor.b)) - + max(msdfColor.r, max(msdfColor.g, msdfColor.b)); + + // SDF + median = min(median, msdfColor.a); + + float screenPxDistance = distance * (median - 0.5); + float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0); + + if (median < 0.01) { + alpha = 0.0; + } else if (median > 0.99) { + alpha = 1.0; + } + + // Gamma correction for coverage-like alpha + float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114)); + float gamma = mix(1.0, 1.0 / 2.2, luma); + float coverage = pow(shapeColor.a * alpha, gamma); + + return coverage; + } + `}}}),Ch,Ah,ug,z0=_(()=>{Ze(),bn(),Qi(),Ta(),Ca(),Ji(),Ql(),ti(),xr(),N0(),H0(),ug=class extends jr{constructor(){let t=new ur({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new me,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=xn();Ch??(Ch=is({name:"sdf-shader",bits:[ba,$l(e),ag,lg,Mn]})),Ah??(Ah=ns({name:"sdf-shader",bits:[wa,Xl(e),og,hg,Rn]})),super({glProgram:Ah,gpuProgram:Ch,resources:{localUniforms:t,batchSamplers:Kl(e)}})}}}),cg,j0=_(()=>{It(),kt(),cg=class extends at{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return Qe(ot,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return Qe(ot,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return Qe(ot,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return Qe(ot,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return Qe(ot,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});function dg(t){if(t==="")return[];typeof t=="string"&&(t=[t]);let e=[];for(let r=0,i=t.length;r{"use strict"}),Ph,Mh,V0=_(()=>{De(),S(),us(),Il(),Dt(),kt(),Th(),wh(),ig(),ms(),j0(),fg(),Ph=class uy extends cg{constructor(e){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let r={...uy.defaultOptions,...e};this._textureSize=r.textureSize,this._mipmap=r.mipmap;let i=r.style.clone();r.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=Fe.WHITE,i._fill.fill=null),this.applyFillAsTint=r.overrideFill;let n=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let s=Ya(i);r.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/n):i.fontSize=this.baseRenderedFontSize=n,this._style=i,this._skipKerning=r.skipKerning??!1,this.resolution=r.resolution??1,this._padding=r.padding??4,this.fontMetrics=ai.measureFont(s),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(e){let r=dg(e).filter(v=>!this._currentChars.includes(v)).filter((v,w,P)=>P.indexOf(v)===w);if(!r.length)return;this._currentChars=[...this._currentChars,...r];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:n,context:s}=i.canvasAndContext,a=i.texture.source,o=this._style,l=this._currentX,h=this._currentY,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,c=this._padding*u,f=0,d=!1,y=n.width/this.resolution,x=n.height/this.resolution;for(let v=0;vy&&(h+=f,f=H,l=0,h+f>x)){a.update();let ue=this._nextPage();n=ue.canvasAndContext.canvas,s=ue.canvasAndContext.context,a=ue.texture.source,h=0}let fe=G/u-(o.dropShadow?.distance??0)-(o._stroke?.width??0);if(this.chars[w]={id:w.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:fe,kerning:{}},d){this._drawGlyph(s,P,l+c,h+c,u,o);let ue=a.width*u,ae=a.height*u,le=new b(l/ue*a.width,h/ae*a.height,N/ue*a.width,H/ae*a.height);this.chars[w].texture=new Fe({source:a,frame:le}),l+=Math.ceil(N)}}a.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(r,s)}get pageTextures(){return Qe(ot,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,r){let i=this._measureCache;for(let n=0;n{let x=s.width;for(let v=0;v{let y=s.chars.length-1;if(i){let x=s.chars[y];for(;x===" ";)s.width-=r.chars[x].xAdvance,x=s.chars[--y]}n.width=Math.max(n.width,s.width),s={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,n.lines.push(s),n.height+=r.lineHeight},c=r.baseMeasurementFontSize/e.fontSize,f=e.letterSpacing*c,d=e.wordWrapWidth*c;for(let y=0;yd?(u(),h(l),v||s.charPositions.push(0)):(l.start=s.width,h(l),v||s.charPositions.push(0)),x==="\r"||x===` +`)s.width!==0&&u();else if(!v){let P=w.xAdvance+(w.kerning[a]||0)+f;s.width+=P,s.spaceWidth=P,s.spacesIndex.push(s.charPositions.length),s.chars.push(x)}}else{let P=w.kerning[a]||0,G=w.xAdvance+P+f;l.positions[l.index++]=l.width+P,l.chars.push(x),l.width+=G}a=x}return u(),e.align==="center"?W0(n):e.align==="right"?$0(n):e.align==="justify"&&X0(n),n}function W0(t){for(let e=0;e{"use strict"}),_s,mg,_g,Y0=_(()=>{la(),kt(),Se(),ms(),V0(),gg(),fg(),_s=0,mg=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){let r=`${e.fontFamily}-bitmap`,i=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,i=!1;else if(e._stroke||e.dropShadow){let s=e.styleKey;s=s.substring(0,s.lastIndexOf("-")),r=`${s}-bitmap`,i=!1}if(!or.has(r)){let s=new Mh({style:e,overrideFill:i,overrideSize:!0,...this.defaultOptions});_s++,_s>50&&Be("BitmapText",`You have dynamically created ${_s} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),s.once("destroy",()=>{_s--,or.remove(r)}),or.set(r,s)}let n=or.get(r);return n.ensureCharacters?.(t),n}getLayout(t,e,r=!0){let i=this.getFont(t,e);return pg([...t],e,i,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},Qe(ot,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let i=e.style,n=i instanceof si?i:new si(i),s=n._fill.fill!==null&&n._fill.fill!==void 0,a=new Mh({style:n,overrideFill:s,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),o=dg(e.chars);return a.ensureCharacters(o.join("")),or.set(`${r}-bitmap`,a),a.once("destroy",()=>or.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=or.get(e);r&&r.destroy()}},_g=new mg});function vg(t,e){e.groupTransform=t.groupTransform,e.groupColorAlpha=t.groupColorAlpha,e.groupColor=t.groupColor,e.groupBlendMode=t.groupBlendMode,e.globalDisplayStatus=t.globalDisplayStatus,e.groupTransform=t.groupTransform,e.localDisplayStatus=t.localDisplayStatus,e.groupAlpha=t.groupAlpha,e._roundPixels=t._roundPixels}var Rh,q0=_(()=>{la(),J(),Zt(),sg(),z0(),Y0(),gg(),Rh=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);vg(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(it.return(e.customShader),e.customShader=null),it.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);vg(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,i=_g.getFont(t.text,t._style);r.clear(),i.distanceField.type!=="none"&&(r.customShader||(r.customShader=it.get(ug)));let n=Array.from(t.text),s=t._style,a=i.baseLineOffset,o=pg(n,s,i,!0),l=0,h=s.padding,u=o.scale,c=o.width,f=o.height+o.offsetY;s._stroke&&(c+=s._stroke.width/u,f+=s._stroke.width/u),r.translate(-t._anchor._x*c-h,-t._anchor._y*f-h).scale(u,u);let d=i.applyFillAsTint?s._fill.color:16777215;for(let y=0;y{J(),q0(),xe.add(Rh)}),kh,K0=_(()=>{J(),Dt(),Zt(),Na(),mp(),kh=class{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),it.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),i=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(n=>{console.error(n)}),t._didTextUpdate=!1,uh(i,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;let i=t.resolution??this._renderer.resolution,n=await this._renderer.htmlText.getManagedTexture(t.text,i,t._style,t._getKey()),s=e.batchableSprite;s.texture=e.texture=n,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),uh(s,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:Fe.EMPTY,currentKey:"--",batchableSprite:it.get(hs),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=Fe.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}},kh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"htmlText"}});function Z0(){let{userAgent:t}=Nt.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}var Q0=_(()=>{tr()}),Bh,Ih,Oh,xg=_(()=>{"use strict";Bh="http://www.w3.org/2000/svg",Ih="http://www.w3.org/1999/xhtml",Oh=class{constructor(){this.svgRoot=document.createElementNS(Bh,"svg"),this.foreignObject=document.createElementNS(Bh,"foreignObject"),this.domElement=document.createElementNS(Ih,"div"),this.styleElement=document.createElementNS(Ih,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:i}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(i)}}});function J0(t){let e=t._stroke,r=t._fill,i=[`div { ${[`color: ${ce.shared.setValue(r.color).toHex()}`,`font-size: ${t.fontSize}px`,`font-family: ${t.fontFamily}`,`font-weight: ${t.fontWeight}`,`font-style: ${t.fontStyle}`,`font-variant: ${t.fontVariant}`,`letter-spacing: ${t.letterSpacing}px`,`text-align: ${t.align}`,`padding: ${t.padding}px`,`white-space: ${t.whiteSpace==="pre"&&t.wordWrap?"pre-wrap":t.whiteSpace}`,...t.lineHeight?[`line-height: ${t.lineHeight}px`]:[],...t.wordWrap?[`word-wrap: ${t.breakWords?"break-all":"break-word"}`,`max-width: ${t.wordWrapWidth}px`]:[],...e?[wg(e)]:[],...t.dropShadow?[bg(t.dropShadow)]:[],...t.cssOverrides].join(";")} }`];return e1(t.tagStyles,i),i.join(" ")}function bg(t){let e=ce.shared.setValue(t.color).setAlpha(t.alpha).toHexa(),r=Math.round(Math.cos(t.angle)*t.distance),i=Math.round(Math.sin(t.angle)*t.distance),n=`${r}px ${i}px`;return t.blur>0?`text-shadow: ${n} ${t.blur}px ${e}`:`text-shadow: ${n} ${e}`}function wg(t){return[`-webkit-text-stroke-width: ${t.width}px`,`-webkit-text-stroke-color: ${ce.shared.setValue(t.color).toHex()}`,`text-stroke-width: ${t.width}px`,`text-stroke-color: ${ce.shared.setValue(t.color).toHex()}`,"paint-order: stroke"].join(";")}function e1(t,e){for(let r in t){let i=t[r],n=[];for(let s in i)Fh[s]?n.push(Fh[s](i[s])):Gh[s]&&n.push(Gh[s].replace("{{VALUE}}",i[s]));e.push(`${r} { ${n.join(";")} }`)}}var Gh,Fh,t1=_(()=>{De(),Gh={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},Fh={fill:t=>`color: ${ce.shared.setValue(t).toHex()}`,breakWords:t=>`word-wrap: ${t?"break-all":"break-word"}`,stroke:wg,dropShadow:bg}}),Tg,r1=_(()=>{Se(),ms(),Qp(),t1(),Tg=class cy extends si{constructor(e={}){super(e),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=e.cssOverrides),this.tagStyles=e.tagStyles??{}}set cssOverrides(e){this._cssOverrides=e instanceof Array?e:[e],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Kp(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new cy({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=J0(this)),this._cssStyle}addOverride(...e){let r=e.filter(i=>!this.cssOverrides.includes(i));r.length>0&&(this.cssOverrides.push(...r),this.update())}removeOverride(...e){let r=e.filter(i=>this.cssOverrides.includes(i));r.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!r.includes(i)),this.update())}set fill(e){typeof e!="string"&&typeof e!="number"&&Be("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&Be("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}});function i1(t,e){let r=e.fontFamily,i=[],n={},s=/font-family:([^;"\s]+)/g,a=t.match(s);function o(l){n[l]||(i.push(l),n[l]=!0)}if(Array.isArray(r))for(let l=0;l{let h=l.split(":")[1].trim();o(h)});for(let l in e.tagStyles){let h=e.tagStyles[l].fontFamily;o(h)}return i}var n1=_(()=>{"use strict"});async function s1(t){let e=await(await Nt.get().fetch(t)).blob(),r=new FileReader;return await new Promise((i,n)=>{r.onloadend=()=>i(r.result),r.onerror=n,r.readAsDataURL(e)})}var a1=_(()=>{tr()});async function Sg(t,e){let r=await s1(e);return`@font-face { + font-family: "${t.fontFamily}"; + src: url('${r}'); + font-weight: ${t.fontWeight}; + font-style: ${t.fontStyle}; + }`}var o1=_(()=>{a1()});async function l1(t,e,r){let i=t.filter(n=>or.has(`${n}-and-url`)).map((n,s)=>{if(!vs.has(n)){let{url:a}=or.get(`${n}-and-url`);s===0?vs.set(n,Sg({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:n},a)):vs.set(n,Sg({fontWeight:r.fontWeight,fontStyle:r.fontStyle,fontFamily:n},a))}return vs.get(n)});return(await Promise.all(i)).join(` +`)}var vs,h1=_(()=>{la(),o1(),vs=new Map});function u1(t,e,r,i,n){let{domElement:s,styleElement:a,svgRoot:o}=n;s.innerHTML=`
    ${t}
    `,s.setAttribute("style",`transform: scale(${r});transform-origin: top left; display: inline-block`),a.textContent=i;let{width:l,height:h}=n.image;return o.setAttribute("width",l.toString()),o.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(o)}var c1=_(()=>{"use strict"});function d1(t,e){let r=ni.getOptimalCanvasAndContext(t.width,t.height,e),{context:i}=r;return i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),r}var f1=_(()=>{us()});function p1(t,e,r){return new Promise(async i=>{r&&await new Promise(n=>setTimeout(n,100)),t.onload=()=>{i()},t.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(e)}`,t.crossOrigin="anonymous"})}var g1=_(()=>{"use strict"});function m1(t,e,r,i){i||(i=Eg||(Eg=new Oh));let{domElement:n,styleElement:s,svgRoot:a}=i;n.innerHTML=`
    ${t}
    `,n.setAttribute("style","transform-origin: top left; display: inline-block"),r&&(s.textContent=r),document.body.appendChild(a);let o=n.getBoundingClientRect();a.remove();let l=e.padding*2;return{width:o.width-l,height:o.height-l}}var Eg,_1=_(()=>{xg()}),Qa,v1=_(()=>{J(),us(),ji(),gi(),Q0(),Se(),Zt(),tg(),xg(),r1(),n1(),h1(),c1(),f1(),g1(),_1(),Qa=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===Gr.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,i){if(this._activeTextures[i])return this._increaseReferenceCount(i),this._activeTextures[i].promise;let n=this._buildTexturePromise(t,e,r).then(s=>(this._activeTextures[i].texture=s,s));return this._activeTextures[i]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(t,e,r){let i=it.get(Oh),n=i1(t,r),s=await l1(n,r,Tg.defaultTextStyle),a=m1(t,r,s,i),o=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*e),h=i.image,u=2;h.width=(o|0)+u,h.height=(l|0)+u;let c=u1(t,r,e,s,i);await p1(h,c,Z0()&&n.length>0);let f=h,d;this._createCanvas&&(d=d1(h,e));let y=Jp(d?d.canvas:f,h.width-u,h.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(y.source),ni.returnCanvasAndContext(d)),it.return(i),y}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(r=>{e.texture=r,this._cleanUp(e)}).catch(()=>{Be("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){ar.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}},Qa.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"htmlText"},Qa.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}}),Cg=_(()=>{J(),K0(),v1(),xe.add(Qa),xe.add(kh)}),Dh,Ja,Uh=_(()=>{Ki(),Mi(),es(),kt(),Dh=class dy extends Sn{constructor(...e){let r=e[0]??{};r instanceof Float32Array&&(Qe(ot,"use new MeshGeometry({ positions, uvs, indices }) instead"),r={positions:r,uvs:e[1],indices:e[2]}),r={...dy.defaultOptions,...r};let i=r.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=r.uvs;n||(r.positions?n=new Float32Array(i.length):n=new Float32Array([0,0,1,0,1,1,0,1]));let s=r.indices||new Uint32Array([0,1,2,0,2,3]),a=r.shrinkBuffersToFit,o=new yr({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:dt.VERTEX|dt.COPY_DST}),l=new yr({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:dt.VERTEX|dt.COPY_DST}),h=new yr({data:s,label:"index-mesh-buffer",shrinkToFit:a,usage:dt.INDEX|dt.COPY_DST});super({attributes:{aPosition:{buffer:o,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,topology:r.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(e){this.attributes.aPosition.buffer.data=e}get uvs(){return this.attributes.aUV.buffer.data}set uvs(e){this.attributes.aUV.buffer.data=e}get indices(){return this.indexBuffer.data}set indices(e){this.indexBuffer.data=e}},Dh.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1},Ja=Dh}),In,Ag,eo,ys=_(()=>{"use strict";In={name:"local-uniform-bit",vertex:{header:` + + struct LocalUniforms { + uTransformMatrix:mat3x3, + uColor:vec4, + uRound:f32, + } + + @group(1) @binding(0) var localUniforms : LocalUniforms; + `,main:` + vColor *= localUniforms.uColor; + modelMatrix *= localUniforms.uTransformMatrix; + `,end:` + if(localUniforms.uRound == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `}},Ag={...In,vertex:{...In.vertex,header:In.vertex.header.replace("group(1)","group(2)")}},eo={name:"local-uniform-bit",vertex:{header:` + + uniform mat3 uTransformMatrix; + uniform vec4 uColor; + uniform float uRound; + `,main:` + vColor *= uColor; + modelMatrix = uTransformMatrix; + `,end:` + if(uRound == 1.) + { + gl_Position.xy = roundPixels(gl_Position.xy, uResolution); + } + `}}}),Pg,Mg,y1=_(()=>{"use strict";Pg={name:"tiling-bit",vertex:{header:` + struct TilingUniforms { + uMapCoord:mat3x3, + uClampFrame:vec4, + uClampOffset:vec2, + uTextureTransform:mat3x3, + uSizeAnchor:vec4 + }; + + @group(2) @binding(0) var tilingUniforms: TilingUniforms; + @group(2) @binding(1) var uTexture: texture_2d; + @group(2) @binding(2) var uSampler: sampler; + `,main:` + uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy; + + position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy; + `},fragment:{header:` + struct TilingUniforms { + uMapCoord:mat3x3, + uClampFrame:vec4, + uClampOffset:vec2, + uTextureTransform:mat3x3, + uSizeAnchor:vec4 + }; + + @group(2) @binding(0) var tilingUniforms: TilingUniforms; + @group(2) @binding(1) var uTexture: texture_2d; + @group(2) @binding(2) var uSampler: sampler; + `,main:` + + var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV); + coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy; + var unclamped = coord; + coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw); + + var bias = 0.; + + if(unclamped.x == coord.x && unclamped.y == coord.y) + { + bias = -32.; + } + + outColor = textureSampleBias(uTexture, uSampler, coord, bias); + `}},Mg={name:"tiling-bit",vertex:{header:` + uniform mat3 uTextureTransform; + uniform vec4 uSizeAnchor; + + `,main:` + uv = (uTextureTransform * vec3(aUV, 1.0)).xy; + + position = (position - uSizeAnchor.zw) * uSizeAnchor.xy; + `},fragment:{header:` + uniform sampler2D uTexture; + uniform mat3 uMapCoord; + uniform vec4 uClampFrame; + uniform vec2 uClampOffset; + `,main:` + + vec2 coord = vUV + ceil(uClampOffset - vUV); + coord = (uMapCoord * vec3(coord, 1.0)).xy; + vec2 unclamped = coord; + coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); + + outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0 + + `}}}),Lh,Nh,Rg,x1=_(()=>{Ze(),Qi(),ys(),Ji(),ti(),xr(),Dt(),y1(),Rg=class extends jr{constructor(){Lh??(Lh=is({name:"tiling-sprite-shader",bits:[In,Pg,Mn]})),Nh??(Nh=ns({name:"tiling-sprite-shader",bits:[eo,Mg,Rn]}));let t=new ur({uMapCoord:{value:new me,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new me,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:Nh,gpuProgram:Lh,resources:{localUniforms:new ur({uTransformMatrix:{value:new me,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:Fe.EMPTY.source,uSampler:Fe.EMPTY.source.style}})}updateUniforms(t,e,r,i,n,s){let a=this.resources.tilingUniforms,o=s.width,l=s.height,h=s.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*o/t,r.b*o/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=i,a.uniforms.uSizeAnchor[3]=n,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}}),kg,b1=_(()=>{Uh(),kg=class extends Ja{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}});function w1(t,e){let r=t.anchor.x,i=t.anchor.y;e[0]=-r*t.width,e[1]=-i*t.height,e[2]=(1-r)*t.width,e[3]=-i*t.height,e[4]=(1-r)*t.width,e[5]=(1-i)*t.height,e[6]=-r*t.width,e[7]=(1-i)*t.height}var T1=_(()=>{"use strict"});function S1(t,e,r,i){let n=0,s=t.length/(e||2),a=i.a,o=i.b,l=i.c,h=i.d,u=i.tx,c=i.ty;for(r*=e;n{"use strict"});function C1(t,e){let r=t.texture,i=r.frame.width,n=r.frame.height,s=0,a=0;t.applyAnchorToTexture&&(s=t.anchor.x,a=t.anchor.y),e[0]=e[6]=-s,e[2]=e[4]=1-s,e[1]=e[3]=-a,e[5]=e[7]=1-a;let o=me.shared;o.copyFrom(t._tileTransform.matrix),o.tx/=t.width,o.ty/=t.height,o.invert(),o.scale(t.width/i,t.height/n),S1(e,2,0,o)}var A1=_(()=>{Ze(),E1()}),xs,Hh,P1=_(()=>{J(),da(),ii(),gi(),ls(),nh(),Uh(),x1(),b1(),T1(),A1(),xs=new kg,Hh=class{constructor(t){this._state=Fr.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let i=e.canBatch;if(i&&i===r){let{batchableMesh:n}=e;return!n._batcher.checkAndUpdateTexture(n,t.texture)}return r!==i}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let i=this._getTilingSpriteData(t),{geometry:n,canBatch:s}=i;if(s){i.batchableMesh||(i.batchableMesh=new La);let a=i.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=n,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),i.shader||(i.shader=new Rg),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,os(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Jn(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:xs,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:i}=e;t.didViewUpdate&&this._updateBatchableMesh(t),i._batcher.updateElement(i)}else if(t.didViewUpdate){let{shader:i}=e;i.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Ja({indices:xs.indices,positions:xs.positions.slice(),uvs:xs.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,i=t.texture.source.style;i.addressMode!=="repeat"&&(i.addressMode="repeat",i.update()),C1(t,r.uvs),w1(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,i=!0;return this._renderer.type===Gr.WEBGL&&(i=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(i||r.source.isPowerOfTwo),e.canBatch}},Hh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"tilingSprite"}}),Bg=_(()=>{J(),P1(),xe.add(Hh)}),zh,Ig,M1=_(()=>{kt(),Uh(),zh=class fy extends Ja{constructor(...e){super({});let r=e[0]??{};typeof r=="number"&&(Qe(ot,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),r={width:r,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(r)}build(e){e={...fy.defaultOptions,...e},this.verticesX=this.verticesX??e.verticesX,this.verticesY=this.verticesY??e.verticesY,this.width=this.width??e.width,this.height=this.height??e.height;let r=this.verticesX*this.verticesY,i=[],n=[],s=[],a=this.verticesX-1,o=this.verticesY-1,l=this.width/a,h=this.height/o;for(let c=0;c{M1(),jh=class py extends Ig{constructor(e={}){e={...py.defaultOptions,...e},super({width:e.width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,{width:r,height:i,_leftWidth:n,_rightWidth:s,_topHeight:a,_bottomHeight:o,_anchorX:l,_anchorY:h}=this,u=n+s,c=r>u?1:r/u,f=a+o,d=i>f?1:i/f,y=Math.min(c,d),x=l*r,v=h*i;e[0]=e[8]=e[16]=e[24]=-x,e[2]=e[10]=e[18]=e[26]=n*y-x,e[4]=e[12]=e[20]=e[28]=r-s*y-x,e[6]=e[14]=e[22]=e[30]=r-x,e[1]=e[3]=e[5]=e[7]=-v,e[9]=e[11]=e[13]=e[15]=a*y-v,e[17]=e[19]=e[21]=e[23]=i-o*y-v,e[25]=e[27]=e[29]=e[31]=i-v,this.getBuffer("aPosition").update()}updateUvs(){let e=this.uvs;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1;let r=1/this._originalWidth,i=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}},jh.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100},Og=jh}),Vh,k1=_(()=>{J(),Zt(),nh(),R1(),Vh=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];it.return(e.geometry),it.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=it.get(La);return e.geometry=it.get(Og),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}},Vh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"nineSliceSprite"}}),Gg=_(()=>{J(),k1(),xe.add(Vh)}),Wh,B1=_(()=>{J(),Wh=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}},Wh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"filter"}});function I1(t,e){e.clear();let r=e.matrix;for(let i=0;i{"use strict"}),Fg,$h,G1=_(()=>{J(),Ze(),He(),Xi(),es(),xr(),Dt(),ji(),gi(),T(),O1(),Se(),Fg=new Sn({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),$h=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new ur({uInputSize:{value:new Float32Array(4),type:"vec4"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new ei({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let i=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){i.skip=!0;return}let n=i.bounds;if(t.renderables?I1(t.renderables,n):t.filterEffect.filterArea?(n.clear(),n.addRect(t.filterEffect.filterArea),n.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,n),t.container){let f=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;f&&n.applyMatrix(f)}let s=e.renderTarget.renderTarget.colorTexture.source,a=1/0,o=0,l=!0,h=!1,u=!1,c=!0;for(let f=0;f0?this._filterStack[this._filterStackIndex-1].bounds:null,o=t.renderTarget.getRenderTarget(e.previousRenderSurface);n=this.getBackTexture(o,i,a)}e.backTexture=n;let s=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),t.globalUniforms.pop(),s.length===1)s[0].apply(this,r,e.previousRenderSurface,!1),ar.returnTexture(r);else{let a=e.inputTexture,o=ar.getOptimalTexture(i.width,i.height,a.source._resolution,!1),l=0;for(l=0;l0&&this._filterStack[u].skip;)--u;u>0&&(h=this._filterStack[u].inputTexture.source._resolution);let c=this._filterGlobalUniforms,f=c.uniforms,d=f.uOutputFrame,y=f.uInputSize,x=f.uInputPixel,v=f.uInputClamp,w=f.uGlobalFrame,P=f.uOutputTexture;if(l){let L=this._filterStackIndex;for(;L>0;){L--;let N=this._filterStack[this._filterStackIndex-1];if(!N.skip){o.x=N.bounds.minX,o.y=N.bounds.minY;break}}d[0]=a.minX-o.x,d[1]=a.minY-o.y}else d[0]=0,d[1]=0;d[2]=e.frame.width,d[3]=e.frame.height,y[0]=e.source.width,y[1]=e.source.height,y[2]=1/y[0],y[3]=1/y[1],x[0]=e.source.pixelWidth,x[1]=e.source.pixelHeight,x[2]=1/x[0],x[3]=1/x[1],v[0]=.5*x[2],v[1]=.5*x[3],v[2]=e.frame.width*y[2]-.5*x[2],v[3]=e.frame.height*y[3]-.5*x[3];let G=this.renderer.renderTarget.rootRenderTarget.colorTexture;w[0]=o.x*h,w[1]=o.y*h,w[2]=G.source.width*h,w[3]=G.source.height*h;let k=this.renderer.renderTarget.getRenderTarget(r);if(n.renderTarget.bind(r,!!i),r instanceof Fe?(P[0]=r.frame.width,P[1]=r.frame.height):(P[0]=k.width,P[1]=k.height),P[2]=k.isRoot?-1:1,c.update(),n.renderPipes.uniformBatch){let L=n.renderPipes.uniformBatch.getUboResource(c);this._globalFilterBindGroup.setResource(L,0)}else this._globalFilterBindGroup.setResource(c,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:Fg,shader:t,state:t._state,topology:"triangle-list"}),n.type===Gr.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new m,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,i=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),n=e.worldTransform.copyTo(me.shared),s=e.renderGroup||e.parentRenderGroup;return s&&s.cacheToLocalTransform&&n.prepend(s.cacheToLocalTransform),n.invert(),i.prepend(n),i.scale(1/e.texture.frame.width,1/e.texture.frame.height),i.translate(e.anchor.x,e.anchor.y),i}},$h.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"filter"}}),Dg=_(()=>{J(),B1(),G1(),xe.add($h),xe.add(Wh)}),F1={},D1=_(()=>{Ly(),vd(),Wy(),Xy(),Ml(),Gl(),np(),sp(),gp(),ng(),yg(),Cg(),Bg(),Gg(),Dg()}),U1={},L1=_(()=>{vd(),Ml(),Gl(),np(),sp(),gp(),ng(),yg(),Cg(),Bg(),Gg(),Dg()}),Xh,Ug,N1=_(()=>{En(),rs(),ti(),ii(),Xh=class $c extends jr{constructor(e){e={...$c.defaultOptions,...e},super(e),this.enabled=!0,this._state=Fr.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1)}apply(e,r,i,n){e.applyFilter(this,r,i,n)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:r,gl:i,...n}=e,s,a;return r&&(s=Pn.from(r)),i&&(a=Zi.from(i)),new $c({gpuProgram:s,glProgram:a,...n})}},Xh.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0},Ug=Xh});async function H1(t){if(!t)for(let e=0;e{J(),to=[],xe.handleByNamedList(O.Environment,to)});function Lg(){if(typeof bs=="boolean")return bs;try{bs=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{bs=!1}return bs}var bs,Ng=_(()=>{"use strict"}),br,ws=_(()=>{"use strict";br=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(br||{})}),Yh,Hg=_(()=>{"use strict";Yh=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,i,n,s,a,o){let{name:l,items:h}=this;for(let u=0,c=h.length;u{De(),z1(),Zr(),Ng(),kt(),ws(),Hg(),It(),zg=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],qh=class gy extends at{constructor(e){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;let r=[...zg,...this.config.runners??[]];this._addRunners(...r),this._unsafeEvalCheck()}async init(e={}){let r=e.skipExtensionImports===!0?!0:e.manageImports===!1;await H1(r),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)e={...this._systemsHash[i].constructor.defaultOptions,...e};e={...gy.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let i=0;i{this.runners[r]=new Yh(r)})}_addSystems(e){let r;for(r in e){let i=e[r];this._addSystem(i.value,i.name)}}_addSystem(e,r){let i=new e(this);if(this[r])throw new Error(`Whoops! The name "${r}" is already in use`);this[r]=i,this._systemsHash[r]=i;for(let n in this.runners)this.runners[n].add(i);return this}_addPipes(e,r){let i=r.reduce((n,s)=>(n[s.name]=s.value,n),{});e.forEach(n=>{let s=n.value,a=n.name,o=i[a];this.renderPipes[a]=new s(this,o?new o:null)})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),Object.values(this.runners).forEach(r=>{r.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Lg())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}},qh.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1},Ts=qh}),Kh,j1=_(()=>{J(),Ze(),bn(),Ul(),Qi(),Ta(),Ca(),ys(),Ji(),ti(),xr(),Kh=class{init(){let t=new ur({uTransformMatrix:{value:new me,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),e=is({name:"graphics",bits:[ba,$l(xn()),Ag,Mn]});this.shader=new jr({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,i=r.customShader||this.shader,n=t.renderer,s=n.graphicsContext,{batcher:a,instructions:o}=s.getContextRenderData(r),l=n.encoder;l.setGeometry(a.geometry,i.gpuProgram);let h=n.globalUniforms.bindGroup;l.setBindGroup(0,h,i.gpuProgram);let u=n.renderPipes.uniformBatch.getUniformBindGroup(i.resources.localUniforms,!0);l.setBindGroup(2,u,i.gpuProgram);let c=o.instructions,f=null;for(let d=0;d{"use strict";jg={name:"texture-bit",vertex:{header:` + + struct TextureUniforms { + uTextureMatrix:mat3x3, + } + + @group(2) @binding(2) var textureUniforms : TextureUniforms; + `,main:` + uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy; + `},fragment:{header:` + @group(2) @binding(0) var uTexture: texture_2d; + @group(2) @binding(1) var uSampler: sampler; + + + `,main:` + outColor = textureSample(uTexture, uSampler, vUV); + `}},Vg={name:"texture-bit",vertex:{header:` + uniform mat3 uTextureMatrix; + `,main:` + uv = (uTextureMatrix * vec3(uv, 1.0)).xy; + `},fragment:{header:` + uniform sampler2D uTexture; + + + `,main:` + outColor = texture(uTexture, vUV); + `}}}),Zh,V1=_(()=>{J(),Ze(),Qi(),ys(),Ji(),Wg(),ti(),Dt(),Se(),Zh=class{init(){let t=is({name:"mesh",bits:[In,jg,Mn]});this._shader=new jr({gpuProgram:t,resources:{uTexture:Fe.EMPTY._source,uSampler:Fe.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new me}}}})}execute(t,e){let r=t.renderer,i=e._shader;if(!i)i=this._shader,i.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!i.gpuProgram){Be("Mesh shader has no gpuProgram",e.shader);return}let n=i.gpuProgram;if(n.autoAssignGlobalUniforms&&(i.groups[0]=r.globalUniforms.bindGroup),n.autoAssignLocalUniforms){let s=t.localUniforms;i.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(s,!0)}r.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}},Zh.extension={type:[O.WebGPUPipesAdaptor],name:"mesh"}}),Ss,Qh,W1=_(()=>{J(),ii(),Ul(),Ss=Fr.for2d(),Qh=class{start(t,e,r){let i=t.renderer,n=i.encoder,s=r.gpuProgram;this._shader=r,this._geometry=e,n.setGeometry(e,s),Ss.blendMode="normal",i.pipeline.getPipeline(e,s,Ss);let a=i.globalUniforms.bindGroup;n.resetBindGroup(1),n.setBindGroup(0,a,s)}execute(t,e){let r=this._shader.gpuProgram,i=t.renderer,n=i.encoder;if(!e.bindGroup){let o=e.textures;e.bindGroup=Fl(o.textures,o.count)}Ss.blendMode=e.blendMode;let s=i.bindGroup.getBindGroup(e.bindGroup,r,1),a=i.pipeline.getPipeline(this._geometry,r,Ss,e.topology);e.bindGroup._touch(i.textureGC.count),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,s),n.renderPassEncoder.drawIndexed(e.size,1,e.start)}},Qh.extension={type:[O.WebGPUPipesAdaptor],name:"batch"}}),Jh,$1=_(()=>{J(),Jh=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}},Jh.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"customRender"}});function eu(t,e){let r=t.instructionSet,i=r.instructions;for(let n=0;n{"use strict"}),Xg,tu,X1=_(()=>{J(),Ze(),Zt(),Na(),$g(),Xg=new me,tu=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(it.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=it.get(hs));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=Xg.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),eu(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),eu(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}},tu.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"renderGroup"}});function ru(t,e){e||(e=0);for(let r=e;r{"use strict"});function qg(t,e=!1){Y1(t);let r=t.childrenToUpdate,i=t.updateTick++;for(let n in r){let s=Number(n),a=r[n],o=a.list,l=a.index;for(let h=0;h1?1:r,t.worldAlpha=r,t.worldColorAlpha=t.worldColor+((r*255|0)<<24)}function Kg(t,e,r){if(e===t.updateTick)return;t.updateTick=e,t.didChange=!1;let i=t.localTransform;t.updateLocalTransform();let n=t.parent;if(n&&!n.renderGroup?(r|=t._updateFlags,t.relativeGroupTransform.appendFrom(i,n.relativeGroupTransform),r&iu&&Zg(t,n,r)):(r=t._updateFlags,t.relativeGroupTransform.copyFrom(i),r&iu&&Zg(t,Qg,r)),!t.renderGroup){let s=t.children,a=s.length;for(let h=0;h1?1:i,t.groupAlpha=i,t.groupColorAlpha=t.groupColor+((i*255|0)<<24)}r&Qs&&(t.groupBlendMode=t.localBlendMode==="inherit"?e.groupBlendMode:t.localBlendMode),r&gn&&(t.globalDisplayStatus=t.localDisplayStatus&e.globalDisplayStatus),t._updateFlags=0}var Qg,iu,q1=_(()=>{Zr(),Yg(),Re(),Qg=new dr,iu=gn|$n|Qs});function K1(t,e){let{list:r,index:i}=t.childrenRenderablesToUpdate,n=!1;for(let s=0;s{"use strict"}),Jg,nu,Q1=_(()=>{J(),Ze(),ji(),T(),Yg(),$g(),q1(),Z1(),Jg=new me,nu=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,i=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let n=this._renderer,s=Jg;e&&(s=s.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=n.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),eu(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(s),t.parent=r,t.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let i=t.texture;t.texture&&ar.returnTexture(t.texture);let n=this._renderer,s=t.textureOptions.resolution||n.view.resolution,a=t.textureOptions.antialias??n.view.antialias;t.texture=ar.getOptimalTexture(r.width,r.height,s,a),t._textureBounds||(t._textureBounds=new m),t._textureBounds.copyFrom(r),i!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(ar.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?ru(t.childrenRenderablesToUpdate.list,0):K1(t,r),qg(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let i=0;i{J(),Zt(),Na(),su=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];it.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=it.get(hs);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)it.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}},su.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"sprite"}}),Es,em=_(()=>{It(),Es="8.9.2"}),au,ou,tm=_(()=>{J(),em(),au=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Es)}static destroy(){}},au.extension=O.Application,ou=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Es)}destroy(){this._renderer=null}},ou.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"initHook",priority:-10}}),io,lu,ew=_(()=>{J(),ii(),If(),io=class my{constructor(e,r){this.state=Fr.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=r,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let r=this._batchersByInstructionSet[e.uid];r||(r=this._batchersByInstructionSet[e.uid]=Object.create(null),r.default||(r.default=new Aa)),this._activeBatches=r,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(e,r){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(r);let i=this._activeBatches[e.batcherName];i||(i=this._activeBatches[e.batcherName]=my.getBatcher(e.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);let r=this._activeBatches;for(let i in r){let n=r[i],s=n.geometry;s.indexBuffer.setDataWithSize(n.indexBuffer,n.indexSize,!0),s.buffers[0].setDataWithSize(n.attributeBuffer.float32View,n.attributeSize,!1)}}upload(e){let r=this._batchersByInstructionSet[e.uid];for(let i in r){let n=r[i],s=n.geometry;n.dirty&&(n.dirty=!1,s.buffers[0].update(n.attributeSize*4))}}execute(e){if(e.action==="startBatch"){let r=e.batcher,i=r.geometry,n=r.shader;this._adaptor.start(this,i,n)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}},io.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"batch"},io._availableBatchers=Object.create(null),lu=io,xe.handleByMap(O.Batcher,lu._availableBatchers),xe.add(Aa)}),rm,tw=_(()=>{rm=`in vec2 vMaskCoord; +in vec2 vTextureCoord; + +uniform sampler2D uTexture; +uniform sampler2D uMaskTexture; + +uniform float uAlpha; +uniform vec4 uMaskClamp; +uniform float uInverse; + +out vec4 finalColor; + +void main(void) +{ + float clip = step(3.5, + step(uMaskClamp.x, vMaskCoord.x) + + step(uMaskClamp.y, vMaskCoord.y) + + step(vMaskCoord.x, uMaskClamp.z) + + step(vMaskCoord.y, uMaskClamp.w)); + + // TODO look into why this is needed + float npmAlpha = uAlpha; + vec4 original = texture(uTexture, vTextureCoord); + vec4 masky = texture(uMaskTexture, vMaskCoord); + float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a); + + float a = alphaMul * masky.r * npmAlpha * clip; + + if (uInverse == 1.0) { + a = 1.0 - a; + } + + finalColor = original * a; +} +`}),im,rw=_(()=>{im=`in vec2 aPosition; + +out vec2 vTextureCoord; +out vec2 vMaskCoord; + + +uniform vec4 uInputSize; +uniform vec4 uOutputFrame; +uniform vec4 uOutputTexture; +uniform mat3 uFilterMatrix; + +vec4 filterVertexPosition( vec2 aPosition ) +{ + vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; + + position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +vec2 filterTextureCoord( vec2 aPosition ) +{ + return aPosition * (uOutputFrame.zw * uInputSize.zw); +} + +vec2 getFilterCoord( vec2 aPosition ) +{ + return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; +} + +void main(void) +{ + gl_Position = filterVertexPosition(aPosition); + vTextureCoord = filterTextureCoord(aPosition); + vMaskCoord = getFilterCoord(aPosition); +} +`}),hu,iw=_(()=>{hu=`struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct MaskUniforms { + uFilterMatrix:mat3x3, + uMaskClamp:vec4, + uAlpha:f32, + uInverse:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var filterUniforms : MaskUniforms; +@group(1) @binding(1) var uMaskTexture: texture_2d; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + @location(1) filterUv : vec2, +}; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord( aPosition:vec2 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getFilterCoord(aPosition:vec2 ) -> vec2 +{ + return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; +} + +fn getSize() -> vec2 +{ + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition), + getFilterCoord(aPosition) + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @location(1) filterUv: vec2, + @builtin(position) position: vec4 +) -> @location(0) vec4 { + + var maskClamp = filterUniforms.uMaskClamp; + var uAlpha = filterUniforms.uAlpha; + + var clip = step(3.5, + step(maskClamp.x, filterUv.x) + + step(maskClamp.y, filterUv.y) + + step(filterUv.x, maskClamp.z) + + step(filterUv.y, maskClamp.w)); + + var mask = textureSample(uMaskTexture, uSampler, filterUv); + var source = textureSample(uTexture, uSampler, uv); + var alphaMul = 1.0 - uAlpha * (1.0 - mask.a); + + var a: f32 = alphaMul * mask.r * uAlpha * clip; + + if (filterUniforms.uInverse == 1.0) { + a = 1.0 - a; + } + + return source * a; +} +`}),nm,nw=_(()=>{Ze(),En(),rs(),xr(),rd(),N1(),tw(),rw(),iw(),nm=class extends Ug{constructor(t){let{sprite:e,...r}=t,i=new Jo(e.texture),n=new ur({uFilterMatrix:{value:new me,type:"mat3x3"},uMaskClamp:{value:i.uClampFrame,type:"vec4"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),s=Pn.from({vertex:{source:hu,entryPoint:"mainVertex"},fragment:{source:hu,entryPoint:"mainFragment"}}),a=Zi.from({vertex:im,fragment:rm,name:"mask-filter"});super({...r,gpuProgram:s,glProgram:a,resources:{filterUniforms:n,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=i}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,i){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,r,i)}}}),sm,am,uu,sw=_(()=>{J(),fi(),nw(),T(),Q(),Ld(),Zt(),Dt(),ji(),gi(),sm=new m,am=class extends kr{constructor(){super(),this.filters=[new nm({sprite:new oa(Fe.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},uu=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let i=this._renderer;if(i.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let n=t.mask;n.includeInBuild=!0,n.collectRenderables(r,i,null),n.includeInBuild=!1}i.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let i=it.get(am);if(i.inverse=t.inverse,r){t.mask.mask.measurable=!0;let n=q(t.mask.mask,!0,sm);t.mask.mask.measurable=!1,n.ceil();let s=e.renderTarget.renderTarget.colorTexture.source,a=ar.getOptimalTexture(n.width,n.height,s._resolution,s.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:n,worldColor:4294967295});let o=i.sprite;o.texture=a,o.worldTransform.tx=n.minX,o.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:i,maskedContainer:t.maskedContainer,filterTexture:a})}else i.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:i,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let i=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===Gr.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:i.maskedContainer,filterEffect:i.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let i=this._activeMaskStage.pop();r&&ar.returnTexture(i.filterTexture),it.return(i.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}},uu.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"alphaMask"}}),cu,aw=_(()=>{J(),cu=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,r){this._renderer.renderPipes.batch.break(r);let i=this._colorStack;i[this._colorStackIndex]=i[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let i=this._colorStack;this._colorStackIndex--;let n=i[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}},cu.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"colorMask"}}),du,ow=_(()=>{J(),ws(),wn(),du=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var i;let n=t,s=this._renderer;s.renderPipes.batch.break(r),s.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=n.mask;a.includeInBuild=!0,this._maskHash.has(n)||this._maskHash.set(n,{instructionsStart:0,instructionsLength:0});let o=this._maskHash.get(n);o.instructionsStart=r.instructionSize,a.collectRenderables(r,s,null),a.includeInBuild=!1,s.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-o.instructionsStart-1;o.instructionsLength=l;let h=s.renderTarget.renderTarget.uid;(i=this._maskStackHash)[h]??(i[h]=0)}pop(t,e,r){let i=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(i.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let s=this._maskHash.get(t);for(let a=0;a{De(),J(),no=class _y{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ce(0),this.color=this._backgroundColor,this.alpha=1}init(e){e={..._y.defaultOptions,...e},this.clearBeforeRender=e.clearBeforeRender,this.color=e.background||e.backgroundColor||this._backgroundColor,this.alpha=e.backgroundAlpha,this._backgroundColor.setAlpha(e.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}},no.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"background",priority:0},no.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},om=no}),On,fu,hw=_(()=>{J(),fi(),Se(),On={},xe.handle(O.BlendMode,t=>{if(!t.name)throw new Error("BlendMode extension must have a name property");On[t.name]=t.ref},t=>{delete On[t.name]}),fu=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!On[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!On[e]){Be(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new kr,r.filters=[new On[e]]);let i={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}},fu.extension={type:[O.WebGLPipes,O.WebGPUPipes,O.CanvasPipes],name:"blendMode"}}),so,ao,lm,uw=_(()=>{J(),Zr(),Dt(),so={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},ao=class vy{constructor(e){this._renderer=e}_normalizeOptions(e,r={}){return e instanceof dr||e instanceof Fe?{target:e,...r}:{...r,...e}}async image(e){let r=new Image;return r.src=await this.base64(e),r}async base64(e){e=this._normalizeOptions(e,vy.defaultImageOptions);let{format:r,quality:i}=e,n=this.canvas(e);if(n.toBlob!==void 0)return new Promise((s,a)=>{n.toBlob(o=>{if(!o){a(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>s(l.result),l.onerror=a,l.readAsDataURL(o)},so[r],i)});if(n.toDataURL!==void 0)return n.toDataURL(so[r],i);if(n.convertToBlob!==void 0){let s=await n.convertToBlob({type:so[r],quality:i});return new Promise((a,o)=>{let l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(s)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){e=this._normalizeOptions(e);let r=e.target,i=this._renderer;if(r instanceof Fe)return i.texture.generateCanvas(r);let n=i.textureGenerator.generateTexture(e),s=i.texture.generateCanvas(n);return n.destroy(!0),s}pixels(e){e=this._normalizeOptions(e);let r=e.target,i=this._renderer,n=r instanceof Fe?r:i.textureGenerator.generateTexture(e),s=i.texture.getPixels(n);return r instanceof dr&&n.destroy(!0),s}texture(e){return e=this._normalizeOptions(e),e.target instanceof Fe?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);let r=this.canvas(e),i=document.createElement("a");i.download=e.filename??"image.png",i.href=r.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(e){let r=e.width??200;e=this._normalizeOptions(e);let i=this.canvas(e),n=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let s=["font-size: 1px;",`padding: ${r}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}},ao.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"extract"},ao.defaultImageOptions={format:"png",quality:1},lm=ao}),hm,cw=_(()=>{Er(),Dt(),hm=class yy extends Fe{static create(e){return new yy({source:new er(e)})}resize(e,r,i){return this.source.resize(e,r,i),this}}}),um,cm,dm,pu,dw=_(()=>{De(),J(),Ze(),S(),T(),Ot(),Zr(),cw(),um=new b,cm=new m,dm=[0,0,0,0],pu=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof dr&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,i=t.target,n=t.clearColor;n?n=Array.isArray(n)&&n.length===4?n:ce.shared.setValue(n).toArray():n=dm;let s=t.frame?.copyTo(um)||et(i,cm).rectangle;s.width=Math.max(s.width,1/e)|0,s.height=Math.max(s.height,1/e)|0;let a=hm.create({...t.textureSourceOptions,width:s.width,height:s.height,resolution:e,antialias:r}),o=me.shared.translate(-s.x,-s.y);return this._renderer.render({container:i,transform:o,target:a,clearColor:n}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}},pu.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"textureGenerator"}}),gu,fw=_(()=>{J(),Ze(),He(),ls(),Xi(),gi(),xr(),gu=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t"},uWorldTransformMatrix:{value:new me,type:"mat3x3"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4"},uResolution:{value:[0,0],type:"vec2"}},{isStatic:!0})}destroy(){this._renderer=null}},gu.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"globalUniforms"}}),fm,mu,pw=_(()=>{J(),na(),fm=1,mu=class{constructor(){this._tasks=[],this._offset=0}init(){Hr.system.add(this._update,this)}repeat(t,e,r=!0){let i=fm++,n=0;return r&&(this._offset+=1e3,n=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:n,last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e=r.duration){let i=t-r.start;r.func(i),r.last=t}}}destroy(){Hr.system.remove(this._update,this),this._tasks.length=0}},mu.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"scheduler",priority:0}});function gw(t){if(!_u){if(Nt.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let e=[`%c %c %c %c %c PixiJS %c v${Es} (${t}) http://www.pixijs.com/ + +`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${Es} - ${t} - http://www.pixijs.com/`);_u=!0}}var _u,mw=_(()=>{tr(),em(),_u=!1}),oo,_w=_(()=>{J(),mw(),gi(),oo=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===Gr.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),gw(e)}}},oo.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"hello",priority:-2},oo.defaultOptions={hello:!1}});function vw(t){let e=!1;for(let i in t)if(t[i]==null){e=!0;break}if(!e)return t;let r=Object.create(null);for(let i in t){let n=t[i];n&&(r[i]=n)}return r}function yw(t){let e=0;for(let r=0;r{"use strict"}),pm,lo,gm,bw=_(()=>{J(),xw(),pm=0,lo=class xy{constructor(e){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=e}init(e){e={...xy.defaultOptions,...e},this.maxUnusedTime=e.renderableGCMaxUnusedTime,this._frequency=e.renderableGCFrequency,this.enabled=e.renderableGCActive}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let r of this._managedHashes)r.context[r.hash]=vw(r.context[r.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let r of this._managedArrays)yw(r.context[r.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(e,r){this._managedHashes.push({context:e,hash:r})}addManagedArray(e,r){this._managedArrays.push({context:e,hash:r})}prerender({container:e}){this._now=performance.now(),e.renderGroup.gcTick=pm++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}addRenderable(e){this.enabled&&(e._lastUsed===-1&&(this._managedRenderables.push(e),e.once("destroyed",this._removeRenderable,this)),e._lastUsed=this._now)}run(){let e=this._now,r=this._managedRenderables,i=this._renderer.renderPipes,n=0;for(let s=0;sthis.maxUnusedTime){if(!a.destroyed){let h=i;o&&(o.structureDidChange=!0),h[a.renderPipeId].destroyRenderable(a)}a._lastUsed=-1,n++,a.off("destroyed",this._removeRenderable,this)}else r[s-n]=a}r.length-=n}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(e){let r=this._managedRenderables.indexOf(e);r>=0&&(e.off("destroyed",this._removeRenderable,this),this._managedRenderables[r]=null)}_updateInstructionGCTick(e,r){e.instructionSet.gcTick=r;for(let i of e.renderGroupChildren)this._updateInstructionGCTick(i,r)}},lo.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"renderableGC",priority:0},lo.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4},gm=lo}),ho,mm,ww=_(()=>{J(),ho=class by{constructor(e){this._renderer=e,this.count=0,this.checkCount=0}init(e){e={...by.defaultOptions,...e},this.checkCountMax=e.textureGCCheckCountMax,this.maxIdle=e.textureGCAMaxIdle??e.textureGCMaxIdle,this.active=e.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this._renderer.texture.managedTextures;for(let r=0;r-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}},ho.extension={type:[O.WebGLSystem,O.WebGPUSystem],name:"textureGC"},ho.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600},mm=ho}),vu,uo,_m=_(()=>{Wt(),Er(),Dt(),vu=class wy{constructor(e={}){if(this.uid=Mt("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,e={...wy.defaultOptions,...e},this.stencil=e.stencil,this.depth=e.depth,this.isRoot=e.isRoot,typeof e.colorTextures=="number"){this._managedColorTextures=!0;for(let r=0;ri.source)];let r=this.colorTexture.source;this.resize(r.width,r.height,r._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(e.depthStencilTexture||this.stencil)&&(e.depthStencilTexture instanceof Fe||e.depthStencilTexture instanceof er?this.depthStencilTexture=e.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new er({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,r,i=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach((s,a)=>{n&&a===0||s.source.resize(e,r,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,r,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(e=>{e.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}},vu.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1},uo=vu});function vm(t,e){if(!Gn.has(t)){let r=new Fe({source:new Jr({resource:t,...e})}),i=()=>{Gn.get(t)===r&&Gn.delete(t)};r.once("destroy",i),r.source.once("destroy",i),Gn.set(t,r)}return Gn.get(t)}var Gn,ym=_(()=>{Zn(),Dt(),Gn=new Map}),co,xm,Tw=_(()=>{tr(),J(),S(),kt(),_m(),ym(),co=class Ty{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(e){e={...Ty.defaultOptions,...e},e.view&&(Qe(ot,"ViewSystem.view has been renamed to ViewSystem.canvas"),e.canvas=e.view),this.screen=new b(0,0,e.width,e.height),this.canvas=e.canvas||Nt.get().createCanvas(),this.antialias=!!e.antialias,this.texture=vm(this.canvas,e),this.renderTarget=new uo({colorTextures:[this.texture],depth:!!e.depth,isRoot:!0}),this.texture.source.transparent=e.backgroundAlpha<1,this.resolution=e.resolution}resize(e,r,i){this.texture.source.resize(e,r,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){(typeof e=="boolean"?e:e?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}},co.extension={type:[O.WebGLSystem,O.WebGPUSystem,O.CanvasSystem],name:"view",priority:0},co.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1},xm=co}),yu,xu,bm=_(()=>{$1(),X1(),Q1(),J1(),tm(),ew(),sw(),aw(),ow(),lw(),hw(),uw(),dw(),fw(),pw(),_w(),bw(),ww(),Tw(),yu=[om,gu,oo,xm,nu,mm,pu,lm,ou,gm,mu],xu=[fu,lu,su,tu,uu,du,cu,Jh]}),bu,Sw=_(()=>{J(),bu=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let i=this._gpu.device,n=e.layout[r],s=[],a=this._renderer;for(let h in n){let u=t.resources[h]??t.resources[n[h]],c;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let d=f.buffer;c={buffer:a.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;c={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;c={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;c=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;c=a.texture.getGpuSource(f).createView({})}s.push({binding:n[h],resource:c})}let o=a.shader.getProgramData(e).bindGroups[r],l=i.createBindGroup({layout:o,entries:s});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}},bu.extension={type:[O.WebGPUSystem],name:"bindGroup"}}),wu,Ew=_(()=>{J(),ef(),wu=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Ll(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}},wu.extension={type:[O.WebGPUSystem],name:"buffer"}}),Tu,Cw=_(()=>{J(),Tu=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}},Tu.extension={type:[O.WebGPUSystem],name:"colorMask"}}),fo,Aw=_(()=>{tr(),J(),fo=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await Nt.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),i=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:i}}destroy(){this.gpu=null,this._renderer=null}},fo.extension={type:[O.WebGPUSystem],name:"device"},fo.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}}),Su,Pw=_(()=>{J(),Su=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,r,i){let n=this._renderer.pipeline.getPipeline(t,e,r,i);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let i=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,i)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let i in r)this._setVertexBuffer(i,t.attributes[r[i]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let i=t.groups[r];e||this._syncBindGroup(i),this.setBindGroup(r,i,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:i,topology:n,size:s,start:a,instanceCount:o,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,i,n),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(s||e.indexBuffer.data.length,o??e.instanceCount,a||0):this.renderPassEncoder.draw(s||e.getSize(),o??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},i=this._boundIndexBuffer,n={...this._boundBindGroup};this._clearCache();let s=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(s.x,s.y,s.width,s.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(i)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}},Su.extension={type:[O.WebGPUSystem],name:"encoder",priority:1}}),Eu,Mw=_(()=>{J(),wn(),Eu=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:$t.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let i=this._renderer;i.pipeline.setStencilMode(t),i.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}},Eu.extension={type:[O.WebGPUSystem],name:"stencil"}}),Cu,wm=_(()=>{Ng(),Ki(),Mi(),Cu=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!Lg())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new yr({data:new Float32Array(e.layout.size/4),usage:dt.UNIFORM|dt.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let i=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),n=this._adaptor.createUboElements(i),s=this._generateUboSync(n.uboElements);r=this._syncFunctionHash[e]={layout:n,syncFunction:s}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let i=this.getUniformGroupData(t);t.buffer||(t.buffer=new yr({data:new Float32Array(i.layout.size/4),usage:dt.UNIFORM|dt.COPY_DST}));let n=null;return e||(e=t.buffer.data,n=t.buffer.dataInt32),r||(r=0),i.syncFunction(t.uniforms,e,n,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function Rw(t){let e=t.map(i=>({data:i,offset:0,size:0})),r=0;for(let i=0;i1&&(s=Math.max(s,a)*n.data.size),r=Math.ceil(r/a)*a,n.size=s,n.offset=r,r+=s}return r=Math.ceil(r/16)*16,{uboElements:e,size:r}}var Cs,Tm=_(()=>{"use strict";Cs={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}}}),Ii,Sm=_(()=>{"use strict";Ii=[{type:"mat3x3",test:t=>t.value.a!==void 0,ubo:` + var matrix = uv[name].toArray(true); + data[offset] = matrix[0]; + data[offset + 1] = matrix[1]; + data[offset + 2] = matrix[2]; + data[offset + 4] = matrix[3]; + data[offset + 5] = matrix[4]; + data[offset + 6] = matrix[5]; + data[offset + 8] = matrix[6]; + data[offset + 9] = matrix[7]; + data[offset + 10] = matrix[8]; + `,uniform:` + gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true)); + `},{type:"vec4",test:t=>t.type==="vec4"&&t.size===1&&t.value.width!==void 0,ubo:` + v = uv[name]; + data[offset] = v.x; + data[offset + 1] = v.y; + data[offset + 2] = v.width; + data[offset + 3] = v.height; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) { + cv[0] = v.x; + cv[1] = v.y; + cv[2] = v.width; + cv[3] = v.height; + gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height); + } + `},{type:"vec2",test:t=>t.type==="vec2"&&t.size===1&&t.value.x!==void 0,ubo:` + v = uv[name]; + data[offset] = v.x; + data[offset + 1] = v.y; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.x || cv[1] !== v.y) { + cv[0] = v.x; + cv[1] = v.y; + gl.uniform2f(ud[name].location, v.x, v.y); + } + `},{type:"vec4",test:t=>t.type==="vec4"&&t.size===1&&t.value.red!==void 0,ubo:` + v = uv[name]; + data[offset] = v.red; + data[offset + 1] = v.green; + data[offset + 2] = v.blue; + data[offset + 3] = v.alpha; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + cv[3] = v.alpha; + gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha); + } + `},{type:"vec3",test:t=>t.type==="vec3"&&t.size===1&&t.value.red!==void 0,ubo:` + v = uv[name]; + data[offset] = v.red; + data[offset + 1] = v.green; + data[offset + 2] = v.blue; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + gl.uniform3f(ud[name].location, v.red, v.green, v.blue); + } + `}]});function Em(t,e,r,i){let n=[` + var v = null; + var v2 = null; + var t = 0; + var index = 0; + var name = null; + var arrayOffset = null; + `],s=0;for(let o=0;o1)c=l.offset/4,n.push(r(l,c-s));else{let f=i[l.data.type];c=l.offset/4,n.push(` + v = uv.${h}; + offset += ${c-s}; + ${f}; + `)}s=c}let a=n.join(` +`);return new Function("uv","data","dataInt32","offset",a)}var Cm=_(()=>{Sm()});function Fn(t,e){return` + for (let i = 0; i < ${t*e}; i++) { + data[offset + (((i / ${t})|0) * 4) + (i % ${t})] = v[i]; + } + `}var Au,Am,Pm=_(()=>{"use strict";Au={f32:` + data[offset] = v;`,i32:` + dataInt32[offset] = v;`,"vec2":` + data[offset] = v[0]; + data[offset + 1] = v[1];`,"vec3":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2];`,"vec4":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 3] = v[3];`,"vec2":` + dataInt32[offset] = v[0]; + dataInt32[offset + 1] = v[1];`,"vec3":` + dataInt32[offset] = v[0]; + dataInt32[offset + 1] = v[1]; + dataInt32[offset + 2] = v[2];`,"vec4":` + dataInt32[offset] = v[0]; + dataInt32[offset + 1] = v[1]; + dataInt32[offset + 2] = v[2]; + dataInt32[offset + 3] = v[3];`,"mat2x2":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 4] = v[2]; + data[offset + 5] = v[3];`,"mat3x3":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 4] = v[3]; + data[offset + 5] = v[4]; + data[offset + 6] = v[5]; + data[offset + 8] = v[6]; + data[offset + 9] = v[7]; + data[offset + 10] = v[8];`,"mat4x4":` + for (let i = 0; i < 16; i++) { + data[offset + i] = v[i]; + }`,"mat3x2":Fn(3,2),"mat4x2":Fn(4,2),"mat2x3":Fn(2,3),"mat4x3":Fn(4,3),"mat2x4":Fn(2,4),"mat3x4":Fn(3,4)},Am={...Au,"mat2x2":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 3] = v[3]; + `}});function kw(t,e){let{size:r,align:i}=Cs[t.data.type],n=(i-r)/4,s=t.data.type.indexOf("i32")>=0?"dataInt32":"data";return` + v = uv.${t.data.name}; + ${e!==0?`offset += ${e};`:""} + + arrayOffset = offset; + + t = 0; + + for(var i=0; i < ${t.data.size*(r/4)}; i++) + { + for(var j = 0; j < ${r/4}; j++) + { + ${s}[arrayOffset++] = v[t++]; + } + ${n!==0?`arrayOffset += ${n};`:""} + } + `}var Bw=_(()=>{Tm()});function Iw(t){return Em(t,"uboWgsl",kw,Am)}var Ow=_(()=>{Cm(),Pm(),Bw()}),Pu,Gw=_(()=>{J(),wm(),Tm(),Ow(),Pu=class extends Cu{constructor(){super({createUboElements:Rw,generateUboSync:Iw})}},Pu.extension={type:[O.WebGPUSystem],name:"ubo"}}),po,Mu=_(()=>{It(),Wt(),po=class extends at{constructor({buffer:t,offset:e,size:r}){super(),this.uid=Mt("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=Mt("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=Mt("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}}),Mm,Fw=_(()=>{"use strict";Mm=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r{J(),Ki(),Mu(),Mi(),Fw(),Xi(),mi=128,Ru=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new Mm({minUniformOffsetAlignment:mi});let e=256/mi;for(let r=0;r{Se(),Cn()}),_i,Bm=_(()=>{wn(),_i=[],_i[$t.NONE]=void 0,_i[$t.DISABLED]={stencilWriteMask:0,stencilReadMask:0},_i[$t.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},_i[$t.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},_i[$t.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},_i[$t.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function Lw(t,e,r,i,n){return t<<24|e<<16|r<<10|i<<5|n}function Nw(t,e,r,i){return r<<6|t<<3|i<<1|e}var Im,ku,Hw=_(()=>{J(),Se(),km(),wn(),ga(),Bm(),Im={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4},ku=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode($t.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=_i[t],this._updatePipeHash())}setPipeline(t,e,r,i){let n=this.getPipeline(t,e,r);i.setPipeline(n)}getPipeline(t,e,r,i){t._layoutKey||(Rm(t,e.attributeData),this._generateBufferKey(t)),i||(i=t.topology);let n=Lw(t._layoutKey,e._layoutKey,r.data,r._blendModeId,Im[i]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(t,e,r,i),this._pipeCache[n])}_createPipeline(t,e,r,i){let n=this._gpu.device,s=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===$t.RENDERING_MASK_ADD?0:this._colorMask;let o=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:s},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:i,cullMode:r.cullMode},layout:o,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),n.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,i=Object.keys(t.attributes).sort();for(let s=0;s{let s={arrayStride:0,stepMode:"vertex",attributes:[]},a=s.attributes;for(let o in e.attributeData){let l=t.attributes[o];(l.divisor??1)!==1&&Be(`Attribute ${o} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===n&&(s.arrayStride=l.stride,s.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[o].location,offset:l.offset,format:l.format}))}a.length&&i.push(s)}),this._bufferLayoutsCache[r]=i,i}_updatePipeHash(){let t=Nw(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}},ku.extension={type:[O.WebGPUSystem],name:"pipeline"}});function zw(t,e,r,i,n,s){let a=s?1:-1;return t.identity(),t.a=1/i*2,t.d=a*(1/n*2),t.tx=-1-e*t.a,t.ty=-a-r*t.d,t}var jw=_(()=>{"use strict"});function Vw(t){let e=t.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}var Ww=_(()=>{"use strict"}),Bu,Om=_(()=>{Ze(),S(),ws(),jw(),Hg(),Zn(),Er(),Dt(),ym(),Ww(),_m(),Bu=class{constructor(t){this.rootViewPort=new b,this.viewport=new b,this.onRenderTargetChange=new Yh("onRenderTargetChange"),this.projectionMatrix=new me,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:i}){this._renderTargetStack.length=0,this.push(t,e,r,i),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=Vw(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,i){let n=this.getRenderTarget(t),s=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=t;let a=this.getGpuRenderTarget(n);(n.pixelWidth!==a.width||n.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(n),a.width=n.pixelWidth,a.height=n.pixelHeight);let o=n.colorTexture,l=this.viewport,h=o.pixelWidth,u=o.pixelHeight;if(!i&&t instanceof Fe&&(i=t.frame),i){let c=o._resolution;l.x=i.x*c+.5|0,l.y=i.y*c+.5|0,l.width=i.width*c+.5|0,l.height=i.height*c+.5|0}else l.x=0,l.y=0,l.width=h,l.height=u;return zw(this.projectionMatrix,0,0,l.width/o.resolution,l.height/o.resolution,!n.isRoot),this.adaptor.startRenderPass(n,e,r,l),s&&this.onRenderTargetChange.emit(n),n}clear(t,e=br.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=br.ALL,r,i){let n=this.bind(t,e,r,i);return this._renderTargetStack.push({renderTarget:n,frame:i}),n}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,i,n){r.x<0&&(i.width+=r.x,n.x-=r.x,r.x=0),r.y<0&&(i.height+=r.y,n.y-=r.y,r.y=0);let{pixelWidth:s,pixelHeight:a}=t;return i.width=Math.min(i.width,s-r.x),i.height=Math.min(i.height,a-r.y),this.adaptor.copyToTexture(t,e,r,i,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return Jr.test(t)&&(t=vm(t).source),t instanceof uo?e=t:t instanceof er&&(e=new uo({colorTextures:[t]}),Jr.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}}),Gm,$w=_(()=>{"use strict";Gm=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}}),Fm,Xw=_(()=>{ws(),Zn(),Er(),$w(),Fm=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,i,n){let s=this._renderer,a=this._getGpuColorTexture(t),o=s.texture.getGpuSource(e.source);return s.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:o,origin:n},i),e}startRenderPass(t,e=!0,r,i){let n=this._renderTargetSystem.getGpuRenderTarget(t),s=this.getDescriptor(t,e,r);n.descriptor=s,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(i)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?br.ALL:br.NONE);let i=this._renderTargetSystem,n=i.getGpuRenderTarget(t),s=t.colorTextures.map((o,l)=>{let h=n.contexts[l],u,c;h?u=h.getCurrentTexture().createView():u=this._renderer.texture.getGpuSource(o).createView({mipLevelCount:1}),n.msaaTextures[l]&&(c=u,u=this._renderer.texture.getTextureView(n.msaaTextures[l]));let f=e&br.COLOR?"clear":"load";return r??(r=i.defaultClearColor),{view:u,resolveTarget:c,clearValue:r,storeOp:"store",loadOp:f}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=n.msaa?4:1),t.depthStencilTexture){let o=e&br.STENCIL?"clear":"load",l=e&br.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:o,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"}}return{colorAttachments:s,depthStencilAttachment:a}}clear(t,e=!0,r,i){if(!e)return;let{gpu:n,encoder:s}=this._renderer,a=n.device;if(s.commandEncoder===null){let o=a.createCommandEncoder(),l=this.getDescriptor(t,e,r),h=o.beginRenderPass(l);h.setViewport(i.x,i.y,i.width,i.height,0,1),h.end();let u=o.finish();a.queue.submit([u])}else this.startRenderPass(t,e,r,i)}initGpuRenderTarget(t){t.isRoot=!0;let e=new Gm;return t.colorTextures.forEach((r,i)=>{if(Jr.test(r.resource)){let n=r.resource.getContext("webgpu"),s=r.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:s})}catch(a){console.error(a)}e.contexts[i]=n}if(e.msaa=r.source.antialias,r.source.antialias){let n=new er({width:0,height:0,sampleCount:4});e.msaaTextures[i]=n}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,i)=>{e.msaaTextures[i]?.resize(r.source.width,r.source.height,r.source._resolution)})}}}),Iu,Yw=_(()=>{J(),Om(),Xw(),Iu=class extends Bu{constructor(t){super(t),this.adaptor=new Fm,this.adaptor.init(t,this)}},Iu.extension={type:[O.WebGPUSystem],name:"renderTarget"}}),Ou,qw=_(()=>{J(),Ou=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),i={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(i)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}},Ou.extension={type:[O.WebGPUSystem],name:"shader"}}),fr,Kw=_(()=>{"use strict";fr={},fr.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},fr.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},fr.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},fr.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},fr.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},fr.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},fr["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},fr["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},fr["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},fr.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},fr.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},fr.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}}),Gu,Zw=_(()=>{J(),ii(),Kw(),Gu=class{constructor(){this.defaultState=new Fr,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:fr[t.blendMode]||fr.normal}]}destroy(){this.gpu=null}},Gu.extension={type:[O.WebGPUSystem],name:"state"}}),Dm,Qw=_(()=>{"use strict";Dm={type:"image",upload(t,e,r){let i=t.resource,n=(t.pixelWidth|0)*(t.pixelHeight|0),s=i.byteLength/n;r.device.queue.writeTexture({texture:e},i,{offset:0,rowsPerImage:t.pixelHeight,bytesPerRow:t.pixelHeight*s},{width:t.pixelWidth,height:t.pixelHeight,depthOrArrayLayers:1})}}}),Fu,Um,Lm,Jw=_(()=>{"use strict";Fu={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},Um={blockBytes:4,blockWidth:1,blockHeight:1},Lm={type:"compressed",upload(t,e,r){let i=t.pixelWidth,n=t.pixelHeight,s=Fu[t.format]||Um;for(let a=0;a>1,1),n=Math.max(n>>1,1)}}}}),Du,Nm=_(()=>{"use strict";Du={type:"image",upload(t,e,r){let i=t.resource;if(!i)return;let n=Math.min(e.width,t.resourceWidth||t.pixelWidth),s=Math.min(e.height,t.resourceHeight||t.pixelHeight),a=t.alphaMode==="premultiply-alpha-on-upload";r.device.queue.copyExternalImageToTexture({source:i},{texture:e,premultipliedAlpha:a},{width:n,height:s})}}}),Hm,eT=_(()=>{Nm(),Hm={type:"video",upload(t,e,r){Du.upload(t,e,r)}}}),zm,tT=_(()=>{"use strict";zm=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:` + var pos : array, 3> = array, 3>( + vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0)); + + struct VertexOutput { + @builtin(position) position : vec4, + @location(0) texCoord : vec2, + }; + + @vertex + fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { + var output : VertexOutput; + output.texCoord = pos[vertexIndex] * vec2(0.5, -0.5) + vec2(0.5); + output.position = vec4(pos[vertexIndex], 0.0, 1.0); + return output; + } + + @group(0) @binding(0) var imgSampler : sampler; + @group(0) @binding(1) var img : texture_2d; + + @fragment + fn fragmentMain(@location(0) texCoord : vec2) -> @location(0) vec4 { + return textureSample(img, imgSampler, texCoord); + } + `})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t,i=t.depthOrArrayLayers||1,n=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){let o={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:i},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(o)}let s=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let o=0;o{tr(),J(),xr(),us(),Xi(),Qw(),Jw(),Nm(),eT(),tT(),Uu=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:Du,buffer:Dm,video:Hm,compressed:Lm},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let o=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(o))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=Fu[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},i=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,n=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,s={label:t.label,size:{width:i,height:n},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(s);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new zm(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new ei({0:e,1:e.style,2:new ur({uTextureMatrix:{type:"mat3x3",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),i=Nt.get().createCanvas();i.width=t.source.pixelWidth,i.height=t.source.pixelHeight;let n=i.getContext("webgpu");return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:Nt.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:i.width,height:i.height}),e.gpu.device.queue.submit([r.finish()]),i}getPixels(t){let e=this.generateCanvas(t),r=ni.getOptimalCanvasAndContext(e.width,e.height),i=r.context;i.drawImage(e,0,0);let{width:n,height:s}=e,a=i.getImageData(0,0,n,s),o=new Uint8ClampedArray(a.data.buffer);return ni.returnCanvasAndContext(r),{pixels:o,width:n,height:s}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}},Uu.extension={type:[O.WebGPUSystem],name:"texture"}}),jm={};Ft(jm,{WebGPURenderer:()=>Xm});var Vm,Wm,$m,Lu,Nu,Hu,Xm,iT=_(()=>{J(),j1(),V1(),W1(),ro(),bm(),gi(),Sw(),Ew(),Cw(),Aw(),Pw(),Mw(),Gw(),Dw(),Hw(),Yw(),qw(),Zw(),rT(),Vm=[...yu,Pu,Su,fo,wu,Uu,Iu,Ou,Gu,ku,Tu,Eu,bu],Wm=[...xu,Ru],$m=[Qh,Zh,Kh],Lu=[],Nu=[],Hu=[],xe.handleByNamedList(O.WebGPUSystem,Lu),xe.handleByNamedList(O.WebGPUPipes,Nu),xe.handleByNamedList(O.WebGPUPipesAdaptor,Hu),xe.add(...Vm,...Wm,...$m),Xm=class extends Ts{constructor(){let t={name:"webgpu",type:Gr.WEBGPU,systems:Lu,renderPipes:Nu,renderPipeAdaptors:Hu};super(t)}}}),zu,nT=_(()=>{J(),Ze(),bn(),Qi(),Ta(),Ca(),ys(),Ji(),Ql(),ti(),xr(),zu=class{init(){let t=new ur({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new me,type:"mat3x3"},uRound:{value:0,type:"f32"}}),e=xn(),r=ns({name:"graphics",bits:[wa,Xl(e),eo,Rn]});this.shader=new jr({glProgram:r,resources:{localUniforms:t,batchSamplers:Kl(e)}})}execute(t,e){let r=e.context,i=r.customShader||this.shader,n=t.renderer,s=n.graphicsContext,{batcher:a,instructions:o}=s.getContextRenderData(r);i.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(i),n.geometry.bind(a.geometry,i.glProgram);let l=o.instructions;for(let h=0;h{J(),Ze(),Qi(),ys(),Ji(),Wg(),ti(),Dt(),Se(),ju=class{init(){let t=ns({name:"mesh",bits:[eo,Vg,Rn]});this._shader=new jr({glProgram:t,resources:{uTexture:Fe.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new me}}}})}execute(t,e){let r=t.renderer,i=e._shader;if(i){if(!i.glProgram){Be("Mesh shader has no glProgram",e.shader);return}}else{i=this._shader;let n=e.texture,s=n.source;i.resources.uTexture=s,i.resources.uSampler=s.style,i.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}i.groups[100]=r.globalUniforms.bindGroup,i.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}},ju.extension={type:[O.WebGLPipesAdaptor],name:"mesh"}}),Vu,aT=_(()=>{J(),ii(),Vu=class{constructor(){this._tempState=Fr.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let i=t.renderer,n=this._didUploadHash[r.uid];i.shader.bind(r,n),n||(this._didUploadHash[r.uid]=!0),i.shader.updateUniformGroup(i.globalUniforms.uniformGroup),i.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let i=e.textures.textures;for(let n=0;n{"use strict";As=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(As||{})}),Ym,lT=_(()=>{"use strict";Ym=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}}),Wu,hT=_(()=>{J(),Mi(),oT(),lT(),Wu=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,i=this._nextBindBaseIndex;for(;r<2;){i>=this._maxBindings&&(i=this._minBaseLocation,r++);let n=this._boundBufferBases[i];if(n&&n._lastBindCallId===this._bindCallId){i++;continue}break}return e=i,this._nextBindBaseIndex=i+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,i){let{_gl:n}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,n.bindBufferRange(n.UNIFORM_BUFFER,e||0,t.buffer,r*256,i||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let i=t.data,n=t.descriptor.usage&dt.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return i?r.byteLength>=i.byteLength?e.bufferSubData(r.type,0,i,0,t._updateSize/i.BYTES_PER_ELEMENT):(r.byteLength=i.byteLength,e.bufferData(r.type,i,n)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,n)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],i=this._gl;e||i.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=As.ARRAY_BUFFER;t.descriptor.usage&dt.INDEX?r=As.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&dt.UNIFORM&&(r=As.UNIFORM_BUFFER);let i=new Ym(e.createBuffer(),r);return this._gpuBuffers[t.uid]=i,t.on("destroy",this.onBufferDestroy,this),i}resetState(){this._boundBufferBases=Object.create(null)}},Wu.extension={type:[O.WebGLSystem],name:"buffer"}}),go,qm,uT=_(()=>{tr(),J(),Se(),go=class Sy{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...Sy.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(Be("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=Nt.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{let i=this._renderer.background.alpha<1,n=e.premultipliedAlpha??!0,s=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:i,premultipliedAlpha:n,antialias:s,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&Be("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:r}=this;(r.width{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){let r=e.getContextAttributes();r&&!r.stencil&&Be("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,n=this.webGLVersion===2,s=this.extensions;i.uint32Indices=n||!!s.uint32ElementIndex,i.uniformBufferObject=n,i.vertexArrayObject=n||!!s.vertexArrayObject,i.srgbTextures=n||!!s.srgb,i.nonPowOf2wrapping=n,i.nonPowOf2mipmaps=n,i.msaa=n,i.uint32Indices||Be("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}},go.extension={type:[O.WebGLSystem],name:"context"},go.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1},qm=go}),mo,$u,vt,Km=_(()=>{"use strict";mo=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(mo||{}),$u=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))($u||{}),vt=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(vt||{})});function cT(t){return Xu[t]??Xu.float32}var Xu,dT=_(()=>{Km(),Xu={uint8x2:vt.UNSIGNED_BYTE,uint8x4:vt.UNSIGNED_BYTE,sint8x2:vt.BYTE,sint8x4:vt.BYTE,unorm8x2:vt.UNSIGNED_BYTE,unorm8x4:vt.UNSIGNED_BYTE,snorm8x2:vt.BYTE,snorm8x4:vt.BYTE,uint16x2:vt.UNSIGNED_SHORT,uint16x4:vt.UNSIGNED_SHORT,sint16x2:vt.SHORT,sint16x4:vt.SHORT,unorm16x2:vt.UNSIGNED_SHORT,unorm16x4:vt.UNSIGNED_SHORT,snorm16x2:vt.SHORT,snorm16x4:vt.SHORT,float16x2:vt.HALF_FLOAT,float16x4:vt.HALF_FLOAT,float32:vt.FLOAT,float32x2:vt.FLOAT,float32x3:vt.FLOAT,float32x4:vt.FLOAT,uint32:vt.UNSIGNED_INT,uint32x2:vt.UNSIGNED_INT,uint32x3:vt.UNSIGNED_INT,uint32x4:vt.UNSIGNED_INT,sint32:vt.INT,sint32x2:vt.INT,sint32x3:vt.INT,sint32x4:vt.INT}}),Zm,Yu,fT=_(()=>{J(),Cn(),km(),dT(),Zm={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Yu=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=i=>e.bindVertexArrayOES(i),t.deleteVertexArray=i=>e.deleteVertexArrayOES(i));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(i,n,s,a)=>{r.drawArraysInstancedANGLE(i,n,s,a)},t.drawElementsInstanced=(i,n,s,a,o)=>{r.drawElementsInstancedANGLE(i,n,s,a,o)},t.vertexAttribDivisor=(i,n)=>r.vertexAttribDivisorANGLE(i,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let i=this.getVao(t,e);this._activeVao!==i&&(this._activeVao=i,r.bindVertexArray(i)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r1?n.drawElementsInstanced(a,e||s.indexBuffer.data.length,l,(r||0)*o,i):n.drawElements(a,e||s.indexBuffer.data.length,l,(r||0)*o)}else i>1?n.drawArraysInstanced(a,r||0,e||s.getSize(),i):n.drawArrays(a,r||0,e||s.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}},Yu.extension={type:[O.WebGLSystem],name:"geometry"}}),Qm,_o,Jm,pT=_(()=>{J(),Se(),es(),ti(),ii(),Er(),Dt(),En(),Qm=new Sn({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),_o=class Ey{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){let{useBackBuffer:r,antialias:i}={...Ey.defaultOptions,...e};this.useBackBuffer=r,this._antialias=i,this._renderer.context.supports.msaa||(Be("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Fr.for2d();let n=new Zi({vertex:` + attribute vec2 aPosition; + out vec2 vUv; + + void main() { + gl_Position = vec4(aPosition, 0.0, 1.0); + + vUv = (aPosition + 1.0) / 2.0; + + // flip dem UVs + vUv.y = 1.0 - vUv.y; + }`,fragment:` + in vec2 vUv; + out vec4 finalColor; + + uniform sampler2D uTexture; + + void main() { + finalColor = texture(uTexture, vUv); + }`,name:"big-triangle"});this._bigTriangleShader=new jr({glProgram:n,resources:{uTexture:Fe.WHITE.source}})}renderStart(e){let r=this._renderer.renderTarget.getRenderTarget(e.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!r.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(e.target);this._targetTexture=i.colorTexture,e.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let e=this._renderer;e.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(e.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,e.encoder.draw({geometry:Qm,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(e){return this._backBufferTexture=this._backBufferTexture||new Fe({source:new er({width:e.width,height:e.height,resolution:e._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(e.width,e.height,e._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}},_o.extension={type:[O.WebGLSystem],name:"backBuffer",priority:1},_o.defaultOptions={useBackBuffer:!1},Jm=_o}),qu,gT=_(()=>{J(),qu=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}},qu.extension={type:[O.WebGLSystem],name:"colorMask"}}),Ku,mT=_(()=>{J(),Ku=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:r,shader:i,state:n,skipSync:s,topology:a,size:o,start:l,instanceCount:h}=t;e.shader.bind(i,s),e.geometry.bind(r,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(a,o,l,h??r.instanceCount)}destroy(){this._renderer=null}},Ku.extension={type:[O.WebGLSystem],name:"encoder"}}),Zu,_T=_(()=>{J(),Bm(),wn(),Zu=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:$t.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:$t.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=$t.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],i=this._gl,n=_i[t],s=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===$t.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,i.disable(i.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,i.enable(i.STENCIL_TEST)),(t!==s.stencilMode||s.stencilReference!==e)&&(s.stencilMode=t,s.stencilReference=e,i.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),i.stencilOp(i.KEEP,i.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}},Zu.extension={type:[O.WebGLSystem],name:"stencil"}});function vT(t){let e=t.map(s=>({data:s,offset:0,size:0})),r=16,i=0,n=0;for(let s=0;s1&&(i=Math.max(i,r)*a.data.size);let o=i===12?16:i;a.size=i;let l=n%r;l>0&&r-l{"use strict";Qu={f32:4,i32:4,"vec2":8,"vec3":12,"vec4":16,"vec2":8,"vec3":12,"vec4":16,"mat2x2":32,"mat3x3":48,"mat4x4":64}});function yT(t,e){let r=Math.max(Qu[t.data.type]/16,1),i=t.data.value.length/t.data.size,n=(4-i%4)%4,s=t.data.type.indexOf("i32")>=0?"dataInt32":"data";return` + v = uv.${t.data.name}; + offset += ${e}; + + arrayOffset = offset; + + t = 0; + + for(var i=0; i < ${t.data.size*r}; i++) + { + for(var j = 0; j < ${i}; j++) + { + ${s}[arrayOffset++] = v[t++]; + } + ${n!==0?`arrayOffset += ${n};`:""} + } + `}var xT=_(()=>{e_()});function bT(t){return Em(t,"uboStd40",yT,Au)}var wT=_(()=>{Cm(),Pm(),xT()}),Ju,TT=_(()=>{J(),wm(),e_(),wT(),Ju=class extends Cu{constructor(){super({createUboElements:vT,generateUboSync:bT})}},Ju.extension={type:[O.WebGLSystem],name:"ubo"}}),t_,ST=_(()=>{"use strict";t_=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}}),r_,ET=_(()=>{S(),Se(),Zn(),ws(),ST(),r_=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new b}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new b}copyToTexture(t,e,r,i,n){let s=this._renderTargetSystem,a=this._renderer,o=s.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,o.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,n.x,n.y,r.x,r.y,i.width,i.height),e}startRenderPass(t,e=!0,r,i){let n=this._renderTargetSystem,s=t.colorTexture,a=n.getGpuRenderTarget(t),o=i.y;t.isRoot&&(o=s.pixelHeight-i.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let h=this._viewPortCache;(h.x!==i.x||h.y!==o||h.width!==i.width||h.height!==i.height)&&(h.x=i.x,h.y=o,h.width=i.width,h.height=i.height,l.viewport(i.x,o,i.width,i.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;let r=this._renderer.gl;r.bindFramebuffer(r.FRAMEBUFFER,e.resolveTargetFramebuffer),r.bindFramebuffer(r.READ_FRAMEBUFFER,e.framebuffer),r.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,r.COLOR_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){let e=this._renderer.gl,r=new t_,i=t.colorTexture;return Jr.test(i.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),r.framebuffer=null,r):(this._initColor(t,r),e.bindFramebuffer(e.FRAMEBUFFER,null),r)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let i=this._renderTargetSystem;typeof e=="boolean"&&(e=e?br.ALL:br.NONE);let n=this._renderer.gl;if(e&br.COLOR){r??(r=i.defaultClearColor);let s=this._clearColorCache,a=r;(s[0]!==a[0]||s[1]!==a[1]||s[2]!==a[2]||s[3]!==a[3])&&(s[0]=a[0],s[1]=a[1],s[2]=a[2],s[3]=a[3],n.clearColor(a[0],a[1],a[2],a[3]))}n.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let e=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,e),(t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){let r=this._renderer,i=r.gl,n=i.createFramebuffer();if(e.resolveTargetFramebuffer=n,i.bindFramebuffer(i.FRAMEBUFFER,n),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((s,a)=>{let o=s.source;o.antialias&&(r.context.supports.msaa?e.msaa=!0:Be("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(o,0);let l=r.texture.getGlSource(o).texture;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+a,3553,l,0)}),e.msaa){let s=i.createFramebuffer();e.framebuffer=s,i.bindFramebuffer(i.FRAMEBUFFER,s),t.colorTextures.forEach((a,o)=>{let l=i.createRenderbuffer();e.msaaRenderBuffer[o]=l})}else e.framebuffer=n;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((i,n)=>{n!==0&&i.source.resize(r.width,r.height,r._resolution)}),e.msaa){let i=this._renderer,n=i.gl,s=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,s),t.colorTextures.forEach((a,o)=>{let l=a.source;i.texture.bindSource(l,0);let h=i.texture.getGlSource(l).internalFormat,u=e.msaaRenderBuffer[o];n.bindRenderbuffer(n.RENDERBUFFER,u),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,h,l.pixelWidth,l.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,n.RENDERBUFFER,u)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&Jr.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&Jr.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}}),ec,CT=_(()=>{J(),Om(),ET(),ec=class extends Bu{constructor(t){super(t),this.adaptor=new r_,this.adaptor.init(t,this)}},ec.extension={type:[O.WebGLSystem],name:"renderTarget"}});function AT(t,e){let r=[],i=[` + var g = s.groups; + var sS = r.shader; + var p = s.glProgram; + var ugS = r.uniformGroup; + var resources; + `],n=!1,s=0,a=e._getProgramData(t.glProgram);for(let l in t.groups){let h=t.groups[l];r.push(` + resources = g[${l}].resources; + `);for(let u in h.resources){let c=h.resources[u];if(c instanceof ur)if(c.ubo){let f=t._uniformBindMap[l][Number(u)];r.push(` + sS.bindUniformBlock( + resources[${u}], + '${f}', + ${t.glProgram._uniformBlockData[f].index} + ); + `)}else r.push(` + ugS.updateUniformGroup(resources[${u}], p, sD); + `);else if(c instanceof po){let f=t._uniformBindMap[l][Number(u)];r.push(` + sS.bindUniformBlock( + resources[${u}], + '${f}', + ${t.glProgram._uniformBlockData[f].index} + ); + `)}else if(c instanceof er){let f=t._uniformBindMap[l][u],d=a.uniformData[f];d&&(n||(n=!0,i.push(` + var tS = r.texture; + `)),e._gl.uniform1i(d.location,s),r.push(` + tS.bind(resources[${u}], ${s}); + `),s++)}}}let o=[...i,...r].join(` +`);return new Function("r","s","sD",o)}var PT=_(()=>{Mu(),xr(),Er()}),i_,MT=_(()=>{"use strict";i_=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function n_(t,e,r){let i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),i}var RT=_(()=>{"use strict"});function tc(t){let e=new Array(t);for(let r=0;r{"use strict"});function o_(t,e){if(!Ps){let r=Object.keys(rc);Ps={};for(let i=0;i{"use strict";Ps=null,rc={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},l_={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function BT(t,e,r=!1){let i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let a=0;aa>o?1:-1);for(let a=0;a{Cn(),h_()});function OT(t,e){if(!e.ACTIVE_UNIFORM_BLOCKS)return{};let r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORM_BLOCKS);for(let n=0;n{"use strict"});function FT(t,e){let r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n{a_(),h_()});function u_(t,e){let r=t.getShaderSource(e).split(` +`).map((h,u)=>`${u}: ${h}`),i=t.getShaderInfoLog(e),n=i.split(` +`),s={},a=n.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!s[h]?(s[h]=!0,!0):!1),o=[""];a.forEach(h=>{r[h-1]=`%c${r[h-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=r.join(` +`);o[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function UT(t,e,r,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||u_(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||u_(t,i),console.error("PixiJS Error: Could not initialize shader."),t.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}var LT=_(()=>{"use strict"});function NT(t,e){let r=n_(t,t.VERTEX_SHADER,e.vertex),i=n_(t,t.FRAGMENT_SHADER,e.fragment),n=t.createProgram();t.attachShader(n,r),t.attachShader(n,i);let s=e.transformFeedbackVaryings;s&&(typeof t.transformFeedbackVaryings!="function"?Be("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(n,s.names,s.bufferMode==="separate"?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||UT(t,n,r,i),e._attributeData=BT(n,t,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)),e._uniformData=FT(n,t),e._uniformBlockData=OT(n,t),t.deleteShader(r),t.deleteShader(i);let a={};for(let o in e._uniformData){let l=e._uniformData[o];a[o]={location:t.getUniformLocation(n,o),value:s_(l.type,l.size)}}return new i_(n,a)}var HT=_(()=>{Se(),MT(),RT(),a_(),IT(),GT(),DT(),LT()}),Ms,ic,zT=_(()=>{J(),bn(),PT(),HT(),Ms={textureCount:0,blockIndex:0},ic=class{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=xn()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Ms.textureCount=0,Ms.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),r(this._renderer,t,Ms)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Ms)}bindUniformBlock(t,e,r=0){let i=this._renderer.buffer,n=this._getProgramData(this._activeProgram),s=t._bufferResource;s||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,o=i.updateBuffer(a),l=i.freeLocationForBufferBase(o);if(s){let{offset:u,size:c}=t;u===0&&c===a.data.byteLength?i.bindBufferBase(o,l):i.bindBufferRange(o,l,u)}else i.getLastBindBaseLocation(o)!==l&&i.bindBufferBase(o,l);let h=this._activeProgram._uniformBlockData[e].index;n.uniformBlockBindings[r]!==l&&(n.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(n.program,h,l))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=NT(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return AT(t,e)}resetState(){this._activeProgram=null}},ic.extension={type:[O.WebGLSystem],name:"shader"}}),c_,d_,jT=_(()=>{"use strict";c_={f32:`if (cv !== v) { + cu.value = v; + gl.uniform1f(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2f(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3f(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4f(location, v[0], v[1], v[2], v[3]); + }`,i32:`if (cv !== v) { + cu.value = v; + gl.uniform1i(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2i(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3i(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,u32:`if (cv !== v) { + cu.value = v; + gl.uniform1ui(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2ui(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3ui(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4ui(location, v[0], v[1], v[2], v[3]); + }`,bool:`if (cv !== v) { + cu.value = v; + gl.uniform1i(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2i(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3i(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,"mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);"},d_={f32:"gl.uniform1fv(location, v);","vec2":"gl.uniform2fv(location, v);","vec3":"gl.uniform3fv(location, v);","vec4":"gl.uniform4fv(location, v);","mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);"}});function VT(t,e){let r=[` + var v = null; + var cv = null; + var cu = null; + var t = 0; + var gl = renderer.gl; + var name = null; + `];for(let i in t.uniforms){if(!e[i]){t.uniforms[i]instanceof ur?t.uniforms[i].ubo?r.push(` + renderer.shader.bindUniformBlock(uv.${i}, "${i}"); + `):r.push(` + renderer.shader.updateUniformGroup(uv.${i}); + `):t.uniforms[i]instanceof po&&r.push(` + renderer.shader.bindBufferResource(uv.${i}, "${i}"); + `);continue}let n=t.uniformStructures[i],s=!1;for(let a=0;a{Mu(),xr(),Sm(),jT()}),nc,$T=_(()=>{J(),WT(),nc=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let i=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==i.uniformDirtyGroups[t.uid])&&(i.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(i.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),i=this._getSignature(t,e._uniformData,"u");return this._cache[i]||(this._cache[i]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[i],r[e._key]}_generateUniformsSync(t,e){return VT(t,e)}_getSignature(t,e,r){let i=t.uniforms,n=[`${r}-`];for(let s in i)n.push(s),e[s]&&n.push(e[s].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}},nc.extension={type:[O.WebGLSystem],name:"uniformGroup"}});function XT(t){let e={};if(e.normal=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.add=[t.ONE,t.ONE],e.multiply=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.screen=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e["screen-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.erase=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],!(t instanceof Nt.get().getWebGLRenderingContext()))e.min=[t.ONE,t.ONE,t.ONE,t.ONE,t.MIN,t.MIN],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,t.MAX,t.MAX];else{let r=t.getExtension("EXT_blend_minmax");r&&(e.min=[t.ONE,t.ONE,t.ONE,t.ONE,r.MIN_EXT,r.MIN_EXT],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,r.MAX_EXT,r.MAX_EXT])}return e}var YT=_(()=>{tr()}),f_,p_,g_,m_,__,v_,sc,y_,qT=_(()=>{J(),ii(),YT(),f_=0,p_=1,g_=2,m_=3,__=4,v_=5,sc=class Xc{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[f_]=this.setBlend,this.map[p_]=this.setOffset,this.map[g_]=this.setCullFace,this.map[m_]=this.setDepthTest,this.map[__]=this.setFrontFace,this.map[v_]=this.setDepthMask,this.checks=[],this.defaultState=Fr.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=XT(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let r=this.stateId^e.data,i=0;for(;r;)r&1&&this.map[i].call(this,!!(e.data&1<>=1,i++;this.stateId=e.data}for(let r=0;r{Km(),x_=class{constructor(t){this.target=$u.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=vt.UNSIGNED_BYTE,this.internalFormat=mo.RGBA,this.format=mo.RGBA,this.samplerType=0}}}),b_,ZT=_(()=>{"use strict";b_={id:"buffer",upload(t,e,r){e.width===t.width||e.height===t.height?r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.width,t.height,e.format,e.type,t.resource):r.texImage2D(e.target,0,e.internalFormat,t.width,t.height,0,e.format,e.type,t.resource),e.width=t.width,e.height=t.height}}}),w_,T_,QT=_(()=>{"use strict";w_={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},T_={id:"compressed",upload(t,e,r){r.pixelStorei(r.UNPACK_ALIGNMENT,4);let i=t.pixelWidth,n=t.pixelHeight,s=!!w_[t.format];for(let a=0;a>1,1),n=Math.max(n>>1,1)}}}}),ac,S_=_(()=>{"use strict";ac={id:"image",upload(t,e,r,i){let n=e.width,s=e.height,a=t.pixelWidth,o=t.pixelHeight,l=t.resourceWidth,h=t.resourceHeight;l{S_(),E_={id:"video",upload(t,e,r,i){if(!t.isValid){r.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}ac.upload(t,e,r,i)}}}),oc,C_,vo,A_,eS=_(()=>{"use strict";oc={linear:9729,nearest:9728},C_={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},vo={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},A_={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function P_(t,e,r,i,n,s,a,o){let l=s;if(!o||t.addressModeU!=="repeat"||t.addressModeV!=="repeat"||t.addressModeW!=="repeat"){let h=vo[a?"clamp-to-edge":t.addressModeU],u=vo[a?"clamp-to-edge":t.addressModeV],c=vo[a?"clamp-to-edge":t.addressModeW];e[n](l,e.TEXTURE_WRAP_S,h),e[n](l,e.TEXTURE_WRAP_T,u),e.TEXTURE_WRAP_R&&e[n](l,e.TEXTURE_WRAP_R,c)}if((!o||t.magFilter!=="linear")&&e[n](l,e.TEXTURE_MAG_FILTER,oc[t.magFilter]),r){if(!o||t.mipmapFilter!=="linear"){let h=C_[t.minFilter][t.mipmapFilter];e[n](l,e.TEXTURE_MIN_FILTER,h)}}else e[n](l,e.TEXTURE_MIN_FILTER,oc[t.minFilter]);if(i&&t.maxAnisotropy>1){let h=Math.min(t.maxAnisotropy,e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[n](l,i.TEXTURE_MAX_ANISOTROPY_EXT,h)}t.compare&&e[n](l,e.TEXTURE_COMPARE_FUNC,A_[t.compare])}var tS=_(()=>{eS()});function rS(t){return{r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}var iS=_(()=>{"use strict"});function nS(t,e){let r={},i=t.RGBA;return t instanceof Nt.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},i=t.RGBA8),{r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA,...r,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:i,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var sS=_(()=>{tr()});function aS(t){return{r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}var oS=_(()=>{"use strict"}),M_,lc,lS=_(()=>{tr(),J(),Dt(),KT(),ZT(),QT(),S_(),JT(),tS(),iS(),sS(),oS(),M_=4,lc=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:ac,buffer:b_,video:E_,compressed:T_},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=nS(t,this._renderer.context.extensions),this._mapFormatToType=aS(t),this._mapFormatToFormat=rS(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(Fe.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=Fe.EMPTY.source);let i=this.getGlSource(t);r.bindTexture(i.target,i.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let i=this._getGlSampler(t);this._boundSamplers[e]!==i&&(this._boundSamplers[e]=i,r.bindSampler(e,i))}unbind(t){let e=t.source,r=this._boundTextures,i=this._gl;for(let n=0;n1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let i=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==i&&(this._premultiplyAlpha=i,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,P_(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:i}=this.getPixels(t),n=Nt.get().createCanvas();n.width=r,n.height=i;let s=n.getContext("2d");if(s){let a=s.createImageData(r,i);a.data.set(e),s.putImageData(a,0,0)}return n}getPixels(t){let e=t.source.resolution,r=t.frame,i=Math.max(Math.round(r.width*e),1),n=Math.max(Math.round(r.height*e),1),s=new Uint8Array(M_*i*n),a=this._renderer,o=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(o),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(r.x*e),Math.round(r.y*e),i,n,h.RGBA,h.UNSIGNED_BYTE,s),{pixels:new Uint8ClampedArray(s.buffer),width:i,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(Fe.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}},lc.extension={type:[O.WebGLSystem],name:"texture"}}),R_={};Ft(R_,{WebGLRenderer:()=>O_});var k_,B_,I_,hc,uc,cc,O_,hS=_(()=>{J(),nT(),sT(),aT(),ro(),bm(),gi(),hT(),uT(),fT(),pT(),gT(),mT(),_T(),TT(),CT(),zT(),$T(),qT(),lS(),k_=[...yu,Ju,Jm,qm,Wu,lc,ec,Yu,nc,ic,Ku,y_,Zu,qu],B_=[...xu],I_=[Vu,ju,zu],hc=[],uc=[],cc=[],xe.handleByNamedList(O.WebGLSystem,hc),xe.handleByNamedList(O.WebGLPipes,uc),xe.handleByNamedList(O.WebGLPipesAdaptor,cc),xe.add(...k_,...B_,...I_),O_=class extends Ts{constructor(){let t={name:"webgl",type:Gr.WEBGL,systems:hc,renderPipes:uc,renderPipeAdaptors:cc};super(t)}}}),uS=nr((t,e)=>{"use strict";e.exports=i;function r(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function i(s){if(s=s||{},s.circles)return n(s);let a=new Map;if(a.set(Date,c=>new Date(c)),a.set(Map,(c,f)=>new Map(l(Array.from(c),f))),a.set(Set,(c,f)=>new Set(l(Array.from(c),f))),s.constructorHandlers)for(let c of s.constructorHandlers)a.set(c[0],c[1]);let o=null;return s.proto?u:h;function l(c,f){let d=Object.keys(c),y=new Array(d.length);for(let x=0;xnew Date(d)),l.set(Map,(d,y)=>new Map(u(Array.from(d),y))),l.set(Set,(d,y)=>new Set(u(Array.from(d),y))),s.constructorHandlers)for(let d of s.constructorHandlers)l.set(d[0],d[1]);let h=null;return s.proto?f:c;function u(d,y){let x=Object.keys(d),v=new Array(x.length);for(let w=0;w{}};function G_(){for(var t=0,e=arguments.length,r={},i;t=0&&(i=r.slice(n+1),r=r.slice(0,n)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}yo.prototype=G_.prototype={constructor:yo,on:function(t,e){var r=this._,i=dS(t+"",r),n,s=-1,a=i.length;if(arguments.length<2){for(;++s0)for(var r=new Array(n),i=0,n,s;i=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),D_.hasOwnProperty(e)?{space:D_[e],local:t}:t}function pS(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===dc&&e.documentElement.namespaceURI===dc?e.createElement(t):e.createElementNS(r,t)}}function gS(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function U_(t){var e=bo(t);return(e.local?gS:pS)(e)}function mS(){}function fc(t){return t==null?mS:function(){return this.querySelector(t)}}function _S(t){typeof t!="function"&&(t=fc(t));for(var e=this._groups,r=e.length,i=new Array(r),n=0;n=G&&(G=P+1);!(L=v[G])&&++G=0;)(a=i[n])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function zS(t){t||(t=jS);function e(c,f){return c&&f?t(c.__data__,f.__data__):!c-!f}for(var r=this._groups,i=r.length,n=new Array(i),s=0;se?1:t>=e?0:NaN}function VS(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function WS(){return Array.from(this)}function $S(){for(var t=this._groups,e=0,r=t.length;e1?this.each((e==null?iE:typeof e=="function"?sE:nE)(t,e,r??"")):Dn(this.node(),t)}function Dn(t,e){return t.style.getPropertyValue(e)||j_(t).getComputedStyle(t,null).getPropertyValue(e)}function oE(t){return function(){delete this[t]}}function lE(t,e){return function(){this[t]=e}}function hE(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function uE(t,e){return arguments.length>1?this.each((e==null?oE:typeof e=="function"?hE:lE)(t,e)):this.node()[t]}function V_(t){return t.trim().split(/^|\s+/)}function pc(t){return t.classList||new W_(t)}function W_(t){this._node=t,this._names=V_(t.getAttribute("class")||"")}W_.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function $_(t,e){for(var r=pc(t),i=-1,n=e.length;++i=0&&(r=e.slice(i+1),e=e.slice(0,i)),{type:e,name:r}})}function UE(t){return function(){var e=this.__on;if(e){for(var r=0,i=-1,n=e.length,s;r()=>t;function mc(t,{sourceEvent:e,subject:r,target:i,identifier:n,active:s,x:a,y:o,dx:l,dy:h,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:u}})}mc.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function YE(t){return!t.ctrlKey&&!t.button}function qE(){return this.parentNode}function KE(t,e){return e??{x:t.x,y:t.y}}function ZE(){return navigator.maxTouchPoints||"ontouchstart"in this}function QE(){var t=YE,e=qE,r=KE,i=ZE,n={},s=xo("start","drag","end"),a=0,o,l,h,u,c=0;function f(k){k.on("mousedown.drag",d).filter(i).on("touchstart.drag",v).on("touchmove.drag",w,XE).on("touchend.drag touchcancel.drag",P).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(k,L){if(!(u||!t.call(this,k,L))){var N=G(this,e.call(this,k,L),k,L,"mouse");N&&(Vr(k.view).on("mousemove.drag",y,ks).on("mouseup.drag",x,ks),Z_(k.view),gc(k),h=!1,o=k.clientX,l=k.clientY,N("start",k))}}function y(k){if(Un(k),!h){var L=k.clientX-o,N=k.clientY-l;h=L*L+N*N>c}n.mouse("drag",k)}function x(k){Vr(k.view).on("mousemove.drag mouseup.drag",null),Q_(k.view,h),Un(k),n.mouse("end",k)}function v(k,L){if(t.call(this,k,L)){var N=k.changedTouches,H=e.call(this,k,L),fe=N.length,ue,ae;for(ue=0;ue>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Eo(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Eo(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=e2.exec(t))?new wr(e[1],e[2],e[3],1):(e=t2.exec(t))?new wr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=r2.exec(t))?Eo(e[1],e[2],e[3],e[4]):(e=i2.exec(t))?Eo(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=n2.exec(t))?av(e[1],e[2]/100,e[3]/100,1):(e=s2.exec(t))?av(e[1],e[2]/100,e[3]/100,e[4]):ev.hasOwnProperty(t)?iv(ev[t]):t==="transparent"?new wr(NaN,NaN,NaN,0):null}function iv(t){return new wr(t>>16&255,t>>8&255,t&255,1)}function Eo(t,e,r,i){return i<=0&&(t=e=r=NaN),new wr(t,e,r,i)}function l2(t){return t instanceof Bs||(t=Gs(t)),t?(t=t.rgb(),new wr(t.r,t.g,t.b,t.opacity)):new wr}function Co(t,e,r,i){return arguments.length===1?l2(t):new wr(t,e,r,i??1)}function wr(t,e,r,i){this.r=+t,this.g=+e,this.b=+r,this.opacity=+i}_c(wr,Co,J_(Bs,{brighter(t){return t=t==null?So:Math.pow(So,t),new wr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Is:Math.pow(Is,t),new wr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new wr(nn(this.r),nn(this.g),nn(this.b),Ao(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:nv,formatHex:nv,formatHex8:h2,formatRgb:sv,toString:sv}));function nv(){return`#${sn(this.r)}${sn(this.g)}${sn(this.b)}`}function h2(){return`#${sn(this.r)}${sn(this.g)}${sn(this.b)}${sn((isNaN(this.opacity)?1:this.opacity)*255)}`}function sv(){let t=Ao(this.opacity);return`${t===1?"rgb(":"rgba("}${nn(this.r)}, ${nn(this.g)}, ${nn(this.b)}${t===1?")":`, ${t})`}`}function Ao(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function nn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function sn(t){return t=nn(t),(t<16?"0":"")+t.toString(16)}function av(t,e,r,i){return i<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Wr(t,e,r,i)}function ov(t){if(t instanceof Wr)return new Wr(t.h,t.s,t.l,t.opacity);if(t instanceof Bs||(t=Gs(t)),!t)return new Wr;if(t instanceof Wr)return t;t=t.rgb();var e=t.r/255,r=t.g/255,i=t.b/255,n=Math.min(e,r,i),s=Math.max(e,r,i),a=NaN,o=s-n,l=(s+n)/2;return o?(e===s?a=(r-i)/o+(r0&&l<1?0:a,new Wr(a,o,l,t.opacity)}function u2(t,e,r,i){return arguments.length===1?ov(t):new Wr(t,e,r,i??1)}function Wr(t,e,r,i){this.h=+t,this.s=+e,this.l=+r,this.opacity=+i}_c(Wr,u2,J_(Bs,{brighter(t){return t=t==null?So:Math.pow(So,t),new Wr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Is:Math.pow(Is,t),new Wr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*e,n=2*r-i;return new wr(vc(t>=240?t-240:t+120,n,i),vc(t,n,i),vc(t<120?t+240:t-120,n,i),this.opacity)},clamp(){return new Wr(lv(this.h),Po(this.s),Po(this.l),Ao(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=Ao(this.opacity);return`${t===1?"hsl(":"hsla("}${lv(this.h)}, ${Po(this.s)*100}%, ${Po(this.l)*100}%${t===1?")":`, ${t})`}`}}));function lv(t){return t=(t||0)%360,t<0?t+360:t}function Po(t){return Math.max(0,Math.min(1,t||0))}function vc(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}function hv(t,e,r,i,n){var s=t*t,a=s*t;return((1-3*t+3*s-a)*e+(4-6*s+3*a)*r+(1+3*t+3*s-3*a)*i+a*n)/6}function c2(t){var e=t.length-1;return function(r){var i=r<=0?r=0:r>=1?(r=1,e-1):Math.floor(r*e),n=t[i],s=t[i+1],a=i>0?t[i-1]:2*n-s,o=i()=>t;function f2(t,e){return function(r){return t+r*e}}function p2(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(i){return Math.pow(t+i*e,r)}}function g2(t){return(t=+t)==1?cv:function(e,r){return r-e?p2(e,r,t):uv(isNaN(e)?r:e)}}function cv(t,e){var r=e-t;return r?f2(t,r):uv(isNaN(t)?e:t)}var dv=function t(e){var r=g2(e);function i(n,s){var a=r((n=Co(n)).r,(s=Co(s)).r),o=r(n.g,s.g),l=r(n.b,s.b),h=cv(n.opacity,s.opacity);return function(u){return n.r=a(u),n.g=o(u),n.b=l(u),n.opacity=h(u),n+""}}return i.gamma=t,i}(1);function fv(t){return function(e){var r=e.length,i=new Array(r),n=new Array(r),s=new Array(r),a,o;for(a=0;ar&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:Oi(i,n)})),r=xc.lastIndex;return r180?u+=360:u-h>180&&(h+=360),f.push({i:c.push(n(c)+"rotate(",null,i)-2,x:Oi(h,u)})):u&&c.push(n(c)+"rotate("+u+i)}function o(h,u,c,f){h!==u?f.push({i:c.push(n(c)+"skewX(",null,i)-2,x:Oi(h,u)}):u&&c.push(n(c)+"skewX("+u+i)}function l(h,u,c,f,d,y){if(h!==c||u!==f){var x=d.push(n(d)+"scale(",null,",",null,")");y.push({i:x-4,x:Oi(h,c)},{i:x-2,x:Oi(u,f)})}else(c!==1||f!==1)&&d.push(n(d)+"scale("+c+","+f+")")}return function(h,u){var c=[],f=[];return h=t(h),u=t(u),s(h.translateX,h.translateY,u.translateX,u.translateY,c,f),a(h.rotate,u.rotate,c,f),o(h.skewX,u.skewX,c,f),l(h.scaleX,h.scaleY,u.scaleX,u.scaleY,c,f),h=u=null,function(d){for(var y=-1,x=f.length,v;++y=0&&t._call.call(void 0,e),t=t._next;--Nn}function xv(){an=(ko=Ls.now())+Bo,Nn=Fs=0;try{P2()}finally{Nn=0,R2(),an=0}}function M2(){var t=Ls.now(),e=t-ko;e>vv&&(Bo-=e,ko=t)}function R2(){for(var t,e=Ro,r,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:Ro=r);Us=t,Sc(i)}function Sc(t){if(!Nn){Fs&&(Fs=clearTimeout(Fs));var e=t-an;e>24?(t<1/0&&(Fs=setTimeout(xv,t-Ls.now()-Bo)),Ds&&(Ds=clearInterval(Ds))):(Ds||(ko=Ls.now(),Ds=setInterval(M2,vv)),Nn=1,yv(xv))}}function bv(t,e,r){var i=new Io;return e=e==null?0:+e,i.restart(n=>{i.stop(),t(n+e)},e,r),i}var k2=xo("start","end","cancel","interrupt"),B2=[],wv=0,Tv=1,Ec=2,Oo=3,Sv=4,Cc=5,Go=6;function Fo(t,e,r,i,n,s){var a=t.__transition;if(!a)t.__transition={};else if(r in a)return;I2(t,r,{name:e,index:i,group:n,on:k2,tween:B2,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:wv})}function Ac(t,e){var r=$r(t,e);if(r.state>wv)throw new Error("too late; already scheduled");return r}function li(t,e){var r=$r(t,e);if(r.state>Oo)throw new Error("too late; already running");return r}function $r(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function I2(t,e,r){var i=t.__transition,n;i[e]=r,r.timer=Tc(s,0,r.time);function s(h){r.state=Tv,r.timer.restart(a,r.delay,r.time),r.delay<=h&&a(h-r.delay)}function a(h){var u,c,f,d;if(r.state!==Tv)return l();for(u in i)if(d=i[u],d.name===r.name){if(d.state===Oo)return bv(a);d.state===Sv?(d.state=Go,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[u]):+uEc&&i.state=0&&(e=e.slice(0,r)),!e||e==="start"})}function hC(t,e,r){var i,n,s=lC(e)?Ac:li;return function(){var a=s(this,t),o=a.on;o!==i&&(n=(i=o).copy()).on(e,r),a.on=n}}function uC(t,e){var r=this._id;return arguments.length<2?$r(this.node(),r).on.on(t):this.each(hC(r,t,e))}function cC(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function dC(){return this.on("end.remove",cC(this._id))}function fC(t){var e=this._name,r=this._id;typeof t!="function"&&(t=fc(t));for(var i=this._groups,n=i.length,s=new Array(n),a=0;a=(c=(o+h)/2))?o=c:h=c,(v=r>=(f=(l+u)/2))?l=f:u=f,n=s,!(s=s[w=v<<1|x]))return n[w]=a,t;if(d=+t._x.call(null,s.data),y=+t._y.call(null,s.data),e===d&&r===y)return a.next=s,n?n[w]=a:t._root=a,t;do n=n?n[w]=new Array(4):t._root=new Array(4),(x=e>=(c=(o+h)/2))?o=c:h=c,(v=r>=(f=(l+u)/2))?l=f:u=f;while((w=v<<1|x)===(P=(y>=f)<<1|d>=c));return n[P]=s,n[w]=a,t}function zC(t){var e,r,i=t.length,n,s,a=new Array(i),o=new Array(i),l=1/0,h=1/0,u=-1/0,c=-1/0;for(r=0;ru&&(u=n),sc&&(c=s));if(l>u||h>c)return this;for(this.cover(l,h).cover(u,c),r=0;rt||t>=n||i>e||e>=s;)switch(h=(eu||(o=y.y0)>c||(l=y.x1)=w)<<1|t>=v)&&(y=f[f.length-1],f[f.length-1]=f[f.length-1-x],f[f.length-1-x]=y)}else{var P=t-+this._x.call(null,d.data),G=e-+this._y.call(null,d.data),k=P*P+G*G;if(k=(f=(a+l)/2))?a=f:l=f,(x=c>=(d=(o+h)/2))?o=d:h=d,e=r,!(r=r[v=x<<1|y]))return this;if(!r.length)break;(e[v+1&3]||e[v+2&3]||e[v+3&3])&&(i=e,w=v)}for(;r.data!==t;)if(n=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,n?(s?n.next=s:delete n.next,this):e?(s?e[v]=s:delete e[v],(r=e[0]||e[1]||e[2]||e[3])&&r===(e[3]||e[2]||e[1]||e[0])&&!r.length&&(i?i[w]=r:this._root=r),this):(this._root=s,this)}function YC(t){for(var e=0,r=t.length;ef.index){var le=d-fe.x-fe.vx,ke=y-fe.y-fe.vy,We=le*le+ke*ke;Wed+ae||Ny+ae||Hh.r&&(h.r=h[u].r)}function l(){if(e){var h,u=e.length,c;for(r=new Array(u),h=0;h[e(L,N,a),L])),k;for(v=0,o=new Array(w);v(t=(1664525*t+1013904223)%4294967296)/4294967296}function hA(t){return t.x}function uA(t){return t.y}var cA=10,dA=Math.PI*(3-Math.sqrt(5));function fA(t){var e,r=1,i=.001,n=1-Math.pow(i,1/300),s=0,a=.6,o=new Map,l=Tc(c),h=xo("tick","end"),u=lA();t==null&&(t=[]);function c(){f(),h.call("tick",e),r1?(v==null?o.delete(x):o.set(x,y(v)),e):o.get(x)},find:function(x,v,w){var P=0,G=t.length,k,L,N,H,fe;for(w==null?w=1/0:w*=w,P=0;P1?(h.on(x,v),e):h.on(x)}}}function pA(){var t,e,r,i,n=Xr(-30),s,a=1,o=1/0,l=.81;function h(d){var y,x=t.length,v=Rc(t,hA,uA).visitAfter(c);for(i=d,y=0;y=o)){(d.data!==e||d.next)&&(w===0&&(w=Gi(r),k+=w*w),P===0&&(P=Gi(r),k+=P*P),k()=>t;function mA(t,{sourceEvent:e,target:r,transform:i,dispatch:n}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:n}})}function bi(t,e,r){this.k=t,this.x=e,this.y=r}bi.prototype={constructor:bi,scale:function(t){return t===1?this:new bi(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new bi(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Lo=new bi(1,0,0);_A.prototype=bi.prototype;function _A(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Lo;return t.__zoom}function Bc(t){t.stopImmediatePropagation()}function Ns(t){t.preventDefault(),t.stopImmediatePropagation()}function vA(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function yA(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Bv(){return this.__zoom||Lo}function xA(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function bA(){return navigator.maxTouchPoints||"ontouchstart"in this}function wA(t,e,r){var i=t.invertX(e[0][0])-r[0][0],n=t.invertX(e[1][0])-r[1][0],s=t.invertY(e[0][1])-r[0][1],a=t.invertY(e[1][1])-r[1][1];return t.translate(n>i?(i+n)/2:Math.min(0,i)||Math.max(0,n),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function TA(){var t=vA,e=yA,r=wA,i=xA,n=bA,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=C2,h=xo("start","zoom","end"),u,c,f,d=500,y=150,x=0,v=10;function w(U){U.property("__zoom",Bv).on("wheel.zoom",fe,{passive:!1}).on("mousedown.zoom",ue).on("dblclick.zoom",ae).filter(n).on("touchstart.zoom",le).on("touchmove.zoom",ke).on("touchend.zoom touchcancel.zoom",We).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(U,we,X,se){var A=U.selection?U.selection():U;A.property("__zoom",Bv),U!==A?L(U,we,X,se):A.interrupt().each(function(){N(this,arguments).event(se).start().zoom(null,typeof we=="function"?we.apply(this,arguments):we).end()})},w.scaleBy=function(U,we,X,se){w.scaleTo(U,function(){var A=this.__zoom.k,B=typeof we=="function"?we.apply(this,arguments):we;return A*B},X,se)},w.scaleTo=function(U,we,X,se){w.transform(U,function(){var A=e.apply(this,arguments),B=this.__zoom,R=X==null?k(A):typeof X=="function"?X.apply(this,arguments):X,Y=B.invert(R),K=typeof we=="function"?we.apply(this,arguments):we;return r(G(P(B,K),R,Y),A,a)},X,se)},w.translateBy=function(U,we,X,se){w.transform(U,function(){return r(this.__zoom.translate(typeof we=="function"?we.apply(this,arguments):we,typeof X=="function"?X.apply(this,arguments):X),e.apply(this,arguments),a)},null,se)},w.translateTo=function(U,we,X,se,A){w.transform(U,function(){var B=e.apply(this,arguments),R=this.__zoom,Y=se==null?k(B):typeof se=="function"?se.apply(this,arguments):se;return r(Lo.translate(Y[0],Y[1]).scale(R.k).translate(typeof we=="function"?-we.apply(this,arguments):-we,typeof X=="function"?-X.apply(this,arguments):-X),B,a)},se,A)};function P(U,we){return we=Math.max(s[0],Math.min(s[1],we)),we===U.k?U:new bi(we,U.x,U.y)}function G(U,we,X){var se=we[0]-X[0]*U.k,A=we[1]-X[1]*U.k;return se===U.x&&A===U.y?U:new bi(U.k,se,A)}function k(U){return[(+U[0][0]+ +U[1][0])/2,(+U[0][1]+ +U[1][1])/2]}function L(U,we,X,se){U.on("start.zoom",function(){N(this,arguments).event(se).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(se).end()}).tween("zoom",function(){var A=this,B=arguments,R=N(A,B).event(se),Y=e.apply(A,B),K=X==null?k(Y):typeof X=="function"?X.apply(A,B):X,ee=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),te=A.__zoom,de=typeof we=="function"?we.apply(A,B):we,Pe=l(te.invert(K).concat(ee/te.k),de.invert(K).concat(ee/de.k));return function(Ee){if(Ee===1)Ee=de;else{var nt=Pe(Ee),Ye=ee/nt[2];Ee=new bi(Ye,K[0]-nt[0]*Ye,K[1]-nt[1]*Ye)}R.zoom(null,Ee)}})}function N(U,we,X){return!X&&U.__zooming||new H(U,we)}function H(U,we){this.that=U,this.args=we,this.active=0,this.sourceEvent=null,this.extent=e.apply(U,we),this.taps=0}H.prototype={event:function(U){return U&&(this.sourceEvent=U),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(U,we){return this.mouse&&U!=="mouse"&&(this.mouse[1]=we.invert(this.mouse[0])),this.touch0&&U!=="touch"&&(this.touch0[1]=we.invert(this.touch0[0])),this.touch1&&U!=="touch"&&(this.touch1[1]=we.invert(this.touch1[0])),this.that.__zoom=we,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(U){var we=Vr(this.that).datum();h.call(U,this.that,new mA(U,{sourceEvent:this.sourceEvent,target:w,type:U,transform:this.that.__zoom,dispatch:h}),we)}};function fe(U,...we){if(!t.apply(this,arguments))return;var X=N(this,we).event(U),se=this.__zoom,A=Math.max(s[0],Math.min(s[1],se.k*Math.pow(2,i.apply(this,arguments)))),B=vi(U);if(X.wheel)(X.mouse[0][0]!==B[0]||X.mouse[0][1]!==B[1])&&(X.mouse[1]=se.invert(X.mouse[0]=B)),clearTimeout(X.wheel);else{if(se.k===A)return;X.mouse=[B,se.invert(B)],Do(this),X.start()}Ns(U),X.wheel=setTimeout(R,y),X.zoom("mouse",r(G(P(se,A),X.mouse[0],X.mouse[1]),X.extent,a));function R(){X.wheel=null,X.end()}}function ue(U,...we){if(f||!t.apply(this,arguments))return;var X=U.currentTarget,se=N(this,we,!0).event(U),A=Vr(U.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",ee,!0),B=vi(U,X),R=U.clientX,Y=U.clientY;Z_(U.view),Bc(U),se.mouse=[B,this.__zoom.invert(B)],Do(this),se.start();function K(te){if(Ns(te),!se.moved){var de=te.clientX-R,Pe=te.clientY-Y;se.moved=de*de+Pe*Pe>x}se.event(te).zoom("mouse",r(G(se.that.__zoom,se.mouse[0]=vi(te,X),se.mouse[1]),se.extent,a))}function ee(te){A.on("mousemove.zoom mouseup.zoom",null),Q_(te.view,se.moved),Ns(te),se.event(te).end()}}function ae(U,...we){if(t.apply(this,arguments)){var X=this.__zoom,se=vi(U.changedTouches?U.changedTouches[0]:U,this),A=X.invert(se),B=X.k*(U.shiftKey?.5:2),R=r(G(P(X,B),se,A),e.apply(this,we),a);Ns(U),o>0?Vr(this).transition().duration(o).call(L,R,se,U):Vr(this).call(w.transform,R,se,U)}}function le(U,...we){if(t.apply(this,arguments)){var X=U.touches,se=X.length,A=N(this,we,U.changedTouches.length===se).event(U),B,R,Y,K;for(Bc(U),R=0;R!0,load:async()=>{await Promise.resolve().then(()=>(D1(),F1))}};J();var EA={extension:{type:O.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(L1(),U1))}};J(),Gl(),Ml(),J(),tr(),ro();var Ic;function CA(t){return Ic!==void 0||(Ic=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:t??Ts.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Nt.get().getWebGLRenderingContext())return!1;let r=Nt.get().createCanvas().getContext("webgl",e),i=!!r?.getContextAttributes()?.stencil;if(r){let n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,i}catch{return!1}})()),Ic}tr();var Oc;async function AA(t={}){return Oc!==void 0||(Oc=await(async()=>{let e=Nt.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(t)).requestDevice(),!0}catch{return!1}})()),Oc}ro();var Iv=["webgl","webgpu","canvas"];async function PA(t){let e=[];t.preference?(e.push(t.preference),Iv.forEach(s=>{s!==t.preference&&e.push(s)})):e=Iv.slice();let r,i={};for(let s=0;s(iT(),jm));r=o,i={...t,...t.webgpu};break}else if(a==="webgl"&&CA(t.failIfMajorPerformanceCaveat??Ts.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:o}=await Promise.resolve().then(()=>(hS(),R_));r=o,i={...t,...t.webgl};break}else if(a==="canvas")throw i={...t},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!r)throw new Error("No available renderer for the current environment");let n=new r;return await n.init(i),n}Zr(),tm(),kt();var Ov=class Yc{constructor(...e){this.stage=new dr,e[0]!==void 0&&Qe(ot,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await PA(e),Yc._plugins.forEach(r=>{r.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return Qe(ot,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,r=!1){let i=Yc._plugins.slice(0);i.reverse(),i.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(r),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Ov._plugins=[];var Gv=Ov;xe.handleByList(O.Application,Gv._plugins),xe.add(au),ci(),kt(),bl();var MA=class extends aa{constructor(t,e){let{text:r,resolution:i,style:n,anchor:s,width:a,height:o,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=n,this.resolution=i??null,this.allowChildren=!1,this._anchor=new Yt({_onUpdate:()=>{this.onViewUpdate()}}),s&&(this.anchor=s),this.roundPixels=l??!1,a!==void 0&&(this.width=a),o!==void 0&&(this.height=o)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,i=-e*this.anchor.x,n=0;return t.x>=i&&t.x<=i+e&&(n=-r*this.anchor.y,t.y>=n&&t.y<=n+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function RA(t,e){let r=t[0]??{};return(typeof r=="string"||t[1])&&(Qe(ot,`use new ${e}({ text: "hi!", style }) instead`),r={text:r,style:t[1]}),r}Th(),ms();var kA=class extends MA{constructor(...t){let e=RA(t,"Text");super(e,si),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=ai.measureText(this._text,this._style),{width:i,height:n}=r;t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}};bp(),qd(),Zr(),sg(),It();var QA=Qt(Nf(),1);xe.add(SA,EA);var Hs=Object.freeze({Linear:Object.freeze({None:function(t){return t},In:function(t){return t},Out:function(t){return t},InOut:function(t){return t}}),Quadratic:Object.freeze({In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}}),Cubic:Object.freeze({In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}}),Quartic:Object.freeze({In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}}),Quintic:Object.freeze({In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}}),Sinusoidal:Object.freeze({In:function(t){return 1-Math.sin((1-t)*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return .5*(1-Math.sin(Math.PI*(.5-t)))}}),Exponential:Object.freeze({In:function(t){return t===0?0:Math.pow(1024,t-1)},Out:function(t){return t===1?1:1-Math.pow(2,-10*t)},InOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)}}),Circular:Object.freeze({In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}}),Elastic:Object.freeze({In:function(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},Out:function(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},InOut:function(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(t){var e=1.70158;return t===1?1:t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return t===0?0:--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}}),Bounce:Object.freeze({In:function(t){return 1-Hs.Bounce.Out(1-t)},Out:function(t){return t<.36363636363636365?7.5625*t*t:t<.7272727272727273?7.5625*(t-=.5454545454545454)*t+.75:t<.9090909090909091?7.5625*(t-=.8181818181818182)*t+.9375:7.5625*(t-=.9545454545454546)*t+.984375},InOut:function(t){return t<.5?Hs.Bounce.In(t*2)*.5:Hs.Bounce.Out(t*2-1)*.5+.5}}),generatePow:function(t){return t===void 0&&(t=4),t=t1e4?1e4:t,{In:function(e){return Math.pow(e,t)},Out:function(e){return 1-Math.pow(1-e,t)},InOut:function(e){return e<.5?Math.pow(e*2,t)/2:(1-Math.pow(2-e*2,t))/2+.5}}}}),zs=function(){return performance.now()},No=function(){function t(){for(var e=[],r=0;r0;){this._tweensAddedDuringUpdate={};for(var n=0;n1?s(t[r],t[r-1],r-i):s(t[n],t[n+1>r?r:n+1],i-n)},Bezier:function(t,e){for(var r=0,i=t.length-1,n=Math.pow,s=Hn.Utils.Bernstein,a=0;a<=i;a++)r+=n(1-e,i-a)*n(e,a)*t[a]*s(i,a);return r},CatmullRom:function(t,e){var r=t.length-1,i=r*e,n=Math.floor(i),s=Hn.Utils.CatmullRom;return t[0]===t[r]?(e<0&&(n=Math.floor(i=r*(1+e))),s(t[(n-1+r)%r],t[n],t[(n+1)%r],t[(n+2)%r],i-n)):e<0?t[0]-(s(t[0],t[0],t[1],t[1],-i)-t[0]):e>1?t[r]-(s(t[r],t[r],t[r-1],t[r-1],i-r)-t[r]):s(t[n?n-1:0],t[n],t[r1;i--)r*=i;return t[e]=r,r}}(),CatmullRom:function(t,e,r,i,n){var s=(r-t)*.5,a=(i-e)*.5,o=n*n,l=n*o;return(2*e-2*r+s+a)*l+(-3*e+3*r-2*s-a)*o+s*n+e}}},Fv=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),Gc=new No,Ho=function(){function t(e,r){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=Hs.Linear.None,this._interpolationFunction=Hn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Fv.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=Gc,Gc.add(this))}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(e,r){if(r===void 0&&(r=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=r<0?0:r,this},t.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},t.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},t.prototype.start=function(e,r){if(e===void 0&&(e=zs()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}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||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var s in this._valuesEnd)n[s]=this._valuesEnd[s];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},t.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},t.prototype._setupProperties=function(e,r,i,n,s){for(var a in i){var o=e[a],l=Array.isArray(o),h=l?"array":typeof o,u=!l&&Array.isArray(i[a]);if(!(h==="undefined"||h==="function")){if(u){var c=i[a];if(c.length===0)continue;for(var f=[o],d=0,y=c.length;d"u"||s)&&(r[a]=o),l||(r[a]*=1),u?n[a]=i[a].slice().reverse():n[a]=r[a]||0}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},t.prototype.pause=function(e){return e===void 0&&(e=zs()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},t.prototype.resume=function(e){return e===void 0&&(e=zs()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},t.prototype.stopChainedTweens=function(){for(var e=0,r=this._chainedTweens.length;el)return 1;var x=Math.trunc(a/o),v=a-x*o,w=Math.min(v/i._duration,1);return w===0&&a===i._duration?1:w},u=h(),c=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=o*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var d=0,y=this._chainedTweens.length;dt?.removeEventListener("click",r)),document.addEventListener("keydown",i),window.addCleanup(()=>document.removeEventListener("keydown",i))}function IA(t){for(;t.firstChild;)t.removeChild(t.firstChild)}var sP=Object.hasOwnProperty,OA=Qt(uS(),1),aP=(0,OA.default)();function GA(t){return t.document.body.dataset.slug}function js(t){let e=Uv(LA(t,"index"),!0);return e.length===0?"/":e}function FA(t){let e=t.split("/").filter(r=>r!=="").slice(0,-1).map(r=>"..").join("/");return e.length===0&&(e="."),e}function Dv(t,e){return DA(FA(t),js(e))}function DA(...t){if(t.length===0)return"";let e=t.filter(r=>r!==""&&r!=="/").map(r=>Uv(r)).join("/");return t[0].startsWith("/")&&(e="/"+e),t[t.length-1].endsWith("/")&&(e=e+"/"),e}function UA(t,e){return t===e||t.endsWith("/"+e)}function LA(t,e){return UA(t,e)&&(t=t.slice(0,-e.length)),t}function Uv(t,e){return t.startsWith("/")&&(t=t.substring(1)),!e&&t.endsWith("/")&&(t=t.slice(0,-1)),t}var Lv="graph-visited";function Nv(){return new Set(JSON.parse(localStorage.getItem(Lv)??"[]"))}function NA(t){let e=Nv();e.add(t),localStorage.setItem(Lv,JSON.stringify([...e]))}async function HA(){let t=await navigator.gpu?.requestAdapter().catch(()=>null),e=t&&await t.requestDevice().catch(()=>null);if(!e)return"webgl";let r=document.createElement("canvas"),i=r.getContext("webgl2")??r.getContext("webgl");if(!i)return"webgl";let n=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),s=e.limits.maxSampledTexturesPerShaderStage;return n===s?"webgpu":"webgl"}async function Hv(t,e){let r=js(e),i=Nv();IA(t);let{drag:n,zoom:s,depth:a,scale:o,repelForce:l,centerForce:h,linkDistance:u,fontSize:c,opacityScale:f,removeTags:d,showTags:y,focusOnHover:x,enableRadial:v}=JSON.parse(t.dataset.cfg),w=new Map(Object.entries(await fetchData).map(([$,ne])=>[js($),ne])),P=[],G=[],k=new Set(w.keys()),L=new Map;for(let[$,ne]of w.entries()){let qe=ne.links??[];for(let yt of qe)k.has(yt)&&P.push({source:$,target:yt});if(y){let yt=ne.tags.filter(rr=>!d.includes(rr)).map(rr=>js("tags/"+rr));G.push(...yt.filter(rr=>!G.includes(rr)));for(let rr of yt)P.push({source:$,target:rr})}}let N=new Set,H=[r,"__SENTINEL"];if(a>=0)for(;a>=0&&H.length>0;){let $=H.shift();if($==="__SENTINEL")a--,H.push("__SENTINEL");else{N.add($);let ne=P.filter(yt=>yt.source===$),qe=P.filter(yt=>yt.target===$);H.push(...ne.map(yt=>yt.target),...qe.map(yt=>yt.source))}}else k.forEach($=>N.add($)),y&&G.forEach($=>N.add($));let fe=[...N].map($=>{let ne=$.startsWith("tags/")?"#"+$.substring(5):w.get($)?.title??$;return{id:$,text:ne,tags:w.get($)?.tags??[]}}),ue={nodes:fe,links:P.filter($=>N.has($.source)&&N.has($.target)).map($=>({source:fe.find(ne=>ne.id===$.source),target:fe.find(ne=>ne.id===$.target)}))},ae=t.offsetWidth,le=Math.max(t.offsetHeight,250),ke=fA(ue.nodes).force("charge",pA().strength(-100*l)).force("center",NC().strength(h)).force("link",oA(ue.links).distance(u)).force("collide",sA($=>X($)).iterations(3)),We=Math.min(ae,le)/2*.8;v&&ke.force("radial",gA(We).strength(.2));let U=["--secondary","--tertiary","--gray","--light","--lightgray","--dark","--darkgray","--bodyFont"].reduce(($,ne)=>($[ne]=getComputedStyle(document.documentElement).getPropertyValue(ne),$),{}),we=$=>$.id===r?U["--secondary"]:i.has($.id)||$.id.startsWith("tags/")?U["--tertiary"]:U["--gray"];function X($){let ne=ue.links.filter(qe=>qe.source.id===$.id||qe.target.id===$.id).length;return 2+Math.sqrt(ne)}let se=null,A=new Set,B=[],R=[];function Y($){if(se=$,$===null){A=new Set;for(let ne of R)ne.active=!1;for(let ne of B)ne.active=!1}else{A=new Set;for(let ne of B){let qe=ne.simulationData;(qe.source.id===$||qe.target.id===$)&&(A.add(qe.source.id),A.add(qe.target.id)),ne.active=qe.source.id===$||qe.target.id===$}for(let ne of R)ne.active=A.has(ne.simulationData.id)}}let K=0,ee=!1;function te(){L.get("link")?.stop();let $=new No;for(let ne of B){let qe=1;se&&(qe=ne.active?1:.2),ne.color=ne.active?U["--gray"]:U["--lightgray"],$.add(new Ho(ne).to({alpha:qe},200))}$.getAll().forEach(ne=>ne.start()),L.set("link",{update:$.update.bind($),stop(){$.getAll().forEach(ne=>ne.stop())}})}function de(){L.get("label")?.stop();let $=new No,ne=1/o,qe=ne*1.1;for(let yt of R){let rr=yt.simulationData.id;se===rr?$.add(new Ho(yt.label).to({alpha:1,scale:{x:qe,y:qe}},100)):$.add(new Ho(yt.label).to({alpha:yt.label.alpha,scale:{x:ne,y:ne}},100))}$.getAll().forEach(yt=>yt.start()),L.set("label",{update:$.update.bind($),stop(){$.getAll().forEach(yt=>yt.stop())}})}function Pe(){L.get("hover")?.stop();let $=new No;for(let ne of R){let qe=1;se!==null&&x&&(qe=ne.active?1:.2),$.add(new Ho(ne.gfx,$).to({alpha:qe},200))}$.getAll().forEach(ne=>ne.start()),L.set("hover",{update:$.update.bind($),stop(){$.getAll().forEach(ne=>ne.stop())}})}function Ee(){Pe(),te(),de()}L.forEach($=>$.stop()),L.clear();let nt=await HA(),Ye=new Gv;await Ye.init({width:ae,height:le,antialias:!0,autoStart:!1,autoDensity:!0,backgroundAlpha:0,preference:nt,resolution:window.devicePixelRatio,eventMode:"static"}),t.appendChild(Ye.canvas);let tt=Ye.stage;tt.interactive=!1;let Vt=new dr({zIndex:3,isRenderGroup:!0}),st=new dr({zIndex:2,isRenderGroup:!0}),cr=new dr({zIndex:1,isRenderGroup:!0});tt.addChild(st,Vt,cr);for(let $ of ue.nodes){let ne=$.id,qe=new kA({interactive:!1,eventMode:"none",text:$.text,alpha:0,anchor:{x:.5,y:1.2},style:{fontSize:c*15,fill:U["--dark"],fontFamily:U["--bodyFont"]},resolution:window.devicePixelRatio*4});qe.scale.set(1/o);let yt=0,rr=ne.startsWith("tags/"),Uc=new Za({interactive:!0,label:ne,eventMode:"static",hitArea:new ph(0,0,X($)),cursor:"pointer"}).circle(0,0,X($)).fill({color:rr?U["--light"]:we($)}).on("pointerover",jA=>{Y(jA.target.label),yt=qe.alpha,ee||Ee()}).on("pointerleave",()=>{Y(null),qe.alpha=yt,ee||Ee()});rr&&Uc.stroke({width:2,color:U["--tertiary"]}),st.addChild(Uc),Vt.addChild(qe);let zA={simulationData:$,gfx:Uc,label:qe,color:we($),alpha:1,active:!1};R.push(zA)}for(let $ of ue.links){let ne=new Za({interactive:!1,eventMode:"none"});cr.addChild(ne);let qe={simulationData:$,gfx:ne,color:U["--lightgray"],alpha:1,active:!1};B.push(qe)}let lr=Lo;if(n)Vr(Ye.canvas).call(QE().container(()=>Ye.canvas).subject(()=>ue.nodes.find($=>$.id===se)).on("start",function($){$.active||ke.alphaTarget(1).restart(),$.subject.fx=$.subject.x,$.subject.fy=$.subject.y,$.subject.__initialDragPos={x:$.subject.x,y:$.subject.y,fx:$.subject.fx,fy:$.subject.fy},K=Date.now(),ee=!0}).on("drag",function($){let ne=$.subject.__initialDragPos;$.subject.fx=ne.x+($.x-ne.x)/lr.k,$.subject.fy=ne.y+($.y-ne.y)/lr.k}).on("end",function($){if($.active||ke.alphaTarget(0),$.subject.fx=null,$.subject.fy=null,ee=!1,Date.now()-K<500){let ne=ue.nodes.find(yt=>yt.id===$.subject.id),qe=Dv(e,ne.id);window.spaNavigate(new URL(qe,window.location.toString()))}}));else for(let $ of R)$.gfx.on("click",()=>{let ne=Dv(e,$.simulationData.id);window.spaNavigate(new URL(ne,window.location.toString()))});s&&Vr(Ye.canvas).call(TA().extent([[0,0],[ae,le]]).scaleExtent([.25,4]).on("zoom",({transform:$})=>{lr=$,tt.scale.set($.k,$.k),tt.position.set($.x,$.y);let ne=$.k*f,qe=Math.max((ne-1)/3.75,0),yt=R.filter(rr=>rr.active).flatMap(rr=>rr.label);for(let rr of Vt.children)yt.includes(rr)||(rr.alpha=qe)}));let Ar=!1;function on($){if(!Ar){for(let ne of R){let{x:qe,y:yt}=ne.simulationData;!qe||!yt||(ne.gfx.position.set(qe+ae/2,yt+le/2),ne.label&&ne.label.position.set(qe+ae/2,yt+le/2))}for(let ne of B){let qe=ne.simulationData;ne.gfx.clear(),ne.gfx.moveTo(qe.source.x+ae/2,qe.source.y+le/2),ne.gfx.lineTo(qe.target.x+ae/2,qe.target.y+le/2).stroke({alpha:ne.alpha,width:1,color:ne.color})}L.forEach(ne=>ne.update($)),Ye.renderer.render(tt),requestAnimationFrame(on)}}return requestAnimationFrame(on),()=>{Ar=!0,Ye.destroy()}}var Fc=[],Dc=[];function zv(){for(let t of Fc)t();Fc=[]}function jv(){for(let t of Dc)t();Dc=[]}document.addEventListener("nav",async t=>{let e=t.detail.url;NA(js(e));async function r(){zv();let h=document.getElementsByClassName("graph-container");for(let u of h)Fc.push(await Hv(u,e))}await r();let i=()=>{r()};document.addEventListener("themechange",i),window.addCleanup(()=>{document.removeEventListener("themechange",i)});let n=[...document.getElementsByClassName("global-graph-outer")];async function s(){let h=GA(window);for(let u of n){u.classList.add("active");let c=u.closest(".sidebar");c&&(c.style.zIndex="1");let f=u.querySelector(".global-graph-container");BA(u,a),f&&Dc.push(await Hv(f,h))}}function a(){jv();for(let h of n){h.classList.remove("active");let u=h.closest(".sidebar");u&&(u.style.zIndex="")}}async function o(h){h.key==="g"&&(h.ctrlKey||h.metaKey)&&!h.shiftKey&&(h.preventDefault(),n.some(u=>u.classList.contains("active"))?a():s())}let l=document.getElementsByClassName("global-graph-icon");Array.from(l).forEach(h=>{h.addEventListener("click",s),window.addCleanup(()=>h.removeEventListener("click",s))}),document.addEventListener("keydown",o),window.addCleanup(()=>{document.removeEventListener("keydown",o),zv(),jv()})})}(),function(){var Ut=new IntersectionObserver(bt=>{for(let Et of bt){let Ct=Et.target.id,_=document.querySelectorAll(`a[data-for="${Ct}"]`),nr=Et.rootBounds?.height;nr&&_.length>0&&(Et.boundingClientRect.yFt.classList.add("in-view")):_.forEach(Ft=>Ft.classList.remove("in-view")))}});function xt(){this.classList.toggle("collapsed"),this.setAttribute("aria-expanded",this.getAttribute("aria-expanded")==="true"?"false":"true");let bt=this.nextElementSibling;bt&&bt.classList.toggle("collapsed")}function Bt(){for(let bt of document.getElementsByClassName("toc")){let Et=bt.querySelector(".toc-header"),Ct=bt.querySelector(".toc-content");if(!Et||!Ct)return;Et.addEventListener("click",xt),window.addCleanup(()=>Et.removeEventListener("click",xt))}}document.addEventListener("nav",()=>{Bt(),Ut.disconnect(),document.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").forEach(bt=>Ut.observe(bt))})}(),function(){document.addEventListener("nav",Ut=>{const xt=new IntersectionObserver(Et=>{for(const Ct of Et){const _=Ct.target.parentElement;if(!_)return;Ct.isIntersecting?_.classList.remove("gradient-active"):_.classList.add("gradient-active")}}),Bt=document.getElementById("list-1");if(!Bt)return;const bt=Bt.querySelector(".overflow-end");bt&&(xt.observe(bt),window.addCleanup(()=>xt.disconnect()))})}(),function(){document.addEventListener("nav",Ut=>{const xt=new IntersectionObserver(Et=>{for(const Ct of Et){const _=Ct.target.parentElement;if(!_)return;Ct.isIntersecting?_.classList.remove("gradient-active"):_.classList.add("gradient-active")}}),Bt=document.getElementById("list-2");if(!Bt)return;const bt=Bt.querySelector(".overflow-end");bt&&(xt.observe(bt),window.addCleanup(()=>xt.disconnect()))})}(),function(){document.addEventListener("nav",Ut=>{const xt=new IntersectionObserver(Et=>{for(const Ct of Et){const _=Ct.target.parentElement;if(!_)return;Ct.isIntersecting?_.classList.remove("gradient-active"):_.classList.add("gradient-active")}}),Bt=document.getElementById("list-3");if(!Bt)return;const bt=Bt.querySelector(".overflow-end");bt&&(xt.observe(bt),window.addCleanup(()=>xt.disconnect()))})}(),function(){var Ut=Object.create,xt=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,bt=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty,_=(p,m)=>()=>(m||p((m={exports:{}}).exports,m),m.exports),nr=(p,m,T,E)=>{if(m&&typeof m=="object"||typeof m=="function")for(let C of bt(m))!Ct.call(p,C)&&C!==T&&xt(p,C,{get:()=>m[C],enumerable:!(E=Bt(m,C))||E.enumerable});return p},Ft=(p,m,T)=>(T=p!=null?Ut(Et(p)):{},nr(m||!p||!p.__esModule?xt(T,"default",{value:p,enumerable:!0}):T,p)),Lr=_((p,m)=>{"use strict";m.exports=E;function T(M){return M instanceof Buffer?Buffer.from(M):new M.constructor(M.buffer.slice(),M.byteOffset,M.length)}function E(M){if(M=M||{},M.circles)return C(M);let F=new Map;if(F.set(Date,I=>new Date(I)),F.set(Map,(I,Q)=>new Map(W(Array.from(I),Q))),F.set(Set,(I,Q)=>new Set(W(Array.from(I),Q))),M.constructorHandlers)for(let I of M.constructorHandlers)F.set(I[0],I[1]);let V=null;return M.proto?z:q;function W(I,Q){let j=Object.keys(I),re=new Array(j.length);for(let he=0;henew Date(j)),W.set(Map,(j,re)=>new Map(z(Array.from(j),re))),W.set(Set,(j,re)=>new Set(z(Array.from(j),re))),M.constructorHandlers)for(let j of M.constructorHandlers)W.set(j[0],j[1]);let q=null;return M.proto?Q:I;function z(j,re){let he=Object.keys(j),oe=new Array(he.length);for(let Re=0;Re({x:p,y:p}),xe={left:"right",right:"left",bottom:"top",top:"bottom"},J={start:"end",end:"start"};function At(p,m,T){return O(p,Qt(m,T))}function qt(p,m){return typeof p=="function"?p(m):p}function at(p){return p.split("-")[0]}function It(p){return p.split("-")[1]}function Mr(p){return p==="x"?"y":"x"}function Lt(p){return p==="y"?"height":"width"}function lt(p){return["top","bottom"].includes(at(p))?"y":"x"}function Pt(p){return Mr(lt(p))}function wt(p,m,T){T===void 0&&(T=!1);let E=It(p),C=Pt(p),M=Lt(C),F=C==="x"?E===(T?"end":"start")?"right":"left":E==="start"?"bottom":"top";return m.reference[M]>m.floating[M]&&(F=Z(F)),[F,Z(F)]}function Rr(p){let m=Z(p);return[mr(p),m,mr(m)]}function mr(p){return p.replace(/start|end/g,m=>J[m])}function Yr(p,m,T){let E=["left","right"],C=["right","left"],M=["top","bottom"],F=["bottom","top"];switch(p){case"top":case"bottom":return T?m?C:E:m?E:C;case"left":case"right":return m?M:F;default:return[]}}function ge(p,m,T,E){let C=It(p),M=Yr(at(p),T==="start",E);return C&&(M=M.map(F=>F+"-"+C),m&&(M=M.concat(M.map(mr)))),M}function Z(p){return p.replace(/left|right|bottom|top/g,m=>xe[m])}function pe(p){return{top:0,right:0,bottom:0,left:0,...p}}function Ne(p){return typeof p!="number"?pe(p):{top:p,right:p,bottom:p,left:p}}function je(p){let{x:m,y:T,width:E,height:C}=p;return{width:E,height:C,top:T,left:m,right:m+E,bottom:T+C,x:m,y:T}}function rt(p,m,T){let{reference:E,floating:C}=p,M=lt(m),F=Pt(m),V=Lt(F),W=at(m),q=M==="y",z=E.x+E.width/2-C.width/2,I=E.y+E.height/2-C.height/2,Q=E[V]/2-C[V]/2,j;switch(W){case"top":j={x:z,y:E.y-C.height};break;case"bottom":j={x:z,y:E.y+E.height};break;case"right":j={x:E.x+E.width,y:I};break;case"left":j={x:E.x-C.width,y:I};break;default:j={x:E.x,y:E.y}}switch(It(m)){case"start":j[F]-=Q*(T&&q?-1:1);break;case"end":j[F]+=Q*(T&&q?-1:1);break}return j}var $e=async(p,m,T)=>{let{placement:E="bottom",strategy:C="absolute",middleware:M=[],platform:F}=T,V=M.filter(Boolean),W=await(F.isRTL==null?void 0:F.isRTL(m)),q=await F.getElementRects({reference:p,floating:m,strategy:C}),{x:z,y:I}=rt(q,E,W),Q=E,j={},re=0;for(let he=0;heGt<=0)){var Ot,zt;let Gt=(((Ot=M.flip)==null?void 0:Ot.index)||0)+1,qr=Ge[Gt];if(qr){var hr;let Br=I==="alignment"?Je!==lt(qr):!1,Ir=((hr=pt[0])==null?void 0:hr.overflows[0])>0;if(!Br||Ir)return{data:{index:Gt,overflows:pt},reset:{placement:qr}}}let Kr=(zt=pt.filter(Br=>Br.overflows[0]<=0).sort((Br,Ir)=>Br.overflows[1]-Ir.overflows[1])[0])==null?void 0:zt.placement;if(!Kr)switch(j){case"bestFit":{var vr;let Br=(vr=pt.filter(Ir=>{if(_r){let Nr=lt(Ir.placement);return Nr===Je||Nr==="y"}return!0}).map(Ir=>[Ir.placement,Ir.overflows.filter(Nr=>Nr>0).reduce((Nr,Vo)=>Nr+Vo,0)]).sort((Ir,Nr)=>Ir[1]-Nr[1])[0])==null?void 0:vr[0];Br&&(Kr=Br);break}case"initialPlacement":Kr=V;break}if(C!==Kr)return{reset:{placement:Kr}}}return{}}}};function St(p){let m=Qt(...p.map(M=>M.left)),T=Qt(...p.map(M=>M.top)),E=O(...p.map(M=>M.right)),C=O(...p.map(M=>M.bottom));return{x:m,y:T,width:E-m,height:C-T}}function ut(p){let m=p.slice().sort((C,M)=>C.y-M.y),T=[],E=null;for(let C=0;CE.height/2?T.push([M]):T[T.length-1].push(M),E=M}return T.map(C=>je(St(C)))}var Ae=function(p){return p===void 0&&(p={}),{name:"inline",options:p,async fn(m){let{placement:T,elements:E,rects:C,platform:M,strategy:F}=m,{padding:V=2,x:W,y:q}=qt(p,m),z=Array.from(await(M.getClientRects==null?void 0:M.getClientRects(E.reference))||[]),I=ut(z),Q=je(St(z)),j=Ne(V);function re(){if(I.length===2&&I[0].left>I[1].right&&W!=null&&q!=null)return I.find(oe=>W>oe.left-j.left&&Woe.top-j.top&&q=2){if(lt(T)==="y"){let pt=I[0],Ot=I[I.length-1],zt=at(T)==="top",hr=pt.top,vr=Ot.bottom,Gt=zt?pt.left:Ot.left,qr=zt?pt.right:Ot.right,Kr=qr-Gt,Br=vr-hr;return{top:hr,bottom:vr,left:Gt,right:qr,width:Kr,height:Br,x:Gt,y:hr}}let oe=at(T)==="left",Re=O(...I.map(pt=>pt.right)),Je=Qt(...I.map(pt=>pt.left)),Xe=I.filter(pt=>oe?pt.left===Je:pt.right===Re),Rt=Xe[0].top,Be=Xe[Xe.length-1].bottom,_r=Je,Ge=Re,Se=Ge-_r,et=Be-Rt;return{top:Rt,bottom:Be,left:_r,right:Ge,width:Se,height:et,x:_r,y:Rt}}return Q}let he=await M.getElementRects({reference:{getBoundingClientRect:re},floating:E.floating,strategy:F});return C.reference.x!==he.reference.x||C.reference.y!==he.reference.y||C.reference.width!==he.reference.width||C.reference.height!==he.reference.height?{reset:{rects:he}}:{}}}},Le=function(p){return p===void 0&&(p={}),{name:"shift",options:p,async fn(m){let{x:T,y:E,placement:C}=m,{mainAxis:M=!0,crossAxis:F=!1,limiter:V={fn:oe=>{let{x:Re,y:Je}=oe;return{x:Re,y:Je}}},...W}=qt(p,m),q={x:T,y:E},z=await ht(m,W),I=lt(at(C)),Q=Mr(I),j=q[Q],re=q[I];if(M){let oe=Q==="y"?"top":"left",Re=Q==="y"?"bottom":"right",Je=j+z[oe],Xe=j-z[Re];j=At(Je,j,Xe)}if(F){let oe=I==="y"?"top":"left",Re=I==="y"?"bottom":"right",Je=re+z[oe],Xe=re-z[Re];re=At(Je,re,Xe)}let he=V.fn({...m,[Q]:j,[I]:re});return{...he,data:{x:he.x-T,y:he.y-E,enabled:{[Q]:M,[I]:F}}}}}};function be(){return typeof window<"u"}function Te(p){return Ke(p)?(p.nodeName||"").toLowerCase():"#document"}function Ve(p){var m;return(p==null||(m=p.ownerDocument)==null?void 0:m.defaultView)||window}function ve(p){var m;return(m=(Ke(p)?p.ownerDocument:p.document)||window.document)==null?void 0:m.documentElement}function Ke(p){return be()?p instanceof Node||p instanceof Ve(p).Node:!1}function ct(p){return be()?p instanceof Element||p instanceof Ve(p).Element:!1}function D(p){return be()?p instanceof HTMLElement||p instanceof Ve(p).HTMLElement:!1}function ie(p){return!be()||typeof ShadowRoot>"u"?!1:p instanceof ShadowRoot||p instanceof Ve(p).ShadowRoot}function ye(p){let{overflow:m,overflowX:T,overflowY:E,display:C}=gt(p);return/auto|scroll|overlay|hidden|clip/.test(m+E+T)&&!["inline","contents"].includes(C)}function Ie(p){return["table","td","th"].includes(Te(p))}function ze(p){return[":popover-open",":modal"].some(m=>{try{return p.matches(m)}catch{return!1}})}function Ce(p){let m=De(),T=ct(p)?gt(p):p;return["transform","translate","scale","rotate","perspective"].some(E=>T[E]?T[E]!=="none":!1)||(T.containerType?T.containerType!=="normal":!1)||!m&&(T.backdropFilter?T.backdropFilter!=="none":!1)||!m&&(T.filter?T.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(E=>(T.willChange||"").includes(E))||["paint","layout","strict","content"].some(E=>(T.contain||"").includes(E))}function ce(p){let m=Ue(p);for(;D(m)&&!ft(m);){if(Ce(m))return m;if(ze(m))return null;m=Ue(m)}return null}function De(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ft(p){return["html","body","#document"].includes(Te(p))}function gt(p){return Ve(p).getComputedStyle(p)}function Kt(p){return ct(p)?{scrollLeft:p.scrollLeft,scrollTop:p.scrollTop}:{scrollLeft:p.scrollX,scrollTop:p.scrollY}}function Ue(p){if(Te(p)==="html")return p;let m=p.assignedSlot||p.parentNode||ie(p)&&p.host||ve(p);return ie(m)?m.host:m}function mt(p){let m=Ue(p);return ft(m)?p.ownerDocument?p.ownerDocument.body:p.body:D(m)&&ye(m)?m:mt(m)}function Me(p,m,T){var E;m===void 0&&(m=[]),T===void 0&&(T=!0);let C=mt(p),M=C===((E=p.ownerDocument)==null?void 0:E.body),F=Ve(C);if(M){let V=_e(F);return m.concat(F,F.visualViewport||[],ye(C)?C:[],V&&T?Me(V):[])}return m.concat(C,Me(C,[],T))}function _e(p){return p.parent&&Object.getPrototypeOf(p.parent)?p.frameElement:null}function _t(p){let m=gt(p),T=parseFloat(m.width)||0,E=parseFloat(m.height)||0,C=D(p),M=C?p.offsetWidth:T,F=C?p.offsetHeight:E,V=sr(T)!==M||sr(E)!==F;return V&&(T=M,E=F),{width:T,height:E,$:V}}function He(p){return ct(p)?p:p.contextElement}function me(p){let m=He(p);if(!D(m))return Ht(1);let T=m.getBoundingClientRect(),{width:E,height:C,$:M}=_t(m),F=(M?sr(T.width):T.width)/E,V=(M?sr(T.height):T.height)/C;return(!F||!Number.isFinite(F))&&(F=1),(!V||!Number.isFinite(V))&&(V=1),{x:F,y:V}}var Tr=Ht(0);function Jt(p){let m=Ve(p);return!De()||!m.visualViewport?Tr:{x:m.visualViewport.offsetLeft,y:m.visualViewport.offsetTop}}function Ze(p,m,T){return m===void 0&&(m=!1),!T||m&&T!==Ve(p)?!1:m}function Yt(p,m,T,E){m===void 0&&(m=!1),T===void 0&&(T=!1);let C=p.getBoundingClientRect(),M=He(p),F=Ht(1);m&&(E?ct(E)&&(F=me(E)):F=me(p));let V=Ze(M,T,E)?Jt(M):Ht(0),W=(C.left+V.x)/F.x,q=(C.top+V.y)/F.y,z=C.width/F.x,I=C.height/F.y;if(M){let Q=Ve(M),j=E&&ct(E)?Ve(E):E,re=Q,he=_e(re);for(;he&&E&&j!==re;){let oe=me(he),Re=he.getBoundingClientRect(),Je=gt(he),Xe=Re.left+(he.clientLeft+parseFloat(Je.paddingLeft))*oe.x,Rt=Re.top+(he.clientTop+parseFloat(Je.paddingTop))*oe.y;W*=oe.x,q*=oe.y,z*=oe.x,I*=oe.y,W+=Xe,q+=Rt,re=Ve(he),he=_e(re)}}return je({width:z,height:I,x:W,y:q})}function ci(p,m){let T=Kt(p).scrollLeft;return m?m.left+T:Yt(ve(p)).left+T}function Mt(p,m,T){T===void 0&&(T=!1);let E=p.getBoundingClientRect(),C=E.left+m.scrollLeft-(T?0:ci(p,E)),M=E.top+m.scrollTop;return{x:C,y:M}}function wi(p){let{elements:m,rect:T,offsetParent:E,strategy:C}=p,M=C==="fixed",F=ve(E),V=m?ze(m.floating):!1;if(E===F||V&&M)return T;let W={scrollLeft:0,scrollTop:0},q=Ht(1),z=Ht(0),I=D(E);if((I||!I&&!M)&&((Te(E)!=="body"||ye(F))&&(W=Kt(E)),D(E))){let j=Yt(E);q=me(E),z.x=j.x+E.clientLeft,z.y=j.y+E.clientTop}let Q=F&&!I&&!M?Mt(F,W,!0):Ht(0);return{width:T.width*q.x,height:T.height*q.y,x:T.x*q.x-W.scrollLeft*q.x+z.x+Q.x,y:T.y*q.y-W.scrollTop*q.y+z.y+Q.y}}function Wt(p){return Array.from(p.getClientRects())}function Qe(p){let m=ve(p),T=Kt(p),E=p.ownerDocument.body,C=O(m.scrollWidth,m.clientWidth,E.scrollWidth,E.clientWidth),M=O(m.scrollHeight,m.clientHeight,E.scrollHeight,E.clientHeight),F=-T.scrollLeft+ci(p),V=-T.scrollTop;return gt(E).direction==="rtl"&&(F+=O(m.clientWidth,E.clientWidth)-C),{width:C,height:M,x:F,y:V}}function Fi(p,m){let T=Ve(p),E=ve(p),C=T.visualViewport,M=E.clientWidth,F=E.clientHeight,V=0,W=0;if(C){M=C.width,F=C.height;let q=De();(!q||q&&m==="fixed")&&(V=C.offsetLeft,W=C.offsetTop)}return{width:M,height:F,x:V,y:W}}function ot(p,m){let T=Yt(p,!0,m==="fixed"),E=T.top+p.clientTop,C=T.left+p.clientLeft,M=D(p)?me(p):Ht(1),F=p.clientWidth*M.x,V=p.clientHeight*M.y,W=C*M.x,q=E*M.y;return{width:F,height:V,x:W,y:q}}function Di(p,m,T){let E;if(m==="viewport")E=Fi(p,T);else if(m==="document")E=Qe(ve(p));else if(ct(m))E=ot(m,T);else{let C=Jt(p);E={x:m.x-C.x,y:m.y-C.y,width:m.width,height:m.height}}return je(E)}function kt(p,m){let T=Ue(p);return T===m||!ct(T)||ft(T)?!1:gt(T).position==="fixed"||kt(T,m)}function Ti(p,m){let T=m.get(p);if(T)return T;let E=Me(p,[],!1).filter(V=>ct(V)&&Te(V)!=="body"),C=null,M=gt(p).position==="fixed",F=M?Ue(p):p;for(;ct(F)&&!ft(F);){let V=gt(F),W=Ce(F);!W&&V.position==="fixed"&&(C=null),(M?!W&&!C:!W&&V.position==="static"&&C&&["absolute","fixed"].includes(C.position)||ye(F)&&!W&&kt(p,F))?E=E.filter(q=>q!==F):C=V,F=Ue(F)}return m.set(p,E),E}function ln(p){let{element:m,boundary:T,rootBoundary:E,strategy:C}=p,M=[...T==="clippingAncestors"?ze(m)?[]:Ti(m,this._c):[].concat(T),E],F=M[0],V=M.reduce((W,q)=>{let z=Di(m,q,C);return W.top=O(z.top,W.top),W.right=Qt(z.right,W.right),W.bottom=Qt(z.bottom,W.bottom),W.left=O(z.left,W.left),W},Di(m,F,C));return{width:V.right-V.left,height:V.bottom-V.top,x:V.left,y:V.top}}function hn(p){let{width:m,height:T}=_t(p);return{width:m,height:T}}function it(p,m,T){let E=D(m),C=ve(m),M=T==="fixed",F=Yt(p,!0,M,m),V={scrollLeft:0,scrollTop:0},W=Ht(0);function q(){W.x=ci(C)}if(E||!E&&!M)if((Te(m)!=="body"||ye(C))&&(V=Kt(m)),E){let j=Yt(m,!0,M,m);W.x=j.x+m.clientLeft,W.y=j.y+m.clientTop}else C&&q();M&&!E&&C&&q();let z=C&&!E&&!M?Mt(C,V):Ht(0),I=F.left+V.scrollLeft-W.x-z.x,Q=F.top+V.scrollTop-W.y-z.y;return{x:I,y:Q,width:F.width,height:F.height}}function Zt(p){return gt(p).position==="static"}function Ui(p,m){if(!D(p)||gt(p).position==="fixed")return null;if(m)return m(p);let T=p.offsetParent;return ve(p)===T&&(T=T.ownerDocument.body),T}function Li(p,m){let T=Ve(p);if(ze(p))return T;if(!D(p)){let C=Ue(p);for(;C&&!ft(C);){if(ct(C)&&!Zt(C))return C;C=Ue(C)}return T}let E=Ui(p,m);for(;E&&Ie(E)&&Zt(E);)E=Ui(E,m);return E&&ft(E)&&Zt(E)&&!Ce(E)?T:E||ce(p)||T}var Sr=async function(p){let m=this.getOffsetParent||Li,T=this.getDimensions,E=await T(p.floating);return{reference:it(p.reference,await m(p.floating),p.strategy),floating:{x:0,y:0,width:E.width,height:E.height}}};function ir(p){return gt(p).direction==="rtl"}var un={convertOffsetParentRelativeRectToViewportRelativeRect:wi,getDocumentElement:ve,getClippingRect:ln,getOffsetParent:Li,getElementRects:Sr,getClientRects:Wt,getDimensions:hn,getScale:me,isElement:ct,isRTL:ir},di=Le,cn=Tt,Ni=Ae,kr=(p,m,T)=>{let E=new Map,C={platform:un,...T},M={...C.platform,_c:E};return $e(p,m,{...C,platform:M})},fi=Object.hasOwnProperty,dn=Ft(Lr(),1),Si=(0,dn.default)(),Hi=(p,m,T)=>{let E=new URL(p.getAttribute(m),T);p.setAttribute(m,E.pathname+E.hash)};function fn(p,m){p.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach(T=>Hi(T,"href",m)),p.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach(T=>Hi(T,"src",m))}var jn=//;async function zi(p){let m=await fetch(`${p}`);if(!m.headers.get("content-type")?.startsWith("text/html"))return m;let T=await m.clone().text(),[E,C]=T.match(jn)??[];return C?fetch(`${new URL(C,p)}`):m}var Vn=new DOMParser,g=null;async function b({clientX:p,clientY:m}){let T=g=this;if(T.dataset.noPopover==="true")return;async function E(he){let{x:oe,y:Re}=await kr(T,he,{strategy:"fixed",middleware:[Ni({x:p,y:m}),di(),cn()]});Object.assign(he.style,{transform:`translate(${oe.toFixed()}px, ${Re.toFixed()}px)`})}function C(he){if(S(),he.classList.add("active-popover"),E(he),F!==""){let oe=`#popover-internal-${F.slice(1)}`,Re=re.querySelector(oe);Re&&re.scroll({top:Re.offsetTop-12,behavior:"instant"})}}let M=new URL(T.href),F=decodeURIComponent(M.hash);M.hash="",M.search="";let V=`popover-${T.pathname}`,W=document.getElementById(V);if(document.getElementById(V)){C(W);return}let q=await zi(M).catch(he=>{console.error(he)});if(!q)return;let[z]=q.headers.get("Content-Type").split(";"),[I,Q]=z.split("/"),j=document.createElement("div");j.id=V,j.classList.add("popover");let re=document.createElement("div");switch(re.classList.add("popover-inner"),re.dataset.contentType=z??void 0,j.appendChild(re),I){case"image":let he=document.createElement("img");he.src=M.toString(),he.alt=M.pathname,re.appendChild(he);break;case"application":switch(Q){case"pdf":let Xe=document.createElement("iframe");Xe.src=M.toString(),re.appendChild(Xe);break;default:break}break;default:let oe=await q.text(),Re=Vn.parseFromString(oe,"text/html");fn(Re,M),Re.querySelectorAll("[id]").forEach(Xe=>{let Rt=`popover-internal-${Xe.id}`;Xe.id=Rt});let Je=[...Re.getElementsByClassName("popover-hint")];if(Je.length===0)return;Je.forEach(Xe=>re.appendChild(Xe))}document.getElementById(V)||(document.body.appendChild(j),g===this&&C(j))}function S(){g=null,document.querySelectorAll(".popover").forEach(p=>p.classList.remove("active-popover"))}document.addEventListener("nav",()=>{let p=[...document.querySelectorAll("a.internal")];for(let m of p)m.addEventListener("mouseenter",b),m.addEventListener("mouseleave",S),window.addCleanup(()=>{m.removeEventListener("mouseenter",b),m.removeEventListener("mouseleave",S)})})}(),function(){const Ut=document.createElement("script");Ut.src="https://plausible.io/js/script.manual.js",Ut.setAttribute("data-domain",location.hostname),Ut.defer=!0,Ut.onload=()=>{window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)},plausible("pageview"),document.addEventListener("nav",()=>{plausible("pageview")})},document.head.appendChild(Ut)}(),function(){var Ut=Object.create,xt=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,bt=Object.getOwnPropertyNames,Et=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty,_=(D,ie)=>()=>(ie||D((ie={exports:{}}).exports,ie),ie.exports),nr=(D,ie,ye,Ie)=>{if(ie&&typeof ie=="object"||typeof ie=="function")for(let ze of bt(ie))!Ct.call(D,ze)&&ze!==ye&&xt(D,ze,{get:()=>ie[ze],enumerable:!(Ie=Bt(ie,ze))||Ie.enumerable});return D},Ft=(D,ie,ye)=>(ye=D!=null?Ut(Et(D)):{},nr(ie||!D||!D.__esModule?xt(ye,"default",{value:D,enumerable:!0}):ye,D)),Lr=_((D,ie)=>{"use strict";ie.exports=Ie;function ye(Ce){return Ce instanceof Buffer?Buffer.from(Ce):new Ce.constructor(Ce.buffer.slice(),Ce.byteOffset,Ce.length)}function Ie(Ce){if(Ce=Ce||{},Ce.circles)return ze(Ce);let ce=new Map;if(ce.set(Date,Ue=>new Date(Ue)),ce.set(Map,(Ue,mt)=>new Map(ft(Array.from(Ue),mt))),ce.set(Set,(Ue,mt)=>new Set(ft(Array.from(Ue),mt))),Ce.constructorHandlers)for(let Ue of Ce.constructorHandlers)ce.set(Ue[0],Ue[1]);let De=null;return Ce.proto?Kt:gt;function ft(Ue,mt){let Me=Object.keys(Ue),_e=new Array(Me.length);for(let _t=0;_tnew Date(Me)),ft.set(Map,(Me,_e)=>new Map(Kt(Array.from(Me),_e))),ft.set(Set,(Me,_e)=>new Set(Kt(Array.from(Me),_e))),Ce.constructorHandlers)for(let Me of Ce.constructorHandlers)ft.set(Me[0],Me[1]);let gt=null;return Ce.proto?mt:Ue;function Kt(Me,_e){let _t=Object.keys(Me),He=new Array(_t.length);for(let me=0;me<_t.length;me++){let Tr=_t[me],Jt=Me[Tr];if(typeof Jt!="object"||Jt===null)He[Tr]=Jt;else if(Jt.constructor!==Object&&(gt=ft.get(Jt.constructor)))He[Tr]=gt(Jt,_e);else if(ArrayBuffer.isView(Jt))He[Tr]=ye(Jt);else{let Ze=ce.indexOf(Jt);Ze!==-1?He[Tr]=De[Ze]:He[Tr]=_e(Jt)}}return He}function Ue(Me){if(typeof Me!="object"||Me===null)return Me;if(Array.isArray(Me))return Kt(Me,Ue);if(Me.constructor!==Object&&(gt=ft.get(Me.constructor)))return gt(Me,Ue);let _e={};ce.push(Me),De.push(_e);for(let _t in Me){if(Object.hasOwnProperty.call(Me,_t)===!1)continue;let He=Me[_t];if(typeof He!="object"||He===null)_e[_t]=He;else if(He.constructor!==Object&&(gt=ft.get(He.constructor)))_e[_t]=gt(He,Ue);else if(ArrayBuffer.isView(He))_e[_t]=ye(He);else{let me=ce.indexOf(He);me!==-1?_e[_t]=De[me]:_e[_t]=Ue(He)}}return ce.pop(),De.pop(),_e}function mt(Me){if(typeof Me!="object"||Me===null)return Me;if(Array.isArray(Me))return Kt(Me,mt);if(Me.constructor!==Object&&(gt=ft.get(Me.constructor)))return gt(Me,mt);let _e={};ce.push(Me),De.push(_e);for(let _t in Me){let He=Me[_t];if(typeof He!="object"||He===null)_e[_t]=He;else if(He.constructor!==Object&&(gt=ft.get(He.constructor)))_e[_t]=gt(He,mt);else if(ArrayBuffer.isView(He))_e[_t]=ye(He);else{let me=ce.indexOf(He);me!==-1?_e[_t]=De[me]:_e[_t]=mt(He)}}return ce.pop(),De.pop(),_e}}}),Qt=D=>(ie,ye)=>ie[`node${D}`]===ye[`node${D}`],O=Qt("Name"),sr=Qt("Type"),Ht=Qt("Value");function xe(D,ie){if(D.attributes.length===0&&ie.attributes.length===0)return[];let ye=[],Ie=new Map,ze=new Map;for(let Ce of D.attributes)Ie.set(Ce.name,Ce.value);for(let Ce of ie.attributes){let ce=Ie.get(Ce.name);Ce.value===ce?Ie.delete(Ce.name):(typeof ce<"u"&&Ie.delete(Ce.name),ze.set(Ce.name,Ce.value))}for(let Ce of Ie.keys())ye.push({type:5,name:Ce});for(let[Ce,ce]of ze.entries())ye.push({type:4,name:Ce,value:ce});return ye}function J(D,ie=!0){let ye=`${D.localName}`;for(let{name:Ie,value:ze}of D.attributes)ie&&Ie.startsWith("data-")||(ye+=`[${Ie}=${ze}]`);return ye+=D.innerHTML,ye}function At(D){switch(D.tagName){case"BASE":case"TITLE":return D.localName;case"META":{if(D.hasAttribute("name"))return`meta[name="${D.getAttribute("name")}"]`;if(D.hasAttribute("property"))return`meta[name="${D.getAttribute("property")}"]`;break}case"LINK":{if(D.hasAttribute("rel")&&D.hasAttribute("href"))return`link[rel="${D.getAttribute("rel")}"][href="${D.getAttribute("href")}"]`;if(D.hasAttribute("href"))return`link[href="${D.getAttribute("href")}"]`;break}}return J(D)}function qt(D){let[ie,ye=""]=D.split("?");return`${ie}?t=${Date.now()}&${ye.replace(/t=\d+/g,"")}`}function at(D){if(D.nodeType===1&&D.hasAttribute("data-persist"))return D;if(D.nodeType===1&&D.localName==="script"){let ie=document.createElement("script");for(let{name:ye,value:Ie}of D.attributes)ye==="src"&&(Ie=qt(Ie)),ie.setAttribute(ye,Ie);return ie.innerHTML=D.innerHTML,ie}return D.cloneNode(!0)}function It(D,ie){if(D.children.length===0&&ie.children.length===0)return[];let ye=[],Ie=new Map,ze=new Map,Ce=new Map;for(let ce of D.children)Ie.set(At(ce),ce);for(let ce of ie.children){let De=At(ce),ft=Ie.get(De);ft?J(ce,!1)!==J(ft,!1)&&ze.set(De,at(ce)):Ce.set(De,at(ce)),Ie.delete(De)}for(let ce of D.childNodes){if(ce.nodeType===1){let De=At(ce);if(Ie.has(De)){ye.push({type:1});continue}else if(ze.has(De)){let ft=ze.get(De);ye.push({type:3,attributes:xe(ce,ft),children:Mr(ce,ft)});continue}}ye.push(void 0)}for(let ce of Ce.values())ye.push({type:0,node:at(ce)});return ye}function Mr(D,ie){let ye=[],Ie=Math.max(D.childNodes.length,ie.childNodes.length);for(let ze=0;zePt(Ie,De,ce[ft])));return}}}function wt(D,ie){let ye=Lt(D,ie);return Pt(D,ye)}var Rr=Object.hasOwnProperty,mr=Ft(Lr(),1),Yr=(0,mr.default)();function ge(D){return D.document.body.dataset.slug}var Z=(D,ie,ye)=>{let Ie=new URL(D.getAttribute(ie),ye);D.setAttribute(ie,Ie.pathname+Ie.hash)};function pe(D,ie){D.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach(ye=>Z(ye,"href",ie)),D.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach(ye=>Z(ye,"src",ie))}var Ne=//;async function je(D){let ie=await fetch(`${D}`);if(!ie.headers.get("content-type")?.startsWith("text/html"))return ie;let ye=await ie.clone().text(),[Ie,ze]=ye.match(Ne)??[];return ze?fetch(`${new URL(ze,D)}`):ie}var rt=1,$e=document.createElement("route-announcer"),ht=D=>D?.nodeType===rt,Tt=D=>{try{let ie=new URL(D);if(window.location.origin===ie.origin)return!0}catch{}return!1},St=D=>{let ie=D.origin===window.location.origin,ye=D.pathname===window.location.pathname;return ie&&ye},ut=({target:D})=>{if(!ht(D)||D.attributes.getNamedItem("target")?.value==="_blank")return;let ie=D.closest("a");if(!ie||"routerIgnore"in ie.dataset)return;let{href:ye}=ie;if(Tt(ye))return{url:new URL(ye),scroll:"routerNoscroll"in ie.dataset?!1:void 0}};function Ae(D){let ie=new CustomEvent("nav",{detail:{url:D}});document.dispatchEvent(ie)}var Le=new Set;window.addCleanup=D=>Le.add(D);function be(){let D=document.createElement("div");D.className="navigation-progress",D.style.width="0",document.body.contains(D)||document.body.appendChild(D),setTimeout(()=>{D.style.width="80%"},100)}var Te=!1,Ve;async function ve(D,ie=!1){Te=!0,be(),Ve=Ve||new DOMParser;let ye=await je(D).then(ce=>{if(ce.headers.get("content-type")?.startsWith("text/html"))return ce.text();window.location.assign(D)}).catch(()=>{window.location.assign(D)});if(!ye)return;let Ie=new CustomEvent("prenav",{detail:{}});document.dispatchEvent(Ie),Le.forEach(ce=>ce()),Le.clear();let ze=Ve.parseFromString(ye,"text/html");pe(ze,D);let Ce=ze.querySelector("title")?.textContent;if(Ce)document.title=Ce;else{let ce=document.querySelector("h1");Ce=ce?.innerText??ce?.textContent??D.pathname}$e.textContent!==Ce&&($e.textContent=Ce),$e.dataset.persist="",ze.body.appendChild($e),wt(document.body,ze.body),ie||(D.hash?document.getElementById(decodeURIComponent(D.hash.substring(1)))?.scrollIntoView():window.scrollTo({top:0})),document.head.querySelectorAll(":not([spa-preserve])").forEach(ce=>ce.remove()),ze.head.querySelectorAll(":not([spa-preserve])").forEach(ce=>document.head.appendChild(ce)),ie||history.pushState({},"",D),Ae(ge(window)),delete $e.dataset.persist}async function Ke(D,ie=!1){if(!Te){Te=!0;try{await ve(D,ie)}catch(ye){console.error(ye),window.location.assign(D)}finally{Te=!1}}}window.spaNavigate=Ke;function ct(){return typeof window<"u"&&(window.addEventListener("click",async D=>{let{url:ie}=ut(D)??{};if(!(!ie||D.ctrlKey||D.metaKey)){if(D.preventDefault(),St(ie)&&ie.hash){document.getElementById(decodeURIComponent(ie.hash.substring(1)))?.scrollIntoView(),history.pushState({},"",ie);return}Ke(ie,!1)}}),window.addEventListener("popstate",D=>{let{url:ie}=ut(D)??{};window.location.hash&&window.location.pathname===ie?.pathname||Ke(new URL(window.location.toString()),!0)})),new class{go(D){let ie=new URL(D,window.location.toString());return Ke(ie,!1)}back(){return window.history.back()}forward(){return window.history.forward()}}}if(ct(),Ae(ge(window)),!customElements.get("route-announcer")){let D={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};customElements.define("route-announcer",class extends HTMLElement{constructor(){super()}connectedCallback(){for(let[ie,ye]of Object.entries(D))this.setAttribute(ie,ye)}})}}(); diff --git a/app/prescript.js b/app/prescript.js new file mode 100644 index 0000000..f95a101 --- /dev/null +++ b/app/prescript.js @@ -0,0 +1 @@ +(function(){var d=window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark",a=localStorage.getItem("theme")??d;document.documentElement.setAttribute("saved-theme",a);var n=e=>{let m=new CustomEvent("themechange",{detail:{theme:e}});document.dispatchEvent(m)};document.addEventListener("nav",()=>{let e=()=>{let t=document.documentElement.getAttribute("saved-theme")==="dark"?"light":"dark";document.documentElement.setAttribute("saved-theme",t),localStorage.setItem("theme",t),n(t)},m=t=>{let o=t.matches?"dark":"light";document.documentElement.setAttribute("saved-theme",o),localStorage.setItem("theme",o),n(o)};for(let t of document.getElementsByClassName("darkmode"))t.addEventListener("click",e),window.addCleanup(()=>t.removeEventListener("click",e));let c=window.matchMedia("(prefers-color-scheme: dark)");c.addEventListener("change",m),window.addCleanup(()=>c.removeEventListener("change",m))})})(),function(){var d=!1,a=n=>{let e=new CustomEvent("readermodechange",{detail:{mode:n}});document.dispatchEvent(e)};document.addEventListener("nav",()=>{let n=()=>{d=!d;let e=d?"on":"off";document.documentElement.setAttribute("reader-mode",e),a(e)};for(let e of document.getElementsByClassName("readermode"))e.addEventListener("click",n),window.addCleanup(()=>e.removeEventListener("click",n));document.documentElement.setAttribute("reader-mode",d?"on":"off")})}(); diff --git a/app/sitemap.xml b/app/sitemap.xml new file mode 100644 index 0000000..2440a32 --- /dev/null +++ b/app/sitemap.xml @@ -0,0 +1,7 @@ + + https://quartz.jzhao.xyz/build-your-Quartz + 2025-06-10T02:33:41.400Z + + https://quartz.jzhao.xyz/ + 2023-08-23T19:09:04.000Z + \ No newline at end of file diff --git a/app/static/contentIndex.json b/app/static/contentIndex.json new file mode 100644 index 0000000..820d3f1 --- /dev/null +++ b/app/static/contentIndex.json @@ -0,0 +1 @@ +{"build-your-Quartz":{"slug":"build-your-Quartz","filePath":"build-your-Quartz.md","title":"build-your-Quartz","links":[],"tags":[],"content":"在您初始化 Quartz 之后,我们可以来看看它在本地构建出来的样子:\nnpx quartz build --serve\n\n这将在您的计算机上启动一个本地 Web 服务器来运行 Quartz,打开浏览器并访问 http://localhost:8080/ 进行查看。\n其他参数选项\n要获得完整的帮助选项,您可以运行 npx quartz build --help.\n其中大多数都有合理的默认值,但如果您需要自定义设置,则可以覆盖它们:\n-d 或 --directory: 内容文件夹,一般即 content\n-v 或 --verbose: 输出额外的日志信息\n-o 或 --output: 输出文件夹,一般即 public\n--serve: 在本地运行一个支持热重载的服务器来预览您的 Quartz\n--port: 本地服务器运行的端口\n--concurrency: 解析文档内容所使用的线程数"},"index":{"slug":"index","filePath":"index.md","title":"Welcome to Quartz","links":[],"tags":[],"content":"This is a blank Quartz installation.\nSee the documentation for how to get started."}} \ No newline at end of file diff --git a/app/static/giscus/dark.css b/app/static/giscus/dark.css new file mode 100644 index 0000000..e98088f --- /dev/null +++ b/app/static/giscus/dark.css @@ -0,0 +1,99 @@ +/*! MIT License + * Copyright (c) 2018 GitHub Inc. + * https://github.com/primer/primitives/blob/main/LICENSE + */ + +main { + --color-prettylights-syntax-comment: #8b949e; + --color-prettylights-syntax-constant: #79c0ff; + --color-prettylights-syntax-entity: #d2a8ff; + --color-prettylights-syntax-storage-modifier-import: #c9d1d9; + --color-prettylights-syntax-entity-tag: #7ee787; + --color-prettylights-syntax-keyword: #ff7b72; + --color-prettylights-syntax-string: #a5d6ff; + --color-prettylights-syntax-variable: #ffa657; + --color-prettylights-syntax-brackethighlighter-unmatched: #f85149; + --color-prettylights-syntax-invalid-illegal-text: #f0f6fc; + --color-prettylights-syntax-invalid-illegal-bg: #8e1519; + --color-prettylights-syntax-carriage-return-text: #f0f6fc; + --color-prettylights-syntax-carriage-return-bg: #b62324; + --color-prettylights-syntax-string-regexp: #7ee787; + --color-prettylights-syntax-markup-list: #f2cc60; + --color-prettylights-syntax-markup-heading: #1f6feb; + --color-prettylights-syntax-markup-italic: #c9d1d9; + --color-prettylights-syntax-markup-bold: #c9d1d9; + --color-prettylights-syntax-markup-deleted-text: #ffdcd7; + --color-prettylights-syntax-markup-deleted-bg: #67060c; + --color-prettylights-syntax-markup-inserted-text: #aff5b4; + --color-prettylights-syntax-markup-inserted-bg: #033a16; + --color-prettylights-syntax-markup-changed-text: #ffdfb6; + --color-prettylights-syntax-markup-changed-bg: #5a1e02; + --color-prettylights-syntax-markup-ignored-text: #c9d1d9; + --color-prettylights-syntax-markup-ignored-bg: #1158c7; + --color-prettylights-syntax-meta-diff-range: #d2a8ff; + --color-prettylights-syntax-brackethighlighter-angle: #8b949e; + --color-prettylights-syntax-sublimelinter-gutter-mark: #484f58; + --color-prettylights-syntax-constant-other-reference-link: #a5d6ff; + --color-btn-text: #d4d4d4; /* --darkgray */ + --color-btn-bg: #161618; /* --light */ + --color-btn-border: rgb(240, 246, 252 / 10%); /* --dark */ + --color-btn-shadow: 0 0 transparent; + --color-btn-inset-shadow: 0 0 transparent; + --color-btn-hover-bg: #30363d; + --color-btn-hover-border: #8b949e; + --color-btn-active-bg: hsl(212deg 12% 18% / 100%); + --color-btn-active-border: #6e7681; + --color-btn-selected-bg: #161b22; + --color-btn-primary-text: #fff; + --color-btn-primary-bg: #84a59d; /* --tertiary */ + --color-btn-primary-border: rgb(240, 246, 252 / 10%); /* --dark */ + --color-btn-primary-shadow: 0 0 transparent; + --color-btn-primary-inset-shadow: 0 0 transparent; + --color-btn-primary-hover-bg: #7b97aa; /* --secondary */ + --color-btn-primary-hover-border: rgb(240, 246, 252 / 10%); /* --dark */ + --color-btn-primary-selected-bg: #7b97aa; /* --secondary */ + --color-btn-primary-selected-shadow: 0 0 transparent; + --color-btn-primary-disabled-text: rgba(33, 32, 32, 0.5); + --color-btn-primary-disabled-bg: rgb(35 134 54 / 60%); + --color-btn-primary-disabled-border: rgb(240 246 252 / 10%); + --color-action-list-item-default-hover-bg: rgb(177 186 196 / 12%); + --color-segmented-control-bg: rgb(110 118 129 / 10%); + --color-segmented-control-button-bg: #0d1117; + --color-segmented-control-button-selected-border: #6e7681; + --color-fg-default: #ebebec; /* --dark */ + --color-fg-muted: #d4d4d4; /* --darkgray */ + --color-fg-subtle: #d4d4d4; /* --darkgray */ + --color-canvas-default: #0d1117; + --color-canvas-overlay: #161b22; + --color-canvas-inset: #010409; + --color-canvas-subtle: #161b22; + --color-border-default: #30363d; + --color-border-muted: #21262d; + --color-neutral-muted: rgb(110 118 129 / 40%); + --color-accent-fg: #2f81f7; + --color-accent-emphasis: #1f6feb; + --color-accent-muted: rgb(56 139 253 / 40%); + --color-accent-subtle: rgb(56 139 253 / 10%); + --color-success-fg: #3fb950; + --color-attention-fg: #d29922; + --color-attention-muted: rgb(187 128 9 / 40%); + --color-attention-subtle: rgb(187 128 9 / 15%); + --color-danger-fg: #f85149; + --color-danger-muted: rgb(248 81 73 / 40%); + --color-danger-subtle: rgb(248 81 73 / 10%); + --color-primer-shadow-inset: 0 0 transparent; + --color-scale-gray-7: #21262d; + --color-scale-blue-8: #0c2d6b; + + /*! Extensions from @primer/css/alerts/flash.scss */ + --color-social-reaction-bg-hover: var(--color-scale-gray-7); + --color-social-reaction-bg-reacted-hover: var(--color-scale-blue-8); +} + +main .pagination-loader-container { + background-image: url("https://github.com/images/modules/pulls/progressive-disclosure-line-dark.svg"); +} + +main .gsc-loading-image { + background-image: url("https://github.githubassets.com/images/mona-loading-dark.gif"); +} diff --git a/app/static/giscus/light.css b/app/static/giscus/light.css new file mode 100644 index 0000000..84b58c0 --- /dev/null +++ b/app/static/giscus/light.css @@ -0,0 +1,99 @@ +/*! MIT License + * Copyright (c) 2018 GitHub Inc. + * https://github.com/primer/primitives/blob/main/LICENSE + */ + +main { + --color-prettylights-syntax-comment: #6e7781; + --color-prettylights-syntax-constant: #0550ae; + --color-prettylights-syntax-entity: #8250df; + --color-prettylights-syntax-storage-modifier-import: #24292f; + --color-prettylights-syntax-entity-tag: #116329; + --color-prettylights-syntax-keyword: #cf222e; + --color-prettylights-syntax-string: #0a3069; + --color-prettylights-syntax-variable: #953800; + --color-prettylights-syntax-brackethighlighter-unmatched: #82071e; + --color-prettylights-syntax-invalid-illegal-text: #f6f8fa; + --color-prettylights-syntax-invalid-illegal-bg: #82071e; + --color-prettylights-syntax-carriage-return-text: #f6f8fa; + --color-prettylights-syntax-carriage-return-bg: #cf222e; + --color-prettylights-syntax-string-regexp: #116329; + --color-prettylights-syntax-markup-list: #3b2300; + --color-prettylights-syntax-markup-heading: #0550ae; + --color-prettylights-syntax-markup-italic: #24292f; + --color-prettylights-syntax-markup-bold: #24292f; + --color-prettylights-syntax-markup-deleted-text: #82071e; + --color-prettylights-syntax-markup-deleted-bg: #ffebe9; + --color-prettylights-syntax-markup-inserted-text: #116329; + --color-prettylights-syntax-markup-inserted-bg: #dafbe1; + --color-prettylights-syntax-markup-changed-text: #953800; + --color-prettylights-syntax-markup-changed-bg: #ffd8b5; + --color-prettylights-syntax-markup-ignored-text: #eaeef2; + --color-prettylights-syntax-markup-ignored-bg: #0550ae; + --color-prettylights-syntax-meta-diff-range: #8250df; + --color-prettylights-syntax-brackethighlighter-angle: #57606a; + --color-prettylights-syntax-sublimelinter-gutter-mark: #8c959f; + --color-prettylights-syntax-constant-other-reference-link: #0a3069; + --color-btn-text: #4e4e4e; /* --darkgray */ + --color-btn-bg: #faf8f8; /* --light */ + --color-btn-border: rgb(43, 43, 43 / 15%); /* --dark */ + --color-btn-shadow: 0 1px 0 rgb(31 35 40 / 4%); + --color-btn-inset-shadow: inset 0 1px 0 rgb(255 255 255 / 25%); + --color-btn-hover-bg: #f3f4f6; + --color-btn-hover-border: rgb(43, 43, 43 / 15%); /* --dark */ + --color-btn-active-bg: hsl(220deg 14% 93% / 100%); + --color-btn-active-border: rgb(31 35 40 / 15%); + --color-btn-selected-bg: hsl(220deg 14% 94% / 100%); + --color-btn-primary-text: #fff; + --color-btn-primary-bg: #84a59d; /* --tertiary */ + --color-btn-primary-border: rgb(43, 43, 43 / 15%); /* --dark */ + --color-btn-primary-shadow: 0 1px 0 rgb(31 35 40 / 10%); + --color-btn-primary-inset-shadow: inset 0 1px 0 rgb(255 255 255 / 3%); + --color-btn-primary-hover-bg: #284b63; /* --secondary */ + --color-btn-primary-hover-border: rgb(43, 43, 43 / 15%); /* --dark */ + --color-btn-primary-selected-bg: #284b63; /* --secondary */ + --color-btn-primary-selected-shadow: inset 0 1px 0 rgb(0 45 17 / 20%); + --color-btn-primary-disabled-text: rgb(255 255 255 / 80%); + --color-btn-primary-disabled-bg: #94d3a2; + --color-btn-primary-disabled-border: rgb(31 35 40 / 15%); + --color-action-list-item-default-hover-bg: rgb(208 215 222 / 32%); + --color-segmented-control-bg: #eaeef2; + --color-segmented-control-button-bg: #fff; + --color-segmented-control-button-selected-border: #8c959f; + --color-fg-default: #2b2b2b; /* --dark */ + --color-fg-muted: #4e4e4e; /* --darkgray */ + --color-fg-subtle: #4e4e4e; /* --darkgray */ + --color-canvas-default: #fff; + --color-canvas-overlay: #fff; + --color-canvas-inset: #f6f8fa; + --color-canvas-subtle: #f6f8fa; + --color-border-default: #d0d7de; + --color-border-muted: hsl(210deg 18% 87% / 100%); + --color-neutral-muted: rgb(175 184 193 / 20%); + --color-accent-fg: #0969da; + --color-accent-emphasis: #0969da; + --color-accent-muted: rgb(84 174 255 / 40%); + --color-accent-subtle: #ddf4ff; + --color-success-fg: #1a7f37; + --color-attention-fg: #9a6700; + --color-attention-muted: rgb(212 167 44 / 40%); + --color-attention-subtle: #fff8c5; + --color-danger-fg: #d1242f; + --color-danger-muted: rgb(255 129 130 / 40%); + --color-danger-subtle: #ffebe9; + --color-primer-shadow-inset: inset 0 1px 0 rgb(208 215 222 / 20%); + --color-scale-gray-1: #eaeef2; + --color-scale-blue-1: #b6e3ff; + + /*! Extensions from @primer/css/alerts/flash.scss */ + --color-social-reaction-bg-hover: var(--color-scale-gray-1); + --color-social-reaction-bg-reacted-hover: var(--color-scale-blue-1); +} + +main .pagination-loader-container { + background-image: url("https://github.com/images/modules/pulls/progressive-disclosure-line.svg"); +} + +main .gsc-loading-image { + background-image: url("https://github.githubassets.com/images/mona-loading-default.gif"); +} diff --git a/app/static/icon.png b/app/static/icon.png new file mode 100644 index 0000000..b6656a7 Binary files /dev/null and b/app/static/icon.png differ diff --git a/app/static/og-image.png b/app/static/og-image.png new file mode 100644 index 0000000..f132145 Binary files /dev/null and b/app/static/og-image.png differ diff --git a/app/tags/index.html b/app/tags/index.html new file mode 100644 index 0000000..18387b7 --- /dev/null +++ b/app/tags/index.html @@ -0,0 +1,125 @@ + +Tag Index

    Found 0 total tags.


    \ No newline at end of file diff --git a/k8s/README.md b/k8s/README.md deleted file mode 100644 index c5eda52..0000000 --- a/k8s/README.md +++ /dev/null @@ -1,308 +0,0 @@ -# Kubernetes 部署指南 - -本指南详细说明了如何将构建好的 NGINX Docker 镜像从私有 Harbor 仓库部署到 Kubernetes 集群。 - -## 📋 目录结构 - -``` -k8s/ -├── deploy.sh # Linux/macOS 自动部署脚本 -├── deploy.bat # Windows 自动部署脚本 -├── nginx-deployment.yaml # Kubernetes 部署配置 -├── .env.template # 环境变量模板 -└── README.md # 本文档 -``` - -## 🚀 快速开始 - -### 方法一:使用自动部署脚本(推荐) - -1. **设置环境变量** - ```bash - # Linux/macOS - export HARBOR_REGISTRY=harbor.example.com - export HARBOR_USERNAME=your-username - export HARBOR_PASSWORD=your-password - export NGINX_IMAGE_TAG=latest # 或使用 ${GITHUB_SHA} - ``` - - ```cmd - REM Windows - set HARBOR_REGISTRY=harbor.example.com - set HARBOR_USERNAME=your-username - set HARBOR_PASSWORD=your-password - set NGINX_IMAGE_TAG=latest - ``` - -2. **运行部署脚本** - ```bash - # Linux/macOS - chmod +x deploy.sh - ./deploy.sh - - # Windows - deploy.bat - ``` - -### 方法二:使用环境变量文件 - -1. **创建环境变量文件** - ```bash - cp .env.template .env - # 编辑 .env 文件,填入实际的配置值 - ``` - -2. **运行部署脚本** - ```bash - # 脚本会自动加载 .env 文件 - ./deploy.sh - ``` - -### 方法三:手动部署 - -1. **创建 Harbor 仓库访问凭据** - ```bash - kubectl create secret docker-registry harbor-registry-secret \ - --docker-server=harbor.example.com \ - --docker-username=your-username \ - --docker-password=your-password \ - --namespace=default - ``` - -2. **更新部署文件中的镜像标签** - ```bash - # 编辑 nginx-deployment.yaml,替换镜像标签 - # 将 harbor.example.com/test/nginx:latest 替换为实际的镜像地址 - ``` - -3. **应用 Kubernetes 配置** - ```bash - kubectl apply -f nginx-deployment.yaml - ``` - -4. **检查部署状态** - ```bash - kubectl get pods -l app=nginx - kubectl get services -l app=nginx - ``` - -## 🔧 配置说明 - -### 环境变量 - -| 变量名 | 描述 | 必需 | 默认值 | -|--------|------|------|--------| -| `HARBOR_REGISTRY` | Harbor 仓库地址 | 是 | - | -| `HARBOR_USERNAME` | Harbor 用户名 | 是 | - | -| `HARBOR_PASSWORD` | Harbor 密码 | 是 | - | -| `NGINX_IMAGE_TAG` | NGINX 镜像标签 | 是 | - | -| `NAMESPACE` | Kubernetes 命名空间 | 否 | `default` | -| `DEPLOYMENT_FILE` | 部署配置文件路径 | 否 | `./nginx-deployment.yaml` | - -### Kubernetes 资源 - -部署文件包含以下 Kubernetes 资源: - -1. **ConfigMap** (`nginx-config`) - - 包含 NGINX 配置文件 - - 自定义日志格式和访问控制 - -2. **Deployment** (`nginx-deployment`) - - 3 个副本的 NGINX Pod - - 从私有 Harbor 仓库拉取镜像 - - 包含健康检查和资源限制 - -3. **Service** (`nginx-service`) - - NodePort 类型(端口 30080) - - 可以改为 LoadBalancer 或 ClusterIP - -4. **HPA** (`nginx-hpa`) - - 水平自动伸缩 - - 基于 CPU 使用率(目标 70%) - - 副本数范围:3-10 - -5. **PodDisruptionBudget** (`nginx-pdb`) - - 确保更新期间的可用性 - - 最小可用副本数:2 - -## 🔍 验证部署 - -### 检查 Pod 状态 -```bash -kubectl get pods -l app=nginx -o wide -``` - -### 检查服务状态 -```bash -kubectl get services -l app=nginx -``` - -### 查看日志 -```bash -# 查看特定 Pod 的日志 -kubectl logs -l app=nginx -f - -# 查看所有 NGINX Pod 的日志 -kubectl logs -l app=nginx --all-containers=true -f -``` - -### 访问应用 - -根据服务类型不同,访问方式如下: - -1. **NodePort**(默认) - ```bash - # 获取节点 IP 和端口 - kubectl get nodes -o wide - kubectl get service nginx-service - # 访问 http://:30080 - ``` - -2. **LoadBalancer** - ```bash - # 等待外部 IP 分配 - kubectl get service nginx-service -w - # 访问 http:// - ``` - -3. **ClusterIP** - ```bash - # 使用端口转发进行测试 - kubectl port-forward service/nginx-service 8080:80 - # 访问 http://localhost:8080 - ``` - -## 🔧 故障排除 - -### 常见问题 - -1. **镜像拉取失败** - ```bash - # 检查 Secret 是否正确创建 - kubectl get secret harbor-registry-secret -o yaml - - # 检查镜像地址是否正确 - kubectl describe pod - ``` - -2. **Pod 启动失败** - ```bash - # 查看 Pod 详细信息 - kubectl describe pod - - # 查看 Pod 日志 - kubectl logs - ``` - -3. **服务无法访问** - ```bash - # 检查服务端点 - kubectl get endpoints nginx-service - - # 检查网络策略(如果启用) - kubectl get networkpolicy - ``` - -### 日志查看 - -```bash -# 查看部署事件 -kubectl get events --sort-by=.metadata.creationTimestamp - -# 查看特定资源的事件 -kubectl describe deployment nginx-deployment -kubectl describe service nginx-service -``` - -## 🔄 更新部署 - -### 更新镜像版本 - -1. **使用脚本更新** - ```bash - export NGINX_IMAGE_TAG=new-version - ./deploy.sh - ``` - -2. **手动更新** - ```bash - kubectl set image deployment/nginx-deployment \ - nginx=harbor.example.com/test/nginx:new-version - ``` - -3. **滚动更新策略** - ```bash - # 查看滚动更新状态 - kubectl rollout status deployment/nginx-deployment - - # 回滚到上一个版本 - kubectl rollout undo deployment/nginx-deployment - ``` - -## 🗑️ 清理资源 - -### 删除部署 -```bash -kubectl delete -f nginx-deployment.yaml -kubectl delete secret harbor-registry-secret -``` - -### 删除命名空间(如果使用专用命名空间) -```bash -kubectl delete namespace -``` - -## 🔐 安全注意事项 - -1. **敏感信息管理** - - 不要将 Harbor 凭据提交到代码仓库 - - 使用 Kubernetes Secrets 存储敏感信息 - - 考虑使用外部密钥管理系统 - -2. **网络安全** - - 配置网络策略限制 Pod 间通信 - - 使用 HTTPS 和 TLS 证书 - - 配置防火墙规则 - -3. **镜像安全** - - 定期扫描镜像漏洞 - - 使用最小权限运行容器 - - 启用镜像签名验证 - -## 📚 参考资料 - -- [Kubernetes 官方文档](https://kubernetes.io/docs/) -- [Harbor 官方文档](https://goharbor.io/docs/) -- [NGINX 官方文档](https://nginx.org/en/docs/) -- [Docker 私有仓库配置](https://docs.docker.com/registry/deploying/) - -## 💡 提示 - -1. **性能优化** - - 根据实际负载调整副本数和资源限制 - - 配置 NGINX 缓存策略 - - 使用持久化存储保存日志 - -2. **监控配置** - - 集成 Prometheus 监控 - - 配置 Grafana 仪表板 - - 设置告警规则 - -3. **自动化** - - 集成到 CI/CD 流水线 - - 使用 Helm 管理复杂部署 - - 配置自动化测试 - -## `${{ github.sha }}` 变量说明 - -`${{ github.sha }}` 是 GitHub Actions 中的一个内置环境变量,代表: - -- **含义**: 当前提交的完整 SHA-1 哈希值(40 字符) -- **格式**: 例如 `a1b2c3d4e5f6789012345678901234567890abcd` -- **用途**: 作为 Docker 镜像的唯一标签,确保每次构建的镜像都有唯一标识 -- **优势**: - - 可追溯性:能够准确对应到具体的代码提交 - - 唯一性:避免镜像标签冲突 - - 版本控制:便于回滚和版本管理 - -在 CI/CD 中使用 `${{ github.sha }}` 作为镜像标签是最佳实践,可以实现精确的版本控制和部署追踪。 diff --git a/k8s/deploy.sh b/k8s/deploy.sh index b50ded4..95855bd 100644 --- a/k8s/deploy.sh +++ b/k8s/deploy.sh @@ -230,51 +230,6 @@ get_access_info() { esac } -# 处理HTML_DIR变量 -process_html_dir() { - print_info "处理HTML目录变量..." - - # 如果HTML_DIR变量不存在,设置默认值 - if [[ -z "${HTML_DIR}" ]]; then - export HTML_DIR="/mnt/nginx-html" - print_warning "HTML_DIR环境变量未设置,使用默认值: $HTML_DIR" - else - print_info "使用HTML目录: $HTML_DIR" - fi - - # 检查PV配置文件是否存在 - local pv_file="./nginx-pv.yaml" - if [[ -f "$pv_file" ]]; then - print_info "更新持久卷配置中的HTML目录路径..." - - # 备份原文件 - cp "$pv_file" "${pv_file}.bak" - - # 替换变量 - sed -i.tmp "s|\"\${{ vars.HTML_DIR }}\"|\"${HTML_DIR}\"|g" "$pv_file" - - # 清理临时文件 - rm -f "${pv_file}.tmp" - - print_success "持久卷配置已更新,使用HTML目录: $HTML_DIR" - else - print_warning "持久卷配置文件不存在: $pv_file" - fi -} - -# 应用持久卷配置 -apply_pv_config() { - print_info "应用持久卷配置..." - - local pv_file="./nginx-pv.yaml" - if [[ -f "$pv_file" ]]; then - kubectl apply -f "$pv_file" - print_success "持久卷配置应用成功" - else - print_warning "持久卷配置文件不存在: $pv_file,跳过应用" - fi -} - # 主函数 main() { print_info "开始 NGINX Kubernetes 自动部署..." @@ -290,10 +245,6 @@ main() { create_namespace "$namespace" create_harbor_secret "$namespace" - # 处理HTML_DIR变量并应用持久卷配置 - process_html_dir - apply_pv_config - update_deployment_image "$deployment_file" "$image_tag" apply_k8s_config "$deployment_file" wait_for_deployment "$namespace" diff --git a/k8s/nginx-deployment.yaml b/k8s/nginx-deployment.yaml index 392e3ae..293e51c 100644 --- a/k8s/nginx-deployment.yaml +++ b/k8s/nginx-deployment.yaml @@ -50,15 +50,30 @@ data: listen 8080; # 修改为非特权端口 server_name localhost; - # 添加重写规则 - 如果请求不带扩展名且不存在对应目录,尝试添加.html后缀 + # 为SPA应用添加特殊处理 location / { root /usr/local/nginx/html; index index.html index.htm; - # 首先尝试完全匹配,然后尝试添加.html扩展名,最后回退到index + # 支持HTML扩展名省略和SPA路由 try_files $uri $uri.html $uri/ /index.html; } + # 静态资源处理 + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + root /usr/local/nginx/html; + expires 30d; + add_header Cache-Control "public, max-age=2592000"; + access_log off; + } + + # API代理配置 (如果需要) + # location /api/ { + # proxy_pass http://backend-service:8080/; + # proxy_set_header Host $host; + # proxy_set_header X-Real-IP $remote_addr; + # } + # 健康检查端点 location /health { return 200 'ok'; @@ -222,7 +237,11 @@ spec: echo "警告: HTML目录不可读"; chmod -R 755 /usr/local/nginx/html; fi; - if [ ! -r /usr/local/nginx/html/index.html ] && [ ! -r /usr/local/nginx/html/index.htm ]; then + + # 保留已存在的前端文件,不覆盖 + if [ -f /usr/local/nginx/html/index.html ]; then + echo "找到现有index.html文件,将保留这些文件"; + else echo "警告: 没有找到index文件,创建默认页面"; cat > /usr/local/nginx/html/index.html << 'EOF' @@ -232,13 +251,11 @@ spec: EOF fi; + echo "设置目录权限..."; chown -R 65534:65534 /usr/local/nginx/html || true; chmod -R 755 /usr/local/nginx/html || true; echo "HTML目录权限设置完成"; - volumeMounts: - - name: nginx-html-content - mountPath: /usr/local/nginx/html containers: - name: nginx diff --git a/k8s/nginx-pv.yaml b/k8s/nginx-pv.yaml deleted file mode 100644 index 637e848..0000000 --- a/k8s/nginx-pv.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# 持久卷和持久卷声明定义 -# 用于存储HTML静态文件 - -# 1. 持久卷 - 基于主机路径 -apiVersion: v1 -kind: PersistentVolume -metadata: - name: nginx-html-pv - labels: - app: nginx - type: local -spec: - storageClassName: manual - capacity: - storage: 1Gi - accessModes: - - ReadWriteMany - hostPath: - path: "${{ vars.HTML_DIR }}" - persistentVolumeReclaimPolicy: Retain - ---- -# 2. 持久卷声明 -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: nginx-html-pvc - namespace: default -spec: - storageClassName: manual - accessModes: - - ReadWriteMany - resources: - requests: - storage: 1Gi - selector: - matchLabels: - app: nginx - type: local diff --git a/k8s/quickstart.sh b/k8s/quickstart.sh deleted file mode 100644 index 165bf80..0000000 --- a/k8s/quickstart.sh +++ /dev/null @@ -1,257 +0,0 @@ -#!/bin/bash - -# NGINX Kubernetes 快速启动脚本 -# 用于快速设置和部署 NGINX 到 Kubernetes - -set -e - -# 颜色输出 -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - -print_banner() { - echo -e "${BLUE}" - echo "╔════════════════════════════════════════════════════════════════╗" - echo "║ NGINX Kubernetes 部署工具 ║" - echo "║ 快速启动和配置向导 ║" - echo "╚════════════════════════════════════════════════════════════════╝" - echo -e "${NC}" -} - -print_info() { - echo -e "${BLUE}[INFO]${NC} $1" -} - -print_success() { - echo -e "${GREEN}[SUCCESS]${NC} $1" -} - -print_warning() { - echo -e "${YELLOW}[WARNING]${NC} $1" -} - -print_error() { - echo -e "${RED}[ERROR]${NC} $1" -} - -# 交互式配置收集 -collect_config() { - print_info "开始收集配置信息..." - echo - - # Harbor 配置 - read -p "$(echo -e ${BLUE}请输入 Harbor 仓库地址${NC} (例: harbor.example.com): " HARBOR_REGISTRY - read -p "$(echo -e ${BLUE}请输入 Harbor 用户名${NC}: " HARBOR_USERNAME - read -s -p "$(echo -e ${BLUE}请输入 Harbor 密码${NC}: " HARBOR_PASSWORD - echo - - # 镜像配置 - read -p "$(echo -e ${BLUE}请输入镜像标签${NC} (默认: latest): " NGINX_IMAGE_TAG - NGINX_IMAGE_TAG=${NGINX_IMAGE_TAG:-latest} - - # Kubernetes 配置 - read -p "$(echo -e ${BLUE}请输入 Kubernetes 命名空间${NC} (默认: default): " NAMESPACE - NAMESPACE=${NAMESPACE:-default} - - echo - print_success "配置收集完成" -} - -# 验证配置 -validate_config() { - print_info "验证配置..." - - if [[ -z "$HARBOR_REGISTRY" ]]; then - print_error "Harbor 仓库地址不能为空" - return 1 - fi - - if [[ -z "$HARBOR_USERNAME" ]]; then - print_error "Harbor 用户名不能为空" - return 1 - fi - - if [[ -z "$HARBOR_PASSWORD" ]]; then - print_error "Harbor 密码不能为空" - return 1 - fi - - print_success "配置验证通过" -} - -# 保存配置到环境文件 -save_config() { - print_info "保存配置到 .env 文件..." - - cat > .env << EOF -# NGINX Kubernetes 部署配置 -# 由快速启动脚本生成于 $(date) - -# Harbor 仓库配置 -HARBOR_REGISTRY=$HARBOR_REGISTRY -HARBOR_USERNAME=$HARBOR_USERNAME -HARBOR_PASSWORD=$HARBOR_PASSWORD - -# 镜像配置 -NGINX_IMAGE_TAG=$NGINX_IMAGE_TAG - -# Kubernetes 配置 -NAMESPACE=$NAMESPACE -DEPLOYMENT_FILE=./nginx-deployment.yaml -EOF - - print_success "配置已保存到 .env 文件" -} - -# 显示配置摘要 -show_config_summary() { - echo - print_info "配置摘要:" - echo " Harbor 仓库: $HARBOR_REGISTRY" - echo " Harbor 用户: $HARBOR_USERNAME" - echo " 镜像标签: $NGINX_IMAGE_TAG" - echo " 命名空间: $NAMESPACE" - echo " 完整镜像地址: $HARBOR_REGISTRY/test/nginx:$NGINX_IMAGE_TAG" - echo -} - -# 检查先决条件 -check_prerequisites() { - print_info "检查先决条件..." - - local missing_tools=() - - # 检查 kubectl - if ! command -v kubectl &> /dev/null; then - missing_tools+=("kubectl") - fi - - # 检查 docker (可选) - if ! command -v docker &> /dev/null; then - print_warning "Docker 未安装 (可选)" - fi - - if [[ ${#missing_tools[@]} -gt 0 ]]; then - print_error "缺少必要工具: ${missing_tools[*]}" - echo "请安装缺少的工具后重试" - return 1 - fi - - # 检查 kubectl 连接 - if ! kubectl cluster-info &> /dev/null; then - print_error "无法连接到 Kubernetes 集群" - echo "请确保 kubectl 已正确配置并能访问集群" - return 1 - fi - - print_success "先决条件检查通过" -} - -# 测试 Harbor 连接 -test_harbor_connection() { - print_info "测试 Harbor 连接..." - - if command -v docker &> /dev/null; then - if echo "$HARBOR_PASSWORD" | docker login "$HARBOR_REGISTRY" -u "$HARBOR_USERNAME" --password-stdin &> /dev/null; then - print_success "Harbor 连接测试通过" - docker logout "$HARBOR_REGISTRY" &> /dev/null - else - print_warning "Harbor 连接测试失败,请检查凭据" - fi - else - print_warning "Docker 未安装,跳过 Harbor 连接测试" - fi -} - -# 运行部署 -run_deployment() { - print_info "开始部署..." - - # 导出环境变量 - export HARBOR_REGISTRY - export HARBOR_USERNAME - export HARBOR_PASSWORD - export NGINX_IMAGE_TAG - export NAMESPACE - - # 运行部署脚本 - if [[ -f "deploy.sh" ]]; then - chmod +x deploy.sh - ./deploy.sh - else - print_error "部署脚本 deploy.sh 不存在" - return 1 - fi -} - -# 提供后续操作建议 -show_next_steps() { - echo - print_success "🎉 部署完成!" - echo - print_info "后续操作建议:" - echo " 1. 查看部署状态: make status" - echo " 2. 查看日志: make logs" - echo " 3. 设置端口转发: make port-forward" - echo " 4. 扩缩容: make scale REPLICAS=5" - echo " 5. 更新镜像: make update NGINX_IMAGE_TAG=new-version" - echo " 6. 清理部署: make clean" - echo - print_info "配置文件已保存到 .env,下次可以直接运行 ./deploy.sh" -} - -# 主函数 -main() { - print_banner - - # 检查是否已有配置文件 - if [[ -f ".env" ]]; then - read -p "$(echo -e ${YELLOW}发现已存在配置文件 .env,是否重新配置?${NC} (y/N): " RECONFIGURE - if [[ "$RECONFIGURE" =~ ^[Yy]$ ]]; then - collect_config - else - print_info "使用现有配置文件..." - source .env - fi - else - collect_config - fi - - validate_config || exit 1 - show_config_summary - - # 询问是否继续 - read -p "$(echo -e ${YELLOW}是否继续部署?${NC} (Y/n): " CONTINUE - if [[ "$CONTINUE" =~ ^[Nn]$ ]]; then - print_info "部署已取消" - save_config - echo "配置已保存,可以稍后运行 ./deploy.sh 进行部署" - exit 0 - fi - - check_prerequisites || exit 1 - test_harbor_connection - save_config - run_deployment - show_next_steps -} - -# 清理函数 -cleanup() { - # 恢复终端状态 - stty echo 2>/dev/null || true -} - -# 设置清理陷阱 -trap cleanup EXIT - -# 处理中断信号 -trap 'print_warning "操作被中断"; exit 130' INT - -# 如果直接运行此脚本 -if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then - main "$@" -fi