From 96bd58ac06ffb56b86dd985c5c177e084d2a63d2 Mon Sep 17 00:00:00 2001 From: Brian Beck Date: Tue, 21 Oct 2025 22:53:25 -0700 Subject: [PATCH] add individual skin download --- docs/404.html | 2 +- docs/404/index.html | 2 +- .../_buildManifest.js | 0 .../_clientMiddlewareManifest.json | 0 .../_ssgManifest.js | 0 docs/_next/static/chunks/0c04e859c9299853.js | 1 + docs/_next/static/chunks/33aeca087c4fb9b3.js | 1 + docs/_next/static/chunks/395c2bae735f87a6.js | 1 - docs/_next/static/chunks/43ceca71888c9b70.js | 1 + ...d2bdb29c69093a9.js => 5778c7d57772f351.js} | 2 +- docs/_next/static/chunks/642c9f483a155826.js | 1 - docs/_next/static/chunks/71f10e2893d67a3c.js | 1 + docs/_next/static/chunks/7d0d362e234cf43a.js | 1 - docs/_next/static/chunks/9072f9dc67ad2fb2.js | 1 - docs/_next/static/chunks/9a2f1a7f288f6fd4.js | 1 + docs/_next/static/chunks/b12a108b39c3ccf5.js | 1 - ...2d3ec98949fe5.css => c45ca2566aefbdb7.css} | 2 +- docs/_next/static/chunks/e6e166ba82cc0d62.js | 1 + docs/_next/static/chunks/ec0a6a943ec3891b.js | 1 - docs/gallery/index.html | 2 +- docs/gallery/index.txt | 6 +- docs/index.html | 2 +- docs/index.txt | 4 +- src/app/gallery/gallery.module.css | 57 +++++++-- src/app/gallery/page.tsx | 120 ++++++++++++++++-- src/exportUtils.ts | 14 +- src/importUtils.ts | 38 ++++++ 27 files changed, 221 insertions(+), 42 deletions(-) rename docs/_next/static/{fFTlXrZYVpcjc_RZhmTtF => _Pc2wzRd3Ns96p5GjKQsi}/_buildManifest.js (100%) rename docs/_next/static/{fFTlXrZYVpcjc_RZhmTtF => _Pc2wzRd3Ns96p5GjKQsi}/_clientMiddlewareManifest.json (100%) rename docs/_next/static/{fFTlXrZYVpcjc_RZhmTtF => _Pc2wzRd3Ns96p5GjKQsi}/_ssgManifest.js (100%) create mode 100644 docs/_next/static/chunks/0c04e859c9299853.js create mode 100644 docs/_next/static/chunks/33aeca087c4fb9b3.js delete mode 100644 docs/_next/static/chunks/395c2bae735f87a6.js create mode 100644 docs/_next/static/chunks/43ceca71888c9b70.js rename docs/_next/static/chunks/{2d2bdb29c69093a9.js => 5778c7d57772f351.js} (87%) delete mode 100644 docs/_next/static/chunks/642c9f483a155826.js create mode 100644 docs/_next/static/chunks/71f10e2893d67a3c.js delete mode 100644 docs/_next/static/chunks/7d0d362e234cf43a.js delete mode 100644 docs/_next/static/chunks/9072f9dc67ad2fb2.js create mode 100644 docs/_next/static/chunks/9a2f1a7f288f6fd4.js delete mode 100644 docs/_next/static/chunks/b12a108b39c3ccf5.js rename docs/_next/static/chunks/{3952d3ec98949fe5.css => c45ca2566aefbdb7.css} (54%) create mode 100644 docs/_next/static/chunks/e6e166ba82cc0d62.js delete mode 100644 docs/_next/static/chunks/ec0a6a943ec3891b.js diff --git a/docs/404.html b/docs/404.html index 649ac7a..5afbbeb 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1 +1 @@ -404: This page could not be found.T2 Model Viewer & Skinner

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.T2 Model Viewer & Skinner

404

This page could not be found.

\ No newline at end of file diff --git a/docs/404/index.html b/docs/404/index.html index 649ac7a..5afbbeb 100644 --- a/docs/404/index.html +++ b/docs/404/index.html @@ -1 +1 @@ -404: This page could not be found.T2 Model Viewer & Skinner

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.T2 Model Viewer & Skinner

404

This page could not be found.

\ No newline at end of file diff --git a/docs/_next/static/fFTlXrZYVpcjc_RZhmTtF/_buildManifest.js b/docs/_next/static/_Pc2wzRd3Ns96p5GjKQsi/_buildManifest.js similarity index 100% rename from docs/_next/static/fFTlXrZYVpcjc_RZhmTtF/_buildManifest.js rename to docs/_next/static/_Pc2wzRd3Ns96p5GjKQsi/_buildManifest.js diff --git a/docs/_next/static/fFTlXrZYVpcjc_RZhmTtF/_clientMiddlewareManifest.json b/docs/_next/static/_Pc2wzRd3Ns96p5GjKQsi/_clientMiddlewareManifest.json similarity index 100% rename from docs/_next/static/fFTlXrZYVpcjc_RZhmTtF/_clientMiddlewareManifest.json rename to docs/_next/static/_Pc2wzRd3Ns96p5GjKQsi/_clientMiddlewareManifest.json diff --git a/docs/_next/static/fFTlXrZYVpcjc_RZhmTtF/_ssgManifest.js b/docs/_next/static/_Pc2wzRd3Ns96p5GjKQsi/_ssgManifest.js similarity index 100% rename from docs/_next/static/fFTlXrZYVpcjc_RZhmTtF/_ssgManifest.js rename to docs/_next/static/_Pc2wzRd3Ns96p5GjKQsi/_ssgManifest.js diff --git a/docs/_next/static/chunks/0c04e859c9299853.js b/docs/_next/static/chunks/0c04e859c9299853.js new file mode 100644 index 0000000..f0eefff --- /dev/null +++ b/docs/_next/static/chunks/0c04e859c9299853.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,40141,e=>{"use strict";e.s(["GenIcon",()=>o],40141);var t=e.i(71645),a={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},r=t.default.createContext&&t.default.createContext(a),n=["attr","size","title"];function c(){return(c=Object.assign.bind()).apply(this,arguments)}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function i(e){for(var t=1;tt.default.createElement(s,c({attr:i({},e.attr)},a),function e(a){return a&&a.map((a,r)=>t.default.createElement(a.tag,i({key:r},a.attr),e(a.child)))}(e.child))}function s(e){var l=a=>{var r,{attr:l,size:o,title:s}=e,u=function(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;a[r]=e[r]}return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}(e,n),h=o||a.size||"1em";return a.className&&(r=a.className),e.className&&(r=(r?r+" ":"")+e.className),t.default.createElement("svg",c({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,l,u,{className:r,style:i(i({color:e.color||a.color},a.style),e.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),s&&t.default.createElement("title",null,s),e.children)};return void 0!==r?t.default.createElement(r.Consumer,null,e=>l(e)):l(a)}},90106,e=>{"use strict";e.s(["BsBadge3dFill",()=>r,"BsFillGrid3X3GapFill",()=>a]);var t=e.i(40141);function a(e){return(0,t.GenIcon)({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M1 2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zM1 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zM1 12a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1z"},child:[]}]})(e)}function r(e){return(0,t.GenIcon)({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M10.157 5.968h-.844v4.06h.844c1.116 0 1.621-.667 1.621-2.02 0-1.354-.51-2.04-1.621-2.04"},child:[]},{tag:"path",attr:{d:"M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm5.184 4.368c.646 0 1.055.378 1.06.9.008.537-.427.919-1.086.919-.598-.004-1.037-.325-1.068-.756H3c.03.914.791 1.688 2.153 1.688 1.24 0 2.285-.66 2.272-1.798-.013-.953-.747-1.38-1.292-1.432v-.062c.44-.07 1.125-.527 1.108-1.375-.013-.906-.8-1.57-2.053-1.565-1.31.005-2.043.734-2.074 1.67h1.103c.022-.391.383-.751.936-.751.532 0 .928.33.928.813.004.479-.383.835-.928.835h-.632v.914zM8.126 11h2.189C12.125 11 13 9.893 13 7.985c0-1.894-.861-2.984-2.685-2.984H8.126z"},child:[]}]})(e)}},11152,e=>{"use strict";e.s(["FaAngleDown",()=>r,"FaArrowDown",()=>n,"FaArrowUp",()=>c,"FaChevronLeft",()=>l,"FaChevronRight",()=>i,"FaDownload",()=>o,"FaFolderOpen",()=>s,"FaGithub",()=>a,"FaLock",()=>u,"FaTrashAlt",()=>h,"FaUnlock",()=>m]);var t=e.i(40141);function a(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"},child:[]}]})(e)}function r(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"},child:[]}]})(e)}function n(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(e)}function c(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(e)}function l(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(e)}function i(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(e)}function o(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(e)}function s(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"},child:[]}]})(e)}function u(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"},child:[]}]})(e)}function h(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"},child:[]}]})(e)}function m(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}},18566,(e,t,a)=>{t.exports=e.r(76562)},15768,e=>{"use strict";e.s(["default",()=>r]);var t=e.i(71645);let a={customSkins:{},newSkins:{},packs:{}};function r(){let[e,r]=(0,t.useState)(a);(0,t.useEffect)(()=>{let e=new AbortController,t=e.signal,a=!1;return(async()=>{let e;try{if(e=await fetch("".concat("https://exogen.github.io/t2-skins","/skins.json"),{signal:t}),!a){let t=await e.json();a||r(t)}}catch(e){console.error(e)}})(),()=>{a=!0,e.signal.aborted||e.abort()}},[]);let n=e!==a;return[e,n]}},20592,e=>{"use strict";e.s(["default",()=>t]);let t=e.i(29947).default},53653,e=>{"use strict";let t;e.s(["importMultipleFilesToModels",()=>u,"modelToModelType",()=>l,"modelTypes",()=>c]);var a=e.i(71315);let r=e.i(20592).default.materials,n=/^(\.|__MACOSX)/,c={player:["lmale","mmale","hmale","lfemale","mfemale","hfemale","lbioderm","mbioderm","hbioderm"],weapon:["disc","chaingun","grenade_launcher","sniper","plasmathrower","energy","shocklance","elf","missile","mortar","repair","targeting","mine"],vehicle:["vehicle_grav_scout","vehicle_grav_tank","vehicle_land_mpbbase","vehicle_air_scout","vehicle_air_bomber","vehicle_air_hapc"]};function l(e){switch(e){case"lmale":case"mmale":case"hmale":case"lfemale":case"mfemale":case"hfemale":case"lbioderm":case"mbioderm":case"hbioderm":return"player";case"disc":case"chaingun":case"grenade_launcher":case"sniper":case"plasmathrower":case"energy":case"shocklance":case"elf":case"missile":case"mortar":case"repair":case"targeting":case"mine":return"weapon";case"vehicle_grav_scout":case"vehicle_grav_tank":case"vehicle_land_mpbbase":case"vehicle_air_scout":case"vehicle_air_bomber":case"vehicle_air_hapc":return"vehicle";default:throw Error("Unknown model")}}async function i(e){let t=await a.default.loadAsync(e);return(await Promise.all(Object.entries(t.files).map(async e=>{let[t,a]=e;if(!n.test(t)&&/\.png$/i.exec(t)){let e=await a.async("base64");return{path:t,imageUrl:"data:image/png;base64,".concat(e)}}}))).filter(e=>!!e)}async function o(e){return new Promise((t,a)=>{let r=new FileReader;r.addEventListener("load",e=>{var r;"string"==typeof(null==(r=e.target)?void 0:r.result)?t(e.target.result):a()}),r.addEventListener("error",e=>{a()}),r.readAsDataURL(e)})}async function s(e){return(await Promise.all(Array.from(e).map(async e=>{var t;if(n.test(e.name))return null;switch((t=e).name.match(/\.png$/i)?"png":t.name.match(/\.zip$/i)?"zip":t.name.match(/\.vl2$/i)?"vl2":void 0){case"zip":case"vl2":{let t=e.name.match(/^(.+)\.(zip|vl2)$/i),a=t?t[1]:e.name;return(await i(e)).map(t=>({...t,path:"".concat(e.name,"/").concat(t.path),name:a}))}case"png":return{path:e.name,imageUrl:await o(e),name:null};default:return null}}))).flat().filter(e=>!!e)}async function u(e){var a=await s(e);let n=new Map;return a.forEach(e=>{let a=function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t||(t=function(){let e=new Map;for(let t in r)r[t].forEach((a,r)=>{let n;if(a.fileSuffix?n=a.fileSuffix:!1!==a.selectable&&!0!==a.hidden&&(a.file||a.name)&&(n=a.file||a.name),n){var c;let l=null!=(c=e.get(n))?c:[];l.push({modelName:t,material:a,index:r}),e.set(n,l)}});return e}());let n=e.split("/").slice(-1)[0],c=n.match(/^(.+)\.(PNG|png)$/);if(c){let r=c[1],l=r.split(".");if(l.length>1){let a=".".concat(l[l.length-1]),i=t.get(a);if(i)return{path:e,basename:n,nameWithoutExtension:r,extension:c[2],skinName:l.slice(0,l.length-1).join("."),models:i}}else{let i=function(e){let a=/^(.+[^\d])(\d{2,})$/.exec(e);if(a){var r;let e=a[1],n=a[2],c=parseInt(n,10),l="".concat(e).concat("0".padStart(n.length,"0"));return(null!=(r=t.get(l))?r:[]).filter(e=>"number"==typeof e.material.frameCount).map(e=>({...e,frameIndex:c}))}return[]}(l[0]);if(i.length)return{path:e,basename:n,nameWithoutExtension:r,extension:c[2],skinName:a,models:i};{let i=t.get(l[0]);if(i)return{path:e,basename:n,nameWithoutExtension:r,extension:c[2],skinName:a,models:i}}}}return null}(e.path,e.name);a&&a.models.forEach(t=>{var r,c,l,i,o;let s=null!=(r=n.get(t.modelName))?r:new Map,u=null!=(c=s.get(a.skinName))?c:{name:a.skinName,isComplete:null,materials:new Map},h=null!=(l=t.material.file)?l:t.material.name,m=null!=(i=u.materials.get(h))?i:[];m[null!=(o=t.frameIndex)?o:0]=e.imageUrl,u.materials.set(h,m),s.set(a.skinName,u),n.set(t.modelName,s)})}),n.forEach((e,t)=>{let a=r[t].filter(e=>!1!==e.selectable&&!0!==e.hidden&&!0!==e.optional);e.forEach(e=>{e.isComplete=a.every(t=>{var a;return e.materials.has(null!=(a=t.file)?a:t.name)})})}),n}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/33aeca087c4fb9b3.js b/docs/_next/static/chunks/33aeca087c4fb9b3.js new file mode 100644 index 0000000..0a03c87 --- /dev/null +++ b/docs/_next/static/chunks/33aeca087c4fb9b3.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29947,e=>{e.v(JSON.parse('{"defaultSkins":{"lmale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"mmale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"hmale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"lfemale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"mfemale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"hfemale":[],"lbioderm":["Horde","Inferno","Storm"],"mbioderm":["Horde","Inferno","Storm"],"hbioderm":["Horde","Inferno","Storm"]},"modelDefaults":{"lmale":"Blood Eagle","mmale":"Blood Eagle","hmale":"Blood Eagle","lfemale":"Blood Eagle","mfemale":"Blood Eagle","hfemale":"Blood Eagle","lbioderm":"Storm","mbioderm":"Storm","hbioderm":"Storm","chaingun":"weapon_chaingun","disc":"weapon_disc","elf":"weapon_elf","energy":"weapon_energy","grenade_launcher":"weapon_grenade_launcher","mine":"mine","missile":"weapon_missile","mortar":"weapon_mortar","plasmathrower":"weapon_plasmathrower","repair":"weapon_repair","shocklance":"weapon_shocklance","sniper":"weapon_sniper","targeting":"weapon_targeting","vehicle_land_mpbbase":"vehicle_land_mpbbase","vehicle_grav_scout":"vehicle_grav_scout","vehicle_grav_tank":"vehicle_grav_tank","turret_assaulttank_mortar":"turret_assaulttank_mortar","vehicle_air_scout":"vehicle_air_scout","vehicle_air_bomber":"vehicle_air_bomber","vehicle_air_hapc":"vehicle_air_hapc"},"animationLabels":{"Forward":"Run Forward","Back":"Run Backward","Back0":"Run Backward","Root":"Idle","Root2":"Run Backward","Root3":"Idle","Idlepda":"Idle (PDA)","PDA":"Idle (PDA)","Root1":"Idle (PDA)","Jump":"Jump","Jump0":"Jump (Alternate)","Jump1":"Jump (Alternate)","Jump2":"Jump (Alternate)","Jump3":"Jump (Alternate)","Jet":"Jet","Fall":"Fall","Land":"Land","Land1":"Land (Alternate)","ski":"Ski","Side":"Strafe Left","Celwave":"Wave","Celbow":"Bow","Celdisco":"Dance","Celdance":"Dance","Celflex":"Flex","Celflex1":"Flex","Celrocky":"Awesome","Celjump":"Awesome","Celsalute":"Salute","celTaunt":"Too Bad","CelebrationGora":"Wave Arms","Celgora":"Wave Arms","CelebrationJump":"Bull Charge","Tauntbull":"Bull Charge","CelebrationJump0":"Celebrate","CelebrationJump4":"The Greatest","CelebrationRoar":"Roar","Celroar":"Roar","Celraor":"Roar","Celflex2":"Flex","celyeah":"Yeah","celtaunt":"Too Bad","Tauntbutt":"Butt","Tauntkiss":"Blow Kiss","Tauntbest":"The Greatest","Taunimp":"Move!","Tauntimp":"Move!","Sitting":"Sit","Scoutroot":"Gravcycle","Recoilde":"Recoil","Light_recoil":"Recoil","Dieforward":"Death (Fall Forward)","DeathForward":"Death (Fall Forward)","Dieslump":"Death (Slump)","DeathSlump":"Death (Slump)","Diespin":"Death (Spin)","DeathSpin":"Death (Spin)","diechest":"Death (Hold Chest)","Diechest":"Death (Hold Chest)","DeathChest":"Death (Hold Chest)","Dieback":"Death (Hold Back)","DeathBack":"Death (Hold Back)","Diehead":"Death (Hold Head)","DeathHead":"Death (Hold Head)","Dieknees":"Death (On Knees)","DeathKnees":"Death (On Knees)","Dieleglf":"Death (Left Leg Injury)","Dieleglft":"Death (Left Leg Injury)","DeathLegLeft":"Death (Left Leg Injury)","Dielegrt":"Death (Right Leg Injury)","Dielegtrt":"Death (Right Leg Injury)","DeathLegRight":"Death (Right Leg Injury)","Dielegrt0":"Death (Right Leg Injury)","Diesidelf":"Death (Left Side)","DeathSideLeft":"Death (Left Side)","Diesidert":"Death (Right Side)","DeathSideRight":"Death (Right Side)","Diesidert0":"Death (Right Side Alternate)"},"cameraOverrides":{"chaingun":{"target":"0m 0m 0m","fov":"12deg"},"plasmathrower":{"target":"0.002m -0.001m 0m","fov":"12deg"},"energy":{"fov":"31deg","orbit":"135deg 70deg 105%"},"hmale":{"fov":"24deg"},"hfemale":{"fov":"24deg"},"hbioderm":{"fov":"24deg"},"vehicle_grav_scout":{"orbit":"290deg 60deg 130%"},"vehicle_grav_tank":{"orbit":"290deg 60deg 130%"},"turret_assaulttank_mortar":{"orbit":"290deg 60deg 130%"},"vehicle_land_mpbbase":{"orbit":"290deg 60deg 130%"},"vehicle_air_scout":{"orbit":"290deg 60deg 130%"},"vehicle_air_bomber":{"orbit":"290deg 60deg 130%"},"vehicle_air_hapc":{"orbit":"290deg 60deg 130%"}},"animationLabelOverrides":{"mmale":{"Back":"Strafe Left"},"mfemale":{"Dielegrt":"Death (Slump)"},"lbioderm":{"Root":"Gravcycle"}},"materials":{"lmale":[{"name":"base","label":"Warrior","fileSuffix":".lmale"}],"mmale":[{"name":"base","label":"Warrior","fileSuffix":".mmale"}],"hmale":[{"name":"base","label":"Warrior","fileSuffix":".hmale"}],"lfemale":[{"name":"base","label":"Warrior","fileSuffix":".lfemale"}],"mfemale":[{"name":"base","label":"Warrior","fileSuffix":".mfemale"}],"lbioderm":[{"name":"base","label":"Warrior","fileSuffix":".lbioderm"}],"mbioderm":[{"name":"base","label":"Warrior","fileSuffix":".mbioderm"}],"hbioderm":[{"name":"base","label":"Warrior","fileSuffix":".hbioderm"}],"disc":[{"name":"weapon_disc","label":"Weapon"},{"name":"dcase00","label":"Disc Case","size":[256,256],"baseColorFactor":[1,1,1,0.7],"emissiveFactor":[1,1,1],"emissiveTexture":true,"alphaMode":"BLEND","metallicFactor":0,"roughnessFactor":1,"frameCount":6,"frameTimings":[21,1,1,1,1,1],"optional":true}],"chaingun":[{"label":"Chaingun","name":"weapon_chaingun"}],"grenade_launcher":[{"label":"Grenade Launcher","name":"weapon_grenade_launcher"}],"sniper":[{"label":"Weapon","name":"weapon_sniper"},{"label":"Green Light","name":"greenlight","hasDefault":false,"optional":true},{"label":"Red Light","name":"lite_red","hasDefault":false,"optional":true}],"plasmathrower":[{"label":"Rear & Barrel","name":"weapon_plasma10","file":"weapon_plasma1"},{"label":"Top & Front","name":"weapon_plasma21","file":"weapon_plasma2"},{"name":"weapon_plasma1","file":"weapon_plasma1","selectable":false},{"name":"weapon_plasma2","file":"weapon_plasma2","selectable":false}],"energy":[{"label":"Weapon","name":"blinn1","file":"weapon_energy"}],"shocklance":[{"label":"Weapon","name":"weapon_shocklance","size":[512,256]},{"label":"Glow","name":"weapon_shocklance_glow_","file":"weapon_shocklance_glow ","emissiveFactor":[1,1,1],"alphaMode":"MASK","alphaCutoff":255,"emissiveTexture":true,"metallicFactor":0,"roughnessFactor":1,"size":[256,128],"optional":true}],"elf":[{"label":"Weapon","name":"weapon_elf","file":"weapon_elf"},{"label":"Glow","name":"weapon_elf0","file":"weapon_elf"}],"missile":[{"label":"Weapon","name":"weapon_missile"}],"mortar":[{"label":"Weapon","name":"weapon_mortar"}],"repair":[{"label":"Weapon","name":"weapon_repair"}],"targeting":[{"label":"Weapon","name":"weapon_targeting"}],"mine":[{"label":"Weapon","name":"mine","size":[512,512],"metallicFactor":0,"roughnessFactor":1}],"vehicle_air_scout":[{"label":"Vehicle","name":"vehicle_air_scout0","file":"vehicle_air_scout"},{"name":"Unassigned","hidden":true,"hasDefault":false},{"name":"vehicle_air_scout","hidden":true,"hasDefault":false},{"label":"Flare","name":"shrikeflare2","emissiveFactor":[0,0,0],"alphaMode":"BLEND","emissiveTexture":true,"metallicFactor":0,"roughnessFactor":1,"size":[256,256],"optional":true}],"vehicle_air_bomber":[{"label":"Cockpit & Thrusters","name":"vehicle_air_bomber10","file":"vehicle_air_bomber1","size":[256,512]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Rear","name":"vehicle_air_bomber2","size":[256,512]},{"label":"Wings","name":"vehicle_air_bomber31","file":"vehicle_air_bomber3"},{"name":"vehicle_air_bomber1","size":[256,512],"selectable":false},{"name":"vehicle_air_bomber3","selectable":false}],"vehicle_air_hapc":[{"label":"Cockpit","name":"vehicle_air_bomber1","size":[256,512]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Wings","name":"vehicle_air_hpc2"},{"label":"Seats","name":"vehicle_air_hpc1"},{"label":"Thrusters","name":"vehicle_air_hpc30","file":"vehicle_air_hpc3"},{"name":"vehicle_air_hpc3","selectable":false}],"vehicle_grav_scout":[{"label":"Vehicle","name":"Vehicle_grav_scout0","file":"Vehicle_grav_scout","size":[512,256]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Pipes","name":"Vehicle_grav_scout_pipes1","file":"Vehicle_grav_scout_pipes","metallicFactor":0,"roughnessFactor":1},{"name":"Vehicle_grav_scout","hidden":true,"hasDefault":false},{"label":"Side Thrusters","name":"Vehicle_grav_scout_pipes","file":"Vehicle_grav_scout_pipes","emissiveFactor":[1,1,1],"alphaMode":"OPAQUE","metallicFactor":0,"roughnessFactor":1,"emissiveTexture":true,"selectable":false},{"label":"Windshield","name":"Vehicle_grav_scout_windshield","file":"Vehicle_grav_scout_windshield","selectable":false,"alphaMode":"BLEND","baseColorFactor":[1,1,1,0.5],"metallicFactor":0,"roughnessFactor":1,"size":[128,128],"optional":true},{"label":"Windshield Inner","name":"Vehicle_grav_scout_windshieldInner","file":"Vehicle_grav_scout_windshieldInner","selectable":false,"alphaMode":"BLEND","baseColorFactor":[1,1,1,0.5],"metallicFactor":0,"roughnessFactor":1,"size":[128,128],"optional":true}],"vehicle_grav_tank":[{"label":"Center","name":"Vehicle_grav_tank_bodyMain","size":[256,512]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Sides","name":"vehicle_grav_tank_bodyside10","file":"vehicle_grav_tank_bodyside1","size":[256,512]},{"label":"Thrusters","name":"vehicle_grav_tank_bodyside21","file":"vehicle_grav_tank_bodyside2"},{"name":"vehicle_grav_tank_bodyside2","selectable":false},{"name":"vehicle_grav_tank_bodyside1","selectable":false}],"turret_assaulttank_mortar":[{"label":"Turret","name":"turret_assaulttank_mortar","file":"turret_assaultTank"}],"vehicle_land_mpbbase":[{"label":"Vehicle Front","name":"vehicle_land_mpb1"},{"label":"Vehicle Back","name":"vehicle_land_mpb2"},{"label":"Wheels","name":"Vehicle_Land_Assault_wheel","file":"Vehicle_Land_Assault_Wheel","size":[512,256],"optional":true}]},"animations":{"global":["Forward","Back","Jump","Jet","Fall","Land","ski","Root"],"lmale":["Idlepda","Side","Jump0","Land1","Recoilde","Celwave","Celdisco","Celflex","Celrocky","Celsalute","celTaunt","Taunimp","Tauntbest","Dieback","diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Diesidelf","Diesidert","Dieslump","Diespin","Scoutroot","Sitting"],"mmale":["Back0","Jump3","Recoilde","Celwave","Celdance","Celflex","Celrocky","Celsalute","celtaunt","Tauntbest","Tauntimp","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Diesidelf","Diesidert","Diespin","Sitting"],"hmale":["Idlepda","Jump1","Side","Recoilde","Celwave","Celdance","Celflex","Celjump","Celsalute","celtaunt","Tauntbest","Tauntimp","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dielegrt","Diesidelf","Diesidert","Diesidert0","Dieslump","Diespin"],"lfemale":["Idlepda","Jump1","Side","Recoilde","Celwave","Celbow","Celdance","Celsalute","Tauntbest","Tauntbutt","Tauntimp","Tauntkiss","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Diesidelf","Diesidert","Dieslump","Diespin","Scoutroot","Sitting"],"mfemale":["Idlepda","Jump1","Side","Recoilde","Celwave","Celbow","Celdisco","Celsalute","Tauntbest","Tauntbutt","Tauntimp","Tauntkiss","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Dielegrt0","Diesidelf","Diesidert","Diespin","Sitting"],"lbioderm":["Root3","PDA","Jump2","Side","Light_recoil","CelebrationGora","CelebrationJump","CelebrationJump0","CelebrationJump4","CelebrationRoar","Salute","Celflex2","celyeah","DeathBack","DeathChest","DeathForward","DeathHead","DeathKnees","DeathLegLeft","DeathLegRight","DeathSideLeft","DeathSideRight","DeathSlump","DeathSpin","Sitting"],"mbioderm":["Root1","Jump2","Side","Recoilde","Salute","Celflex1","Celgora","Celjump","Celroar","celyeah","Tauntbest","Tauntbull","DeathBack","DeathChest","DeathHead","DeathSideLeft","DeathSpin","Dieforward","Dieknees","Dieleglft","Dielegtrt","Diesidert","Dieslump","Sitting"],"hbioderm":["Root1","Jump2","Side","Recoilde","Salute","Celflex2","Celgora","Celjump","Celraor","celyeah","Tauntbest","Tauntbull","DeathBack","DeathChest","DeathForward","DeathHead","DeathKnees","DeathLegLeft","DeathLegRight","DeathSideLeft","DeathSideRight","DeathSlump","DeathSpin"]}}'))},67034,(e,t,r)=>{!function(){var e={675:function(e,t){"use strict";t.byteLength=function(e){var t=f(e),r=t[0],i=t[1];return(r+i)*3/4-i},t.toByteArray=function(e){var t,r,n=f(e),o=n[0],l=n[1],s=new a((o+l)*3/4-l),h=0,u=l>0?o-4:o;for(r=0;r>16&255,s[h++]=t>>8&255,s[h++]=255&t;return 2===l&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,s[h++]=255&t),1===l&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,s[h++]=t>>8&255,s[h++]=255&t),s},t.fromByteArray=function(e){for(var t,i=e.length,a=i%3,n=[],o=0,l=i-a;o>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return n.join("")}(e,o,o+16383>l?l:o+16383));return 1===a?n.push(r[(t=e[i-1])>>2]+r[t<<4&63]+"=="):2===a&&n.push(r[(t=(e[i-2]<<8)+e[i-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),n.join("")};for(var r=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=n.length;o0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var i=r===t?0:4-r%4;return[r,i]}i[45]=62,i[95]=63},72:function(e,t,r){"use strict";var i=r(675),a=r(783),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return h(e)}return f(e,t,r)}function f(e,t,r){if("string"==typeof e){var i=e,a=t;if(("string"!=typeof a||""===a)&&(a="utf8"),!l.isEncoding(a))throw TypeError("Unknown encoding: "+a);var n=0|p(i,a),f=o(n),s=f.write(i,a);return s!==n&&(f=f.slice(0,s)),f}if(ArrayBuffer.isView(e))return u(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(T(e,ArrayBuffer)||e&&T(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(T(e,SharedArrayBuffer)||e&&T(e.buffer,SharedArrayBuffer)))return function(e,t,r){var i;if(t<0||e.byteLength=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||T(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var a=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return A(e).length;default:if(a)return i?-1:B(e).length;t=(""+t).toLowerCase(),a=!0}}function d(e,t,r){var a,n,o,l=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var a="",n=t;n0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(n=r*=1)!=n&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(a)return -1;else r=e.length-1;else if(r<0)if(!a)return -1;else r=0;if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:b(e,t,r,i,a);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(a)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return b(e,[t],r,i,a)}throw TypeError("val must be string, number or Buffer")}function b(e,t,r,i,a){var n,o=1,l=e.length,f=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return -1;o=2,l/=2,f/=2,r/=2}function s(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(a){var h=-1;for(n=r;nl&&(r=l-f),n=r;n>=0;n--){for(var u=!0,c=0;cr&&(e+=" ... "),""},n&&(l.prototype[n]=l.prototype.inspect),l.prototype.compare=function(e,t,r,i,a){if(T(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===a&&(a=this.length),t<0||r>e.length||i<0||a>this.length)throw RangeError("out of range index");if(i>=a&&t>=r)return 0;if(i>=a)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,a>>>=0,this===e)return 0;for(var n=a-i,o=r-t,f=Math.min(n,o),s=this.slice(i,a),h=e.slice(t,r),u=0;u239?4:s>223?3:s>191?2:1;if(a+u<=r)switch(u){case 1:s<128&&(h=s);break;case 2:(192&(n=e[a+1]))==128&&(f=(31&s)<<6|63&n)>127&&(h=f);break;case 3:n=e[a+1],o=e[a+2],(192&n)==128&&(192&o)==128&&(f=(15&s)<<12|(63&n)<<6|63&o)>2047&&(f<55296||f>57343)&&(h=f);break;case 4:n=e[a+1],o=e[a+2],l=e[a+3],(192&n)==128&&(192&o)==128&&(192&l)==128&&(f=(15&s)<<18|(63&n)<<12|(63&o)<<6|63&l)>65535&&f<1114112&&(h=f)}null===h?(h=65533,u=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),a+=u}var c=i,p=c.length;if(p<=4096)return String.fromCharCode.apply(String,c);for(var d="",g=0;gr)throw RangeError("Trying to access beyond buffer length")}function _(e,t,r,i,a,n){if(!l.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw RangeError("Index out of range")}function w(e,t,r,i,a,n){if(r+i>e.length||r<0)throw RangeError("Index out of range")}function D(e,t,r,i,n){return t*=1,r>>>=0,n||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),a.write(e,t,r,i,23,4),r+4}function S(e,t,r,i,n){return t*=1,r>>>=0,n||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),a.write(e,t,r,i,52,8),r+8}l.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a,n,o,l,f,s,h,u,c=this.length-t;if((void 0===r||r>c)&&(r=c),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var p=!1;;)switch(i){case"hex":return function(e,t,r,i){r=Number(r)||0;var a=e.length-r;i?(i=Number(i))>a&&(i=a):i=a;var n=t.length;i>n/2&&(i=n/2);for(var o=0;o>8,a.push(r%256),a.push(i);return a}(e,this.length-h),this,h,u);default:if(p)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),p=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||v(e,t,this.length);for(var i=this[e],a=1,n=0;++n>>=0,t>>>=0,r||v(e,t,this.length);for(var i=this[e+--t],a=1;t>0&&(a*=256);)i+=this[e+--t]*a;return i},l.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var i=this[e],a=1,n=0;++n=(a*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var i=t,a=1,n=this[e+--i];i>0&&(a*=256);)n+=this[e+--i]*a;return n>=(a*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),a.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),a.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),a.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),a.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,i){if(e*=1,t>>>=0,r>>>=0,!i){var a=Math.pow(2,8*r)-1;_(this,e,t,r,a,0)}var n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!i){var a=Math.pow(2,8*r)-1;_(this,e,t,r,a,0)}var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,i){if(e*=1,t>>>=0,!i){var a=Math.pow(2,8*r-1);_(this,e,t,r,a-1,-a)}var n=0,o=1,l=0;for(this[t]=255&e;++n>>=0,!i){var a=Math.pow(2,8*r-1);_(this,e,t,r,a-1,-a)}var n=r-1,o=1,l=0;for(this[t+n]=255&e;--n>=0&&(o*=256);)e<0&&0===l&&0!==this[t+n+1]&&(l=1),this[t+n]=(e/o|0)-l&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,i){if(!l.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,i),t);return a},l.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===e.length){var a,n=e.charCodeAt(0);("utf8"===i&&n<128||"latin1"===i)&&(e=n)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&r<57344){if(!a){if(r>56319||o+1===i){(t-=3)>-1&&n.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&n.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(t-=3)>-1&&n.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;n.push(r)}else if(r<2048){if((t-=2)<0)break;n.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;n.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;n.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return n}function E(e){for(var t=[],r=0;r=t.length)&&!(a>=e.length);++a)t[a+r]=e[a];return a}function T(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var x=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var i=16*r,a=0;a<16;++a)t[i+a]=e[r]+e[a];return t}()},783:function(e,t){t.read=function(e,t,r,i,a){var n,o,l=8*a-i-1,f=(1<>1,h=-7,u=r?a-1:0,c=r?-1:1,p=e[t+u];for(u+=c,n=p&(1<<-h)-1,p>>=-h,h+=l;h>0;n=256*n+e[t+u],u+=c,h-=8);for(o=n&(1<<-h)-1,n>>=-h,h+=i;h>0;o=256*o+e[t+u],u+=c,h-=8);if(0===n)n=1-s;else{if(n===f)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),n-=s}return(p?-1:1)*o*Math.pow(2,n-i)},t.write=function(e,t,r,i,a,n){var o,l,f,s=8*n-a-1,h=(1<>1,c=5960464477539062e-23*(23===a),p=i?0:n-1,d=i?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(l=+!!isNaN(t),o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+u>=1?t+=c/f:t+=c*Math.pow(2,1-u),t*f>=2&&(o++,f/=2),o+u>=h?(l=0,o=h):o+u>=1?(l=(t*f-1)*Math.pow(2,a),o+=u):(l=t*Math.pow(2,u-1)*Math.pow(2,a),o=0));a>=8;e[r+p]=255&l,p+=d,l/=256,a-=8);for(o=o<0;e[r+p]=255&o,p+=d,o/=256,s-=8);e[r+p-d]|=128*g}}},r={};function i(t){var a=r[t];if(void 0!==a)return a.exports;var n=r[t]={exports:{}},o=!0;try{e[t](n,n.exports,i),o=!1}finally{o&&delete r[t]}return n.exports}i.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=i(72)}()},5993,e=>{e.v("/t2-model-skinner/_next/static/media/imageProcessing.worker.dbca7ab4.ts")},63871,e=>{"use strict";e.s(["ModelViewerContext",()=>r,"default",()=>i]);var t=e.i(71645);let r=t.default.createContext(null);function i(){let e=(0,t.useContext)(r);if(!e)throw Error("No ModelViewerContext.Provider");return e}r.displayName="ModelViewerContext"},91135,e=>{e.v(t=>Promise.all(["static/chunks/5778c7d57772f351.js"].map(t=>e.l(t))).then(()=>t(69642)))},22143,e=>{e.v(t=>Promise.all(["static/chunks/2d6d26cb79779ffe.js"].map(t=>e.l(t))).then(()=>t(66641)))}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/395c2bae735f87a6.js b/docs/_next/static/chunks/395c2bae735f87a6.js deleted file mode 100644 index 285ba90..0000000 --- a/docs/_next/static/chunks/395c2bae735f87a6.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33525,(t,e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return n}});let n=t=>{}},67034,(t,e,r)=>{!function(){var t={675:function(t,e){"use strict";e.byteLength=function(t){var e=s(t),r=e[0],n=e[1];return(r+n)*3/4-n},e.toByteArray=function(t){var e,r,i=s(t),f=i[0],u=i[1],a=new o((f+u)*3/4-u),h=0,c=u>0?f-4:f;for(r=0;r>16&255,a[h++]=e>>8&255,a[h++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[h++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[h++]=e>>8&255,a[h++]=255&e),a},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],f=0,u=n-o;f>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return i.join("")}(t,f,f+16383>u?u:f+16383));return 1===o?i.push(r[(e=t[n-1])>>2]+r[e<<4&63]+"=="):2===o&&i.push(r[(e=(t[n-2]<<8)+t[n-1])>>10]+r[e>>4&63]+r[e<<2&63]+"="),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,u=i.length;f0)throw Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");-1===r&&(r=e);var n=r===e?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(t,e,r){"use strict";var n=r(675),o=r(783),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function f(t){if(t>0x7fffffff)throw RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw TypeError('The "string" argument must be of type string. Received type number');return h(t)}return s(t,e,r)}function s(t,e,r){if("string"==typeof t){var n=t,o=e;if(("string"!=typeof o||""===o)&&(o="utf8"),!u.isEncoding(o))throw TypeError("Unknown encoding: "+o);var i=0|p(n,o),s=f(i),a=s.write(n,o);return a!==i&&(s=s.slice(0,a)),s}if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(L(t,ArrayBuffer)||t&&L(t.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(L(t,SharedArrayBuffer)||t&&L(t.buffer,SharedArrayBuffer)))return function(t,e,r){var n;if(e<0||t.byteLength=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||L(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return x(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return O(t).length;default:if(o)return n?-1:x(t).length;e=(""+e).toLowerCase(),o=!0}}function y(t,e,r){var o,i,f,u=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(e>>>=0)))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(i=r*=1)!=i&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length)if(o)return -1;else r=t.length-1;else if(r<0)if(!o)return -1;else r=0;if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e){if(e&=255,"function"==typeof Uint8Array.prototype.indexOf)if(o)return Uint8Array.prototype.indexOf.call(t,e,r);else return Uint8Array.prototype.lastIndexOf.call(t,e,r);return v(t,[e],r,n,o)}throw TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,f=1,u=t.length,s=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;f=2,u/=2,s/=2,r/=2}function a(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(o){var h=-1;for(i=r;iu&&(r=u-s),i=r;i>=0;i--){for(var c=!0,l=0;lr&&(t+=" ... "),""},i&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,o){if(L(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,f=r-e,s=Math.min(i,f),a=this.slice(n,o),h=t.slice(e,r),c=0;c239?4:a>223?3:a>191?2:1;if(o+c<=r)switch(c){case 1:a<128&&(h=a);break;case 2:(192&(i=t[o+1]))==128&&(s=(31&a)<<6|63&i)>127&&(h=s);break;case 3:i=t[o+1],f=t[o+2],(192&i)==128&&(192&f)==128&&(s=(15&a)<<12|(63&i)<<6|63&f)>2047&&(s<55296||s>57343)&&(h=s);break;case 4:i=t[o+1],f=t[o+2],u=t[o+3],(192&i)==128&&(192&f)==128&&(192&u)==128&&(s=(15&a)<<18|(63&i)<<12|(63&f)<<6|63&u)>65535&&s<1114112&&(h=s)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}var l=n,p=l.length;if(p<=4096)return String.fromCharCode.apply(String,l);for(var y="",g=0;gr)throw RangeError("Trying to access beyond buffer length")}function m(t,e,r,n,o,i){if(!u.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw RangeError("Index out of range")}function E(t,e,r,n,o,i){if(r+n>t.length||r<0)throw RangeError("Index out of range")}function A(t,e,r,n,i){return e*=1,r>>>=0,i||E(t,e,r,4,34028234663852886e22,-34028234663852886e22),o.write(t,e,r,n,23,4),r+4}function B(t,e,r,n,i){return e*=1,r>>>=0,i||E(t,e,r,8,17976931348623157e292,-17976931348623157e292),o.write(t,e,r,n,52,8),r+8}u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o,i,f,u,s,a,h,c,l=this.length-e;if((void 0===r||r>l)&&(r=l),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var p=!1;;)switch(n){case"hex":return function(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var f=0;f>8,o.push(r%256),o.push(n);return o}(t,this.length-h),this,h,c);default:if(p)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},u.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUInt8=function(t,e){return t>>>=0,e||w(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||w(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||w(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||w(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+0x1000000*this[t+3]},u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||w(t,4,this.length),0x1000000*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return(t>>>=0,e||w(t,1,this.length),128&this[t])?-((255-this[t]+1)*1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||w(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?0xffff0000|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||w(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?0xffff0000|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||w(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||w(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||w(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||w(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||w(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||w(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){if(t*=1,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;m(this,t,e,r,o,0)}var i=1,f=0;for(this[e]=255&t;++f>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;m(this,t,e,r,o,0)}var i=r-1,f=1;for(this[e+i]=255&t;--i>=0&&(f*=256);)this[e+i]=t/f&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t*=1,e>>>=0,r||m(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t*=1,e>>>=0,r||m(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUInt16BE=function(t,e,r){return t*=1,e>>>=0,r||m(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUInt32LE=function(t,e,r){return t*=1,e>>>=0,r||m(this,t,e,4,0xffffffff,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUInt32BE=function(t,e,r){return t*=1,e>>>=0,r||m(this,t,e,4,0xffffffff,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t*=1,e>>>=0,!n){var o=Math.pow(2,8*r-1);m(this,t,e,r,o-1,-o)}var i=0,f=1,u=0;for(this[e]=255&t;++i>>=0,!n){var o=Math.pow(2,8*r-1);m(this,t,e,r,o-1,-o)}var i=r-1,f=1,u=0;for(this[e+i]=255&t;--i>=0&&(f*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/f|0)-u&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t*=1,e>>>=0,r||m(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t*=1,e>>>=0,r||m(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t*=1,e>>>=0,r||m(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t*=1,e>>>=0,r||m(this,t,e,4,0x7fffffff,-0x80000000),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t*=1,e>>>=0,r||m(this,t,e,4,0x7fffffff,-0x80000000),t<0&&(t=0xffffffff+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return A(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return A(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return B(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return B(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===t.length){var o,i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!o){if(r>56319||f+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return i}function T(t){for(var e=[],r=0;r=e.length)&&!(o>=t.length);++o)e[o+r]=t[o];return o}function L(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}var S=function(){for(var t="0123456789abcdef",e=Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)e[n+o]=t[r]+t[o];return e}()},783:function(t,e){e.read=function(t,e,r,n,o){var i,f,u=8*o-n-1,s=(1<>1,h=-7,c=r?o-1:0,l=r?-1:1,p=t[e+c];for(c+=l,i=p&(1<<-h)-1,p>>=-h,h+=u;h>0;i=256*i+t[e+c],c+=l,h-=8);for(f=i&(1<<-h)-1,i>>=-h,h+=n;h>0;f=256*f+t[e+c],c+=l,h-=8);if(0===i)i=1-a;else{if(i===s)return f?NaN:1/0*(p?-1:1);f+=Math.pow(2,n),i-=a}return(p?-1:1)*f*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var f,u,s,a=8*i-o-1,h=(1<>1,l=5960464477539062e-23*(23===o),p=n?0:i-1,y=n?1:-1,g=+(e<0||0===e&&1/e<0);for(isNaN(e=Math.abs(e))||e===1/0?(u=+!!isNaN(e),f=h):(f=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-f))<1&&(f--,s*=2),f+c>=1?e+=l/s:e+=l*Math.pow(2,1-c),e*s>=2&&(f++,s/=2),f+c>=h?(u=0,f=h):f+c>=1?(u=(e*s-1)*Math.pow(2,o),f+=c):(u=e*Math.pow(2,c-1)*Math.pow(2,o),f=0));o>=8;t[r+p]=255&u,p+=y,u/=256,o-=8);for(f=f<0;t[r+p]=255&f,p+=y,f/=256,a-=8);t[r+p-y]|=128*g}}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}},f=!0;try{t[e](i,i.exports,n),f=!1}finally{f&&delete r[e]}return i.exports}n.ab="/ROOT/node_modules/next/dist/compiled/buffer/",e.exports=n(72)}()},78631,(t,e,r)=>{!function(e,r){if("function"==typeof define&&define.amd){let e;void 0!==(e=r())&&t.v(e)}else r()}(t.e,function(){"use strict";function r(t,e,r){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){u(n.response,e,r)},n.onerror=function(){console.error("could not download file")},n.send()}function n(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch(t){}return 200<=e.status&&299>=e.status}function o(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(r){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:t.g.global===t.g?t.g:void 0,f=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),u=i.saveAs||("object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!f?function(t,e,f){var u=i.URL||i.webkitURL,s=document.createElement("a");s.download=e=e||t.name||"download",s.rel="noopener","string"==typeof t?(s.href=t,s.origin===location.origin?o(s):n(s.href)?r(t,e,f):o(s,s.target="_blank")):(s.href=u.createObjectURL(t),setTimeout(function(){u.revokeObjectURL(s.href)},4e4),setTimeout(function(){o(s)},0))}:"msSaveOrOpenBlob"in navigator?function(t,e,i){if(e=e||t.name||"download","string"!=typeof t){var f;navigator.msSaveOrOpenBlob((void 0===(f=i)?f={autoBom:!1}:"object"!=typeof f&&(console.warn("Deprecated: Expected third argument to be a object"),f={autoBom:!f}),f.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\uFEFF",t],{type:t.type}):t),e)}else if(n(t))r(t,e,i);else{var u=document.createElement("a");u.href=t,u.target="_blank",setTimeout(function(){o(u)})}}:function(t,e,n,o){if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof t)return r(t,e,n);var u="application/octet-stream"===t.type,s=/constructor/i.test(i.HTMLElement)||i.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||u&&s||f)&&"undefined"!=typeof FileReader){var h=new FileReader;h.onloadend=function(){var t=h.result;t=a?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=t:location=t,o=null},h.readAsDataURL(t)}else{var c=i.URL||i.webkitURL,l=c.createObjectURL(t);o?o.location=l:location.href=l,o=null,setTimeout(function(){c.revokeObjectURL(l)},4e4)}});i.saveAs=u.saveAs=u,e.exports=u})},69642,t=>{"use strict";t.s(["collectFiles",()=>f,"createZipFile",()=>n,"savePngFile",()=>i,"saveZipFile",()=>o]);var e=t.i(71315),r=t.i(78631);function n(t){let r=new e.default;for(let e of t)r.file("textures/skins/".concat(e.name),e.data);return r}async function o(t,e){let n=await t.generateAsync({type:"blob"});(0,r.saveAs)(n,e)}function i(t,e){(0,r.saveAs)(t,e)}async function f(t){return await Promise.all(t.map(async t=>{let e="".concat("https://exogen.github.io/t2-skins/skins","/").concat(t),r=await fetch(e);return{name:t,data:await r.arrayBuffer()}}))}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/43ceca71888c9b70.js b/docs/_next/static/chunks/43ceca71888c9b70.js new file mode 100644 index 0000000..eb953b4 --- /dev/null +++ b/docs/_next/static/chunks/43ceca71888c9b70.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,43794,(t,e,r)=>{!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var t=[],e=0;e{t.v(t.b(["static/chunks/9338a92aac995757.js","static/chunks/a55df98dcb3b60ad.js","static/chunks/turbopack-95cb340f669027bc.js"]))},67585,(t,e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSR",{enumerable:!0,get:function(){return n}});let i=t.r(32061);function n(t){let{reason:e,children:r}=t;if("undefined"==typeof window)throw Object.defineProperty(new i.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return r}},9885,(t,e,r)=>{"use strict";function i(t){return t.split("/").map(t=>encodeURIComponent(t)).join("/")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"encodeURIPath",{enumerable:!0,get:function(){return i}})},52157,(t,e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return a}});let i=t.r(43476),n=t.r(74080),s=t.r(63599),o=t.r(9885);function a(t){let{moduleIds:e}=t;if("undefined"!=typeof window)return null;let r=s.workAsyncStorage.getStore();if(void 0===r)return null;let a=[];if(r.reactLoadableManifest&&e){let t=r.reactLoadableManifest;for(let r of e){if(!t[r])continue;let e=t[r].files;a.push(...e)}}return 0===a.length?null:(0,i.jsx)(i.Fragment,{children:a.map(t=>{let e=r.assetPrefix+"/_next/"+(0,o.encodeURIPath)(t);return t.endsWith(".css")?(0,i.jsx)("link",{precedence:"dynamic",href:e,rel:"stylesheet",as:"style"},t):((0,n.preload)(e,{as:"script",fetchPriority:"low"}),null)})})}},69093,(t,e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return h}});let i=t.r(43476),n=t.r(71645),s=t.r(67585),o=t.r(52157);function a(t){return{default:t&&"default"in t?t.default:t}}let l={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},h=function(t){let e={...l,...t},r=(0,n.lazy)(()=>e.loader().then(a)),h=e.loading;function c(t){let a=h?(0,i.jsx)(h,{isLoading:!0,pastDelay:!0,error:null}):null,l=!e.ssr||!!e.loading,c=l?n.Suspense:n.Fragment,u=e.ssr?(0,i.jsxs)(i.Fragment,{children:["undefined"==typeof window?(0,i.jsx)(o.PreloadChunks,{moduleIds:e.modules}):null,(0,i.jsx)(r,{...t})]}):(0,i.jsx)(s.BailoutToCSR,{reason:"next/dynamic",children:(0,i.jsx)(r,{...t})});return(0,i.jsx)(c,{...l?{fallback:a}:{},children:u})}return c.displayName="LoadableComponent",c}},70703,(t,e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return n}});let i=t.r(55682)._(t.r(69093));function n(t,e){var r;let n={};"function"==typeof t&&(n.loader=t);let s={...n,...e};return(0,i.default)({...s,modules:null==(r=s.loadableGenerated)?void 0:r.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),e.exports=r.default)},52683,t=>{"use strict";let e,r,i,n;t.s(["default",()=>u7],52683);var s,o,a,l,h,c,u,d,f,g,p,m,y,x,b,_,w,C,S,T,O,k,M,E,D,j,A,P,F,L,R,I,B,N,W,U,H,X,V,Y,z,G,q,K,Q=t.i(43476),J=t.i(71645);function Z(t,e,r){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e,"string"))?i:i+"")in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function tt(t){for(var e=1;e=0)continue;r[i]=t[i]}return r}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0||({}).propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function tr(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}class ti{constructor(){Z(this,"browserShadowBlurConstant",1),Z(this,"DPI",96),Z(this,"devicePixelRatio","undefined"!=typeof window?window.devicePixelRatio:1),Z(this,"perfLimitSizeTotal",2097152),Z(this,"maxCacheSideLimit",4096),Z(this,"minCacheSideLimit",256),Z(this,"disableStyleCopyPaste",!1),Z(this,"enableGLFiltering",!0),Z(this,"textureSize",4096),Z(this,"forceGLPutImageData",!1),Z(this,"cachesBoundsOfCurve",!1),Z(this,"fontPaths",{}),Z(this,"NUM_FRACTION_DIGITS",4)}}let tn=new class extends ti{configure(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(this,t)}addFonts(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fontPaths=tt(tt({},this.fontPaths),t)}removeFonts(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(t=>{delete this.fontPaths[t]})}clearFonts(){this.fontPaths={}}restoreDefaults(t){let e=new ti,r=(null==t?void 0:t.reduce((t,r)=>(t[r]=e[r],t),{}))||e;this.configure(r)}constructor(t){super(),this.configure(t)}},ts=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;ithis.testPrecision(e,t)),e.getExtension("WEBGL_lose_context").loseContext(),ts("log","WebGL: max texture size ".concat(this.maxTextureSize)))}isSupported(t){return!!this.maxTextureSize&&this.maxTextureSize>=t}}let tc={},tu=()=>e||(e={document:document,window:window,isTouchSupported:"ontouchstart"in window||"ontouchstart"in document||window&&window.navigator&&window.navigator.maxTouchPoints>0,WebGLProbe:new th,dispose(){},copyPasteData:tc}),td=()=>tu().document,tf=()=>tu().window,tg=()=>{var t;return Math.max(null!=(t=tn.devicePixelRatio)?t:tf().devicePixelRatio,1)},tp=new class{getFontCache(t){let{fontFamily:e,fontStyle:r,fontWeight:i}=t;e=e.toLowerCase(),this.charWidthsCache[e]||(this.charWidthsCache[e]={});let n=this.charWidthsCache[e],s="".concat(r.toLowerCase(),"_").concat((i+"").toLowerCase());return n[s]||(n[s]={}),n[s]}clearFontCache(t){(t=(t||"").toLowerCase())?this.charWidthsCache[t]&&delete this.charWidthsCache[t]:this.charWidthsCache={}}limitDimsByArea(t){let{perfLimitSizeTotal:e}=tn,r=Math.sqrt(e*t);return[Math.floor(r),Math.floor(e/r)]}constructor(){Z(this,"charWidthsCache",{}),Z(this,"boundsOfCurveCache",{})}},tm="6.7.1";function tv(){}let ty=Math.PI/2,tx=2*Math.PI,tb=Math.PI/180,t_=Object.freeze([1,0,0,1,0,0]),tw="center",tC="left",tS="bottom",tT="right",tO="none",tk=/\r?\n/,tM="moving",tE="scaling",tD="rotating",tj="rotate",tA="skewing",tP="resizing",tF="modifyPoly",tL="changed",tR="scale",tI="scaleX",tB="scaleY",tN="skewX",tW="skewY",tU="fill",tH="stroke",tX="modified",tV="json",tY=new class{has(t){return this[tV].has(t)}getClass(t){let e=this[tV].get(t);if(!e)throw new to("No class registered for ".concat(t));return e}setClass(t,e){e?this[tV].set(e,t):(this[tV].set(t.type,t),this[tV].set(t.type.toLowerCase(),t))}getSVGClass(t){return this.svg.get(t)}setSVGClass(t,e){this.svg.set(null!=e?e:t.type.toLowerCase(),t)}constructor(){this[tV]=new Map,this.svg=new Map}},tz=new class extends Array{remove(t){let e=this.indexOf(t);e>-1&&this.splice(e,1)}cancelAll(){let t=this.splice(0);return t.forEach(t=>t.abort()),t}cancelByCanvas(t){if(!t)return[];let e=this.filter(e=>{var r;return e.target===t||"object"==typeof e.target&&(null==(r=e.target)?void 0:r.canvas)===t});return e.forEach(t=>t.abort()),e}cancelByTarget(t){if(!t)return[];let e=this.filter(e=>e.target===t);return e.forEach(t=>t.abort()),e}};class tG{on(t,e){return(this.__eventListeners||(this.__eventListeners={}),"object"==typeof t)?(Object.entries(t).forEach(t=>{let[e,r]=t;this.on(e,r)}),()=>this.off(t)):e?(this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e),()=>this.off(t,e)):()=>!1}once(t,e){if("object"==typeof t){let e=[];return Object.entries(t).forEach(t=>{let[r,i]=t;e.push(this.once(r,i))}),()=>e.forEach(t=>t())}if(e){let r=this.on(t,function(){for(var t=arguments.length,i=Array(t),n=0;n!1}_removeEventListener(t,e){if(this.__eventListeners[t])if(e){let r=this.__eventListeners[t],i=r.indexOf(e);i>-1&&r.splice(i,1)}else this.__eventListeners[t]=[]}off(t,e){if(this.__eventListeners)if(void 0===t)for(let t in this.__eventListeners)this._removeEventListener(t);else"object"==typeof t?Object.entries(t).forEach(t=>{let[e,r]=t;this._removeEventListener(e,r)}):this._removeEventListener(t,e)}fire(t,e){var r;if(!this.__eventListeners)return;let i=null==(r=this.__eventListeners[t])?void 0:r.concat();if(i)for(let t=0;t{let r=t.indexOf(e);return -1!==r&&t.splice(r,1),t},tK=t=>{if(0===t)return 1;switch(Math.abs(t)/ty){case 1:case 3:return 0;case 2:return -1}return Math.cos(t)},tQ=t=>{if(0===t)return 0;let e=Math.sign(t);switch(t/ty){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)};class tJ{add(t){return new tJ(this.x+t.x,this.y+t.y)}addEquals(t){return this.x+=t.x,this.y+=t.y,this}scalarAdd(t){return new tJ(this.x+t,this.y+t)}scalarAddEquals(t){return this.x+=t,this.y+=t,this}subtract(t){return new tJ(this.x-t.x,this.y-t.y)}subtractEquals(t){return this.x-=t.x,this.y-=t.y,this}scalarSubtract(t){return new tJ(this.x-t,this.y-t)}scalarSubtractEquals(t){return this.x-=t,this.y-=t,this}multiply(t){return new tJ(this.x*t.x,this.y*t.y)}scalarMultiply(t){return new tJ(this.x*t,this.y*t)}scalarMultiplyEquals(t){return this.x*=t,this.y*=t,this}divide(t){return new tJ(this.x/t.x,this.y/t.y)}scalarDivide(t){return new tJ(this.x/t,this.y/t)}scalarDivideEquals(t){return this.x/=t,this.y/=t,this}eq(t){return this.x===t.x&&this.y===t.y}lt(t){return this.xt.x&&this.y>t.y}gte(t){return this.x>=t.x&&this.y>=t.y}lerp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5;return e=Math.max(Math.min(1,e),0),new tJ(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)}distanceFrom(t){let e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)}midPointFrom(t){return this.lerp(t)}min(t){return new tJ(Math.min(this.x,t.x),Math.min(this.y,t.y))}max(t){return new tJ(Math.max(this.x,t.x),Math.max(this.y,t.y))}toString(){return"".concat(this.x,",").concat(this.y)}setXY(t,e){return this.x=t,this.y=e,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setFromPoint(t){return this.x=t.x,this.y=t.y,this}swap(t){let e=this.x,r=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=r}clone(){return new tJ(this.x,this.y)}rotate(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tZ,r=tQ(t),i=tK(t),n=this.subtract(e);return new tJ(n.x*i-n.y*r,n.x*r+n.y*i).add(e)}transform(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new tJ(t[0]*this.x+t[2]*this.y+(e?0:t[4]),t[1]*this.x+t[3]*this.y+(e?0:t[5]))}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t,this.y=e)}}let tZ=new tJ(0,0),t$=t=>!!t&&Array.isArray(t._objects);function t0(t){class e extends t{_onObjectAdded(t){}_onObjectRemoved(t){}_onStackOrderChanged(t){}add(){for(var t=arguments.length,e=Array(t),r=0;rthis._onObjectAdded(t)),i}insertAt(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;ithis._onObjectAdded(t)),this._objects.length}remove(){let t=this._objects,e=[];for(var r=arguments.length,i=Array(r),n=0;n{let i=t.indexOf(r);-1!==i&&(t.splice(i,1),e.push(r),this._onObjectRemoved(r))}),e}forEachObject(t){this.getObjects().forEach((e,r,i)=>t(e,r,i))}getObjects(){for(var t=arguments.length,e=Array(t),r=0;rt.isType(...e))}item(t){return this._objects[t]}isEmpty(){return 0===this._objects.length}size(){return this._objects.length}contains(t,r){return!!this._objects.includes(t)||!!r&&this._objects.some(r=>r instanceof e&&r.contains(t,!0))}complexity(){return this._objects.reduce((t,e)=>t+=e.complexity?e.complexity():0,0)}sendObjectToBack(t){return!(!t||t===this._objects[0])&&(tq(this._objects,t),this._objects.unshift(t),this._onStackOrderChanged(t),!0)}bringObjectToFront(t){return!(!t||t===this._objects[this._objects.length-1])&&(tq(this._objects,t),this._objects.push(t),this._onStackOrderChanged(t),!0)}sendObjectBackwards(t,e){if(!t)return!1;let r=this._objects.indexOf(t);if(0!==r){let i=this.findNewLowerIndex(t,r,e);return tq(this._objects,t),this._objects.splice(i,0,t),this._onStackOrderChanged(t),!0}return!1}bringObjectForward(t,e){if(!t)return!1;let r=this._objects.indexOf(t);if(r!==this._objects.length-1){let i=this.findNewUpperIndex(t,r,e);return tq(this._objects,t),this._objects.splice(i,0,t),this._onStackOrderChanged(t),!0}return!1}moveObjectTo(t,e){return t!==this._objects[e]&&(tq(this._objects,t),this._objects.splice(e,0,t),this._onStackOrderChanged(t),!0)}findNewLowerIndex(t,e,r){let i;if(r){i=e;for(let r=e-1;r>=0;--r)if(t.isOverlapping(this._objects[r])){i=r;break}}else i=e-1;return i}findNewUpperIndex(t,e,r){let i;if(r){i=e;for(let r=e+1;r1&&void 0!==arguments[1]?arguments[1]:{},o=[],a=new tJ(e,r),l=a.add(new tJ(i,n));for(let t=this._objects.length-1;t>=0;t--){let e=this._objects[t];e.selectable&&e.visible&&(s&&e.intersectsWithRect(a,l)||e.isContainedWithinRect(a,l)||s&&e.containsPoint(a)||s&&e.containsPoint(l))&&o.push(e)}return o}constructor(){super(...arguments),Z(this,"_objects",[])}}return e}class t1 extends tG{_setOptions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(let e in t)this.set(e,t[e])}_setObject(t){for(let e in t)this._set(e,t[e])}set(t,e){return"object"==typeof t?this._setObject(t):this._set(t,e),this}_set(t,e){this[t]=e}toggle(t){let e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this}get(t){return this[t]}}function t2(t){return tf().requestAnimationFrame(t)}function t5(t){return tf().cancelAnimationFrame(t)}let t4=0,t3=()=>t4++,t9=()=>{let t=td().createElement("canvas");if(!t||void 0===t.getContext)throw new to("Failed to create `canvas` element");return t},t6=()=>td().createElement("img"),t8=t=>{let e=t9();return e.width=t.width,e.height=t.height,e},t7=(t,e,r)=>t.toDataURL("image/".concat(e),r),et=(t,e,r)=>new Promise((i,n)=>{t.toBlob(i,"image/".concat(e),r)}),ee=t=>t*tb,er=t=>t/tb,ei=t=>t.every((t,e)=>t===t_[e]),en=(t,e,r)=>new tJ(t).transform(e,r),es=t=>{let e=1/(t[0]*t[3]-t[1]*t[2]),r=[e*t[3],-e*t[1],-e*t[2],e*t[0],0,0],{x:i,y:n}=new tJ(t[4],t[5]).transform(r,!0);return r[4]=-i,r[5]=-n,r},eo=(t,e,r)=>[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],r?0:t[0]*e[4]+t[2]*e[5]+t[4],r?0:t[1]*e[4]+t[3]*e[5]+t[5]],ea=(t,e)=>t.reduceRight((t,r)=>r&&t?eo(r,t,e):r||t,void 0)||t_.concat(),el=t=>{let[e,r]=t;return Math.atan2(r,e)},eh=t=>{let e=el(t),r=Math.pow(t[0],2)+Math.pow(t[1],2),i=Math.sqrt(r),n=(t[0]*t[3]-t[2]*t[1])/i,s=Math.atan2(t[0]*t[2]+t[1]*t[3],r);return{angle:er(e),scaleX:i,scaleY:n,skewX:er(s),skewY:0,translateX:t[4]||0,translateY:t[5]||0}},ec=function(t){return[1,0,0,1,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0]};function eu(){let{angle:t=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{x:e=0,y:r=0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=ee(t),n=tK(i),s=tQ(i);return[n,s,-s,n,e?e-(n*e-s*r):0,r?r-(s*e+n*r):0]}let ed=function(t){return[t,0,0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,0,0]},ef=t=>Math.tan(ee(t)),eg=t=>[1,0,ef(t),1,0,0],ep=t=>[1,ef(t),0,1,0,0],em=t=>{let{scaleX:e=1,scaleY:r=1,flipX:i=!1,flipY:n=!1,skewX:s=0,skewY:o=0}=t,a=ed(i?-e:e,n?-r:r);return s&&(a=eo(a,eg(s),!0)),o&&(a=eo(a,ep(o),!0)),a},ev=t=>{let{translateX:e=0,translateY:r=0,angle:i=0}=t,n=ec(e,r);i&&(n=eo(n,eu({angle:i})));let s=em(t);return ei(s)||(n=eo(n,s)),n},ey=function(t){let{signal:e,crossOrigin:r=null}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(i,n){let s;if(e&&e.aborted)return n(new ta("loadImage"));let o=t6();e&&(s=function(t){o.src="",n(t)},e.addEventListener("abort",s,{once:!0}));let a=function(){o.onload=o.onerror=null,s&&(null==e||e.removeEventListener("abort",s)),i(o)};t?(o.onload=a,o.onerror=function(){s&&(null==e||e.removeEventListener("abort",s)),n(new to("Error loading ".concat(o.src)))},r&&(o.crossOrigin=r),o.src=t):a()})},ex=function(t){let{signal:e,reviver:r=tv}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((i,n)=>{let s=[];e&&e.addEventListener("abort",n,{once:!0}),Promise.all(t.map(t=>tY.getClass(t.type).fromObject(t,{signal:e}).then(e=>(r(t,e),s.push(e),e)))).then(i).catch(t=>{s.forEach(t=>{t.dispose&&t.dispose()}),n(t)}).finally(()=>{e&&e.removeEventListener("abort",n)})})},eb=function(t){let{signal:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((r,i)=>{let n=[];e&&e.addEventListener("abort",i,{once:!0});let s=Object.values(t).map(t=>t&&t.type&&tY.has(t.type)?ex([t],{signal:e}).then(t=>{let[e]=t;return n.push(e),e}):t),o=Object.keys(t);Promise.all(s).then(t=>t.reduce((t,e,r)=>(t[o[r]]=e,t),{})).then(r).catch(t=>{n.forEach(t=>{t.dispose&&t.dispose()}),i(t)}).finally(()=>{e&&e.removeEventListener("abort",i)})})},e_=function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).reduce((e,r)=>(r in t&&(e[r]=t[r]),e),{})},ew=(t,e)=>Object.keys(t).reduce((r,i)=>(e(t[i],i,t)&&(r[i]=t[i]),r),{}),eC=(t,e)=>parseFloat(Number(t).toFixed(e)),eS=t=>"matrix("+t.map(t=>eC(t,tn.NUM_FRACTION_DIGITS)).join(" ")+")",eT=t=>!!t&&void 0!==t.toLive,eO=t=>!!t&&"function"==typeof t.toObject,ek=t=>!!t&&void 0!==t.offsetX&&"source"in t,eM=t=>!!t&&"multiSelectionStacking"in t;function eE(t){let e=t&&eD(t),r=0,i=0;if(!t||!e)return{left:r,top:i};let n=t,s=e.documentElement,o=e.body||{scrollLeft:0,scrollTop:0};for(;n&&(n.parentNode||n.host)&&((n=n.parentNode||n.host)===e?(r=o.scrollLeft||s.scrollLeft||0,i=o.scrollTop||s.scrollTop||0):(r+=n.scrollLeft||0,i+=n.scrollTop||0),1!==n.nodeType||"fixed"!==n.style.position););return{left:r,top:i}}let eD=t=>t.ownerDocument||null,ej=t=>{var e;return(null==(e=t.ownerDocument)?void 0:e.defaultView)||null},eA=function(t,e,r){let{width:i,height:n}=r,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;t.width=i,t.height=n,s>1&&(t.setAttribute("width",(i*s).toString()),t.setAttribute("height",(n*s).toString()),e.scale(s,s))},eP=(t,e)=>{let{width:r,height:i}=e;r&&(t.style.width="number"==typeof r?"".concat(r,"px"):r),i&&(t.style.height="number"==typeof i?"".concat(i,"px"):i)};function eF(t){return void 0!==t.onselectstart&&(t.onselectstart=()=>!1),t.style.userSelect=tO,t}class eL{createLowerCanvas(t){let e=t&&void 0!==t.getContext?t:t&&td().getElementById(t)||t9();if(e.hasAttribute("data-fabric"))throw new to("Trying to initialize a canvas that has already been initialized. Did you forget to dispose the canvas?");return this._originalCanvasStyle=e.style.cssText,e.setAttribute("data-fabric","main"),e.classList.add("lower-canvas"),e}cleanupDOM(t){let{width:e,height:r}=t,{el:i}=this.lower;i.classList.remove("lower-canvas"),i.removeAttribute("data-fabric"),i.setAttribute("width","".concat(e)),i.setAttribute("height","".concat(r)),i.style.cssText=this._originalCanvasStyle||"",this._originalCanvasStyle=void 0}setDimensions(t,e){let{el:r,ctx:i}=this.lower;eA(r,i,t,e)}setCSSDimensions(t){eP(this.lower.el,t)}calcOffset(){return function(t){var e;let r=t&&eD(t),i={left:0,top:0};if(!r)return i;let n=(null==(e=ej(t))?void 0:e.getComputedStyle(t,null))||{};i.left+=parseInt(n.borderLeftWidth,10)||0,i.top+=parseInt(n.borderTopWidth,10)||0,i.left+=parseInt(n.paddingLeft,10)||0,i.top+=parseInt(n.paddingTop,10)||0;let s={left:0,top:0},o=r.documentElement;void 0!==t.getBoundingClientRect&&(s=t.getBoundingClientRect());let a=eE(t);return{left:s.left+a.left-(o.clientLeft||0)+i.left,top:s.top+a.top-(o.clientTop||0)+i.top}}(this.lower.el)}dispose(){tu().dispose(this.lower.el),delete this.lower}constructor(t){Z(this,"_originalCanvasStyle",void 0),Z(this,"lower",void 0);let e=this.createLowerCanvas(t);this.lower={el:e,ctx:e.getContext("2d")}}}let eR={backgroundVpt:!0,backgroundColor:"",overlayVpt:!0,overlayColor:"",includeDefaultValues:!0,svgViewportTransformation:!0,renderOnAddRemove:!0,skipOffscreen:!0,enableRetinaScaling:!0,imageSmoothingEnabled:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,viewportTransform:[...t_]};class eI extends t0(t1){get lowerCanvasEl(){var t;return null==(t=this.elements.lower)?void 0:t.el}get contextContainer(){var t;return null==(t=this.elements.lower)?void 0:t.ctx}static getDefaults(){return eI.ownDefaults}initElements(t){this.elements=new eL(t)}add(){let t=super.add(...arguments);return arguments.length>0&&this.renderOnAddRemove&&this.requestRenderAll(),t}insertAt(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i0&&this.renderOnAddRemove&&this.requestRenderAll(),n}remove(){let t=super.remove(...arguments);return t.length>0&&this.renderOnAddRemove&&this.requestRenderAll(),t}_onObjectAdded(t){t.canvas&&t.canvas!==this&&(ts("warn","Canvas is trying to add an object that belongs to a different canvas.\nResulting to default behavior: removing object from previous canvas and adding to new canvas"),t.canvas.remove(t)),t._set("canvas",this),t.setCoords(),this.fire("object:added",{target:t}),t.fire("added",{target:this})}_onObjectRemoved(t){t._set("canvas",void 0),this.fire("object:removed",{target:t}),t.fire("removed",{target:this})}_onStackOrderChanged(){this.renderOnAddRemove&&this.requestRenderAll()}getRetinaScaling(){return this.enableRetinaScaling?tg():1}calcOffset(){return this._offset=this.elements.calcOffset()}getWidth(){return this.width}getHeight(){return this.height}setWidth(t,e){return this.setDimensions({width:t},e)}setHeight(t,e){return this.setDimensions({height:t},e)}_setDimensionsImpl(t){let{cssOnly:e=!1,backstoreOnly:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e){let e=tt({width:this.width,height:this.height},t);this.elements.setDimensions(e,this.getRetinaScaling()),this.hasLostContext=!0,this.width=e.width,this.height=e.height}r||this.elements.setCSSDimensions(t),this.calcOffset()}setDimensions(t,e){this._setDimensionsImpl(t,e),e&&e.cssOnly||this.requestRenderAll()}getZoom(){return this.viewportTransform[0]}setViewportTransform(t){this.viewportTransform=t,this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll()}zoomToPoint(t,e){let r=[...this.viewportTransform],i=en(t,es(r));r[0]=e,r[3]=e;let n=en(i,r);r[4]+=t.x-n.x,r[5]+=t.y-n.y,this.setViewportTransform(r)}setZoom(t){this.zoomToPoint(new tJ(0,0),t)}absolutePan(t){let e=[...this.viewportTransform];return e[4]=-t.x,e[5]=-t.y,this.setViewportTransform(e)}relativePan(t){return this.absolutePan(new tJ(-t.x-this.viewportTransform[4],-t.y-this.viewportTransform[5]))}getElement(){return this.elements.lower.el}clearContext(t){t.clearRect(0,0,this.width,this.height)}getContext(){return this.elements.lower.ctx}clear(){this.remove(...this.getObjects()),this.backgroundImage=void 0,this.overlayImage=void 0,this.backgroundColor="",this.overlayColor="",this.clearContext(this.getContext()),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll()}renderAll(){this.cancelRequestedRender(),this.destroyed||this.renderCanvas(this.getContext(),this._objects)}renderAndReset(){this.nextRenderHandle=0,this.renderAll()}requestRenderAll(){this.nextRenderHandle||this.disposed||this.destroyed||(this.nextRenderHandle=t2(()=>this.renderAndReset()))}calcViewportBoundaries(){let t=this.width,e=this.height,r=es(this.viewportTransform),i=en({x:0,y:0},r),n=en({x:t,y:e},r),s=i.min(n),o=i.max(n);return this.vptCoords={tl:s,tr:new tJ(o.x,s.y),bl:new tJ(s.x,o.y),br:o}}cancelRequestedRender(){this.nextRenderHandle&&(t5(this.nextRenderHandle),this.nextRenderHandle=0)}drawControls(t){}renderCanvas(t,e){if(this.destroyed)return;let r=this.viewportTransform,i=this.clipPath;this.calcViewportBoundaries(),this.clearContext(t),t.imageSmoothingEnabled=this.imageSmoothingEnabled,t.patternQuality="best",this.fire("before:render",{ctx:t}),this._renderBackground(t),t.save(),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this._renderObjects(t,e),t.restore(),this.controlsAboveOverlay||this.skipControlsDrawing||this.drawControls(t),i&&(i._set("canvas",this),i.shouldCache(),i._transformDone=!0,i.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(t,i)),this._renderOverlay(t),this.controlsAboveOverlay&&!this.skipControlsDrawing&&this.drawControls(t),this.fire("after:render",{ctx:t}),this.__cleanupTask&&(this.__cleanupTask(),this.__cleanupTask=void 0)}drawClipPathOnCanvas(t,e){let r=this.viewportTransform;t.save(),t.transform(...r),t.globalCompositeOperation="destination-in",e.transform(t),t.scale(1/e.zoomX,1/e.zoomY),t.drawImage(e._cacheCanvas,-e.cacheTranslationX,-e.cacheTranslationY),t.restore()}_renderObjects(t,e){for(let r=0,i=e.length;r!t.excludeFromExport).map(r=>this._toObject(r,t,e))},this.__serializeBgOverlay(t,e)),i?{clipPath:i}:null)}_toObject(t,e,r){let i;this.includeDefaultValues||(i=t.includeDefaultValues,t.includeDefaultValues=!1);let n=t[e](r);return this.includeDefaultValues||(t.includeDefaultValues=!!i),n}__serializeBgOverlay(t,e){let r={},i=this.backgroundImage,n=this.overlayImage,s=this.backgroundColor,o=this.overlayColor;return eT(s)?s.excludeFromExport||(r.background=s.toObject(e)):s&&(r.background=s),eT(o)?o.excludeFromExport||(r.overlay=o.toObject(e)):o&&(r.overlay=o),i&&!i.excludeFromExport&&(r.backgroundImage=this._toObject(i,t,e)),n&&!n.excludeFromExport&&(r.overlayImage=this._toObject(n,t,e)),r}toSVG(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;t.reviver=e;let r=[];return this._setSVGPreamble(r,t),this._setSVGHeader(r,t),this.clipPath&&r.push('\n')),this._setSVGBgOverlayColor(r,"background"),this._setSVGBgOverlayImage(r,"backgroundImage",e),this._setSVGObjects(r,e),this.clipPath&&r.push("\n"),this._setSVGBgOverlayColor(r,"overlay"),this._setSVGBgOverlayImage(r,"overlayImage",e),r.push(""),r.join("")}_setSVGPreamble(t,e){e.suppressPreamble||t.push('\n','\n')}_setSVGHeader(t,e){let r,i=e.width||"".concat(this.width),n=e.height||"".concat(this.height),s=tn.NUM_FRACTION_DIGITS,o=e.viewBox;if(o)r='viewBox="'.concat(o.x," ").concat(o.y," ").concat(o.width," ").concat(o.height,'" ');else if(this.svgViewportTransformation){let t=this.viewportTransform;r='viewBox="'.concat(eC(-t[4]/t[0],s)," ").concat(eC(-t[5]/t[3],s)," ").concat(eC(this.width/t[0],s)," ").concat(eC(this.height/t[3],s),'" ')}else r='viewBox="0 0 '.concat(this.width," ").concat(this.height,'" ');t.push("\n',"Created with Fabric.js ",tm,"\n","\n",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(e),"\n")}createSVGClipPathMarkup(t){let e=this.clipPath;return e?(e.clipPathId="CLIPPATH_".concat(t3()),'\n').concat(e.toClipPathSVG(t.reviver),"\n")):""}createSVGRefElementsMarkup(){return["background","overlay"].map(t=>{let e=this["".concat(t,"Color")];if(eT(e)){let r=this["".concat(t,"Vpt")],i=this.viewportTransform,n={isType:()=>!1,width:this.width/(r?i[0]:1),height:this.height/(r?i[3]:1)};return e.toSVG(n,{additionalTransform:r?eS(i):""})}}).join("")}createSVGFontFacesMarkup(){let t=[],e={},r=tn.fontPaths;this._objects.forEach(function e(r){t.push(r),t$(r)&&r._objects.forEach(e)}),t.forEach(t=>{if(!t||"function"!=typeof t._renderText)return;let{styles:i,fontFamily:n}=t;!e[n]&&r[n]&&(e[n]=!0,i&&Object.values(i).forEach(t=>{Object.values(t).forEach(t=>{let{fontFamily:i=""}=t;!e[i]&&r[i]&&(e[i]=!0)})}))});let i=Object.keys(e).map(t=>" @font-face {\n font-family: '".concat(t,"';\n src: url('").concat(r[t],"');\n }\n")).join("");return i?' \n"):""}_setSVGObjects(t,e){this.forEachObject(r=>{r.excludeFromExport||this._setSVGObject(t,r,e)})}_setSVGObject(t,e,r){t.push(e.toSVG(r))}_setSVGBgOverlayImage(t,e,r){let i=this[e];i&&!i.excludeFromExport&&i.toSVG&&t.push(i.toSVG(r))}_setSVGBgOverlayColor(t,e){let r=this["".concat(e,"Color")];if(r)if(eT(r)){let i=r.repeat||"",n=this.width,s=this.height,o=this["".concat(e,"Vpt")]?eS(es(this.viewportTransform)):"";t.push('\n'))}else t.push('\n")}loadFromJSON(t,e){let{signal:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return Promise.reject(new to("`json` is undefined"));let i="string"==typeof t?JSON.parse(t):t,{objects:n=[],backgroundImage:s,background:o,overlayImage:a,overlay:l,clipPath:h}=i,c=this.renderOnAddRemove;return this.renderOnAddRemove=!1,Promise.all([ex(n,{reviver:e,signal:r}),eb({backgroundImage:s,backgroundColor:o,overlayImage:a,overlayColor:l,clipPath:h},{signal:r})]).then(t=>{let[e,r]=t;return this.clear(),this.add(...e),this.set(i),this.set(r),this.renderOnAddRemove=c,this})}clone(t){let e=this.toObject(t);return this.cloneWithoutData().loadFromJSON(e)}cloneWithoutData(){let t=t8(this);return new this.constructor(t)}toDataURL(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{format:e="png",quality:r=1,multiplier:i=1,enableRetinaScaling:n=!1}=t,s=i*(n?this.getRetinaScaling():1);return t7(this.toCanvasElement(s,t),e,r)}toBlob(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{format:e="png",quality:r=1,multiplier:i=1,enableRetinaScaling:n=!1}=t,s=i*(n?this.getRetinaScaling():1);return et(this.toCanvasElement(s,t),e,r)}toCanvasElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,{width:e,height:r,left:i,top:n,filter:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=(e||this.width)*t,a=(r||this.height)*t,l=this.getZoom(),h=this.width,c=this.height,u=this.skipControlsDrawing,d=l*t,f=this.viewportTransform,g=[d,0,0,d,(f[4]-(i||0))*t,(f[5]-(n||0))*t],p=this.enableRetinaScaling,m=t8({width:o,height:a}),y=s?this._objects.filter(t=>s(t)):this._objects;return this.enableRetinaScaling=!1,this.viewportTransform=g,this.width=o,this.height=a,this.skipControlsDrawing=!0,this.calcViewportBoundaries(),this.renderCanvas(m.getContext("2d"),y),this.viewportTransform=f,this.width=h,this.height=c,this.calcViewportBoundaries(),this.enableRetinaScaling=p,this.skipControlsDrawing=u,m}dispose(){return this.disposed||this.elements.cleanupDOM({width:this.width,height:this.height}),tz.cancelByCanvas(this),this.disposed=!0,new Promise((t,e)=>{let r=()=>{this.destroy(),t(!0)};r.kill=e,this.__cleanupTask&&this.__cleanupTask.kill("aborted"),this.destroyed?t(!1):this.nextRenderHandle?this.__cleanupTask=r:r()})}destroy(){this.destroyed=!0,this.cancelRequestedRender(),this.forEachObject(t=>t.dispose()),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose(),this.backgroundImage=void 0,this.overlayImage&&this.overlayImage.dispose(),this.overlayImage=void 0,this.elements.dispose()}toString(){return"#")}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),Object.assign(this,this.constructor.getDefaults()),this.set(e),this.initElements(t),this._setDimensionsImpl({width:this.width||this.elements.lower.el.width||0,height:this.height||this.elements.lower.el.height||0}),this.skipControlsDrawing=!1,this.viewportTransform=[...this.viewportTransform],this.calcViewportBoundaries()}}Z(eI,"ownDefaults",eR);let eB=["touchstart","touchmove","touchend"],eN=t=>{let e=eE(t.target),r=function(t){let e=t.changedTouches;return e&&e[0]?e[0]:t}(t);return new tJ(r.clientX+e.left,r.clientY+e.top)},eW=t=>eB.includes(t.type)||"touch"===t.pointerType,eU=t=>{t.preventDefault(),t.stopPropagation()},eH=t=>{let e=0,r=0,i=0,n=0;for(let s=0,o=t.length;si||!s)&&(i=o),(on||!s)&&(n=a),(aeY(t,eo(e,t.calcOwnMatrix())),eY=(t,e)=>{let r=eh(e),{translateX:i,translateY:n,scaleX:s,scaleY:o}=r,a=te(r,eX),l=new tJ(i,n);t.flipX=!1,t.flipY=!1,Object.assign(t,a),t.set({scaleX:s,scaleY:o}),t.setPositionByOrigin(l,tw,tw)},ez=t=>{t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},eG=t=>({scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}),eq=(t,e,r)=>{let i=t/2,n=e/2,s=eH([new tJ(-i,-n),new tJ(i,-n),new tJ(-i,n),new tJ(i,n)].map(t=>t.transform(r)));return new tJ(s.width,s.height)},eK=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t_;return eo(es(arguments.length>1&&void 0!==arguments[1]?arguments[1]:t_),t)},eQ=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t_,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t_;return t.transform(eK(e,r))},eJ=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t_,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t_;return t.transform(eK(e,r),!0)},eZ=(t,e,r)=>{let i=eK(e,r);return eY(t,eo(i,t.calcOwnMatrix())),i},e$=(t,e)=>{var r;let{transform:{target:i}}=e;null==(r=i.canvas)||r.fire("object:".concat(t),tt(tt({},e),{},{target:i})),i.fire(t,e)},e0={left:-.5,top:-.5,center:0,bottom:.5,right:.5},e1=t=>"string"==typeof t?e0[t]:t-.5,e2="not-allowed";function e5(t){return e1(t.originX)===e1(tw)&&e1(t.originY)===e1(tw)}let e4=(t,e)=>t[e],e3=(t,e,r,i)=>({e:t,transform:e,pointer:new tJ(r,i)});function e9(t,e){return Math.round((t.getTotalAngle()+er(Math.atan2(e.y,e.x))+360)%360/45)}function e6(t,e,r,i,n){var s;let{target:o,corner:a}=t,l=o.controls[a],h=(null==(s=o.canvas)?void 0:s.getZoom())||1,c=o.padding/h,u=function(t,e,r,i){let n=t.getRelativeCenterPoint(),s=void 0!==r&&void 0!==i?t.translateToGivenOrigin(n,tw,tw,r,i):new tJ(t.left,t.top);return(t.angle?e.rotate(-ee(t.angle),n):e).subtract(s)}(o,new tJ(i,n),e,r);return u.x>=c&&(u.x-=c),u.x<=-c&&(u.x+=c),u.y>=c&&(u.y-=c),u.y<=c&&(u.y+=c),u.x-=l.offsetX,u.y-=l.offsetY,u}let e8=(t,e,r,i)=>{let{target:n,offsetX:s,offsetY:o}=e,a=r-s,l=i-o,h=!e4(n,"lockMovementX")&&n.left!==a,c=!e4(n,"lockMovementY")&&n.top!==l;return h&&n.set(tC,a),c&&n.set("top",l),(h||c)&&e$(tM,e3(t,e,r,i)),h||c},e7={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#789",lightslategrey:"#789",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#639",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32"},rt=(t,e,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t),re=(t,e,r,i)=>{let n,s;t/=255;let o=Math.max(t,e/=255,r/=255),a=Math.min(t,e,r),l=(o+a)/2;if(o===a)n=s=0;else{let i=o-a;switch(s=l>.5?i/(2-o-a):i/(o+a),o){case t:n=(e-r)/i+6*(e0&&void 0!==arguments[0]?arguments[0]:"1";return parseFloat(t)/(t.endsWith("%")?100:1)},ri=t=>Math.min(Math.round(t),255).toString(16).toUpperCase().padStart(2,"0"),rn=t=>{let[e,r,i,n=1]=t,s=Math.round(.3*e+.59*r+.11*i);return[s,s,s,n]};class rs{_tryParsingColor(t){return(t=t.toLowerCase())in e7&&(t=e7[t]),"transparent"===t?[255,255,255,0]:rs.sourceFromHex(t)||rs.sourceFromRgb(t)||rs.sourceFromHsl(t)||(this.isUnrecognised=!0,[0,0,0,1])}getSource(){return this._source}setSource(t){this._source=t}toRgb(){let[t,e,r]=this.getSource();return"rgb(".concat(t,",").concat(e,",").concat(r,")")}toRgba(){return"rgba(".concat(this.getSource().join(","),")")}toHsl(){let[t,e,r]=re(...this.getSource());return"hsl(".concat(t,",").concat(e,"%,").concat(r,"%)")}toHsla(){let[t,e,r,i]=re(...this.getSource());return"hsla(".concat(t,",").concat(e,"%,").concat(r,"%,").concat(i,")")}toHex(){return this.toHexa().slice(0,6)}toHexa(){let[t,e,r,i]=this.getSource();return"".concat(ri(t)).concat(ri(e)).concat(ri(r)).concat(ri(Math.round(255*i)))}getAlpha(){return this.getSource()[3]}setAlpha(t){return this._source[3]=t,this}toGrayscale(){return this.setSource(rn(this.getSource())),this}toBlackWhite(t){let[e,,,r]=rn(this.getSource()),i=e<(t||127)?0:255;return this.setSource([i,i,i,r]),this}overlayWith(t){t instanceof rs||(t=new rs(t));let e=this.getSource(),r=t.getSource(),[i,n,s]=e.map((t,e)=>Math.round(.5*t+.5*r[e]));return this.setSource([i,n,s,e[3]]),this}static fromRgb(t){return rs.fromRgba(t)}static fromRgba(t){return new rs(rs.sourceFromRgb(t))}static sourceFromRgb(t){let e=t.match(/^rgba?\(\s*(\d{0,3}(?:\.\d+)?%?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*(?:\s*[,/]\s*(\d{0,3}(?:\.\d+)?%?)\s*)?\)$/i);if(e){let[t,r,i]=e.slice(1,4).map(t=>{let e=parseFloat(t);return t.endsWith("%")?Math.round(2.55*e):e});return[t,r,i,rr(e[4])]}}static fromHsl(t){return rs.fromHsla(t)}static fromHsla(t){return new rs(rs.sourceFromHsl(t))}static sourceFromHsl(t){let e,r,i,n=t.match(/^hsla?\(\s*([+-]?\d{0,3}(?:\.\d+)?(?:deg|turn|rad)?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*(?:\s*[,/]\s*(\d*(?:\.\d+)?%?)\s*)?\)$/i);if(!n)return;let s=(rs.parseAngletoDegrees(n[1])%360+360)%360/360,o=parseFloat(n[2])/100,a=parseFloat(n[3])/100;if(0===o)e=r=i=a;else{let t=a<=.5?a*(o+1):a+o-a*o,n=2*a-t;e=rt(n,t,s+1/3),r=rt(n,t,s),i=rt(n,t,s-1/3)}return[Math.round(255*e),Math.round(255*r),Math.round(255*i),rr(n[4])]}static fromHex(t){return new rs(rs.sourceFromHex(t))}static sourceFromHex(t){if(t.match(/^#?(([0-9a-f]){3,4}|([0-9a-f]{2}){3,4})$/i)){let e=t.slice(t.indexOf("#")+1),[r,i,n,s=255]=(e.length<=4?e.split("").map(t=>t+t):e.match(/.{2}/g)).map(t=>parseInt(t,16));return[r,i,n,s/255]}}static parseAngletoDegrees(t){let e=t.toLowerCase(),r=parseFloat(e);return e.includes("rad")?er(r):e.includes("turn")?360*r:r}constructor(t){if(Z(this,"isUnrecognised",!1),t)if(t instanceof rs)this.setSource([...t._source]);else if(Array.isArray(t)){let[e,r,i,n=1]=t;this.setSource([e,r,i,n])}else this.setSource(this._tryParsingColor(t));else this.setSource([0,0,0,1])}}let ro=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,r=/\D{0,2}$/.exec(t),i=parseFloat(t),n=tn.DPI;switch(null==r?void 0:r[0]){case"mm":return i*n/25.4;case"cm":return i*n/2.54;case"in":return i*n;case"pt":return i*n/72;case"pc":return i*n/72*12;case"em":return i*e;default:return i}},ra=t=>{let[e,r]=t.trim().split(" "),[i,n]=e&&e!==tO?[e.slice(1,4),e.slice(5,8)]:e===tO?[e,e]:["Mid","Mid"];return{meetOrSlice:r||"meet",alignX:i,alignY:n}},rl=function(t,e){let r,i,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e)if(e.toLive)r="url(#SVGID_".concat(e.id,")");else{let t=new rs(e),n=t.getAlpha();r=t.toRgb(),1!==n&&(i=n.toString())}else r="none";return n?"".concat(t,": ").concat(r,"; ").concat(i?"".concat(t,"-opacity: ").concat(i,"; "):""):"".concat(t,'="').concat(r,'" ').concat(i?"".concat(t,'-opacity="').concat(i,'" '):"")};class rh{getSvgStyles(t){let e=this.fillRule?this.fillRule:"nonzero",r=this.strokeWidth?this.strokeWidth:"0",i=this.strokeDashArray?this.strokeDashArray.join(" "):tO,n=this.strokeDashOffset?this.strokeDashOffset:"0",s=this.strokeLineCap?this.strokeLineCap:"butt",o=this.strokeLineJoin?this.strokeLineJoin:"miter",a=this.strokeMiterLimit?this.strokeMiterLimit:"4",l=void 0!==this.opacity?this.opacity:"1",h=this.visible?"":" visibility: hidden;",c=t?"":this.getSvgFilter(),u=rl(tU,this.fill);return rl(tH,this.stroke)+"stroke-width: "+r+"; stroke-dasharray: "+i+"; stroke-linecap: "+s+"; stroke-dashoffset: "+n+"; stroke-linejoin: "+o+"; stroke-miterlimit: "+a+"; "+u+"fill-rule: "+e+"; opacity: "+l+";"+c+h}getSvgFilter(){return this.shadow?"filter: url(#SVGID_".concat(this.shadow.id,");"):""}getSvgCommons(){return[this.id?'id="'.concat(this.id,'" '):"",this.clipPath?'clip-path="url(#'.concat(this.clipPath.clipPathId,')" '):""].join("")}getSvgTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=t?this.calcTransformMatrix():this.calcOwnMatrix(),i='transform="'.concat(eS(r));return"".concat(i).concat(e,'" ')}_toSVG(t){return[""]}toSVG(t){return this._createBaseSVGMarkup(this._toSVG(t),{reviver:t})}toClipPathSVG(t){return" "+this._createBaseClipPathSVGMarkup(this._toSVG(t),{reviver:t})}_createBaseClipPathSVGMarkup(t){let{reviver:e,additionalTransform:r=""}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[this.getSvgTransform(!0,r),this.getSvgCommons()].join(""),n=t.indexOf("COMMON_PARTS");return t[n]=i,e?e(t.join("")):t.join("")}_createBaseSVGMarkup(t){let e,{noStyle:r,reviver:i,withShadow:n,additionalTransform:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r?"":'style="'.concat(this.getSvgStyles(),'" '),a=n?'style="'.concat(this.getSvgFilter(),'" '):"",l=this.clipPath,h=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",c=l&&l.absolutePositioned,u=this.stroke,d=this.fill,f=this.shadow,g=[],p=t.indexOf("COMMON_PARTS");l&&(l.clipPathId="CLIPPATH_".concat(t3()),e='\n').concat(l.toClipPathSVG(i),"\n")),c&&g.push("\n"),g.push("\n");let m=""+o+h+(r?"":this.addPaintOrder())+" "+(s?'transform="'.concat(s,'" '):"");return t[p]=m,eT(d)&&g.push(d.toSVG(this)),eT(u)&&g.push(u.toSVG(this)),f&&g.push(f.toSVG(this)),l&&g.push(e),g.push(t.join("")),g.push("\n"),c&&g.push("\n"),i?i(g.join("")):g.join("")}addPaintOrder(){return this.paintFirst!==tU?' paint-order="'.concat(this.paintFirst,'" '):""}}function rc(t){return RegExp("^("+t.join("|")+")\\b","i")}let ru="textDecorationThickness",rd=["fontSize","fontWeight","fontFamily","fontStyle"],rf=["underline","overline","linethrough"],rg=[...rd,"lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide","pathAlign"],rp=[...rg,...rf,"textBackgroundColor","direction",ru],rm=[...rd,...rf,tH,"strokeWidth",tU,"deltaY","textBackgroundColor",ru],rv="justify",ry="justify-left",rx="justify-right",rb="justify-center",r_=String.raw(s||(s=tr(["[-+]?(?:d*.d+|d+.?)(?:[eE][-+]?d+)?"],["[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?"]))),rw=String.raw(o||(o=tr(["(?:s*,?s+|s*,s*)"],["(?:\\s*,?\\s+|\\s*,\\s*)"]))),rC=RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+r_+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+r_+"))?\\s+(.*)"),rS={cx:tC,x:tC,r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing","text-decoration-thickness":ru},rT="font-size",rO="clip-path",rk=(rc(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),rc(["symbol","image","marker","pattern","view","svg"]),rc(["symbol","g","a","svg","clipPath","defs"])),rM=(new RegExp(String.raw(a||(a=tr(["^s*(",")","(",")","(",")","(",")s*$"],["^\\s*(",")","(",")","(",")","(",")\\s*$"])),r_,rw,r_,rw,r_,rw,r_)),new tJ(1,0)),rE=new tJ,rD=(t,e)=>t.rotate(e),rj=(t,e)=>new tJ(e).subtract(t),rA=t=>t.distanceFrom(rE),rP=(t,e)=>Math.atan2(rI(t,e),rB(t,e)),rF=t=>rP(rM,t),rL=t=>t.eq(rE)?t:t.scalarDivide(rA(t)),rR=function(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return rL(new tJ(-t.y,t.x).scalarMultiply(e?1:-1))},rI=(t,e)=>t.x*e.y-t.y*e.x,rB=(t,e)=>t.x*e.x+t.y*e.y,rN=(t,e,r)=>{if(t.eq(e)||t.eq(r))return!0;let i=rI(e,r),n=rI(e,t),s=rI(r,t);return i>=0?n>=0&&s<=0:!(n<=0&&s>=0)},rW="(-?\\d+(?:\\.\\d*)?(?:px)?(?:\\s?|$))?",rU=RegExp("(?:\\s|^)"+rW+rW+"("+r_+"?(?:px)?)?(?:\\s?|$)(?:$|\\s)");class rH{static parseShadow(t){let e=t.trim(),[,r=0,i=0,n=0]=(rU.exec(e)||[]).map(t=>parseFloat(t)||0);return{color:(e.replace(rU,"")||"rgb(0,0,0)").trim(),offsetX:r,offsetY:i,blur:n}}toString(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")}toSVG(t){let e=rD(new tJ(this.offsetX,this.offsetY),ee(-t.angle)),r=new rs(this.color),i=40,n=40;return t.width&&t.height&&(i=100*eC((Math.abs(e.x)+this.blur)/t.width,tn.NUM_FRACTION_DIGITS)+20,n=100*eC((Math.abs(e.y)+this.blur)/t.height,tn.NUM_FRACTION_DIGITS)+20),t.flipX&&(e.x*=-1),t.flipY&&(e.y*=-1),'\n \n \n \n \n \n \n \n \n\n')}toObject(){let t={color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling,type:this.constructor.type},e=rH.ownDefaults;return this.includeDefaultValues?t:ew(t,(t,r)=>t!==e[r])}static async fromObject(t){return new this(t)}constructor(t){let e="string"==typeof t?rH.parseShadow(t):t;Object.assign(this,rH.ownDefaults,e),this.id=t3()}}Z(rH,"ownDefaults",{color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1}),Z(rH,"type","shadow"),tY.setClass(rH,"shadow");let rX=(t,e,r)=>Math.max(t,Math.min(e,r)),rV=["top",tC,tI,tB,"flipX","flipY","originX","originY","angle","opacity","globalCompositeOperation","shadow","visible",tN,tW],rY=[tU,tH,"strokeWidth","strokeDashArray","width","height","paintFirst","strokeUniform","strokeLineCap","strokeDashOffset","strokeLineJoin","strokeMiterLimit","backgroundColor","clipPath"],rz=(t,e,r,i)=>(tt*Math.pow(2,10*(i-=1))*Math.sin((i*n-e)*tx/r),rq=(t,e,r,i)=>-r*Math.cos(t/i*ty)+r+e,rK=(t,e,r,i)=>(t/=i)<1/2.75?7.5625*t*t*r+e:t<2/2.75?r*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?r*(7.5625*(t-=2.25/2.75)*t+.9375)+e:r*(7.5625*(t-=2.625/2.75)*t+.984375)+e,rQ=(t,e,r,i)=>r-rK(i-t,0,r,i)+e;var rJ=Object.freeze({__proto__:null,defaultEasing:rq,easeInBack:function(t,e,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1.70158;return r*(t/=i)*t*((n+1)*t-n)+e},easeInBounce:rQ,easeInCirc:(t,e,r,i)=>-r*(Math.sqrt(1-(t/=i)*t)-1)+e,easeInCubic:(t,e,r,i)=>r*(t/i)**3+e,easeInElastic:(t,e,r,i)=>{let n=0;if(0===t)return e;if(1==(t/=i))return e+r;n||(n=.3*i);let{a:s,s:o,p:a}=rz(r,r,n,1.70158);return-rG(s,o,a,t,i)+e},easeInExpo:(t,e,r,i)=>0===t?e:r*2**(10*(t/i-1))+e,easeInOutBack:function(t,e,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1.70158;return(t/=i/2)<1?r/2*(t*t*((1+(n*=1.525))*t-n))+e:r/2*((t-=2)*t*((1+(n*=1.525))*t+n)+2)+e},easeInOutBounce:(t,e,r,i)=>t(t/=i/2)<1?-r/2*(Math.sqrt(1-t**2)-1)+e:r/2*(Math.sqrt(1-(t-=2)*t)+1)+e,easeInOutCubic:(t,e,r,i)=>(t/=i/2)<1?r/2*t**3+e:r/2*((t-2)**3+2)+e,easeInOutElastic:(t,e,r,i)=>{let n=0;if(0===t)return e;if(2==(t/=i/2))return e+r;n||(n=.3*1.5*i);let{a:s,s:o,p:a,c:l}=rz(r,r,n,1.70158);return t<1?-.5*rG(s,o,a,t,i)+e:s*Math.pow(2,-10*(t-=1))*Math.sin((t*i-o)*tx/a)*.5+l+e},easeInOutExpo:(t,e,r,i)=>0===t?e:t===i?e+r:(t/=i/2)<1?r/2*2**(10*(t-1))+e:-(r/2*(2**(-10*--t)+2))+e,easeInOutQuad:(t,e,r,i)=>(t/=i/2)<1?r/2*t**2+e:-r/2*(--t*(t-2)-1)+e,easeInOutQuart:(t,e,r,i)=>(t/=i/2)<1?r/2*t**4+e:-r/2*((t-=2)*t**3-2)+e,easeInOutQuint:(t,e,r,i)=>(t/=i/2)<1?r/2*t**5+e:r/2*((t-2)**5+2)+e,easeInOutSine:(t,e,r,i)=>-r/2*(Math.cos(Math.PI*t/i)-1)+e,easeInQuad:(t,e,r,i)=>r*(t/=i)*t+e,easeInQuart:(t,e,r,i)=>r*(t/=i)*t**3+e,easeInQuint:(t,e,r,i)=>r*(t/i)**5+e,easeInSine:(t,e,r,i)=>-r*Math.cos(t/i*ty)+r+e,easeOutBack:function(t,e,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1.70158;return r*((t=t/i-1)*t*((n+1)*t+n)+1)+e},easeOutBounce:rK,easeOutCirc:(t,e,r,i)=>r*Math.sqrt(1-(t=t/i-1)*t)+e,easeOutCubic:(t,e,r,i)=>r*((t/i-1)**3+1)+e,easeOutElastic:(t,e,r,i)=>{let n=0;if(0===t)return e;if(1==(t/=i))return e+r;n||(n=.3*i);let{a:s,s:o,p:a,c:l}=rz(r,r,n,1.70158);return s*2**(-10*t)*Math.sin((t*i-o)*tx/a)+l+e},easeOutExpo:(t,e,r,i)=>t===i?e+r:-(r*(2**(-10*t/i)+1))+e,easeOutQuad:(t,e,r,i)=>-r*(t/=i)*(t-2)+e,easeOutQuart:(t,e,r,i)=>-r*((t=t/i-1)*t**3-1)+e,easeOutQuint:(t,e,r,i)=>r*((t/i-1)**5+1)+e,easeOutSine:(t,e,r,i)=>r*Math.sin(t/i*ty)+e});let rZ=()=>!1;class r${get state(){return this._state}isDone(){return"aborted"===this._state||"completed"===this._state}start(){let t=t=>{"pending"===this._state&&(this.startTime=t||+new Date,this._state="running",this._onStart(),this.tick(this.startTime))};this.register(),this.delay>0?setTimeout(()=>t2(t),this.delay):t2(t)}tick(t){let e=(t||+new Date)-this.startTime,r=Math.min(e,this.duration);this.durationProgress=r/this.duration;let{value:i,valueProgress:n}=this.calculate(r);this.value=Object.freeze(i),this.valueProgress=n,"aborted"!==this._state&&(this._abort(this.value,this.valueProgress,this.durationProgress)?(this._state="aborted",this.unregister()):e>=this.duration?(this.durationProgress=this.valueProgress=1,this._onChange(this.endValue,this.valueProgress,this.durationProgress),this._state="completed",this._onComplete(this.endValue,this.valueProgress,this.durationProgress),this.unregister()):(this._onChange(this.value,this.valueProgress,this.durationProgress),t2(this.tick)))}register(){tz.push(this)}unregister(){tz.remove(this)}abort(){this._state="aborted",this.unregister()}constructor(t){let{startValue:e,byValue:r,duration:i=500,delay:n=0,easing:s=rq,onStart:o=tv,onChange:a=tv,onComplete:l=tv,abort:h=rZ,target:c}=t;Z(this,"_state","pending"),Z(this,"durationProgress",0),Z(this,"valueProgress",0),this.tick=this.tick.bind(this),this.duration=i,this.delay=n,this.easing=s,this._onStart=o,this._onChange=a,this._onComplete=l,this._abort=h,this.target=c,this.startValue=e,this.byValue=r,this.value=this.startValue,this.endValue=Object.freeze(this.calculate(this.duration).value)}}let r0=["startValue","endValue"];class r1 extends r${calculate(t){let e=this.easing(t,this.startValue,this.byValue,this.duration);return{value:e,valueProgress:Math.abs((e-this.startValue)/this.byValue)}}constructor(t){let{startValue:e=0,endValue:r=100}=t;super(tt(tt({},te(t,r0)),{},{startValue:e,byValue:r-e}))}}let r2=["startValue","endValue"];class r5 extends r${calculate(t){let e=this.startValue.map((e,r)=>this.easing(t,e,this.byValue[r],this.duration,r));return{value:e,valueProgress:Math.abs((e[0]-this.startValue[0])/this.byValue[0])}}constructor(t){let{startValue:e=[0],endValue:r=[100]}=t;super(tt(tt({},te(t,r2)),{},{startValue:e,byValue:r.map((t,r)=>t-e[r])}))}}let r4=["startValue","endValue","easing","onChange","onComplete","abort"],r3=(t,e,r,i)=>e+r*(1-Math.cos(t/i*ty)),r9=t=>t&&((e,r,i)=>t(new rs(e).toRgba(),r,i));class r6 extends r${calculate(t){let[e,r,i,n]=this.startValue.map((e,r)=>this.easing(t,e,this.byValue[r],this.duration,r)),s=[...[e,r,i].map(Math.round),rX(0,n,1)];return{value:s,valueProgress:s.map((t,e)=>0!==this.byValue[e]?Math.abs((t-this.startValue[e])/this.byValue[e]):0).find(t=>0!==t)||0}}constructor(t){let{startValue:e,endValue:r,easing:i=r3,onChange:n,onComplete:s,abort:o}=t,a=te(t,r4),l=new rs(e).getSource();super(tt(tt({},a),{},{startValue:l,byValue:new rs(r).getSource().map((t,e)=>t-l[e]),easing:i,onChange:r9(n),onComplete:r9(s),abort:r9(o)}))}}function r8(t){let e=Array.isArray(t.startValue)||Array.isArray(t.endValue)?new r5(t):new r1(t);return e.start(),e}function r7(t){let e=new r6(t);return e.start(),e}class it{includes(t){return this.points.some(e=>e.eq(t))}append(){for(var t=arguments.length,e=Array(t),r=0;r!this.includes(t))),this}static isPointContained(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.eq(r))return t.eq(e);if(e.x===r.x)return t.x===e.x&&(i||t.y>=Math.min(e.y,r.y)&&t.y<=Math.max(e.y,r.y));if(e.y===r.y)return t.y===e.y&&(i||t.x>=Math.min(e.x,r.x)&&t.x<=Math.max(e.x,r.x));{let n=rj(e,r),s=rj(e,t).divide(n);return i?Math.abs(s.x)===Math.abs(s.y):s.x===s.y&&s.x>=0&&s.x<=1}}static isPointInPolygon(t,e){let r=new tJ(t).setX(Math.min(t.x-1,...e.map(t=>t.x))),i=0;for(let n=0;n4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=e.x-t.x,a=e.y-t.y,l=i.x-r.x,h=i.y-r.y,c=t.x-r.x,u=t.y-r.y,d=l*u-h*c,f=o*u-a*c,g=h*o-l*a;if(0!==g){let e=d/g,r=f/g;return(n||0<=e&&e<=1)&&(s||0<=r&&r<=1)?new it("Intersection").append(new tJ(t.x+e*o,t.y+e*a)):new it}if(0===d||0===f){let o=n||s||it.isPointContained(t,r,i)||it.isPointContained(e,r,i)||it.isPointContained(r,t,e)||it.isPointContained(i,t,e);return new it(o?"Coincident":void 0)}return new it("Parallel")}static intersectSegmentLine(t,e,r,i){return it.intersectLineLine(t,e,r,i,!1,!0)}static intersectSegmentSegment(t,e,r,i){return it.intersectLineLine(t,e,r,i,!1,!1)}static intersectLinePolygon(t,e,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=new it,s=r.length;for(let o,a,l,h=0;h0&&(n.status="Intersection"),n}static intersectSegmentPolygon(t,e,r){return it.intersectLinePolygon(t,e,r,!1)}static intersectPolygonPolygon(t,e){let r=new it,i=t.length,n=[];for(let s=0;s0&&n.length===t.length?new it("Coincident"):(r.points.length>0&&(r.status="Intersection"),r)}static intersectPolygonRectangle(t,e,r){let i=e.min(r),n=e.max(r),s=new tJ(n.x,i.y),o=new tJ(i.x,n.y);return it.intersectPolygonPolygon(t,[i,s,n,o])}constructor(t){this.status=t,this.points=[]}}class ie extends t1{getX(){return this.getXY().x}setX(t){this.setXY(this.getXY().setX(t))}getY(){return this.getXY().y}setY(t){this.setXY(this.getXY().setY(t))}getRelativeX(){return this.left}setRelativeX(t){this.left=t}getRelativeY(){return this.top}setRelativeY(t){this.top=t}getXY(){let t=this.getRelativeXY();return this.group?en(t,this.group.calcTransformMatrix()):t}setXY(t,e,r){this.group&&(t=en(t,es(this.group.calcTransformMatrix()))),this.setRelativeXY(t,e,r)}getRelativeXY(){return new tJ(this.left,this.top)}setRelativeXY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.originX,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.originY;this.setPositionByOrigin(t,e,r)}isStrokeAccountedForInDimensions(){return!1}getCoords(){let{tl:t,tr:e,br:r,bl:i}=this.aCoords||(this.aCoords=this.calcACoords()),n=[t,e,r,i];if(this.group){let t=this.group.calcTransformMatrix();return n.map(e=>en(e,t))}return n}intersectsWithRect(t,e){return"Intersection"===it.intersectPolygonRectangle(this.getCoords(),t,e).status}intersectsWithObject(t){let e=it.intersectPolygonPolygon(this.getCoords(),t.getCoords());return"Intersection"===e.status||"Coincident"===e.status||t.isContainedWithinObject(this)||this.isContainedWithinObject(t)}isContainedWithinObject(t){return this.getCoords().every(e=>t.containsPoint(e))}isContainedWithinRect(t,e){let{left:r,top:i,width:n,height:s}=this.getBoundingRect();return r>=t.x&&r+n<=e.x&&i>=t.y&&i+s<=e.y}isOverlapping(t){return this.intersectsWithObject(t)||this.isContainedWithinObject(t)||t.isContainedWithinObject(this)}containsPoint(t){return it.isPointInPolygon(t,this.getCoords())}isOnScreen(){if(!this.canvas)return!1;let{tl:t,br:e}=this.canvas.vptCoords;return!!this.getCoords().some(r=>r.x<=e.x&&r.x>=t.x&&r.y<=e.y&&r.y>=t.y)||!!this.intersectsWithRect(t,e)||this.containsPoint(t.midPointFrom(e))}isPartiallyOnScreen(){if(!this.canvas)return!1;let{tl:t,br:e}=this.canvas.vptCoords;return!!this.intersectsWithRect(t,e)||this.getCoords().every(r=>(r.x>=e.x||r.x<=t.x)&&(r.y>=e.y||r.y<=t.y))&&this.containsPoint(t.midPointFrom(e))}getBoundingRect(){return eH(this.getCoords())}getScaledWidth(){return this._getTransformedDimensions().x}getScaledHeight(){return this._getTransformedDimensions().y}scale(t){this._set(tI,t),this._set(tB,t),this.setCoords()}scaleToWidth(t){let e=this.getBoundingRect().width/this.getScaledWidth();return this.scale(t/this.width/e)}scaleToHeight(t){let e=this.getBoundingRect().height/this.getScaledHeight();return this.scale(t/this.height/e)}getCanvasRetinaScaling(){var t;return(null==(t=this.canvas)?void 0:t.getRetinaScaling())||1}getTotalAngle(){return this.group?er(el(this.calcTransformMatrix())):this.angle}getViewportTransform(){var t;return(null==(t=this.canvas)?void 0:t.viewportTransform)||t_.concat()}calcACoords(){let t=eu({angle:this.angle}),{x:e,y:r}=this.getRelativeCenterPoint(),i=eo(ec(e,r),t),n=this._getTransformedDimensions(),s=n.x/2,o=n.y/2;return{tl:en({x:-s,y:-o},i),tr:en({x:s,y:-o},i),bl:en({x:-s,y:o},i),br:en({x:s,y:o},i)}}setCoords(){this.aCoords=this.calcACoords()}transformMatrixKey(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=[];return!t&&this.group&&(e=this.group.transformMatrixKey(t)),e.push(this.top,this.left,this.width,this.height,this.scaleX,this.scaleY,this.angle,this.strokeWidth,this.skewX,this.skewY,+this.flipX,+this.flipY,e1(this.originX),e1(this.originY)),e}calcTransformMatrix(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.calcOwnMatrix();if(t||!this.group)return e;let r=this.transformMatrixKey(t),i=this.matrixCache;return i&&i.key.every((t,e)=>t===r[e])?i.value:(this.group&&(e=eo(this.group.calcTransformMatrix(!1),e)),this.matrixCache={key:r,value:e},e)}calcOwnMatrix(){let t=this.transformMatrixKey(!0),e=this.ownMatrixCache;if(e&&e.key===t)return e.value;let r=this.getRelativeCenterPoint(),i=ev({angle:this.angle,translateX:r.x,translateY:r.y,scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY});return this.ownMatrixCache={key:t,value:i},i}_getNonTransformedDimensions(){return new tJ(this.width,this.height).scalarAdd(this.strokeWidth)}_calculateCurrentDimensions(t){return this._getTransformedDimensions(t).transform(this.getViewportTransform(),!0).scalarAdd(2*this.padding)}_getTransformedDimensions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=tt({scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,width:this.width,height:this.height,strokeWidth:this.strokeWidth},t),r=e.strokeWidth,i=r,n=0;this.strokeUniform&&(i=0,n=r);let s=e.width+i,o=e.height+i;return(0===e.skewX&&0===e.skewY?new tJ(s*e.scaleX,o*e.scaleY):eq(s,o,em(e))).scalarAdd(n)}translateToGivenOrigin(t,e,r,i,n){let s=t.x,o=t.y,a=e1(i)-e1(e),l=e1(n)-e1(r);if(a||l){let t=this._getTransformedDimensions();s+=a*t.x,o+=l*t.y}return new tJ(s,o)}translateToCenterPoint(t,e,r){if(e===tw&&r===tw)return t;let i=this.translateToGivenOrigin(t,e,r,tw,tw);return this.angle?i.rotate(ee(this.angle),t):i}translateToOriginPoint(t,e,r){let i=this.translateToGivenOrigin(t,tw,tw,e,r);return this.angle?i.rotate(ee(this.angle),t):i}getCenterPoint(){let t=this.getRelativeCenterPoint();return this.group?en(t,this.group.calcTransformMatrix()):t}getRelativeCenterPoint(){return this.translateToCenterPoint(new tJ(this.left,this.top),this.originX,this.originY)}getPointByOrigin(t,e){return this.translateToOriginPoint(this.getRelativeCenterPoint(),t,e)}setPositionByOrigin(t,e,r){let i=this.translateToCenterPoint(t,e,r),n=this.translateToOriginPoint(i,this.originX,this.originY);this.set({left:n.x,top:n.y})}_getLeftTopCoords(){return this.translateToOriginPoint(this.getRelativeCenterPoint(),tC,"top")}}let ir=["type"],ii=["extraParam"],is=class t extends ie{static getDefaults(){return t.ownDefaults}get type(){let t=this.constructor.type;return"FabricObject"===t?"object":t.toLowerCase()}set type(t){ts("warn","Setting type has no effect",t)}_createCacheCanvas(){this._cacheCanvas=t9(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0}_limitCacheSize(t){let e=t.width,r=t.height,i=tn.maxCacheSideLimit,n=tn.minCacheSideLimit;if(e<=i&&r<=i&&e*r<=tn.perfLimitSizeTotal)return ea&&(t.zoomX/=e/a,t.width=a,t.capped=!0),r>l&&(t.zoomY/=r/l,t.height=l,t.capped=!0),t}_getCacheCanvasDimensions(){let t=this.getTotalObjectScaling(),e=this._getTransformedDimensions({skewX:0,skewY:0}),r=e.x*t.x/this.scaleX,i=e.y*t.y/this.scaleY;return{width:Math.ceil(r+2),height:Math.ceil(i+2),zoomX:t.x,zoomY:t.y,x:r,y:i}}_updateCacheCanvas(){let t=this._cacheCanvas,e=this._cacheContext,{width:r,height:i,zoomX:n,zoomY:s,x:o,y:a}=this._limitCacheSize(this._getCacheCanvasDimensions()),l=r!==t.width||i!==t.height,h=this.zoomX!==n||this.zoomY!==s;if(!t||!e)return!1;if(l||h){r!==t.width||i!==t.height?(t.width=r,t.height=i):(e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height));let l=o/2,h=a/2;return this.cacheTranslationX=Math.round(t.width/2-l)+l,this.cacheTranslationY=Math.round(t.height/2-h)+h,e.translate(this.cacheTranslationX,this.cacheTranslationY),e.scale(n,s),this.zoomX=n,this.zoomY=s,!0}return!1}setOptions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._setOptions(t)}transform(t){let e=this.group&&!this.group._transformDone||this.group&&this.canvas&&t===this.canvas.contextTop,r=this.calcTransformMatrix(!e);t.transform(r[0],r[1],r[2],r[3],r[4],r[5])}getObjectScaling(){if(!this.group)return new tJ(Math.abs(this.scaleX),Math.abs(this.scaleY));let t=eh(this.calcTransformMatrix());return new tJ(Math.abs(t.scaleX),Math.abs(t.scaleY))}getTotalObjectScaling(){let t=this.getObjectScaling();if(this.canvas){let e=this.canvas.getZoom(),r=this.getCanvasRetinaScaling();return t.scalarMultiply(e*r)}return t}getObjectOpacity(){let t=this.opacity;return this.group&&(t*=this.group.getObjectOpacity()),t}_constrainScale(t){return Math.abs(t){t.transform(i)}),e.parentClipPaths.push(t),t.absolutePositioned){let t=es(this.calcTransformMatrix());i.transform(t[0],t[1],t[2],t[3],t[4],t[5])}return t.transform(i),t.drawObject(i,!0,e),r}_drawClipPath(t,e,r){if(!e)return;e._transformDone=!0;let i=this.createClipPathLayer(e,r);this.drawClipPathOnCache(t,e,i)}drawCacheOnCanvas(t){t.scale(1/this.zoomX,1/this.zoomY),t.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)}isCacheDirty(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isNotVisible())return!1;let e=this._cacheCanvas,r=this._cacheContext;return!(!e||!r||t||!this._updateCacheCanvas())||!!(this.dirty||this.clipPath&&this.clipPath.absolutePositioned)&&(e&&r&&!t&&(r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.width,e.height),r.restore()),!0)}_renderBackground(t){if(!this.backgroundColor)return;let e=this._getNonTransformedDimensions();t.fillStyle=this.backgroundColor,t.fillRect(-e.x/2,-e.y/2,e.x,e.y),this._removeShadow(t)}_setOpacity(t){this.group&&!this.group._transformDone?t.globalAlpha=this.getObjectOpacity():t.globalAlpha*=this.opacity}_setStrokeStyles(t,e){let r=e.stroke;r&&(t.lineWidth=e.strokeWidth,t.lineCap=e.strokeLineCap,t.lineDashOffset=e.strokeDashOffset,t.lineJoin=e.strokeLineJoin,t.miterLimit=e.strokeMiterLimit,eT(r)?"percentage"===r.gradientUnits||r.gradientTransform||r.patternTransform?this._applyPatternForTransformedGradient(t,r):(t.strokeStyle=r.toLive(t),this._applyPatternGradientTransform(t,r)):t.strokeStyle=e.stroke)}_setFillStyles(t,e){let{fill:r}=e;r&&(eT(r)?(t.fillStyle=r.toLive(t),this._applyPatternGradientTransform(t,r)):t.fillStyle=r)}_setClippingProperties(t){t.globalAlpha=1,t.strokeStyle="transparent",t.fillStyle="#000000"}_setLineDash(t,e){e&&0!==e.length&&t.setLineDash(e)}_setShadow(t){if(!this.shadow)return;let e=this.shadow,r=this.canvas,i=this.getCanvasRetinaScaling(),[n,,,s]=(null==r?void 0:r.viewportTransform)||t_,o=n*i,a=s*i,l=e.nonScaling?new tJ(1,1):this.getObjectScaling();t.shadowColor=e.color,t.shadowBlur=e.blur*tn.browserShadowBlurConstant*(o+a)*(l.x+l.y)/4,t.shadowOffsetX=e.offsetX*o*l.x,t.shadowOffsetY=e.offsetY*a*l.y}_removeShadow(t){this.shadow&&(t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)}_applyPatternGradientTransform(t,e){if(!eT(e))return{offsetX:0,offsetY:0};let r=e.gradientTransform||e.patternTransform,i=-this.width/2+e.offsetX||0,n=-this.height/2+e.offsetY||0;return"percentage"===e.gradientUnits?t.transform(this.width,0,0,this.height,i,n):t.transform(1,0,0,1,i,n),r&&t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),{offsetX:i,offsetY:n}}_renderPaintInOrder(t){this.paintFirst===tH?(this._renderStroke(t),this._renderFill(t)):(this._renderFill(t),this._renderStroke(t))}_render(t){}_renderFill(t){this.fill&&(t.save(),this._setFillStyles(t,this),"evenodd"===this.fillRule?t.fill("evenodd"):t.fill(),t.restore())}_renderStroke(t){if(this.stroke&&0!==this.strokeWidth){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this.strokeUniform){let e=this.getObjectScaling();t.scale(1/e.x,1/e.y)}this._setLineDash(t,this.strokeDashArray),this._setStrokeStyles(t,this),t.stroke(),t.restore()}}_applyPatternForTransformedGradient(t,e){var r;let i=this._limitCacheSize(this._getCacheCanvasDimensions()),n=this.getCanvasRetinaScaling(),s=i.x/this.scaleX/n,o=i.y/this.scaleY/n,a=t8({width:Math.ceil(s),height:Math.ceil(o)}),l=a.getContext("2d");l&&(l.beginPath(),l.moveTo(0,0),l.lineTo(s,0),l.lineTo(s,o),l.lineTo(0,o),l.closePath(),l.translate(s/2,o/2),l.scale(i.zoomX/this.scaleX/n,i.zoomY/this.scaleY/n),this._applyPatternGradientTransform(l,e),l.fillStyle=e.toLive(t),l.fill(),t.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),t.scale(n*this.scaleX/i.zoomX,n*this.scaleY/i.zoomY),t.strokeStyle=null!=(r=l.createPattern(a,"no-repeat"))?r:"")}_findCenterFromElement(){return new tJ(this.left+this.width/2,this.top+this.height/2)}clone(t){let e=this.toObject(t);return this.constructor.fromObject(e)}cloneAsImage(t){let e=this.toCanvasElement(t);return new(tY.getClass("image"))(e)}toCanvasElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=eG(this),r=this.group,i=this.shadow,n=Math.abs,s=t.enableRetinaScaling?tg():1,o=(t.multiplier||1)*s,a=t.canvasProvider||(t=>new eI(t,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1}));delete this.group,t.withoutTransform&&ez(this),t.withoutShadow&&(this.shadow=null),t.viewportTransform&&eZ(this,this.getViewportTransform()),this.setCoords();let l=t9(),h=this.getBoundingRect(),c=this.shadow,u=new tJ;if(c){let t=c.blur,e=c.nonScaling?new tJ(1,1):this.getObjectScaling();u.x=2*Math.round(n(c.offsetX)+t)*n(e.x),u.y=2*Math.round(n(c.offsetY)+t)*n(e.y)}let d=h.width+u.x,f=h.height+u.y;l.width=Math.ceil(d),l.height=Math.ceil(f);let g=a(l);"jpeg"===t.format&&(g.backgroundColor="#fff"),this.setPositionByOrigin(new tJ(g.width/2,g.height/2),tw,tw);let p=this.canvas;g._objects=[this],this.set("canvas",g),this.setCoords();let m=g.toCanvasElement(o||1,t);return this.set("canvas",p),this.shadow=i,r&&(this.group=r),this.set(e),this.setCoords(),g._objects=[],g.destroy(),m}toDataURL(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t7(this.toCanvasElement(t),t.format||"png",t.quality||1)}toBlob(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return et(this.toCanvasElement(t),t.format||"png",t.quality||1)}isType(){for(var t=arguments.length,e=Array(t),r=0;r{let[i,n]=r;return t[i]=this._animate(i,n,e),t},{})}_animate(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.split("."),n=this.constructor.colorProperties.includes(i[i.length-1]),{abort:s,startValue:o,onChange:a,onComplete:l}=r,h=tt(tt({},r),{},{target:this,startValue:null!=o?o:i.reduce((t,e)=>t[e],this),endValue:e,abort:null==s?void 0:s.bind(this),onChange:(t,e,r)=>{i.reduce((e,r,n)=>(n===i.length-1&&(e[r]=t),e[r]),this),a&&a(t,e,r)},onComplete:(t,e,r)=>{this.setCoords(),l&&l(t,e,r)}});return n?r7(h):r8(h)}isDescendantOf(t){let{parent:e,group:r}=this;return e===t||r===t||!!e&&e.isDescendantOf(t)||!!r&&r!==e&&r.isDescendantOf(t)}getAncestors(){let t=[],e=this;do(e=e.parent)&&t.push(e);while(e)return t}findCommonAncestors(t){if(this===t)return{fork:[],otherFork:[],common:[this,...this.getAncestors()]};let e=this.getAncestors(),r=t.getAncestors();if(0===e.length&&r.length>0&&this===r[r.length-1])return{fork:[],otherFork:[t,...r.slice(0,r.length-1)],common:[this]};for(let i,n=0;n-1&&s>o}toObject(){let e,r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).concat(t.customProperties,this.constructor.customProperties||[]),i=tn.NUM_FRACTION_DIGITS,{clipPath:n,fill:s,stroke:o,shadow:a,strokeDashArray:l,left:h,top:c,originX:u,originY:d,width:f,height:g,strokeWidth:p,strokeLineCap:m,strokeDashOffset:y,strokeLineJoin:x,strokeUniform:b,strokeMiterLimit:_,scaleX:w,scaleY:C,angle:S,flipX:T,flipY:O,opacity:k,visible:M,backgroundColor:E,fillRule:D,paintFirst:j,globalCompositeOperation:A,skewX:P,skewY:F}=this;n&&!n.excludeFromExport&&(e=n.toObject(r.concat("inverted","absolutePositioned")));let L=t=>eC(t,i),R=tt(tt({},e_(this,r)),{},{type:this.constructor.type,version:tm,originX:u,originY:d,left:L(h),top:L(c),width:L(f),height:L(g),fill:eO(s)?s.toObject():s,stroke:eO(o)?o.toObject():o,strokeWidth:L(p),strokeDashArray:l?l.concat():l,strokeLineCap:m,strokeDashOffset:y,strokeLineJoin:x,strokeUniform:b,strokeMiterLimit:L(_),scaleX:L(w),scaleY:L(C),angle:L(S),flipX:T,flipY:O,opacity:L(k),shadow:a?a.toObject():a,visible:M,backgroundColor:E,fillRule:D,paintFirst:j,globalCompositeOperation:A,skewX:L(P),skewY:L(F)},e?{clipPath:e}:null);return this.includeDefaultValues?R:this._removeDefaultValues(R)}toDatalessObject(t){return this.toObject(t)}_removeDefaultValues(t){let e=this.constructor.getDefaults(),r=Object.keys(e).length>0?e:Object.getPrototypeOf(this);return ew(t,(t,e)=>{if(e===tC||"top"===e||"type"===e)return!0;let i=r[e];return t!==i&&!(Array.isArray(t)&&Array.isArray(i)&&0===t.length&&0===i.length)})}toString(){return"#<".concat(this.constructor.type,">")}static _fromObject(t){let e=te(t,ir),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{extraParam:i}=r;return eb(e,te(r,ii)).then(t=>i?(delete t[i],new this(e[i],t)):new this(t))}static fromObject(t,e){return this._fromObject(t,e)}constructor(e){super(),Z(this,"_cacheContext",null),Object.assign(this,t.ownDefaults),this.setOptions(e)}};Z(is,"stateProperties",rV),Z(is,"cacheProperties",rY),Z(is,"ownDefaults",{top:0,left:0,width:0,height:0,angle:0,flipX:!1,flipY:!1,scaleX:1,scaleY:1,minScaleLimit:0,skewX:0,skewY:0,originX:tC,originY:"top",strokeWidth:1,strokeUniform:!1,padding:0,opacity:1,paintFirst:tU,fill:"rgb(0,0,0)",fillRule:"nonzero",stroke:null,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,globalCompositeOperation:"source-over",backgroundColor:"",shadow:null,visible:!0,includeDefaultValues:!0,excludeFromExport:!1,objectCaching:!0,clipPath:void 0,inverted:!1,absolutePositioned:!1,centeredRotation:!0,centeredScaling:!1,dirty:!0}),Z(is,"type","FabricObject"),Z(is,"colorProperties",[tU,tH,"backgroundColor"]),Z(is,"customProperties",[]),tY.setClass(is),tY.setClass(is,"object");let io=(t,e,r)=>(i,n,s,o)=>{let a=e(i,n,s,o);return a&&e$(t,tt(tt({},e3(i,n,s,o)),r)),a};function ia(t){return(e,r,i,n)=>{let{target:s,originX:o,originY:a}=r,l=s.getRelativeCenterPoint(),h=s.translateToOriginPoint(l,o,a),c=t(e,r,i,n);return s.setPositionByOrigin(h,r.originX,r.originY),c}}let il=io(tP,ia((t,e,r,i)=>{let n=e6(e,e.originX,e.originY,r,i);if(e1(e.originX)===e1(tw)||e1(e.originX)===e1(tT)&&n.x<0||e1(e.originX)===e1(tC)&&n.x>0){let{target:t}=e,r=t.strokeWidth/(t.strokeUniform?t.scaleX:1),i=e5(e)?2:1,s=t.width,o=Math.abs(n.x*i/t.scaleX)-r;return t.set("width",Math.max(o,1)),s!==t.width}return!1}));function ih(t,e,r,i,n){i=i||{};let s=this.sizeX||i.cornerSize||n.cornerSize,o=this.sizeY||i.cornerSize||n.cornerSize,a=void 0!==i.transparentCorners?i.transparentCorners:n.transparentCorners,l=a?tH:tU,h=!a&&(i.cornerStrokeColor||n.cornerStrokeColor),c,u=e,d=r;t.save(),t.fillStyle=i.cornerColor||n.cornerColor||"",t.strokeStyle=i.cornerStrokeColor||n.cornerStrokeColor||"",s>o?(c=s,t.scale(1,o/s),d=r*s/o):o>s?(c=o,t.scale(s/o,1),u=e*o/s):c=s,t.beginPath(),t.arc(u,d,c/2,0,tx,!1),t[l](),h&&t.stroke(),t.restore()}function ic(t,e,r,i,n){i=i||{};let s=this.sizeX||i.cornerSize||n.cornerSize,o=this.sizeY||i.cornerSize||n.cornerSize,a=void 0!==i.transparentCorners?i.transparentCorners:n.transparentCorners,l=a?tH:tU,h=!a&&(i.cornerStrokeColor||n.cornerStrokeColor),c=s/2,u=o/2;t.save(),t.fillStyle=i.cornerColor||n.cornerColor||"",t.strokeStyle=i.cornerStrokeColor||n.cornerStrokeColor||"",t.translate(e,r);let d=n.getTotalAngle();t.rotate(ee(d)),t["".concat(l,"Rect")](-c,-u,s,o),h&&t.strokeRect(-c,-u,s,o),t.restore()}class iu{shouldActivate(t,e,r,i){var n;let{tl:s,tr:o,br:a,bl:l}=i;return(null==(n=e.canvas)?void 0:n.getActiveObject())===e&&e.isControlVisible(t)&&it.isPointInPolygon(r,[s,o,a,l])}getActionHandler(t,e,r){return this.actionHandler}getMouseDownHandler(t,e,r){return this.mouseDownHandler}getMouseUpHandler(t,e,r){return this.mouseUpHandler}cursorStyleHandler(t,e,r){return e.cursorStyle}getActionName(t,e,r){return e.actionName}getVisibility(t,e){var r,i;return null!=(r=null==(i=t._controlsVisibility)?void 0:i[e])?r:this.visible}setVisibility(t,e,r){this.visible=t}positionHandler(t,e,r,i){return new tJ(this.x*t.x+this.offsetX,this.y*t.y+this.offsetY).transform(e)}calcCornerCoords(t,e,r,i,n,s){let o=ea([ec(r,i),eu({angle:t}),ed((n?this.touchSizeX:this.sizeX)||e,(n?this.touchSizeY:this.sizeY)||e)]);return{tl:new tJ(-.5,-.5).transform(o),tr:new tJ(.5,-.5).transform(o),br:new tJ(.5,.5).transform(o),bl:new tJ(-.5,.5).transform(o)}}render(t,e,r,i,n){"circle"===((i=i||{}).cornerStyle||n.cornerStyle)?ih.call(this,t,e,r,i,n):ic.call(this,t,e,r,i,n)}constructor(t){Z(this,"visible",!0),Z(this,"actionName",tR),Z(this,"angle",0),Z(this,"x",0),Z(this,"y",0),Z(this,"offsetX",0),Z(this,"offsetY",0),Z(this,"sizeX",0),Z(this,"sizeY",0),Z(this,"touchSizeX",0),Z(this,"touchSizeY",0),Z(this,"cursorStyle","crosshair"),Z(this,"withConnection",!1),Object.assign(this,t)}}let id=(t,e,r)=>r.lockRotation?e2:e.cursorStyle,ig=io(tD,ia((t,e,r,i)=>{let{target:n,ex:s,ey:o,theta:a,originX:l,originY:h}=e,c=n.translateToOriginPoint(n.getRelativeCenterPoint(),l,h);if(e4(n,"lockRotation"))return!1;let u=Math.atan2(o-c.y,s-c.x),d=er(Math.atan2(i-c.y,r-c.x)-u+a);if(n.snapAngle&&n.snapAngle>0){let t=n.snapAngle,e=n.snapThreshold||t,r=Math.ceil(d/t)*t,i=Math.floor(d/t)*t;Math.abs(d-i){let i=ip(t,r);if(im(r,0!==e.x&&0===e.y?"x":0===e.x&&0!==e.y?"y":"",i))return e2;let n=e9(r,e);return"".concat(iv[n],"-resize")};function ix(t,e,r,i){let n,s,o,a,l,h,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},u=e.target,d=c.by,f=ip(t,u);if(im(u,d,f))return!1;if(e.gestureScale)s=e.scaleX*e.gestureScale,o=e.scaleY*e.gestureScale;else{if(n=e6(e,e.originX,e.originY,r,i),l="y"!==d?Math.sign(n.x||e.signX||1):1,h="x"!==d?Math.sign(n.y||e.signY||1):1,e.signX||(e.signX=l),e.signY||(e.signY=h),e4(u,"lockScalingFlip")&&(e.signX!==l||e.signY!==h))return!1;if(a=u._getTransformedDimensions(),f&&!d){let t=Math.abs(n.x)+Math.abs(n.y),{original:r}=e,i=t/(Math.abs(a.x*r.scaleX/u.scaleX)+Math.abs(a.y*r.scaleY/u.scaleY));s=r.scaleX*i,o=r.scaleY*i}else s=Math.abs(n.x*u.scaleX/a.x),o=Math.abs(n.y*u.scaleY/a.y);e5(e)&&(s*=2,o*=2),e.signX!==l&&"y"!==d&&(e.originX=.5-e1(e.originX),s*=-1,e.signX=l),e.signY!==h&&"x"!==d&&(e.originY=.5-e1(e.originY),o*=-1,e.signY=h)}let g=u.scaleX,p=u.scaleY;return d?("x"===d&&u.set(tI,s),"y"===d&&u.set(tB,o)):(e4(u,"lockScalingX")||u.set(tI,s),e4(u,"lockScalingY")||u.set(tB,o)),g!==u.scaleX||p!==u.scaleY}let ib=io(tE,ia((t,e,r,i)=>ix(t,e,r,i))),i_=io(tE,ia((t,e,r,i)=>ix(t,e,r,i,{by:"x"}))),iw=io(tE,ia((t,e,r,i)=>ix(t,e,r,i,{by:"y"}))),iC=["target","ex","ey","skewingSide"],iS={x:{counterAxis:"y",scale:tI,skew:tN,lockSkewing:"lockSkewingX",origin:"originX",flip:"flipX"},y:{counterAxis:"x",scale:tB,skew:tW,lockSkewing:"lockSkewingY",origin:"originY",flip:"flipY"}},iT=["ns","nesw","ew","nwse"],iO=(t,e,r)=>{if(0!==e.x&&e4(r,"lockSkewingY")||0!==e.y&&e4(r,"lockSkewingX"))return e2;let i=e9(r,e)%4;return"".concat(iT[i],"-resize")};function ik(t,e,r,i,n){let{target:s}=r,{counterAxis:o,origin:a,lockSkewing:l,skew:h,flip:c}=iS[t];if(e4(s,l))return!1;let{origin:u,flip:d}=iS[o],f=-Math.sign(e1(r[u])*(s[d]?-1:1))*(s[c]?-1:1),g=-(.5*((0===s[h]&&e6(r,tw,tw,i,n)[t]>0||s[h]>0?1:-1)*f))+.5;return io(tA,ia((e,r,i,n)=>(function(t,e,r){let{target:i,ex:n,ey:s,skewingSide:o}=e,a=te(e,iC),{skew:l}=iS[t],h=r.subtract(new tJ(n,s)).divide(new tJ(i.scaleX,i.scaleY))[t],c=i[l],u=Math.tan(ee(a[l])),d=er(Math.atan(2*h*o/Math.max("y"===t?i._getTransformedDimensions({scaleX:1,scaleY:1,skewX:0}).x:i._getTransformedDimensions({scaleX:1,scaleY:1}).y,1)+u));i.set(l,d);let f=c!==i[l];if(f&&"y"===t){let{skewX:t,scaleX:e}=i,r=i._getTransformedDimensions({skewY:c}),n=i._getTransformedDimensions(),s=0!==t?r.x/n.x:1;1!==s&&i.set(tI,s*e)}return f})(t,r,new tJ(i,n))))(e,tt(tt({},r),{},{[a]:g,skewingSide:f}),i,n)}let iM=(t,e,r,i)=>ik("x",t,e,r,i),iE=(t,e,r,i)=>ik("y",t,e,r,i);function iD(t,e){return t[e.canvas.altActionKey]}let ij=(t,e,r)=>{let i=iD(t,r);return 0===e.x?i?tN:tB:0===e.y?i?tW:tI:""},iA=(t,e,r)=>iD(t,r)?iO(0,e,r):iy(t,e,r),iP=(t,e,r,i)=>iD(t,e.target)?iE(t,e,r,i):i_(t,e,r,i),iF=(t,e,r,i)=>iD(t,e.target)?iM(t,e,r,i):iw(t,e,r,i),iL=()=>({ml:new iu({x:-.5,y:0,cursorStyleHandler:iA,actionHandler:iP,getActionName:ij}),mr:new iu({x:.5,y:0,cursorStyleHandler:iA,actionHandler:iP,getActionName:ij}),mb:new iu({x:0,y:.5,cursorStyleHandler:iA,actionHandler:iF,getActionName:ij}),mt:new iu({x:0,y:-.5,cursorStyleHandler:iA,actionHandler:iF,getActionName:ij}),tl:new iu({x:-.5,y:-.5,cursorStyleHandler:iy,actionHandler:ib}),tr:new iu({x:.5,y:-.5,cursorStyleHandler:iy,actionHandler:ib}),bl:new iu({x:-.5,y:.5,cursorStyleHandler:iy,actionHandler:ib}),br:new iu({x:.5,y:.5,cursorStyleHandler:iy,actionHandler:ib}),mtr:new iu({x:0,y:-.5,actionHandler:ig,cursorStyleHandler:id,offsetY:-40,withConnection:!0,actionName:tj})}),iR=()=>({mr:new iu({x:.5,y:0,actionHandler:il,cursorStyleHandler:iA,actionName:tP}),ml:new iu({x:-.5,y:0,actionHandler:il,cursorStyleHandler:iA,actionName:tP})}),iI=()=>tt(tt({},iL()),iR());class iB extends is{static getDefaults(){return tt(tt({},super.getDefaults()),iB.ownDefaults)}static createControls(){return{controls:iL()}}_updateCacheCanvas(){let t=this.canvas;if(this.noScaleCache&&t&&t._currentTransform){let e=t._currentTransform,r=e.target,i=e.action;if(this===r&&i&&i.startsWith(tR))return!1}return super._updateCacheCanvas()}getActiveControl(){let t=this.__corner;return t?{key:t,control:this.controls[t],coord:this.oCoords[t]}:void 0}findControl(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasControls||!this.canvas)return;this.__corner=void 0;let r=Object.entries(this.oCoords);for(let i=r.length-1;i>=0;i--){let[n,s]=r[i],o=this.controls[n];if(o.shouldActivate(n,this,t,e?s.touchCorner:s.corner))return this.__corner=n,{key:n,control:o,coord:this.oCoords[n]}}}calcOCoords(){let t=this.getViewportTransform(),e=this.getCenterPoint(),r=eo(ec(e.x,e.y),eu({angle:this.getTotalAngle()-(this.group&&this.flipX?180:0)})),i=eo(t,r),n=eo(i,[1/t[0],0,0,1/t[3],0,0]),s=this.group?eh(this.calcTransformMatrix()):void 0;s&&(s.scaleX=Math.abs(s.scaleX),s.scaleY=Math.abs(s.scaleY));let o=this._calculateCurrentDimensions(s),a={};return this.forEachControl((t,e)=>{let r=t.positionHandler(o,n,this,t);a[e]=Object.assign(r,this._calcCornerCoords(t,r))}),a}_calcCornerCoords(t,e){let r=this.getTotalAngle();return{corner:t.calcCornerCoords(r,this.cornerSize,e.x,e.y,!1,this),touchCorner:t.calcCornerCoords(r,this.touchCornerSize,e.x,e.y,!0,this)}}setCoords(){super.setCoords(),this.canvas&&(this.oCoords=this.calcOCoords())}forEachControl(t){for(let e in this.controls)t(this.controls[e],e,this)}drawSelectionBackground(t){if(!this.selectionBackgroundColor||this.canvas&&this.canvas._activeObject!==this)return;t.save();let e=this.getRelativeCenterPoint(),r=this._calculateCurrentDimensions(),i=this.getViewportTransform();t.translate(e.x,e.y),t.scale(1/i[0],1/i[3]),t.rotate(ee(this.angle)),t.fillStyle=this.selectionBackgroundColor,t.fillRect(-r.x/2,-r.y/2,r.x,r.y),t.restore()}strokeBorders(t,e){t.strokeRect(-e.x/2,-e.y/2,e.x,e.y)}_drawBorders(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=tt({hasControls:this.hasControls,borderColor:this.borderColor,borderDashArray:this.borderDashArray},r);t.save(),t.strokeStyle=i.borderColor,this._setLineDash(t,i.borderDashArray),this.strokeBorders(t,e),i.hasControls&&this.drawControlsConnectingLines(t,e),t.restore()}_renderControls(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{hasBorders:r,hasControls:i}=this,n=tt({hasBorders:r,hasControls:i},e),s=this.getViewportTransform(),o=n.hasBorders,a=n.hasControls,l=eh(eo(s,this.calcTransformMatrix()));t.save(),t.translate(l.translateX,l.translateY),t.lineWidth=this.borderScaleFactor,this.group===this.parent&&(t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(l.angle-=180),t.rotate(ee(this.group?l.angle:this.angle)),o&&this.drawBorders(t,l,e),a&&this.drawControls(t,e),t.restore()}drawBorders(t,e,r){let i;if(r&&r.forActiveSelection||this.group){let t=eq(this.width,this.height,em(e)),r=this.isStrokeAccountedForInDimensions()?tZ:(this.strokeUniform?(new tJ).scalarAdd(this.canvas?this.canvas.getZoom():1):new tJ(e.scaleX,e.scaleY)).scalarMultiply(this.strokeWidth);i=t.add(r).scalarAdd(this.borderScaleFactor).scalarAdd(2*this.padding)}else i=this._calculateCurrentDimensions().scalarAdd(this.borderScaleFactor);this._drawBorders(t,i,r)}drawControlsConnectingLines(t,e){let r=!1;t.beginPath(),this.forEachControl((i,n)=>{i.withConnection&&i.getVisibility(this,n)&&(r=!0,t.moveTo(i.x*e.x,i.y*e.y),t.lineTo(i.x*e.x+i.offsetX,i.y*e.y+i.offsetY))}),r&&t.stroke()}drawControls(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.save();let r=this.getCanvasRetinaScaling(),{cornerStrokeColor:i,cornerDashArray:n,cornerColor:s}=this,o=tt({cornerStrokeColor:i,cornerDashArray:n,cornerColor:s},e);t.setTransform(r,0,0,r,0,0),t.strokeStyle=t.fillStyle=o.cornerColor,this.transparentCorners||(t.strokeStyle=o.cornerStrokeColor),this._setLineDash(t,o.cornerDashArray),this.forEachControl((e,r)=>{if(e.getVisibility(this,r)){let i=this.oCoords[r];e.render(t,i.x,i.y,o,this)}}),t.restore()}isControlVisible(t){return this.controls[t]&&this.controls[t].getVisibility(this,t)}setControlVisible(t,e){this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[t]=e}setControlsVisibility(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.entries(t).forEach(t=>{let[e,r]=t;return this.setControlVisible(e,r)})}clearContextTop(t){if(!this.canvas)return;let e=this.canvas.contextTop;if(!e)return;let r=this.canvas.viewportTransform;e.save(),e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this.transform(e);let i=this.width+4,n=this.height+4;return e.clearRect(-i/2,-n/2,i,n),t||e.restore(),e}onDeselect(t){return!1}onSelect(t){return!1}shouldStartDragging(t){return!1}onDragStart(t){return!1}canDrop(t){return!1}renderDragSourceEffect(t){}renderDropTargetEffect(t){}constructor(t){super(),Object.assign(this,this.constructor.createControls(),iB.ownDefaults),this.setOptions(t)}}function iN(t,e){return e.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(r=>{"constructor"!==r&&Object.defineProperty(t.prototype,r,Object.getOwnPropertyDescriptor(e.prototype,r)||Object.create(null))})}),t}Z(iB,"ownDefaults",{noScaleCache:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,cornerSize:13,touchCornerSize:24,transparentCorners:!0,cornerColor:"rgb(178,204,255)",cornerStrokeColor:"",cornerStyle:"rect",cornerDashArray:null,hasControls:!0,borderColor:"rgb(178,204,255)",borderDashArray:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,hasBorders:!0,selectionBackgroundColor:"",selectable:!0,evented:!0,perPixelTargetFind:!1,activeOn:"down",hoverCursor:null,moveCursor:null});class iW extends iB{}iN(iW,[rh]),tY.setClass(iW),tY.setClass(iW,"object");let iU=(t,e,r,i)=>{let n=2*(i=Math.round(i))+1,{data:s}=t.getImageData(e-i,r-i,n,n);for(let t=3;t0)return!1;return!0};class iH{createSideVector(t,e){let r=rj(t,e);return this.options.strokeUniform?r.multiply(this.scale):r}projectOrthogonally(t,e,r){return this.applySkew(t.add(this.calcOrthogonalProjection(t,e,r)))}isSkewed(){return 0!==this.options.skewX||0!==this.options.skewY}applySkew(t){let e=new tJ(t);return e.y+=e.x*Math.tan(ee(this.options.skewY)),e.x+=e.y*Math.tan(ee(this.options.skewX)),e}scaleUnitVector(t,e){return t.multiply(this.strokeUniformScalar).scalarMultiply(e)}constructor(t){this.options=t,this.strokeProjectionMagnitude=this.options.strokeWidth/2,this.scale=new tJ(this.options.scaleX,this.options.scaleY),this.strokeUniformScalar=this.options.strokeUniform?new tJ(1/this.options.scaleX,1/this.options.scaleY):new tJ(1,1)}}let iX=new tJ;class iV extends iH{static getOrthogonalRotationFactor(t,e){return Math.abs(e?rP(t,e):rF(t))2&&void 0!==arguments[2]?arguments[2]:this.strokeProjectionMagnitude,i=rR(this.createSideVector(t,e)),n=iV.getOrthogonalRotationFactor(i,this.bisector);return this.scaleUnitVector(i,r*n)}projectBevel(){let t=[];return(this.alpha%tx==0?[this.B]:[this.B,this.C]).forEach(e=>{t.push(this.projectOrthogonally(this.A,e)),t.push(this.projectOrthogonally(this.A,e,-this.strokeProjectionMagnitude))}),t}projectMiter(){let t=[],e=1/Math.sin(Math.abs(this.alpha)/2),r=this.scaleUnitVector(this.bisector,-this.strokeProjectionMagnitude*e),i=this.options.strokeUniform?rA(this.scaleUnitVector(this.bisector,this.options.strokeMiterLimit)):this.options.strokeMiterLimit;return rA(r)/this.strokeProjectionMagnitude<=i&&t.push(this.applySkew(this.A.add(r))),t.push(...this.projectBevel()),t}projectRoundNoSkew(t,e){let r=[],i=new tJ(iV.getOrthogonalRotationFactor(this.bisector),iV.getOrthogonalRotationFactor(new tJ(this.bisector.y,this.bisector.x)));return[new tJ(1,0).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar).multiply(i),new tJ(0,1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar).multiply(i)].forEach(i=>{rN(i,t,e)&&r.push(this.A.add(i))}),r}projectRoundWithSkew(t,e){let r=[],{skewX:i,skewY:n,scaleX:s,scaleY:o,strokeUniform:a}=this.options,l=new tJ(Math.tan(ee(i)),Math.tan(ee(n))),h=this.strokeProjectionMagnitude,c=a?h/o/Math.sqrt(1/o**2+1/s**2*l.y**2):h/Math.sqrt(1+l.y**2),u=new tJ(Math.sqrt(Math.max(h**2-c**2,0)),c),d=a?h/Math.sqrt(1+l.x**2*(1/o)**2/(1/s+1/s*l.x*l.y)**2):h/Math.sqrt(1+l.x**2/(1+l.x*l.y)**2),f=new tJ(d,Math.sqrt(Math.max(h**2-d**2,0)));return[f,f.scalarMultiply(-1),u,u.scalarMultiply(-1)].map(t=>this.applySkew(a?t.multiply(this.strokeUniformScalar):t)).forEach(i=>{rN(i,t,e)&&r.push(this.applySkew(this.A).add(i))}),r}projectRound(){let t=[];t.push(...this.projectBevel());let e=this.alpha%tx==0,r=this.applySkew(this.A),i=t[2*!e].subtract(r),n=t[+!!e].subtract(r),s=rI(i,e?this.applySkew(this.AB.scalarMultiply(-1)):this.applySkew(this.bisector.multiply(this.strokeUniformScalar).scalarMultiply(-1)))>0,o=s?i:n,a=s?n:i;return this.isSkewed()?t.push(...this.projectRoundWithSkew(o,a)):t.push(...this.projectRoundNoSkew(o,a)),t}projectPoints(){switch(this.options.strokeLineJoin){case"miter":return this.projectMiter();case"round":return this.projectRound();default:return this.projectBevel()}}project(){return this.projectPoints().map(t=>({originPoint:this.A,projectedPoint:t,angle:this.alpha,bisector:this.bisector}))}constructor(t,e,r,i){super(i),Z(this,"AB",void 0),Z(this,"AC",void 0),Z(this,"alpha",void 0),Z(this,"bisector",void 0),this.A=new tJ(t),this.B=new tJ(e),this.C=new tJ(r),this.AB=this.createSideVector(this.A,this.B),this.AC=this.createSideVector(this.A,this.C),this.alpha=rP(this.AB,this.AC),this.bisector=rL(rD(this.AB.eq(iX)?this.AC:this.AB,this.alpha/2))}}class iY extends iH{calcOrthogonalProjection(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.strokeProjectionMagnitude,i=this.createSideVector(t,e);return this.scaleUnitVector(rR(i),r)}projectButt(){return[this.projectOrthogonally(this.A,this.T,this.strokeProjectionMagnitude),this.projectOrthogonally(this.A,this.T,-this.strokeProjectionMagnitude)]}projectRound(){let t=[];if(!this.isSkewed()&&this.A.eq(this.T)){let e=new tJ(1,1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar);t.push(this.applySkew(this.A.add(e)),this.applySkew(this.A.subtract(e)))}else t.push(...new iV(this.A,this.T,this.T,this.options).projectRound());return t}projectSquare(){let t=[];if(this.A.eq(this.T)){let e=new tJ(1,1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar);t.push(this.A.add(e),this.A.subtract(e))}else{let e=this.calcOrthogonalProjection(this.A,this.T,this.strokeProjectionMagnitude),r=this.scaleUnitVector(rL(this.createSideVector(this.A,this.T)),-this.strokeProjectionMagnitude),i=this.A.add(r);t.push(i.add(e),i.subtract(e))}return t.map(t=>this.applySkew(t))}projectPoints(){switch(this.options.strokeLineCap){case"round":return this.projectRound();case"square":return this.projectSquare();default:return this.projectButt()}}project(){return this.projectPoints().map(t=>({originPoint:this.A,projectedPoint:t}))}constructor(t,e,r){super(r),this.A=new tJ(t),this.T=new tJ(e)}}let iz=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[];if(0===t.length)return i;let n=t.reduce((t,e)=>(t[t.length-1].eq(e)||t.push(new tJ(e)),t),[new tJ(t[0])]);if(1===n.length)r=!0;else if(!r){let t=n[0],e=((t,e)=>{for(let r=t.length-1;r>=0;r--)if(e(t[r],r,t))return r;return -1})(n,e=>!e.eq(t));n.splice(e+1)}return n.forEach((t,n,s)=>{let o,a;0===n?(a=s[1],o=r?t:s[s.length-1]):n===s.length-1?(o=s[n-1],a=r?t:s[0]):(o=s[n-1],a=s[n+1]),r&&1===s.length?i.push(...new iY(t,t,e).project()):r&&(0===n||n===s.length-1)?i.push(...new iY(t,0===n?a:o,e).project()):i.push(...new iV(t,o,a,e).project())}),i},iG=t=>{let e={};return Object.keys(t).forEach(r=>{e[r]={},Object.keys(t[r]).forEach(i=>{e[r][i]=tt({},t[r][i])})}),e},iq=t=>t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">"),iK=t=>(r||r||(r="Intl"in tf()&&"Segmenter"in Intl&&new Intl.Segmenter(void 0,{granularity:"grapheme"})),r)?Array.from(r.segment(t)).map(t=>{let{segment:e}=t;return e}):iQ(t),iQ=t=>{let e=[];for(let r,i=0;i{let r=t.charCodeAt(e);if(isNaN(r))return"";if(r<55296||r>57343)return t.charAt(e);if(55296<=r&&r<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";let r=t.charCodeAt(e+1);if(56320>r||r>57343)throw"High surrogate without following low surrogate";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw"Low surrogate without preceding high surrogate";let i=t.charCodeAt(e-1);if(55296>i||i>56319)throw"Low surrogate without preceding high surrogate";return!1};var iZ=Object.freeze({__proto__:null,capitalize:function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"".concat(t.charAt(0).toUpperCase()).concat(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:iq,graphemeSplit:iK});let i$=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.fill!==e.fill||t.stroke!==e.stroke||t.strokeWidth!==e.strokeWidth||t.fontSize!==e.fontSize||t.fontFamily!==e.fontFamily||t.fontWeight!==e.fontWeight||t.fontStyle!==e.fontStyle||t.textDecorationThickness!==e.textDecorationThickness||t.textBackgroundColor!==e.textBackgroundColor||t.deltaY!==e.deltaY||r&&(t.overline!==e.overline||t.underline!==e.underline||t.linethrough!==e.linethrough)},i0=(t,e)=>{let r=e.split("\n"),i=[],n=-1,s={};t=iG(t);for(let e=0;e0&&(i$(s,o,!0)?i.push({start:n,end:n+1,style:o}):i[i.length-1].end++),s=o||{}}else n+=o.length,s={}}return i},i1=(t,e)=>{if(!Array.isArray(t))return iG(t);let r=e.split(tk),i={},n=-1,s=0;for(let e=0;e{var e;return null!=(e=rS[t])?e:t},i3=RegExp("(".concat(r_,")"),"gi"),i9="(".concat(r_,")"),i6=String.raw(l||(l=tr(["(skewX)(",")"],["(skewX)\\(","\\)"])),i9),i8=String.raw(h||(h=tr(["(skewY)(",")"],["(skewY)\\(","\\)"])),i9),i7=String.raw(c||(c=tr(["(rotate)(","(?: "," ",")?)"],["(rotate)\\(","(?: "," ",")?\\)"])),i9,i9,i9),nt=String.raw(u||(u=tr(["(scale)(","(?: ",")?)"],["(scale)\\(","(?: ",")?\\)"])),i9,i9),ne=String.raw(d||(d=tr(["(translate)(","(?: ",")?)"],["(translate)\\(","(?: ",")?\\)"])),i9,i9),nr=String.raw(f||(f=tr(["(matrix)("," "," "," "," "," ",")"],["(matrix)\\("," "," "," "," "," ","\\)"])),i9,i9,i9,i9,i9,i9),ni="(?:".concat(nr,"|").concat(ne,"|").concat(i7,"|").concat(nt,"|").concat(i6,"|").concat(i8,")"),nn=new RegExp(String.raw(g||(g=tr(["^s*(?:","?)s*$"],["^\\s*(?:","?)\\s*$"])),"(?:".concat(ni,"*)"))),ns=new RegExp(ni),no=RegExp(ni,"g");function na(t){let e=[];if(!(t=t.replace(i3," $1 ").replace(/,/gi," ").replace(/\s+/gi," ").replace(/\s*([()])\s*/gi,"$1"))||t&&!nn.test(t))return[...t_];for(let r of t.matchAll(no)){let t=ns.exec(r[0]);if(!t)continue;let i=t_,[,n,...s]=t.filter(t=>!!t),[o,a,l,h,c,u]=s.map(t=>parseFloat(t));switch(n){case"translate":i=ec(o,a);break;case tj:i=eu({angle:o},{x:a,y:l});break;case tR:i=ed(o,a);break;case tN:i=eg(o);break;case tW:i=ep(o);break;case"matrix":i=[o,a,l,h,c,u]}e.push(i)}return ea(e)}let nl={stroke:"strokeOpacity",fill:"fillOpacity"};function nh(t,e,r){if(!t)return{};let i,n={},s=16;t.parentNode&&rk.test(t.parentNode.nodeName)&&(n=nh(t.parentElement,e,r)).fontSize&&(i=s=ro(n.fontSize));let o=tt(tt(tt({},e.reduce((e,r)=>{let i=t.getAttribute(r);return i&&(e[r]=i),e},{})),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={};for(let i in e)(function(t,e){let r=!0,i=i5(t,e.pop());return i&&e.length&&(r=function(t,e){let r,i=!0;for(;t.parentElement&&1===t.parentElement.nodeType&&e.length;)i&&(r=e.pop()),i=i5(t=t.parentElement,r);return 0===e.length}(t,e)),i&&r&&0===e.length})(t,i.split(" "))&&(r=tt(tt({},r),e[i]));return r}(t,r)),function(t){let e={},r=t.getAttribute("style");return r&&("string"==typeof r?r.replace(/;\s*$/,"").split(";").forEach(t=>{if(!t)return;let[r,i]=t.split(":");e[r.trim().toLowerCase()]=i.trim()}):Object.entries(r).forEach(t=>{let[r,i]=t;void 0!==i&&(e[r.toLowerCase()]=i)})),e}(t));o[rO]&&t.setAttribute(rO,o[rO]),o[rT]&&(i=ro(o[rT],s),o[rT]="".concat(i));let a={};for(let t in o){let e=i4(t),r=function(t,e,r,i){let n=Array.isArray(e),s,o=e;if(t!==tU&&t!==tH||e!==tO){if("strokeUniform"===t)return"non-scaling-stroke"===e;if("strokeDashArray"===t)o=e===tO?null:e.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===t)o=r&&r.transformMatrix?eo(r.transformMatrix,na(e)):na(e);else if("visible"===t)o=e!==tO&&"hidden"!==e,r&&!1===r.visible&&(o=!1);else if("opacity"===t)o=parseFloat(e),r&&void 0!==r.opacity&&(o*=r.opacity);else if("textAnchor"===t)o="start"===e?tC:"end"===e?tT:tw;else if("charSpacing"===t||t===ru)s=ro(e,i)/i*1e3;else if("paintFirst"===t){let t=e.indexOf(tU),r=e.indexOf(tH);o=tU,(t>-1&&r>-1&&r-1)&&(o=tH)}else{if("href"===t||"xlink:href"===t||"font"===t||"id"===t)return e;if("imageSmoothing"===t)return"optimizeQuality"===e;s=n?e.map(ro):ro(e,i)}}else o="";return!n&&isNaN(s)?o:s}(e,o[t],n,i);a[e]=r}a&&a.font&&function(t,e){let r=t.match(rC);if(!r)return;let i=r[1],n=r[3],s=r[4],o=r[5],a=r[6];i&&(e.fontStyle=i),n&&(e.fontWeight=isNaN(parseFloat(n))?n:parseFloat(n)),s&&(e.fontSize=ro(s)),a&&(e.fontFamily=a),o&&(e.lineHeight="normal"===o?1:o)}(a.font,a);let l=tt(tt({},n),a);return rk.test(t.nodeName)?l:function(t){let e=iW.getDefaults();return Object.entries(nl).forEach(r=>{let[i,n]=r;if(void 0===t[n]||""===t[i])return;if(void 0===t[i]){if(!e[i])return;t[i]=e[i]}if(0===t[i].indexOf("url("))return;let s=new rs(t[i]);t[i]=s.setAlpha(eC(s.getAlpha()*t[n],2)).toRgba()}),t}(l)}let nc=["left","top","width","height","visible"],nu=["rx","ry"];class nd extends iW{static getDefaults(){return tt(tt({},super.getDefaults()),nd.ownDefaults)}_initRxRy(){let{rx:t,ry:e}=this;t&&!e?this.ry=t:e&&!t&&(this.rx=e)}_render(t){let{width:e,height:r}=this,i=-e/2,n=-r/2,s=this.rx?Math.min(this.rx,e/2):0,o=this.ry?Math.min(this.ry,r/2):0,a=0!==s||0!==o;t.beginPath(),t.moveTo(i+s,n),t.lineTo(i+e-s,n),a&&t.bezierCurveTo(i+e-.4477152502*s,n,i+e,n+.4477152502*o,i+e,n+o),t.lineTo(i+e,n+r-o),a&&t.bezierCurveTo(i+e,n+r-.4477152502*o,i+e-.4477152502*s,n+r,i+e-s,n+r),t.lineTo(i+s,n+r),a&&t.bezierCurveTo(i+.4477152502*s,n+r,i,n+r-.4477152502*o,i,n+r-o),t.lineTo(i,n+o),a&&t.bezierCurveTo(i,n+.4477152502*o,i+.4477152502*s,n,i+s,n),t.closePath(),this._renderPaintInOrder(t)}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return super.toObject([...nu,...t])}_toSVG(){let{width:t,height:e,rx:r,ry:i}=this;return["\n')]}static async fromElement(t,e,r){let i=nh(t,this.ATTRIBUTE_NAMES,r),{left:n=0,top:s=0,width:o=0,height:a=0,visible:l=!0}=i,h=te(i,nc);return new this(tt(tt(tt({},e),h),{},{left:n,top:s,width:o,height:a,visible:!!(l&&o&&a)}))}constructor(t){super(),Object.assign(this,nd.ownDefaults),this.setOptions(t),this._initRxRy()}}Z(nd,"type","Rect"),Z(nd,"cacheProperties",[...rY,...nu]),Z(nd,"ownDefaults",{rx:0,ry:0}),Z(nd,"ATTRIBUTE_NAMES",[...i2,"x","y","rx","ry","width","height"]),tY.setClass(nd),tY.setSVGClass(nd);let nf="initialization",ng="added",np="removed",nm="imperative",nv=(t,e)=>{let{strokeUniform:r,strokeWidth:i,width:n,height:s,group:o}=e,a=o&&o!==t?eK(o.calcTransformMatrix(),t.calcTransformMatrix()):null,l=a?e.getRelativeCenterPoint().transform(a):e.getRelativeCenterPoint(),h=!e.isStrokeAccountedForInDimensions(),c=r&&h?eJ(new tJ(i,i),void 0,t.calcTransformMatrix()):tZ,u=!r&&h?i:0,d=eq(n+u,s+u,ea([a,e.calcOwnMatrix()],!0)).add(c).scalarDivide(2);return[l.subtract(d),l.add(d)]};class ny{calcLayoutResult(t,e){if(this.shouldPerformLayout(t))return this.calcBoundingBox(e,t)}shouldPerformLayout(t){let{type:e,prevStrategy:r,strategy:i}=t;return e===nf||e===nm||!!r&&i!==r}shouldLayoutClipPath(t){let{type:e,target:{clipPath:r}}=t;return e!==nf&&r&&!r.absolutePositioned}getInitialSize(t,e){return e.size}calcBoundingBox(t,e){let{type:r,target:i}=e;if(r===nm&&e.overrides)return e.overrides;if(0===t.length)return;let{left:n,top:s,width:o,height:a}=eH(t.map(t=>nv(i,t)).reduce((t,e)=>t.concat(e),[])),l=new tJ(o,a),h=new tJ(n,s).add(l.scalarDivide(2));if(r===nf){let t=this.getInitialSize(e,{size:l,center:h});return{center:h,relativeCorrection:new tJ(0,0),size:t}}return{center:h.transform(i.calcOwnMatrix()),size:l}}}Z(ny,"type","strategy");class nx extends ny{shouldPerformLayout(t){return!0}}Z(nx,"type","fit-content"),tY.setClass(nx);let nb=["strategy"],n_=["target","strategy","bubbles","prevStrategy"],nw="layoutManager";class nC{performLayout(t){let e=tt(tt({bubbles:!0,strategy:this.strategy},t),{},{prevStrategy:this._prevLayoutStrategy,stopPropagation(){this.bubbles=!1}});this.onBeforeLayout(e);let r=this.getLayoutResult(e);r&&this.commitLayout(e,r),this.onAfterLayout(e,r),this._prevLayoutStrategy=e.strategy}attachHandlers(t,e){let{target:r}=e;return[tX,tM,tP,tD,tE,tA,tL,tF,"modifyPath"].map(e=>t.on(e,t=>this.performLayout(e===tX?{type:"object_modified",trigger:e,e:t,target:r}:{type:"object_modifying",trigger:e,e:t,target:r})))}subscribe(t,e){this.unsubscribe(t,e);let r=this.attachHandlers(t,e);this._subscriptions.set(t,r)}unsubscribe(t,e){(this._subscriptions.get(t)||[]).forEach(t=>t()),this._subscriptions.delete(t)}unsubscribeTargets(t){t.targets.forEach(e=>this.unsubscribe(e,t))}subscribeTargets(t){t.targets.forEach(e=>this.subscribe(e,t))}onBeforeLayout(t){let{target:e,type:r}=t,{canvas:i}=e;if(r===nf||r===ng?this.subscribeTargets(t):r===np&&this.unsubscribeTargets(t),e.fire("layout:before",{context:t}),i&&i.fire("object:layout:before",{target:e,context:t}),r===nm&&t.deep){let r=te(t,nb);e.forEachObject(t=>t.layoutManager&&t.layoutManager.performLayout(tt(tt({},r),{},{bubbles:!1,target:t})))}}getLayoutResult(t){let{target:e,strategy:r,type:i}=t,n=r.calcLayoutResult(t,e.getObjects());if(!n)return;let s=i===nf?new tJ:e.getRelativeCenterPoint(),{center:o,correction:a=new tJ,relativeCorrection:l=new tJ}=n,h=s.subtract(o).add(a).transform(i===nf?t_:es(e.calcOwnMatrix()),!0).add(l);return{result:n,prevCenter:s,nextCenter:o,offset:h}}commitLayout(t,e){var r,i;let{target:n}=t,{result:{size:s},nextCenter:o}=e;(n.set({width:s.x,height:s.y}),this.layoutObjects(t,e),t.type===nf)?n.set({left:null!=(r=t.x)?r:o.x+s.x*e1(n.originX),top:null!=(i=t.y)?i:o.y+s.y*e1(n.originY)}):(n.setPositionByOrigin(o,tw,tw),n.setCoords(),n.set("dirty",!0))}layoutObjects(t,e){let{target:r}=t;r.forEachObject(i=>{i.group===r&&this.layoutObject(t,e,i)}),t.strategy.shouldLayoutClipPath(t)&&this.layoutObject(t,e,r.clipPath)}layoutObject(t,e,r){let{offset:i}=e;r.set({left:r.left+i.x,top:r.top+i.y})}onAfterLayout(t,e){let{target:r,strategy:i,bubbles:n,prevStrategy:s}=t,o=te(t,n_),{canvas:a}=r;r.fire("layout:after",{context:t,result:e}),a&&a.fire("object:layout:after",{context:t,result:e,target:r});let l=r.parent;n&&null!=l&&l.layoutManager&&((o.path||(o.path=[])).push(r),l.layoutManager.performLayout(tt(tt({},o),{},{target:l}))),r.set("dirty",!0)}dispose(){let{_subscriptions:t}=this;t.forEach(t=>t.forEach(t=>t())),t.clear()}toObject(){return{type:nw,strategy:this.strategy.constructor.type}}toJSON(){return this.toObject()}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nx;Z(this,"strategy",void 0),this.strategy=t,this._subscriptions=new Map}}tY.setClass(nC,nw);let nS=["type","objects","layoutManager"];class nT extends nC{performLayout(){}}class nO extends t0(iW){static getDefaults(){return tt(tt({},super.getDefaults()),nO.ownDefaults)}groupInit(t,e){var r;this._objects=[...t],this.__objectSelectionTracker=this.__objectSelectionMonitor.bind(this,!0),this.__objectSelectionDisposer=this.__objectSelectionMonitor.bind(this,!1),this.forEachObject(t=>{this.enterGroup(t,!1)}),this.layoutManager=null!=(r=e.layoutManager)?r:new nC,this.layoutManager.performLayout({type:nf,target:this,targets:[...t],x:e.left,y:e.top})}canEnterGroup(t){return t===this||this.isDescendantOf(t)?(ts("error","Group: circular object trees are not supported, this call has no effect"),!1):-1===this._objects.indexOf(t)||(ts("error","Group: duplicate objects are not supported inside group, this call has no effect"),!1)}_filterObjectsBeforeEnteringGroup(t){return t.filter((t,e,r)=>this.canEnterGroup(t)&&r.indexOf(t)===e)}add(){for(var t=arguments.length,e=Array(t),r=0;r1?e-1:0),i=1;i{r._set(t,e)}),this}_shouldSetNestedCoords(){return this.subTargetCheck}removeAll(){return this._activeObjects=[],this.remove(...this._objects)}__objectSelectionMonitor(t,e){let{target:r}=e,i=this._activeObjects;if(t)i.push(r),this._set("dirty",!0);else if(i.length>0){let t=i.indexOf(r);t>-1&&(i.splice(t,1),this._set("dirty",!0))}}_watchObject(t,e){t&&this._watchObject(!1,e),t?(e.on("selected",this.__objectSelectionTracker),e.on("deselected",this.__objectSelectionDisposer)):(e.off("selected",this.__objectSelectionTracker),e.off("deselected",this.__objectSelectionDisposer))}enterGroup(t,e){t.group&&t.group.remove(t),t._set("parent",this),this._enterGroup(t,e)}_enterGroup(t,e){e&&eY(t,eo(es(this.calcTransformMatrix()),t.calcTransformMatrix())),this._shouldSetNestedCoords()&&t.setCoords(),t._set("group",this),t._set("canvas",this.canvas),this._watchObject(!0,t);let r=this.canvas&&this.canvas.getActiveObject&&this.canvas.getActiveObject();r&&(r===t||t.isDescendantOf(r))&&this._activeObjects.push(t)}exitGroup(t,e){this._exitGroup(t,e),t._set("parent",void 0),t._set("canvas",void 0)}_exitGroup(t,e){t._set("group",void 0),e||(eY(t,eo(this.calcTransformMatrix(),t.calcTransformMatrix())),t.setCoords()),this._watchObject(!1,t);let r=this._activeObjects.length>0?this._activeObjects.indexOf(t):-1;r>-1&&this._activeObjects.splice(r,1)}shouldCache(){let t=iW.prototype.shouldCache.call(this);if(t){for(let t=0;tt.setCoords())}triggerLayout(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.layoutManager.performLayout(tt({target:this,type:nm},t))}render(t){this._transformDone=!0,super.render(t),this._transformDone=!1}__serializeObjects(t,e){let r=this.includeDefaultValues;return this._objects.filter(function(t){return!t.excludeFromExport}).map(function(i){let n=i.includeDefaultValues;i.includeDefaultValues=r;let s=i[t||"toObject"](e);return i.includeDefaultValues=n,s})}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=this.layoutManager.toObject();return tt(tt(tt({},super.toObject(["subTargetCheck","interactive",...t])),"fit-content"!==e.strategy||this.includeDefaultValues?{layoutManager:e}:{}),{},{objects:this.__serializeObjects("toObject",t)})}toString(){return"#")}dispose(){this.layoutManager.unsubscribeTargets({targets:this.getObjects(),target:this}),this._activeObjects=[],this.forEachObject(t=>{this._watchObject(!1,t),t.dispose()}),super.dispose()}_createSVGBgRect(t){if(!this.backgroundColor)return"";let e=nd.prototype._toSVG.call(this),r=e.indexOf("COMMON_PARTS");e[r]='for="group" ';let i=e.join("");return t?t(i):i}_toSVG(t){let e=["\n"],r=this._createSVGBgRect(t);r&&e.push(" ",r);for(let r=0;r\n"),e}getSvgStyles(){let t=void 0!==this.opacity&&1!==this.opacity?"opacity: ".concat(this.opacity,";"):"",e=this.visible?"":" visibility: hidden;";return[t,this.getSvgFilter(),e].join("")}toClipPathSVG(t){let e=[],r=this._createSVGBgRect(t);r&&e.push(" ",r);for(let r=0;r{let[e,r]=t,i=new this(e,tt(tt(tt({},s),r),{},{layoutManager:new nT}));return n?i.layoutManager=new(tY.getClass(n.type))(new(tY.getClass(n.strategy))):i.layoutManager=new nC,i.layoutManager.subscribeTargets({type:nf,target:i,targets:i.getObjects()}),i.setCoords(),i})}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),Z(this,"_activeObjects",[]),Z(this,"__objectSelectionTracker",void 0),Z(this,"__objectSelectionDisposer",void 0),Object.assign(this,nO.ownDefaults),this.setOptions(e),this.groupInit(t,e)}}Z(nO,"type","Group"),Z(nO,"ownDefaults",{strokeWidth:0,subTargetCheck:!1,interactive:!1}),tY.setClass(nO);let nk=(t,e)=>Math.min(e.width/t.width,e.height/t.height),nM=(t,e)=>Math.max(e.width/t.width,e.height/t.height),nE="\\s*,?\\s*",nD="".concat(nE,"(").concat(r_,")"),nj="".concat(nD).concat(nD).concat(nD).concat(nE,"([01])").concat(nE,"([01])").concat(nD).concat(nD),nA={m:"l",M:"L"},nP=(t,e,r,i,n,s,o,a,l,h,c)=>{let u=tK(t),d=tQ(t),f=tK(e),g=tQ(e),p=r*n*f-i*s*g+o,m=i*n*f+r*s*g+a;return["C",h+l*(-r*n*d-i*s*u),c+l*(-i*n*d+r*s*u),p+l*(r*n*g+i*s*f),m+l*(i*n*g-r*s*f),p,m]},nF=(t,e,r,i)=>{let n=Math.atan2(e,t),s=Math.atan2(i,r);return s>=n?s-n:2*Math.PI-(n-s)};function nL(t,e,r,i,n,s,o,a){let l;if(tn.cachesBoundsOfCurve&&(l=[...arguments].join(),tp.boundsOfCurveCache[l]))return tp.boundsOfCurveCache[l];let h=Math.sqrt,c=Math.abs,u=[],d=[[0,0],[0,0]],f=6*t-12*r+6*n,g=-3*t+9*r-9*n+3*o,p=3*r-3*t;for(let t=0;t<2;++t){if(t>0&&(f=6*e-12*i+6*s,g=-3*e+9*i-9*s+3*a,p=3*i-3*e),1e-12>c(g)){if(1e-12>c(f))continue;let t=-p/f;0{let[i,n,s,o,a,l,h,c]=r,u=((t,e,r,i,n,s,o)=>{if(0===r||0===i)return[];let a=0,l=0,h=0,c=Math.PI,u=o*tb,d=tQ(u),f=tK(u),g=.5*(-f*t-d*e),p=.5*(-f*e+d*t),m=r**2,y=i**2,x=p**2,b=g**2,_=m*y-m*x-y*b,w=Math.abs(r),C=Math.abs(i);if(_<0){let t=Math.sqrt(1-_/(m*y));w*=t,C*=t}else h=(n===s?-1:1)*Math.sqrt(_/(m*x+y*b));let S=h*w*p/C,T=-h*C*g/w,O=f*S-d*T+.5*t,k=d*S+f*T+.5*e,M=nF(1,0,(g-S)/w,(p-T)/C),E=nF((g-S)/w,(p-T)/C,(-g-S)/w,(-p-T)/C);0===s&&E>0?E-=2*c:1===s&&E<0&&(E+=2*c);let D=Math.ceil(Math.abs(E/c*2)),j=[],A=E/D,P=8/3*Math.sin(A/4)*Math.sin(A/4)/Math.sin(A/2),F=M+A;for(let t=0;t{let e=0,r=0,i=0,n=0,s=[],o,a=0,l=0;for(let h of t){let t,c=[...h];switch(c[0]){case"l":c[1]+=e,c[2]+=r;case"L":t=["L",e=c[1],r=c[2]];break;case"h":c[1]+=e;case"H":t=["L",e=c[1],r];break;case"v":c[1]+=r;case"V":t=["L",e,r=c[1]];break;case"m":c[1]+=e,c[2]+=r;case"M":e=c[1],r=c[2],i=c[1],n=c[2],t=["M",e,r];break;case"c":c[1]+=e,c[2]+=r,c[3]+=e,c[4]+=r,c[5]+=e,c[6]+=r;case"C":a=c[3],l=c[4],e=c[5],r=c[6],t=["C",c[1],c[2],a,l,e,r];break;case"s":c[1]+=e,c[2]+=r,c[3]+=e,c[4]+=r;case"S":"C"===o?(a=2*e-a,l=2*r-l):(a=e,l=r),e=c[3],r=c[4],a=(t=["C",a,l,c[1],c[2],e,r])[3],l=t[4];break;case"q":c[1]+=e,c[2]+=r,c[3]+=e,c[4]+=r;case"Q":a=c[1],l=c[2],t=["Q",a,l,e=c[3],r=c[4]];break;case"t":c[1]+=e,c[2]+=r;case"T":"Q"===o?(a=2*e-a,l=2*r-l):(a=e,l=r),t=["Q",a,l,e=c[1],r=c[2]];break;case"a":c[6]+=e,c[7]+=r;case"A":nR(e,r,c).forEach(t=>s.push(t)),e=c[6],r=c[7];break;case"z":case"Z":e=i,r=n,t=["Z"]}t?(s.push(t),o=t[0]):o=""}return s},nB=(t,e,r,i)=>Math.sqrt((r-t)**2+(i-e)**2),nN=(t,e,r,i,n,s,o,a)=>l=>{let h=l**3,c=(t=>3*t**2*(1-t))(l),u=(t=>3*t*(1-t)**2)(l),d=(1-l)**3;return new tJ(o*h+n*c+r*u+t*d,a*h+s*c+i*u+e*d)},nW=t=>2*t*(1-t),nU=(t,e,r,i,n,s,o,a)=>l=>{let h=l**2,c=nW(l),u=(1-l)**2;return Math.atan2(3*(u*(i-e)+c*(s-i)+h*(a-s)),3*(u*(r-t)+c*(n-r)+h*(o-n)))},nH=(t,e,r,i,n,s)=>o=>{let a=o**2,l=nW(o),h=(1-o)**2;return new tJ(n*a+r*l+t*h,s*a+i*l+e*h)},nX=(t,e,r,i,n,s)=>o=>{let a=1-o;return Math.atan2(2*(a*(i-e)+o*(s-i)),2*(a*(r-t)+o*(n-r)))},nV=(t,e,r)=>{let i=new tJ(e,r),n=0;for(let e=1;e<=100;e+=1){let r=t(e/100);n+=nB(i.x,i.y,r.x,r.y),i=r}return n},nY=t=>{let e,r,i=0,n=0,s=0,o=0,a=0,l=[];for(let h of t){let t={x:n,y:s,command:h[0],length:0};switch(h[0]){case"M":(r=t).x=o=n=h[1],r.y=a=s=h[2];break;case"L":(r=t).length=nB(n,s,h[1],h[2]),n=h[1],s=h[2];break;case"C":e=nN(n,s,h[1],h[2],h[3],h[4],h[5],h[6]),(r=t).iterator=e,r.angleFinder=nU(n,s,h[1],h[2],h[3],h[4],h[5],h[6]),r.length=nV(e,n,s),n=h[5],s=h[6];break;case"Q":e=nH(n,s,h[1],h[2],h[3],h[4]),(r=t).iterator=e,r.angleFinder=nX(n,s,h[1],h[2],h[3],h[4]),r.length=nV(e,n,s),n=h[3],s=h[4];break;case"Z":(r=t).destX=o,r.destY=a,r.length=nB(n,s,o,a),n=o,s=a}i+=r.length,l.push(r)}return l.push({length:i,x:n,y:s}),l},nz=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nY(t),i=0;for(;e-r[i].length>0&&i{let r,i=0,n=0,s={x:t.x,y:t.y},o=tt({},s),a=.01,l=0,h=t.iterator,c=t.angleFinder;for(;n1e-4;)o=h(i),l=i,(r=nB(s.x,s.y,o.x,o.y))+n>e?(i-=a,a/=2):(s=o,i+=a,n+=r);return tt(tt({},o),{},{angle:c(l)})})(n,e)}},nG=RegExp("[mzlhvcsqta][^mzlhvcsqta]*","gi"),nq=RegExp(nj,"g"),nK=RegExp(r_,"gi"),nQ={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},nJ=t=>{var e;let r=[];for(let i of null!=(e=t.match(nG))?e:[]){let t=i[0];if("z"===t||"Z"===t){r.push([t]);continue}let e=nQ[t.toLowerCase()],n=[];if("a"===t||"A"===t){nq.lastIndex=0;for(let t=null;t=nq.exec(i);)n.push(...t.slice(1))}else n=i.match(nK)||[];for(let i=0;i0&&o?o:t;for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:0,i=new tJ(t[0]),n=new tJ(t[1]),s=1,o=0,a=[],l=t.length,h=l>2;for(h&&(s=t[2].xt[e-2].x?1:i.x===t[e-2].x?0:-1,o=i.y>t[e-2].y?1:i.y===t[e-2].y?0:-1),a.push(["L",i.x+s*r,i.y+o*r]),a},n$=(t,e)=>t.map(t=>t.map((t,r)=>0===r||void 0===e?t:eC(t,e)).join(" ")).join(" ");function n0(t,e){let r=t.style;r&&e&&("string"==typeof e?r.cssText+=";"+e:Object.entries(e).forEach(t=>{let[e,i]=t;return r.setProperty(e,i)}))}Object.freeze({__proto__:null,addTransformToObject:eV,animate:r8,animateColor:r7,applyTransformToObject:eY,calcAngleBetweenVectors:rP,calcDimensionsMatrix:em,calcPlaneChangeMatrix:eK,calcVectorRotation:rF,cancelAnimFrame:t5,capValue:rX,composeMatrix:ev,copyCanvasElement:t=>{var e;let r=t8(t);return null==(e=r.getContext("2d"))||e.drawImage(t,0,0),r},cos:tK,createCanvasElement:t9,createImage:t6,createRotateMatrix:eu,createScaleMatrix:ed,createSkewXMatrix:eg,createSkewYMatrix:ep,createTranslateMatrix:ec,createVector:rj,crossProduct:rI,degreesToRadians:ee,dotProduct:rB,ease:rJ,enlivenObjectEnlivables:eb,enlivenObjects:ex,findScaleToCover:nM,findScaleToFit:nk,getBoundsOfCurve:nL,getOrthonormalVector:rR,getPathSegmentsInfo:nY,getPointOnPath:nz,getPointer:eN,getRandomInt:(t,e)=>Math.floor(Math.random()*(e-t+1))+t,getRegularPolygonPath:(t,e)=>{let r=2*Math.PI/t,i=-ty;t%2==0&&(i+=r/2);let n=Array(t+1);for(let s=0;s{let e=["instantiated_by_use","style","id","class"];switch(t){case"linearGradient":return e.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);case"radialGradient":return e.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);case"stop":return e.concat(["offset","stop-color","stop-opacity"])}return e},getUnitVector:rL,groupSVGElements:(t,e)=>t&&1===t.length?t[0]:new nO(t,e),hasStyleChanged:i$,invertTransform:es,isBetweenVectors:rN,isIdentityMatrix:ei,isTouchEvent:eW,isTransparent:iU,joinPath:n$,loadImage:ey,magnitude:rA,makeBoundingBoxFromPoints:eH,makePathSimpler:nI,matrixToSVG:eS,mergeClipPaths:(t,e)=>{var r;let i=t,n=e;i.inverted&&!n.inverted&&(i=e,n=t),eZ(n,null==(r=n.group)?void 0:r.calcTransformMatrix(),i.calcTransformMatrix());let s=i.inverted&&n.inverted;return s&&(i.inverted=n.inverted=!1),new nO([i],{clipPath:n,inverted:s})},multiplyTransformMatrices:eo,multiplyTransformMatrixArray:ea,parsePath:nJ,parsePreserveAspectRatioAttribute:ra,parseUnit:ro,pick:e_,projectStrokeOnPoints:iz,qrDecompose:eh,radiansToDegrees:er,removeFromArray:tq,removeTransformFromObject:(t,e)=>{let r=eo(es(e),t.calcOwnMatrix());eY(t,r)},removeTransformMatrixForSvgParsing:(t,e)=>{let r=t._findCenterFromElement();t.transformMatrix&&((t=>{if(t.transformMatrix){let{scaleX:e,scaleY:r,angle:i,skewX:n}=eh(t.transformMatrix);t.flipX=!1,t.flipY=!1,t.set(tI,e),t.set(tB,r),t.angle=i,t.skewX=n,t.skewY=0}})(t),r=r.transform(t.transformMatrix)),delete t.transformMatrix,e&&(t.scaleX*=e.scaleX,t.scaleY*=e.scaleY,t.cropX=e.cropX,t.cropY=e.cropY,r.x+=e.offsetLeft,r.y+=e.offsetTop,t.width=e.width,t.height=e.height),t.setPositionByOrigin(r,tw,tw)},request:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.onComplete||tv,i=new(tf()).XMLHttpRequest,n=e.signal,s=function(){i.abort()},o=function(){n&&n.removeEventListener("abort",s),i.onerror=i.ontimeout=tv};if(n&&n.aborted)throw new ta("request");return n&&n.addEventListener("abort",s,{once:!0}),i.onreadystatechange=function(){4===i.readyState&&(o(),r(i),i.onreadystatechange=tv)},i.onerror=i.ontimeout=o,i.open("get",t,!0),i.send(),i},requestAnimFrame:t2,resetObjectTransform:ez,rotatePoint:(t,e,r)=>t.rotate(r,e),rotateVector:rD,saveObjectTransform:eG,sendObjectToPlane:eZ,sendPointToPlane:eQ,sendVectorToPlane:eJ,setStyle:n0,sin:tQ,sizeAfterTransform:eq,string:iZ,stylesFromArray:i1,stylesToArray:i0,toBlob:et,toDataURL:t7,toFixed:eC,transformPath:(t,e,r)=>(r&&(e=eo(e,[1,0,0,1,-r.x,-r.y])),t.map(t=>{let r=[...t];for(let i=1;i1&&void 0!==arguments[1]?arguments[1]:{};super(t),Z(this,"upper",void 0),Z(this,"container",void 0);let{el:i}=this.lower,n=this.createUpperCanvas();this.upper={el:n,ctx:n.getContext("2d")},this.applyCanvasStyle(i,{allowTouchScrolling:e}),this.applyCanvasStyle(n,{allowTouchScrolling:e,styles:{position:"absolute",left:"0",top:"0"}});let s=this.createContainerElement();s.classList.add(r),i.parentNode&&i.parentNode.replaceChild(s,i),s.append(i,n),this.container=s}}class n2 extends eI{static getDefaults(){return tt(tt({},super.getDefaults()),n2.ownDefaults)}get upperCanvasEl(){var t;return null==(t=this.elements.upper)?void 0:t.el}get contextTop(){var t;return null==(t=this.elements.upper)?void 0:t.ctx}get wrapperEl(){return this.elements.container}initElements(t){this.elements=new n1(t,{allowTouchScrolling:this.allowTouchScrolling,containerClass:this.containerClass}),this._createCacheCanvas()}_onObjectAdded(t){this._objectsToRender=void 0,super._onObjectAdded(t)}_onObjectRemoved(t){this._objectsToRender=void 0,t===this._activeObject&&(this.fire("before:selection:cleared",{deselected:[t]}),this._discardActiveObject(),this.fire("selection:cleared",{deselected:[t]}),t.fire("deselected",{target:t})),t===this._hoveredTarget&&(this._hoveredTarget=void 0,this._hoveredTargets=[]),super._onObjectRemoved(t)}_onStackOrderChanged(){this._objectsToRender=void 0,super._onStackOrderChanged()}_chooseObjectsToRender(){let t=this._activeObject;return!this.preserveObjectStacking&&t?this._objects.filter(e=>!e.group&&e!==t).concat(t):this._objects}renderAll(){this.cancelRequestedRender(),this.destroyed||(!this.contextTopDirty||this._groupSelector||this.isDrawingMode||(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&(this.renderTopLayer(this.contextTop),this.hasLostContext=!1),this._objectsToRender||(this._objectsToRender=this._chooseObjectsToRender()),this.renderCanvas(this.getContext(),this._objectsToRender))}renderTopLayer(t){t.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(t),this.contextTopDirty=!0),t.restore()}renderTop(){let t=this.contextTop;this.clearContext(t),this.renderTopLayer(t),this.fire("after:render",{ctx:t})}setTargetFindTolerance(t){t=Math.round(t),this.targetFindTolerance=t;let e=this.getRetinaScaling(),r=Math.ceil((2*t+1)*e);this.pixelFindCanvasEl.width=this.pixelFindCanvasEl.height=r,this.pixelFindContext.scale(e,e)}isTargetTransparent(t,e,r){let i=this.targetFindTolerance,n=this.pixelFindContext;this.clearContext(n),n.save(),n.translate(-e+i,-r+i),n.transform(...this.viewportTransform);let s=t.selectionBackgroundColor;t.selectionBackgroundColor="",t.render(n),t.selectionBackgroundColor=s,n.restore();let o=Math.round(i*this.getRetinaScaling());return iU(n,o,o,o)}_isSelectionKeyPressed(t){let e=this.selectionKey;return!!e&&(Array.isArray(e)?!!e.find(e=>!!e&&!0===t[e]):t[e])}_shouldClearSelection(t,e){let r=this.getActiveObjects(),i=this._activeObject;return!!(!e||e&&i&&r.length>1&&-1===r.indexOf(e)&&i!==e&&!this._isSelectionKeyPressed(t)||e&&!e.evented||e&&!e.selectable&&i&&i!==e)}_shouldCenterTransform(t,e,r){let i;if(t)return e===tR||e===tI||e===tB||e===tP?i=this.centeredScaling||t.centeredScaling:e===tj&&(i=this.centeredRotation||t.centeredRotation),i?!r:r}_getOriginFromCorner(t,e){let r={x:t.originX,y:t.originY};return e&&(["ml","tl","bl"].includes(e)?r.x=tT:["mr","tr","br"].includes(e)&&(r.x=tC),["tl","mt","tr"].includes(e)?r.y=tS:["bl","mb","br"].includes(e)&&(r.y="top")),r}_setupCurrentTransform(t,e,r){var i;let n=e.group?eQ(this.getScenePoint(t),void 0,e.group.calcTransformMatrix()):this.getScenePoint(t),{key:s="",control:o}=e.getActiveControl()||{},a=r&&o?null==(i=o.getActionHandler(t,e,o))?void 0:i.bind(o):e8,l=((t,e,r,i)=>{if(!e||!t)return"drag";let n=i.controls[e];return n.getActionName(r,n,i)})(r,s,t,e),h=t[this.centeredKey],c=this._shouldCenterTransform(e,l,h)?{x:tw,y:tw}:this._getOriginFromCorner(e,s),u={target:e,action:l,actionHandler:a,actionPerformed:!1,corner:s,scaleX:e.scaleX,scaleY:e.scaleY,skewX:e.skewX,skewY:e.skewY,offsetX:n.x-e.left,offsetY:n.y-e.top,originX:c.x,originY:c.y,ex:n.x,ey:n.y,lastX:n.x,lastY:n.y,theta:ee(e.angle),width:e.width,height:e.height,shiftKey:t.shiftKey,altKey:h,original:tt(tt({},eG(e)),{},{originX:c.x,originY:c.y})};this._currentTransform=u,this.fire("before:transform",{e:t,transform:u})}setCursor(t){this.upperCanvasEl.style.cursor=t}_drawSelection(t){let{x:e,y:r,deltaX:i,deltaY:n}=this._groupSelector,s=new tJ(e,r).transform(this.viewportTransform),o=new tJ(e+i,r+n).transform(this.viewportTransform),a=this.selectionLineWidth/2,l=Math.min(s.x,o.x),h=Math.min(s.y,o.y),c=Math.max(s.x,o.x),u=Math.max(s.y,o.y);this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(l,h,c-l,u-h)),this.selectionLineWidth&&this.selectionBorderColor&&(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,l+=a,h+=a,c-=a,u-=a,iW.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(l,h,c-l,u-h))}findTarget(t){if(this.skipTargetFind)return;let e=this.getViewportPoint(t),r=this._activeObject,i=this.getActiveObjects();if(this.targets=[],r&&i.length>=1){if(r.findControl(e,eW(t))||i.length>1&&this.searchPossibleTargets([r],e))return r;if(r===this.searchPossibleTargets([r],e)){if(this.preserveObjectStacking){let i=this.targets;this.targets=[];let n=this.searchPossibleTargets(this._objects,e);return t[this.altSelectionKey]&&n&&n!==r?(this.targets=i,r):n}return r}}return this.searchPossibleTargets(this._objects,e)}_pointIsInObjectSelectionArea(t,e){let r=t.getCoords(),i=this.getZoom(),n=t.padding/i;if(n){let[t,e,i,s]=r,o=Math.atan2(e.y-t.y,e.x-t.x),a=tK(o)*n,l=tQ(o)*n,h=a+l,c=a-l;r=[new tJ(t.x-c,t.y-h),new tJ(e.x+h,e.y-c),new tJ(i.x+c,i.y+h),new tJ(s.x-h,s.y+c)]}return it.isPointInPolygon(e,r)}_checkTarget(t,e){return!(!(t&&t.visible&&t.evented&&this._pointIsInObjectSelectionArea(t,eQ(e,void 0,this.viewportTransform)))||(this.perPixelTargetFind||t.perPixelTargetFind)&&!t.isEditing&&this.isTargetTransparent(t,e.x,e.y))||!1}_searchPossibleTargets(t,e){let r=t.length;for(;r--;){let i=t[r];if(this._checkTarget(i,e)){if(t$(i)&&i.subTargetCheck){let t=this._searchPossibleTargets(i._objects,e);t&&this.targets.push(t)}return i}}}searchPossibleTargets(t,e){let r=this._searchPossibleTargets(t,e);if(r&&t$(r)&&r.interactive&&this.targets[0]){let t=this.targets;for(let e=t.length-1;e>0;e--){let r=t[e];if(!t$(r)||!r.interactive)return r}return t[0]}return r}getViewportPoint(t){return this._pointer?this._pointer:this.getPointer(t,!0)}getScenePoint(t){return this._absolutePointer?this._absolutePointer:this.getPointer(t)}getPointer(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.upperCanvasEl,i=r.getBoundingClientRect(),n=eN(t),s=i.width||0,o=i.height||0;s&&o||("top"in i&&tS in i&&(o=Math.abs(i.top-i.bottom)),tT in i&&tC in i&&(s=Math.abs(i.right-i.left))),this.calcOffset(),n.x=n.x-this._offset.left,n.y=n.y-this._offset.top,e||(n=eQ(n,void 0,this.viewportTransform));let a=this.getRetinaScaling();1!==a&&(n.x/=a,n.y/=a);let l=0===s||0===o?new tJ(1,1):new tJ(r.width/s,r.height/o);return n.multiply(l)}_setDimensionsImpl(t,e){this._resetTransformEventData(),super._setDimensionsImpl(t,e),this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop)}_createCacheCanvas(){this.pixelFindCanvasEl=t9(),this.pixelFindContext=this.pixelFindCanvasEl.getContext("2d",{willReadFrequently:!0}),this.setTargetFindTolerance(this.targetFindTolerance)}getTopContext(){return this.elements.upper.ctx}getSelectionContext(){return this.elements.upper.ctx}getSelectionElement(){return this.elements.upper.el}getActiveObject(){return this._activeObject}getActiveObjects(){let t=this._activeObject;return eM(t)?t.getObjects():t?[t]:[]}_fireSelectionEvents(t,e){let r=!1,i=!1,n=this.getActiveObjects(),s=[],o=[];t.forEach(t=>{n.includes(t)||(r=!0,t.fire("deselected",{e:e,target:t}),o.push(t))}),n.forEach(i=>{t.includes(i)||(r=!0,i.fire("selected",{e:e,target:i}),s.push(i))}),t.length>0&&n.length>0?(i=!0,r&&this.fire("selection:updated",{e:e,selected:s,deselected:o})):n.length>0?(i=!0,this.fire("selection:created",{e:e,selected:s})):t.length>0&&(i=!0,this.fire("selection:cleared",{e:e,deselected:o})),i&&(this._objectsToRender=void 0)}setActiveObject(t,e){let r=this.getActiveObjects(),i=this._setActiveObject(t,e);return this._fireSelectionEvents(r,e),i}_setActiveObject(t,e){let r=this._activeObject;return r!==t&&!(!this._discardActiveObject(e,t)&&this._activeObject)&&!t.onSelect({e:e})&&(this._activeObject=t,eM(t)&&r!==t&&t.set("canvas",this),t.setCoords(),!0)}_discardActiveObject(t,e){let r=this._activeObject;return!!r&&!r.onDeselect({e:t,object:e})&&(this._currentTransform&&this._currentTransform.target===r&&this.endCurrentTransform(t),eM(r)&&r===this._hoveredTarget&&(this._hoveredTarget=void 0),this._activeObject=void 0,!0)}discardActiveObject(t){let e=this.getActiveObjects(),r=this.getActiveObject();e.length&&this.fire("before:selection:cleared",{e:t,deselected:[r]});let i=this._discardActiveObject(t);return this._fireSelectionEvents(e,t),i}endCurrentTransform(t){let e=this._currentTransform;this._finalizeCurrentTransform(t),e&&e.target&&(e.target.isMoving=!1),this._currentTransform=null}_finalizeCurrentTransform(t){let e=this._currentTransform,r=e.target,i={e:t,target:r,transform:e,action:e.action};r._scaling&&(r._scaling=!1),r.setCoords(),e.actionPerformed&&(this.fire("object:modified",i),r.fire(tX,i))}setViewportTransform(t){super.setViewportTransform(t);let e=this._activeObject;e&&e.setCoords()}destroy(){let t=this._activeObject;eM(t)&&(t.removeAll(),t.dispose()),delete this._activeObject,super.destroy(),this.pixelFindContext=null,this.pixelFindCanvasEl=void 0}clear(){this.discardActiveObject(),this._activeObject=void 0,this.clearContext(this.contextTop),super.clear()}drawControls(t){let e=this._activeObject;e&&e._renderControls(t)}_toObject(t,e,r){let i=this._realizeGroupTransformOnObject(t),n=super._toObject(t,e,r);return t.set(i),n}_realizeGroupTransformOnObject(t){let{group:e}=t;if(e&&eM(e)&&this._activeObject===e){let r=e_(t,["angle","flipX","flipY",tC,tI,tB,tN,tW,"top"]);return eV(t,e.calcOwnMatrix()),r}return{}}_setSVGObject(t,e,r){let i=this._realizeGroupTransformOnObject(e);super._setSVGObject(t,e,r),e.set(i)}constructor(){super(...arguments),Z(this,"targets",[]),Z(this,"_hoveredTargets",[]),Z(this,"_objectsToRender",void 0),Z(this,"_currentTransform",null),Z(this,"_groupSelector",null),Z(this,"contextTopDirty",!1)}}Z(n2,"ownDefaults",{uniformScaling:!0,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",selection:!0,selectionKey:"shiftKey",selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",notAllowedCursor:"not-allowed",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,enablePointerEvents:!1,containerClass:"canvas-container",preserveObjectStacking:!1});class n5{exitTextEditing(){this.target=void 0,this.targets.forEach(t=>{t.isEditing&&t.exitEditing()})}add(t){this.targets.push(t)}remove(t){this.unregister(t),tq(this.targets,t)}register(t){this.target=t}unregister(t){t===this.target&&(this.target=void 0)}onMouseMove(t){var e;(null==(e=this.target)?void 0:e.isEditing)&&this.target.updateSelectionOnMouseMove(t)}clear(){this.targets=[],this.target=void 0}dispose(){this.clear(),this.__disposer(),delete this.__disposer}constructor(t){Z(this,"targets",[]),Z(this,"__disposer",void 0);let e=()=>{let{hiddenTextarea:e}=t.getActiveObject()||{};e&&e.focus()},r=t.upperCanvasEl;r.addEventListener("click",e),this.__disposer=()=>r.removeEventListener("click",e)}}let n4=["target","oldTarget","fireCanvas","e"],n3={passive:!1},n9=(t,e)=>{let r=t.getViewportPoint(e),i=t.getScenePoint(e);return{viewportPoint:r,scenePoint:i,pointer:r,absolutePointer:i}},n6=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i1?e-1:0),i=1;i{this.fire("mouse:out",tt(tt({},r),{},{target:t})),t&&t.fire("mouseout",tt({},r))}),this._hoveredTargets=[]}_onMouseEnter(t){this._currentTransform||this.findTarget(t)||(this.fire("mouse:over",tt({e:t},n9(this,t))),this._hoveredTarget=void 0,this._hoveredTargets=[])}_onDragStart(t){this._isClick=!1;let e=this.getActiveObject();if(e&&e.onDragStart(t)){this._dragSource=e;let r={e:t,target:e};return this.fire("dragstart",r),e.fire("dragstart",r),void n6(this.upperCanvasEl,"drag",this._onDragProgress)}eU(t)}_renderDragEffects(t,e,r){let i=!1,n=this._dropTarget;n&&n!==e&&n!==r&&(n.clearContextTop(),i=!0),null==e||e.clearContextTop(),r!==e&&(null==r||r.clearContextTop());let s=this.contextTop;s.save(),s.transform(...this.viewportTransform),e&&(s.save(),e.transform(s),e.renderDragSourceEffect(t),s.restore(),i=!0),r&&(s.save(),r.transform(s),r.renderDropTargetEffect(t),s.restore(),i=!0),s.restore(),i&&(this.contextTopDirty=!0)}_onDragEnd(t){let e=!!t.dataTransfer&&t.dataTransfer.dropEffect!==tO,r=e?this._activeObject:void 0,i={e:t,target:this._dragSource,subTargets:this.targets,dragSource:this._dragSource,didDrop:e,dropTarget:r};n8(this.upperCanvasEl,"drag",this._onDragProgress),this.fire("dragend",i),this._dragSource&&this._dragSource.fire("dragend",i),delete this._dragSource,this._onMouseUp(t)}_onDragProgress(t){let e={e:t,target:this._dragSource,dragSource:this._dragSource,dropTarget:this._draggedoverTarget};this.fire("drag",e),this._dragSource&&this._dragSource.fire("drag",e)}findDragTargets(t){return this.targets=[],{target:this._searchPossibleTargets(this._objects,this.getViewportPoint(t)),targets:[...this.targets]}}_onDragOver(t){let e,r="dragover",{target:i,targets:n}=this.findDragTargets(t),s=this._dragSource,o={e:t,target:i,subTargets:n,dragSource:s,canDrop:!1,dropTarget:void 0};this.fire(r,o),this._fireEnterLeaveEvents(i,o),i&&(i.canDrop(t)&&(e=i),i.fire(r,o));for(let i=0;i3||e<2||(this._cacheTransformEventData(t),2==e&&"dblclick"===t.type&&this._handleEvent(t,"dblclick"),3==e&&this._handleEvent(t,"tripleclick"),this._resetTransformEventData())}getPointerId(t){let e=t.changedTouches;return e?e[0]&&e[0].identifier:this.enablePointerEvents?t.pointerId:-1}_isMainEvent(t){return!0===t.isPrimary||!1!==t.isPrimary&&("touchend"===t.type&&0===t.touches.length||!t.changedTouches||t.changedTouches[0].identifier===this.mainTouchId)}_onTouchStart(t){let e=!this.allowTouchScrolling,r=this._activeObject;void 0===this.mainTouchId&&(this.mainTouchId=this.getPointerId(t)),this.__onMouseDown(t),(this.isDrawingMode||r&&this._target===r)&&(e=!0),e&&t.preventDefault(),this._resetTransformEventData();let i=this.upperCanvasEl,n=this._getEventPrefix(),s=eD(i);n6(s,"touchend",this._onTouchEnd,n3),e&&n6(s,"touchmove",this._onMouseMove,n3),n8(i,"".concat(n,"down"),this._onMouseDown)}_onMouseDown(t){this.__onMouseDown(t),this._resetTransformEventData();let e=this.upperCanvasEl,r=this._getEventPrefix();n8(e,"".concat(r,"move"),this._onMouseMove,n3);let i=eD(e);n6(i,"".concat(r,"up"),this._onMouseUp),n6(i,"".concat(r,"move"),this._onMouseMove,n3)}_onTouchEnd(t){if(t.touches.length>0)return;this.__onMouseUp(t),this._resetTransformEventData(),delete this.mainTouchId;let e=this._getEventPrefix(),r=eD(this.upperCanvasEl);n8(r,"touchend",this._onTouchEnd,n3),n8(r,"touchmove",this._onMouseMove,n3),this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(()=>{n6(this.upperCanvasEl,"".concat(e,"down"),this._onMouseDown),this._willAddMouseDown=0},400)}_onMouseUp(t){this.__onMouseUp(t),this._resetTransformEventData();let e=this.upperCanvasEl,r=this._getEventPrefix();if(this._isMainEvent(t)){let t=eD(this.upperCanvasEl);n8(t,"".concat(r,"up"),this._onMouseUp),n8(t,"".concat(r,"move"),this._onMouseMove,n3),n6(e,"".concat(r,"move"),this._onMouseMove,n3)}}_onMouseMove(t){let e=this.getActiveObject();this.allowTouchScrolling||e&&e.shouldStartDragging(t)||!t.preventDefault||t.preventDefault(),this.__onMouseMove(t)}_onResize(){this.calcOffset(),this._resetTransformEventData()}_shouldRender(t){let e=this.getActiveObject();return!!e!=!!t||e&&t&&e!==t}__onMouseUp(t){var e;this._cacheTransformEventData(t),this._handleEvent(t,"up:before");let r=this._currentTransform,i=this._isClick,n=this._target,{button:s}=t;if(s)return(this.fireMiddleClick&&1===s||this.fireRightClick&&2===s)&&this._handleEvent(t,"up"),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)return void this._onMouseUpInDrawingMode(t);if(!this._isMainEvent(t))return;let o,a,l=!1;if(r&&(this._finalizeCurrentTransform(t),l=r.actionPerformed),!i){let e=n===this._activeObject;this.handleSelection(t),l||(l=this._shouldRender(n)||!e&&n===this._activeObject)}if(n){let{key:e,control:i}=n.findControl(this.getViewportPoint(t),eW(t))||{};if(a=e,n.selectable&&n!==this._activeObject&&"up"===n.activeOn)this.setActiveObject(n,t),l=!0;else if(i){let e=i.getMouseUpHandler(t,n,i);e&&(o=this.getScenePoint(t),e.call(i,t,r,o.x,o.y))}n.isMoving=!1}if(r&&(r.target!==n||r.corner!==a)){let e=r.target&&r.target.controls[r.corner],i=e&&e.getMouseUpHandler(t,r.target,e);o=o||this.getScenePoint(t),i&&i.call(e,t,r,o.x,o.y)}this._setCursorFromEvent(t,n),this._handleEvent(t,"up"),this._groupSelector=null,this._currentTransform=null,n&&(n.__corner=void 0),l?this.requestRenderAll():i||null!=(e=this._activeObject)&&e.isEditing||this.renderTop()}_basicEventHandler(t,e){let{target:r,subTargets:i=[]}=e;this.fire(t,e),r&&r.fire(t,e);for(let n=0;n{r=t.hoverCursor||r}),this.setCursor(r)}handleMultiSelection(t,e){let r=this._activeObject,i=eM(r);if(r&&this._isSelectionKeyPressed(t)&&this.selection&&e&&e.selectable&&(r!==e||i)&&(i||!e.isDescendantOf(r)&&!r.isDescendantOf(e))&&!e.onSelect({e:t})&&!r.getActiveControl()){if(i){let i=r.getObjects();if(e===r){let r=this.getViewportPoint(t);if(!(e=this.searchPossibleTargets(i,r)||this.searchPossibleTargets(this._objects,r))||!e.selectable)return!1}e.group===r?(r.remove(e),this._hoveredTarget=e,this._hoveredTargets=[...this.targets],1===r.size()&&this._setActiveObject(r.item(0),t)):(r.multiSelectAdd(e),this._hoveredTarget=r,this._hoveredTargets=[...this.targets]),this._fireSelectionEvents(i,t)}else{r.isEditing&&r.exitEditing();let i=new(tY.getClass("ActiveSelection"))([],{canvas:this});i.multiSelectAdd(r,e),this._hoveredTarget=i,this._setActiveObject(i,t),this._fireSelectionEvents([r],t)}return!0}return!1}handleSelection(t){if(!this.selection||!this._groupSelector)return!1;let{x:e,y:r,deltaX:i,deltaY:n}=this._groupSelector,s=new tJ(e,r),o=s.add(new tJ(i,n)),a=s.min(o),l=s.max(o).subtract(a),h=this.collectObjects({left:a.x,top:a.y,width:l.x,height:l.y},{includeIntersecting:!this.selectionFullyContained}),c=s.eq(o)?h[0]?[h[0]]:[]:h.length>1?h.filter(e=>!e.onSelect({e:t})).reverse():h;if(1===c.length)this.setActiveObject(c[0],t);else if(c.length>1){let e=tY.getClass("ActiveSelection");this.setActiveObject(new e(c,{canvas:this}),t)}return this._groupSelector=null,!0}clear(){this.textEditingManager.clear(),super.clear()}destroy(){this.removeListeners(),this.textEditingManager.dispose(),super.destroy()}constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),Z(this,"_isClick",void 0),Z(this,"textEditingManager",new n5(this)),["_onMouseDown","_onTouchStart","_onMouseMove","_onMouseUp","_onTouchEnd","_onResize","_onMouseWheel","_onMouseOut","_onMouseEnter","_onContextMenu","_onClick","_onDragStart","_onDragEnd","_onDragProgress","_onDragOver","_onDragEnter","_onDragLeave","_onDrop"].forEach(t=>{this[t]=this[t].bind(this)}),this.addOrRemove(n6,"add")}}let se={x1:0,y1:0,x2:0,y2:0},sr=tt(tt({},se),{},{r1:0,r2:0}),si=(t,e)=>isNaN(t)&&"number"==typeof e?e:t,sn=/^(\d+\.\d+)%|(\d+)%$/;function ss(t){return t&&sn.test(t)}function so(t,e){return rX(0,si("number"==typeof t?t:"string"==typeof t?parseFloat(t)/(ss(t)?100:1):NaN,e),1)}let sa=/\s*;\s*/,sl=/\s*:\s*/;function sh(t){return"linearGradient"===t.nodeName||"LINEARGRADIENT"===t.nodeName?"linear":"radial"}function sc(t){return"userSpaceOnUse"===t.getAttribute("gradientUnits")?"pixels":"percentage"}function su(t,e){return t.getAttribute(e)}class sd{addColorStop(t){for(let e in t){let r=new rs(t[e]);this.colorStops.push({offset:parseFloat(e),color:r.toRgb(),opacity:r.getAlpha()})}return this}toObject(t){return tt(tt({},e_(this,t)),{},{type:this.type,coords:tt({},this.coords),colorStops:this.colorStops.map(t=>tt({},t)),offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?[...this.gradientTransform]:void 0})}toSVG(t){let{additionalTransform:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[],i=this.gradientTransform?this.gradientTransform.concat():t_.concat(),n="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox",s=this.colorStops.map(t=>tt({},t)).sort((t,e)=>t.offset-e.offset),o=-this.offsetX,a=-this.offsetY;"objectBoundingBox"===n?(o/=t.width,a/=t.height):(o+=t.width/2,a+=t.height/2),t&&"function"==typeof t._renderPathCommands&&"percentage"!==this.gradientUnits&&(o-=t.pathOffset.x,a-=t.pathOffset.y),i[4]-=o,i[5]-=a;let l=['id="SVGID_'.concat(this.id,'"'),'gradientUnits="'.concat(n,'"'),'gradientTransform="'.concat(e?e+" ":"").concat(eS(i),'"'),""].join(" ");if("linear"===this.type){let{x1:t,y1:e,x2:i,y2:n}=this.coords;r.push("\n')}else if("radial"===this.type){let{x1:t,y1:e,x2:i,y2:n,r1:o,r2:a}=this.coords,h=o>a;r.push("\n'),h&&(s.reverse(),s.forEach(t=>{t.offset=1-t.offset}));let c=Math.min(o,a);if(c>0){let t=c/Math.max(o,a);s.forEach(e=>{e.offset+=t*(1-e.offset)})}}return s.forEach(t=>{let{color:e,offset:i,opacity:n}=t;r.push("\n')}),r.push("linear"===this.type?"":"","\n"),r.join("")}toLive(t){let{x1:e,y1:r,x2:i,y2:n,r1:s,r2:o}=this.coords,a="linear"===this.type?t.createLinearGradient(e,r,i,n):t.createRadialGradient(e,r,s,i,n,o);return this.colorStops.forEach(t=>{let{color:e,opacity:r,offset:i}=t;a.addColorStop(i,void 0!==r?new rs(e).setAlpha(r).toRgba():e)}),a}static async fromObject(t){let{colorStops:e,gradientTransform:r}=t;return new this(tt(tt({},t),{},{colorStops:e?e.map(t=>tt({},t)):void 0,gradientTransform:r?[...r]:void 0}))}static fromElement(t,e,r){var i;let n=sc(t),s=e._findCenterFromElement();return new this(tt({id:t.getAttribute("id")||void 0,type:sh(t),coords:(i={width:r.viewBoxWidth||r.width,height:r.viewBoxHeight||r.height},function(t,e){let r,{width:i,height:n,gradientUnits:s}=e;return Object.keys(t).reduce((e,o)=>{let a=t[o];return"Infinity"===a?r=1:"-Infinity"===a?r=0:(r="string"==typeof a?parseFloat(a):a,"string"==typeof a&&ss(a)&&(r*=.01,"pixels"===s&&("x1"!==o&&"x2"!==o&&"r2"!==o||(r*=i),"y1"!==o&&"y2"!==o||(r*=n)))),e[o]=r,e},{})}("linear"===sh(t)?{x1:su(t,"x1")||0,y1:su(t,"y1")||0,x2:su(t,"x2")||"100%",y2:su(t,"y2")||0}:{x1:su(t,"fx")||su(t,"cx")||"50%",y1:su(t,"fy")||su(t,"cy")||"50%",r1:0,x2:su(t,"cx")||"50%",y2:su(t,"cy")||"50%",r2:su(t,"r")||"50%"},tt(tt({},i),{},{gradientUnits:sc(t)}))),colorStops:function(t,e){let r=[],i=t.getElementsByTagName("stop"),n=so(e,1);for(let t=i.length;t--;)r.push(function(t,e){let r,i,n=t.getAttribute("style");if(n){let t=n.split(sa);""===t[t.length-1]&&t.pop();for(let e=t.length;e--;){let[n,s]=t[e].split(sl).map(t=>t.trim());"stop-color"===n?r=s:"stop-opacity"===n&&(i=s)}}let s=new rs(r||t.getAttribute("stop-color")||"rgb(0,0,0)");return{offset:so(t.getAttribute("offset"),0),color:s.toRgb(),opacity:si(parseFloat(i||t.getAttribute("stop-opacity")||""),1)*s.getAlpha()*e}}(i[t],n));return r}(t,r.opacity),gradientUnits:n,gradientTransform:na(t.getAttribute("gradientTransform")||"")},"pixels"===n?{offsetX:e.width/2-s.x,offsetY:e.height/2-s.y}:{offsetX:0,offsetY:0}))}constructor(t){let{type:e="linear",gradientUnits:r="pixels",coords:i={},colorStops:n=[],offsetX:s=0,offsetY:o=0,gradientTransform:a,id:l}=t||{};Object.assign(this,{type:e,gradientUnits:r,coords:tt(tt({},"radial"===e?sr:se),i),colorStops:n,offsetX:s,offsetY:o,gradientTransform:a,id:l?"".concat(l,"_").concat(t3()):t3()})}}Z(sd,"type","Gradient"),tY.setClass(sd,"gradient"),tY.setClass(sd,"linear"),tY.setClass(sd,"radial");let sf=["type","source","patternTransform"];class sg{get type(){return"pattern"}set type(t){ts("warn","Setting type has no effect",t)}isImageSource(){return!!this.source&&"string"==typeof this.source.src}isCanvasSource(){return!!this.source&&!!this.source.toDataURL}sourceToString(){return this.isImageSource()?this.source.src:this.isCanvasSource()?this.source.toDataURL():""}toLive(t){return this.source&&(!this.isImageSource()||this.source.complete&&0!==this.source.naturalWidth&&0!==this.source.naturalHeight)?t.createPattern(this.source,this.repeat):null}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{repeat:e,crossOrigin:r}=this;return tt(tt({},e_(this,t)),{},{type:"pattern",source:this.sourceToString(),repeat:e,crossOrigin:r,offsetX:eC(this.offsetX,tn.NUM_FRACTION_DIGITS),offsetY:eC(this.offsetY,tn.NUM_FRACTION_DIGITS),patternTransform:this.patternTransform?[...this.patternTransform]:null})}toSVG(t){let{width:e,height:r}=t,{source:i,repeat:n,id:s}=this,o=si(this.offsetX/e,0),a=si(this.offsetY/r,0),l="repeat-y"===n||"no-repeat"===n?1+Math.abs(o||0):si(i.width/e,0),h="repeat-x"===n||"no-repeat"===n?1+Math.abs(a||0):si(i.height/r,0);return[''),''),"\n"].join("\n")}static async fromObject(t,e){let{type:r,source:i,patternTransform:n}=t,s=te(t,sf),o=await ey(i,tt(tt({},e),{},{crossOrigin:s.crossOrigin}));return new this(tt(tt({},s),{},{patternTransform:n&&n.slice(0),source:o}))}constructor(t){Z(this,"repeat","repeat"),Z(this,"offsetX",0),Z(this,"offsetY",0),Z(this,"crossOrigin",""),this.id=t3(),Object.assign(this,t)}}Z(sg,"type","Pattern"),tY.setClass(sg),tY.setClass(sg,"pattern");class sp{_setBrushStyles(t){t.strokeStyle=this.color,t.lineWidth=this.width,t.lineCap=this.strokeLineCap,t.miterLimit=this.strokeMiterLimit,t.lineJoin=this.strokeLineJoin,t.setLineDash(this.strokeDashArray||[])}_saveAndTransform(t){let e=this.canvas.viewportTransform;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5])}needsFullRender(){return 1>new rs(this.color).getAlpha()||!!this.shadow}_setShadow(){if(!this.shadow||!this.canvas)return;let t=this.canvas,e=this.shadow,r=t.contextTop,i=t.getZoom()*t.getRetinaScaling();r.shadowColor=e.color,r.shadowBlur=e.blur*i,r.shadowOffsetX=e.offsetX*i,r.shadowOffsetY=e.offsetY*i}_resetShadow(){let t=this.canvas.contextTop;t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0}_isOutSideCanvas(t){return t.x<0||t.x>this.canvas.getWidth()||t.y<0||t.y>this.canvas.getHeight()}constructor(t){Z(this,"color","rgb(0, 0, 0)"),Z(this,"width",1),Z(this,"shadow",null),Z(this,"strokeLineCap","round"),Z(this,"strokeLineJoin","round"),Z(this,"strokeMiterLimit",10),Z(this,"strokeDashArray",null),Z(this,"limitedToCanvasSize",!1),this.canvas=t}}let sm=["path","left","top"],sv=["d"];class sy extends iW{_setPath(t,e){this.path=nI(Array.isArray(t)?t:nJ(t)),this.setBoundingBox(e)}_findCenterFromElement(){let t=this._calcBoundsFromPath();return new tJ(t.left+t.width/2,t.top+t.height/2)}_renderPathCommands(t){let e=-this.pathOffset.x,r=-this.pathOffset.y;for(let i of(t.beginPath(),this.path))switch(i[0]){case"L":t.lineTo(i[1]+e,i[2]+r);break;case"M":t.moveTo(i[1]+e,i[2]+r);break;case"C":t.bezierCurveTo(i[1]+e,i[2]+r,i[3]+e,i[4]+r,i[5]+e,i[6]+r);break;case"Q":t.quadraticCurveTo(i[1]+e,i[2]+r,i[3]+e,i[4]+r);break;case"Z":t.closePath()}}_render(t){this._renderPathCommands(t),this._renderPaintInOrder(t)}toString(){return"#")}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return tt(tt({},super.toObject(t)),{},{path:this.path.map(t=>t.slice())})}toDatalessObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=this.toObject(t);return this.sourcePath&&(delete e.path,e.sourcePath=this.sourcePath),e}_toSVG(){let t=n$(this.path,tn.NUM_FRACTION_DIGITS);return["\n')]}_getOffsetTransform(){let t=tn.NUM_FRACTION_DIGITS;return" translate(".concat(eC(-this.pathOffset.x,t),", ").concat(eC(-this.pathOffset.y,t),")")}toClipPathSVG(t){let e=this._getOffsetTransform();return" "+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})}toSVG(t){let e=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})}complexity(){return this.path.length}setDimensions(){this.setBoundingBox()}setBoundingBox(t){let{width:e,height:r,pathOffset:i}=this._calcDimensions();this.set({width:e,height:r,pathOffset:i}),t&&this.setPositionByOrigin(i,tw,tw)}_calcBoundsFromPath(){let t=[],e=0,r=0,i=0,n=0;for(let s of this.path)switch(s[0]){case"L":i=s[1],n=s[2],t.push({x:e,y:r},{x:i,y:n});break;case"M":i=s[1],n=s[2],e=i,r=n;break;case"C":t.push(...nL(i,n,s[1],s[2],s[3],s[4],s[5],s[6])),i=s[5],n=s[6];break;case"Q":t.push(...nL(i,n,s[1],s[2],s[1],s[2],s[3],s[4])),i=s[3],n=s[4];break;case"Z":i=e,n=r}return eH(t)}_calcDimensions(){let t=this._calcBoundsFromPath();return tt(tt({},t),{},{pathOffset:new tJ(t.left+t.width/2,t.top+t.height/2)})}static fromObject(t){return this._fromObject(t,{extraParam:"path"})}static async fromElement(t,e,r){let i=nh(t,this.ATTRIBUTE_NAMES,r),{d:n}=i;return new this(n,tt(tt(tt({},te(i,sv)),e),{},{left:void 0,top:void 0}))}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{path:r,left:i,top:n}=e,s=te(e,sm);super(),Object.assign(this,sy.ownDefaults),this.setOptions(s),this._setPath(t||[],!0),"number"==typeof i&&this.set(tC,i),"number"==typeof n&&this.set("top",n)}}Z(sy,"type","Path"),Z(sy,"cacheProperties",[...rY,"path","fillRule"]),Z(sy,"ATTRIBUTE_NAMES",[...i2,"d"]),tY.setClass(sy),tY.setSVGClass(sy);class sx extends sp{needsFullRender(){return super.needsFullRender()||this._hasStraightLine}static drawSegment(t,e,r){let i=e.midPointFrom(r);return t.quadraticCurveTo(e.x,e.y,i.x,i.y),i}onMouseDown(t,e){let{e:r}=e;this.canvas._isMainEvent(r)&&(this.drawStraightLine=!!this.straightLineKey&&r[this.straightLineKey],this._prepareForDrawing(t),this._addPoint(t),this._render())}onMouseMove(t,e){let{e:r}=e;if(this.canvas._isMainEvent(r)&&(this.drawStraightLine=!!this.straightLineKey&&r[this.straightLineKey],(!0!==this.limitedToCanvasSize||!this._isOutSideCanvas(t))&&this._addPoint(t)&&this._points.length>1))if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{let t=this._points,e=t.length,r=this.canvas.contextTop;this._saveAndTransform(r),this.oldEnd&&(r.beginPath(),r.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=sx.drawSegment(r,t[e-2],t[e-1]),r.stroke(),r.restore()}}onMouseUp(t){let{e:e}=t;return!this.canvas._isMainEvent(e)||(this.drawStraightLine=!1,this.oldEnd=void 0,this._finalizeAndAddPath(),!1)}_prepareForDrawing(t){this._reset(),this._addPoint(t),this.canvas.contextTop.moveTo(t.x,t.y)}_addPoint(t){return!(this._points.length>1&&t.eq(this._points[this._points.length-1]))&&(this.drawStraightLine&&this._points.length>1&&(this._hasStraightLine=!0,this._points.pop()),this._points.push(t),!0)}_reset(){this._points=[],this._setBrushStyles(this.canvas.contextTop),this._setShadow(),this._hasStraightLine=!1}_render(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.canvas.contextTop,e=this._points[0],r=this._points[1];if(this._saveAndTransform(t),t.beginPath(),2===this._points.length&&e.x===r.x&&e.y===r.y){let t=this.width/1e3;e.x-=t,r.x+=t}t.moveTo(e.x,e.y);for(let i=1;i=i&&s.push(r=t[e]);return s.push(t[n]),s}_finalizeAndAddPath(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));let t=this.convertPointsToSVGPath(this._points);if("M 0 0 Q 0 0 0 0 L 0 0"===n$(t))return void this.canvas.requestRenderAll();let e=this.createPath(t);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire("before:path:created",{path:e}),this.canvas.add(e),this.canvas.requestRenderAll(),e.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:e})}constructor(t){super(t),Z(this,"decimate",.4),Z(this,"drawStraightLine",!1),Z(this,"straightLineKey","shiftKey"),this._points=[],this._hasStraightLine=!1}}let sb=["left","top","radius"],s_=["radius","startAngle","endAngle","counterClockwise"];class sw extends iW{static getDefaults(){return tt(tt({},super.getDefaults()),sw.ownDefaults)}_set(t,e){return super._set(t,e),"radius"===t&&this.setRadius(e),this}_render(t){t.beginPath(),t.arc(0,0,this.radius,ee(this.startAngle),ee(this.endAngle),this.counterClockwise),this._renderPaintInOrder(t)}getRadiusX(){return this.get("radius")*this.get(tI)}getRadiusY(){return this.get("radius")*this.get(tB)}setRadius(t){this.radius=t,this.set({width:2*t,height:2*t})}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return super.toObject([...s_,...t])}_toSVG(){let t=(this.endAngle-this.startAngle)%360;if(0===t)return["\n'];{let{radius:e}=this,r=ee(this.startAngle),i=ee(this.endAngle),n=tK(r)*e,s=tQ(r)*e,o=tK(i)*e,a=tQ(i)*e,l=+!this.counterClockwise;return['180)," ").concat(l," ").concat(o," ").concat(a,'" '),"COMMON_PARTS"," />\n"]}}static async fromElement(t,e,r){let i=nh(t,this.ATTRIBUTE_NAMES,r),{left:n=0,top:s=0,radius:o=0}=i;return new this(tt(tt({},te(i,sb)),{},{radius:o,left:n-o,top:s-o}))}static fromObject(t){return super._fromObject(t)}constructor(t){super(),Object.assign(this,sw.ownDefaults),this.setOptions(t)}}Z(sw,"type","Circle"),Z(sw,"cacheProperties",[...rY,...s_]),Z(sw,"ownDefaults",{radius:0,startAngle:0,endAngle:360,counterClockwise:!1}),Z(sw,"ATTRIBUTE_NAMES",["cx","cy","r",...i2]),tY.setClass(sw),tY.setSVGClass(sw);let sC=["x1","y1","x2","y2"],sS=["x1","y1","x2","y2"],sT=["x1","x2","y1","y2"];class sO extends iW{_setWidthHeight(){let{x1:t,y1:e,x2:r,y2:i}=this;this.width=Math.abs(r-t),this.height=Math.abs(i-e);let{left:n,top:s,width:o,height:a}=eH([{x:t,y:e},{x:r,y:i}]),l=new tJ(n+o/2,s+a/2);this.setPositionByOrigin(l,tw,tw)}_set(t,e){return super._set(t,e),sT.includes(t)&&this._setWidthHeight(),this}_render(t){var e;t.beginPath();let r=this.calcLinePoints();t.moveTo(r.x1,r.y1),t.lineTo(r.x2,r.y2),t.lineWidth=this.strokeWidth;let i=t.strokeStyle;eT(this.stroke)?t.strokeStyle=this.stroke.toLive(t):t.strokeStyle=null!=(e=this.stroke)?e:t.fillStyle,this.stroke&&this._renderStroke(t),t.strokeStyle=i}_findCenterFromElement(){return new tJ((this.x1+this.x2)/2,(this.y1+this.y2)/2)}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return tt(tt({},super.toObject(t)),this.calcLinePoints())}_getNonTransformedDimensions(){let t=super._getNonTransformedDimensions();return"butt"===this.strokeLineCap&&(0===this.width&&(t.y-=this.strokeWidth),0===this.height&&(t.x-=this.strokeWidth)),t}calcLinePoints(){let{x1:t,x2:e,y1:r,y2:i,width:n,height:s}=this,o=t<=e?-1:1,a=r<=i?-1:1;return{x1:o*n/2,x2:-(o*n)/2,y1:a*s/2,y2:-(a*s)/2}}_toSVG(){let{x1:t,x2:e,y1:r,y2:i}=this.calcLinePoints();return["\n')]}static async fromElement(t,e,r){let i=nh(t,this.ATTRIBUTE_NAMES,r),{x1:n=0,y1:s=0,x2:o=0,y2:a=0}=i;return new this([n,s,o,a],te(i,sC))}static fromObject(t){let{x1:e,y1:r,x2:i,y2:n}=t,s=te(t,sS);return this._fromObject(tt(tt({},s),{},{points:[e,r,i,n]}),{extraParam:"points"})}constructor(){let[t,e,r,i]=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0,0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),Object.assign(this,sO.ownDefaults),this.setOptions(n),this.x1=t,this.x2=r,this.y1=e,this.y2=i,this._setWidthHeight();let{left:s,top:o}=n;"number"==typeof s&&this.set(tC,s),"number"==typeof o&&this.set("top",o)}}Z(sO,"type","Line"),Z(sO,"cacheProperties",[...rY,...sT]),Z(sO,"ATTRIBUTE_NAMES",i2.concat(sT)),tY.setClass(sO),tY.setSVGClass(sO);class sk extends iW{static getDefaults(){return tt(tt({},super.getDefaults()),sk.ownDefaults)}_render(t){let e=this.width/2,r=this.height/2;t.beginPath(),t.moveTo(-e,r),t.lineTo(0,-r),t.lineTo(e,r),t.closePath(),this._renderPaintInOrder(t)}_toSVG(){let t=this.width/2,e=this.height/2;return["']}constructor(t){super(),Object.assign(this,sk.ownDefaults),this.setOptions(t)}}Z(sk,"type","Triangle"),Z(sk,"ownDefaults",{width:100,height:100}),tY.setClass(sk),tY.setSVGClass(sk);let sM=["rx","ry"];class sE extends iW{static getDefaults(){return tt(tt({},super.getDefaults()),sE.ownDefaults)}_set(t,e){switch(super._set(t,e),t){case"rx":this.rx=e,this.set("width",2*e);break;case"ry":this.ry=e,this.set("height",2*e)}return this}getRx(){return this.get("rx")*this.get(tI)}getRy(){return this.get("ry")*this.get(tB)}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return super.toObject([...sM,...t])}_toSVG(){return["\n')]}_render(t){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(0,0,this.rx,0,tx,!1),t.restore(),this._renderPaintInOrder(t)}static async fromElement(t,e,r){let i=nh(t,this.ATTRIBUTE_NAMES,r);return i.left=(i.left||0)-i.rx,i.top=(i.top||0)-i.ry,new this(i)}constructor(t){super(),Object.assign(this,sE.ownDefaults),this.setOptions(t)}}Z(sE,"type","Ellipse"),Z(sE,"cacheProperties",[...rY,...sM]),Z(sE,"ownDefaults",{rx:0,ry:0}),Z(sE,"ATTRIBUTE_NAMES",[...i2,"cx","cy","rx","ry"]),tY.setClass(sE),tY.setSVGClass(sE);let sD=["left","top"],sj={exactBoundingBox:!1};class sA extends iW{static getDefaults(){return tt(tt({},super.getDefaults()),sA.ownDefaults)}isOpen(){return!0}_projectStrokeOnPoints(t){return iz(this.points,t,this.isOpen())}_calcDimensions(t){t=tt({scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,strokeLineCap:this.strokeLineCap,strokeLineJoin:this.strokeLineJoin,strokeMiterLimit:this.strokeMiterLimit,strokeUniform:this.strokeUniform,strokeWidth:this.strokeWidth},t||{});let e=this.exactBoundingBox?this._projectStrokeOnPoints(t).map(t=>t.projectedPoint):this.points;if(0===e.length)return{left:0,top:0,width:0,height:0,pathOffset:new tJ,strokeOffset:new tJ,strokeDiff:new tJ};let r=eH(e),i=em(tt(tt({},t),{},{scaleX:1,scaleY:1})),n=eH(this.points.map(t=>en(t,i,!0))),s=new tJ(this.scaleX,this.scaleY),o=r.left+r.width/2,a=r.top+r.height/2;return this.exactBoundingBox&&(o-=a*Math.tan(ee(this.skewX)),a-=o*Math.tan(ee(this.skewY))),tt(tt({},r),{},{pathOffset:new tJ(o,a),strokeOffset:new tJ(n.left,n.top).subtract(new tJ(r.left,r.top)).multiply(s),strokeDiff:new tJ(r.width,r.height).subtract(new tJ(n.width,n.height)).multiply(s)})}_findCenterFromElement(){let t=eH(this.points);return new tJ(t.left+t.width/2,t.top+t.height/2)}setDimensions(){this.setBoundingBox()}setBoundingBox(t){let{left:e,top:r,width:i,height:n,pathOffset:s,strokeOffset:o,strokeDiff:a}=this._calcDimensions();this.set({width:i,height:n,pathOffset:s,strokeOffset:o,strokeDiff:a}),t&&this.setPositionByOrigin(new tJ(e+i/2,r+n/2),tw,tw)}isStrokeAccountedForInDimensions(){return this.exactBoundingBox}_getNonTransformedDimensions(){return this.exactBoundingBox?new tJ(this.width,this.height):super._getNonTransformedDimensions()}_getTransformedDimensions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.exactBoundingBox){var e,r,i,n;let s;if(Object.keys(t).some(t=>this.strokeUniform||this.constructor.layoutProperties.includes(t))){let{width:i,height:n}=this._calcDimensions(t);s=new tJ(null!=(e=t.width)?e:i,null!=(r=t.height)?r:n)}else s=new tJ(null!=(i=t.width)?i:this.width,null!=(n=t.height)?n:this.height);return s.multiply(new tJ(t.scaleX||this.scaleX,t.scaleY||this.scaleY))}return super._getTransformedDimensions(t)}_set(t,e){let r=this.initialized&&this[t]!==e,i=super._set(t,e);return this.exactBoundingBox&&r&&((t===tI||t===tB)&&this.strokeUniform&&this.constructor.layoutProperties.includes("strokeUniform")||this.constructor.layoutProperties.includes(t))&&this.setDimensions(),i}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return tt(tt({},super.toObject(t)),{},{points:this.points.map(t=>{let{x:e,y:r}=t;return{x:e,y:r}})})}_toSVG(){let t=[],e=this.pathOffset.x,r=this.pathOffset.y,i=tn.NUM_FRACTION_DIGITS;for(let n=0,s=this.points.length;n\n')]}_render(t){let e=this.points.length,r=this.pathOffset.x,i=this.pathOffset.y;if(e&&!isNaN(this.points[e-1].y)){t.beginPath(),t.moveTo(this.points[0].x-r,this.points[0].y-i);for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),Z(this,"strokeDiff",void 0),Object.assign(this,sA.ownDefaults),this.setOptions(e),this.points=t;let{left:r,top:i}=e;this.initialized=!0,this.setBoundingBox(!0),"number"==typeof r&&this.set(tC,r),"number"==typeof i&&this.set("top",i)}}Z(sA,"ownDefaults",sj),Z(sA,"type","Polyline"),Z(sA,"layoutProperties",[tN,tW,"strokeLineCap","strokeLineJoin","strokeMiterLimit","strokeWidth","strokeUniform","points"]),Z(sA,"cacheProperties",[...rY,"points"]),Z(sA,"ATTRIBUTE_NAMES",[...i2]),tY.setClass(sA),tY.setSVGClass(sA);class sP extends sA{isOpen(){return!1}}Z(sP,"ownDefaults",sj),Z(sP,"type","Polygon"),tY.setClass(sP),tY.setSVGClass(sP);class sF extends iW{isEmptyStyles(t){if(!this.styles||void 0!==t&&!this.styles[t])return!0;let e=void 0===t?this.styles:{line:this.styles[t]};for(let t in e)for(let r in e[t])for(let i in e[t][r])return!1;return!0}styleHas(t,e){if(!this.styles||void 0!==e&&!this.styles[e])return!1;let r=void 0===e?this.styles:{0:this.styles[e]};for(let e in r)for(let i in r[e])if(void 0!==r[e][i][t])return!0;return!1}cleanStyle(t){if(!this.styles)return!1;let e=this.styles,r,i,n=0,s=!0,o=0;for(let o in e){for(let a in r=0,e[o]){let l=e[o][a]||{};n++,void 0!==l[t]?(i?l[t]!==i&&(s=!1):i=l[t],l[t]===this[t]&&delete l[t]):s=!1,0!==Object.keys(l).length?r++:delete e[o][a]}0===r&&delete e[o]}for(let t=0;tvoid 0!==t);this._setStyleDeclaration(r,i,n)}getSelectionStyles(t,e,r){let i=[];for(let n=t;n<(e||t);n++)i.push(this.getStyleAtPosition(n,r));return i}getStyleAtPosition(t,e){let{lineIndex:r,charIndex:i}=this.get2DCursorLocation(t);return e?this.getCompleteStyleDeclaration(r,i):this._getStyleDeclaration(r,i)}setSelectionStyles(t,e,r){for(let i=e;i<(r||e);i++)this._extendStyles(i,t);this._forceClearCache=!0}_getStyleDeclaration(t,e){var r;let i=this.styles&&this.styles[t];return i&&null!=(r=i[e])?r:{}}getCompleteStyleDeclaration(t,e){return tt(tt({},e_(this,this.constructor._styleProperties)),this._getStyleDeclaration(t,e))}_setStyleDeclaration(t,e,r){this.styles[t][e]=r}_deleteStyleDeclaration(t,e){delete this.styles[t][e]}_getLineStyle(t){return!!this.styles[t]}_setLineStyle(t){this.styles[t]={}}_deleteLineStyle(t){delete this.styles[t]}}Z(sF,"_styleProperties",rm);let sL=/ +/g,sR=/"/g;function sI(t,e,r,i,n){return" ".concat(function(t,e){let{left:r,top:i,width:n,height:s}=e,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:tn.NUM_FRACTION_DIGITS,a=rl(tU,t,!1),[l,h,c,u]=[r,i,n,s].map(t=>eC(t,o));return"')}(t,{left:e,top:r,width:i,height:n}),"\n")}let sB=["textAnchor","textDecoration","dx","dy","top","left","fontSize","strokeWidth"];class sN extends sF{static getDefaults(){return tt(tt({},super.getDefaults()),sN.ownDefaults)}setPathInfo(){let t=this.path;t&&(t.segmentsInfo=nY(t.path))}_splitText(){let t=this._splitTextIntoLines(this.text);return this.textLines=t.lines,this._textLines=t.graphemeLines,this._unwrappedTextLines=t._unwrappedLines,this._text=t.graphemeText,t}initDimensions(){this._splitText(),this._clearCache(),this.dirty=!0,this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),this.textAlign.includes(rv)&&this.enlargeSpaces()}enlargeSpaces(){let t,e,r,i,n,s,o;for(let a=0,l=this._textLines.length;a')}_getCacheCanvasDimensions(){let t=super._getCacheCanvasDimensions(),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t}_render(t){let e=this.path;e&&!e.isNotVisible()&&e._render(t),this._setTextStyles(t),this._renderTextLinesBackground(t),this._renderTextDecoration(t,"underline"),this._renderText(t),this._renderTextDecoration(t,"overline"),this._renderTextDecoration(t,"linethrough")}_renderText(t){this.paintFirst===tH?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))}_setTextStyles(t,e,r){if(t.textBaseline="alphabetic",this.path)switch(this.pathAlign){case tw:t.textBaseline="middle";break;case"ascender":t.textBaseline="top";break;case"descender":t.textBaseline=tS}t.font=this._getFontDeclaration(e,r)}calcTextWidth(){let t=this.getLineWidth(0);for(let e=1,r=this._textLines.length;et&&(t=r)}return t}_renderTextLine(t,e,r,i,n,s){this._renderChars(t,e,r,i,n,s)}_renderTextLinesBackground(t){if(!this.textBackgroundColor&&!this.styleHas("textBackgroundColor"))return;let e=t.fillStyle,r=this._getLeftOffset(),i=this._getTopOffset();for(let e=0,n=this._textLines.length;e=0:ie?t%=e:t<0&&(t+=e),this._setGraphemeOnPath(t,r),t+=r.kernedWidth}return{width:i,numOfSpaces:0}}_setGraphemeOnPath(t,e){let r=t+e.kernedWidth/2,i=this.path,n=nz(i.path,r,i.segmentsInfo);e.renderLeft=n.x-i.pathOffset.x,e.renderTop=n.y-i.pathOffset.y,e.angle=n.angle+(this.pathSide===tT?Math.PI:0)}_getGraphemeBox(t,e,r,i,n){let s=this.getCompleteStyleDeclaration(e,r),o=i?this.getCompleteStyleDeclaration(e,r-1):{},a=this._measureChar(t,s,i,o),l,h=a.kernedWidth,c=a.width;0!==this.charSpacing&&(c+=l=this._getWidthOfCharSpacing(),h+=l);let u={width:c,left:0,height:s.fontSize,kernedWidth:h,deltaY:s.deltaY};if(r>0&&!n){let t=this.__charBounds[e][r-1];u.left=t.left+t.width+a.kernedWidth-a.width}return u}getHeightOfLine(t){if(this.__lineHeights[t])return this.__lineHeights[t];let e=this.getHeightOfChar(t,0);for(let r=1,i=this._textLines[t].length;r0){let e=this.fontSize*y/1e3,r=i+d+f;"rtl"===this.direction&&(r=this.width-r-g),p&&m&&y&&(t.fillStyle=m,t.fillRect(r,w+a*C+S-o*e,g,e)),f=s.left,g=s.width,p=x,y=_,m=b,C=h,S=c}else g+=s.kernedWidth}let T=i+d+f;"rtl"===this.direction&&(T=this.width-T-g),t.fillStyle=b;let O=this.fontSize*_/1e3;x&&b&&_&&t.fillRect(T,w+a*C+S-o*O,g-s,O),r+=h}this._removeShadow(t)}_getFontDeclaration(){let{fontFamily:t=this.fontFamily,fontStyle:e=this.fontStyle,fontWeight:r=this.fontWeight,fontSize:i=this.fontSize}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,s=t.includes("'")||t.includes('"')||t.includes(",")||sN.genericFonts.includes(t.toLowerCase())?t:'"'.concat(t,'"');return[e,r,"".concat(n?this.CACHE_FONT_SIZE:i,"px"),s].join(" ")}render(t){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._forceClearCache&&this.initDimensions(),super.render(t)))}graphemeSplit(t){return iK(t)}_splitTextIntoLines(t){let e=t.split(this._reNewline),r=Array(e.length),i=["\n"],n=[];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[];return tt(tt({},super.toObject([...rp,...t])),{},{styles:i0(this.styles,this.text)},this.path?{path:this.path.toObject()}:{})}set(t,e){let{textLayoutProperties:r}=this.constructor;super.set(t,e);let i=!1,n=!1;if("object"==typeof t)for(let e in t)"path"===e&&this.setPathInfo(),i=i||r.includes(e),n=n||"path"===e;else i=r.includes(t),n="path"===t;return n&&this.setPathInfo(),i&&this.initialized&&(this.initDimensions(),this.setCoords()),this}complexity(){return 1}static async fromElement(t,e,r){let i=nh(t,sN.ATTRIBUTE_NAMES,r),n=tt(tt({},e),i),{textAnchor:s=tC,textDecoration:o="",dx:a=0,dy:l=0,top:h=0,left:c=0,fontSize:u=16,strokeWidth:d=1}=n,f=te(n,sB),g=new this((t.textContent||"").replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," "),tt({left:c+a,top:h+l,underline:o.includes("underline"),overline:o.includes("overline"),linethrough:o.includes("line-through"),strokeWidth:0,fontSize:u},f)),p=g.getScaledHeight()/g.height,m=((g.height+g.strokeWidth)*g.lineHeight-g.height)*p,y=g.getScaledHeight()+m,x=0;return s===tw&&(x=g.getScaledWidth()/2),s===tT&&(x=g.getScaledWidth()),g.set({left:g.left-x,top:g.top-(y-g.fontSize*(.07+g._fontSizeFraction))/g.lineHeight,strokeWidth:d}),g}static fromObject(t){return this._fromObject(tt(tt({},t),{},{styles:i1(t.styles||{},t.text)}),{extraParam:"text"})}constructor(t,e){super(),Z(this,"__charBounds",[]),Object.assign(this,sN.ownDefaults),this.setOptions(e),this.styles||(this.styles={}),this.text=t,this.initialized=!0,this.path&&this.setPathInfo(),this.initDimensions(),this.setCoords()}}Z(sN,"textLayoutProperties",rg),Z(sN,"cacheProperties",[...rY,...rp]),Z(sN,"ownDefaults",{_reNewline:tk,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:tC,fontStyle:"normal",lineHeight:1.16,textBackgroundColor:"",stroke:null,shadow:null,path:void 0,pathStartOffset:0,pathSide:tC,pathAlign:"baseline",charSpacing:0,deltaY:0,direction:"ltr",CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.28167,overline:-.81333},_fontSizeMult:1.13,[ru]:66.667}),Z(sN,"type","Text"),Z(sN,"genericFonts",["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]),Z(sN,"ATTRIBUTE_NAMES",i2.concat("x","y","dx","dy","font-family","font-style","font-weight","font-size","letter-spacing","text-decoration","text-anchor")),iN(sN,[class extends rh{_toSVG(){let t=this._getSVGLeftTopOffsets(),e=this._getSVGTextAndBg(t.textTop,t.textLeft);return this._wrapSVGTextAndBg(e)}toSVG(t){let e=this._createBaseSVGMarkup(this._toSVG(),{reviver:t,noStyle:!0,withShadow:!0}),r=this.path;return r?e+r._createBaseSVGMarkup(r._toSVG(),{reviver:t,withShadow:!0,additionalTransform:eS(this.calcOwnMatrix())}):e}_getSVGLeftTopOffsets(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}}_wrapSVGTextAndBg(t){let{textBgRects:e,textSpans:r}=t,i=this.getSvgTextDecoration(this);return[e.join(""),' ",r.join(""),"\n"]}_getSVGTextAndBg(t,e){let r=[],i=[],n,s=t;this.backgroundColor&&i.push(...sI(this.backgroundColor,-this.width/2,-this.height/2,this.width,this.height));for(let t=0,o=this._textLines.length;t").concat(iq(t),"")}_setSVGTextLineText(t,e,r,i){let n=this.getHeightOfLine(e),s=this.textAlign.includes(rv),o=this._textLines[e],a,l,h,c,u,d="",f=0;i+=n*(1-this._fontSizeFraction)/this.lineHeight;for(let n=0,g=o.length-1;n<=g;n++)u=n===g||this.charSpacing||this.path,d+=o[n],h=this.__charBounds[e][n],0===f?(r+=h.kernedWidth-h.width,f+=h.width):f+=h.kernedWidth,s&&!u&&this._reSpaceAndTab.test(o[n])&&(u=!0),u||(u=i$(a=a||this.getCompleteStyleDeclaration(e,n),l=this.getCompleteStyleDeclaration(e,n+1),!0)),u&&(c=this._getStyleDeclaration(e,n),t.push(this._createTextCharSpan(d,c,r,i,h)),d="",a=l,"rtl"===this.direction?r-=f:r+=f,f=0)}_setSVGTextLineBg(t,e,r,i){let n=this._textLines[e],s=this.getHeightOfLine(e)/this.lineHeight,o,a=0,l=0,h=this.getValueOfPropertyAt(e,0,"textBackgroundColor");for(let c=0;ct[e.replace("-","")]).join(" ")}}]),tY.setClass(sN),tY.setSVGClass(sN);class sW{isPointerOverSelection(t){let e=this.target,r=e.getSelectionStartFromPointer(t);return e.isEditing&&r>=e.selectionStart&&r<=e.selectionEnd&&e.selectionStart{b.remove()},eD(t.target||this.target.hiddenTextarea).body.appendChild(b),null==(r=t.dataTransfer)||r.setDragImage(b,p.x,p.y)}onDragStart(t){this.__dragStartFired=!0;let e=this.target,r=this.isActive();if(r&&t.dataTransfer){let r=this.__dragStartSelection={selectionStart:e.selectionStart,selectionEnd:e.selectionEnd},i=e._text.slice(r.selectionStart,r.selectionEnd).join(""),n=tt({text:e.text,value:i},r);t.dataTransfer.setData("text/plain",i),t.dataTransfer.setData("application/fabric",JSON.stringify({value:i,styles:e.getSelectionStyles(r.selectionStart,r.selectionEnd,!0)})),t.dataTransfer.effectAllowed="copyMove",this.setDragImage(t,n)}return e.abortCursorAnimation(),r}canDrop(t){if(this.target.editable&&!this.target.getActiveControl()&&!t.defaultPrevented){if(this.isActive()&&this.__dragStartSelection){let e=this.target.getSelectionStartFromPointer(t),r=this.__dragStartSelection;return er.selectionEnd}return!0}return!1}targetCanDrop(t){return this.target.canDrop(t)}dragEnterHandler(t){let{e:e}=t,r=this.targetCanDrop(e);!this.__isDraggingOver&&r&&(this.__isDraggingOver=!0)}dragOverHandler(t){let{e:e}=t,r=this.targetCanDrop(e);!this.__isDraggingOver&&r?this.__isDraggingOver=!0:this.__isDraggingOver&&!r&&(this.__isDraggingOver=!1),this.__isDraggingOver&&(e.preventDefault(),t.canDrop=!0,t.dropTarget=this.target)}dragLeaveHandler(){(this.__isDraggingOver||this.isActive())&&(this.__isDraggingOver=!1)}dropHandler(t){var e;let{e:r}=t,i=r.defaultPrevented;this.__isDraggingOver=!1,r.preventDefault();let n=null==(e=r.dataTransfer)?void 0:e.getData("text/plain");if(n&&!i){let e=this.target,i=e.canvas,s=e.getSelectionStartFromPointer(r),{styles:o}=r.dataTransfer.types.includes("application/fabric")?JSON.parse(r.dataTransfer.getData("application/fabric")):{},a=n[Math.max(0,n.length-1)];if(this.__dragStartSelection){let t=this.__dragStartSelection.selectionStart,r=this.__dragStartSelection.selectionEnd;s>t&&s<=r?s=t:s>r&&(s-=r-t),e.removeChars(t,r),delete this.__dragStartSelection}e._reNewline.test(a)&&(e._reNewline.test(e._text[s])||s===e._text.length)&&(n=n.trimEnd()),t.didDrop=!0,t.dropTarget=e,e.insertChars(n,o,s),i.setActiveObject(e),e.enterEditing(r),e.selectionStart=Math.min(s+0,e._text.length),e.selectionEnd=Math.min(e.selectionStart+n.length,e._text.length),e.hiddenTextarea.value=e.text,e._updateTextarea(),e.hiddenTextarea.focus(),e.fire(tL,{index:s+0,action:"drop"}),i.fire("text:changed",{target:e}),i.contextTopDirty=!0,i.requestRenderAll()}}dragEndHandler(t){let{e:e}=t;if(this.isActive()&&this.__dragStartFired&&this.__dragStartSelection){var r;let t=this.target,i=this.target.canvas,{selectionStart:n,selectionEnd:s}=this.__dragStartSelection,o=(null==(r=e.dataTransfer)?void 0:r.dropEffect)||tO;o===tO?(t.selectionStart=n,t.selectionEnd=s,t._updateTextarea(),t.hiddenTextarea.focus()):(t.clearContextTop(),"move"===o&&(t.removeChars(n,s),t.selectionStart=t.selectionEnd=n,t.hiddenTextarea&&(t.hiddenTextarea.value=t.text),t._updateTextarea(),t.fire(tL,{index:n,action:"dragend"}),i.fire("text:changed",{target:t}),i.requestRenderAll()),t.exitEditing())}this.__dragImageDisposer&&this.__dragImageDisposer(),delete this.__dragImageDisposer,delete this.__dragStartSelection,this.__isDraggingOver=!1}dispose(){this._dispose&&this._dispose()}constructor(t){Z(this,"target",void 0),Z(this,"__mouseDownInPlace",!1),Z(this,"__dragStartFired",!1),Z(this,"__isDraggingOver",!1),Z(this,"__dragStartSelection",void 0),Z(this,"__dragImageDisposer",void 0),Z(this,"_dispose",void 0),this.target=t;let e=[this.target.on("dragenter",this.dragEnterHandler.bind(this)),this.target.on("dragover",this.dragOverHandler.bind(this)),this.target.on("dragleave",this.dragLeaveHandler.bind(this)),this.target.on("dragend",this.dragEndHandler.bind(this)),this.target.on("drop",this.dropHandler.bind(this))];this._dispose=()=>{e.forEach(t=>t()),this._dispose=void 0}}}let sU=/[ \n\.,;!\?\-]/;class sH extends sN{initBehavior(){this._tick=this._tick.bind(this),this._onTickComplete=this._onTickComplete.bind(this),this.updateSelectionOnMouseMove=this.updateSelectionOnMouseMove.bind(this)}onDeselect(t){return this.isEditing&&this.exitEditing(),this.selected=!1,super.onDeselect(t)}_animateCursor(t){let{toValue:e,duration:r,delay:i,onComplete:n}=t;return r8({startValue:this._currentCursorOpacity,endValue:e,duration:r,delay:i,onComplete:n,abort:()=>!this.canvas||this.selectionStart!==this.selectionEnd,onChange:t=>{this._currentCursorOpacity=t,this.renderCursorOrSelection()}})}_tick(t){this._currentTickState=this._animateCursor({toValue:0,duration:this.cursorDuration/2,delay:Math.max(t||0,100),onComplete:this._onTickComplete})}_onTickComplete(){var t;null==(t=this._currentTickCompleteState)||t.abort(),this._currentTickCompleteState=this._animateCursor({toValue:1,duration:this.cursorDuration,onComplete:this._tick})}initDelayedCursor(t){this.abortCursorAnimation(),this._tick(t?0:this.cursorDelay)}abortCursorAnimation(){let t=!1;[this._currentTickState,this._currentTickCompleteState].forEach(e=>{e&&!e.isDone()&&(t=!0,e.abort())}),this._currentCursorOpacity=1,t&&this.clearContextTop()}restartCursorIfNeeded(){[this._currentTickState,this._currentTickCompleteState].some(t=>!t||t.isDone())&&this.initDelayedCursor()}selectAll(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this}cmdAll(){this.selectAll(),this.renderCursorOrSelection()}getSelectedText(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")}findWordBoundaryLeft(t){let e=0,r=t-1;if(this._reSpace.test(this._text[r]))for(;this._reSpace.test(this._text[r]);)e++,r--;for(;/\S/.test(this._text[r])&&r>-1;)e++,r--;return t-e}findWordBoundaryRight(t){let e=0,r=t;if(this._reSpace.test(this._text[r]))for(;this._reSpace.test(this._text[r]);)e++,r++;for(;/\S/.test(this._text[r])&&r-1;)e++,r--;return t-e}findLineBoundaryRight(t){let e=0,r=t;for(;!/\n/.test(this._text[r])&&r0&&this._reSpace.test(r[t])&&(-1===e||!tk.test(r[t-1]))?t-1:t,n=r[i];for(;i>0&&ithis.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=r):(this.selectionStart=r,this.selectionEnd=this.__selectionStartOnMouseDown),this.selectionStart===i&&this.selectionEnd===n||(this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}_setEditingProps(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0}fromStringToGraphemeSelection(t,e,r){let i=r.slice(0,t),n=this.graphemeSplit(i).length;if(t===e)return{selectionStart:n,selectionEnd:n};let s=r.slice(t,e);return{selectionStart:n,selectionEnd:n+this.graphemeSplit(s).length}}fromGraphemeToStringSelection(t,e,r){let i=r.slice(0,t).join("").length;return t===e?{selectionStart:i,selectionEnd:i}:{selectionStart:i,selectionEnd:i+r.slice(t,e).join("").length}}_updateTextarea(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){let t=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=t.selectionStart,this.hiddenTextarea.selectionEnd=t.selectionEnd}this.updateTextareaPosition()}}updateFromTextArea(){if(!this.hiddenTextarea)return;this.cursorOffsetCache={};let t=this.hiddenTextarea;this.text=t.value,this.set("dirty",!0),this.initDimensions(),this.setCoords();let e=this.fromStringToGraphemeSelection(t.selectionStart,t.selectionEnd,t.value);this.selectionEnd=this.selectionStart=e.selectionEnd,this.inCompositionMode||(this.selectionStart=e.selectionStart),this.updateTextareaPosition()}updateTextareaPosition(){if(this.selectionStart===this.selectionEnd){let t=this._calcTextareaPosition();this.hiddenTextarea.style.left=t.left,this.hiddenTextarea.style.top=t.top}}_calcTextareaPosition(){if(!this.canvas)return{left:"1px",top:"1px"};let t=this.inCompositionMode?this.compositionStart:this.selectionStart,e=this._getCursorBoundaries(t),r=this.get2DCursorLocation(t),i=r.lineIndex,n=r.charIndex,s=this.getValueOfPropertyAt(i,n,"fontSize")*this.lineHeight,o=e.leftOffset,a=this.getCanvasRetinaScaling(),l=this.canvas.upperCanvasEl,h=l.width/a,c=l.height/a,u=h-s,d=c-s,f=new tJ(e.left+o,e.top+e.topOffset+s).transform(this.calcTransformMatrix()).transform(this.canvas.viewportTransform).multiply(new tJ(l.clientWidth/h,l.clientHeight/c));return f.x<0&&(f.x=0),f.x>u&&(f.x=u),f.y<0&&(f.y=0),f.y>d&&(f.y=d),f.x+=this.canvas._offset.left,f.y+=this.canvas._offset.top,{left:"".concat(f.x,"px"),top:"".concat(f.y,"px"),fontSize:"".concat(s,"px"),charHeight:s}}_saveEditingProps(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}}_restoreEditingProps(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor||this.canvas.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor||this.canvas.moveCursor),delete this._savedProps)}_exitEditing(){let t=this.hiddenTextarea;this.selected=!1,this.isEditing=!1,t&&(t.blur&&t.blur(),t.parentNode&&t.parentNode.removeChild(t)),this.hiddenTextarea=null,this.abortCursorAnimation(),this.selectionStart!==this.selectionEnd&&this.clearContextTop()}exitEditingImpl(){this._exitEditing(),this.selectionEnd=this.selectionStart,this._restoreEditingProps(),this._forceClearCache&&(this.initDimensions(),this.setCoords())}exitEditing(){let t=this._textBeforeEdit!==this.text;return this.exitEditingImpl(),this.fire("editing:exited"),t&&this.fire(tX),this.canvas&&(this.canvas.fire("text:editing:exited",{target:this}),t&&this.canvas.fire("object:modified",{target:this})),this}_removeExtraneousStyles(){for(let t in this.styles)this._textLines[t]||delete this.styles[t]}removeStyleFromTo(t,e){let{lineIndex:r,charIndex:i}=this.get2DCursorLocation(t,!0),{lineIndex:n,charIndex:s}=this.get2DCursorLocation(e,!0);if(r!==n){if(this.styles[r])for(let t=i;t=s&&(t[r-e]=t[i],delete t[i])}}}shiftLineStyles(t,e){let r=Object.assign({},this.styles);for(let i in this.styles){let n=parseInt(i,10);n>t&&(this.styles[n+e]=r[n],r[n-e]||delete this.styles[n])}}insertNewlineStyleObject(t,e,r,i){let n={},s=this._unwrappedTextLines[t].length,o=s===e,a=!1;r||(r=1),this.shiftLineStyles(t,r);let l=this.styles[t]?this.styles[t][0===e?e:e-1]:void 0;for(let r in this.styles[t]){let i=parseInt(r,10);i>=e&&(a=!0,n[i-e]=this.styles[t][r],o&&0===e||delete this.styles[t][r])}let h=!1;for(a&&!o&&(this.styles[t+r]=n,h=!0),(h||s>e)&&r--;r>0;)i&&i[r-1]?this.styles[t+r]={0:tt({},i[r-1])}:l?this.styles[t+r]={0:tt({},l)}:delete this.styles[t+r],r--;this._forceClearCache=!0}insertCharStyleObject(t,e,r,i){this.styles||(this.styles={});let n=this.styles[t],s=n?tt({},n):{};for(let t in r||(r=1),s){let i=parseInt(t,10);i>=e&&(n[i+r]=s[i],s[i-r]||delete n[i])}if(this._forceClearCache=!0,i){for(;r--;)Object.keys(i[r]).length&&(this.styles[t]||(this.styles[t]={}),this.styles[t][e+r]=tt({},i[r]));return}if(!n)return;let o=n[e?e-1:1];for(;o&&r--;)this.styles[t][e+r]=tt({},o)}insertNewStyleBlock(t,e,r){let i=this.get2DCursorLocation(e,!0),n=[0],s,o=0;for(let e=0;e0&&(this.insertCharStyleObject(i.lineIndex,i.charIndex,n[0],r),r=r&&r.slice(n[0]+1)),o&&this.insertNewlineStyleObject(i.lineIndex,i.charIndex+n[0],o),s=1;s0?this.insertCharStyleObject(i.lineIndex+s,0,n[s],r):r&&this.styles[i.lineIndex+s]&&r[0]&&(this.styles[i.lineIndex+s][0]=r[0]),r=r&&r.slice(n[s]+1);n[s]>0&&this.insertCharStyleObject(i.lineIndex+s,0,n[s],r)}removeChars(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t+1;this.removeStyleFromTo(t,e),this._text.splice(t,e-t),this.text=this._text.join(""),this.set("dirty",!0),this.initDimensions(),this.setCoords(),this._removeExtraneousStyles()}insertChars(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r;i>r&&this.removeStyleFromTo(r,i);let n=this.graphemeSplit(t);this.insertNewStyleBlock(n,r,e),this._text=[...this._text.slice(0,r),...n,...this._text.slice(i)],this.text=this._text.join(""),this.set("dirty",!0),this.initDimensions(),this.setCoords(),this._removeExtraneousStyles()}setSelectionStartEndWithShift(t,e,r){r<=t?(e===t?this._selectionDirection=tC:this._selectionDirection===tT&&(this._selectionDirection=tC,this.selectionEnd=t),this.selectionStart=r):r>t&&r{let[r,i]=t;return e.setAttribute(r,i)});let{top:r,left:i,fontSize:n}=this._calcTextareaPosition();e.style.cssText="position: absolute; top: ".concat(r,"; left: ").concat(i,"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding-top: ").concat(n,";"),(this.hiddenTextareaContainer||t.body).appendChild(e),Object.entries({blur:"blur",keydown:"onKeyDown",keyup:"onKeyUp",input:"onInput",copy:"copy",cut:"copy",paste:"paste",compositionstart:"onCompositionStart",compositionupdate:"onCompositionUpdate",compositionend:"onCompositionEnd"}).map(t=>{let[r,i]=t;return e.addEventListener(r,this[i].bind(this))}),this.hiddenTextarea=e}blur(){this.abortCursorAnimation()}onKeyDown(t){if(!this.isEditing)return;let e="rtl"===this.direction?this.keysMapRtl:this.keysMap;if(t.keyCode in e)this[e[t.keyCode]](t);else{if(!(t.keyCode in this.ctrlKeysMapDown)||!t.ctrlKey&&!t.metaKey)return;this[this.ctrlKeysMapDown[t.keyCode]](t)}t.stopImmediatePropagation(),t.preventDefault(),t.keyCode>=33&&t.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}onKeyUp(t){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:t.keyCode in this.ctrlKeysMapUp&&(t.ctrlKey||t.metaKey)&&(this[this.ctrlKeysMapUp[t.keyCode]](t),t.stopImmediatePropagation(),t.preventDefault(),this.canvas&&this.canvas.requestRenderAll())}onInput(t){let e=this.fromPaste,{value:r,selectionStart:i,selectionEnd:n}=this.hiddenTextarea;if(this.fromPaste=!1,t&&t.stopPropagation(),!this.isEditing)return;let s=()=>{this.updateFromTextArea(),this.fire(tL),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())};if(""===this.hiddenTextarea.value)return this.styles={},void s();let o=this._splitTextIntoLines(r).graphemeText,a=this._text.length,l=o.length,h=this.selectionStart,c=this.selectionEnd,u=h!==c,d,f,g,p,m=l-a,y=this.fromStringToGraphemeSelection(i,n,r),x=h>y.selectionStart;u?(f=this._text.slice(h,c),m+=c-h):ld[0])),u?(g=h,p=c):x?(g=c-f.length,p=c):(g=c,p=c+f.length),this.removeStyleFromTo(g,p)),b.length){let{copyPasteData:t}=tu();e&&b.join("")===t.copiedText&&!tn.disableStyleCopyPaste&&(d=t.copiedTextStyle),this.insertNewStyleBlock(b,h,d)}s()}onCompositionStart(){this.inCompositionMode=!0}onCompositionEnd(){this.inCompositionMode=!1}onCompositionUpdate(t){let{target:e}=t,{selectionStart:r,selectionEnd:i}=e;this.compositionStart=r,this.compositionEnd=i,this.updateTextareaPosition()}copy(){if(this.selectionStart===this.selectionEnd)return;let{copyPasteData:t}=tu();t.copiedText=this.getSelectedText(),tn.disableStyleCopyPaste?t.copiedTextStyle=void 0:t.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0}paste(){this.fromPaste=!0}_getWidthBeforeCursor(t,e){let r,i=this._getLineLeftOffset(t);return e>0&&(i+=(r=this.__charBounds[t][e-1]).left+r.width),i}getDownCursorOffset(t,e){let r=this._getSelectionForOffset(t,e),i=this.get2DCursorLocation(r),n=i.lineIndex;if(n===this._textLines.length-1||t.metaKey||34===t.keyCode)return this._text.length-r;let s=i.charIndex,o=this._getWidthBeforeCursor(n,s),a=this._getIndexOnLine(n+1,o);return this._textLines[n].slice(s).length+a+1+this.missingNewlineOffset(n)}_getSelectionForOffset(t,e){return t.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart}getUpCursorOffset(t,e){let r=this._getSelectionForOffset(t,e),i=this.get2DCursorLocation(r),n=i.lineIndex;if(0===n||t.metaKey||33===t.keyCode)return-r;let s=i.charIndex,o=this._getWidthBeforeCursor(n,s),a=this._getIndexOnLine(n-1,o),l=this._textLines[n].slice(0,s),h=this.missingNewlineOffset(n-1);return-this._textLines[n-1].length+a-l.length+(1-h)}_getIndexOnLine(t,e){let r=this._textLines[t],i,n,s=this._getLineLeftOffset(t),o=0;for(let a=0,l=r.length;ae){n=!0;let t=Math.abs(s-i-e);o=Math.abs(s-e)=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",t)}moveCursorUp(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorUpOrDown("Up",t)}_moveCursorUpOrDown(t,e){let r=this["get".concat(t,"CursorOffset")](e,this._selectionDirection===tT);if(e.shiftKey?this.moveCursorWithShift(r):this.moveCursorWithoutShift(r),0!==r){let t=this.text.length;this.selectionStart=rX(0,this.selectionStart,t),this.selectionEnd=rX(0,this.selectionEnd,t),this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea()}}moveCursorWithShift(t){let e=this._selectionDirection===tC?this.selectionStart+t:this.selectionEnd+t;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,e),0!==t}moveCursorWithoutShift(t){return t<0?(this.selectionStart+=t,this.selectionEnd=this.selectionStart):(this.selectionEnd+=t,this.selectionStart=this.selectionEnd),0!==t}moveCursorLeft(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight("Left",t)}_move(t,e,r){let i;if(t.altKey)i=this["findWordBoundary".concat(r)](this[e]);else{if(!t.metaKey&&35!==t.keyCode&&36!==t.keyCode)return this[e]+="Left"===r?-1:1,!0;i=this["findLineBoundary".concat(r)](this[e])}return void 0!==i&&this[e]!==i&&(this[e]=i,!0)}_moveLeft(t,e){return this._move(t,e,"Left")}_moveRight(t,e){return this._move(t,e,"Right")}moveCursorLeftWithoutShift(t){let e=!0;return this._selectionDirection=tC,this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(e=this._moveLeft(t,"selectionStart")),this.selectionEnd=this.selectionStart,e}moveCursorLeftWithShift(t){return this._selectionDirection===tT&&this.selectionStart!==this.selectionEnd?this._moveLeft(t,"selectionEnd"):0!==this.selectionStart?(this._selectionDirection=tC,this._moveLeft(t,"selectionStart")):void 0}moveCursorRight(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",t)}_moveCursorLeftOrRight(t,e){let r="moveCursor".concat(t).concat(e.shiftKey?"WithShift":"WithoutShift");this._currentCursorOpacity=1,this[r](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())}moveCursorRightWithShift(t){return this._selectionDirection===tC&&this.selectionStart!==this.selectionEnd?this._moveRight(t,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection=tT,this._moveRight(t,"selectionEnd")):void 0}moveCursorRightWithoutShift(t){let e=!0;return this._selectionDirection=tT,this.selectionStart===this.selectionEnd?(e=this._moveRight(t,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,e}}class sV extends sX{initBehavior(){this.on("mousedown",this._mouseDownHandler),this.on("mouseup",this.mouseUpHandler),this.on("mousedblclick",this.doubleClickHandler),this.on("mousetripleclick",this.tripleClickHandler),this.draggableTextDelegate=new sW(this),super.initBehavior()}shouldStartDragging(){return this.draggableTextDelegate.isActive()}onDragStart(t){return this.draggableTextDelegate.onDragStart(t)}canDrop(t){return this.draggableTextDelegate.canDrop(t)}doubleClickHandler(t){this.isEditing&&(this.selectWord(this.getSelectionStartFromPointer(t.e)),this.renderCursorOrSelection())}tripleClickHandler(t){this.isEditing&&(this.selectLine(this.getSelectionStartFromPointer(t.e)),this.renderCursorOrSelection())}_mouseDownHandler(t){let{e:e,alreadySelected:r}=t;this.canvas&&this.editable&&!e.button&&!this.getActiveControl()&&(this.draggableTextDelegate.start(e)||(this.canvas.textEditingManager.register(this),r&&(this.inCompositionMode=!1,this.setCursorByClick(e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()),this.selected||(this.selected=r||this.isEditing)))}mouseUpHandler(t){let{e:e,transform:r}=t,i=this.draggableTextDelegate.end(e);if(this.canvas){this.canvas.textEditingManager.unregister(this);let t=this.canvas._activeObject;if(t&&t!==this)return}!this.editable||this.group&&!this.group.interactive||r&&r.actionPerformed||e.button||i||this.selected&&!this.getActiveControl()&&(this.enterEditing(e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection())}setCursorByClick(t){let e=this.getSelectionStartFromPointer(t),r=this.selectionStart,i=this.selectionEnd;t.shiftKey?this.setSelectionStartEndWithShift(r,i,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())}getSelectionStartFromPointer(t){let e=this.canvas.getScenePoint(t).transform(es(this.calcTransformMatrix())).add(new tJ(-this._getLeftOffset(),-this._getTopOffset())),r=0,i=0,n=0;for(let t=0;t0&&(i+=this._textLines[t-1].length+this.missingNewlineOffset(t-1));let s=Math.abs(this._getLineLeftOffset(n)),o=this._textLines[n].length,a=this.__charBounds[n];for(let t=0;t{let r=e.getRetinaScaling();t.setTransform(r,0,0,r,0,0);let i=e.viewportTransform;t.transform(i[0],i[1],i[2],i[3],i[4],i[5])},sJ=tt({selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,keysMap:{9:sK,27:sK,33:sY,34:sz,35:sq,36:sG,37:sG,38:sY,39:sq,40:sz},keysMapRtl:{9:sK,27:sK,33:sY,34:sz,35:sG,36:sq,37:sq,38:sY,39:sG,40:sz},ctrlKeysMapDown:{65:"cmdAll"},ctrlKeysMapUp:{67:"copy",88:"cut"}},{_selectionDirection:null,_reSpace:/\s|\r?\n/,inCompositionMode:!1});class sZ extends sV{static getDefaults(){return tt(tt({},super.getDefaults()),sZ.ownDefaults)}get type(){let t=super.type;return"itext"===t?"i-text":t}_set(t,e){return this.isEditing&&this._savedProps&&t in this._savedProps?(this._savedProps[t]=e,this):("canvas"===t&&(this.canvas instanceof st&&this.canvas.textEditingManager.remove(this),e instanceof st&&e.textEditingManager.add(this)),super._set(t,e))}setSelectionStart(t){t=Math.max(t,0),this._updateAndFire("selectionStart",t)}setSelectionEnd(t){t=Math.min(t,this.text.length),this._updateAndFire("selectionEnd",t)}_updateAndFire(t,e){this[t]!==e&&(this._fireSelectionChanged(),this[t]=e),this._updateTextarea()}_fireSelectionChanged(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})}initDimensions(){this.isEditing&&this.initDelayedCursor(),super.initDimensions()}getSelectionStyles(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectionStart||0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selectionEnd,r=arguments.length>2?arguments[2]:void 0;return super.getSelectionStyles(t,e,r)}setSelectionStyles(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selectionStart||0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.selectionEnd;return super.setSelectionStyles(t,e,r)}get2DCursorLocation(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectionStart,e=arguments.length>1?arguments[1]:void 0;return super.get2DCursorLocation(t,e)}render(t){super.render(t),this.cursorOffsetCache={},this.renderCursorOrSelection()}toCanvasElement(t){let e=this.isEditing;this.isEditing=!1;let r=super.toCanvasElement(t);return this.isEditing=e,r}renderCursorOrSelection(){if(!this.isEditing||!this.canvas)return;let t=this.clearContextTop(!0);if(!t)return;let e=this._getCursorBoundaries(),r=this.findAncestorsWithClipPath(),i=r.length>0,n,s=t;if(i){sQ(s=(n=t8(t.canvas)).getContext("2d"),this.canvas);let e=this.calcTransformMatrix();s.transform(e[0],e[1],e[2],e[3],e[4],e[5])}if(this.selectionStart!==this.selectionEnd||this.inCompositionMode?this.renderSelection(s,e):this.renderCursor(s,e),i)for(let e of r){let r=e.clipPath,i=t8(t.canvas),n=i.getContext("2d");if(sQ(n,this.canvas),!r.absolutePositioned){let t=e.calcTransformMatrix();n.transform(t[0],t[1],t[2],t[3],t[4],t[5])}r.transform(n),r.drawObject(n,!0,{}),this.drawClipPathOnCache(s,r,i)}i&&(t.setTransform(1,0,0,1,0,0),t.drawImage(n,0,0)),this.canvas.contextTopDirty=!0,t.restore()}findAncestorsWithClipPath(){let t=[],e=this;for(;e;)e.clipPath&&t.push(e),e=e.parent;return t}_getCursorBoundaries(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectionStart,e=arguments.length>1?arguments[1]:void 0,r=this._getLeftOffset(),i=this._getTopOffset(),n=this._getCursorBoundariesOffsets(t,e);return{left:r,top:i,leftOffset:n.left,topOffset:n.top}}_getCursorBoundariesOffsets(t,e){return e?this.__getCursorBoundariesOffsets(t):this.cursorOffsetCache&&"top"in this.cursorOffsetCache?this.cursorOffsetCache:this.cursorOffsetCache=this.__getCursorBoundariesOffsets(t)}__getCursorBoundariesOffsets(t){let e=0,r=0,{charIndex:i,lineIndex:n}=this.get2DCursorLocation(t);for(let t=0;t0?r:0)};return"rtl"===this.direction&&(this.textAlign===tT||this.textAlign===rv||this.textAlign===rx?a.left*=-1:this.textAlign===tC||this.textAlign===ry?a.left=s-(r>0?r:0):this.textAlign!==tw&&this.textAlign!==rb||(a.left=s-(r>0?r:0))),a}renderCursorAt(t){this._renderCursor(this.canvas.contextTop,this._getCursorBoundaries(t,!0),t)}renderCursor(t,e){this._renderCursor(t,e,this.selectionStart)}getCursorRenderingData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectionStart,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getCursorBoundaries(t),r=this.get2DCursorLocation(t),i=r.lineIndex,n=r.charIndex>0?r.charIndex-1:0,s=this.getValueOfPropertyAt(i,n,"fontSize"),o=this.getObjectScaling().x*this.canvas.getZoom(),a=this.cursorWidth/o,l=this.getValueOfPropertyAt(i,n,"deltaY"),h=e.topOffset+(1-this._fontSizeFraction)*this.getHeightOfLine(i)/this.lineHeight-s*(1-this._fontSizeFraction);return{color:this.cursorColor||this.getValueOfPropertyAt(i,n,"fill"),opacity:this._currentCursorOpacity,left:e.left+e.leftOffset-a/2,top:h+e.top+l,width:a,height:s}}_renderCursor(t,e,r){let{color:i,opacity:n,left:s,top:o,width:a,height:l}=this.getCursorRenderingData(r,e);t.fillStyle=i,t.globalAlpha=n,t.fillRect(s,o,a,l)}renderSelection(t,e){let r={selectionStart:this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,selectionEnd:this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd};this._renderSelection(t,r,e)}renderDragSourceEffect(){let t=this.draggableTextDelegate.getDragStartSelection();this._renderSelection(this.canvas.contextTop,t,this._getCursorBoundaries(t.selectionStart,!0))}renderDropTargetEffect(t){let e=this.getSelectionStartFromPointer(t);this.renderCursorAt(e)}_renderSelection(t,e,r){let i=e.selectionStart,n=e.selectionEnd,s=this.textAlign.includes(rv),o=this.get2DCursorLocation(i),a=this.get2DCursorLocation(n),l=o.lineIndex,h=a.lineIndex,c=o.charIndex<0?0:o.charIndex,u=a.charIndex<0?0:a.charIndex;for(let e=l;e<=h;e++){let i=this._getLineLeftOffset(e)||0,n=this.getHeightOfLine(e),o=0,a=0,d=0;if(e===l&&(a=this.__charBounds[l][c].left),e>=l&&e1)&&(n/=this.lineHeight);let f=r.left+i+a,g=n,p=0,m=d-a;this.inCompositionMode?(t.fillStyle=this.compositionColor||"black",g=1,p=n):t.fillStyle=this.selectionColor,"rtl"===this.direction&&(this.textAlign===tT||this.textAlign===rv||this.textAlign===rx?f=this.width-f-m:this.textAlign===tC||this.textAlign===ry?f=r.left+i-d:this.textAlign!==tw&&this.textAlign!==rb||(f=r.left+i-d)),t.fillRect(f,r.top+r.topOffset+p,m,g),r.topOffset+=o}}getCurrentCharFontSize(){let t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fontSize")}getCurrentCharColor(){let t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,tU)}_getCurrentCharIndex(){let t=this.get2DCursorLocation(this.selectionStart,!0),e=t.charIndex>0?t.charIndex-1:0;return{l:t.lineIndex,c:e}}dispose(){this.exitEditingImpl(),this.draggableTextDelegate.dispose(),super.dispose()}constructor(t,e){super(t,tt(tt({},sZ.ownDefaults),e)),this.initBehavior()}}Z(sZ,"ownDefaults",sJ),Z(sZ,"type","IText"),tY.setClass(sZ),tY.setClass(sZ,"i-text");class s$ extends sZ{static getDefaults(){return tt(tt({},super.getDefaults()),s$.ownDefaults)}static createControls(){return{controls:iI()}}initDimensions(){this.initialized&&(this.isEditing&&this.initDelayedCursor(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),this.textAlign.includes(rv)&&this.enlargeSpaces(),this.height=this.calcTextHeight())}_generateStyleMap(t){let e=0,r=0,i=0,n={};for(let s=0;s0?(r=0,i++,e++):!this.splitByGrapheme&&this._reSpaceAndTab.test(t.graphemeText[i])&&s>0&&(r++,i++),n[s]={line:e,offset:r},i+=t.graphemeLines[s].length,r+=t.graphemeLines[s].length;return n}styleHas(t,e){if(this._styleMap&&!this.isWrapping){let t=this._styleMap[e];t&&(e=t.line)}return super.styleHas(t,e)}isEmptyStyles(t){if(!this.styles)return!0;let e,r=0,i=!1,n=this._styleMap[t],s=this._styleMap[t+1];n&&(t=n.line,r=n.offset),s&&(i=s.line===t,e=s.offset);let o=void 0===t?this.styles:{line:this.styles[t]};for(let t in o)for(let n in o[t]){let s=parseInt(n,10);if(s>=r&&(!i||s{let s=0,o=e?this.graphemeSplit(t):this.wordSplit(t);return 0===o.length?[{word:[],width:0}]:o.map(t=>{let o=e?[t]:this.graphemeSplit(t),a=this._measureWord(o,n,s);return i=Math.max(a,i),s+=o.length+r.length,{word:o,width:a}})}),largestWordWidth:i}}_measureWord(t,e){let r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=0;for(let s=0,o=t.length;s3&&void 0!==arguments[3]?arguments[3]:0,a=this._getWidthOfCharSpacing(),l=this.splitByGrapheme,h=[],c=l?"":" ",u=0,d=[],f=0,g=0,p=!0,m=Math.max(e-=o,n,this.dynamicMinWidth),y=s[t];for(f=0,i=0;im&&!p?(h.push(d),d=[],u=r,p=!0):u+=a,p||l||d.push(c),d=d.concat(e),g=l?0:this._measureWord([c],t,f),f++,p=!1}return i&&h.push(d),n+o>this.dynamicMinWidth&&(this.dynamicMinWidth=n-a+o),h}isEndOfWrapping(t){return!this._styleMap[t+1]||this._styleMap[t+1].line!==this._styleMap[t].line}missingNewlineOffset(t,e){return this.splitByGrapheme&&!e?+!!this.isEndOfWrapping(t):1}_splitTextIntoLines(t){let e=super._splitTextIntoLines(t),r=this._wrapText(e.lines,this.width),i=Array(r.length);for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[];return super.toObject(["minWidth","splitByGrapheme",...t])}constructor(t,e){super(t,tt(tt({},s$.ownDefaults),e))}}Z(s$,"type","Textbox"),Z(s$,"textLayoutProperties",[...sZ.textLayoutProperties,"width"]),Z(s$,"ownDefaults",{minWidth:20,dynamicMinWidth:2,lockScalingFlip:!0,noScaleCache:!1,_wordJoiners:/[ \t\r]/,splitByGrapheme:!1}),tY.setClass(s$);class s0 extends ny{shouldPerformLayout(t){return!!t.target.clipPath&&super.shouldPerformLayout(t)}shouldLayoutClipPath(){return!1}calcLayoutResult(t,e){let{target:r}=t,{clipPath:i,group:n}=r;if(!i||!this.shouldPerformLayout(t))return;let{width:s,height:o}=eH(nv(r,i)),a=new tJ(s,o);if(i.absolutePositioned)return{center:eQ(i.getRelativeCenterPoint(),void 0,n?n.calcTransformMatrix():void 0),size:a};{let n=i.getRelativeCenterPoint().transform(r.calcOwnMatrix(),!0);if(this.shouldPerformLayout(t)){let{center:r=new tJ,correction:i=new tJ}=this.calcBoundingBox(e,t)||{};return{center:r.add(n),correction:i.subtract(n),size:a}}return{center:r.getRelativeCenterPoint().add(n),size:a}}}}Z(s0,"type","clip-path"),tY.setClass(s0);class s1 extends ny{getInitialSize(t,e){let{target:r}=t,{size:i}=e;return new tJ(r.width||i.x,r.height||i.y)}}Z(s1,"type","fixed"),tY.setClass(s1);class s2 extends nC{subscribeTargets(t){let e=t.target;t.targets.reduce((t,e)=>(e.parent&&t.add(e.parent),t),new Set).forEach(t=>{t.layoutManager.subscribeTargets({target:t,targets:[e]})})}unsubscribeTargets(t){let e=t.target,r=e.getObjects();t.targets.reduce((t,e)=>(e.parent&&t.add(e.parent),t),new Set).forEach(t=>{r.some(e=>e.parent===t)||t.layoutManager.unsubscribeTargets({target:t,targets:[e]})})}}class s5 extends nO{static getDefaults(){return tt(tt({},super.getDefaults()),s5.ownDefaults)}_shouldSetNestedCoords(){return!0}__objectSelectionMonitor(){}multiSelectAdd(){for(var t=arguments.length,e=Array(t),r=0;r{let e=this._objects.findIndex(e=>e.isInFrontOf(t)),r=-1===e?this.size():e;this.insertAt(r,t)})}canEnterGroup(t){return this.getObjects().some(e=>e.isDescendantOf(t)||t.isDescendantOf(e))?(ts("error","ActiveSelection: circular object trees are not supported, this call has no effect"),!1):super.canEnterGroup(t)}enterGroup(t,e){t.parent&&t.parent===t.group?t.parent._exitGroup(t):t.group&&t.parent!==t.group&&t.group.remove(t),this._enterGroup(t,e)}exitGroup(t,e){this._exitGroup(t,e),t.parent&&t.parent._enterGroup(t,!0)}_onAfterObjectsChange(t,e){super._onAfterObjectsChange(t,e);let r=new Set;e.forEach(t=>{let{parent:e}=t;e&&r.add(e)}),t===np?r.forEach(t=>{t._onAfterObjectsChange(ng,e)}):r.forEach(t=>{t._set("dirty",!0)})}onDeselect(){return this.removeAll(),!1}toString(){return"#")}shouldCache(){return!1}isOnACache(){return!1}_renderControls(t,e,r){t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1;let i=tt(tt({hasControls:!1},r),{},{forActiveSelection:!0});for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),Object.assign(this,s5.ownDefaults),this.setOptions(e);let{left:r,top:i,layoutManager:n}=e;this.groupInit(t,{left:r,top:i,layoutManager:null!=n?n:new s2})}}Z(s5,"type","ActiveSelection"),Z(s5,"ownDefaults",{multiSelectionStacking:"canvas-stacking"}),tY.setClass(s5),tY.setClass(s5,"activeSelection");class s4{applyFilters(t,e,r,i,n){let s=n.getContext("2d");if(!s)return;s.drawImage(e,0,0,r,i);let o={sourceWidth:r,sourceHeight:i,imageData:s.getImageData(0,0,r,i),originalEl:e,originalImageData:s.getImageData(0,0,r,i),canvasEl:n,ctx:s,filterBackend:this};t.forEach(t=>{t.applyTo(o)});let{imageData:a}=o;return a.width===r&&a.height===i||(n.width=a.width,n.height=a.height),s.putImageData(a,0,0),o}constructor(){Z(this,"resources",{})}}class s3{setupGLContext(t,e){this.dispose(),this.createWebGLCanvas(t,e)}createWebGLCanvas(t,e){let r=t8({width:t,height:e}),i=r.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1});i&&(i.clearColor(0,0,0,0),this.canvas=r,this.gl=i)}applyFilters(t,e,r,i,n,s){let o,a=this.gl,l=n.getContext("2d");if(!a||!l)return;s&&(o=this.getCachedTexture(s,e));let h={originalWidth:e.width||e.naturalWidth||0,originalHeight:e.height||e.naturalHeight||0,sourceWidth:r,sourceHeight:i,destinationWidth:r,destinationHeight:i,context:a,sourceTexture:this.createTexture(a,r,i,o?void 0:e),targetTexture:this.createTexture(a,r,i),originalTexture:o||this.createTexture(a,r,i,o?void 0:e),passes:t.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:n},c=a.createFramebuffer();return a.bindFramebuffer(a.FRAMEBUFFER,c),t.forEach(t=>{t&&t.applyTo(h)}),function(t){let e=t.targetCanvas,r=e.width,i=e.height,n=t.destinationWidth,s=t.destinationHeight;r===n&&i===s||(e.width=n,e.height=s)}(h),this.copyGLTo2D(a,h),a.bindTexture(a.TEXTURE_2D,null),a.deleteTexture(h.sourceTexture),a.deleteTexture(h.targetTexture),a.deleteFramebuffer(c),l.setTransform(1,0,0,1,0,0),h}dispose(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()}clearWebGLCaches(){this.programCache={},this.textureCache={}}createTexture(t,e,r,i,n){let{NEAREST:s,TEXTURE_2D:o,RGBA:a,UNSIGNED_BYTE:l,CLAMP_TO_EDGE:h,TEXTURE_MAG_FILTER:c,TEXTURE_MIN_FILTER:u,TEXTURE_WRAP_S:d,TEXTURE_WRAP_T:f}=t,g=t.createTexture();return t.bindTexture(o,g),t.texParameteri(o,c,n||s),t.texParameteri(o,u,n||s),t.texParameteri(o,d,h),t.texParameteri(o,f,h),i?t.texImage2D(o,0,a,a,l,i):t.texImage2D(o,0,a,e,r,0,a,l,null),g}getCachedTexture(t,e,r){let{textureCache:i}=this;if(i[t])return i[t];{let n=this.createTexture(this.gl,e.width,e.height,e,r);return n&&(i[t]=n),n}}evictCachesForKey(t){this.textureCache[t]&&(this.gl.deleteTexture(this.textureCache[t]),delete this.textureCache[t])}copyGLTo2D(t,e){let r=t.canvas,i=e.targetCanvas,n=i.getContext("2d");if(!n)return;n.translate(0,i.height),n.scale(1,-1);let s=r.height-i.height;n.drawImage(r,0,s,i.width,i.height,0,0,i.width,i.height)}copyGLTo2DPutImageData(t,e){let r=e.targetCanvas.getContext("2d"),i=e.destinationWidth,n=e.destinationHeight,s=i*n*4;if(!r)return;let o=new Uint8Array(this.imageBuffer,0,s),a=new Uint8ClampedArray(this.imageBuffer,0,s);t.readPixels(0,0,i,n,t.RGBA,t.UNSIGNED_BYTE,o);let l=new ImageData(a,i,n);r.putImageData(l,0,0)}captureGPUInfo(){if(this.gpuInfo)return this.gpuInfo;let t=this.gl,e={renderer:"",vendor:""};if(!t)return e;let r=t.getExtension("WEBGL_debug_renderer_info");if(r){let i=t.getParameter(r.UNMASKED_RENDERER_WEBGL),n=t.getParameter(r.UNMASKED_VENDOR_WEBGL);i&&(e.renderer=i.toLowerCase()),n&&(e.vendor=n.toLowerCase())}return this.gpuInfo=e,e}constructor(){let{tileSize:t=tn.textureSize}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Z(this,"aPosition",new Float32Array([0,0,0,1,1,0,1,1])),Z(this,"resources",{}),this.tileSize=t,this.setupGLContext(t,t),this.captureGPUInfo()}}function s9(){return n||arguments.length>0&&void 0!==arguments[0]&&!arguments[0]||(n=function(){let{WebGLProbe:t}=tu();return t.queryWebGL(t9()),tn.enableGLFiltering&&t.isSupported(tn.textureSize)?new s3({tileSize:tn.textureSize}):new s4}()),n}let s6=["filters","resizeFilter","src","crossOrigin","type"],s8=["cropX","cropY"];class s7 extends iW{static getDefaults(){return tt(tt({},super.getDefaults()),s7.ownDefaults)}getElement(){return this._element}setElement(t){var e;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.removeTexture(this.cacheKey),this.removeTexture("".concat(this.cacheKey,"_filtered")),this._element=t,this._originalElement=t,this._setWidthHeight(r),null==(e=t.classList)||e.add(s7.CSS_CANVAS),0!==this.filters.length&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters()}removeTexture(t){let e=s9(!1);e instanceof s3&&e.evictCachesForKey(t)}dispose(){super.dispose(),this.removeTexture(this.cacheKey),this.removeTexture("".concat(this.cacheKey,"_filtered")),this._cacheContext=null,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(t=>{let e=this[t];e&&tu().dispose(e),this[t]=void 0})}getCrossOrigin(){return this._originalElement&&(this._originalElement.crossOrigin||null)}getOriginalSize(){let t=this.getElement();return t?{width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}:{width:0,height:0}}_stroke(t){if(!this.stroke||0===this.strokeWidth)return;let e=this.width/2,r=this.height/2;t.beginPath(),t.moveTo(-e,-r),t.lineTo(e,-r),t.lineTo(e,r),t.lineTo(-e,r),t.lineTo(-e,-r),t.closePath()}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=[];return this.filters.forEach(t=>{t&&e.push(t.toObject())}),tt(tt({},super.toObject([...s8,...t])),{},{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:e},this.resizeFilter?{resizeFilter:this.resizeFilter.toObject()}:{})}hasCrop(){return!!this.cropX||!!this.cropY||this.width\n',' \n',"\n"),o=' clip-path="url(#imageCrop_'+t+')" '}if(this.imageSmoothing||(a=' image-rendering="optimizeSpeed"'),t.push(" \n")),this.stroke||this.strokeDashArray){let t=this.fill;this.fill=null,s=[' \n')],this.fill=t}return this.paintFirst!==tU?n.concat(s,t):n.concat(t,s)}getSrc(t){let e=t?this._element:this._originalElement;return e?e.toDataURL?e.toDataURL():this.srcFromAttribute?e.getAttribute("src")||"":e.src:this.src||""}getSvgSrc(t){return this.getSrc(t)}setSrc(t){let{crossOrigin:e,signal:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ey(t,{crossOrigin:e,signal:r}).then(t=>{void 0!==e&&this.set({crossOrigin:e}),this.setElement(t)})}toString(){return'#')}applyResizeFilters(){let t=this.resizeFilter,e=this.minimumScaleTrigger,r=this.getTotalObjectScaling(),i=r.x,n=r.y,s=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!t||i>e&&n>e)return this._element=s,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=i,void(this._lastScaleY=n);let o=t8(s),{width:a,height:l}=s;this._element=o,this._lastScaleX=t.scaleX=i,this._lastScaleY=t.scaleY=n,s9().applyFilters([t],s,a,l,this._element),this._filterScalingX=o.width/this._originalElement.width,this._filterScalingY=o.height/this._originalElement.height}applyFilters(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.filters||[];if(t=t.filter(t=>t&&!t.isNeutralState()),this.set("dirty",!0),this.removeTexture("".concat(this.cacheKey,"_filtered")),0===t.length)return this._element=this._originalElement,this._filteredEl=void 0,this._filterScalingX=1,void(this._filterScalingY=1);let e=this._originalElement,r=e.naturalWidth||e.width,i=e.naturalHeight||e.height;if(this._element===this._originalElement){let t=t8({width:r,height:i});this._element=t,this._filteredEl=t}else this._filteredEl&&(this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,r,i),this._lastScaleX=1,this._lastScaleY=1);s9().applyFilters(t,this._originalElement,r,i,this._element,this.cacheKey),this._originalElement.width===this._element.width&&this._originalElement.height===this._element.height||(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height)}_render(t){t.imageSmoothingEnabled=this.imageSmoothing,!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(t),this._renderPaintInOrder(t)}drawCacheOnCanvas(t){t.imageSmoothingEnabled=this.imageSmoothing,super.drawCacheOnCanvas(t)}shouldCache(){return this.needsItsOwnCache()}_renderFill(t){let e=this._element;if(!e)return;let r=this._filterScalingX,i=this._filterScalingY,n=this.width,s=this.height,o=Math.max(this.cropX,0),a=Math.max(this.cropY,0),l=e.naturalWidth||e.width,h=e.naturalHeight||e.height,c=o*r,u=a*i,d=Math.min(n*r,l-c),f=Math.min(s*i,h-u),g=Math.min(n,l/r-o),p=Math.min(s,h/i-a);e&&t.drawImage(e,c,u,d,f,-n/2,-s/2,g,p)}_needsResize(){let t=this.getTotalObjectScaling();return t.x!==this._lastScaleX||t.y!==this._lastScaleY}_resetWidthHeight(){this.set(this.getOriginalSize())}_setWidthHeight(){let{width:t,height:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this.getOriginalSize();this.width=t||r.width,this.height=e||r.height}parsePreserveAspectRatioAttribute(){let t=ra(this.preserveAspectRatio||""),e=this.width,r=this.height,i={width:e,height:r},n,s=this._element.width,o=this._element.height,a=1,l=1,h=0,c=0,u=0,d=0;return t&&(t.alignX!==tO||t.alignY!==tO)?("meet"===t.meetOrSlice&&(n=(e-s*(a=l=nk(this._element,i)))/2,"Min"===t.alignX&&(h=-n),"Max"===t.alignX&&(h=n),n=(r-o*l)/2,"Min"===t.alignY&&(c=-n),"Max"===t.alignY&&(c=n)),"slice"===t.meetOrSlice&&(n=s-e/(a=l=nM(this._element,i)),"Mid"===t.alignX&&(u=n/2),"Max"===t.alignX&&(u=n),n=o-r/l,"Mid"===t.alignY&&(d=n/2),"Max"===t.alignY&&(d=n),s=e/a,o=r/l)):(a=e/s,l=r/o),{width:s,height:o,scaleX:a,scaleY:l,offsetLeft:h,offsetTop:c,cropX:u,cropY:d}}static fromObject(t,e){let{filters:r,resizeFilter:i,src:n,crossOrigin:s,type:o}=t,a=te(t,s6);return Promise.all([ey(n,tt(tt({},e),{},{crossOrigin:s})),r&&ex(r,e),i&&ex([i],e),eb(a,e)]).then(t=>{let[e,r=[],[i]=[],s={}]=t;return new this(e,tt(tt({},a),{},{src:n,filters:r,resizeFilter:i},s))})}static fromURL(t){let{crossOrigin:e=null,signal:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;return ey(t,{crossOrigin:e,signal:r}).then(t=>new this(t,i))}static async fromElement(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=nh(t,this.ATTRIBUTE_NAMES,r);return this.fromURL(i["xlink:href"]||i.href,e,i).catch(t=>(ts("log","Unable to parse Image",t),null))}constructor(t,e){super(),Z(this,"_lastScaleX",1),Z(this,"_lastScaleY",1),Z(this,"_filterScalingX",1),Z(this,"_filterScalingY",1),this.filters=[],Object.assign(this,s7.ownDefaults),this.setOptions(e),this.cacheKey="texture".concat(t3()),this.setElement("string"==typeof t?(this.canvas&&eD(this.canvas.getElement())||td()).getElementById(t):t,e)}}Z(s7,"type","Image"),Z(s7,"cacheProperties",[...rY,...s8]),Z(s7,"ownDefaults",{strokeWidth:0,srcFromAttribute:!1,minimumScaleTrigger:.5,cropX:0,cropY:0,imageSmoothing:!0}),Z(s7,"CSS_CANVAS","canvas-img"),Z(s7,"ATTRIBUTE_NAMES",[...i2,"x","y","width","height","preserveAspectRatio","xlink:href","href","crossOrigin","image-rendering"]),tY.setClass(s7),tY.setSVGClass(s7),rc(["pattern","defs","symbol","metadata","clipPath","mask","desc"]);let ot=t=>function(e,r,i){let{points:n,pathOffset:s}=i;return new tJ(n[t]).subtract(s).transform(eo(i.getViewportTransform(),i.calcTransformMatrix()))},oe=(t,e,r,i)=>{let{target:n,pointIndex:s}=e,o=eQ(new tJ(r,i),void 0,n.calcOwnMatrix());return n.points[s]=o.add(n.pathOffset),n.setDimensions(),n.set("dirty",!0),!0},or=(t,e)=>function(r,i,n,s){let o=i.target,a=new tJ(o.points[(t>0?t:o.points.length)-1]),l=a.subtract(o.pathOffset).transform(o.calcOwnMatrix()),h=e(r,tt(tt({},i),{},{pointIndex:t}),n,s),c=a.subtract(o.pathOffset).transform(o.calcOwnMatrix()).subtract(l);return o.left-=c.x,o.top-=c.y,h},oi=t=>io(tF,or(t,oe)),on=(t,e,r)=>{let{path:i,pathOffset:n}=t,s=i[e];return new tJ(s[r]-n.x,s[r+1]-n.y).transform(eo(t.getViewportTransform(),t.calcTransformMatrix()))};function os(t,e,r){let{commandIndex:i,pointIndex:n}=this;return on(r,i,n)}function oo(t,e,r,i){let{target:n}=e,{commandIndex:s,pointIndex:o}=this,a=((t,e,r,i,n)=>{let{path:s,pathOffset:o}=t,a=s[(i>0?i:s.length)-1],l=new tJ(a[n],a[n+1]),h=l.subtract(o).transform(t.calcOwnMatrix()),c=eQ(new tJ(e,r),void 0,t.calcOwnMatrix());s[i][n]=c.x+o.x,s[i][n+1]=c.y+o.y,t.setDimensions();let u=l.subtract(t.pathOffset).transform(t.calcOwnMatrix()).subtract(h);return t.left-=u.x,t.top-=u.y,t.set("dirty",!0),!0})(n,r,i,s,o);return e$(this.actionName,tt(tt({},e3(t,e,r,i)),{},{commandIndex:s,pointIndex:o})),a}class oa extends iu{render(t,e,r,i,n){let s=tt(tt({},i),{},{cornerColor:this.controlFill,cornerStrokeColor:this.controlStroke,transparentCorners:!this.controlFill});super.render(t,e,r,s,n)}constructor(t){super(t)}}class ol extends oa{render(t,e,r,i,n){let{path:s}=n,{commandIndex:o,pointIndex:a,connectToCommandIndex:l,connectToPointIndex:h}=this;t.save(),t.strokeStyle=this.controlStroke,this.connectionDashArray&&t.setLineDash(this.connectionDashArray);let[c]=s[o],u=on(n,l,h);if("Q"===c){let i=on(n,o,a+2);t.moveTo(i.x,i.y),t.lineTo(e,r)}else t.moveTo(e,r);t.lineTo(u.x,u.y),t.stroke(),t.restore(),super.render(t,e,r,i,n)}constructor(t){super(t)}}let oh=(t,e,r,i,n,s)=>new(r?ol:oa)(tt(tt({commandIndex:t,pointIndex:e,actionName:"modifyPath",positionHandler:os,actionHandler:oo,connectToCommandIndex:n,connectToPointIndex:s},i),r?i.controlPointStyle:i.pointStyle));Object.freeze({__proto__:null,changeWidth:il,createObjectDefaultControls:iL,createPathControls:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i="M";return t.path.forEach((t,n)=>{let s=t[0];switch("Z"!==s&&(r["c_".concat(n,"_").concat(s)]=oh(n,t.length-2,!1,e)),s){case"C":let o;r["c_".concat(n,"_C_CP_1")]=oh(n,1,!0,e,n-1,"C"===(o=i)?5:"Q"===o?3:1),r["c_".concat(n,"_C_CP_2")]=oh(n,3,!0,e,n,5);break;case"Q":r["c_".concat(n,"_Q_CP_1")]=oh(n,1,!0,e,n,3)}i=s}),r},createPolyActionHandler:oi,createPolyControls:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={};for(let i=0;i<("number"==typeof t?t:t.points.length);i++)r["p".concat(i)]=new iu(tt({actionName:tF,positionHandler:ot(i),actionHandler:oi(i)},e));return r},createPolyPositionHandler:ot,createResizeControls:iR,createTextboxDefaultControls:iI,dragHandler:e8,factoryPolyActionHandler:or,getLocalPoint:e6,polyActionHandler:oe,renderCircleControl:ih,renderSquareControl:ic,rotationStyleHandler:id,rotationWithSnapping:ig,scaleCursorStyleHandler:iy,scaleOrSkewActionName:ij,scaleSkewCursorStyleHandler:iA,scalingEqually:ib,scalingX:i_,scalingXOrSkewingY:iP,scalingY:iw,scalingYOrSkewingX:iF,skewCursorStyleHandler:iO,skewHandlerX:iM,skewHandlerY:iE,wrapWithFireEvent:io,wrapWithFixedAnchor:ia});let oc="precision highp float",ou="\n ".concat(oc,";\n varying vec2 vTexCoord;\n uniform sampler2D uTexture;\n void main() {\n gl_FragColor = texture2D(uTexture, vTexCoord);\n }"),od=["type"],of=["type"],og=RegExp(oc,"g");class op{get type(){return this.constructor.type}getFragmentSource(){return ou}getVertexSource(){return"\n attribute vec2 aPosition;\n varying vec2 vTexCoord;\n void main() {\n vTexCoord = aPosition;\n gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n }"}createProgram(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getFragmentSource(),r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.getVertexSource(),{WebGLProbe:{GLPrecision:i="highp"}}=tu();"highp"!==i&&(e=e.replace(og,oc.replace("highp",i)));let n=t.createShader(t.VERTEX_SHADER),s=t.createShader(t.FRAGMENT_SHADER),o=t.createProgram();if(!n||!s||!o)throw new to("Vertex, fragment shader or program creation error");if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw new to("Vertex shader compile error for ".concat(this.type,": ").concat(t.getShaderInfoLog(n)));if(t.shaderSource(s,e),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS))throw new to("Fragment shader compile error for ".concat(this.type,": ").concat(t.getShaderInfoLog(s)));if(t.attachShader(o,n),t.attachShader(o,s),t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS))throw new to('Shader link error for "'.concat(this.type,'" ').concat(t.getProgramInfoLog(o)));let a=this.getUniformLocations(t,o)||{};return a.uStepW=t.getUniformLocation(o,"uStepW"),a.uStepH=t.getUniformLocation(o,"uStepH"),{program:o,attributeLocations:this.getAttributeLocations(t,o),uniformLocations:a}}getAttributeLocations(t,e){return{aPosition:t.getAttribLocation(e,"aPosition")}}getUniformLocations(t,e){let r=this.constructor.uniformLocations,i={};for(let n=0;n1){let r=t.destinationWidth,i=t.destinationHeight;t.sourceWidth===r&&t.sourceHeight===i||(e.deleteTexture(t.targetTexture),t.targetTexture=t.filterBackend.createTexture(e,r,i)),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.targetTexture,0)}else e.bindFramebuffer(e.FRAMEBUFFER,null),e.finish()}_swapTextures(t){t.passes--,t.pass++;let e=t.targetTexture;t.targetTexture=t.sourceTexture,t.sourceTexture=e}isNeutralState(t){return!1}applyTo(t){void 0!==t.webgl?(this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)}applyTo2d(t){}getCacheKey(){return this.type}retrieveShader(t){let e=this.getCacheKey();return t.programCache[e]||(t.programCache[e]=this.createProgram(t.context)),t.programCache[e]}applyToWebGL(t){let e=t.context,r=this.retrieveShader(t);0===t.pass&&t.originalTexture?e.bindTexture(e.TEXTURE_2D,t.originalTexture):e.bindTexture(e.TEXTURE_2D,t.sourceTexture),e.useProgram(r.program),this.sendAttributeData(e,r.attributeLocations,t.aPosition),e.uniform1f(r.uniformLocations.uStepW,1/t.sourceWidth),e.uniform1f(r.uniformLocations.uStepH,1/t.sourceHeight),this.sendUniformData(e,r.uniformLocations),e.viewport(0,0,t.destinationWidth,t.destinationHeight),e.drawArrays(e.TRIANGLE_STRIP,0,4)}bindAdditionalTexture(t,e,r){t.activeTexture(r),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE0)}unbindAdditionalTexture(t,e){t.activeTexture(e),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE0)}sendUniformData(t,e){}createHelpLayer(t){if(!t.helpLayer){let{sourceWidth:e,sourceHeight:r}=t;t.helpLayer=t8({width:e,height:r})}}toObject(){let t=Object.keys(this.constructor.defaults||{});return tt({type:this.type},t.reduce((t,e)=>(t[e]=this[e],t),{}))}toJSON(){return this.toObject()}static async fromObject(t,e){return new this(te(t,of))}constructor(){let t=te(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},od);Object.assign(this,this.constructor.defaults,t)}}Z(op,"type","BaseFilter"),Z(op,"uniformLocations",[]);let om={multiply:"gl_FragColor.rgb *= uColor.rgb;\n",screen:"gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n",add:"gl_FragColor.rgb += uColor.rgb;\n",difference:"gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n",subtract:"gl_FragColor.rgb -= uColor.rgb;\n",lighten:"gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n",darken:"gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n",exclusion:"gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n",overlay:"\n if (uColor.r < 0.5) {\n gl_FragColor.r *= 2.0 * uColor.r;\n } else {\n gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n }\n if (uColor.g < 0.5) {\n gl_FragColor.g *= 2.0 * uColor.g;\n } else {\n gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n }\n if (uColor.b < 0.5) {\n gl_FragColor.b *= 2.0 * uColor.b;\n } else {\n gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n }\n ",tint:"\n gl_FragColor.rgb *= (1.0 - uColor.a);\n gl_FragColor.rgb += uColor.rgb;\n "};class ov extends op{getCacheKey(){return"".concat(this.type,"_").concat(this.mode)}getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform vec4 uColor;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n gl_FragColor = color;\n if (color.a > 0.0) {\n ".concat(om[this.mode],"\n }\n }\n ")}applyTo2d(t){let{imageData:{data:e}}=t,r=new rs(this.color).getSource(),i=this.alpha,n=r[0]*i,s=r[1]*i,o=r[2]*i,a=1-i;for(let t=0;tnew this(tt(tt({},n),{},{image:t})))}}Z(ob,"type","BlendImage"),Z(ob,"defaults",{mode:"multiply",alpha:1}),Z(ob,"uniformLocations",["uTransformMatrix","uImage"]),tY.setClass(ob);class o_ extends op{getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform vec2 uDelta;\n varying vec2 vTexCoord;\n const float nSamples = 15.0;\n vec3 v3offset = vec3(12.9898, 78.233, 151.7182);\n float random(vec3 scale) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n }\n void main() {\n vec4 color = vec4(0.0);\n float totalC = 0.0;\n float totalA = 0.0;\n float offset = random(v3offset);\n for (float t = -nSamples; t <= nSamples; t++) {\n float percent = (t + offset - 0.5) / nSamples;\n vec4 sample = texture2D(uTexture, vTexCoord + uDelta * percent);\n float weight = 1.0 - abs(percent);\n float alpha = weight * sample.a;\n color.rgb += sample.rgb * alpha;\n color.a += alpha;\n totalA += weight;\n totalC += alpha;\n }\n gl_FragColor.rgb = color.rgb / totalC;\n gl_FragColor.a = color.a / totalA;\n }\n "}applyTo(t){void 0!==t.webgl?(this.aspectRatio=t.sourceWidth/t.sourceHeight,t.passes++,this._setupFrameBuffer(t),this.horizontal=!0,this.applyToWebGL(t),this._swapTextures(t),this._setupFrameBuffer(t),this.horizontal=!1,this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)}applyTo2d(t){let{imageData:{data:e,width:r,height:i}}=t;this.aspectRatio=r/i,this.horizontal=!0;let n=this.getBlurValue()*r,s=new Uint8ClampedArray(e),o=4*r;for(let t=0;tu&&(g=u);let p=e[g+3]*f;r+=e[g]*p,i+=e[g+1]*p,a+=e[g+2]*p,l+=p,h+=f}s[t]=r/l,s[t+1]=i/l,s[t+2]=a/l,s[t+3]=l/h}this.horizontal=!1,n=this.getBlurValue()*i;for(let t=0;tu&&(p=u);let m=s[p+3]*g;r+=s[p]*m,i+=s[p+1]*m,a+=s[p+2]*m,l+=m,h+=g}e[t]=r/l,e[t+1]=i/l,e[t+2]=a/l,e[t+3]=l/h}}sendUniformData(t,e){let r=this.chooseRightDelta();t.uniform2fv(e.uDelta,r)}isNeutralState(){return 0===this.blur}getBlurValue(){let t=1,{horizontal:e,aspectRatio:r}=this;return e?r>1&&(t=1/r):r<1&&(t=r),t*this.blur*.12}chooseRightDelta(){let t=this.getBlurValue();return this.horizontal?[t,0]:[0,t]}}Z(o_,"type","Blur"),Z(o_,"defaults",{blur:0}),Z(o_,"uniformLocations",["uDelta"]),tY.setClass(o_);class ow extends op{getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uBrightness;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n color.rgb += uBrightness;\n gl_FragColor = color;\n }\n"}applyTo2d(t){let{imageData:{data:e}}=t,r=Math.round(255*this.brightness);for(let t=0;t{e.applyTo(t)})}toObject(){return{type:this.type,subFilters:this.subFilters.map(t=>t.toObject())}}isNeutralState(){return!this.subFilters.some(t=>!t.isNeutralState())}static fromObject(t,e){return Promise.all((t.subFilters||[]).map(t=>tY.getClass(t.type).fromObject(t,e))).then(t=>new this({subFilters:t}))}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),this.subFilters=t.subFilters||[]}}Z(oP,"type","Composed"),tY.setClass(oP);class oF extends op{getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uContrast;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\n color.rgb = contrastF * (color.rgb - 0.5) + 0.5;\n gl_FragColor = color;\n }"}isNeutralState(){return 0===this.contrast}applyTo2d(t){let{imageData:{data:e}}=t,r=Math.floor(255*this.contrast),i=259*(r+255)/(255*(259-r));for(let t=0;t=_||o<0||o>=b||(l=4*(a*b+o),h=m[f*y+d],e+=p[l]*h,r+=p[l+1]*h,i+=p[l+2]*h,S||(n+=p[l+3]*h));C[s]=e,C[s+1]=r,C[s+2]=i,C[s+3]=S?p[s+3]:n}t.imageData=w}sendUniformData(t,e){t.uniform1fv(e.uMatrix,this.matrix)}toObject(){return tt(tt({},super.toObject()),{},{opaque:this.opaque,matrix:[...this.matrix]})}}Z(oR,"type","Convolute"),Z(oR,"defaults",{opaque:!1,matrix:[0,0,0,0,1,0,0,0,0]}),Z(oR,"uniformLocations",["uMatrix","uOpaque","uHalfSize","uSize"]),tY.setClass(oR);let oI="Gamma";class oB extends op{getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform vec3 uGamma;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n vec3 correction = (1.0 / uGamma);\n color.r = pow(color.r, correction.r);\n color.g = pow(color.g, correction.g);\n color.b = pow(color.b, correction.b);\n gl_FragColor = color;\n gl_FragColor.rgb *= color.a;\n }\n"}applyTo2d(t){let{imageData:{data:e}}=t,r=this.gamma,i=1/r[0],n=1/r[1],s=1/r[2];this.rgbValues||(this.rgbValues={r:new Uint8Array(256),g:new Uint8Array(256),b:new Uint8Array(256)});let o=this.rgbValues;for(let t=0;t<256;t++)o.r[t]=255*Math.pow(t/255,i),o.g[t]=255*Math.pow(t/255,n),o.b[t]=255*Math.pow(t/255,s);for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:{};super(t),this.gamma=t.gamma||this.constructor.defaults.gamma.concat()}}Z(oB,"type",oI),Z(oB,"defaults",{gamma:[1,1,1]}),Z(oB,"uniformLocations",["uGamma"]),tY.setClass(oB);let oN={average:"\n precision highp float;\n uniform sampler2D uTexture;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float average = (color.r + color.b + color.g) / 3.0;\n gl_FragColor = vec4(average, average, average, color.a);\n }\n ",lightness:"\n precision highp float;\n uniform sampler2D uTexture;\n uniform int uMode;\n varying vec2 vTexCoord;\n void main() {\n vec4 col = texture2D(uTexture, vTexCoord);\n float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\n gl_FragColor = vec4(average, average, average, col.a);\n }\n ",luminosity:"\n precision highp float;\n uniform sampler2D uTexture;\n uniform int uMode;\n varying vec2 vTexCoord;\n void main() {\n vec4 col = texture2D(uTexture, vTexCoord);\n float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\n gl_FragColor = vec4(average, average, average, col.a);\n }\n "};class oW extends op{applyTo2d(t){let{imageData:{data:e}}=t;for(let t,r=0;rn[0]&&i>n[1]&&o>n[2]&&r"\n color += texture2D(uTexture, vTexCoord + ".concat(t,") * uTaps[").concat(e,"] + texture2D(uTexture, vTexCoord - ").concat(t,") * uTaps[").concat(e,"];\n sum += 2.0 * uTaps[").concat(e,"];\n ")).join("\n"),"\n gl_FragColor = color / sum;\n }\n ")}applyToForWebgl(t){t.passes++,this.width=t.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=t.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),t.destinationWidth=this.dW,super.applyTo(t),t.sourceWidth=t.destinationWidth,this.height=t.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),t.destinationHeight=this.dH,super.applyTo(t),t.sourceHeight=t.destinationHeight}applyTo(t){void 0!==t.webgl?this.applyToForWebgl(t):this.applyTo2d(t)}isNeutralState(){return 1===this.scaleX&&1===this.scaleY}lanczosCreate(t){return e=>{if(e>=t||e<=-t)return 0;if(e<11920929e-14&&e>-11920929e-14)return 1;let r=(e*=Math.PI)/t;return Math.sin(e)/e*Math.sin(r)/r}}applyTo2d(t){let e,r=t.imageData,i=this.scaleX,n=this.scaleY;this.rcpScaleX=1/i,this.rcpScaleY=1/n;let s=r.width,o=r.height,a=Math.round(s*i),l=Math.round(o*n);e="sliceHack"===this.resizeType?this.sliceByTwo(t,s,o,a,l):"hermite"===this.resizeType?this.hermiteFastResize(t,s,o,a,l):"bilinear"===this.resizeType?this.bilinearFiltering(t,s,o,a,l):"lanczos"===this.resizeType?this.lanczosResize(t,s,o,a,l):new ImageData(a,l),t.imageData=e}sliceByTwo(t,e,r,i,n){let s=t.imageData,o=!1,a=!1,l=.5*e,h=.5*r,c=t.filterBackend.resources,u=0,d=0,f=e,g=0;c.sliceByTwo||(c.sliceByTwo=t9());let p=c.sliceByTwo;(p.width<1.5*e||p.height=e)){p[E=Math.floor(1e3*Math.abs(_-m.x))]||(p[E]={});for(let t=y.y-g;t<=y.y+g;t++)t<0||t>=r||(D=Math.floor(1e3*Math.abs(t-m.y)),p[E][D]||(p[E][D]=l(Math.sqrt(Math.pow(E*u,2)+Math.pow(D*d,2))/1e3)),(w=p[E][D])>0&&(C=4*(t*e+_),S+=w,T+=w*s[C],O+=w*s[C+1],k+=w*s[C+2],M+=w*s[C+3]))}a[C=4*(b*i+x)]=T/S,a[C+1]=O/S,a[C+2]=k/S,a[C+3]=M/S}return++x1&&s<-1||(c=2*s*s*s-3*s*s+1)>0&&(y+=c*h[(r=4*(t+i*e))+3],f+=c,h[r+3]<255&&(c=c*h[r+3]/250),g+=c*h[r],p+=c*h[r+1],m+=c*h[r+2],d+=c)}}u[n]=g/d,u[n+1]=p/d,u[n+2]=m/d,u[n+3]=y/f}return c}}Z(oG,"type","Resize"),Z(oG,"defaults",{resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3}),Z(oG,"uniformLocations",["uDelta","uTaps"]),tY.setClass(oG);class oq extends op{getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uSaturation;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float rgMax = max(color.r, color.g);\n float rgbMax = max(rgMax, color.b);\n color.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\n color.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\n color.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\n gl_FragColor = color;\n }\n"}applyTo2d(t){let{imageData:{data:e}}=t,r=-this.saturation;for(let t=0;t({x:t,y:t}),o9={left:"right",right:"left",bottom:"top",top:"bottom"},o6={start:"end",end:"start"};function o8(t,e){return"function"==typeof t?t(e):t}function o7(t){return t.split("-")[0]}function at(t){return t.split("-")[1]}function ae(t){return"y"===t?"height":"width"}let ar=new Set(["top","bottom"]);function ai(t){return ar.has(o7(t))?"y":"x"}function an(t){return"x"===ai(t)?"y":"x"}function as(t){return t.replace(/start|end/g,t=>o6[t])}let ao=["left","right"],aa=["right","left"],al=["top","bottom"],ah=["bottom","top"];function ac(t){return t.replace(/left|right|bottom|top/g,t=>o9[t])}function au(t){let{x:e,y:r,width:i,height:n}=t;return{width:i,height:n,top:r,left:e,right:e+i,bottom:r+n,x:e,y:r}}function ad(t,e,r){let i,{reference:n,floating:s}=t,o=ai(e),a=an(e),l=ae(a),h=o7(e),c="y"===o,u=n.x+n.width/2-s.width/2,d=n.y+n.height/2-s.height/2,f=n[l]/2-s[l]/2;switch(h){case"top":i={x:u,y:n.y-s.height};break;case"bottom":i={x:u,y:n.y+n.height};break;case"right":i={x:n.x+n.width,y:d};break;case"left":i={x:n.x-s.width,y:d};break;default:i={x:n.x,y:n.y}}switch(at(e)){case"start":i[a]-=f*(r&&c?-1:1);break;case"end":i[a]+=f*(r&&c?-1:1)}return i}let af=async(t,e,r)=>{let{placement:i="bottom",strategy:n="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),l=await (null==o.isRTL?void 0:o.isRTL(e)),h=await o.getElementRects({reference:t,floating:e,strategy:n}),{x:c,y:u}=ad(h,i,l),d=i,f={},g=0;for(let r=0;r{try{return t.matches(e)}catch(t){return!1}})}let aD=["transform","translate","scale","rotate","perspective"],aj=["transform","translate","scale","rotate","perspective","filter"],aA=["paint","layout","strict","content"];function aP(t){let e=aF(),r=aw(t)?aI(t):t;return aD.some(t=>!!r[t]&&"none"!==r[t])||!!r.containerType&&"normal"!==r.containerType||!e&&!!r.backdropFilter&&"none"!==r.backdropFilter||!e&&!!r.filter&&"none"!==r.filter||aj.some(t=>(r.willChange||"").includes(t))||aA.some(t=>(r.contain||"").includes(t))}function aF(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let aL=new Set(["html","body","#document"]);function aR(t){return aL.has(ay(t))}function aI(t){return ax(t).getComputedStyle(t)}function aB(t){return aw(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function aN(t){if("html"===ay(t))return t;let e=t.assignedSlot||t.parentNode||aS(t)&&t.host||ab(t);return aS(e)?e.host:e}function aW(t,e,r){var i;void 0===e&&(e=[]),void 0===r&&(r=!0);let n=function t(e){let r=aN(e);return aR(r)?e.ownerDocument?e.ownerDocument.body:e.body:aC(r)&&aO(r)?r:t(r)}(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),o=ax(n);if(s){let t=aU(o);return e.concat(o,o.visualViewport||[],aO(n)?n:[],t&&r?aW(t):[])}return e.concat(n,aW(n,[],r))}function aU(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function aH(t){let e=aI(t),r=parseFloat(e.width)||0,i=parseFloat(e.height)||0,n=aC(t),s=n?t.offsetWidth:r,o=n?t.offsetHeight:i,a=o5(r)!==s||o5(i)!==o;return a&&(r=s,i=o),{width:r,height:i,$:a}}function aX(t){return aw(t)?t:t.contextElement}function aV(t){let e=aX(t);if(!aC(e))return o3(1);let r=e.getBoundingClientRect(),{width:i,height:n,$:s}=aH(e),o=(s?o5(r.width):r.width)/i,a=(s?o5(r.height):r.height)/n;return o&&Number.isFinite(o)||(o=1),a&&Number.isFinite(a)||(a=1),{x:o,y:a}}let aY=o3(0);function az(t){let e=ax(t);return aF()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:aY}function aG(t,e,r,i){var n;void 0===e&&(e=!1),void 0===r&&(r=!1);let s=t.getBoundingClientRect(),o=aX(t),a=o3(1);e&&(i?aw(i)&&(a=aV(i)):a=aV(t));let l=(void 0===(n=r)&&(n=!1),i&&(!n||i===ax(o))&&n)?az(o):o3(0),h=(s.left+l.x)/a.x,c=(s.top+l.y)/a.y,u=s.width/a.x,d=s.height/a.y;if(o){let t=ax(o),e=i&&aw(i)?ax(i):i,r=t,n=aU(r);for(;n&&i&&e!==r;){let t=aV(n),e=n.getBoundingClientRect(),i=aI(n),s=e.left+(n.clientLeft+parseFloat(i.paddingLeft))*t.x,o=e.top+(n.clientTop+parseFloat(i.paddingTop))*t.y;h*=t.x,c*=t.y,u*=t.x,d*=t.y,h+=s,c+=o,n=aU(r=ax(n))}}return au({width:u,height:d,x:h,y:c})}function aq(t,e){let r=aB(t).scrollLeft;return e?e.left+r:aG(ab(t)).left+r}function aK(t,e){let r=t.getBoundingClientRect();return{x:r.left+e.scrollLeft-aq(t,r),y:r.top+e.scrollTop}}let aQ=new Set(["absolute","fixed"]);function aJ(t,e,r){let i;if("viewport"===e)i=function(t,e){let r=ax(t),i=ab(t),n=r.visualViewport,s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(n){s=n.width,o=n.height;let t=aF();(!t||t&&"fixed"===e)&&(a=n.offsetLeft,l=n.offsetTop)}let h=aq(i);if(h<=0){let t=i.ownerDocument,e=t.body,r=getComputedStyle(e),n="CSS1Compat"===t.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(i.clientWidth-e.clientWidth-n);o<=25&&(s-=o)}else h<=25&&(s+=h);return{width:s,height:o,x:a,y:l}}(t,r);else if("document"===e)i=function(t){let e=ab(t),r=aB(t),i=t.ownerDocument.body,n=o2(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=o2(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),o=-r.scrollLeft+aq(t),a=-r.scrollTop;return"rtl"===aI(i).direction&&(o+=o2(e.clientWidth,i.clientWidth)-n),{width:n,height:s,x:o,y:a}}(ab(t));else if(aw(e))i=function(t,e){let r=aG(t,!0,"fixed"===e),i=r.top+t.clientTop,n=r.left+t.clientLeft,s=aC(t)?aV(t):o3(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y;return{width:o,height:a,x:n*s.x,y:i*s.y}}(e,r);else{let r=az(t);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return au(i)}function aZ(t){return"static"===aI(t).position}function a$(t,e){if(!aC(t)||"fixed"===aI(t).position)return null;if(e)return e(t);let r=t.offsetParent;return ab(t)===r&&(r=r.ownerDocument.body),r}function a0(t,e){var r;let i=ax(t);if(aE(t))return i;if(!aC(t)){let e=aN(t);for(;e&&!aR(e);){if(aw(e)&&!aZ(e))return e;e=aN(e)}return i}let n=a$(t,e);for(;n&&(r=n,ak.has(ay(r)))&&aZ(n);)n=a$(n,e);return n&&aR(n)&&aZ(n)&&!aP(n)?i:n||function(t){let e=aN(t);for(;aC(e)&&!aR(e);){if(aP(e))return e;if(aE(e))break;e=aN(e)}return null}(t)||i}let a1=async function(t){let e=this.getOffsetParent||a0,r=this.getDimensions,i=await r(t.floating);return{reference:function(t,e,r){let i=aC(e),n=ab(e),s="fixed"===r,o=aG(t,!0,s,e),a={scrollLeft:0,scrollTop:0},l=o3(0);if(i||!i&&!s)if(("body"!==ay(e)||aO(n))&&(a=aB(e)),i){let t=aG(e,!0,s,e);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else n&&(l.x=aq(n));s&&!i&&n&&(l.x=aq(n));let h=!n||i||s?o3(0):aK(n,a);return{x:o.left+a.scrollLeft-l.x-h.x,y:o.top+a.scrollTop-l.y-h.y,width:o.width,height:o.height}}(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}},a2={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:r,offsetParent:i,strategy:n}=t,s="fixed"===n,o=ab(i),a=!!e&&aE(e.floating);if(i===o||a&&s)return r;let l={scrollLeft:0,scrollTop:0},h=o3(1),c=o3(0),u=aC(i);if((u||!u&&!s)&&(("body"!==ay(i)||aO(o))&&(l=aB(i)),aC(i))){let t=aG(i);h=aV(i),c.x=t.x+i.clientLeft,c.y=t.y+i.clientTop}let d=!o||u||s?o3(0):aK(o,l);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-l.scrollLeft*h.x+c.x+d.x,y:r.y*h.y-l.scrollTop*h.y+c.y+d.y}},getDocumentElement:ab,getClippingRect:function(t){let{element:e,boundary:r,rootBoundary:i,strategy:n}=t,s=[..."clippingAncestors"===r?aE(e)?[]:function(t,e){let r=e.get(t);if(r)return r;let i=aW(t,[],!1).filter(t=>aw(t)&&"body"!==ay(t)),n=null,s="fixed"===aI(t).position,o=s?aN(t):t;for(;aw(o)&&!aR(o);){let e=aI(o),r=aP(o);r||"fixed"!==e.position||(n=null),(s?!r&&!n:!r&&"static"===e.position&&!!n&&aQ.has(n.position)||aO(o)&&!r&&function t(e,r){let i=aN(e);return!(i===r||!aw(i)||aR(i))&&("fixed"===aI(i).position||t(i,r))}(t,o))?i=i.filter(t=>t!==o):n=e,o=aN(o)}return e.set(t,i),i}(e,this._c):[].concat(r),i],o=s[0],a=s.reduce((t,r)=>{let i=aJ(e,r,n);return t.top=o2(i.top,t.top),t.right=o1(i.right,t.right),t.bottom=o1(i.bottom,t.bottom),t.left=o2(i.left,t.left),t},aJ(e,o,n));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:a0,getElementRects:a1,getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){let{width:e,height:r}=aH(t);return{width:e,height:r}},getScale:aV,isElement:aw,isRTL:function(t){return"rtl"===aI(t).direction}};function a5(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function a4(t,e,r,i){let n;void 0===i&&(i={});let{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:h=!1}=i,c=aX(t),u=s||o?[...c?aW(c):[],...aW(e)]:[];u.forEach(t=>{s&&t.addEventListener("scroll",r,{passive:!0}),o&&t.addEventListener("resize",r)});let d=c&&l?function(t,e){let r,i=null,n=ab(t);function s(){var t;clearTimeout(r),null==(t=i)||t.disconnect(),i=null}return!function o(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),s();let h=t.getBoundingClientRect(),{left:c,top:u,width:d,height:f}=h;if(a||e(),!d||!f)return;let g=o4(u),p=o4(n.clientWidth-(c+d)),m={rootMargin:-g+"px "+-p+"px "+-o4(n.clientHeight-(u+f))+"px "+-o4(c)+"px",threshold:o2(0,o1(1,l))||1},y=!0;function x(e){let i=e[0].intersectionRatio;if(i!==l){if(!y)return o();i?o(!1,i):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==i||a5(h,t.getBoundingClientRect())||o(),y=!1}try{i=new IntersectionObserver(x,{...m,root:n.ownerDocument})}catch(t){i=new IntersectionObserver(x,m)}i.observe(t)}(!0),s}(c,r):null,f=-1,g=null;a&&(g=new ResizeObserver(t=>{let[i]=t;i&&i.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var t;null==(t=g)||t.observe(e)})),r()}),c&&!h&&g.observe(c),g.observe(e));let p=h?aG(t):null;return h&&function e(){let i=aG(t);p&&!a5(p,i)&&r(),p=i,n=requestAnimationFrame(e)}(),r(),()=>{var t;u.forEach(t=>{s&&t.removeEventListener("scroll",r),o&&t.removeEventListener("resize",r)}),null==d||d(),null==(t=g)||t.disconnect(),g=null,h&&cancelAnimationFrame(n)}}var a3=t.i(74080),a9="undefined"!=typeof document?J.useLayoutEffect:function(){};function a6(t,e){let r,i,n;if(t===e)return!0;if(typeof t!=typeof e)return!1;if("function"==typeof t&&t.toString()===e.toString())return!0;if(t&&e&&"object"==typeof t){if(Array.isArray(t)){if((r=t.length)!==e.length)return!1;for(i=r;0!=i--;)if(!a6(t[i],e[i]))return!1;return!0}if((r=(n=Object.keys(t)).length)!==Object.keys(e).length)return!1;for(i=r;0!=i--;)if(!({}).hasOwnProperty.call(e,n[i]))return!1;for(i=r;0!=i--;){let r=n[i];if(("_owner"!==r||!t.$$typeof)&&!a6(t[r],e[r]))return!1}return!0}return t!=t&&e!=e}function a8(t){return"undefined"==typeof window?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function a7(t,e){let r=a8(t);return Math.round(e*r)/r}function lt(t){let e=J.useRef(t);return a9(()=>{e.current=t}),e}let le=(t,e)=>({...function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var r,i;let{x:n,y:s,placement:o,middlewareData:a}=e,l=await am(e,t);return o===(null==(r=a.offset)?void 0:r.placement)&&null!=(i=a.arrow)&&i.alignmentOffset?{}:{x:n+l.x,y:s+l.y,data:{...l,placement:o}}}}}(t),options:[t,e]}),lr=(t,e)=>({...function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var r,i,n,s,o;let{placement:a,middlewareData:l,rects:h,initialPlacement:c,platform:u,elements:d}=e,{mainAxis:f=!0,crossAxis:g=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...b}=o8(t,e);if(null!=(r=l.arrow)&&r.alignmentOffset)return{};let _=o7(a),w=ai(c),C=o7(c)===c,S=await (null==u.isRTL?void 0:u.isRTL(d.floating)),T=p||(C||!x?[ac(c)]:function(t){let e=ac(t);return[as(t),e,as(e)]}(c)),O="none"!==y;!p&&O&&T.push(...function(t,e,r,i){let n=at(t),s=function(t,e,r){switch(t){case"top":case"bottom":if(r)return e?aa:ao;return e?ao:aa;case"left":case"right":return e?al:ah;default:return[]}}(o7(t),"start"===r,i);return n&&(s=s.map(t=>t+"-"+n),e&&(s=s.concat(s.map(as)))),s}(c,x,y,S));let k=[c,...T],M=await ag(e,b),E=[],D=(null==(i=l.flip)?void 0:i.overflows)||[];if(f&&E.push(M[_]),g){let t=function(t,e,r){void 0===r&&(r=!1);let i=at(t),n=an(t),s=ae(n),o="x"===n?i===(r?"end":"start")?"right":"left":"start"===i?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ac(o)),[o,ac(o)]}(a,h,S);E.push(M[t[0]],M[t[1]])}if(D=[...D,{placement:a,overflows:E}],!E.every(t=>t<=0)){let t=((null==(n=l.flip)?void 0:n.index)||0)+1,e=k[t];if(e&&("alignment"!==g||w===ai(e)||D.every(t=>ai(t.placement)!==w||t.overflows[0]>0)))return{data:{index:t,overflows:D},reset:{placement:e}};let r=null==(s=D.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:s.placement;if(!r)switch(m){case"bestFit":{let t=null==(o=D.filter(t=>{if(O){let e=ai(t.placement);return e===w||"y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:o[0];t&&(r=t);break}case"initialPlacement":r=c}if(a!==r)return{reset:{placement:r}}}return{}}}}(t),options:[t,e]});t.i(47167);var li='input:not([inert]),select:not([inert]),textarea:not([inert]),a[href]:not([inert]),button:not([inert]),[tabindex]:not(slot):not([inert]),audio[controls]:not([inert]),video[controls]:not([inert]),[contenteditable]:not([contenteditable="false"]):not([inert]),details>summary:first-of-type:not([inert]),details:not([inert])',ln="undefined"==typeof Element,ls=ln?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,lo=!ln&&Element.prototype.getRootNode?function(t){var e;return null==t||null==(e=t.getRootNode)?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},la=function t(e,r){void 0===r&&(r=!0);var i,n=null==e||null==(i=e.getAttribute)?void 0:i.call(e,"inert");return""===n||"true"===n||r&&e&&t(e.parentNode)},ll=function(t){var e,r=null==t||null==(e=t.getAttribute)?void 0:e.call(t,"contenteditable");return""===r||"true"===r},lh=function(t,e,r){if(la(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(li));return e&&ls.call(t,li)&&i.unshift(t),i=i.filter(r)},lc=function t(e,r,i){for(var n=[],s=Array.from(e);s.length;){var o=s.shift();if(!la(o,!1))if("SLOT"===o.tagName){var a=o.assignedElements(),l=t(a.length?a:o.children,!0,i);i.flatten?n.push.apply(n,l):n.push({scopeParent:o,candidates:l})}else{ls.call(o,li)&&i.filter(o)&&(r||!e.includes(o))&&n.push(o);var h=o.shadowRoot||"function"==typeof i.getShadowRoot&&i.getShadowRoot(o),c=!la(h,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(o));if(h&&c){var u=t(!0===h?o.children:h.children,!0,i);i.flatten?n.push.apply(n,u):n.push({scopeParent:o,candidates:u})}else s.unshift.apply(s,o.children)}}return n},lu=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},ld=function(t){if(!t)throw Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||ll(t))&&!lu(t)?0:t.tabIndex},lf=function(t,e){var r=ld(t);return r<0&&e&&!lu(t)?0:r},lg=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},lp=function(t){return"INPUT"===t.tagName},lm=function(t,e){for(var r=0;rsummary:first-of-type")?t.parentElement:t;if(ls.call(n,"details:not([open]) *"))return!0;if(r&&"full"!==r&&"legacy-full"!==r){if("non-zero-area"===r)return lb(t)}else{if("function"==typeof i){for(var s=t;t;){var o=t.parentElement,a=lo(t);if(o&&!o.shadowRoot&&!0===i(o))return lb(t);t=t.assignedSlot?t.assignedSlot:o||a===t.ownerDocument?o:a.host}t=s}if(lx(t))return!t.getClientRects().length;if("legacy-full"!==r)return!0}return!1},lw=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var r=0;rld(e))&&!!lC(t,e)},lT=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!isNaN(e)||!!(e>=0)},lO=function t(e){var r=[],i=[];return e.forEach(function(e,n){var s=!!e.scopeParent,o=s?e.scopeParent:e,a=lf(o,s),l=s?t(e.candidates):o;0===a?s?r.push.apply(r,l):r.push(o):i.push({documentOrder:n,tabIndex:a,item:e,isScope:s,content:l})}),i.sort(lg).reduce(function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t},[]).concat(r)},lk=function(t,e){return lO((e=e||{}).getShadowRoot?lc([t],e.includeContainer,{filter:lS.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:lT}):lh(t,e.includeContainer,lS.bind(null,e)))},lM=function(t,e){return(e=e||{}).getShadowRoot?lc([t],e.includeContainer,{filter:lC.bind(null,e),flatten:!0,getShadowRoot:e.getShadowRoot}):lh(t,e.includeContainer,lC.bind(null,e))},lE=function(t,e){if(e=e||{},!t)throw Error("No node provided");return!1!==ls.call(t,li)&&lS(e,t)};function lD(){let t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(t=>{let{brand:e,version:r}=t;return e+"/"+r}).join(" "):navigator.userAgent}function lj(){let t=/android/i;return t.test(function(){let t=navigator.userAgentData;return null!=t&&t.platform?t.platform:navigator.platform}())||t.test(lD())}let lA="data-floating-ui-focusable";function lP(t){let e=t.activeElement;for(;(null==(r=e)||null==(r=r.shadowRoot)?void 0:r.activeElement)!=null;){var r;e=e.shadowRoot.activeElement}return e}function lF(t,e){if(!t||!e)return!1;let r=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(r&&aS(r)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function lL(t){return"composedPath"in t?t.composedPath()[0]:t.target}function lR(t,e){return null!=e&&("composedPath"in t?t.composedPath().includes(e):null!=t.target&&e.contains(t.target))}function lI(t){return(null==t?void 0:t.ownerDocument)||document}function lB(t){return aC(t)&&t.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function lN(t){return!!t&&"combobox"===t.getAttribute("role")&&lB(t)}function lW(t){return t?t.hasAttribute(lA)?t:t.querySelector("["+lA+"]")||t:null}function lU(t,e,r){return void 0===r&&(r=!0),t.filter(t=>{var i;return t.parentId===e&&(!r||(null==(i=t.context)?void 0:i.open))}).flatMap(e=>[e,...lU(t,e.id,r)])}function lH(t,e){var r;let i=[],n=null==(r=t.find(t=>t.id===e))?void 0:r.parentId;for(;n;){let e=t.find(t=>t.id===n);n=null==e?void 0:e.parentId,e&&(i=i.concat(e))}return i}function lX(t){t.preventDefault(),t.stopPropagation()}function lV(t,e){let r=["mouse","pen"];return e||r.push("",void 0),r.includes(t)}var lY="undefined"!=typeof document?J.useLayoutEffect:function(){};function lz(t){let e=J.useRef(t);return lY(()=>{e.current=t}),e}let lG={...J}.useInsertionEffect||(t=>t());function lq(t){let e=J.useRef(()=>{});return lG(()=>{e.current=t}),J.useCallback(function(){for(var t=arguments.length,r=Array(t),i=0;i({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function lQ(t,e){let r=lk(t,lK()),i=r.length;if(0===i)return;let n=lP(lI(t)),s=r.indexOf(n);return r[-1===s?1===e?0:i-1:s+e]}function lJ(t,e){let r=e||t.currentTarget,i=t.relatedTarget;return!i||!lF(r,i)}let lZ="active",l$="selected",l0={...J},l1=!1,l2=0,l5=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+l2++,l4=l0.useId||function(){let[t,e]=J.useState(()=>l1?l5():void 0);return lY(()=>{null==t&&e(l5())},[]),J.useEffect(()=>{l1=!0},[]),t},l3=J.createContext(null),l9=J.createContext(null),l6=()=>{var t;return(null==(t=J.useContext(l3))?void 0:t.id)||null},l8=()=>J.useContext(l9);function l7(t){return"data-floating-ui-"+t}let ht=0;function he(t,e){void 0===e&&(e={});let{preventScroll:r=!1,cancelPrevious:i=!0,sync:n=!1}=e;i&&cancelAnimationFrame(ht);let s=()=>null==t?void 0:t.focus({preventScroll:r});n?s():ht=requestAnimationFrame(s)}let hr={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function hi(t){return"inert"===t?hr.inert:"aria-hidden"===t?hr["aria-hidden"]:hr.none}let hn=new WeakSet,hs={},ho=0,ha=t=>t&&(t.host||ha(t.parentNode));function hl(t,e,r){var i;void 0===e&&(e=!1),void 0===r&&(r=!1);let n=((null==(i=t[0])?void 0:i.ownerDocument)||document).body;return function(t,e,r,i){let n="data-floating-ui-inert",s=i?"inert":r?"aria-hidden":null,o=t.map(t=>{if(e.contains(t))return t;let r=ha(t);return e.contains(r)?r:null}).filter(t=>null!=t),a=new Set,l=new Set(o),h=[];hs[n]||(hs[n]=new WeakMap);let c=hs[n];return o.forEach(function t(e){!(!e||a.has(e))&&(a.add(e),e.parentNode&&t(e.parentNode))}),function t(e){!e||l.has(e)||[].forEach.call(e.children,e=>{if("script"!==ay(e))if(a.has(e))t(e);else{let t=s?e.getAttribute(s):null,r=null!==t&&"false"!==t,i=hi(s),o=(i.get(e)||0)+1,a=(c.get(e)||0)+1;i.set(e,o),c.set(e,a),h.push(e),1===o&&r&&hn.add(e),1===a&&e.setAttribute(n,""),!r&&s&&e.setAttribute(s,"inert"===s?"":"true")}})}(e),a.clear(),ho++,()=>{h.forEach(t=>{let e=hi(s),r=(e.get(t)||0)-1,i=(c.get(t)||0)-1;e.set(t,r),c.set(t,i),r||(!hn.has(t)&&s&&t.removeAttribute(s),hn.delete(t)),i||t.removeAttribute(n)}),--ho||(hr.inert=new WeakMap,hr["aria-hidden"]=new WeakMap,hr.none=new WeakMap,hn=new WeakSet,hs={})}}(t.concat(Array.from(n.querySelectorAll('[aria-live],[role="status"],output'))),n,e,r)}let hh={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},hc=J.forwardRef(function(t,e){let[r,i]=J.useState();lY(()=>{/apple/i.test(navigator.vendor)&&i("button")},[]);let n={ref:e,tabIndex:0,role:r,"aria-hidden":!r||void 0,[l7("focus-guard")]:"",style:hh};return(0,Q.jsx)("span",{...t,...n})}),hu=J.createContext(null);function hd(t){return J.useMemo(()=>e=>{t.forEach(t=>{t&&(t.current=e)})},t)}let hf=[];function hg(){hf=hf.filter(t=>t.isConnected)}function hp(){return hg(),hf[hf.length-1]}function hm(t,e){var r;if(!e.current.includes("floating")&&!(null!=(r=t.getAttribute("role"))&&r.includes("dialog")))return;let i=lK(),n=lM(t,i).filter(t=>{let e=t.getAttribute("data-tabindex")||"";return lE(t,i)||t.hasAttribute("data-tabindex")&&!e.startsWith("-")}),s=t.getAttribute("tabindex");e.current.includes("floating")||0===n.length?"0"!==s&&t.setAttribute("tabindex","0"):("-1"!==s||t.hasAttribute("data-tabindex")&&"-1"!==t.getAttribute("data-tabindex"))&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}let hv=J.forwardRef(function(t,e){return(0,Q.jsx)("button",{...t,type:"button",ref:e,tabIndex:-1,style:hh})});function hy(t){let{context:e,children:r,disabled:i=!1,order:n=["content"],guards:s=!0,initialFocus:o=0,returnFocus:a=!0,restoreFocus:l=!1,modal:h=!0,visuallyHiddenDismiss:c=!1,closeOnFocusOut:u=!0,outsideElementsInert:d=!1,getInsideElements:f=()=>[]}=t,{open:g,onOpenChange:p,events:m,dataRef:y,elements:{domReference:x,floating:b}}=e,_=lq(()=>{var t;return null==(t=y.current.floatingContext)?void 0:t.nodeId}),w=lq(f),C="number"==typeof o&&o<0,S=lN(x)&&C,T="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,O=!T||s,k=!O||T&&d,M=lz(n),E=lz(o),D=lz(a),j=l8(),A=J.useContext(hu),P=J.useRef(null),F=J.useRef(null),L=J.useRef(!1),R=J.useRef(!1),I=J.useRef(-1),B=J.useRef(-1),N=null!=A,W=lW(b),U=lq(function(t){return void 0===t&&(t=W),t?lk(t,lK()):[]}),H=lq(t=>{let e=U(t);return M.current.map(t=>x&&"reference"===t?x:W&&"floating"===t?W:e).filter(Boolean).flat()});J.useEffect(()=>{if(i||!h)return;function t(t){if("Tab"===t.key){lF(W,lP(lI(W)))&&0===U().length&&!S&&lX(t);let e=H(),r=lL(t);"reference"===M.current[0]&&r===x&&(lX(t),t.shiftKey?he(e[e.length-1]):he(e[1])),"floating"===M.current[1]&&r===W&&t.shiftKey&&(lX(t),he(e[0]))}}let e=lI(W);return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}},[i,x,W,h,M,S,U,H]),J.useEffect(()=>{if(!i&&b)return b.addEventListener("focusin",t),()=>{b.removeEventListener("focusin",t)};function t(t){let e=lL(t),r=U().indexOf(e);-1!==r&&(I.current=r)}},[i,b,U]),J.useEffect(()=>{if(i||!u)return;function t(){R.current=!0,setTimeout(()=>{R.current=!1})}function e(t){let e=t.relatedTarget,r=t.currentTarget,i=lL(t);queueMicrotask(()=>{let n=_(),s=!(lF(x,e)||lF(b,e)||lF(e,b)||lF(null==A?void 0:A.portalNode,e)||null!=e&&e.hasAttribute(l7("focus-guard"))||j&&(lU(j.nodesRef.current,n).find(t=>{var r,i;return lF(null==(r=t.context)?void 0:r.elements.floating,e)||lF(null==(i=t.context)?void 0:i.elements.domReference,e)})||lH(j.nodesRef.current,n).find(t=>{var r,i,n;return[null==(r=t.context)?void 0:r.elements.floating,lW(null==(i=t.context)?void 0:i.elements.floating)].includes(e)||(null==(n=t.context)?void 0:n.elements.domReference)===e})));if(r===x&&W&&hm(W,M),l&&r!==x&&!(null!=i&&i.isConnected)&&lP(lI(W))===lI(W).body){aC(W)&&W.focus();let t=I.current,e=U(),r=e[t]||e[e.length-1]||W;aC(r)&&r.focus()}if(y.current.insideReactTree){y.current.insideReactTree=!1;return}(S||!h)&&e&&s&&!R.current&&e!==hp()&&(L.current=!0,p(!1,t,"focus-out"))})}let r=!!(!j&&A);function n(){-1!==B.current&&(clearTimeout(B.current),B.current=-1),y.current.insideReactTree=!0,B.current=window.setTimeout(()=>{y.current.insideReactTree=!1})}if(b&&aC(x))return x.addEventListener("focusout",e),x.addEventListener("pointerdown",t),b.addEventListener("focusout",e),r&&b.addEventListener("focusout",n,!0),()=>{x.removeEventListener("focusout",e),x.removeEventListener("pointerdown",t),b.removeEventListener("focusout",e),r&&b.removeEventListener("focusout",n,!0)}},[i,x,b,W,h,j,A,p,u,l,U,S,_,M,y]);let X=J.useRef(null),V=J.useRef(null),Y=hd([X,null==A?void 0:A.beforeInsideRef]),z=hd([V,null==A?void 0:A.afterInsideRef]);function G(t){return!i&&c&&h?(0,Q.jsx)(hv,{ref:"start"===t?P:F,onClick:t=>p(!1,t.nativeEvent),children:"string"==typeof c?c:"Dismiss"}):null}J.useEffect(()=>{var t,e;if(i||!b)return;let r=Array.from((null==A||null==(t=A.portalNode)?void 0:t.querySelectorAll("["+l7("portal")+"]"))||[]),n=[b,null==(e=(j?lH(j.nodesRef.current,_()):[]).find(t=>{var e;return lN((null==(e=t.context)?void 0:e.elements.domReference)||null)}))||null==(e=e.context)?void 0:e.elements.domReference,...r,...w(),P.current,F.current,X.current,V.current,null==A?void 0:A.beforeOutsideRef.current,null==A?void 0:A.afterOutsideRef.current,M.current.includes("reference")||S?x:null].filter(t=>null!=t),s=h||S?hl(n,!k,k):hl(n);return()=>{s()}},[i,x,b,h,M,A,S,O,k,j,_,w]),lY(()=>{if(i||!aC(W))return;let t=lP(lI(W));queueMicrotask(()=>{let e=H(W),r=E.current,i=("number"==typeof r?e[r]:r.current)||W,n=lF(W,t);C||n||!g||he(i,{preventScroll:i===W})})},[i,g,W,C,H,E]),lY(()=>{var t;if(i||!W)return;let e=lI(W);function r(t){let{reason:e,event:r,nested:i}=t;if(["hover","safe-polygon"].includes(e)&&"mouseleave"===r.type&&(L.current=!0),"outside-press"===e)if(i)L.current=!1;else if(0===r.mozInputSource&&r.isTrusted||(lj()&&r.pointerType?"click"===r.type&&1===r.buttons:0===r.detail&&!r.pointerType)||!lD().includes("jsdom/")&&(!lj()&&0===r.width&&0===r.height||lj()&&1===r.width&&1===r.height&&0===r.pressure&&0===r.detail&&"mouse"===r.pointerType||r.width<1&&r.height<1&&0===r.pressure&&0===r.detail&&"touch"===r.pointerType))L.current=!1;else{let t=!1;document.createElement("div").focus({get preventScroll(){return t=!0,!1}}),t?L.current=!1:L.current=!0}}t=lP(e),hg(),t&&"body"!==ay(t)&&(hf.push(t),hf.length>20&&(hf=hf.slice(-20))),m.on("openchange",r);let n=e.createElement("span");return n.setAttribute("tabindex","-1"),n.setAttribute("aria-hidden","true"),Object.assign(n.style,hh),N&&x&&x.insertAdjacentElement("afterend",n),()=>{m.off("openchange",r);let t=lP(e),i=lF(b,t)||j&&lU(j.nodesRef.current,_(),!1).some(e=>{var r;return lF(null==(r=e.context)?void 0:r.elements.floating,t)}),s=function(){if("boolean"==typeof D.current){let t=x||hp();return t&&t.isConnected?t:n}return D.current.current||n}();queueMicrotask(()=>{let r=function(t){let e=lK();return lE(t,e)?t:lk(t,e)[0]||t}(s);D.current&&!L.current&&aC(r)&&(r===t||t===e.body||i)&&r.focus({preventScroll:!0}),n.remove()})}},[i,b,W,D,y,m,j,N,x,_]),J.useEffect(()=>(queueMicrotask(()=>{L.current=!1}),()=>{queueMicrotask(hg)}),[i]),lY(()=>{if(!i&&A)return A.setFocusManagerState({modal:h,closeOnFocusOut:u,open:g,onOpenChange:p,domReference:x}),()=>{A.setFocusManagerState(null)}},[i,A,h,g,p,u,x]),lY(()=>{!i&&W&&hm(W,M)},[i,W,M]);let q=!i&&O&&(!h||!S)&&(N||h);return(0,Q.jsxs)(Q.Fragment,{children:[q&&(0,Q.jsx)(hc,{"data-type":"inside",ref:Y,onFocus:t=>{var e;if(h){let t=H();he("reference"===n[0]?t[0]:t[t.length-1])}else if(null!=A&&A.preserveTabOrder&&A.portalNode)if(L.current=!1,lJ(t,A.portalNode)){let t=lQ(lI(x).body,1)||x;null==t||t.focus()}else null==(e=A.beforeOutsideRef.current)||e.focus()}}),!S&&G("start"),r,G("end"),q&&(0,Q.jsx)(hc,{"data-type":"inside",ref:z,onFocus:t=>{var e;if(h)he(H()[0]);else if(null!=A&&A.preserveTabOrder&&A.portalNode)if(u&&(L.current=!0),lJ(t,A.portalNode)){let t=lQ(lI(x).body,-1)||x;null==t||t.focus()}else null==(e=A.afterOutsideRef.current)||e.focus()}})]})}function hx(t){return aC(t.target)&&"BUTTON"===t.target.tagName}function hb(t,e){void 0===e&&(e={});let{open:r,onOpenChange:i,dataRef:n,elements:{domReference:s}}=t,{enabled:o=!0,event:a="click",toggle:l=!0,ignoreMouse:h=!1,keyboardHandlers:c=!0,stickIfOpen:u=!0}=e,d=J.useRef(),f=J.useRef(!1),g=J.useMemo(()=>({onPointerDown(t){d.current=t.pointerType},onMouseDown(t){let e=d.current;0===t.button&&"click"!==a&&(lV(e,!0)&&h||(r&&l&&(!n.current.openEvent||!u||"mousedown"===n.current.openEvent.type)?i(!1,t.nativeEvent,"click"):(t.preventDefault(),i(!0,t.nativeEvent,"click"))))},onClick(t){let e=d.current;if("mousedown"===a&&d.current){d.current=void 0;return}lV(e,!0)&&h||(r&&l&&(!n.current.openEvent||!u||"click"===n.current.openEvent.type)?i(!1,t.nativeEvent,"click"):i(!0,t.nativeEvent,"click"))},onKeyDown(t){d.current=void 0,!(t.defaultPrevented||!c||hx(t))&&(" "!==t.key||lB(s)||(t.preventDefault(),f.current=!0),aC(t.target)&&"A"===t.target.tagName||"Enter"!==t.key||(r&&l?i(!1,t.nativeEvent,"click"):i(!0,t.nativeEvent,"click")))},onKeyUp(t){!(t.defaultPrevented||!c||hx(t)||lB(s))&&" "===t.key&&f.current&&(f.current=!1,r&&l?i(!1,t.nativeEvent,"click"):i(!0,t.nativeEvent,"click"))}}),[n,s,a,h,c,i,r,u,l]);return J.useMemo(()=>o?{reference:g}:{},[o,g])}let h_={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},hw={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},hC=t=>{var e,r;return{escapeKey:"boolean"==typeof t?t:null!=(e=null==t?void 0:t.escapeKey)&&e,outsidePress:"boolean"==typeof t?t:null==(r=null==t?void 0:t.outsidePress)||r}};function hS(t,e){void 0===e&&(e={});let{open:r,onOpenChange:i,elements:n,dataRef:s}=t,{enabled:o=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:h="pointerdown",referencePress:c=!1,referencePressEvent:u="pointerdown",ancestorScroll:d=!1,bubbles:f,capture:g}=e,p=l8(),m=lq("function"==typeof l?l:()=>!1),y="function"==typeof l?m:l,x=J.useRef(!1),{escapeKey:b,outsidePress:_}=hC(f),{escapeKey:w,outsidePress:C}=hC(g),S=J.useRef(!1),T=lq(t=>{var e;if(!r||!o||!a||"Escape"!==t.key||S.current)return;let n=null==(e=s.current.floatingContext)?void 0:e.nodeId,l=p?lU(p.nodesRef.current,n):[];if(!b&&(t.stopPropagation(),l.length>0)){let t=!0;if(l.forEach(e=>{var r;if(null!=(r=e.context)&&r.open&&!e.context.dataRef.current.__escapeKeyBubbles){t=!1;return}}),!t)return}i(!1,"nativeEvent"in t?t.nativeEvent:t,"escape-key")}),O=lq(t=>{var e;let r=()=>{var e;T(t),null==(e=lL(t))||e.removeEventListener("keydown",r)};null==(e=lL(t))||e.addEventListener("keydown",r)}),k=lq(t=>{var e;let r=s.current.insideReactTree;s.current.insideReactTree=!1;let o=x.current;if(x.current=!1,"click"===h&&o||r||"function"==typeof y&&!y(t))return;let a=lL(t),l="["+l7("inert")+"]",c=lI(n.floating).querySelectorAll(l),u=aw(a)?a:null;for(;u&&!aR(u);){let t=aN(u);if(aR(t)||!aw(t))break;u=t}if(c.length&&aw(a)&&!a.matches("html,body")&&!lF(a,n.floating)&&Array.from(c).every(t=>!lF(u,t)))return;if(aC(a)&&D){let e=aR(a),r=aI(a),i=/auto|scroll/,n=e||i.test(r.overflowX),s=e||i.test(r.overflowY),o=n&&a.clientWidth>0&&a.scrollWidth>a.clientWidth,l=s&&a.clientHeight>0&&a.scrollHeight>a.clientHeight,h="rtl"===r.direction,c=l&&(h?t.offsetX<=a.offsetWidth-a.clientWidth:t.offsetX>a.clientWidth),u=o&&t.offsetY>a.clientHeight;if(c||u)return}let d=null==(e=s.current.floatingContext)?void 0:e.nodeId,f=p&&lU(p.nodesRef.current,d).some(e=>{var r;return lR(t,null==(r=e.context)?void 0:r.elements.floating)});if(lR(t,n.floating)||lR(t,n.domReference)||f)return;let g=p?lU(p.nodesRef.current,d):[];if(g.length>0){let t=!0;if(g.forEach(e=>{var r;if(null!=(r=e.context)&&r.open&&!e.context.dataRef.current.__outsidePressBubbles){t=!1;return}}),!t)return}i(!1,t,"outside-press")}),M=lq(t=>{var e;let r=()=>{var e;k(t),null==(e=lL(t))||e.removeEventListener(h,r)};null==(e=lL(t))||e.addEventListener(h,r)});J.useEffect(()=>{if(!r||!o)return;s.current.__escapeKeyBubbles=b,s.current.__outsidePressBubbles=_;let t=-1;function e(t){i(!1,t,"ancestor-scroll")}function l(){window.clearTimeout(t),S.current=!0}function c(){t=window.setTimeout(()=>{S.current=!1},5*!!aF())}let u=lI(n.floating);a&&(u.addEventListener("keydown",w?O:T,w),u.addEventListener("compositionstart",l),u.addEventListener("compositionend",c)),y&&u.addEventListener(h,C?M:k,C);let f=[];return d&&(aw(n.domReference)&&(f=aW(n.domReference)),aw(n.floating)&&(f=f.concat(aW(n.floating))),!aw(n.reference)&&n.reference&&n.reference.contextElement&&(f=f.concat(aW(n.reference.contextElement)))),(f=f.filter(t=>{var e;return t!==(null==(e=u.defaultView)?void 0:e.visualViewport)})).forEach(t=>{t.addEventListener("scroll",e,{passive:!0})}),()=>{a&&(u.removeEventListener("keydown",w?O:T,w),u.removeEventListener("compositionstart",l),u.removeEventListener("compositionend",c)),y&&u.removeEventListener(h,C?M:k,C),f.forEach(t=>{t.removeEventListener("scroll",e)}),window.clearTimeout(t)}},[s,n,a,y,h,r,i,d,o,b,_,T,w,O,k,C,M]),J.useEffect(()=>{s.current.insideReactTree=!1},[s,y,h]);let E=J.useMemo(()=>({onKeyDown:T,...c&&{[h_[u]]:t=>{i(!1,t.nativeEvent,"reference-press")},..."click"!==u&&{onClick(t){i(!1,t.nativeEvent,"reference-press")}}}}),[T,i,c,u]),D=J.useMemo(()=>({onKeyDown:T,onMouseDown(){x.current=!0},onMouseUp(){x.current=!0},[hw[h]]:()=>{s.current.insideReactTree=!0}}),[T,h,s]);return J.useMemo(()=>o?{reference:E,floating:D}:{},[o,E,D])}function hT(t){void 0===t&&(t={});let{nodeId:e}=t,r=function(t){let{open:e=!1,onOpenChange:r,elements:i}=t,n=l4(),s=J.useRef({}),[o]=J.useState(()=>(function(){let t=new Map;return{emit(e,r){var i;null==(i=t.get(e))||i.forEach(t=>t(r))},on(e,r){t.has(e)||t.set(e,new Set),t.get(e).add(r)},off(e,r){var i;null==(i=t.get(e))||i.delete(r)}}})()),a=null!=l6(),[l,h]=J.useState(i.reference),c=lq((t,e,i)=>{s.current.openEvent=t?e:void 0,o.emit("openchange",{open:t,event:e,reason:i,nested:a}),null==r||r(t,e,i)}),u=J.useMemo(()=>({setPositionReference:h}),[]),d=J.useMemo(()=>({reference:l||i.reference||null,floating:i.floating||null,domReference:i.reference}),[l,i.reference,i.floating]);return J.useMemo(()=>({dataRef:s,open:e,onOpenChange:c,elements:d,events:o,floatingId:n,refs:u}),[e,c,d,o,n,u])}({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||r,n=i.elements,[s,o]=J.useState(null),[a,l]=J.useState(null),h=(null==n?void 0:n.domReference)||s,c=J.useRef(null),u=l8();lY(()=>{h&&(c.current=h)},[h]);let d=function(t){void 0===t&&(t={});let{placement:e="bottom",strategy:r="absolute",middleware:i=[],platform:n,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:h}=t,[c,u]=J.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[d,f]=J.useState(i);a6(d,i)||f(i);let[g,p]=J.useState(null),[m,y]=J.useState(null),x=J.useCallback(t=>{t!==C.current&&(C.current=t,p(t))},[]),b=J.useCallback(t=>{t!==S.current&&(S.current=t,y(t))},[]),_=s||g,w=o||m,C=J.useRef(null),S=J.useRef(null),T=J.useRef(c),O=null!=l,k=lt(l),M=lt(n),E=lt(h),D=J.useCallback(()=>{if(!C.current||!S.current)return;let t={placement:e,strategy:r,middleware:d};M.current&&(t.platform=M.current),((t,e,r)=>{let i=new Map,n={platform:a2,...r},s={...n.platform,_c:i};return af(t,e,{...n,platform:s})})(C.current,S.current,t).then(t=>{let e={...t,isPositioned:!1!==E.current};j.current&&!a6(T.current,e)&&(T.current=e,a3.flushSync(()=>{u(e)}))})},[d,e,r,M,E]);a9(()=>{!1===h&&T.current.isPositioned&&(T.current.isPositioned=!1,u(t=>({...t,isPositioned:!1})))},[h]);let j=J.useRef(!1);a9(()=>(j.current=!0,()=>{j.current=!1}),[]),a9(()=>{if(_&&(C.current=_),w&&(S.current=w),_&&w){if(k.current)return k.current(_,w,D);D()}},[_,w,D,k,O]);let A=J.useMemo(()=>({reference:C,floating:S,setReference:x,setFloating:b}),[x,b]),P=J.useMemo(()=>({reference:_,floating:w}),[_,w]),F=J.useMemo(()=>{let t={position:r,left:0,top:0};if(!P.floating)return t;let e=a7(P.floating,c.x),i=a7(P.floating,c.y);return a?{...t,transform:"translate("+e+"px, "+i+"px)",...a8(P.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:e,top:i}},[r,a,P.floating,c.x,c.y]);return J.useMemo(()=>({...c,update:D,refs:A,elements:P,floatingStyles:F}),[c,D,A,P,F])}({...t,elements:{...n,...a&&{reference:a}}}),f=J.useCallback(t=>{let e=aw(t)?{getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>t.getClientRects(),contextElement:t}:t;l(e),d.refs.setReference(e)},[d.refs]),g=J.useCallback(t=>{(aw(t)||null===t)&&(c.current=t,o(t)),(aw(d.refs.reference.current)||null===d.refs.reference.current||null!==t&&!aw(t))&&d.refs.setReference(t)},[d.refs]),p=J.useMemo(()=>({...d.refs,setReference:g,setPositionReference:f,domReference:c}),[d.refs,g,f]),m=J.useMemo(()=>({...d.elements,domReference:h}),[d.elements,h]),y=J.useMemo(()=>({...d,...i,refs:p,elements:m,nodeId:e}),[d,p,m,e,i]);return lY(()=>{i.dataRef.current.floatingContext=y;let t=null==u?void 0:u.nodesRef.current.find(t=>t.id===e);t&&(t.context=y)}),J.useMemo(()=>({...d,context:y,refs:p,elements:m}),[d,p,m,y])}function hO(t,e,r){let i=new Map,n="item"===r,s=t;if(n&&t){let{[lZ]:e,[l$]:r,...i}=t;s=i}return{..."floating"===r&&{tabIndex:-1,"data-floating-ui-focusable":""},...s,...e.map(e=>{let i=e?e[r]:null;return"function"==typeof i?t?i(t):null:i}).concat(t).reduce((t,e)=>(e&&Object.entries(e).forEach(e=>{let[r,s]=e;if(!(n&&[lZ,l$].includes(r)))if(0===r.indexOf("on")){if(i.has(r)||i.set(r,[]),"function"==typeof s){var o;null==(o=i.get(r))||o.push(s),t[r]=function(){for(var t,e=arguments.length,n=Array(e),s=0;st(...n)).find(t=>void 0!==t)}}}else t[r]=s}),t),{})}}function hk(t){void 0===t&&(t=[]);let e=t.map(t=>null==t?void 0:t.reference),r=t.map(t=>null==t?void 0:t.floating),i=t.map(t=>null==t?void 0:t.item),n=J.useCallback(e=>hO(e,t,"reference"),e),s=J.useCallback(e=>hO(e,t,"floating"),r),o=J.useCallback(e=>hO(e,t,"item"),i);return J.useMemo(()=>({getReferenceProps:n,getFloatingProps:s,getItemProps:o}),[n,s,o])}let hM=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hE(t,e){var r,i;void 0===e&&(e={});let{open:n,elements:s,floatingId:o}=t,{enabled:a=!0,role:l="dialog"}=e,h=l4(),c=(null==(r=s.domReference)?void 0:r.id)||h,u=J.useMemo(()=>{var t;return(null==(t=lW(s.floating))?void 0:t.id)||o},[s.floating,o]),d=null!=(i=hM.get(l))?i:l,f=null!=l6(),g=J.useMemo(()=>"tooltip"===d||"label"===l?{["aria-"+("label"===l?"labelledby":"describedby")]:n?u:void 0}:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===d?"dialog":d,"aria-controls":n?u:void 0,..."listbox"===d&&{role:"combobox"},..."menu"===d&&{id:c},..."menu"===d&&f&&{role:"menuitem"},..."select"===l&&{"aria-autocomplete":"none"},..."combobox"===l&&{"aria-autocomplete":"list"}},[d,u,f,n,c,l]),p=J.useMemo(()=>{let t={id:u,...d&&{role:d}};return"tooltip"===d||"label"===l?t:{...t,..."menu"===d&&{"aria-labelledby":c}}},[d,u,c,l]),m=J.useCallback(t=>{let{active:e,selected:r}=t,i={role:"option",...e&&{id:u+"-fui-option"}};switch(l){case"select":case"combobox":return{...i,"aria-selected":r}}return{}},[u,l]);return J.useMemo(()=>a?{reference:g,floating:p,item:m}:{},[a,g,p,m])}var hD=t.i(40141);function hj(t){return(0,hD.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M6.9998 6V3C6.9998 2.44772 7.44752 2 7.9998 2H19.9998C20.5521 2 20.9998 2.44772 20.9998 3V17C20.9998 17.5523 20.5521 18 19.9998 18H16.9998V20.9991C16.9998 21.5519 16.5499 22 15.993 22H4.00666C3.45059 22 3 21.5554 3 20.9991L3.0026 7.00087C3.0027 6.44811 3.45264 6 4.00942 6H6.9998ZM8.9998 6H16.9998V16H18.9998V4H8.9998V6Z"},child:[]}]})(t)}function hA(t){return(0,hD.GenIcon)({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5 2a1 1 0 011 1v1h1a1 1 0 010 2H6v1a1 1 0 01-2 0V6H3a1 1 0 010-2h1V3a1 1 0 011-1zm0 10a1 1 0 011 1v1h1a1 1 0 110 2H6v1a1 1 0 11-2 0v-1H3a1 1 0 110-2h1v-1a1 1 0 011-1zM12 2a1 1 0 01.967.744L14.146 7.2 17.5 9.134a1 1 0 010 1.732l-3.354 1.935-1.18 4.455a1 1 0 01-1.933 0L9.854 12.8 6.5 10.866a1 1 0 010-1.732l3.354-1.935 1.18-4.455A1 1 0 0112 2z",clipRule:"evenodd"},child:[]}]})(t)}var hP=t.i(11152);function hF(t){return(0,hD.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M123.193 29.635L121 406.18l84.31-82.836 65.87 159.02 67.5-27.96-65.87-159.02L391 294.342z"},child:[]}]})(t)}function hL(t){return(0,hD.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M149.9 302.2c-39.1 0-70.7 31-70.7 69.3 0 30.3-27.3 46.2-47.2 46.2C53.7 446 90.7 464 126.3 464c52.1 0 94.3-41.4 94.3-92.4 0-38.4-31.6-69.4-70.7-69.4zM473.1 85.7l-31.6-31c-9.2-9-24-9-33.2 0L197 261.8l64.8 63.5 211.2-207c9.3-9 9.3-23.6.1-32.6z"},child:[]}]})(t)}function hR(t){return(0,hD.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M96 448h106.7V64H96v384zM309.3 64v384H416V64H309.3z"},child:[]}]})(t)}function hI(t){return(0,hD.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M96 52v408l320-204L96 52z"},child:[]}]})(t)}function hB(t){return(0,hD.GenIcon)({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M11.904 16c1.777-3.219 2.076-8.13-4.904-7.966v3.966l-6-6 6-6v3.881c8.359-0.218 9.29 7.378 4.904 12.119z"},child:[]}]})(t)}function hN(t){return(0,hD.GenIcon)({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9 3.881v-3.881l6 6-6 6v-3.966c-6.98-0.164-6.681 4.747-4.904 7.966-4.386-4.741-3.455-12.337 4.904-12.119z"},child:[]}]})(t)}function hW(t){return(0,hD.GenIcon)({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8 0c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zM2 8c0-3.314 2.686-6 6-6v12c-3.314 0-6-2.686-6-6z"},child:[]}]})(t)}function hU(t){return(0,hD.GenIcon)({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8 4c-2.209 0-4 1.791-4 4s1.791 4 4 4 4-1.791 4-4-1.791-4-4-4zM8 10.5v-5c1.379 0 2.5 1.122 2.5 2.5s-1.121 2.5-2.5 2.5zM8 13c0.552 0 1 0.448 1 1v1c0 0.552-0.448 1-1 1s-1-0.448-1-1v-1c0-0.552 0.448-1 1-1zM8 3c-0.552 0-1-0.448-1-1v-1c0-0.552 0.448-1 1-1s1 0.448 1 1v1c0 0.552-0.448 1-1 1zM15 7c0.552 0 1 0.448 1 1s-0.448 1-1 1h-1c-0.552 0-1-0.448-1-1s0.448-1 1-1h1zM3 8c0 0.552-0.448 1-1 1h-1c-0.552 0-1-0.448-1-1s0.448-1 1-1h1c0.552 0 1 0.448 1 1zM12.95 11.536l0.707 0.707c0.39 0.39 0.39 1.024 0 1.414s-1.024 0.39-1.414 0l-0.707-0.707c-0.39-0.39-0.39-1.024 0-1.414s1.024-0.39 1.414 0zM3.050 4.464l-0.707-0.707c-0.391-0.391-0.391-1.024 0-1.414s1.024-0.391 1.414 0l0.707 0.707c0.391 0.391 0.391 1.024 0 1.414s-1.024 0.391-1.414 0zM12.95 4.464c-0.39 0.391-1.024 0.391-1.414 0s-0.39-1.024 0-1.414l0.707-0.707c0.39-0.391 1.024-0.391 1.414 0s0.39 1.024 0 1.414l-0.707 0.707zM3.050 11.536c0.39-0.39 1.024-0.39 1.414 0s0.391 1.024 0 1.414l-0.707 0.707c-0.391 0.39-1.024 0.39-1.414 0s-0.391-1.024 0-1.414l0.707-0.707z"},child:[]}]})(t)}function hH(t){return(0,hD.GenIcon)({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M15.5 6h-5.5v-5.5c0-0.276-0.224-0.5-0.5-0.5h-3c-0.276 0-0.5 0.224-0.5 0.5v5.5h-5.5c-0.276 0-0.5 0.224-0.5 0.5v3c0 0.276 0.224 0.5 0.5 0.5h5.5v5.5c0 0.276 0.224 0.5 0.5 0.5h3c0.276 0 0.5-0.224 0.5-0.5v-5.5h5.5c0.276 0 0.5-0.224 0.5-0.5v-3c0-0.276-0.224-0.5-0.5-0.5z"},child:[]}]})(t)}let hX=J.default.createContext(null);function hV(){let t=(0,J.useContext)(hX);if(!t)throw Error("No WarriorContext.Provider");return t}hX.displayName="WarriorContext";let hY="undefined"!=typeof window&&window.document&&window.document.createElement?J.useLayoutEffect:J.useEffect,hz=(t,e)=>{let r=J.useRef(!0);hY(()=>t(r.current),e),hY(()=>(r.current=!1,()=>{r.current=!0}),[])},hG=function(t){let e=J.useRef();return e.current=t,J.useCallback(function(){for(var t,r=arguments.length,i=Array(r),n=0;n{hK.push(t)},h$.resetWarned=function(){hq={}},h$.noteOnce=function(t,e){hZ(hJ,t,e)};let h0=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=new Set;return function t(e,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=i.has(e);if(h$(!o,"Warning: There may be circular references"),o)return!1;if(e===n)return!0;if(r&&s>1)return!1;i.add(e);let a=s+1;if(Array.isArray(e)){if(!Array.isArray(n)||e.length!==n.length)return!1;for(let r=0;rt(e[r],n[r],a))}return!1}(t,e)};var h1=t.i(43794);function h2(t,e,r,i){let n=(e-r)/(i-r),s={};switch(t){case"rtl":s.right="".concat(100*n,"%"),s.transform="translateX(50%)";break;case"btt":s.bottom="".concat(100*n,"%"),s.transform="translateY(50%)";break;case"ttb":s.top="".concat(100*n,"%"),s.transform="translateY(-50%)";break;default:s.left="".concat(100*n,"%"),s.transform="translateX(-50%)"}return s}function h5(t,e){return Array.isArray(t)?t[e]:t}let h4={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(t){let{keyCode:e}=t;if(t.altKey&&!t.ctrlKey||t.metaKey||e>=h4.F1&&e<=h4.F12)return!1;switch(e){case h4.ALT:case h4.CAPS_LOCK:case h4.CONTEXT_MENU:case h4.CTRL:case h4.DOWN:case h4.END:case h4.ESC:case h4.HOME:case h4.INSERT:case h4.LEFT:case h4.MAC_FF_META:case h4.META:case h4.NUMLOCK:case h4.NUM_CENTER:case h4.PAGE_DOWN:case h4.PAGE_UP:case h4.PAUSE:case h4.PRINT_SCREEN:case h4.RIGHT:case h4.SHIFT:case h4.UP:case h4.WIN_KEY:case h4.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(t){if(t>=h4.ZERO&&t<=h4.NINE||t>=h4.NUM_ZERO&&t<=h4.NUM_MULTIPLY||t>=h4.A&&t<=h4.Z||-1!==window.navigator.userAgent.indexOf("WebKit")&&0===t)return!0;switch(t){case h4.SPACE:case h4.QUESTION_MARK:case h4.NUM_PLUS:case h4.NUM_MINUS:case h4.NUM_PERIOD:case h4.NUM_DIVISION:case h4.SEMICOLON:case h4.DASH:case h4.EQUALS:case h4.COMMA:case h4.PERIOD:case h4.SLASH:case h4.APOSTROPHE:case h4.SINGLE_QUOTE:case h4.OPEN_SQUARE_BRACKET:case h4.BACKSLASH:case h4.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}},h3=J.createContext({min:0,max:0,direction:"ltr",step:1,includedStart:0,includedEnd:0,tabIndex:0,keyboard:!0,styles:{},classNames:{}}),h9=J.createContext({});function h6(){return(h6=Object.assign.bind()).apply(this,arguments)}let h8=J.forwardRef((t,e)=>{let{prefixCls:r,value:i,valueIndex:n,onStartMove:s,onDelete:o,style:a,render:l,dragging:h,draggingDelete:c,onOffsetChange:u,onChangeComplete:d,onFocus:f,onMouseEnter:g,...p}=t,{min:m,max:y,direction:x,disabled:b,keyboard:_,range:w,tabIndex:C,ariaLabelForHandle:S,ariaLabelledByForHandle:T,ariaRequired:O,ariaValueTextFormatterForHandle:k,styles:M,classNames:E}=J.useContext(h3),D="".concat(r,"-handle"),j=t=>{b||s(t,n)},A=h2(x,i,m,y),P={};if(null!==n){var F;P={tabIndex:b?null:h5(C,n),role:"slider","aria-valuemin":m,"aria-valuemax":y,"aria-valuenow":i,"aria-disabled":b,"aria-label":h5(S,n),"aria-labelledby":h5(T,n),"aria-required":h5(O,n),"aria-valuetext":null==(F=h5(k,n))?void 0:F(i),"aria-orientation":"ltr"===x||"rtl"===x?"horizontal":"vertical",onMouseDown:j,onTouchStart:j,onFocus:t=>{null==f||f(t,n)},onMouseEnter:t=>{g(t,n)},onKeyDown:t=>{if(!b&&_){let e=null;switch(t.which||t.keyCode){case h4.LEFT:e="ltr"===x||"btt"===x?-1:1;break;case h4.RIGHT:e="ltr"===x||"btt"===x?1:-1;break;case h4.UP:e="ttb"!==x?1:-1;break;case h4.DOWN:e="ttb"!==x?-1:1;break;case h4.HOME:e="min";break;case h4.END:e="max";break;case h4.PAGE_UP:e=2;break;case h4.PAGE_DOWN:e=-2;break;case h4.BACKSPACE:case h4.DELETE:null==o||o(n)}null!==e&&(t.preventDefault(),u(e,n))}},onKeyUp:t=>{switch(t.which||t.keyCode){case h4.LEFT:case h4.RIGHT:case h4.UP:case h4.DOWN:case h4.HOME:case h4.END:case h4.PAGE_UP:case h4.PAGE_DOWN:null==d||d()}}}}let L=J.createElement("div",h6({ref:e,className:(0,h1.default)(D,{["".concat(D,"-").concat(n+1)]:null!==n&&w,["".concat(D,"-dragging")]:h,["".concat(D,"-dragging-delete")]:c},E.handle),style:{...A,...a,...M.handle}},P,p));return l&&(L=l(L,{index:n,prefixCls:r,value:i,dragging:h,draggingDelete:c})),L});function h7(){return(h7=Object.assign.bind()).apply(this,arguments)}let ct=J.forwardRef((t,e)=>{let{prefixCls:r,style:i,onStartMove:n,onOffsetChange:s,values:o,handleRender:a,activeHandleRender:l,draggingIndex:h,draggingDelete:c,onFocus:u,...d}=t,f=J.useRef({}),[g,p]=J.useState(!1),[m,y]=J.useState(-1),x=t=>{y(t),p(!0)};J.useImperativeHandle(e,()=>({focus:t=>{var e;null==(e=f.current[t])||e.focus()},hideHelp:()=>{(0,a3.flushSync)(()=>{p(!1)})}}));let b={prefixCls:r,onStartMove:n,onOffsetChange:s,render:a,onFocus:(t,e)=>{x(e),null==u||u(t)},onMouseEnter:(t,e)=>{x(e)},...d};return J.createElement(J.Fragment,null,o.map((t,e)=>{let r=h===e;return J.createElement(h8,h7({ref:t=>{t?f.current[e]=t:delete f.current[e]},dragging:r,draggingDelete:r&&c,style:h5(i,e),key:e,value:t,valueIndex:e},b))}),l&&g&&J.createElement(h8,h7({key:"a11y"},b,{value:o[m],valueIndex:null,dragging:-1!==h,draggingDelete:c,render:l,style:{pointerEvents:"none"},tabIndex:null,"aria-hidden":!0})))}),ce=t=>{let{prefixCls:e,style:r,children:i,value:n,onClick:s}=t,{min:o,max:a,direction:l,includedStart:h,includedEnd:c,included:u}=J.useContext(h3),d="".concat(e,"-text"),f=h2(l,n,o,a);return J.createElement("span",{className:(0,h1.default)(d,{["".concat(d,"-active")]:u&&h<=n&&n<=c}),style:{...f,...r},onMouseDown:t=>{t.stopPropagation()},onClick:()=>{s(n)}},i)},cr=t=>{let{prefixCls:e,marks:r,onClick:i}=t,n="".concat(e,"-mark");return r.length?J.createElement("div",{className:n},r.map(t=>{let{value:e,style:r,label:s}=t;return J.createElement(ce,{key:e,prefixCls:n,style:r,value:e,onClick:i},s)})):null},ci=t=>{let{prefixCls:e,value:r,style:i,activeStyle:n}=t,{min:s,max:o,direction:a,included:l,includedStart:h,includedEnd:c}=J.useContext(h3),u="".concat(e,"-dot"),d=l&&h<=r&&r<=c,f={...h2(a,r,s,o),..."function"==typeof i?i(r):i};return d&&(f={...f,..."function"==typeof n?n(r):n}),J.createElement("span",{className:(0,h1.default)(u,{["".concat(u,"-active")]:d}),style:f})},cn=t=>{let{prefixCls:e,marks:r,dots:i,style:n,activeStyle:s}=t,{min:o,max:a,step:l}=J.useContext(h3),h=J.useMemo(()=>{let t=new Set;if(r.forEach(e=>{t.add(e.value)}),i&&null!==l){let e=o;for(;e<=a;)t.add(e),e+=l}return Array.from(t)},[o,a,l,i,r]);return J.createElement("div",{className:"".concat(e,"-step")},h.map(t=>J.createElement(ci,{prefixCls:e,key:t,value:t,style:n,activeStyle:s})))},cs=t=>{let{prefixCls:e,style:r,start:i,end:n,index:s,onStartMove:o,replaceCls:a}=t,{direction:l,min:h,max:c,disabled:u,range:d,classNames:f}=J.useContext(h3),g="".concat(e,"-track"),p=(i-h)/(c-h),m=(n-h)/(c-h),y=t=>{!u&&o&&o(t,-1)},x={};switch(l){case"rtl":x.right="".concat(100*p,"%"),x.width="".concat(100*m-100*p,"%");break;case"btt":x.bottom="".concat(100*p,"%"),x.height="".concat(100*m-100*p,"%");break;case"ttb":x.top="".concat(100*p,"%"),x.height="".concat(100*m-100*p,"%");break;default:x.left="".concat(100*p,"%"),x.width="".concat(100*m-100*p,"%")}let b=a||(0,h1.default)(g,{["".concat(g,"-").concat(s+1)]:null!==s&&d,["".concat(e,"-track-draggable")]:o},f.track);return J.createElement("div",{className:b,style:{...x,...r},onMouseDown:y,onTouchStart:y})},co=t=>{let{prefixCls:e,style:r,values:i,startPoint:n,onStartMove:s}=t,{included:o,range:a,min:l,styles:h,classNames:c}=J.useContext(h3),u=J.useMemo(()=>{if(!a){if(0===i.length)return[];let t=null!=n?n:l,e=i[0];return[{start:Math.min(t,e),end:Math.max(t,e)}]}let t=[];for(let e=0;e{let{start:n,end:o}=t;return J.createElement(cs,{index:i,prefixCls:e,style:{...h5(r,i),...h.track},start:n,end:o,key:i,onStartMove:s})}))};function ca(t){let e="targetTouches"in t?t.targetTouches[0]:t;return{pageX:e.pageX,pageY:e.pageY}}let cl=function(t,e,r,i,n,s,o,a,l,h,c){let[u,d]=J.useState(null),[f,g]=J.useState(-1),[p,m]=J.useState(!1),[y,x]=J.useState(r),[b,_]=J.useState(r),w=J.useRef(null),C=J.useRef(null),S=J.useRef(null),{onDragStart:T,onDragChange:O}=J.useContext(h9);hz(()=>{-1===f&&x(r)},[r,f]),J.useEffect(()=>()=>{document.removeEventListener("mousemove",w.current),document.removeEventListener("mouseup",C.current),S.current&&(S.current.removeEventListener("touchmove",w.current),S.current.removeEventListener("touchend",C.current))},[]);let k=(t,e,r)=>{void 0!==e&&d(e),x(t);let i=t;r&&(i=t.filter((t,e)=>e!==f)),o(i),O&&O({rawValues:t,deleteIndex:r?f:-1,draggingIndex:f,draggingValue:e})},M=hG((t,e,r)=>{if(-1===t){let t=b[0],r=b[b.length-1],o=e*(n-i);o=Math.min(o=Math.max(o,i-t),n-r),o=s(t+o)-t,k(b.map(t=>t+o))}else{let s=[...y];s[t]=b[t];let o=l(s,(n-i)*e,t,"dist");k(o.values,o.value,r)}});return[f,u,p,J.useMemo(()=>{let t=[...r].sort((t,e)=>t-e),e=[...y].sort((t,e)=>t-e),i={};e.forEach(t=>{i[t]=(i[t]||0)+1}),t.forEach(t=>{i[t]=(i[t]||0)-1});let n=+!!h;return Object.values(i).reduce((t,e)=>t+Math.abs(e),0)<=n?y:r},[r,y,h]),(i,n,s)=>{i.stopPropagation();let o=s||r,l=o[n];g(n),d(l),_(o),x(o),m(!1);let{pageX:u,pageY:f}=ca(i),p=!1;T&&T({rawValues:o,draggingIndex:n,draggingValue:l});let b=r=>{let i,s;r.preventDefault();let{pageX:o,pageY:a}=ca(r),l=o-u,d=a-f,{width:g,height:x}=t.current.getBoundingClientRect();switch(e){case"btt":i=-d/x,s=l;break;case"ttb":i=d/x,s=l;break;case"rtl":i=-l/g,s=d;break;default:i=l/g,s=d}m(p=!!h&&Math.abs(s)>130&&c{t.preventDefault(),document.removeEventListener("mouseup",O),document.removeEventListener("mousemove",b),S.current&&(S.current.removeEventListener("touchmove",w.current),S.current.removeEventListener("touchend",C.current)),w.current=null,C.current=null,S.current=null,a(p),g(-1),m(!1)};document.addEventListener("mouseup",O),document.addEventListener("mousemove",b),i.currentTarget.addEventListener("touchend",O),i.currentTarget.addEventListener("touchmove",b),w.current=b,C.current=O,S.current=i.currentTarget}]},ch=J.forwardRef((t,e)=>{let{prefixCls:r="rc-slider",className:i,style:n,classNames:s,styles:o,id:a,disabled:l=!1,keyboard:h=!0,autoFocus:c,onFocus:u,onBlur:d,min:f=0,max:g=100,step:p=1,value:m,defaultValue:y,range:x,count:b,onChange:_,onBeforeChange:w,onAfterChange:C,onChangeComplete:S,allowCross:T=!0,pushable:O=!1,reverse:k,vertical:M,included:E=!0,startPoint:D,trackStyle:j,handleStyle:A,railStyle:P,dotStyle:F,activeDotStyle:L,marks:R,dots:I,handleRender:B,activeHandleRender:N,track:W,tabIndex:U=0,ariaLabelForHandle:H,ariaLabelledByForHandle:X,ariaRequired:V,ariaValueTextFormatterForHandle:Y}=t,z=J.useRef(null),G=J.useRef(null),q=J.useMemo(()=>M?k?"ttb":"btt":k?"rtl":"ltr",[k,M]),[K,Q,Z,$,tt]=function(t){return(0,J.useMemo)(()=>{if(!0===t||!t)return[!!t,!1,!1,0];let{editable:e,draggableTrack:r,minCount:i,maxCount:n}=t;return[!0,e,!e&&r,i||0,n]},[t])}(x),te=J.useMemo(()=>isFinite(f)?f:0,[f]),tr=J.useMemo(()=>isFinite(g)?g:100,[g]),ti=J.useMemo(()=>null!==p&&p<=0?1:p,[p]),tn=J.useMemo(()=>"boolean"==typeof O?!!O&&ti:O>=0&&O,[O,ti]),ts=J.useMemo(()=>Object.keys(R||{}).map(t=>{let e=R[t],r={value:Number(t)};return e&&"object"==typeof e&&!J.isValidElement(e)&&("label"in e||"style"in e)?(r.style=e.style,r.label=e.label):r.label=e,r}).filter(t=>{let{label:e}=t;return e||"number"==typeof e}).sort((t,e)=>t.value-e.value),[R]),[to,ta]=function(t,e,r,i,n,s){let o=J.useCallback(r=>Math.max(t,Math.min(e,r)),[t,e]),a=J.useCallback(i=>{if(null!==r){let n=t+Math.round((o(i)-t)/r)*r,s=t=>(String(t).split(".")[1]||"").length,a=Math.max(s(r),s(e),s(t)),l=Number(n.toFixed(a));return t<=l&&l<=e?l:null}return null},[r,t,e,o]),l=J.useCallback(n=>{let s=o(n),l=i.map(t=>t.value);null!==r&&l.push(a(n)),l.push(t,e);let h=l[0],c=e-t;return l.forEach(t=>{let e=Math.abs(s-t);e<=c&&(h=t,c=e)}),h},[t,e,i,r,o,a]),h=function(n,s,o){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unit";if("number"==typeof s){let c,u=n[o],d=u+s,f=[];i.forEach(t=>{f.push(t.value)}),f.push(t,e),f.push(a(u));let g=s>0?1:-1;"unit"===l?f.push(a(u+g*r)):f.push(a(d)),f=f.filter(t=>null!==t).filter(t=>s<0?t<=u:t>=u),"unit"===l&&(f=f.filter(t=>t!==u));let p="unit"===l?u:d,m=Math.abs((c=f[0])-p);if(f.forEach(t=>{let e=Math.abs(t-p);e1){let t=[...n];return t[o]=c,h(t,s-g,o,l)}return c}return"min"===s?t:"max"===s?e:void 0},c=function(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unit",n=t[r],s=h(t,e,r,i);return{value:s,changed:s!==n}},u=t=>null===s&&0===t||"number"==typeof s&&t3&&void 0!==arguments[3]?arguments[3]:"unit",o=t.map(l),a=o[r],d=h(o,e,r,i);if(o[r]=d,!1===n){let t=s||0;r>0&&o[r-1]!==a&&(o[r]=Math.max(o[r],o[r-1]+t)),r0;t-=1){let e=!0;for(;u(o[t]-o[t-1])&&e;)({value:o[t-1],changed:e}=c(o,-1,t-1))}for(let t=o.length-1;t>0;t-=1){let e=!0;for(;u(o[t]-o[t-1])&&e;)({value:o[t-1],changed:e}=c(o,-1,t-1))}for(let t=0;t{t||i(e)},[e]),[n,i]}(y,m),tc=J.useMemo(()=>{let t=null==tl?[]:Array.isArray(tl)?tl:[tl],[e=te]=t,r=null===tl?[]:[e];if(K){if(r=[...t],b||void 0===tl){let t=b>=0?b+1:2;for(r=r.slice(0,t);r.lengtht-e)}return r.forEach((t,e)=>{r[e]=to(t)}),r},[tl,K,te,b,to]),tu=t=>K?t:t[0],td=hG(t=>{let e=[...t].sort((t,e)=>t-e);_&&!h0(e,tc,!0)&&_(tu(e)),th(e)}),tf=hG(t=>{t&&z.current.hideHelp();let e=tu(tc);null==C||C(e),h$(!C,"[rc-slider] `onAfterChange` is deprecated. Please use `onChangeComplete` instead."),null==S||S(e)}),[tg,tp,tm,tv,ty]=cl(G,q,tc,te,tr,to,td,tf,ta,Q,$),tx=(t,e)=>{if(!l){let n=[...tc],s=0,o=0,a=tr-te;tc.forEach((e,r)=>{let i=Math.abs(t-e);i<=a&&(a=i,s=r),e{if(null!==tb){let t=tc.indexOf(tb);t>=0&&z.current.focus(t)}t_(null)},[tb]);let tw=J.useMemo(()=>(!Z||null!==ti)&&Z,[Z,ti]),tC=hG((t,e)=>{ty(t,e),null==w||w(tu(tc))}),tS=-1!==tg;J.useEffect(()=>{if(!tS){let t=tc.lastIndexOf(tp);z.current.focus(t)}},[tS]);let tT=J.useMemo(()=>[...tv].sort((t,e)=>t-e),[tv]),[tO,tk]=J.useMemo(()=>K?[tT[0],tT[tT.length-1]]:[te,tT[0]],[tT,K,te]);J.useImperativeHandle(e,()=>({focus:()=>{z.current.focus(0)},blur:()=>{var t;let{activeElement:e}=document;(null==(t=G.current)?void 0:t.contains(e))&&(null==e||e.blur())}})),J.useEffect(()=>{c&&z.current.focus(0)},[]);let tM=J.useMemo(()=>({min:te,max:tr,direction:q,disabled:l,keyboard:h,step:ti,included:E,includedStart:tO,includedEnd:tk,range:K,tabIndex:U,ariaLabelForHandle:H,ariaLabelledByForHandle:X,ariaRequired:V,ariaValueTextFormatterForHandle:Y,styles:o||{},classNames:s||{}}),[te,tr,q,l,h,ti,E,tO,tk,K,U,H,X,V,Y,o,s]);return J.createElement(h3.Provider,{value:tM},J.createElement("div",{ref:G,className:(0,h1.default)(r,i,{["".concat(r,"-disabled")]:l,["".concat(r,"-vertical")]:M,["".concat(r,"-horizontal")]:!M,["".concat(r,"-with-marks")]:ts.length}),style:n,onMouseDown:t=>{let e;t.preventDefault();let{width:r,height:i,left:n,top:s,bottom:o,right:a}=G.current.getBoundingClientRect(),{clientX:l,clientY:h}=t;switch(q){case"btt":e=(o-h)/i;break;case"ttb":e=(h-s)/i;break;case"rtl":e=(a-l)/r;break;default:e=(l-n)/r}tx(to(te+e*(tr-te)),t)},id:a},J.createElement("div",{className:(0,h1.default)("".concat(r,"-rail"),null==s?void 0:s.rail),style:{...P,...null==o?void 0:o.rail}}),!1!==W&&J.createElement(co,{prefixCls:r,style:j,values:tc,startPoint:D,onStartMove:tw?tC:void 0}),J.createElement(cn,{prefixCls:r,marks:ts,dots:I,style:F,activeStyle:L}),J.createElement(ct,{ref:z,prefixCls:r,style:A,values:tv,draggingIndex:tg,draggingDelete:tm,onStartMove:tC,onOffsetChange:(t,e)=>{if(!l){let r=ta(tc,t,e);null==w||w(tu(tc)),td(r.values),t_(r.value)}},onFocus:u,onBlur:d,handleRender:B,activeHandleRender:N,onChangeComplete:tf,onDelete:Q?t=>{if(l||!Q||tc.length<=$)return;let e=[...tc];e.splice(t,1),null==w||w(tu(e)),td(e);let r=Math.max(0,t-1);z.current.hideHelp(),z.current.focus(r)}:void 0}),J.createElement(cr,{prefixCls:r,marks:ts,onClick:tx})))}),cc={track:{height:8,background:"#03fccf"},handle:{width:20,height:20,marginTop:-6,borderColor:"#03fccf",background:"rgb(5, 69, 76)",opacity:1},rail:{height:8,border:"1px solid #555",background:"rgba(255, 255, 255, 0.3)"}};function cu(t){return(0,Q.jsx)(ch,{...t,styles:{...cc,...t.styles}})}var cd=t.i(20592);let{materials:cf}=cd.default;function cg(){var t;let e=(0,J.useRef)(null),r=(0,J.useRef)(null),[i,n]=(0,J.useState)("vl2"),{activeCanvas:s,backgroundColor:o,setBackgroundColor:a,selectedObjects:l,lockedObjects:h,lockSelection:c,unlockSelection:u,bringForward:d,sendBackward:f,duplicate:g,deleteSelection:p,undo:m,redo:y,canUndo:x,canRedo:b,copyToMetallic:_,brushColor:w,setBrushColor:C,brushSize:S,setBrushSize:T,hueRotate:O,setHueRotate:k,saturation:M,setSaturation:E,brightness:D,setBrightness:j,contrast:A,setContrast:P,opacity:F,setOpacity:L,layerMode:R,setLayerMode:I,activeCanvasType:B,addImages:N,exportSkin:W,selectedExportMaterials:U,setSelectedExportMaterials:H}=o0(),{actualModel:X}=hV(),V=cf[X],{canvas:Y,isDrawingMode:z,setDrawingMode:G}=oZ(s),[q,K]=(0,J.useState)(!1),Z=q?"⌘":"Ctrl ",[$,tt]=(0,J.useState)(!1),{refs:te,floatingStyles:tr,context:ti}=hT({open:$,onOpenChange:tt,placement:"bottom-end",middleware:[lr(),le(10)],whileElementsMounted:a4}),tn=hb(ti),ts=hS(ti),to=hE(ti);(0,J.useEffect)(()=>{$&&G(!0)},[$,G]);let{getReferenceProps:ta,getFloatingProps:tl}=hk([tn,ts,to]),[th,tc]=(0,J.useState)(!1),{refs:tu,floatingStyles:td,context:tf}=hT({open:th,onOpenChange:tc,placement:"bottom-end",middleware:[lr(),le(10)],whileElementsMounted:a4}),tg=hb(tf),{getReferenceProps:tp,getFloatingProps:tm}=hk([tg,hS(tf),hE(tf)]),[tv,ty]=(0,J.useState)(!1),{refs:tx,floatingStyles:tb,context:t_}=hT({open:tv,onOpenChange:ty,placement:"bottom-end",middleware:[lr(),le(10)],whileElementsMounted:a4}),tw=hb(t_),{getReferenceProps:tC,getFloatingProps:tS}=hk([tw,hS(t_),hE(t_)]),tT=!!l.length&&l.every(t=>h.has(t)),tO=l.length>0,tk=l.filter(t=>t instanceof s7).length>0,tM=t=>{a(t.target.value)};return(0,J.useEffect)(()=>{try{let t=localStorage.getItem("exportFileType");switch(t){case"vl2":case"png":n(t)}}catch(t){}},[]),(0,J.useEffect)(()=>{navigator.platform&&navigator.platform.startsWith("Mac")?K(!0):navigator.userAgent.match(/\(Macintosh;/)&&K(!0)},[]),(0,Q.jsxs)("div",{className:"CanvasTools",children:[(0,Q.jsxs)("div",{className:"CanvasBackgroundColor",children:[(0,Q.jsx)("input",{className:"ColorSwatch",type:"radio",name:"backgroundColor",id:"canvasBackgroundColorBlack",value:"black",checked:"black"===o,onChange:tM}),(0,Q.jsx)("label",{htmlFor:"canvasBackgroundColorBlack",children:(0,Q.jsx)("span",{className:"HiddenLabel",children:"Black"})}),(0,Q.jsx)("input",{className:"ColorSwatch",type:"radio",name:"backgroundColor",id:"canvasBackgroundColorMagenta",value:"magenta",checked:"magenta"===o,onChange:tM}),(0,Q.jsx)("label",{htmlFor:"canvasBackgroundColorMagenta",children:(0,Q.jsx)("span",{className:"HiddenLabel",children:"Magenta"})}),(0,Q.jsx)("input",{className:"ColorSwatch",type:"radio",name:"backgroundColor",id:"canvasBackgroundColorWhite",value:"white",checked:"white"===o,onChange:tM}),(0,Q.jsx)("label",{htmlFor:"canvasBackgroundColorWhite",children:(0,Q.jsx)("span",{className:"HiddenLabel",children:"White"})})]}),(0,Q.jsxs)("div",{className:"Buttons",children:["metallic"===B?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"ButtonGroup",children:[(0,Q.jsx)("button",{className:"ButtonGroup",type:"button","data-active":z?void 0:"","aria-label":"Select Mode",title:"Select Mode (S)",onClick:()=>{G(!1)},children:(0,Q.jsx)(hF,{})}),(0,Q.jsx)("button",{className:"ButtonGroup",type:"button","data-active":z?"":void 0,"aria-label":"Paint Mode",title:"Paint Mode (P)",ref:te.setReference,...ta(),children:(0,Q.jsx)(hL,{})})]}),$?(0,Q.jsx)(hy,{context:ti,modal:!1,children:(0,Q.jsx)("div",{className:"BrushToolsPopup",ref:te.setFloating,style:tr,...tl(),children:(0,Q.jsxs)("div",{className:"Fields",children:[(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsx)("label",{children:"Metallic Amount"}),(0,Q.jsx)("div",{className:"SliderContainer",children:(0,Q.jsx)(cu,{min:0,max:255,value:w,onChange:t=>{Array.isArray(t)&&(t=t[0]),C(t)},styles:{track:{display:"none"},handle:{width:20,height:20,marginTop:-6,borderColor:"rgb(20, 105, 241)",background:"rgb(".concat(w,", ").concat(w,", ").concat(w,")"),opacity:1},rail:{height:8,border:"1px solid #555",background:"linear-gradient(to right, black 0%, white 100%)"}}})})]}),(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsx)("label",{children:"Brush Size"}),(0,Q.jsx)("div",{className:"SliderContainer",children:(0,Q.jsx)(cu,{min:1,max:50,value:S,onChange:t=>{Array.isArray(t)&&(t=t[0]),T(t)}})})]})]})})}):null]}):null,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("input",{ref:r,onChange:async t=>{N([await new Promise((e,r)=>{var i;let n=null==(i=t.target.files)?void 0:i[0];if(n){let t=new FileReader;t.addEventListener("load",t=>{var r;e(null==(r=t.target)?void 0:r.result)}),t.readAsDataURL(n)}else r(Error("No input file provided."))})])},type:"file",accept:".png, image/png",hidden:!0}),(0,Q.jsx)("button",{type:"button","aria-label":"Add Image",title:"Add Image",onClick:()=>{r.current&&r.current.click()},children:(0,Q.jsx)(hH,{style:{fontSize:14}})}),(0,Q.jsx)("button",{type:"button","data-active":th?"":void 0,"aria-label":"Filters",title:"Filters",disabled:tO&&!tk,ref:tu.setReference,...tp(),children:(0,Q.jsx)(hW,{})}),th?(0,Q.jsx)(hy,{context:tf,modal:!1,children:(0,Q.jsx)("div",{className:"BrushToolsPopup",ref:tu.setFloating,style:td,...tm(),children:(0,Q.jsxs)("div",{className:"Fields",children:[(0,Q.jsxs)("div",{className:"Field ApplyTo",children:[(0,Q.jsx)("label",{children:"Layer:"}),(0,Q.jsx)("ul",{children:l.length?(0,Q.jsxs)("li",{children:[(0,Q.jsx)("input",{type:"radio",name:"FilterLayer",value:"SelectedLayer",id:"FilterLayer-SelectedLayer",checked:"SelectedLayer"===R,onChange:()=>{I("SelectedLayer")}}),(0,Q.jsxs)("label",{htmlFor:"FilterLayer-SelectedLayer",children:["selected (",l.length.toLocaleString(),")"]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("li",{children:[(0,Q.jsx)("input",{type:"radio",name:"FilterLayer",value:"BaseLayer",id:"FilterLayer-BaseLayer",checked:"BaseLayer"===R,onChange:()=>{I("BaseLayer")}})," ",(0,Q.jsx)("label",{htmlFor:"FilterLayer-BaseLayer",children:"base"})]}),(0,Q.jsxs)("li",{children:[(0,Q.jsx)("input",{type:"radio",name:"FilterLayer",value:"AllLayers",id:"FilterLayer-AllLayers",checked:"AllLayers"===R,onChange:()=>{I("AllLayers")}}),(0,Q.jsxs)("label",{htmlFor:"FilterLayer-AllLayers",children:["all (",null!=(t=null==Y?void 0:Y._objects.filter(t=>t instanceof s7).length.toLocaleString())?t:0,")"]})]})]})})]}),"color"===B?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsxs)("label",{children:["Hue:"," ",(0,Q.jsx)("strong",{children:null==O?"MULTIPLE VALUES":(0,Q.jsxs)(Q.Fragment,{children:[Math.round(180*O),"°"]})})]}),(0,Q.jsx)("div",{className:"SliderContainer",children:(0,Q.jsx)(cu,{min:-180,max:180,startPoint:0,value:Math.round((null!=O?O:0)*180),onChange:t=>{Array.isArray(t)&&(t=t[0]),k(t/180)}})})]}),(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsxs)("label",{children:["Saturation:"," ",(0,Q.jsx)("strong",{children:null==M?"MULTIPLE VALUES":"".concat(Math.round(100*M+100),"%")})]}),(0,Q.jsx)("div",{className:"SliderContainer",children:(0,Q.jsx)(cu,{min:-100,max:100,startPoint:0,value:Math.round((null!=M?M:0)*100),onChange:t=>{Array.isArray(t)&&(t=t[0]),E(t/100)}})})]})]}):null,(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsxs)("label",{children:["Brightness:"," ",(0,Q.jsx)("strong",{children:null==D?"MULTIPLE VALUES":"".concat(Math.round(100*D+100),"%")})]}),(0,Q.jsx)("div",{className:"SliderContainer",children:(0,Q.jsx)(cu,{min:-100,max:100,startPoint:0,value:Math.round((null!=D?D:0)*100),onChange:t=>{Array.isArray(t)&&(t=t[0]),j(t/100)}})})]}),(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsxs)("label",{children:["Contrast:"," ",(0,Q.jsx)("strong",{children:null==A?"MULTIPLE VALUES":"".concat(Math.round(100*A+100),"%")})]}),(0,Q.jsx)("div",{className:"SliderContainer",children:(0,Q.jsx)(cu,{min:-100,max:100,startPoint:0,value:Math.round((null!=A?A:0)*100),onChange:t=>{Array.isArray(t)&&(t=t[0]),P(t/100)}})})]}),(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsxs)("label",{children:["Opacity:"," ",(0,Q.jsx)("strong",{children:null==F?"MULTIPLE VALUES":"".concat(Math.round((null!=F?F:1)*100),"%")})]}),(0,Q.jsx)("div",{className:"SliderContainer",children:(0,Q.jsx)(cu,{min:0,max:100,startPoint:0,value:Math.round((null!=F?F:1)*100),onChange:t=>{Array.isArray(t)&&(t=t[0]),L(t/100)}})})]})]})})}):null,(0,Q.jsx)("button",{type:"button","aria-label":tT?"Unlock":"Lock",title:tT?"Unlock (L)":"Lock (L)",onClick:tT?u:c,"data-locked":tT?"":void 0,disabled:!tO,children:tT?(0,Q.jsx)(hP.FaUnlock,{style:{fontSize:14}}):(0,Q.jsx)(hP.FaLock,{style:{fontSize:14}})}),(0,Q.jsxs)("div",{className:"ButtonGroup",children:[(0,Q.jsx)("button",{type:"button","aria-label":"Bring Forward",title:"Bring Forward (F)",onClick:d,disabled:!tO,children:(0,Q.jsx)(hP.FaArrowUp,{})}),(0,Q.jsx)("button",{type:"button","aria-label":"Send Backward",title:"Send Backward (B)",onClick:f,disabled:!tO,children:(0,Q.jsx)(hP.FaArrowDown,{})})]}),(0,Q.jsx)("button",{type:"button","aria-label":"Duplicate",title:"Duplicate (D)",onClick:g,disabled:!tO,children:(0,Q.jsx)(hj,{})}),(0,Q.jsx)("button",{type:"button","aria-label":"Delete",title:"Delete (Backspace)",onClick:p,disabled:tT||!tO,children:(0,Q.jsx)(hP.FaTrashAlt,{})}),(0,Q.jsxs)("div",{className:"ButtonGroup",children:[(0,Q.jsx)("button",{type:"button","aria-label":"Undo",title:"Undo (".concat(Z,"Z)"),onClick:m,disabled:!x,children:(0,Q.jsx)(hB,{})}),(0,Q.jsx)("button",{type:"button","aria-label":"Redo",title:"Redo (".concat(q?"".concat("⇧").concat(Z,"Z)"):"".concat(Z," Y"),")"),onClick:y,disabled:!b,children:(0,Q.jsx)(hN,{})})]}),"color"===B?(0,Q.jsxs)("button",{type:"button",className:"MetallicButton","aria-label":"Copy to Metallic",title:"Copy to Metallic",onClick:_,children:[(0,Q.jsx)(hA,{})," ",(0,Q.jsx)("span",{className:"ButtonLabel",children:"Metal"})]}):null]})]}),(0,Q.jsxs)("div",{className:"Export",children:[(0,Q.jsx)("input",{ref:e,type:"text",name:"CustomSkinName",placeholder:"Skin Name",size:12}),(0,Q.jsxs)("button",{className:"ExportOptionsButton",type:"button","data-active":tv?"":void 0,"aria-label":"Export Options",title:"Export Options",ref:tx.setReference,...tC(),children:[".",i,(0,Q.jsx)(hP.FaAngleDown,{})]}),tv?(0,Q.jsx)(hy,{context:t_,modal:!1,children:(0,Q.jsx)("div",{className:"ExportOptionsPopup",ref:tx.setFloating,style:tb,...tS(),children:(0,Q.jsxs)("div",{className:"Fields",children:[(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsx)("label",{children:"Export Materials"}),(0,Q.jsx)("ul",{className:"ExportOptionsList",children:V.map((t,e)=>t&&!1!==t.selectable&&!t.hidden?(0,Q.jsxs)("li",{children:[(0,Q.jsx)("input",{id:"MaterialSelect-".concat(t.name),type:"checkbox",checked:!1!==U[e],onChange:t=>{H(r=>{let i=r.slice();return i[e]=t.target.checked,i})}}),(0,Q.jsx)("label",{htmlFor:"MaterialSelect-".concat(t.name),children:t.label})]},t.name):null)})]}),(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsx)("label",{htmlFor:"ExportFormat",children:"Export Format"}),(0,Q.jsxs)("select",{id:"ExportFormat",value:i,onChange:t=>{n(t.target.value);try{localStorage.setItem("exportFileType",t.target.value)}catch(t){}},children:[(0,Q.jsx)("option",{value:"png",children:".png"}),(0,Q.jsx)("option",{value:"vl2",children:".vl2"})]})]})]})})}):null,(0,Q.jsx)("button",{type:"button",onClick:()=>{W({name:e.current?e.current.value:"",format:i})},children:"Export"})]})]})}function cp(){return(0,Q.jsxs)("footer",{className:"AppFooter",children:[(0,Q.jsx)("a",{href:"https://github.com/exogen/t2-model-skinner",className:"IconLink",children:(0,Q.jsx)(hP.FaGithub,{size:24})}),(0,Q.jsxs)("div",{className:"Sponsor",children:[(0,Q.jsx)("a",{href:"https://github.com/sponsors/exogen",target:"_blank",rel:"noreferrer",children:"Support this project"})," ",(0,Q.jsx)("span",{className:"Separator",children:"or"})," ",(0,Q.jsx)("a",{href:"https://www.buymeacoffee.com/mosswood",target:"_blank",rel:"noreferrer",children:(0,Q.jsx)("img",{src:"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png",alt:"Buy Me A Coffee",width:109,height:31})})]})]})}async function cm(t){return await s7.fromURL(t,{crossOrigin:"anonymous"})}var cv=t.i(55519);function cy(){let e=(0,J.useRef)(null),r=(0,J.useRef)(null),i=(0,J.useMemo)(()=>({async combineColorAndAlphaImageUrls(){for(var t=arguments.length,e=Array(t),i=0;i{let i=new Worker(t.r(79702)),n=cv.wrap(i);return e.current=i,r.current=n,()=>{n[cv.releaseProxy](),r.current=null,i.terminate()}},[]),i}function cx(){return{canvasPadding:64,basePath:"/t2-model-skinner"}}var cb=t.i(54826);let{materials:c_}=cd.default,cw=[512,512];function cC(e){var r,i;let{children:n}=e,{actualModel:s,selectedModelType:o}=hV(),[a,l]=(0,J.useState)(0),[h,c]=(0,J.useState)(0),[u,d]=(0,J.useState)(1),f=c_[s],g=null!=(r=f[a])?r:null,p=null!=(i=g.frameCount)?i:1,m=p>1,[y,x]=(0,J.useState)([]),b=(0,J.useMemo)(()=>{var t;let[e,r]=null!=(t=g.size)?t:cw;return[e*u,r*u]},[g.size,u]),_=0!==g.metallicFactor||1!==g.roughnessFactor,[w,C]=(0,J.useState)("color");_||"metallic"!==w||C("color"),h>=p&&c(0),(0,J.useEffect)(()=>{try{let t=localStorage.getItem("sizeMultiplier");switch(t){case"1":case"2":case"4":d(+t)}}catch(t){}},[]),(0,J.useEffect)(()=>{x(f.map(t=>!!(t&&!1!==t.selectable&&!t.hidden)))},[f]),(0,J.useEffect)(()=>{c(0)},[g]);let[S,T]=(0,J.useState)("black"),[O,k]=(0,J.useState)(()=>new Set),[M,E]=(0,J.useState)(200),[D,j]=(0,J.useState)(10),[A,P]=(0,J.useState)(()=>new Map),[F,L]=(0,J.useState)(()=>[]),R=g?"".concat(g.name,":").concat(w,":").concat(h,":").concat(u):null,I=g?"".concat(g.name,":metallic:").concat(h,":").concat(u):null,{canvases:B}=oZ(),{canvas:N,notifyChange:W,undo:U,redo:H,canUndo:X,canRedo:V}=oZ(R),{canvas:Y,setDrawingMode:z}=oZ(I),{combineColorAndAlphaImageUrls:G}=cy(),{canvasPadding:q}=cx(),[K,Z]=(0,J.useState)(()=>[]),[$,tt]=(0,J.useState)("BaseLayer");F.length?"SelectedLayer"!==$&&tt("SelectedLayer"):"SelectedLayer"===$&&tt("BaseLayer");let te=(0,J.useCallback)((t,e)=>{var r,i,n;let s=[],o=new Map(A),a=F;for(let l of("AllLayers"===$?a=null!=(r=null==N?void 0:N._objects)?r:[]:"BaseLayer"===$&&(a=null!=(i=null==N?void 0:N._objects.slice(0,1))?i:[]),a))if(l instanceof s7){let r={...null!=(n=A.get(l))?n:{},[t]:e};o.set(l,r),s.push([l,r])}P(o),Z(s)},[N,$,A,F]),tr=t=>{var e,r;let i=+("Opacity"===t),n=F;if("AllLayers"===$?n=null!=(e=null==N?void 0:N._objects)?e:[]:"BaseLayer"===$&&(n=null!=(r=null==N?void 0:N._objects.slice(0,1))?r:[]),!(n=n.filter(t=>t instanceof s7)).length)return[i,e=>te(t,e)];{let e=e=>{var r,s;return null!=(s=(null!=(r=A.get(n[e]))?r:{})[t])?s:i},r=e(0);return n.slice(1).every((t,i)=>e(i+1)===r)?[r,e=>te(t,e)]:[null,e=>te(t,e)]}},[ti,tn]=tr("HueRotation"),[ts,to]=tr("Saturation"),[ta,tl]=tr("Brightness"),[th,tc]=tr("Contrast"),[tu,td]=tr("Opacity");(0,J.useEffect)(()=>{if(K.length){for(let[t,e]of K)if(t instanceof s7){if(t.filters=[],"metallic"===w){let e=new oQ.Grayscale;t.filters.push(e)}for(let r in e){let i=e[r];if(null!=i)switch(r){case"HueRotation":t.filters.push(new oQ.HueRotation({rotation:i}));break;case"Saturation":t.filters.push(new oQ.Saturation({saturation:i}));break;case"Brightness":t.filters.push(new oQ.Brightness({brightness:i}));break;case"Contrast":t.filters.push(new oQ.Contrast({contrast:i}));break;case"Opacity":t.opacity=i}}t.applyFilters()}Z([]),W&&W()}},[K,w,W]);let tf=(0,J.useCallback)(()=>{F.length&&k(t=>{let e=new Set(t);for(let t of F)e.add(t),t.lockMovementX=!0,t.lockMovementY=!0,t.lockScalingX=!0,t.lockScalingY=!0,t.lockRotation=!0;return e})},[F]),tg=(0,J.useCallback)(()=>{F.length&&k(t=>{let e=new Set(t);for(let t of F)e.delete(t),t.lockMovementX=!1,t.lockMovementY=!1,t.lockScalingX=!1,t.lockScalingY=!1,t.lockRotation=!1;return e})},[F]),tp=(0,J.useCallback)(async()=>{let t=N.getActiveObject();t&&(N.bringObjectForward(t,!0),W())},[N,W]),tm=(0,J.useCallback)(async()=>{let t=N.getActiveObject();if(t){if(N._objects[0]===t||N._objects[1]===t)return;N.sendObjectBackwards(t,!0),W()}},[N,W]),tv=(0,J.useCallback)(async t=>{let e;for(let r of t){let t=await cm(r);if(!t.width||!t.height)throw Error("Zero-height image");let i=t.width/b[0],n=t.height/b[1];if(i>1||n>1){let e;t.scaleX=e=i>n?1/i:1/n,t.scaleY=e}if("metallic"===w){t.filters||(t.filters=[]);let e=new oQ.Grayscale;t.filters.push(e),t.applyFilters()}Y&&z(!1),N.centerObject(t),N.add(t),e=t}e&&(N.setActiveObject(e),N.requestRenderAll())},[b,w,Y,N,z]),ty=(0,J.useCallback)(async()=>{let t=N.getActiveObject();if(t){var e,r;let i=await t.clone();i.set({top:(null!=(e=i.top)?e:0)+20,left:(null!=(r=i.left)?r:0)+20,evented:!0}),"activeSelection"===i.type&&(i.canvas=N,i.forEachObject(t=>{N.add(t)}),i.setCoords()),N.discardActiveObject(),N.add(i),N.setActiveObject(i)}},[N]),tx=(0,J.useCallback)(async()=>{let t=N.getActiveObjects();N.discardActiveObject(),N.remove(...t),N.requestRenderAll()},[N]),tb=(0,J.useCallback)(async()=>{if("color"===w&&Y){let t=N.toDataURL({format:"png",multiplier:1,top:q,left:q,width:b[0],height:b[1]}),e=await cm(t);e.filters||(e.filters=[]);let r=new oQ.Grayscale;e.filters.push(r),e.applyFilters(),Y.centerObject(e),Y.add(e),Y.setActiveObject(e),z(!1),C("metallic")}},[Y,N,w,q,z,b]),t_=(0,J.useCallback)(async e=>{let{format:r,name:i=""}=e,{savePngFile:n,saveZipFile:a,createZipFile:l}=await t.A(91135);i=i.trim()||"MyCustomSkin";let h=await Promise.all(f.filter((t,e)=>!1!==y[e]).map(t=>{var e;let r=null!=(e=t.frameCount)?e:1;return Array(r).fill(null).map(async(e,n)=>{var a,l,h,c;let d,f,g=null==(a=B["".concat(t.name,":color:").concat(n,":").concat(u)])?void 0:a.canvas,p=null==(l=B["".concat(t.name,":metallic:").concat(n,":").concat(u)])?void 0:l.canvas,m=null!=(h=t.size)?h:cw,y=[m[0]*u,m[1]*u],x=g.toDataURL({format:"png",multiplier:1,top:q,left:q,width:y[0],height:y[1]});if(p){let t=p.toDataURL({format:"png",multiplier:1,top:q,left:q,width:y[0],height:y[1]});d=await G({colorImageUrl:x,metallicImageUrl:t})}else d=x;switch(o){case"player":f="".concat(i,".").concat(s,".png");break;case"weapon":case"vehicle":if(t){let e=null!=(c=t.file)?c:t.name;if(r>1){let t=e.match(/^(.+)(\d\d)$/);if(t){let e=t[1];f="".concat(e).concat(n.toString().padStart(2,"0"),".png")}else throw Error("Unexpected animation filename")}else f="".concat(e,".png")}else f="weapon"===o?"weapon_".concat(s,".png"):"".concat(s,".png");break;default:throw Error("Unknown model type")}return{imageUrl:d,filename:f}})}).flat());switch(r){case"png":h.forEach(t=>{let{imageUrl:e,filename:r}=t;n(e,r)});break;case"vl2":{let t=l(await Promise.all(h.map(async t=>({data:await (0,cb.imageUrlToArrayBuffer)(t.imageUrl),name:t.filename})))),e=s.replace(/(?:^([a-z])|_([a-z]))/g,(t,e,r)=>(e||r).toUpperCase()),r="",n=u>1?"-@".concat(u,"x"):"";switch(o){case"player":r="zPlayerSkin-".concat(i).concat(n,".vl2");break;case"weapon":r="zWeapon".concat(e,"-").concat(i).concat(n,".vl2");break;case"vehicle":r="z".concat(e,"-").concat(i).concat(n,".vl2")}await a(t,r)}}},[f,y,B,u,q,o,G,s]),tw=(0,J.useMemo)(()=>({activeCanvas:R,activeCanvasType:w,setActiveCanvasType:C,backgroundColor:S,setBackgroundColor:T,lockedObjects:O,setLockedObjects:k,brushColor:M,setBrushColor:E,brushSize:D,setBrushSize:j,hueRotate:ti,setHueRotate:tn,saturation:ts,setSaturation:to,brightness:ta,setBrightness:tl,contrast:th,setContrast:tc,opacity:tu,setOpacity:td,layerMode:$,setLayerMode:tt,selectedObjects:F,lockSelection:tf,unlockSelection:tg,bringForward:tp,sendBackward:tm,addImages:tv,duplicate:ty,deleteSelection:tx,undo:U,redo:H,canUndo:X,canRedo:V,copyToMetallic:tb,exportSkin:t_,selectedMaterialIndex:a,setSelectedMaterialIndex:l,textureSize:b,hasMetallic:_,selectedFrameIndex:h,setSelectedFrameIndex:c,hasAnimation:m,frameCount:p,sizeMultiplier:u,setSizeMultiplier:d,selectedExportMaterials:y,setSelectedExportMaterials:x}),[R,w,S,O,M,D,ti,tn,ts,to,ta,tl,th,tc,tu,td,$,F,tf,tg,tp,tm,tv,ty,tx,U,H,X,V,tb,t_,a,b,_,h,m,p,u,y]);return(0,J.useEffect)(()=>{if(N){let t=()=>{L(N.getActiveObjects())};return N.on("selection:cleared",t),N.on("selection:updated",t),N.on("selection:created",t),t(),()=>{N.off("selection:cleared",t),N.off("selection:updated",t),N.off("selection:created",t)}}},[N]),(0,J.useEffect)(()=>{Y&&(Y.freeDrawingBrush||(Y.freeDrawingBrush=new sx(Y)),Y.freeDrawingBrush.width=D)},[Y,D]),(0,J.useEffect)(()=>{Y&&(Y.freeDrawingBrush||(Y.freeDrawingBrush=new sx(Y)),Y.freeDrawingBrush.color="rgb(".concat(M,", ").concat(M,", ").concat(M,")"))},[Y,M]),(0,Q.jsx)(o$.Provider,{value:tw,children:n})}function cS(){let{backgroundColor:t,textureSize:e}=o0(),{canvasPadding:r}=cx();return e?(0,Q.jsx)("div",{className:"CanvasBackdrop",style:{backgroundColor:t,top:r,width:e[0],height:e[1]}}):null}function cT(t){let{children:e}=t,[r,i]=(0,J.useState)({}),n=(0,J.useCallback)((t,e)=>{i(r=>({...r,[t]:e}))},[]),s=(0,J.useCallback)(t=>{i(e=>{let{[t]:r,...i}=e;return i})},[]),o=(0,J.useMemo)(()=>({canvases:r,registerCanvas:n,unregisterCanvas:s}),[r,n,s]);return(0,Q.jsx)(oJ.Provider,{value:o,children:e})}function cO(t){let{children:e}=t,r=(0,J.useRef)(null),{activeCanvas:i,activeCanvasType:n,bringForward:s,sendBackward:o,duplicate:a,deleteSelection:l,addImages:h,undo:c,redo:u}=o0(),{canvas:d,notifyChange:f,setDrawingMode:g}=oZ(i),p=async function(){let{top:t=0,left:e=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(let n of d.getActiveObjects()){var r,i;n.top=(null!=(r=n.top)?r:0)+t,n.left=(null!=(i=n.left)?i:0)+e,n.setCoords()}f()};return(0,Q.jsx)("div",{className:"CanvasInteractions",tabIndex:0,ref:r,onDragOver:t=>{t.preventDefault()},onDrop:async t=>{t.preventDefault(),r.current&&r.current.focus();let{items:e}=t.dataTransfer,i=Array.from(e).filter(t=>"file"===t.kind&&t.type.match(/^image\//)),n=await Promise.all(i.map(async t=>{let e=t.getAsFile();if(!e)throw Error("Not a file.");let r=new FileReader;return await new Promise((t,i)=>{r.onload=async e=>{e.target&&"string"==typeof e.target.result?t(e.target.result):i(Error("Failed to load image data."))},r.readAsDataURL(e)})}).filter(Boolean));await h(n)},onKeyDown:async t=>{let e=t.target;if("INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName){if(t.ctrlKey||t.metaKey)switch(t.key){case"z":if(t.altKey)return;if(t.shiftKey){t.preventDefault(),u();return}t.preventDefault(),c();return;case"y":if(t.altKey||t.shiftKey)return;t.preventDefault(),u();return}if(!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey)switch(t.key){case"Backspace":case"Delete":t.preventDefault(),await l();break;case"ArrowLeft":t.preventDefault(),await p({left:-1});break;case"ArrowRight":t.preventDefault(),await p({left:1});break;case"ArrowUp":t.preventDefault(),await p({top:-1});break;case"ArrowDown":t.preventDefault(),await p({top:1});break;case"d":t.preventDefault(),await a();break;case"f":t.preventDefault(),await s();break;case"b":t.preventDefault(),await o();break;case"p":"metallic"===n&&(t.preventDefault(),g(!0));break;case"s":"metallic"===n&&(t.preventDefault(),g(!1))}}},children:e})}function ck(){let{activeCanvasType:t,setActiveCanvasType:e,hasMetallic:r,hasAnimation:i,frameCount:n,selectedFrameIndex:s,setSelectedFrameIndex:o,sizeMultiplier:a,setSizeMultiplier:l}=o0();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"CanvasToggle",children:[(0,Q.jsx)("button",{type:"button","data-selected":"color"===t?"":void 0,onClick:()=>{e("color")},children:"Color"}),r?(0,Q.jsx)("button",{type:"button","data-selected":"metallic"===t?"":void 0,onClick:()=>{e("metallic")},children:"Metallic"}):null]}),(0,Q.jsxs)("div",{className:"CanvasToggle",style:{display:"none"},children:[(0,Q.jsx)("button",{type:"button","data-selected":1===a?"":void 0,onClick:()=>{l(1)},children:"1×"}),(0,Q.jsx)("button",{type:"button","data-selected":2===a?"":void 0,onClick:()=>{l(2)},children:"2×"}),(0,Q.jsx)("button",{type:"button","data-selected":4===a?"":void 0,onClick:()=>{l(4)},children:"4×"})]}),i?(0,Q.jsxs)("div",{className:"FrameSelector",children:[(0,Q.jsx)("button",{type:"button",onClick:()=>{o(t=>(n+t-1)%n)},children:(0,Q.jsx)(hP.FaChevronLeft,{})}),(0,Q.jsxs)("span",{className:"FrameInfo",children:[s+1," / ",n]}),(0,Q.jsx)("button",{type:"button",onClick:()=>{o(t=>(t+1)%n)},children:(0,Q.jsx)(hP.FaChevronRight,{})})]}):null]})}var cM=t.i(90106),cE=t.i(53653),cD=t.i(15768);let{defaultSkins:cj,modelDefaults:cA}=cd.default,cP={},cF=new Map;function cL(){var t,e,r,i,n,s;let{selectedModel:o,setSelectedModel:a,selectedModelType:l,setSelectedModelType:h,selectedSkin:c,setSelectedSkin:u,setSelectedSkinType:d,actualModel:f,setSelectedAnimation:g,setAnimationPaused:p,importedSkins:m,addImportedSkins:y}=hV(),{setSelectedMaterialIndex:x}=o0(),[b,_]=(0,J.useState)(cP),[w,C]=(0,J.useState)(cP),[S,T]=(0,J.useState)(null),O=(0,J.useRef)(null),[k,M]=(0,cD.default)(),E=Array.from((null!=(s=m.get(f))?s:cF).values()).filter(t=>t.isComplete);M&&(b!==k.customSkins||w!==k.newSkins)&&(_(k.customSkins),C(k.newSkins));let D=null!=c?c:"";return c&&S&&(D="".concat(S,"/").concat(c)),(0,Q.jsxs)("div",{className:"Toolbar",children:[(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsx)("label",{htmlFor:"ModelSelect",children:"Model"}),(0,Q.jsxs)("select",{id:"ModelSelect",value:o,onChange:t=>{var e,r,i,n;let s=t.target.selectedOptions[0].parentNode,o=t.target.value,l="hfemale"===o?"hmale":o,{modelType:f}=s.dataset;if(!f)throw Error("No data-model-type found");let m=c&&((null==(e=cj[l])?void 0:e.includes(c))||(null==(r=b[l])?void 0:r.includes(c)))||!1,y=!1;c&&"new"===S&&m&&(y=null==(i=w[l])?void 0:i.includes(c)),g(null),p(!1),h(f),a(o),x(0),m||(u(null!=(n=cA[l])?n:null),d("default")),y||T(null)},children:[(0,Q.jsxs)("optgroup",{label:"Players","data-model-type":"player",children:[(0,Q.jsx)("option",{value:"lmale",children:"Human Male • Light"}),(0,Q.jsx)("option",{value:"mmale",children:"Human Male • Medium"}),(0,Q.jsx)("option",{value:"hmale",children:"Human Male • Heavy"}),(0,Q.jsx)("option",{value:"lfemale",children:"Human Female • Light"}),(0,Q.jsx)("option",{value:"mfemale",children:"Human Female • Medium"}),(0,Q.jsx)("option",{value:"hfemale",children:"Human Female • Heavy"}),(0,Q.jsx)("option",{value:"lbioderm",children:"Bioderm • Light"}),(0,Q.jsx)("option",{value:"mbioderm",children:"Bioderm • Medium"}),(0,Q.jsx)("option",{value:"hbioderm",children:"Bioderm • Heavy"})]}),(0,Q.jsxs)("optgroup",{label:"Weapons","data-model-type":"weapon",children:[(0,Q.jsx)("option",{value:"disc",children:"Disc Launcher"}),(0,Q.jsx)("option",{value:"chaingun",children:"Chaingun"}),(0,Q.jsx)("option",{value:"grenade_launcher",children:"Grenade Launcher"}),(0,Q.jsx)("option",{value:"sniper",children:"Laser Rifle"}),(0,Q.jsx)("option",{value:"plasmathrower",children:"Plasma Cannon"}),(0,Q.jsx)("option",{value:"energy",children:"Blaster"}),(0,Q.jsx)("option",{value:"shocklance",children:"Shocklance"}),(0,Q.jsx)("option",{value:"elf",children:"ELF Projector"}),(0,Q.jsx)("option",{value:"missile",children:"Missile Launcher"}),(0,Q.jsx)("option",{value:"mortar",children:"Mortar"}),(0,Q.jsx)("option",{value:"repair",children:"Repair Pack"}),(0,Q.jsx)("option",{value:"targeting",children:"Targeting Laser"}),(0,Q.jsx)("option",{value:"mine",children:"Mine"})]}),(0,Q.jsxs)("optgroup",{label:"Vehicles","data-model-type":"vehicle",children:[(0,Q.jsx)("option",{value:"vehicle_grav_scout",children:"Wildcat Grav Cycle"}),(0,Q.jsx)("option",{value:"vehicle_grav_tank",children:"Beowulf Assault Tank"}),(0,Q.jsx)("option",{value:"vehicle_land_mpbbase",children:"Jericho Mobile Point Base"}),(0,Q.jsx)("option",{value:"vehicle_air_scout",children:"Shrike Scout Fighter"}),(0,Q.jsx)("option",{value:"vehicle_air_bomber",children:"Thundersword Bomber"}),(0,Q.jsx)("option",{value:"vehicle_air_hapc",children:"HAVOC Gunship Transport"})]})]})]}),(0,Q.jsxs)("div",{className:"Field",children:[(0,Q.jsx)("label",{htmlFor:"SkinSelect",children:"Skin"}),(0,Q.jsxs)("div",{className:"Buttons",children:[(0,Q.jsxs)("select",{id:"SkinSelect",value:D,onChange:t=>{var e,r;let i=t.target.selectedOptions[0].parentNode,n=t.target.value&&null!=(e=i.dataset.skinType)?e:null,s=t.target.value.split("/");u(null!=(r=s.slice(-1)[0])?r:null),d(n),s.length>1?T(s[0]):T(null)},children:[(0,Q.jsx)("option",{value:"",children:"Select a skin…"}),"player"===l?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("optgroup",{label:"Default Skins","data-skin-type":"default",children:null==(t=cj[f])?void 0:t.map(t=>(0,Q.jsx)("option",{value:t,children:t},t))}),E.length?(0,Q.jsx)("optgroup",{label:"Imported Skins","data-skin-type":"import",children:E.map(t=>{var e,r;return(0,Q.jsx)("option",{value:"import/".concat(null!=(e=t.name)?e:"__untitled__"),children:t.name||"Untitled Imported Skin"},"import/".concat(null!=(r=t.name)?r:"__untitled__"))})}):null,(null==(e=w[f])?void 0:e.length)?(0,Q.jsx)("optgroup",{label:"New Skins ✨","data-skin-type":"custom",children:null==(r=w[f])?void 0:r.map(t=>(0,Q.jsxs)("option",{value:"new/".concat(t),children:[t," ✨"]},"new/".concat(t)))}):null,(0,Q.jsx)("optgroup",{label:"Custom Skins","data-skin-type":"custom",children:b===cP?(0,Q.jsx)("option",{value:"",children:"Loading…"},"loading"):null==(i=b[f])?void 0:i.map(t=>(0,Q.jsx)("option",{value:t,children:t},t))})]}):null,"weapon"===l||"vehicle"===l?(0,Q.jsxs)(Q.Fragment,{children:[cA[f]?(0,Q.jsx)("optgroup",{label:"Default Skins","data-skin-type":"default",children:(0,Q.jsx)("option",{value:cA[f],children:"Default"})}):null,E.length?(0,Q.jsx)("optgroup",{label:"Imported Skins","data-skin-type":"import",children:E.map(t=>{var e,r;return(0,Q.jsx)("option",{value:"import/".concat(null!=(e=t.name)?e:"__untitled__"),children:t.name||"Untitled Imported Skin"},"import/".concat(null!=(r=t.name)?r:"__untitled__"))})}):null,(null==(n=b[f])?void 0:n.length)?(0,Q.jsx)("optgroup",{label:"Custom Skins","data-skin-type":"custom",children:b[f].map(t=>(0,Q.jsx)("option",{value:t,children:t},t))}):null]}):null]}),(0,Q.jsx)("button",{type:"button","aria-label":"Load Skin",title:"Load a Skin",onClick:()=>{O.current&&O.current.click()},children:(0,Q.jsx)(hP.FaFolderOpen,{style:{fontSize:18}})}),(0,Q.jsx)("input",{ref:O,onChange:async t=>{var e,r,i;let n=await (0,cE.importMultipleFilesToModels)(null!=(e=t.target.files)?e:[]);y(n);let s=n.get(f);if(s){let t=Array.from(s.values()).filter(t=>t.isComplete);if(t.length){let e=t[0];d("import"),T("import"),u(null!=(r=e.name)?r:"__untitled__"),x(0),g(null);return}}for(let[t,e]of Array.from(n.entries()))for(let r of Array.from(e.values()))if(r.isComplete){a(t),h((0,cE.modelToModelType)(t)),d("import"),T("import"),u(null!=(i=r.name)?i:"__untitled__"),x(0),g(null);break}},type:"file",accept:".png, image/png, .vl2, .zip, application/zip, application/zip-compressed",multiple:!0,hidden:!0})]})]}),(0,Q.jsx)("div",{className:"Field GalleryField",children:(0,Q.jsxs)("a",{href:"gallery/",target:"_blank",className:"GalleryLink",title:"Open skin gallery",children:[(0,Q.jsx)("span",{className:"FieldLabel",children:"Gallery"}),(0,Q.jsx)(cM.BsFillGrid3X3GapFill,{})]})})]})}var cR=t.i(18566);let{materials:cI,modelDefaults:cB,defaultSkins:cN}=cd.default,cW="https://exogen.github.io/t2-skins/skins",cU=new Map;function cH(t,e){if(e<2)return[t];let r=t.match(/^(.+)(\d\d)$/);if(r){let t=r[1];return Array(e).fill(null).map((e,r)=>"".concat(t).concat(r.toString().padStart(2,"0")))}throw Error("Did not match expected frame format")}function cX(t){let{basePath:e,actualModel:r,selectedModelType:i,selectedSkin:n,selectedSkinType:s}=t,o=cI[r];if(n&&"import"===s){let t=cU.get(r);if(t){let e="__untitled__"===n?null:n,r=t.get(e);if(r&&r.isComplete)return Object.fromEntries(r.materials)}throw Error("No skin found")}switch(i){case"player":switch(s){case"default":return{base:["".concat(e,"/textures/").concat(n,".").concat(r,".png")]};case"custom":return{base:["".concat(cW,"/").concat(n,".").concat(r,".png")]}}break;case"weapon":case"vehicle":return o.reduce((t,r)=>{if(r){var i,o,a,l,h;let c=null!=(i=r.frameCount)?i:1;switch(s){case"default":!1!==r.hasDefault&&(t[null!=(o=r.file)?o:r.name]=cH(null!=(a=r.file)?a:r.name,c).map(t=>"".concat(e,"/textures/").concat(t,".png")));break;case"custom":t[null!=(l=r.file)?l:r.name]=cH(null!=(h=r.file)?h:r.name,c).map(t=>"".concat(cW,"/").concat(n,"/").concat(t,".png"))}}return t},{})}return{}}function cV(t){var e,r;let{children:i}=t,n=(0,cR.useRouter)(),s=(0,cR.usePathname)(),o=(0,cR.useSearchParams)(),[a,l]=(0,J.useState)(!1),[h,c]=(0,J.useState)("lmale"),[u,d]=(0,J.useState)("player"),[f,g]=(0,J.useState)("Blood Eagle"),[p,m]=(0,J.useState)("default"),[y,x]=(0,J.useState)(null),[b,_]=(0,J.useState)(!1),[w,C]=(0,J.useState)(!1),{basePath:S}=cx(),T="hfemale"===h?"hmale":h,O="".concat(S,"/").concat(T).concat(y?".anim":"",".glb"),[k,M]=(0,J.useState)(cU),E=(0,J.useCallback)(t=>{let e=new Map(cU.entries());t.forEach((t,r)=>{var i;let n=null!=(i=e.get(r))?i:new Map;t.forEach((t,e)=>{n.set(e,t)}),e.set(r,n)}),M(cU=e)},[]),[D,j]=(0,J.useState)(()=>cX({basePath:S,actualModel:T,selectedModelType:u,selectedSkin:f,selectedSkinType:p})),A=(0,J.useMemo)(()=>cX({basePath:S,actualModel:T,selectedModelType:u,selectedSkin:cB[T],selectedSkinType:"default"}),[T,S,u]),P=(0,J.useMemo)(()=>({selectedModel:h,setSelectedModel:c,selectedModelType:u,setSelectedModelType:d,actualModel:T,selectedModelUrl:O,animationPaused:b,setAnimationPaused:_,selectedSkin:f,setSelectedSkin:g,selectedSkinType:p,setSelectedSkinType:m,selectedAnimation:y,setSelectedAnimation:x,skinImageUrls:D,setSkinImageUrls:j,defaultSkinImageUrls:A,slowModeEnabled:w,setSlowModeEnabled:C,importedSkins:k,addImportedSkins:E}),[h,c,u,d,T,O,b,_,f,g,p,m,y,x,D,j,A,w,k,E]);if(!a){let t=o.get("m"),i=o.get("s");if("string"==typeof t){let n=function(t){switch(t){case"lmale":case"mmale":case"hmale":case"lfemale":case"mfemale":case"hfemale":case"lbioderm":case"mbioderm":case"hbioderm":return"player";case"disc":case"chaingun":case"grenade_launcher":case"sniper":case"plasmathrower":case"energy":case"shocklance":case"elf":case"missile":case"mortar":case"repair":case"targeting":case"mine":return"weapon";case"vehicle_grav_scout":case"vehicle_grav_tank":case"vehicle_land_mpbbase":case"vehicle_air_scout":case"vehicle_air_bomber":case"vehicle_air_hapc":return"vehicle";default:return null}}(t);if(n&&(c(t),d(n),"string"==typeof i)){let n=i===cB[e="hfemale"===t?"hmale":t]||(null==(r=cN[e])?void 0:r.includes(i))?"default":"custom";g(i),m(n)}}l(!0)}return(0,J.useEffect)(()=>{if(!f)return;let t=o.get("m"),e=o.get("s");if(t!==h||e!==f){let t=new URLSearchParams(o);t.set("m",h),t.set("s",f);let e="".concat(s,"?").concat(t);n.replace(e,{scroll:!1})}},[s,n,o,h,f]),(0,J.useEffect)(()=>{if(f)try{let t=cX({basePath:S,actualModel:T,selectedModelType:u,selectedSkin:f,selectedSkinType:p});j(t)}catch(t){m("default"),g(cB[T])}},[T,S,u,f,p]),(0,Q.jsx)(hX.Provider,{value:P,children:i})}var cY=t.i(70703);let cz=J.default.createContext(null);function cG(){let t=(0,J.useContext)(cz);if(!t)throw Error("No EnvironmentContext.Provider");return t}cz.displayName="EnvironmentContext";let cq=J.default.createContext(null);function cK(){let t=(0,J.useContext)(cq);if(!t)throw Error("No SkinContext.Provider");return t}cq.displayName="SkinContext";var cQ=t.i(63871);function cJ(t){let{material:e,materialDef:r,textureType:i,imageUrl:n,frameRef:s,onReady:o}=t,{modelViewer:a}=(0,cQ.default)(),{basePath:l}=cx(),{slowModeEnabled:h}=hV();(0,J.useEffect)(()=>{let t,c=!1;return(async()=>{if(!r||r.hidden)if("metallicRoughnessTexture"===i){o&&o();return}else e.setAlphaMode("BLEND"),e.pbrMetallicRoughness.setBaseColorFactor([0,0,0,0]),o&&o();else{let{alphaMode:u,alphaCutoff:d,baseColorFactor:f,emissiveFactor:g,emissiveTexture:p=!1,metallicFactor:m=1,roughnessFactor:y=1,frameCount:x=1,frameTimings:b}=r,_=null!=n?n:Array(x).fill("".concat(l,"/white.png"));if(_.some(t=>!t))return;switch(i){case"baseColorTexture":f&&e.pbrMetallicRoughness.setBaseColorFactor(f),u&&e.setAlphaMode(u),d&&e.setAlphaCutoff(d),g&&e.setEmissiveFactor(g);break;case"metallicRoughnessTexture":e.pbrMetallicRoughness.setMetallicFactor(m),e.pbrMetallicRoughness.setRoughnessFactor(y),0===m&&1===y&&(_=Array(x).fill("".concat(l,"/green.png")))}let w=await Promise.all(_.map(t=>a.createTexture(t)));if(!c){let r="baseColorTexture"===i,n=s.current,a=()=>{let s=w[n.frameIndex];if(e.pbrMetallicRoughness[i].setTexture(s),r&&p&&e.emissiveTexture.setTexture(s),r&&(n.frameProgress+=h?.05:1),x>1){var o;let e=null!=(o=null==b?void 0:b[n.frameIndex])?o:1;r&&n.frameProgress>=e&&(n.frameIndex=(n.frameIndex+1)%x,n.frameProgress=0),t=requestAnimationFrame(a)}};a(0),o&&o()}}})(),()=>{c=!0,null!=t&&cancelAnimationFrame(t)}},[l,a,e,r,i,n,s,h,o])}function cZ(t){var e,r;let{material:i,materialDef:n,onReady:s}=t,{getSkinImages:o}=cK(),{colorImageUrl:a,metallicImageUrl:l}=null!=(r=o(null!=(e=null==n?void 0:n.file)?e:i.name))?r:{},h=(0,J.useRef)({frameIndex:0,frameProgress:0});return cJ({material:i,materialDef:n,textureType:"baseColorTexture",imageUrl:a,frameRef:h}),cJ({material:i,materialDef:n,textureType:"metallicRoughnessTexture",imageUrl:l,frameRef:h}),null}let{materials:c$}=cd.default;function c0(){let{actualModel:t}=hV(),{model:e}=(0,cQ.default)(),r=c$[t];return(0,Q.jsx)(Q.Fragment,{children:e.materials.map((t,e)=>{let i=r[e];return(0,Q.jsx)(cZ,{material:t,materialDef:i},t.name)})})}let c1=(0,cY.default)(()=>t.A(22143),{loadableGenerated:{modules:[66641]},ssr:!1}),{cameraOverrides:c2}=cd.default;function c5(){var t,e,r,i;let{selectedModel:n,selectedModelUrl:s,selectedModelType:o,selectedAnimation:a,animationPaused:l,slowModeEnabled:h}=hV(),{environmentImageUrl:c,showEnvironment:u,exposure:d}=cG();return(0,Q.jsx)(c1,{modelUrl:s,environmentImageUrl:c,showEnvironment:u,animationName:a,animationPaused:l,timeScale:h?.05:.5,cameraOrbit:null!=(i=null==(t=c2[n])?void 0:t.orbit)?i:"weapon"===o?"315deg 70deg 105%":void 0,cameraTarget:null==(e=c2[n])?void 0:e.target,fieldOfView:null==(r=c2[n])?void 0:r.fov,exposure:d,children:(0,Q.jsx)(c0,{})})}function c4(){let{selectedEnvironment:t,setSelectedEnvironment:e}=cG();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("label",{htmlFor:"EnvMapSelect",children:"Environment"}),(0,Q.jsxs)("select",{id:"EnvMapSelect",value:null!=t?t:"",onChange:t=>{e(t.target.value||null)},children:[(0,Q.jsx)("option",{value:"",children:"Default"}),(0,Q.jsx)("option",{value:"clarens_night_02_1k.hdr",children:"Clarens Night"}),(0,Q.jsx)("option",{value:"dry_cracked_lake_1k.hdr",children:"Dry Cracked Lake"}),(0,Q.jsx)("option",{value:"fouriesburg_mountain_midday_1k.hdr",children:"Fouriesburg Mountain"}),(0,Q.jsx)("option",{value:"goegap_1k.hdr",children:"Goegap"}),(0,Q.jsx)("option",{value:"hilly_terrain_01_1k.hdr",children:"Hilly Terrain"}),(0,Q.jsx)("option",{value:"kloofendal_48d_partly_cloudy_puresky_1k.hdr",children:"Kloofendal Partly Cloudy"}),(0,Q.jsx)("option",{value:"kloppenheim_06_puresky_1k.hdr",children:"Kloppenheim"}),(0,Q.jsx)("option",{value:"lilienstein_1k.hdr",children:"Lilienstein"}),(0,Q.jsx)("option",{value:"spruit_sunrise_1k_HDR.hdr",children:"Spruit Sunrise"}),(0,Q.jsx)("option",{value:"umhlanga_sunrise_1k.hdr",children:"Umhlanga Sunrise"})]})]})}function c3(){let{exposure:t,setExposure:e}=cG();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("label",{htmlFor:"EnvExposure",children:(0,Q.jsx)(hU,{size:16})}),(0,Q.jsx)("input",{"aria-label":"Exposure",id:"EnvExposure",type:"range",min:.2,max:2.2,step:.1,value:t,onChange:t=>{e(parseFloat(t.target.value))}})]})}let{animations:c9,animationLabels:c6,animationLabelOverrides:c8}=cd.default;function c7(){let{actualModel:t,selectedModelType:e,selectedAnimation:r,setSelectedAnimation:i,animationPaused:n,setAnimationPaused:s,slowModeEnabled:o,setSlowModeEnabled:a}=hV(),l=(0,J.useMemo)(()=>{var r;return[..."player"===e?c9.global:[],...null!=(r=c9[t])?r:[]]},[t,e]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"LabelWithControls",children:[(0,Q.jsx)("label",{children:"Animation"}),(0,Q.jsxs)("div",{className:"AnimationSpeed",children:[(0,Q.jsx)("input",{type:"checkbox",id:"SlowDownCheckbox",checked:o,onChange:t=>{a(t.target.checked)}})," ",(0,Q.jsx)("label",{htmlFor:"SlowDownCheckbox",children:"Slow?"})]})]}),(0,Q.jsxs)("div",{className:"Buttons",children:[(0,Q.jsxs)("select",{value:null!=r?r:"",onChange:t=>{i(t.target.value||null),s(!1)},children:[(0,Q.jsx)("option",{value:"",children:"None"}),l.map(e=>{var r,i;let n=null!=(i=null==(r=c8[t])?void 0:r[e])?i:c6[e];return(0,Q.jsx)("option",{value:e,children:null!=n?n:e},e)})]}),(0,Q.jsx)("button",{type:"button",disabled:!r,onClick:()=>{s(t=>!t)},children:n||!r?(0,Q.jsx)(hI,{}):(0,Q.jsx)(hR,{})})]})]})}function ut(t){let{children:e}=t,[r,i]=(0,J.useState)(null),[n,s]=(0,J.useState)(!1),[o,a]=(0,J.useState)(1),{basePath:l}=cx(),h=(0,J.useMemo)(()=>{let t=r?"".concat(l,"/").concat(r):null;return{selectedEnvironment:r,setSelectedEnvironment:i,showEnvironment:n,setShowEnvironment:s,exposure:o,setExposure:a,environmentImageUrl:t}},[l,r,n,o]);return(0,Q.jsx)(cz.Provider,{value:h,children:e})}function ue(t){let{children:e}=t,[r,i]=(0,J.useState)({}),n=(0,J.useMemo)(()=>({setSkinImages(t,e){i(r=>({...r,[t]:e}))},setColorImageUrl(t,e,r){i(i=>{var n,s;let o=Array.from(null!=(s=null==(n=i[t])?void 0:n.colorImageUrl)?s:[]);return o[r]=e,{...i,[t]:{...i[t],colorImageUrl:o}}})},setMetallicImageUrl(t,e,r){i(i=>{var n,s;let o=Array.from(null!=(s=null==(n=i[t])?void 0:n.metallicImageUrl)?s:[]);return o[r]=e,{...i,[t]:{...i[t],metallicImageUrl:o}}})}}),[]),s=(0,J.useMemo)(()=>({materialSkins:r,getSkinImages:t=>r[t],getColorImageUrl(t,e){var i;return null==(i=r[t].colorImageUrl)?void 0:i[e]},getMetallicImageUrl(t,e){var i;return null==(i=r[t].metallicImageUrl)?void 0:i[e]},...n}),[r,n]);return(0,Q.jsx)(cq.Provider,{value:s,children:e})}let{materials:ur}=cd.default;function ui(){let{actualModel:t}=hV(),{selectedMaterialIndex:e,setSelectedMaterialIndex:r}=o0(),i=ur[t];return(0,Q.jsx)("select",{value:e,onChange:t=>{r(parseInt(t.target.value,10))},children:i.map((t,e)=>{var r;return t&&!t.hidden&&!1!==t.selectable?(0,Q.jsx)("option",{value:e,children:null!=(r=t.label)?r:t.name},t.name):null})})}function un(t){let{canvasId:e,onChange:r,baseImageUrl:i,textureSize:n,defaultDrawingMode:s=!1}=t,o=(0,J.useRef)(null),[a,l]=(0,J.useState)(null),{activeCanvas:h}=o0(),{canvasPadding:c}=cx(),{registerCanvas:u,unregisterCanvas:d}=oZ(),[f,g]=(0,J.useState)(s),p=(0,J.useRef)(null),m=(0,J.useRef)(!0),[y,x]=(0,J.useState)(()=>[]),[b,_]=(0,J.useState)(()=>[]),w=y.length>1,C=b.length>0,S=(0,J.useCallback)(t=>{let e=p.current;e&&e(t)},[]),T=(0,J.useCallback)(async()=>{if(a&&y.length>1){let[t,e]=y.slice(-2);m.current=!1,a.renderOnAddRemove=!1,a.clear(),a.loadFromJSON(t,()=>{a.renderAll(),m.current=!0,a.renderOnAddRemove=!0}),x(t=>t.slice(0,-1)),_(t=>[e,...t])}},[a,y]),O=(0,J.useCallback)(()=>{if(a&&b.length>0){let t=b[0];m.current=!1,a.renderOnAddRemove=!1,a.clear(),a.loadFromJSON(t,()=>{a.renderAll(),m.current=!0,a.renderOnAddRemove=!0}),x(e=>[...e,t]),_(t=>t.slice(1))}},[a,b]);(0,J.useEffect)(()=>{p.current=r},[r]);let k=h===e;return(0,J.useEffect)(()=>{let t;if(!o.current)return;iB.ownDefaults={...iB.ownDefaults,transparentCorners:!1,borderColor:"#8afff1",cornerSize:9,cornerStyle:"circle",cornerColor:"#8afff1",cornerStrokeColor:"#1c9f7c",strokeWidth:10,perPixelTargetFind:!0};let e=new st(o.current,{preserveObjectStacking:!0,targetFindTolerance:2}),r=!1,i=()=>{S(e)};return e.on("object:modified",i),e.on("object:added",i),e.on("object:removed",i),e.on("after:render",()=>{!r&&m.current&&(clearTimeout(t),t=setTimeout(()=>{let t=(()=>{r=!0;let t=e.toDatalessJSON(["lockMovementX","lockMovementY","lockRotation","lockScalingX","lockScalingY","selectable","hoverCursor","moveCursor"]);return r=!1,t})();x(e=>{if(0===e.length)return[t];let r=e[e.length-1];return JSON.stringify(t)===JSON.stringify(r)?e:[...e.slice(-10),t]}),_([])},250))}),l(e),()=>{clearTimeout(t),l(null),e.dispose()}},[S]),(0,J.useEffect)(()=>{a&&(a.isDrawingMode=f,f&&(a.discardActiveObject(),a.requestRenderAll()))},[a,f]),(0,J.useEffect)(()=>{a&&k&&a.calcOffset()},[a,k]),(0,J.useEffect)(()=>{if(a)return u(e,{canvas:a,notifyChange:()=>{a.renderAll(),S(a)},undo:T,redo:O,canUndo:w,canRedo:C,isDrawingMode:f,setDrawingMode:g}),()=>{d(e)}},[a,u,d,e,S,f,g,T,O,w,C]),(0,J.useEffect)(()=>{x([]),_([])},[a,i,n]),(0,J.useEffect)(()=>{if(a&&n&&(m.current=!1,a.clear(),i)){let t=!1;return(async()=>{let e=await cm(i);if(!t){if(!e.width||!e.height)throw Error("Zero-height image");e.selectable=!1,e.lockMovementX=!0,e.lockMovementY=!0,e.lockScalingX=!0,e.lockScalingY=!0,e.lockRotation=!0,e.hoverCursor="default",e.moveCursor="default";let[t,r]=n,i=e.width===t?1:t/e.width,s=e.height===r?1:r/e.height;(1!==i||1!==s)&&(e.scaleX=i,e.scaleY=s),a.centerObject(e),a.add(e)}m.current=!0,a.requestRenderAll()})(),()=>{t=!0}}},[a,i,n]),(0,Q.jsx)("div",{className:"CanvasContainer","data-active":k?"true":"false",children:(0,Q.jsx)("canvas",{width:n[0]+2*c,height:n[1]+2*c,ref:o})})}let us=J.default.createContext(null);function uo(){let t=(0,J.useContext)(us);if(!t)throw Error("ImageLoaderContext.Provider not found!");return t}us.displayName="ImageLoaderContext";let ua=[512,512];function ul(t){var e,r,i,n;let{materialDef:s,frameIndex:o=0}=t,{skinImageUrls:a,defaultSkinImageUrls:l}=hV(),h=null==(e=a[null!=(i=s.file)?i:s.name])?void 0:e[o],c=null==(r=l[null!=(n=s.file)?n:s.name])?void 0:r[o],{setColorImageUrl:u}=cK(),{canvasPadding:d}=cx(),[f,g]=(0,J.useState)(null),{removeAlphaFromArrayBuffer:p}=cy(),{loadImage:m}=uo(),{sizeMultiplier:y}=o0(),x=(0,J.useMemo)(()=>{var t;let[e,r]=null!=(t=s.size)?t:ua;return[e*y,r*y]},[s.size,y]),b=(0,J.useCallback)(async t=>{var e;let r=t.toDataURL({format:"png",multiplier:1,top:d,left:d,width:x[0],height:x[1]});u(null!=(e=s.file)?e:s.name,r,o)},[x,d,u,s,o]);(0,J.useEffect)(()=>{if(h){let t=!1;return(async()=>{let e;try{e=await m(h)}catch(t){if(!1===s.hasDefault)return;e=await m(c)}let r=await p(e);t||g(r)})(),()=>{t=!0}}g(null)},[s,h,c,p,m]);let _="".concat(s.name,":color:").concat(o,":").concat(y);return x?(0,Q.jsx)(un,{canvasId:_,canvasType:"color",onChange:b,baseImageUrl:f,textureSize:x},_):null}let uh=[512,512];function uc(t){var e,r,i,n;let{materialDef:s,frameIndex:o=0}=t,{skinImageUrls:a,defaultSkinImageUrls:l}=hV(),h=null==(e=a[null!=(i=s.file)?i:s.name])?void 0:e[o],c=null==(r=l[null!=(n=s.file)?n:s.name])?void 0:r[o],{setMetallicImageUrl:u}=cK(),{canvasPadding:d}=cx(),[f,g]=(0,J.useState)(null),p=(0,J.useRef)(0),{convertGrayscaleImageUrlToMetallicRoughness:m,convertArrayBufferAlphaToGrayscale:y}=cy(),{loadImage:x}=uo(),{sizeMultiplier:b}=o0(),_=(0,J.useMemo)(()=>{var t;let[e,r]=null!=(t=s.size)?t:uh;return[e*b,r*b]},[s.size,b]),w=(0,J.useCallback)(async t=>{let e;p.current+=1;let r=t.toDataURL({format:"png",multiplier:1,top:d,left:d,width:_[0],height:_[1]});try{e=await m(r)}finally{p.current-=1}if(0===p.current){var i;u(null!=(i=s.file)?i:s.name,e,o)}},[_,d,u,m,s,o]);(0,J.useEffect)(()=>{if(h){let t=!1;return(async()=>{let e;try{e=await x(h)}catch(t){if(!1===s.hasDefault)return;e=await x(c)}let r=await y(e);t||g(r)})(),()=>{t=!0}}g(null)},[s,h,c,_,y,x]);let C="".concat(s.name,":metallic:").concat(o,":").concat(b);return _?(0,Q.jsx)(un,{canvasId:C,canvasType:"metallic",onChange:w,baseImageUrl:f,textureSize:_,defaultDrawingMode:!0},C):null}let{materials:uu}=cd.default;function ud(){let{actualModel:t}=hV(),e=uu[t];return(0,Q.jsx)(Q.Fragment,{children:e.map(e=>{var r;if(!e)return null;let i=0!==e.metallicFactor||1!==e.roughnessFactor,n=Array(null!=(r=e.frameCount)?r:1).fill(null);return(0,Q.jsxs)(J.default.Fragment,{children:[n.map((t,r)=>(0,Q.jsx)(ul,{materialDef:e,frameIndex:r},"color:".concat(r))),i?n.map((t,r)=>(0,Q.jsx)(uc,{materialDef:e,frameIndex:r},"metallic:".concat(r))):null]},"".concat(t,"-").concat(e.name))})})}var uf=J.createContext(void 0),ug=t=>{let{client:e,children:r}=t;return J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Q.jsx)(uf.Provider,{value:e,children:r})};function up(t){let{children:e}=t,r=(t=>{let e=J.useContext(uf);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e})(),i=(0,J.useMemo)(()=>({loadImage:async t=>t.startsWith("data:")?(0,cb.imageUrlToArrayBuffer)(t):await r.fetchQuery({queryKey:[t]})}),[r]);return(0,Q.jsx)(us.Provider,{value:i,children:e})}function um(t,e,r){if(!e.has(t))throw TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function uv(t,e){var r=um(t,e,"get");return r.get?r.get.call(t):r.value}function uy(t,e){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object")}function ux(t,e,r){uy(t,e),e.set(t,r)}function ub(t,e,r){var i=um(t,e,"set");if(i.set)i.set.call(t,r);else{if(!i.writable)throw TypeError("attempted to set read only private field");i.value=r}return r}function u_(t,e){var r=um(t,e,"update");if(r.set){if(!r.get)throw TypeError("attempted to read set only private field");return"__destrWrapper"in r||(r.__destrWrapper={set value(v){r.set.call(t,v)},get value(){return r.get.call(t)}}),r.__destrWrapper}if(!r.writable)throw TypeError("attempted to set read only private field");return r}var uw={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},uC=new(p=new WeakMap,m=new WeakMap,class{setTimeoutProvider(t){ub(this,p,t)}setTimeout(t,e){return uv(this,p).setTimeout(t,e)}clearTimeout(t){uv(this,p).clearTimeout(t)}setInterval(t,e){return uv(this,p).setInterval(t,e)}clearInterval(t){uv(this,p).clearInterval(t)}constructor(){ux(this,p,{writable:!0,value:uw}),ux(this,m,{writable:!0,value:!1})}}),uS="undefined"==typeof window||"Deno"in globalThis;function uT(){}function uO(t,e){return"function"==typeof t?t(e):t}function uk(t,e){let{type:r="all",exact:i,fetchStatus:n,predicate:s,queryKey:o,stale:a}=t;if(o){if(i){if(e.queryHash!==uE(o,e.options))return!1}else if(!uj(e.queryKey,o))return!1}if("all"!==r){let t=e.isActive();if("active"===r&&!t||"inactive"===r&&t)return!1}return("boolean"!=typeof a||e.isStale()===a)&&(!n||n===e.state.fetchStatus)&&(!s||!!s(e))}function uM(t,e){let{exact:r,status:i,predicate:n,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(r){if(uD(e.options.mutationKey)!==uD(s))return!1}else if(!uj(e.options.mutationKey,s))return!1}return(!i||e.state.status===i)&&(!n||!!n(e))}function uE(t,e){return((null==e?void 0:e.queryKeyHashFn)||uD)(t)}function uD(t){return JSON.stringify(t,(t,e)=>uF(e)?Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}):e)}function uj(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).every(r=>uj(t[r],e[r]))}var uA=Object.prototype.hasOwnProperty;function uP(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function uF(t){if(!uL(t))return!1;let e=t.constructor;if(void 0===e)return!0;let r=e.prototype;return!!uL(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(t)===Object.prototype}function uL(t){return"[object Object]"===Object.prototype.toString.call(t)}function uR(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[...t,e];return r&&i.length>r?i.slice(1):i}function uI(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[e,...t];return r&&i.length>r?i.slice(0,-1):i}var uB=Symbol();function uN(t,e){return!t.queryFn&&(null==e?void 0:e.initialPromise)?()=>e.initialPromise:t.queryFn&&t.queryFn!==uB?t.queryFn:()=>Promise.reject(Error("Missing queryFn: '".concat(t.queryHash,"'")))}function uW(t,e,r){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return r}function uU(t,e){uy(t,e),e.add(t)}var uH=function(t){setTimeout(t,0)},uX=function(){let t=[],e=0,r=t=>{t()},i=t=>{t()},n=uH,s=i=>{e?t.push(i):n(()=>{r(i)})};return{batch:s=>{let o;e++;try{o=s()}finally{--e||(()=>{let e=t;t=[],e.length&&n(()=>{i(()=>{e.forEach(t=>{r(t)})})})})()}return o},batchCalls:t=>function(){for(var e=arguments.length,r=Array(e),i=0;i{t(...r)})},schedule:s,setNotifyFunction:t=>{r=t},setBatchNotifyFunction:t=>{i=t},setScheduler:t=>{n=t}}}(),uV=class{subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}},uY=new(y=new WeakMap,x=new WeakMap,b=new WeakMap,class extends uV{onSubscribe(){uv(this,x)||this.setEventListener(uv(this,b))}onUnsubscribe(){var t;this.hasListeners()||(null==(t=uv(this,x))||t.call(this),ub(this,x,void 0))}setEventListener(t){var e;ub(this,b,t),null==(e=uv(this,x))||e.call(this),ub(this,x,t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()}))}setFocused(t){uv(this,y)!==t&&(ub(this,y,t),this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){var t;return"boolean"==typeof uv(this,y)?uv(this,y):(null==(t=globalThis.document)?void 0:t.visibilityState)!=="hidden"}constructor(){super(),ux(this,y,{writable:!0,value:void 0}),ux(this,x,{writable:!0,value:void 0}),ux(this,b,{writable:!0,value:void 0}),ub(this,b,t=>{if(!uS&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}})}}),uz=new(_=new WeakMap,w=new WeakMap,C=new WeakMap,class extends uV{onSubscribe(){uv(this,w)||this.setEventListener(uv(this,C))}onUnsubscribe(){var t;this.hasListeners()||(null==(t=uv(this,w))||t.call(this),ub(this,w,void 0))}setEventListener(t){var e;ub(this,C,t),null==(e=uv(this,w))||e.call(this),ub(this,w,t(this.setOnline.bind(this)))}setOnline(t){uv(this,_)!==t&&(ub(this,_,t),this.listeners.forEach(e=>{e(t)}))}isOnline(){return uv(this,_)}constructor(){super(),ux(this,_,{writable:!0,value:!0}),ux(this,w,{writable:!0,value:void 0}),ux(this,C,{writable:!0,value:void 0}),ub(this,C,t=>{if(!uS&&window.addEventListener){let e=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",r)}}})}});function uG(t){return Math.min(1e3*2**t,3e4)}function uq(t){return(null!=t?t:"online")!=="online"||uz.isOnline()}var uK=class extends Error{constructor(t){super("CancelledError"),this.revert=null==t?void 0:t.revert,this.silent=null==t?void 0:t.silent}};function uQ(t){let e,r=!1,i=0,n=function(){let t,e,r=new Promise((r,i)=>{t=r,e=i});function i(t){Object.assign(r,t),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=e=>{i({status:"fulfilled",value:e}),t(e)},r.reject=t=>{i({status:"rejected",reason:t}),e(t)},r}(),s=()=>uY.isFocused()&&("always"===t.networkMode||uz.isOnline())&&t.canRun(),o=()=>uq(t.networkMode)&&t.canRun(),a=t=>{"pending"===n.status&&(null==e||e(),n.resolve(t))},l=t=>{"pending"===n.status&&(null==e||e(),n.reject(t))},h=()=>new Promise(r=>{var i;e=t=>{("pending"!==n.status||s())&&r(t)},null==(i=t.onPause)||i.call(t)}).then(()=>{if(e=void 0,"pending"===n.status){var r;null==(r=t.onContinue)||r.call(t)}}),c=()=>{let e;if("pending"!==n.status)return;let o=0===i?t.initialPromise:void 0;try{e=null!=o?o:t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(a).catch(e=>{var o,a,u;if("pending"!==n.status)return;let d=null!=(a=t.retry)?a:3*!uS,f=null!=(u=t.retryDelay)?u:uG,g="function"==typeof f?f(i,e):f,p=!0===d||"number"==typeof d&&i{uC.setTimeout(t,g)}).then(()=>s()?void 0:h()).then(()=>{r?l(e):c()})})};return{promise:n,status:()=>n.status,cancel:e=>{if("pending"===n.status){var r;let i=new uK(e);l(i),null==(r=t.onCancel)||r.call(t,i)}},continue:()=>(null==e||e(),n),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:o,start:()=>(o()?c():h().then(c),n)}}var uJ=(S=new WeakMap,class{destroy(){this.clearGcTimeout()}scheduleGc(){var t;this.clearGcTimeout(),"number"==typeof(t=this.gcTime)&&t>=0&&t!==1/0&&ub(this,S,uC.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,null!=t?t:uS?1/0:3e5)}clearGcTimeout(){uv(this,S)&&(uC.clearTimeout(uv(this,S)),ub(this,S,void 0))}constructor(){ux(this,S,{writable:!0,value:void 0})}}),uZ=(T=new WeakMap,O=new WeakMap,k=new WeakMap,M=new WeakMap,E=new WeakMap,D=new WeakMap,j=new WeakMap,A=new WeakSet,class extends uJ{get meta(){return this.options.meta}get promise(){var t;return null==(t=uv(this,E))?void 0:t.promise}setOptions(t){if(this.options={...uv(this,D),...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let t=u$(this.options);void 0!==t.data&&(this.setData(t.data,{updatedAt:t.dataUpdatedAt,manual:!0}),ub(this,T,t))}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||uv(this,k).remove(this)}setData(t,e){var r,i;let n=(r=this.state.data,"function"==typeof(i=this.options).structuralSharing?i.structuralSharing(r,t):!1!==i.structuralSharing?function t(e,r){if(e===r)return e;let i=uP(e)&&uP(r);if(!i&&!(uF(e)&&uF(r)))return r;let n=(i?e:Object.keys(e)).length,s=i?r:Object.keys(r),o=s.length,a=i?Array(o):{},l=0;for(let h=0;h{var e;return!1!==(e=t.options.enabled,"function"==typeof e?e(this):e)})}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===uB||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===uO(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!Math.max(this.state.dataUpdatedAt+(t||0)-Date.now(),0))}onFocus(){var t;let e=this.observers.find(t=>t.shouldFetchOnWindowFocus());null==e||e.refetch({cancelRefetch:!1}),null==(t=uv(this,E))||t.continue()}onOnline(){var t;let e=this.observers.find(t=>t.shouldFetchOnReconnect());null==e||e.refetch({cancelRefetch:!1}),null==(t=uv(this,E))||t.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),uv(this,k).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(uv(this,E)&&(uv(this,j)?uv(this,E).cancel({revert:!0}):uv(this,E).cancelRetry()),this.scheduleGc()),uv(this,k).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||uW(this,A,u0).call(this,{type:"invalidate"})}async fetch(t,e){var r,i,n,s,o,a,l,h,c,u,d,f;if("idle"!==this.state.fetchStatus&&(null==(r=uv(this,E))?void 0:r.status())!=="rejected"){if(void 0!==this.state.data&&(null==e?void 0:e.cancelRefetch))this.cancel({silent:!0});else if(uv(this,E))return uv(this,E).continueRetry(),uv(this,E).promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let g=new AbortController,p=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(ub(this,j,!0),g.signal)})},m=()=>{let t=uN(this.options,e),r=(()=>{let t={client:uv(this,M),queryKey:this.queryKey,meta:this.meta};return p(t),t})();return(ub(this,j,!1),this.options.persister)?this.options.persister(t,r,this):t(r)},y=(()=>{let t={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:uv(this,M),state:this.state,fetchFn:m};return p(t),t})();null==(i=this.options.behavior)||i.onFetch(y,this),ub(this,O,this.state),("idle"===this.state.fetchStatus||this.state.fetchMeta!==(null==(n=y.fetchOptions)?void 0:n.meta))&&uW(this,A,u0).call(this,{type:"fetch",meta:null==(s=y.fetchOptions)?void 0:s.meta}),ub(this,E,uQ({initialPromise:null==e?void 0:e.initialPromise,fn:y.fetchFn,onCancel:t=>{t instanceof uK&&t.revert&&this.setState({...uv(this,O),fetchStatus:"idle"}),g.abort()},onFail:(t,e)=>{uW(this,A,u0).call(this,{type:"failed",failureCount:t,error:e})},onPause:()=>{uW(this,A,u0).call(this,{type:"pause"})},onContinue:()=>{uW(this,A,u0).call(this,{type:"continue"})},retry:y.options.retry,retryDelay:y.options.retryDelay,networkMode:y.options.networkMode,canRun:()=>!0}));try{let t=await uv(this,E).start();if(void 0===t)throw Error("".concat(this.queryHash," data is undefined"));return this.setData(t),null==(o=(a=uv(this,k).config).onSuccess)||o.call(a,t,this),null==(l=(h=uv(this,k).config).onSettled)||l.call(h,t,this.state.error,this),t}catch(t){if(t instanceof uK){if(t.silent)return uv(this,E).promise;else if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw uW(this,A,u0).call(this,{type:"error",error:t}),null==(c=(u=uv(this,k).config).onError)||c.call(u,t,this),null==(d=(f=uv(this,k).config).onSettled)||d.call(f,this.state.data,t,this),t}finally{this.scheduleGc()}}constructor(t){var e;super(),uU(this,A),ux(this,T,{writable:!0,value:void 0}),ux(this,O,{writable:!0,value:void 0}),ux(this,k,{writable:!0,value:void 0}),ux(this,M,{writable:!0,value:void 0}),ux(this,E,{writable:!0,value:void 0}),ux(this,D,{writable:!0,value:void 0}),ux(this,j,{writable:!0,value:void 0}),ub(this,j,!1),ub(this,D,t.defaultOptions),this.setOptions(t.options),this.observers=[],ub(this,M,t.client),ub(this,k,uv(this,M).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ub(this,T,u$(this.options)),this.state=null!=(e=t.state)?e:uv(this,T),this.scheduleGc()}});function u$(t){let e="function"==typeof t.initialData?t.initialData():t.initialData,r=void 0!==e,i=r?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?null!=i?i:Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}function u0(t){let e=e=>{var r,i,n;switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...(n=e.data,{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uq(this.options.networkMode)?"fetching":"paused",...void 0===n&&{error:null,status:"pending"}}),fetchMeta:null!=(r=t.meta)?r:null};case"success":let s={...e,data:t.data,dataUpdateCount:e.dataUpdateCount+1,dataUpdatedAt:null!=(i=t.dataUpdatedAt)?i:Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ub(this,O,t.manual?s:void 0),s;case"error":let o=t.error;return{...e,error:o,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}};this.state=e(this.state),uX.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),uv(this,k).notify({query:this,type:"updated",action:t})})}var u1=(P=new WeakMap,class extends uV{build(t,e,r){var i;let n=e.queryKey,s=null!=(i=e.queryHash)?i:uE(n,e),o=this.get(s);return o||(o=new uZ({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(e),state:r,defaultOptions:t.getQueryDefaults(n)}),this.add(o)),o}add(t){uv(this,P).has(t.queryHash)||(uv(this,P).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=uv(this,P).get(t.queryHash);e&&(t.destroy(),e===t&&uv(this,P).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){uX.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return uv(this,P).get(t)}getAll(){return[...uv(this,P).values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>uk(e,t))}findAll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAll();return Object.keys(t).length>0?e.filter(e=>uk(t,e)):e}notify(t){uX.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){uX.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){uX.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}constructor(t={}){super(),ux(this,P,{writable:!0,value:void 0}),this.config=t,ub(this,P,new Map)}}),u2=(F=new WeakMap,L=new WeakMap,R=new WeakMap,I=new WeakMap,B=new WeakSet,class extends uJ{setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){uv(this,L).includes(t)||(uv(this,L).push(t),this.clearGcTimeout(),uv(this,R).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ub(this,L,uv(this,L).filter(e=>e!==t)),this.scheduleGc(),uv(this,R).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){uv(this,L).length||("pending"===this.state.status?this.scheduleGc():uv(this,R).remove(this))}continue(){var t,e;return null!=(e=null==(t=uv(this,I))?void 0:t.continue())?e:this.execute(this.state.variables)}async execute(t){var e,r,i,n,s,o,a,l,h,c,u,d,f,g,p,m,y,x,b,_,w;let C=()=>{uW(this,B,u5).call(this,{type:"continue"})},S={client:uv(this,F),meta:this.options.meta,mutationKey:this.options.mutationKey};ub(this,I,uQ({fn:()=>this.options.mutationFn?this.options.mutationFn(t,S):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{uW(this,B,u5).call(this,{type:"failed",failureCount:t,error:e})},onPause:()=>{uW(this,B,u5).call(this,{type:"pause"})},onContinue:C,retry:null!=(e=this.options.retry)?e:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>uv(this,R).canRun(this)}));let T="pending"===this.state.status,O=!uv(this,I).canStart();try{if(T)C();else{uW(this,B,u5).call(this,{type:"pending",variables:t,isPaused:O}),await (null==(c=(u=uv(this,R).config).onMutate)?void 0:c.call(u,t,this,S));let e=await (null==(d=(f=this.options).onMutate)?void 0:d.call(f,t,S));e!==this.state.context&&uW(this,B,u5).call(this,{type:"pending",context:e,variables:t,isPaused:O})}let e=await uv(this,I).start();return await (null==(r=(i=uv(this,R).config).onSuccess)?void 0:r.call(i,e,t,this.state.context,this,S)),await (null==(n=(s=this.options).onSuccess)?void 0:n.call(s,e,t,this.state.context,S)),await (null==(o=(a=uv(this,R).config).onSettled)?void 0:o.call(a,e,null,this.state.variables,this.state.context,this,S)),await (null==(l=(h=this.options).onSettled)?void 0:l.call(h,e,null,t,this.state.context,S)),uW(this,B,u5).call(this,{type:"success",data:e}),e}catch(e){try{throw await (null==(g=(p=uv(this,R).config).onError)?void 0:g.call(p,e,t,this.state.context,this,S)),await (null==(m=(y=this.options).onError)?void 0:m.call(y,e,t,this.state.context,S)),await (null==(x=(b=uv(this,R).config).onSettled)?void 0:x.call(b,void 0,e,this.state.variables,this.state.context,this,S)),await (null==(_=(w=this.options).onSettled)?void 0:_.call(w,void 0,e,t,this.state.context,S)),e}finally{uW(this,B,u5).call(this,{type:"error",error:e})}}finally{uv(this,R).runNext(this)}}constructor(t){super(),uU(this,B),ux(this,F,{writable:!0,value:void 0}),ux(this,L,{writable:!0,value:void 0}),ux(this,R,{writable:!0,value:void 0}),ux(this,I,{writable:!0,value:void 0}),ub(this,F,t.client),this.mutationId=t.mutationId,ub(this,R,t.mutationCache),ub(this,L,[]),this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}});function u5(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),uX.batch(()=>{uv(this,L).forEach(e=>{e.onMutationUpdate(t)}),uv(this,R).notify({mutation:this,type:"updated",action:t})})}var u4=(N=new WeakMap,W=new WeakMap,U=new WeakMap,class extends uV{build(t,e,r){let i=new u2({client:t,mutationCache:this,mutationId:++u_(this,U).value,options:t.defaultMutationOptions(e),state:r});return this.add(i),i}add(t){uv(this,N).add(t);let e=u3(t);if("string"==typeof e){let r=uv(this,W).get(e);r?r.push(t):uv(this,W).set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(uv(this,N).delete(t)){let e=u3(t);if("string"==typeof e){let r=uv(this,W).get(e);if(r)if(r.length>1){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}else r[0]===t&&uv(this,W).delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=u3(t);if("string"!=typeof e)return!0;{let r=uv(this,W).get(e),i=null==r?void 0:r.find(t=>"pending"===t.state.status);return!i||i===t}}runNext(t){let e=u3(t);if("string"!=typeof e)return Promise.resolve();{var r,i;let n=null==(r=uv(this,W).get(e))?void 0:r.find(e=>e!==t&&e.state.isPaused);return null!=(i=null==n?void 0:n.continue())?i:Promise.resolve()}}clear(){uX.batch(()=>{uv(this,N).forEach(t=>{this.notify({type:"removed",mutation:t})}),uv(this,N).clear(),uv(this,W).clear()})}getAll(){return Array.from(uv(this,N))}find(t){let e={exact:!0,...t};return this.getAll().find(t=>uM(e,t))}findAll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getAll().filter(e=>uM(t,e))}notify(t){uX.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return uX.batch(()=>Promise.all(t.map(t=>t.continue().catch(uT))))}constructor(t={}){super(),ux(this,N,{writable:!0,value:void 0}),ux(this,W,{writable:!0,value:void 0}),ux(this,U,{writable:!0,value:void 0}),this.config=t,ub(this,N,new Set),ub(this,W,new Map),ub(this,U,0)}});function u3(t){var e;return null==(e=t.options.scope)?void 0:e.id}function u9(t){return{onFetch:(e,r)=>{var i,n,s,o,a;let l=e.options,h=null==(s=e.fetchOptions)||null==(n=s.meta)||null==(i=n.fetchMore)?void 0:i.direction,c=(null==(o=e.state.data)?void 0:o.pages)||[],u=(null==(a=e.state.data)?void 0:a.pageParams)||[],d={pages:[],pageParams:[]},f=0,g=async()=>{let r=!1,i=uN(e.options,e.fetchOptions),n=async(t,n,s)=>{if(r)return Promise.reject();if(null==n&&t.pages.length)return Promise.resolve(t);let o=(()=>{let t={client:e.client,queryKey:e.queryKey,pageParam:n,direction:s?"backward":"forward",meta:e.options.meta};return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(e.signal.aborted?r=!0:e.signal.addEventListener("abort",()=>{r=!0}),e.signal)}),t})(),a=await i(o),{maxPages:l}=e.options,h=s?uI:uR;return{pages:h(t.pages,a,l),pageParams:h(t.pageParams,n,l)}};if(h&&c.length){let t="backward"===h,e={pages:c,pageParams:u},r=(t?function(t,e){var r;let{pages:i,pageParams:n}=e;return i.length>0?null==(r=t.getPreviousPageParam)?void 0:r.call(t,i[0],i,n[0],n):void 0}:u6)(l,e);d=await n(e,r,t)}else{let e=null!=t?t:c.length;do{var s;let t=0===f?null!=(s=u[0])?s:l.initialPageParam:u6(l,d);if(f>0&&null==t)break;d=await n(d,t),f++}while(f{var t,i;return null==(t=(i=e.options).persister)?void 0:t.call(i,g,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=g}}}function u6(t,e){let{pages:r,pageParams:i}=e,n=r.length-1;return r.length>0?t.getNextPageParam(r[n],r,i[n],i):void 0}let u8=new(H=new WeakMap,X=new WeakMap,V=new WeakMap,Y=new WeakMap,z=new WeakMap,G=new WeakMap,q=new WeakMap,K=new WeakMap,class{mount(){u_(this,G).value++,1===uv(this,G)&&(ub(this,q,uY.subscribe(async t=>{t&&(await this.resumePausedMutations(),uv(this,H).onFocus())})),ub(this,K,uz.subscribe(async t=>{t&&(await this.resumePausedMutations(),uv(this,H).onOnline())})))}unmount(){var t,e;u_(this,G).value--,0===uv(this,G)&&(null==(t=uv(this,q))||t.call(this),ub(this,q,void 0),null==(e=uv(this,K))||e.call(this),ub(this,K,void 0))}isFetching(t){return uv(this,H).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return uv(this,X).findAll({...t,status:"pending"}).length}getQueryData(t){var e;let r=this.defaultQueryOptions({queryKey:t});return null==(e=uv(this,H).get(r.queryHash))?void 0:e.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),r=uv(this,H).build(this,e),i=r.state.data;return void 0===i?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(uO(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return uv(this,H).findAll(t).map(t=>{let{queryKey:e,state:r}=t;return[e,r.data]})}setQueryData(t,e,r){let i=this.defaultQueryOptions({queryKey:t}),n=uv(this,H).get(i.queryHash),s=null==n?void 0:n.state.data,o="function"==typeof e?e(s):e;if(void 0!==o)return uv(this,H).build(this,i).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return uX.batch(()=>uv(this,H).findAll(t).map(t=>{let{queryKey:i}=t;return[i,this.setQueryData(i,e,r)]}))}getQueryState(t){var e;let r=this.defaultQueryOptions({queryKey:t});return null==(e=uv(this,H).get(r.queryHash))?void 0:e.state}removeQueries(t){let e=uv(this,H);uX.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let r=uv(this,H);return uX.batch(()=>(r.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={revert:!0,...e};return Promise.all(uX.batch(()=>uv(this,H).findAll(t).map(t=>t.cancel(r)))).then(uT).catch(uT)}invalidateQueries(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return uX.batch(()=>{var r,i;return(uv(this,H).findAll(t).forEach(t=>{t.invalidate()}),(null==t?void 0:t.refetchType)==="none")?Promise.resolve():this.refetchQueries({...t,type:null!=(i=null!=(r=null==t?void 0:t.refetchType)?r:null==t?void 0:t.type)?i:"active"},e)})}refetchQueries(t){var e;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={...r,cancelRefetch:null==(e=r.cancelRefetch)||e};return Promise.all(uX.batch(()=>uv(this,H).findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,i);return i.throwOnError||(e=e.catch(uT)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(uT)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let r=uv(this,H).build(this,e);return r.isStaleByTime(uO(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(uT).catch(uT)}fetchInfiniteQuery(t){return t.behavior=u9(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(uT).catch(uT)}ensureInfiniteQueryData(t){return t.behavior=u9(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return uz.isOnline()?uv(this,X).resumePausedMutations():Promise.resolve()}getQueryCache(){return uv(this,H)}getMutationCache(){return uv(this,X)}getDefaultOptions(){return uv(this,V)}setDefaultOptions(t){ub(this,V,t)}setQueryDefaults(t,e){uv(this,Y).set(uD(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...uv(this,Y).values()],r={};return e.forEach(e=>{uj(t,e.queryKey)&&Object.assign(r,e.defaultOptions)}),r}setMutationDefaults(t,e){uv(this,z).set(uD(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...uv(this,z).values()],r={};return e.forEach(e=>{uj(t,e.mutationKey)&&Object.assign(r,e.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;let e={...uv(this,V).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=uE(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===uB&&(e.enabled=!1),e}defaultMutationOptions(t){return(null==t?void 0:t._defaulted)?t:{...uv(this,V).mutations,...(null==t?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){uv(this,H).clear(),uv(this,X).clear()}constructor(t={}){ux(this,H,{writable:!0,value:void 0}),ux(this,X,{writable:!0,value:void 0}),ux(this,V,{writable:!0,value:void 0}),ux(this,Y,{writable:!0,value:void 0}),ux(this,z,{writable:!0,value:void 0}),ux(this,G,{writable:!0,value:void 0}),ux(this,q,{writable:!0,value:void 0}),ux(this,K,{writable:!0,value:void 0}),ub(this,H,t.queryCache||new u1),ub(this,X,t.mutationCache||new u4),ub(this,V,t.defaultOptions||{}),ub(this,Y,new Map),ub(this,z,new Map),ub(this,G,0)}})({defaultOptions:{queries:{queryFn:async function(t){let{queryKey:e}=t,[r]=e;return(0,cb.imageUrlToArrayBuffer)(r)},staleTime:1/0,gcTime:6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1}}});function u7(){return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(ug,{client:u8,children:(0,Q.jsx)("main",{children:(0,Q.jsx)(up,{children:(0,Q.jsx)(J.Suspense,{children:(0,Q.jsx)(cV,{children:(0,Q.jsx)(ut,{children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)("div",{className:"Viewport",children:[(0,Q.jsxs)("div",{className:"ModelTools",children:[(0,Q.jsx)("div",{className:"Field",children:(0,Q.jsx)(c4,{})}),(0,Q.jsx)("div",{className:"Field SliderField",children:(0,Q.jsx)(c3,{})}),(0,Q.jsx)("div",{className:"Field",children:(0,Q.jsx)(c7,{})})]}),(0,Q.jsx)(c5,{})]}),(0,Q.jsx)(cT,{children:(0,Q.jsx)(cC,{children:(0,Q.jsxs)(cO,{children:[(0,Q.jsx)(cL,{}),(0,Q.jsxs)("div",{className:"CanvasViewport",children:[(0,Q.jsxs)("div",{className:"CanvasSelector",children:[(0,Q.jsx)(ck,{}),(0,Q.jsx)(ui,{})]}),(0,Q.jsx)(cS,{}),(0,Q.jsx)(ud,{})]}),(0,Q.jsx)(cg,{}),(0,Q.jsx)(cp,{})]})})})]})})})})})})})})}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/2d2bdb29c69093a9.js b/docs/_next/static/chunks/5778c7d57772f351.js similarity index 87% rename from docs/_next/static/chunks/2d2bdb29c69093a9.js rename to docs/_next/static/chunks/5778c7d57772f351.js index b77d02a..d4f1f72 100644 --- a/docs/_next/static/chunks/2d2bdb29c69093a9.js +++ b/docs/_next/static/chunks/5778c7d57772f351.js @@ -1 +1 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,78631,(e,t,n)=>{!function(t,n){if("function"==typeof define&&define.amd){let t;void 0!==(t=n())&&e.v(t)}else n()}(e.e,function(){"use strict";function n(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){s(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function o(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function a(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:e.g.global===e.g?e.g:void 0,r=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=i.saveAs||("object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!r?function(e,t,r){var s=i.URL||i.webkitURL,c=document.createElement("a");c.download=t=t||e.name||"download",c.rel="noopener","string"==typeof e?(c.href=e,c.origin===location.origin?a(c):o(c.href)?n(e,t,r):a(c,c.target="_blank")):(c.href=s.createObjectURL(e),setTimeout(function(){s.revokeObjectURL(c.href)},4e4),setTimeout(function(){a(c)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"!=typeof e){var r;navigator.msSaveOrOpenBlob((void 0===(r=i)?r={autoBom:!1}:"object"!=typeof r&&(console.warn("Deprecated: Expected third argument to be a object"),r={autoBom:!r}),r.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),t)}else if(o(e))n(e,t,i);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout(function(){a(s)})}}:function(e,t,o,a){if((a=a||open("","_blank"))&&(a.document.title=a.document.body.innerText="downloading..."),"string"==typeof e)return n(e,t,o);var s="application/octet-stream"===e.type,c=/constructor/i.test(i.HTMLElement)||i.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||s&&c||r)&&"undefined"!=typeof FileReader){var u=new FileReader;u.onloadend=function(){var e=u.result;e=l?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),a?a.location.href=e:location=e,a=null},u.readAsDataURL(e)}else{var f=i.URL||i.webkitURL,d=f.createObjectURL(e);a?a.location=d:location.href=d,a=null,setTimeout(function(){f.revokeObjectURL(d)},4e4)}});i.saveAs=s.saveAs=s,t.exports=s})},69642,e=>{"use strict";e.s(["collectFiles",()=>r,"createZipFile",()=>o,"savePngFile",()=>i,"saveZipFile",()=>a]);var t=e.i(71315),n=e.i(78631);function o(e){let n=new t.default;for(let t of e)n.file("textures/skins/".concat(t.name),t.data);return n}async function a(e,t){let o=await e.generateAsync({type:"blob"});(0,n.saveAs)(o,t)}function i(e,t){(0,n.saveAs)(e,t)}async function r(e){return await Promise.all(e.map(async e=>{let t="".concat("https://exogen.github.io/t2-skins/skins","/").concat(e),n=await fetch(t);return{name:e,data:await n.arrayBuffer()}}))}}]); \ No newline at end of file +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,78631,(e,t,n)=>{!function(t,n){if("function"==typeof define&&define.amd){let t;void 0!==(t=n())&&e.v(t)}else n()}(e.e,function(){"use strict";function n(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){s(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function o(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function a(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:e.g.global===e.g?e.g:void 0,r=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=i.saveAs||("object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!r?function(e,t,r){var s=i.URL||i.webkitURL,c=document.createElement("a");c.download=t=t||e.name||"download",c.rel="noopener","string"==typeof e?(c.href=e,c.origin===location.origin?a(c):o(c.href)?n(e,t,r):a(c,c.target="_blank")):(c.href=s.createObjectURL(e),setTimeout(function(){s.revokeObjectURL(c.href)},4e4),setTimeout(function(){a(c)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"!=typeof e){var r;navigator.msSaveOrOpenBlob((void 0===(r=i)?r={autoBom:!1}:"object"!=typeof r&&(console.warn("Deprecated: Expected third argument to be a object"),r={autoBom:!r}),r.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),t)}else if(o(e))n(e,t,i);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout(function(){a(s)})}}:function(e,t,o,a){if((a=a||open("","_blank"))&&(a.document.title=a.document.body.innerText="downloading..."),"string"==typeof e)return n(e,t,o);var s="application/octet-stream"===e.type,c=/constructor/i.test(i.HTMLElement)||i.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||s&&c||r)&&"undefined"!=typeof FileReader){var u=new FileReader;u.onloadend=function(){var e=u.result;e=l?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),a?a.location.href=e:location=e,a=null},u.readAsDataURL(e)}else{var f=i.URL||i.webkitURL,d=f.createObjectURL(e);a?a.location=d:location.href=d,a=null,setTimeout(function(){f.revokeObjectURL(d)},4e4)}});i.saveAs=s.saveAs=s,t.exports=s})},69642,e=>{"use strict";e.s(["collectFiles",()=>r,"createZipFile",()=>o,"savePngFile",()=>i,"saveZipFile",()=>a]);var t=e.i(71315),n=e.i(78631);function o(e){let n=new t.default;for(let t of e)n.file("textures/skins/".concat(t.name),t.data);return n}async function a(e,t){let o=await e.generateAsync({type:"blob"});(0,n.saveAs)(o,t)}function i(e,t){(0,n.saveAs)(e,t)}async function r(e){let{skipNotFound:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(await Promise.all(e.map(async e=>{let n="".concat("https://exogen.github.io/t2-skins/skins","/").concat(e),o=await fetch(n);if(!o.ok){if(t)return null;throw Error("Response failed: ".concat(o.status," ").concat(o.statusText))}return{name:e,data:await o.arrayBuffer()}}))).filter(e=>null!=e)}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/642c9f483a155826.js b/docs/_next/static/chunks/642c9f483a155826.js deleted file mode 100644 index e2385f9..0000000 --- a/docs/_next/static/chunks/642c9f483a155826.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29402,(e,t,r)=>{var n,o,a="__lodash_hash_undefined__",l=1/0,i="[object Arguments]",u="[object Array]",c="[object Boolean]",s="[object Date]",f="[object Error]",d="[object Function]",p="[object Map]",h="[object Number]",_="[object Object]",v="[object Promise]",y="[object RegExp]",g="[object Set]",m="[object String]",b="[object Symbol]",j="[object WeakMap]",x="[object ArrayBuffer]",w="[object DataView]",O=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,P=/^\w*$/,k=/^\./,S=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,T=/\\(\\)?/g,C=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[i]=E[u]=E[x]=E[c]=E[w]=E[s]=E[f]=E[d]=E[p]=E[h]=E[_]=E[y]=E[g]=E[m]=E[j]=!1;var M=e.g&&e.g.Object===Object&&e.g,L="object"==typeof self&&self&&self.Object===Object&&self,N=M||L||Function("return this")(),R=r&&!r.nodeType&&r,G=R&&t&&!t.nodeType&&t,I=G&&G.exports===R&&M.process,F=function(){try{return I&&I.binding("util")}catch(e){}}(),z=F&&F.isTypedArray;function B(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r-1},eb.prototype.set=function(e,t){var r=this.__data__,n=eO(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},ej.prototype.clear=function(){this.__data__={hash:new em,map:new(el||eb),string:new em}},ej.prototype.delete=function(e){return eM(this,e).delete(e)},ej.prototype.get=function(e){return eM(this,e).get(e)},ej.prototype.has=function(e){return eM(this,e).has(e)},ej.prototype.set=function(e,t){return eM(this,e).set(e,t),this},ex.prototype.add=ex.prototype.push=function(e){return this.__data__.set(e,a),this},ex.prototype.has=function(e){return this.__data__.has(e)},ew.prototype.clear=function(){this.__data__=new eb},ew.prototype.delete=function(e){return this.__data__.delete(e)},ew.prototype.get=function(e){return this.__data__.get(e)},ew.prototype.has=function(e){return this.__data__.has(e)},ew.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eb){var n=r.__data__;if(!el||n.length<199)return n.push([e,t]),this;r=this.__data__=new ej(n)}return r.set(e,t),this};var eP=function(e,t){return function(r,n){if(null==r)return r;if(!e$(r))return e(r,n);for(var o=r.length,a=-1,l=Object(r);(t?a--:++ai))return!1;var c=a.get(e);if(c&&a.get(t))return c==t;var s=-1,f=!0,d=1&o?new ex:void 0;for(a.set(e,t),a.set(t,e);++s-1&&e%1==0&&e-1&&e%1==0&&e<=0x1fffffffffffff}function eW(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function eQ(e){return!!e&&"object"==typeof e}function eq(e){return"symbol"==typeof e||eQ(e)&&X.call(e)==b}var eJ=z?U(z):function(e){return eQ(e)&&eZ(e.length)&&!!E[X.call(e)]};function eX(e){return e$(e)?function(e,t){var r=eV(e)||eH(e)?function(e,t){for(var r=-1,n=Array(e);++rt||a&&l&&u&&!i&&!c||n&&l&&u||!r&&u||!o)return 1;if(!n&&!a&&!c&&e=i)return u;return u*("desc"==r[n]?-1:1)}}return e.index-t.index}(e,t,r)});u--;)i[u]=i[u].value;return i}(e,t,r))}},97052,e=>{e.v({Back:"gallery-module__zlwOTG__Back",DownloadButton:"gallery-module__zlwOTG__DownloadButton",DownloadSection:"gallery-module__zlwOTG__DownloadSection",DownloadSpinner:"gallery-module__zlwOTG__DownloadSpinner",Gallery:"gallery-module__zlwOTG__Gallery",GalleryPage:"gallery-module__zlwOTG__GalleryPage",HeaderEnd:"gallery-module__zlwOTG__HeaderEnd",IconLink:"gallery-module__zlwOTG__IconLink",Label:"gallery-module__zlwOTG__Label",Name:"gallery-module__zlwOTG__Name",PackVersion:"gallery-module__zlwOTG__PackVersion",Preview:"gallery-module__zlwOTG__Preview",Skin:"gallery-module__zlwOTG__Skin",Spinner:"gallery-module__zlwOTG__Spinner",Tools:"gallery-module__zlwOTG__Tools",spin:"gallery-module__zlwOTG__spin"})},36159,(e,t,r)=>{"use strict";function n(){return null}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return n}}),("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},98183,(e,t,r)=>{"use strict";function n(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function o(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function a(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,o(e));else t.set(r,o(n));return t}function l(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(r,{formatUrl:function(){return a},formatWithValidation:function(){return i},urlObjectKeys:function(){return l}});let n=e.r(90809)._(e.r(98183)),o=/https?|ftp|gopher|file/;function a(e){let{auth:t,hostname:r}=e,a=e.protocol||"",l=e.pathname||"",i=e.hash||"",u=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:r&&(c=t+(~r.indexOf(":")?"["+r+"]":r),e.port&&(c+=":"+e.port)),u&&"object"==typeof u&&(u=String(n.urlQueryToSearchParams(u)));let s=e.search||u&&"?"+u||"";return a&&!a.endsWith(":")&&(a+=":"),e.slashes||(!a||o.test(a))&&!1!==c?(c="//"+(c||""),l&&"/"!==l[0]&&(l="/"+l)):c||(c=""),i&&"#"!==i[0]&&(i="#"+i),s&&"?"!==s[0]&&(s="?"+s),""+a+c+(l=l.replace(/[?#]/g,encodeURIComponent))+(s=s.replace("#","%23"))+i}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function i(e){return a(e)}},18581,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return o}});let n=e.r(71645);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=a(e,n)),t&&(o.current=a(t,n))},[e,t])}function a(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},18967,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(r,{DecodeError:function(){return _},MiddlewareNotFoundError:function(){return m},MissingStaticPage:function(){return g},NormalizeError:function(){return v},PageNotFoundError:function(){return y},SP:function(){return p},ST:function(){return h},WEB_VITALS:function(){return n},execOnce:function(){return o},getDisplayName:function(){return c},getLocationOrigin:function(){return i},getURL:function(){return u},isAbsoluteUrl:function(){return l},isResSent:function(){return s},loadGetInitialProps:function(){return d},normalizeRepeatedSlashes:function(){return f},stringifyError:function(){return b}});let n=["CLS","FCP","FID","INP","LCP","TTFB"];function o(e){let t,r=!1;return function(){for(var n=arguments.length,o=Array(n),a=0;aa.test(e);function i(){let{protocol:e,hostname:t,port:r}=window.location;return e+"//"+t+(r?":"+r:"")}function u(){let{href:e}=window.location,t=i();return e.substring(t.length)}function c(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function s(e){return e.finished||e.headersSent}function f(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?"?"+t.slice(1).join("?"):"")}async function d(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await d(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&s(r))return n;if(!n)throw Object.defineProperty(Error('"'+c(e)+'.getInitialProps()" should resolve to an object. But found "'+n+'" instead.'),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n}let p="undefined"!=typeof performance,h=p&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class _ extends Error{}class v extends Error{}class y extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message="Cannot find module for page: "+e}}class g extends Error{constructor(e,t){super(),this.message="Failed to load static file for page: "+e+" "+t}}class m extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function b(e){return JSON.stringify({message:e.message,stack:e.stack})}},73668,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return a}});let n=e.r(18967),o=e.r(52817);function a(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},84508,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},22016,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(r,{default:function(){return v},useLinkStatus:function(){return g}});let n=e.r(90809),o=e.r(43476),a=n._(e.r(71645)),l=e.r(95057),i=e.r(8372),u=e.r(18581),c=e.r(18967),s=e.r(5550);e.r(33525);let f=e.r(91949),d=e.r(73668),p=e.r(99781);e.r(84508);let h=e.r(65165);function _(e){return"string"==typeof e?e:(0,l.formatUrl)(e)}function v(e){var t;let r,n,l,[v,g]=(0,a.useOptimistic)(f.IDLE_LINK_STATUS),m=(0,a.useRef)(null),{href:b,as:j,children:x,prefetch:w=null,passHref:O,replace:P,shallow:k,scroll:S,onClick:T,onMouseEnter:C,onTouchStart:A,legacyBehavior:E=!1,onNavigate:M,ref:L,unstable_dynamicOnHover:N,...R}=e;r=x,E&&("string"==typeof r||"number"==typeof r)&&(r=(0,o.jsx)("a",{children:r}));let G=a.default.useContext(i.AppRouterContext),I=!1!==w,F=!1!==w?null===(t=w)||"auto"===t?h.FetchStrategy.PPR:h.FetchStrategy.Full:h.FetchStrategy.PPR,{href:z,as:B}=a.default.useMemo(()=>{let e=_(b);return{href:e,as:j?_(j):e}},[b,j]);E&&(n=a.default.Children.only(r));let U=E?n&&"object"==typeof n&&n.ref:L,D=a.default.useCallback(e=>(null!==G&&(m.current=(0,f.mountLinkInstance)(e,z,G,F,I,g)),()=>{m.current&&((0,f.unmountLinkForCurrentNavigation)(m.current),m.current=null),(0,f.unmountPrefetchableInstance)(e)}),[I,z,G,F,g]),H={ref:(0,u.useMergedRef)(D,U),onClick(e){E||"function"!=typeof T||T(e),E&&n.props&&"function"==typeof n.props.onClick&&n.props.onClick(e),G&&(e.defaultPrevented||function(e,t,r,n,o,l,i){let{nodeName:u}=e.currentTarget;if(!("A"===u.toUpperCase()&&function(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||e.currentTarget.hasAttribute("download"))){if(!(0,d.isLocalURL)(t)){o&&(e.preventDefault(),location.replace(t));return}if(e.preventDefault(),i){let e=!1;if(i({preventDefault:()=>{e=!0}}),e)return}a.default.startTransition(()=>{(0,p.dispatchNavigateAction)(r||t,o?"replace":"push",null==l||l,n.current)})}}(e,z,B,m,P,S,M))},onMouseEnter(e){E||"function"!=typeof C||C(e),E&&n.props&&"function"==typeof n.props.onMouseEnter&&n.props.onMouseEnter(e),G&&I&&(0,f.onNavigationIntent)(e.currentTarget,!0===N)},onTouchStart:function(e){E||"function"!=typeof A||A(e),E&&n.props&&"function"==typeof n.props.onTouchStart&&n.props.onTouchStart(e),G&&I&&(0,f.onNavigationIntent)(e.currentTarget,!0===N)}};return(0,c.isAbsoluteUrl)(B)?H.href=B:E&&!O&&("a"!==n.type||"href"in n.props)||(H.href=(0,s.addBasePath)(B)),l=E?a.default.cloneElement(n,H):(0,o.jsx)("a",{...R,...H,children:r}),(0,o.jsx)(y.Provider,{value:v,children:l})}let y=(0,a.createContext)(f.IDLE_LINK_STATUS),g=()=>(0,a.useContext)(y);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},25500,e=>{"use strict";e.s(["default",()=>v],25500);var t=e.i(43476),r=e.i(71645),n=e.i(40141);function o(e){return(0,n.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{opacity:"0.2",fillRule:"evenodd",clipRule:"evenodd",d:"M12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",fill:"currentColor"},child:[]},{tag:"path",attr:{d:"M12 22C17.5228 22 22 17.5228 22 12H19C19 15.866 15.866 19 12 19V22Z",fill:"currentColor"},child:[]},{tag:"path",attr:{d:"M2 12C2 6.47715 6.47715 2 12 2V5C8.13401 5 5 8.13401 5 12H2Z",fill:"currentColor"},child:[]}]})(e)}var a=e.i(11152),l=e.i(18566),i=e.i(29402),u=e.i(15768),c=e.i(97052),s=e.i(36159),f=e.i(22016),d=e.i(69642);let p=[],h={lmale:0,mmale:1,lfemale:2,mfemale:3,hmale:4,lbioderm:5,mbioderm:6,hbioderm:7,energy:8,disc:9,chaingun:10,grenade_launcher:11,sniper:12,elf:13,shocklance:14,plasmathrower:15,missile:16,mortar:17,repair:18,targeting:19,vehicle_grav_scout:20,vehicle_grav_tank:21,turret_assaulttank_mortar:22,vehicle_land_mpbbase:23,vehicle_air_scout:24,vehicle_air_bomber:25,vehicle_air_hapc:26};function _(){var e,n,_;let v=(0,l.useRouter)(),y=(0,l.usePathname)(),g=(0,l.useSearchParams)(),[m,b]=(0,u.default)(),[j,x]=(0,r.useState)("lmale"),[w,O]=(0,r.useState)(!1),P="hfemale"===j?"hmale":j,k=null!=(_=null==(e=m.customSkins)?void 0:e[P])?_:p,S="new"===j,T=null==m||null==(n=m.packs)?void 0:n[j],C=null!=T;(0,r.useEffect)(()=>{if(T&&w){let e=!1;return(async()=>{let t=await (0,d.collectFiles)(T.files);if(!e){let r=(0,d.createZipFile)(t);await new Promise(e=>setTimeout(e,500)),e||await (0,d.saveZipFile)(r,"zSkinPack-".concat(j.replace(/ /g,"_"),"-v").concat(T.version,".vl2")),e||O(!1)}})(),()=>{e=!0,O(!1)}}},[w,T,j]);let A=(0,r.useMemo)(()=>{var e;return(0,i.default)(Object.keys(null!=(e=null==m?void 0:m.packs)?e:{}),e=>e.toLowerCase(),["asc"])},[m]),E=(0,r.useMemo)(()=>{var e,t;let r=S?null==m?void 0:m.newSkins:C?null==m||null==(t=m.packs)||null==(e=t[j])?void 0:e.skins:null;if(!r)return[];let n=[];return Object.entries(r).forEach(e=>{let[t,r]=e;n.push(...r.map(e=>({name:e,model:t})))}),(0,i.default)(n,[e=>e.name.toLowerCase(),e=>h[e.model]],["asc","asc"])},[S,C,j,m]),M=S||C?E:k,L=g.get("filter")||"lmale";return(0,r.useEffect)(()=>{O(!1),x(L)},[L]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.default,{children:(0,t.jsx)("title",{children:"Tribes 2 Skin Gallery"})}),(0,t.jsxs)("main",{className:c.default.GalleryPage,children:[(0,t.jsxs)("div",{className:c.default.Tools,children:[(0,t.jsxs)(f.default,{className:c.default.Back,href:"../",children:[(0,t.jsx)(a.FaChevronLeft,{size:12,className:c.default.Icon})," ",(0,t.jsx)("span",{className:c.default.Label,children:"Back to Editor"})]}),(0,t.jsxs)("select",{tabIndex:0,id:"ModelSelect","aria-label":"Player model",onChange:e=>{v.push("".concat(y,"?filter=").concat(e.target.value))},value:j,children:[(0,t.jsx)("option",{value:"new",children:"All new skins ✨"}),(0,t.jsx)("optgroup",{label:"Packs",children:A.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsxs)("optgroup",{label:"Players","data-model-type":"player",children:[(0,t.jsx)("option",{value:"lmale",children:"Human Male • Light"}),(0,t.jsx)("option",{value:"mmale",children:"Human Male • Medium"}),(0,t.jsx)("option",{value:"hmale",children:"Human Male • Heavy"}),(0,t.jsx)("option",{value:"lfemale",children:"Human Female • Light"}),(0,t.jsx)("option",{value:"mfemale",children:"Human Female • Medium"}),(0,t.jsx)("option",{value:"hfemale",children:"Human Female • Heavy"}),(0,t.jsx)("option",{value:"lbioderm",children:"Bioderm • Light"}),(0,t.jsx)("option",{value:"mbioderm",children:"Bioderm • Medium"}),(0,t.jsx)("option",{value:"hbioderm",children:"Bioderm • Heavy"})]}),(0,t.jsxs)("optgroup",{label:"Weapons","data-model-type":"weapon",children:[(0,t.jsx)("option",{value:"disc",children:"Disc Launcher"}),(0,t.jsx)("option",{value:"chaingun",children:"Chaingun"}),(0,t.jsx)("option",{value:"grenade_launcher",children:"Grenade Launcher"}),(0,t.jsx)("option",{value:"sniper",children:"Laser Rifle"}),(0,t.jsx)("option",{value:"plasmathrower",children:"Plasma Cannon"}),(0,t.jsx)("option",{value:"energy",children:"Blaster"}),(0,t.jsx)("option",{value:"shocklance",children:"Shocklance"}),(0,t.jsx)("option",{value:"elf",children:"ELF Projector"}),(0,t.jsx)("option",{value:"missile",children:"Missile Launcher"}),(0,t.jsx)("option",{value:"mortar",children:"Mortar"}),(0,t.jsx)("option",{value:"repair",children:"Repair Pack"}),(0,t.jsx)("option",{value:"targeting",children:"Targeting Laser"})]}),(0,t.jsxs)("optgroup",{label:"Vehicles","data-model-type":"vehicle",children:[(0,t.jsx)("option",{value:"vehicle_grav_scout",children:"Wildcat Grav Cycle"}),(0,t.jsx)("option",{value:"vehicle_grav_tank",children:"Beowulf Assault Tank"}),(0,t.jsx)("option",{value:"vehicle_land_mpbbase",children:"Jericho Mobile Point Base"}),(0,t.jsx)("option",{value:"vehicle_air_scout",children:"Shrike Scout Fighter"}),(0,t.jsx)("option",{value:"vehicle_air_bomber",children:"Thundersword Bomber"}),(0,t.jsx)("option",{value:"vehicle_air_hapc",children:"HAVOC Gunship Transport"})]})]}),(0,t.jsxs)("div",{className:c.default.HeaderEnd,children:[C?(0,t.jsxs)("div",{className:c.default.DownloadSection,children:[(0,t.jsx)("button",{type:"button",className:c.default.DownloadButton,onClick:async()=>{O(!0)},children:"Download"})," ",w?(0,t.jsx)(o,{className:c.default.DownloadSpinner}):(0,t.jsxs)("span",{className:c.default.PackVersion,children:["v",T.version," • ",T.files.length.toLocaleString()," ",1===T.files.length?"file":"files"]})]}):null,(0,t.jsx)("a",{href:"https://github.com/exogen/t2-model-skinner",className:c.default.IconLink,children:(0,t.jsx)(a.FaGithub,{size:32})})]})]}),b?(0,t.jsx)("div",{className:c.default.Gallery,children:M.map(e=>{let r,n;"string"==typeof e?(r=e,n=P):(r=e.name,n=e.model);let o="".concat("https://exogen.github.io/t2-skins","/gallery/").concat(encodeURIComponent(r),".").concat(n,".webp");return(0,t.jsxs)(f.default,{className:c.default.Skin,href:"/?m=".concat(n,"&s=").concat(encodeURIComponent(r)),children:[(0,t.jsx)("img",{className:c.default.Preview,loading:"lazy",src:o,width:680,height:800,alt:r}),(0,t.jsx)("div",{className:c.default.Name,children:r})]},"".concat(r,":").concat(n))})}):(0,t.jsx)(o,{className:c.default.Spinner})]})]})}function v(){return(0,t.jsx)(r.Suspense,{children:(0,t.jsx)(_,{})})}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/71f10e2893d67a3c.js b/docs/_next/static/chunks/71f10e2893d67a3c.js new file mode 100644 index 0000000..01f0987 --- /dev/null +++ b/docs/_next/static/chunks/71f10e2893d67a3c.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33525,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},29947,e=>{e.v(JSON.parse('{"defaultSkins":{"lmale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"mmale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"hmale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"lfemale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"mfemale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"hfemale":[],"lbioderm":["Horde","Inferno","Storm"],"mbioderm":["Horde","Inferno","Storm"],"hbioderm":["Horde","Inferno","Storm"]},"modelDefaults":{"lmale":"Blood Eagle","mmale":"Blood Eagle","hmale":"Blood Eagle","lfemale":"Blood Eagle","mfemale":"Blood Eagle","hfemale":"Blood Eagle","lbioderm":"Storm","mbioderm":"Storm","hbioderm":"Storm","chaingun":"weapon_chaingun","disc":"weapon_disc","elf":"weapon_elf","energy":"weapon_energy","grenade_launcher":"weapon_grenade_launcher","mine":"mine","missile":"weapon_missile","mortar":"weapon_mortar","plasmathrower":"weapon_plasmathrower","repair":"weapon_repair","shocklance":"weapon_shocklance","sniper":"weapon_sniper","targeting":"weapon_targeting","vehicle_land_mpbbase":"vehicle_land_mpbbase","vehicle_grav_scout":"vehicle_grav_scout","vehicle_grav_tank":"vehicle_grav_tank","turret_assaulttank_mortar":"turret_assaulttank_mortar","vehicle_air_scout":"vehicle_air_scout","vehicle_air_bomber":"vehicle_air_bomber","vehicle_air_hapc":"vehicle_air_hapc"},"animationLabels":{"Forward":"Run Forward","Back":"Run Backward","Back0":"Run Backward","Root":"Idle","Root2":"Run Backward","Root3":"Idle","Idlepda":"Idle (PDA)","PDA":"Idle (PDA)","Root1":"Idle (PDA)","Jump":"Jump","Jump0":"Jump (Alternate)","Jump1":"Jump (Alternate)","Jump2":"Jump (Alternate)","Jump3":"Jump (Alternate)","Jet":"Jet","Fall":"Fall","Land":"Land","Land1":"Land (Alternate)","ski":"Ski","Side":"Strafe Left","Celwave":"Wave","Celbow":"Bow","Celdisco":"Dance","Celdance":"Dance","Celflex":"Flex","Celflex1":"Flex","Celrocky":"Awesome","Celjump":"Awesome","Celsalute":"Salute","celTaunt":"Too Bad","CelebrationGora":"Wave Arms","Celgora":"Wave Arms","CelebrationJump":"Bull Charge","Tauntbull":"Bull Charge","CelebrationJump0":"Celebrate","CelebrationJump4":"The Greatest","CelebrationRoar":"Roar","Celroar":"Roar","Celraor":"Roar","Celflex2":"Flex","celyeah":"Yeah","celtaunt":"Too Bad","Tauntbutt":"Butt","Tauntkiss":"Blow Kiss","Tauntbest":"The Greatest","Taunimp":"Move!","Tauntimp":"Move!","Sitting":"Sit","Scoutroot":"Gravcycle","Recoilde":"Recoil","Light_recoil":"Recoil","Dieforward":"Death (Fall Forward)","DeathForward":"Death (Fall Forward)","Dieslump":"Death (Slump)","DeathSlump":"Death (Slump)","Diespin":"Death (Spin)","DeathSpin":"Death (Spin)","diechest":"Death (Hold Chest)","Diechest":"Death (Hold Chest)","DeathChest":"Death (Hold Chest)","Dieback":"Death (Hold Back)","DeathBack":"Death (Hold Back)","Diehead":"Death (Hold Head)","DeathHead":"Death (Hold Head)","Dieknees":"Death (On Knees)","DeathKnees":"Death (On Knees)","Dieleglf":"Death (Left Leg Injury)","Dieleglft":"Death (Left Leg Injury)","DeathLegLeft":"Death (Left Leg Injury)","Dielegrt":"Death (Right Leg Injury)","Dielegtrt":"Death (Right Leg Injury)","DeathLegRight":"Death (Right Leg Injury)","Dielegrt0":"Death (Right Leg Injury)","Diesidelf":"Death (Left Side)","DeathSideLeft":"Death (Left Side)","Diesidert":"Death (Right Side)","DeathSideRight":"Death (Right Side)","Diesidert0":"Death (Right Side Alternate)"},"cameraOverrides":{"chaingun":{"target":"0m 0m 0m","fov":"12deg"},"plasmathrower":{"target":"0.002m -0.001m 0m","fov":"12deg"},"energy":{"fov":"31deg","orbit":"135deg 70deg 105%"},"hmale":{"fov":"24deg"},"hfemale":{"fov":"24deg"},"hbioderm":{"fov":"24deg"},"vehicle_grav_scout":{"orbit":"290deg 60deg 130%"},"vehicle_grav_tank":{"orbit":"290deg 60deg 130%"},"turret_assaulttank_mortar":{"orbit":"290deg 60deg 130%"},"vehicle_land_mpbbase":{"orbit":"290deg 60deg 130%"},"vehicle_air_scout":{"orbit":"290deg 60deg 130%"},"vehicle_air_bomber":{"orbit":"290deg 60deg 130%"},"vehicle_air_hapc":{"orbit":"290deg 60deg 130%"}},"animationLabelOverrides":{"mmale":{"Back":"Strafe Left"},"mfemale":{"Dielegrt":"Death (Slump)"},"lbioderm":{"Root":"Gravcycle"}},"materials":{"lmale":[{"name":"base","label":"Warrior","fileSuffix":".lmale"}],"mmale":[{"name":"base","label":"Warrior","fileSuffix":".mmale"}],"hmale":[{"name":"base","label":"Warrior","fileSuffix":".hmale"}],"lfemale":[{"name":"base","label":"Warrior","fileSuffix":".lfemale"}],"mfemale":[{"name":"base","label":"Warrior","fileSuffix":".mfemale"}],"lbioderm":[{"name":"base","label":"Warrior","fileSuffix":".lbioderm"}],"mbioderm":[{"name":"base","label":"Warrior","fileSuffix":".mbioderm"}],"hbioderm":[{"name":"base","label":"Warrior","fileSuffix":".hbioderm"}],"disc":[{"name":"weapon_disc","label":"Weapon"},{"name":"dcase00","label":"Disc Case","size":[256,256],"baseColorFactor":[1,1,1,0.7],"emissiveFactor":[1,1,1],"emissiveTexture":true,"alphaMode":"BLEND","metallicFactor":0,"roughnessFactor":1,"frameCount":6,"frameTimings":[21,1,1,1,1,1],"optional":true}],"chaingun":[{"label":"Chaingun","name":"weapon_chaingun"}],"grenade_launcher":[{"label":"Grenade Launcher","name":"weapon_grenade_launcher"}],"sniper":[{"label":"Weapon","name":"weapon_sniper"},{"label":"Green Light","name":"greenlight","hasDefault":false,"optional":true},{"label":"Red Light","name":"lite_red","hasDefault":false,"optional":true}],"plasmathrower":[{"label":"Rear & Barrel","name":"weapon_plasma10","file":"weapon_plasma1"},{"label":"Top & Front","name":"weapon_plasma21","file":"weapon_plasma2"},{"name":"weapon_plasma1","file":"weapon_plasma1","selectable":false},{"name":"weapon_plasma2","file":"weapon_plasma2","selectable":false}],"energy":[{"label":"Weapon","name":"blinn1","file":"weapon_energy"}],"shocklance":[{"label":"Weapon","name":"weapon_shocklance","size":[512,256]},{"label":"Glow","name":"weapon_shocklance_glow_","file":"weapon_shocklance_glow ","emissiveFactor":[1,1,1],"alphaMode":"MASK","alphaCutoff":255,"emissiveTexture":true,"metallicFactor":0,"roughnessFactor":1,"size":[256,128],"optional":true}],"elf":[{"label":"Weapon","name":"weapon_elf","file":"weapon_elf"},{"label":"Glow","name":"weapon_elf0","file":"weapon_elf"}],"missile":[{"label":"Weapon","name":"weapon_missile"}],"mortar":[{"label":"Weapon","name":"weapon_mortar"}],"repair":[{"label":"Weapon","name":"weapon_repair"}],"targeting":[{"label":"Weapon","name":"weapon_targeting"}],"mine":[{"label":"Weapon","name":"mine","size":[512,512],"metallicFactor":0,"roughnessFactor":1}],"vehicle_air_scout":[{"label":"Vehicle","name":"vehicle_air_scout0","file":"vehicle_air_scout"},{"name":"Unassigned","hidden":true,"hasDefault":false},{"name":"vehicle_air_scout","hidden":true,"hasDefault":false},{"label":"Flare","name":"shrikeflare2","emissiveFactor":[0,0,0],"alphaMode":"BLEND","emissiveTexture":true,"metallicFactor":0,"roughnessFactor":1,"size":[256,256],"optional":true}],"vehicle_air_bomber":[{"label":"Cockpit & Thrusters","name":"vehicle_air_bomber10","file":"vehicle_air_bomber1","size":[256,512]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Rear","name":"vehicle_air_bomber2","size":[256,512]},{"label":"Wings","name":"vehicle_air_bomber31","file":"vehicle_air_bomber3"},{"name":"vehicle_air_bomber1","size":[256,512],"selectable":false},{"name":"vehicle_air_bomber3","selectable":false}],"vehicle_air_hapc":[{"label":"Cockpit","name":"vehicle_air_bomber1","size":[256,512]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Wings","name":"vehicle_air_hpc2"},{"label":"Seats","name":"vehicle_air_hpc1"},{"label":"Thrusters","name":"vehicle_air_hpc30","file":"vehicle_air_hpc3"},{"name":"vehicle_air_hpc3","selectable":false}],"vehicle_grav_scout":[{"label":"Vehicle","name":"Vehicle_grav_scout0","file":"Vehicle_grav_scout","size":[512,256]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Pipes","name":"Vehicle_grav_scout_pipes1","file":"Vehicle_grav_scout_pipes","metallicFactor":0,"roughnessFactor":1},{"name":"Vehicle_grav_scout","hidden":true,"hasDefault":false},{"label":"Side Thrusters","name":"Vehicle_grav_scout_pipes","file":"Vehicle_grav_scout_pipes","emissiveFactor":[1,1,1],"alphaMode":"OPAQUE","metallicFactor":0,"roughnessFactor":1,"emissiveTexture":true,"selectable":false},{"label":"Windshield","name":"Vehicle_grav_scout_windshield","file":"Vehicle_grav_scout_windshield","selectable":false,"alphaMode":"BLEND","baseColorFactor":[1,1,1,0.5],"metallicFactor":0,"roughnessFactor":1,"size":[128,128],"optional":true},{"label":"Windshield Inner","name":"Vehicle_grav_scout_windshieldInner","file":"Vehicle_grav_scout_windshieldInner","selectable":false,"alphaMode":"BLEND","baseColorFactor":[1,1,1,0.5],"metallicFactor":0,"roughnessFactor":1,"size":[128,128],"optional":true}],"vehicle_grav_tank":[{"label":"Center","name":"Vehicle_grav_tank_bodyMain","size":[256,512]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Sides","name":"vehicle_grav_tank_bodyside10","file":"vehicle_grav_tank_bodyside1","size":[256,512]},{"label":"Thrusters","name":"vehicle_grav_tank_bodyside21","file":"vehicle_grav_tank_bodyside2"},{"name":"vehicle_grav_tank_bodyside2","selectable":false},{"name":"vehicle_grav_tank_bodyside1","selectable":false}],"turret_assaulttank_mortar":[{"label":"Turret","name":"turret_assaulttank_mortar","file":"turret_assaultTank"}],"vehicle_land_mpbbase":[{"label":"Vehicle Front","name":"vehicle_land_mpb1"},{"label":"Vehicle Back","name":"vehicle_land_mpb2"},{"label":"Wheels","name":"Vehicle_Land_Assault_wheel","file":"Vehicle_Land_Assault_Wheel","size":[512,256],"optional":true}]},"animations":{"global":["Forward","Back","Jump","Jet","Fall","Land","ski","Root"],"lmale":["Idlepda","Side","Jump0","Land1","Recoilde","Celwave","Celdisco","Celflex","Celrocky","Celsalute","celTaunt","Taunimp","Tauntbest","Dieback","diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Diesidelf","Diesidert","Dieslump","Diespin","Scoutroot","Sitting"],"mmale":["Back0","Jump3","Recoilde","Celwave","Celdance","Celflex","Celrocky","Celsalute","celtaunt","Tauntbest","Tauntimp","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Diesidelf","Diesidert","Diespin","Sitting"],"hmale":["Idlepda","Jump1","Side","Recoilde","Celwave","Celdance","Celflex","Celjump","Celsalute","celtaunt","Tauntbest","Tauntimp","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dielegrt","Diesidelf","Diesidert","Diesidert0","Dieslump","Diespin"],"lfemale":["Idlepda","Jump1","Side","Recoilde","Celwave","Celbow","Celdance","Celsalute","Tauntbest","Tauntbutt","Tauntimp","Tauntkiss","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Diesidelf","Diesidert","Dieslump","Diespin","Scoutroot","Sitting"],"mfemale":["Idlepda","Jump1","Side","Recoilde","Celwave","Celbow","Celdisco","Celsalute","Tauntbest","Tauntbutt","Tauntimp","Tauntkiss","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Dielegrt0","Diesidelf","Diesidert","Diespin","Sitting"],"lbioderm":["Root3","PDA","Jump2","Side","Light_recoil","CelebrationGora","CelebrationJump","CelebrationJump0","CelebrationJump4","CelebrationRoar","Salute","Celflex2","celyeah","DeathBack","DeathChest","DeathForward","DeathHead","DeathKnees","DeathLegLeft","DeathLegRight","DeathSideLeft","DeathSideRight","DeathSlump","DeathSpin","Sitting"],"mbioderm":["Root1","Jump2","Side","Recoilde","Salute","Celflex1","Celgora","Celjump","Celroar","celyeah","Tauntbest","Tauntbull","DeathBack","DeathChest","DeathHead","DeathSideLeft","DeathSpin","Dieforward","Dieknees","Dieleglft","Dielegtrt","Diesidert","Dieslump","Sitting"],"hbioderm":["Root1","Jump2","Side","Recoilde","Salute","Celflex2","Celgora","Celjump","Celraor","celyeah","Tauntbest","Tauntbull","DeathBack","DeathChest","DeathForward","DeathHead","DeathKnees","DeathLegLeft","DeathLegRight","DeathSideLeft","DeathSideRight","DeathSlump","DeathSpin"]}}'))},67034,(e,t,r)=>{!function(){var e={675:function(e,t){"use strict";t.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,a=s(e),o=a[0],l=a[1],f=new i((o+l)*3/4-l),u=0,h=l>0?o-4:o;for(r=0;r>16&255,f[u++]=t>>8&255,f[u++]=255&t;return 2===l&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,f[u++]=255&t),1===l&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,f[u++]=t>>8&255,f[u++]=255&t),f},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=0,l=n-i;o>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}(e,o,o+16383>l?l:o+16383));return 1===i?a.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&a.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),a.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=a.length;o0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return u(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!l.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|p(n,i),s=o(a),f=s.write(n,i);return f!==a&&(s=s.slice(0,f)),s}if(ArrayBuffer.isView(e))return h(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(k(e,ArrayBuffer)||e&&k(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(k(e,SharedArrayBuffer)||e&&k(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||k(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return A(e).length;default:if(i)return n?-1:E(e).length;t=(""+t).toLowerCase(),i=!0}}function d(e,t,r){var i,a,o,l=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r*=1)!=a&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return b(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){var a,o=1,l=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,l/=2,s/=2,r/=2}function f(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var u=-1;for(a=r;al&&(r=l-s),a=r;a>=0;a--){for(var h=!0,c=0;cr&&(e+=" ... "),""},a&&(l.prototype[a]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,i){if(k(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,o=r-t,s=Math.min(a,o),f=this.slice(n,i),u=e.slice(t,r),h=0;h239?4:f>223?3:f>191?2:1;if(i+h<=r)switch(h){case 1:f<128&&(u=f);break;case 2:(192&(a=e[i+1]))==128&&(s=(31&f)<<6|63&a)>127&&(u=s);break;case 3:a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(s=(15&f)<<12|(63&a)<<6|63&o)>2047&&(s<55296||s>57343)&&(u=s);break;case 4:a=e[i+1],o=e[i+2],l=e[i+3],(192&a)==128&&(192&o)==128&&(192&l)==128&&(s=(15&f)<<18|(63&a)<<12|(63&o)<<6|63&l)>65535&&s<1114112&&(u=s)}null===u?(u=65533,h=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=h}var c=n,p=c.length;if(p<=4096)return String.fromCharCode.apply(String,c);for(var d="",g=0;gr)throw RangeError("Trying to access beyond buffer length")}function w(e,t,r,n,i,a){if(!l.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function _(e,t,r,n,i,a){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function D(e,t,r,n,a){return t*=1,r>>>=0,a||_(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function S(e,t,r,n,a){return t*=1,r>>>=0,a||_(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,o,l,s,f,u,h,c=this.length-t;if((void 0===r||r>c)&&(r=c),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var p=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;n>a/2&&(n=a/2);for(var o=0;o>8,i.push(r%256),i.push(n);return i}(e,this.length-u),this,u,h);default:if(p)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,a=0;++a>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},l.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var a=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var a=r-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var a=0,o=1,l=0;for(this[t]=255&e;++a>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var a=r-1,o=1,l=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===l&&0!==this[t+a+1]&&(l=1),this[t+a]=(e/o|0)-l&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function C(e){for(var t=[],r=0;r=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function k(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var L=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var a,o,l=8*i-n-1,s=(1<>1,u=-7,h=r?i-1:0,c=r?-1:1,p=e[t+h];for(h+=c,a=p&(1<<-u)-1,p>>=-u,u+=l;u>0;a=256*a+e[t+h],h+=c,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+e[t+h],h+=c,u-=8);if(0===a)a=1-f;else{if(a===s)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=f}return(p?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,l,s,f=8*a-i-1,u=(1<>1,c=5960464477539062e-23*(23===i),p=n?0:a-1,d=n?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(l=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),o+h>=1?t+=c/s:t+=c*Math.pow(2,1-h),t*s>=2&&(o++,s/=2),o+h>=u?(l=0,o=u):o+h>=1?(l=(t*s-1)*Math.pow(2,i),o+=h):(l=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+p]=255&l,p+=d,l/=256,i-=8);for(o=o<0;e[r+p]=255&o,p+=d,o/=256,f-=8);e[r+p-d]|=128*g}}},r={};function n(t){var i=r[t];if(void 0!==i)return i.exports;var a=r[t]={exports:{}},o=!0;try{e[t](a,a.exports,n),o=!1}finally{o&&delete r[t]}return a.exports}n.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=n(72)}()},78631,(e,t,r)=>{!function(t,r){if("function"==typeof define&&define.amd){let t;void 0!==(t=r())&&e.v(t)}else r()}(e.e,function(){"use strict";function r(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){l(n.response,t,r)},n.onerror=function(){console.error("could not download file")},n.send()}function n(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function i(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(r){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:e.g.global===e.g?e.g:void 0,o=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=a.saveAs||("object"!=typeof window||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(e,t,o){var l=a.URL||a.webkitURL,s=document.createElement("a");s.download=t=t||e.name||"download",s.rel="noopener","string"==typeof e?(s.href=e,s.origin===location.origin?i(s):n(s.href)?r(e,t,o):i(s,s.target="_blank")):(s.href=l.createObjectURL(e),setTimeout(function(){l.revokeObjectURL(s.href)},4e4),setTimeout(function(){i(s)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,a){if(t=t||e.name||"download","string"!=typeof e){var o;navigator.msSaveOrOpenBlob((void 0===(o=a)?o={autoBom:!1}:"object"!=typeof o&&(console.warn("Deprecated: Expected third argument to be a object"),o={autoBom:!o}),o.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),t)}else if(n(e))r(e,t,a);else{var l=document.createElement("a");l.href=e,l.target="_blank",setTimeout(function(){i(l)})}}:function(e,t,n,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return r(e,t,n);var l="application/octet-stream"===e.type,s=/constructor/i.test(a.HTMLElement)||a.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent);if((f||l&&s||o)&&"undefined"!=typeof FileReader){var u=new FileReader;u.onloadend=function(){var e=u.result;e=f?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},u.readAsDataURL(e)}else{var h=a.URL||a.webkitURL,c=h.createObjectURL(e);i?i.location=c:location.href=c,i=null,setTimeout(function(){h.revokeObjectURL(c)},4e4)}});a.saveAs=l.saveAs=l,t.exports=l})},69642,e=>{"use strict";e.s(["collectFiles",()=>o,"createZipFile",()=>n,"savePngFile",()=>a,"saveZipFile",()=>i]);var t=e.i(71315),r=e.i(78631);function n(e){let r=new t.default;for(let t of e)r.file("textures/skins/".concat(t.name),t.data);return r}async function i(e,t){let n=await e.generateAsync({type:"blob"});(0,r.saveAs)(n,t)}function a(e,t){(0,r.saveAs)(e,t)}async function o(e){let{skipNotFound:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(await Promise.all(e.map(async e=>{let r="".concat("https://exogen.github.io/t2-skins/skins","/").concat(e),n=await fetch(r);if(!n.ok){if(t)return null;throw Error("Response failed: ".concat(n.status," ").concat(n.statusText))}return{name:e,data:await n.arrayBuffer()}}))).filter(e=>null!=e)}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/7d0d362e234cf43a.js b/docs/_next/static/chunks/7d0d362e234cf43a.js deleted file mode 100644 index 17f3c2d..0000000 --- a/docs/_next/static/chunks/7d0d362e234cf43a.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,67034,(e,t,r)=>{!function(){var e={675:function(e,t){"use strict";t.byteLength=function(e){var t=f(e),r=t[0],i=t[1];return(r+i)*3/4-i},t.toByteArray=function(e){var t,r,n=f(e),o=n[0],l=n[1],s=new a((o+l)*3/4-l),h=0,u=l>0?o-4:o;for(r=0;r>16&255,s[h++]=t>>8&255,s[h++]=255&t;return 2===l&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,s[h++]=255&t),1===l&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,s[h++]=t>>8&255,s[h++]=255&t),s},t.fromByteArray=function(e){for(var t,i=e.length,a=i%3,n=[],o=0,l=i-a;o>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return n.join("")}(e,o,o+16383>l?l:o+16383));return 1===a?n.push(r[(t=e[i-1])>>2]+r[t<<4&63]+"=="):2===a&&n.push(r[(t=(e[i-2]<<8)+e[i-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),n.join("")};for(var r=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=n.length;o0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var i=r===t?0:4-r%4;return[r,i]}i[45]=62,i[95]=63},72:function(e,t,r){"use strict";var i=r(675),a=r(783),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return h(e)}return f(e,t,r)}function f(e,t,r){if("string"==typeof e){var i=e,a=t;if(("string"!=typeof a||""===a)&&(a="utf8"),!l.isEncoding(a))throw TypeError("Unknown encoding: "+a);var n=0|p(i,a),f=o(n),s=f.write(i,a);return s!==n&&(f=f.slice(0,s)),f}if(ArrayBuffer.isView(e))return u(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(T(e,ArrayBuffer)||e&&T(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(T(e,SharedArrayBuffer)||e&&T(e.buffer,SharedArrayBuffer)))return function(e,t,r){var i;if(t<0||e.byteLength=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||T(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var a=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return A(e).length;default:if(a)return i?-1:B(e).length;t=(""+t).toLowerCase(),a=!0}}function d(e,t,r){var a,n,o,l=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var a="",n=t;n0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(n=r*=1)!=n&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(a)return -1;else r=e.length-1;else if(r<0)if(!a)return -1;else r=0;if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:b(e,t,r,i,a);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(a)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return b(e,[t],r,i,a)}throw TypeError("val must be string, number or Buffer")}function b(e,t,r,i,a){var n,o=1,l=e.length,f=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return -1;o=2,l/=2,f/=2,r/=2}function s(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(a){var h=-1;for(n=r;nl&&(r=l-f),n=r;n>=0;n--){for(var u=!0,c=0;cr&&(e+=" ... "),""},n&&(l.prototype[n]=l.prototype.inspect),l.prototype.compare=function(e,t,r,i,a){if(T(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===a&&(a=this.length),t<0||r>e.length||i<0||a>this.length)throw RangeError("out of range index");if(i>=a&&t>=r)return 0;if(i>=a)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,a>>>=0,this===e)return 0;for(var n=a-i,o=r-t,f=Math.min(n,o),s=this.slice(i,a),h=e.slice(t,r),u=0;u239?4:s>223?3:s>191?2:1;if(a+u<=r)switch(u){case 1:s<128&&(h=s);break;case 2:(192&(n=e[a+1]))==128&&(f=(31&s)<<6|63&n)>127&&(h=f);break;case 3:n=e[a+1],o=e[a+2],(192&n)==128&&(192&o)==128&&(f=(15&s)<<12|(63&n)<<6|63&o)>2047&&(f<55296||f>57343)&&(h=f);break;case 4:n=e[a+1],o=e[a+2],l=e[a+3],(192&n)==128&&(192&o)==128&&(192&l)==128&&(f=(15&s)<<18|(63&n)<<12|(63&o)<<6|63&l)>65535&&f<1114112&&(h=f)}null===h?(h=65533,u=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),a+=u}var c=i,p=c.length;if(p<=4096)return String.fromCharCode.apply(String,c);for(var d="",g=0;gr)throw RangeError("Trying to access beyond buffer length")}function _(e,t,r,i,a,n){if(!l.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw RangeError("Index out of range")}function w(e,t,r,i,a,n){if(r+i>e.length||r<0)throw RangeError("Index out of range")}function D(e,t,r,i,n){return t*=1,r>>>=0,n||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),a.write(e,t,r,i,23,4),r+4}function S(e,t,r,i,n){return t*=1,r>>>=0,n||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),a.write(e,t,r,i,52,8),r+8}l.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a,n,o,l,f,s,h,u,c=this.length-t;if((void 0===r||r>c)&&(r=c),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var p=!1;;)switch(i){case"hex":return function(e,t,r,i){r=Number(r)||0;var a=e.length-r;i?(i=Number(i))>a&&(i=a):i=a;var n=t.length;i>n/2&&(i=n/2);for(var o=0;o>8,a.push(r%256),a.push(i);return a}(e,this.length-h),this,h,u);default:if(p)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),p=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||v(e,t,this.length);for(var i=this[e],a=1,n=0;++n>>=0,t>>>=0,r||v(e,t,this.length);for(var i=this[e+--t],a=1;t>0&&(a*=256);)i+=this[e+--t]*a;return i},l.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var i=this[e],a=1,n=0;++n=(a*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var i=t,a=1,n=this[e+--i];i>0&&(a*=256);)n+=this[e+--i]*a;return n>=(a*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),a.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),a.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),a.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),a.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,i){if(e*=1,t>>>=0,r>>>=0,!i){var a=Math.pow(2,8*r)-1;_(this,e,t,r,a,0)}var n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!i){var a=Math.pow(2,8*r)-1;_(this,e,t,r,a,0)}var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,r,i){if(e*=1,t>>>=0,!i){var a=Math.pow(2,8*r-1);_(this,e,t,r,a-1,-a)}var n=0,o=1,l=0;for(this[t]=255&e;++n>>=0,!i){var a=Math.pow(2,8*r-1);_(this,e,t,r,a-1,-a)}var n=r-1,o=1,l=0;for(this[t+n]=255&e;--n>=0&&(o*=256);)e<0&&0===l&&0!==this[t+n+1]&&(l=1),this[t+n]=(e/o|0)-l&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,i){if(!l.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,i),t);return a},l.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===e.length){var a,n=e.charCodeAt(0);("utf8"===i&&n<128||"latin1"===i)&&(e=n)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&r<57344){if(!a){if(r>56319||o+1===i){(t-=3)>-1&&n.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&n.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(t-=3)>-1&&n.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;n.push(r)}else if(r<2048){if((t-=2)<0)break;n.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;n.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;n.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return n}function E(e){for(var t=[],r=0;r=t.length)&&!(a>=e.length);++a)t[a+r]=e[a];return a}function T(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var x=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var i=16*r,a=0;a<16;++a)t[i+a]=e[r]+e[a];return t}()},783:function(e,t){t.read=function(e,t,r,i,a){var n,o,l=8*a-i-1,f=(1<>1,h=-7,u=r?a-1:0,c=r?-1:1,p=e[t+u];for(u+=c,n=p&(1<<-h)-1,p>>=-h,h+=l;h>0;n=256*n+e[t+u],u+=c,h-=8);for(o=n&(1<<-h)-1,n>>=-h,h+=i;h>0;o=256*o+e[t+u],u+=c,h-=8);if(0===n)n=1-s;else{if(n===f)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),n-=s}return(p?-1:1)*o*Math.pow(2,n-i)},t.write=function(e,t,r,i,a,n){var o,l,f,s=8*n-a-1,h=(1<>1,c=5960464477539062e-23*(23===a),p=i?0:n-1,d=i?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(l=+!!isNaN(t),o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+u>=1?t+=c/f:t+=c*Math.pow(2,1-u),t*f>=2&&(o++,f/=2),o+u>=h?(l=0,o=h):o+u>=1?(l=(t*f-1)*Math.pow(2,a),o+=u):(l=t*Math.pow(2,u-1)*Math.pow(2,a),o=0));a>=8;e[r+p]=255&l,p+=d,l/=256,a-=8);for(o=o<0;e[r+p]=255&o,p+=d,o/=256,s-=8);e[r+p-d]|=128*g}}},r={};function i(t){var a=r[t];if(void 0!==a)return a.exports;var n=r[t]={exports:{}},o=!0;try{e[t](n,n.exports,i),o=!1}finally{o&&delete r[t]}return n.exports}i.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=i(72)}()},63871,e=>{"use strict";e.s(["ModelViewerContext",()=>r,"default",()=>i]);var t=e.i(71645);let r=t.default.createContext(null);function i(){let e=(0,t.useContext)(r);if(!e)throw Error("No ModelViewerContext.Provider");return e}r.displayName="ModelViewerContext"},29947,e=>{e.v(JSON.parse('{"defaultSkins":{"lmale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"mmale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"hmale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"lfemale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"mfemale":["Blood Eagle","Children of the Phoenix","Diamond Sword","Inferno","Starwolf","Storm"],"hfemale":[],"lbioderm":["Horde","Inferno","Storm"],"mbioderm":["Horde","Inferno","Storm"],"hbioderm":["Horde","Inferno","Storm"]},"modelDefaults":{"lmale":"Blood Eagle","mmale":"Blood Eagle","hmale":"Blood Eagle","lfemale":"Blood Eagle","mfemale":"Blood Eagle","hfemale":"Blood Eagle","lbioderm":"Storm","mbioderm":"Storm","hbioderm":"Storm","chaingun":"weapon_chaingun","disc":"weapon_disc","elf":"weapon_elf","energy":"weapon_energy","grenade_launcher":"weapon_grenade_launcher","mine":"mine","missile":"weapon_missile","mortar":"weapon_mortar","plasmathrower":"weapon_plasmathrower","repair":"weapon_repair","shocklance":"weapon_shocklance","sniper":"weapon_sniper","targeting":"weapon_targeting","vehicle_land_mpbbase":"vehicle_land_mpbbase","vehicle_grav_scout":"vehicle_grav_scout","vehicle_grav_tank":"vehicle_grav_tank","turret_assaulttank_mortar":"turret_assaulttank_mortar","vehicle_air_scout":"vehicle_air_scout","vehicle_air_bomber":"vehicle_air_bomber","vehicle_air_hapc":"vehicle_air_hapc"},"animationLabels":{"Forward":"Run Forward","Back":"Run Backward","Back0":"Run Backward","Root":"Idle","Root2":"Run Backward","Root3":"Idle","Idlepda":"Idle (PDA)","PDA":"Idle (PDA)","Root1":"Idle (PDA)","Jump":"Jump","Jump0":"Jump (Alternate)","Jump1":"Jump (Alternate)","Jump2":"Jump (Alternate)","Jump3":"Jump (Alternate)","Jet":"Jet","Fall":"Fall","Land":"Land","Land1":"Land (Alternate)","ski":"Ski","Side":"Strafe Left","Celwave":"Wave","Celbow":"Bow","Celdisco":"Dance","Celdance":"Dance","Celflex":"Flex","Celflex1":"Flex","Celrocky":"Awesome","Celjump":"Awesome","Celsalute":"Salute","celTaunt":"Too Bad","CelebrationGora":"Wave Arms","Celgora":"Wave Arms","CelebrationJump":"Bull Charge","Tauntbull":"Bull Charge","CelebrationJump0":"Celebrate","CelebrationJump4":"The Greatest","CelebrationRoar":"Roar","Celroar":"Roar","Celraor":"Roar","Celflex2":"Flex","celyeah":"Yeah","celtaunt":"Too Bad","Tauntbutt":"Butt","Tauntkiss":"Blow Kiss","Tauntbest":"The Greatest","Taunimp":"Move!","Tauntimp":"Move!","Sitting":"Sit","Scoutroot":"Gravcycle","Recoilde":"Recoil","Light_recoil":"Recoil","Dieforward":"Death (Fall Forward)","DeathForward":"Death (Fall Forward)","Dieslump":"Death (Slump)","DeathSlump":"Death (Slump)","Diespin":"Death (Spin)","DeathSpin":"Death (Spin)","diechest":"Death (Hold Chest)","Diechest":"Death (Hold Chest)","DeathChest":"Death (Hold Chest)","Dieback":"Death (Hold Back)","DeathBack":"Death (Hold Back)","Diehead":"Death (Hold Head)","DeathHead":"Death (Hold Head)","Dieknees":"Death (On Knees)","DeathKnees":"Death (On Knees)","Dieleglf":"Death (Left Leg Injury)","Dieleglft":"Death (Left Leg Injury)","DeathLegLeft":"Death (Left Leg Injury)","Dielegrt":"Death (Right Leg Injury)","Dielegtrt":"Death (Right Leg Injury)","DeathLegRight":"Death (Right Leg Injury)","Dielegrt0":"Death (Right Leg Injury)","Diesidelf":"Death (Left Side)","DeathSideLeft":"Death (Left Side)","Diesidert":"Death (Right Side)","DeathSideRight":"Death (Right Side)","Diesidert0":"Death (Right Side Alternate)"},"cameraOverrides":{"chaingun":{"target":"0m 0m 0m","fov":"12deg"},"plasmathrower":{"target":"0.002m -0.001m 0m","fov":"12deg"},"energy":{"fov":"31deg","orbit":"135deg 70deg 105%"},"hmale":{"fov":"24deg"},"hfemale":{"fov":"24deg"},"hbioderm":{"fov":"24deg"},"vehicle_grav_scout":{"orbit":"290deg 60deg 130%"},"vehicle_grav_tank":{"orbit":"290deg 60deg 130%"},"turret_assaulttank_mortar":{"orbit":"290deg 60deg 130%"},"vehicle_land_mpbbase":{"orbit":"290deg 60deg 130%"},"vehicle_air_scout":{"orbit":"290deg 60deg 130%"},"vehicle_air_bomber":{"orbit":"290deg 60deg 130%"},"vehicle_air_hapc":{"orbit":"290deg 60deg 130%"}},"animationLabelOverrides":{"mmale":{"Back":"Strafe Left"},"mfemale":{"Dielegrt":"Death (Slump)"},"lbioderm":{"Root":"Gravcycle"}},"materials":{"lmale":[{"name":"base","label":"Warrior","fileSuffix":".lmale"}],"mmale":[{"name":"base","label":"Warrior","fileSuffix":".mmale"}],"hmale":[{"name":"base","label":"Warrior","fileSuffix":".hmale"}],"lfemale":[{"name":"base","label":"Warrior","fileSuffix":".lfemale"}],"mfemale":[{"name":"base","label":"Warrior","fileSuffix":".mfemale"}],"lbioderm":[{"name":"base","label":"Warrior","fileSuffix":".lbioderm"}],"mbioderm":[{"name":"base","label":"Warrior","fileSuffix":".mbioderm"}],"hbioderm":[{"name":"base","label":"Warrior","fileSuffix":".hbioderm"}],"disc":[{"name":"weapon_disc","label":"Weapon"},{"name":"dcase00","label":"Disc Case","size":[256,256],"baseColorFactor":[1,1,1,0.7],"emissiveFactor":[1,1,1],"emissiveTexture":true,"alphaMode":"BLEND","metallicFactor":0,"roughnessFactor":1,"frameCount":6,"frameTimings":[21,1,1,1,1,1],"optional":true}],"chaingun":[{"label":"Chaingun","name":"weapon_chaingun"}],"grenade_launcher":[{"label":"Grenade Launcher","name":"weapon_grenade_launcher"}],"sniper":[{"label":"Weapon","name":"weapon_sniper"},{"label":"Green Light","name":"greenlight","hasDefault":false,"optional":true},{"label":"Red Light","name":"lite_red","hasDefault":false,"optional":true}],"plasmathrower":[{"label":"Rear & Barrel","name":"weapon_plasma10","file":"weapon_plasma1"},{"label":"Top & Front","name":"weapon_plasma21","file":"weapon_plasma2"},{"name":"weapon_plasma1","file":"weapon_plasma1","selectable":false},{"name":"weapon_plasma2","file":"weapon_plasma2","selectable":false}],"energy":[{"label":"Weapon","name":"blinn1","file":"weapon_energy"}],"shocklance":[{"label":"Weapon","name":"weapon_shocklance","size":[512,256]},{"label":"Glow","name":"weapon_shocklance_glow_","file":"weapon_shocklance_glow ","emissiveFactor":[1,1,1],"alphaMode":"MASK","alphaCutoff":255,"emissiveTexture":true,"metallicFactor":0,"roughnessFactor":1,"size":[256,128],"optional":true}],"elf":[{"label":"Weapon","name":"weapon_elf","file":"weapon_elf"},{"label":"Glow","name":"weapon_elf0","file":"weapon_elf"}],"missile":[{"label":"Weapon","name":"weapon_missile"}],"mortar":[{"label":"Weapon","name":"weapon_mortar"}],"repair":[{"label":"Weapon","name":"weapon_repair"}],"targeting":[{"label":"Weapon","name":"weapon_targeting"}],"mine":[{"label":"Weapon","name":"mine","size":[512,512],"metallicFactor":0,"roughnessFactor":1}],"vehicle_air_scout":[{"label":"Vehicle","name":"vehicle_air_scout0","file":"vehicle_air_scout"},{"name":"Unassigned","hidden":true,"hasDefault":false},{"name":"vehicle_air_scout","hidden":true,"hasDefault":false},{"label":"Flare","name":"shrikeflare2","emissiveFactor":[0,0,0],"alphaMode":"BLEND","emissiveTexture":true,"metallicFactor":0,"roughnessFactor":1,"size":[256,256],"optional":true}],"vehicle_air_bomber":[{"label":"Cockpit & Thrusters","name":"vehicle_air_bomber10","file":"vehicle_air_bomber1","size":[256,512]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Rear","name":"vehicle_air_bomber2","size":[256,512]},{"label":"Wings","name":"vehicle_air_bomber31","file":"vehicle_air_bomber3"},{"name":"vehicle_air_bomber1","size":[256,512],"selectable":false},{"name":"vehicle_air_bomber3","selectable":false}],"vehicle_air_hapc":[{"label":"Cockpit","name":"vehicle_air_bomber1","size":[256,512]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Wings","name":"vehicle_air_hpc2"},{"label":"Seats","name":"vehicle_air_hpc1"},{"label":"Thrusters","name":"vehicle_air_hpc30","file":"vehicle_air_hpc3"},{"name":"vehicle_air_hpc3","selectable":false}],"vehicle_grav_scout":[{"label":"Vehicle","name":"Vehicle_grav_scout0","file":"Vehicle_grav_scout","size":[512,256]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Pipes","name":"Vehicle_grav_scout_pipes1","file":"Vehicle_grav_scout_pipes","metallicFactor":0,"roughnessFactor":1},{"name":"Vehicle_grav_scout","hidden":true,"hasDefault":false},{"label":"Side Thrusters","name":"Vehicle_grav_scout_pipes","file":"Vehicle_grav_scout_pipes","emissiveFactor":[1,1,1],"alphaMode":"OPAQUE","metallicFactor":0,"roughnessFactor":1,"emissiveTexture":true,"selectable":false},{"label":"Windshield","name":"Vehicle_grav_scout_windshield","file":"Vehicle_grav_scout_windshield","selectable":false,"alphaMode":"BLEND","baseColorFactor":[1,1,1,0.5],"metallicFactor":0,"roughnessFactor":1,"size":[128,128],"optional":true},{"label":"Windshield Inner","name":"Vehicle_grav_scout_windshieldInner","file":"Vehicle_grav_scout_windshieldInner","selectable":false,"alphaMode":"BLEND","baseColorFactor":[1,1,1,0.5],"metallicFactor":0,"roughnessFactor":1,"size":[128,128],"optional":true}],"vehicle_grav_tank":[{"label":"Center","name":"Vehicle_grav_tank_bodyMain","size":[256,512]},{"name":"Unassigned","hidden":true,"hasDefault":false},{"label":"Sides","name":"vehicle_grav_tank_bodyside10","file":"vehicle_grav_tank_bodyside1","size":[256,512]},{"label":"Thrusters","name":"vehicle_grav_tank_bodyside21","file":"vehicle_grav_tank_bodyside2"},{"name":"vehicle_grav_tank_bodyside2","selectable":false},{"name":"vehicle_grav_tank_bodyside1","selectable":false}],"turret_assaulttank_mortar":[{"label":"Turret","name":"turret_assaulttank_mortar","file":"turret_assaultTank"}],"vehicle_land_mpbbase":[{"label":"Vehicle Front","name":"vehicle_land_mpb1"},{"label":"Vehicle Back","name":"vehicle_land_mpb2"},{"label":"Wheels","name":"Vehicle_Land_Assault_wheel","file":"Vehicle_Land_Assault_Wheel","size":[512,256],"optional":true}]},"animations":{"global":["Forward","Back","Jump","Jet","Fall","Land","ski","Root"],"lmale":["Idlepda","Side","Jump0","Land1","Recoilde","Celwave","Celdisco","Celflex","Celrocky","Celsalute","celTaunt","Taunimp","Tauntbest","Dieback","diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Diesidelf","Diesidert","Dieslump","Diespin","Scoutroot","Sitting"],"mmale":["Back0","Jump3","Recoilde","Celwave","Celdance","Celflex","Celrocky","Celsalute","celtaunt","Tauntbest","Tauntimp","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Diesidelf","Diesidert","Diespin","Sitting"],"hmale":["Idlepda","Jump1","Side","Recoilde","Celwave","Celdance","Celflex","Celjump","Celsalute","celtaunt","Tauntbest","Tauntimp","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dielegrt","Diesidelf","Diesidert","Diesidert0","Dieslump","Diespin"],"lfemale":["Idlepda","Jump1","Side","Recoilde","Celwave","Celbow","Celdance","Celsalute","Tauntbest","Tauntbutt","Tauntimp","Tauntkiss","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Diesidelf","Diesidert","Dieslump","Diespin","Scoutroot","Sitting"],"mfemale":["Idlepda","Jump1","Side","Recoilde","Celwave","Celbow","Celdisco","Celsalute","Tauntbest","Tauntbutt","Tauntimp","Tauntkiss","Dieback","Diechest","Dieforward","Diehead","Dieknees","Dieleglf","Dielegrt","Dielegrt0","Diesidelf","Diesidert","Diespin","Sitting"],"lbioderm":["Root3","PDA","Jump2","Side","Light_recoil","CelebrationGora","CelebrationJump","CelebrationJump0","CelebrationJump4","CelebrationRoar","Salute","Celflex2","celyeah","DeathBack","DeathChest","DeathForward","DeathHead","DeathKnees","DeathLegLeft","DeathLegRight","DeathSideLeft","DeathSideRight","DeathSlump","DeathSpin","Sitting"],"mbioderm":["Root1","Jump2","Side","Recoilde","Salute","Celflex1","Celgora","Celjump","Celroar","celyeah","Tauntbest","Tauntbull","DeathBack","DeathChest","DeathHead","DeathSideLeft","DeathSpin","Dieforward","Dieknees","Dieleglft","Dielegtrt","Diesidert","Dieslump","Sitting"],"hbioderm":["Root1","Jump2","Side","Recoilde","Salute","Celflex2","Celgora","Celjump","Celraor","celyeah","Tauntbest","Tauntbull","DeathBack","DeathChest","DeathForward","DeathHead","DeathKnees","DeathLegLeft","DeathLegRight","DeathSideLeft","DeathSideRight","DeathSlump","DeathSpin"]}}'))},5993,e=>{e.v("/t2-model-skinner/_next/static/media/imageProcessing.worker.dbca7ab4.ts")},91135,e=>{e.v(t=>Promise.all(["static/chunks/2d2bdb29c69093a9.js"].map(t=>e.l(t))).then(()=>t(69642)))},22143,e=>{e.v(t=>Promise.all(["static/chunks/2d6d26cb79779ffe.js"].map(t=>e.l(t))).then(()=>t(66641)))}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/9072f9dc67ad2fb2.js b/docs/_next/static/chunks/9072f9dc67ad2fb2.js deleted file mode 100644 index f7018c1..0000000 --- a/docs/_next/static/chunks/9072f9dc67ad2fb2.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,43794,(t,e,r)=>{!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var t=[],e=0;e{t.v(t.b(["static/chunks/9338a92aac995757.js","static/chunks/a55df98dcb3b60ad.js","static/chunks/turbopack-95cb340f669027bc.js"]))},67585,(t,e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSR",{enumerable:!0,get:function(){return n}});let i=t.r(32061);function n(t){let{reason:e,children:r}=t;if("undefined"==typeof window)throw Object.defineProperty(new i.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return r}},9885,(t,e,r)=>{"use strict";function i(t){return t.split("/").map(t=>encodeURIComponent(t)).join("/")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"encodeURIPath",{enumerable:!0,get:function(){return i}})},52157,(t,e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return o}});let i=t.r(43476),n=t.r(74080),s=t.r(63599),a=t.r(9885);function o(t){let{moduleIds:e}=t;if("undefined"!=typeof window)return null;let r=s.workAsyncStorage.getStore();if(void 0===r)return null;let o=[];if(r.reactLoadableManifest&&e){let t=r.reactLoadableManifest;for(let r of e){if(!t[r])continue;let e=t[r].files;o.push(...e)}}return 0===o.length?null:(0,i.jsx)(i.Fragment,{children:o.map(t=>{let e=r.assetPrefix+"/_next/"+(0,a.encodeURIPath)(t);return t.endsWith(".css")?(0,i.jsx)("link",{precedence:"dynamic",href:e,rel:"stylesheet",as:"style"},t):((0,n.preload)(e,{as:"script",fetchPriority:"low"}),null)})})}},69093,(t,e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return h}});let i=t.r(43476),n=t.r(71645),s=t.r(67585),a=t.r(52157);function o(t){return{default:t&&"default"in t?t.default:t}}let l={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},h=function(t){let e={...l,...t},r=(0,n.lazy)(()=>e.loader().then(o)),h=e.loading;function c(t){let o=h?(0,i.jsx)(h,{isLoading:!0,pastDelay:!0,error:null}):null,l=!e.ssr||!!e.loading,c=l?n.Suspense:n.Fragment,u=e.ssr?(0,i.jsxs)(i.Fragment,{children:["undefined"==typeof window?(0,i.jsx)(a.PreloadChunks,{moduleIds:e.modules}):null,(0,i.jsx)(r,{...t})]}):(0,i.jsx)(s.BailoutToCSR,{reason:"next/dynamic",children:(0,i.jsx)(r,{...t})});return(0,i.jsx)(c,{...l?{fallback:o}:{},children:u})}return c.displayName="LoadableComponent",c}},70703,(t,e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return n}});let i=t.r(55682)._(t.r(69093));function n(t,e){var r;let n={};"function"==typeof t&&(n.loader=t);let s={...n,...e};return(0,i.default)({...s,modules:null==(r=s.loadableGenerated)?void 0:r.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),e.exports=r.default)},52683,t=>{"use strict";let e,r,i,n,s;t.s(["default",()=>da],52683);var a,o,l,h,c,u,d,f,g,p,m,y,x,b,_,w,C,S,T,O,k,M,E,D,j,A,P,F,L,R,I,B,N,W,U,H,X,V,z,Y,G,q,K,Q,J=t.i(43476),Z=t.i(71645);function $(t,e,r){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e,"string"))?i:i+"")in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function tt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,i)}return r}function te(t){for(var e=1;e=0)continue;r[i]=t[i]}return r}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0||({}).propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function ti(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}class tn{constructor(){$(this,"browserShadowBlurConstant",1),$(this,"DPI",96),$(this,"devicePixelRatio","undefined"!=typeof window?window.devicePixelRatio:1),$(this,"perfLimitSizeTotal",2097152),$(this,"maxCacheSideLimit",4096),$(this,"minCacheSideLimit",256),$(this,"disableStyleCopyPaste",!1),$(this,"enableGLFiltering",!0),$(this,"textureSize",4096),$(this,"forceGLPutImageData",!1),$(this,"cachesBoundsOfCurve",!1),$(this,"fontPaths",{}),$(this,"NUM_FRACTION_DIGITS",4)}}let ts=new class extends tn{configure(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(this,t)}addFonts(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fontPaths=te(te({},this.fontPaths),t)}removeFonts(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(t=>{delete this.fontPaths[t]})}clearFonts(){this.fontPaths={}}restoreDefaults(t){let e=new tn,r=(null==t?void 0:t.reduce((t,r)=>(t[r]=e[r],t),{}))||e;this.configure(r)}constructor(t){super(),this.configure(t)}},ta=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;ithis.testPrecision(e,t)),e.getExtension("WEBGL_lose_context").loseContext(),ta("log","WebGL: max texture size ".concat(this.maxTextureSize)))}isSupported(t){return!!this.maxTextureSize&&this.maxTextureSize>=t}}let tu={},td=()=>e||(e={document:document,window:window,isTouchSupported:"ontouchstart"in window||"ontouchstart"in document||window&&window.navigator&&window.navigator.maxTouchPoints>0,WebGLProbe:new tc,dispose(){},copyPasteData:tu}),tf=()=>td().document,tg=()=>td().window,tp=()=>{var t;return Math.max(null!=(t=ts.devicePixelRatio)?t:tg().devicePixelRatio,1)},tm=new class{getFontCache(t){let{fontFamily:e,fontStyle:r,fontWeight:i}=t;e=e.toLowerCase(),this.charWidthsCache[e]||(this.charWidthsCache[e]={});let n=this.charWidthsCache[e],s="".concat(r.toLowerCase(),"_").concat((i+"").toLowerCase());return n[s]||(n[s]={}),n[s]}clearFontCache(t){(t=(t||"").toLowerCase())?this.charWidthsCache[t]&&delete this.charWidthsCache[t]:this.charWidthsCache={}}limitDimsByArea(t){let{perfLimitSizeTotal:e}=ts,r=Math.sqrt(e*t);return[Math.floor(r),Math.floor(e/r)]}constructor(){$(this,"charWidthsCache",{}),$(this,"boundsOfCurveCache",{})}},tv="6.7.1";function ty(){}let tx=Math.PI/2,tb=2*Math.PI,t_=Math.PI/180,tw=Object.freeze([1,0,0,1,0,0]),tC="center",tS="left",tT="bottom",tO="right",tk="none",tM=/\r?\n/,tE="moving",tD="scaling",tj="rotating",tA="rotate",tP="skewing",tF="resizing",tL="modifyPoly",tR="changed",tI="scale",tB="scaleX",tN="scaleY",tW="skewX",tU="skewY",tH="fill",tX="stroke",tV="modified",tz="json",tY=new class{has(t){return this[tz].has(t)}getClass(t){let e=this[tz].get(t);if(!e)throw new to("No class registered for ".concat(t));return e}setClass(t,e){e?this[tz].set(e,t):(this[tz].set(t.type,t),this[tz].set(t.type.toLowerCase(),t))}getSVGClass(t){return this.svg.get(t)}setSVGClass(t,e){this.svg.set(null!=e?e:t.type.toLowerCase(),t)}constructor(){this[tz]=new Map,this.svg=new Map}},tG=new class extends Array{remove(t){let e=this.indexOf(t);e>-1&&this.splice(e,1)}cancelAll(){let t=this.splice(0);return t.forEach(t=>t.abort()),t}cancelByCanvas(t){if(!t)return[];let e=this.filter(e=>{var r;return e.target===t||"object"==typeof e.target&&(null==(r=e.target)?void 0:r.canvas)===t});return e.forEach(t=>t.abort()),e}cancelByTarget(t){if(!t)return[];let e=this.filter(e=>e.target===t);return e.forEach(t=>t.abort()),e}};class tq{on(t,e){return(this.__eventListeners||(this.__eventListeners={}),"object"==typeof t)?(Object.entries(t).forEach(t=>{let[e,r]=t;this.on(e,r)}),()=>this.off(t)):e?(this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e),()=>this.off(t,e)):()=>!1}once(t,e){if("object"==typeof t){let e=[];return Object.entries(t).forEach(t=>{let[r,i]=t;e.push(this.once(r,i))}),()=>e.forEach(t=>t())}if(e){let r=this.on(t,function(){for(var t=arguments.length,i=Array(t),n=0;n!1}_removeEventListener(t,e){if(this.__eventListeners[t])if(e){let r=this.__eventListeners[t],i=r.indexOf(e);i>-1&&r.splice(i,1)}else this.__eventListeners[t]=[]}off(t,e){if(this.__eventListeners)if(void 0===t)for(let t in this.__eventListeners)this._removeEventListener(t);else"object"==typeof t?Object.entries(t).forEach(t=>{let[e,r]=t;this._removeEventListener(e,r)}):this._removeEventListener(t,e)}fire(t,e){var r;if(!this.__eventListeners)return;let i=null==(r=this.__eventListeners[t])?void 0:r.concat();if(i)for(let t=0;t{let r=t.indexOf(e);return -1!==r&&t.splice(r,1),t},tQ=t=>{if(0===t)return 1;switch(Math.abs(t)/tx){case 1:case 3:return 0;case 2:return -1}return Math.cos(t)},tJ=t=>{if(0===t)return 0;let e=Math.sign(t);switch(t/tx){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)};class tZ{add(t){return new tZ(this.x+t.x,this.y+t.y)}addEquals(t){return this.x+=t.x,this.y+=t.y,this}scalarAdd(t){return new tZ(this.x+t,this.y+t)}scalarAddEquals(t){return this.x+=t,this.y+=t,this}subtract(t){return new tZ(this.x-t.x,this.y-t.y)}subtractEquals(t){return this.x-=t.x,this.y-=t.y,this}scalarSubtract(t){return new tZ(this.x-t,this.y-t)}scalarSubtractEquals(t){return this.x-=t,this.y-=t,this}multiply(t){return new tZ(this.x*t.x,this.y*t.y)}scalarMultiply(t){return new tZ(this.x*t,this.y*t)}scalarMultiplyEquals(t){return this.x*=t,this.y*=t,this}divide(t){return new tZ(this.x/t.x,this.y/t.y)}scalarDivide(t){return new tZ(this.x/t,this.y/t)}scalarDivideEquals(t){return this.x/=t,this.y/=t,this}eq(t){return this.x===t.x&&this.y===t.y}lt(t){return this.xt.x&&this.y>t.y}gte(t){return this.x>=t.x&&this.y>=t.y}lerp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5;return e=Math.max(Math.min(1,e),0),new tZ(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)}distanceFrom(t){let e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)}midPointFrom(t){return this.lerp(t)}min(t){return new tZ(Math.min(this.x,t.x),Math.min(this.y,t.y))}max(t){return new tZ(Math.max(this.x,t.x),Math.max(this.y,t.y))}toString(){return"".concat(this.x,",").concat(this.y)}setXY(t,e){return this.x=t,this.y=e,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setFromPoint(t){return this.x=t.x,this.y=t.y,this}swap(t){let e=this.x,r=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=r}clone(){return new tZ(this.x,this.y)}rotate(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t$,r=tJ(t),i=tQ(t),n=this.subtract(e);return new tZ(n.x*i-n.y*r,n.x*r+n.y*i).add(e)}transform(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new tZ(t[0]*this.x+t[2]*this.y+(e?0:t[4]),t[1]*this.x+t[3]*this.y+(e?0:t[5]))}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t,this.y=e)}}let t$=new tZ(0,0),t0=t=>!!t&&Array.isArray(t._objects);function t1(t){class e extends t{_onObjectAdded(t){}_onObjectRemoved(t){}_onStackOrderChanged(t){}add(){for(var t=arguments.length,e=Array(t),r=0;rthis._onObjectAdded(t)),i}insertAt(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;ithis._onObjectAdded(t)),this._objects.length}remove(){let t=this._objects,e=[];for(var r=arguments.length,i=Array(r),n=0;n{let i=t.indexOf(r);-1!==i&&(t.splice(i,1),e.push(r),this._onObjectRemoved(r))}),e}forEachObject(t){this.getObjects().forEach((e,r,i)=>t(e,r,i))}getObjects(){for(var t=arguments.length,e=Array(t),r=0;rt.isType(...e))}item(t){return this._objects[t]}isEmpty(){return 0===this._objects.length}size(){return this._objects.length}contains(t,r){return!!this._objects.includes(t)||!!r&&this._objects.some(r=>r instanceof e&&r.contains(t,!0))}complexity(){return this._objects.reduce((t,e)=>t+=e.complexity?e.complexity():0,0)}sendObjectToBack(t){return!(!t||t===this._objects[0])&&(tK(this._objects,t),this._objects.unshift(t),this._onStackOrderChanged(t),!0)}bringObjectToFront(t){return!(!t||t===this._objects[this._objects.length-1])&&(tK(this._objects,t),this._objects.push(t),this._onStackOrderChanged(t),!0)}sendObjectBackwards(t,e){if(!t)return!1;let r=this._objects.indexOf(t);if(0!==r){let i=this.findNewLowerIndex(t,r,e);return tK(this._objects,t),this._objects.splice(i,0,t),this._onStackOrderChanged(t),!0}return!1}bringObjectForward(t,e){if(!t)return!1;let r=this._objects.indexOf(t);if(r!==this._objects.length-1){let i=this.findNewUpperIndex(t,r,e);return tK(this._objects,t),this._objects.splice(i,0,t),this._onStackOrderChanged(t),!0}return!1}moveObjectTo(t,e){return t!==this._objects[e]&&(tK(this._objects,t),this._objects.splice(e,0,t),this._onStackOrderChanged(t),!0)}findNewLowerIndex(t,e,r){let i;if(r){i=e;for(let r=e-1;r>=0;--r)if(t.isOverlapping(this._objects[r])){i=r;break}}else i=e-1;return i}findNewUpperIndex(t,e,r){let i;if(r){i=e;for(let r=e+1;r1&&void 0!==arguments[1]?arguments[1]:{},a=[],o=new tZ(e,r),l=o.add(new tZ(i,n));for(let t=this._objects.length-1;t>=0;t--){let e=this._objects[t];e.selectable&&e.visible&&(s&&e.intersectsWithRect(o,l)||e.isContainedWithinRect(o,l)||s&&e.containsPoint(o)||s&&e.containsPoint(l))&&a.push(e)}return a}constructor(){super(...arguments),$(this,"_objects",[])}}return e}class t2 extends tq{_setOptions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(let e in t)this.set(e,t[e])}_setObject(t){for(let e in t)this._set(e,t[e])}set(t,e){return"object"==typeof t?this._setObject(t):this._set(t,e),this}_set(t,e){this[t]=e}toggle(t){let e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this}get(t){return this[t]}}function t5(t){return tg().requestAnimationFrame(t)}function t4(t){return tg().cancelAnimationFrame(t)}let t3=0,t9=()=>t3++,t6=()=>{let t=tf().createElement("canvas");if(!t||void 0===t.getContext)throw new to("Failed to create `canvas` element");return t},t8=()=>tf().createElement("img"),t7=t=>{let e=t6();return e.width=t.width,e.height=t.height,e},et=(t,e,r)=>t.toDataURL("image/".concat(e),r),ee=(t,e,r)=>new Promise((i,n)=>{t.toBlob(i,"image/".concat(e),r)}),er=t=>t*t_,ei=t=>t/t_,en=t=>t.every((t,e)=>t===tw[e]),es=(t,e,r)=>new tZ(t).transform(e,r),ea=t=>{let e=1/(t[0]*t[3]-t[1]*t[2]),r=[e*t[3],-e*t[1],-e*t[2],e*t[0],0,0],{x:i,y:n}=new tZ(t[4],t[5]).transform(r,!0);return r[4]=-i,r[5]=-n,r},eo=(t,e,r)=>[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],r?0:t[0]*e[4]+t[2]*e[5]+t[4],r?0:t[1]*e[4]+t[3]*e[5]+t[5]],el=(t,e)=>t.reduceRight((t,r)=>r&&t?eo(r,t,e):r||t,void 0)||tw.concat(),eh=t=>{let[e,r]=t;return Math.atan2(r,e)},ec=t=>{let e=eh(t),r=Math.pow(t[0],2)+Math.pow(t[1],2),i=Math.sqrt(r),n=(t[0]*t[3]-t[2]*t[1])/i,s=Math.atan2(t[0]*t[2]+t[1]*t[3],r);return{angle:ei(e),scaleX:i,scaleY:n,skewX:ei(s),skewY:0,translateX:t[4]||0,translateY:t[5]||0}},eu=function(t){return[1,0,0,1,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0]};function ed(){let{angle:t=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{x:e=0,y:r=0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=er(t),n=tQ(i),s=tJ(i);return[n,s,-s,n,e?e-(n*e-s*r):0,r?r-(s*e+n*r):0]}let ef=function(t){return[t,0,0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,0,0]},eg=t=>Math.tan(er(t)),ep=t=>[1,0,eg(t),1,0,0],em=t=>[1,eg(t),0,1,0,0],ev=t=>{let{scaleX:e=1,scaleY:r=1,flipX:i=!1,flipY:n=!1,skewX:s=0,skewY:a=0}=t,o=ef(i?-e:e,n?-r:r);return s&&(o=eo(o,ep(s),!0)),a&&(o=eo(o,em(a),!0)),o},ey=t=>{let{translateX:e=0,translateY:r=0,angle:i=0}=t,n=eu(e,r);i&&(n=eo(n,ed({angle:i})));let s=ev(t);return en(s)||(n=eo(n,s)),n},ex=function(t){let{signal:e,crossOrigin:r=null}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(i,n){let s;if(e&&e.aborted)return n(new tl("loadImage"));let a=t8();e&&(s=function(t){a.src="",n(t)},e.addEventListener("abort",s,{once:!0}));let o=function(){a.onload=a.onerror=null,s&&(null==e||e.removeEventListener("abort",s)),i(a)};t?(a.onload=o,a.onerror=function(){s&&(null==e||e.removeEventListener("abort",s)),n(new to("Error loading ".concat(a.src)))},r&&(a.crossOrigin=r),a.src=t):o()})},eb=function(t){let{signal:e,reviver:r=ty}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((i,n)=>{let s=[];e&&e.addEventListener("abort",n,{once:!0}),Promise.all(t.map(t=>tY.getClass(t.type).fromObject(t,{signal:e}).then(e=>(r(t,e),s.push(e),e)))).then(i).catch(t=>{s.forEach(t=>{t.dispose&&t.dispose()}),n(t)}).finally(()=>{e&&e.removeEventListener("abort",n)})})},e_=function(t){let{signal:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((r,i)=>{let n=[];e&&e.addEventListener("abort",i,{once:!0});let s=Object.values(t).map(t=>t&&t.type&&tY.has(t.type)?eb([t],{signal:e}).then(t=>{let[e]=t;return n.push(e),e}):t),a=Object.keys(t);Promise.all(s).then(t=>t.reduce((t,e,r)=>(t[a[r]]=e,t),{})).then(r).catch(t=>{n.forEach(t=>{t.dispose&&t.dispose()}),i(t)}).finally(()=>{e&&e.removeEventListener("abort",i)})})},ew=function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).reduce((e,r)=>(r in t&&(e[r]=t[r]),e),{})},eC=(t,e)=>Object.keys(t).reduce((r,i)=>(e(t[i],i,t)&&(r[i]=t[i]),r),{}),eS=(t,e)=>parseFloat(Number(t).toFixed(e)),eT=t=>"matrix("+t.map(t=>eS(t,ts.NUM_FRACTION_DIGITS)).join(" ")+")",eO=t=>!!t&&void 0!==t.toLive,ek=t=>!!t&&"function"==typeof t.toObject,eM=t=>!!t&&void 0!==t.offsetX&&"source"in t,eE=t=>!!t&&"multiSelectionStacking"in t;function eD(t){let e=t&&ej(t),r=0,i=0;if(!t||!e)return{left:r,top:i};let n=t,s=e.documentElement,a=e.body||{scrollLeft:0,scrollTop:0};for(;n&&(n.parentNode||n.host)&&((n=n.parentNode||n.host)===e?(r=a.scrollLeft||s.scrollLeft||0,i=a.scrollTop||s.scrollTop||0):(r+=n.scrollLeft||0,i+=n.scrollTop||0),1!==n.nodeType||"fixed"!==n.style.position););return{left:r,top:i}}let ej=t=>t.ownerDocument||null,eA=t=>{var e;return(null==(e=t.ownerDocument)?void 0:e.defaultView)||null},eP=function(t,e,r){let{width:i,height:n}=r,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;t.width=i,t.height=n,s>1&&(t.setAttribute("width",(i*s).toString()),t.setAttribute("height",(n*s).toString()),e.scale(s,s))},eF=(t,e)=>{let{width:r,height:i}=e;r&&(t.style.width="number"==typeof r?"".concat(r,"px"):r),i&&(t.style.height="number"==typeof i?"".concat(i,"px"):i)};function eL(t){return void 0!==t.onselectstart&&(t.onselectstart=()=>!1),t.style.userSelect=tk,t}class eR{createLowerCanvas(t){let e=t&&void 0!==t.getContext?t:t&&tf().getElementById(t)||t6();if(e.hasAttribute("data-fabric"))throw new to("Trying to initialize a canvas that has already been initialized. Did you forget to dispose the canvas?");return this._originalCanvasStyle=e.style.cssText,e.setAttribute("data-fabric","main"),e.classList.add("lower-canvas"),e}cleanupDOM(t){let{width:e,height:r}=t,{el:i}=this.lower;i.classList.remove("lower-canvas"),i.removeAttribute("data-fabric"),i.setAttribute("width","".concat(e)),i.setAttribute("height","".concat(r)),i.style.cssText=this._originalCanvasStyle||"",this._originalCanvasStyle=void 0}setDimensions(t,e){let{el:r,ctx:i}=this.lower;eP(r,i,t,e)}setCSSDimensions(t){eF(this.lower.el,t)}calcOffset(){return function(t){var e;let r=t&&ej(t),i={left:0,top:0};if(!r)return i;let n=(null==(e=eA(t))?void 0:e.getComputedStyle(t,null))||{};i.left+=parseInt(n.borderLeftWidth,10)||0,i.top+=parseInt(n.borderTopWidth,10)||0,i.left+=parseInt(n.paddingLeft,10)||0,i.top+=parseInt(n.paddingTop,10)||0;let s={left:0,top:0},a=r.documentElement;void 0!==t.getBoundingClientRect&&(s=t.getBoundingClientRect());let o=eD(t);return{left:s.left+o.left-(a.clientLeft||0)+i.left,top:s.top+o.top-(a.clientTop||0)+i.top}}(this.lower.el)}dispose(){td().dispose(this.lower.el),delete this.lower}constructor(t){$(this,"_originalCanvasStyle",void 0),$(this,"lower",void 0);let e=this.createLowerCanvas(t);this.lower={el:e,ctx:e.getContext("2d")}}}let eI={backgroundVpt:!0,backgroundColor:"",overlayVpt:!0,overlayColor:"",includeDefaultValues:!0,svgViewportTransformation:!0,renderOnAddRemove:!0,skipOffscreen:!0,enableRetinaScaling:!0,imageSmoothingEnabled:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,viewportTransform:[...tw]};class eB extends t1(t2){get lowerCanvasEl(){var t;return null==(t=this.elements.lower)?void 0:t.el}get contextContainer(){var t;return null==(t=this.elements.lower)?void 0:t.ctx}static getDefaults(){return eB.ownDefaults}initElements(t){this.elements=new eR(t)}add(){let t=super.add(...arguments);return arguments.length>0&&this.renderOnAddRemove&&this.requestRenderAll(),t}insertAt(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i0&&this.renderOnAddRemove&&this.requestRenderAll(),n}remove(){let t=super.remove(...arguments);return t.length>0&&this.renderOnAddRemove&&this.requestRenderAll(),t}_onObjectAdded(t){t.canvas&&t.canvas!==this&&(ta("warn","Canvas is trying to add an object that belongs to a different canvas.\nResulting to default behavior: removing object from previous canvas and adding to new canvas"),t.canvas.remove(t)),t._set("canvas",this),t.setCoords(),this.fire("object:added",{target:t}),t.fire("added",{target:this})}_onObjectRemoved(t){t._set("canvas",void 0),this.fire("object:removed",{target:t}),t.fire("removed",{target:this})}_onStackOrderChanged(){this.renderOnAddRemove&&this.requestRenderAll()}getRetinaScaling(){return this.enableRetinaScaling?tp():1}calcOffset(){return this._offset=this.elements.calcOffset()}getWidth(){return this.width}getHeight(){return this.height}setWidth(t,e){return this.setDimensions({width:t},e)}setHeight(t,e){return this.setDimensions({height:t},e)}_setDimensionsImpl(t){let{cssOnly:e=!1,backstoreOnly:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e){let e=te({width:this.width,height:this.height},t);this.elements.setDimensions(e,this.getRetinaScaling()),this.hasLostContext=!0,this.width=e.width,this.height=e.height}r||this.elements.setCSSDimensions(t),this.calcOffset()}setDimensions(t,e){this._setDimensionsImpl(t,e),e&&e.cssOnly||this.requestRenderAll()}getZoom(){return this.viewportTransform[0]}setViewportTransform(t){this.viewportTransform=t,this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll()}zoomToPoint(t,e){let r=[...this.viewportTransform],i=es(t,ea(r));r[0]=e,r[3]=e;let n=es(i,r);r[4]+=t.x-n.x,r[5]+=t.y-n.y,this.setViewportTransform(r)}setZoom(t){this.zoomToPoint(new tZ(0,0),t)}absolutePan(t){let e=[...this.viewportTransform];return e[4]=-t.x,e[5]=-t.y,this.setViewportTransform(e)}relativePan(t){return this.absolutePan(new tZ(-t.x-this.viewportTransform[4],-t.y-this.viewportTransform[5]))}getElement(){return this.elements.lower.el}clearContext(t){t.clearRect(0,0,this.width,this.height)}getContext(){return this.elements.lower.ctx}clear(){this.remove(...this.getObjects()),this.backgroundImage=void 0,this.overlayImage=void 0,this.backgroundColor="",this.overlayColor="",this.clearContext(this.getContext()),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll()}renderAll(){this.cancelRequestedRender(),this.destroyed||this.renderCanvas(this.getContext(),this._objects)}renderAndReset(){this.nextRenderHandle=0,this.renderAll()}requestRenderAll(){this.nextRenderHandle||this.disposed||this.destroyed||(this.nextRenderHandle=t5(()=>this.renderAndReset()))}calcViewportBoundaries(){let t=this.width,e=this.height,r=ea(this.viewportTransform),i=es({x:0,y:0},r),n=es({x:t,y:e},r),s=i.min(n),a=i.max(n);return this.vptCoords={tl:s,tr:new tZ(a.x,s.y),bl:new tZ(s.x,a.y),br:a}}cancelRequestedRender(){this.nextRenderHandle&&(t4(this.nextRenderHandle),this.nextRenderHandle=0)}drawControls(t){}renderCanvas(t,e){if(this.destroyed)return;let r=this.viewportTransform,i=this.clipPath;this.calcViewportBoundaries(),this.clearContext(t),t.imageSmoothingEnabled=this.imageSmoothingEnabled,t.patternQuality="best",this.fire("before:render",{ctx:t}),this._renderBackground(t),t.save(),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this._renderObjects(t,e),t.restore(),this.controlsAboveOverlay||this.skipControlsDrawing||this.drawControls(t),i&&(i._set("canvas",this),i.shouldCache(),i._transformDone=!0,i.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(t,i)),this._renderOverlay(t),this.controlsAboveOverlay&&!this.skipControlsDrawing&&this.drawControls(t),this.fire("after:render",{ctx:t}),this.__cleanupTask&&(this.__cleanupTask(),this.__cleanupTask=void 0)}drawClipPathOnCanvas(t,e){let r=this.viewportTransform;t.save(),t.transform(...r),t.globalCompositeOperation="destination-in",e.transform(t),t.scale(1/e.zoomX,1/e.zoomY),t.drawImage(e._cacheCanvas,-e.cacheTranslationX,-e.cacheTranslationY),t.restore()}_renderObjects(t,e){for(let r=0,i=e.length;r!t.excludeFromExport).map(r=>this._toObject(r,t,e))},this.__serializeBgOverlay(t,e)),i?{clipPath:i}:null)}_toObject(t,e,r){let i;this.includeDefaultValues||(i=t.includeDefaultValues,t.includeDefaultValues=!1);let n=t[e](r);return this.includeDefaultValues||(t.includeDefaultValues=!!i),n}__serializeBgOverlay(t,e){let r={},i=this.backgroundImage,n=this.overlayImage,s=this.backgroundColor,a=this.overlayColor;return eO(s)?s.excludeFromExport||(r.background=s.toObject(e)):s&&(r.background=s),eO(a)?a.excludeFromExport||(r.overlay=a.toObject(e)):a&&(r.overlay=a),i&&!i.excludeFromExport&&(r.backgroundImage=this._toObject(i,t,e)),n&&!n.excludeFromExport&&(r.overlayImage=this._toObject(n,t,e)),r}toSVG(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;t.reviver=e;let r=[];return this._setSVGPreamble(r,t),this._setSVGHeader(r,t),this.clipPath&&r.push('\n')),this._setSVGBgOverlayColor(r,"background"),this._setSVGBgOverlayImage(r,"backgroundImage",e),this._setSVGObjects(r,e),this.clipPath&&r.push("\n"),this._setSVGBgOverlayColor(r,"overlay"),this._setSVGBgOverlayImage(r,"overlayImage",e),r.push(""),r.join("")}_setSVGPreamble(t,e){e.suppressPreamble||t.push('\n','\n')}_setSVGHeader(t,e){let r,i=e.width||"".concat(this.width),n=e.height||"".concat(this.height),s=ts.NUM_FRACTION_DIGITS,a=e.viewBox;if(a)r='viewBox="'.concat(a.x," ").concat(a.y," ").concat(a.width," ").concat(a.height,'" ');else if(this.svgViewportTransformation){let t=this.viewportTransform;r='viewBox="'.concat(eS(-t[4]/t[0],s)," ").concat(eS(-t[5]/t[3],s)," ").concat(eS(this.width/t[0],s)," ").concat(eS(this.height/t[3],s),'" ')}else r='viewBox="0 0 '.concat(this.width," ").concat(this.height,'" ');t.push("\n',"Created with Fabric.js ",tv,"\n","\n",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(e),"\n")}createSVGClipPathMarkup(t){let e=this.clipPath;return e?(e.clipPathId="CLIPPATH_".concat(t9()),'\n').concat(e.toClipPathSVG(t.reviver),"\n")):""}createSVGRefElementsMarkup(){return["background","overlay"].map(t=>{let e=this["".concat(t,"Color")];if(eO(e)){let r=this["".concat(t,"Vpt")],i=this.viewportTransform,n={isType:()=>!1,width:this.width/(r?i[0]:1),height:this.height/(r?i[3]:1)};return e.toSVG(n,{additionalTransform:r?eT(i):""})}}).join("")}createSVGFontFacesMarkup(){let t=[],e={},r=ts.fontPaths;this._objects.forEach(function e(r){t.push(r),t0(r)&&r._objects.forEach(e)}),t.forEach(t=>{if(!t||"function"!=typeof t._renderText)return;let{styles:i,fontFamily:n}=t;!e[n]&&r[n]&&(e[n]=!0,i&&Object.values(i).forEach(t=>{Object.values(t).forEach(t=>{let{fontFamily:i=""}=t;!e[i]&&r[i]&&(e[i]=!0)})}))});let i=Object.keys(e).map(t=>" @font-face {\n font-family: '".concat(t,"';\n src: url('").concat(r[t],"');\n }\n")).join("");return i?' \n"):""}_setSVGObjects(t,e){this.forEachObject(r=>{r.excludeFromExport||this._setSVGObject(t,r,e)})}_setSVGObject(t,e,r){t.push(e.toSVG(r))}_setSVGBgOverlayImage(t,e,r){let i=this[e];i&&!i.excludeFromExport&&i.toSVG&&t.push(i.toSVG(r))}_setSVGBgOverlayColor(t,e){let r=this["".concat(e,"Color")];if(r)if(eO(r)){let i=r.repeat||"",n=this.width,s=this.height,a=this["".concat(e,"Vpt")]?eT(ea(this.viewportTransform)):"";t.push('\n'))}else t.push('\n")}loadFromJSON(t,e){let{signal:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return Promise.reject(new to("`json` is undefined"));let i="string"==typeof t?JSON.parse(t):t,{objects:n=[],backgroundImage:s,background:a,overlayImage:o,overlay:l,clipPath:h}=i,c=this.renderOnAddRemove;return this.renderOnAddRemove=!1,Promise.all([eb(n,{reviver:e,signal:r}),e_({backgroundImage:s,backgroundColor:a,overlayImage:o,overlayColor:l,clipPath:h},{signal:r})]).then(t=>{let[e,r]=t;return this.clear(),this.add(...e),this.set(i),this.set(r),this.renderOnAddRemove=c,this})}clone(t){let e=this.toObject(t);return this.cloneWithoutData().loadFromJSON(e)}cloneWithoutData(){let t=t7(this);return new this.constructor(t)}toDataURL(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{format:e="png",quality:r=1,multiplier:i=1,enableRetinaScaling:n=!1}=t,s=i*(n?this.getRetinaScaling():1);return et(this.toCanvasElement(s,t),e,r)}toBlob(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{format:e="png",quality:r=1,multiplier:i=1,enableRetinaScaling:n=!1}=t,s=i*(n?this.getRetinaScaling():1);return ee(this.toCanvasElement(s,t),e,r)}toCanvasElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,{width:e,height:r,left:i,top:n,filter:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=(e||this.width)*t,o=(r||this.height)*t,l=this.getZoom(),h=this.width,c=this.height,u=this.skipControlsDrawing,d=l*t,f=this.viewportTransform,g=[d,0,0,d,(f[4]-(i||0))*t,(f[5]-(n||0))*t],p=this.enableRetinaScaling,m=t7({width:a,height:o}),y=s?this._objects.filter(t=>s(t)):this._objects;return this.enableRetinaScaling=!1,this.viewportTransform=g,this.width=a,this.height=o,this.skipControlsDrawing=!0,this.calcViewportBoundaries(),this.renderCanvas(m.getContext("2d"),y),this.viewportTransform=f,this.width=h,this.height=c,this.calcViewportBoundaries(),this.enableRetinaScaling=p,this.skipControlsDrawing=u,m}dispose(){return this.disposed||this.elements.cleanupDOM({width:this.width,height:this.height}),tG.cancelByCanvas(this),this.disposed=!0,new Promise((t,e)=>{let r=()=>{this.destroy(),t(!0)};r.kill=e,this.__cleanupTask&&this.__cleanupTask.kill("aborted"),this.destroyed?t(!1):this.nextRenderHandle?this.__cleanupTask=r:r()})}destroy(){this.destroyed=!0,this.cancelRequestedRender(),this.forEachObject(t=>t.dispose()),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose(),this.backgroundImage=void 0,this.overlayImage&&this.overlayImage.dispose(),this.overlayImage=void 0,this.elements.dispose()}toString(){return"#")}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),Object.assign(this,this.constructor.getDefaults()),this.set(e),this.initElements(t),this._setDimensionsImpl({width:this.width||this.elements.lower.el.width||0,height:this.height||this.elements.lower.el.height||0}),this.skipControlsDrawing=!1,this.viewportTransform=[...this.viewportTransform],this.calcViewportBoundaries()}}$(eB,"ownDefaults",eI);let eN=["touchstart","touchmove","touchend"],eW=t=>{let e=eD(t.target),r=function(t){let e=t.changedTouches;return e&&e[0]?e[0]:t}(t);return new tZ(r.clientX+e.left,r.clientY+e.top)},eU=t=>eN.includes(t.type)||"touch"===t.pointerType,eH=t=>{t.preventDefault(),t.stopPropagation()},eX=t=>{let e=0,r=0,i=0,n=0;for(let s=0,a=t.length;si||!s)&&(i=a),(an||!s)&&(n=o),(oeY(t,eo(e,t.calcOwnMatrix())),eY=(t,e)=>{let r=ec(e),{translateX:i,translateY:n,scaleX:s,scaleY:a}=r,o=tr(r,eV),l=new tZ(i,n);t.flipX=!1,t.flipY=!1,Object.assign(t,o),t.set({scaleX:s,scaleY:a}),t.setPositionByOrigin(l,tC,tC)},eG=t=>{t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},eq=t=>({scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}),eK=(t,e,r)=>{let i=t/2,n=e/2,s=eX([new tZ(-i,-n),new tZ(i,-n),new tZ(-i,n),new tZ(i,n)].map(t=>t.transform(r)));return new tZ(s.width,s.height)},eQ=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tw;return eo(ea(arguments.length>1&&void 0!==arguments[1]?arguments[1]:tw),t)},eJ=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tw,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:tw;return t.transform(eQ(e,r))},eZ=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tw,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:tw;return t.transform(eQ(e,r),!0)},e$=(t,e,r)=>{let i=eQ(e,r);return eY(t,eo(i,t.calcOwnMatrix())),i},e0=(t,e)=>{var r;let{transform:{target:i}}=e;null==(r=i.canvas)||r.fire("object:".concat(t),te(te({},e),{},{target:i})),i.fire(t,e)},e1={left:-.5,top:-.5,center:0,bottom:.5,right:.5},e2=t=>"string"==typeof t?e1[t]:t-.5,e5="not-allowed";function e4(t){return e2(t.originX)===e2(tC)&&e2(t.originY)===e2(tC)}let e3=(t,e)=>t[e],e9=(t,e,r,i)=>({e:t,transform:e,pointer:new tZ(r,i)});function e6(t,e){return Math.round((t.getTotalAngle()+ei(Math.atan2(e.y,e.x))+360)%360/45)}function e8(t,e,r,i,n){var s;let{target:a,corner:o}=t,l=a.controls[o],h=(null==(s=a.canvas)?void 0:s.getZoom())||1,c=a.padding/h,u=function(t,e,r,i){let n=t.getRelativeCenterPoint(),s=void 0!==r&&void 0!==i?t.translateToGivenOrigin(n,tC,tC,r,i):new tZ(t.left,t.top);return(t.angle?e.rotate(-er(t.angle),n):e).subtract(s)}(a,new tZ(i,n),e,r);return u.x>=c&&(u.x-=c),u.x<=-c&&(u.x+=c),u.y>=c&&(u.y-=c),u.y<=c&&(u.y+=c),u.x-=l.offsetX,u.y-=l.offsetY,u}let e7=(t,e,r,i)=>{let{target:n,offsetX:s,offsetY:a}=e,o=r-s,l=i-a,h=!e3(n,"lockMovementX")&&n.left!==o,c=!e3(n,"lockMovementY")&&n.top!==l;return h&&n.set(tS,o),c&&n.set("top",l),(h||c)&&e0(tE,e9(t,e,r,i)),h||c},rt={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#789",lightslategrey:"#789",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#639",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32"},re=(t,e,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t),rr=(t,e,r,i)=>{let n,s;t/=255;let a=Math.max(t,e/=255,r/=255),o=Math.min(t,e,r),l=(a+o)/2;if(a===o)n=s=0;else{let i=a-o;switch(s=l>.5?i/(2-a-o):i/(a+o),a){case t:n=(e-r)/i+6*(e0&&void 0!==arguments[0]?arguments[0]:"1";return parseFloat(t)/(t.endsWith("%")?100:1)},rn=t=>Math.min(Math.round(t),255).toString(16).toUpperCase().padStart(2,"0"),rs=t=>{let[e,r,i,n=1]=t,s=Math.round(.3*e+.59*r+.11*i);return[s,s,s,n]};class ra{_tryParsingColor(t){return(t=t.toLowerCase())in rt&&(t=rt[t]),"transparent"===t?[255,255,255,0]:ra.sourceFromHex(t)||ra.sourceFromRgb(t)||ra.sourceFromHsl(t)||(this.isUnrecognised=!0,[0,0,0,1])}getSource(){return this._source}setSource(t){this._source=t}toRgb(){let[t,e,r]=this.getSource();return"rgb(".concat(t,",").concat(e,",").concat(r,")")}toRgba(){return"rgba(".concat(this.getSource().join(","),")")}toHsl(){let[t,e,r]=rr(...this.getSource());return"hsl(".concat(t,",").concat(e,"%,").concat(r,"%)")}toHsla(){let[t,e,r,i]=rr(...this.getSource());return"hsla(".concat(t,",").concat(e,"%,").concat(r,"%,").concat(i,")")}toHex(){return this.toHexa().slice(0,6)}toHexa(){let[t,e,r,i]=this.getSource();return"".concat(rn(t)).concat(rn(e)).concat(rn(r)).concat(rn(Math.round(255*i)))}getAlpha(){return this.getSource()[3]}setAlpha(t){return this._source[3]=t,this}toGrayscale(){return this.setSource(rs(this.getSource())),this}toBlackWhite(t){let[e,,,r]=rs(this.getSource()),i=e<(t||127)?0:255;return this.setSource([i,i,i,r]),this}overlayWith(t){t instanceof ra||(t=new ra(t));let e=this.getSource(),r=t.getSource(),[i,n,s]=e.map((t,e)=>Math.round(.5*t+.5*r[e]));return this.setSource([i,n,s,e[3]]),this}static fromRgb(t){return ra.fromRgba(t)}static fromRgba(t){return new ra(ra.sourceFromRgb(t))}static sourceFromRgb(t){let e=t.match(/^rgba?\(\s*(\d{0,3}(?:\.\d+)?%?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*(?:\s*[,/]\s*(\d{0,3}(?:\.\d+)?%?)\s*)?\)$/i);if(e){let[t,r,i]=e.slice(1,4).map(t=>{let e=parseFloat(t);return t.endsWith("%")?Math.round(2.55*e):e});return[t,r,i,ri(e[4])]}}static fromHsl(t){return ra.fromHsla(t)}static fromHsla(t){return new ra(ra.sourceFromHsl(t))}static sourceFromHsl(t){let e,r,i,n=t.match(/^hsla?\(\s*([+-]?\d{0,3}(?:\.\d+)?(?:deg|turn|rad)?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*(?:\s*[,/]\s*(\d*(?:\.\d+)?%?)\s*)?\)$/i);if(!n)return;let s=(ra.parseAngletoDegrees(n[1])%360+360)%360/360,a=parseFloat(n[2])/100,o=parseFloat(n[3])/100;if(0===a)e=r=i=o;else{let t=o<=.5?o*(a+1):o+a-o*a,n=2*o-t;e=re(n,t,s+1/3),r=re(n,t,s),i=re(n,t,s-1/3)}return[Math.round(255*e),Math.round(255*r),Math.round(255*i),ri(n[4])]}static fromHex(t){return new ra(ra.sourceFromHex(t))}static sourceFromHex(t){if(t.match(/^#?(([0-9a-f]){3,4}|([0-9a-f]{2}){3,4})$/i)){let e=t.slice(t.indexOf("#")+1),[r,i,n,s=255]=(e.length<=4?e.split("").map(t=>t+t):e.match(/.{2}/g)).map(t=>parseInt(t,16));return[r,i,n,s/255]}}static parseAngletoDegrees(t){let e=t.toLowerCase(),r=parseFloat(e);return e.includes("rad")?ei(r):e.includes("turn")?360*r:r}constructor(t){if($(this,"isUnrecognised",!1),t)if(t instanceof ra)this.setSource([...t._source]);else if(Array.isArray(t)){let[e,r,i,n=1]=t;this.setSource([e,r,i,n])}else this.setSource(this._tryParsingColor(t));else this.setSource([0,0,0,1])}}let ro=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,r=/\D{0,2}$/.exec(t),i=parseFloat(t),n=ts.DPI;switch(null==r?void 0:r[0]){case"mm":return i*n/25.4;case"cm":return i*n/2.54;case"in":return i*n;case"pt":return i*n/72;case"pc":return i*n/72*12;case"em":return i*e;default:return i}},rl=t=>{let[e,r]=t.trim().split(" "),[i,n]=e&&e!==tk?[e.slice(1,4),e.slice(5,8)]:e===tk?[e,e]:["Mid","Mid"];return{meetOrSlice:r||"meet",alignX:i,alignY:n}},rh=function(t,e){let r,i,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e)if(e.toLive)r="url(#SVGID_".concat(e.id,")");else{let t=new ra(e),n=t.getAlpha();r=t.toRgb(),1!==n&&(i=n.toString())}else r="none";return n?"".concat(t,": ").concat(r,"; ").concat(i?"".concat(t,"-opacity: ").concat(i,"; "):""):"".concat(t,'="').concat(r,'" ').concat(i?"".concat(t,'-opacity="').concat(i,'" '):"")};class rc{getSvgStyles(t){let e=this.fillRule?this.fillRule:"nonzero",r=this.strokeWidth?this.strokeWidth:"0",i=this.strokeDashArray?this.strokeDashArray.join(" "):tk,n=this.strokeDashOffset?this.strokeDashOffset:"0",s=this.strokeLineCap?this.strokeLineCap:"butt",a=this.strokeLineJoin?this.strokeLineJoin:"miter",o=this.strokeMiterLimit?this.strokeMiterLimit:"4",l=void 0!==this.opacity?this.opacity:"1",h=this.visible?"":" visibility: hidden;",c=t?"":this.getSvgFilter(),u=rh(tH,this.fill);return rh(tX,this.stroke)+"stroke-width: "+r+"; stroke-dasharray: "+i+"; stroke-linecap: "+s+"; stroke-dashoffset: "+n+"; stroke-linejoin: "+a+"; stroke-miterlimit: "+o+"; "+u+"fill-rule: "+e+"; opacity: "+l+";"+c+h}getSvgFilter(){return this.shadow?"filter: url(#SVGID_".concat(this.shadow.id,");"):""}getSvgCommons(){return[this.id?'id="'.concat(this.id,'" '):"",this.clipPath?'clip-path="url(#'.concat(this.clipPath.clipPathId,')" '):""].join("")}getSvgTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=t?this.calcTransformMatrix():this.calcOwnMatrix(),i='transform="'.concat(eT(r));return"".concat(i).concat(e,'" ')}_toSVG(t){return[""]}toSVG(t){return this._createBaseSVGMarkup(this._toSVG(t),{reviver:t})}toClipPathSVG(t){return" "+this._createBaseClipPathSVGMarkup(this._toSVG(t),{reviver:t})}_createBaseClipPathSVGMarkup(t){let{reviver:e,additionalTransform:r=""}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[this.getSvgTransform(!0,r),this.getSvgCommons()].join(""),n=t.indexOf("COMMON_PARTS");return t[n]=i,e?e(t.join("")):t.join("")}_createBaseSVGMarkup(t){let e,{noStyle:r,reviver:i,withShadow:n,additionalTransform:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r?"":'style="'.concat(this.getSvgStyles(),'" '),o=n?'style="'.concat(this.getSvgFilter(),'" '):"",l=this.clipPath,h=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",c=l&&l.absolutePositioned,u=this.stroke,d=this.fill,f=this.shadow,g=[],p=t.indexOf("COMMON_PARTS");l&&(l.clipPathId="CLIPPATH_".concat(t9()),e='\n').concat(l.toClipPathSVG(i),"\n")),c&&g.push("\n"),g.push("\n");let m=""+a+h+(r?"":this.addPaintOrder())+" "+(s?'transform="'.concat(s,'" '):"");return t[p]=m,eO(d)&&g.push(d.toSVG(this)),eO(u)&&g.push(u.toSVG(this)),f&&g.push(f.toSVG(this)),l&&g.push(e),g.push(t.join("")),g.push("\n"),c&&g.push("\n"),i?i(g.join("")):g.join("")}addPaintOrder(){return this.paintFirst!==tH?' paint-order="'.concat(this.paintFirst,'" '):""}}function ru(t){return RegExp("^("+t.join("|")+")\\b","i")}let rd="textDecorationThickness",rf=["fontSize","fontWeight","fontFamily","fontStyle"],rg=["underline","overline","linethrough"],rp=[...rf,"lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide","pathAlign"],rm=[...rp,...rg,"textBackgroundColor","direction",rd],rv=[...rf,...rg,tX,"strokeWidth",tH,"deltaY","textBackgroundColor",rd],ry="justify",rx="justify-left",rb="justify-right",r_="justify-center",rw=String.raw(a||(a=ti(["[-+]?(?:d*.d+|d+.?)(?:[eE][-+]?d+)?"],["[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?"]))),rC=String.raw(o||(o=ti(["(?:s*,?s+|s*,s*)"],["(?:\\s*,?\\s+|\\s*,\\s*)"]))),rS=RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+rw+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+rw+"))?\\s+(.*)"),rT={cx:tS,x:tS,r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing","text-decoration-thickness":rd},rO="font-size",rk="clip-path",rM=(ru(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),ru(["symbol","image","marker","pattern","view","svg"]),ru(["symbol","g","a","svg","clipPath","defs"])),rE=(new RegExp(String.raw(l||(l=ti(["^s*(",")","(",")","(",")","(",")s*$"],["^\\s*(",")","(",")","(",")","(",")\\s*$"])),rw,rC,rw,rC,rw,rC,rw)),new tZ(1,0)),rD=new tZ,rj=(t,e)=>t.rotate(e),rA=(t,e)=>new tZ(e).subtract(t),rP=t=>t.distanceFrom(rD),rF=(t,e)=>Math.atan2(rB(t,e),rN(t,e)),rL=t=>rF(rE,t),rR=t=>t.eq(rD)?t:t.scalarDivide(rP(t)),rI=function(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return rR(new tZ(-t.y,t.x).scalarMultiply(e?1:-1))},rB=(t,e)=>t.x*e.y-t.y*e.x,rN=(t,e)=>t.x*e.x+t.y*e.y,rW=(t,e,r)=>{if(t.eq(e)||t.eq(r))return!0;let i=rB(e,r),n=rB(e,t),s=rB(r,t);return i>=0?n>=0&&s<=0:!(n<=0&&s>=0)},rU="(-?\\d+(?:\\.\\d*)?(?:px)?(?:\\s?|$))?",rH=RegExp("(?:\\s|^)"+rU+rU+"("+rw+"?(?:px)?)?(?:\\s?|$)(?:$|\\s)");class rX{static parseShadow(t){let e=t.trim(),[,r=0,i=0,n=0]=(rH.exec(e)||[]).map(t=>parseFloat(t)||0);return{color:(e.replace(rH,"")||"rgb(0,0,0)").trim(),offsetX:r,offsetY:i,blur:n}}toString(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")}toSVG(t){let e=rj(new tZ(this.offsetX,this.offsetY),er(-t.angle)),r=new ra(this.color),i=40,n=40;return t.width&&t.height&&(i=100*eS((Math.abs(e.x)+this.blur)/t.width,ts.NUM_FRACTION_DIGITS)+20,n=100*eS((Math.abs(e.y)+this.blur)/t.height,ts.NUM_FRACTION_DIGITS)+20),t.flipX&&(e.x*=-1),t.flipY&&(e.y*=-1),'\n \n \n \n \n \n \n \n \n\n')}toObject(){let t={color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling,type:this.constructor.type},e=rX.ownDefaults;return this.includeDefaultValues?t:eC(t,(t,r)=>t!==e[r])}static async fromObject(t){return new this(t)}constructor(t){let e="string"==typeof t?rX.parseShadow(t):t;Object.assign(this,rX.ownDefaults,e),this.id=t9()}}$(rX,"ownDefaults",{color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1}),$(rX,"type","shadow"),tY.setClass(rX,"shadow");let rV=(t,e,r)=>Math.max(t,Math.min(e,r)),rz=["top",tS,tB,tN,"flipX","flipY","originX","originY","angle","opacity","globalCompositeOperation","shadow","visible",tW,tU],rY=[tH,tX,"strokeWidth","strokeDashArray","width","height","paintFirst","strokeUniform","strokeLineCap","strokeDashOffset","strokeLineJoin","strokeMiterLimit","backgroundColor","clipPath"],rG=(t,e,r,i)=>(tt*Math.pow(2,10*(i-=1))*Math.sin((i*n-e)*tb/r),rK=(t,e,r,i)=>-r*Math.cos(t/i*tx)+r+e,rQ=(t,e,r,i)=>(t/=i)<1/2.75?7.5625*t*t*r+e:t<2/2.75?r*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?r*(7.5625*(t-=2.25/2.75)*t+.9375)+e:r*(7.5625*(t-=2.625/2.75)*t+.984375)+e,rJ=(t,e,r,i)=>r-rQ(i-t,0,r,i)+e;var rZ=Object.freeze({__proto__:null,defaultEasing:rK,easeInBack:function(t,e,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1.70158;return r*(t/=i)*t*((n+1)*t-n)+e},easeInBounce:rJ,easeInCirc:(t,e,r,i)=>-r*(Math.sqrt(1-(t/=i)*t)-1)+e,easeInCubic:(t,e,r,i)=>r*(t/i)**3+e,easeInElastic:(t,e,r,i)=>{let n=0;if(0===t)return e;if(1==(t/=i))return e+r;n||(n=.3*i);let{a:s,s:a,p:o}=rG(r,r,n,1.70158);return-rq(s,a,o,t,i)+e},easeInExpo:(t,e,r,i)=>0===t?e:r*2**(10*(t/i-1))+e,easeInOutBack:function(t,e,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1.70158;return(t/=i/2)<1?r/2*(t*t*((1+(n*=1.525))*t-n))+e:r/2*((t-=2)*t*((1+(n*=1.525))*t+n)+2)+e},easeInOutBounce:(t,e,r,i)=>t(t/=i/2)<1?-r/2*(Math.sqrt(1-t**2)-1)+e:r/2*(Math.sqrt(1-(t-=2)*t)+1)+e,easeInOutCubic:(t,e,r,i)=>(t/=i/2)<1?r/2*t**3+e:r/2*((t-2)**3+2)+e,easeInOutElastic:(t,e,r,i)=>{let n=0;if(0===t)return e;if(2==(t/=i/2))return e+r;n||(n=.3*1.5*i);let{a:s,s:a,p:o,c:l}=rG(r,r,n,1.70158);return t<1?-.5*rq(s,a,o,t,i)+e:s*Math.pow(2,-10*(t-=1))*Math.sin((t*i-a)*tb/o)*.5+l+e},easeInOutExpo:(t,e,r,i)=>0===t?e:t===i?e+r:(t/=i/2)<1?r/2*2**(10*(t-1))+e:-(r/2*(2**(-10*--t)+2))+e,easeInOutQuad:(t,e,r,i)=>(t/=i/2)<1?r/2*t**2+e:-r/2*(--t*(t-2)-1)+e,easeInOutQuart:(t,e,r,i)=>(t/=i/2)<1?r/2*t**4+e:-r/2*((t-=2)*t**3-2)+e,easeInOutQuint:(t,e,r,i)=>(t/=i/2)<1?r/2*t**5+e:r/2*((t-2)**5+2)+e,easeInOutSine:(t,e,r,i)=>-r/2*(Math.cos(Math.PI*t/i)-1)+e,easeInQuad:(t,e,r,i)=>r*(t/=i)*t+e,easeInQuart:(t,e,r,i)=>r*(t/=i)*t**3+e,easeInQuint:(t,e,r,i)=>r*(t/i)**5+e,easeInSine:(t,e,r,i)=>-r*Math.cos(t/i*tx)+r+e,easeOutBack:function(t,e,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1.70158;return r*((t=t/i-1)*t*((n+1)*t+n)+1)+e},easeOutBounce:rQ,easeOutCirc:(t,e,r,i)=>r*Math.sqrt(1-(t=t/i-1)*t)+e,easeOutCubic:(t,e,r,i)=>r*((t/i-1)**3+1)+e,easeOutElastic:(t,e,r,i)=>{let n=0;if(0===t)return e;if(1==(t/=i))return e+r;n||(n=.3*i);let{a:s,s:a,p:o,c:l}=rG(r,r,n,1.70158);return s*2**(-10*t)*Math.sin((t*i-a)*tb/o)+l+e},easeOutExpo:(t,e,r,i)=>t===i?e+r:-(r*(2**(-10*t/i)+1))+e,easeOutQuad:(t,e,r,i)=>-r*(t/=i)*(t-2)+e,easeOutQuart:(t,e,r,i)=>-r*((t=t/i-1)*t**3-1)+e,easeOutQuint:(t,e,r,i)=>r*((t/i-1)**5+1)+e,easeOutSine:(t,e,r,i)=>r*Math.sin(t/i*tx)+e});let r$=()=>!1;class r0{get state(){return this._state}isDone(){return"aborted"===this._state||"completed"===this._state}start(){let t=t=>{"pending"===this._state&&(this.startTime=t||+new Date,this._state="running",this._onStart(),this.tick(this.startTime))};this.register(),this.delay>0?setTimeout(()=>t5(t),this.delay):t5(t)}tick(t){let e=(t||+new Date)-this.startTime,r=Math.min(e,this.duration);this.durationProgress=r/this.duration;let{value:i,valueProgress:n}=this.calculate(r);this.value=Object.freeze(i),this.valueProgress=n,"aborted"!==this._state&&(this._abort(this.value,this.valueProgress,this.durationProgress)?(this._state="aborted",this.unregister()):e>=this.duration?(this.durationProgress=this.valueProgress=1,this._onChange(this.endValue,this.valueProgress,this.durationProgress),this._state="completed",this._onComplete(this.endValue,this.valueProgress,this.durationProgress),this.unregister()):(this._onChange(this.value,this.valueProgress,this.durationProgress),t5(this.tick)))}register(){tG.push(this)}unregister(){tG.remove(this)}abort(){this._state="aborted",this.unregister()}constructor(t){let{startValue:e,byValue:r,duration:i=500,delay:n=0,easing:s=rK,onStart:a=ty,onChange:o=ty,onComplete:l=ty,abort:h=r$,target:c}=t;$(this,"_state","pending"),$(this,"durationProgress",0),$(this,"valueProgress",0),this.tick=this.tick.bind(this),this.duration=i,this.delay=n,this.easing=s,this._onStart=a,this._onChange=o,this._onComplete=l,this._abort=h,this.target=c,this.startValue=e,this.byValue=r,this.value=this.startValue,this.endValue=Object.freeze(this.calculate(this.duration).value)}}let r1=["startValue","endValue"];class r2 extends r0{calculate(t){let e=this.easing(t,this.startValue,this.byValue,this.duration);return{value:e,valueProgress:Math.abs((e-this.startValue)/this.byValue)}}constructor(t){let{startValue:e=0,endValue:r=100}=t;super(te(te({},tr(t,r1)),{},{startValue:e,byValue:r-e}))}}let r5=["startValue","endValue"];class r4 extends r0{calculate(t){let e=this.startValue.map((e,r)=>this.easing(t,e,this.byValue[r],this.duration,r));return{value:e,valueProgress:Math.abs((e[0]-this.startValue[0])/this.byValue[0])}}constructor(t){let{startValue:e=[0],endValue:r=[100]}=t;super(te(te({},tr(t,r5)),{},{startValue:e,byValue:r.map((t,r)=>t-e[r])}))}}let r3=["startValue","endValue","easing","onChange","onComplete","abort"],r9=(t,e,r,i)=>e+r*(1-Math.cos(t/i*tx)),r6=t=>t&&((e,r,i)=>t(new ra(e).toRgba(),r,i));class r8 extends r0{calculate(t){let[e,r,i,n]=this.startValue.map((e,r)=>this.easing(t,e,this.byValue[r],this.duration,r)),s=[...[e,r,i].map(Math.round),rV(0,n,1)];return{value:s,valueProgress:s.map((t,e)=>0!==this.byValue[e]?Math.abs((t-this.startValue[e])/this.byValue[e]):0).find(t=>0!==t)||0}}constructor(t){let{startValue:e,endValue:r,easing:i=r9,onChange:n,onComplete:s,abort:a}=t,o=tr(t,r3),l=new ra(e).getSource();super(te(te({},o),{},{startValue:l,byValue:new ra(r).getSource().map((t,e)=>t-l[e]),easing:i,onChange:r6(n),onComplete:r6(s),abort:r6(a)}))}}function r7(t){let e=Array.isArray(t.startValue)||Array.isArray(t.endValue)?new r4(t):new r2(t);return e.start(),e}function it(t){let e=new r8(t);return e.start(),e}class ie{includes(t){return this.points.some(e=>e.eq(t))}append(){for(var t=arguments.length,e=Array(t),r=0;r!this.includes(t))),this}static isPointContained(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.eq(r))return t.eq(e);if(e.x===r.x)return t.x===e.x&&(i||t.y>=Math.min(e.y,r.y)&&t.y<=Math.max(e.y,r.y));if(e.y===r.y)return t.y===e.y&&(i||t.x>=Math.min(e.x,r.x)&&t.x<=Math.max(e.x,r.x));{let n=rA(e,r),s=rA(e,t).divide(n);return i?Math.abs(s.x)===Math.abs(s.y):s.x===s.y&&s.x>=0&&s.x<=1}}static isPointInPolygon(t,e){let r=new tZ(t).setX(Math.min(t.x-1,...e.map(t=>t.x))),i=0;for(let n=0;n4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],a=e.x-t.x,o=e.y-t.y,l=i.x-r.x,h=i.y-r.y,c=t.x-r.x,u=t.y-r.y,d=l*u-h*c,f=a*u-o*c,g=h*a-l*o;if(0!==g){let e=d/g,r=f/g;return(n||0<=e&&e<=1)&&(s||0<=r&&r<=1)?new ie("Intersection").append(new tZ(t.x+e*a,t.y+e*o)):new ie}if(0===d||0===f){let a=n||s||ie.isPointContained(t,r,i)||ie.isPointContained(e,r,i)||ie.isPointContained(r,t,e)||ie.isPointContained(i,t,e);return new ie(a?"Coincident":void 0)}return new ie("Parallel")}static intersectSegmentLine(t,e,r,i){return ie.intersectLineLine(t,e,r,i,!1,!0)}static intersectSegmentSegment(t,e,r,i){return ie.intersectLineLine(t,e,r,i,!1,!1)}static intersectLinePolygon(t,e,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=new ie,s=r.length;for(let a,o,l,h=0;h0&&(n.status="Intersection"),n}static intersectSegmentPolygon(t,e,r){return ie.intersectLinePolygon(t,e,r,!1)}static intersectPolygonPolygon(t,e){let r=new ie,i=t.length,n=[];for(let s=0;s0&&n.length===t.length?new ie("Coincident"):(r.points.length>0&&(r.status="Intersection"),r)}static intersectPolygonRectangle(t,e,r){let i=e.min(r),n=e.max(r),s=new tZ(n.x,i.y),a=new tZ(i.x,n.y);return ie.intersectPolygonPolygon(t,[i,s,n,a])}constructor(t){this.status=t,this.points=[]}}class ir extends t2{getX(){return this.getXY().x}setX(t){this.setXY(this.getXY().setX(t))}getY(){return this.getXY().y}setY(t){this.setXY(this.getXY().setY(t))}getRelativeX(){return this.left}setRelativeX(t){this.left=t}getRelativeY(){return this.top}setRelativeY(t){this.top=t}getXY(){let t=this.getRelativeXY();return this.group?es(t,this.group.calcTransformMatrix()):t}setXY(t,e,r){this.group&&(t=es(t,ea(this.group.calcTransformMatrix()))),this.setRelativeXY(t,e,r)}getRelativeXY(){return new tZ(this.left,this.top)}setRelativeXY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.originX,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.originY;this.setPositionByOrigin(t,e,r)}isStrokeAccountedForInDimensions(){return!1}getCoords(){let{tl:t,tr:e,br:r,bl:i}=this.aCoords||(this.aCoords=this.calcACoords()),n=[t,e,r,i];if(this.group){let t=this.group.calcTransformMatrix();return n.map(e=>es(e,t))}return n}intersectsWithRect(t,e){return"Intersection"===ie.intersectPolygonRectangle(this.getCoords(),t,e).status}intersectsWithObject(t){let e=ie.intersectPolygonPolygon(this.getCoords(),t.getCoords());return"Intersection"===e.status||"Coincident"===e.status||t.isContainedWithinObject(this)||this.isContainedWithinObject(t)}isContainedWithinObject(t){return this.getCoords().every(e=>t.containsPoint(e))}isContainedWithinRect(t,e){let{left:r,top:i,width:n,height:s}=this.getBoundingRect();return r>=t.x&&r+n<=e.x&&i>=t.y&&i+s<=e.y}isOverlapping(t){return this.intersectsWithObject(t)||this.isContainedWithinObject(t)||t.isContainedWithinObject(this)}containsPoint(t){return ie.isPointInPolygon(t,this.getCoords())}isOnScreen(){if(!this.canvas)return!1;let{tl:t,br:e}=this.canvas.vptCoords;return!!this.getCoords().some(r=>r.x<=e.x&&r.x>=t.x&&r.y<=e.y&&r.y>=t.y)||!!this.intersectsWithRect(t,e)||this.containsPoint(t.midPointFrom(e))}isPartiallyOnScreen(){if(!this.canvas)return!1;let{tl:t,br:e}=this.canvas.vptCoords;return!!this.intersectsWithRect(t,e)||this.getCoords().every(r=>(r.x>=e.x||r.x<=t.x)&&(r.y>=e.y||r.y<=t.y))&&this.containsPoint(t.midPointFrom(e))}getBoundingRect(){return eX(this.getCoords())}getScaledWidth(){return this._getTransformedDimensions().x}getScaledHeight(){return this._getTransformedDimensions().y}scale(t){this._set(tB,t),this._set(tN,t),this.setCoords()}scaleToWidth(t){let e=this.getBoundingRect().width/this.getScaledWidth();return this.scale(t/this.width/e)}scaleToHeight(t){let e=this.getBoundingRect().height/this.getScaledHeight();return this.scale(t/this.height/e)}getCanvasRetinaScaling(){var t;return(null==(t=this.canvas)?void 0:t.getRetinaScaling())||1}getTotalAngle(){return this.group?ei(eh(this.calcTransformMatrix())):this.angle}getViewportTransform(){var t;return(null==(t=this.canvas)?void 0:t.viewportTransform)||tw.concat()}calcACoords(){let t=ed({angle:this.angle}),{x:e,y:r}=this.getRelativeCenterPoint(),i=eo(eu(e,r),t),n=this._getTransformedDimensions(),s=n.x/2,a=n.y/2;return{tl:es({x:-s,y:-a},i),tr:es({x:s,y:-a},i),bl:es({x:-s,y:a},i),br:es({x:s,y:a},i)}}setCoords(){this.aCoords=this.calcACoords()}transformMatrixKey(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=[];return!t&&this.group&&(e=this.group.transformMatrixKey(t)),e.push(this.top,this.left,this.width,this.height,this.scaleX,this.scaleY,this.angle,this.strokeWidth,this.skewX,this.skewY,+this.flipX,+this.flipY,e2(this.originX),e2(this.originY)),e}calcTransformMatrix(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.calcOwnMatrix();if(t||!this.group)return e;let r=this.transformMatrixKey(t),i=this.matrixCache;return i&&i.key.every((t,e)=>t===r[e])?i.value:(this.group&&(e=eo(this.group.calcTransformMatrix(!1),e)),this.matrixCache={key:r,value:e},e)}calcOwnMatrix(){let t=this.transformMatrixKey(!0),e=this.ownMatrixCache;if(e&&e.key===t)return e.value;let r=this.getRelativeCenterPoint(),i=ey({angle:this.angle,translateX:r.x,translateY:r.y,scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY});return this.ownMatrixCache={key:t,value:i},i}_getNonTransformedDimensions(){return new tZ(this.width,this.height).scalarAdd(this.strokeWidth)}_calculateCurrentDimensions(t){return this._getTransformedDimensions(t).transform(this.getViewportTransform(),!0).scalarAdd(2*this.padding)}_getTransformedDimensions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=te({scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,width:this.width,height:this.height,strokeWidth:this.strokeWidth},t),r=e.strokeWidth,i=r,n=0;this.strokeUniform&&(i=0,n=r);let s=e.width+i,a=e.height+i;return(0===e.skewX&&0===e.skewY?new tZ(s*e.scaleX,a*e.scaleY):eK(s,a,ev(e))).scalarAdd(n)}translateToGivenOrigin(t,e,r,i,n){let s=t.x,a=t.y,o=e2(i)-e2(e),l=e2(n)-e2(r);if(o||l){let t=this._getTransformedDimensions();s+=o*t.x,a+=l*t.y}return new tZ(s,a)}translateToCenterPoint(t,e,r){if(e===tC&&r===tC)return t;let i=this.translateToGivenOrigin(t,e,r,tC,tC);return this.angle?i.rotate(er(this.angle),t):i}translateToOriginPoint(t,e,r){let i=this.translateToGivenOrigin(t,tC,tC,e,r);return this.angle?i.rotate(er(this.angle),t):i}getCenterPoint(){let t=this.getRelativeCenterPoint();return this.group?es(t,this.group.calcTransformMatrix()):t}getRelativeCenterPoint(){return this.translateToCenterPoint(new tZ(this.left,this.top),this.originX,this.originY)}getPointByOrigin(t,e){return this.translateToOriginPoint(this.getRelativeCenterPoint(),t,e)}setPositionByOrigin(t,e,r){let i=this.translateToCenterPoint(t,e,r),n=this.translateToOriginPoint(i,this.originX,this.originY);this.set({left:n.x,top:n.y})}_getLeftTopCoords(){return this.translateToOriginPoint(this.getRelativeCenterPoint(),tS,"top")}}let ii=["type"],is=["extraParam"],ia=class t extends ir{static getDefaults(){return t.ownDefaults}get type(){let t=this.constructor.type;return"FabricObject"===t?"object":t.toLowerCase()}set type(t){ta("warn","Setting type has no effect",t)}_createCacheCanvas(){this._cacheCanvas=t6(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0}_limitCacheSize(t){let e=t.width,r=t.height,i=ts.maxCacheSideLimit,n=ts.minCacheSideLimit;if(e<=i&&r<=i&&e*r<=ts.perfLimitSizeTotal)return eo&&(t.zoomX/=e/o,t.width=o,t.capped=!0),r>l&&(t.zoomY/=r/l,t.height=l,t.capped=!0),t}_getCacheCanvasDimensions(){let t=this.getTotalObjectScaling(),e=this._getTransformedDimensions({skewX:0,skewY:0}),r=e.x*t.x/this.scaleX,i=e.y*t.y/this.scaleY;return{width:Math.ceil(r+2),height:Math.ceil(i+2),zoomX:t.x,zoomY:t.y,x:r,y:i}}_updateCacheCanvas(){let t=this._cacheCanvas,e=this._cacheContext,{width:r,height:i,zoomX:n,zoomY:s,x:a,y:o}=this._limitCacheSize(this._getCacheCanvasDimensions()),l=r!==t.width||i!==t.height,h=this.zoomX!==n||this.zoomY!==s;if(!t||!e)return!1;if(l||h){r!==t.width||i!==t.height?(t.width=r,t.height=i):(e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height));let l=a/2,h=o/2;return this.cacheTranslationX=Math.round(t.width/2-l)+l,this.cacheTranslationY=Math.round(t.height/2-h)+h,e.translate(this.cacheTranslationX,this.cacheTranslationY),e.scale(n,s),this.zoomX=n,this.zoomY=s,!0}return!1}setOptions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._setOptions(t)}transform(t){let e=this.group&&!this.group._transformDone||this.group&&this.canvas&&t===this.canvas.contextTop,r=this.calcTransformMatrix(!e);t.transform(r[0],r[1],r[2],r[3],r[4],r[5])}getObjectScaling(){if(!this.group)return new tZ(Math.abs(this.scaleX),Math.abs(this.scaleY));let t=ec(this.calcTransformMatrix());return new tZ(Math.abs(t.scaleX),Math.abs(t.scaleY))}getTotalObjectScaling(){let t=this.getObjectScaling();if(this.canvas){let e=this.canvas.getZoom(),r=this.getCanvasRetinaScaling();return t.scalarMultiply(e*r)}return t}getObjectOpacity(){let t=this.opacity;return this.group&&(t*=this.group.getObjectOpacity()),t}_constrainScale(t){return Math.abs(t){t.transform(i)}),e.parentClipPaths.push(t),t.absolutePositioned){let t=ea(this.calcTransformMatrix());i.transform(t[0],t[1],t[2],t[3],t[4],t[5])}return t.transform(i),t.drawObject(i,!0,e),r}_drawClipPath(t,e,r){if(!e)return;e._transformDone=!0;let i=this.createClipPathLayer(e,r);this.drawClipPathOnCache(t,e,i)}drawCacheOnCanvas(t){t.scale(1/this.zoomX,1/this.zoomY),t.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)}isCacheDirty(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isNotVisible())return!1;let e=this._cacheCanvas,r=this._cacheContext;return!(!e||!r||t||!this._updateCacheCanvas())||!!(this.dirty||this.clipPath&&this.clipPath.absolutePositioned)&&(e&&r&&!t&&(r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.width,e.height),r.restore()),!0)}_renderBackground(t){if(!this.backgroundColor)return;let e=this._getNonTransformedDimensions();t.fillStyle=this.backgroundColor,t.fillRect(-e.x/2,-e.y/2,e.x,e.y),this._removeShadow(t)}_setOpacity(t){this.group&&!this.group._transformDone?t.globalAlpha=this.getObjectOpacity():t.globalAlpha*=this.opacity}_setStrokeStyles(t,e){let r=e.stroke;r&&(t.lineWidth=e.strokeWidth,t.lineCap=e.strokeLineCap,t.lineDashOffset=e.strokeDashOffset,t.lineJoin=e.strokeLineJoin,t.miterLimit=e.strokeMiterLimit,eO(r)?"percentage"===r.gradientUnits||r.gradientTransform||r.patternTransform?this._applyPatternForTransformedGradient(t,r):(t.strokeStyle=r.toLive(t),this._applyPatternGradientTransform(t,r)):t.strokeStyle=e.stroke)}_setFillStyles(t,e){let{fill:r}=e;r&&(eO(r)?(t.fillStyle=r.toLive(t),this._applyPatternGradientTransform(t,r)):t.fillStyle=r)}_setClippingProperties(t){t.globalAlpha=1,t.strokeStyle="transparent",t.fillStyle="#000000"}_setLineDash(t,e){e&&0!==e.length&&t.setLineDash(e)}_setShadow(t){if(!this.shadow)return;let e=this.shadow,r=this.canvas,i=this.getCanvasRetinaScaling(),[n,,,s]=(null==r?void 0:r.viewportTransform)||tw,a=n*i,o=s*i,l=e.nonScaling?new tZ(1,1):this.getObjectScaling();t.shadowColor=e.color,t.shadowBlur=e.blur*ts.browserShadowBlurConstant*(a+o)*(l.x+l.y)/4,t.shadowOffsetX=e.offsetX*a*l.x,t.shadowOffsetY=e.offsetY*o*l.y}_removeShadow(t){this.shadow&&(t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)}_applyPatternGradientTransform(t,e){if(!eO(e))return{offsetX:0,offsetY:0};let r=e.gradientTransform||e.patternTransform,i=-this.width/2+e.offsetX||0,n=-this.height/2+e.offsetY||0;return"percentage"===e.gradientUnits?t.transform(this.width,0,0,this.height,i,n):t.transform(1,0,0,1,i,n),r&&t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),{offsetX:i,offsetY:n}}_renderPaintInOrder(t){this.paintFirst===tX?(this._renderStroke(t),this._renderFill(t)):(this._renderFill(t),this._renderStroke(t))}_render(t){}_renderFill(t){this.fill&&(t.save(),this._setFillStyles(t,this),"evenodd"===this.fillRule?t.fill("evenodd"):t.fill(),t.restore())}_renderStroke(t){if(this.stroke&&0!==this.strokeWidth){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this.strokeUniform){let e=this.getObjectScaling();t.scale(1/e.x,1/e.y)}this._setLineDash(t,this.strokeDashArray),this._setStrokeStyles(t,this),t.stroke(),t.restore()}}_applyPatternForTransformedGradient(t,e){var r;let i=this._limitCacheSize(this._getCacheCanvasDimensions()),n=this.getCanvasRetinaScaling(),s=i.x/this.scaleX/n,a=i.y/this.scaleY/n,o=t7({width:Math.ceil(s),height:Math.ceil(a)}),l=o.getContext("2d");l&&(l.beginPath(),l.moveTo(0,0),l.lineTo(s,0),l.lineTo(s,a),l.lineTo(0,a),l.closePath(),l.translate(s/2,a/2),l.scale(i.zoomX/this.scaleX/n,i.zoomY/this.scaleY/n),this._applyPatternGradientTransform(l,e),l.fillStyle=e.toLive(t),l.fill(),t.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),t.scale(n*this.scaleX/i.zoomX,n*this.scaleY/i.zoomY),t.strokeStyle=null!=(r=l.createPattern(o,"no-repeat"))?r:"")}_findCenterFromElement(){return new tZ(this.left+this.width/2,this.top+this.height/2)}clone(t){let e=this.toObject(t);return this.constructor.fromObject(e)}cloneAsImage(t){let e=this.toCanvasElement(t);return new(tY.getClass("image"))(e)}toCanvasElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=eq(this),r=this.group,i=this.shadow,n=Math.abs,s=t.enableRetinaScaling?tp():1,a=(t.multiplier||1)*s,o=t.canvasProvider||(t=>new eB(t,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1}));delete this.group,t.withoutTransform&&eG(this),t.withoutShadow&&(this.shadow=null),t.viewportTransform&&e$(this,this.getViewportTransform()),this.setCoords();let l=t6(),h=this.getBoundingRect(),c=this.shadow,u=new tZ;if(c){let t=c.blur,e=c.nonScaling?new tZ(1,1):this.getObjectScaling();u.x=2*Math.round(n(c.offsetX)+t)*n(e.x),u.y=2*Math.round(n(c.offsetY)+t)*n(e.y)}let d=h.width+u.x,f=h.height+u.y;l.width=Math.ceil(d),l.height=Math.ceil(f);let g=o(l);"jpeg"===t.format&&(g.backgroundColor="#fff"),this.setPositionByOrigin(new tZ(g.width/2,g.height/2),tC,tC);let p=this.canvas;g._objects=[this],this.set("canvas",g),this.setCoords();let m=g.toCanvasElement(a||1,t);return this.set("canvas",p),this.shadow=i,r&&(this.group=r),this.set(e),this.setCoords(),g._objects=[],g.destroy(),m}toDataURL(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return et(this.toCanvasElement(t),t.format||"png",t.quality||1)}toBlob(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ee(this.toCanvasElement(t),t.format||"png",t.quality||1)}isType(){for(var t=arguments.length,e=Array(t),r=0;r{let[i,n]=r;return t[i]=this._animate(i,n,e),t},{})}_animate(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.split("."),n=this.constructor.colorProperties.includes(i[i.length-1]),{abort:s,startValue:a,onChange:o,onComplete:l}=r,h=te(te({},r),{},{target:this,startValue:null!=a?a:i.reduce((t,e)=>t[e],this),endValue:e,abort:null==s?void 0:s.bind(this),onChange:(t,e,r)=>{i.reduce((e,r,n)=>(n===i.length-1&&(e[r]=t),e[r]),this),o&&o(t,e,r)},onComplete:(t,e,r)=>{this.setCoords(),l&&l(t,e,r)}});return n?it(h):r7(h)}isDescendantOf(t){let{parent:e,group:r}=this;return e===t||r===t||!!e&&e.isDescendantOf(t)||!!r&&r!==e&&r.isDescendantOf(t)}getAncestors(){let t=[],e=this;do(e=e.parent)&&t.push(e);while(e)return t}findCommonAncestors(t){if(this===t)return{fork:[],otherFork:[],common:[this,...this.getAncestors()]};let e=this.getAncestors(),r=t.getAncestors();if(0===e.length&&r.length>0&&this===r[r.length-1])return{fork:[],otherFork:[t,...r.slice(0,r.length-1)],common:[this]};for(let i,n=0;n-1&&s>a}toObject(){let e,r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).concat(t.customProperties,this.constructor.customProperties||[]),i=ts.NUM_FRACTION_DIGITS,{clipPath:n,fill:s,stroke:a,shadow:o,strokeDashArray:l,left:h,top:c,originX:u,originY:d,width:f,height:g,strokeWidth:p,strokeLineCap:m,strokeDashOffset:y,strokeLineJoin:x,strokeUniform:b,strokeMiterLimit:_,scaleX:w,scaleY:C,angle:S,flipX:T,flipY:O,opacity:k,visible:M,backgroundColor:E,fillRule:D,paintFirst:j,globalCompositeOperation:A,skewX:P,skewY:F}=this;n&&!n.excludeFromExport&&(e=n.toObject(r.concat("inverted","absolutePositioned")));let L=t=>eS(t,i),R=te(te({},ew(this,r)),{},{type:this.constructor.type,version:tv,originX:u,originY:d,left:L(h),top:L(c),width:L(f),height:L(g),fill:ek(s)?s.toObject():s,stroke:ek(a)?a.toObject():a,strokeWidth:L(p),strokeDashArray:l?l.concat():l,strokeLineCap:m,strokeDashOffset:y,strokeLineJoin:x,strokeUniform:b,strokeMiterLimit:L(_),scaleX:L(w),scaleY:L(C),angle:L(S),flipX:T,flipY:O,opacity:L(k),shadow:o?o.toObject():o,visible:M,backgroundColor:E,fillRule:D,paintFirst:j,globalCompositeOperation:A,skewX:L(P),skewY:L(F)},e?{clipPath:e}:null);return this.includeDefaultValues?R:this._removeDefaultValues(R)}toDatalessObject(t){return this.toObject(t)}_removeDefaultValues(t){let e=this.constructor.getDefaults(),r=Object.keys(e).length>0?e:Object.getPrototypeOf(this);return eC(t,(t,e)=>{if(e===tS||"top"===e||"type"===e)return!0;let i=r[e];return t!==i&&!(Array.isArray(t)&&Array.isArray(i)&&0===t.length&&0===i.length)})}toString(){return"#<".concat(this.constructor.type,">")}static _fromObject(t){let e=tr(t,ii),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{extraParam:i}=r;return e_(e,tr(r,is)).then(t=>i?(delete t[i],new this(e[i],t)):new this(t))}static fromObject(t,e){return this._fromObject(t,e)}constructor(e){super(),$(this,"_cacheContext",null),Object.assign(this,t.ownDefaults),this.setOptions(e)}};$(ia,"stateProperties",rz),$(ia,"cacheProperties",rY),$(ia,"ownDefaults",{top:0,left:0,width:0,height:0,angle:0,flipX:!1,flipY:!1,scaleX:1,scaleY:1,minScaleLimit:0,skewX:0,skewY:0,originX:tS,originY:"top",strokeWidth:1,strokeUniform:!1,padding:0,opacity:1,paintFirst:tH,fill:"rgb(0,0,0)",fillRule:"nonzero",stroke:null,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,globalCompositeOperation:"source-over",backgroundColor:"",shadow:null,visible:!0,includeDefaultValues:!0,excludeFromExport:!1,objectCaching:!0,clipPath:void 0,inverted:!1,absolutePositioned:!1,centeredRotation:!0,centeredScaling:!1,dirty:!0}),$(ia,"type","FabricObject"),$(ia,"colorProperties",[tH,tX,"backgroundColor"]),$(ia,"customProperties",[]),tY.setClass(ia),tY.setClass(ia,"object");let io=(t,e,r)=>(i,n,s,a)=>{let o=e(i,n,s,a);return o&&e0(t,te(te({},e9(i,n,s,a)),r)),o};function il(t){return(e,r,i,n)=>{let{target:s,originX:a,originY:o}=r,l=s.getRelativeCenterPoint(),h=s.translateToOriginPoint(l,a,o),c=t(e,r,i,n);return s.setPositionByOrigin(h,r.originX,r.originY),c}}let ih=io(tF,il((t,e,r,i)=>{let n=e8(e,e.originX,e.originY,r,i);if(e2(e.originX)===e2(tC)||e2(e.originX)===e2(tO)&&n.x<0||e2(e.originX)===e2(tS)&&n.x>0){let{target:t}=e,r=t.strokeWidth/(t.strokeUniform?t.scaleX:1),i=e4(e)?2:1,s=t.width,a=Math.abs(n.x*i/t.scaleX)-r;return t.set("width",Math.max(a,1)),s!==t.width}return!1}));function ic(t,e,r,i,n){i=i||{};let s=this.sizeX||i.cornerSize||n.cornerSize,a=this.sizeY||i.cornerSize||n.cornerSize,o=void 0!==i.transparentCorners?i.transparentCorners:n.transparentCorners,l=o?tX:tH,h=!o&&(i.cornerStrokeColor||n.cornerStrokeColor),c,u=e,d=r;t.save(),t.fillStyle=i.cornerColor||n.cornerColor||"",t.strokeStyle=i.cornerStrokeColor||n.cornerStrokeColor||"",s>a?(c=s,t.scale(1,a/s),d=r*s/a):a>s?(c=a,t.scale(s/a,1),u=e*a/s):c=s,t.beginPath(),t.arc(u,d,c/2,0,tb,!1),t[l](),h&&t.stroke(),t.restore()}function iu(t,e,r,i,n){i=i||{};let s=this.sizeX||i.cornerSize||n.cornerSize,a=this.sizeY||i.cornerSize||n.cornerSize,o=void 0!==i.transparentCorners?i.transparentCorners:n.transparentCorners,l=o?tX:tH,h=!o&&(i.cornerStrokeColor||n.cornerStrokeColor),c=s/2,u=a/2;t.save(),t.fillStyle=i.cornerColor||n.cornerColor||"",t.strokeStyle=i.cornerStrokeColor||n.cornerStrokeColor||"",t.translate(e,r);let d=n.getTotalAngle();t.rotate(er(d)),t["".concat(l,"Rect")](-c,-u,s,a),h&&t.strokeRect(-c,-u,s,a),t.restore()}class id{shouldActivate(t,e,r,i){var n;let{tl:s,tr:a,br:o,bl:l}=i;return(null==(n=e.canvas)?void 0:n.getActiveObject())===e&&e.isControlVisible(t)&&ie.isPointInPolygon(r,[s,a,o,l])}getActionHandler(t,e,r){return this.actionHandler}getMouseDownHandler(t,e,r){return this.mouseDownHandler}getMouseUpHandler(t,e,r){return this.mouseUpHandler}cursorStyleHandler(t,e,r){return e.cursorStyle}getActionName(t,e,r){return e.actionName}getVisibility(t,e){var r,i;return null!=(r=null==(i=t._controlsVisibility)?void 0:i[e])?r:this.visible}setVisibility(t,e,r){this.visible=t}positionHandler(t,e,r,i){return new tZ(this.x*t.x+this.offsetX,this.y*t.y+this.offsetY).transform(e)}calcCornerCoords(t,e,r,i,n,s){let a=el([eu(r,i),ed({angle:t}),ef((n?this.touchSizeX:this.sizeX)||e,(n?this.touchSizeY:this.sizeY)||e)]);return{tl:new tZ(-.5,-.5).transform(a),tr:new tZ(.5,-.5).transform(a),br:new tZ(.5,.5).transform(a),bl:new tZ(-.5,.5).transform(a)}}render(t,e,r,i,n){"circle"===((i=i||{}).cornerStyle||n.cornerStyle)?ic.call(this,t,e,r,i,n):iu.call(this,t,e,r,i,n)}constructor(t){$(this,"visible",!0),$(this,"actionName",tI),$(this,"angle",0),$(this,"x",0),$(this,"y",0),$(this,"offsetX",0),$(this,"offsetY",0),$(this,"sizeX",0),$(this,"sizeY",0),$(this,"touchSizeX",0),$(this,"touchSizeY",0),$(this,"cursorStyle","crosshair"),$(this,"withConnection",!1),Object.assign(this,t)}}let ig=(t,e,r)=>r.lockRotation?e5:e.cursorStyle,ip=io(tj,il((t,e,r,i)=>{let{target:n,ex:s,ey:a,theta:o,originX:l,originY:h}=e,c=n.translateToOriginPoint(n.getRelativeCenterPoint(),l,h);if(e3(n,"lockRotation"))return!1;let u=Math.atan2(a-c.y,s-c.x),d=ei(Math.atan2(i-c.y,r-c.x)-u+o);if(n.snapAngle&&n.snapAngle>0){let t=n.snapAngle,e=n.snapThreshold||t,r=Math.ceil(d/t)*t,i=Math.floor(d/t)*t;Math.abs(d-i){let i=im(t,r);if(iv(r,0!==e.x&&0===e.y?"x":0===e.x&&0!==e.y?"y":"",i))return e5;let n=e6(r,e);return"".concat(iy[n],"-resize")};function ib(t,e,r,i){let n,s,a,o,l,h,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},u=e.target,d=c.by,f=im(t,u);if(iv(u,d,f))return!1;if(e.gestureScale)s=e.scaleX*e.gestureScale,a=e.scaleY*e.gestureScale;else{if(n=e8(e,e.originX,e.originY,r,i),l="y"!==d?Math.sign(n.x||e.signX||1):1,h="x"!==d?Math.sign(n.y||e.signY||1):1,e.signX||(e.signX=l),e.signY||(e.signY=h),e3(u,"lockScalingFlip")&&(e.signX!==l||e.signY!==h))return!1;if(o=u._getTransformedDimensions(),f&&!d){let t=Math.abs(n.x)+Math.abs(n.y),{original:r}=e,i=t/(Math.abs(o.x*r.scaleX/u.scaleX)+Math.abs(o.y*r.scaleY/u.scaleY));s=r.scaleX*i,a=r.scaleY*i}else s=Math.abs(n.x*u.scaleX/o.x),a=Math.abs(n.y*u.scaleY/o.y);e4(e)&&(s*=2,a*=2),e.signX!==l&&"y"!==d&&(e.originX=.5-e2(e.originX),s*=-1,e.signX=l),e.signY!==h&&"x"!==d&&(e.originY=.5-e2(e.originY),a*=-1,e.signY=h)}let g=u.scaleX,p=u.scaleY;return d?("x"===d&&u.set(tB,s),"y"===d&&u.set(tN,a)):(e3(u,"lockScalingX")||u.set(tB,s),e3(u,"lockScalingY")||u.set(tN,a)),g!==u.scaleX||p!==u.scaleY}let i_=io(tD,il((t,e,r,i)=>ib(t,e,r,i))),iw=io(tD,il((t,e,r,i)=>ib(t,e,r,i,{by:"x"}))),iC=io(tD,il((t,e,r,i)=>ib(t,e,r,i,{by:"y"}))),iS=["target","ex","ey","skewingSide"],iT={x:{counterAxis:"y",scale:tB,skew:tW,lockSkewing:"lockSkewingX",origin:"originX",flip:"flipX"},y:{counterAxis:"x",scale:tN,skew:tU,lockSkewing:"lockSkewingY",origin:"originY",flip:"flipY"}},iO=["ns","nesw","ew","nwse"],ik=(t,e,r)=>{if(0!==e.x&&e3(r,"lockSkewingY")||0!==e.y&&e3(r,"lockSkewingX"))return e5;let i=e6(r,e)%4;return"".concat(iO[i],"-resize")};function iM(t,e,r,i,n){let{target:s}=r,{counterAxis:a,origin:o,lockSkewing:l,skew:h,flip:c}=iT[t];if(e3(s,l))return!1;let{origin:u,flip:d}=iT[a],f=-Math.sign(e2(r[u])*(s[d]?-1:1))*(s[c]?-1:1),g=-(.5*((0===s[h]&&e8(r,tC,tC,i,n)[t]>0||s[h]>0?1:-1)*f))+.5;return io(tP,il((e,r,i,n)=>(function(t,e,r){let{target:i,ex:n,ey:s,skewingSide:a}=e,o=tr(e,iS),{skew:l}=iT[t],h=r.subtract(new tZ(n,s)).divide(new tZ(i.scaleX,i.scaleY))[t],c=i[l],u=Math.tan(er(o[l])),d=ei(Math.atan(2*h*a/Math.max("y"===t?i._getTransformedDimensions({scaleX:1,scaleY:1,skewX:0}).x:i._getTransformedDimensions({scaleX:1,scaleY:1}).y,1)+u));i.set(l,d);let f=c!==i[l];if(f&&"y"===t){let{skewX:t,scaleX:e}=i,r=i._getTransformedDimensions({skewY:c}),n=i._getTransformedDimensions(),s=0!==t?r.x/n.x:1;1!==s&&i.set(tB,s*e)}return f})(t,r,new tZ(i,n))))(e,te(te({},r),{},{[o]:g,skewingSide:f}),i,n)}let iE=(t,e,r,i)=>iM("x",t,e,r,i),iD=(t,e,r,i)=>iM("y",t,e,r,i);function ij(t,e){return t[e.canvas.altActionKey]}let iA=(t,e,r)=>{let i=ij(t,r);return 0===e.x?i?tW:tN:0===e.y?i?tU:tB:""},iP=(t,e,r)=>ij(t,r)?ik(0,e,r):ix(t,e,r),iF=(t,e,r,i)=>ij(t,e.target)?iD(t,e,r,i):iw(t,e,r,i),iL=(t,e,r,i)=>ij(t,e.target)?iE(t,e,r,i):iC(t,e,r,i),iR=()=>({ml:new id({x:-.5,y:0,cursorStyleHandler:iP,actionHandler:iF,getActionName:iA}),mr:new id({x:.5,y:0,cursorStyleHandler:iP,actionHandler:iF,getActionName:iA}),mb:new id({x:0,y:.5,cursorStyleHandler:iP,actionHandler:iL,getActionName:iA}),mt:new id({x:0,y:-.5,cursorStyleHandler:iP,actionHandler:iL,getActionName:iA}),tl:new id({x:-.5,y:-.5,cursorStyleHandler:ix,actionHandler:i_}),tr:new id({x:.5,y:-.5,cursorStyleHandler:ix,actionHandler:i_}),bl:new id({x:-.5,y:.5,cursorStyleHandler:ix,actionHandler:i_}),br:new id({x:.5,y:.5,cursorStyleHandler:ix,actionHandler:i_}),mtr:new id({x:0,y:-.5,actionHandler:ip,cursorStyleHandler:ig,offsetY:-40,withConnection:!0,actionName:tA})}),iI=()=>({mr:new id({x:.5,y:0,actionHandler:ih,cursorStyleHandler:iP,actionName:tF}),ml:new id({x:-.5,y:0,actionHandler:ih,cursorStyleHandler:iP,actionName:tF})}),iB=()=>te(te({},iR()),iI());class iN extends ia{static getDefaults(){return te(te({},super.getDefaults()),iN.ownDefaults)}static createControls(){return{controls:iR()}}_updateCacheCanvas(){let t=this.canvas;if(this.noScaleCache&&t&&t._currentTransform){let e=t._currentTransform,r=e.target,i=e.action;if(this===r&&i&&i.startsWith(tI))return!1}return super._updateCacheCanvas()}getActiveControl(){let t=this.__corner;return t?{key:t,control:this.controls[t],coord:this.oCoords[t]}:void 0}findControl(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasControls||!this.canvas)return;this.__corner=void 0;let r=Object.entries(this.oCoords);for(let i=r.length-1;i>=0;i--){let[n,s]=r[i],a=this.controls[n];if(a.shouldActivate(n,this,t,e?s.touchCorner:s.corner))return this.__corner=n,{key:n,control:a,coord:this.oCoords[n]}}}calcOCoords(){let t=this.getViewportTransform(),e=this.getCenterPoint(),r=eo(eu(e.x,e.y),ed({angle:this.getTotalAngle()-(this.group&&this.flipX?180:0)})),i=eo(t,r),n=eo(i,[1/t[0],0,0,1/t[3],0,0]),s=this.group?ec(this.calcTransformMatrix()):void 0;s&&(s.scaleX=Math.abs(s.scaleX),s.scaleY=Math.abs(s.scaleY));let a=this._calculateCurrentDimensions(s),o={};return this.forEachControl((t,e)=>{let r=t.positionHandler(a,n,this,t);o[e]=Object.assign(r,this._calcCornerCoords(t,r))}),o}_calcCornerCoords(t,e){let r=this.getTotalAngle();return{corner:t.calcCornerCoords(r,this.cornerSize,e.x,e.y,!1,this),touchCorner:t.calcCornerCoords(r,this.touchCornerSize,e.x,e.y,!0,this)}}setCoords(){super.setCoords(),this.canvas&&(this.oCoords=this.calcOCoords())}forEachControl(t){for(let e in this.controls)t(this.controls[e],e,this)}drawSelectionBackground(t){if(!this.selectionBackgroundColor||this.canvas&&this.canvas._activeObject!==this)return;t.save();let e=this.getRelativeCenterPoint(),r=this._calculateCurrentDimensions(),i=this.getViewportTransform();t.translate(e.x,e.y),t.scale(1/i[0],1/i[3]),t.rotate(er(this.angle)),t.fillStyle=this.selectionBackgroundColor,t.fillRect(-r.x/2,-r.y/2,r.x,r.y),t.restore()}strokeBorders(t,e){t.strokeRect(-e.x/2,-e.y/2,e.x,e.y)}_drawBorders(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=te({hasControls:this.hasControls,borderColor:this.borderColor,borderDashArray:this.borderDashArray},r);t.save(),t.strokeStyle=i.borderColor,this._setLineDash(t,i.borderDashArray),this.strokeBorders(t,e),i.hasControls&&this.drawControlsConnectingLines(t,e),t.restore()}_renderControls(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{hasBorders:r,hasControls:i}=this,n=te({hasBorders:r,hasControls:i},e),s=this.getViewportTransform(),a=n.hasBorders,o=n.hasControls,l=ec(eo(s,this.calcTransformMatrix()));t.save(),t.translate(l.translateX,l.translateY),t.lineWidth=this.borderScaleFactor,this.group===this.parent&&(t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(l.angle-=180),t.rotate(er(this.group?l.angle:this.angle)),a&&this.drawBorders(t,l,e),o&&this.drawControls(t,e),t.restore()}drawBorders(t,e,r){let i;if(r&&r.forActiveSelection||this.group){let t=eK(this.width,this.height,ev(e)),r=this.isStrokeAccountedForInDimensions()?t$:(this.strokeUniform?(new tZ).scalarAdd(this.canvas?this.canvas.getZoom():1):new tZ(e.scaleX,e.scaleY)).scalarMultiply(this.strokeWidth);i=t.add(r).scalarAdd(this.borderScaleFactor).scalarAdd(2*this.padding)}else i=this._calculateCurrentDimensions().scalarAdd(this.borderScaleFactor);this._drawBorders(t,i,r)}drawControlsConnectingLines(t,e){let r=!1;t.beginPath(),this.forEachControl((i,n)=>{i.withConnection&&i.getVisibility(this,n)&&(r=!0,t.moveTo(i.x*e.x,i.y*e.y),t.lineTo(i.x*e.x+i.offsetX,i.y*e.y+i.offsetY))}),r&&t.stroke()}drawControls(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.save();let r=this.getCanvasRetinaScaling(),{cornerStrokeColor:i,cornerDashArray:n,cornerColor:s}=this,a=te({cornerStrokeColor:i,cornerDashArray:n,cornerColor:s},e);t.setTransform(r,0,0,r,0,0),t.strokeStyle=t.fillStyle=a.cornerColor,this.transparentCorners||(t.strokeStyle=a.cornerStrokeColor),this._setLineDash(t,a.cornerDashArray),this.forEachControl((e,r)=>{if(e.getVisibility(this,r)){let i=this.oCoords[r];e.render(t,i.x,i.y,a,this)}}),t.restore()}isControlVisible(t){return this.controls[t]&&this.controls[t].getVisibility(this,t)}setControlVisible(t,e){this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[t]=e}setControlsVisibility(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.entries(t).forEach(t=>{let[e,r]=t;return this.setControlVisible(e,r)})}clearContextTop(t){if(!this.canvas)return;let e=this.canvas.contextTop;if(!e)return;let r=this.canvas.viewportTransform;e.save(),e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this.transform(e);let i=this.width+4,n=this.height+4;return e.clearRect(-i/2,-n/2,i,n),t||e.restore(),e}onDeselect(t){return!1}onSelect(t){return!1}shouldStartDragging(t){return!1}onDragStart(t){return!1}canDrop(t){return!1}renderDragSourceEffect(t){}renderDropTargetEffect(t){}constructor(t){super(),Object.assign(this,this.constructor.createControls(),iN.ownDefaults),this.setOptions(t)}}function iW(t,e){return e.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(r=>{"constructor"!==r&&Object.defineProperty(t.prototype,r,Object.getOwnPropertyDescriptor(e.prototype,r)||Object.create(null))})}),t}$(iN,"ownDefaults",{noScaleCache:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,cornerSize:13,touchCornerSize:24,transparentCorners:!0,cornerColor:"rgb(178,204,255)",cornerStrokeColor:"",cornerStyle:"rect",cornerDashArray:null,hasControls:!0,borderColor:"rgb(178,204,255)",borderDashArray:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,hasBorders:!0,selectionBackgroundColor:"",selectable:!0,evented:!0,perPixelTargetFind:!1,activeOn:"down",hoverCursor:null,moveCursor:null});class iU extends iN{}iW(iU,[rc]),tY.setClass(iU),tY.setClass(iU,"object");let iH=(t,e,r,i)=>{let n=2*(i=Math.round(i))+1,{data:s}=t.getImageData(e-i,r-i,n,n);for(let t=3;t0)return!1;return!0};class iX{createSideVector(t,e){let r=rA(t,e);return this.options.strokeUniform?r.multiply(this.scale):r}projectOrthogonally(t,e,r){return this.applySkew(t.add(this.calcOrthogonalProjection(t,e,r)))}isSkewed(){return 0!==this.options.skewX||0!==this.options.skewY}applySkew(t){let e=new tZ(t);return e.y+=e.x*Math.tan(er(this.options.skewY)),e.x+=e.y*Math.tan(er(this.options.skewX)),e}scaleUnitVector(t,e){return t.multiply(this.strokeUniformScalar).scalarMultiply(e)}constructor(t){this.options=t,this.strokeProjectionMagnitude=this.options.strokeWidth/2,this.scale=new tZ(this.options.scaleX,this.options.scaleY),this.strokeUniformScalar=this.options.strokeUniform?new tZ(1/this.options.scaleX,1/this.options.scaleY):new tZ(1,1)}}let iV=new tZ;class iz extends iX{static getOrthogonalRotationFactor(t,e){return Math.abs(e?rF(t,e):rL(t))2&&void 0!==arguments[2]?arguments[2]:this.strokeProjectionMagnitude,i=rI(this.createSideVector(t,e)),n=iz.getOrthogonalRotationFactor(i,this.bisector);return this.scaleUnitVector(i,r*n)}projectBevel(){let t=[];return(this.alpha%tb==0?[this.B]:[this.B,this.C]).forEach(e=>{t.push(this.projectOrthogonally(this.A,e)),t.push(this.projectOrthogonally(this.A,e,-this.strokeProjectionMagnitude))}),t}projectMiter(){let t=[],e=1/Math.sin(Math.abs(this.alpha)/2),r=this.scaleUnitVector(this.bisector,-this.strokeProjectionMagnitude*e),i=this.options.strokeUniform?rP(this.scaleUnitVector(this.bisector,this.options.strokeMiterLimit)):this.options.strokeMiterLimit;return rP(r)/this.strokeProjectionMagnitude<=i&&t.push(this.applySkew(this.A.add(r))),t.push(...this.projectBevel()),t}projectRoundNoSkew(t,e){let r=[],i=new tZ(iz.getOrthogonalRotationFactor(this.bisector),iz.getOrthogonalRotationFactor(new tZ(this.bisector.y,this.bisector.x)));return[new tZ(1,0).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar).multiply(i),new tZ(0,1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar).multiply(i)].forEach(i=>{rW(i,t,e)&&r.push(this.A.add(i))}),r}projectRoundWithSkew(t,e){let r=[],{skewX:i,skewY:n,scaleX:s,scaleY:a,strokeUniform:o}=this.options,l=new tZ(Math.tan(er(i)),Math.tan(er(n))),h=this.strokeProjectionMagnitude,c=o?h/a/Math.sqrt(1/a**2+1/s**2*l.y**2):h/Math.sqrt(1+l.y**2),u=new tZ(Math.sqrt(Math.max(h**2-c**2,0)),c),d=o?h/Math.sqrt(1+l.x**2*(1/a)**2/(1/s+1/s*l.x*l.y)**2):h/Math.sqrt(1+l.x**2/(1+l.x*l.y)**2),f=new tZ(d,Math.sqrt(Math.max(h**2-d**2,0)));return[f,f.scalarMultiply(-1),u,u.scalarMultiply(-1)].map(t=>this.applySkew(o?t.multiply(this.strokeUniformScalar):t)).forEach(i=>{rW(i,t,e)&&r.push(this.applySkew(this.A).add(i))}),r}projectRound(){let t=[];t.push(...this.projectBevel());let e=this.alpha%tb==0,r=this.applySkew(this.A),i=t[2*!e].subtract(r),n=t[+!!e].subtract(r),s=rB(i,e?this.applySkew(this.AB.scalarMultiply(-1)):this.applySkew(this.bisector.multiply(this.strokeUniformScalar).scalarMultiply(-1)))>0,a=s?i:n,o=s?n:i;return this.isSkewed()?t.push(...this.projectRoundWithSkew(a,o)):t.push(...this.projectRoundNoSkew(a,o)),t}projectPoints(){switch(this.options.strokeLineJoin){case"miter":return this.projectMiter();case"round":return this.projectRound();default:return this.projectBevel()}}project(){return this.projectPoints().map(t=>({originPoint:this.A,projectedPoint:t,angle:this.alpha,bisector:this.bisector}))}constructor(t,e,r,i){super(i),$(this,"AB",void 0),$(this,"AC",void 0),$(this,"alpha",void 0),$(this,"bisector",void 0),this.A=new tZ(t),this.B=new tZ(e),this.C=new tZ(r),this.AB=this.createSideVector(this.A,this.B),this.AC=this.createSideVector(this.A,this.C),this.alpha=rF(this.AB,this.AC),this.bisector=rR(rj(this.AB.eq(iV)?this.AC:this.AB,this.alpha/2))}}class iY extends iX{calcOrthogonalProjection(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.strokeProjectionMagnitude,i=this.createSideVector(t,e);return this.scaleUnitVector(rI(i),r)}projectButt(){return[this.projectOrthogonally(this.A,this.T,this.strokeProjectionMagnitude),this.projectOrthogonally(this.A,this.T,-this.strokeProjectionMagnitude)]}projectRound(){let t=[];if(!this.isSkewed()&&this.A.eq(this.T)){let e=new tZ(1,1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar);t.push(this.applySkew(this.A.add(e)),this.applySkew(this.A.subtract(e)))}else t.push(...new iz(this.A,this.T,this.T,this.options).projectRound());return t}projectSquare(){let t=[];if(this.A.eq(this.T)){let e=new tZ(1,1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar);t.push(this.A.add(e),this.A.subtract(e))}else{let e=this.calcOrthogonalProjection(this.A,this.T,this.strokeProjectionMagnitude),r=this.scaleUnitVector(rR(this.createSideVector(this.A,this.T)),-this.strokeProjectionMagnitude),i=this.A.add(r);t.push(i.add(e),i.subtract(e))}return t.map(t=>this.applySkew(t))}projectPoints(){switch(this.options.strokeLineCap){case"round":return this.projectRound();case"square":return this.projectSquare();default:return this.projectButt()}}project(){return this.projectPoints().map(t=>({originPoint:this.A,projectedPoint:t}))}constructor(t,e,r){super(r),this.A=new tZ(t),this.T=new tZ(e)}}let iG=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[];if(0===t.length)return i;let n=t.reduce((t,e)=>(t[t.length-1].eq(e)||t.push(new tZ(e)),t),[new tZ(t[0])]);if(1===n.length)r=!0;else if(!r){let t=n[0],e=((t,e)=>{for(let r=t.length-1;r>=0;r--)if(e(t[r],r,t))return r;return -1})(n,e=>!e.eq(t));n.splice(e+1)}return n.forEach((t,n,s)=>{let a,o;0===n?(o=s[1],a=r?t:s[s.length-1]):n===s.length-1?(a=s[n-1],o=r?t:s[0]):(a=s[n-1],o=s[n+1]),r&&1===s.length?i.push(...new iY(t,t,e).project()):r&&(0===n||n===s.length-1)?i.push(...new iY(t,0===n?o:a,e).project()):i.push(...new iz(t,a,o,e).project())}),i},iq=t=>{let e={};return Object.keys(t).forEach(r=>{e[r]={},Object.keys(t[r]).forEach(i=>{e[r][i]=te({},t[r][i])})}),e},iK=t=>t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">"),iQ=t=>(r||r||(r="Intl"in tg()&&"Segmenter"in Intl&&new Intl.Segmenter(void 0,{granularity:"grapheme"})),r)?Array.from(r.segment(t)).map(t=>{let{segment:e}=t;return e}):iJ(t),iJ=t=>{let e=[];for(let r,i=0;i{let r=t.charCodeAt(e);if(isNaN(r))return"";if(r<55296||r>57343)return t.charAt(e);if(55296<=r&&r<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";let r=t.charCodeAt(e+1);if(56320>r||r>57343)throw"High surrogate without following low surrogate";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw"Low surrogate without preceding high surrogate";let i=t.charCodeAt(e-1);if(55296>i||i>56319)throw"Low surrogate without preceding high surrogate";return!1};var i$=Object.freeze({__proto__:null,capitalize:function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"".concat(t.charAt(0).toUpperCase()).concat(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:iK,graphemeSplit:iQ});let i0=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.fill!==e.fill||t.stroke!==e.stroke||t.strokeWidth!==e.strokeWidth||t.fontSize!==e.fontSize||t.fontFamily!==e.fontFamily||t.fontWeight!==e.fontWeight||t.fontStyle!==e.fontStyle||t.textDecorationThickness!==e.textDecorationThickness||t.textBackgroundColor!==e.textBackgroundColor||t.deltaY!==e.deltaY||r&&(t.overline!==e.overline||t.underline!==e.underline||t.linethrough!==e.linethrough)},i1=(t,e)=>{let r=e.split("\n"),i=[],n=-1,s={};t=iq(t);for(let e=0;e0&&(i0(s,a,!0)?i.push({start:n,end:n+1,style:a}):i[i.length-1].end++),s=a||{}}else n+=a.length,s={}}return i},i2=(t,e)=>{if(!Array.isArray(t))return iq(t);let r=e.split(tM),i={},n=-1,s=0;for(let e=0;e{var e;return null!=(e=rT[t])?e:t},i9=RegExp("(".concat(rw,")"),"gi"),i6="(".concat(rw,")"),i8=String.raw(h||(h=ti(["(skewX)(",")"],["(skewX)\\(","\\)"])),i6),i7=String.raw(c||(c=ti(["(skewY)(",")"],["(skewY)\\(","\\)"])),i6),nt=String.raw(u||(u=ti(["(rotate)(","(?: "," ",")?)"],["(rotate)\\(","(?: "," ",")?\\)"])),i6,i6,i6),ne=String.raw(d||(d=ti(["(scale)(","(?: ",")?)"],["(scale)\\(","(?: ",")?\\)"])),i6,i6),nr=String.raw(f||(f=ti(["(translate)(","(?: ",")?)"],["(translate)\\(","(?: ",")?\\)"])),i6,i6),ni=String.raw(g||(g=ti(["(matrix)("," "," "," "," "," ",")"],["(matrix)\\("," "," "," "," "," ","\\)"])),i6,i6,i6,i6,i6,i6),nn="(?:".concat(ni,"|").concat(nr,"|").concat(nt,"|").concat(ne,"|").concat(i8,"|").concat(i7,")"),ns=new RegExp(String.raw(p||(p=ti(["^s*(?:","?)s*$"],["^\\s*(?:","?)\\s*$"])),"(?:".concat(nn,"*)"))),na=new RegExp(nn),no=RegExp(nn,"g");function nl(t){let e=[];if(!(t=t.replace(i9," $1 ").replace(/,/gi," ").replace(/\s+/gi," ").replace(/\s*([()])\s*/gi,"$1"))||t&&!ns.test(t))return[...tw];for(let r of t.matchAll(no)){let t=na.exec(r[0]);if(!t)continue;let i=tw,[,n,...s]=t.filter(t=>!!t),[a,o,l,h,c,u]=s.map(t=>parseFloat(t));switch(n){case"translate":i=eu(a,o);break;case tA:i=ed({angle:a},{x:o,y:l});break;case tI:i=ef(a,o);break;case tW:i=ep(a);break;case tU:i=em(a);break;case"matrix":i=[a,o,l,h,c,u]}e.push(i)}return el(e)}let nh={stroke:"strokeOpacity",fill:"fillOpacity"};function nc(t,e,r){if(!t)return{};let i,n={},s=16;t.parentNode&&rM.test(t.parentNode.nodeName)&&(n=nc(t.parentElement,e,r)).fontSize&&(i=s=ro(n.fontSize));let a=te(te(te({},e.reduce((e,r)=>{let i=t.getAttribute(r);return i&&(e[r]=i),e},{})),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={};for(let i in e)(function(t,e){let r=!0,i=i4(t,e.pop());return i&&e.length&&(r=function(t,e){let r,i=!0;for(;t.parentElement&&1===t.parentElement.nodeType&&e.length;)i&&(r=e.pop()),i=i4(t=t.parentElement,r);return 0===e.length}(t,e)),i&&r&&0===e.length})(t,i.split(" "))&&(r=te(te({},r),e[i]));return r}(t,r)),function(t){let e={},r=t.getAttribute("style");return r&&("string"==typeof r?r.replace(/;\s*$/,"").split(";").forEach(t=>{if(!t)return;let[r,i]=t.split(":");e[r.trim().toLowerCase()]=i.trim()}):Object.entries(r).forEach(t=>{let[r,i]=t;void 0!==i&&(e[r.toLowerCase()]=i)})),e}(t));a[rk]&&t.setAttribute(rk,a[rk]),a[rO]&&(i=ro(a[rO],s),a[rO]="".concat(i));let o={};for(let t in a){let e=i3(t),r=function(t,e,r,i){let n=Array.isArray(e),s,a=e;if(t!==tH&&t!==tX||e!==tk){if("strokeUniform"===t)return"non-scaling-stroke"===e;if("strokeDashArray"===t)a=e===tk?null:e.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===t)a=r&&r.transformMatrix?eo(r.transformMatrix,nl(e)):nl(e);else if("visible"===t)a=e!==tk&&"hidden"!==e,r&&!1===r.visible&&(a=!1);else if("opacity"===t)a=parseFloat(e),r&&void 0!==r.opacity&&(a*=r.opacity);else if("textAnchor"===t)a="start"===e?tS:"end"===e?tO:tC;else if("charSpacing"===t||t===rd)s=ro(e,i)/i*1e3;else if("paintFirst"===t){let t=e.indexOf(tH),r=e.indexOf(tX);a=tH,(t>-1&&r>-1&&r-1)&&(a=tX)}else{if("href"===t||"xlink:href"===t||"font"===t||"id"===t)return e;if("imageSmoothing"===t)return"optimizeQuality"===e;s=n?e.map(ro):ro(e,i)}}else a="";return!n&&isNaN(s)?a:s}(e,a[t],n,i);o[e]=r}o&&o.font&&function(t,e){let r=t.match(rS);if(!r)return;let i=r[1],n=r[3],s=r[4],a=r[5],o=r[6];i&&(e.fontStyle=i),n&&(e.fontWeight=isNaN(parseFloat(n))?n:parseFloat(n)),s&&(e.fontSize=ro(s)),o&&(e.fontFamily=o),a&&(e.lineHeight="normal"===a?1:a)}(o.font,o);let l=te(te({},n),o);return rM.test(t.nodeName)?l:function(t){let e=iU.getDefaults();return Object.entries(nh).forEach(r=>{let[i,n]=r;if(void 0===t[n]||""===t[i])return;if(void 0===t[i]){if(!e[i])return;t[i]=e[i]}if(0===t[i].indexOf("url("))return;let s=new ra(t[i]);t[i]=s.setAlpha(eS(s.getAlpha()*t[n],2)).toRgba()}),t}(l)}let nu=["left","top","width","height","visible"],nd=["rx","ry"];class nf extends iU{static getDefaults(){return te(te({},super.getDefaults()),nf.ownDefaults)}_initRxRy(){let{rx:t,ry:e}=this;t&&!e?this.ry=t:e&&!t&&(this.rx=e)}_render(t){let{width:e,height:r}=this,i=-e/2,n=-r/2,s=this.rx?Math.min(this.rx,e/2):0,a=this.ry?Math.min(this.ry,r/2):0,o=0!==s||0!==a;t.beginPath(),t.moveTo(i+s,n),t.lineTo(i+e-s,n),o&&t.bezierCurveTo(i+e-.4477152502*s,n,i+e,n+.4477152502*a,i+e,n+a),t.lineTo(i+e,n+r-a),o&&t.bezierCurveTo(i+e,n+r-.4477152502*a,i+e-.4477152502*s,n+r,i+e-s,n+r),t.lineTo(i+s,n+r),o&&t.bezierCurveTo(i+.4477152502*s,n+r,i,n+r-.4477152502*a,i,n+r-a),t.lineTo(i,n+a),o&&t.bezierCurveTo(i,n+.4477152502*a,i+.4477152502*s,n,i+s,n),t.closePath(),this._renderPaintInOrder(t)}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return super.toObject([...nd,...t])}_toSVG(){let{width:t,height:e,rx:r,ry:i}=this;return["\n')]}static async fromElement(t,e,r){let i=nc(t,this.ATTRIBUTE_NAMES,r),{left:n=0,top:s=0,width:a=0,height:o=0,visible:l=!0}=i,h=tr(i,nu);return new this(te(te(te({},e),h),{},{left:n,top:s,width:a,height:o,visible:!!(l&&a&&o)}))}constructor(t){super(),Object.assign(this,nf.ownDefaults),this.setOptions(t),this._initRxRy()}}$(nf,"type","Rect"),$(nf,"cacheProperties",[...rY,...nd]),$(nf,"ownDefaults",{rx:0,ry:0}),$(nf,"ATTRIBUTE_NAMES",[...i5,"x","y","rx","ry","width","height"]),tY.setClass(nf),tY.setSVGClass(nf);let ng="initialization",np="added",nm="removed",nv="imperative",ny=(t,e)=>{let{strokeUniform:r,strokeWidth:i,width:n,height:s,group:a}=e,o=a&&a!==t?eQ(a.calcTransformMatrix(),t.calcTransformMatrix()):null,l=o?e.getRelativeCenterPoint().transform(o):e.getRelativeCenterPoint(),h=!e.isStrokeAccountedForInDimensions(),c=r&&h?eZ(new tZ(i,i),void 0,t.calcTransformMatrix()):t$,u=!r&&h?i:0,d=eK(n+u,s+u,el([o,e.calcOwnMatrix()],!0)).add(c).scalarDivide(2);return[l.subtract(d),l.add(d)]};class nx{calcLayoutResult(t,e){if(this.shouldPerformLayout(t))return this.calcBoundingBox(e,t)}shouldPerformLayout(t){let{type:e,prevStrategy:r,strategy:i}=t;return e===ng||e===nv||!!r&&i!==r}shouldLayoutClipPath(t){let{type:e,target:{clipPath:r}}=t;return e!==ng&&r&&!r.absolutePositioned}getInitialSize(t,e){return e.size}calcBoundingBox(t,e){let{type:r,target:i}=e;if(r===nv&&e.overrides)return e.overrides;if(0===t.length)return;let{left:n,top:s,width:a,height:o}=eX(t.map(t=>ny(i,t)).reduce((t,e)=>t.concat(e),[])),l=new tZ(a,o),h=new tZ(n,s).add(l.scalarDivide(2));if(r===ng){let t=this.getInitialSize(e,{size:l,center:h});return{center:h,relativeCorrection:new tZ(0,0),size:t}}return{center:h.transform(i.calcOwnMatrix()),size:l}}}$(nx,"type","strategy");class nb extends nx{shouldPerformLayout(t){return!0}}$(nb,"type","fit-content"),tY.setClass(nb);let n_=["strategy"],nw=["target","strategy","bubbles","prevStrategy"],nC="layoutManager";class nS{performLayout(t){let e=te(te({bubbles:!0,strategy:this.strategy},t),{},{prevStrategy:this._prevLayoutStrategy,stopPropagation(){this.bubbles=!1}});this.onBeforeLayout(e);let r=this.getLayoutResult(e);r&&this.commitLayout(e,r),this.onAfterLayout(e,r),this._prevLayoutStrategy=e.strategy}attachHandlers(t,e){let{target:r}=e;return[tV,tE,tF,tj,tD,tP,tR,tL,"modifyPath"].map(e=>t.on(e,t=>this.performLayout(e===tV?{type:"object_modified",trigger:e,e:t,target:r}:{type:"object_modifying",trigger:e,e:t,target:r})))}subscribe(t,e){this.unsubscribe(t,e);let r=this.attachHandlers(t,e);this._subscriptions.set(t,r)}unsubscribe(t,e){(this._subscriptions.get(t)||[]).forEach(t=>t()),this._subscriptions.delete(t)}unsubscribeTargets(t){t.targets.forEach(e=>this.unsubscribe(e,t))}subscribeTargets(t){t.targets.forEach(e=>this.subscribe(e,t))}onBeforeLayout(t){let{target:e,type:r}=t,{canvas:i}=e;if(r===ng||r===np?this.subscribeTargets(t):r===nm&&this.unsubscribeTargets(t),e.fire("layout:before",{context:t}),i&&i.fire("object:layout:before",{target:e,context:t}),r===nv&&t.deep){let r=tr(t,n_);e.forEachObject(t=>t.layoutManager&&t.layoutManager.performLayout(te(te({},r),{},{bubbles:!1,target:t})))}}getLayoutResult(t){let{target:e,strategy:r,type:i}=t,n=r.calcLayoutResult(t,e.getObjects());if(!n)return;let s=i===ng?new tZ:e.getRelativeCenterPoint(),{center:a,correction:o=new tZ,relativeCorrection:l=new tZ}=n,h=s.subtract(a).add(o).transform(i===ng?tw:ea(e.calcOwnMatrix()),!0).add(l);return{result:n,prevCenter:s,nextCenter:a,offset:h}}commitLayout(t,e){var r,i;let{target:n}=t,{result:{size:s},nextCenter:a}=e;(n.set({width:s.x,height:s.y}),this.layoutObjects(t,e),t.type===ng)?n.set({left:null!=(r=t.x)?r:a.x+s.x*e2(n.originX),top:null!=(i=t.y)?i:a.y+s.y*e2(n.originY)}):(n.setPositionByOrigin(a,tC,tC),n.setCoords(),n.set("dirty",!0))}layoutObjects(t,e){let{target:r}=t;r.forEachObject(i=>{i.group===r&&this.layoutObject(t,e,i)}),t.strategy.shouldLayoutClipPath(t)&&this.layoutObject(t,e,r.clipPath)}layoutObject(t,e,r){let{offset:i}=e;r.set({left:r.left+i.x,top:r.top+i.y})}onAfterLayout(t,e){let{target:r,strategy:i,bubbles:n,prevStrategy:s}=t,a=tr(t,nw),{canvas:o}=r;r.fire("layout:after",{context:t,result:e}),o&&o.fire("object:layout:after",{context:t,result:e,target:r});let l=r.parent;n&&null!=l&&l.layoutManager&&((a.path||(a.path=[])).push(r),l.layoutManager.performLayout(te(te({},a),{},{target:l}))),r.set("dirty",!0)}dispose(){let{_subscriptions:t}=this;t.forEach(t=>t.forEach(t=>t())),t.clear()}toObject(){return{type:nC,strategy:this.strategy.constructor.type}}toJSON(){return this.toObject()}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new nb;$(this,"strategy",void 0),this.strategy=t,this._subscriptions=new Map}}tY.setClass(nS,nC);let nT=["type","objects","layoutManager"];class nO extends nS{performLayout(){}}class nk extends t1(iU){static getDefaults(){return te(te({},super.getDefaults()),nk.ownDefaults)}groupInit(t,e){var r;this._objects=[...t],this.__objectSelectionTracker=this.__objectSelectionMonitor.bind(this,!0),this.__objectSelectionDisposer=this.__objectSelectionMonitor.bind(this,!1),this.forEachObject(t=>{this.enterGroup(t,!1)}),this.layoutManager=null!=(r=e.layoutManager)?r:new nS,this.layoutManager.performLayout({type:ng,target:this,targets:[...t],x:e.left,y:e.top})}canEnterGroup(t){return t===this||this.isDescendantOf(t)?(ta("error","Group: circular object trees are not supported, this call has no effect"),!1):-1===this._objects.indexOf(t)||(ta("error","Group: duplicate objects are not supported inside group, this call has no effect"),!1)}_filterObjectsBeforeEnteringGroup(t){return t.filter((t,e,r)=>this.canEnterGroup(t)&&r.indexOf(t)===e)}add(){for(var t=arguments.length,e=Array(t),r=0;r1?e-1:0),i=1;i{r._set(t,e)}),this}_shouldSetNestedCoords(){return this.subTargetCheck}removeAll(){return this._activeObjects=[],this.remove(...this._objects)}__objectSelectionMonitor(t,e){let{target:r}=e,i=this._activeObjects;if(t)i.push(r),this._set("dirty",!0);else if(i.length>0){let t=i.indexOf(r);t>-1&&(i.splice(t,1),this._set("dirty",!0))}}_watchObject(t,e){t&&this._watchObject(!1,e),t?(e.on("selected",this.__objectSelectionTracker),e.on("deselected",this.__objectSelectionDisposer)):(e.off("selected",this.__objectSelectionTracker),e.off("deselected",this.__objectSelectionDisposer))}enterGroup(t,e){t.group&&t.group.remove(t),t._set("parent",this),this._enterGroup(t,e)}_enterGroup(t,e){e&&eY(t,eo(ea(this.calcTransformMatrix()),t.calcTransformMatrix())),this._shouldSetNestedCoords()&&t.setCoords(),t._set("group",this),t._set("canvas",this.canvas),this._watchObject(!0,t);let r=this.canvas&&this.canvas.getActiveObject&&this.canvas.getActiveObject();r&&(r===t||t.isDescendantOf(r))&&this._activeObjects.push(t)}exitGroup(t,e){this._exitGroup(t,e),t._set("parent",void 0),t._set("canvas",void 0)}_exitGroup(t,e){t._set("group",void 0),e||(eY(t,eo(this.calcTransformMatrix(),t.calcTransformMatrix())),t.setCoords()),this._watchObject(!1,t);let r=this._activeObjects.length>0?this._activeObjects.indexOf(t):-1;r>-1&&this._activeObjects.splice(r,1)}shouldCache(){let t=iU.prototype.shouldCache.call(this);if(t){for(let t=0;tt.setCoords())}triggerLayout(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.layoutManager.performLayout(te({target:this,type:nv},t))}render(t){this._transformDone=!0,super.render(t),this._transformDone=!1}__serializeObjects(t,e){let r=this.includeDefaultValues;return this._objects.filter(function(t){return!t.excludeFromExport}).map(function(i){let n=i.includeDefaultValues;i.includeDefaultValues=r;let s=i[t||"toObject"](e);return i.includeDefaultValues=n,s})}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=this.layoutManager.toObject();return te(te(te({},super.toObject(["subTargetCheck","interactive",...t])),"fit-content"!==e.strategy||this.includeDefaultValues?{layoutManager:e}:{}),{},{objects:this.__serializeObjects("toObject",t)})}toString(){return"#")}dispose(){this.layoutManager.unsubscribeTargets({targets:this.getObjects(),target:this}),this._activeObjects=[],this.forEachObject(t=>{this._watchObject(!1,t),t.dispose()}),super.dispose()}_createSVGBgRect(t){if(!this.backgroundColor)return"";let e=nf.prototype._toSVG.call(this),r=e.indexOf("COMMON_PARTS");e[r]='for="group" ';let i=e.join("");return t?t(i):i}_toSVG(t){let e=["\n"],r=this._createSVGBgRect(t);r&&e.push(" ",r);for(let r=0;r\n"),e}getSvgStyles(){let t=void 0!==this.opacity&&1!==this.opacity?"opacity: ".concat(this.opacity,";"):"",e=this.visible?"":" visibility: hidden;";return[t,this.getSvgFilter(),e].join("")}toClipPathSVG(t){let e=[],r=this._createSVGBgRect(t);r&&e.push(" ",r);for(let r=0;r{let[e,r]=t,i=new this(e,te(te(te({},s),r),{},{layoutManager:new nO}));return n?i.layoutManager=new(tY.getClass(n.type))(new(tY.getClass(n.strategy))):i.layoutManager=new nS,i.layoutManager.subscribeTargets({type:ng,target:i,targets:i.getObjects()}),i.setCoords(),i})}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),$(this,"_activeObjects",[]),$(this,"__objectSelectionTracker",void 0),$(this,"__objectSelectionDisposer",void 0),Object.assign(this,nk.ownDefaults),this.setOptions(e),this.groupInit(t,e)}}$(nk,"type","Group"),$(nk,"ownDefaults",{strokeWidth:0,subTargetCheck:!1,interactive:!1}),tY.setClass(nk);let nM=(t,e)=>Math.min(e.width/t.width,e.height/t.height),nE=(t,e)=>Math.max(e.width/t.width,e.height/t.height),nD="\\s*,?\\s*",nj="".concat(nD,"(").concat(rw,")"),nA="".concat(nj).concat(nj).concat(nj).concat(nD,"([01])").concat(nD,"([01])").concat(nj).concat(nj),nP={m:"l",M:"L"},nF=(t,e,r,i,n,s,a,o,l,h,c)=>{let u=tQ(t),d=tJ(t),f=tQ(e),g=tJ(e),p=r*n*f-i*s*g+a,m=i*n*f+r*s*g+o;return["C",h+l*(-r*n*d-i*s*u),c+l*(-i*n*d+r*s*u),p+l*(r*n*g+i*s*f),m+l*(i*n*g-r*s*f),p,m]},nL=(t,e,r,i)=>{let n=Math.atan2(e,t),s=Math.atan2(i,r);return s>=n?s-n:2*Math.PI-(n-s)};function nR(t,e,r,i,n,s,a,o){let l;if(ts.cachesBoundsOfCurve&&(l=[...arguments].join(),tm.boundsOfCurveCache[l]))return tm.boundsOfCurveCache[l];let h=Math.sqrt,c=Math.abs,u=[],d=[[0,0],[0,0]],f=6*t-12*r+6*n,g=-3*t+9*r-9*n+3*a,p=3*r-3*t;for(let t=0;t<2;++t){if(t>0&&(f=6*e-12*i+6*s,g=-3*e+9*i-9*s+3*o,p=3*i-3*e),1e-12>c(g)){if(1e-12>c(f))continue;let t=-p/f;0{let[i,n,s,a,o,l,h,c]=r,u=((t,e,r,i,n,s,a)=>{if(0===r||0===i)return[];let o=0,l=0,h=0,c=Math.PI,u=a*t_,d=tJ(u),f=tQ(u),g=.5*(-f*t-d*e),p=.5*(-f*e+d*t),m=r**2,y=i**2,x=p**2,b=g**2,_=m*y-m*x-y*b,w=Math.abs(r),C=Math.abs(i);if(_<0){let t=Math.sqrt(1-_/(m*y));w*=t,C*=t}else h=(n===s?-1:1)*Math.sqrt(_/(m*x+y*b));let S=h*w*p/C,T=-h*C*g/w,O=f*S-d*T+.5*t,k=d*S+f*T+.5*e,M=nL(1,0,(g-S)/w,(p-T)/C),E=nL((g-S)/w,(p-T)/C,(-g-S)/w,(-p-T)/C);0===s&&E>0?E-=2*c:1===s&&E<0&&(E+=2*c);let D=Math.ceil(Math.abs(E/c*2)),j=[],A=E/D,P=8/3*Math.sin(A/4)*Math.sin(A/4)/Math.sin(A/2),F=M+A;for(let t=0;t{let e=0,r=0,i=0,n=0,s=[],a,o=0,l=0;for(let h of t){let t,c=[...h];switch(c[0]){case"l":c[1]+=e,c[2]+=r;case"L":t=["L",e=c[1],r=c[2]];break;case"h":c[1]+=e;case"H":t=["L",e=c[1],r];break;case"v":c[1]+=r;case"V":t=["L",e,r=c[1]];break;case"m":c[1]+=e,c[2]+=r;case"M":e=c[1],r=c[2],i=c[1],n=c[2],t=["M",e,r];break;case"c":c[1]+=e,c[2]+=r,c[3]+=e,c[4]+=r,c[5]+=e,c[6]+=r;case"C":o=c[3],l=c[4],e=c[5],r=c[6],t=["C",c[1],c[2],o,l,e,r];break;case"s":c[1]+=e,c[2]+=r,c[3]+=e,c[4]+=r;case"S":"C"===a?(o=2*e-o,l=2*r-l):(o=e,l=r),e=c[3],r=c[4],o=(t=["C",o,l,c[1],c[2],e,r])[3],l=t[4];break;case"q":c[1]+=e,c[2]+=r,c[3]+=e,c[4]+=r;case"Q":o=c[1],l=c[2],t=["Q",o,l,e=c[3],r=c[4]];break;case"t":c[1]+=e,c[2]+=r;case"T":"Q"===a?(o=2*e-o,l=2*r-l):(o=e,l=r),t=["Q",o,l,e=c[1],r=c[2]];break;case"a":c[6]+=e,c[7]+=r;case"A":nI(e,r,c).forEach(t=>s.push(t)),e=c[6],r=c[7];break;case"z":case"Z":e=i,r=n,t=["Z"]}t?(s.push(t),a=t[0]):a=""}return s},nN=(t,e,r,i)=>Math.sqrt((r-t)**2+(i-e)**2),nW=(t,e,r,i,n,s,a,o)=>l=>{let h=l**3,c=(t=>3*t**2*(1-t))(l),u=(t=>3*t*(1-t)**2)(l),d=(1-l)**3;return new tZ(a*h+n*c+r*u+t*d,o*h+s*c+i*u+e*d)},nU=t=>2*t*(1-t),nH=(t,e,r,i,n,s,a,o)=>l=>{let h=l**2,c=nU(l),u=(1-l)**2;return Math.atan2(3*(u*(i-e)+c*(s-i)+h*(o-s)),3*(u*(r-t)+c*(n-r)+h*(a-n)))},nX=(t,e,r,i,n,s)=>a=>{let o=a**2,l=nU(a),h=(1-a)**2;return new tZ(n*o+r*l+t*h,s*o+i*l+e*h)},nV=(t,e,r,i,n,s)=>a=>{let o=1-a;return Math.atan2(2*(o*(i-e)+a*(s-i)),2*(o*(r-t)+a*(n-r)))},nz=(t,e,r)=>{let i=new tZ(e,r),n=0;for(let e=1;e<=100;e+=1){let r=t(e/100);n+=nN(i.x,i.y,r.x,r.y),i=r}return n},nY=t=>{let e,r,i=0,n=0,s=0,a=0,o=0,l=[];for(let h of t){let t={x:n,y:s,command:h[0],length:0};switch(h[0]){case"M":(r=t).x=a=n=h[1],r.y=o=s=h[2];break;case"L":(r=t).length=nN(n,s,h[1],h[2]),n=h[1],s=h[2];break;case"C":e=nW(n,s,h[1],h[2],h[3],h[4],h[5],h[6]),(r=t).iterator=e,r.angleFinder=nH(n,s,h[1],h[2],h[3],h[4],h[5],h[6]),r.length=nz(e,n,s),n=h[5],s=h[6];break;case"Q":e=nX(n,s,h[1],h[2],h[3],h[4]),(r=t).iterator=e,r.angleFinder=nV(n,s,h[1],h[2],h[3],h[4]),r.length=nz(e,n,s),n=h[3],s=h[4];break;case"Z":(r=t).destX=a,r.destY=o,r.length=nN(n,s,a,o),n=a,s=o}i+=r.length,l.push(r)}return l.push({length:i,x:n,y:s}),l},nG=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nY(t),i=0;for(;e-r[i].length>0&&i{let r,i=0,n=0,s={x:t.x,y:t.y},a=te({},s),o=.01,l=0,h=t.iterator,c=t.angleFinder;for(;n1e-4;)a=h(i),l=i,(r=nN(s.x,s.y,a.x,a.y))+n>e?(i-=o,o/=2):(s=a,i+=o,n+=r);return te(te({},a),{},{angle:c(l)})})(n,e)}},nq=RegExp("[mzlhvcsqta][^mzlhvcsqta]*","gi"),nK=RegExp(nA,"g"),nQ=RegExp(rw,"gi"),nJ={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},nZ=t=>{var e;let r=[];for(let i of null!=(e=t.match(nq))?e:[]){let t=i[0];if("z"===t||"Z"===t){r.push([t]);continue}let e=nJ[t.toLowerCase()],n=[];if("a"===t||"A"===t){nK.lastIndex=0;for(let t=null;t=nK.exec(i);)n.push(...t.slice(1))}else n=i.match(nQ)||[];for(let i=0;i0&&a?a:t;for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:0,i=new tZ(t[0]),n=new tZ(t[1]),s=1,a=0,o=[],l=t.length,h=l>2;for(h&&(s=t[2].xt[e-2].x?1:i.x===t[e-2].x?0:-1,a=i.y>t[e-2].y?1:i.y===t[e-2].y?0:-1),o.push(["L",i.x+s*r,i.y+a*r]),o},n0=(t,e)=>t.map(t=>t.map((t,r)=>0===r||void 0===e?t:eS(t,e)).join(" ")).join(" ");function n1(t,e){let r=t.style;r&&e&&("string"==typeof e?r.cssText+=";"+e:Object.entries(e).forEach(t=>{let[e,i]=t;return r.setProperty(e,i)}))}Object.freeze({__proto__:null,addTransformToObject:ez,animate:r7,animateColor:it,applyTransformToObject:eY,calcAngleBetweenVectors:rF,calcDimensionsMatrix:ev,calcPlaneChangeMatrix:eQ,calcVectorRotation:rL,cancelAnimFrame:t4,capValue:rV,composeMatrix:ey,copyCanvasElement:t=>{var e;let r=t7(t);return null==(e=r.getContext("2d"))||e.drawImage(t,0,0),r},cos:tQ,createCanvasElement:t6,createImage:t8,createRotateMatrix:ed,createScaleMatrix:ef,createSkewXMatrix:ep,createSkewYMatrix:em,createTranslateMatrix:eu,createVector:rA,crossProduct:rB,degreesToRadians:er,dotProduct:rN,ease:rZ,enlivenObjectEnlivables:e_,enlivenObjects:eb,findScaleToCover:nE,findScaleToFit:nM,getBoundsOfCurve:nR,getOrthonormalVector:rI,getPathSegmentsInfo:nY,getPointOnPath:nG,getPointer:eW,getRandomInt:(t,e)=>Math.floor(Math.random()*(e-t+1))+t,getRegularPolygonPath:(t,e)=>{let r=2*Math.PI/t,i=-tx;t%2==0&&(i+=r/2);let n=Array(t+1);for(let s=0;s{let e=["instantiated_by_use","style","id","class"];switch(t){case"linearGradient":return e.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);case"radialGradient":return e.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);case"stop":return e.concat(["offset","stop-color","stop-opacity"])}return e},getUnitVector:rR,groupSVGElements:(t,e)=>t&&1===t.length?t[0]:new nk(t,e),hasStyleChanged:i0,invertTransform:ea,isBetweenVectors:rW,isIdentityMatrix:en,isTouchEvent:eU,isTransparent:iH,joinPath:n0,loadImage:ex,magnitude:rP,makeBoundingBoxFromPoints:eX,makePathSimpler:nB,matrixToSVG:eT,mergeClipPaths:(t,e)=>{var r;let i=t,n=e;i.inverted&&!n.inverted&&(i=e,n=t),e$(n,null==(r=n.group)?void 0:r.calcTransformMatrix(),i.calcTransformMatrix());let s=i.inverted&&n.inverted;return s&&(i.inverted=n.inverted=!1),new nk([i],{clipPath:n,inverted:s})},multiplyTransformMatrices:eo,multiplyTransformMatrixArray:el,parsePath:nZ,parsePreserveAspectRatioAttribute:rl,parseUnit:ro,pick:ew,projectStrokeOnPoints:iG,qrDecompose:ec,radiansToDegrees:ei,removeFromArray:tK,removeTransformFromObject:(t,e)=>{let r=eo(ea(e),t.calcOwnMatrix());eY(t,r)},removeTransformMatrixForSvgParsing:(t,e)=>{let r=t._findCenterFromElement();t.transformMatrix&&((t=>{if(t.transformMatrix){let{scaleX:e,scaleY:r,angle:i,skewX:n}=ec(t.transformMatrix);t.flipX=!1,t.flipY=!1,t.set(tB,e),t.set(tN,r),t.angle=i,t.skewX=n,t.skewY=0}})(t),r=r.transform(t.transformMatrix)),delete t.transformMatrix,e&&(t.scaleX*=e.scaleX,t.scaleY*=e.scaleY,t.cropX=e.cropX,t.cropY=e.cropY,r.x+=e.offsetLeft,r.y+=e.offsetTop,t.width=e.width,t.height=e.height),t.setPositionByOrigin(r,tC,tC)},request:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.onComplete||ty,i=new(tg()).XMLHttpRequest,n=e.signal,s=function(){i.abort()},a=function(){n&&n.removeEventListener("abort",s),i.onerror=i.ontimeout=ty};if(n&&n.aborted)throw new tl("request");return n&&n.addEventListener("abort",s,{once:!0}),i.onreadystatechange=function(){4===i.readyState&&(a(),r(i),i.onreadystatechange=ty)},i.onerror=i.ontimeout=a,i.open("get",t,!0),i.send(),i},requestAnimFrame:t5,resetObjectTransform:eG,rotatePoint:(t,e,r)=>t.rotate(r,e),rotateVector:rj,saveObjectTransform:eq,sendObjectToPlane:e$,sendPointToPlane:eJ,sendVectorToPlane:eZ,setStyle:n1,sin:tJ,sizeAfterTransform:eK,string:i$,stylesFromArray:i2,stylesToArray:i1,toBlob:ee,toDataURL:et,toFixed:eS,transformPath:(t,e,r)=>(r&&(e=eo(e,[1,0,0,1,-r.x,-r.y])),t.map(t=>{let r=[...t];for(let i=1;i1&&void 0!==arguments[1]?arguments[1]:{};super(t),$(this,"upper",void 0),$(this,"container",void 0);let{el:i}=this.lower,n=this.createUpperCanvas();this.upper={el:n,ctx:n.getContext("2d")},this.applyCanvasStyle(i,{allowTouchScrolling:e}),this.applyCanvasStyle(n,{allowTouchScrolling:e,styles:{position:"absolute",left:"0",top:"0"}});let s=this.createContainerElement();s.classList.add(r),i.parentNode&&i.parentNode.replaceChild(s,i),s.append(i,n),this.container=s}}class n5 extends eB{static getDefaults(){return te(te({},super.getDefaults()),n5.ownDefaults)}get upperCanvasEl(){var t;return null==(t=this.elements.upper)?void 0:t.el}get contextTop(){var t;return null==(t=this.elements.upper)?void 0:t.ctx}get wrapperEl(){return this.elements.container}initElements(t){this.elements=new n2(t,{allowTouchScrolling:this.allowTouchScrolling,containerClass:this.containerClass}),this._createCacheCanvas()}_onObjectAdded(t){this._objectsToRender=void 0,super._onObjectAdded(t)}_onObjectRemoved(t){this._objectsToRender=void 0,t===this._activeObject&&(this.fire("before:selection:cleared",{deselected:[t]}),this._discardActiveObject(),this.fire("selection:cleared",{deselected:[t]}),t.fire("deselected",{target:t})),t===this._hoveredTarget&&(this._hoveredTarget=void 0,this._hoveredTargets=[]),super._onObjectRemoved(t)}_onStackOrderChanged(){this._objectsToRender=void 0,super._onStackOrderChanged()}_chooseObjectsToRender(){let t=this._activeObject;return!this.preserveObjectStacking&&t?this._objects.filter(e=>!e.group&&e!==t).concat(t):this._objects}renderAll(){this.cancelRequestedRender(),this.destroyed||(!this.contextTopDirty||this._groupSelector||this.isDrawingMode||(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&(this.renderTopLayer(this.contextTop),this.hasLostContext=!1),this._objectsToRender||(this._objectsToRender=this._chooseObjectsToRender()),this.renderCanvas(this.getContext(),this._objectsToRender))}renderTopLayer(t){t.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(t),this.contextTopDirty=!0),t.restore()}renderTop(){let t=this.contextTop;this.clearContext(t),this.renderTopLayer(t),this.fire("after:render",{ctx:t})}setTargetFindTolerance(t){t=Math.round(t),this.targetFindTolerance=t;let e=this.getRetinaScaling(),r=Math.ceil((2*t+1)*e);this.pixelFindCanvasEl.width=this.pixelFindCanvasEl.height=r,this.pixelFindContext.scale(e,e)}isTargetTransparent(t,e,r){let i=this.targetFindTolerance,n=this.pixelFindContext;this.clearContext(n),n.save(),n.translate(-e+i,-r+i),n.transform(...this.viewportTransform);let s=t.selectionBackgroundColor;t.selectionBackgroundColor="",t.render(n),t.selectionBackgroundColor=s,n.restore();let a=Math.round(i*this.getRetinaScaling());return iH(n,a,a,a)}_isSelectionKeyPressed(t){let e=this.selectionKey;return!!e&&(Array.isArray(e)?!!e.find(e=>!!e&&!0===t[e]):t[e])}_shouldClearSelection(t,e){let r=this.getActiveObjects(),i=this._activeObject;return!!(!e||e&&i&&r.length>1&&-1===r.indexOf(e)&&i!==e&&!this._isSelectionKeyPressed(t)||e&&!e.evented||e&&!e.selectable&&i&&i!==e)}_shouldCenterTransform(t,e,r){let i;if(t)return e===tI||e===tB||e===tN||e===tF?i=this.centeredScaling||t.centeredScaling:e===tA&&(i=this.centeredRotation||t.centeredRotation),i?!r:r}_getOriginFromCorner(t,e){let r={x:t.originX,y:t.originY};return e&&(["ml","tl","bl"].includes(e)?r.x=tO:["mr","tr","br"].includes(e)&&(r.x=tS),["tl","mt","tr"].includes(e)?r.y=tT:["bl","mb","br"].includes(e)&&(r.y="top")),r}_setupCurrentTransform(t,e,r){var i;let n=e.group?eJ(this.getScenePoint(t),void 0,e.group.calcTransformMatrix()):this.getScenePoint(t),{key:s="",control:a}=e.getActiveControl()||{},o=r&&a?null==(i=a.getActionHandler(t,e,a))?void 0:i.bind(a):e7,l=((t,e,r,i)=>{if(!e||!t)return"drag";let n=i.controls[e];return n.getActionName(r,n,i)})(r,s,t,e),h=t[this.centeredKey],c=this._shouldCenterTransform(e,l,h)?{x:tC,y:tC}:this._getOriginFromCorner(e,s),u={target:e,action:l,actionHandler:o,actionPerformed:!1,corner:s,scaleX:e.scaleX,scaleY:e.scaleY,skewX:e.skewX,skewY:e.skewY,offsetX:n.x-e.left,offsetY:n.y-e.top,originX:c.x,originY:c.y,ex:n.x,ey:n.y,lastX:n.x,lastY:n.y,theta:er(e.angle),width:e.width,height:e.height,shiftKey:t.shiftKey,altKey:h,original:te(te({},eq(e)),{},{originX:c.x,originY:c.y})};this._currentTransform=u,this.fire("before:transform",{e:t,transform:u})}setCursor(t){this.upperCanvasEl.style.cursor=t}_drawSelection(t){let{x:e,y:r,deltaX:i,deltaY:n}=this._groupSelector,s=new tZ(e,r).transform(this.viewportTransform),a=new tZ(e+i,r+n).transform(this.viewportTransform),o=this.selectionLineWidth/2,l=Math.min(s.x,a.x),h=Math.min(s.y,a.y),c=Math.max(s.x,a.x),u=Math.max(s.y,a.y);this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(l,h,c-l,u-h)),this.selectionLineWidth&&this.selectionBorderColor&&(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,l+=o,h+=o,c-=o,u-=o,iU.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(l,h,c-l,u-h))}findTarget(t){if(this.skipTargetFind)return;let e=this.getViewportPoint(t),r=this._activeObject,i=this.getActiveObjects();if(this.targets=[],r&&i.length>=1){if(r.findControl(e,eU(t))||i.length>1&&this.searchPossibleTargets([r],e))return r;if(r===this.searchPossibleTargets([r],e)){if(this.preserveObjectStacking){let i=this.targets;this.targets=[];let n=this.searchPossibleTargets(this._objects,e);return t[this.altSelectionKey]&&n&&n!==r?(this.targets=i,r):n}return r}}return this.searchPossibleTargets(this._objects,e)}_pointIsInObjectSelectionArea(t,e){let r=t.getCoords(),i=this.getZoom(),n=t.padding/i;if(n){let[t,e,i,s]=r,a=Math.atan2(e.y-t.y,e.x-t.x),o=tQ(a)*n,l=tJ(a)*n,h=o+l,c=o-l;r=[new tZ(t.x-c,t.y-h),new tZ(e.x+h,e.y-c),new tZ(i.x+c,i.y+h),new tZ(s.x-h,s.y+c)]}return ie.isPointInPolygon(e,r)}_checkTarget(t,e){return!(!(t&&t.visible&&t.evented&&this._pointIsInObjectSelectionArea(t,eJ(e,void 0,this.viewportTransform)))||(this.perPixelTargetFind||t.perPixelTargetFind)&&!t.isEditing&&this.isTargetTransparent(t,e.x,e.y))||!1}_searchPossibleTargets(t,e){let r=t.length;for(;r--;){let i=t[r];if(this._checkTarget(i,e)){if(t0(i)&&i.subTargetCheck){let t=this._searchPossibleTargets(i._objects,e);t&&this.targets.push(t)}return i}}}searchPossibleTargets(t,e){let r=this._searchPossibleTargets(t,e);if(r&&t0(r)&&r.interactive&&this.targets[0]){let t=this.targets;for(let e=t.length-1;e>0;e--){let r=t[e];if(!t0(r)||!r.interactive)return r}return t[0]}return r}getViewportPoint(t){return this._pointer?this._pointer:this.getPointer(t,!0)}getScenePoint(t){return this._absolutePointer?this._absolutePointer:this.getPointer(t)}getPointer(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.upperCanvasEl,i=r.getBoundingClientRect(),n=eW(t),s=i.width||0,a=i.height||0;s&&a||("top"in i&&tT in i&&(a=Math.abs(i.top-i.bottom)),tO in i&&tS in i&&(s=Math.abs(i.right-i.left))),this.calcOffset(),n.x=n.x-this._offset.left,n.y=n.y-this._offset.top,e||(n=eJ(n,void 0,this.viewportTransform));let o=this.getRetinaScaling();1!==o&&(n.x/=o,n.y/=o);let l=0===s||0===a?new tZ(1,1):new tZ(r.width/s,r.height/a);return n.multiply(l)}_setDimensionsImpl(t,e){this._resetTransformEventData(),super._setDimensionsImpl(t,e),this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop)}_createCacheCanvas(){this.pixelFindCanvasEl=t6(),this.pixelFindContext=this.pixelFindCanvasEl.getContext("2d",{willReadFrequently:!0}),this.setTargetFindTolerance(this.targetFindTolerance)}getTopContext(){return this.elements.upper.ctx}getSelectionContext(){return this.elements.upper.ctx}getSelectionElement(){return this.elements.upper.el}getActiveObject(){return this._activeObject}getActiveObjects(){let t=this._activeObject;return eE(t)?t.getObjects():t?[t]:[]}_fireSelectionEvents(t,e){let r=!1,i=!1,n=this.getActiveObjects(),s=[],a=[];t.forEach(t=>{n.includes(t)||(r=!0,t.fire("deselected",{e:e,target:t}),a.push(t))}),n.forEach(i=>{t.includes(i)||(r=!0,i.fire("selected",{e:e,target:i}),s.push(i))}),t.length>0&&n.length>0?(i=!0,r&&this.fire("selection:updated",{e:e,selected:s,deselected:a})):n.length>0?(i=!0,this.fire("selection:created",{e:e,selected:s})):t.length>0&&(i=!0,this.fire("selection:cleared",{e:e,deselected:a})),i&&(this._objectsToRender=void 0)}setActiveObject(t,e){let r=this.getActiveObjects(),i=this._setActiveObject(t,e);return this._fireSelectionEvents(r,e),i}_setActiveObject(t,e){let r=this._activeObject;return r!==t&&!(!this._discardActiveObject(e,t)&&this._activeObject)&&!t.onSelect({e:e})&&(this._activeObject=t,eE(t)&&r!==t&&t.set("canvas",this),t.setCoords(),!0)}_discardActiveObject(t,e){let r=this._activeObject;return!!r&&!r.onDeselect({e:t,object:e})&&(this._currentTransform&&this._currentTransform.target===r&&this.endCurrentTransform(t),eE(r)&&r===this._hoveredTarget&&(this._hoveredTarget=void 0),this._activeObject=void 0,!0)}discardActiveObject(t){let e=this.getActiveObjects(),r=this.getActiveObject();e.length&&this.fire("before:selection:cleared",{e:t,deselected:[r]});let i=this._discardActiveObject(t);return this._fireSelectionEvents(e,t),i}endCurrentTransform(t){let e=this._currentTransform;this._finalizeCurrentTransform(t),e&&e.target&&(e.target.isMoving=!1),this._currentTransform=null}_finalizeCurrentTransform(t){let e=this._currentTransform,r=e.target,i={e:t,target:r,transform:e,action:e.action};r._scaling&&(r._scaling=!1),r.setCoords(),e.actionPerformed&&(this.fire("object:modified",i),r.fire(tV,i))}setViewportTransform(t){super.setViewportTransform(t);let e=this._activeObject;e&&e.setCoords()}destroy(){let t=this._activeObject;eE(t)&&(t.removeAll(),t.dispose()),delete this._activeObject,super.destroy(),this.pixelFindContext=null,this.pixelFindCanvasEl=void 0}clear(){this.discardActiveObject(),this._activeObject=void 0,this.clearContext(this.contextTop),super.clear()}drawControls(t){let e=this._activeObject;e&&e._renderControls(t)}_toObject(t,e,r){let i=this._realizeGroupTransformOnObject(t),n=super._toObject(t,e,r);return t.set(i),n}_realizeGroupTransformOnObject(t){let{group:e}=t;if(e&&eE(e)&&this._activeObject===e){let r=ew(t,["angle","flipX","flipY",tS,tB,tN,tW,tU,"top"]);return ez(t,e.calcOwnMatrix()),r}return{}}_setSVGObject(t,e,r){let i=this._realizeGroupTransformOnObject(e);super._setSVGObject(t,e,r),e.set(i)}constructor(){super(...arguments),$(this,"targets",[]),$(this,"_hoveredTargets",[]),$(this,"_objectsToRender",void 0),$(this,"_currentTransform",null),$(this,"_groupSelector",null),$(this,"contextTopDirty",!1)}}$(n5,"ownDefaults",{uniformScaling:!0,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",selection:!0,selectionKey:"shiftKey",selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",notAllowedCursor:"not-allowed",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,enablePointerEvents:!1,containerClass:"canvas-container",preserveObjectStacking:!1});class n4{exitTextEditing(){this.target=void 0,this.targets.forEach(t=>{t.isEditing&&t.exitEditing()})}add(t){this.targets.push(t)}remove(t){this.unregister(t),tK(this.targets,t)}register(t){this.target=t}unregister(t){t===this.target&&(this.target=void 0)}onMouseMove(t){var e;(null==(e=this.target)?void 0:e.isEditing)&&this.target.updateSelectionOnMouseMove(t)}clear(){this.targets=[],this.target=void 0}dispose(){this.clear(),this.__disposer(),delete this.__disposer}constructor(t){$(this,"targets",[]),$(this,"__disposer",void 0);let e=()=>{let{hiddenTextarea:e}=t.getActiveObject()||{};e&&e.focus()},r=t.upperCanvasEl;r.addEventListener("click",e),this.__disposer=()=>r.removeEventListener("click",e)}}let n3=["target","oldTarget","fireCanvas","e"],n9={passive:!1},n6=(t,e)=>{let r=t.getViewportPoint(e),i=t.getScenePoint(e);return{viewportPoint:r,scenePoint:i,pointer:r,absolutePointer:i}},n8=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i1?e-1:0),i=1;i{this.fire("mouse:out",te(te({},r),{},{target:t})),t&&t.fire("mouseout",te({},r))}),this._hoveredTargets=[]}_onMouseEnter(t){this._currentTransform||this.findTarget(t)||(this.fire("mouse:over",te({e:t},n6(this,t))),this._hoveredTarget=void 0,this._hoveredTargets=[])}_onDragStart(t){this._isClick=!1;let e=this.getActiveObject();if(e&&e.onDragStart(t)){this._dragSource=e;let r={e:t,target:e};return this.fire("dragstart",r),e.fire("dragstart",r),void n8(this.upperCanvasEl,"drag",this._onDragProgress)}eH(t)}_renderDragEffects(t,e,r){let i=!1,n=this._dropTarget;n&&n!==e&&n!==r&&(n.clearContextTop(),i=!0),null==e||e.clearContextTop(),r!==e&&(null==r||r.clearContextTop());let s=this.contextTop;s.save(),s.transform(...this.viewportTransform),e&&(s.save(),e.transform(s),e.renderDragSourceEffect(t),s.restore(),i=!0),r&&(s.save(),r.transform(s),r.renderDropTargetEffect(t),s.restore(),i=!0),s.restore(),i&&(this.contextTopDirty=!0)}_onDragEnd(t){let e=!!t.dataTransfer&&t.dataTransfer.dropEffect!==tk,r=e?this._activeObject:void 0,i={e:t,target:this._dragSource,subTargets:this.targets,dragSource:this._dragSource,didDrop:e,dropTarget:r};n7(this.upperCanvasEl,"drag",this._onDragProgress),this.fire("dragend",i),this._dragSource&&this._dragSource.fire("dragend",i),delete this._dragSource,this._onMouseUp(t)}_onDragProgress(t){let e={e:t,target:this._dragSource,dragSource:this._dragSource,dropTarget:this._draggedoverTarget};this.fire("drag",e),this._dragSource&&this._dragSource.fire("drag",e)}findDragTargets(t){return this.targets=[],{target:this._searchPossibleTargets(this._objects,this.getViewportPoint(t)),targets:[...this.targets]}}_onDragOver(t){let e,r="dragover",{target:i,targets:n}=this.findDragTargets(t),s=this._dragSource,a={e:t,target:i,subTargets:n,dragSource:s,canDrop:!1,dropTarget:void 0};this.fire(r,a),this._fireEnterLeaveEvents(i,a),i&&(i.canDrop(t)&&(e=i),i.fire(r,a));for(let i=0;i3||e<2||(this._cacheTransformEventData(t),2==e&&"dblclick"===t.type&&this._handleEvent(t,"dblclick"),3==e&&this._handleEvent(t,"tripleclick"),this._resetTransformEventData())}getPointerId(t){let e=t.changedTouches;return e?e[0]&&e[0].identifier:this.enablePointerEvents?t.pointerId:-1}_isMainEvent(t){return!0===t.isPrimary||!1!==t.isPrimary&&("touchend"===t.type&&0===t.touches.length||!t.changedTouches||t.changedTouches[0].identifier===this.mainTouchId)}_onTouchStart(t){let e=!this.allowTouchScrolling,r=this._activeObject;void 0===this.mainTouchId&&(this.mainTouchId=this.getPointerId(t)),this.__onMouseDown(t),(this.isDrawingMode||r&&this._target===r)&&(e=!0),e&&t.preventDefault(),this._resetTransformEventData();let i=this.upperCanvasEl,n=this._getEventPrefix(),s=ej(i);n8(s,"touchend",this._onTouchEnd,n9),e&&n8(s,"touchmove",this._onMouseMove,n9),n7(i,"".concat(n,"down"),this._onMouseDown)}_onMouseDown(t){this.__onMouseDown(t),this._resetTransformEventData();let e=this.upperCanvasEl,r=this._getEventPrefix();n7(e,"".concat(r,"move"),this._onMouseMove,n9);let i=ej(e);n8(i,"".concat(r,"up"),this._onMouseUp),n8(i,"".concat(r,"move"),this._onMouseMove,n9)}_onTouchEnd(t){if(t.touches.length>0)return;this.__onMouseUp(t),this._resetTransformEventData(),delete this.mainTouchId;let e=this._getEventPrefix(),r=ej(this.upperCanvasEl);n7(r,"touchend",this._onTouchEnd,n9),n7(r,"touchmove",this._onMouseMove,n9),this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(()=>{n8(this.upperCanvasEl,"".concat(e,"down"),this._onMouseDown),this._willAddMouseDown=0},400)}_onMouseUp(t){this.__onMouseUp(t),this._resetTransformEventData();let e=this.upperCanvasEl,r=this._getEventPrefix();if(this._isMainEvent(t)){let t=ej(this.upperCanvasEl);n7(t,"".concat(r,"up"),this._onMouseUp),n7(t,"".concat(r,"move"),this._onMouseMove,n9),n8(e,"".concat(r,"move"),this._onMouseMove,n9)}}_onMouseMove(t){let e=this.getActiveObject();this.allowTouchScrolling||e&&e.shouldStartDragging(t)||!t.preventDefault||t.preventDefault(),this.__onMouseMove(t)}_onResize(){this.calcOffset(),this._resetTransformEventData()}_shouldRender(t){let e=this.getActiveObject();return!!e!=!!t||e&&t&&e!==t}__onMouseUp(t){var e;this._cacheTransformEventData(t),this._handleEvent(t,"up:before");let r=this._currentTransform,i=this._isClick,n=this._target,{button:s}=t;if(s)return(this.fireMiddleClick&&1===s||this.fireRightClick&&2===s)&&this._handleEvent(t,"up"),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)return void this._onMouseUpInDrawingMode(t);if(!this._isMainEvent(t))return;let a,o,l=!1;if(r&&(this._finalizeCurrentTransform(t),l=r.actionPerformed),!i){let e=n===this._activeObject;this.handleSelection(t),l||(l=this._shouldRender(n)||!e&&n===this._activeObject)}if(n){let{key:e,control:i}=n.findControl(this.getViewportPoint(t),eU(t))||{};if(o=e,n.selectable&&n!==this._activeObject&&"up"===n.activeOn)this.setActiveObject(n,t),l=!0;else if(i){let e=i.getMouseUpHandler(t,n,i);e&&(a=this.getScenePoint(t),e.call(i,t,r,a.x,a.y))}n.isMoving=!1}if(r&&(r.target!==n||r.corner!==o)){let e=r.target&&r.target.controls[r.corner],i=e&&e.getMouseUpHandler(t,r.target,e);a=a||this.getScenePoint(t),i&&i.call(e,t,r,a.x,a.y)}this._setCursorFromEvent(t,n),this._handleEvent(t,"up"),this._groupSelector=null,this._currentTransform=null,n&&(n.__corner=void 0),l?this.requestRenderAll():i||null!=(e=this._activeObject)&&e.isEditing||this.renderTop()}_basicEventHandler(t,e){let{target:r,subTargets:i=[]}=e;this.fire(t,e),r&&r.fire(t,e);for(let n=0;n{r=t.hoverCursor||r}),this.setCursor(r)}handleMultiSelection(t,e){let r=this._activeObject,i=eE(r);if(r&&this._isSelectionKeyPressed(t)&&this.selection&&e&&e.selectable&&(r!==e||i)&&(i||!e.isDescendantOf(r)&&!r.isDescendantOf(e))&&!e.onSelect({e:t})&&!r.getActiveControl()){if(i){let i=r.getObjects();if(e===r){let r=this.getViewportPoint(t);if(!(e=this.searchPossibleTargets(i,r)||this.searchPossibleTargets(this._objects,r))||!e.selectable)return!1}e.group===r?(r.remove(e),this._hoveredTarget=e,this._hoveredTargets=[...this.targets],1===r.size()&&this._setActiveObject(r.item(0),t)):(r.multiSelectAdd(e),this._hoveredTarget=r,this._hoveredTargets=[...this.targets]),this._fireSelectionEvents(i,t)}else{r.isEditing&&r.exitEditing();let i=new(tY.getClass("ActiveSelection"))([],{canvas:this});i.multiSelectAdd(r,e),this._hoveredTarget=i,this._setActiveObject(i,t),this._fireSelectionEvents([r],t)}return!0}return!1}handleSelection(t){if(!this.selection||!this._groupSelector)return!1;let{x:e,y:r,deltaX:i,deltaY:n}=this._groupSelector,s=new tZ(e,r),a=s.add(new tZ(i,n)),o=s.min(a),l=s.max(a).subtract(o),h=this.collectObjects({left:o.x,top:o.y,width:l.x,height:l.y},{includeIntersecting:!this.selectionFullyContained}),c=s.eq(a)?h[0]?[h[0]]:[]:h.length>1?h.filter(e=>!e.onSelect({e:t})).reverse():h;if(1===c.length)this.setActiveObject(c[0],t);else if(c.length>1){let e=tY.getClass("ActiveSelection");this.setActiveObject(new e(c,{canvas:this}),t)}return this._groupSelector=null,!0}clear(){this.textEditingManager.clear(),super.clear()}destroy(){this.removeListeners(),this.textEditingManager.dispose(),super.destroy()}constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),$(this,"_isClick",void 0),$(this,"textEditingManager",new n4(this)),["_onMouseDown","_onTouchStart","_onMouseMove","_onMouseUp","_onTouchEnd","_onResize","_onMouseWheel","_onMouseOut","_onMouseEnter","_onContextMenu","_onClick","_onDragStart","_onDragEnd","_onDragProgress","_onDragOver","_onDragEnter","_onDragLeave","_onDrop"].forEach(t=>{this[t]=this[t].bind(this)}),this.addOrRemove(n8,"add")}}let sr={x1:0,y1:0,x2:0,y2:0},si=te(te({},sr),{},{r1:0,r2:0}),sn=(t,e)=>isNaN(t)&&"number"==typeof e?e:t,ss=/^(\d+\.\d+)%|(\d+)%$/;function sa(t){return t&&ss.test(t)}function so(t,e){return rV(0,sn("number"==typeof t?t:"string"==typeof t?parseFloat(t)/(sa(t)?100:1):NaN,e),1)}let sl=/\s*;\s*/,sh=/\s*:\s*/;function sc(t){return"linearGradient"===t.nodeName||"LINEARGRADIENT"===t.nodeName?"linear":"radial"}function su(t){return"userSpaceOnUse"===t.getAttribute("gradientUnits")?"pixels":"percentage"}function sd(t,e){return t.getAttribute(e)}class sf{addColorStop(t){for(let e in t){let r=new ra(t[e]);this.colorStops.push({offset:parseFloat(e),color:r.toRgb(),opacity:r.getAlpha()})}return this}toObject(t){return te(te({},ew(this,t)),{},{type:this.type,coords:te({},this.coords),colorStops:this.colorStops.map(t=>te({},t)),offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?[...this.gradientTransform]:void 0})}toSVG(t){let{additionalTransform:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[],i=this.gradientTransform?this.gradientTransform.concat():tw.concat(),n="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox",s=this.colorStops.map(t=>te({},t)).sort((t,e)=>t.offset-e.offset),a=-this.offsetX,o=-this.offsetY;"objectBoundingBox"===n?(a/=t.width,o/=t.height):(a+=t.width/2,o+=t.height/2),t&&"function"==typeof t._renderPathCommands&&"percentage"!==this.gradientUnits&&(a-=t.pathOffset.x,o-=t.pathOffset.y),i[4]-=a,i[5]-=o;let l=['id="SVGID_'.concat(this.id,'"'),'gradientUnits="'.concat(n,'"'),'gradientTransform="'.concat(e?e+" ":"").concat(eT(i),'"'),""].join(" ");if("linear"===this.type){let{x1:t,y1:e,x2:i,y2:n}=this.coords;r.push("\n')}else if("radial"===this.type){let{x1:t,y1:e,x2:i,y2:n,r1:a,r2:o}=this.coords,h=a>o;r.push("\n'),h&&(s.reverse(),s.forEach(t=>{t.offset=1-t.offset}));let c=Math.min(a,o);if(c>0){let t=c/Math.max(a,o);s.forEach(e=>{e.offset+=t*(1-e.offset)})}}return s.forEach(t=>{let{color:e,offset:i,opacity:n}=t;r.push("\n')}),r.push("linear"===this.type?"":"","\n"),r.join("")}toLive(t){let{x1:e,y1:r,x2:i,y2:n,r1:s,r2:a}=this.coords,o="linear"===this.type?t.createLinearGradient(e,r,i,n):t.createRadialGradient(e,r,s,i,n,a);return this.colorStops.forEach(t=>{let{color:e,opacity:r,offset:i}=t;o.addColorStop(i,void 0!==r?new ra(e).setAlpha(r).toRgba():e)}),o}static async fromObject(t){let{colorStops:e,gradientTransform:r}=t;return new this(te(te({},t),{},{colorStops:e?e.map(t=>te({},t)):void 0,gradientTransform:r?[...r]:void 0}))}static fromElement(t,e,r){var i;let n=su(t),s=e._findCenterFromElement();return new this(te({id:t.getAttribute("id")||void 0,type:sc(t),coords:(i={width:r.viewBoxWidth||r.width,height:r.viewBoxHeight||r.height},function(t,e){let r,{width:i,height:n,gradientUnits:s}=e;return Object.keys(t).reduce((e,a)=>{let o=t[a];return"Infinity"===o?r=1:"-Infinity"===o?r=0:(r="string"==typeof o?parseFloat(o):o,"string"==typeof o&&sa(o)&&(r*=.01,"pixels"===s&&("x1"!==a&&"x2"!==a&&"r2"!==a||(r*=i),"y1"!==a&&"y2"!==a||(r*=n)))),e[a]=r,e},{})}("linear"===sc(t)?{x1:sd(t,"x1")||0,y1:sd(t,"y1")||0,x2:sd(t,"x2")||"100%",y2:sd(t,"y2")||0}:{x1:sd(t,"fx")||sd(t,"cx")||"50%",y1:sd(t,"fy")||sd(t,"cy")||"50%",r1:0,x2:sd(t,"cx")||"50%",y2:sd(t,"cy")||"50%",r2:sd(t,"r")||"50%"},te(te({},i),{},{gradientUnits:su(t)}))),colorStops:function(t,e){let r=[],i=t.getElementsByTagName("stop"),n=so(e,1);for(let t=i.length;t--;)r.push(function(t,e){let r,i,n=t.getAttribute("style");if(n){let t=n.split(sl);""===t[t.length-1]&&t.pop();for(let e=t.length;e--;){let[n,s]=t[e].split(sh).map(t=>t.trim());"stop-color"===n?r=s:"stop-opacity"===n&&(i=s)}}let s=new ra(r||t.getAttribute("stop-color")||"rgb(0,0,0)");return{offset:so(t.getAttribute("offset"),0),color:s.toRgb(),opacity:sn(parseFloat(i||t.getAttribute("stop-opacity")||""),1)*s.getAlpha()*e}}(i[t],n));return r}(t,r.opacity),gradientUnits:n,gradientTransform:nl(t.getAttribute("gradientTransform")||"")},"pixels"===n?{offsetX:e.width/2-s.x,offsetY:e.height/2-s.y}:{offsetX:0,offsetY:0}))}constructor(t){let{type:e="linear",gradientUnits:r="pixels",coords:i={},colorStops:n=[],offsetX:s=0,offsetY:a=0,gradientTransform:o,id:l}=t||{};Object.assign(this,{type:e,gradientUnits:r,coords:te(te({},"radial"===e?si:sr),i),colorStops:n,offsetX:s,offsetY:a,gradientTransform:o,id:l?"".concat(l,"_").concat(t9()):t9()})}}$(sf,"type","Gradient"),tY.setClass(sf,"gradient"),tY.setClass(sf,"linear"),tY.setClass(sf,"radial");let sg=["type","source","patternTransform"];class sp{get type(){return"pattern"}set type(t){ta("warn","Setting type has no effect",t)}isImageSource(){return!!this.source&&"string"==typeof this.source.src}isCanvasSource(){return!!this.source&&!!this.source.toDataURL}sourceToString(){return this.isImageSource()?this.source.src:this.isCanvasSource()?this.source.toDataURL():""}toLive(t){return this.source&&(!this.isImageSource()||this.source.complete&&0!==this.source.naturalWidth&&0!==this.source.naturalHeight)?t.createPattern(this.source,this.repeat):null}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{repeat:e,crossOrigin:r}=this;return te(te({},ew(this,t)),{},{type:"pattern",source:this.sourceToString(),repeat:e,crossOrigin:r,offsetX:eS(this.offsetX,ts.NUM_FRACTION_DIGITS),offsetY:eS(this.offsetY,ts.NUM_FRACTION_DIGITS),patternTransform:this.patternTransform?[...this.patternTransform]:null})}toSVG(t){let{width:e,height:r}=t,{source:i,repeat:n,id:s}=this,a=sn(this.offsetX/e,0),o=sn(this.offsetY/r,0),l="repeat-y"===n||"no-repeat"===n?1+Math.abs(a||0):sn(i.width/e,0),h="repeat-x"===n||"no-repeat"===n?1+Math.abs(o||0):sn(i.height/r,0);return[''),''),"\n"].join("\n")}static async fromObject(t,e){let{type:r,source:i,patternTransform:n}=t,s=tr(t,sg),a=await ex(i,te(te({},e),{},{crossOrigin:s.crossOrigin}));return new this(te(te({},s),{},{patternTransform:n&&n.slice(0),source:a}))}constructor(t){$(this,"repeat","repeat"),$(this,"offsetX",0),$(this,"offsetY",0),$(this,"crossOrigin",""),this.id=t9(),Object.assign(this,t)}}$(sp,"type","Pattern"),tY.setClass(sp),tY.setClass(sp,"pattern");class sm{_setBrushStyles(t){t.strokeStyle=this.color,t.lineWidth=this.width,t.lineCap=this.strokeLineCap,t.miterLimit=this.strokeMiterLimit,t.lineJoin=this.strokeLineJoin,t.setLineDash(this.strokeDashArray||[])}_saveAndTransform(t){let e=this.canvas.viewportTransform;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5])}needsFullRender(){return 1>new ra(this.color).getAlpha()||!!this.shadow}_setShadow(){if(!this.shadow||!this.canvas)return;let t=this.canvas,e=this.shadow,r=t.contextTop,i=t.getZoom()*t.getRetinaScaling();r.shadowColor=e.color,r.shadowBlur=e.blur*i,r.shadowOffsetX=e.offsetX*i,r.shadowOffsetY=e.offsetY*i}_resetShadow(){let t=this.canvas.contextTop;t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0}_isOutSideCanvas(t){return t.x<0||t.x>this.canvas.getWidth()||t.y<0||t.y>this.canvas.getHeight()}constructor(t){$(this,"color","rgb(0, 0, 0)"),$(this,"width",1),$(this,"shadow",null),$(this,"strokeLineCap","round"),$(this,"strokeLineJoin","round"),$(this,"strokeMiterLimit",10),$(this,"strokeDashArray",null),$(this,"limitedToCanvasSize",!1),this.canvas=t}}let sv=["path","left","top"],sy=["d"];class sx extends iU{_setPath(t,e){this.path=nB(Array.isArray(t)?t:nZ(t)),this.setBoundingBox(e)}_findCenterFromElement(){let t=this._calcBoundsFromPath();return new tZ(t.left+t.width/2,t.top+t.height/2)}_renderPathCommands(t){let e=-this.pathOffset.x,r=-this.pathOffset.y;for(let i of(t.beginPath(),this.path))switch(i[0]){case"L":t.lineTo(i[1]+e,i[2]+r);break;case"M":t.moveTo(i[1]+e,i[2]+r);break;case"C":t.bezierCurveTo(i[1]+e,i[2]+r,i[3]+e,i[4]+r,i[5]+e,i[6]+r);break;case"Q":t.quadraticCurveTo(i[1]+e,i[2]+r,i[3]+e,i[4]+r);break;case"Z":t.closePath()}}_render(t){this._renderPathCommands(t),this._renderPaintInOrder(t)}toString(){return"#")}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return te(te({},super.toObject(t)),{},{path:this.path.map(t=>t.slice())})}toDatalessObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=this.toObject(t);return this.sourcePath&&(delete e.path,e.sourcePath=this.sourcePath),e}_toSVG(){let t=n0(this.path,ts.NUM_FRACTION_DIGITS);return["\n')]}_getOffsetTransform(){let t=ts.NUM_FRACTION_DIGITS;return" translate(".concat(eS(-this.pathOffset.x,t),", ").concat(eS(-this.pathOffset.y,t),")")}toClipPathSVG(t){let e=this._getOffsetTransform();return" "+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})}toSVG(t){let e=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})}complexity(){return this.path.length}setDimensions(){this.setBoundingBox()}setBoundingBox(t){let{width:e,height:r,pathOffset:i}=this._calcDimensions();this.set({width:e,height:r,pathOffset:i}),t&&this.setPositionByOrigin(i,tC,tC)}_calcBoundsFromPath(){let t=[],e=0,r=0,i=0,n=0;for(let s of this.path)switch(s[0]){case"L":i=s[1],n=s[2],t.push({x:e,y:r},{x:i,y:n});break;case"M":i=s[1],n=s[2],e=i,r=n;break;case"C":t.push(...nR(i,n,s[1],s[2],s[3],s[4],s[5],s[6])),i=s[5],n=s[6];break;case"Q":t.push(...nR(i,n,s[1],s[2],s[1],s[2],s[3],s[4])),i=s[3],n=s[4];break;case"Z":i=e,n=r}return eX(t)}_calcDimensions(){let t=this._calcBoundsFromPath();return te(te({},t),{},{pathOffset:new tZ(t.left+t.width/2,t.top+t.height/2)})}static fromObject(t){return this._fromObject(t,{extraParam:"path"})}static async fromElement(t,e,r){let i=nc(t,this.ATTRIBUTE_NAMES,r),{d:n}=i;return new this(n,te(te(te({},tr(i,sy)),e),{},{left:void 0,top:void 0}))}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{path:r,left:i,top:n}=e,s=tr(e,sv);super(),Object.assign(this,sx.ownDefaults),this.setOptions(s),this._setPath(t||[],!0),"number"==typeof i&&this.set(tS,i),"number"==typeof n&&this.set("top",n)}}$(sx,"type","Path"),$(sx,"cacheProperties",[...rY,"path","fillRule"]),$(sx,"ATTRIBUTE_NAMES",[...i5,"d"]),tY.setClass(sx),tY.setSVGClass(sx);class sb extends sm{needsFullRender(){return super.needsFullRender()||this._hasStraightLine}static drawSegment(t,e,r){let i=e.midPointFrom(r);return t.quadraticCurveTo(e.x,e.y,i.x,i.y),i}onMouseDown(t,e){let{e:r}=e;this.canvas._isMainEvent(r)&&(this.drawStraightLine=!!this.straightLineKey&&r[this.straightLineKey],this._prepareForDrawing(t),this._addPoint(t),this._render())}onMouseMove(t,e){let{e:r}=e;if(this.canvas._isMainEvent(r)&&(this.drawStraightLine=!!this.straightLineKey&&r[this.straightLineKey],(!0!==this.limitedToCanvasSize||!this._isOutSideCanvas(t))&&this._addPoint(t)&&this._points.length>1))if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{let t=this._points,e=t.length,r=this.canvas.contextTop;this._saveAndTransform(r),this.oldEnd&&(r.beginPath(),r.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=sb.drawSegment(r,t[e-2],t[e-1]),r.stroke(),r.restore()}}onMouseUp(t){let{e:e}=t;return!this.canvas._isMainEvent(e)||(this.drawStraightLine=!1,this.oldEnd=void 0,this._finalizeAndAddPath(),!1)}_prepareForDrawing(t){this._reset(),this._addPoint(t),this.canvas.contextTop.moveTo(t.x,t.y)}_addPoint(t){return!(this._points.length>1&&t.eq(this._points[this._points.length-1]))&&(this.drawStraightLine&&this._points.length>1&&(this._hasStraightLine=!0,this._points.pop()),this._points.push(t),!0)}_reset(){this._points=[],this._setBrushStyles(this.canvas.contextTop),this._setShadow(),this._hasStraightLine=!1}_render(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.canvas.contextTop,e=this._points[0],r=this._points[1];if(this._saveAndTransform(t),t.beginPath(),2===this._points.length&&e.x===r.x&&e.y===r.y){let t=this.width/1e3;e.x-=t,r.x+=t}t.moveTo(e.x,e.y);for(let i=1;i=i&&s.push(r=t[e]);return s.push(t[n]),s}_finalizeAndAddPath(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));let t=this.convertPointsToSVGPath(this._points);if("M 0 0 Q 0 0 0 0 L 0 0"===n0(t))return void this.canvas.requestRenderAll();let e=this.createPath(t);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire("before:path:created",{path:e}),this.canvas.add(e),this.canvas.requestRenderAll(),e.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:e})}constructor(t){super(t),$(this,"decimate",.4),$(this,"drawStraightLine",!1),$(this,"straightLineKey","shiftKey"),this._points=[],this._hasStraightLine=!1}}let s_=["left","top","radius"],sw=["radius","startAngle","endAngle","counterClockwise"];class sC extends iU{static getDefaults(){return te(te({},super.getDefaults()),sC.ownDefaults)}_set(t,e){return super._set(t,e),"radius"===t&&this.setRadius(e),this}_render(t){t.beginPath(),t.arc(0,0,this.radius,er(this.startAngle),er(this.endAngle),this.counterClockwise),this._renderPaintInOrder(t)}getRadiusX(){return this.get("radius")*this.get(tB)}getRadiusY(){return this.get("radius")*this.get(tN)}setRadius(t){this.radius=t,this.set({width:2*t,height:2*t})}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return super.toObject([...sw,...t])}_toSVG(){let t=(this.endAngle-this.startAngle)%360;if(0===t)return["\n'];{let{radius:e}=this,r=er(this.startAngle),i=er(this.endAngle),n=tQ(r)*e,s=tJ(r)*e,a=tQ(i)*e,o=tJ(i)*e,l=+!this.counterClockwise;return['180)," ").concat(l," ").concat(a," ").concat(o,'" '),"COMMON_PARTS"," />\n"]}}static async fromElement(t,e,r){let i=nc(t,this.ATTRIBUTE_NAMES,r),{left:n=0,top:s=0,radius:a=0}=i;return new this(te(te({},tr(i,s_)),{},{radius:a,left:n-a,top:s-a}))}static fromObject(t){return super._fromObject(t)}constructor(t){super(),Object.assign(this,sC.ownDefaults),this.setOptions(t)}}$(sC,"type","Circle"),$(sC,"cacheProperties",[...rY,...sw]),$(sC,"ownDefaults",{radius:0,startAngle:0,endAngle:360,counterClockwise:!1}),$(sC,"ATTRIBUTE_NAMES",["cx","cy","r",...i5]),tY.setClass(sC),tY.setSVGClass(sC);let sS=["x1","y1","x2","y2"],sT=["x1","y1","x2","y2"],sO=["x1","x2","y1","y2"];class sk extends iU{_setWidthHeight(){let{x1:t,y1:e,x2:r,y2:i}=this;this.width=Math.abs(r-t),this.height=Math.abs(i-e);let{left:n,top:s,width:a,height:o}=eX([{x:t,y:e},{x:r,y:i}]),l=new tZ(n+a/2,s+o/2);this.setPositionByOrigin(l,tC,tC)}_set(t,e){return super._set(t,e),sO.includes(t)&&this._setWidthHeight(),this}_render(t){var e;t.beginPath();let r=this.calcLinePoints();t.moveTo(r.x1,r.y1),t.lineTo(r.x2,r.y2),t.lineWidth=this.strokeWidth;let i=t.strokeStyle;eO(this.stroke)?t.strokeStyle=this.stroke.toLive(t):t.strokeStyle=null!=(e=this.stroke)?e:t.fillStyle,this.stroke&&this._renderStroke(t),t.strokeStyle=i}_findCenterFromElement(){return new tZ((this.x1+this.x2)/2,(this.y1+this.y2)/2)}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return te(te({},super.toObject(t)),this.calcLinePoints())}_getNonTransformedDimensions(){let t=super._getNonTransformedDimensions();return"butt"===this.strokeLineCap&&(0===this.width&&(t.y-=this.strokeWidth),0===this.height&&(t.x-=this.strokeWidth)),t}calcLinePoints(){let{x1:t,x2:e,y1:r,y2:i,width:n,height:s}=this,a=t<=e?-1:1,o=r<=i?-1:1;return{x1:a*n/2,x2:-(a*n)/2,y1:o*s/2,y2:-(o*s)/2}}_toSVG(){let{x1:t,x2:e,y1:r,y2:i}=this.calcLinePoints();return["\n')]}static async fromElement(t,e,r){let i=nc(t,this.ATTRIBUTE_NAMES,r),{x1:n=0,y1:s=0,x2:a=0,y2:o=0}=i;return new this([n,s,a,o],tr(i,sS))}static fromObject(t){let{x1:e,y1:r,x2:i,y2:n}=t,s=tr(t,sT);return this._fromObject(te(te({},s),{},{points:[e,r,i,n]}),{extraParam:"points"})}constructor(){let[t,e,r,i]=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0,0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),Object.assign(this,sk.ownDefaults),this.setOptions(n),this.x1=t,this.x2=r,this.y1=e,this.y2=i,this._setWidthHeight();let{left:s,top:a}=n;"number"==typeof s&&this.set(tS,s),"number"==typeof a&&this.set("top",a)}}$(sk,"type","Line"),$(sk,"cacheProperties",[...rY,...sO]),$(sk,"ATTRIBUTE_NAMES",i5.concat(sO)),tY.setClass(sk),tY.setSVGClass(sk);class sM extends iU{static getDefaults(){return te(te({},super.getDefaults()),sM.ownDefaults)}_render(t){let e=this.width/2,r=this.height/2;t.beginPath(),t.moveTo(-e,r),t.lineTo(0,-r),t.lineTo(e,r),t.closePath(),this._renderPaintInOrder(t)}_toSVG(){let t=this.width/2,e=this.height/2;return["']}constructor(t){super(),Object.assign(this,sM.ownDefaults),this.setOptions(t)}}$(sM,"type","Triangle"),$(sM,"ownDefaults",{width:100,height:100}),tY.setClass(sM),tY.setSVGClass(sM);let sE=["rx","ry"];class sD extends iU{static getDefaults(){return te(te({},super.getDefaults()),sD.ownDefaults)}_set(t,e){switch(super._set(t,e),t){case"rx":this.rx=e,this.set("width",2*e);break;case"ry":this.ry=e,this.set("height",2*e)}return this}getRx(){return this.get("rx")*this.get(tB)}getRy(){return this.get("ry")*this.get(tN)}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return super.toObject([...sE,...t])}_toSVG(){return["\n')]}_render(t){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(0,0,this.rx,0,tb,!1),t.restore(),this._renderPaintInOrder(t)}static async fromElement(t,e,r){let i=nc(t,this.ATTRIBUTE_NAMES,r);return i.left=(i.left||0)-i.rx,i.top=(i.top||0)-i.ry,new this(i)}constructor(t){super(),Object.assign(this,sD.ownDefaults),this.setOptions(t)}}$(sD,"type","Ellipse"),$(sD,"cacheProperties",[...rY,...sE]),$(sD,"ownDefaults",{rx:0,ry:0}),$(sD,"ATTRIBUTE_NAMES",[...i5,"cx","cy","rx","ry"]),tY.setClass(sD),tY.setSVGClass(sD);let sj=["left","top"],sA={exactBoundingBox:!1};class sP extends iU{static getDefaults(){return te(te({},super.getDefaults()),sP.ownDefaults)}isOpen(){return!0}_projectStrokeOnPoints(t){return iG(this.points,t,this.isOpen())}_calcDimensions(t){t=te({scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,strokeLineCap:this.strokeLineCap,strokeLineJoin:this.strokeLineJoin,strokeMiterLimit:this.strokeMiterLimit,strokeUniform:this.strokeUniform,strokeWidth:this.strokeWidth},t||{});let e=this.exactBoundingBox?this._projectStrokeOnPoints(t).map(t=>t.projectedPoint):this.points;if(0===e.length)return{left:0,top:0,width:0,height:0,pathOffset:new tZ,strokeOffset:new tZ,strokeDiff:new tZ};let r=eX(e),i=ev(te(te({},t),{},{scaleX:1,scaleY:1})),n=eX(this.points.map(t=>es(t,i,!0))),s=new tZ(this.scaleX,this.scaleY),a=r.left+r.width/2,o=r.top+r.height/2;return this.exactBoundingBox&&(a-=o*Math.tan(er(this.skewX)),o-=a*Math.tan(er(this.skewY))),te(te({},r),{},{pathOffset:new tZ(a,o),strokeOffset:new tZ(n.left,n.top).subtract(new tZ(r.left,r.top)).multiply(s),strokeDiff:new tZ(r.width,r.height).subtract(new tZ(n.width,n.height)).multiply(s)})}_findCenterFromElement(){let t=eX(this.points);return new tZ(t.left+t.width/2,t.top+t.height/2)}setDimensions(){this.setBoundingBox()}setBoundingBox(t){let{left:e,top:r,width:i,height:n,pathOffset:s,strokeOffset:a,strokeDiff:o}=this._calcDimensions();this.set({width:i,height:n,pathOffset:s,strokeOffset:a,strokeDiff:o}),t&&this.setPositionByOrigin(new tZ(e+i/2,r+n/2),tC,tC)}isStrokeAccountedForInDimensions(){return this.exactBoundingBox}_getNonTransformedDimensions(){return this.exactBoundingBox?new tZ(this.width,this.height):super._getNonTransformedDimensions()}_getTransformedDimensions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.exactBoundingBox){var e,r,i,n;let s;if(Object.keys(t).some(t=>this.strokeUniform||this.constructor.layoutProperties.includes(t))){let{width:i,height:n}=this._calcDimensions(t);s=new tZ(null!=(e=t.width)?e:i,null!=(r=t.height)?r:n)}else s=new tZ(null!=(i=t.width)?i:this.width,null!=(n=t.height)?n:this.height);return s.multiply(new tZ(t.scaleX||this.scaleX,t.scaleY||this.scaleY))}return super._getTransformedDimensions(t)}_set(t,e){let r=this.initialized&&this[t]!==e,i=super._set(t,e);return this.exactBoundingBox&&r&&((t===tB||t===tN)&&this.strokeUniform&&this.constructor.layoutProperties.includes("strokeUniform")||this.constructor.layoutProperties.includes(t))&&this.setDimensions(),i}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return te(te({},super.toObject(t)),{},{points:this.points.map(t=>{let{x:e,y:r}=t;return{x:e,y:r}})})}_toSVG(){let t=[],e=this.pathOffset.x,r=this.pathOffset.y,i=ts.NUM_FRACTION_DIGITS;for(let n=0,s=this.points.length;n\n')]}_render(t){let e=this.points.length,r=this.pathOffset.x,i=this.pathOffset.y;if(e&&!isNaN(this.points[e-1].y)){t.beginPath(),t.moveTo(this.points[0].x-r,this.points[0].y-i);for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),$(this,"strokeDiff",void 0),Object.assign(this,sP.ownDefaults),this.setOptions(e),this.points=t;let{left:r,top:i}=e;this.initialized=!0,this.setBoundingBox(!0),"number"==typeof r&&this.set(tS,r),"number"==typeof i&&this.set("top",i)}}$(sP,"ownDefaults",sA),$(sP,"type","Polyline"),$(sP,"layoutProperties",[tW,tU,"strokeLineCap","strokeLineJoin","strokeMiterLimit","strokeWidth","strokeUniform","points"]),$(sP,"cacheProperties",[...rY,"points"]),$(sP,"ATTRIBUTE_NAMES",[...i5]),tY.setClass(sP),tY.setSVGClass(sP);class sF extends sP{isOpen(){return!1}}$(sF,"ownDefaults",sA),$(sF,"type","Polygon"),tY.setClass(sF),tY.setSVGClass(sF);class sL extends iU{isEmptyStyles(t){if(!this.styles||void 0!==t&&!this.styles[t])return!0;let e=void 0===t?this.styles:{line:this.styles[t]};for(let t in e)for(let r in e[t])for(let i in e[t][r])return!1;return!0}styleHas(t,e){if(!this.styles||void 0!==e&&!this.styles[e])return!1;let r=void 0===e?this.styles:{0:this.styles[e]};for(let e in r)for(let i in r[e])if(void 0!==r[e][i][t])return!0;return!1}cleanStyle(t){if(!this.styles)return!1;let e=this.styles,r,i,n=0,s=!0,a=0;for(let a in e){for(let o in r=0,e[a]){let l=e[a][o]||{};n++,void 0!==l[t]?(i?l[t]!==i&&(s=!1):i=l[t],l[t]===this[t]&&delete l[t]):s=!1,0!==Object.keys(l).length?r++:delete e[a][o]}0===r&&delete e[a]}for(let t=0;tvoid 0!==t);this._setStyleDeclaration(r,i,n)}getSelectionStyles(t,e,r){let i=[];for(let n=t;n<(e||t);n++)i.push(this.getStyleAtPosition(n,r));return i}getStyleAtPosition(t,e){let{lineIndex:r,charIndex:i}=this.get2DCursorLocation(t);return e?this.getCompleteStyleDeclaration(r,i):this._getStyleDeclaration(r,i)}setSelectionStyles(t,e,r){for(let i=e;i<(r||e);i++)this._extendStyles(i,t);this._forceClearCache=!0}_getStyleDeclaration(t,e){var r;let i=this.styles&&this.styles[t];return i&&null!=(r=i[e])?r:{}}getCompleteStyleDeclaration(t,e){return te(te({},ew(this,this.constructor._styleProperties)),this._getStyleDeclaration(t,e))}_setStyleDeclaration(t,e,r){this.styles[t][e]=r}_deleteStyleDeclaration(t,e){delete this.styles[t][e]}_getLineStyle(t){return!!this.styles[t]}_setLineStyle(t){this.styles[t]={}}_deleteLineStyle(t){delete this.styles[t]}}$(sL,"_styleProperties",rv);let sR=/ +/g,sI=/"/g;function sB(t,e,r,i,n){return" ".concat(function(t,e){let{left:r,top:i,width:n,height:s}=e,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ts.NUM_FRACTION_DIGITS,o=rh(tH,t,!1),[l,h,c,u]=[r,i,n,s].map(t=>eS(t,a));return"')}(t,{left:e,top:r,width:i,height:n}),"\n")}let sN=["textAnchor","textDecoration","dx","dy","top","left","fontSize","strokeWidth"];class sW extends sL{static getDefaults(){return te(te({},super.getDefaults()),sW.ownDefaults)}setPathInfo(){let t=this.path;t&&(t.segmentsInfo=nY(t.path))}_splitText(){let t=this._splitTextIntoLines(this.text);return this.textLines=t.lines,this._textLines=t.graphemeLines,this._unwrappedTextLines=t._unwrappedLines,this._text=t.graphemeText,t}initDimensions(){this._splitText(),this._clearCache(),this.dirty=!0,this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),this.textAlign.includes(ry)&&this.enlargeSpaces()}enlargeSpaces(){let t,e,r,i,n,s,a;for(let o=0,l=this._textLines.length;o')}_getCacheCanvasDimensions(){let t=super._getCacheCanvasDimensions(),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t}_render(t){let e=this.path;e&&!e.isNotVisible()&&e._render(t),this._setTextStyles(t),this._renderTextLinesBackground(t),this._renderTextDecoration(t,"underline"),this._renderText(t),this._renderTextDecoration(t,"overline"),this._renderTextDecoration(t,"linethrough")}_renderText(t){this.paintFirst===tX?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))}_setTextStyles(t,e,r){if(t.textBaseline="alphabetic",this.path)switch(this.pathAlign){case tC:t.textBaseline="middle";break;case"ascender":t.textBaseline="top";break;case"descender":t.textBaseline=tT}t.font=this._getFontDeclaration(e,r)}calcTextWidth(){let t=this.getLineWidth(0);for(let e=1,r=this._textLines.length;et&&(t=r)}return t}_renderTextLine(t,e,r,i,n,s){this._renderChars(t,e,r,i,n,s)}_renderTextLinesBackground(t){if(!this.textBackgroundColor&&!this.styleHas("textBackgroundColor"))return;let e=t.fillStyle,r=this._getLeftOffset(),i=this._getTopOffset();for(let e=0,n=this._textLines.length;e=0:ie?t%=e:t<0&&(t+=e),this._setGraphemeOnPath(t,r),t+=r.kernedWidth}return{width:i,numOfSpaces:0}}_setGraphemeOnPath(t,e){let r=t+e.kernedWidth/2,i=this.path,n=nG(i.path,r,i.segmentsInfo);e.renderLeft=n.x-i.pathOffset.x,e.renderTop=n.y-i.pathOffset.y,e.angle=n.angle+(this.pathSide===tO?Math.PI:0)}_getGraphemeBox(t,e,r,i,n){let s=this.getCompleteStyleDeclaration(e,r),a=i?this.getCompleteStyleDeclaration(e,r-1):{},o=this._measureChar(t,s,i,a),l,h=o.kernedWidth,c=o.width;0!==this.charSpacing&&(c+=l=this._getWidthOfCharSpacing(),h+=l);let u={width:c,left:0,height:s.fontSize,kernedWidth:h,deltaY:s.deltaY};if(r>0&&!n){let t=this.__charBounds[e][r-1];u.left=t.left+t.width+o.kernedWidth-o.width}return u}getHeightOfLine(t){if(this.__lineHeights[t])return this.__lineHeights[t];let e=this.getHeightOfChar(t,0);for(let r=1,i=this._textLines[t].length;r0){let e=this.fontSize*y/1e3,r=i+d+f;"rtl"===this.direction&&(r=this.width-r-g),p&&m&&y&&(t.fillStyle=m,t.fillRect(r,w+o*C+S-a*e,g,e)),f=s.left,g=s.width,p=x,y=_,m=b,C=h,S=c}else g+=s.kernedWidth}let T=i+d+f;"rtl"===this.direction&&(T=this.width-T-g),t.fillStyle=b;let O=this.fontSize*_/1e3;x&&b&&_&&t.fillRect(T,w+o*C+S-a*O,g-s,O),r+=h}this._removeShadow(t)}_getFontDeclaration(){let{fontFamily:t=this.fontFamily,fontStyle:e=this.fontStyle,fontWeight:r=this.fontWeight,fontSize:i=this.fontSize}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,s=t.includes("'")||t.includes('"')||t.includes(",")||sW.genericFonts.includes(t.toLowerCase())?t:'"'.concat(t,'"');return[e,r,"".concat(n?this.CACHE_FONT_SIZE:i,"px"),s].join(" ")}render(t){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._forceClearCache&&this.initDimensions(),super.render(t)))}graphemeSplit(t){return iQ(t)}_splitTextIntoLines(t){let e=t.split(this._reNewline),r=Array(e.length),i=["\n"],n=[];for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[];return te(te({},super.toObject([...rm,...t])),{},{styles:i1(this.styles,this.text)},this.path?{path:this.path.toObject()}:{})}set(t,e){let{textLayoutProperties:r}=this.constructor;super.set(t,e);let i=!1,n=!1;if("object"==typeof t)for(let e in t)"path"===e&&this.setPathInfo(),i=i||r.includes(e),n=n||"path"===e;else i=r.includes(t),n="path"===t;return n&&this.setPathInfo(),i&&this.initialized&&(this.initDimensions(),this.setCoords()),this}complexity(){return 1}static async fromElement(t,e,r){let i=nc(t,sW.ATTRIBUTE_NAMES,r),n=te(te({},e),i),{textAnchor:s=tS,textDecoration:a="",dx:o=0,dy:l=0,top:h=0,left:c=0,fontSize:u=16,strokeWidth:d=1}=n,f=tr(n,sN),g=new this((t.textContent||"").replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," "),te({left:c+o,top:h+l,underline:a.includes("underline"),overline:a.includes("overline"),linethrough:a.includes("line-through"),strokeWidth:0,fontSize:u},f)),p=g.getScaledHeight()/g.height,m=((g.height+g.strokeWidth)*g.lineHeight-g.height)*p,y=g.getScaledHeight()+m,x=0;return s===tC&&(x=g.getScaledWidth()/2),s===tO&&(x=g.getScaledWidth()),g.set({left:g.left-x,top:g.top-(y-g.fontSize*(.07+g._fontSizeFraction))/g.lineHeight,strokeWidth:d}),g}static fromObject(t){return this._fromObject(te(te({},t),{},{styles:i2(t.styles||{},t.text)}),{extraParam:"text"})}constructor(t,e){super(),$(this,"__charBounds",[]),Object.assign(this,sW.ownDefaults),this.setOptions(e),this.styles||(this.styles={}),this.text=t,this.initialized=!0,this.path&&this.setPathInfo(),this.initDimensions(),this.setCoords()}}$(sW,"textLayoutProperties",rp),$(sW,"cacheProperties",[...rY,...rm]),$(sW,"ownDefaults",{_reNewline:tM,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:tS,fontStyle:"normal",lineHeight:1.16,textBackgroundColor:"",stroke:null,shadow:null,path:void 0,pathStartOffset:0,pathSide:tS,pathAlign:"baseline",charSpacing:0,deltaY:0,direction:"ltr",CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.28167,overline:-.81333},_fontSizeMult:1.13,[rd]:66.667}),$(sW,"type","Text"),$(sW,"genericFonts",["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]),$(sW,"ATTRIBUTE_NAMES",i5.concat("x","y","dx","dy","font-family","font-style","font-weight","font-size","letter-spacing","text-decoration","text-anchor")),iW(sW,[class extends rc{_toSVG(){let t=this._getSVGLeftTopOffsets(),e=this._getSVGTextAndBg(t.textTop,t.textLeft);return this._wrapSVGTextAndBg(e)}toSVG(t){let e=this._createBaseSVGMarkup(this._toSVG(),{reviver:t,noStyle:!0,withShadow:!0}),r=this.path;return r?e+r._createBaseSVGMarkup(r._toSVG(),{reviver:t,withShadow:!0,additionalTransform:eT(this.calcOwnMatrix())}):e}_getSVGLeftTopOffsets(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}}_wrapSVGTextAndBg(t){let{textBgRects:e,textSpans:r}=t,i=this.getSvgTextDecoration(this);return[e.join(""),' ",r.join(""),"\n"]}_getSVGTextAndBg(t,e){let r=[],i=[],n,s=t;this.backgroundColor&&i.push(...sB(this.backgroundColor,-this.width/2,-this.height/2,this.width,this.height));for(let t=0,a=this._textLines.length;t").concat(iK(t),"")}_setSVGTextLineText(t,e,r,i){let n=this.getHeightOfLine(e),s=this.textAlign.includes(ry),a=this._textLines[e],o,l,h,c,u,d="",f=0;i+=n*(1-this._fontSizeFraction)/this.lineHeight;for(let n=0,g=a.length-1;n<=g;n++)u=n===g||this.charSpacing||this.path,d+=a[n],h=this.__charBounds[e][n],0===f?(r+=h.kernedWidth-h.width,f+=h.width):f+=h.kernedWidth,s&&!u&&this._reSpaceAndTab.test(a[n])&&(u=!0),u||(u=i0(o=o||this.getCompleteStyleDeclaration(e,n),l=this.getCompleteStyleDeclaration(e,n+1),!0)),u&&(c=this._getStyleDeclaration(e,n),t.push(this._createTextCharSpan(d,c,r,i,h)),d="",o=l,"rtl"===this.direction?r-=f:r+=f,f=0)}_setSVGTextLineBg(t,e,r,i){let n=this._textLines[e],s=this.getHeightOfLine(e)/this.lineHeight,a,o=0,l=0,h=this.getValueOfPropertyAt(e,0,"textBackgroundColor");for(let c=0;ct[e.replace("-","")]).join(" ")}}]),tY.setClass(sW),tY.setSVGClass(sW);class sU{isPointerOverSelection(t){let e=this.target,r=e.getSelectionStartFromPointer(t);return e.isEditing&&r>=e.selectionStart&&r<=e.selectionEnd&&e.selectionStart{b.remove()},ej(t.target||this.target.hiddenTextarea).body.appendChild(b),null==(r=t.dataTransfer)||r.setDragImage(b,p.x,p.y)}onDragStart(t){this.__dragStartFired=!0;let e=this.target,r=this.isActive();if(r&&t.dataTransfer){let r=this.__dragStartSelection={selectionStart:e.selectionStart,selectionEnd:e.selectionEnd},i=e._text.slice(r.selectionStart,r.selectionEnd).join(""),n=te({text:e.text,value:i},r);t.dataTransfer.setData("text/plain",i),t.dataTransfer.setData("application/fabric",JSON.stringify({value:i,styles:e.getSelectionStyles(r.selectionStart,r.selectionEnd,!0)})),t.dataTransfer.effectAllowed="copyMove",this.setDragImage(t,n)}return e.abortCursorAnimation(),r}canDrop(t){if(this.target.editable&&!this.target.getActiveControl()&&!t.defaultPrevented){if(this.isActive()&&this.__dragStartSelection){let e=this.target.getSelectionStartFromPointer(t),r=this.__dragStartSelection;return er.selectionEnd}return!0}return!1}targetCanDrop(t){return this.target.canDrop(t)}dragEnterHandler(t){let{e:e}=t,r=this.targetCanDrop(e);!this.__isDraggingOver&&r&&(this.__isDraggingOver=!0)}dragOverHandler(t){let{e:e}=t,r=this.targetCanDrop(e);!this.__isDraggingOver&&r?this.__isDraggingOver=!0:this.__isDraggingOver&&!r&&(this.__isDraggingOver=!1),this.__isDraggingOver&&(e.preventDefault(),t.canDrop=!0,t.dropTarget=this.target)}dragLeaveHandler(){(this.__isDraggingOver||this.isActive())&&(this.__isDraggingOver=!1)}dropHandler(t){var e;let{e:r}=t,i=r.defaultPrevented;this.__isDraggingOver=!1,r.preventDefault();let n=null==(e=r.dataTransfer)?void 0:e.getData("text/plain");if(n&&!i){let e=this.target,i=e.canvas,s=e.getSelectionStartFromPointer(r),{styles:a}=r.dataTransfer.types.includes("application/fabric")?JSON.parse(r.dataTransfer.getData("application/fabric")):{},o=n[Math.max(0,n.length-1)];if(this.__dragStartSelection){let t=this.__dragStartSelection.selectionStart,r=this.__dragStartSelection.selectionEnd;s>t&&s<=r?s=t:s>r&&(s-=r-t),e.removeChars(t,r),delete this.__dragStartSelection}e._reNewline.test(o)&&(e._reNewline.test(e._text[s])||s===e._text.length)&&(n=n.trimEnd()),t.didDrop=!0,t.dropTarget=e,e.insertChars(n,a,s),i.setActiveObject(e),e.enterEditing(r),e.selectionStart=Math.min(s+0,e._text.length),e.selectionEnd=Math.min(e.selectionStart+n.length,e._text.length),e.hiddenTextarea.value=e.text,e._updateTextarea(),e.hiddenTextarea.focus(),e.fire(tR,{index:s+0,action:"drop"}),i.fire("text:changed",{target:e}),i.contextTopDirty=!0,i.requestRenderAll()}}dragEndHandler(t){let{e:e}=t;if(this.isActive()&&this.__dragStartFired&&this.__dragStartSelection){var r;let t=this.target,i=this.target.canvas,{selectionStart:n,selectionEnd:s}=this.__dragStartSelection,a=(null==(r=e.dataTransfer)?void 0:r.dropEffect)||tk;a===tk?(t.selectionStart=n,t.selectionEnd=s,t._updateTextarea(),t.hiddenTextarea.focus()):(t.clearContextTop(),"move"===a&&(t.removeChars(n,s),t.selectionStart=t.selectionEnd=n,t.hiddenTextarea&&(t.hiddenTextarea.value=t.text),t._updateTextarea(),t.fire(tR,{index:n,action:"dragend"}),i.fire("text:changed",{target:t}),i.requestRenderAll()),t.exitEditing())}this.__dragImageDisposer&&this.__dragImageDisposer(),delete this.__dragImageDisposer,delete this.__dragStartSelection,this.__isDraggingOver=!1}dispose(){this._dispose&&this._dispose()}constructor(t){$(this,"target",void 0),$(this,"__mouseDownInPlace",!1),$(this,"__dragStartFired",!1),$(this,"__isDraggingOver",!1),$(this,"__dragStartSelection",void 0),$(this,"__dragImageDisposer",void 0),$(this,"_dispose",void 0),this.target=t;let e=[this.target.on("dragenter",this.dragEnterHandler.bind(this)),this.target.on("dragover",this.dragOverHandler.bind(this)),this.target.on("dragleave",this.dragLeaveHandler.bind(this)),this.target.on("dragend",this.dragEndHandler.bind(this)),this.target.on("drop",this.dropHandler.bind(this))];this._dispose=()=>{e.forEach(t=>t()),this._dispose=void 0}}}let sH=/[ \n\.,;!\?\-]/;class sX extends sW{initBehavior(){this._tick=this._tick.bind(this),this._onTickComplete=this._onTickComplete.bind(this),this.updateSelectionOnMouseMove=this.updateSelectionOnMouseMove.bind(this)}onDeselect(t){return this.isEditing&&this.exitEditing(),this.selected=!1,super.onDeselect(t)}_animateCursor(t){let{toValue:e,duration:r,delay:i,onComplete:n}=t;return r7({startValue:this._currentCursorOpacity,endValue:e,duration:r,delay:i,onComplete:n,abort:()=>!this.canvas||this.selectionStart!==this.selectionEnd,onChange:t=>{this._currentCursorOpacity=t,this.renderCursorOrSelection()}})}_tick(t){this._currentTickState=this._animateCursor({toValue:0,duration:this.cursorDuration/2,delay:Math.max(t||0,100),onComplete:this._onTickComplete})}_onTickComplete(){var t;null==(t=this._currentTickCompleteState)||t.abort(),this._currentTickCompleteState=this._animateCursor({toValue:1,duration:this.cursorDuration,onComplete:this._tick})}initDelayedCursor(t){this.abortCursorAnimation(),this._tick(t?0:this.cursorDelay)}abortCursorAnimation(){let t=!1;[this._currentTickState,this._currentTickCompleteState].forEach(e=>{e&&!e.isDone()&&(t=!0,e.abort())}),this._currentCursorOpacity=1,t&&this.clearContextTop()}restartCursorIfNeeded(){[this._currentTickState,this._currentTickCompleteState].some(t=>!t||t.isDone())&&this.initDelayedCursor()}selectAll(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this}cmdAll(){this.selectAll(),this.renderCursorOrSelection()}getSelectedText(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")}findWordBoundaryLeft(t){let e=0,r=t-1;if(this._reSpace.test(this._text[r]))for(;this._reSpace.test(this._text[r]);)e++,r--;for(;/\S/.test(this._text[r])&&r>-1;)e++,r--;return t-e}findWordBoundaryRight(t){let e=0,r=t;if(this._reSpace.test(this._text[r]))for(;this._reSpace.test(this._text[r]);)e++,r++;for(;/\S/.test(this._text[r])&&r-1;)e++,r--;return t-e}findLineBoundaryRight(t){let e=0,r=t;for(;!/\n/.test(this._text[r])&&r0&&this._reSpace.test(r[t])&&(-1===e||!tM.test(r[t-1]))?t-1:t,n=r[i];for(;i>0&&ithis.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=r):(this.selectionStart=r,this.selectionEnd=this.__selectionStartOnMouseDown),this.selectionStart===i&&this.selectionEnd===n||(this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}_setEditingProps(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0}fromStringToGraphemeSelection(t,e,r){let i=r.slice(0,t),n=this.graphemeSplit(i).length;if(t===e)return{selectionStart:n,selectionEnd:n};let s=r.slice(t,e);return{selectionStart:n,selectionEnd:n+this.graphemeSplit(s).length}}fromGraphemeToStringSelection(t,e,r){let i=r.slice(0,t).join("").length;return t===e?{selectionStart:i,selectionEnd:i}:{selectionStart:i,selectionEnd:i+r.slice(t,e).join("").length}}_updateTextarea(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){let t=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=t.selectionStart,this.hiddenTextarea.selectionEnd=t.selectionEnd}this.updateTextareaPosition()}}updateFromTextArea(){if(!this.hiddenTextarea)return;this.cursorOffsetCache={};let t=this.hiddenTextarea;this.text=t.value,this.set("dirty",!0),this.initDimensions(),this.setCoords();let e=this.fromStringToGraphemeSelection(t.selectionStart,t.selectionEnd,t.value);this.selectionEnd=this.selectionStart=e.selectionEnd,this.inCompositionMode||(this.selectionStart=e.selectionStart),this.updateTextareaPosition()}updateTextareaPosition(){if(this.selectionStart===this.selectionEnd){let t=this._calcTextareaPosition();this.hiddenTextarea.style.left=t.left,this.hiddenTextarea.style.top=t.top}}_calcTextareaPosition(){if(!this.canvas)return{left:"1px",top:"1px"};let t=this.inCompositionMode?this.compositionStart:this.selectionStart,e=this._getCursorBoundaries(t),r=this.get2DCursorLocation(t),i=r.lineIndex,n=r.charIndex,s=this.getValueOfPropertyAt(i,n,"fontSize")*this.lineHeight,a=e.leftOffset,o=this.getCanvasRetinaScaling(),l=this.canvas.upperCanvasEl,h=l.width/o,c=l.height/o,u=h-s,d=c-s,f=new tZ(e.left+a,e.top+e.topOffset+s).transform(this.calcTransformMatrix()).transform(this.canvas.viewportTransform).multiply(new tZ(l.clientWidth/h,l.clientHeight/c));return f.x<0&&(f.x=0),f.x>u&&(f.x=u),f.y<0&&(f.y=0),f.y>d&&(f.y=d),f.x+=this.canvas._offset.left,f.y+=this.canvas._offset.top,{left:"".concat(f.x,"px"),top:"".concat(f.y,"px"),fontSize:"".concat(s,"px"),charHeight:s}}_saveEditingProps(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}}_restoreEditingProps(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor||this.canvas.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor||this.canvas.moveCursor),delete this._savedProps)}_exitEditing(){let t=this.hiddenTextarea;this.selected=!1,this.isEditing=!1,t&&(t.blur&&t.blur(),t.parentNode&&t.parentNode.removeChild(t)),this.hiddenTextarea=null,this.abortCursorAnimation(),this.selectionStart!==this.selectionEnd&&this.clearContextTop()}exitEditingImpl(){this._exitEditing(),this.selectionEnd=this.selectionStart,this._restoreEditingProps(),this._forceClearCache&&(this.initDimensions(),this.setCoords())}exitEditing(){let t=this._textBeforeEdit!==this.text;return this.exitEditingImpl(),this.fire("editing:exited"),t&&this.fire(tV),this.canvas&&(this.canvas.fire("text:editing:exited",{target:this}),t&&this.canvas.fire("object:modified",{target:this})),this}_removeExtraneousStyles(){for(let t in this.styles)this._textLines[t]||delete this.styles[t]}removeStyleFromTo(t,e){let{lineIndex:r,charIndex:i}=this.get2DCursorLocation(t,!0),{lineIndex:n,charIndex:s}=this.get2DCursorLocation(e,!0);if(r!==n){if(this.styles[r])for(let t=i;t=s&&(t[r-e]=t[i],delete t[i])}}}shiftLineStyles(t,e){let r=Object.assign({},this.styles);for(let i in this.styles){let n=parseInt(i,10);n>t&&(this.styles[n+e]=r[n],r[n-e]||delete this.styles[n])}}insertNewlineStyleObject(t,e,r,i){let n={},s=this._unwrappedTextLines[t].length,a=s===e,o=!1;r||(r=1),this.shiftLineStyles(t,r);let l=this.styles[t]?this.styles[t][0===e?e:e-1]:void 0;for(let r in this.styles[t]){let i=parseInt(r,10);i>=e&&(o=!0,n[i-e]=this.styles[t][r],a&&0===e||delete this.styles[t][r])}let h=!1;for(o&&!a&&(this.styles[t+r]=n,h=!0),(h||s>e)&&r--;r>0;)i&&i[r-1]?this.styles[t+r]={0:te({},i[r-1])}:l?this.styles[t+r]={0:te({},l)}:delete this.styles[t+r],r--;this._forceClearCache=!0}insertCharStyleObject(t,e,r,i){this.styles||(this.styles={});let n=this.styles[t],s=n?te({},n):{};for(let t in r||(r=1),s){let i=parseInt(t,10);i>=e&&(n[i+r]=s[i],s[i-r]||delete n[i])}if(this._forceClearCache=!0,i){for(;r--;)Object.keys(i[r]).length&&(this.styles[t]||(this.styles[t]={}),this.styles[t][e+r]=te({},i[r]));return}if(!n)return;let a=n[e?e-1:1];for(;a&&r--;)this.styles[t][e+r]=te({},a)}insertNewStyleBlock(t,e,r){let i=this.get2DCursorLocation(e,!0),n=[0],s,a=0;for(let e=0;e0&&(this.insertCharStyleObject(i.lineIndex,i.charIndex,n[0],r),r=r&&r.slice(n[0]+1)),a&&this.insertNewlineStyleObject(i.lineIndex,i.charIndex+n[0],a),s=1;s0?this.insertCharStyleObject(i.lineIndex+s,0,n[s],r):r&&this.styles[i.lineIndex+s]&&r[0]&&(this.styles[i.lineIndex+s][0]=r[0]),r=r&&r.slice(n[s]+1);n[s]>0&&this.insertCharStyleObject(i.lineIndex+s,0,n[s],r)}removeChars(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t+1;this.removeStyleFromTo(t,e),this._text.splice(t,e-t),this.text=this._text.join(""),this.set("dirty",!0),this.initDimensions(),this.setCoords(),this._removeExtraneousStyles()}insertChars(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r;i>r&&this.removeStyleFromTo(r,i);let n=this.graphemeSplit(t);this.insertNewStyleBlock(n,r,e),this._text=[...this._text.slice(0,r),...n,...this._text.slice(i)],this.text=this._text.join(""),this.set("dirty",!0),this.initDimensions(),this.setCoords(),this._removeExtraneousStyles()}setSelectionStartEndWithShift(t,e,r){r<=t?(e===t?this._selectionDirection=tS:this._selectionDirection===tO&&(this._selectionDirection=tS,this.selectionEnd=t),this.selectionStart=r):r>t&&r{let[r,i]=t;return e.setAttribute(r,i)});let{top:r,left:i,fontSize:n}=this._calcTextareaPosition();e.style.cssText="position: absolute; top: ".concat(r,"; left: ").concat(i,"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding-top: ").concat(n,";"),(this.hiddenTextareaContainer||t.body).appendChild(e),Object.entries({blur:"blur",keydown:"onKeyDown",keyup:"onKeyUp",input:"onInput",copy:"copy",cut:"copy",paste:"paste",compositionstart:"onCompositionStart",compositionupdate:"onCompositionUpdate",compositionend:"onCompositionEnd"}).map(t=>{let[r,i]=t;return e.addEventListener(r,this[i].bind(this))}),this.hiddenTextarea=e}blur(){this.abortCursorAnimation()}onKeyDown(t){if(!this.isEditing)return;let e="rtl"===this.direction?this.keysMapRtl:this.keysMap;if(t.keyCode in e)this[e[t.keyCode]](t);else{if(!(t.keyCode in this.ctrlKeysMapDown)||!t.ctrlKey&&!t.metaKey)return;this[this.ctrlKeysMapDown[t.keyCode]](t)}t.stopImmediatePropagation(),t.preventDefault(),t.keyCode>=33&&t.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}onKeyUp(t){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:t.keyCode in this.ctrlKeysMapUp&&(t.ctrlKey||t.metaKey)&&(this[this.ctrlKeysMapUp[t.keyCode]](t),t.stopImmediatePropagation(),t.preventDefault(),this.canvas&&this.canvas.requestRenderAll())}onInput(t){let e=this.fromPaste,{value:r,selectionStart:i,selectionEnd:n}=this.hiddenTextarea;if(this.fromPaste=!1,t&&t.stopPropagation(),!this.isEditing)return;let s=()=>{this.updateFromTextArea(),this.fire(tR),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())};if(""===this.hiddenTextarea.value)return this.styles={},void s();let a=this._splitTextIntoLines(r).graphemeText,o=this._text.length,l=a.length,h=this.selectionStart,c=this.selectionEnd,u=h!==c,d,f,g,p,m=l-o,y=this.fromStringToGraphemeSelection(i,n,r),x=h>y.selectionStart;u?(f=this._text.slice(h,c),m+=c-h):ld[0])),u?(g=h,p=c):x?(g=c-f.length,p=c):(g=c,p=c+f.length),this.removeStyleFromTo(g,p)),b.length){let{copyPasteData:t}=td();e&&b.join("")===t.copiedText&&!ts.disableStyleCopyPaste&&(d=t.copiedTextStyle),this.insertNewStyleBlock(b,h,d)}s()}onCompositionStart(){this.inCompositionMode=!0}onCompositionEnd(){this.inCompositionMode=!1}onCompositionUpdate(t){let{target:e}=t,{selectionStart:r,selectionEnd:i}=e;this.compositionStart=r,this.compositionEnd=i,this.updateTextareaPosition()}copy(){if(this.selectionStart===this.selectionEnd)return;let{copyPasteData:t}=td();t.copiedText=this.getSelectedText(),ts.disableStyleCopyPaste?t.copiedTextStyle=void 0:t.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0}paste(){this.fromPaste=!0}_getWidthBeforeCursor(t,e){let r,i=this._getLineLeftOffset(t);return e>0&&(i+=(r=this.__charBounds[t][e-1]).left+r.width),i}getDownCursorOffset(t,e){let r=this._getSelectionForOffset(t,e),i=this.get2DCursorLocation(r),n=i.lineIndex;if(n===this._textLines.length-1||t.metaKey||34===t.keyCode)return this._text.length-r;let s=i.charIndex,a=this._getWidthBeforeCursor(n,s),o=this._getIndexOnLine(n+1,a);return this._textLines[n].slice(s).length+o+1+this.missingNewlineOffset(n)}_getSelectionForOffset(t,e){return t.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart}getUpCursorOffset(t,e){let r=this._getSelectionForOffset(t,e),i=this.get2DCursorLocation(r),n=i.lineIndex;if(0===n||t.metaKey||33===t.keyCode)return-r;let s=i.charIndex,a=this._getWidthBeforeCursor(n,s),o=this._getIndexOnLine(n-1,a),l=this._textLines[n].slice(0,s),h=this.missingNewlineOffset(n-1);return-this._textLines[n-1].length+o-l.length+(1-h)}_getIndexOnLine(t,e){let r=this._textLines[t],i,n,s=this._getLineLeftOffset(t),a=0;for(let o=0,l=r.length;oe){n=!0;let t=Math.abs(s-i-e);a=Math.abs(s-e)=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",t)}moveCursorUp(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorUpOrDown("Up",t)}_moveCursorUpOrDown(t,e){let r=this["get".concat(t,"CursorOffset")](e,this._selectionDirection===tO);if(e.shiftKey?this.moveCursorWithShift(r):this.moveCursorWithoutShift(r),0!==r){let t=this.text.length;this.selectionStart=rV(0,this.selectionStart,t),this.selectionEnd=rV(0,this.selectionEnd,t),this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea()}}moveCursorWithShift(t){let e=this._selectionDirection===tS?this.selectionStart+t:this.selectionEnd+t;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,e),0!==t}moveCursorWithoutShift(t){return t<0?(this.selectionStart+=t,this.selectionEnd=this.selectionStart):(this.selectionEnd+=t,this.selectionStart=this.selectionEnd),0!==t}moveCursorLeft(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight("Left",t)}_move(t,e,r){let i;if(t.altKey)i=this["findWordBoundary".concat(r)](this[e]);else{if(!t.metaKey&&35!==t.keyCode&&36!==t.keyCode)return this[e]+="Left"===r?-1:1,!0;i=this["findLineBoundary".concat(r)](this[e])}return void 0!==i&&this[e]!==i&&(this[e]=i,!0)}_moveLeft(t,e){return this._move(t,e,"Left")}_moveRight(t,e){return this._move(t,e,"Right")}moveCursorLeftWithoutShift(t){let e=!0;return this._selectionDirection=tS,this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(e=this._moveLeft(t,"selectionStart")),this.selectionEnd=this.selectionStart,e}moveCursorLeftWithShift(t){return this._selectionDirection===tO&&this.selectionStart!==this.selectionEnd?this._moveLeft(t,"selectionEnd"):0!==this.selectionStart?(this._selectionDirection=tS,this._moveLeft(t,"selectionStart")):void 0}moveCursorRight(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",t)}_moveCursorLeftOrRight(t,e){let r="moveCursor".concat(t).concat(e.shiftKey?"WithShift":"WithoutShift");this._currentCursorOpacity=1,this[r](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())}moveCursorRightWithShift(t){return this._selectionDirection===tS&&this.selectionStart!==this.selectionEnd?this._moveRight(t,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection=tO,this._moveRight(t,"selectionEnd")):void 0}moveCursorRightWithoutShift(t){let e=!0;return this._selectionDirection=tO,this.selectionStart===this.selectionEnd?(e=this._moveRight(t,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,e}}class sz extends sV{initBehavior(){this.on("mousedown",this._mouseDownHandler),this.on("mouseup",this.mouseUpHandler),this.on("mousedblclick",this.doubleClickHandler),this.on("mousetripleclick",this.tripleClickHandler),this.draggableTextDelegate=new sU(this),super.initBehavior()}shouldStartDragging(){return this.draggableTextDelegate.isActive()}onDragStart(t){return this.draggableTextDelegate.onDragStart(t)}canDrop(t){return this.draggableTextDelegate.canDrop(t)}doubleClickHandler(t){this.isEditing&&(this.selectWord(this.getSelectionStartFromPointer(t.e)),this.renderCursorOrSelection())}tripleClickHandler(t){this.isEditing&&(this.selectLine(this.getSelectionStartFromPointer(t.e)),this.renderCursorOrSelection())}_mouseDownHandler(t){let{e:e,alreadySelected:r}=t;this.canvas&&this.editable&&!e.button&&!this.getActiveControl()&&(this.draggableTextDelegate.start(e)||(this.canvas.textEditingManager.register(this),r&&(this.inCompositionMode=!1,this.setCursorByClick(e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()),this.selected||(this.selected=r||this.isEditing)))}mouseUpHandler(t){let{e:e,transform:r}=t,i=this.draggableTextDelegate.end(e);if(this.canvas){this.canvas.textEditingManager.unregister(this);let t=this.canvas._activeObject;if(t&&t!==this)return}!this.editable||this.group&&!this.group.interactive||r&&r.actionPerformed||e.button||i||this.selected&&!this.getActiveControl()&&(this.enterEditing(e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection())}setCursorByClick(t){let e=this.getSelectionStartFromPointer(t),r=this.selectionStart,i=this.selectionEnd;t.shiftKey?this.setSelectionStartEndWithShift(r,i,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())}getSelectionStartFromPointer(t){let e=this.canvas.getScenePoint(t).transform(ea(this.calcTransformMatrix())).add(new tZ(-this._getLeftOffset(),-this._getTopOffset())),r=0,i=0,n=0;for(let t=0;t0&&(i+=this._textLines[t-1].length+this.missingNewlineOffset(t-1));let s=Math.abs(this._getLineLeftOffset(n)),a=this._textLines[n].length,o=this.__charBounds[n];for(let t=0;t{let r=e.getRetinaScaling();t.setTransform(r,0,0,r,0,0);let i=e.viewportTransform;t.transform(i[0],i[1],i[2],i[3],i[4],i[5])},sZ=te({selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,keysMap:{9:sQ,27:sQ,33:sY,34:sG,35:sK,36:sq,37:sq,38:sY,39:sK,40:sG},keysMapRtl:{9:sQ,27:sQ,33:sY,34:sG,35:sq,36:sK,37:sK,38:sY,39:sq,40:sG},ctrlKeysMapDown:{65:"cmdAll"},ctrlKeysMapUp:{67:"copy",88:"cut"}},{_selectionDirection:null,_reSpace:/\s|\r?\n/,inCompositionMode:!1});class s$ extends sz{static getDefaults(){return te(te({},super.getDefaults()),s$.ownDefaults)}get type(){let t=super.type;return"itext"===t?"i-text":t}_set(t,e){return this.isEditing&&this._savedProps&&t in this._savedProps?(this._savedProps[t]=e,this):("canvas"===t&&(this.canvas instanceof se&&this.canvas.textEditingManager.remove(this),e instanceof se&&e.textEditingManager.add(this)),super._set(t,e))}setSelectionStart(t){t=Math.max(t,0),this._updateAndFire("selectionStart",t)}setSelectionEnd(t){t=Math.min(t,this.text.length),this._updateAndFire("selectionEnd",t)}_updateAndFire(t,e){this[t]!==e&&(this._fireSelectionChanged(),this[t]=e),this._updateTextarea()}_fireSelectionChanged(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})}initDimensions(){this.isEditing&&this.initDelayedCursor(),super.initDimensions()}getSelectionStyles(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectionStart||0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selectionEnd,r=arguments.length>2?arguments[2]:void 0;return super.getSelectionStyles(t,e,r)}setSelectionStyles(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selectionStart||0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.selectionEnd;return super.setSelectionStyles(t,e,r)}get2DCursorLocation(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectionStart,e=arguments.length>1?arguments[1]:void 0;return super.get2DCursorLocation(t,e)}render(t){super.render(t),this.cursorOffsetCache={},this.renderCursorOrSelection()}toCanvasElement(t){let e=this.isEditing;this.isEditing=!1;let r=super.toCanvasElement(t);return this.isEditing=e,r}renderCursorOrSelection(){if(!this.isEditing||!this.canvas)return;let t=this.clearContextTop(!0);if(!t)return;let e=this._getCursorBoundaries(),r=this.findAncestorsWithClipPath(),i=r.length>0,n,s=t;if(i){sJ(s=(n=t7(t.canvas)).getContext("2d"),this.canvas);let e=this.calcTransformMatrix();s.transform(e[0],e[1],e[2],e[3],e[4],e[5])}if(this.selectionStart!==this.selectionEnd||this.inCompositionMode?this.renderSelection(s,e):this.renderCursor(s,e),i)for(let e of r){let r=e.clipPath,i=t7(t.canvas),n=i.getContext("2d");if(sJ(n,this.canvas),!r.absolutePositioned){let t=e.calcTransformMatrix();n.transform(t[0],t[1],t[2],t[3],t[4],t[5])}r.transform(n),r.drawObject(n,!0,{}),this.drawClipPathOnCache(s,r,i)}i&&(t.setTransform(1,0,0,1,0,0),t.drawImage(n,0,0)),this.canvas.contextTopDirty=!0,t.restore()}findAncestorsWithClipPath(){let t=[],e=this;for(;e;)e.clipPath&&t.push(e),e=e.parent;return t}_getCursorBoundaries(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectionStart,e=arguments.length>1?arguments[1]:void 0,r=this._getLeftOffset(),i=this._getTopOffset(),n=this._getCursorBoundariesOffsets(t,e);return{left:r,top:i,leftOffset:n.left,topOffset:n.top}}_getCursorBoundariesOffsets(t,e){return e?this.__getCursorBoundariesOffsets(t):this.cursorOffsetCache&&"top"in this.cursorOffsetCache?this.cursorOffsetCache:this.cursorOffsetCache=this.__getCursorBoundariesOffsets(t)}__getCursorBoundariesOffsets(t){let e=0,r=0,{charIndex:i,lineIndex:n}=this.get2DCursorLocation(t);for(let t=0;t0?r:0)};return"rtl"===this.direction&&(this.textAlign===tO||this.textAlign===ry||this.textAlign===rb?o.left*=-1:this.textAlign===tS||this.textAlign===rx?o.left=s-(r>0?r:0):this.textAlign!==tC&&this.textAlign!==r_||(o.left=s-(r>0?r:0))),o}renderCursorAt(t){this._renderCursor(this.canvas.contextTop,this._getCursorBoundaries(t,!0),t)}renderCursor(t,e){this._renderCursor(t,e,this.selectionStart)}getCursorRenderingData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectionStart,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getCursorBoundaries(t),r=this.get2DCursorLocation(t),i=r.lineIndex,n=r.charIndex>0?r.charIndex-1:0,s=this.getValueOfPropertyAt(i,n,"fontSize"),a=this.getObjectScaling().x*this.canvas.getZoom(),o=this.cursorWidth/a,l=this.getValueOfPropertyAt(i,n,"deltaY"),h=e.topOffset+(1-this._fontSizeFraction)*this.getHeightOfLine(i)/this.lineHeight-s*(1-this._fontSizeFraction);return{color:this.cursorColor||this.getValueOfPropertyAt(i,n,"fill"),opacity:this._currentCursorOpacity,left:e.left+e.leftOffset-o/2,top:h+e.top+l,width:o,height:s}}_renderCursor(t,e,r){let{color:i,opacity:n,left:s,top:a,width:o,height:l}=this.getCursorRenderingData(r,e);t.fillStyle=i,t.globalAlpha=n,t.fillRect(s,a,o,l)}renderSelection(t,e){let r={selectionStart:this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,selectionEnd:this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd};this._renderSelection(t,r,e)}renderDragSourceEffect(){let t=this.draggableTextDelegate.getDragStartSelection();this._renderSelection(this.canvas.contextTop,t,this._getCursorBoundaries(t.selectionStart,!0))}renderDropTargetEffect(t){let e=this.getSelectionStartFromPointer(t);this.renderCursorAt(e)}_renderSelection(t,e,r){let i=e.selectionStart,n=e.selectionEnd,s=this.textAlign.includes(ry),a=this.get2DCursorLocation(i),o=this.get2DCursorLocation(n),l=a.lineIndex,h=o.lineIndex,c=a.charIndex<0?0:a.charIndex,u=o.charIndex<0?0:o.charIndex;for(let e=l;e<=h;e++){let i=this._getLineLeftOffset(e)||0,n=this.getHeightOfLine(e),a=0,o=0,d=0;if(e===l&&(o=this.__charBounds[l][c].left),e>=l&&e1)&&(n/=this.lineHeight);let f=r.left+i+o,g=n,p=0,m=d-o;this.inCompositionMode?(t.fillStyle=this.compositionColor||"black",g=1,p=n):t.fillStyle=this.selectionColor,"rtl"===this.direction&&(this.textAlign===tO||this.textAlign===ry||this.textAlign===rb?f=this.width-f-m:this.textAlign===tS||this.textAlign===rx?f=r.left+i-d:this.textAlign!==tC&&this.textAlign!==r_||(f=r.left+i-d)),t.fillRect(f,r.top+r.topOffset+p,m,g),r.topOffset+=a}}getCurrentCharFontSize(){let t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fontSize")}getCurrentCharColor(){let t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,tH)}_getCurrentCharIndex(){let t=this.get2DCursorLocation(this.selectionStart,!0),e=t.charIndex>0?t.charIndex-1:0;return{l:t.lineIndex,c:e}}dispose(){this.exitEditingImpl(),this.draggableTextDelegate.dispose(),super.dispose()}constructor(t,e){super(t,te(te({},s$.ownDefaults),e)),this.initBehavior()}}$(s$,"ownDefaults",sZ),$(s$,"type","IText"),tY.setClass(s$),tY.setClass(s$,"i-text");class s0 extends s${static getDefaults(){return te(te({},super.getDefaults()),s0.ownDefaults)}static createControls(){return{controls:iB()}}initDimensions(){this.initialized&&(this.isEditing&&this.initDelayedCursor(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),this.textAlign.includes(ry)&&this.enlargeSpaces(),this.height=this.calcTextHeight())}_generateStyleMap(t){let e=0,r=0,i=0,n={};for(let s=0;s0?(r=0,i++,e++):!this.splitByGrapheme&&this._reSpaceAndTab.test(t.graphemeText[i])&&s>0&&(r++,i++),n[s]={line:e,offset:r},i+=t.graphemeLines[s].length,r+=t.graphemeLines[s].length;return n}styleHas(t,e){if(this._styleMap&&!this.isWrapping){let t=this._styleMap[e];t&&(e=t.line)}return super.styleHas(t,e)}isEmptyStyles(t){if(!this.styles)return!0;let e,r=0,i=!1,n=this._styleMap[t],s=this._styleMap[t+1];n&&(t=n.line,r=n.offset),s&&(i=s.line===t,e=s.offset);let a=void 0===t?this.styles:{line:this.styles[t]};for(let t in a)for(let n in a[t]){let s=parseInt(n,10);if(s>=r&&(!i||s{let s=0,a=e?this.graphemeSplit(t):this.wordSplit(t);return 0===a.length?[{word:[],width:0}]:a.map(t=>{let a=e?[t]:this.graphemeSplit(t),o=this._measureWord(a,n,s);return i=Math.max(o,i),s+=a.length+r.length,{word:a,width:o}})}),largestWordWidth:i}}_measureWord(t,e){let r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=0;for(let s=0,a=t.length;s3&&void 0!==arguments[3]?arguments[3]:0,o=this._getWidthOfCharSpacing(),l=this.splitByGrapheme,h=[],c=l?"":" ",u=0,d=[],f=0,g=0,p=!0,m=Math.max(e-=a,n,this.dynamicMinWidth),y=s[t];for(f=0,i=0;im&&!p?(h.push(d),d=[],u=r,p=!0):u+=o,p||l||d.push(c),d=d.concat(e),g=l?0:this._measureWord([c],t,f),f++,p=!1}return i&&h.push(d),n+a>this.dynamicMinWidth&&(this.dynamicMinWidth=n-o+a),h}isEndOfWrapping(t){return!this._styleMap[t+1]||this._styleMap[t+1].line!==this._styleMap[t].line}missingNewlineOffset(t,e){return this.splitByGrapheme&&!e?+!!this.isEndOfWrapping(t):1}_splitTextIntoLines(t){let e=super._splitTextIntoLines(t),r=this._wrapText(e.lines,this.width),i=Array(r.length);for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[];return super.toObject(["minWidth","splitByGrapheme",...t])}constructor(t,e){super(t,te(te({},s0.ownDefaults),e))}}$(s0,"type","Textbox"),$(s0,"textLayoutProperties",[...s$.textLayoutProperties,"width"]),$(s0,"ownDefaults",{minWidth:20,dynamicMinWidth:2,lockScalingFlip:!0,noScaleCache:!1,_wordJoiners:/[ \t\r]/,splitByGrapheme:!1}),tY.setClass(s0);class s1 extends nx{shouldPerformLayout(t){return!!t.target.clipPath&&super.shouldPerformLayout(t)}shouldLayoutClipPath(){return!1}calcLayoutResult(t,e){let{target:r}=t,{clipPath:i,group:n}=r;if(!i||!this.shouldPerformLayout(t))return;let{width:s,height:a}=eX(ny(r,i)),o=new tZ(s,a);if(i.absolutePositioned)return{center:eJ(i.getRelativeCenterPoint(),void 0,n?n.calcTransformMatrix():void 0),size:o};{let n=i.getRelativeCenterPoint().transform(r.calcOwnMatrix(),!0);if(this.shouldPerformLayout(t)){let{center:r=new tZ,correction:i=new tZ}=this.calcBoundingBox(e,t)||{};return{center:r.add(n),correction:i.subtract(n),size:o}}return{center:r.getRelativeCenterPoint().add(n),size:o}}}}$(s1,"type","clip-path"),tY.setClass(s1);class s2 extends nx{getInitialSize(t,e){let{target:r}=t,{size:i}=e;return new tZ(r.width||i.x,r.height||i.y)}}$(s2,"type","fixed"),tY.setClass(s2);class s5 extends nS{subscribeTargets(t){let e=t.target;t.targets.reduce((t,e)=>(e.parent&&t.add(e.parent),t),new Set).forEach(t=>{t.layoutManager.subscribeTargets({target:t,targets:[e]})})}unsubscribeTargets(t){let e=t.target,r=e.getObjects();t.targets.reduce((t,e)=>(e.parent&&t.add(e.parent),t),new Set).forEach(t=>{r.some(e=>e.parent===t)||t.layoutManager.unsubscribeTargets({target:t,targets:[e]})})}}class s4 extends nk{static getDefaults(){return te(te({},super.getDefaults()),s4.ownDefaults)}_shouldSetNestedCoords(){return!0}__objectSelectionMonitor(){}multiSelectAdd(){for(var t=arguments.length,e=Array(t),r=0;r{let e=this._objects.findIndex(e=>e.isInFrontOf(t)),r=-1===e?this.size():e;this.insertAt(r,t)})}canEnterGroup(t){return this.getObjects().some(e=>e.isDescendantOf(t)||t.isDescendantOf(e))?(ta("error","ActiveSelection: circular object trees are not supported, this call has no effect"),!1):super.canEnterGroup(t)}enterGroup(t,e){t.parent&&t.parent===t.group?t.parent._exitGroup(t):t.group&&t.parent!==t.group&&t.group.remove(t),this._enterGroup(t,e)}exitGroup(t,e){this._exitGroup(t,e),t.parent&&t.parent._enterGroup(t,!0)}_onAfterObjectsChange(t,e){super._onAfterObjectsChange(t,e);let r=new Set;e.forEach(t=>{let{parent:e}=t;e&&r.add(e)}),t===nm?r.forEach(t=>{t._onAfterObjectsChange(np,e)}):r.forEach(t=>{t._set("dirty",!0)})}onDeselect(){return this.removeAll(),!1}toString(){return"#")}shouldCache(){return!1}isOnACache(){return!1}_renderControls(t,e,r){t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1;let i=te(te({hasControls:!1},r),{},{forActiveSelection:!0});for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),Object.assign(this,s4.ownDefaults),this.setOptions(e);let{left:r,top:i,layoutManager:n}=e;this.groupInit(t,{left:r,top:i,layoutManager:null!=n?n:new s5})}}$(s4,"type","ActiveSelection"),$(s4,"ownDefaults",{multiSelectionStacking:"canvas-stacking"}),tY.setClass(s4),tY.setClass(s4,"activeSelection");class s3{applyFilters(t,e,r,i,n){let s=n.getContext("2d");if(!s)return;s.drawImage(e,0,0,r,i);let a={sourceWidth:r,sourceHeight:i,imageData:s.getImageData(0,0,r,i),originalEl:e,originalImageData:s.getImageData(0,0,r,i),canvasEl:n,ctx:s,filterBackend:this};t.forEach(t=>{t.applyTo(a)});let{imageData:o}=a;return o.width===r&&o.height===i||(n.width=o.width,n.height=o.height),s.putImageData(o,0,0),a}constructor(){$(this,"resources",{})}}class s9{setupGLContext(t,e){this.dispose(),this.createWebGLCanvas(t,e)}createWebGLCanvas(t,e){let r=t7({width:t,height:e}),i=r.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1});i&&(i.clearColor(0,0,0,0),this.canvas=r,this.gl=i)}applyFilters(t,e,r,i,n,s){let a,o=this.gl,l=n.getContext("2d");if(!o||!l)return;s&&(a=this.getCachedTexture(s,e));let h={originalWidth:e.width||e.naturalWidth||0,originalHeight:e.height||e.naturalHeight||0,sourceWidth:r,sourceHeight:i,destinationWidth:r,destinationHeight:i,context:o,sourceTexture:this.createTexture(o,r,i,a?void 0:e),targetTexture:this.createTexture(o,r,i),originalTexture:a||this.createTexture(o,r,i,a?void 0:e),passes:t.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:n},c=o.createFramebuffer();return o.bindFramebuffer(o.FRAMEBUFFER,c),t.forEach(t=>{t&&t.applyTo(h)}),function(t){let e=t.targetCanvas,r=e.width,i=e.height,n=t.destinationWidth,s=t.destinationHeight;r===n&&i===s||(e.width=n,e.height=s)}(h),this.copyGLTo2D(o,h),o.bindTexture(o.TEXTURE_2D,null),o.deleteTexture(h.sourceTexture),o.deleteTexture(h.targetTexture),o.deleteFramebuffer(c),l.setTransform(1,0,0,1,0,0),h}dispose(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()}clearWebGLCaches(){this.programCache={},this.textureCache={}}createTexture(t,e,r,i,n){let{NEAREST:s,TEXTURE_2D:a,RGBA:o,UNSIGNED_BYTE:l,CLAMP_TO_EDGE:h,TEXTURE_MAG_FILTER:c,TEXTURE_MIN_FILTER:u,TEXTURE_WRAP_S:d,TEXTURE_WRAP_T:f}=t,g=t.createTexture();return t.bindTexture(a,g),t.texParameteri(a,c,n||s),t.texParameteri(a,u,n||s),t.texParameteri(a,d,h),t.texParameteri(a,f,h),i?t.texImage2D(a,0,o,o,l,i):t.texImage2D(a,0,o,e,r,0,o,l,null),g}getCachedTexture(t,e,r){let{textureCache:i}=this;if(i[t])return i[t];{let n=this.createTexture(this.gl,e.width,e.height,e,r);return n&&(i[t]=n),n}}evictCachesForKey(t){this.textureCache[t]&&(this.gl.deleteTexture(this.textureCache[t]),delete this.textureCache[t])}copyGLTo2D(t,e){let r=t.canvas,i=e.targetCanvas,n=i.getContext("2d");if(!n)return;n.translate(0,i.height),n.scale(1,-1);let s=r.height-i.height;n.drawImage(r,0,s,i.width,i.height,0,0,i.width,i.height)}copyGLTo2DPutImageData(t,e){let r=e.targetCanvas.getContext("2d"),i=e.destinationWidth,n=e.destinationHeight,s=i*n*4;if(!r)return;let a=new Uint8Array(this.imageBuffer,0,s),o=new Uint8ClampedArray(this.imageBuffer,0,s);t.readPixels(0,0,i,n,t.RGBA,t.UNSIGNED_BYTE,a);let l=new ImageData(o,i,n);r.putImageData(l,0,0)}captureGPUInfo(){if(this.gpuInfo)return this.gpuInfo;let t=this.gl,e={renderer:"",vendor:""};if(!t)return e;let r=t.getExtension("WEBGL_debug_renderer_info");if(r){let i=t.getParameter(r.UNMASKED_RENDERER_WEBGL),n=t.getParameter(r.UNMASKED_VENDOR_WEBGL);i&&(e.renderer=i.toLowerCase()),n&&(e.vendor=n.toLowerCase())}return this.gpuInfo=e,e}constructor(){let{tileSize:t=ts.textureSize}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};$(this,"aPosition",new Float32Array([0,0,0,1,1,0,1,1])),$(this,"resources",{}),this.tileSize=t,this.setupGLContext(t,t),this.captureGPUInfo()}}function s6(){return n||arguments.length>0&&void 0!==arguments[0]&&!arguments[0]||(n=function(){let{WebGLProbe:t}=td();return t.queryWebGL(t6()),ts.enableGLFiltering&&t.isSupported(ts.textureSize)?new s9({tileSize:ts.textureSize}):new s3}()),n}let s8=["filters","resizeFilter","src","crossOrigin","type"],s7=["cropX","cropY"];class at extends iU{static getDefaults(){return te(te({},super.getDefaults()),at.ownDefaults)}getElement(){return this._element}setElement(t){var e;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.removeTexture(this.cacheKey),this.removeTexture("".concat(this.cacheKey,"_filtered")),this._element=t,this._originalElement=t,this._setWidthHeight(r),null==(e=t.classList)||e.add(at.CSS_CANVAS),0!==this.filters.length&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters()}removeTexture(t){let e=s6(!1);e instanceof s9&&e.evictCachesForKey(t)}dispose(){super.dispose(),this.removeTexture(this.cacheKey),this.removeTexture("".concat(this.cacheKey,"_filtered")),this._cacheContext=null,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(t=>{let e=this[t];e&&td().dispose(e),this[t]=void 0})}getCrossOrigin(){return this._originalElement&&(this._originalElement.crossOrigin||null)}getOriginalSize(){let t=this.getElement();return t?{width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}:{width:0,height:0}}_stroke(t){if(!this.stroke||0===this.strokeWidth)return;let e=this.width/2,r=this.height/2;t.beginPath(),t.moveTo(-e,-r),t.lineTo(e,-r),t.lineTo(e,r),t.lineTo(-e,r),t.lineTo(-e,-r),t.closePath()}toObject(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=[];return this.filters.forEach(t=>{t&&e.push(t.toObject())}),te(te({},super.toObject([...s7,...t])),{},{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:e},this.resizeFilter?{resizeFilter:this.resizeFilter.toObject()}:{})}hasCrop(){return!!this.cropX||!!this.cropY||this.width\n',' \n',"\n"),a=' clip-path="url(#imageCrop_'+t+')" '}if(this.imageSmoothing||(o=' image-rendering="optimizeSpeed"'),t.push(" \n")),this.stroke||this.strokeDashArray){let t=this.fill;this.fill=null,s=[' \n')],this.fill=t}return this.paintFirst!==tH?n.concat(s,t):n.concat(t,s)}getSrc(t){let e=t?this._element:this._originalElement;return e?e.toDataURL?e.toDataURL():this.srcFromAttribute?e.getAttribute("src")||"":e.src:this.src||""}getSvgSrc(t){return this.getSrc(t)}setSrc(t){let{crossOrigin:e,signal:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ex(t,{crossOrigin:e,signal:r}).then(t=>{void 0!==e&&this.set({crossOrigin:e}),this.setElement(t)})}toString(){return'#')}applyResizeFilters(){let t=this.resizeFilter,e=this.minimumScaleTrigger,r=this.getTotalObjectScaling(),i=r.x,n=r.y,s=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!t||i>e&&n>e)return this._element=s,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=i,void(this._lastScaleY=n);let a=t7(s),{width:o,height:l}=s;this._element=a,this._lastScaleX=t.scaleX=i,this._lastScaleY=t.scaleY=n,s6().applyFilters([t],s,o,l,this._element),this._filterScalingX=a.width/this._originalElement.width,this._filterScalingY=a.height/this._originalElement.height}applyFilters(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.filters||[];if(t=t.filter(t=>t&&!t.isNeutralState()),this.set("dirty",!0),this.removeTexture("".concat(this.cacheKey,"_filtered")),0===t.length)return this._element=this._originalElement,this._filteredEl=void 0,this._filterScalingX=1,void(this._filterScalingY=1);let e=this._originalElement,r=e.naturalWidth||e.width,i=e.naturalHeight||e.height;if(this._element===this._originalElement){let t=t7({width:r,height:i});this._element=t,this._filteredEl=t}else this._filteredEl&&(this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,r,i),this._lastScaleX=1,this._lastScaleY=1);s6().applyFilters(t,this._originalElement,r,i,this._element,this.cacheKey),this._originalElement.width===this._element.width&&this._originalElement.height===this._element.height||(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height)}_render(t){t.imageSmoothingEnabled=this.imageSmoothing,!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(t),this._renderPaintInOrder(t)}drawCacheOnCanvas(t){t.imageSmoothingEnabled=this.imageSmoothing,super.drawCacheOnCanvas(t)}shouldCache(){return this.needsItsOwnCache()}_renderFill(t){let e=this._element;if(!e)return;let r=this._filterScalingX,i=this._filterScalingY,n=this.width,s=this.height,a=Math.max(this.cropX,0),o=Math.max(this.cropY,0),l=e.naturalWidth||e.width,h=e.naturalHeight||e.height,c=a*r,u=o*i,d=Math.min(n*r,l-c),f=Math.min(s*i,h-u),g=Math.min(n,l/r-a),p=Math.min(s,h/i-o);e&&t.drawImage(e,c,u,d,f,-n/2,-s/2,g,p)}_needsResize(){let t=this.getTotalObjectScaling();return t.x!==this._lastScaleX||t.y!==this._lastScaleY}_resetWidthHeight(){this.set(this.getOriginalSize())}_setWidthHeight(){let{width:t,height:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this.getOriginalSize();this.width=t||r.width,this.height=e||r.height}parsePreserveAspectRatioAttribute(){let t=rl(this.preserveAspectRatio||""),e=this.width,r=this.height,i={width:e,height:r},n,s=this._element.width,a=this._element.height,o=1,l=1,h=0,c=0,u=0,d=0;return t&&(t.alignX!==tk||t.alignY!==tk)?("meet"===t.meetOrSlice&&(n=(e-s*(o=l=nM(this._element,i)))/2,"Min"===t.alignX&&(h=-n),"Max"===t.alignX&&(h=n),n=(r-a*l)/2,"Min"===t.alignY&&(c=-n),"Max"===t.alignY&&(c=n)),"slice"===t.meetOrSlice&&(n=s-e/(o=l=nE(this._element,i)),"Mid"===t.alignX&&(u=n/2),"Max"===t.alignX&&(u=n),n=a-r/l,"Mid"===t.alignY&&(d=n/2),"Max"===t.alignY&&(d=n),s=e/o,a=r/l)):(o=e/s,l=r/a),{width:s,height:a,scaleX:o,scaleY:l,offsetLeft:h,offsetTop:c,cropX:u,cropY:d}}static fromObject(t,e){let{filters:r,resizeFilter:i,src:n,crossOrigin:s,type:a}=t,o=tr(t,s8);return Promise.all([ex(n,te(te({},e),{},{crossOrigin:s})),r&&eb(r,e),i&&eb([i],e),e_(o,e)]).then(t=>{let[e,r=[],[i]=[],s={}]=t;return new this(e,te(te({},o),{},{src:n,filters:r,resizeFilter:i},s))})}static fromURL(t){let{crossOrigin:e=null,signal:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;return ex(t,{crossOrigin:e,signal:r}).then(t=>new this(t,i))}static async fromElement(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=nc(t,this.ATTRIBUTE_NAMES,r);return this.fromURL(i["xlink:href"]||i.href,e,i).catch(t=>(ta("log","Unable to parse Image",t),null))}constructor(t,e){super(),$(this,"_lastScaleX",1),$(this,"_lastScaleY",1),$(this,"_filterScalingX",1),$(this,"_filterScalingY",1),this.filters=[],Object.assign(this,at.ownDefaults),this.setOptions(e),this.cacheKey="texture".concat(t9()),this.setElement("string"==typeof t?(this.canvas&&ej(this.canvas.getElement())||tf()).getElementById(t):t,e)}}$(at,"type","Image"),$(at,"cacheProperties",[...rY,...s7]),$(at,"ownDefaults",{strokeWidth:0,srcFromAttribute:!1,minimumScaleTrigger:.5,cropX:0,cropY:0,imageSmoothing:!0}),$(at,"CSS_CANVAS","canvas-img"),$(at,"ATTRIBUTE_NAMES",[...i5,"x","y","width","height","preserveAspectRatio","xlink:href","href","crossOrigin","image-rendering"]),tY.setClass(at),tY.setSVGClass(at),ru(["pattern","defs","symbol","metadata","clipPath","mask","desc"]);let ae=t=>function(e,r,i){let{points:n,pathOffset:s}=i;return new tZ(n[t]).subtract(s).transform(eo(i.getViewportTransform(),i.calcTransformMatrix()))},ar=(t,e,r,i)=>{let{target:n,pointIndex:s}=e,a=eJ(new tZ(r,i),void 0,n.calcOwnMatrix());return n.points[s]=a.add(n.pathOffset),n.setDimensions(),n.set("dirty",!0),!0},ai=(t,e)=>function(r,i,n,s){let a=i.target,o=new tZ(a.points[(t>0?t:a.points.length)-1]),l=o.subtract(a.pathOffset).transform(a.calcOwnMatrix()),h=e(r,te(te({},i),{},{pointIndex:t}),n,s),c=o.subtract(a.pathOffset).transform(a.calcOwnMatrix()).subtract(l);return a.left-=c.x,a.top-=c.y,h},an=t=>io(tL,ai(t,ar)),as=(t,e,r)=>{let{path:i,pathOffset:n}=t,s=i[e];return new tZ(s[r]-n.x,s[r+1]-n.y).transform(eo(t.getViewportTransform(),t.calcTransformMatrix()))};function aa(t,e,r){let{commandIndex:i,pointIndex:n}=this;return as(r,i,n)}function ao(t,e,r,i){let{target:n}=e,{commandIndex:s,pointIndex:a}=this,o=((t,e,r,i,n)=>{let{path:s,pathOffset:a}=t,o=s[(i>0?i:s.length)-1],l=new tZ(o[n],o[n+1]),h=l.subtract(a).transform(t.calcOwnMatrix()),c=eJ(new tZ(e,r),void 0,t.calcOwnMatrix());s[i][n]=c.x+a.x,s[i][n+1]=c.y+a.y,t.setDimensions();let u=l.subtract(t.pathOffset).transform(t.calcOwnMatrix()).subtract(h);return t.left-=u.x,t.top-=u.y,t.set("dirty",!0),!0})(n,r,i,s,a);return e0(this.actionName,te(te({},e9(t,e,r,i)),{},{commandIndex:s,pointIndex:a})),o}class al extends id{render(t,e,r,i,n){let s=te(te({},i),{},{cornerColor:this.controlFill,cornerStrokeColor:this.controlStroke,transparentCorners:!this.controlFill});super.render(t,e,r,s,n)}constructor(t){super(t)}}class ah extends al{render(t,e,r,i,n){let{path:s}=n,{commandIndex:a,pointIndex:o,connectToCommandIndex:l,connectToPointIndex:h}=this;t.save(),t.strokeStyle=this.controlStroke,this.connectionDashArray&&t.setLineDash(this.connectionDashArray);let[c]=s[a],u=as(n,l,h);if("Q"===c){let i=as(n,a,o+2);t.moveTo(i.x,i.y),t.lineTo(e,r)}else t.moveTo(e,r);t.lineTo(u.x,u.y),t.stroke(),t.restore(),super.render(t,e,r,i,n)}constructor(t){super(t)}}let ac=(t,e,r,i,n,s)=>new(r?ah:al)(te(te({commandIndex:t,pointIndex:e,actionName:"modifyPath",positionHandler:aa,actionHandler:ao,connectToCommandIndex:n,connectToPointIndex:s},i),r?i.controlPointStyle:i.pointStyle));Object.freeze({__proto__:null,changeWidth:ih,createObjectDefaultControls:iR,createPathControls:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i="M";return t.path.forEach((t,n)=>{let s=t[0];switch("Z"!==s&&(r["c_".concat(n,"_").concat(s)]=ac(n,t.length-2,!1,e)),s){case"C":let a;r["c_".concat(n,"_C_CP_1")]=ac(n,1,!0,e,n-1,"C"===(a=i)?5:"Q"===a?3:1),r["c_".concat(n,"_C_CP_2")]=ac(n,3,!0,e,n,5);break;case"Q":r["c_".concat(n,"_Q_CP_1")]=ac(n,1,!0,e,n,3)}i=s}),r},createPolyActionHandler:an,createPolyControls:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={};for(let i=0;i<("number"==typeof t?t:t.points.length);i++)r["p".concat(i)]=new id(te({actionName:tL,positionHandler:ae(i),actionHandler:an(i)},e));return r},createPolyPositionHandler:ae,createResizeControls:iI,createTextboxDefaultControls:iB,dragHandler:e7,factoryPolyActionHandler:ai,getLocalPoint:e8,polyActionHandler:ar,renderCircleControl:ic,renderSquareControl:iu,rotationStyleHandler:ig,rotationWithSnapping:ip,scaleCursorStyleHandler:ix,scaleOrSkewActionName:iA,scaleSkewCursorStyleHandler:iP,scalingEqually:i_,scalingX:iw,scalingXOrSkewingY:iF,scalingY:iC,scalingYOrSkewingX:iL,skewCursorStyleHandler:ik,skewHandlerX:iE,skewHandlerY:iD,wrapWithFireEvent:io,wrapWithFixedAnchor:il});let au="precision highp float",ad="\n ".concat(au,";\n varying vec2 vTexCoord;\n uniform sampler2D uTexture;\n void main() {\n gl_FragColor = texture2D(uTexture, vTexCoord);\n }"),af=["type"],ag=["type"],ap=RegExp(au,"g");class am{get type(){return this.constructor.type}getFragmentSource(){return ad}getVertexSource(){return"\n attribute vec2 aPosition;\n varying vec2 vTexCoord;\n void main() {\n vTexCoord = aPosition;\n gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n }"}createProgram(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getFragmentSource(),r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.getVertexSource(),{WebGLProbe:{GLPrecision:i="highp"}}=td();"highp"!==i&&(e=e.replace(ap,au.replace("highp",i)));let n=t.createShader(t.VERTEX_SHADER),s=t.createShader(t.FRAGMENT_SHADER),a=t.createProgram();if(!n||!s||!a)throw new to("Vertex, fragment shader or program creation error");if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw new to("Vertex shader compile error for ".concat(this.type,": ").concat(t.getShaderInfoLog(n)));if(t.shaderSource(s,e),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS))throw new to("Fragment shader compile error for ".concat(this.type,": ").concat(t.getShaderInfoLog(s)));if(t.attachShader(a,n),t.attachShader(a,s),t.linkProgram(a),!t.getProgramParameter(a,t.LINK_STATUS))throw new to('Shader link error for "'.concat(this.type,'" ').concat(t.getProgramInfoLog(a)));let o=this.getUniformLocations(t,a)||{};return o.uStepW=t.getUniformLocation(a,"uStepW"),o.uStepH=t.getUniformLocation(a,"uStepH"),{program:a,attributeLocations:this.getAttributeLocations(t,a),uniformLocations:o}}getAttributeLocations(t,e){return{aPosition:t.getAttribLocation(e,"aPosition")}}getUniformLocations(t,e){let r=this.constructor.uniformLocations,i={};for(let n=0;n1){let r=t.destinationWidth,i=t.destinationHeight;t.sourceWidth===r&&t.sourceHeight===i||(e.deleteTexture(t.targetTexture),t.targetTexture=t.filterBackend.createTexture(e,r,i)),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.targetTexture,0)}else e.bindFramebuffer(e.FRAMEBUFFER,null),e.finish()}_swapTextures(t){t.passes--,t.pass++;let e=t.targetTexture;t.targetTexture=t.sourceTexture,t.sourceTexture=e}isNeutralState(t){return!1}applyTo(t){void 0!==t.webgl?(this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)}applyTo2d(t){}getCacheKey(){return this.type}retrieveShader(t){let e=this.getCacheKey();return t.programCache[e]||(t.programCache[e]=this.createProgram(t.context)),t.programCache[e]}applyToWebGL(t){let e=t.context,r=this.retrieveShader(t);0===t.pass&&t.originalTexture?e.bindTexture(e.TEXTURE_2D,t.originalTexture):e.bindTexture(e.TEXTURE_2D,t.sourceTexture),e.useProgram(r.program),this.sendAttributeData(e,r.attributeLocations,t.aPosition),e.uniform1f(r.uniformLocations.uStepW,1/t.sourceWidth),e.uniform1f(r.uniformLocations.uStepH,1/t.sourceHeight),this.sendUniformData(e,r.uniformLocations),e.viewport(0,0,t.destinationWidth,t.destinationHeight),e.drawArrays(e.TRIANGLE_STRIP,0,4)}bindAdditionalTexture(t,e,r){t.activeTexture(r),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE0)}unbindAdditionalTexture(t,e){t.activeTexture(e),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE0)}sendUniformData(t,e){}createHelpLayer(t){if(!t.helpLayer){let{sourceWidth:e,sourceHeight:r}=t;t.helpLayer=t7({width:e,height:r})}}toObject(){let t=Object.keys(this.constructor.defaults||{});return te({type:this.type},t.reduce((t,e)=>(t[e]=this[e],t),{}))}toJSON(){return this.toObject()}static async fromObject(t,e){return new this(tr(t,ag))}constructor(){let t=tr(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},af);Object.assign(this,this.constructor.defaults,t)}}$(am,"type","BaseFilter"),$(am,"uniformLocations",[]);let av={multiply:"gl_FragColor.rgb *= uColor.rgb;\n",screen:"gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n",add:"gl_FragColor.rgb += uColor.rgb;\n",difference:"gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n",subtract:"gl_FragColor.rgb -= uColor.rgb;\n",lighten:"gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n",darken:"gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n",exclusion:"gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n",overlay:"\n if (uColor.r < 0.5) {\n gl_FragColor.r *= 2.0 * uColor.r;\n } else {\n gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n }\n if (uColor.g < 0.5) {\n gl_FragColor.g *= 2.0 * uColor.g;\n } else {\n gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n }\n if (uColor.b < 0.5) {\n gl_FragColor.b *= 2.0 * uColor.b;\n } else {\n gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n }\n ",tint:"\n gl_FragColor.rgb *= (1.0 - uColor.a);\n gl_FragColor.rgb += uColor.rgb;\n "};class ay extends am{getCacheKey(){return"".concat(this.type,"_").concat(this.mode)}getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform vec4 uColor;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n gl_FragColor = color;\n if (color.a > 0.0) {\n ".concat(av[this.mode],"\n }\n }\n ")}applyTo2d(t){let{imageData:{data:e}}=t,r=new ra(this.color).getSource(),i=this.alpha,n=r[0]*i,s=r[1]*i,a=r[2]*i,o=1-i;for(let t=0;tnew this(te(te({},n),{},{image:t})))}}$(a_,"type","BlendImage"),$(a_,"defaults",{mode:"multiply",alpha:1}),$(a_,"uniformLocations",["uTransformMatrix","uImage"]),tY.setClass(a_);class aw extends am{getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform vec2 uDelta;\n varying vec2 vTexCoord;\n const float nSamples = 15.0;\n vec3 v3offset = vec3(12.9898, 78.233, 151.7182);\n float random(vec3 scale) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n }\n void main() {\n vec4 color = vec4(0.0);\n float totalC = 0.0;\n float totalA = 0.0;\n float offset = random(v3offset);\n for (float t = -nSamples; t <= nSamples; t++) {\n float percent = (t + offset - 0.5) / nSamples;\n vec4 sample = texture2D(uTexture, vTexCoord + uDelta * percent);\n float weight = 1.0 - abs(percent);\n float alpha = weight * sample.a;\n color.rgb += sample.rgb * alpha;\n color.a += alpha;\n totalA += weight;\n totalC += alpha;\n }\n gl_FragColor.rgb = color.rgb / totalC;\n gl_FragColor.a = color.a / totalA;\n }\n "}applyTo(t){void 0!==t.webgl?(this.aspectRatio=t.sourceWidth/t.sourceHeight,t.passes++,this._setupFrameBuffer(t),this.horizontal=!0,this.applyToWebGL(t),this._swapTextures(t),this._setupFrameBuffer(t),this.horizontal=!1,this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)}applyTo2d(t){let{imageData:{data:e,width:r,height:i}}=t;this.aspectRatio=r/i,this.horizontal=!0;let n=this.getBlurValue()*r,s=new Uint8ClampedArray(e),a=4*r;for(let t=0;tu&&(g=u);let p=e[g+3]*f;r+=e[g]*p,i+=e[g+1]*p,o+=e[g+2]*p,l+=p,h+=f}s[t]=r/l,s[t+1]=i/l,s[t+2]=o/l,s[t+3]=l/h}this.horizontal=!1,n=this.getBlurValue()*i;for(let t=0;tu&&(p=u);let m=s[p+3]*g;r+=s[p]*m,i+=s[p+1]*m,o+=s[p+2]*m,l+=m,h+=g}e[t]=r/l,e[t+1]=i/l,e[t+2]=o/l,e[t+3]=l/h}}sendUniformData(t,e){let r=this.chooseRightDelta();t.uniform2fv(e.uDelta,r)}isNeutralState(){return 0===this.blur}getBlurValue(){let t=1,{horizontal:e,aspectRatio:r}=this;return e?r>1&&(t=1/r):r<1&&(t=r),t*this.blur*.12}chooseRightDelta(){let t=this.getBlurValue();return this.horizontal?[t,0]:[0,t]}}$(aw,"type","Blur"),$(aw,"defaults",{blur:0}),$(aw,"uniformLocations",["uDelta"]),tY.setClass(aw);class aC extends am{getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uBrightness;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n color.rgb += uBrightness;\n gl_FragColor = color;\n }\n"}applyTo2d(t){let{imageData:{data:e}}=t,r=Math.round(255*this.brightness);for(let t=0;t{e.applyTo(t)})}toObject(){return{type:this.type,subFilters:this.subFilters.map(t=>t.toObject())}}isNeutralState(){return!this.subFilters.some(t=>!t.isNeutralState())}static fromObject(t,e){return Promise.all((t.subFilters||[]).map(t=>tY.getClass(t.type).fromObject(t,e))).then(t=>new this({subFilters:t}))}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),this.subFilters=t.subFilters||[]}}$(aF,"type","Composed"),tY.setClass(aF);class aL extends am{getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uContrast;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\n color.rgb = contrastF * (color.rgb - 0.5) + 0.5;\n gl_FragColor = color;\n }"}isNeutralState(){return 0===this.contrast}applyTo2d(t){let{imageData:{data:e}}=t,r=Math.floor(255*this.contrast),i=259*(r+255)/(255*(259-r));for(let t=0;t=_||a<0||a>=b||(l=4*(o*b+a),h=m[f*y+d],e+=p[l]*h,r+=p[l+1]*h,i+=p[l+2]*h,S||(n+=p[l+3]*h));C[s]=e,C[s+1]=r,C[s+2]=i,C[s+3]=S?p[s+3]:n}t.imageData=w}sendUniformData(t,e){t.uniform1fv(e.uMatrix,this.matrix)}toObject(){return te(te({},super.toObject()),{},{opaque:this.opaque,matrix:[...this.matrix]})}}$(aI,"type","Convolute"),$(aI,"defaults",{opaque:!1,matrix:[0,0,0,0,1,0,0,0,0]}),$(aI,"uniformLocations",["uMatrix","uOpaque","uHalfSize","uSize"]),tY.setClass(aI);let aB="Gamma";class aN extends am{getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform vec3 uGamma;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n vec3 correction = (1.0 / uGamma);\n color.r = pow(color.r, correction.r);\n color.g = pow(color.g, correction.g);\n color.b = pow(color.b, correction.b);\n gl_FragColor = color;\n gl_FragColor.rgb *= color.a;\n }\n"}applyTo2d(t){let{imageData:{data:e}}=t,r=this.gamma,i=1/r[0],n=1/r[1],s=1/r[2];this.rgbValues||(this.rgbValues={r:new Uint8Array(256),g:new Uint8Array(256),b:new Uint8Array(256)});let a=this.rgbValues;for(let t=0;t<256;t++)a.r[t]=255*Math.pow(t/255,i),a.g[t]=255*Math.pow(t/255,n),a.b[t]=255*Math.pow(t/255,s);for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:{};super(t),this.gamma=t.gamma||this.constructor.defaults.gamma.concat()}}$(aN,"type",aB),$(aN,"defaults",{gamma:[1,1,1]}),$(aN,"uniformLocations",["uGamma"]),tY.setClass(aN);let aW={average:"\n precision highp float;\n uniform sampler2D uTexture;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float average = (color.r + color.b + color.g) / 3.0;\n gl_FragColor = vec4(average, average, average, color.a);\n }\n ",lightness:"\n precision highp float;\n uniform sampler2D uTexture;\n uniform int uMode;\n varying vec2 vTexCoord;\n void main() {\n vec4 col = texture2D(uTexture, vTexCoord);\n float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\n gl_FragColor = vec4(average, average, average, col.a);\n }\n ",luminosity:"\n precision highp float;\n uniform sampler2D uTexture;\n uniform int uMode;\n varying vec2 vTexCoord;\n void main() {\n vec4 col = texture2D(uTexture, vTexCoord);\n float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\n gl_FragColor = vec4(average, average, average, col.a);\n }\n "};class aU extends am{applyTo2d(t){let{imageData:{data:e}}=t;for(let t,r=0;rn[0]&&i>n[1]&&a>n[2]&&r"\n color += texture2D(uTexture, vTexCoord + ".concat(t,") * uTaps[").concat(e,"] + texture2D(uTexture, vTexCoord - ").concat(t,") * uTaps[").concat(e,"];\n sum += 2.0 * uTaps[").concat(e,"];\n ")).join("\n"),"\n gl_FragColor = color / sum;\n }\n ")}applyToForWebgl(t){t.passes++,this.width=t.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=t.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),t.destinationWidth=this.dW,super.applyTo(t),t.sourceWidth=t.destinationWidth,this.height=t.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),t.destinationHeight=this.dH,super.applyTo(t),t.sourceHeight=t.destinationHeight}applyTo(t){void 0!==t.webgl?this.applyToForWebgl(t):this.applyTo2d(t)}isNeutralState(){return 1===this.scaleX&&1===this.scaleY}lanczosCreate(t){return e=>{if(e>=t||e<=-t)return 0;if(e<11920929e-14&&e>-11920929e-14)return 1;let r=(e*=Math.PI)/t;return Math.sin(e)/e*Math.sin(r)/r}}applyTo2d(t){let e,r=t.imageData,i=this.scaleX,n=this.scaleY;this.rcpScaleX=1/i,this.rcpScaleY=1/n;let s=r.width,a=r.height,o=Math.round(s*i),l=Math.round(a*n);e="sliceHack"===this.resizeType?this.sliceByTwo(t,s,a,o,l):"hermite"===this.resizeType?this.hermiteFastResize(t,s,a,o,l):"bilinear"===this.resizeType?this.bilinearFiltering(t,s,a,o,l):"lanczos"===this.resizeType?this.lanczosResize(t,s,a,o,l):new ImageData(o,l),t.imageData=e}sliceByTwo(t,e,r,i,n){let s=t.imageData,a=!1,o=!1,l=.5*e,h=.5*r,c=t.filterBackend.resources,u=0,d=0,f=e,g=0;c.sliceByTwo||(c.sliceByTwo=t6());let p=c.sliceByTwo;(p.width<1.5*e||p.height=e)){p[E=Math.floor(1e3*Math.abs(_-m.x))]||(p[E]={});for(let t=y.y-g;t<=y.y+g;t++)t<0||t>=r||(D=Math.floor(1e3*Math.abs(t-m.y)),p[E][D]||(p[E][D]=l(Math.sqrt(Math.pow(E*u,2)+Math.pow(D*d,2))/1e3)),(w=p[E][D])>0&&(C=4*(t*e+_),S+=w,T+=w*s[C],O+=w*s[C+1],k+=w*s[C+2],M+=w*s[C+3]))}o[C=4*(b*i+x)]=T/S,o[C+1]=O/S,o[C+2]=k/S,o[C+3]=M/S}return++x1&&s<-1||(c=2*s*s*s-3*s*s+1)>0&&(y+=c*h[(r=4*(t+i*e))+3],f+=c,h[r+3]<255&&(c=c*h[r+3]/250),g+=c*h[r],p+=c*h[r+1],m+=c*h[r+2],d+=c)}}u[n]=g/d,u[n+1]=p/d,u[n+2]=m/d,u[n+3]=y/f}return c}}$(aq,"type","Resize"),$(aq,"defaults",{resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3}),$(aq,"uniformLocations",["uDelta","uTaps"]),tY.setClass(aq);class aK extends am{getFragmentSource(){return"\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uSaturation;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float rgMax = max(color.r, color.g);\n float rgbMax = max(rgMax, color.b);\n color.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\n color.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\n color.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\n gl_FragColor = color;\n }\n"}applyTo2d(t){let{imageData:{data:e}}=t,r=-this.saturation;for(let t=0;t({x:t,y:t}),a6={left:"right",right:"left",bottom:"top",top:"bottom"},a8={start:"end",end:"start"};function a7(t,e){return"function"==typeof t?t(e):t}function ot(t){return t.split("-")[0]}function oe(t){return t.split("-")[1]}function or(t){return"y"===t?"height":"width"}let oi=new Set(["top","bottom"]);function on(t){return oi.has(ot(t))?"y":"x"}function os(t){return"x"===on(t)?"y":"x"}function oa(t){return t.replace(/start|end/g,t=>a8[t])}let oo=["left","right"],ol=["right","left"],oh=["top","bottom"],oc=["bottom","top"];function ou(t){return t.replace(/left|right|bottom|top/g,t=>a6[t])}function od(t){let{x:e,y:r,width:i,height:n}=t;return{width:i,height:n,top:r,left:e,right:e+i,bottom:r+n,x:e,y:r}}function of(t,e,r){let i,{reference:n,floating:s}=t,a=on(e),o=os(e),l=or(o),h=ot(e),c="y"===a,u=n.x+n.width/2-s.width/2,d=n.y+n.height/2-s.height/2,f=n[l]/2-s[l]/2;switch(h){case"top":i={x:u,y:n.y-s.height};break;case"bottom":i={x:u,y:n.y+n.height};break;case"right":i={x:n.x+n.width,y:d};break;case"left":i={x:n.x-s.width,y:d};break;default:i={x:n.x,y:n.y}}switch(oe(e)){case"start":i[o]-=f*(r&&c?-1:1);break;case"end":i[o]+=f*(r&&c?-1:1)}return i}let og=async(t,e,r)=>{let{placement:i="bottom",strategy:n="absolute",middleware:s=[],platform:a}=r,o=s.filter(Boolean),l=await (null==a.isRTL?void 0:a.isRTL(e)),h=await a.getElementRects({reference:t,floating:e,strategy:n}),{x:c,y:u}=of(h,i,l),d=i,f={},g=0;for(let r=0;r{try{return t.matches(e)}catch(t){return!1}})}let oj=["transform","translate","scale","rotate","perspective"],oA=["transform","translate","scale","rotate","perspective","filter"],oP=["paint","layout","strict","content"];function oF(t){let e=oL(),r=oC(t)?oB(t):t;return oj.some(t=>!!r[t]&&"none"!==r[t])||!!r.containerType&&"normal"!==r.containerType||!e&&!!r.backdropFilter&&"none"!==r.backdropFilter||!e&&!!r.filter&&"none"!==r.filter||oA.some(t=>(r.willChange||"").includes(t))||oP.some(t=>(r.contain||"").includes(t))}function oL(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let oR=new Set(["html","body","#document"]);function oI(t){return oR.has(ox(t))}function oB(t){return ob(t).getComputedStyle(t)}function oN(t){return oC(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function oW(t){if("html"===ox(t))return t;let e=t.assignedSlot||t.parentNode||oT(t)&&t.host||o_(t);return oT(e)?e.host:e}function oU(t,e,r){var i;void 0===e&&(e=[]),void 0===r&&(r=!0);let n=function t(e){let r=oW(e);return oI(r)?e.ownerDocument?e.ownerDocument.body:e.body:oS(r)&&ok(r)?r:t(r)}(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),a=ob(n);if(s){let t=oH(a);return e.concat(a,a.visualViewport||[],ok(n)?n:[],t&&r?oU(t):[])}return e.concat(n,oU(n,[],r))}function oH(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function oX(t){let e=oB(t),r=parseFloat(e.width)||0,i=parseFloat(e.height)||0,n=oS(t),s=n?t.offsetWidth:r,a=n?t.offsetHeight:i,o=a4(r)!==s||a4(i)!==a;return o&&(r=s,i=a),{width:r,height:i,$:o}}function oV(t){return oC(t)?t:t.contextElement}function oz(t){let e=oV(t);if(!oS(e))return a9(1);let r=e.getBoundingClientRect(),{width:i,height:n,$:s}=oX(e),a=(s?a4(r.width):r.width)/i,o=(s?a4(r.height):r.height)/n;return a&&Number.isFinite(a)||(a=1),o&&Number.isFinite(o)||(o=1),{x:a,y:o}}let oY=a9(0);function oG(t){let e=ob(t);return oL()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:oY}function oq(t,e,r,i){var n;void 0===e&&(e=!1),void 0===r&&(r=!1);let s=t.getBoundingClientRect(),a=oV(t),o=a9(1);e&&(i?oC(i)&&(o=oz(i)):o=oz(t));let l=(void 0===(n=r)&&(n=!1),i&&(!n||i===ob(a))&&n)?oG(a):a9(0),h=(s.left+l.x)/o.x,c=(s.top+l.y)/o.y,u=s.width/o.x,d=s.height/o.y;if(a){let t=ob(a),e=i&&oC(i)?ob(i):i,r=t,n=oH(r);for(;n&&i&&e!==r;){let t=oz(n),e=n.getBoundingClientRect(),i=oB(n),s=e.left+(n.clientLeft+parseFloat(i.paddingLeft))*t.x,a=e.top+(n.clientTop+parseFloat(i.paddingTop))*t.y;h*=t.x,c*=t.y,u*=t.x,d*=t.y,h+=s,c+=a,n=oH(r=ob(n))}}return od({width:u,height:d,x:h,y:c})}function oK(t,e){let r=oN(t).scrollLeft;return e?e.left+r:oq(o_(t)).left+r}function oQ(t,e){let r=t.getBoundingClientRect();return{x:r.left+e.scrollLeft-oK(t,r),y:r.top+e.scrollTop}}let oJ=new Set(["absolute","fixed"]);function oZ(t,e,r){let i;if("viewport"===e)i=function(t,e){let r=ob(t),i=o_(t),n=r.visualViewport,s=i.clientWidth,a=i.clientHeight,o=0,l=0;if(n){s=n.width,a=n.height;let t=oL();(!t||t&&"fixed"===e)&&(o=n.offsetLeft,l=n.offsetTop)}let h=oK(i);if(h<=0){let t=i.ownerDocument,e=t.body,r=getComputedStyle(e),n="CSS1Compat"===t.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,a=Math.abs(i.clientWidth-e.clientWidth-n);a<=25&&(s-=a)}else h<=25&&(s+=h);return{width:s,height:a,x:o,y:l}}(t,r);else if("document"===e)i=function(t){let e=o_(t),r=oN(t),i=t.ownerDocument.body,n=a5(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=a5(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight),a=-r.scrollLeft+oK(t),o=-r.scrollTop;return"rtl"===oB(i).direction&&(a+=a5(e.clientWidth,i.clientWidth)-n),{width:n,height:s,x:a,y:o}}(o_(t));else if(oC(e))i=function(t,e){let r=oq(t,!0,"fixed"===e),i=r.top+t.clientTop,n=r.left+t.clientLeft,s=oS(t)?oz(t):a9(1),a=t.clientWidth*s.x,o=t.clientHeight*s.y;return{width:a,height:o,x:n*s.x,y:i*s.y}}(e,r);else{let r=oG(t);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return od(i)}function o$(t){return"static"===oB(t).position}function o0(t,e){if(!oS(t)||"fixed"===oB(t).position)return null;if(e)return e(t);let r=t.offsetParent;return o_(t)===r&&(r=r.ownerDocument.body),r}function o1(t,e){var r;let i=ob(t);if(oD(t))return i;if(!oS(t)){let e=oW(t);for(;e&&!oI(e);){if(oC(e)&&!o$(e))return e;e=oW(e)}return i}let n=o0(t,e);for(;n&&(r=n,oM.has(ox(r)))&&o$(n);)n=o0(n,e);return n&&oI(n)&&o$(n)&&!oF(n)?i:n||function(t){let e=oW(t);for(;oS(e)&&!oI(e);){if(oF(e))return e;if(oD(e))break;e=oW(e)}return null}(t)||i}let o2=async function(t){let e=this.getOffsetParent||o1,r=this.getDimensions,i=await r(t.floating);return{reference:function(t,e,r){let i=oS(e),n=o_(e),s="fixed"===r,a=oq(t,!0,s,e),o={scrollLeft:0,scrollTop:0},l=a9(0);if(i||!i&&!s)if(("body"!==ox(e)||ok(n))&&(o=oN(e)),i){let t=oq(e,!0,s,e);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else n&&(l.x=oK(n));s&&!i&&n&&(l.x=oK(n));let h=!n||i||s?a9(0):oQ(n,o);return{x:a.left+o.scrollLeft-l.x-h.x,y:a.top+o.scrollTop-l.y-h.y,width:a.width,height:a.height}}(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}},o5={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:r,offsetParent:i,strategy:n}=t,s="fixed"===n,a=o_(i),o=!!e&&oD(e.floating);if(i===a||o&&s)return r;let l={scrollLeft:0,scrollTop:0},h=a9(1),c=a9(0),u=oS(i);if((u||!u&&!s)&&(("body"!==ox(i)||ok(a))&&(l=oN(i)),oS(i))){let t=oq(i);h=oz(i),c.x=t.x+i.clientLeft,c.y=t.y+i.clientTop}let d=!a||u||s?a9(0):oQ(a,l);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-l.scrollLeft*h.x+c.x+d.x,y:r.y*h.y-l.scrollTop*h.y+c.y+d.y}},getDocumentElement:o_,getClippingRect:function(t){let{element:e,boundary:r,rootBoundary:i,strategy:n}=t,s=[..."clippingAncestors"===r?oD(e)?[]:function(t,e){let r=e.get(t);if(r)return r;let i=oU(t,[],!1).filter(t=>oC(t)&&"body"!==ox(t)),n=null,s="fixed"===oB(t).position,a=s?oW(t):t;for(;oC(a)&&!oI(a);){let e=oB(a),r=oF(a);r||"fixed"!==e.position||(n=null),(s?!r&&!n:!r&&"static"===e.position&&!!n&&oJ.has(n.position)||ok(a)&&!r&&function t(e,r){let i=oW(e);return!(i===r||!oC(i)||oI(i))&&("fixed"===oB(i).position||t(i,r))}(t,a))?i=i.filter(t=>t!==a):n=e,a=oW(a)}return e.set(t,i),i}(e,this._c):[].concat(r),i],a=s[0],o=s.reduce((t,r)=>{let i=oZ(e,r,n);return t.top=a5(i.top,t.top),t.right=a2(i.right,t.right),t.bottom=a2(i.bottom,t.bottom),t.left=a5(i.left,t.left),t},oZ(e,a,n));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}},getOffsetParent:o1,getElementRects:o2,getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){let{width:e,height:r}=oX(t);return{width:e,height:r}},getScale:oz,isElement:oC,isRTL:function(t){return"rtl"===oB(t).direction}};function o4(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function o3(t,e,r,i){let n;void 0===i&&(i={});let{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:h=!1}=i,c=oV(t),u=s||a?[...c?oU(c):[],...oU(e)]:[];u.forEach(t=>{s&&t.addEventListener("scroll",r,{passive:!0}),a&&t.addEventListener("resize",r)});let d=c&&l?function(t,e){let r,i=null,n=o_(t);function s(){var t;clearTimeout(r),null==(t=i)||t.disconnect(),i=null}return!function a(o,l){void 0===o&&(o=!1),void 0===l&&(l=1),s();let h=t.getBoundingClientRect(),{left:c,top:u,width:d,height:f}=h;if(o||e(),!d||!f)return;let g=a3(u),p=a3(n.clientWidth-(c+d)),m={rootMargin:-g+"px "+-p+"px "+-a3(n.clientHeight-(u+f))+"px "+-a3(c)+"px",threshold:a5(0,a2(1,l))||1},y=!0;function x(e){let i=e[0].intersectionRatio;if(i!==l){if(!y)return a();i?a(!1,i):r=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==i||o4(h,t.getBoundingClientRect())||a(),y=!1}try{i=new IntersectionObserver(x,{...m,root:n.ownerDocument})}catch(t){i=new IntersectionObserver(x,m)}i.observe(t)}(!0),s}(c,r):null,f=-1,g=null;o&&(g=new ResizeObserver(t=>{let[i]=t;i&&i.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var t;null==(t=g)||t.observe(e)})),r()}),c&&!h&&g.observe(c),g.observe(e));let p=h?oq(t):null;return h&&function e(){let i=oq(t);p&&!o4(p,i)&&r(),p=i,n=requestAnimationFrame(e)}(),r(),()=>{var t;u.forEach(t=>{s&&t.removeEventListener("scroll",r),a&&t.removeEventListener("resize",r)}),null==d||d(),null==(t=g)||t.disconnect(),g=null,h&&cancelAnimationFrame(n)}}var o9=t.i(74080),o6="undefined"!=typeof document?Z.useLayoutEffect:function(){};function o8(t,e){let r,i,n;if(t===e)return!0;if(typeof t!=typeof e)return!1;if("function"==typeof t&&t.toString()===e.toString())return!0;if(t&&e&&"object"==typeof t){if(Array.isArray(t)){if((r=t.length)!==e.length)return!1;for(i=r;0!=i--;)if(!o8(t[i],e[i]))return!1;return!0}if((r=(n=Object.keys(t)).length)!==Object.keys(e).length)return!1;for(i=r;0!=i--;)if(!({}).hasOwnProperty.call(e,n[i]))return!1;for(i=r;0!=i--;){let r=n[i];if(("_owner"!==r||!t.$$typeof)&&!o8(t[r],e[r]))return!1}return!0}return t!=t&&e!=e}function o7(t){return"undefined"==typeof window?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function lt(t,e){let r=o7(t);return Math.round(e*r)/r}function le(t){let e=Z.useRef(t);return o6(()=>{e.current=t}),e}let lr=(t,e)=>({...function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var r,i;let{x:n,y:s,placement:a,middlewareData:o}=e,l=await ov(e,t);return a===(null==(r=o.offset)?void 0:r.placement)&&null!=(i=o.arrow)&&i.alignmentOffset?{}:{x:n+l.x,y:s+l.y,data:{...l,placement:a}}}}}(t),options:[t,e]}),li=(t,e)=>({...function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var r,i,n,s,a;let{placement:o,middlewareData:l,rects:h,initialPlacement:c,platform:u,elements:d}=e,{mainAxis:f=!0,crossAxis:g=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...b}=a7(t,e);if(null!=(r=l.arrow)&&r.alignmentOffset)return{};let _=ot(o),w=on(c),C=ot(c)===c,S=await (null==u.isRTL?void 0:u.isRTL(d.floating)),T=p||(C||!x?[ou(c)]:function(t){let e=ou(t);return[oa(t),e,oa(e)]}(c)),O="none"!==y;!p&&O&&T.push(...function(t,e,r,i){let n=oe(t),s=function(t,e,r){switch(t){case"top":case"bottom":if(r)return e?ol:oo;return e?oo:ol;case"left":case"right":return e?oh:oc;default:return[]}}(ot(t),"start"===r,i);return n&&(s=s.map(t=>t+"-"+n),e&&(s=s.concat(s.map(oa)))),s}(c,x,y,S));let k=[c,...T],M=await op(e,b),E=[],D=(null==(i=l.flip)?void 0:i.overflows)||[];if(f&&E.push(M[_]),g){let t=function(t,e,r){void 0===r&&(r=!1);let i=oe(t),n=os(t),s=or(n),a="x"===n?i===(r?"end":"start")?"right":"left":"start"===i?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=ou(a)),[a,ou(a)]}(o,h,S);E.push(M[t[0]],M[t[1]])}if(D=[...D,{placement:o,overflows:E}],!E.every(t=>t<=0)){let t=((null==(n=l.flip)?void 0:n.index)||0)+1,e=k[t];if(e&&("alignment"!==g||w===on(e)||D.every(t=>on(t.placement)!==w||t.overflows[0]>0)))return{data:{index:t,overflows:D},reset:{placement:e}};let r=null==(s=D.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:s.placement;if(!r)switch(m){case"bestFit":{let t=null==(a=D.filter(t=>{if(O){let e=on(t.placement);return e===w||"y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:a[0];t&&(r=t);break}case"initialPlacement":r=c}if(o!==r)return{reset:{placement:r}}}return{}}}}(t),options:[t,e]});t.i(47167);var ln='input:not([inert]),select:not([inert]),textarea:not([inert]),a[href]:not([inert]),button:not([inert]),[tabindex]:not(slot):not([inert]),audio[controls]:not([inert]),video[controls]:not([inert]),[contenteditable]:not([contenteditable="false"]):not([inert]),details>summary:first-of-type:not([inert]),details:not([inert])',ls="undefined"==typeof Element,la=ls?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,lo=!ls&&Element.prototype.getRootNode?function(t){var e;return null==t||null==(e=t.getRootNode)?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},ll=function t(e,r){void 0===r&&(r=!0);var i,n=null==e||null==(i=e.getAttribute)?void 0:i.call(e,"inert");return""===n||"true"===n||r&&e&&t(e.parentNode)},lh=function(t){var e,r=null==t||null==(e=t.getAttribute)?void 0:e.call(t,"contenteditable");return""===r||"true"===r},lc=function(t,e,r){if(ll(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(ln));return e&&la.call(t,ln)&&i.unshift(t),i=i.filter(r)},lu=function t(e,r,i){for(var n=[],s=Array.from(e);s.length;){var a=s.shift();if(!ll(a,!1))if("SLOT"===a.tagName){var o=a.assignedElements(),l=t(o.length?o:a.children,!0,i);i.flatten?n.push.apply(n,l):n.push({scopeParent:a,candidates:l})}else{la.call(a,ln)&&i.filter(a)&&(r||!e.includes(a))&&n.push(a);var h=a.shadowRoot||"function"==typeof i.getShadowRoot&&i.getShadowRoot(a),c=!ll(h,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(a));if(h&&c){var u=t(!0===h?a.children:h.children,!0,i);i.flatten?n.push.apply(n,u):n.push({scopeParent:a,candidates:u})}else s.unshift.apply(s,a.children)}}return n},ld=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},lf=function(t){if(!t)throw Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||lh(t))&&!ld(t)?0:t.tabIndex},lg=function(t,e){var r=lf(t);return r<0&&e&&!ld(t)?0:r},lp=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},lm=function(t){return"INPUT"===t.tagName},lv=function(t,e){for(var r=0;rsummary:first-of-type")?t.parentElement:t;if(la.call(n,"details:not([open]) *"))return!0;if(r&&"full"!==r&&"legacy-full"!==r){if("non-zero-area"===r)return l_(t)}else{if("function"==typeof i){for(var s=t;t;){var a=t.parentElement,o=lo(t);if(a&&!a.shadowRoot&&!0===i(a))return l_(t);t=t.assignedSlot?t.assignedSlot:a||o===t.ownerDocument?a:o.host}t=s}if(lb(t))return!t.getClientRects().length;if("legacy-full"!==r)return!0}return!1},lC=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var r=0;rlf(e))&&!!lS(t,e)},lO=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!isNaN(e)||!!(e>=0)},lk=function t(e){var r=[],i=[];return e.forEach(function(e,n){var s=!!e.scopeParent,a=s?e.scopeParent:e,o=lg(a,s),l=s?t(e.candidates):a;0===o?s?r.push.apply(r,l):r.push(a):i.push({documentOrder:n,tabIndex:o,item:e,isScope:s,content:l})}),i.sort(lp).reduce(function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t},[]).concat(r)},lM=function(t,e){return lk((e=e||{}).getShadowRoot?lu([t],e.includeContainer,{filter:lT.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:lO}):lc(t,e.includeContainer,lT.bind(null,e)))},lE=function(t,e){return(e=e||{}).getShadowRoot?lu([t],e.includeContainer,{filter:lS.bind(null,e),flatten:!0,getShadowRoot:e.getShadowRoot}):lc(t,e.includeContainer,lS.bind(null,e))},lD=function(t,e){if(e=e||{},!t)throw Error("No node provided");return!1!==la.call(t,ln)&&lT(e,t)};function lj(){let t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(t=>{let{brand:e,version:r}=t;return e+"/"+r}).join(" "):navigator.userAgent}function lA(){let t=/android/i;return t.test(function(){let t=navigator.userAgentData;return null!=t&&t.platform?t.platform:navigator.platform}())||t.test(lj())}let lP="data-floating-ui-focusable";function lF(t){let e=t.activeElement;for(;(null==(r=e)||null==(r=r.shadowRoot)?void 0:r.activeElement)!=null;){var r;e=e.shadowRoot.activeElement}return e}function lL(t,e){if(!t||!e)return!1;let r=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(r&&oT(r)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function lR(t){return"composedPath"in t?t.composedPath()[0]:t.target}function lI(t,e){return null!=e&&("composedPath"in t?t.composedPath().includes(e):null!=t.target&&e.contains(t.target))}function lB(t){return(null==t?void 0:t.ownerDocument)||document}function lN(t){return oS(t)&&t.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function lW(t){return!!t&&"combobox"===t.getAttribute("role")&&lN(t)}function lU(t){return t?t.hasAttribute(lP)?t:t.querySelector("["+lP+"]")||t:null}function lH(t,e,r){return void 0===r&&(r=!0),t.filter(t=>{var i;return t.parentId===e&&(!r||(null==(i=t.context)?void 0:i.open))}).flatMap(e=>[e,...lH(t,e.id,r)])}function lX(t,e){var r;let i=[],n=null==(r=t.find(t=>t.id===e))?void 0:r.parentId;for(;n;){let e=t.find(t=>t.id===n);n=null==e?void 0:e.parentId,e&&(i=i.concat(e))}return i}function lV(t){t.preventDefault(),t.stopPropagation()}function lz(t,e){let r=["mouse","pen"];return e||r.push("",void 0),r.includes(t)}var lY="undefined"!=typeof document?Z.useLayoutEffect:function(){};function lG(t){let e=Z.useRef(t);return lY(()=>{e.current=t}),e}let lq={...Z}.useInsertionEffect||(t=>t());function lK(t){let e=Z.useRef(()=>{});return lq(()=>{e.current=t}),Z.useCallback(function(){for(var t=arguments.length,r=Array(t),i=0;i({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function lJ(t,e){let r=lM(t,lQ()),i=r.length;if(0===i)return;let n=lF(lB(t)),s=r.indexOf(n);return r[-1===s?1===e?0:i-1:s+e]}function lZ(t,e){let r=e||t.currentTarget,i=t.relatedTarget;return!i||!lL(r,i)}let l$="active",l0="selected",l1={...Z},l2=!1,l5=0,l4=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+l5++,l3=l1.useId||function(){let[t,e]=Z.useState(()=>l2?l4():void 0);return lY(()=>{null==t&&e(l4())},[]),Z.useEffect(()=>{l2=!0},[]),t},l9=Z.createContext(null),l6=Z.createContext(null),l8=()=>{var t;return(null==(t=Z.useContext(l9))?void 0:t.id)||null},l7=()=>Z.useContext(l6);function ht(t){return"data-floating-ui-"+t}let he=0;function hr(t,e){void 0===e&&(e={});let{preventScroll:r=!1,cancelPrevious:i=!0,sync:n=!1}=e;i&&cancelAnimationFrame(he);let s=()=>null==t?void 0:t.focus({preventScroll:r});n?s():he=requestAnimationFrame(s)}let hi={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function hn(t){return"inert"===t?hi.inert:"aria-hidden"===t?hi["aria-hidden"]:hi.none}let hs=new WeakSet,ha={},ho=0,hl=t=>t&&(t.host||hl(t.parentNode));function hh(t,e,r){var i;void 0===e&&(e=!1),void 0===r&&(r=!1);let n=((null==(i=t[0])?void 0:i.ownerDocument)||document).body;return function(t,e,r,i){let n="data-floating-ui-inert",s=i?"inert":r?"aria-hidden":null,a=t.map(t=>{if(e.contains(t))return t;let r=hl(t);return e.contains(r)?r:null}).filter(t=>null!=t),o=new Set,l=new Set(a),h=[];ha[n]||(ha[n]=new WeakMap);let c=ha[n];return a.forEach(function t(e){!(!e||o.has(e))&&(o.add(e),e.parentNode&&t(e.parentNode))}),function t(e){!e||l.has(e)||[].forEach.call(e.children,e=>{if("script"!==ox(e))if(o.has(e))t(e);else{let t=s?e.getAttribute(s):null,r=null!==t&&"false"!==t,i=hn(s),a=(i.get(e)||0)+1,o=(c.get(e)||0)+1;i.set(e,a),c.set(e,o),h.push(e),1===a&&r&&hs.add(e),1===o&&e.setAttribute(n,""),!r&&s&&e.setAttribute(s,"inert"===s?"":"true")}})}(e),o.clear(),ho++,()=>{h.forEach(t=>{let e=hn(s),r=(e.get(t)||0)-1,i=(c.get(t)||0)-1;e.set(t,r),c.set(t,i),r||(!hs.has(t)&&s&&t.removeAttribute(s),hs.delete(t)),i||t.removeAttribute(n)}),--ho||(hi.inert=new WeakMap,hi["aria-hidden"]=new WeakMap,hi.none=new WeakMap,hs=new WeakSet,ha={})}}(t.concat(Array.from(n.querySelectorAll('[aria-live],[role="status"],output'))),n,e,r)}let hc={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},hu=Z.forwardRef(function(t,e){let[r,i]=Z.useState();lY(()=>{/apple/i.test(navigator.vendor)&&i("button")},[]);let n={ref:e,tabIndex:0,role:r,"aria-hidden":!r||void 0,[ht("focus-guard")]:"",style:hc};return(0,J.jsx)("span",{...t,...n})}),hd=Z.createContext(null);function hf(t){return Z.useMemo(()=>e=>{t.forEach(t=>{t&&(t.current=e)})},t)}let hg=[];function hp(){hg=hg.filter(t=>t.isConnected)}function hm(){return hp(),hg[hg.length-1]}function hv(t,e){var r;if(!e.current.includes("floating")&&!(null!=(r=t.getAttribute("role"))&&r.includes("dialog")))return;let i=lQ(),n=lE(t,i).filter(t=>{let e=t.getAttribute("data-tabindex")||"";return lD(t,i)||t.hasAttribute("data-tabindex")&&!e.startsWith("-")}),s=t.getAttribute("tabindex");e.current.includes("floating")||0===n.length?"0"!==s&&t.setAttribute("tabindex","0"):("-1"!==s||t.hasAttribute("data-tabindex")&&"-1"!==t.getAttribute("data-tabindex"))&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}let hy=Z.forwardRef(function(t,e){return(0,J.jsx)("button",{...t,type:"button",ref:e,tabIndex:-1,style:hc})});function hx(t){let{context:e,children:r,disabled:i=!1,order:n=["content"],guards:s=!0,initialFocus:a=0,returnFocus:o=!0,restoreFocus:l=!1,modal:h=!0,visuallyHiddenDismiss:c=!1,closeOnFocusOut:u=!0,outsideElementsInert:d=!1,getInsideElements:f=()=>[]}=t,{open:g,onOpenChange:p,events:m,dataRef:y,elements:{domReference:x,floating:b}}=e,_=lK(()=>{var t;return null==(t=y.current.floatingContext)?void 0:t.nodeId}),w=lK(f),C="number"==typeof a&&a<0,S=lW(x)&&C,T="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,O=!T||s,k=!O||T&&d,M=lG(n),E=lG(a),D=lG(o),j=l7(),A=Z.useContext(hd),P=Z.useRef(null),F=Z.useRef(null),L=Z.useRef(!1),R=Z.useRef(!1),I=Z.useRef(-1),B=Z.useRef(-1),N=null!=A,W=lU(b),U=lK(function(t){return void 0===t&&(t=W),t?lM(t,lQ()):[]}),H=lK(t=>{let e=U(t);return M.current.map(t=>x&&"reference"===t?x:W&&"floating"===t?W:e).filter(Boolean).flat()});Z.useEffect(()=>{if(i||!h)return;function t(t){if("Tab"===t.key){lL(W,lF(lB(W)))&&0===U().length&&!S&&lV(t);let e=H(),r=lR(t);"reference"===M.current[0]&&r===x&&(lV(t),t.shiftKey?hr(e[e.length-1]):hr(e[1])),"floating"===M.current[1]&&r===W&&t.shiftKey&&(lV(t),hr(e[0]))}}let e=lB(W);return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}},[i,x,W,h,M,S,U,H]),Z.useEffect(()=>{if(!i&&b)return b.addEventListener("focusin",t),()=>{b.removeEventListener("focusin",t)};function t(t){let e=lR(t),r=U().indexOf(e);-1!==r&&(I.current=r)}},[i,b,U]),Z.useEffect(()=>{if(i||!u)return;function t(){R.current=!0,setTimeout(()=>{R.current=!1})}function e(t){let e=t.relatedTarget,r=t.currentTarget,i=lR(t);queueMicrotask(()=>{let n=_(),s=!(lL(x,e)||lL(b,e)||lL(e,b)||lL(null==A?void 0:A.portalNode,e)||null!=e&&e.hasAttribute(ht("focus-guard"))||j&&(lH(j.nodesRef.current,n).find(t=>{var r,i;return lL(null==(r=t.context)?void 0:r.elements.floating,e)||lL(null==(i=t.context)?void 0:i.elements.domReference,e)})||lX(j.nodesRef.current,n).find(t=>{var r,i,n;return[null==(r=t.context)?void 0:r.elements.floating,lU(null==(i=t.context)?void 0:i.elements.floating)].includes(e)||(null==(n=t.context)?void 0:n.elements.domReference)===e})));if(r===x&&W&&hv(W,M),l&&r!==x&&!(null!=i&&i.isConnected)&&lF(lB(W))===lB(W).body){oS(W)&&W.focus();let t=I.current,e=U(),r=e[t]||e[e.length-1]||W;oS(r)&&r.focus()}if(y.current.insideReactTree){y.current.insideReactTree=!1;return}(S||!h)&&e&&s&&!R.current&&e!==hm()&&(L.current=!0,p(!1,t,"focus-out"))})}let r=!!(!j&&A);function n(){-1!==B.current&&(clearTimeout(B.current),B.current=-1),y.current.insideReactTree=!0,B.current=window.setTimeout(()=>{y.current.insideReactTree=!1})}if(b&&oS(x))return x.addEventListener("focusout",e),x.addEventListener("pointerdown",t),b.addEventListener("focusout",e),r&&b.addEventListener("focusout",n,!0),()=>{x.removeEventListener("focusout",e),x.removeEventListener("pointerdown",t),b.removeEventListener("focusout",e),r&&b.removeEventListener("focusout",n,!0)}},[i,x,b,W,h,j,A,p,u,l,U,S,_,M,y]);let X=Z.useRef(null),V=Z.useRef(null),z=hf([X,null==A?void 0:A.beforeInsideRef]),Y=hf([V,null==A?void 0:A.afterInsideRef]);function G(t){return!i&&c&&h?(0,J.jsx)(hy,{ref:"start"===t?P:F,onClick:t=>p(!1,t.nativeEvent),children:"string"==typeof c?c:"Dismiss"}):null}Z.useEffect(()=>{var t,e;if(i||!b)return;let r=Array.from((null==A||null==(t=A.portalNode)?void 0:t.querySelectorAll("["+ht("portal")+"]"))||[]),n=[b,null==(e=(j?lX(j.nodesRef.current,_()):[]).find(t=>{var e;return lW((null==(e=t.context)?void 0:e.elements.domReference)||null)}))||null==(e=e.context)?void 0:e.elements.domReference,...r,...w(),P.current,F.current,X.current,V.current,null==A?void 0:A.beforeOutsideRef.current,null==A?void 0:A.afterOutsideRef.current,M.current.includes("reference")||S?x:null].filter(t=>null!=t),s=h||S?hh(n,!k,k):hh(n);return()=>{s()}},[i,x,b,h,M,A,S,O,k,j,_,w]),lY(()=>{if(i||!oS(W))return;let t=lF(lB(W));queueMicrotask(()=>{let e=H(W),r=E.current,i=("number"==typeof r?e[r]:r.current)||W,n=lL(W,t);C||n||!g||hr(i,{preventScroll:i===W})})},[i,g,W,C,H,E]),lY(()=>{var t;if(i||!W)return;let e=lB(W);function r(t){let{reason:e,event:r,nested:i}=t;if(["hover","safe-polygon"].includes(e)&&"mouseleave"===r.type&&(L.current=!0),"outside-press"===e)if(i)L.current=!1;else if(0===r.mozInputSource&&r.isTrusted||(lA()&&r.pointerType?"click"===r.type&&1===r.buttons:0===r.detail&&!r.pointerType)||!lj().includes("jsdom/")&&(!lA()&&0===r.width&&0===r.height||lA()&&1===r.width&&1===r.height&&0===r.pressure&&0===r.detail&&"mouse"===r.pointerType||r.width<1&&r.height<1&&0===r.pressure&&0===r.detail&&"touch"===r.pointerType))L.current=!1;else{let t=!1;document.createElement("div").focus({get preventScroll(){return t=!0,!1}}),t?L.current=!1:L.current=!0}}t=lF(e),hp(),t&&"body"!==ox(t)&&(hg.push(t),hg.length>20&&(hg=hg.slice(-20))),m.on("openchange",r);let n=e.createElement("span");return n.setAttribute("tabindex","-1"),n.setAttribute("aria-hidden","true"),Object.assign(n.style,hc),N&&x&&x.insertAdjacentElement("afterend",n),()=>{m.off("openchange",r);let t=lF(e),i=lL(b,t)||j&&lH(j.nodesRef.current,_(),!1).some(e=>{var r;return lL(null==(r=e.context)?void 0:r.elements.floating,t)}),s=function(){if("boolean"==typeof D.current){let t=x||hm();return t&&t.isConnected?t:n}return D.current.current||n}();queueMicrotask(()=>{let r=function(t){let e=lQ();return lD(t,e)?t:lM(t,e)[0]||t}(s);D.current&&!L.current&&oS(r)&&(r===t||t===e.body||i)&&r.focus({preventScroll:!0}),n.remove()})}},[i,b,W,D,y,m,j,N,x,_]),Z.useEffect(()=>(queueMicrotask(()=>{L.current=!1}),()=>{queueMicrotask(hp)}),[i]),lY(()=>{if(!i&&A)return A.setFocusManagerState({modal:h,closeOnFocusOut:u,open:g,onOpenChange:p,domReference:x}),()=>{A.setFocusManagerState(null)}},[i,A,h,g,p,u,x]),lY(()=>{!i&&W&&hv(W,M)},[i,W,M]);let q=!i&&O&&(!h||!S)&&(N||h);return(0,J.jsxs)(J.Fragment,{children:[q&&(0,J.jsx)(hu,{"data-type":"inside",ref:z,onFocus:t=>{var e;if(h){let t=H();hr("reference"===n[0]?t[0]:t[t.length-1])}else if(null!=A&&A.preserveTabOrder&&A.portalNode)if(L.current=!1,lZ(t,A.portalNode)){let t=lJ(lB(x).body,1)||x;null==t||t.focus()}else null==(e=A.beforeOutsideRef.current)||e.focus()}}),!S&&G("start"),r,G("end"),q&&(0,J.jsx)(hu,{"data-type":"inside",ref:Y,onFocus:t=>{var e;if(h)hr(H()[0]);else if(null!=A&&A.preserveTabOrder&&A.portalNode)if(u&&(L.current=!0),lZ(t,A.portalNode)){let t=lJ(lB(x).body,-1)||x;null==t||t.focus()}else null==(e=A.afterOutsideRef.current)||e.focus()}})]})}function hb(t){return oS(t.target)&&"BUTTON"===t.target.tagName}function h_(t,e){void 0===e&&(e={});let{open:r,onOpenChange:i,dataRef:n,elements:{domReference:s}}=t,{enabled:a=!0,event:o="click",toggle:l=!0,ignoreMouse:h=!1,keyboardHandlers:c=!0,stickIfOpen:u=!0}=e,d=Z.useRef(),f=Z.useRef(!1),g=Z.useMemo(()=>({onPointerDown(t){d.current=t.pointerType},onMouseDown(t){let e=d.current;0===t.button&&"click"!==o&&(lz(e,!0)&&h||(r&&l&&(!n.current.openEvent||!u||"mousedown"===n.current.openEvent.type)?i(!1,t.nativeEvent,"click"):(t.preventDefault(),i(!0,t.nativeEvent,"click"))))},onClick(t){let e=d.current;if("mousedown"===o&&d.current){d.current=void 0;return}lz(e,!0)&&h||(r&&l&&(!n.current.openEvent||!u||"click"===n.current.openEvent.type)?i(!1,t.nativeEvent,"click"):i(!0,t.nativeEvent,"click"))},onKeyDown(t){d.current=void 0,!(t.defaultPrevented||!c||hb(t))&&(" "!==t.key||lN(s)||(t.preventDefault(),f.current=!0),oS(t.target)&&"A"===t.target.tagName||"Enter"!==t.key||(r&&l?i(!1,t.nativeEvent,"click"):i(!0,t.nativeEvent,"click")))},onKeyUp(t){!(t.defaultPrevented||!c||hb(t)||lN(s))&&" "===t.key&&f.current&&(f.current=!1,r&&l?i(!1,t.nativeEvent,"click"):i(!0,t.nativeEvent,"click"))}}),[n,s,o,h,c,i,r,u,l]);return Z.useMemo(()=>a?{reference:g}:{},[a,g])}let hw={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},hC={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},hS=t=>{var e,r;return{escapeKey:"boolean"==typeof t?t:null!=(e=null==t?void 0:t.escapeKey)&&e,outsidePress:"boolean"==typeof t?t:null==(r=null==t?void 0:t.outsidePress)||r}};function hT(t,e){void 0===e&&(e={});let{open:r,onOpenChange:i,elements:n,dataRef:s}=t,{enabled:a=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:h="pointerdown",referencePress:c=!1,referencePressEvent:u="pointerdown",ancestorScroll:d=!1,bubbles:f,capture:g}=e,p=l7(),m=lK("function"==typeof l?l:()=>!1),y="function"==typeof l?m:l,x=Z.useRef(!1),{escapeKey:b,outsidePress:_}=hS(f),{escapeKey:w,outsidePress:C}=hS(g),S=Z.useRef(!1),T=lK(t=>{var e;if(!r||!a||!o||"Escape"!==t.key||S.current)return;let n=null==(e=s.current.floatingContext)?void 0:e.nodeId,l=p?lH(p.nodesRef.current,n):[];if(!b&&(t.stopPropagation(),l.length>0)){let t=!0;if(l.forEach(e=>{var r;if(null!=(r=e.context)&&r.open&&!e.context.dataRef.current.__escapeKeyBubbles){t=!1;return}}),!t)return}i(!1,"nativeEvent"in t?t.nativeEvent:t,"escape-key")}),O=lK(t=>{var e;let r=()=>{var e;T(t),null==(e=lR(t))||e.removeEventListener("keydown",r)};null==(e=lR(t))||e.addEventListener("keydown",r)}),k=lK(t=>{var e;let r=s.current.insideReactTree;s.current.insideReactTree=!1;let a=x.current;if(x.current=!1,"click"===h&&a||r||"function"==typeof y&&!y(t))return;let o=lR(t),l="["+ht("inert")+"]",c=lB(n.floating).querySelectorAll(l),u=oC(o)?o:null;for(;u&&!oI(u);){let t=oW(u);if(oI(t)||!oC(t))break;u=t}if(c.length&&oC(o)&&!o.matches("html,body")&&!lL(o,n.floating)&&Array.from(c).every(t=>!lL(u,t)))return;if(oS(o)&&D){let e=oI(o),r=oB(o),i=/auto|scroll/,n=e||i.test(r.overflowX),s=e||i.test(r.overflowY),a=n&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,l=s&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,h="rtl"===r.direction,c=l&&(h?t.offsetX<=o.offsetWidth-o.clientWidth:t.offsetX>o.clientWidth),u=a&&t.offsetY>o.clientHeight;if(c||u)return}let d=null==(e=s.current.floatingContext)?void 0:e.nodeId,f=p&&lH(p.nodesRef.current,d).some(e=>{var r;return lI(t,null==(r=e.context)?void 0:r.elements.floating)});if(lI(t,n.floating)||lI(t,n.domReference)||f)return;let g=p?lH(p.nodesRef.current,d):[];if(g.length>0){let t=!0;if(g.forEach(e=>{var r;if(null!=(r=e.context)&&r.open&&!e.context.dataRef.current.__outsidePressBubbles){t=!1;return}}),!t)return}i(!1,t,"outside-press")}),M=lK(t=>{var e;let r=()=>{var e;k(t),null==(e=lR(t))||e.removeEventListener(h,r)};null==(e=lR(t))||e.addEventListener(h,r)});Z.useEffect(()=>{if(!r||!a)return;s.current.__escapeKeyBubbles=b,s.current.__outsidePressBubbles=_;let t=-1;function e(t){i(!1,t,"ancestor-scroll")}function l(){window.clearTimeout(t),S.current=!0}function c(){t=window.setTimeout(()=>{S.current=!1},5*!!oL())}let u=lB(n.floating);o&&(u.addEventListener("keydown",w?O:T,w),u.addEventListener("compositionstart",l),u.addEventListener("compositionend",c)),y&&u.addEventListener(h,C?M:k,C);let f=[];return d&&(oC(n.domReference)&&(f=oU(n.domReference)),oC(n.floating)&&(f=f.concat(oU(n.floating))),!oC(n.reference)&&n.reference&&n.reference.contextElement&&(f=f.concat(oU(n.reference.contextElement)))),(f=f.filter(t=>{var e;return t!==(null==(e=u.defaultView)?void 0:e.visualViewport)})).forEach(t=>{t.addEventListener("scroll",e,{passive:!0})}),()=>{o&&(u.removeEventListener("keydown",w?O:T,w),u.removeEventListener("compositionstart",l),u.removeEventListener("compositionend",c)),y&&u.removeEventListener(h,C?M:k,C),f.forEach(t=>{t.removeEventListener("scroll",e)}),window.clearTimeout(t)}},[s,n,o,y,h,r,i,d,a,b,_,T,w,O,k,C,M]),Z.useEffect(()=>{s.current.insideReactTree=!1},[s,y,h]);let E=Z.useMemo(()=>({onKeyDown:T,...c&&{[hw[u]]:t=>{i(!1,t.nativeEvent,"reference-press")},..."click"!==u&&{onClick(t){i(!1,t.nativeEvent,"reference-press")}}}}),[T,i,c,u]),D=Z.useMemo(()=>({onKeyDown:T,onMouseDown(){x.current=!0},onMouseUp(){x.current=!0},[hC[h]]:()=>{s.current.insideReactTree=!0}}),[T,h,s]);return Z.useMemo(()=>a?{reference:E,floating:D}:{},[a,E,D])}function hO(t){void 0===t&&(t={});let{nodeId:e}=t,r=function(t){let{open:e=!1,onOpenChange:r,elements:i}=t,n=l3(),s=Z.useRef({}),[a]=Z.useState(()=>(function(){let t=new Map;return{emit(e,r){var i;null==(i=t.get(e))||i.forEach(t=>t(r))},on(e,r){t.has(e)||t.set(e,new Set),t.get(e).add(r)},off(e,r){var i;null==(i=t.get(e))||i.delete(r)}}})()),o=null!=l8(),[l,h]=Z.useState(i.reference),c=lK((t,e,i)=>{s.current.openEvent=t?e:void 0,a.emit("openchange",{open:t,event:e,reason:i,nested:o}),null==r||r(t,e,i)}),u=Z.useMemo(()=>({setPositionReference:h}),[]),d=Z.useMemo(()=>({reference:l||i.reference||null,floating:i.floating||null,domReference:i.reference}),[l,i.reference,i.floating]);return Z.useMemo(()=>({dataRef:s,open:e,onOpenChange:c,elements:d,events:a,floatingId:n,refs:u}),[e,c,d,a,n,u])}({...t,elements:{reference:null,floating:null,...t.elements}}),i=t.rootContext||r,n=i.elements,[s,a]=Z.useState(null),[o,l]=Z.useState(null),h=(null==n?void 0:n.domReference)||s,c=Z.useRef(null),u=l7();lY(()=>{h&&(c.current=h)},[h]);let d=function(t){void 0===t&&(t={});let{placement:e="bottom",strategy:r="absolute",middleware:i=[],platform:n,elements:{reference:s,floating:a}={},transform:o=!0,whileElementsMounted:l,open:h}=t,[c,u]=Z.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[d,f]=Z.useState(i);o8(d,i)||f(i);let[g,p]=Z.useState(null),[m,y]=Z.useState(null),x=Z.useCallback(t=>{t!==C.current&&(C.current=t,p(t))},[]),b=Z.useCallback(t=>{t!==S.current&&(S.current=t,y(t))},[]),_=s||g,w=a||m,C=Z.useRef(null),S=Z.useRef(null),T=Z.useRef(c),O=null!=l,k=le(l),M=le(n),E=le(h),D=Z.useCallback(()=>{if(!C.current||!S.current)return;let t={placement:e,strategy:r,middleware:d};M.current&&(t.platform=M.current),((t,e,r)=>{let i=new Map,n={platform:o5,...r},s={...n.platform,_c:i};return og(t,e,{...n,platform:s})})(C.current,S.current,t).then(t=>{let e={...t,isPositioned:!1!==E.current};j.current&&!o8(T.current,e)&&(T.current=e,o9.flushSync(()=>{u(e)}))})},[d,e,r,M,E]);o6(()=>{!1===h&&T.current.isPositioned&&(T.current.isPositioned=!1,u(t=>({...t,isPositioned:!1})))},[h]);let j=Z.useRef(!1);o6(()=>(j.current=!0,()=>{j.current=!1}),[]),o6(()=>{if(_&&(C.current=_),w&&(S.current=w),_&&w){if(k.current)return k.current(_,w,D);D()}},[_,w,D,k,O]);let A=Z.useMemo(()=>({reference:C,floating:S,setReference:x,setFloating:b}),[x,b]),P=Z.useMemo(()=>({reference:_,floating:w}),[_,w]),F=Z.useMemo(()=>{let t={position:r,left:0,top:0};if(!P.floating)return t;let e=lt(P.floating,c.x),i=lt(P.floating,c.y);return o?{...t,transform:"translate("+e+"px, "+i+"px)",...o7(P.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:e,top:i}},[r,o,P.floating,c.x,c.y]);return Z.useMemo(()=>({...c,update:D,refs:A,elements:P,floatingStyles:F}),[c,D,A,P,F])}({...t,elements:{...n,...o&&{reference:o}}}),f=Z.useCallback(t=>{let e=oC(t)?{getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>t.getClientRects(),contextElement:t}:t;l(e),d.refs.setReference(e)},[d.refs]),g=Z.useCallback(t=>{(oC(t)||null===t)&&(c.current=t,a(t)),(oC(d.refs.reference.current)||null===d.refs.reference.current||null!==t&&!oC(t))&&d.refs.setReference(t)},[d.refs]),p=Z.useMemo(()=>({...d.refs,setReference:g,setPositionReference:f,domReference:c}),[d.refs,g,f]),m=Z.useMemo(()=>({...d.elements,domReference:h}),[d.elements,h]),y=Z.useMemo(()=>({...d,...i,refs:p,elements:m,nodeId:e}),[d,p,m,e,i]);return lY(()=>{i.dataRef.current.floatingContext=y;let t=null==u?void 0:u.nodesRef.current.find(t=>t.id===e);t&&(t.context=y)}),Z.useMemo(()=>({...d,context:y,refs:p,elements:m}),[d,p,m,y])}function hk(t,e,r){let i=new Map,n="item"===r,s=t;if(n&&t){let{[l$]:e,[l0]:r,...i}=t;s=i}return{..."floating"===r&&{tabIndex:-1,"data-floating-ui-focusable":""},...s,...e.map(e=>{let i=e?e[r]:null;return"function"==typeof i?t?i(t):null:i}).concat(t).reduce((t,e)=>(e&&Object.entries(e).forEach(e=>{let[r,s]=e;if(!(n&&[l$,l0].includes(r)))if(0===r.indexOf("on")){if(i.has(r)||i.set(r,[]),"function"==typeof s){var a;null==(a=i.get(r))||a.push(s),t[r]=function(){for(var t,e=arguments.length,n=Array(e),s=0;st(...n)).find(t=>void 0!==t)}}}else t[r]=s}),t),{})}}function hM(t){void 0===t&&(t=[]);let e=t.map(t=>null==t?void 0:t.reference),r=t.map(t=>null==t?void 0:t.floating),i=t.map(t=>null==t?void 0:t.item),n=Z.useCallback(e=>hk(e,t,"reference"),e),s=Z.useCallback(e=>hk(e,t,"floating"),r),a=Z.useCallback(e=>hk(e,t,"item"),i);return Z.useMemo(()=>({getReferenceProps:n,getFloatingProps:s,getItemProps:a}),[n,s,a])}let hE=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hD(t,e){var r,i;void 0===e&&(e={});let{open:n,elements:s,floatingId:a}=t,{enabled:o=!0,role:l="dialog"}=e,h=l3(),c=(null==(r=s.domReference)?void 0:r.id)||h,u=Z.useMemo(()=>{var t;return(null==(t=lU(s.floating))?void 0:t.id)||a},[s.floating,a]),d=null!=(i=hE.get(l))?i:l,f=null!=l8(),g=Z.useMemo(()=>"tooltip"===d||"label"===l?{["aria-"+("label"===l?"labelledby":"describedby")]:n?u:void 0}:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===d?"dialog":d,"aria-controls":n?u:void 0,..."listbox"===d&&{role:"combobox"},..."menu"===d&&{id:c},..."menu"===d&&f&&{role:"menuitem"},..."select"===l&&{"aria-autocomplete":"none"},..."combobox"===l&&{"aria-autocomplete":"list"}},[d,u,f,n,c,l]),p=Z.useMemo(()=>{let t={id:u,...d&&{role:d}};return"tooltip"===d||"label"===l?t:{...t,..."menu"===d&&{"aria-labelledby":c}}},[d,u,c,l]),m=Z.useCallback(t=>{let{active:e,selected:r}=t,i={role:"option",...e&&{id:u+"-fui-option"}};switch(l){case"select":case"combobox":return{...i,"aria-selected":r}}return{}},[u,l]);return Z.useMemo(()=>o?{reference:g,floating:p,item:m}:{},[o,g,p,m])}var hj=t.i(40141);function hA(t){return(0,hj.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M6.9998 6V3C6.9998 2.44772 7.44752 2 7.9998 2H19.9998C20.5521 2 20.9998 2.44772 20.9998 3V17C20.9998 17.5523 20.5521 18 19.9998 18H16.9998V20.9991C16.9998 21.5519 16.5499 22 15.993 22H4.00666C3.45059 22 3 21.5554 3 20.9991L3.0026 7.00087C3.0027 6.44811 3.45264 6 4.00942 6H6.9998ZM8.9998 6H16.9998V16H18.9998V4H8.9998V6Z"},child:[]}]})(t)}function hP(t){return(0,hj.GenIcon)({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5 2a1 1 0 011 1v1h1a1 1 0 010 2H6v1a1 1 0 01-2 0V6H3a1 1 0 010-2h1V3a1 1 0 011-1zm0 10a1 1 0 011 1v1h1a1 1 0 110 2H6v1a1 1 0 11-2 0v-1H3a1 1 0 110-2h1v-1a1 1 0 011-1zM12 2a1 1 0 01.967.744L14.146 7.2 17.5 9.134a1 1 0 010 1.732l-3.354 1.935-1.18 4.455a1 1 0 01-1.933 0L9.854 12.8 6.5 10.866a1 1 0 010-1.732l3.354-1.935 1.18-4.455A1 1 0 0112 2z",clipRule:"evenodd"},child:[]}]})(t)}var hF=t.i(11152);function hL(t){return(0,hj.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M123.193 29.635L121 406.18l84.31-82.836 65.87 159.02 67.5-27.96-65.87-159.02L391 294.342z"},child:[]}]})(t)}function hR(t){return(0,hj.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M149.9 302.2c-39.1 0-70.7 31-70.7 69.3 0 30.3-27.3 46.2-47.2 46.2C53.7 446 90.7 464 126.3 464c52.1 0 94.3-41.4 94.3-92.4 0-38.4-31.6-69.4-70.7-69.4zM473.1 85.7l-31.6-31c-9.2-9-24-9-33.2 0L197 261.8l64.8 63.5 211.2-207c9.3-9 9.3-23.6.1-32.6z"},child:[]}]})(t)}function hI(t){return(0,hj.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M96 448h106.7V64H96v384zM309.3 64v384H416V64H309.3z"},child:[]}]})(t)}function hB(t){return(0,hj.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M96 52v408l320-204L96 52z"},child:[]}]})(t)}function hN(t){return(0,hj.GenIcon)({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M11.904 16c1.777-3.219 2.076-8.13-4.904-7.966v3.966l-6-6 6-6v3.881c8.359-0.218 9.29 7.378 4.904 12.119z"},child:[]}]})(t)}function hW(t){return(0,hj.GenIcon)({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9 3.881v-3.881l6 6-6 6v-3.966c-6.98-0.164-6.681 4.747-4.904 7.966-4.386-4.741-3.455-12.337 4.904-12.119z"},child:[]}]})(t)}function hU(t){return(0,hj.GenIcon)({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8 0c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zM2 8c0-3.314 2.686-6 6-6v12c-3.314 0-6-2.686-6-6z"},child:[]}]})(t)}function hH(t){return(0,hj.GenIcon)({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8 4c-2.209 0-4 1.791-4 4s1.791 4 4 4 4-1.791 4-4-1.791-4-4-4zM8 10.5v-5c1.379 0 2.5 1.122 2.5 2.5s-1.121 2.5-2.5 2.5zM8 13c0.552 0 1 0.448 1 1v1c0 0.552-0.448 1-1 1s-1-0.448-1-1v-1c0-0.552 0.448-1 1-1zM8 3c-0.552 0-1-0.448-1-1v-1c0-0.552 0.448-1 1-1s1 0.448 1 1v1c0 0.552-0.448 1-1 1zM15 7c0.552 0 1 0.448 1 1s-0.448 1-1 1h-1c-0.552 0-1-0.448-1-1s0.448-1 1-1h1zM3 8c0 0.552-0.448 1-1 1h-1c-0.552 0-1-0.448-1-1s0.448-1 1-1h1c0.552 0 1 0.448 1 1zM12.95 11.536l0.707 0.707c0.39 0.39 0.39 1.024 0 1.414s-1.024 0.39-1.414 0l-0.707-0.707c-0.39-0.39-0.39-1.024 0-1.414s1.024-0.39 1.414 0zM3.050 4.464l-0.707-0.707c-0.391-0.391-0.391-1.024 0-1.414s1.024-0.391 1.414 0l0.707 0.707c0.391 0.391 0.391 1.024 0 1.414s-1.024 0.391-1.414 0zM12.95 4.464c-0.39 0.391-1.024 0.391-1.414 0s-0.39-1.024 0-1.414l0.707-0.707c0.39-0.391 1.024-0.391 1.414 0s0.39 1.024 0 1.414l-0.707 0.707zM3.050 11.536c0.39-0.39 1.024-0.39 1.414 0s0.391 1.024 0 1.414l-0.707 0.707c-0.391 0.39-1.024 0.39-1.414 0s-0.391-1.024 0-1.414l0.707-0.707z"},child:[]}]})(t)}function hX(t){return(0,hj.GenIcon)({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M15.5 6h-5.5v-5.5c0-0.276-0.224-0.5-0.5-0.5h-3c-0.276 0-0.5 0.224-0.5 0.5v5.5h-5.5c-0.276 0-0.5 0.224-0.5 0.5v3c0 0.276 0.224 0.5 0.5 0.5h5.5v5.5c0 0.276 0.224 0.5 0.5 0.5h3c0.276 0 0.5-0.224 0.5-0.5v-5.5h5.5c0.276 0 0.5-0.224 0.5-0.5v-3c0-0.276-0.224-0.5-0.5-0.5z"},child:[]}]})(t)}let hV=Z.default.createContext(null);function hz(){let t=(0,Z.useContext)(hV);if(!t)throw Error("No WarriorContext.Provider");return t}hV.displayName="WarriorContext";let hY="undefined"!=typeof window&&window.document&&window.document.createElement?Z.useLayoutEffect:Z.useEffect,hG=(t,e)=>{let r=Z.useRef(!0);hY(()=>t(r.current),e),hY(()=>(r.current=!1,()=>{r.current=!0}),[])},hq=function(t){let e=Z.useRef();return e.current=t,Z.useCallback(function(){for(var t,r=arguments.length,i=Array(r),n=0;n{hQ.push(t)},h0.resetWarned=function(){hK={}},h0.noteOnce=function(t,e){h$(hZ,t,e)};let h1=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=new Set;return function t(e,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=i.has(e);if(h0(!a,"Warning: There may be circular references"),a)return!1;if(e===n)return!0;if(r&&s>1)return!1;i.add(e);let o=s+1;if(Array.isArray(e)){if(!Array.isArray(n)||e.length!==n.length)return!1;for(let r=0;rt(e[r],n[r],o))}return!1}(t,e)};var h2=t.i(43794);function h5(t,e,r,i){let n=(e-r)/(i-r),s={};switch(t){case"rtl":s.right="".concat(100*n,"%"),s.transform="translateX(50%)";break;case"btt":s.bottom="".concat(100*n,"%"),s.transform="translateY(50%)";break;case"ttb":s.top="".concat(100*n,"%"),s.transform="translateY(-50%)";break;default:s.left="".concat(100*n,"%"),s.transform="translateX(-50%)"}return s}function h4(t,e){return Array.isArray(t)?t[e]:t}let h3={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(t){let{keyCode:e}=t;if(t.altKey&&!t.ctrlKey||t.metaKey||e>=h3.F1&&e<=h3.F12)return!1;switch(e){case h3.ALT:case h3.CAPS_LOCK:case h3.CONTEXT_MENU:case h3.CTRL:case h3.DOWN:case h3.END:case h3.ESC:case h3.HOME:case h3.INSERT:case h3.LEFT:case h3.MAC_FF_META:case h3.META:case h3.NUMLOCK:case h3.NUM_CENTER:case h3.PAGE_DOWN:case h3.PAGE_UP:case h3.PAUSE:case h3.PRINT_SCREEN:case h3.RIGHT:case h3.SHIFT:case h3.UP:case h3.WIN_KEY:case h3.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(t){if(t>=h3.ZERO&&t<=h3.NINE||t>=h3.NUM_ZERO&&t<=h3.NUM_MULTIPLY||t>=h3.A&&t<=h3.Z||-1!==window.navigator.userAgent.indexOf("WebKit")&&0===t)return!0;switch(t){case h3.SPACE:case h3.QUESTION_MARK:case h3.NUM_PLUS:case h3.NUM_MINUS:case h3.NUM_PERIOD:case h3.NUM_DIVISION:case h3.SEMICOLON:case h3.DASH:case h3.EQUALS:case h3.COMMA:case h3.PERIOD:case h3.SLASH:case h3.APOSTROPHE:case h3.SINGLE_QUOTE:case h3.OPEN_SQUARE_BRACKET:case h3.BACKSLASH:case h3.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}},h9=Z.createContext({min:0,max:0,direction:"ltr",step:1,includedStart:0,includedEnd:0,tabIndex:0,keyboard:!0,styles:{},classNames:{}}),h6=Z.createContext({});function h8(){return(h8=Object.assign.bind()).apply(this,arguments)}let h7=Z.forwardRef((t,e)=>{let{prefixCls:r,value:i,valueIndex:n,onStartMove:s,onDelete:a,style:o,render:l,dragging:h,draggingDelete:c,onOffsetChange:u,onChangeComplete:d,onFocus:f,onMouseEnter:g,...p}=t,{min:m,max:y,direction:x,disabled:b,keyboard:_,range:w,tabIndex:C,ariaLabelForHandle:S,ariaLabelledByForHandle:T,ariaRequired:O,ariaValueTextFormatterForHandle:k,styles:M,classNames:E}=Z.useContext(h9),D="".concat(r,"-handle"),j=t=>{b||s(t,n)},A=h5(x,i,m,y),P={};if(null!==n){var F;P={tabIndex:b?null:h4(C,n),role:"slider","aria-valuemin":m,"aria-valuemax":y,"aria-valuenow":i,"aria-disabled":b,"aria-label":h4(S,n),"aria-labelledby":h4(T,n),"aria-required":h4(O,n),"aria-valuetext":null==(F=h4(k,n))?void 0:F(i),"aria-orientation":"ltr"===x||"rtl"===x?"horizontal":"vertical",onMouseDown:j,onTouchStart:j,onFocus:t=>{null==f||f(t,n)},onMouseEnter:t=>{g(t,n)},onKeyDown:t=>{if(!b&&_){let e=null;switch(t.which||t.keyCode){case h3.LEFT:e="ltr"===x||"btt"===x?-1:1;break;case h3.RIGHT:e="ltr"===x||"btt"===x?1:-1;break;case h3.UP:e="ttb"!==x?1:-1;break;case h3.DOWN:e="ttb"!==x?-1:1;break;case h3.HOME:e="min";break;case h3.END:e="max";break;case h3.PAGE_UP:e=2;break;case h3.PAGE_DOWN:e=-2;break;case h3.BACKSPACE:case h3.DELETE:null==a||a(n)}null!==e&&(t.preventDefault(),u(e,n))}},onKeyUp:t=>{switch(t.which||t.keyCode){case h3.LEFT:case h3.RIGHT:case h3.UP:case h3.DOWN:case h3.HOME:case h3.END:case h3.PAGE_UP:case h3.PAGE_DOWN:null==d||d()}}}}let L=Z.createElement("div",h8({ref:e,className:(0,h2.default)(D,{["".concat(D,"-").concat(n+1)]:null!==n&&w,["".concat(D,"-dragging")]:h,["".concat(D,"-dragging-delete")]:c},E.handle),style:{...A,...o,...M.handle}},P,p));return l&&(L=l(L,{index:n,prefixCls:r,value:i,dragging:h,draggingDelete:c})),L});function ct(){return(ct=Object.assign.bind()).apply(this,arguments)}let ce=Z.forwardRef((t,e)=>{let{prefixCls:r,style:i,onStartMove:n,onOffsetChange:s,values:a,handleRender:o,activeHandleRender:l,draggingIndex:h,draggingDelete:c,onFocus:u,...d}=t,f=Z.useRef({}),[g,p]=Z.useState(!1),[m,y]=Z.useState(-1),x=t=>{y(t),p(!0)};Z.useImperativeHandle(e,()=>({focus:t=>{var e;null==(e=f.current[t])||e.focus()},hideHelp:()=>{(0,o9.flushSync)(()=>{p(!1)})}}));let b={prefixCls:r,onStartMove:n,onOffsetChange:s,render:o,onFocus:(t,e)=>{x(e),null==u||u(t)},onMouseEnter:(t,e)=>{x(e)},...d};return Z.createElement(Z.Fragment,null,a.map((t,e)=>{let r=h===e;return Z.createElement(h7,ct({ref:t=>{t?f.current[e]=t:delete f.current[e]},dragging:r,draggingDelete:r&&c,style:h4(i,e),key:e,value:t,valueIndex:e},b))}),l&&g&&Z.createElement(h7,ct({key:"a11y"},b,{value:a[m],valueIndex:null,dragging:-1!==h,draggingDelete:c,render:l,style:{pointerEvents:"none"},tabIndex:null,"aria-hidden":!0})))}),cr=t=>{let{prefixCls:e,style:r,children:i,value:n,onClick:s}=t,{min:a,max:o,direction:l,includedStart:h,includedEnd:c,included:u}=Z.useContext(h9),d="".concat(e,"-text"),f=h5(l,n,a,o);return Z.createElement("span",{className:(0,h2.default)(d,{["".concat(d,"-active")]:u&&h<=n&&n<=c}),style:{...f,...r},onMouseDown:t=>{t.stopPropagation()},onClick:()=>{s(n)}},i)},ci=t=>{let{prefixCls:e,marks:r,onClick:i}=t,n="".concat(e,"-mark");return r.length?Z.createElement("div",{className:n},r.map(t=>{let{value:e,style:r,label:s}=t;return Z.createElement(cr,{key:e,prefixCls:n,style:r,value:e,onClick:i},s)})):null},cn=t=>{let{prefixCls:e,value:r,style:i,activeStyle:n}=t,{min:s,max:a,direction:o,included:l,includedStart:h,includedEnd:c}=Z.useContext(h9),u="".concat(e,"-dot"),d=l&&h<=r&&r<=c,f={...h5(o,r,s,a),..."function"==typeof i?i(r):i};return d&&(f={...f,..."function"==typeof n?n(r):n}),Z.createElement("span",{className:(0,h2.default)(u,{["".concat(u,"-active")]:d}),style:f})},cs=t=>{let{prefixCls:e,marks:r,dots:i,style:n,activeStyle:s}=t,{min:a,max:o,step:l}=Z.useContext(h9),h=Z.useMemo(()=>{let t=new Set;if(r.forEach(e=>{t.add(e.value)}),i&&null!==l){let e=a;for(;e<=o;)t.add(e),e+=l}return Array.from(t)},[a,o,l,i,r]);return Z.createElement("div",{className:"".concat(e,"-step")},h.map(t=>Z.createElement(cn,{prefixCls:e,key:t,value:t,style:n,activeStyle:s})))},ca=t=>{let{prefixCls:e,style:r,start:i,end:n,index:s,onStartMove:a,replaceCls:o}=t,{direction:l,min:h,max:c,disabled:u,range:d,classNames:f}=Z.useContext(h9),g="".concat(e,"-track"),p=(i-h)/(c-h),m=(n-h)/(c-h),y=t=>{!u&&a&&a(t,-1)},x={};switch(l){case"rtl":x.right="".concat(100*p,"%"),x.width="".concat(100*m-100*p,"%");break;case"btt":x.bottom="".concat(100*p,"%"),x.height="".concat(100*m-100*p,"%");break;case"ttb":x.top="".concat(100*p,"%"),x.height="".concat(100*m-100*p,"%");break;default:x.left="".concat(100*p,"%"),x.width="".concat(100*m-100*p,"%")}let b=o||(0,h2.default)(g,{["".concat(g,"-").concat(s+1)]:null!==s&&d,["".concat(e,"-track-draggable")]:a},f.track);return Z.createElement("div",{className:b,style:{...x,...r},onMouseDown:y,onTouchStart:y})},co=t=>{let{prefixCls:e,style:r,values:i,startPoint:n,onStartMove:s}=t,{included:a,range:o,min:l,styles:h,classNames:c}=Z.useContext(h9),u=Z.useMemo(()=>{if(!o){if(0===i.length)return[];let t=null!=n?n:l,e=i[0];return[{start:Math.min(t,e),end:Math.max(t,e)}]}let t=[];for(let e=0;e{let{start:n,end:a}=t;return Z.createElement(ca,{index:i,prefixCls:e,style:{...h4(r,i),...h.track},start:n,end:a,key:i,onStartMove:s})}))};function cl(t){let e="targetTouches"in t?t.targetTouches[0]:t;return{pageX:e.pageX,pageY:e.pageY}}let ch=function(t,e,r,i,n,s,a,o,l,h,c){let[u,d]=Z.useState(null),[f,g]=Z.useState(-1),[p,m]=Z.useState(!1),[y,x]=Z.useState(r),[b,_]=Z.useState(r),w=Z.useRef(null),C=Z.useRef(null),S=Z.useRef(null),{onDragStart:T,onDragChange:O}=Z.useContext(h6);hG(()=>{-1===f&&x(r)},[r,f]),Z.useEffect(()=>()=>{document.removeEventListener("mousemove",w.current),document.removeEventListener("mouseup",C.current),S.current&&(S.current.removeEventListener("touchmove",w.current),S.current.removeEventListener("touchend",C.current))},[]);let k=(t,e,r)=>{void 0!==e&&d(e),x(t);let i=t;r&&(i=t.filter((t,e)=>e!==f)),a(i),O&&O({rawValues:t,deleteIndex:r?f:-1,draggingIndex:f,draggingValue:e})},M=hq((t,e,r)=>{if(-1===t){let t=b[0],r=b[b.length-1],a=e*(n-i);a=Math.min(a=Math.max(a,i-t),n-r),a=s(t+a)-t,k(b.map(t=>t+a))}else{let s=[...y];s[t]=b[t];let a=l(s,(n-i)*e,t,"dist");k(a.values,a.value,r)}});return[f,u,p,Z.useMemo(()=>{let t=[...r].sort((t,e)=>t-e),e=[...y].sort((t,e)=>t-e),i={};e.forEach(t=>{i[t]=(i[t]||0)+1}),t.forEach(t=>{i[t]=(i[t]||0)-1});let n=+!!h;return Object.values(i).reduce((t,e)=>t+Math.abs(e),0)<=n?y:r},[r,y,h]),(i,n,s)=>{i.stopPropagation();let a=s||r,l=a[n];g(n),d(l),_(a),x(a),m(!1);let{pageX:u,pageY:f}=cl(i),p=!1;T&&T({rawValues:a,draggingIndex:n,draggingValue:l});let b=r=>{let i,s;r.preventDefault();let{pageX:a,pageY:o}=cl(r),l=a-u,d=o-f,{width:g,height:x}=t.current.getBoundingClientRect();switch(e){case"btt":i=-d/x,s=l;break;case"ttb":i=d/x,s=l;break;case"rtl":i=-l/g,s=d;break;default:i=l/g,s=d}m(p=!!h&&Math.abs(s)>130&&c{t.preventDefault(),document.removeEventListener("mouseup",O),document.removeEventListener("mousemove",b),S.current&&(S.current.removeEventListener("touchmove",w.current),S.current.removeEventListener("touchend",C.current)),w.current=null,C.current=null,S.current=null,o(p),g(-1),m(!1)};document.addEventListener("mouseup",O),document.addEventListener("mousemove",b),i.currentTarget.addEventListener("touchend",O),i.currentTarget.addEventListener("touchmove",b),w.current=b,C.current=O,S.current=i.currentTarget}]},cc=Z.forwardRef((t,e)=>{let{prefixCls:r="rc-slider",className:i,style:n,classNames:s,styles:a,id:o,disabled:l=!1,keyboard:h=!0,autoFocus:c,onFocus:u,onBlur:d,min:f=0,max:g=100,step:p=1,value:m,defaultValue:y,range:x,count:b,onChange:_,onBeforeChange:w,onAfterChange:C,onChangeComplete:S,allowCross:T=!0,pushable:O=!1,reverse:k,vertical:M,included:E=!0,startPoint:D,trackStyle:j,handleStyle:A,railStyle:P,dotStyle:F,activeDotStyle:L,marks:R,dots:I,handleRender:B,activeHandleRender:N,track:W,tabIndex:U=0,ariaLabelForHandle:H,ariaLabelledByForHandle:X,ariaRequired:V,ariaValueTextFormatterForHandle:z}=t,Y=Z.useRef(null),G=Z.useRef(null),q=Z.useMemo(()=>M?k?"ttb":"btt":k?"rtl":"ltr",[k,M]),[K,Q,J,$,tt]=function(t){return(0,Z.useMemo)(()=>{if(!0===t||!t)return[!!t,!1,!1,0];let{editable:e,draggableTrack:r,minCount:i,maxCount:n}=t;return[!0,e,!e&&r,i||0,n]},[t])}(x),te=Z.useMemo(()=>isFinite(f)?f:0,[f]),tr=Z.useMemo(()=>isFinite(g)?g:100,[g]),ti=Z.useMemo(()=>null!==p&&p<=0?1:p,[p]),tn=Z.useMemo(()=>"boolean"==typeof O?!!O&&ti:O>=0&&O,[O,ti]),ts=Z.useMemo(()=>Object.keys(R||{}).map(t=>{let e=R[t],r={value:Number(t)};return e&&"object"==typeof e&&!Z.isValidElement(e)&&("label"in e||"style"in e)?(r.style=e.style,r.label=e.label):r.label=e,r}).filter(t=>{let{label:e}=t;return e||"number"==typeof e}).sort((t,e)=>t.value-e.value),[R]),[ta,to]=function(t,e,r,i,n,s){let a=Z.useCallback(r=>Math.max(t,Math.min(e,r)),[t,e]),o=Z.useCallback(i=>{if(null!==r){let n=t+Math.round((a(i)-t)/r)*r,s=t=>(String(t).split(".")[1]||"").length,o=Math.max(s(r),s(e),s(t)),l=Number(n.toFixed(o));return t<=l&&l<=e?l:null}return null},[r,t,e,a]),l=Z.useCallback(n=>{let s=a(n),l=i.map(t=>t.value);null!==r&&l.push(o(n)),l.push(t,e);let h=l[0],c=e-t;return l.forEach(t=>{let e=Math.abs(s-t);e<=c&&(h=t,c=e)}),h},[t,e,i,r,a,o]),h=function(n,s,a){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unit";if("number"==typeof s){let c,u=n[a],d=u+s,f=[];i.forEach(t=>{f.push(t.value)}),f.push(t,e),f.push(o(u));let g=s>0?1:-1;"unit"===l?f.push(o(u+g*r)):f.push(o(d)),f=f.filter(t=>null!==t).filter(t=>s<0?t<=u:t>=u),"unit"===l&&(f=f.filter(t=>t!==u));let p="unit"===l?u:d,m=Math.abs((c=f[0])-p);if(f.forEach(t=>{let e=Math.abs(t-p);e1){let t=[...n];return t[a]=c,h(t,s-g,a,l)}return c}return"min"===s?t:"max"===s?e:void 0},c=function(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unit",n=t[r],s=h(t,e,r,i);return{value:s,changed:s!==n}},u=t=>null===s&&0===t||"number"==typeof s&&t3&&void 0!==arguments[3]?arguments[3]:"unit",a=t.map(l),o=a[r],d=h(a,e,r,i);if(a[r]=d,!1===n){let t=s||0;r>0&&a[r-1]!==o&&(a[r]=Math.max(a[r],a[r-1]+t)),r0;t-=1){let e=!0;for(;u(a[t]-a[t-1])&&e;)({value:a[t-1],changed:e}=c(a,-1,t-1))}for(let t=a.length-1;t>0;t-=1){let e=!0;for(;u(a[t]-a[t-1])&&e;)({value:a[t-1],changed:e}=c(a,-1,t-1))}for(let t=0;t{t||i(e)},[e]),[n,i]}(y,m),tc=Z.useMemo(()=>{let t=null==tl?[]:Array.isArray(tl)?tl:[tl],[e=te]=t,r=null===tl?[]:[e];if(K){if(r=[...t],b||void 0===tl){let t=b>=0?b+1:2;for(r=r.slice(0,t);r.lengtht-e)}return r.forEach((t,e)=>{r[e]=ta(t)}),r},[tl,K,te,b,ta]),tu=t=>K?t:t[0],td=hq(t=>{let e=[...t].sort((t,e)=>t-e);_&&!h1(e,tc,!0)&&_(tu(e)),th(e)}),tf=hq(t=>{t&&Y.current.hideHelp();let e=tu(tc);null==C||C(e),h0(!C,"[rc-slider] `onAfterChange` is deprecated. Please use `onChangeComplete` instead."),null==S||S(e)}),[tg,tp,tm,tv,ty]=ch(G,q,tc,te,tr,ta,td,tf,to,Q,$),tx=(t,e)=>{if(!l){let n=[...tc],s=0,a=0,o=tr-te;tc.forEach((e,r)=>{let i=Math.abs(t-e);i<=o&&(o=i,s=r),e{if(null!==tb){let t=tc.indexOf(tb);t>=0&&Y.current.focus(t)}t_(null)},[tb]);let tw=Z.useMemo(()=>(!J||null!==ti)&&J,[J,ti]),tC=hq((t,e)=>{ty(t,e),null==w||w(tu(tc))}),tS=-1!==tg;Z.useEffect(()=>{if(!tS){let t=tc.lastIndexOf(tp);Y.current.focus(t)}},[tS]);let tT=Z.useMemo(()=>[...tv].sort((t,e)=>t-e),[tv]),[tO,tk]=Z.useMemo(()=>K?[tT[0],tT[tT.length-1]]:[te,tT[0]],[tT,K,te]);Z.useImperativeHandle(e,()=>({focus:()=>{Y.current.focus(0)},blur:()=>{var t;let{activeElement:e}=document;(null==(t=G.current)?void 0:t.contains(e))&&(null==e||e.blur())}})),Z.useEffect(()=>{c&&Y.current.focus(0)},[]);let tM=Z.useMemo(()=>({min:te,max:tr,direction:q,disabled:l,keyboard:h,step:ti,included:E,includedStart:tO,includedEnd:tk,range:K,tabIndex:U,ariaLabelForHandle:H,ariaLabelledByForHandle:X,ariaRequired:V,ariaValueTextFormatterForHandle:z,styles:a||{},classNames:s||{}}),[te,tr,q,l,h,ti,E,tO,tk,K,U,H,X,V,z,a,s]);return Z.createElement(h9.Provider,{value:tM},Z.createElement("div",{ref:G,className:(0,h2.default)(r,i,{["".concat(r,"-disabled")]:l,["".concat(r,"-vertical")]:M,["".concat(r,"-horizontal")]:!M,["".concat(r,"-with-marks")]:ts.length}),style:n,onMouseDown:t=>{let e;t.preventDefault();let{width:r,height:i,left:n,top:s,bottom:a,right:o}=G.current.getBoundingClientRect(),{clientX:l,clientY:h}=t;switch(q){case"btt":e=(a-h)/i;break;case"ttb":e=(h-s)/i;break;case"rtl":e=(o-l)/r;break;default:e=(l-n)/r}tx(ta(te+e*(tr-te)),t)},id:o},Z.createElement("div",{className:(0,h2.default)("".concat(r,"-rail"),null==s?void 0:s.rail),style:{...P,...null==a?void 0:a.rail}}),!1!==W&&Z.createElement(co,{prefixCls:r,style:j,values:tc,startPoint:D,onStartMove:tw?tC:void 0}),Z.createElement(cs,{prefixCls:r,marks:ts,dots:I,style:F,activeStyle:L}),Z.createElement(ce,{ref:Y,prefixCls:r,style:A,values:tv,draggingIndex:tg,draggingDelete:tm,onStartMove:tC,onOffsetChange:(t,e)=>{if(!l){let r=to(tc,t,e);null==w||w(tu(tc)),td(r.values),t_(r.value)}},onFocus:u,onBlur:d,handleRender:B,activeHandleRender:N,onChangeComplete:tf,onDelete:Q?t=>{if(l||!Q||tc.length<=$)return;let e=[...tc];e.splice(t,1),null==w||w(tu(e)),td(e);let r=Math.max(0,t-1);Y.current.hideHelp(),Y.current.focus(r)}:void 0}),Z.createElement(ci,{prefixCls:r,marks:ts,onClick:tx})))}),cu={track:{height:8,background:"#03fccf"},handle:{width:20,height:20,marginTop:-6,borderColor:"#03fccf",background:"rgb(5, 69, 76)",opacity:1},rail:{height:8,border:"1px solid #555",background:"rgba(255, 255, 255, 0.3)"}};function cd(t){return(0,J.jsx)(cc,{...t,styles:{...cu,...t.styles}})}let cf=t.i(29947).default,{materials:cg}=cf;function cp(){var t;let e=(0,Z.useRef)(null),r=(0,Z.useRef)(null),[i,n]=(0,Z.useState)("vl2"),{activeCanvas:s,backgroundColor:a,setBackgroundColor:o,selectedObjects:l,lockedObjects:h,lockSelection:c,unlockSelection:u,bringForward:d,sendBackward:f,duplicate:g,deleteSelection:p,undo:m,redo:y,canUndo:x,canRedo:b,copyToMetallic:_,brushColor:w,setBrushColor:C,brushSize:S,setBrushSize:T,hueRotate:O,setHueRotate:k,saturation:M,setSaturation:E,brightness:D,setBrightness:j,contrast:A,setContrast:P,opacity:F,setOpacity:L,layerMode:R,setLayerMode:I,activeCanvasType:B,addImages:N,exportSkin:W,selectedExportMaterials:U,setSelectedExportMaterials:H}=a1(),{actualModel:X}=hz(),V=cg[X],{canvas:z,isDrawingMode:Y,setDrawingMode:G}=a$(s),[q,K]=(0,Z.useState)(!1),Q=q?"⌘":"Ctrl ",[$,tt]=(0,Z.useState)(!1),{refs:te,floatingStyles:tr,context:ti}=hO({open:$,onOpenChange:tt,placement:"bottom-end",middleware:[li(),lr(10)],whileElementsMounted:o3}),tn=h_(ti),ts=hT(ti),ta=hD(ti);(0,Z.useEffect)(()=>{$&&G(!0)},[$,G]);let{getReferenceProps:to,getFloatingProps:tl}=hM([tn,ts,ta]),[th,tc]=(0,Z.useState)(!1),{refs:tu,floatingStyles:td,context:tf}=hO({open:th,onOpenChange:tc,placement:"bottom-end",middleware:[li(),lr(10)],whileElementsMounted:o3}),tg=h_(tf),{getReferenceProps:tp,getFloatingProps:tm}=hM([tg,hT(tf),hD(tf)]),[tv,ty]=(0,Z.useState)(!1),{refs:tx,floatingStyles:tb,context:t_}=hO({open:tv,onOpenChange:ty,placement:"bottom-end",middleware:[li(),lr(10)],whileElementsMounted:o3}),tw=h_(t_),{getReferenceProps:tC,getFloatingProps:tS}=hM([tw,hT(t_),hD(t_)]),tT=!!l.length&&l.every(t=>h.has(t)),tO=l.length>0,tk=l.filter(t=>t instanceof at).length>0,tM=t=>{o(t.target.value)};return(0,Z.useEffect)(()=>{try{let t=localStorage.getItem("exportFileType");switch(t){case"vl2":case"png":n(t)}}catch(t){}},[]),(0,Z.useEffect)(()=>{navigator.platform&&navigator.platform.startsWith("Mac")?K(!0):navigator.userAgent.match(/\(Macintosh;/)&&K(!0)},[]),(0,J.jsxs)("div",{className:"CanvasTools",children:[(0,J.jsxs)("div",{className:"CanvasBackgroundColor",children:[(0,J.jsx)("input",{className:"ColorSwatch",type:"radio",name:"backgroundColor",id:"canvasBackgroundColorBlack",value:"black",checked:"black"===a,onChange:tM}),(0,J.jsx)("label",{htmlFor:"canvasBackgroundColorBlack",children:(0,J.jsx)("span",{className:"HiddenLabel",children:"Black"})}),(0,J.jsx)("input",{className:"ColorSwatch",type:"radio",name:"backgroundColor",id:"canvasBackgroundColorMagenta",value:"magenta",checked:"magenta"===a,onChange:tM}),(0,J.jsx)("label",{htmlFor:"canvasBackgroundColorMagenta",children:(0,J.jsx)("span",{className:"HiddenLabel",children:"Magenta"})}),(0,J.jsx)("input",{className:"ColorSwatch",type:"radio",name:"backgroundColor",id:"canvasBackgroundColorWhite",value:"white",checked:"white"===a,onChange:tM}),(0,J.jsx)("label",{htmlFor:"canvasBackgroundColorWhite",children:(0,J.jsx)("span",{className:"HiddenLabel",children:"White"})})]}),(0,J.jsxs)("div",{className:"Buttons",children:["metallic"===B?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"ButtonGroup",children:[(0,J.jsx)("button",{className:"ButtonGroup",type:"button","data-active":Y?void 0:"","aria-label":"Select Mode",title:"Select Mode (S)",onClick:()=>{G(!1)},children:(0,J.jsx)(hL,{})}),(0,J.jsx)("button",{className:"ButtonGroup",type:"button","data-active":Y?"":void 0,"aria-label":"Paint Mode",title:"Paint Mode (P)",ref:te.setReference,...to(),children:(0,J.jsx)(hR,{})})]}),$?(0,J.jsx)(hx,{context:ti,modal:!1,children:(0,J.jsx)("div",{className:"BrushToolsPopup",ref:te.setFloating,style:tr,...tl(),children:(0,J.jsxs)("div",{className:"Fields",children:[(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsx)("label",{children:"Metallic Amount"}),(0,J.jsx)("div",{className:"SliderContainer",children:(0,J.jsx)(cd,{min:0,max:255,value:w,onChange:t=>{Array.isArray(t)&&(t=t[0]),C(t)},styles:{track:{display:"none"},handle:{width:20,height:20,marginTop:-6,borderColor:"rgb(20, 105, 241)",background:"rgb(".concat(w,", ").concat(w,", ").concat(w,")"),opacity:1},rail:{height:8,border:"1px solid #555",background:"linear-gradient(to right, black 0%, white 100%)"}}})})]}),(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsx)("label",{children:"Brush Size"}),(0,J.jsx)("div",{className:"SliderContainer",children:(0,J.jsx)(cd,{min:1,max:50,value:S,onChange:t=>{Array.isArray(t)&&(t=t[0]),T(t)}})})]})]})})}):null]}):null,(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("input",{ref:r,onChange:async t=>{N([await new Promise((e,r)=>{var i;let n=null==(i=t.target.files)?void 0:i[0];if(n){let t=new FileReader;t.addEventListener("load",t=>{var r;e(null==(r=t.target)?void 0:r.result)}),t.readAsDataURL(n)}else r(Error("No input file provided."))})])},type:"file",accept:".png, image/png",hidden:!0}),(0,J.jsx)("button",{type:"button","aria-label":"Add Image",title:"Add Image",onClick:()=>{r.current&&r.current.click()},children:(0,J.jsx)(hX,{style:{fontSize:14}})}),(0,J.jsx)("button",{type:"button","data-active":th?"":void 0,"aria-label":"Filters",title:"Filters",disabled:tO&&!tk,ref:tu.setReference,...tp(),children:(0,J.jsx)(hU,{})}),th?(0,J.jsx)(hx,{context:tf,modal:!1,children:(0,J.jsx)("div",{className:"BrushToolsPopup",ref:tu.setFloating,style:td,...tm(),children:(0,J.jsxs)("div",{className:"Fields",children:[(0,J.jsxs)("div",{className:"Field ApplyTo",children:[(0,J.jsx)("label",{children:"Layer:"}),(0,J.jsx)("ul",{children:l.length?(0,J.jsxs)("li",{children:[(0,J.jsx)("input",{type:"radio",name:"FilterLayer",value:"SelectedLayer",id:"FilterLayer-SelectedLayer",checked:"SelectedLayer"===R,onChange:()=>{I("SelectedLayer")}}),(0,J.jsxs)("label",{htmlFor:"FilterLayer-SelectedLayer",children:["selected (",l.length.toLocaleString(),")"]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("li",{children:[(0,J.jsx)("input",{type:"radio",name:"FilterLayer",value:"BaseLayer",id:"FilterLayer-BaseLayer",checked:"BaseLayer"===R,onChange:()=>{I("BaseLayer")}})," ",(0,J.jsx)("label",{htmlFor:"FilterLayer-BaseLayer",children:"base"})]}),(0,J.jsxs)("li",{children:[(0,J.jsx)("input",{type:"radio",name:"FilterLayer",value:"AllLayers",id:"FilterLayer-AllLayers",checked:"AllLayers"===R,onChange:()=>{I("AllLayers")}}),(0,J.jsxs)("label",{htmlFor:"FilterLayer-AllLayers",children:["all (",null!=(t=null==z?void 0:z._objects.filter(t=>t instanceof at).length.toLocaleString())?t:0,")"]})]})]})})]}),"color"===B?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsxs)("label",{children:["Hue:"," ",(0,J.jsx)("strong",{children:null==O?"MULTIPLE VALUES":(0,J.jsxs)(J.Fragment,{children:[Math.round(180*O),"°"]})})]}),(0,J.jsx)("div",{className:"SliderContainer",children:(0,J.jsx)(cd,{min:-180,max:180,startPoint:0,value:Math.round((null!=O?O:0)*180),onChange:t=>{Array.isArray(t)&&(t=t[0]),k(t/180)}})})]}),(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsxs)("label",{children:["Saturation:"," ",(0,J.jsx)("strong",{children:null==M?"MULTIPLE VALUES":"".concat(Math.round(100*M+100),"%")})]}),(0,J.jsx)("div",{className:"SliderContainer",children:(0,J.jsx)(cd,{min:-100,max:100,startPoint:0,value:Math.round((null!=M?M:0)*100),onChange:t=>{Array.isArray(t)&&(t=t[0]),E(t/100)}})})]})]}):null,(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsxs)("label",{children:["Brightness:"," ",(0,J.jsx)("strong",{children:null==D?"MULTIPLE VALUES":"".concat(Math.round(100*D+100),"%")})]}),(0,J.jsx)("div",{className:"SliderContainer",children:(0,J.jsx)(cd,{min:-100,max:100,startPoint:0,value:Math.round((null!=D?D:0)*100),onChange:t=>{Array.isArray(t)&&(t=t[0]),j(t/100)}})})]}),(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsxs)("label",{children:["Contrast:"," ",(0,J.jsx)("strong",{children:null==A?"MULTIPLE VALUES":"".concat(Math.round(100*A+100),"%")})]}),(0,J.jsx)("div",{className:"SliderContainer",children:(0,J.jsx)(cd,{min:-100,max:100,startPoint:0,value:Math.round((null!=A?A:0)*100),onChange:t=>{Array.isArray(t)&&(t=t[0]),P(t/100)}})})]}),(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsxs)("label",{children:["Opacity:"," ",(0,J.jsx)("strong",{children:null==F?"MULTIPLE VALUES":"".concat(Math.round((null!=F?F:1)*100),"%")})]}),(0,J.jsx)("div",{className:"SliderContainer",children:(0,J.jsx)(cd,{min:0,max:100,startPoint:0,value:Math.round((null!=F?F:1)*100),onChange:t=>{Array.isArray(t)&&(t=t[0]),L(t/100)}})})]})]})})}):null,(0,J.jsx)("button",{type:"button","aria-label":tT?"Unlock":"Lock",title:tT?"Unlock (L)":"Lock (L)",onClick:tT?u:c,"data-locked":tT?"":void 0,disabled:!tO,children:tT?(0,J.jsx)(hF.FaUnlock,{style:{fontSize:14}}):(0,J.jsx)(hF.FaLock,{style:{fontSize:14}})}),(0,J.jsxs)("div",{className:"ButtonGroup",children:[(0,J.jsx)("button",{type:"button","aria-label":"Bring Forward",title:"Bring Forward (F)",onClick:d,disabled:!tO,children:(0,J.jsx)(hF.FaArrowUp,{})}),(0,J.jsx)("button",{type:"button","aria-label":"Send Backward",title:"Send Backward (B)",onClick:f,disabled:!tO,children:(0,J.jsx)(hF.FaArrowDown,{})})]}),(0,J.jsx)("button",{type:"button","aria-label":"Duplicate",title:"Duplicate (D)",onClick:g,disabled:!tO,children:(0,J.jsx)(hA,{})}),(0,J.jsx)("button",{type:"button","aria-label":"Delete",title:"Delete (Backspace)",onClick:p,disabled:tT||!tO,children:(0,J.jsx)(hF.FaTrashAlt,{})}),(0,J.jsxs)("div",{className:"ButtonGroup",children:[(0,J.jsx)("button",{type:"button","aria-label":"Undo",title:"Undo (".concat(Q,"Z)"),onClick:m,disabled:!x,children:(0,J.jsx)(hN,{})}),(0,J.jsx)("button",{type:"button","aria-label":"Redo",title:"Redo (".concat(q?"".concat("⇧").concat(Q,"Z)"):"".concat(Q," Y"),")"),onClick:y,disabled:!b,children:(0,J.jsx)(hW,{})})]}),"color"===B?(0,J.jsxs)("button",{type:"button",className:"MetallicButton","aria-label":"Copy to Metallic",title:"Copy to Metallic",onClick:_,children:[(0,J.jsx)(hP,{})," ",(0,J.jsx)("span",{className:"ButtonLabel",children:"Metal"})]}):null]})]}),(0,J.jsxs)("div",{className:"Export",children:[(0,J.jsx)("input",{ref:e,type:"text",name:"CustomSkinName",placeholder:"Skin Name",size:12}),(0,J.jsxs)("button",{className:"ExportOptionsButton",type:"button","data-active":tv?"":void 0,"aria-label":"Export Options",title:"Export Options",ref:tx.setReference,...tC(),children:[".",i,(0,J.jsx)(hF.FaAngleDown,{})]}),tv?(0,J.jsx)(hx,{context:t_,modal:!1,children:(0,J.jsx)("div",{className:"ExportOptionsPopup",ref:tx.setFloating,style:tb,...tS(),children:(0,J.jsxs)("div",{className:"Fields",children:[(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsx)("label",{children:"Export Materials"}),(0,J.jsx)("ul",{className:"ExportOptionsList",children:V.map((t,e)=>t&&!1!==t.selectable&&!t.hidden?(0,J.jsxs)("li",{children:[(0,J.jsx)("input",{id:"MaterialSelect-".concat(t.name),type:"checkbox",checked:!1!==U[e],onChange:t=>{H(r=>{let i=r.slice();return i[e]=t.target.checked,i})}}),(0,J.jsx)("label",{htmlFor:"MaterialSelect-".concat(t.name),children:t.label})]},t.name):null)})]}),(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsx)("label",{htmlFor:"ExportFormat",children:"Export Format"}),(0,J.jsxs)("select",{id:"ExportFormat",value:i,onChange:t=>{n(t.target.value);try{localStorage.setItem("exportFileType",t.target.value)}catch(t){}},children:[(0,J.jsx)("option",{value:"png",children:".png"}),(0,J.jsx)("option",{value:"vl2",children:".vl2"})]})]})]})})}):null,(0,J.jsx)("button",{type:"button",onClick:()=>{W({name:e.current?e.current.value:"",format:i})},children:"Export"})]})]})}function cm(){return(0,J.jsxs)("footer",{className:"AppFooter",children:[(0,J.jsx)("a",{href:"https://github.com/exogen/t2-model-skinner",className:"IconLink",children:(0,J.jsx)(hF.FaGithub,{size:24})}),(0,J.jsxs)("div",{className:"Sponsor",children:[(0,J.jsx)("a",{href:"https://github.com/sponsors/exogen",target:"_blank",rel:"noreferrer",children:"Support this project"})," ",(0,J.jsx)("span",{className:"Separator",children:"or"})," ",(0,J.jsx)("a",{href:"https://www.buymeacoffee.com/mosswood",target:"_blank",rel:"noreferrer",children:(0,J.jsx)("img",{src:"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png",alt:"Buy Me A Coffee",width:109,height:31})})]})]})}async function cv(t){return await at.fromURL(t,{crossOrigin:"anonymous"})}var cy=t.i(55519);function cx(){let e=(0,Z.useRef)(null),r=(0,Z.useRef)(null),i=(0,Z.useMemo)(()=>({async combineColorAndAlphaImageUrls(){for(var t=arguments.length,e=Array(t),i=0;i{let i=new Worker(t.r(79702)),n=cy.wrap(i);return e.current=i,r.current=n,()=>{n[cy.releaseProxy](),r.current=null,i.terminate()}},[]),i}function cb(){return{canvasPadding:64,basePath:"/t2-model-skinner"}}var c_=t.i(54826);let{materials:cw}=cf,cC=[512,512];function cS(e){var r,i;let{children:n}=e,{actualModel:s,selectedModelType:a}=hz(),[o,l]=(0,Z.useState)(0),[h,c]=(0,Z.useState)(0),[u,d]=(0,Z.useState)(1),f=cw[s],g=null!=(r=f[o])?r:null,p=null!=(i=g.frameCount)?i:1,m=p>1,[y,x]=(0,Z.useState)([]),b=(0,Z.useMemo)(()=>{var t;let[e,r]=null!=(t=g.size)?t:cC;return[e*u,r*u]},[g.size,u]),_=0!==g.metallicFactor||1!==g.roughnessFactor,[w,C]=(0,Z.useState)("color");_||"metallic"!==w||C("color"),h>=p&&c(0),(0,Z.useEffect)(()=>{try{let t=localStorage.getItem("sizeMultiplier");switch(t){case"1":case"2":case"4":d(+t)}}catch(t){}},[]),(0,Z.useEffect)(()=>{x(f.map(t=>!!(t&&!1!==t.selectable&&!t.hidden)))},[f]),(0,Z.useEffect)(()=>{c(0)},[g]);let[S,T]=(0,Z.useState)("black"),[O,k]=(0,Z.useState)(()=>new Set),[M,E]=(0,Z.useState)(200),[D,j]=(0,Z.useState)(10),[A,P]=(0,Z.useState)(()=>new Map),[F,L]=(0,Z.useState)(()=>[]),R=g?"".concat(g.name,":").concat(w,":").concat(h,":").concat(u):null,I=g?"".concat(g.name,":metallic:").concat(h,":").concat(u):null,{canvases:B}=a$(),{canvas:N,notifyChange:W,undo:U,redo:H,canUndo:X,canRedo:V}=a$(R),{canvas:z,setDrawingMode:Y}=a$(I),{combineColorAndAlphaImageUrls:G}=cx(),{canvasPadding:q}=cb(),[K,Q]=(0,Z.useState)(()=>[]),[$,tt]=(0,Z.useState)("BaseLayer");F.length?"SelectedLayer"!==$&&tt("SelectedLayer"):"SelectedLayer"===$&&tt("BaseLayer");let te=(0,Z.useCallback)((t,e)=>{var r,i,n;let s=[],a=new Map(A),o=F;for(let l of("AllLayers"===$?o=null!=(r=null==N?void 0:N._objects)?r:[]:"BaseLayer"===$&&(o=null!=(i=null==N?void 0:N._objects.slice(0,1))?i:[]),o))if(l instanceof at){let r={...null!=(n=A.get(l))?n:{},[t]:e};a.set(l,r),s.push([l,r])}P(a),Q(s)},[N,$,A,F]),tr=t=>{var e,r;let i=+("Opacity"===t),n=F;if("AllLayers"===$?n=null!=(e=null==N?void 0:N._objects)?e:[]:"BaseLayer"===$&&(n=null!=(r=null==N?void 0:N._objects.slice(0,1))?r:[]),!(n=n.filter(t=>t instanceof at)).length)return[i,e=>te(t,e)];{let e=e=>{var r,s;return null!=(s=(null!=(r=A.get(n[e]))?r:{})[t])?s:i},r=e(0);return n.slice(1).every((t,i)=>e(i+1)===r)?[r,e=>te(t,e)]:[null,e=>te(t,e)]}},[ti,tn]=tr("HueRotation"),[ts,ta]=tr("Saturation"),[to,tl]=tr("Brightness"),[th,tc]=tr("Contrast"),[tu,td]=tr("Opacity");(0,Z.useEffect)(()=>{if(K.length){for(let[t,e]of K)if(t instanceof at){if(t.filters=[],"metallic"===w){let e=new aJ.Grayscale;t.filters.push(e)}for(let r in e){let i=e[r];if(null!=i)switch(r){case"HueRotation":t.filters.push(new aJ.HueRotation({rotation:i}));break;case"Saturation":t.filters.push(new aJ.Saturation({saturation:i}));break;case"Brightness":t.filters.push(new aJ.Brightness({brightness:i}));break;case"Contrast":t.filters.push(new aJ.Contrast({contrast:i}));break;case"Opacity":t.opacity=i}}t.applyFilters()}Q([]),W&&W()}},[K,w,W]);let tf=(0,Z.useCallback)(()=>{F.length&&k(t=>{let e=new Set(t);for(let t of F)e.add(t),t.lockMovementX=!0,t.lockMovementY=!0,t.lockScalingX=!0,t.lockScalingY=!0,t.lockRotation=!0;return e})},[F]),tg=(0,Z.useCallback)(()=>{F.length&&k(t=>{let e=new Set(t);for(let t of F)e.delete(t),t.lockMovementX=!1,t.lockMovementY=!1,t.lockScalingX=!1,t.lockScalingY=!1,t.lockRotation=!1;return e})},[F]),tp=(0,Z.useCallback)(async()=>{let t=N.getActiveObject();t&&(N.bringObjectForward(t,!0),W())},[N,W]),tm=(0,Z.useCallback)(async()=>{let t=N.getActiveObject();if(t){if(N._objects[0]===t||N._objects[1]===t)return;N.sendObjectBackwards(t,!0),W()}},[N,W]),tv=(0,Z.useCallback)(async t=>{let e;for(let r of t){let t=await cv(r);if(!t.width||!t.height)throw Error("Zero-height image");let i=t.width/b[0],n=t.height/b[1];if(i>1||n>1){let e;t.scaleX=e=i>n?1/i:1/n,t.scaleY=e}if("metallic"===w){t.filters||(t.filters=[]);let e=new aJ.Grayscale;t.filters.push(e),t.applyFilters()}z&&Y(!1),N.centerObject(t),N.add(t),e=t}e&&(N.setActiveObject(e),N.requestRenderAll())},[b,w,z,N,Y]),ty=(0,Z.useCallback)(async()=>{let t=N.getActiveObject();if(t){var e,r;let i=await t.clone();i.set({top:(null!=(e=i.top)?e:0)+20,left:(null!=(r=i.left)?r:0)+20,evented:!0}),"activeSelection"===i.type&&(i.canvas=N,i.forEachObject(t=>{N.add(t)}),i.setCoords()),N.discardActiveObject(),N.add(i),N.setActiveObject(i)}},[N]),tx=(0,Z.useCallback)(async()=>{let t=N.getActiveObjects();N.discardActiveObject(),N.remove(...t),N.requestRenderAll()},[N]),tb=(0,Z.useCallback)(async()=>{if("color"===w&&z){let t=N.toDataURL({format:"png",multiplier:1,top:q,left:q,width:b[0],height:b[1]}),e=await cv(t);e.filters||(e.filters=[]);let r=new aJ.Grayscale;e.filters.push(r),e.applyFilters(),z.centerObject(e),z.add(e),z.setActiveObject(e),Y(!1),C("metallic")}},[z,N,w,q,Y,b]),t_=(0,Z.useCallback)(async e=>{let{format:r,name:i=""}=e,{savePngFile:n,saveZipFile:o,createZipFile:l}=await t.A(91135);i=i.trim()||"MyCustomSkin";let h=await Promise.all(f.filter((t,e)=>!1!==y[e]).map(t=>{var e;let r=null!=(e=t.frameCount)?e:1;return Array(r).fill(null).map(async(e,n)=>{var o,l,h,c;let d,f,g=null==(o=B["".concat(t.name,":color:").concat(n,":").concat(u)])?void 0:o.canvas,p=null==(l=B["".concat(t.name,":metallic:").concat(n,":").concat(u)])?void 0:l.canvas,m=null!=(h=t.size)?h:cC,y=[m[0]*u,m[1]*u],x=g.toDataURL({format:"png",multiplier:1,top:q,left:q,width:y[0],height:y[1]});if(p){let t=p.toDataURL({format:"png",multiplier:1,top:q,left:q,width:y[0],height:y[1]});d=await G({colorImageUrl:x,metallicImageUrl:t})}else d=x;switch(a){case"player":f="".concat(i,".").concat(s,".png");break;case"weapon":case"vehicle":if(t){let e=null!=(c=t.file)?c:t.name;if(r>1){let t=e.match(/^(.+)(\d\d)$/);if(t){let e=t[1];f="".concat(e).concat(n.toString().padStart(2,"0"),".png")}else throw Error("Unexpected animation filename")}else f="".concat(e,".png")}else f="weapon"===a?"weapon_".concat(s,".png"):"".concat(s,".png");break;default:throw Error("Unknown model type")}return{imageUrl:d,filename:f}})}).flat());switch(r){case"png":h.forEach(t=>{let{imageUrl:e,filename:r}=t;n(e,r)});break;case"vl2":{let t=l(await Promise.all(h.map(async t=>({data:await (0,c_.imageUrlToArrayBuffer)(t.imageUrl),name:t.filename})))),e=s.replace(/(?:^([a-z])|_([a-z]))/g,(t,e,r)=>(e||r).toUpperCase()),r="",n=u>1?"-@".concat(u,"x"):"";switch(a){case"player":r="zPlayerSkin-".concat(i).concat(n,".vl2");break;case"weapon":r="zWeapon".concat(e,"-").concat(i).concat(n,".vl2");break;case"vehicle":r="z".concat(e,"-").concat(i).concat(n,".vl2")}await o(t,r)}}},[f,y,B,u,q,a,G,s]),tw=(0,Z.useMemo)(()=>({activeCanvas:R,activeCanvasType:w,setActiveCanvasType:C,backgroundColor:S,setBackgroundColor:T,lockedObjects:O,setLockedObjects:k,brushColor:M,setBrushColor:E,brushSize:D,setBrushSize:j,hueRotate:ti,setHueRotate:tn,saturation:ts,setSaturation:ta,brightness:to,setBrightness:tl,contrast:th,setContrast:tc,opacity:tu,setOpacity:td,layerMode:$,setLayerMode:tt,selectedObjects:F,lockSelection:tf,unlockSelection:tg,bringForward:tp,sendBackward:tm,addImages:tv,duplicate:ty,deleteSelection:tx,undo:U,redo:H,canUndo:X,canRedo:V,copyToMetallic:tb,exportSkin:t_,selectedMaterialIndex:o,setSelectedMaterialIndex:l,textureSize:b,hasMetallic:_,selectedFrameIndex:h,setSelectedFrameIndex:c,hasAnimation:m,frameCount:p,sizeMultiplier:u,setSizeMultiplier:d,selectedExportMaterials:y,setSelectedExportMaterials:x}),[R,w,S,O,M,D,ti,tn,ts,ta,to,tl,th,tc,tu,td,$,F,tf,tg,tp,tm,tv,ty,tx,U,H,X,V,tb,t_,o,b,_,h,m,p,u,y]);return(0,Z.useEffect)(()=>{if(N){let t=()=>{L(N.getActiveObjects())};return N.on("selection:cleared",t),N.on("selection:updated",t),N.on("selection:created",t),t(),()=>{N.off("selection:cleared",t),N.off("selection:updated",t),N.off("selection:created",t)}}},[N]),(0,Z.useEffect)(()=>{z&&(z.freeDrawingBrush||(z.freeDrawingBrush=new sb(z)),z.freeDrawingBrush.width=D)},[z,D]),(0,Z.useEffect)(()=>{z&&(z.freeDrawingBrush||(z.freeDrawingBrush=new sb(z)),z.freeDrawingBrush.color="rgb(".concat(M,", ").concat(M,", ").concat(M,")"))},[z,M]),(0,J.jsx)(a0.Provider,{value:tw,children:n})}function cT(){let{backgroundColor:t,textureSize:e}=a1(),{canvasPadding:r}=cb();return e?(0,J.jsx)("div",{className:"CanvasBackdrop",style:{backgroundColor:t,top:r,width:e[0],height:e[1]}}):null}function cO(t){let{children:e}=t,[r,i]=(0,Z.useState)({}),n=(0,Z.useCallback)((t,e)=>{i(r=>({...r,[t]:e}))},[]),s=(0,Z.useCallback)(t=>{i(e=>{let{[t]:r,...i}=e;return i})},[]),a=(0,Z.useMemo)(()=>({canvases:r,registerCanvas:n,unregisterCanvas:s}),[r,n,s]);return(0,J.jsx)(aZ.Provider,{value:a,children:e})}function ck(t){let{children:e}=t,r=(0,Z.useRef)(null),{activeCanvas:i,activeCanvasType:n,bringForward:s,sendBackward:a,duplicate:o,deleteSelection:l,addImages:h,undo:c,redo:u}=a1(),{canvas:d,notifyChange:f,setDrawingMode:g}=a$(i),p=async function(){let{top:t=0,left:e=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(let n of d.getActiveObjects()){var r,i;n.top=(null!=(r=n.top)?r:0)+t,n.left=(null!=(i=n.left)?i:0)+e,n.setCoords()}f()};return(0,J.jsx)("div",{className:"CanvasInteractions",tabIndex:0,ref:r,onDragOver:t=>{t.preventDefault()},onDrop:async t=>{t.preventDefault(),r.current&&r.current.focus();let{items:e}=t.dataTransfer,i=Array.from(e).filter(t=>"file"===t.kind&&t.type.match(/^image\//)),n=await Promise.all(i.map(async t=>{let e=t.getAsFile();if(!e)throw Error("Not a file.");let r=new FileReader;return await new Promise((t,i)=>{r.onload=async e=>{e.target&&"string"==typeof e.target.result?t(e.target.result):i(Error("Failed to load image data."))},r.readAsDataURL(e)})}).filter(Boolean));await h(n)},onKeyDown:async t=>{let e=t.target;if("INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName){if(t.ctrlKey||t.metaKey)switch(t.key){case"z":if(t.altKey)return;if(t.shiftKey){t.preventDefault(),u();return}t.preventDefault(),c();return;case"y":if(t.altKey||t.shiftKey)return;t.preventDefault(),u();return}if(!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey)switch(t.key){case"Backspace":case"Delete":t.preventDefault(),await l();break;case"ArrowLeft":t.preventDefault(),await p({left:-1});break;case"ArrowRight":t.preventDefault(),await p({left:1});break;case"ArrowUp":t.preventDefault(),await p({top:-1});break;case"ArrowDown":t.preventDefault(),await p({top:1});break;case"d":t.preventDefault(),await o();break;case"f":t.preventDefault(),await s();break;case"b":t.preventDefault(),await a();break;case"p":"metallic"===n&&(t.preventDefault(),g(!0));break;case"s":"metallic"===n&&(t.preventDefault(),g(!1))}}},children:e})}function cM(){let{activeCanvasType:t,setActiveCanvasType:e,hasMetallic:r,hasAnimation:i,frameCount:n,selectedFrameIndex:s,setSelectedFrameIndex:a,sizeMultiplier:o,setSizeMultiplier:l}=a1();return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"CanvasToggle",children:[(0,J.jsx)("button",{type:"button","data-selected":"color"===t?"":void 0,onClick:()=>{e("color")},children:"Color"}),r?(0,J.jsx)("button",{type:"button","data-selected":"metallic"===t?"":void 0,onClick:()=>{e("metallic")},children:"Metallic"}):null]}),(0,J.jsxs)("div",{className:"CanvasToggle",style:{display:"none"},children:[(0,J.jsx)("button",{type:"button","data-selected":1===o?"":void 0,onClick:()=>{l(1)},children:"1×"}),(0,J.jsx)("button",{type:"button","data-selected":2===o?"":void 0,onClick:()=>{l(2)},children:"2×"}),(0,J.jsx)("button",{type:"button","data-selected":4===o?"":void 0,onClick:()=>{l(4)},children:"4×"})]}),i?(0,J.jsxs)("div",{className:"FrameSelector",children:[(0,J.jsx)("button",{type:"button",onClick:()=>{a(t=>(n+t-1)%n)},children:(0,J.jsx)(hF.FaChevronLeft,{})}),(0,J.jsxs)("span",{className:"FrameInfo",children:[s+1," / ",n]}),(0,J.jsx)("button",{type:"button",onClick:()=>{a(t=>(t+1)%n)},children:(0,J.jsx)(hF.FaChevronRight,{})})]}):null]})}function cE(t){return(0,hj.GenIcon)({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M1 2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zM1 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zM1 12a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1z"},child:[]}]})(t)}var cD=t.i(71315);let cj=cf.materials,cA=/^(\.|__MACOSX)/;async function cP(t){let e=await cD.default.loadAsync(t);return(await Promise.all(Object.entries(e.files).map(async t=>{let[e,r]=t;if(!cA.test(e)&&/\.png$/i.exec(e)){let t=await r.async("base64");return{path:e,imageUrl:"data:image/png;base64,".concat(t)}}}))).filter(t=>!!t)}async function cF(t){return new Promise((e,r)=>{let i=new FileReader;i.addEventListener("load",t=>{var i;"string"==typeof(null==(i=t.target)?void 0:i.result)?e(t.target.result):r()}),i.addEventListener("error",t=>{r()}),i.readAsDataURL(t)})}async function cL(t){return(await Promise.all(Array.from(t).map(async t=>{var e;if(cA.test(t.name))return null;switch((e=t).name.match(/\.png$/i)?"png":e.name.match(/\.zip$/i)?"zip":e.name.match(/\.vl2$/i)?"vl2":void 0){case"zip":case"vl2":{let e=t.name.match(/^(.+)\.(zip|vl2)$/i),r=e?e[1]:t.name;return(await cP(t)).map(e=>({...e,path:"".concat(t.name,"/").concat(e.path),name:r}))}case"png":return{path:t.name,imageUrl:await cF(t),name:null};default:return null}}))).flat().filter(t=>!!t)}async function cR(t){var e=await cL(t);let r=new Map;return e.forEach(t=>{let e=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;s||(s=function(){let t=new Map;for(let e in cj)cj[e].forEach((r,i)=>{let n;if(r.fileSuffix?n=r.fileSuffix:!1!==r.selectable&&!0!==r.hidden&&(r.file||r.name)&&(n=r.file||r.name),n){var s;let a=null!=(s=t.get(n))?s:[];a.push({modelName:e,material:r,index:i}),t.set(n,a)}});return t}());let r=t.split("/").slice(-1)[0],i=r.match(/^(.+)\.(PNG|png)$/);if(i){let n=i[1],a=n.split(".");if(a.length>1){let e=".".concat(a[a.length-1]),o=s.get(e);if(o)return{path:t,basename:r,nameWithoutExtension:n,extension:i[2],skinName:a.slice(0,a.length-1).join("."),models:o}}else{let o=function(t){let e=/^(.+[^\d])(\d{2,})$/.exec(t);if(e){var r;let t=e[1],i=e[2],n=parseInt(i,10),a="".concat(t).concat("0".padStart(i.length,"0"));return(null!=(r=s.get(a))?r:[]).filter(t=>"number"==typeof t.material.frameCount).map(t=>({...t,frameIndex:n}))}return[]}(a[0]);if(o.length)return{path:t,basename:r,nameWithoutExtension:n,extension:i[2],skinName:e,models:o};{let o=s.get(a[0]);if(o)return{path:t,basename:r,nameWithoutExtension:n,extension:i[2],skinName:e,models:o}}}}return null}(t.path,t.name);e&&e.models.forEach(i=>{var n,s,a,o,l;let h=null!=(n=r.get(i.modelName))?n:new Map,c=null!=(s=h.get(e.skinName))?s:{name:e.skinName,isComplete:null,materials:new Map},u=null!=(a=i.material.file)?a:i.material.name,d=null!=(o=c.materials.get(u))?o:[];d[null!=(l=i.frameIndex)?l:0]=t.imageUrl,c.materials.set(u,d),h.set(e.skinName,c),r.set(i.modelName,h)})}),r.forEach((t,e)=>{let r=cj[e].filter(t=>!1!==t.selectable&&!0!==t.hidden&&!0!==t.optional);t.forEach(t=>{t.isComplete=r.every(e=>{var r;return t.materials.has(null!=(r=e.file)?r:e.name)})})}),r}var cI=t.i(15768);let{defaultSkins:cB,modelDefaults:cN}=cf,cW={},cU=new Map;function cH(){var t,e,r,i,n,s;let{selectedModel:a,setSelectedModel:o,selectedModelType:l,setSelectedModelType:h,selectedSkin:c,setSelectedSkin:u,setSelectedSkinType:d,actualModel:f,setSelectedAnimation:g,setAnimationPaused:p,importedSkins:m,addImportedSkins:y}=hz(),{setSelectedMaterialIndex:x}=a1(),[b,_]=(0,Z.useState)(cW),[w,C]=(0,Z.useState)(cW),[S,T]=(0,Z.useState)(null),O=(0,Z.useRef)(null),[k,M]=(0,cI.default)(),E=Array.from((null!=(s=m.get(f))?s:cU).values()).filter(t=>t.isComplete);M&&(b!==k.customSkins||w!==k.newSkins)&&(_(k.customSkins),C(k.newSkins));let D=null!=c?c:"";return c&&S&&(D="".concat(S,"/").concat(c)),(0,J.jsxs)("div",{className:"Toolbar",children:[(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsx)("label",{htmlFor:"ModelSelect",children:"Model"}),(0,J.jsxs)("select",{id:"ModelSelect",value:a,onChange:t=>{var e,r,i,n;let s=t.target.selectedOptions[0].parentNode,a=t.target.value,l="hfemale"===a?"hmale":a,{modelType:f}=s.dataset;if(!f)throw Error("No data-model-type found");let m=c&&((null==(e=cB[l])?void 0:e.includes(c))||(null==(r=b[l])?void 0:r.includes(c)))||!1,y=!1;c&&"new"===S&&m&&(y=null==(i=w[l])?void 0:i.includes(c)),g(null),p(!1),h(f),o(a),x(0),m||(u(null!=(n=cN[l])?n:null),d("default")),y||T(null)},children:[(0,J.jsxs)("optgroup",{label:"Players","data-model-type":"player",children:[(0,J.jsx)("option",{value:"lmale",children:"Human Male • Light"}),(0,J.jsx)("option",{value:"mmale",children:"Human Male • Medium"}),(0,J.jsx)("option",{value:"hmale",children:"Human Male • Heavy"}),(0,J.jsx)("option",{value:"lfemale",children:"Human Female • Light"}),(0,J.jsx)("option",{value:"mfemale",children:"Human Female • Medium"}),(0,J.jsx)("option",{value:"hfemale",children:"Human Female • Heavy"}),(0,J.jsx)("option",{value:"lbioderm",children:"Bioderm • Light"}),(0,J.jsx)("option",{value:"mbioderm",children:"Bioderm • Medium"}),(0,J.jsx)("option",{value:"hbioderm",children:"Bioderm • Heavy"})]}),(0,J.jsxs)("optgroup",{label:"Weapons","data-model-type":"weapon",children:[(0,J.jsx)("option",{value:"disc",children:"Disc Launcher"}),(0,J.jsx)("option",{value:"chaingun",children:"Chaingun"}),(0,J.jsx)("option",{value:"grenade_launcher",children:"Grenade Launcher"}),(0,J.jsx)("option",{value:"sniper",children:"Laser Rifle"}),(0,J.jsx)("option",{value:"plasmathrower",children:"Plasma Cannon"}),(0,J.jsx)("option",{value:"energy",children:"Blaster"}),(0,J.jsx)("option",{value:"shocklance",children:"Shocklance"}),(0,J.jsx)("option",{value:"elf",children:"ELF Projector"}),(0,J.jsx)("option",{value:"missile",children:"Missile Launcher"}),(0,J.jsx)("option",{value:"mortar",children:"Mortar"}),(0,J.jsx)("option",{value:"repair",children:"Repair Pack"}),(0,J.jsx)("option",{value:"targeting",children:"Targeting Laser"}),(0,J.jsx)("option",{value:"mine",children:"Mine"})]}),(0,J.jsxs)("optgroup",{label:"Vehicles","data-model-type":"vehicle",children:[(0,J.jsx)("option",{value:"vehicle_grav_scout",children:"Wildcat Grav Cycle"}),(0,J.jsx)("option",{value:"vehicle_grav_tank",children:"Beowulf Assault Tank"}),(0,J.jsx)("option",{value:"vehicle_land_mpbbase",children:"Jericho Mobile Point Base"}),(0,J.jsx)("option",{value:"vehicle_air_scout",children:"Shrike Scout Fighter"}),(0,J.jsx)("option",{value:"vehicle_air_bomber",children:"Thundersword Bomber"}),(0,J.jsx)("option",{value:"vehicle_air_hapc",children:"HAVOC Gunship Transport"})]})]})]}),(0,J.jsxs)("div",{className:"Field",children:[(0,J.jsx)("label",{htmlFor:"SkinSelect",children:"Skin"}),(0,J.jsxs)("div",{className:"Buttons",children:[(0,J.jsxs)("select",{id:"SkinSelect",value:D,onChange:t=>{var e,r;let i=t.target.selectedOptions[0].parentNode,n=t.target.value&&null!=(e=i.dataset.skinType)?e:null,s=t.target.value.split("/");u(null!=(r=s.slice(-1)[0])?r:null),d(n),s.length>1?T(s[0]):T(null)},children:[(0,J.jsx)("option",{value:"",children:"Select a skin…"}),"player"===l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("optgroup",{label:"Default Skins","data-skin-type":"default",children:null==(t=cB[f])?void 0:t.map(t=>(0,J.jsx)("option",{value:t,children:t},t))}),E.length?(0,J.jsx)("optgroup",{label:"Imported Skins","data-skin-type":"import",children:E.map(t=>{var e,r;return(0,J.jsx)("option",{value:"import/".concat(null!=(e=t.name)?e:"__untitled__"),children:t.name||"Untitled Imported Skin"},"import/".concat(null!=(r=t.name)?r:"__untitled__"))})}):null,(null==(e=w[f])?void 0:e.length)?(0,J.jsx)("optgroup",{label:"New Skins ✨","data-skin-type":"custom",children:null==(r=w[f])?void 0:r.map(t=>(0,J.jsxs)("option",{value:"new/".concat(t),children:[t," ✨"]},"new/".concat(t)))}):null,(0,J.jsx)("optgroup",{label:"Custom Skins","data-skin-type":"custom",children:b===cW?(0,J.jsx)("option",{value:"",children:"Loading…"},"loading"):null==(i=b[f])?void 0:i.map(t=>(0,J.jsx)("option",{value:t,children:t},t))})]}):null,"weapon"===l||"vehicle"===l?(0,J.jsxs)(J.Fragment,{children:[cN[f]?(0,J.jsx)("optgroup",{label:"Default Skins","data-skin-type":"default",children:(0,J.jsx)("option",{value:cN[f],children:"Default"})}):null,E.length?(0,J.jsx)("optgroup",{label:"Imported Skins","data-skin-type":"import",children:E.map(t=>{var e,r;return(0,J.jsx)("option",{value:"import/".concat(null!=(e=t.name)?e:"__untitled__"),children:t.name||"Untitled Imported Skin"},"import/".concat(null!=(r=t.name)?r:"__untitled__"))})}):null,(null==(n=b[f])?void 0:n.length)?(0,J.jsx)("optgroup",{label:"Custom Skins","data-skin-type":"custom",children:b[f].map(t=>(0,J.jsx)("option",{value:t,children:t},t))}):null]}):null]}),(0,J.jsx)("button",{type:"button","aria-label":"Load Skin",title:"Load a Skin",onClick:()=>{O.current&&O.current.click()},children:(0,J.jsx)(hF.FaFolderOpen,{style:{fontSize:18}})}),(0,J.jsx)("input",{ref:O,onChange:async t=>{var e,r,i;let n=await cR(null!=(e=t.target.files)?e:[]);y(n);let s=n.get(f);if(s){let t=Array.from(s.values()).filter(t=>t.isComplete);if(t.length){let e=t[0];d("import"),T("import"),u(null!=(r=e.name)?r:"__untitled__"),x(0),g(null);return}}for(let[t,e]of Array.from(n.entries()))for(let r of Array.from(e.values()))if(r.isComplete){o(t),h(function(t){switch(t){case"lmale":case"mmale":case"hmale":case"lfemale":case"mfemale":case"hfemale":case"lbioderm":case"mbioderm":case"hbioderm":return"player";case"disc":case"chaingun":case"grenade_launcher":case"sniper":case"plasmathrower":case"energy":case"shocklance":case"elf":case"missile":case"mortar":case"repair":case"targeting":return"weapon";case"vehicle_grav_scout":case"vehicle_grav_tank":case"vehicle_land_mpbbase":case"vehicle_air_scout":case"vehicle_air_bomber":case"vehicle_air_hapc":return"vehicle";default:throw Error("Unknown model")}}(t)),d("import"),T("import"),u(null!=(i=r.name)?i:"__untitled__"),x(0),g(null);break}},type:"file",accept:".png, image/png, .vl2, .zip, application/zip, application/zip-compressed",multiple:!0,hidden:!0})]})]}),(0,J.jsx)("div",{className:"Field GalleryField",children:(0,J.jsxs)("a",{href:"gallery/",target:"_blank",className:"GalleryLink",title:"Open skin gallery",children:[(0,J.jsx)("span",{className:"FieldLabel",children:"Gallery"}),(0,J.jsx)(cE,{})]})})]})}var cX=t.i(18566);let{materials:cV,modelDefaults:cz,defaultSkins:cY}=cf,cG="https://exogen.github.io/t2-skins/skins",cq=new Map;function cK(t,e){if(e<2)return[t];let r=t.match(/^(.+)(\d\d)$/);if(r){let t=r[1];return Array(e).fill(null).map((e,r)=>"".concat(t).concat(r.toString().padStart(2,"0")))}throw Error("Did not match expected frame format")}function cQ(t){let{basePath:e,actualModel:r,selectedModelType:i,selectedSkin:n,selectedSkinType:s}=t,a=cV[r];if(n&&"import"===s){let t=cq.get(r);if(t){let e="__untitled__"===n?null:n,r=t.get(e);if(r&&r.isComplete)return Object.fromEntries(r.materials)}throw Error("No skin found")}switch(i){case"player":switch(s){case"default":return{base:["".concat(e,"/textures/").concat(n,".").concat(r,".png")]};case"custom":return{base:["".concat(cG,"/").concat(n,".").concat(r,".png")]}}break;case"weapon":case"vehicle":return a.reduce((t,r)=>{if(r){var i,a,o,l,h;let c=null!=(i=r.frameCount)?i:1;switch(s){case"default":!1!==r.hasDefault&&(t[null!=(a=r.file)?a:r.name]=cK(null!=(o=r.file)?o:r.name,c).map(t=>"".concat(e,"/textures/").concat(t,".png")));break;case"custom":t[null!=(l=r.file)?l:r.name]=cK(null!=(h=r.file)?h:r.name,c).map(t=>"".concat(cG,"/").concat(n,"/").concat(t,".png"))}}return t},{})}return{}}function cJ(t){var e,r;let{children:i}=t,n=(0,cX.useRouter)(),s=(0,cX.usePathname)(),a=(0,cX.useSearchParams)(),[o,l]=(0,Z.useState)(!1),[h,c]=(0,Z.useState)("lmale"),[u,d]=(0,Z.useState)("player"),[f,g]=(0,Z.useState)("Blood Eagle"),[p,m]=(0,Z.useState)("default"),[y,x]=(0,Z.useState)(null),[b,_]=(0,Z.useState)(!1),[w,C]=(0,Z.useState)(!1),{basePath:S}=cb(),T="hfemale"===h?"hmale":h,O="".concat(S,"/").concat(T).concat(y?".anim":"",".glb"),[k,M]=(0,Z.useState)(cq),E=(0,Z.useCallback)(t=>{let e=new Map(cq.entries());t.forEach((t,r)=>{var i;let n=null!=(i=e.get(r))?i:new Map;t.forEach((t,e)=>{n.set(e,t)}),e.set(r,n)}),M(cq=e)},[]),[D,j]=(0,Z.useState)(()=>cQ({basePath:S,actualModel:T,selectedModelType:u,selectedSkin:f,selectedSkinType:p})),A=(0,Z.useMemo)(()=>cQ({basePath:S,actualModel:T,selectedModelType:u,selectedSkin:cz[T],selectedSkinType:"default"}),[T,S,u]),P=(0,Z.useMemo)(()=>({selectedModel:h,setSelectedModel:c,selectedModelType:u,setSelectedModelType:d,actualModel:T,selectedModelUrl:O,animationPaused:b,setAnimationPaused:_,selectedSkin:f,setSelectedSkin:g,selectedSkinType:p,setSelectedSkinType:m,selectedAnimation:y,setSelectedAnimation:x,skinImageUrls:D,setSkinImageUrls:j,defaultSkinImageUrls:A,slowModeEnabled:w,setSlowModeEnabled:C,importedSkins:k,addImportedSkins:E}),[h,c,u,d,T,O,b,_,f,g,p,m,y,x,D,j,A,w,k,E]);if(!o){let t=a.get("m"),i=a.get("s");if("string"==typeof t){let n=function(t){switch(t){case"lmale":case"mmale":case"hmale":case"lfemale":case"mfemale":case"hfemale":case"lbioderm":case"mbioderm":case"hbioderm":return"player";case"disc":case"chaingun":case"grenade_launcher":case"sniper":case"plasmathrower":case"energy":case"shocklance":case"elf":case"missile":case"mortar":case"repair":case"targeting":case"mine":return"weapon";case"vehicle_grav_scout":case"vehicle_grav_tank":case"vehicle_land_mpbbase":case"vehicle_air_scout":case"vehicle_air_bomber":case"vehicle_air_hapc":return"vehicle";default:return null}}(t);if(n&&(c(t),d(n),"string"==typeof i)){let n=i===cz[e="hfemale"===t?"hmale":t]||(null==(r=cY[e])?void 0:r.includes(i))?"default":"custom";g(i),m(n)}}l(!0)}return(0,Z.useEffect)(()=>{if(!f)return;let t=a.get("m"),e=a.get("s");if(t!==h||e!==f){let t=new URLSearchParams(a);t.set("m",h),t.set("s",f);let e="".concat(s,"?").concat(t);n.replace(e,{scroll:!1})}},[s,n,a,h,f]),(0,Z.useEffect)(()=>{if(f)try{let t=cQ({basePath:S,actualModel:T,selectedModelType:u,selectedSkin:f,selectedSkinType:p});j(t)}catch(t){m("default"),g(cz[T])}},[T,S,u,f,p]),(0,J.jsx)(hV.Provider,{value:P,children:i})}var cZ=t.i(70703);let c$=Z.default.createContext(null);function c0(){let t=(0,Z.useContext)(c$);if(!t)throw Error("No EnvironmentContext.Provider");return t}c$.displayName="EnvironmentContext";let c1=Z.default.createContext(null);function c2(){let t=(0,Z.useContext)(c1);if(!t)throw Error("No SkinContext.Provider");return t}c1.displayName="SkinContext";var c5=t.i(63871);function c4(t){let{material:e,materialDef:r,textureType:i,imageUrl:n,frameRef:s,onReady:a}=t,{modelViewer:o}=(0,c5.default)(),{basePath:l}=cb(),{slowModeEnabled:h}=hz();(0,Z.useEffect)(()=>{let t,c=!1;return(async()=>{if(!r||r.hidden)if("metallicRoughnessTexture"===i){a&&a();return}else e.setAlphaMode("BLEND"),e.pbrMetallicRoughness.setBaseColorFactor([0,0,0,0]),a&&a();else{let{alphaMode:u,alphaCutoff:d,baseColorFactor:f,emissiveFactor:g,emissiveTexture:p=!1,metallicFactor:m=1,roughnessFactor:y=1,frameCount:x=1,frameTimings:b}=r,_=null!=n?n:Array(x).fill("".concat(l,"/white.png"));if(_.some(t=>!t))return;switch(i){case"baseColorTexture":f&&e.pbrMetallicRoughness.setBaseColorFactor(f),u&&e.setAlphaMode(u),d&&e.setAlphaCutoff(d),g&&e.setEmissiveFactor(g);break;case"metallicRoughnessTexture":e.pbrMetallicRoughness.setMetallicFactor(m),e.pbrMetallicRoughness.setRoughnessFactor(y),0===m&&1===y&&(_=Array(x).fill("".concat(l,"/green.png")))}let w=await Promise.all(_.map(t=>o.createTexture(t)));if(!c){let r="baseColorTexture"===i,n=s.current,o=()=>{let s=w[n.frameIndex];if(e.pbrMetallicRoughness[i].setTexture(s),r&&p&&e.emissiveTexture.setTexture(s),r&&(n.frameProgress+=h?.05:1),x>1){var a;let e=null!=(a=null==b?void 0:b[n.frameIndex])?a:1;r&&n.frameProgress>=e&&(n.frameIndex=(n.frameIndex+1)%x,n.frameProgress=0),t=requestAnimationFrame(o)}};o(0),a&&a()}}})(),()=>{c=!0,null!=t&&cancelAnimationFrame(t)}},[l,o,e,r,i,n,s,h,a])}function c3(t){var e,r;let{material:i,materialDef:n,onReady:s}=t,{getSkinImages:a}=c2(),{colorImageUrl:o,metallicImageUrl:l}=null!=(r=a(null!=(e=null==n?void 0:n.file)?e:i.name))?r:{},h=(0,Z.useRef)({frameIndex:0,frameProgress:0});return c4({material:i,materialDef:n,textureType:"baseColorTexture",imageUrl:o,frameRef:h}),c4({material:i,materialDef:n,textureType:"metallicRoughnessTexture",imageUrl:l,frameRef:h}),null}let{materials:c9}=cf;function c6(){let{actualModel:t}=hz(),{model:e}=(0,c5.default)(),r=c9[t];return(0,J.jsx)(J.Fragment,{children:e.materials.map((t,e)=>{let i=r[e];return(0,J.jsx)(c3,{material:t,materialDef:i},t.name)})})}let c8=(0,cZ.default)(()=>t.A(22143),{loadableGenerated:{modules:[66641]},ssr:!1}),{cameraOverrides:c7}=cf;function ut(){var t,e,r,i;let{selectedModel:n,selectedModelUrl:s,selectedModelType:a,selectedAnimation:o,animationPaused:l,slowModeEnabled:h}=hz(),{environmentImageUrl:c,showEnvironment:u,exposure:d}=c0();return(0,J.jsx)(c8,{modelUrl:s,environmentImageUrl:c,showEnvironment:u,animationName:o,animationPaused:l,timeScale:h?.05:.5,cameraOrbit:null!=(i=null==(t=c7[n])?void 0:t.orbit)?i:"weapon"===a?"315deg 70deg 105%":void 0,cameraTarget:null==(e=c7[n])?void 0:e.target,fieldOfView:null==(r=c7[n])?void 0:r.fov,exposure:d,children:(0,J.jsx)(c6,{})})}function ue(){let{selectedEnvironment:t,setSelectedEnvironment:e}=c0();return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("label",{htmlFor:"EnvMapSelect",children:"Environment"}),(0,J.jsxs)("select",{id:"EnvMapSelect",value:null!=t?t:"",onChange:t=>{e(t.target.value||null)},children:[(0,J.jsx)("option",{value:"",children:"Default"}),(0,J.jsx)("option",{value:"clarens_night_02_1k.hdr",children:"Clarens Night"}),(0,J.jsx)("option",{value:"dry_cracked_lake_1k.hdr",children:"Dry Cracked Lake"}),(0,J.jsx)("option",{value:"fouriesburg_mountain_midday_1k.hdr",children:"Fouriesburg Mountain"}),(0,J.jsx)("option",{value:"goegap_1k.hdr",children:"Goegap"}),(0,J.jsx)("option",{value:"hilly_terrain_01_1k.hdr",children:"Hilly Terrain"}),(0,J.jsx)("option",{value:"kloofendal_48d_partly_cloudy_puresky_1k.hdr",children:"Kloofendal Partly Cloudy"}),(0,J.jsx)("option",{value:"kloppenheim_06_puresky_1k.hdr",children:"Kloppenheim"}),(0,J.jsx)("option",{value:"lilienstein_1k.hdr",children:"Lilienstein"}),(0,J.jsx)("option",{value:"spruit_sunrise_1k_HDR.hdr",children:"Spruit Sunrise"}),(0,J.jsx)("option",{value:"umhlanga_sunrise_1k.hdr",children:"Umhlanga Sunrise"})]})]})}function ur(){let{exposure:t,setExposure:e}=c0();return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("label",{htmlFor:"EnvExposure",children:(0,J.jsx)(hH,{size:16})}),(0,J.jsx)("input",{"aria-label":"Exposure",id:"EnvExposure",type:"range",min:.2,max:2.2,step:.1,value:t,onChange:t=>{e(parseFloat(t.target.value))}})]})}let{animations:ui,animationLabels:un,animationLabelOverrides:us}=cf;function ua(){let{actualModel:t,selectedModelType:e,selectedAnimation:r,setSelectedAnimation:i,animationPaused:n,setAnimationPaused:s,slowModeEnabled:a,setSlowModeEnabled:o}=hz(),l=(0,Z.useMemo)(()=>{var r;return[..."player"===e?ui.global:[],...null!=(r=ui[t])?r:[]]},[t,e]);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"LabelWithControls",children:[(0,J.jsx)("label",{children:"Animation"}),(0,J.jsxs)("div",{className:"AnimationSpeed",children:[(0,J.jsx)("input",{type:"checkbox",id:"SlowDownCheckbox",checked:a,onChange:t=>{o(t.target.checked)}})," ",(0,J.jsx)("label",{htmlFor:"SlowDownCheckbox",children:"Slow?"})]})]}),(0,J.jsxs)("div",{className:"Buttons",children:[(0,J.jsxs)("select",{value:null!=r?r:"",onChange:t=>{i(t.target.value||null),s(!1)},children:[(0,J.jsx)("option",{value:"",children:"None"}),l.map(e=>{var r,i;let n=null!=(i=null==(r=us[t])?void 0:r[e])?i:un[e];return(0,J.jsx)("option",{value:e,children:null!=n?n:e},e)})]}),(0,J.jsx)("button",{type:"button",disabled:!r,onClick:()=>{s(t=>!t)},children:n||!r?(0,J.jsx)(hB,{}):(0,J.jsx)(hI,{})})]})]})}function uo(t){let{children:e}=t,[r,i]=(0,Z.useState)(null),[n,s]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(1),{basePath:l}=cb(),h=(0,Z.useMemo)(()=>{let t=r?"".concat(l,"/").concat(r):null;return{selectedEnvironment:r,setSelectedEnvironment:i,showEnvironment:n,setShowEnvironment:s,exposure:a,setExposure:o,environmentImageUrl:t}},[l,r,n,a]);return(0,J.jsx)(c$.Provider,{value:h,children:e})}function ul(t){let{children:e}=t,[r,i]=(0,Z.useState)({}),n=(0,Z.useMemo)(()=>({setSkinImages(t,e){i(r=>({...r,[t]:e}))},setColorImageUrl(t,e,r){i(i=>{var n,s;let a=Array.from(null!=(s=null==(n=i[t])?void 0:n.colorImageUrl)?s:[]);return a[r]=e,{...i,[t]:{...i[t],colorImageUrl:a}}})},setMetallicImageUrl(t,e,r){i(i=>{var n,s;let a=Array.from(null!=(s=null==(n=i[t])?void 0:n.metallicImageUrl)?s:[]);return a[r]=e,{...i,[t]:{...i[t],metallicImageUrl:a}}})}}),[]),s=(0,Z.useMemo)(()=>({materialSkins:r,getSkinImages:t=>r[t],getColorImageUrl(t,e){var i;return null==(i=r[t].colorImageUrl)?void 0:i[e]},getMetallicImageUrl(t,e){var i;return null==(i=r[t].metallicImageUrl)?void 0:i[e]},...n}),[r,n]);return(0,J.jsx)(c1.Provider,{value:s,children:e})}let{materials:uh}=cf;function uc(){let{actualModel:t}=hz(),{selectedMaterialIndex:e,setSelectedMaterialIndex:r}=a1(),i=uh[t];return(0,J.jsx)("select",{value:e,onChange:t=>{r(parseInt(t.target.value,10))},children:i.map((t,e)=>{var r;return t&&!t.hidden&&!1!==t.selectable?(0,J.jsx)("option",{value:e,children:null!=(r=t.label)?r:t.name},t.name):null})})}function uu(t){let{canvasId:e,onChange:r,baseImageUrl:i,textureSize:n,defaultDrawingMode:s=!1}=t,a=(0,Z.useRef)(null),[o,l]=(0,Z.useState)(null),{activeCanvas:h}=a1(),{canvasPadding:c}=cb(),{registerCanvas:u,unregisterCanvas:d}=a$(),[f,g]=(0,Z.useState)(s),p=(0,Z.useRef)(null),m=(0,Z.useRef)(!0),[y,x]=(0,Z.useState)(()=>[]),[b,_]=(0,Z.useState)(()=>[]),w=y.length>1,C=b.length>0,S=(0,Z.useCallback)(t=>{let e=p.current;e&&e(t)},[]),T=(0,Z.useCallback)(async()=>{if(o&&y.length>1){let[t,e]=y.slice(-2);m.current=!1,o.renderOnAddRemove=!1,o.clear(),o.loadFromJSON(t,()=>{o.renderAll(),m.current=!0,o.renderOnAddRemove=!0}),x(t=>t.slice(0,-1)),_(t=>[e,...t])}},[o,y]),O=(0,Z.useCallback)(()=>{if(o&&b.length>0){let t=b[0];m.current=!1,o.renderOnAddRemove=!1,o.clear(),o.loadFromJSON(t,()=>{o.renderAll(),m.current=!0,o.renderOnAddRemove=!0}),x(e=>[...e,t]),_(t=>t.slice(1))}},[o,b]);(0,Z.useEffect)(()=>{p.current=r},[r]);let k=h===e;return(0,Z.useEffect)(()=>{let t;if(!a.current)return;iN.ownDefaults={...iN.ownDefaults,transparentCorners:!1,borderColor:"#8afff1",cornerSize:9,cornerStyle:"circle",cornerColor:"#8afff1",cornerStrokeColor:"#1c9f7c",strokeWidth:10,perPixelTargetFind:!0};let e=new se(a.current,{preserveObjectStacking:!0,targetFindTolerance:2}),r=!1,i=()=>{S(e)};return e.on("object:modified",i),e.on("object:added",i),e.on("object:removed",i),e.on("after:render",()=>{!r&&m.current&&(clearTimeout(t),t=setTimeout(()=>{let t=(()=>{r=!0;let t=e.toDatalessJSON(["lockMovementX","lockMovementY","lockRotation","lockScalingX","lockScalingY","selectable","hoverCursor","moveCursor"]);return r=!1,t})();x(e=>{if(0===e.length)return[t];let r=e[e.length-1];return JSON.stringify(t)===JSON.stringify(r)?e:[...e.slice(-10),t]}),_([])},250))}),l(e),()=>{clearTimeout(t),l(null),e.dispose()}},[S]),(0,Z.useEffect)(()=>{o&&(o.isDrawingMode=f,f&&(o.discardActiveObject(),o.requestRenderAll()))},[o,f]),(0,Z.useEffect)(()=>{o&&k&&o.calcOffset()},[o,k]),(0,Z.useEffect)(()=>{if(o)return u(e,{canvas:o,notifyChange:()=>{o.renderAll(),S(o)},undo:T,redo:O,canUndo:w,canRedo:C,isDrawingMode:f,setDrawingMode:g}),()=>{d(e)}},[o,u,d,e,S,f,g,T,O,w,C]),(0,Z.useEffect)(()=>{x([]),_([])},[o,i,n]),(0,Z.useEffect)(()=>{if(o&&n&&(m.current=!1,o.clear(),i)){let t=!1;return(async()=>{let e=await cv(i);if(!t){if(!e.width||!e.height)throw Error("Zero-height image");e.selectable=!1,e.lockMovementX=!0,e.lockMovementY=!0,e.lockScalingX=!0,e.lockScalingY=!0,e.lockRotation=!0,e.hoverCursor="default",e.moveCursor="default";let[t,r]=n,i=e.width===t?1:t/e.width,s=e.height===r?1:r/e.height;(1!==i||1!==s)&&(e.scaleX=i,e.scaleY=s),o.centerObject(e),o.add(e)}m.current=!0,o.requestRenderAll()})(),()=>{t=!0}}},[o,i,n]),(0,J.jsx)("div",{className:"CanvasContainer","data-active":k?"true":"false",children:(0,J.jsx)("canvas",{width:n[0]+2*c,height:n[1]+2*c,ref:a})})}let ud=Z.default.createContext(null);function uf(){let t=(0,Z.useContext)(ud);if(!t)throw Error("ImageLoaderContext.Provider not found!");return t}ud.displayName="ImageLoaderContext";let ug=[512,512];function up(t){var e,r,i,n;let{materialDef:s,frameIndex:a=0}=t,{skinImageUrls:o,defaultSkinImageUrls:l}=hz(),h=null==(e=o[null!=(i=s.file)?i:s.name])?void 0:e[a],c=null==(r=l[null!=(n=s.file)?n:s.name])?void 0:r[a],{setColorImageUrl:u}=c2(),{canvasPadding:d}=cb(),[f,g]=(0,Z.useState)(null),{removeAlphaFromArrayBuffer:p}=cx(),{loadImage:m}=uf(),{sizeMultiplier:y}=a1(),x=(0,Z.useMemo)(()=>{var t;let[e,r]=null!=(t=s.size)?t:ug;return[e*y,r*y]},[s.size,y]),b=(0,Z.useCallback)(async t=>{var e;let r=t.toDataURL({format:"png",multiplier:1,top:d,left:d,width:x[0],height:x[1]});u(null!=(e=s.file)?e:s.name,r,a)},[x,d,u,s,a]);(0,Z.useEffect)(()=>{if(h){let t=!1;return(async()=>{let e;try{e=await m(h)}catch(t){if(!1===s.hasDefault)return;e=await m(c)}let r=await p(e);t||g(r)})(),()=>{t=!0}}g(null)},[s,h,c,p,m]);let _="".concat(s.name,":color:").concat(a,":").concat(y);return x?(0,J.jsx)(uu,{canvasId:_,canvasType:"color",onChange:b,baseImageUrl:f,textureSize:x},_):null}let um=[512,512];function uv(t){var e,r,i,n;let{materialDef:s,frameIndex:a=0}=t,{skinImageUrls:o,defaultSkinImageUrls:l}=hz(),h=null==(e=o[null!=(i=s.file)?i:s.name])?void 0:e[a],c=null==(r=l[null!=(n=s.file)?n:s.name])?void 0:r[a],{setMetallicImageUrl:u}=c2(),{canvasPadding:d}=cb(),[f,g]=(0,Z.useState)(null),p=(0,Z.useRef)(0),{convertGrayscaleImageUrlToMetallicRoughness:m,convertArrayBufferAlphaToGrayscale:y}=cx(),{loadImage:x}=uf(),{sizeMultiplier:b}=a1(),_=(0,Z.useMemo)(()=>{var t;let[e,r]=null!=(t=s.size)?t:um;return[e*b,r*b]},[s.size,b]),w=(0,Z.useCallback)(async t=>{let e;p.current+=1;let r=t.toDataURL({format:"png",multiplier:1,top:d,left:d,width:_[0],height:_[1]});try{e=await m(r)}finally{p.current-=1}if(0===p.current){var i;u(null!=(i=s.file)?i:s.name,e,a)}},[_,d,u,m,s,a]);(0,Z.useEffect)(()=>{if(h){let t=!1;return(async()=>{let e;try{e=await x(h)}catch(t){if(!1===s.hasDefault)return;e=await x(c)}let r=await y(e);t||g(r)})(),()=>{t=!0}}g(null)},[s,h,c,_,y,x]);let C="".concat(s.name,":metallic:").concat(a,":").concat(b);return _?(0,J.jsx)(uu,{canvasId:C,canvasType:"metallic",onChange:w,baseImageUrl:f,textureSize:_,defaultDrawingMode:!0},C):null}let{materials:uy}=cf;function ux(){let{actualModel:t}=hz(),e=uy[t];return(0,J.jsx)(J.Fragment,{children:e.map(e=>{var r;if(!e)return null;let i=0!==e.metallicFactor||1!==e.roughnessFactor,n=Array(null!=(r=e.frameCount)?r:1).fill(null);return(0,J.jsxs)(Z.default.Fragment,{children:[n.map((t,r)=>(0,J.jsx)(up,{materialDef:e,frameIndex:r},"color:".concat(r))),i?n.map((t,r)=>(0,J.jsx)(uv,{materialDef:e,frameIndex:r},"metallic:".concat(r))):null]},"".concat(t,"-").concat(e.name))})})}var ub=Z.createContext(void 0),u_=t=>{let{client:e,children:r}=t;return Z.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,J.jsx)(ub.Provider,{value:e,children:r})};function uw(t){let{children:e}=t,r=(t=>{let e=Z.useContext(ub);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e})(),i=(0,Z.useMemo)(()=>({loadImage:async t=>t.startsWith("data:")?(0,c_.imageUrlToArrayBuffer)(t):await r.fetchQuery({queryKey:[t]})}),[r]);return(0,J.jsx)(ud.Provider,{value:i,children:e})}function uC(t,e,r){if(!e.has(t))throw TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function uS(t,e){var r=uC(t,e,"get");return r.get?r.get.call(t):r.value}function uT(t,e){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object")}function uO(t,e,r){uT(t,e),e.set(t,r)}function uk(t,e,r){var i=uC(t,e,"set");if(i.set)i.set.call(t,r);else{if(!i.writable)throw TypeError("attempted to set read only private field");i.value=r}return r}function uM(t,e){var r=uC(t,e,"update");if(r.set){if(!r.get)throw TypeError("attempted to read set only private field");return"__destrWrapper"in r||(r.__destrWrapper={set value(v){r.set.call(t,v)},get value(){return r.get.call(t)}}),r.__destrWrapper}if(!r.writable)throw TypeError("attempted to set read only private field");return r}var uE={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},uD=new(m=new WeakMap,y=new WeakMap,class{setTimeoutProvider(t){uk(this,m,t)}setTimeout(t,e){return uS(this,m).setTimeout(t,e)}clearTimeout(t){uS(this,m).clearTimeout(t)}setInterval(t,e){return uS(this,m).setInterval(t,e)}clearInterval(t){uS(this,m).clearInterval(t)}constructor(){uO(this,m,{writable:!0,value:uE}),uO(this,y,{writable:!0,value:!1})}}),uj="undefined"==typeof window||"Deno"in globalThis;function uA(){}function uP(t,e){return"function"==typeof t?t(e):t}function uF(t,e){let{type:r="all",exact:i,fetchStatus:n,predicate:s,queryKey:a,stale:o}=t;if(a){if(i){if(e.queryHash!==uR(a,e.options))return!1}else if(!uB(e.queryKey,a))return!1}if("all"!==r){let t=e.isActive();if("active"===r&&!t||"inactive"===r&&t)return!1}return("boolean"!=typeof o||e.isStale()===o)&&(!n||n===e.state.fetchStatus)&&(!s||!!s(e))}function uL(t,e){let{exact:r,status:i,predicate:n,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(r){if(uI(e.options.mutationKey)!==uI(s))return!1}else if(!uB(e.options.mutationKey,s))return!1}return(!i||e.state.status===i)&&(!n||!!n(e))}function uR(t,e){return((null==e?void 0:e.queryKeyHashFn)||uI)(t)}function uI(t){return JSON.stringify(t,(t,e)=>uU(e)?Object.keys(e).sort().reduce((t,r)=>(t[r]=e[r],t),{}):e)}function uB(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).every(r=>uB(t[r],e[r]))}var uN=Object.prototype.hasOwnProperty;function uW(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function uU(t){if(!uH(t))return!1;let e=t.constructor;if(void 0===e)return!0;let r=e.prototype;return!!uH(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(t)===Object.prototype}function uH(t){return"[object Object]"===Object.prototype.toString.call(t)}function uX(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[...t,e];return r&&i.length>r?i.slice(1):i}function uV(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[e,...t];return r&&i.length>r?i.slice(0,-1):i}var uz=Symbol();function uY(t,e){return!t.queryFn&&(null==e?void 0:e.initialPromise)?()=>e.initialPromise:t.queryFn&&t.queryFn!==uz?t.queryFn:()=>Promise.reject(Error("Missing queryFn: '".concat(t.queryHash,"'")))}function uG(t,e,r){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return r}function uq(t,e){uT(t,e),e.add(t)}var uK=function(t){setTimeout(t,0)},uQ=function(){let t=[],e=0,r=t=>{t()},i=t=>{t()},n=uK,s=i=>{e?t.push(i):n(()=>{r(i)})};return{batch:s=>{let a;e++;try{a=s()}finally{--e||(()=>{let e=t;t=[],e.length&&n(()=>{i(()=>{e.forEach(t=>{r(t)})})})})()}return a},batchCalls:t=>function(){for(var e=arguments.length,r=Array(e),i=0;i{t(...r)})},schedule:s,setNotifyFunction:t=>{r=t},setBatchNotifyFunction:t=>{i=t},setScheduler:t=>{n=t}}}(),uJ=class{subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}},uZ=new(x=new WeakMap,b=new WeakMap,_=new WeakMap,class extends uJ{onSubscribe(){uS(this,b)||this.setEventListener(uS(this,_))}onUnsubscribe(){var t;this.hasListeners()||(null==(t=uS(this,b))||t.call(this),uk(this,b,void 0))}setEventListener(t){var e;uk(this,_,t),null==(e=uS(this,b))||e.call(this),uk(this,b,t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()}))}setFocused(t){uS(this,x)!==t&&(uk(this,x,t),this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){var t;return"boolean"==typeof uS(this,x)?uS(this,x):(null==(t=globalThis.document)?void 0:t.visibilityState)!=="hidden"}constructor(){super(),uO(this,x,{writable:!0,value:void 0}),uO(this,b,{writable:!0,value:void 0}),uO(this,_,{writable:!0,value:void 0}),uk(this,_,t=>{if(!uj&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}})}}),u$=new(w=new WeakMap,C=new WeakMap,S=new WeakMap,class extends uJ{onSubscribe(){uS(this,C)||this.setEventListener(uS(this,S))}onUnsubscribe(){var t;this.hasListeners()||(null==(t=uS(this,C))||t.call(this),uk(this,C,void 0))}setEventListener(t){var e;uk(this,S,t),null==(e=uS(this,C))||e.call(this),uk(this,C,t(this.setOnline.bind(this)))}setOnline(t){uS(this,w)!==t&&(uk(this,w,t),this.listeners.forEach(e=>{e(t)}))}isOnline(){return uS(this,w)}constructor(){super(),uO(this,w,{writable:!0,value:!0}),uO(this,C,{writable:!0,value:void 0}),uO(this,S,{writable:!0,value:void 0}),uk(this,S,t=>{if(!uj&&window.addEventListener){let e=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",r)}}})}});function u0(t){return Math.min(1e3*2**t,3e4)}function u1(t){return(null!=t?t:"online")!=="online"||u$.isOnline()}var u2=class extends Error{constructor(t){super("CancelledError"),this.revert=null==t?void 0:t.revert,this.silent=null==t?void 0:t.silent}};function u5(t){let e,r=!1,i=0,n=function(){let t,e,r=new Promise((r,i)=>{t=r,e=i});function i(t){Object.assign(r,t),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=e=>{i({status:"fulfilled",value:e}),t(e)},r.reject=t=>{i({status:"rejected",reason:t}),e(t)},r}(),s=()=>uZ.isFocused()&&("always"===t.networkMode||u$.isOnline())&&t.canRun(),a=()=>u1(t.networkMode)&&t.canRun(),o=t=>{"pending"===n.status&&(null==e||e(),n.resolve(t))},l=t=>{"pending"===n.status&&(null==e||e(),n.reject(t))},h=()=>new Promise(r=>{var i;e=t=>{("pending"!==n.status||s())&&r(t)},null==(i=t.onPause)||i.call(t)}).then(()=>{if(e=void 0,"pending"===n.status){var r;null==(r=t.onContinue)||r.call(t)}}),c=()=>{let e;if("pending"!==n.status)return;let a=0===i?t.initialPromise:void 0;try{e=null!=a?a:t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(o).catch(e=>{var a,o,u;if("pending"!==n.status)return;let d=null!=(o=t.retry)?o:3*!uj,f=null!=(u=t.retryDelay)?u:u0,g="function"==typeof f?f(i,e):f,p=!0===d||"number"==typeof d&&i{uD.setTimeout(t,g)}).then(()=>s()?void 0:h()).then(()=>{r?l(e):c()})})};return{promise:n,status:()=>n.status,cancel:e=>{if("pending"===n.status){var r;let i=new u2(e);l(i),null==(r=t.onCancel)||r.call(t,i)}},continue:()=>(null==e||e(),n),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:a,start:()=>(a()?c():h().then(c),n)}}var u4=(T=new WeakMap,class{destroy(){this.clearGcTimeout()}scheduleGc(){var t;this.clearGcTimeout(),"number"==typeof(t=this.gcTime)&&t>=0&&t!==1/0&&uk(this,T,uD.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,null!=t?t:uj?1/0:3e5)}clearGcTimeout(){uS(this,T)&&(uD.clearTimeout(uS(this,T)),uk(this,T,void 0))}constructor(){uO(this,T,{writable:!0,value:void 0})}}),u3=(O=new WeakMap,k=new WeakMap,M=new WeakMap,E=new WeakMap,D=new WeakMap,j=new WeakMap,A=new WeakMap,P=new WeakSet,class extends u4{get meta(){return this.options.meta}get promise(){var t;return null==(t=uS(this,D))?void 0:t.promise}setOptions(t){if(this.options={...uS(this,j),...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let t=u9(this.options);void 0!==t.data&&(this.setData(t.data,{updatedAt:t.dataUpdatedAt,manual:!0}),uk(this,O,t))}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||uS(this,M).remove(this)}setData(t,e){var r,i;let n=(r=this.state.data,"function"==typeof(i=this.options).structuralSharing?i.structuralSharing(r,t):!1!==i.structuralSharing?function t(e,r){if(e===r)return e;let i=uW(e)&&uW(r);if(!i&&!(uU(e)&&uU(r)))return r;let n=(i?e:Object.keys(e)).length,s=i?r:Object.keys(r),a=s.length,o=i?Array(a):{},l=0;for(let h=0;h{var e;return!1!==(e=t.options.enabled,"function"==typeof e?e(this):e)})}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===uz||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===uP(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!Math.max(this.state.dataUpdatedAt+(t||0)-Date.now(),0))}onFocus(){var t;let e=this.observers.find(t=>t.shouldFetchOnWindowFocus());null==e||e.refetch({cancelRefetch:!1}),null==(t=uS(this,D))||t.continue()}onOnline(){var t;let e=this.observers.find(t=>t.shouldFetchOnReconnect());null==e||e.refetch({cancelRefetch:!1}),null==(t=uS(this,D))||t.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),uS(this,M).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(uS(this,D)&&(uS(this,A)?uS(this,D).cancel({revert:!0}):uS(this,D).cancelRetry()),this.scheduleGc()),uS(this,M).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||uG(this,P,u6).call(this,{type:"invalidate"})}async fetch(t,e){var r,i,n,s,a,o,l,h,c,u,d,f;if("idle"!==this.state.fetchStatus&&(null==(r=uS(this,D))?void 0:r.status())!=="rejected"){if(void 0!==this.state.data&&(null==e?void 0:e.cancelRefetch))this.cancel({silent:!0});else if(uS(this,D))return uS(this,D).continueRetry(),uS(this,D).promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let g=new AbortController,p=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(uk(this,A,!0),g.signal)})},m=()=>{let t=uY(this.options,e),r=(()=>{let t={client:uS(this,E),queryKey:this.queryKey,meta:this.meta};return p(t),t})();return(uk(this,A,!1),this.options.persister)?this.options.persister(t,r,this):t(r)},y=(()=>{let t={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:uS(this,E),state:this.state,fetchFn:m};return p(t),t})();null==(i=this.options.behavior)||i.onFetch(y,this),uk(this,k,this.state),("idle"===this.state.fetchStatus||this.state.fetchMeta!==(null==(n=y.fetchOptions)?void 0:n.meta))&&uG(this,P,u6).call(this,{type:"fetch",meta:null==(s=y.fetchOptions)?void 0:s.meta}),uk(this,D,u5({initialPromise:null==e?void 0:e.initialPromise,fn:y.fetchFn,onCancel:t=>{t instanceof u2&&t.revert&&this.setState({...uS(this,k),fetchStatus:"idle"}),g.abort()},onFail:(t,e)=>{uG(this,P,u6).call(this,{type:"failed",failureCount:t,error:e})},onPause:()=>{uG(this,P,u6).call(this,{type:"pause"})},onContinue:()=>{uG(this,P,u6).call(this,{type:"continue"})},retry:y.options.retry,retryDelay:y.options.retryDelay,networkMode:y.options.networkMode,canRun:()=>!0}));try{let t=await uS(this,D).start();if(void 0===t)throw Error("".concat(this.queryHash," data is undefined"));return this.setData(t),null==(a=(o=uS(this,M).config).onSuccess)||a.call(o,t,this),null==(l=(h=uS(this,M).config).onSettled)||l.call(h,t,this.state.error,this),t}catch(t){if(t instanceof u2){if(t.silent)return uS(this,D).promise;else if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw uG(this,P,u6).call(this,{type:"error",error:t}),null==(c=(u=uS(this,M).config).onError)||c.call(u,t,this),null==(d=(f=uS(this,M).config).onSettled)||d.call(f,this.state.data,t,this),t}finally{this.scheduleGc()}}constructor(t){var e;super(),uq(this,P),uO(this,O,{writable:!0,value:void 0}),uO(this,k,{writable:!0,value:void 0}),uO(this,M,{writable:!0,value:void 0}),uO(this,E,{writable:!0,value:void 0}),uO(this,D,{writable:!0,value:void 0}),uO(this,j,{writable:!0,value:void 0}),uO(this,A,{writable:!0,value:void 0}),uk(this,A,!1),uk(this,j,t.defaultOptions),this.setOptions(t.options),this.observers=[],uk(this,E,t.client),uk(this,M,uS(this,E).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,uk(this,O,u9(this.options)),this.state=null!=(e=t.state)?e:uS(this,O),this.scheduleGc()}});function u9(t){let e="function"==typeof t.initialData?t.initialData():t.initialData,r=void 0!==e,i=r?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?null!=i?i:Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}function u6(t){let e=e=>{var r,i,n;switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...(n=e.data,{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:u1(this.options.networkMode)?"fetching":"paused",...void 0===n&&{error:null,status:"pending"}}),fetchMeta:null!=(r=t.meta)?r:null};case"success":let s={...e,data:t.data,dataUpdateCount:e.dataUpdateCount+1,dataUpdatedAt:null!=(i=t.dataUpdatedAt)?i:Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return uk(this,k,t.manual?s:void 0),s;case"error":let a=t.error;return{...e,error:a,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}};this.state=e(this.state),uQ.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),uS(this,M).notify({query:this,type:"updated",action:t})})}var u8=(F=new WeakMap,class extends uJ{build(t,e,r){var i;let n=e.queryKey,s=null!=(i=e.queryHash)?i:uR(n,e),a=this.get(s);return a||(a=new u3({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(e),state:r,defaultOptions:t.getQueryDefaults(n)}),this.add(a)),a}add(t){uS(this,F).has(t.queryHash)||(uS(this,F).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=uS(this,F).get(t.queryHash);e&&(t.destroy(),e===t&&uS(this,F).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){uQ.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return uS(this,F).get(t)}getAll(){return[...uS(this,F).values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>uF(e,t))}findAll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAll();return Object.keys(t).length>0?e.filter(e=>uF(t,e)):e}notify(t){uQ.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){uQ.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){uQ.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}constructor(t={}){super(),uO(this,F,{writable:!0,value:void 0}),this.config=t,uk(this,F,new Map)}}),u7=(L=new WeakMap,R=new WeakMap,I=new WeakMap,B=new WeakMap,N=new WeakSet,class extends u4{setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){uS(this,R).includes(t)||(uS(this,R).push(t),this.clearGcTimeout(),uS(this,I).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){uk(this,R,uS(this,R).filter(e=>e!==t)),this.scheduleGc(),uS(this,I).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){uS(this,R).length||("pending"===this.state.status?this.scheduleGc():uS(this,I).remove(this))}continue(){var t,e;return null!=(e=null==(t=uS(this,B))?void 0:t.continue())?e:this.execute(this.state.variables)}async execute(t){var e,r,i,n,s,a,o,l,h,c,u,d,f,g,p,m,y,x,b,_,w;let C=()=>{uG(this,N,dt).call(this,{type:"continue"})},S={client:uS(this,L),meta:this.options.meta,mutationKey:this.options.mutationKey};uk(this,B,u5({fn:()=>this.options.mutationFn?this.options.mutationFn(t,S):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{uG(this,N,dt).call(this,{type:"failed",failureCount:t,error:e})},onPause:()=>{uG(this,N,dt).call(this,{type:"pause"})},onContinue:C,retry:null!=(e=this.options.retry)?e:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>uS(this,I).canRun(this)}));let T="pending"===this.state.status,O=!uS(this,B).canStart();try{if(T)C();else{uG(this,N,dt).call(this,{type:"pending",variables:t,isPaused:O}),await (null==(c=(u=uS(this,I).config).onMutate)?void 0:c.call(u,t,this,S));let e=await (null==(d=(f=this.options).onMutate)?void 0:d.call(f,t,S));e!==this.state.context&&uG(this,N,dt).call(this,{type:"pending",context:e,variables:t,isPaused:O})}let e=await uS(this,B).start();return await (null==(r=(i=uS(this,I).config).onSuccess)?void 0:r.call(i,e,t,this.state.context,this,S)),await (null==(n=(s=this.options).onSuccess)?void 0:n.call(s,e,t,this.state.context,S)),await (null==(a=(o=uS(this,I).config).onSettled)?void 0:a.call(o,e,null,this.state.variables,this.state.context,this,S)),await (null==(l=(h=this.options).onSettled)?void 0:l.call(h,e,null,t,this.state.context,S)),uG(this,N,dt).call(this,{type:"success",data:e}),e}catch(e){try{throw await (null==(g=(p=uS(this,I).config).onError)?void 0:g.call(p,e,t,this.state.context,this,S)),await (null==(m=(y=this.options).onError)?void 0:m.call(y,e,t,this.state.context,S)),await (null==(x=(b=uS(this,I).config).onSettled)?void 0:x.call(b,void 0,e,this.state.variables,this.state.context,this,S)),await (null==(_=(w=this.options).onSettled)?void 0:_.call(w,void 0,e,t,this.state.context,S)),e}finally{uG(this,N,dt).call(this,{type:"error",error:e})}}finally{uS(this,I).runNext(this)}}constructor(t){super(),uq(this,N),uO(this,L,{writable:!0,value:void 0}),uO(this,R,{writable:!0,value:void 0}),uO(this,I,{writable:!0,value:void 0}),uO(this,B,{writable:!0,value:void 0}),uk(this,L,t.client),this.mutationId=t.mutationId,uk(this,I,t.mutationCache),uk(this,R,[]),this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}});function dt(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),uQ.batch(()=>{uS(this,R).forEach(e=>{e.onMutationUpdate(t)}),uS(this,I).notify({mutation:this,type:"updated",action:t})})}var de=(W=new WeakMap,U=new WeakMap,H=new WeakMap,class extends uJ{build(t,e,r){let i=new u7({client:t,mutationCache:this,mutationId:++uM(this,H).value,options:t.defaultMutationOptions(e),state:r});return this.add(i),i}add(t){uS(this,W).add(t);let e=dr(t);if("string"==typeof e){let r=uS(this,U).get(e);r?r.push(t):uS(this,U).set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(uS(this,W).delete(t)){let e=dr(t);if("string"==typeof e){let r=uS(this,U).get(e);if(r)if(r.length>1){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}else r[0]===t&&uS(this,U).delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=dr(t);if("string"!=typeof e)return!0;{let r=uS(this,U).get(e),i=null==r?void 0:r.find(t=>"pending"===t.state.status);return!i||i===t}}runNext(t){let e=dr(t);if("string"!=typeof e)return Promise.resolve();{var r,i;let n=null==(r=uS(this,U).get(e))?void 0:r.find(e=>e!==t&&e.state.isPaused);return null!=(i=null==n?void 0:n.continue())?i:Promise.resolve()}}clear(){uQ.batch(()=>{uS(this,W).forEach(t=>{this.notify({type:"removed",mutation:t})}),uS(this,W).clear(),uS(this,U).clear()})}getAll(){return Array.from(uS(this,W))}find(t){let e={exact:!0,...t};return this.getAll().find(t=>uL(e,t))}findAll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getAll().filter(e=>uL(t,e))}notify(t){uQ.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return uQ.batch(()=>Promise.all(t.map(t=>t.continue().catch(uA))))}constructor(t={}){super(),uO(this,W,{writable:!0,value:void 0}),uO(this,U,{writable:!0,value:void 0}),uO(this,H,{writable:!0,value:void 0}),this.config=t,uk(this,W,new Set),uk(this,U,new Map),uk(this,H,0)}});function dr(t){var e;return null==(e=t.options.scope)?void 0:e.id}function di(t){return{onFetch:(e,r)=>{var i,n,s,a,o;let l=e.options,h=null==(s=e.fetchOptions)||null==(n=s.meta)||null==(i=n.fetchMore)?void 0:i.direction,c=(null==(a=e.state.data)?void 0:a.pages)||[],u=(null==(o=e.state.data)?void 0:o.pageParams)||[],d={pages:[],pageParams:[]},f=0,g=async()=>{let r=!1,i=uY(e.options,e.fetchOptions),n=async(t,n,s)=>{if(r)return Promise.reject();if(null==n&&t.pages.length)return Promise.resolve(t);let a=(()=>{let t={client:e.client,queryKey:e.queryKey,pageParam:n,direction:s?"backward":"forward",meta:e.options.meta};return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(e.signal.aborted?r=!0:e.signal.addEventListener("abort",()=>{r=!0}),e.signal)}),t})(),o=await i(a),{maxPages:l}=e.options,h=s?uV:uX;return{pages:h(t.pages,o,l),pageParams:h(t.pageParams,n,l)}};if(h&&c.length){let t="backward"===h,e={pages:c,pageParams:u},r=(t?function(t,e){var r;let{pages:i,pageParams:n}=e;return i.length>0?null==(r=t.getPreviousPageParam)?void 0:r.call(t,i[0],i,n[0],n):void 0}:dn)(l,e);d=await n(e,r,t)}else{let e=null!=t?t:c.length;do{var s;let t=0===f?null!=(s=u[0])?s:l.initialPageParam:dn(l,d);if(f>0&&null==t)break;d=await n(d,t),f++}while(f{var t,i;return null==(t=(i=e.options).persister)?void 0:t.call(i,g,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=g}}}function dn(t,e){let{pages:r,pageParams:i}=e,n=r.length-1;return r.length>0?t.getNextPageParam(r[n],r,i[n],i):void 0}let ds=new(X=new WeakMap,V=new WeakMap,z=new WeakMap,Y=new WeakMap,G=new WeakMap,q=new WeakMap,K=new WeakMap,Q=new WeakMap,class{mount(){uM(this,q).value++,1===uS(this,q)&&(uk(this,K,uZ.subscribe(async t=>{t&&(await this.resumePausedMutations(),uS(this,X).onFocus())})),uk(this,Q,u$.subscribe(async t=>{t&&(await this.resumePausedMutations(),uS(this,X).onOnline())})))}unmount(){var t,e;uM(this,q).value--,0===uS(this,q)&&(null==(t=uS(this,K))||t.call(this),uk(this,K,void 0),null==(e=uS(this,Q))||e.call(this),uk(this,Q,void 0))}isFetching(t){return uS(this,X).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return uS(this,V).findAll({...t,status:"pending"}).length}getQueryData(t){var e;let r=this.defaultQueryOptions({queryKey:t});return null==(e=uS(this,X).get(r.queryHash))?void 0:e.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),r=uS(this,X).build(this,e),i=r.state.data;return void 0===i?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(uP(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return uS(this,X).findAll(t).map(t=>{let{queryKey:e,state:r}=t;return[e,r.data]})}setQueryData(t,e,r){let i=this.defaultQueryOptions({queryKey:t}),n=uS(this,X).get(i.queryHash),s=null==n?void 0:n.state.data,a="function"==typeof e?e(s):e;if(void 0!==a)return uS(this,X).build(this,i).setData(a,{...r,manual:!0})}setQueriesData(t,e,r){return uQ.batch(()=>uS(this,X).findAll(t).map(t=>{let{queryKey:i}=t;return[i,this.setQueryData(i,e,r)]}))}getQueryState(t){var e;let r=this.defaultQueryOptions({queryKey:t});return null==(e=uS(this,X).get(r.queryHash))?void 0:e.state}removeQueries(t){let e=uS(this,X);uQ.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let r=uS(this,X);return uQ.batch(()=>(r.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={revert:!0,...e};return Promise.all(uQ.batch(()=>uS(this,X).findAll(t).map(t=>t.cancel(r)))).then(uA).catch(uA)}invalidateQueries(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return uQ.batch(()=>{var r,i;return(uS(this,X).findAll(t).forEach(t=>{t.invalidate()}),(null==t?void 0:t.refetchType)==="none")?Promise.resolve():this.refetchQueries({...t,type:null!=(i=null!=(r=null==t?void 0:t.refetchType)?r:null==t?void 0:t.type)?i:"active"},e)})}refetchQueries(t){var e;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={...r,cancelRefetch:null==(e=r.cancelRefetch)||e};return Promise.all(uQ.batch(()=>uS(this,X).findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,i);return i.throwOnError||(e=e.catch(uA)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(uA)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let r=uS(this,X).build(this,e);return r.isStaleByTime(uP(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(uA).catch(uA)}fetchInfiniteQuery(t){return t.behavior=di(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(uA).catch(uA)}ensureInfiniteQueryData(t){return t.behavior=di(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return u$.isOnline()?uS(this,V).resumePausedMutations():Promise.resolve()}getQueryCache(){return uS(this,X)}getMutationCache(){return uS(this,V)}getDefaultOptions(){return uS(this,z)}setDefaultOptions(t){uk(this,z,t)}setQueryDefaults(t,e){uS(this,Y).set(uI(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...uS(this,Y).values()],r={};return e.forEach(e=>{uB(t,e.queryKey)&&Object.assign(r,e.defaultOptions)}),r}setMutationDefaults(t,e){uS(this,G).set(uI(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...uS(this,G).values()],r={};return e.forEach(e=>{uB(t,e.mutationKey)&&Object.assign(r,e.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;let e={...uS(this,z).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=uR(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===uz&&(e.enabled=!1),e}defaultMutationOptions(t){return(null==t?void 0:t._defaulted)?t:{...uS(this,z).mutations,...(null==t?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){uS(this,X).clear(),uS(this,V).clear()}constructor(t={}){uO(this,X,{writable:!0,value:void 0}),uO(this,V,{writable:!0,value:void 0}),uO(this,z,{writable:!0,value:void 0}),uO(this,Y,{writable:!0,value:void 0}),uO(this,G,{writable:!0,value:void 0}),uO(this,q,{writable:!0,value:void 0}),uO(this,K,{writable:!0,value:void 0}),uO(this,Q,{writable:!0,value:void 0}),uk(this,X,t.queryCache||new u8),uk(this,V,t.mutationCache||new de),uk(this,z,t.defaultOptions||{}),uk(this,Y,new Map),uk(this,G,new Map),uk(this,q,0)}})({defaultOptions:{queries:{queryFn:async function(t){let{queryKey:e}=t,[r]=e;return(0,c_.imageUrlToArrayBuffer)(r)},staleTime:1/0,gcTime:6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1}}});function da(){return(0,J.jsx)(J.Fragment,{children:(0,J.jsx)(u_,{client:ds,children:(0,J.jsx)("main",{children:(0,J.jsx)(uw,{children:(0,J.jsx)(Z.Suspense,{children:(0,J.jsx)(cJ,{children:(0,J.jsx)(uo,{children:(0,J.jsxs)(ul,{children:[(0,J.jsxs)("div",{className:"Viewport",children:[(0,J.jsxs)("div",{className:"ModelTools",children:[(0,J.jsx)("div",{className:"Field",children:(0,J.jsx)(ue,{})}),(0,J.jsx)("div",{className:"Field SliderField",children:(0,J.jsx)(ur,{})}),(0,J.jsx)("div",{className:"Field",children:(0,J.jsx)(ua,{})})]}),(0,J.jsx)(ut,{})]}),(0,J.jsx)(cO,{children:(0,J.jsx)(cS,{children:(0,J.jsxs)(ck,{children:[(0,J.jsx)(cH,{}),(0,J.jsxs)("div",{className:"CanvasViewport",children:[(0,J.jsxs)("div",{className:"CanvasSelector",children:[(0,J.jsx)(cM,{}),(0,J.jsx)(uc,{})]}),(0,J.jsx)(cT,{}),(0,J.jsx)(ux,{})]}),(0,J.jsx)(cp,{}),(0,J.jsx)(cm,{})]})})})]})})})})})})})})}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/9a2f1a7f288f6fd4.js b/docs/_next/static/chunks/9a2f1a7f288f6fd4.js new file mode 100644 index 0000000..6ac6516 --- /dev/null +++ b/docs/_next/static/chunks/9a2f1a7f288f6fd4.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29402,(e,t,r)=>{var n,o,a="__lodash_hash_undefined__",l=1/0,i="[object Arguments]",u="[object Array]",c="[object Boolean]",s="[object Date]",f="[object Error]",d="[object Function]",p="[object Map]",h="[object Number]",_="[object Object]",v="[object Promise]",y="[object RegExp]",g="[object Set]",m="[object String]",b="[object Symbol]",j="[object WeakMap]",w="[object ArrayBuffer]",x="[object DataView]",O=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,k=/^\w*$/,P=/^\./,S=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,T=/\\(\\)?/g,C=/^\[object .+?Constructor\]$/,E=/^(?:0|[1-9]\d*)$/,A={};A["[object Float32Array]"]=A["[object Float64Array]"]=A["[object Int8Array]"]=A["[object Int16Array]"]=A["[object Int32Array]"]=A["[object Uint8Array]"]=A["[object Uint8ClampedArray]"]=A["[object Uint16Array]"]=A["[object Uint32Array]"]=!0,A[i]=A[u]=A[w]=A[c]=A[x]=A[s]=A[f]=A[d]=A[p]=A[h]=A[_]=A[y]=A[g]=A[m]=A[j]=!1;var L=e.g&&e.g.Object===Object&&e.g,N="object"==typeof self&&self&&self.Object===Object&&self,M=L||N||Function("return this")(),z=r&&!r.nodeType&&r,F=z&&t&&!t.nodeType&&t,G=F&&F.exports===z&&L.process,I=function(){try{return G&&G.binding("util")}catch(e){}}(),D=I&&I.isTypedArray;function R(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r-1},eb.prototype.set=function(e,t){var r=this.__data__,n=eO(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},ej.prototype.clear=function(){this.__data__={hash:new em,map:new(el||eb),string:new em}},ej.prototype.delete=function(e){return eL(this,e).delete(e)},ej.prototype.get=function(e){return eL(this,e).get(e)},ej.prototype.has=function(e){return eL(this,e).has(e)},ej.prototype.set=function(e,t){return eL(this,e).set(e,t),this},ew.prototype.add=ew.prototype.push=function(e){return this.__data__.set(e,a),this},ew.prototype.has=function(e){return this.__data__.has(e)},ex.prototype.clear=function(){this.__data__=new eb},ex.prototype.delete=function(e){return this.__data__.delete(e)},ex.prototype.get=function(e){return this.__data__.get(e)},ex.prototype.has=function(e){return this.__data__.has(e)},ex.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eb){var n=r.__data__;if(!el||n.length<199)return n.push([e,t]),this;r=this.__data__=new ej(n)}return r.set(e,t),this};var ek=function(e,t){return function(r,n){if(null==r)return r;if(!e$(r))return e(r,n);for(var o=r.length,a=-1,l=Object(r);(t?a--:++ai))return!1;var c=a.get(e);if(c&&a.get(t))return c==t;var s=-1,f=!0,d=1&o?new ew:void 0;for(a.set(e,t),a.set(t,e);++s-1&&e%1==0&&e-1&&e%1==0&&e<=0x1fffffffffffff}function eW(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function eQ(e){return!!e&&"object"==typeof e}function eq(e){return"symbol"==typeof e||eQ(e)&&X.call(e)==b}var eJ=D?B(D):function(e){return eQ(e)&&eK(e.length)&&!!A[X.call(e)]};function eX(e){return e$(e)?function(e,t){var r=eV(e)||eH(e)?function(e,t){for(var r=-1,n=Array(e);++rt||a&&l&&u&&!i&&!c||n&&l&&u||!r&&u||!o)return 1;if(!n&&!a&&!c&&e=i)return u;return u*("desc"==r[n]?-1:1)}}return e.index-t.index}(e,t,r)});u--;)i[u]=i[u].value;return i}(e,t,r))}},97052,e=>{e.v({Back:"gallery-module__zlwOTG__Back",Detail:"gallery-module__zlwOTG__Detail",DownloadButton:"gallery-module__zlwOTG__DownloadButton",DownloadSection:"gallery-module__zlwOTG__DownloadSection",DownloadSkin:"gallery-module__zlwOTG__DownloadSkin",DownloadSpinner:"gallery-module__zlwOTG__DownloadSpinner",Gallery:"gallery-module__zlwOTG__Gallery",GalleryPage:"gallery-module__zlwOTG__GalleryPage",HeaderEnd:"gallery-module__zlwOTG__HeaderEnd",IconLink:"gallery-module__zlwOTG__IconLink",Label:"gallery-module__zlwOTG__Label",LoadInEditor:"gallery-module__zlwOTG__LoadInEditor",Name:"gallery-module__zlwOTG__Name",PackVersion:"gallery-module__zlwOTG__PackVersion",Preview:"gallery-module__zlwOTG__Preview",Skin:"gallery-module__zlwOTG__Skin",Spinner:"gallery-module__zlwOTG__Spinner",Tools:"gallery-module__zlwOTG__Tools",spin:"gallery-module__zlwOTG__spin"})},36159,(e,t,r)=>{"use strict";function n(){return null}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return n}}),("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},98183,(e,t,r)=>{"use strict";function n(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function o(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function a(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,o(e));else t.set(r,o(n));return t}function l(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(r,{formatUrl:function(){return a},formatWithValidation:function(){return i},urlObjectKeys:function(){return l}});let n=e.r(90809)._(e.r(98183)),o=/https?|ftp|gopher|file/;function a(e){let{auth:t,hostname:r}=e,a=e.protocol||"",l=e.pathname||"",i=e.hash||"",u=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:r&&(c=t+(~r.indexOf(":")?"["+r+"]":r),e.port&&(c+=":"+e.port)),u&&"object"==typeof u&&(u=String(n.urlQueryToSearchParams(u)));let s=e.search||u&&"?"+u||"";return a&&!a.endsWith(":")&&(a+=":"),e.slashes||(!a||o.test(a))&&!1!==c?(c="//"+(c||""),l&&"/"!==l[0]&&(l="/"+l)):c||(c=""),i&&"#"!==i[0]&&(i="#"+i),s&&"?"!==s[0]&&(s="?"+s),""+a+c+(l=l.replace(/[?#]/g,encodeURIComponent))+(s=s.replace("#","%23"))+i}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function i(e){return a(e)}},18581,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return o}});let n=e.r(71645);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=a(e,n)),t&&(o.current=a(t,n))},[e,t])}function a(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},18967,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(r,{DecodeError:function(){return _},MiddlewareNotFoundError:function(){return m},MissingStaticPage:function(){return g},NormalizeError:function(){return v},PageNotFoundError:function(){return y},SP:function(){return p},ST:function(){return h},WEB_VITALS:function(){return n},execOnce:function(){return o},getDisplayName:function(){return c},getLocationOrigin:function(){return i},getURL:function(){return u},isAbsoluteUrl:function(){return l},isResSent:function(){return s},loadGetInitialProps:function(){return d},normalizeRepeatedSlashes:function(){return f},stringifyError:function(){return b}});let n=["CLS","FCP","FID","INP","LCP","TTFB"];function o(e){let t,r=!1;return function(){for(var n=arguments.length,o=Array(n),a=0;aa.test(e);function i(){let{protocol:e,hostname:t,port:r}=window.location;return e+"//"+t+(r?":"+r:"")}function u(){let{href:e}=window.location,t=i();return e.substring(t.length)}function c(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function s(e){return e.finished||e.headersSent}function f(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?"?"+t.slice(1).join("?"):"")}async function d(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await d(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&s(r))return n;if(!n)throw Object.defineProperty(Error('"'+c(e)+'.getInitialProps()" should resolve to an object. But found "'+n+'" instead.'),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n}let p="undefined"!=typeof performance,h=p&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class _ extends Error{}class v extends Error{}class y extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message="Cannot find module for page: "+e}}class g extends Error{constructor(e,t){super(),this.message="Failed to load static file for page: "+e+" "+t}}class m extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function b(e){return JSON.stringify({message:e.message,stack:e.stack})}},73668,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return a}});let n=e.r(18967),o=e.r(52817);function a(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},84508,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},22016,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(r,{default:function(){return v},useLinkStatus:function(){return g}});let n=e.r(90809),o=e.r(43476),a=n._(e.r(71645)),l=e.r(95057),i=e.r(8372),u=e.r(18581),c=e.r(18967),s=e.r(5550);e.r(33525);let f=e.r(91949),d=e.r(73668),p=e.r(99781);e.r(84508);let h=e.r(65165);function _(e){return"string"==typeof e?e:(0,l.formatUrl)(e)}function v(e){var t;let r,n,l,[v,g]=(0,a.useOptimistic)(f.IDLE_LINK_STATUS),m=(0,a.useRef)(null),{href:b,as:j,children:w,prefetch:x=null,passHref:O,replace:k,shallow:P,scroll:S,onClick:T,onMouseEnter:C,onTouchStart:E,legacyBehavior:A=!1,onNavigate:L,ref:N,unstable_dynamicOnHover:M,...z}=e;r=w,A&&("string"==typeof r||"number"==typeof r)&&(r=(0,o.jsx)("a",{children:r}));let F=a.default.useContext(i.AppRouterContext),G=!1!==x,I=!1!==x?null===(t=x)||"auto"===t?h.FetchStrategy.PPR:h.FetchStrategy.Full:h.FetchStrategy.PPR,{href:D,as:R}=a.default.useMemo(()=>{let e=_(b);return{href:e,as:j?_(j):e}},[b,j]);A&&(n=a.default.Children.only(r));let B=A?n&&"object"==typeof n&&n.ref:N,U=a.default.useCallback(e=>(null!==F&&(m.current=(0,f.mountLinkInstance)(e,D,F,I,G,g)),()=>{m.current&&((0,f.unmountLinkForCurrentNavigation)(m.current),m.current=null),(0,f.unmountPrefetchableInstance)(e)}),[G,D,F,I,g]),H={ref:(0,u.useMergedRef)(U,B),onClick(e){A||"function"!=typeof T||T(e),A&&n.props&&"function"==typeof n.props.onClick&&n.props.onClick(e),F&&(e.defaultPrevented||function(e,t,r,n,o,l,i){let{nodeName:u}=e.currentTarget;if(!("A"===u.toUpperCase()&&function(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||e.currentTarget.hasAttribute("download"))){if(!(0,d.isLocalURL)(t)){o&&(e.preventDefault(),location.replace(t));return}if(e.preventDefault(),i){let e=!1;if(i({preventDefault:()=>{e=!0}}),e)return}a.default.startTransition(()=>{(0,p.dispatchNavigateAction)(r||t,o?"replace":"push",null==l||l,n.current)})}}(e,D,R,m,k,S,L))},onMouseEnter(e){A||"function"!=typeof C||C(e),A&&n.props&&"function"==typeof n.props.onMouseEnter&&n.props.onMouseEnter(e),F&&G&&(0,f.onNavigationIntent)(e.currentTarget,!0===M)},onTouchStart:function(e){A||"function"!=typeof E||E(e),A&&n.props&&"function"==typeof n.props.onTouchStart&&n.props.onTouchStart(e),F&&G&&(0,f.onNavigationIntent)(e.currentTarget,!0===M)}};return(0,c.isAbsoluteUrl)(R)?H.href=R:A&&!O&&("a"!==n.type||"href"in n.props)||(H.href=(0,s.addBasePath)(R)),l=A?a.default.cloneElement(n,H):(0,o.jsx)("a",{...z,...H,children:r}),(0,o.jsx)(y.Provider,{value:v,children:l})}let y=(0,a.createContext)(f.IDLE_LINK_STATUS),g=()=>(0,a.useContext)(y);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},25500,e=>{"use strict";e.s(["default",()=>b],25500);var t=e.i(43476),r=e.i(71645),n=e.i(40141);function o(e){return(0,n.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{opacity:"0.2",fillRule:"evenodd",clipRule:"evenodd",d:"M12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",fill:"currentColor"},child:[]},{tag:"path",attr:{d:"M12 22C17.5228 22 22 17.5228 22 12H19C19 15.866 15.866 19 12 19V22Z",fill:"currentColor"},child:[]},{tag:"path",attr:{d:"M2 12C2 6.47715 6.47715 2 12 2V5C8.13401 5 5 8.13401 5 12H2Z",fill:"currentColor"},child:[]}]})(e)}var a=e.i(90106),l=e.i(11152),i=e.i(18566),u=e.i(29402),c=e.i(15768),s=e.i(97052),f=e.i(36159),d=e.i(22016),p=e.i(69642),h=e.i(53653),_=e.i(20592);let v=[];function y(e){return _.default.materials[e].map(e=>{var t;if(e.hidden||!1===e.selectable)return null;let r=null!=(t=e.file)?t:e.name;if(r)if("number"==typeof e.frameCount&&e.frameCount>1)return Array(e.frameCount).fill(r).map((e,t)=>{if(!(t>0))return e;{let r=/^(.+[^\d])(\d{2,})$/.exec(e);if(r){let e=r[1],n=r[2];return"".concat(e).concat(t.toString().padStart(n.length,"0"))}throw Error("frameCount > 0, but could not parse index")}});else return r}).flat().filter(e=>null!=e).map(e=>"".concat(e,".png"))}let g={lmale:0,mmale:1,lfemale:2,mfemale:3,hmale:4,lbioderm:5,mbioderm:6,hbioderm:7,energy:8,disc:9,chaingun:10,grenade_launcher:11,sniper:12,elf:13,shocklance:14,plasmathrower:15,missile:16,mortar:17,repair:18,targeting:19,vehicle_grav_scout:20,vehicle_grav_tank:21,turret_assaulttank_mortar:22,vehicle_land_mpbbase:23,vehicle_air_scout:24,vehicle_air_bomber:25,vehicle_air_hapc:26};function m(){var e,n,_;let m=(0,i.useRouter)(),b=(0,i.usePathname)(),j=(0,i.useSearchParams)(),[w,x]=(0,c.default)(),[O,k]=(0,r.useState)("lmale"),[P,S]=(0,r.useState)(!1),T="hfemale"===O?"hmale":O,C=null!=(_=null==(e=w.customSkins)?void 0:e[T])?_:v,E="new"===O,A=null==w||null==(n=w.packs)?void 0:n[O],L=null!=A;(0,r.useEffect)(()=>{if(A&&P){let e=!1;return(async()=>{let t=await (0,p.collectFiles)(A.files);if(!e){let r=(0,p.createZipFile)(t);await new Promise(e=>setTimeout(e,500)),e||await (0,p.saveZipFile)(r,"zSkinPack-".concat(O,"-v").concat(A.version,".vl2")),e||S(!1)}})(),()=>{e=!0,S(!1)}}},[P,A,O]);let N=(0,r.useMemo)(()=>{var e;return(0,u.default)(Object.keys(null!=(e=null==w?void 0:w.packs)?e:{}),e=>e.toLowerCase(),["asc"])},[w]),M=(0,r.useMemo)(()=>{var e,t;let r=E?null==w?void 0:w.newSkins:L?null==w||null==(t=w.packs)||null==(e=t[O])?void 0:e.skins:null;if(!r)return[];let n=[];return Object.entries(r).forEach(e=>{let[t,r]=e;n.push(...r.map(e=>({name:e,model:t})))}),(0,u.default)(n,[e=>e.name.toLowerCase(),e=>g[e.model]],["asc","asc"])},[E,L,O,w]),z=E||L?M:C,F=j.get("filter")||"lmale";return(0,r.useEffect)(()=>{S(!1),k(F)},[F]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.default,{children:(0,t.jsx)("title",{children:"Tribes 2 Skin Gallery"})}),(0,t.jsxs)("main",{className:s.default.GalleryPage,children:[(0,t.jsxs)("div",{className:s.default.Tools,children:[(0,t.jsxs)(d.default,{className:s.default.Back,href:"../",children:[(0,t.jsx)(l.FaChevronLeft,{size:12,className:s.default.Icon})," ",(0,t.jsx)("span",{className:s.default.Label,children:"Back to Editor"})]}),(0,t.jsxs)("select",{tabIndex:0,id:"ModelSelect","aria-label":"Player model",onChange:e=>{m.push("".concat(b,"?filter=").concat(e.target.value))},value:O,children:[(0,t.jsx)("option",{value:"new",children:"All new skins ✨"}),(0,t.jsx)("optgroup",{label:"Packs",children:N.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsxs)("optgroup",{label:"Players","data-model-type":"player",children:[(0,t.jsx)("option",{value:"lmale",children:"Human Male • Light"}),(0,t.jsx)("option",{value:"mmale",children:"Human Male • Medium"}),(0,t.jsx)("option",{value:"hmale",children:"Human Male • Heavy"}),(0,t.jsx)("option",{value:"lfemale",children:"Human Female • Light"}),(0,t.jsx)("option",{value:"mfemale",children:"Human Female • Medium"}),(0,t.jsx)("option",{value:"hfemale",children:"Human Female • Heavy"}),(0,t.jsx)("option",{value:"lbioderm",children:"Bioderm • Light"}),(0,t.jsx)("option",{value:"mbioderm",children:"Bioderm • Medium"}),(0,t.jsx)("option",{value:"hbioderm",children:"Bioderm • Heavy"})]}),(0,t.jsxs)("optgroup",{label:"Weapons","data-model-type":"weapon",children:[(0,t.jsx)("option",{value:"disc",children:"Disc Launcher"}),(0,t.jsx)("option",{value:"chaingun",children:"Chaingun"}),(0,t.jsx)("option",{value:"grenade_launcher",children:"Grenade Launcher"}),(0,t.jsx)("option",{value:"sniper",children:"Laser Rifle"}),(0,t.jsx)("option",{value:"plasmathrower",children:"Plasma Cannon"}),(0,t.jsx)("option",{value:"energy",children:"Blaster"}),(0,t.jsx)("option",{value:"shocklance",children:"Shocklance"}),(0,t.jsx)("option",{value:"elf",children:"ELF Projector"}),(0,t.jsx)("option",{value:"missile",children:"Missile Launcher"}),(0,t.jsx)("option",{value:"mortar",children:"Mortar"}),(0,t.jsx)("option",{value:"repair",children:"Repair Pack"}),(0,t.jsx)("option",{value:"targeting",children:"Targeting Laser"})]}),(0,t.jsxs)("optgroup",{label:"Vehicles","data-model-type":"vehicle",children:[(0,t.jsx)("option",{value:"vehicle_grav_scout",children:"Wildcat Grav Cycle"}),(0,t.jsx)("option",{value:"vehicle_grav_tank",children:"Beowulf Assault Tank"}),(0,t.jsx)("option",{value:"vehicle_land_mpbbase",children:"Jericho Mobile Point Base"}),(0,t.jsx)("option",{value:"vehicle_air_scout",children:"Shrike Scout Fighter"}),(0,t.jsx)("option",{value:"vehicle_air_bomber",children:"Thundersword Bomber"}),(0,t.jsx)("option",{value:"vehicle_air_hapc",children:"HAVOC Gunship Transport"})]})]}),(0,t.jsxs)("div",{className:s.default.HeaderEnd,children:[L?(0,t.jsxs)("div",{className:s.default.DownloadSection,children:[(0,t.jsx)("button",{type:"button",className:s.default.DownloadButton,onClick:async()=>{S(!0)},children:"Download"})," ",P?(0,t.jsx)(o,{className:s.default.DownloadSpinner}):(0,t.jsxs)("span",{className:s.default.PackVersion,children:["v",A.version," • ",A.files.length.toLocaleString()," ",1===A.files.length?"file":"files"]})]}):null,(0,t.jsx)("a",{href:"https://github.com/exogen/t2-model-skinner",className:s.default.IconLink,children:(0,t.jsx)(l.FaGithub,{size:32})})]})]}),x?(0,t.jsx)("div",{className:s.default.Gallery,children:z.map(e=>{let r,n;"string"==typeof e?(r=e,n=T):(r=e.name,n=e.model);let o="".concat("https://exogen.github.io/t2-skins","/gallery/").concat(encodeURIComponent(r),".").concat(n,".webp");return(0,t.jsxs)("div",{className:s.default.Skin,children:[(0,t.jsx)("img",{className:s.default.Preview,loading:"lazy",src:o,width:680,height:800,alt:r}),(0,t.jsxs)("div",{className:s.default.Detail,children:[(0,t.jsx)(d.default,{className:s.default.LoadInEditor,href:"/?m=".concat(n,"&s=").concat(encodeURIComponent(r)),children:(0,t.jsx)(a.BsBadge3dFill,{title:"Load in Editor","aria-label":"Load in Editor"})}),(0,t.jsx)("span",{className:s.default.Name,children:r}),(0,t.jsx)("button",{type:"button",className:s.default.DownloadSkin,title:"Download ".concat(r," set"),"aria-label":"Download ".concat(r," set"),onClick:async()=>{let e=(0,h.modelToModelType)(n),t=n.replace(/(?:^([a-z])|_([a-z]))/g,(e,t,r)=>(t||r).toUpperCase()),o="",a=[];switch(e){case"player":o="zPlayerSkin-".concat(r,".vl2"),a=h.modelTypes.player.filter(e=>w.customSkins[e].includes(r)).map(e=>"".concat(r,".").concat(e,".png"));break;case"weapon":o="zWeapon".concat(t,"-").concat(r,".vl2"),a=y(n).map(e=>"".concat(r,"/").concat(e));break;case"vehicle":o="z".concat(t,"-").concat(r,".vl2"),a=y(n).map(e=>"".concat(r,"/").concat(e))}if(a.length){let e=await (0,p.collectFiles)(a,{skipNotFound:!0}),t=(0,p.createZipFile)(e);await (0,p.saveZipFile)(t,o)}},children:(0,t.jsx)(l.FaDownload,{})})]})]},"".concat(r,":").concat(n))})}):(0,t.jsx)(o,{className:s.default.Spinner})]})]})}function b(){return(0,t.jsx)(r.Suspense,{children:(0,t.jsx)(m,{})})}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/b12a108b39c3ccf5.js b/docs/_next/static/chunks/b12a108b39c3ccf5.js deleted file mode 100644 index 5654147..0000000 --- a/docs/_next/static/chunks/b12a108b39c3ccf5.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18566,(t,e,r)=>{e.exports=t.r(76562)},40141,11152,15768,t=>{"use strict";t.s(["GenIcon",()=>l],40141);var e=t.i(71645),r={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},c=e.default.createContext&&e.default.createContext(r),a=["attr","size","title"];function n(){return(n=Object.assign.bind()).apply(this,arguments)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);e&&(c=c.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,c)}return r}function i(t){for(var e=1;ee.default.createElement(u,n({attr:i({},t.attr)},r),function t(r){return r&&r.map((r,c)=>e.default.createElement(r.tag,i({key:c},r.attr),t(r.child)))}(t.child))}function u(t){var o=r=>{var c,{attr:o,size:l,title:u}=t,s=function(t,e){if(null==t)return{};var r,c,a=function(t,e){if(null==t)return{};var r={};for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)){if(e.indexOf(c)>=0)continue;r[c]=t[c]}return r}(t,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(c=0;c=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}(t,a),h=l||r.size||"1em";return r.className&&(c=r.className),t.className&&(c=(c?c+" ":"")+t.className),e.default.createElement("svg",n({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,o,s,{className:c,style:i(i({color:t.color||r.color},r.style),t.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),u&&e.default.createElement("title",null,u),t.children)};return void 0!==c?e.default.createElement(c.Consumer,null,t=>o(t)):o(r)}function s(t){return l({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"},child:[]}]})(t)}function h(t){return l({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"},child:[]}]})(t)}function v(t){return l({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(t)}function f(t){return l({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(t)}function d(t){return l({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function g(t){return l({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function p(t){return l({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"},child:[]}]})(t)}function m(t){return l({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"},child:[]}]})(t)}function b(t){return l({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"},child:[]}]})(t)}function y(t){return l({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z"},child:[]}]})(t)}t.s(["FaAngleDown",()=>h,"FaArrowDown",()=>v,"FaArrowUp",()=>f,"FaChevronLeft",()=>d,"FaChevronRight",()=>g,"FaFolderOpen",()=>p,"FaGithub",()=>s,"FaLock",()=>m,"FaTrashAlt",()=>b,"FaUnlock",()=>y],11152),t.s(["default",()=>O],15768);let w={customSkins:{},newSkins:{},packs:{}};function O(){let[t,r]=(0,e.useState)(w);(0,e.useEffect)(()=>{let t=new AbortController,e=t.signal,c=!1;return(async()=>{let t;try{if(t=await fetch("".concat("https://exogen.github.io/t2-skins","/skins.json"),{signal:e}),!c){let e=await t.json();c||r(e)}}catch(t){console.error(t)}})(),()=>{c=!0,t.signal.aborted||t.abort()}},[]);let c=t!==w;return[t,c]}}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/3952d3ec98949fe5.css b/docs/_next/static/chunks/c45ca2566aefbdb7.css similarity index 54% rename from docs/_next/static/chunks/3952d3ec98949fe5.css rename to docs/_next/static/chunks/c45ca2566aefbdb7.css index 3d395fd..a5765b0 100644 --- a/docs/_next/static/chunks/3952d3ec98949fe5.css +++ b/docs/_next/static/chunks/c45ca2566aefbdb7.css @@ -1 +1 @@ -.gallery-module__zlwOTG__GalleryPage{flex-direction:column}.gallery-module__zlwOTG__Tools{text-align:center;z-index:2;background:rgba(0,0,0,.7);flex:none;grid-template-columns:1fr auto 1fr;align-items:center;padding:10px;display:grid;position:-webkit-sticky;position:sticky;top:0}.gallery-module__zlwOTG__Tools select:focus{outline:none;box-shadow:0 0 1px 1px rgba(0,0,0,.5),0 0 2px 3px #98ffd4}.gallery-module__zlwOTG__HeaderEnd{justify-content:space-between;align-items:center;margin-left:10px;display:flex}.gallery-module__zlwOTG__DownloadSection{align-items:center;gap:8px;display:flex}.gallery-module__zlwOTG__PackVersion{color:rgba(127,180,166,.6);font-size:11px}.gallery-module__zlwOTG__DownloadButton{color:#f7ffdc;letter-spacing:-.03em;text-shadow:0 -1px rgba(25,39,34,.4);cursor:pointer;background:0 0,linear-gradient(#43a782,#0f5957);border:0;border-radius:4px;margin-left:3px;padding:4px 8px 5px;font-size:13px;font-weight:500;text-decoration:none;display:inline-block}.gallery-module__zlwOTG__DownloadButton:active{transform:translateY(1px)}.gallery-module__zlwOTG__Back{color:#fff;justify-self:start;align-items:center;gap:4px;font-size:14px;text-decoration:none;display:inline-flex}.gallery-module__zlwOTG__IconLink{color:rgba(255,255,255,.3);place-content:center;justify-self:end;margin-left:auto;display:grid}.gallery-module__zlwOTG__IconLink:hover{color:#fff}.gallery-module__zlwOTG__Gallery{background:#0c1f28;flex:none;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));width:100%;display:grid}.gallery-module__zlwOTG__Skin{text-align:center;padding-bottom:32px;font-size:12px;position:relative;overflow:hidden}.gallery-module__zlwOTG__Preview{width:100%;height:auto;display:block}.gallery-module__zlwOTG__Name{white-space:nowrap;color:#fff;opacity:.5;background:rgba(0,0,0,.5);border-radius:9999px;padding:3px 10px;display:inline-block;position:absolute;bottom:16px;left:50%;transform:translate(-50%)}.gallery-module__zlwOTG__Skin:hover .gallery-module__zlwOTG__Name{opacity:1}@keyframes gallery-module__zlwOTG__spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.gallery-module__zlwOTG__Spinner{flex:none;margin:auto;font-size:64px;animation:2s linear infinite gallery-module__zlwOTG__spin}.gallery-module__zlwOTG__DownloadSpinner{flex:none;margin:auto;font-size:20px;animation:2s linear infinite gallery-module__zlwOTG__spin}@media (max-width:479px){.gallery-module__zlwOTG__Back .gallery-module__zlwOTG__Label,.gallery-module__zlwOTG__DownloadButton{display:none}}@media (max-width:719px){.gallery-module__zlwOTG__PackVersion{display:none}} +.gallery-module__zlwOTG__GalleryPage{flex-direction:column}.gallery-module__zlwOTG__Tools{text-align:center;z-index:2;background:rgba(0,0,0,.7);flex:none;grid-template-columns:1fr auto 1fr;align-items:center;padding:10px;display:grid;position:-webkit-sticky;position:sticky;top:0}.gallery-module__zlwOTG__Tools select:focus{outline:none;box-shadow:0 0 1px 1px rgba(0,0,0,.5),0 0 2px 3px #98ffd4}.gallery-module__zlwOTG__HeaderEnd{justify-content:space-between;align-items:center;margin-left:10px;display:flex}.gallery-module__zlwOTG__DownloadSection{align-items:center;gap:8px;display:flex}.gallery-module__zlwOTG__PackVersion{color:rgba(127,180,166,.6);font-size:11px}.gallery-module__zlwOTG__DownloadButton{color:#f7ffdc;letter-spacing:-.03em;text-shadow:0 -1px rgba(25,39,34,.4);cursor:pointer;background:0 0,linear-gradient(#43a782,#0f5957);border:0;border-radius:4px;margin-left:3px;padding:4px 8px 5px;font-size:13px;font-weight:500;text-decoration:none;display:inline-block}.gallery-module__zlwOTG__DownloadButton:active{transform:translateY(1px)}.gallery-module__zlwOTG__Back{color:#fff;justify-self:start;align-items:center;gap:4px;font-size:14px;text-decoration:none;display:inline-flex}.gallery-module__zlwOTG__IconLink{color:rgba(255,255,255,.3);place-content:center;justify-self:end;margin-left:auto;display:grid}.gallery-module__zlwOTG__IconLink:hover{color:#fff}.gallery-module__zlwOTG__Gallery{background:#0c1f28;flex:none;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));width:100%;display:grid}.gallery-module__zlwOTG__Skin{text-align:center;padding-bottom:32px;font-size:12px;position:relative;overflow:hidden}.gallery-module__zlwOTG__Preview{width:100%;height:auto;display:block}.gallery-module__zlwOTG__Detail{background:rgba(0,0,0,.2);border-radius:6px;justify-content:space-between;align-items:center;gap:8px;padding:5px 9px;display:flex;position:absolute;bottom:8px;left:6px;right:6px;box-shadow:inset 0 1px 10px rgba(0,0,0,.3)}.gallery-module__zlwOTG__LoadInEditor,.gallery-module__zlwOTG__DownloadSkin{color:#28d9b2;visibility:hidden;place-content:center;font-size:24px;display:grid}.gallery-module__zlwOTG__DownloadSkin{cursor:pointer;background:0 0;border:0;margin:0;padding:0;font-size:17px}.gallery-module__zlwOTG__Detail:hover .gallery-module__zlwOTG__LoadInEditor,.gallery-module__zlwOTG__Detail:hover .gallery-module__zlwOTG__DownloadSkin{visibility:visible}.gallery-module__zlwOTG__Name{white-space:nowrap;color:rgba(158,192,209,.9);border-radius:9999px;padding:3px 10px}.gallery-module__zlwOTG__Detail:hover .gallery-module__zlwOTG__Name{color:#fff}@keyframes gallery-module__zlwOTG__spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.gallery-module__zlwOTG__Spinner{flex:none;margin:auto;font-size:64px;animation:2s linear infinite gallery-module__zlwOTG__spin}.gallery-module__zlwOTG__DownloadSpinner{flex:none;margin:auto;font-size:20px;animation:2s linear infinite gallery-module__zlwOTG__spin}@media (max-width:479px){.gallery-module__zlwOTG__Back .gallery-module__zlwOTG__Label,.gallery-module__zlwOTG__DownloadButton{display:none}}@media (max-width:719px){.gallery-module__zlwOTG__PackVersion{display:none}} diff --git a/docs/_next/static/chunks/e6e166ba82cc0d62.js b/docs/_next/static/chunks/e6e166ba82cc0d62.js new file mode 100644 index 0000000..c4833f9 --- /dev/null +++ b/docs/_next/static/chunks/e6e166ba82cc0d62.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,40141,e=>{"use strict";e.s(["GenIcon",()=>o],40141);var t=e.i(71645),a={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},r=t.default.createContext&&t.default.createContext(a),n=["attr","size","title"];function c(){return(c=Object.assign.bind()).apply(this,arguments)}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function i(e){for(var t=1;tt.default.createElement(s,c({attr:i({},e.attr)},a),function e(a){return a&&a.map((a,r)=>t.default.createElement(a.tag,i({key:r},a.attr),e(a.child)))}(e.child))}function s(e){var l=a=>{var r,{attr:l,size:o,title:s}=e,u=function(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;a[r]=e[r]}return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}(e,n),h=o||a.size||"1em";return a.className&&(r=a.className),e.className&&(r=(r?r+" ":"")+e.className),t.default.createElement("svg",c({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,l,u,{className:r,style:i(i({color:e.color||a.color},a.style),e.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),s&&t.default.createElement("title",null,s),e.children)};return void 0!==r?t.default.createElement(r.Consumer,null,e=>l(e)):l(a)}},11152,e=>{"use strict";e.s(["FaAngleDown",()=>r,"FaArrowDown",()=>n,"FaArrowUp",()=>c,"FaChevronLeft",()=>l,"FaChevronRight",()=>i,"FaDownload",()=>o,"FaFolderOpen",()=>s,"FaGithub",()=>a,"FaLock",()=>u,"FaTrashAlt",()=>h,"FaUnlock",()=>m]);var t=e.i(40141);function a(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"},child:[]}]})(e)}function r(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"},child:[]}]})(e)}function n(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(e)}function c(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(e)}function l(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(e)}function i(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(e)}function o(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(e)}function s(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"},child:[]}]})(e)}function u(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"},child:[]}]})(e)}function h(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"},child:[]}]})(e)}function m(e){return(0,t.GenIcon)({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z"},child:[]}]})(e)}},20592,e=>{"use strict";e.s(["default",()=>t]);let t=e.i(29947).default},90106,e=>{"use strict";e.s(["BsBadge3dFill",()=>r,"BsFillGrid3X3GapFill",()=>a]);var t=e.i(40141);function a(e){return(0,t.GenIcon)({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M1 2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zM1 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zM1 12a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1z"},child:[]}]})(e)}function r(e){return(0,t.GenIcon)({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M10.157 5.968h-.844v4.06h.844c1.116 0 1.621-.667 1.621-2.02 0-1.354-.51-2.04-1.621-2.04"},child:[]},{tag:"path",attr:{d:"M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm5.184 4.368c.646 0 1.055.378 1.06.9.008.537-.427.919-1.086.919-.598-.004-1.037-.325-1.068-.756H3c.03.914.791 1.688 2.153 1.688 1.24 0 2.285-.66 2.272-1.798-.013-.953-.747-1.38-1.292-1.432v-.062c.44-.07 1.125-.527 1.108-1.375-.013-.906-.8-1.57-2.053-1.565-1.31.005-2.043.734-2.074 1.67h1.103c.022-.391.383-.751.936-.751.532 0 .928.33.928.813.004.479-.383.835-.928.835h-.632v.914zM8.126 11h2.189C12.125 11 13 9.893 13 7.985c0-1.894-.861-2.984-2.685-2.984H8.126z"},child:[]}]})(e)}},53653,e=>{"use strict";let t;e.s(["importMultipleFilesToModels",()=>u,"modelToModelType",()=>l,"modelTypes",()=>c]);var a=e.i(71315);let r=e.i(20592).default.materials,n=/^(\.|__MACOSX)/,c={player:["lmale","mmale","hmale","lfemale","mfemale","hfemale","lbioderm","mbioderm","hbioderm"],weapon:["disc","chaingun","grenade_launcher","sniper","plasmathrower","energy","shocklance","elf","missile","mortar","repair","targeting","mine"],vehicle:["vehicle_grav_scout","vehicle_grav_tank","vehicle_land_mpbbase","vehicle_air_scout","vehicle_air_bomber","vehicle_air_hapc"]};function l(e){switch(e){case"lmale":case"mmale":case"hmale":case"lfemale":case"mfemale":case"hfemale":case"lbioderm":case"mbioderm":case"hbioderm":return"player";case"disc":case"chaingun":case"grenade_launcher":case"sniper":case"plasmathrower":case"energy":case"shocklance":case"elf":case"missile":case"mortar":case"repair":case"targeting":case"mine":return"weapon";case"vehicle_grav_scout":case"vehicle_grav_tank":case"vehicle_land_mpbbase":case"vehicle_air_scout":case"vehicle_air_bomber":case"vehicle_air_hapc":return"vehicle";default:throw Error("Unknown model")}}async function i(e){let t=await a.default.loadAsync(e);return(await Promise.all(Object.entries(t.files).map(async e=>{let[t,a]=e;if(!n.test(t)&&/\.png$/i.exec(t)){let e=await a.async("base64");return{path:t,imageUrl:"data:image/png;base64,".concat(e)}}}))).filter(e=>!!e)}async function o(e){return new Promise((t,a)=>{let r=new FileReader;r.addEventListener("load",e=>{var r;"string"==typeof(null==(r=e.target)?void 0:r.result)?t(e.target.result):a()}),r.addEventListener("error",e=>{a()}),r.readAsDataURL(e)})}async function s(e){return(await Promise.all(Array.from(e).map(async e=>{var t;if(n.test(e.name))return null;switch((t=e).name.match(/\.png$/i)?"png":t.name.match(/\.zip$/i)?"zip":t.name.match(/\.vl2$/i)?"vl2":void 0){case"zip":case"vl2":{let t=e.name.match(/^(.+)\.(zip|vl2)$/i),a=t?t[1]:e.name;return(await i(e)).map(t=>({...t,path:"".concat(e.name,"/").concat(t.path),name:a}))}case"png":return{path:e.name,imageUrl:await o(e),name:null};default:return null}}))).flat().filter(e=>!!e)}async function u(e){var a=await s(e);let n=new Map;return a.forEach(e=>{let a=function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t||(t=function(){let e=new Map;for(let t in r)r[t].forEach((a,r)=>{let n;if(a.fileSuffix?n=a.fileSuffix:!1!==a.selectable&&!0!==a.hidden&&(a.file||a.name)&&(n=a.file||a.name),n){var c;let l=null!=(c=e.get(n))?c:[];l.push({modelName:t,material:a,index:r}),e.set(n,l)}});return e}());let n=e.split("/").slice(-1)[0],c=n.match(/^(.+)\.(PNG|png)$/);if(c){let r=c[1],l=r.split(".");if(l.length>1){let a=".".concat(l[l.length-1]),i=t.get(a);if(i)return{path:e,basename:n,nameWithoutExtension:r,extension:c[2],skinName:l.slice(0,l.length-1).join("."),models:i}}else{let i=function(e){let a=/^(.+[^\d])(\d{2,})$/.exec(e);if(a){var r;let e=a[1],n=a[2],c=parseInt(n,10),l="".concat(e).concat("0".padStart(n.length,"0"));return(null!=(r=t.get(l))?r:[]).filter(e=>"number"==typeof e.material.frameCount).map(e=>({...e,frameIndex:c}))}return[]}(l[0]);if(i.length)return{path:e,basename:n,nameWithoutExtension:r,extension:c[2],skinName:a,models:i};{let i=t.get(l[0]);if(i)return{path:e,basename:n,nameWithoutExtension:r,extension:c[2],skinName:a,models:i}}}}return null}(e.path,e.name);a&&a.models.forEach(t=>{var r,c,l,i,o;let s=null!=(r=n.get(t.modelName))?r:new Map,u=null!=(c=s.get(a.skinName))?c:{name:a.skinName,isComplete:null,materials:new Map},h=null!=(l=t.material.file)?l:t.material.name,m=null!=(i=u.materials.get(h))?i:[];m[null!=(o=t.frameIndex)?o:0]=e.imageUrl,u.materials.set(h,m),s.set(a.skinName,u),n.set(t.modelName,s)})}),n.forEach((e,t)=>{let a=r[t].filter(e=>!1!==e.selectable&&!0!==e.hidden&&!0!==e.optional);e.forEach(e=>{e.isComplete=a.every(t=>{var a;return e.materials.has(null!=(a=t.file)?a:t.name)})})}),n}},15768,e=>{"use strict";e.s(["default",()=>r]);var t=e.i(71645);let a={customSkins:{},newSkins:{},packs:{}};function r(){let[e,r]=(0,t.useState)(a);(0,t.useEffect)(()=>{let e=new AbortController,t=e.signal,a=!1;return(async()=>{let e;try{if(e=await fetch("".concat("https://exogen.github.io/t2-skins","/skins.json"),{signal:t}),!a){let t=await e.json();a||r(t)}}catch(e){console.error(e)}})(),()=>{a=!0,e.signal.aborted||e.abort()}},[]);let n=e!==a;return[e,n]}},18566,(e,t,a)=>{t.exports=e.r(76562)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/ec0a6a943ec3891b.js b/docs/_next/static/chunks/ec0a6a943ec3891b.js deleted file mode 100644 index fe6b5bc..0000000 --- a/docs/_next/static/chunks/ec0a6a943ec3891b.js +++ /dev/null @@ -1 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,40141,11152,15768,t=>{"use strict";t.s(["GenIcon",()=>l],40141);var e=t.i(71645),r={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},c=e.default.createContext&&e.default.createContext(r),a=["attr","size","title"];function n(){return(n=Object.assign.bind()).apply(this,arguments)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);e&&(c=c.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,c)}return r}function i(t){for(var e=1;ee.default.createElement(u,n({attr:i({},t.attr)},r),function t(r){return r&&r.map((r,c)=>e.default.createElement(r.tag,i({key:c},r.attr),t(r.child)))}(t.child))}function u(t){var o=r=>{var c,{attr:o,size:l,title:u}=t,s=function(t,e){if(null==t)return{};var r,c,a=function(t,e){if(null==t)return{};var r={};for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)){if(e.indexOf(c)>=0)continue;r[c]=t[c]}return r}(t,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(c=0;c=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}(t,a),h=l||r.size||"1em";return r.className&&(c=r.className),t.className&&(c=(c?c+" ":"")+t.className),e.default.createElement("svg",n({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,o,s,{className:c,style:i(i({color:t.color||r.color},r.style),t.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),u&&e.default.createElement("title",null,u),t.children)};return void 0!==c?e.default.createElement(c.Consumer,null,t=>o(t)):o(r)}function s(t){return l({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"},child:[]}]})(t)}function h(t){return l({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"},child:[]}]})(t)}function v(t){return l({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"},child:[]}]})(t)}function f(t){return l({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"},child:[]}]})(t)}function d(t){return l({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function g(t){return l({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function p(t){return l({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"},child:[]}]})(t)}function m(t){return l({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"},child:[]}]})(t)}function b(t){return l({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"},child:[]}]})(t)}function y(t){return l({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z"},child:[]}]})(t)}t.s(["FaAngleDown",()=>h,"FaArrowDown",()=>v,"FaArrowUp",()=>f,"FaChevronLeft",()=>d,"FaChevronRight",()=>g,"FaFolderOpen",()=>p,"FaGithub",()=>s,"FaLock",()=>m,"FaTrashAlt",()=>b,"FaUnlock",()=>y],11152),t.s(["default",()=>O],15768);let w={customSkins:{},newSkins:{},packs:{}};function O(){let[t,r]=(0,e.useState)(w);(0,e.useEffect)(()=>{let t=new AbortController,e=t.signal,c=!1;return(async()=>{let t;try{if(t=await fetch("".concat("https://exogen.github.io/t2-skins","/skins.json"),{signal:e}),!c){let e=await t.json();c||r(e)}}catch(t){console.error(t)}})(),()=>{c=!0,t.signal.aborted||t.abort()}},[]);let c=t!==w;return[t,c]}},18566,(t,e,r)=>{e.exports=t.r(76562)}]); \ No newline at end of file diff --git a/docs/gallery/index.html b/docs/gallery/index.html index a652375..60998a8 100644 --- a/docs/gallery/index.html +++ b/docs/gallery/index.html @@ -1 +1 @@ -T2 Model Viewer & Skinner \ No newline at end of file +T2 Model Viewer & Skinner \ No newline at end of file diff --git a/docs/gallery/index.txt b/docs/gallery/index.txt index 1cb88c6..cf7c13d 100644 --- a/docs/gallery/index.txt +++ b/docs/gallery/index.txt @@ -2,7 +2,7 @@ 2:I[39756,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"default"] 3:I[37457,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"default"] 4:I[47257,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"ClientPageRoot"] -5:I[25500,["/t2-model-skinner/_next/static/chunks/395c2bae735f87a6.js","/t2-model-skinner/_next/static/chunks/d63fc3798baf75bd.js","/t2-model-skinner/_next/static/chunks/b12a108b39c3ccf5.js","/t2-model-skinner/_next/static/chunks/642c9f483a155826.js"],"default"] +5:I[25500,["/t2-model-skinner/_next/static/chunks/71f10e2893d67a3c.js","/t2-model-skinner/_next/static/chunks/d63fc3798baf75bd.js","/t2-model-skinner/_next/static/chunks/0c04e859c9299853.js","/t2-model-skinner/_next/static/chunks/9a2f1a7f288f6fd4.js"],"default"] 8:I[97367,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"OutletBoundary"] a:I[11533,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"AsyncMetadataOutlet"] c:I[97367,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"ViewportBoundary"] @@ -10,8 +10,8 @@ e:I[97367,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-mode f:"$Sreact.suspense" 11:I[68027,[],"default"] :HL["/t2-model-skinner/_next/static/chunks/795c34bef1c92210.css","style"] -:HL["/t2-model-skinner/_next/static/chunks/3952d3ec98949fe5.css","style"] -0:{"P":null,"b":"fFTlXrZYVpcjc_RZhmTtF","p":"/t2-model-skinner","c":["","gallery",""],"i":false,"f":[[["",{"children":["gallery",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/795c34bef1c92210.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]]}],{"children":["gallery",["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$L4",null,{"Component":"$5","searchParams":{},"params":{},"promises":["$@6","$@7"]}],[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/3952d3ec98949fe5.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-model-skinner/_next/static/chunks/395c2bae735f87a6.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-model-skinner/_next/static/chunks/d63fc3798baf75bd.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-model-skinner/_next/static/chunks/b12a108b39c3ccf5.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-model-skinner/_next/static/chunks/642c9f483a155826.js","async":true,"nonce":"$undefined"}]],["$","$L8",null,{"children":["$L9",["$","$La",null,{"promise":"$@b"}]]}]]}],{},null,false]},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$Lc",null,{"children":"$Ld"}],null],["$","$Le",null,{"children":["$","div",null,{"hidden":true,"children":["$","$f",null,{"fallback":null,"children":"$L10"}]}]}]]}],false]],"m":"$undefined","G":["$11",[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/795c34bef1c92210.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]]],"s":false,"S":true} +:HL["/t2-model-skinner/_next/static/chunks/c45ca2566aefbdb7.css","style"] +0:{"P":null,"b":"_Pc2wzRd3Ns96p5GjKQsi","p":"/t2-model-skinner","c":["","gallery",""],"i":false,"f":[[["",{"children":["gallery",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/795c34bef1c92210.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]]}],{"children":["gallery",["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","forbidden":"$undefined","unauthorized":"$undefined"}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$L4",null,{"Component":"$5","searchParams":{},"params":{},"promises":["$@6","$@7"]}],[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/c45ca2566aefbdb7.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-model-skinner/_next/static/chunks/71f10e2893d67a3c.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-model-skinner/_next/static/chunks/d63fc3798baf75bd.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-model-skinner/_next/static/chunks/0c04e859c9299853.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-model-skinner/_next/static/chunks/9a2f1a7f288f6fd4.js","async":true,"nonce":"$undefined"}]],["$","$L8",null,{"children":["$L9",["$","$La",null,{"promise":"$@b"}]]}]]}],{},null,false]},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$Lc",null,{"children":"$Ld"}],null],["$","$Le",null,{"children":["$","div",null,{"hidden":true,"children":["$","$f",null,{"fallback":null,"children":"$L10"}]}]}]]}],false]],"m":"$undefined","G":["$11",[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/795c34bef1c92210.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]]],"s":false,"S":true} 6:{} 7:"$0:f:0:1:2:children:2:children:1:props:children:0:props:params" d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]] diff --git a/docs/index.html b/docs/index.html index 0ec72ba..eb77d25 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -T2 Model Viewer & Skinner
\ No newline at end of file +T2 Model Viewer & Skinner
\ No newline at end of file diff --git a/docs/index.txt b/docs/index.txt index 25dde68..5bee361 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -2,7 +2,7 @@ 2:I[39756,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"default"] 3:I[37457,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"default"] 4:I[47257,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"ClientPageRoot"] -5:I[52683,["/t2-model-skinner/_next/static/chunks/7d0d362e234cf43a.js","/t2-model-skinner/_next/static/chunks/d63fc3798baf75bd.js","/t2-model-skinner/_next/static/chunks/a55df98dcb3b60ad.js","/t2-model-skinner/_next/static/chunks/9072f9dc67ad2fb2.js","/t2-model-skinner/_next/static/chunks/ec0a6a943ec3891b.js"],"default"] +5:I[52683,["/t2-model-skinner/_next/static/chunks/33aeca087c4fb9b3.js","/t2-model-skinner/_next/static/chunks/d63fc3798baf75bd.js","/t2-model-skinner/_next/static/chunks/43ceca71888c9b70.js","/t2-model-skinner/_next/static/chunks/e6e166ba82cc0d62.js","/t2-model-skinner/_next/static/chunks/a55df98dcb3b60ad.js"],"default"] 8:I[97367,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"OutletBoundary"] a:I[11533,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"AsyncMetadataOutlet"] c:I[97367,["/t2-model-skinner/_next/static/chunks/ff1a16fafef87110.js","/t2-model-skinner/_next/static/chunks/7dd66bdf8a7e5707.js"],"ViewportBoundary"] @@ -11,7 +11,7 @@ f:"$Sreact.suspense" 11:I[68027,[],"default"] :HL["/t2-model-skinner/_next/static/chunks/795c34bef1c92210.css","style"] :HL["/t2-model-skinner/_next/static/chunks/df18f9fdc6a3cb7c.css","style"] -0:{"P":null,"b":"fFTlXrZYVpcjc_RZhmTtF","p":"/t2-model-skinner","c":["",""],"i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/795c34bef1c92210.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$L4",null,{"Component":"$5","searchParams":{},"params":{},"promises":["$@6","$@7"]}],[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/df18f9fdc6a3cb7c.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-model-skinner/_next/static/chunks/7d0d362e234cf43a.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-model-skinner/_next/static/chunks/d63fc3798baf75bd.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-model-skinner/_next/static/chunks/a55df98dcb3b60ad.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-model-skinner/_next/static/chunks/9072f9dc67ad2fb2.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-model-skinner/_next/static/chunks/ec0a6a943ec3891b.js","async":true,"nonce":"$undefined"}]],["$","$L8",null,{"children":["$L9",["$","$La",null,{"promise":"$@b"}]]}]]}],{},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$Lc",null,{"children":"$Ld"}],null],["$","$Le",null,{"children":["$","div",null,{"hidden":true,"children":["$","$f",null,{"fallback":null,"children":"$L10"}]}]}]]}],false]],"m":"$undefined","G":["$11",[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/795c34bef1c92210.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]]],"s":false,"S":true} +0:{"P":null,"b":"_Pc2wzRd3Ns96p5GjKQsi","p":"/t2-model-skinner","c":["",""],"i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/795c34bef1c92210.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]]}],{"children":["__PAGE__",["$","$1","c",{"children":[["$","$L4",null,{"Component":"$5","searchParams":{},"params":{},"promises":["$@6","$@7"]}],[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/df18f9fdc6a3cb7c.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-model-skinner/_next/static/chunks/33aeca087c4fb9b3.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-model-skinner/_next/static/chunks/d63fc3798baf75bd.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-model-skinner/_next/static/chunks/43ceca71888c9b70.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-model-skinner/_next/static/chunks/e6e166ba82cc0d62.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-model-skinner/_next/static/chunks/a55df98dcb3b60ad.js","async":true,"nonce":"$undefined"}]],["$","$L8",null,{"children":["$L9",["$","$La",null,{"promise":"$@b"}]]}]]}],{},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$Lc",null,{"children":"$Ld"}],null],["$","$Le",null,{"children":["$","div",null,{"hidden":true,"children":["$","$f",null,{"fallback":null,"children":"$L10"}]}]}]]}],false]],"m":"$undefined","G":["$11",[["$","link","0",{"rel":"stylesheet","href":"/t2-model-skinner/_next/static/chunks/795c34bef1c92210.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]]],"s":false,"S":true} 6:{} 7:"$0:f:0:1:2:children:1:props:children:0:props:params" d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]] diff --git a/src/app/gallery/gallery.module.css b/src/app/gallery/gallery.module.css index 2249891..8dd5246 100644 --- a/src/app/gallery/gallery.module.css +++ b/src/app/gallery/gallery.module.css @@ -103,22 +103,53 @@ height: auto; } -.Name { +.Detail { position: absolute; - bottom: 16px; - left: 50%; - transform: translate(-50%, 0); - display: inline-block; - white-space: nowrap; - color: #fff; - background: rgba(0, 0, 0, 0.5); - padding: 3px 10px; - border-radius: 9999px; - opacity: 0.5; + bottom: 8px; + left: 6px; + right: 6px; + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + border-radius: 6px; + background: rgba(0, 0, 0, 0.2); + padding: 5px 9px; + box-shadow: inset 0 1px 10px rgba(0, 0, 0, 0.3); } -.Skin:hover .Name { - opacity: 1; +.LoadInEditor, +.DownloadSkin { + display: grid; + place-content: center; + font-size: 24px; + color: rgb(40, 217, 178); + visibility: hidden; +} + +.DownloadSkin { + border: 0; + background: transparent; + font-size: 17px; + margin: 0; + padding: 0; + cursor: pointer; +} + +.Detail:hover .LoadInEditor, +.Detail:hover .DownloadSkin { + visibility: visible; +} + +.Name { + padding: 3px 10px; + border-radius: 9999px; + white-space: nowrap; + color: rgba(158, 192, 209, 0.9); +} + +.Detail:hover .Name { + color: #fff; } @keyframes spin { diff --git a/src/app/gallery/page.tsx b/src/app/gallery/page.tsx index e5ad44d..4eb9272 100644 --- a/src/app/gallery/page.tsx +++ b/src/app/gallery/page.tsx @@ -1,6 +1,8 @@ "use client"; import { Suspense, useEffect, useMemo, useState } from "react"; import { CgSpinnerTwo } from "react-icons/cg"; +import { BsBadge3dFill } from "react-icons/bs"; +import { FaDownload } from "react-icons/fa"; import { FaChevronLeft, FaGithub } from "react-icons/fa"; import { useRouter, usePathname, useSearchParams } from "next/navigation"; import orderBy from "lodash.orderby"; @@ -9,10 +11,50 @@ import styles from "./gallery.module.css"; import Head from "next/head"; import Link from "next/link"; import { collectFiles, createZipFile, saveZipFile } from "../../exportUtils"; +import { modelToModelType, modelTypes } from "../../importUtils"; +import modelConfig from "../../models"; const baseManifestPath = `https://exogen.github.io/t2-skins`; const emptySkins: string[] = []; +function modelToFileList(modelName: string) { + return modelConfig.materials[modelName] + .map((material) => { + if (material.hidden || material.selectable === false) { + return null; + } + const file = material.file ?? material.name; + if (file) { + if ( + typeof material.frameCount === "number" && + material.frameCount > 1 + ) { + return new Array(material.frameCount) + .fill(file) + .map((fileName, i) => { + if (i > 0) { + const match = /^(.+[^\d])(\d{2,})$/.exec(fileName); + if (match) { + const head = match[1]; + const tail = match[2]; + return `${head}${i.toString().padStart(tail.length, "0")}`; + } else { + throw new Error("frameCount > 0, but could not parse index"); + } + } else { + return fileName; + } + }); + } else { + return file; + } + } + }) + .flat() + .filter((fileName) => fileName != null) + .map((fileName) => `${fileName}.png`); +} + const modelOrder: Record = { lmale: 0, mmale: 1, @@ -85,9 +127,7 @@ function Gallery() { if (!ignore) { await saveZipFile( zip, - `zSkinPack-${selectedModel.replace(/ /g, "_")}-v${ - pack.version - }.vl2` + `zSkinPack-${selectedModel}-v${pack.version}.vl2` ); } if (!ignore) { @@ -246,11 +286,7 @@ function Gallery() { )}.${skinModel}.webp`; return ( - +
{skinName} -
{skinName}
- +
+ + + + {skinName} + +
+
); })} diff --git a/src/exportUtils.ts b/src/exportUtils.ts index 7206e03..477af28 100644 --- a/src/exportUtils.ts +++ b/src/exportUtils.ts @@ -22,13 +22,23 @@ export function savePngFile(imageUrl: string, name: string) { saveAs(imageUrl, name); } -export async function collectFiles(files: string[]) { - return await Promise.all( +export async function collectFiles( + files: string[], + { skipNotFound = false }: { skipNotFound?: boolean } = {} +) { + const results = await Promise.all( files.map(async (fileName) => { const url = `${basePath}/${fileName}`; const res = await fetch(url); + if (!res.ok) { + if (skipNotFound) { + return null; + } + throw new Error(`Response failed: ${res.status} ${res.statusText}`); + } const arrayBuffer = await res.arrayBuffer(); return { name: fileName, data: arrayBuffer }; }) ); + return results.filter((fileInfo) => fileInfo != null); } diff --git a/src/importUtils.ts b/src/importUtils.ts index cfdca74..2d58399 100644 --- a/src/importUtils.ts +++ b/src/importUtils.ts @@ -15,6 +15,43 @@ const materialMap: Record = modelConfig.materials; const ignoreFilePattern = /^(\.|__MACOSX)/; +export const modelTypes = { + player: [ + "lmale", + "mmale", + "hmale", + "lfemale", + "mfemale", + "hfemale", + "lbioderm", + "mbioderm", + "hbioderm", + ], + weapon: [ + "disc", + "chaingun", + "grenade_launcher", + "sniper", + "plasmathrower", + "energy", + "shocklance", + "elf", + "missile", + "mortar", + "repair", + "targeting", + "mine", + ], + vehicle: [ + "vehicle_grav_scout", + "vehicle_grav_tank", + "vehicle_land_mpbbase", + "vehicle_air_scout", + "vehicle_air_bomber", + "vehicle_air_hapc", + ], +}; + export function modelToModelType(modelName: string) { switch (modelName) { case "lmale": @@ -39,6 +76,7 @@ export function modelToModelType(modelName: string) { case "mortar": case "repair": case "targeting": + case "mine": return "weapon"; case "vehicle_grav_scout": case "vehicle_grav_tank":