// ==UserScript== // @name HWH Shop Vacuum Lite // @name:en HWH Shop Vacuum Lite // @namespace http://tampermonkey.net/ // @version 1.3.10-lite.1 // @updateURL https://raw.githubusercontent.com/Askja/hwh-extensions-greasyfork/main/hwhvacuum-lite.meta.js // @downloadURL https://raw.githubusercontent.com/Askja/hwh-extensions-greasyfork/main/hwhvacuum-lite.user.js // @supportURL https://t.me/+ppLK1qqObB43NjMy // @description Облегчённый Shop Vacuum без Vue, анимаций, тем, иконок и игровой графики. // @description:en Lightweight Shop Vacuum without Vue, animations, themes, icons, or game artwork. // @author Askja // @match https://www.hero-wars.com/* // @match https://apps-1701433570146040.apps.fbsbx.com/* // @grant none // @license MIT // ==/UserScript== (function(){function e(){try{var e;return(e=globalThis.localStorage)==null?null:e}catch(e){return null}}function t(e,t){console.warn(e,t)}function n(t,n=e()){return{clear(){try{if(!n)return;for(let e=n.length-1;e>=0;e--){let r=n.key(e);r!=null&&r.startsWith(t)&&n.removeItem(r)}}catch(e){}},getItem(e){try{var r;return(r=n==null?void 0:n.getItem(`${t}${e}`))==null?null:r}catch(e){return null}},keys(){let e=[];try{if(!n)return e;for(let r=0;r`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`)}function a(e=`en`){var t,n,i,a,o,s;let c=r.get(e);if(c)return c;let l=String((t=(n=globalThis.document)==null||(n=n.documentElement)==null?void 0:n.lang)==null?``:t).toLowerCase().trim(),u=[...Array.isArray((i=globalThis.navigator)==null?void 0:i.languages)?globalThis.navigator.languages:[],(a=globalThis.navigator)==null?void 0:a.language].map(e=>String(e==null?``:e).toLowerCase().trim()).filter(Boolean),d=typeof((o=globalThis.HWHFuncs)==null?void 0:o.I18N)==`function`?String((s=globalThis.HWHFuncs.I18N(`~D`))==null?``:s):``;return l.startsWith(`ru`)||u.some(e=>e.startsWith(`ru`))||d.trim().toLowerCase()===`ок`?(r.set(e,`ru`),`ru`):l.startsWith(`en`)||u.some(e=>e.startsWith(`en`))||d.trim().toLowerCase()===`ok`?(r.set(e,`en`),`en`):(r.set(e,e),e)}var o=`injectedStyleCacheV1`,s=new Map;function c(){let e=globalThis.HWHSharedUI&&typeof globalThis.HWHSharedUI==`object`?globalThis.HWHSharedUI:globalThis.HWHSharedUI={},t=e[o];return t instanceof Map?t:(e[o]=s,s)}function l(e,t){var n;let r=document.getElementById(e),i=c(),a=i.get(e);if((a==null?void 0:a.source)===t&&r===a.element)return;if((r==null?void 0:r.tagName)===`STYLE`){r.textContent!==t&&(r.textContent=t),i.set(e,{source:t,normalized:t,element:r});return}let o=document.createElement(`style`);o.id=e,o.textContent=t,((n=document.head)==null?document.documentElement:n).appendChild(o),i.set(e,{source:t,normalized:t,element:o})}var u=new Map;function d(e){let t=u.get(e);return t||(t=new Intl.NumberFormat(e),u.set(e,t)),t}function f(e=`en-US`){var t,n;let r=String((t=(n=globalThis.document)==null||(n=n.documentElement)==null?void 0:n.lang)==null?``:t).trim();return r?r.toLowerCase().startsWith(`ru`)?`ru-RU`:r:e}function p(e={}){var t,n;let r=(t=e.locale)==null?f():t,i=(n=e.minimum)==null?0:n,a=d(r);return function(e){return a.format(Math.max(i,Number(e)||0))}}function m({load:e,ttlMs:t,now:n=Date.now}){let r,i,a=0;function o(){r=void 0,i=void 0,a+=1}async function s(){if(r&&r.expiresAt>n())return r.value;let o=a;i!=null||(i=e().then(e=>(o===a&&(r={expiresAt:n()+Math.max(0,t),value:e}),e)));let s=i;try{return await s}finally{i===s&&(i=void 0)}}return{get:s,invalidate:o}}function h(e=0){let t=Math.max(0,Math.floor(Number(e)||0));return new Promise(e=>{globalThis.setTimeout(e,t)})}function g(e){return typeof e==`object`&&!!e}function _(e,t=``){var n,r,i,a;return e?typeof e==`string`?e:g(e)?String((n=(r=(i=(a=e.description)==null?e.message:a)==null?e.name:i)==null?t:r)==null?``:n):String(t==null?``:t):``}function ee(e){var t;if(!g(e))return;let n=g(e.result)?e.result:void 0;return(t=e.error)==null?n==null?void 0:n.error:t}function v(e){var t,n;if(!g(e))return e;let r=g(e.result)?e.result:void 0;return(t=(n=r==null?void 0:r.response)==null?e.response:n)==null?e:t}function te(e,t=``){return _(ee(e),t)}function ne(e,{requirePayload:t=!0}={}){if(!e||ee(e))return!1;if(!t)return!0;let n=v(e);return n!==!1&&n!=null}async function y({calls:e,chunkSize:t=20,delayMs:n=0,sendChunk:r,onChunk:i}){let a=Array.isArray(e)?e:[],o=Math.max(1,Math.floor(Number(t)||1)),s=Math.max(0,Math.floor(Number(n)||0)),c=Math.max(1,Math.ceil(a.length/o)),l=[];for(let e=0;e0&&await h(s)}return l}function re({chunkSize:e=20,delayMs:t=0,sendChunk:n,mapOnChunk:r=e=>e}){if(typeof n!=`function`)throw Error(`Chunked call sender requires sendChunk.`);return function(i,a=e,o=void 0,s=t){return y({calls:i,chunkSize:a,delayMs:s,sendChunk:n,onChunk:r(o)})}}var ie=`hwhx-shared-ui-lite-style`,ae=`.hwhx-build-lite.hwhx-modal{z-index:10000;color:#eee;box-sizing:border-box;background:#000000b8;justify-content:center;align-items:center;padding:8px;font:14px/1.35 Arial,sans-serif;display:flex;position:fixed;inset:0}.hwhx-build-lite.hwhx-modal .hwhx-modal__dialog{color:#eee;box-sizing:border-box;background:#181818;border:1px solid #777;border-radius:3px;flex-direction:column;align-items:stretch;display:flex;position:relative;overflow:hidden;width:min(1040px,100vw - 16px)!important;height:auto!important;min-height:0!important;max-height:calc(100vh - 16px)!important}.hwhx-build-lite.hwhx-modal[data-hwhx-modal-kind=hero-selection] .hwhx-modal__dialog,.hwhx-build-lite.hwhx-modal[data-hwhx-modal-kind=tier-selection] .hwhx-modal__dialog{width:min(1160px,100vw - 16px)!important}.hwhx-build-lite.hwhx-modal .hwhx-modal__header{box-sizing:border-box;background:#222;border-bottom:1px solid #555;justify-content:space-between;align-items:center;gap:8px;min-height:42px;padding:7px 10px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-modal__identity,.hwhx-build-lite.hwhx-modal .hwhx-modal__brand,.hwhx-build-lite.hwhx-modal .hwhx-modal__meta,.hwhx-build-lite.hwhx-modal .hwhx-modal__toolbar,.hwhx-build-lite.hwhx-modal .hwhx-button-group,.hwhx-build-lite.hwhx-modal .hwhx-icon-label{align-items:center;gap:7px;min-width:0;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-modal__title{text-overflow:ellipsis;white-space:nowrap;font-size:16px;font-weight:700;overflow:hidden}.hwhx-build-lite.hwhx-modal .hwhx-modal__body{scrollbar-gutter:stable;box-sizing:border-box;align-self:stretch;min-width:0;min-height:0;max-height:calc(100vh - 116px);padding:10px;flex:0 auto!important;width:100%!important;overflow:hidden scroll!important}.hwhx-build-lite.hwhx-modal .hwhx-modal__body>.hwhx-native-body,.hwhx-build-lite.hwhx-modal .hwhx-modal__body>.hwhx-popup,.hwhx-build-lite.hwhx-modal .hwhx-hwhauto-managed-popup-panel,.hwhx-build-lite.hwhx-modal .hwhx-hwhauto-managed-popup-panel__body,.hwhx-build-lite.hwhx-modal .hwhx-settings-summary,.hwhx-build-lite.hwhx-modal .hwhx-settings-summary__scroll,.hwhx-build-lite.hwhx-modal .hwhx-selection-body,.hwhx-build-lite.hwhx-modal .hwhx-selection-groups{box-sizing:border-box;align-self:stretch;width:100%!important;min-width:0!important;max-width:none!important}.hwhx-build-lite.hwhx-modal .hwhx-modal__actions{background:#202020;border-top:1px solid #555;justify-content:space-between;gap:8px;padding:8px 10px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-modal__actions-side{flex-wrap:wrap;gap:6px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-button,.hwhx-build-lite.hwhx-modal button.hwhx-button,.hwhx-build-lite.hwhx-modal .hwhx-icon-button,.hwhx-build-lite.hwhx-modal .hwhx-custom-select__button,.hwhx-build-lite.hwhx-progress .hwhx-button,.hwhx-build-lite.hwhx-progress .hwhx-icon-button,.hwhx-build-lite.hwhx-toast-stack .hwhx-button{color:#eee;cursor:pointer;box-sizing:border-box;background:#292929;border:1px solid #777;border-radius:2px;min-height:32px;margin:0;padding:5px 10px;font:700 14px/1.2 Arial,sans-serif}.hwhx-build-lite.hwhx-modal .hwhx-button:hover,.hwhx-build-lite.hwhx-modal .hwhx-button:focus,.hwhx-build-lite.hwhx-modal .hwhx-icon-button:hover,.hwhx-build-lite.hwhx-modal .hwhx-custom-select__button:hover{background:#333;border-color:#bbb;outline:1px solid #bbb}.hwhx-build-lite.hwhx-modal .hwhx-button:disabled,.hwhx-build-lite.hwhx-modal .hwhx-button.is-disabled,.hwhx-build-lite.hwhx-modal .hwhx-icon-button:disabled{cursor:not-allowed;opacity:.55}.hwhx-build-lite.hwhx-modal .hwhx-lite-glyph,.hwhx-build-lite.hwhx-progress .hwhx-lite-glyph,.hwhx-build-lite.hwhx-toast-stack .hwhx-lite-glyph{text-align:center;min-width:1em;font:700 14px/1 Segoe UI Emoji,Apple Color Emoji,Noto Color Emoji,sans-serif;display:inline-block}.hwhx-build-lite.hwhx-modal .hwhx-field,.hwhx-build-lite.hwhx-modal .hwhx-input,.hwhx-build-lite.hwhx-modal .hwhx-number-input,.hwhx-build-lite.hwhx-modal input.hwhx-field,.hwhx-build-lite.hwhx-modal select.hwhx-field,.hwhx-build-lite.hwhx-modal textarea.hwhx-field{color:#eee;box-sizing:border-box;background:#111;border:1px solid #777;border-radius:2px;width:100%;min-height:32px;padding:5px 8px;font:14px/1.2 Arial,sans-serif}.hwhx-build-lite.hwhx-modal .hwhx-field:focus,.hwhx-build-lite.hwhx-modal .hwhx-input:focus{border-color:#ccc;outline:1px solid #ccc}.hwhx-build-lite.hwhx-modal .hwhx-settings-search,.hwhx-build-lite.hwhx-modal .hwhx-selection-head,.hwhx-build-lite.hwhx-modal .hwhx-search-toolbar{box-sizing:border-box;align-items:center;gap:8px;width:100%;margin:0 0 8px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-settings-search .hwhx-field,.hwhx-build-lite.hwhx-modal .hwhx-search-toolbar .hwhx-field{flex:auto}.hwhx-build-lite.hwhx-modal .hwhx-settings-grid,.hwhx-build-lite.hwhx-modal .hwhx-selection-groups,.hwhx-build-lite.hwhx-modal .hwhx-stack,.hwhx-build-lite.hwhx-modal .hwhx-checkbox-list,.hwhx-build-lite.hwhx-modal .hwhx-native-checkboxes{box-sizing:border-box;flex-direction:column;align-items:stretch;gap:6px;width:100%;min-width:0;max-width:none;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-accordion{box-sizing:border-box;background:#1e1e1e;border:1px solid #555;border-radius:2px;flex:none;align-self:stretch;margin:0 0 6px;padding:0;display:block;overflow:hidden;inline-size:100%!important;width:100%!important;min-inline-size:0!important;max-inline-size:none!important}.hwhx-build-lite.hwhx-modal .hwhx-accordion__summary{inline-size:100%;color:#eee;cursor:pointer;box-sizing:border-box;background:#252525;justify-content:space-between;align-items:center;gap:8px;width:100%;min-width:0;min-height:36px;padding:7px 9px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-accordion__summary:focus{outline:1px solid #aaa}.hwhx-build-lite.hwhx-modal .hwhx-accordion__heading{flex:auto;align-items:center;gap:7px;min-width:0;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-accordion__title{text-overflow:ellipsis;min-width:0;overflow:hidden}.hwhx-build-lite.hwhx-modal .hwhx-accordion__arrow:empty:before{content:"+";font-weight:700}.hwhx-build-lite.hwhx-modal .hwhx-accordion[data-open="1"]>.hwhx-accordion__summary .hwhx-accordion__arrow:empty:before{content:"−"}.hwhx-build-lite.hwhx-modal .hwhx-accordion__body{inline-size:100%;box-sizing:border-box;width:100%;min-width:0;padding:8px 9px}.hwhx-build-lite.hwhx-modal .hwhx-accordion__body>*{box-sizing:border-box;min-width:0;max-width:100%}.hwhx-build-lite.hwhx-modal .hwhx-accordion--nested{margin:0 0 5px}.hwhx-build-lite.hwhx-modal .hwhx-checkbox-row,.hwhx-build-lite.hwhx-modal .hwhx-checkbox-list__item,.hwhx-build-lite.hwhx-modal .hwhx-custom-row{color:#eee;box-sizing:border-box;background:#202020;border:1px solid #444;align-items:center;gap:8px;width:100%;min-width:0;min-height:32px;margin:0;padding:5px 7px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-checkbox-input{-webkit-appearance:none;appearance:none;outline-offset:1px;box-sizing:border-box;cursor:pointer;outline:1px solid #aaa;flex:0 0 18px;justify-content:center;align-items:center;margin:0;display:inline-flex;position:relative;opacity:1!important;background:#fff!important;border:1px solid #000!important;border-radius:0!important;width:18px!important;height:18px!important}.hwhx-build-lite.hwhx-modal .hwhx-checkbox-input:checked{background:#fff!important;border-color:#000!important}.hwhx-build-lite.hwhx-modal .hwhx-checkbox-input:checked:after{content:""!important;clip-path:polygon(14% 52%,0 66%,38% 100%,100% 18%,84% 4%,35% 70%)!important;background:#000!important;border:0!important;width:12px!important;height:12px!important;display:block!important;position:absolute!important;top:50%!important;left:50%!important;transform:translate(-50%,-50%)!important}.hwhx-build-lite.hwhx-modal .hwhx-checkbox-input:focus-visible{outline-offset:2px;outline:2px solid #fff!important}.hwhx-build-lite.hwhx-modal .hwhx-checkbox-input:disabled{cursor:not-allowed;opacity:.55!important}.hwhx-build-lite.hwhx-modal .hwhx-checkbox-label{flex:auto;align-items:center;min-width:0;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-checkbox-list__toolbar,.hwhx-build-lite.hwhx-modal .hwhx-selection-modes,.hwhx-build-lite.hwhx-modal .hwhx-selection-mode,.hwhx-build-lite.hwhx-modal .hwhx-selection-mode__control{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-custom-select{min-width:0;position:relative}.hwhx-build-lite.hwhx-modal .hwhx-custom-select__menu{z-index:11000;color:#eee;background:#191919;border:1px solid #888;max-height:260px;position:fixed;overflow:auto}.hwhx-build-lite.hwhx-modal .hwhx-custom-select__option{cursor:pointer;align-items:center;gap:6px;min-height:30px;padding:5px 8px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-custom-select__option:hover,.hwhx-build-lite.hwhx-modal .hwhx-custom-select__option.is-selected{background:#353535}.hwhx-build-lite.hwhx-modal .hwhx-settings-row,.hwhx-build-lite.hwhx-modal .hwhx-settings-field,.hwhx-build-lite.hwhx-modal .hwhx-field-row{box-sizing:border-box;grid-template-columns:minmax(180px,1fr) minmax(120px,auto);align-items:center;gap:8px;width:100%;padding:5px 0;display:grid}.hwhx-build-lite.hwhx-modal .hwhx-settings-label,.hwhx-build-lite.hwhx-modal .hwhx-selection-label,.hwhx-build-lite.hwhx-modal .hwhx-selection-label__lead,.hwhx-build-lite.hwhx-modal .hwhx-selection-label__identity,.hwhx-build-lite.hwhx-modal .hwhx-selection-label__main{align-items:center;gap:6px;min-width:0;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-selection-label__identity{flex-direction:column;align-items:flex-start;gap:1px}.hwhx-build-lite.hwhx-modal .hwhx-selection-label__details{color:#bbb;align-items:center;gap:8px;margin-left:auto;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-badges,.hwhx-build-lite.hwhx-modal .hwhx-selection-badges,.hwhx-build-lite.hwhx-modal .hwhx-token-list{align-items:center;gap:5px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-badge,.hwhx-build-lite.hwhx-modal .hwhx-selection-badge,.hwhx-build-lite.hwhx-modal .hwhx-token,.hwhx-build-lite.hwhx-modal .hwhx-modal-badge{color:#ddd;background:#292929;border:1px solid #666;border-radius:2px;padding:2px 6px;font-size:12px}.hwhx-build-lite.hwhx-modal .hwhx-data-table{border-collapse:collapse;color:#eee;width:100%}.hwhx-build-lite.hwhx-modal .hwhx-data-table th,.hwhx-build-lite.hwhx-modal .hwhx-data-table td{text-align:left;border:1px solid #555;padding:5px 7px}.hwhx-build-lite.hwhx-modal .hwhx-panel,.hwhx-build-lite.hwhx-modal .hwhx-ui-panel,.hwhx-build-lite.hwhx-modal .hwhx-popup{color:#eee;box-sizing:border-box;background:#202020;border:1px solid #555;border-radius:2px;flex-direction:column;align-items:stretch;gap:8px;width:100%;min-width:0;margin:0 0 8px;padding:9px 10px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-popup>.hwhx-panel:last-child,.hwhx-build-lite.hwhx-modal .hwhx-popup>.hwhx-ui-panel:last-child,.hwhx-build-lite.hwhx-modal .hwhx-panel:last-child,.hwhx-build-lite.hwhx-modal .hwhx-ui-panel:last-child{margin-bottom:0}.hwhx-build-lite.hwhx-modal .hwhx-ui-panel__head{border-bottom:1px solid #444;justify-content:space-between;align-items:center;gap:10px;min-width:0;padding-bottom:6px;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-ui-panel__title,.hwhx-build-lite.hwhx-modal .hwhx-ui-panel__actions{align-items:center;gap:6px;min-width:0;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-ui-panel__title{font-size:14px;font-weight:700;line-height:1.25}.hwhx-build-lite.hwhx-modal .hwhx-ui-panel__description{color:#bbb;margin:0;font-size:13px;line-height:1.4}.hwhx-build-lite.hwhx-modal .hwhx-ui-panel__body{flex-direction:column;gap:7px;width:100%;min-width:0;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-ui-panel__body>p,.hwhx-build-lite.hwhx-modal .hwhx-popup>p{margin:0;line-height:1.4}.hwhx-build-lite.hwhx-modal .hwhx-info-list{flex-direction:column;gap:6px;width:100%;min-width:0;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-info-list__row{box-sizing:border-box;background:#1b1b1b;border:1px solid #444;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;min-width:0;padding:7px 9px;display:grid}.hwhx-build-lite.hwhx-modal .hwhx-info-list__label,.hwhx-build-lite.hwhx-modal .hwhx-info-list__value,.hwhx-build-lite.hwhx-modal .hwhx-info-line__label,.hwhx-build-lite.hwhx-modal .hwhx-info-line__value{align-items:center;gap:6px;min-width:0;line-height:1.3;display:flex}.hwhx-build-lite.hwhx-modal .hwhx-info-list__value,.hwhx-build-lite.hwhx-modal .hwhx-info-line__value{text-align:right;justify-content:flex-end;font-weight:700}.hwhx-build-lite.hwhx-modal .hwhx-form-row,.hwhx-build-lite.hwhx-modal .hwhx-info-line{box-sizing:border-box;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;width:100%;max-width:none;margin:0;padding:5px 0;display:grid}.hwhx-build-lite.hwhx-modal .hwhx-hint,.hwhx-build-lite.hwhx-modal .hwhx-note,.hwhx-build-lite.hwhx-modal .hwhx-empty-state{color:#ddd;box-sizing:border-box;background:#242424;border:1px solid #666;width:100%;margin:0 0 8px;padding:8px 9px;line-height:1.4}.hwhx-build-lite.hwhx-modal .hwhx-hint{grid-template-columns:18px minmax(0,1fr);gap:8px}.hwhx-build-lite.hwhx-modal [class^=hwhx-][class*=__icon]:empty,.hwhx-build-lite.hwhx-modal [class*= hwhx-][class*=__icon]:empty,.hwhx-build-lite.hwhx-modal .hwhx-modal__script-logo,.hwhx-build-lite.hwhx-modal .hwhx-modal__forum-link,.hwhx-build-lite.hwhx-modal .hwhx-brand-icon,.hwhx-build-lite.hwhx-modal .hwhx-help-button,.hwhx-build-lite.hwhx-modal .hwhx-motion-icon:empty{display:none!important}.hwhx-build-lite.hwhx-modal .hwhx-empty-state,.hwhx-build-lite.hwhx-modal .hwhx-help-links-panel__card,.hwhx-build-lite.hwhx-modal .hwhx-link-list__item,.hwhx-build-lite.hwhx-modal .hwhx-release-card,.hwhx-build-lite.hwhx-modal .hwhx-daily-resource-metric{grid-template-columns:minmax(0,1fr)!important}.hwhx-build-lite.hwhx-progress{z-index:10002;color:#eee;box-sizing:border-box;background:#181818;border:1px solid #777;border-radius:3px;flex-direction:column;gap:7px;max-height:calc(100vh - 16px);padding:9px;font:14px/1.35 Arial,sans-serif;display:none;position:fixed;overflow:auto;width:min(620px,100vw - 16px)!important}.hwhx-build-lite.hwhx-progress.is-visible{display:flex}.hwhx-build-lite.hwhx-progress .hwhx-progress__header,.hwhx-build-lite.hwhx-progress .hwhx-progress__body,.hwhx-build-lite.hwhx-progress .hwhx-progress__content{box-sizing:border-box;width:100%;min-width:0}.hwhx-build-lite.hwhx-progress .hwhx-progress__header{border-bottom:1px solid #555;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;padding-bottom:7px;display:grid}.hwhx-build-lite.hwhx-progress .hwhx-progress__stage{color:#dff8e5;white-space:normal;background:#202923;border:1px solid #5d826e;padding:6px 8px;font-weight:700}.hwhx-build-lite.hwhx-progress .hwhx-progress__content{white-space:pre-line}.hwhx-build-lite.hwhx-progress .hwhx-progress__title{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.hwhx-build-lite.hwhx-progress .hwhx-progress__header-actions{align-items:center;gap:6px;min-width:0;display:flex}.hwhx-build-lite.hwhx-progress .hwhx-status-badge{color:#ccc;white-space:nowrap;box-sizing:border-box;background:#242424;border:1px solid #777;border-radius:2px;align-items:center;min-height:30px;padding:0 8px;font-size:12px;font-weight:700;display:inline-flex}.hwhx-build-lite.hwhx-progress .hwhx-status-badge[data-tone=active]{color:#a8d3fa;border-color:#6684a0}.hwhx-build-lite.hwhx-progress .hwhx-status-badge[data-tone=success]{color:#a8d9a8;border-color:#5d865d}.hwhx-build-lite.hwhx-progress .hwhx-status-badge[data-tone=warning]{color:#ead48f;border-color:#8e7a46}.hwhx-build-lite.hwhx-progress .hwhx-status-badge[data-tone=danger]{color:#efaaa6;border-color:#965b58}.hwhx-build-lite.hwhx-progress[data-hwhx-progress-style=compact]{width:min(360px,100vw - 16px)!important}.hwhx-build-lite.hwhx-progress[data-hwhx-progress-style=compact] .hwhx-status-badge__label{font-size:0}.hwhx-build-lite.hwhx-progress[data-hwhx-progress-style=compact] .hwhx-status-badge__label:before{content:"•";font-size:18px;line-height:1}.hwhx-build-lite.hwhx-progress[data-hwhx-progress-style=dashboard]{padding:0;width:min(800px,100vw - 16px)!important}.hwhx-build-lite.hwhx-progress[data-hwhx-progress-style=dashboard] .hwhx-progress__header{min-height:46px;padding:7px 9px}.hwhx-build-lite.hwhx-progress[data-hwhx-progress-style=dashboard] .hwhx-progress__body{padding:9px}.hwhx-build-lite.hwhx-progress [class^=hwhx-][class*=__icon]:empty,.hwhx-build-lite.hwhx-progress [class*= hwhx-][class*=__icon]:empty,.hwhx-build-lite.hwhx-progress .hwhx-progress__title-marker:empty{display:none!important}.hwhx-build-lite.hwhx-progress .hwhx-result-message{grid-template-columns:minmax(0,1fr)!important;min-height:0!important}.hwhx-build-lite.hwhx-progress .hwhx-progress-bar{background:#111;border:1px solid #666;height:8px}.hwhx-build-lite.hwhx-progress .hwhx-progress-bar__fill{background:#7abf7a;height:100%}.hwhx-build-lite.hwhx-toast-stack{z-index:12000;flex-direction:column;gap:5px;width:min(340px,100vw - 16px);font:14px/1.35 Arial,sans-serif;display:flex;position:fixed;top:8px;right:8px}.hwhx-build-lite.hwhx-toast-stack .hwhx-toast{color:#eee;box-sizing:border-box;background:#202020;border:1px solid #777;align-items:flex-start;gap:8px;padding:8px;display:flex;position:relative}.hwhx-build-lite.hwhx-toast-stack .hwhx-toast__icon:empty{display:none}.hwhx-build-lite.hwhx-toast-stack .hwhx-toast__content{flex:auto;min-width:0}.hwhx-build-lite.hwhx-toast-stack .hwhx-toast__title{font-weight:700}.hwhx-build-lite.hwhx-toast-stack .hwhx-toast__actions{flex-wrap:wrap;gap:5px;margin-top:6px;display:flex}.hwhx-build-lite.hwhx-tooltip{z-index:13000;color:#eee;background:#202020;border:1px solid #777;border-radius:2px;max-width:min(320px,100vw - 16px);padding:5px 7px;font:12px/1.3 Arial,sans-serif;position:fixed}.hwhx-build-lite.hwhx-splash{font-family:Arial,sans-serif}.hwhx-build-lite.hwhx-modal,.hwhx-build-lite.hwhx-modal *,.hwhx-build-lite.hwhx-progress,.hwhx-build-lite.hwhx-progress *,.hwhx-build-lite.hwhx-toast-stack,.hwhx-build-lite.hwhx-toast-stack *,.hwhx-build-lite.hwhx-tooltip,.hwhx-build-lite.hwhx-splash,.hwhx-build-lite.hwhx-splash *{scroll-behavior:auto!important;filter:none!important;backdrop-filter:none!important;box-shadow:none!important;text-shadow:none!important;transition:none!important;animation:none!important}@media (width<=640px){.hwhx-build-lite.hwhx-modal{padding:0}.hwhx-build-lite.hwhx-modal .hwhx-modal__dialog{border-radius:0;width:100vw!important;max-height:100vh!important}.hwhx-build-lite.hwhx-modal .hwhx-settings-row,.hwhx-build-lite.hwhx-modal .hwhx-settings-field,.hwhx-build-lite.hwhx-modal .hwhx-field-row,.hwhx-build-lite.hwhx-modal .hwhx-info-line{grid-template-columns:1fr}.hwhx-build-lite.hwhx-modal .hwhx-modal__actions{flex-direction:column}.hwhx-build-lite.hwhx-modal .hwhx-selection-label__details{display:none}}`;function b(){l(ie,ae)}function x(){b()}function S(){b()}function C(){b()}var oe=[`top-right`,`bottom-right`,`top-left`,`bottom-left`],se=`top-right`,ce=1e4,le=12e4,ue=Object.freeze({position:se,stackSize:3,timeoutMs:ce}),de=new Set(oe);function fe(e){let t=String(e==null?``:e);return de.has(t)?t:se}function pe(e){let t=Math.trunc(Number(e));return Number.isFinite(t)?Math.min(6,Math.max(1,t)):3}function me(e){let t=Math.trunc(Number(e));return Number.isFinite(t)?Math.min(le,Math.max(0,t)):ce}function he(e){let t=_e(e)?e:{};return{position:fe(t.position),stackSize:pe(t.stackSize),timeoutMs:me(t.timeoutMs)}}function ge(t=e()){try{var n;return he(JSON.parse((n=t==null?void 0:t.getItem(`hwhx_toast_preferences`))==null?`null`:n))}catch(e){return console.warn(`[hwhx] Не удалось прочитать настройки уведомлений:`,e),{...ue}}}function _e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var w=ge(),ve=0,T=null,E=new Map;function D(e){var t,n;C();let r=String((t=e.id)==null?k():t);O(r,`overflow`);let i=ye(),a=xe(r,e),o=he({timeoutMs:(n=e.timeoutMs)==null?w.timeoutMs:n}).timeoutMs,s={element:a,onClose:e.onClose,timeoutId:o>0?globalThis.setTimeout(()=>O(r,`timeout`),o):null};return E.set(r,s),i.appendChild(a),Ce(),r}function O(e,t=`close`){var n;let r=E.get(e);r&&(E.delete(e),r.timeoutId!==null&&globalThis.clearTimeout(r.timeoutId),r.element.remove(),(n=r.onClose)==null||n.call(r,t),E.size===0&&(T==null||T.remove(),T=null))}function ye(){return T!=null&&T.isConnected?T:(T=document.createElement(`div`),T.className=`hwhx-toast-stack hwhx-build-lite`,be(),document.body.appendChild(T),T)}function be(){if(!T)return;T.dataset.position=w.position,T.style.inset=`auto`;let e=w.position.startsWith(`bottom`),t=w.position.endsWith(`left`);T.style[e?`bottom`:`top`]=`8px`,T.style[t?`left`:`right`]=`8px`,T.style.flexDirection=e?`column-reverse`:`column`}function xe(e,t){var n;let r=document.createElement(`article`);r.className=`hwhx-toast`,r.dataset.tone=(n=t.tone)==null?`info`:n;let i=document.createElement(`div`);if(i.className=`hwhx-toast__content`,t.title){let e=document.createElement(`div`);e.className=`hwhx-toast__title`,e.textContent=t.title,i.appendChild(e)}if(t.text){let e=document.createElement(`div`);e.className=`hwhx-toast__text`,e.textContent=t.text,i.appendChild(e)}if(Se(i,e,t.actions),r.appendChild(i),t.closable!==!1){let n=document.createElement(`button`);n.type=`button`,n.className=`hwhx-icon-button`,n.textContent=`×`,n.ariaLabel=t.closeLabel||`Закрыть`,n.addEventListener(`click`,()=>O(e,`close`)),r.appendChild(n)}return r}function Se(e,t,n){if(!Array.isArray(n)||n.length===0)return;let r=document.createElement(`div`);r.className=`hwhx-toast__actions`;for(let e of n){var i;if(!(e!=null&&e.id)||!e.label)continue;let n=document.createElement(e.href?`a`:`button`);n.className=`hwhx-button hwhx-button--mini`,n.textContent=e.label,n.dataset.tone=(i=e.tone)==null?`secondary`:i,n instanceof HTMLAnchorElement?(n.href=String(e.href),n.target=`_blank`,n.rel=`noopener noreferrer`):n.type=`button`,n.addEventListener(`click`,()=>{try{var n;Promise.resolve((n=e.onClick)==null?void 0:n.call(e)).catch(e=>console.error(`[hwhx] Ошибка действия уведомления:`,e))}catch(e){console.error(`[hwhx] Ошибка действия уведомления:`,e)}e.closeOnClick!==!1&&O(t,`action`)}),r.appendChild(n)}r.childElementCount>0&&e.appendChild(r)}function Ce(){for(;E.size>w.stackSize;){let e=E.keys().next().value;if(typeof e!=`string`)break;O(e,`overflow`)}}function k(){return ve+=1,`hwhx-toast-${Date.now()}-${ve}`}function we(e){return D(e)}async function Te(e,t){return await t()}var Ee=new Set([`https:`,`http:`]);function De(e){let t=String(e==null?``:e).trim();if(!t)return``;try{let e=new URL(t);return Ee.has(e.protocol)?e.href:``}catch(e){return``}}var Oe=`https://greasyfork.org/ru/scripts/450693-herowarshelper`,ke=!1;function Ae(e){if(e==null)return``;let t=String(e).trim();return t.length>0?t:``}function je(e,t=Oe){return De(e)||t}function Me({scriptName:e=``,installUrl:t=Oe}={}){if(typeof document>`u`||ke)return;if(!document.body){globalThis.setTimeout(()=>Me({scriptName:e,installUrl:t}),0);return}let n=je(t),r=Ae(e);ke=!0,we({id:`hero-wars-helper-install`,title:`Нужен HeroWarsHelper`,text:`${r?`${r}: `:``}runtime игры не найден. Установите HeroWarsHelper и обновите вкладку.`,tone:`warning`,icon:`plug-zap`,actions:[{id:`install`,label:`Установить на GreasyFork`,icon:`download`,tone:`success`,href:n}],closeLabel:`Закрыть`,onClose:()=>{ke=!1}})}function Ne(e=[`HWHClasses`,`HWHFuncs`,`HWHData`],t){let n=globalThis;if(!e.every(e=>!!n[e]))return!1;if(!t)return!0;try{return t()}catch(e){return!1}}function Pe({attempt:e=0,maxAttempts:t=120,delayMs:n=500,requiredKeys:r=[`HWHClasses`,`HWHFuncs`,`HWHData`],retry:i,readyWhen:a,logPrefix:o=`[HWH]`,scriptName:s=``,showInstallNotice:c=!0}={}){let l=Number(e)||0;return Ne(r,a)?!0:li(l+1),n),!1):(console.log(`%c${o} Объект расширения не найден`,`color: red`),c&&Me({scriptName:s}),!1)}function A(e,t){return e!==null&&(typeof e==`object`||typeof e==`function`)&&typeof e[t]==`function`}function Fe(e){if(typeof e!=`function`||!A(e,`send`))return!1;let t=e.prototype;return A(t,`addCall`)&&A(t,`add`)&&A(t,`send`)&&A(t,`result`)&&A(t,`sideResult`)&&A(t,`execute`)&&A(t,`clear`)&&A(t,`isEmpty`)}function Ie(e=globalThis){return Fe(e.Caller)?e.Caller:null}function Le(e=globalThis){let t=Ie(e);if(!t)throw Error(`HeroWarsHelper Caller runtime is not available.`);return t}var Re=`none`,ze=`start`,Be=`before:`,Ve=`after:`;function He(e,t){return typeof e==`object`&&!!e&&typeof e[t]==`function`}function Ue(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:null}function We(e){if(typeof e!=`function`)return!1;let t=e.prototype;return He(t,`start`)&&He(t,`end`)&&He(t,`errorHandling`)}function Ge(e){return We(e)?e:null}function Ke(e){return Ge(e==null?void 0:e.doYourBest)}function j(e){var t;let n=Ue(e);return String((t=n==null?void 0:n.name)==null?``:t).trim()}function qe(e){let t=Ue(e);return String((t==null?void 0:t.label)||(t==null?void 0:t.title)||(t==null?void 0:t.name)||``).trim()}function Je(e,{allowStart:t=!1,fallbackValue:n=`end`}={}){let r=String(e==null?``:e).trim();return r===`none`||r===`end`||t&&r===`start`||r.startsWith(`before:`)&&r.length>7||r.startsWith(`after:`)&&r.length>6?r:n}function Ye(e){if(typeof e!=`function`)return e;let t=e;for(;;){let e=Object.getPrototypeOf(t.prototype);if(!e||e===Object.prototype)return t;let n=e.constructor;if(typeof n!=`function`||n===t)return t;t=n}}function Xe(e,{logPrefix:t=`[HWH]`}={}){let n=Ge(e);if(!n)return[];try{let e=new n;return Array.isArray(e.funcList)?e.funcList.filter(Boolean):[]}catch(e){return console.warn(`${t} checklist snapshot failed`,e),[]}}function Ze({getDoYourBestClass:e,logPrefix:t=`[HWH]`}={}){return function(){return Xe(e==null?void 0:e(),{logPrefix:t})}}function Qe(e={}){return function(t){return Je(t,e)}}function $e(e,t,{allowStart:n=!1,normalizePlacement:r=void 0}={}){let i=typeof r==`function`?r(t):Je(t,{allowStart:n});if(n&&i===`start`)return 0;if(i===`end`)return e.length;let a=i.startsWith(Ve),o=i.slice(a?6:7),s=e.findIndex(e=>j(e)===o);return s<0?e.length:s+ +!!a}function et({taskList:e=[],translate:t,keys:n,includeStart:r=!1}={}){var i,a;let o=typeof t==`function`?t:e=>e,s=(e==null?[]:e).filter(e=>j(e)),c=[{value:Re,label:o((i=n==null?void 0:n.none)==null?`DO_YOUR_BEST_PLACEMENT_NONE`:i),icon:`x`}];if(r){var l;c.push({value:ze,label:o((l=n==null?void 0:n.start)==null?`DO_YOUR_BEST_PLACEMENT_START`:l),icon:`arrow-up-to-line`})}if(s.length<=0){var u;return c.push({value:`end`,label:o((u=n==null?void 0:n.end)==null?`DO_YOUR_BEST_PLACEMENT_END`:u),icon:`arrow-down`}),c}let d=s[0],f=j(d),p=qe(d)||f;return c.push({value:`${Be}${f}`,label:o((a=n==null?void 0:n.before)==null?`DO_YOUR_BEST_PLACEMENT_BEFORE`:a,{label:p}),icon:`arrow-up`}),s.forEach(e=>{var t;let r=j(e),i=qe(e)||r;c.push({value:`${Ve}${r}`,label:o((t=n==null?void 0:n.after)==null?`DO_YOUR_BEST_PLACEMENT_AFTER`:t,{label:i}),icon:`arrow-down`})}),c}function tt({translate:e,keys:t,includeStart:n=!1}={}){return function(r){return et({taskList:r,translate:e,keys:t,includeStart:n})}}function nt(e){return e===`gold`?`gold`:e===`blue`?`blue`:e===`pink`||e===`purple`?`purple`:`green`}function rt({actionKey:e,color:t=`pink`,icon:n=``,getLabel:r,getTitle:i,onClick:a,buildIconLabel:o=(e,t)=>String(t==null?``:t),splash:s=!0}={}){let c=()=>typeof r==`function`?r():String(r==null?``:r),l=()=>typeof i==`function`?i():String(i==null?``:i),u=a?(...e)=>s?Te({title:String(c()),status:String(l()),icon:n||`settings-2`,tone:nt(t)},()=>a(...e)):a(...e):void 0;function d(){return{get name(){return String(c())},get title(){return String(l())},color:t,onClick:u}}function f(){return{actionKey:e,get msg(){return String(o(n,c()))},get title(){return String(l())},color:t,result:u}}return{createMainButton:d,createOtherButton:f}}var it=`main`,at=`other`;function ot(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function st(e){return e!=null&&e.buttons&&typeof e.buttons==`object`?e.buttons:e.buttons={}}function ct(e){return Array.isArray(e==null?void 0:e.othersPopupButtons)?e.othersPopupButtons:e.othersPopupButtons=[]}function lt(e,t=it){return e===`other`||e===`main`?e:t}function ut({normalizePlacement:e=lt,readStoredPlacement:t,settings:n,settingsKey:r}){let i=ot(n)?n:{},a=ot(n)&&r?Object.prototype.hasOwnProperty.call(i,r)?i[r]:t==null?void 0:t():n;return e(a===void 0?t==null?void 0:t():a)}function dt({HWHData:e,mainMenuButtons:t,othersPopupButtons:n,placement:r,mainKey:i,actionKey:a,createMainButton:o,createOtherButton:s,mainPlacementValue:c=it,otherPlacementValue:l=at}){let u=e==null?{}:e,d=t==null?st(u):t,f=n==null?ct(u):n,p=f.findIndex(e=>(e==null?void 0:e.actionKey)===a);return p>=0&&f.splice(p,1),i&&delete d[i],r===l&&typeof s==`function`?f.push(s()):i&&r===c&&typeof o==`function`&&(d[i]=o()),u.buttons=d,{mainMenuButtons:d,othersPopupButtons:f}}function ft({normalizePlacement:e=lt,persistPlacement:t,readStoredPlacement:n,settings:r,settingsKey:i,...a}){let o=ut({normalizePlacement:e,readStoredPlacement:n,settings:r,settingsKey:i});return t==null||t(o),{...dt({...a,placement:o}),placement:o}}function pt(e=`hwh`){if(typeof console>`u`)return;let t=globalThis,n={HWHClasses:t.HWHClasses,HWHFuncs:t.HWHFuncs,HWHData:t.HWHData,lib:t.lib,cheats:t.cheats,userId:t.userId},r=`[${e}] game library dump`,i=typeof console.groupCollapsed==`function`?console.groupCollapsed.bind(console):typeof console.group==`function`?console.group.bind(console):null,a=typeof console.groupEnd==`function`?console.groupEnd.bind(console):null;if(i&&a){i(r),Object.entries(n).forEach(([e,t])=>console.log(e,t)),a();return}console.log(r,n)}function mt({cheats:e=globalThis.cheats,buildMessage:t=()=>``}={}){let n=e==null?void 0:e.refreshGame;return typeof n==`function`?(n.call(e),t()):``}function ht({settings:e,options:t=void 0,skipSource:n=`checklist`,runSync:r=mt,buildSuccessMessage:i,buildFailureMessage:a=()=>``,logPrefix:o=`[HWHShared]`}={}){if(!(e!=null&&e.syncAfterRun)||(t==null?void 0:t.source)===n)return``;try{return r({buildMessage:i})}catch(e){return console.error(`${o} post-run sync failed`,e),a(e)}}function gt(e={}){return function(t={}){return ht({...e,...t})}}function _t(e=void 0){var t,n,r,i;let a=String((t=(n=globalThis.NXFlashVars)==null?void 0:n.interface_lang)==null?``:t).slice(0,2),o=String((r=(i=globalThis.navigator)==null?void 0:i.language)==null?``:r).slice(0,2),s=a||o||`en`;return e!=null&&e[s]?s:`en`}function vt(e,t){let n=String(e==null?``:e).trim(),r=String(t==null?``:t).trim();return!!n&&n!==r&&n!==`% ${r} %`&&n!==`%${r}%`&&!n.includes(`undefined`)}function yt(e,t={}){!e||typeof e!=`object`||Object.entries(t).forEach(([t,n])=>{var r;e[t]=Object.assign((r=e[t])==null?{}:r,n==null?{}:n)})}function bt({I18N:e,cheats:t,i18nLangData:n,defaultLanguage:r=`en`,fallbackLanguage:i=`en`,preferGameI18N:a=!0,forceLanguage:o=void 0,cacheMissingTranslations:s=!1}={}){var c;let l=new Map,u=(c=o==null?_t(n):o)==null?r:c,d=e=>{var t,a,o,s,c,l;return String((t=(a=(o=n==null||(s=n[u])==null?void 0:s[e])==null?n==null||(c=n[i])==null?void 0:c[e]:o)==null?n==null||(l=n[r])==null?void 0:l[e]:a)==null?``:t)};return function(n,r){let i=String(n==null?``:n),o=l.get(i),c=o==null?``:o;if(o===void 0){if(a||(c=d(i)),!vt(c,i)&&typeof e==`function`)try{var u;c=String((u=e(i))==null?``:u)}catch(e){c=``}if(!vt(c,i)&&typeof(t==null?void 0:t.translate)==`function`)try{var f;c=String((f=t.translate(i))==null?``:f)}catch(e){c=``}vt(c,i)||(c=d(i)),vt(c,i)||(c=i),(s||c!==i)&&l.set(i,c)}if(r)for(let[e,t]of Object.entries(r))c=String(c).split(`{${e}}`).join(String(t));return String(c)}}var xt;function St(e,t){return xt!=null||(xt=new Intl.Collator(`ru`)),xt.compare(String(e==null?``:e),String(t==null?``:t))}function Ct({storage:e,defaultValue:t,normalize:n,getScopeKey:r=()=>``,beforeRead:i,afterRead:a,beforeWrite:o,afterWrite:s}={}){if(!e||typeof e.read!=`function`||typeof e.write!=`function`)throw Error(`Settings repository requires storage with read/write methods.`);let c=e,l=typeof n==`function`?n:e=>e===void 0?t:e,u=async()=>{var e;return String((e=await r())==null?``:e)};async function d(e=t){await(i==null?void 0:i());let n=await u(),r=c.read(n,e),o=l(r==null?e:r);return await(a==null?void 0:a(o,{scopeKey:n,rawValue:r})),o}async function f(e){let n=await u(),r=l(e==null?t:e);return await(o==null?void 0:o(r,{scopeKey:n})),c.write(n,r),await(s==null?void 0:s(r,{scopeKey:n})),r}function p(e=t,n=``){let r=c.read(String(n==null?``:n),e),i=l(r==null?e:r);return a==null||a(i,{scopeKey:String(n==null?``:n),rawValue:r}),i}function m(e,n=``){let r=l(e==null?t:e);return o==null||o(r,{scopeKey:String(n==null?``:n)}),c.write(String(n==null?``:n),r),s==null||s(r,{scopeKey:String(n==null?``:n)}),r}return{read:d,write:f,readSync:p,writeSync:m,normalize:l}}function wt(e,t){if(e.file){t();return}let n=e.requestFile;if(!n){e.submitAfterFileSelection=!1;return}e.submitAfterFileSelection=!0,n()}function Tt(e,t,n){if(e.file=t,!t){e.submitAfterFileSelection=!1;return}e.submitAfterFileSelection&&(e.submitAfterFileSelection=!1,n())}function Et(e){e.submitAfterFileSelection=!1}function Dt(e=[]){let t=[];if(!Array.isArray(e))return t;for(let a of e){var n,r,i;if(!a||typeof a!=`object`||Array.isArray(a))continue;let e=a;e.key!=null&&t.push({key:String(e.key),label:String((n=e.label)==null?e.key:n),icon:String((r=e.icon)==null?`database`:r),checked:e.checked!==!1,disabled:!!e.disabled,title:String((i=e.title)==null?``:i)})}return t}function Ot(e,t){return Object.freeze({kind:e,render:t})}function kt(e,t,n){if(At(e))return e.render(jt(t),n);let r=document.createElement(`div`);return r.className=`hwhx-native-body hwhx-empty-state`,r.textContent=`Этот экран недоступен в Lite-сборке.`,r}function At(e){return typeof e==`object`&&!!e&&typeof e.render==`function`}function jt(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Mt(e,t){return t?e.closeOnClick===!0?{notifyAction:!1,close:!0}:{notifyAction:!0,close:!1}:{notifyAction:!0,close:e.closeOnClick!==!1}}var Nt=null;function Pt(){x(),S()}function Ft(e){return Pt(),M(!1),new Promise(t=>{var n,r;let i=document.createElement(`div`);i.className=[`hwhx-modal`,`hwhx-build-lite`,e.className].filter(Boolean).join(` `),i.dataset.hwhxBuildProfile=`lite`,i.dataset.hwhxModalKind=(n=e.kind)==null?`generic`:n,i.dataset.hwhxUiTheme=(r=e.uiTheme)==null?`classic`:r;let a=document.createElement(`section`);a.className=`hwhx-modal__dialog`,a.tabIndex=-1,i.appendChild(a);let o={actions:Bt(e.actions),dialog:a,footer:null,keydown:()=>void 0,onAction:e.onAction,onBeforeClose:e.onBeforeClose,overlay:i,resolve:t};Nt=o,a.appendChild(It(e,o));let s=document.createElement(`div`);s.className=`hwhx-modal__body`,s.appendChild(kt(e.component,e.props,{close:M})),a.appendChild(s),Rt(o),i.addEventListener(`pointerdown`,e=>{e.target===i&&M(!1)}),o.keydown=e=>{e.key!==`Escape`||Nt!==o||(e.preventDefault(),e.stopPropagation(),M(!1))},document.addEventListener(`keydown`,o.keydown,!0),document.body.appendChild(i),queueMicrotask(()=>a.focus({preventScroll:!0}))})}function M(e=!1){var t;let n=Nt;if(!n)return;Nt=null,document.removeEventListener(`keydown`,n.keydown,!0),n.overlay.remove();let r=(t=n.onBeforeClose)==null?void 0:t.call(n,e);n.resolve(r===void 0?e:r)}function It(e,t){let n=document.createElement(`header`);n.className=`hwhx-modal__header`;let r=document.createElement(`div`);r.className=`hwhx-modal__identity`;let i=document.createElement(`strong`);i.className=`hwhx-modal__title`,i.textContent=Vt(e.header)||e.title||``,r.appendChild(i),Lt(r,e.header),n.appendChild(r);let o=document.createElement(`div`);o.className=`hwhx-modal__toolbar`;for(let n of Bt(e.headerActions))o.appendChild(zt(n,t,!0));let s=document.createElement(`button`);return s.type=`button`,s.className=`hwhx-button hwhx-modal__close`,s.dataset.tone=`danger`,s.textContent=`×`,s.ariaLabel=e.closeLabel||(a()===`ru`?`Закрыть`:`Close`),s.addEventListener(`click`,()=>M(!1)),o.appendChild(s),n.appendChild(o),n}function Lt(e,t){let n=Ht(t).badges;if(!Array.isArray(n)||n.length===0)return;let r=document.createElement(`div`);r.className=`hwhx-modal__meta`;for(let e of n){var i,a;let t=Ht(e),n=document.createElement(`span`);n.className=`hwhx-modal-badge`,n.dataset.tone=String((i=t.tone)==null?`gray`:i),n.textContent=String((a=t.label)==null?``:a),t.title&&(n.dataset.hwhxNativeTitle=String(t.title)),r.appendChild(n)}e.appendChild(r)}function Rt(e){var t;if((t=e.footer)==null||t.remove(),e.footer=null,e.actions.length===0)return;let n=document.createElement(`footer`);n.className=`hwhx-modal__actions`;let r=document.createElement(`div`);r.className=`hwhx-modal__actions-side hwhx-modal__actions-side--left`;let i=document.createElement(`div`);i.className=`hwhx-modal__actions-side hwhx-modal__actions-side--right`;for(let t of e.actions)(t.placement===`left`?r:i).appendChild(zt(t,e,!1));n.append(r,i),e.dialog.appendChild(n),e.footer=n}function zt(e,t,n){var r;let i=document.createElement(`button`);i.type=`button`,i.className=`hwhx-button hwhx-button--modal`,i.dataset.action=e.result,i.dataset.tone=(r=e.tone)==null?`secondary`:r,i.disabled=!!e.disabled||!!e.loading,i.textContent=e.loading?`…`:e.label;let a=e.tooltip||e.title;return a&&(i.dataset.hwhxNativeTitle=a),i.addEventListener(`click`,()=>{var r;if(i.disabled||Nt!==t)return;let a=Mt(e,n);a.notifyAction&&((r=t.onAction)==null||r.call(t,e.result)),a.close&&M(e.result)}),i}function Bt(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.result==`string`):[]}function Vt(e){var t;return String((t=Ht(e).title)==null?``:t).trim()}function Ht(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}var Ut=Ot(`settings-transfer-checklist`,Gt);async function Wt({title:e=`Выберите блоки`,options:t=[],mode:n=`export`,confirmLabel:r=`Продолжить`,cancelLabel:i=`Отмена`,fileLabel:a=`JSON файл`,searchPlaceholder:o=`Поиск`,emptyLabel:s=`Ничего не найдено`}={}){let c=Dt(t),l={selectedKeys:c.filter(e=>e.checked&&!e.disabled).map(e=>e.key)};return l.onFileSelected=e=>Tt(l,e,()=>M(`confirm`)),l.onFileSelectionCanceled=()=>Et(l),await Ft({title:e,kind:`checklist`,className:`hwhx-modal--checklist`,component:Ut,props:{state:l,mode:n,fileLabel:a,searchPlaceholder:o,emptyLabel:s,options:c},actions:[{result:`cancel`,label:i,tone:`danger`},{result:`confirm`,label:r,tone:`success`,closeOnClick:n!==`import`}],onAction:e=>{n===`import`&&e===`confirm`&&wt(l,()=>M(`confirm`))}})===`confirm`?{confirmed:!0,selectedKeys:l.selectedKeys,file:l.file}:{confirmed:!1,selectedKeys:[]}}function Gt(e){var t;let n=e.state,r=e.options,i=document.createElement(`div`);if(i.className=`hwhx-settings-transfer-checklist`,e.mode===`import`){var a;i.appendChild(Kt(n,String((a=e.fileLabel)==null?`JSON файл`:a)))}let o=document.createElement(`input`);o.type=`search`,o.className=`hwhx-input hwhx-settings-transfer-checklist__search`,o.placeholder=String((t=e.searchPlaceholder)==null?`Поиск`:t),i.appendChild(o);let s=document.createElement(`div`);s.className=`hwhx-checkbox-list`,i.appendChild(s);let c=()=>{let t=o.value.trim().toLocaleLowerCase();s.replaceChildren();let i=0;for(let e of r)t&&!e.label.toLocaleLowerCase().includes(t)||(s.appendChild(qt(e,n)),i+=1);if(i===0){var a;let t=document.createElement(`div`);t.className=`hwhx-empty-state`,t.textContent=String((a=e.emptyLabel)==null?`Ничего не найдено`:a),s.appendChild(t)}};return o.addEventListener(`input`,c),c(),i}function Kt(e,t){let n=document.createElement(`label`);n.className=`hwhx-settings-field`;let r=document.createElement(`span`);r.textContent=t;let i=document.createElement(`input`);return i.type=`file`,i.accept=`application/json,.json`,i.addEventListener(`change`,()=>{var t,n;(t=e.onFileSelected)==null||t.call(e,(n=i.files)==null?void 0:n[0])}),i.addEventListener(`cancel`,()=>{var t;return(t=e.onFileSelectionCanceled)==null?void 0:t.call(e)}),e.requestFile=()=>{if(typeof i.showPicker==`function`)try{i.showPicker();return}catch(e){}i.click()},n.append(r,i),n}function qt(e,t){let n=document.createElement(`label`);n.className=`hwhx-checkbox-list__item`,e.title&&(n.dataset.hwhxNativeTitle=e.title);let r=document.createElement(`input`);r.type=`checkbox`,r.disabled=!!e.disabled,r.checked=t.selectedKeys.includes(e.key),r.addEventListener(`change`,()=>{let n=new Set(t.selectedKeys);r.checked?n.add(e.key):n.delete(e.key),t.selectedKeys=[...n]});let i=document.createElement(`span`);return i.textContent=e.label,n.append(r,i),n}var Jt=`hwhx:settings-transfer:download-json`,Yt=`__hwhxSettingsDownloadBridgeInstalled`,Xt=10*1024*1024,Zt=`null`;function Qt(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function N(e,t){return e==null?t:String(e)}function $t({scriptId:e,scriptName:t,scriptVersion:n=``,exportVersion:r,storageSchemaVersion:i,userId:a=void 0,data:o,extra:s={}}){return{scriptId:String(e==null?``:e),scriptName:String(t==null?``:t),scriptVersion:String(n==null?``:n),exportVersion:r,storageSchemaVersion:i,exportedAt:new Date().toISOString(),...a===void 0?{}:{userId:String(a)},...s,data:o}}function en(e,t){return`${String(e==null?`unknown`:e).trim().replaceAll(/[^\w.-]+/g,`_`)||`unknown`}.${String(t==null?`settings.json`:t).trim().replace(/^\.*/,``)}`}function tn(){try{return globalThis.self!==globalThis.top}catch(e){return!0}}function nn(e){let t=String(e==null?``:e).trim();if(!t||t===Zt)return``;try{let e=new URL(t).origin;return e===Zt?``:e}catch(e){return``}}function rn(){var e,t;return nn((e=globalThis.location)==null?void 0:e.origin)||nn((t=globalThis.location)==null?void 0:t.href)}function an(){let e=globalThis.location,t=e==null?void 0:e.ancestorOrigins;return t?Array.from({length:t.length},(e,n)=>nn(t[n])).filter(Boolean):[]}function on(){try{return nn(document.referrer)}catch(e){return``}}function sn(){return an()[0]||on()}function cn(e){let t=nn(e);return!!(t&&[rn(),on(),...an()].includes(t))}function ln(e){if(!e)return!1;try{for(let t of document.querySelectorAll(`iframe`))if(t.contentWindow===e)return!0}catch(e){}return!1}function un(e){let t=String(e==null?`settings.json`:e).trim().replaceAll(/[\\/:*?"<>|]+/g,`_`)||`settings.json`;return t.toLowerCase().endsWith(`.json`)?t:`${t}.json`}function dn(e,t,n){let r=new globalThis.Blob([t],{type:n}),i=globalThis.URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=un(e),a.style.display=`none`,document.body.appendChild(a),a.click(),a.remove(),globalThis.setTimeout(()=>globalThis.URL.revokeObjectURL(i),1e3)}function fn(e){if(typeof e!=`string`||e.length===0||e.length>Xt)return!1;try{return JSON.parse(e),!0}catch(e){return!1}}function pn(e){let t=e;return!!t&&t.hwhx===`settings-transfer`&&t.type===Jt&&fn(t.content)}function mn(e){if(!pn(e.data))return!1;let t=e.source;return!t||t===globalThis?!1:ln(t)?!0:cn(e.origin)}function hn(){if(tn())return;let e=globalThis;e[Yt]||(e[Yt]=!0,globalThis.addEventListener(`message`,e=>{tn()||!mn(e)||dn(e.data.fileName,e.data.content,`application/json;charset=utf-8`)}))}function gn(e,t){if(!tn())return!1;let n=sn();if(!n)return!1;try{var r;return(r=globalThis.top)==null||r.postMessage({hwhx:`settings-transfer`,type:Jt,fileName:e,content:t},n),!0}catch(e){return!1}}function _n(e,t){let n=`${JSON.stringify(t,null,2)}\n`;hn(),!gn(e,n)&&dn(e,n,`application/json;charset=utf-8`)}function vn(e){return e?typeof e.text==`function`?e.text():new Promise((t,n)=>{let r=new globalThis.FileReader;r.addEventListener(`load`,()=>{var e;return t(String((e=r.result)==null?``:e))}),r.addEventListener(`error`,()=>n(r.error)),r.readAsText(e)}):Promise.resolve(void 0)}function yn(e=[]){return(Array.isArray(e)?e:[]).flatMap(e=>{var t,n,r;let i=Qt(e);return!i||i.key==null?[]:[{key:String(i.key),label:String((t=i.label)==null?i.key:t),icon:String((n=i.icon)==null?`database`:n),checked:i.checked!==!1,title:String((r=i.title)==null?``:r)}]})}function bn(e){let t=Qt(e),n=Qt(t==null?void 0:t.data);return n?Object.keys(n):[]}function xn(e){return(Array.isArray(e)?e:[]).map(e=>({key:String(e),label:String(e),icon:`database`,checked:!0,title:``}))}function Sn(e,t=[]){let n=Qt(e),r=Qt(n==null?void 0:n.data);if(!n||!r||!Array.isArray(t)||t.length===0)return e;let i=new Set(t.map(String));return{...n,data:Object.fromEntries(Object.entries(r).filter(([e])=>i.has(e)))}}function Cn(e={},t=`export`){var n,r;let i=t===`export`;return{title:N(e[i?`exportSelectTitle`:`importSelectTitle`],i?`Выберите блоки для экспорта`:`Выберите блоки для импорта`),confirmLabel:N(e[i?`exportSelectConfirm`:`importSelectConfirm`],i?`Экспортировать`:`Импортировать`),cancelLabel:N(e.cancel,`Отмена`),fileLabel:N(e.importFileLabel,`JSON файл`),searchPlaceholder:N((n=e.searchPlaceholder)==null?e.search:n,`Поиск`),clearSearchLabel:N(e.clearSearch,`Очистить поиск`),emptyLabel:N((r=e.empty)==null?e.noOptions:r,`Ничего не найдено`),selectAllLabel:N(e.selectAll,`Выбрать все`),clearAllLabel:N(e.clearAll,`Снять все`),sortLabel:N(e.sort,`Сортировка`),sortByLabelLabel:N(e.sortByLabel,`По названию`),sortSelectedLabel:N(e.sortSelected,`Выбранные сверху`),sortAscendingLabel:N(e.sortAsc,`По возрастанию`),sortDescendingLabel:N(e.sortDesc,`По убыванию`)}}function wn(e,t){return{uiTheme:t,searchPlaceholder:e.searchPlaceholder,clearSearchLabel:e.clearSearchLabel,emptyLabel:e.emptyLabel,selectAllLabel:e.selectAllLabel,clearAllLabel:e.clearAllLabel,sortLabel:e.sortLabel,sortAscendingLabel:e.sortAscendingLabel,sortDescendingLabel:e.sortDescendingLabel,sortOptions:[{value:`label`,label:e.sortByLabelLabel,icon:`align-center`},{value:`selected`,label:e.sortSelectedLabel,icon:`check`}],sortWidthPx:210}}async function Tn(e,t=[],n={},r=void 0,i=!1){let a=yn(t),o=a.length>0?a:xn(bn(e));if(!i&&o.length<=1)return o.map(e=>e.key);let s=Cn(n,`export`),c=await Wt({title:s.title,options:o,mode:`export`,confirmLabel:s.confirmLabel,cancelLabel:s.cancelLabel,...wn(s,r)});return c.confirmed?c.selectedKeys:void 0}async function En({parsedValue:e,options:t=[],labels:n={},uiTheme:r=void 0,alwaysShowChecklist:i=!1}){let a=bn(e),o=new Set(a),s=yn(t),c=s.length>0?s.map(e=>({...e,checked:e.checked!==!1&&o.has(e.key),disabled:!o.has(e.key)})):xn(a);if(!i&&c.length<=1)return a;let l=Cn(n,`import`),u=await Wt({title:l.title,options:c,mode:`export`,confirmLabel:l.confirmLabel,cancelLabel:l.cancelLabel,...wn(l,r)});return u.confirmed?u.selectedKeys:void 0}async function Dn(e=[],t={},n=void 0){let r=yn(e),i=Cn(t,`import`),a=await Wt({title:i.title,options:r,mode:`import`,confirmLabel:i.confirmLabel,cancelLabel:i.cancelLabel,fileLabel:i.fileLabel,...wn(i,n)});return a.confirmed?{fileText:await vn(a.file),selectedKeys:a.selectedKeys}:{fileText:void 0,selectedKeys:void 0}}function On(e,t){try{return JSON.parse(String(e==null?``:e))}catch(e){throw typeof t==`function`?t():Error(`Invalid JSON.`)}}async function kn({payload:e,normalize:t,write:n,invalidMessage:r=`Invalid settings import payload.`}){if(!Qt(e))throw Error(String(r==null?`Invalid settings import payload.`:r));let i=t(e);return await n(i),i}function An({buildPayload:e,buildFileName:t,parseImport:n,applyImport:r,showNotice:i=()=>{},labels:a={},exportOptions:o=[],importOptions:s=o,uiTheme:c=void 0,alwaysShowChecklist:l=!1}={}){async function u(...n){if(typeof e!=`function`||typeof t!=`function`)throw Error(`Settings export requires buildPayload and buildFileName.`);let r=await e(...n),s=await Tn(r,o,a,c,l);if(s===void 0)return!1;let u=Sn(r,s);return _n(t(u),u),await i(a.exportDone,{phase:`export`}),u}async function d(...e){var t;if(typeof n!=`function`||typeof r!=`function`)throw Error(`Settings import requires parseImport and applyImport.`);let o=await Dn(s,a,c),u=o.fileText;if(u===void 0||u===``)return!1;let d=On(u,a.parseError?()=>Error(String(a.parseError)):void 0),f=(t=o.selectedKeys)==null?await En({parsedValue:d,options:s,labels:a,uiTheme:c,alwaysShowChecklist:l}):t;return f===void 0?!1:(await r(await n(Sn(d,f),...e),...e),await i(a.importDone,{phase:`import`}),!0)}return{exportToJson:u,importFromJson:d}}function jn(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function Mn(e,t){jn(e,t),t.add(e)}function Nn(e){"@babel/helpers - typeof";return Nn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Nn(e)}function Pn(e,t){if(Nn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Nn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Fn(e){var t=Pn(e,`string`);return Nn(t)==`symbol`?t:t+``}function In(e,t,n){return(t=Fn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}var Ln=new WeakSet,Rn=class{constructor({keyPrefix:n,schemaVersion:r,migrations:i={},storage:a=e(),warn:o=t}){Mn(this,Ln),In(this,`keyPrefix`,void 0),In(this,`schemaVersion`,void 0),In(this,`migrations`,void 0),In(this,`storage`,void 0),In(this,`warn`,void 0),this.keyPrefix=n,this.schemaVersion=r,this.migrations=i,this.storage=a,this.warn=o}key(e){return`${this.keyPrefix}${e}`}read(e,t){let n;try{var r,i;n=(r=(i=this.storage)==null?void 0:i.getItem(this.key(e)))==null?null:r}catch(e){return this.warn(`[hwh] versioned storage read failed`,e),t}if(!n)return t;let a;try{a=JSON.parse(n)}catch(e){return t}return P(Ln,this,Bn).call(this,a)}write(e,t){let n={schemaVersion:this.schemaVersion,value:t};try{var r;(r=this.storage)==null||r.setItem(this.key(e),JSON.stringify(n))}catch(e){this.warn(`[hwh] versioned storage write failed`,e)}}remove(e){try{var t;(t=this.storage)==null||t.removeItem(this.key(e))}catch(e){this.warn(`[hwh] versioned storage remove failed`,e)}}};function zn(e){let t=e;for(let e=0;e<8&&!(!t||typeof t!=`object`||!Object.prototype.hasOwnProperty.call(t,`value`));e+=1)t=t.value;return t}function Bn(e){let t=Number(e==null?void 0:e.schemaVersion)||1,n=P(Ln,this,zn).call(this,e);for(;t${Qn(e,{className:n.iconClassName,title:n.title})} ${i(t)}`}function Qn(e,t={}){var n,r;let a=(n=Yn[String(e==null?``:e)])==null?``:n;if(!a)return``;let o=[`hwhx-lite-glyph`,`hwhx-emoji-icon`,t.className].filter(Boolean).join(` `),s=String((r=t.title)==null?``:r).trim(),c=s?` data-hwhx-native-title="${i(s)}"`:``,l=Math.max(10,Math.min(32,Number(t.size)||16));return``}function F(e,t,n){jn(e,t),t.set(e,n)}function I(e,t,n){return e.set(P(e,t),n),n}function L(e,t){return e.get(P(e,t))}var $n=`localforage`,er=`keyvaluepairs`,tr=new Map;function nr(){try{var e;return(e=globalThis.indexedDB)==null?null:e}catch(e){return null}}function rr(e){return Error(e)}function ir(e,t,n,r){return new Promise((i,a)=>{let o=!1,s=r===void 0?e.open(t):e.open(t,r);s.addEventListener(`upgradeneeded`,()=>{s.result.objectStoreNames.contains(n)||s.result.createObjectStore(n)}),s.addEventListener(`error`,()=>{var e;o=!0,a((e=s.error)==null?rr(`IndexedDB open failed`):e)}),s.addEventListener(`blocked`,()=>{o=!0,a(rr(`IndexedDB open blocked`))}),s.addEventListener(`success`,()=>{if(o){s.result.close();return}o=!0,i(s.result)})})}function ar(e){return new Promise((t,n)=>{e.addEventListener(`error`,()=>{var t;return n((t=e.error)==null?rr(`IndexedDB request failed`):t)}),e.addEventListener(`success`,()=>t(e.result))})}function or(e){return new Promise((t,n)=>{e.addEventListener(`abort`,()=>{var t;return n((t=e.error)==null?rr(`IndexedDB transaction aborted`):t)}),e.addEventListener(`error`,()=>{var t;return n((t=e.error)==null?rr(`IndexedDB transaction failed`):t)}),e.addEventListener(`complete`,()=>t())})}function sr(e){return new Promise((t,n)=>{let r=[],i=e.openKeyCursor();i.addEventListener(`error`,()=>{var e;return n((e=i.error)==null?rr(`IndexedDB cursor failed`):e)}),i.addEventListener(`success`,()=>{let e=i.result;if(!e){t(r);return}r.push(String(e.key)),e.continue()})})}function cr(e){return e===void 0?null:e}function lr(e){return JSON.parse(e)}function ur(e){return JSON.stringify(cr(e))}var dr=new WeakMap,R=new WeakMap,fr=new WeakMap,z=new WeakMap,pr=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap,U=new WeakSet,mr=class{constructor({databaseName:t=$n,indexedDb:r=nr(),localStorage:i=e(),storeName:a=er}={}){var o;Mn(this,U),F(this,dr,void 0),F(this,R,void 0),F(this,fr,void 0),F(this,z,void 0),F(this,pr,void 0),F(this,B,void 0),F(this,V,null),F(this,H,null),I(dr,this,t),I(fr,this,r),I(B,this,a),I(pr,this,`${t}/${a===er?``:`${a}/`}`),I(R,this,n(L(pr,this),i));let s=`${t}/${a}`;I(z,this,(o=tr.get(s))==null?new Map:o),tr.set(s,L(z,this))}async getItem(e){let t=String(e),n=await P(U,this,hr).call(this);if(n)try{let e=await ar(n.transaction(L(B,this),`readonly`).objectStore(L(B,this)).get(t));if(e!==void 0)return e}catch(e){P(U,this,_r).call(this)}let r=P(U,this,yr).call(this,t);return r.found?(n&&await P(U,this,vr).call(this,n,t,r.value).catch(()=>void 0),r.value):L(z,this).has(t)?L(z,this).get(t):null}async setItem(e,t){let n=String(e),r=cr(t),i=await P(U,this,hr).call(this);if(i)try{return await P(U,this,vr).call(this,i,n,r),P(U,this,xr).call(this,n),L(z,this).delete(n),r}catch(e){P(U,this,_r).call(this)}return P(U,this,br).call(this,n,r)?(L(z,this).delete(n),r):(L(z,this).set(n,r),r)}async removeItem(e){let t=String(e),n=await P(U,this,hr).call(this);if(n)try{let e=n.transaction(L(B,this),`readwrite`);e.objectStore(L(B,this)).delete(t),await or(e)}catch(e){P(U,this,_r).call(this)}P(U,this,xr).call(this,t),L(z,this).delete(t)}async clear(){let e=await P(U,this,hr).call(this);if(e)try{let t=e.transaction(L(B,this),`readwrite`);t.objectStore(L(B,this)).clear(),await or(t)}catch(e){P(U,this,_r).call(this)}P(U,this,Cr).call(this),L(z,this).clear()}async keys(){let e=new Set,t=await P(U,this,hr).call(this);if(t)try{let n=t.transaction(L(B,this),`readonly`);for(let t of await sr(n.objectStore(L(B,this))))e.add(t)}catch(e){P(U,this,_r).call(this)}for(let t of P(U,this,Sr).call(this))e.add(t);for(let t of L(z,this).keys())e.add(t);return[...e]}};async function hr(){if(!L(fr,this))return null;if(L(V,this))return L(V,this);L(H,this)||I(H,this,P(U,this,gr).call(this).catch(()=>null));let e=await L(H,this);return I(H,this,null),e?(I(V,this,e),e.addEventListener(`versionchange`,()=>{e.close(),L(V,this)===e&&I(V,this,null)}),e):null}async function gr(){let e=await ir(L(fr,this),L(dr,this),L(B,this));if(e.objectStoreNames.contains(L(B,this)))return e;let t=e.version+1;return e.close(),ir(L(fr,this),L(dr,this),L(B,this),t)}function _r(){var e;(e=L(V,this))==null||e.close(),I(V,this,null),I(H,this,null)}async function vr(e,t,n){let r=e.transaction(L(B,this),`readwrite`);r.objectStore(L(B,this)).put(n,t),await or(r)}function yr(e){try{let t=L(R,this).getItem(e);return t===null?{found:!1,value:void 0}:{found:!0,value:lr(t)}}catch(e){return{found:!1,value:void 0}}}function br(e,t){try{return L(R,this).setItem(e,ur(t))}catch(e){return!1}}function xr(e){L(R,this).removeItem(e)}function Sr(){return L(R,this).keys()}function Cr(){L(R,this).clear()}var wr;function Tr(){var e;return(e=wr)==null?wr=new mr:e}function Er(e,t){for(let t of Object.keys(e))delete e[t];Object.assign(e,t)}function Dr(e,t,n,r={}){var i;let a=`hwhx-settings-${e}`,o=(i=r.storage)==null?Tr():i,s={...t},c=new Map,l=new Map;async function u(){var e,t;let n=String((e=await((t=r.getStorageScopeKey)==null?void 0:t.call(r)))==null?``:e).trim();return n?`${a}:${encodeURIComponent(n)}`:a}function d(e){return n?n(e):e&&typeof e==`object`?e:{...t}}async function f({force:e=!1,preferSource:t=!1}={}){let n=await u(),r=c.get(n);if(!e&&r){Er(s,{...r});return}let i=`${n}:${t?`source`:`cache`}`,a=l.get(i);a||(a=p(n,t),l.set(i,a));try{let e=await a;c.set(n,e),Er(s,{...e})}finally{l.get(i)===a&&l.delete(i)}}async function p(e,n){try{var i;if(!n){let t=await o.getItem(e);if(t!=null)return d(t)}let t=await((i=r.read)==null?void 0:i.call(r));if(t!==void 0){let n=d(t);return await o.setItem(e,n),n}}catch(e){}return{...t}}async function m(){var e;let t=d({...s});Er(s,t);let n=await u();await o.setItem(n,t),await((e=r.write)==null?void 0:e.call(r,t)),c.set(n,t)}function h(){Er(s,{...t})}let g={state:s,load:f,save:m,reset:h};return{storageKey:a,resolveStorageKey:u,useStore:()=>g}}var Or=[`top-center`,`top-right`,`bottom-right`],kr=[`default`,`compact`,`dashboard`],Ar={progressWindowPosition:`top-right`,progressWindowStyle:`default`,progressAutoHideResult:!1,progressAutoHideResultTimeoutMs:5e3};function jr(e,t=Ar){let n=Fr(e),r={...Ar,...t};return{progressWindowPosition:Mr(n.progressWindowPosition,Or,r.progressWindowPosition),progressWindowStyle:Mr(n.progressWindowStyle,kr,r.progressWindowStyle),progressAutoHideResult:Nr(n.progressAutoHideResult,r.progressAutoHideResult),progressAutoHideResultTimeoutMs:Pr(n.progressAutoHideResultTimeoutMs,r.progressAutoHideResultTimeoutMs,1e3)}}function Mr(e,t,n){return t.includes(e)?e:n}function Nr(e,t){return e===!0||e===1||e===`1`||e===`true`?!0:e===!1||e===0||e===`0`||e===`false`?!1:t}function Pr(e,t,n=1){let r=Math.trunc(Number(e));return Number.isFinite(r)?Math.max(n,r):Math.max(n,t)}function Fr(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}var Ir=`.hwhx-modal,.hwhx-custom-select.is-open,.hwhx-multiselect.is-open,.hwhx-hotkey-input.is-recording`;function Lr(e,t,n=document){var r;if(!t||e.key!==`Escape`||e.defaultPrevented||n.querySelector(`.hwhx-modal`))return!1;let i=e.target;if(!(i==null||(r=i.closest)==null)&&r.call(i,Ir))return!1;let a=n.querySelectorAll(`.hwhx-progress.is-visible`);return a.item(a.length-1)===t}var Rr={preparing:{emoji:`🚦`,label:`Подготавливаем запуск`,description:`Проверяем настройки и доступные ресурсы.`},loading:{emoji:`📥`,label:`Получаем данные игры`,description:`Загружаем актуальное состояние с игрового сервера.`},planning:{emoji:`🧭`,label:`Строим план действий`,description:`Считаем цели, ограничения и оптимальный порядок операций.`},batching:{emoji:`🧩`,label:`Формируем пакет команд`,description:`Объединяем совместимые операции в серверный пакет.`},sending:{emoji:`🌐`,label:`Отправляем пакет на сервер`,description:`Передаём подготовленные команды игровому серверу.`},waiting:{emoji:`⏳`,label:`Ждём ответ сервера`,description:`Сервер выполняет отправленные команды.`},processing:{emoji:`⚙️`,label:`Обрабатываем ответ сервера`,description:`Проверяем результаты и изменения ресурсов.`},applying:{emoji:`📦`,label:`Применяем изменения`,description:`Обновляем локальный план по подтверждённым результатам.`},syncing:{emoji:`🔄`,label:`Синхронизируем состояние`,description:`Сверяем локальные данные с состоянием игры.`},finalizing:{emoji:`✅`,label:`Подводим итог`,description:`Собираем итоговые результаты запуска.`}},zr={preparing:{emoji:`🚦`,label:`Preparing the run`,description:`Checking settings and available resources.`},loading:{emoji:`📥`,label:`Loading game data`,description:`Fetching the latest state from the game server.`},planning:{emoji:`🧭`,label:`Building the action plan`,description:`Calculating goals, limits, and operation order.`},batching:{emoji:`🧩`,label:`Building a command batch`,description:`Combining compatible operations into a server batch.`},sending:{emoji:`🌐`,label:`Sending the batch`,description:`Sending prepared commands to the game server.`},waiting:{emoji:`⏳`,label:`Waiting for the server`,description:`The game server is executing the submitted commands.`},processing:{emoji:`⚙️`,label:`Processing the server response`,description:`Checking results and resource changes.`},applying:{emoji:`📦`,label:`Applying changes`,description:`Updating the local plan with confirmed results.`},syncing:{emoji:`🔄`,label:`Synchronizing state`,description:`Reconciling local data with the game state.`},finalizing:{emoji:`✅`,label:`Finalizing results`,description:`Building the final run summary.`}},Br=new Set([`batching`,`sending`,`waiting`,`processing`]);function Vr(e){let t=Hr(e.language)===`ru`,n=(t?Rr:zr)[e.phase],r=Gr(e.current),i=Gr(e.total),a=Kr(e.itemCount),o=[n.description];if(r!==void 0&&i!==void 0){let n=qr(e.counterLabel)||(t?`Пакет`:`Batch`);o.push(t?`${n} ${Math.min(r,i)} из ${i}.`:`${n} ${Math.min(r,i)} of ${i}.`)}if(a!==void 0){let n=qr(e.itemLabel)||(t?`Команд в пакете`:`Commands in this batch`);o.push(`${n}: ${a}.`)}let s=qr(e.requestName);s&&o.push(`${t?`Команда сервера`:`Server command`}: ${s}.`);let c=qr(e.detail);return c&&o.push(c),i===1&&Br.has(e.phase)&&e.explainSingleBatch!==!1&&o.push(t?`Один пакет может содержать много объединённых команд — это не объём потраченной энергии.`:`One batch may contain many combined commands; it is not the amount of energy spent.`),{stageLabel:`${n.emoji} ${n.label}`,content:o.join(` `),percent:Ur(e.percent,r,i),intermediate:!0}}function Hr(e){let t=qr(e).toLowerCase();return t.startsWith(`ru`)?`ru`:t.startsWith(`en`)?`en`:a()===`ru`?`ru`:`en`}function Ur(e,t,n){let r=Number(e);if(Number.isFinite(r))return Wr(r);if(!(t===void 0||n===void 0||n<=0))return Wr(t/n*100)}function Wr(e){return Math.max(0,Math.min(100,e))}function Gr(e){let t=Math.trunc(Number(e));return Number.isFinite(t)&&t>0?t:void 0}function Kr(e){let t=Math.trunc(Number(e));return Number.isFinite(t)&&t>=0?t:void 0}function qr(e){return String(e==null?``:e).trim()}var Jr=new Map,Yr=!1;function Xr({scriptId:e,title:t,settings:n}){let r=`hwhx-progress-${li(e)}`,i=oi(n),a=null;function o(e=0){d();let t=Math.max(0,Number(e)||0);t>0?a=globalThis.setTimeout(()=>Qr(r),t):Qr(r)}function s(e,n=!1,a=void 0){var s,c,l,u;d();let f=mi(a);a===void 0&&(f.autoHide=n);let p=String(e==null?``:e),m=Number(f.percent),h=Number.isFinite(m)?di(m):ui(p),g=f.autoHide;Zr({id:r,title:String(t==null?``:t),content:p,contentHtml:fi(p)?pi(p):``,component:f.component,props:mi(f.props),isResult:!!f.result,resultLabel:String((s=(c=f.resultLabel)==null?f.completeText:c)==null?``:s),resultTone:String((l=f.resultTone)==null?`success`:l),percent:Number.isFinite(h)?h:null,position:i.progressWindowPosition,style:i.progressWindowStyle,stageLabel:String((u=f.stage)==null?``:u)}),g&&o(typeof g==`number`?Math.max(0,g):3e3)}function c(e,t=void 0){var n;let r={...mi(t),result:!0},a=(n=r.autoHide)==null?i.progressAutoHideResult?i.progressAutoHideResultTimeoutMs:!1:n;s(e,a,{...r,autoHide:a})}function l(e,t=!1,n=void 0){var r,i;let a=Vr(e),o=mi(n);s(a.content,t,{...o,percent:(r=o.percent)==null?a.percent:r,stage:(i=o.stage)==null?a.stageLabel:i})}function u(e){i=oi({...i,...mi(e)})}function d(){a!==null&&(globalThis.clearTimeout(a),a=null)}return{configure:u,setProgress:s,setStageProgress:l,showResult:c,hideProgress:o}}function Zr(e){var t,n;C();let r=Jr.get(e.id);r||(r=ni(e.id),Jr.set(e.id,r),document.body.appendChild(r.root),ei());let i=r.root;if(i.className=`hwhx-progress hwhx-build-lite is-visible`,i.dataset.hwhxProgressStyle=(t=e.style)==null?`default`:t,i.dataset.hwhxProgressResult=e.isResult?`1`:`0`,i.dataset.hwhxProgressResultTone=si(e.resultTone),ai(i,e.position),r.title.textContent=e.title,r.status.dataset.tone=e.isResult?si(e.resultTone):`active`,r.statusLabel.textContent=ci(e.isResult,e.resultTone),r.stage.textContent=(n=e.stageLabel)==null?``:n,r.stage.hidden=!e.stageLabel||!!e.component,e.component?(r.body.replaceChildren(kt(e.component,e.props,{close:()=>Qr(e.id)})),r.mode=`component`):(r.mode!==`content`&&(r.body.replaceChildren(r.content),r.mode=`content`),ri(r.content,e.content,e.contentHtml)),ii(r,e.percent),e.isResult&&e.resultLabel){var a;r.result.dataset.tone=(a=e.resultTone)==null?`success`:a,r.result.textContent=e.resultLabel,r.body.appendChild(r.result)}else r.result.remove()}function Qr(e){let t=Jr.get(e);t&&(Jr.delete(e),t.root.remove(),Jr.size===0&&ti())}function $r(e){var t,n;let r=document.querySelectorAll(`.hwhx-progress.is-visible`),i=r.item(r.length-1);if(!Lr(e,i))return;let a=(t=i==null?void 0:i.id)==null?``:t;((n=Jr.get(a))==null?void 0:n.root)===i&&(e.preventDefault(),e.stopPropagation(),Qr(a))}function ei(){Yr||(Yr=!0,document.addEventListener(`keydown`,$r,!0))}function ti(){Yr&&(Yr=!1,document.removeEventListener(`keydown`,$r,!0))}function ni(e){let t=document.createElement(`section`);t.id=e;let n=document.createElement(`header`);n.className=`hwhx-progress__header`;let r=document.createElement(`strong`);r.className=`hwhx-progress__title`;let i=document.createElement(`div`);i.className=`hwhx-progress__header-actions`;let a=document.createElement(`span`);a.className=`hwhx-status-badge hwhx-progress__state`;let o=document.createElement(`span`);o.className=`hwhx-status-badge__label`,a.appendChild(o);let s=document.createElement(`button`);s.type=`button`,s.className=`hwhx-icon-button`,s.textContent=`×`,s.ariaLabel=`Закрыть`,s.addEventListener(`click`,()=>Qr(e)),i.append(a,s),n.append(r,i);let c=document.createElement(`div`);c.className=`hwhx-progress__stage`,c.hidden=!0;let l=document.createElement(`div`);l.className=`hwhx-progress__body`;let u=document.createElement(`div`);u.className=`hwhx-progress__content`;let d=document.createElement(`div`);d.className=`hwhx-progress-bar`;let f=document.createElement(`div`);f.className=`hwhx-progress-bar__fill`,d.appendChild(f);let p=document.createElement(`strong`);return p.className=`hwhx-progress__result`,l.appendChild(u),t.append(n,c,l),{root:t,title:r,status:a,statusLabel:o,stage:c,body:l,content:u,progressBar:d,progressFill:f,result:p,mode:`content`}}function ri(e,t,n){if(n){e.innerHTML!==n&&(e.innerHTML=n);return}let r=t==null?``:t;e.textContent!==r&&(e.textContent=r)}function ii(e,t){if(t==null){e.progressBar.remove();return}e.progressFill.style.width=`${di(t)}%`,e.body.appendChild(e.progressBar)}function ai(e,t){e.style.inset=`auto`,e.style.transform=``,e.style.top=`8px`,t===`bottom-right`?(e.style.top=`auto`,e.style.bottom=`8px`,e.style.right=`8px`):t===`top-center`?(e.style.left=`50%`,e.style.transform=`translateX(-50%)`):e.style.right=`8px`}var oi=jr;function si(e){let t=String(e==null?`success`:e);return t===`danger`||t===`warning`?t:`success`}function ci(e,t){return e?t===`danger`?`Ошибка`:t===`warning`?`Остановлено`:`Завершено`:`Выполняется`}function li(e){return String(e==null?`script`:e).toLowerCase().replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function ui(e){let t=String(e==null?``:e).match(/(?:^|\D)(\d+)\s*\/\s*(\d+)(?:\D|$)/);if(!t)return;let n=Number(t[1]),r=Number(t[2]);return r>0?di(n/r*100):void 0}function di(e){return Math.max(0,Math.min(100,e))}function fi(e){return/<\/?[a-z][\s\S]*>/i.test(String(e==null?``:e))}function pi(e){return String(e==null?``:e).replace(/<(script|style|iframe|object|embed|link|meta)\b[\s\S]*?<\/\1>/gi,``).replace(/<(script|style|iframe|object|embed|link|meta)\b[^>]*\/?>/gi,``).replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,``).replace(/\s+(href|src|xlink:href)\s*=\s*(["'])\s*javascript:[\s\S]*?\2/gi,``)}function mi(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function hi(e){var t;let n=document.createElement(`div`);n.className=`hwhx-result-summary`,n.dataset.resultTone=String((t=e.resultTone)==null?`success`:t);let r=document.createElement(`div`);if(r.className=`hwhx-result-stack`,e.messageHtml){let t=document.createElement(`div`);t.className=`hwhx-result-message`,t.innerHTML=vi(e.messageHtml),r.appendChild(t)}let i=Array.isArray(e.accordions)?e.accordions:[];for(let e of i)r.appendChild(gi(e));return n.appendChild(r),n}function gi(e){let t=document.createElement(`details`);t.className=`hwhx-result-accordion`,t.dataset.tone=e.tone,t.open=e.defaultOpen!==!1;let n=document.createElement(`summary`);n.className=`hwhx-result-accordion__summary`,n.textContent=`${e.title} (${e.countText})`;let r=document.createElement(`div`);r.className=`hwhx-result-accordion__body`;for(let t of e.rows)r.appendChild(_i(t));return t.append(n,r),t}function _i(e){let t=document.createElement(`div`);return t.className=`hwhx-result-row`,t.dataset.kind=e.kind,t.innerHTML=vi(e.html),t}function vi(e){return String(e==null?``:e).replace(/<(script|style|iframe|object|embed|link|meta)\b[\s\S]*?<\/\1>/gi,``).replace(/<(script|style|iframe|object|embed|link|meta)\b[^>]*\/?>/gi,``).replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,``).replace(/\s+(href|src|xlink:href)\s*=\s*(["'])\s*javascript:[\s\S]*?\2/gi,``)}function yi(e){let t=document.createElement(`div`);if(t.className=`hwhx-native-body hwhx-popup`,e.note){let n=document.createElement(`p`);n.className=`hwhx-hint`,n.textContent=String(e.note),t.appendChild(n)}let n=Array.isArray(e.links)?e.links:[];for(let e of n){var r,i,a;let n=bi(e),o=document.createElement(`a`);o.className=`hwhx-button`,o.textContent=String((r=(i=n.label)==null?n.url:i)==null?``:r),o.href=String((a=n.url)==null?`#`:a),o.target=`_blank`,o.rel=`noopener noreferrer`,t.appendChild(o)}return t}function bi(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}var xi={donate:{wallet:`2200154655410578`,icon:`alfabank`,accentColor:`#ef3124`,qrDataUrl:``},contacts:[{key:`askja`,displayName:`Askja`,telegramUsername:`askja_tlgrm`,qrPath:`/contacts/telegram-askja.png`},{key:`zingery`,displayName:`ZingerY`,telegramUsername:`AlysonWi`,qrPath:`/contacts/telegram-zingery.png`}],feedback:{contact:`askja`},community:{forumUrl:`https://t.me/+ppLK1qqObB43NjMy`},documentation:{links:[{key:`primary`,url:`https://ext-askja.zingery.ru`},{key:`mirror-1`,url:`https://hwhx-askja.h0w.top/`}]}},Si,Ci,wi,Ti,Ei,Di,Oi=xi.donate,ki=xi.community,Ai=String((Si=Oi.wallet)==null?``:Si);String((Ci=Oi.icon)==null?`wallet-cards`:Ci),String((wi=Oi.accentColor)==null?`#ef3124`:wi),String((Ti=Oi.qrDataUrl)==null?``:Ti),String((Ei=ki.forumUrl)==null?``:Ei);var ji=Object.freeze(xi.contacts.map(e=>{let t=String(e.telegramUsername).replace(/^@/,``);return Object.freeze({key:String(e.key),displayName:String(e.displayName),telegramUsername:t,telegramUrl:`https://t.me/${t}`,qrPath:String(e.qrPath)})}));function Mi(e){return String(e==null?``:e).replace(/^@/,``).replace(/[^a-zA-Z0-9_]/g,``)}function Ni(e){return Mi(e).toLocaleLowerCase(`en`)}function Pi(e){let t=Ni(e);return ji.find(e=>Ni(e.key)===t||Ni(e.displayName)===t||Ni(e.telegramUsername)===t)}function Fi(e,t=`askja`){let n=Pi(e);if(n)return n.telegramUrl;let r=Pi(t);return`https://t.me/${Mi(e)||(r==null?void 0:r.telegramUsername)||Mi(t)}`}Fi(String((Di=xi.feedback.contact)==null?`askja`:Di),`askja`);var Ii=Object.freeze(xi.documentation.links.map(e=>({key:String(e.key),url:String(e.url)}))),Li=`hwhVacuumSettings`,Ri=`hwhvacuumRunSelectedShops`,zi=new Set([`coin:25`,`petcoin:25`]),W=[`titans`,`heroes`,`pets`],Bi=[`heroArtifactFragments`,`titanArtifactFragments`],Vi=[...W,...Bi],Hi=`main`,Ui=`other`,Wi=`hwhShopVacuumAction`,Gi=`shopPurchases`,Ki=[Gi,...Vi],qi=[`fragmentArtifact`,`fragmentHeroArtifact`,`artifactFragment`],Ji=[`fragmentTitanArtifact`],Yi=[0,1,2],G=[10,17,1,8,9,4,5,6],Xi=[`gold:0`,`coin:4`,`coin:25`,`coin:5`,`coin:6`,`coin:1`,`coin:2`,`coin:3`],Zi=new Set([`gear`,`scroll`,`fragmentGear`,`fragmentScroll`]),Qi={1:{nameKey:`~i8`,currencyKey:`gold:0`,icon:`shopping-bag`,accentColor:`#ffd36e`},4:{nameKey:`~i7`,currencyKey:`coin:1`,icon:`swords`,accentColor:`#67c7ff`},5:{nameKey:`~ib`,currencyKey:`coin:2`,icon:`trophy`,accentColor:`#ff8fd5`},6:{nameKey:`~if`,currencyKey:`coin:3`,icon:`shield`,accentColor:`#8fdd7c`},8:{nameKey:`~ie`,currencyKey:`coin:5`,icon:`sparkles`,accentColor:`#d9a0ff`},9:{nameKey:`~ia`,currencyKey:`coin:6`,icon:`users`,accentColor:`#ff7db8`},10:{nameKey:`~ic`,currencyKey:`coin:4`,icon:`gem`,accentColor:`#ff9c57`},17:{nameKey:`~id`,currencyKey:`coin:25`,icon:`paw-print`,accentColor:`#7fe3ba`}},$i={"gold:0":{nameKey:`~h1`,icon:`coins`,accentColor:`#ffd36e`},"coin:1":{nameKey:`~gY`,icon:`swords`,accentColor:`#67c7ff`},"coin:2":{nameKey:`~h2`,icon:`trophy`,accentColor:`#ff8fd5`},"coin:3":{nameKey:`~h7`,icon:`shield`,accentColor:`#8fdd7c`},"coin:4":{nameKey:`~h4`,icon:`gem`,accentColor:`#ff9c57`},"coin:5":{nameKey:`~h6`,icon:`sparkles`,accentColor:`#d9a0ff`},"coin:6":{nameKey:`~gZ`,icon:`users`,accentColor:`#ff7db8`},"coin:25":{nameKey:`~h5`,icon:`paw-print`,accentColor:`#7fe3ba`}},ea={gear:{labelKey:`~gN`,icon:`shirt`,accentColor:`#f3d69f`,defaultValue:!0},soulStones:{labelKey:`~gU`,icon:`sparkles`,accentColor:`#d7b2ff`,defaultValue:!1},skinStoneChests:{labelKey:`~gO`,icon:`box`,accentColor:`#ff9c57`,defaultValue:!1},xpSlot:{labelKey:`~gT`,icon:`flask`,accentColor:`#9fd3ff`,defaultValue:!1},petPotionGold:{labelKey:`~gQ`,icon:`flask`,accentColor:`#7fe3ba`,defaultValue:!1},petSparkGold:{labelKey:`~gS`,icon:`sparkles`,accentColor:`#ffd36e`,defaultValue:!1},petPotionCoins:{labelKey:`~gP`,icon:`flask`,accentColor:`#7fe3ba`,defaultValue:!1},petSparkCoins:{labelKey:`~gR`,icon:`sparkles`,accentColor:`#ffd36e`,defaultValue:!1}},ta={heroes:{labelKey:`~ht`,shortLabelKey:`~is`,infoLineKey:`~ij`,infoTotalKey:`~ik`,icon:`users`,accentColor:`#d7b2ff`,coinKey:`coin:5`,coinId:5,call:{name:`inventoryExchangeStones`,args:{},ident:`group_1_body`}},titans:{labelKey:`~hv`,shortLabelKey:`~iu`,infoLineKey:`~ij`,infoTotalKey:`~ik`,icon:`shield`,accentColor:`#9fd3ff`,coinKey:`coin:15`,coinId:15,call:{name:`inventoryExchangeTitanStones`,args:{},ident:`body`}},pets:{labelKey:`~hu`,shortLabelKey:`~it`,infoLineKey:`~ij`,infoTotalKey:`~ik`,icon:`paw-print`,accentColor:`#7fe3ba`,coinKey:`coin:25`,coinId:25,call:{name:`inventoryExchangePetStones`,args:{},ident:`body`}}},na={heroArtifactFragments:{labelKey:`~hX`,shortLabelKey:`~gG`,infoLineKey:`~gD`,infoTotalKey:`~gE`,icon:`package`,accentColor:`#f7c873`,inventorySellType:`artifact`,inventoryTypes:qi},titanArtifactFragments:{labelKey:`~hY`,shortLabelKey:`~gH`,infoLineKey:`~gD`,infoTotalKey:`~gE`,icon:`shield`,accentColor:`#9fd3ff`,inventorySellType:`titanArtifact`,inventoryTypes:Ji}},ra={"~iv":`Starting extension {name} by {author} (v.{version})`,"~gI":`Shop Vacuum`,"~gM":`Buys configured shop slots so you can skip the evening click marathon.`,"~iI":`Shop vacuum settings`,"~i0":`v.{version} · {author}`,"~i6":`Ready`,"~hV":`Start vacuum`,"~hW":`Save`,"~gX":`Close`,"~hr":`Enable shops`,"~h8":`Disable shops`,"~iG":`Run synchronization after work`,"~h3":`Currency limits`,"~i9":`Available shops`,"~iH":`Additional`,"~hg":`Project support`,"~hf":`Direct transfer to an Alfa Bank card. No wallet relay, no mystery payment circus.`,"~hh":`Alfa Bank card: {wallet}`,"~hd":`Donation QR code`,"~he":`Bank transfer`,"~hc":`Documentation`,"~hb":`Useful links for setup, mirrors and the shared UI kit.`,"~ha":`Documentation`,"~h9":`Mirror {number}`,"~hp":`Game library`,"~hq":`Print Hero Wars runtime and library objects to the console.`,"~hA":`Information panel`,"~gJ":`Vacuum button`,"~gK":`Main menu`,"~gL":`Other menu`,"~ir":`Excess exchange`,"~ih":`Soul exchange`,"~ht":`Exchange excess hero souls for coins`,"~hv":`Exchange excess titan souls for coins`,"~hu":`Exchange excess pet souls for coins`,"~gF":`Artifact fragment sale`,"~hX":`Sell surplus hero artifact fragments`,"~hY":`Sell surplus titan artifact fragments`,"~gG":`Hero artifacts`,"~gH":`Titan artifacts`,"~ig":`Exchange/sale in Do all`,"~ii":`No exchangeable excess found right now.`,"~ij":`{name}: {amount} stones`,"~ik":`{count} targets, {amount} stones`,"~gD":`{name}: {amount} fragments`,"~gE":`{count} types, {amount} surplus`,"~in":`Nothing selected`,"~ip":`{count} selected`,"~io":`Search`,"~il":`All`,"~im":`Reset`,"~gV":`Actions in Do all`,"~gW":`Buy selected shop slots`,"~iq":`Processing exchange and sale.`,"~iC":`Exchange and sale`,"~iD":`{name}: +{amount} coins`,"~iw":`{group}: {name} x{amount}{reward}`,"~iB":` (+{reward})`,"~hm":`Do all checkbox`,"~hn":`Checkbox position`,"~ho":`Do not add`,"~hl":`At the bottom`,"~hk":`Before: {label}`,"~hj":`After: {label}`,"~hw":`Export settings`,"~hz":`Import settings`,"~iP":`Settings`,"~iQ":`Shop Vacuum settings block.`,"~iM":`JSON file`,"~iN":`Search`,"~iK":`Clear search`,"~iL":`Nothing found`,"~iO":`Select all`,"~iJ":`Clear all`,"~iR":`Sort`,"~iT":`By name`,"~iV":`Selected first`,"~iS":`Ascending`,"~iU":`Descending`,"~hx":`Feedback`,"~hy":`If you have problems not covered in the documentation, or a suggestion, please message me in`,"~hK":`Hide result window by timeout`,"~hL":`Result timeout, ms`,"~hT":`Information panel`,"~hP":`Result window position`,HWHVACUUM_PROGRESS_POSITION_TOP_CENTER:`Top center`,HWHVACUUM_PROGRESS_POSITION_TOP_RIGHT:`Top right`,HWHVACUUM_PROGRESS_POSITION_BOTTOM_RIGHT:`Bottom right`,"~hS":`Result window style`,HWHVACUUM_PROGRESS_STYLE_DEFAULT:`Default`,HWHVACUUM_PROGRESS_STYLE_COMPACT:`Compact`,HWHVACUUM_PROGRESS_STYLE_DASHBOARD:`Panel`,HWHVACUUM_ACCORDION_AUTO_SCROLL_MODE:`Accordion auto-scroll`,HWHVACUUM_ACCORDION_AUTO_SCROLL_OFF:`Off`,HWHVACUUM_ACCORDION_AUTO_SCROLL_INSTANT:`Instant`,HWHVACUUM_ACCORDION_AUTO_SCROLL_SMOOTH:`Smooth`,"~hU":`Reorder controls`,HWHVACUUM_REORDER_LIST_VARIANT_FULL:`Full`,HWHVACUUM_REORDER_LIST_VARIANT_MINIMAL:`Minimal`,"~hI":`Synchronization done.`,"~hJ":`Synchronization did not finish. The console has the useful details.`,"~hi":`Shop vacuum`,"~hQ":`Checking shop shelves and balances before spending anything.`,"~hR":`Buying {count} shop slots and counting coins.`,"~hM":`Done. Bought {count} slots and left the rest alone.`,"~hO":`Nothing to buy in selected shops. The settings did their job.`,"~hN":`Purchases failed. The console has the reason.`,"~iA":`Purchases by shop`,"~iE":`Spent`,"~iz":`Failed purchases`,"~ix":`Nothing was bought. No impulse shopping today.`,"~iy":`Nothing spent. The wallet can breathe.`,"~iF":`{name} -{spent} ({left})`,"~hZ":`Settings exported to JSON.`,"~i1":`Settings imported.`,"~i3":`This JSON is not a HWH Shop Vacuum settings export.`,"~i4":`Could not parse settings JSON.`,"~i2":`Import failed: {message}`,"~i5":`Settings saved.`,"~gA":`On: {count}`,"~gC":`Off: {count}`,"~gB":`No matches.`,"~gN":`Buy gear`,"~gU":`Buy soul stones`,"~gO":`Buy skin stone chests`,"~gT":`Buy experience slot`,"~gQ":`Buy pet potions for gold`,"~gS":`Buy sparks for gold`,"~gP":`Buy pet potions for pet coins`,"~gR":`Buy sparks for pet coins`,"~h1":`Gold`,"~gY":`Arena coins`,"~h2":`Grand Arena coins`,"~h7":`Tower coins`,"~h6":`Soul coins`,"~gZ":`Friendship coins`,"~h4":`Outland coins`,"~h5":`Pet coins`,"~h0":`Currency {id}`,"~i8":`City Shop`,"~i7":`Arena Shop`,"~ib":`Grand Arena Shop`,"~if":`Tower Shop`,"~ie":`Soul Shop`,"~ia":`Friendship Shop`,"~ic":`Outland Shop`,"~id":`Pet Shop`,"~is":`Hero souls`,"~iu":`Titan souls`,"~it":`Pet souls`,"~hD":`Gear`,"~hG":`Scroll`,"~hB":`Consumable`,"~hC":`Fragment {name}`,"~hF":`{name} Soul Stone`,"~hH":`Skin stone chest`,"~hE":`Item {id}`,"~hs":`Something went wrong. Check the console for the reason.`},ia={"~iv":`Старт расширения {name} от {author} (v.{version})`,"~gI":`Пылесос`,"~gM":`Скупает настроенные слоты магазинов, чтобы ты не устраивал вечерний кликер-марафон.`,"~iI":`Настройки пылесоса`,"~i0":`v.{version} · {author}`,"~i6":`Готов к работе`,"~hV":`Запустить пылесос`,"~hW":`Сохранить`,"~gX":`Закрыть`,"~hr":`Включить магазины`,"~h8":`Отключить магазины`,"~iG":`Запускать синхронизацию после работы`,"~h3":`Лимиты валют`,"~i9":`Доступные магазины`,"~iH":`Дополнительно`,"~hg":`Поддержка проекта`,"~hf":`Прямой перевод на карту Альфа-Банка. Без старого кошелька и платежного цирка.`,"~hh":`Карта Альфа-Банка: {wallet}`,"~hd":`QR-код для доната`,"~he":`Банковский перевод`,"~hc":`Документация`,"~hb":`Полезные ссылки по установке, зеркалам и общему UI kit.`,"~ha":`Документация`,"~h9":`Зеркало {number}`,"~hp":`Игровая библиотека`,"~hq":`Вывести runtime Hero Wars и игровые библиотеки в консоль.`,"~hA":`Информационная панель`,"~gJ":`Кнопка «Пылесос»`,"~gK":`Основное меню`,"~gL":`Разное`,"~ir":`Обмен лишнего`,"~ih":`Обмен душ`,"~ht":`Обменивать лишние души героев на монеты`,"~hv":`Обменивать лишние души титанов на монеты`,"~hu":`Обменивать лишние души питомцев на монеты`,"~gF":`Продажа фрагментов артефактов`,"~hX":`Продавать лишние фрагменты артефактов героев`,"~hY":`Продавать лишние фрагменты артефактов титанов`,"~gG":`Артефакты героев`,"~gH":`Артефакты титанов`,"~ig":`Обмен/продажа в «Сделать всё»`,"~ii":`Сейчас лишнего для обмена или продажи не нашли.`,"~ij":`{name}: {amount} камней`,"~ik":`{count} целей, {amount} камней`,"~gD":`{name}: {amount} фрагм.`,"~gE":`{count} типов, лишних {amount}`,"~in":`Ничего не выбрано`,"~ip":`Выбрано: {count}`,"~io":`Поиск`,"~il":`Все`,"~im":`Сброс`,"~gV":`Действия в «Сделать всё»`,"~gW":`Скупать выбранные слоты магазинов`,"~iq":`Обрабатываем обмен и продажу.`,"~iC":`Обмен и продажа`,"~iD":`{name}: +{amount} монет`,"~iw":`{group}: {name} x{amount}{reward}`,"~iB":` (+{reward})`,"~hm":`Галочка «Сделать всё»`,"~hn":`Куда поставить галочку`,"~ho":`Не добавлять`,"~hl":`В конец`,"~hk":`Перед: {label}`,"~hj":`После: {label}`,"~hw":`Экспорт настроек`,"~hz":`Импорт настроек`,"~iP":`Настройки`,"~iQ":`Блок настроек Shop Vacuum.`,"~iM":`JSON файл`,"~iN":`Поиск`,"~iK":`Очистить поиск`,"~iL":`Ничего не найдено`,"~iO":`Выбрать всё`,"~iJ":`Снять всё`,"~iR":`Сортировка`,"~iT":`По названию`,"~iV":`Выбранные сверху`,"~iS":`По возрастанию`,"~iU":`По убыванию`,"~hx":`Обратная связь`,"~hy":`Если у Вас возникли проблемы не описанные в документации, или же есть пожелание, просьба отписать мне в`,"~hK":`Скрывать окно результата по таймауту`,"~hL":`Таймаут результата, мс`,"~hT":`Информационная панель`,"~hP":`Положение окна результата`,HWHVACUUM_PROGRESS_POSITION_TOP_CENTER:`Сверху по центру`,HWHVACUUM_PROGRESS_POSITION_TOP_RIGHT:`Правый верхний угол`,HWHVACUUM_PROGRESS_POSITION_BOTTOM_RIGHT:`Правый нижний угол`,"~hS":`Стиль окна результата`,HWHVACUUM_PROGRESS_STYLE_DEFAULT:`Обычный`,HWHVACUUM_PROGRESS_STYLE_COMPACT:`Компактный`,HWHVACUUM_PROGRESS_STYLE_DASHBOARD:`Панель`,HWHVACUUM_ACCORDION_AUTO_SCROLL_MODE:`Автоскролл аккордеонов`,HWHVACUUM_ACCORDION_AUTO_SCROLL_OFF:`Выключен`,HWHVACUUM_ACCORDION_AUTO_SCROLL_INSTANT:`Мгновенный`,HWHVACUUM_ACCORDION_AUTO_SCROLL_SMOOTH:`Плавный`,"~hU":`Кнопки сортировки списков`,HWHVACUUM_REORDER_LIST_VARIANT_FULL:`Полный`,HWHVACUUM_REORDER_LIST_VARIANT_MINIMAL:`Минимальный`,"~hI":`Синхронизация выполнена.`,"~hJ":`Синхронизация не доехала. Подробности в консоли, без гадания по скриншотам.`,"~hi":`Пылесос`,"~hQ":`Проверяем витрины и остатки. Сейчас поймём, где игра снова просит лишнего.`,"~hR":`Покупаем {count} лотов. Монеты считаем, паники не устраиваем.`,"~hM":`Готово: купили {count} лотов, лишнего не трогали.`,"~hO":`Покупать нечего: либо всё уже взято, либо настройки наконец-то сдержали аппетит.`,"~hN":`Покупки сорвались. Консоль уже держит детали.`,"~iA":`Покупки по магазинам`,"~iE":`Потратили`,"~iz":`Не купилось`,"~ix":`Покупок нет. Значит, сегодня без импульсивного шопинга.`,"~iy":`Траты ноль. Кошелёк выдохнул.`,"~iF":`{name} -{spent} ({left})`,"~hZ":`Настройки выгружены в JSON.`,"~i1":`Настройки импортированы.`,"~i3":`Этот JSON не похож на экспорт настроек HWH Shop Vacuum.`,"~i4":`JSON с настройками не читается.`,"~i2":`Импорт упал: {message}`,"~i5":`Настройки сохранены.`,"~gA":`Вкл: {count}`,"~gC":`Выкл: {count}`,"~gB":`По фильтру ничего не нашлось.`,"~gN":`Покупать шмот`,"~gU":`Покупать камни душ`,"~gO":`Покупать ящики камней облика`,"~gT":`Покупать слот с опытом`,"~gQ":`Покупать зелья питомцев за золото`,"~gS":`Покупать искры за золото`,"~gP":`Покупать зелья питомцев за монеты питомцев`,"~gR":`Покупать искры за монеты питомцев`,"~h1":`Золото`,"~gY":`Монеты арены`,"~h2":`Монеты гранд-арены`,"~h7":`Монеты башни`,"~h6":`Монеты душ`,"~gZ":`Монеты дружбы`,"~h4":`Монеты Запределья`,"~h5":`Монеты питомцев`,"~h0":`Валюта {id}`,"~i8":`Городская лавка`,"~i7":`Лавка арены`,"~ib":`Лавка гранд-арены`,"~if":`Лавка башни`,"~ie":`Лавка душ`,"~ia":`Лавка дружбы`,"~ic":`Лавка Запределья`,"~id":`Лавка питомцев`,"~is":`Души героев`,"~iu":`Души титанов`,"~it":`Души питомцев`,"~hD":`Шмотка`,"~hG":`Свиток`,"~hB":`Расходник`,"~hC":`Фрагмент {name}`,"~hF":`Камень души: {name}`,"~hH":`Ящик камней облика`,"~hE":`Предмет {id}`,"~hs":`Что-то пошло не так. В консоли будет причина.`};function aa(e,t=0){if(e==null)return t;let n=String(e==null?``:e).trim();if(!n)return 0;let r=n.replace(/[\s\u00a0\u202f]/g,``).replace(`,`,`.`).replace(/[^\d.-]/g,``),i=r.startsWith(`-`),[a=``,...o]=r.replaceAll(`-`,``).split(`.`),s=`${i?`-`:``}${a}${o.length>0?`.${o.join(``)}`:``}`,c=Number(s);return Number.isFinite(c)?c:t}function oa(e,{minValue:t=-1/0,maxValue:n=1/0,fallbackValue:r=0}={}){let i=aa(e,r);return Number.isFinite(i)?Math.min(Math.max(i,t),n):r}function sa(e,t=0){return oa(e,{minValue:0,fallbackValue:t})}function ca(e,t=0){return Math.trunc(sa(e,t))}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var la=new WeakMap,ua=new WeakMap,da=new WeakMap,fa=new Set(Vi),pa=new Set(Ki),ma=new Set(W),ha=new Set(Bi);function ga(e){return!!e&&typeof e==`object`}function q(e){return ga(e)?e:null}function J(e,t){var n;return(n=q(e))==null?void 0:n[String(t)]}function Y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _a(e,t=[]){let n=e===void 0?t:Array.isArray(e)?e:String(e==null?``:e).split(`,`),r=[],i=new Set;for(let e of n){let t=String(e==null?``:e).trim();!t||i.has(t)||(i.add(t),r.push(t))}return r}function va(e){var t;return(t=Qi[Number(e)])==null?{nameKey:`~hE`,currencyKey:``,icon:`shopping-cart`,accentColor:`#d8c39a`}:t}function ya(e){var t;return(t=$i[String(e)])==null?{nameKey:`~h0`,icon:`coins`,accentColor:`#d8c39a`}:t}function ba(e){let t=Number(e);if(t===17)return[`petPotionGold`,`petSparkGold`,`petPotionCoins`,`petSparkCoins`];let n=[`gear`,`soulStones`];return t===10&&n.push(`skinStoneChests`),t===8&&n.push(`xpSlot`),n}function xa(e){var t,n;return zi.has(String((t=(n=q(e))==null?void 0:n.balanceKey)==null?``:t))}function Sa(e){return Object.fromEntries(G.map(t=>[t,!!e]))}function Ca(){return Object.fromEntries(G.map(e=>[e,Object.fromEntries(ba(e).map(e=>{var t;return[e,!!((t=ea[e])!=null&&t.defaultValue)]}))]))}function wa(){return Object.fromEntries(Xi.map(e=>[e,0]))}function Ta(e=!1){return Object.fromEntries(W.map(t=>[t,!!e]))}function Ea(e=!1){return Object.fromEntries(Bi.map(t=>[t,!!e]))}function Da(e){return _a(e).filter(e=>fa.has(e))}function Oa(e,t=[Gi]){return _a(e,t).filter(e=>pa.has(e))}function ka(e){return e===`main`?Hi:Ui}function Aa(e){let t=q(e);if(!t)return[...G];let n=Pa(t),r=G.filter(e=>n.has(e));return r.length>0?r:[...G]}function ja(e,t){var n;let r=q(e);return r?(n=Pa(r).get(Number(t)))==null?null:n:null}function Ma(e){var t;let n=[],r=-1/0,i=!0,a=q((t=q(e))==null?void 0:t.slots);if(!a)return n;for(let e in a){if(Y(a,e)===!1)continue;let t=q(a[e]);if(!t)continue;let o=Number(t.id);i&&(i=o>=r),r=o,n.push(t)}return i||n.sort((e,t)=>Number(e.id)-Number(t.id)),n}function Na(e,t){let n=[],r=q(e);if(!r)return n;for(let e in r){if(Y(r,e)===!1)continue;let i=q(r[e]);if(i)for(let r in i){if(Y(i,r)===!1)continue;let a=Number(i[r])||0;a<=0||n.push({key:`${e}:${r}`,label:t(e,r),amount:a})}}return n}function Pa(e){let t=ua.get(e);if(t)return t;let n=new Map;for(let t in e){var r;if(Y(e,t)===!1)continue;let i=e[t],a=q(i);if(!a)continue;let o=Number((r=a.id)==null?t:r);Number.isFinite(o)&&n.set(o,a)}return ua.set(e,n),n}function Fa(e){let t=q(e);if(!t)return{};if(!Array.isArray(e))return t;let n=da.get(e);if(n)return n;let r={};for(let t of e){var i,a;let e=q(t),n=Number((i=(a=e==null?void 0:e.id)==null?e==null?void 0:e.petId:a)==null?0:i);Number.isFinite(n)&&n>0&&(r[n]=t)}return da.set(e,r),r}function Ia(e){var t,n,r;let i=q(e);return Math.max(0,Number((t=(n=(r=i==null?void 0:i.star)==null?i==null?void 0:i.stars:r)==null?i==null?void 0:i.evolution:n)==null?i==null?void 0:i.evolutionLevel:t)||0)}function La(e,t,n){let r=String(Math.max(0,Number(n)||0)),i=0;for(let n of t)i+=Number(J(J(e,n),r))||0;return i}function Ra(e){var t;let n=q(e);if(n){let e=la.get(n);if(e)return e}let r=[],i=(t=q(n==null?void 0:n.evolution))==null?{}:t;for(let e in i){if(Y(i,e)===!1)continue;let t=q(i[e]),n=Math.max(0,Number(t==null?void 0:t.star)||0);n<=0||r.push({star:n,fragmentCost:Math.max(0,Number(t==null?void 0:t.costFragmentsAmount)||0)})}return r.sort((e,t)=>e.star-t.star),n&&la.set(n,r),r}function za(e,t){let n=Math.max(0,Number(t)||0),r=0;for(let t of e)t.star>n&&(r+=Number(t.fragmentCost)||0);return r}function Ba(e,t,n,r){let i=Math.max(0,Number(t)||0);if(i<=0)return;let a=e.get(i);a||(a={id:i,name:String(n==null?``:n),requiredFragments:0,usageCount:0},e.set(i,a)),a.requiredFragments+=Math.max(0,Number(r)||0),a.usageCount+=1}function Va({inventory:e,inventoryTypes:t,usageByArtifactId:n,blockedArtifactIds:r}){var i;let a=[];for(let o of(i=n==null?void 0:n.values())==null?[]:i){if(r!=null&&r.has(o.id))continue;let n=La(e,t==null?[]:t,o.id),i=Math.max(0,Math.floor(Number(o.requiredFragments)||0)),s=Math.max(0,n-i);s<=0||a.push({id:o.id,name:o.name,amount:s,ownedAmount:n,requiredAmount:i,usageCount:o.usageCount})}return a.sort((e,t)=>t.amount-e.amount||St(e.name,t.name)),a}function Ha(e,t,n,r,i={}){let a=Number(r)||0;if(a<=0)return;let o=e.get(t);o||(o={label:n,amount:0,...i},e.set(t,o)),o.amount+=a,Object.assign(o,i)}function Ua(e,t){var n,r,i,a,o;let s=q(e),c=q(s==null?void 0:s.result),l=(n=(r=(i=c==null?void 0:c.response)==null?s==null?void 0:s.response:i)==null?s:r)==null?{}:n,u=q((a=(o=q(l))==null?void 0:o.reward)==null?l:a);return Number(J(u==null?void 0:u.coin,t))||0}function Wa(e,t){let n=String(t),r=q(e);return ma.has(n)?!!J(r==null?void 0:r.soulExchange,n):ha.has(n)?!!J(r==null?void 0:r.artifactFragmentSale,n):!1}function Ga(e,t=void 0){let n=q(e),r=q(t),i=(r==null?void 0:r.source)===`checklist`?new Set(Oa(n==null?void 0:n.checklistActionTypes,[])):void 0,a=[];for(let t of Vi)Wa(e,t)&&(!i||i.has(t))&&a.push(t);return a}function Ka(e,t=void 0){var n;let r=q(t);return(r==null?void 0:r.source)!==`checklist`||Oa((n=q(e))==null?void 0:n.checklistActionTypes,[]).includes(Gi)}function qa(e,t=void 0){let n=new Set(Ga(e,t)),r=Ka(e,t);return{includeShops:r,includeUserInfo:r,includeHeroes:n.has(`heroes`)||n.has(`heroArtifactFragments`),includeTitans:n.has(`titans`)||n.has(`titanArtifactFragments`),includePets:n.has(`pets`)}}function Ja(e){var t;let n=(t=q(e))==null?{}:t,r=!1;for(let e in n)if(Y(n,e)!==!1&&(r=!0,!Zi.has(e)))return!1;return r}function Ya(e){var t;let n=(t=q(e))==null?{}:t,r=!1;for(let e in n)if(Y(n,e)!==!1&&(r=!0,e!==`fragmentHero`))return!1;return r}function Xa(e){var t;return Number(J((t=q(e))==null?void 0:t.consumable,65))||0}function Za(e){var t;return Xa((t=q(e))==null?void 0:t.reward)>0}function Qa(e){var t;return Number((t=q(e))==null?void 0:t.id)===2}function $a(e,t,n,r){var i,a,o,s;let c=(i=q(J((a=q(e))==null?void 0:a.shopPurchases,t)))==null?{}:i;if(Number(t)===17){var l;let e=Number((l=q(n))==null?void 0:l.id);return r.balanceKey===`gold:0`&&e===1&&c.petPotionGold?`petPotionGold`:r.balanceKey===`gold:0`&&e===2&&c.petSparkGold?`petSparkGold`:xa(r)&&e===3&&c.petPotionCoins?`petPotionCoins`:xa(r)&&e===4&&c.petSparkCoins?`petSparkCoins`:``}return Number(t)===10&&c.skinStoneChests&&Za(n)?`skinStoneChests`:Number(t)===8&&c.xpSlot&&Qa(n)?`xpSlot`:c.gear&&Ja((o=q(n))==null?void 0:o.reward)?`gear`:c.soulStones&&Ya((s=q(n))==null?void 0:s.reward)?`soulStones`:``}function eo(e,t){var n;return ca(J((n=q(e))==null?void 0:n.currencyLimits,t),0)}function to(e,t){var n,r,i,a,o;let s={"gold:0":Number((n=q(t))==null?void 0:n.gold)||0},c=(r=q((i=q(e))==null?void 0:i.coin))==null?{}:r;for(let e in c){if(Y(c,e)===!1)continue;let t=c[e];s[`coin:${e}`]=Number(t)||0}let l=(a=q((o=q(e))==null?void 0:o.petcoin))==null?{}:a;for(let e in l){if(Y(l,e)===!1)continue;let t=l[e];s[`petcoin:${e}`]=Number(t)||0}return s}function no(e,t){let n={...e==null?{}:e};for(let e of t){let t=q(e);if(!(t!=null&&t.success))continue;let i=Array.isArray(t.rewardBalances)?t.rewardBalances:[];for(let e of i){var r;let t=q(e),i=String((r=t==null?void 0:t.key)==null?``:r);i&&(n[i]=(Number(n[i])||0)+(Number(t==null?void 0:t.amount)||0))}}return n}function X(e,t=!1){let n=document.createElement(`details`);n.className=`hwhx-accordion`,n.open=t;let r=document.createElement(`summary`);r.className=`hwhx-accordion__summary`,r.textContent=uo(e);let i=document.createElement(`div`);return i.className=`hwhx-accordion__body`,n.append(r,i),{root:n,body:i}}function Z(e,t,n,r=!1){let i=document.createElement(`label`);i.className=`hwhx-checkbox-row`;let a=document.createElement(`input`);return a.type=`checkbox`,a.className=`hwhx-checkbox-input`,a.checked=!!t,a.disabled=r,a.addEventListener(`change`,()=>n(a.checked)),i.append(a,so(`span`,`hwhx-checkbox-label`,e)),i}function ro(e,t,n,r,i){let a=fo(e);return a.appendChild(io(t,n,r,i)),a}function io(e,t,n,r){let i=document.createElement(`input`);return i.type=`number`,i.className=`hwhx-field hwhx-number`,i.value=String(Math.max(0,Number(e)||0)),Number.isFinite(Number(t))&&(i.min=String(t)),Number.isFinite(Number(n))&&(i.max=String(n)),i.addEventListener(`change`,()=>{r(Math.max(0,Math.trunc(Number(i.value)||0)))}),i}function ao(e,t,n,r){let i=fo(e),a=document.createElement(`select`);a.className=`hwhx-field hwhx-select`;for(let e of n){var o,s;let t=document.createElement(`option`);t.value=String((o=e.value)==null?``:o),t.textContent=uo((s=e.label)==null?e.value:s),t.disabled=!!e.disabled,a.appendChild(t)}return a.value=String(t==null?``:t),a.addEventListener(`change`,()=>r(a.value)),i.appendChild(a),i}function oo(e,t,n=`secondary`){let r=document.createElement(`button`);return r.type=`button`,r.className=`hwhx-button`,r.dataset.tone=n,r.textContent=uo(e),r.addEventListener(`click`,t),r}function so(e,t,n){let r=document.createElement(e);return r.className=t,r.textContent=uo(n),r}function co(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function lo(e){return Array.isArray(e)?e.map(co):[]}function uo(e){return String(e==null?``:e).replace(/<[^>]+>/g,` `).replace(/ /g,` `).replace(/&/g,`&`).replace(/\s+/g,` `).trim()}function fo(e){let t=document.createElement(`label`);return t.className=`hwhx-field-row`,t.appendChild(so(`span`,`hwhx-settings-label`,e)),t}function po(e,t,n){var r;return String((r=e[t])==null?n:r)}function mo(e={}){let t={"top-center":{key:`topCenter`,fallback:`Top center`,icon:`align-center`},"top-right":{key:`topRight`,fallback:`Top right`,icon:`corner-right-up`},"bottom-right":{key:`bottomRight`,fallback:`Bottom right`,icon:`corner-right-down`}};return Or.map(n=>({value:n,label:po(e,t[n].key,t[n].fallback),icon:t[n].icon}))}function ho(e={}){let t={default:{fallback:`Default`,icon:`panel-top`},compact:{fallback:`Compact`,icon:`minus`},dashboard:{fallback:`Dashboard`,icon:`boxes`}};return kr.map(n=>({value:n,label:po(e,n,t[n].fallback),icon:t[n].icon}))}function go({value:e,labels:t,positionOptions:n,styleOptions:r,open:i=!1,onUpdate:a}){let o={...e},s=X(t.title,i),c=ro(t.autoHideMs,o.autoHideMs,1e3,void 0,e=>l(`autoHideMs`,Math.max(1e3,e)));return c.hidden=!o.autoHide,s.body.append(Z(t.autoHide,o.autoHide,e=>{c.hidden=!e,l(`autoHide`,e)}),c,ao(t.position,o.position,n==null?mo(t):n,e=>l(`position`,e)),ao(t.style,o.style,r==null?ho(t):r,e=>l(`style`,e))),s.root;function l(e,t){o[e]=t,a({...o})}}var _o=ea,vo=ta,yo=na;function bo(e){let t=co(e.state),n=co(e.snapshot),r=Mo(e.translate),i=Aa(n.shops),a=document.createElement(`div`);a.className=`hwhx-native-body hwhx-popup hwhx-vacuum-lite`,a.append(xo(t,i,r,e.saveSettings),So(t,r),Co(t,i,r));for(let e of i)a.appendChild(wo(t,e,r));return a.append(To(t,r),Eo(t,r),Do(t,r),Oo(t,r,e.doYourBestPlacementOptions)),a}function xo(e,t,n,r){let i=document.createElement(`div`);return i.className=`hwhx-button-group`,i.append(oo(n(`~hr`),()=>{ko(e,t,!0),No(r)},`success`),oo(n(`~h8`),()=>{ko(e,t,!1),No(r)})),i}function So(e,t){let n=X(t(`~h3`),!0),r=Ao(e,`currencyLimits`);for(let e of Xi){let i=ya(e);n.body.appendChild(ro(t(i.nameKey),r[e],0,void 0,t=>{r[e]=t}))}return n.root}function Co(e,t,n){let r=X(n(`~i9`),!0),i=Ao(e,`enabledShops`);for(let e of t)r.body.appendChild(Z(n(va(e).nameKey),i[e],t=>{i[e]=t}));return r.root}function wo(e,t,n){let r=X(n(va(t).nameKey)),i=jo(e,`shopPurchases`,t);for(let e of ba(t)){let t=_o[e];t&&r.body.appendChild(Z(n(t.labelKey),i[e],t=>{i[e]=t}))}return r.root}function To(e,t){let n=X(t(`~ir`)),r=Ao(e,`soulExchange`);for(let e of W)n.body.appendChild(Z(t(vo[e].labelKey),r[e],t=>{r[e]=t}));let i=Ao(e,`artifactFragmentSale`);for(let e of Bi)n.body.appendChild(Z(t(yo[e].labelKey),i[e],t=>{i[e]=t}));return n.root}function Eo(e,t){let n=X(t(`~hA`));return n.body.append(ao(t(`~gJ`),e.vacuumButtonPlacement,[{value:Hi,label:t(`~gK`)},{value:Ui,label:t(`~gL`)}],t=>{e.vacuumButtonPlacement=t}),Z(t(`~iG`),e.syncAfterRun,t=>{e.syncAfterRun=t}),ao(t(`HWHVACUUM_ACCORDION_AUTO_SCROLL_MODE`),e.accordionAutoScrollMode,[`off`,`instant`,`smooth`].map(e=>({value:e,label:t(`HWHVACUUM_ACCORDION_AUTO_SCROLL_${e.toUpperCase()}`)})),t=>{e.accordionAutoScrollMode=t}),ao(t(`~hU`),e.reorderListVariant,[`full`,`minimal`].map(e=>({value:e,label:t(`HWHVACUUM_REORDER_LIST_VARIANT_${e.toUpperCase()}`)})),t=>{e.reorderListVariant=t})),n.root}function Do(e,t){var n,r;return go({value:{autoHide:!!e.progressAutoHideResult,autoHideMs:Number(e.progressAutoHideResultTimeoutMs)||5e3,position:String((n=e.progressWindowPosition)==null?`top-right`:n),style:String((r=e.progressWindowStyle)==null?`default`:r)},labels:{title:t(`~hT`),autoHide:t(`~hK`),autoHideMs:t(`~hL`),position:t(`~hP`),style:t(`~hS`)},positionOptions:[`top-center`,`top-right`,`bottom-right`].map(e=>({value:e,label:t(`HWHVACUUM_PROGRESS_POSITION_${e.replaceAll(`-`,`_`).toUpperCase()}`)})),styleOptions:[`default`,`compact`,`dashboard`].map(e=>({value:e,label:t(`HWHVACUUM_PROGRESS_STYLE_${e.toUpperCase()}`)})),onUpdate:t=>{e.progressAutoHideResult=t.autoHide,e.progressAutoHideResultTimeoutMs=t.autoHideMs,e.progressWindowPosition=t.position,e.progressWindowStyle=t.style}})}function Oo(e,t,n){let r=X(t(`~hi`));r.body.appendChild(ao(t(`~hn`),e.doYourBestPlacement,lo(n),t=>{e.doYourBestPlacement=t}));let i=new Set(Array.isArray(e.checklistActionTypes)?e.checklistActionTypes.map(String):[]),a=[{value:Gi,label:t(`~gW`)},...W.map(e=>({value:e,label:t(vo[e].labelKey)})),...Bi.map(e=>({value:e,label:t(yo[e].labelKey)}))];for(let t of a)r.body.appendChild(Z(t.label,i.has(t.value),n=>{n?i.add(t.value):i.delete(t.value),e.checklistActionTypes=[...i]}));return r.root}function ko(e,t,n){let r=Ao(e,`enabledShops`);for(let e of t)r[e]=n}function Ao(e,t){let n=co(e[t]);return e[t]=n,n}function jo(e,t,n){let r=Ao(e,t),i=co(r[String(n)]);return r[String(n)]=i,i}function Mo(e){return typeof e==`function`?e:e=>e}function No(e){typeof e==`function`&&e()}var Po=Ot(`vacuum-result-summary`,hi),Fo=Ot(`vacuum-settings`,bo),Io=Ot(`vacuum-text-panel`,yi),Lo=Xr,Ro=Pt,zo=Ft;function Bo(e){return e}function Vo(e){return{title:e||`HWH Shop Vacuum Lite`,badges:[{label:`v1.3.10-lite.1`,tone:`blue`},{label:`Lite`,tone:`gray`}]}}function Ho(e){var t,n,r;let i=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{name:String((t=i.name)==null?`HWH Shop Vacuum Lite`:t).trim(),version:String((n=i.version)==null?`?`:n).trim(),author:String((r=i.author)==null?`?`:r).trim()}}function Uo(e,t){return`${e.name} · ${t(`~i0`,{version:e.version||`?`,author:e.author||`?`})}`}function Wo(e){return[qo(`exportSettings`,e(`~hw`)),qo(`importSettings`,e(`~hz`),!0),qo(`dumpGameLibrary`,e(`~hq`)),qo(`help`,e(`~hc`),!0)]}async function Go(e){await Ft({kind:`documentation`,title:e(`~hc`),header:Vo(e(`~hc`)),component:Io,props:{note:e(`~hb`),links:Ii.map((t,n)=>({label:e(n===0?`~ha`:`~h9`),url:t.url}))},actions:[{result:`close`,label:e(`~gX`)}]})}async function Ko(e){await Ft({kind:`donate`,title:e(`~hg`),header:Vo(e(`~hg`)),component:Io,props:{note:`${e(`~hf`)}\n${e(`~hh`,{wallet:Ai})}`},actions:[{result:`close`,label:e(`~gX`)}]})}function qo(e,t,n=!1){return{result:e,label:t,title:t,iconOnly:!0,closeOnClick:n}}function Jo({setStageProgress:e,sendCallsInChunks:t}){let n=(t,n)=>r=>{let i=new Set(t.slice(r.chunkStart-1,r.chunkEnd).map(e=>{var t;return String((t=e.name)==null?``:t)}).filter(Boolean));e({phase:r.phase===`processed`?`processing`:`sending`,current:r.requestIndex,total:r.totalRequests,itemCount:r.chunkSize,requestName:[...i].join(`, `),detail:n})};return{chunks:n,batching:(t,n,r)=>e({phase:`batching`,itemCount:t,requestName:n,detail:r}),send:(r,i)=>{var a,o;let s=String((a=(o=r[0])==null?void 0:o.name)==null?`serverCall`:a);return e({phase:`batching`,itemCount:r.length,requestName:s,detail:i}),t([...r],void 0,n(r,i))}}}function Yo({plannedPurchases:e,purchaseResults:t,balances:n,finalBalances:r={},exchangeActions:i=[],isCallResultSucceeded:a,getCallResultErrorMessage:o}){let s=new Map,c=new Map,l=[],u={...n==null?{}:n},d=0;return t.forEach((t,n)=>{var i;let f=e[n];if(!f)return;if(!a(t)){let e=o(t);l.push(`${f.shopName}, slot ${f.slotId}${e?`: ${e}`:``}`);return}let p=f.cost.balanceKey;u[p]=Math.max(0,(Number(u[p])||0)-f.cost.amount),Ha(c,p,f.cost.currencyLabel,f.cost.amount,{remainingAmount:(i=r[p])==null?u[p]:i}),s.has(f.shopId)||s.set(f.shopId,{shopId:f.shopId,shopName:f.shopName,items:new Map,slots:0});let m=s.get(f.shopId);m&&(m.slots+=1,d+=1,f.rewardItems.forEach(e=>{Ha(m.items,e.key,e.label,e.amount)}))}),{purchasesByShop:[...s.values()],spentByCurrency:[...c.values()],failures:l,successCount:d,exchangeActions:[...i]}}var Xo=`full`;function Zo(e,t=Xo){return e===`minimal`||e===`full`?e:t===`minimal`||t===`full`?t:Xo}function Qo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return Qo(e)?e:{}}function $o(e,t){return Q(e)[String(t)]}function es(e,...t){return Q(t.reduce((e,t)=>$o(e,t),e))}var ts=Qe(),ns={enabledShops:Sa(!0),shopPurchases:Ca(),currencyLimits:wa(),soulExchange:Ta(!1),artifactFragmentSale:Ea(!1),checklistSoulExchangeTypes:[],checklistActionTypes:[Gi],vacuumButtonPlacement:Ui,doYourBestPlacement:`end`,syncAfterRun:!1,...Ar,accordionAutoScrollMode:`smooth`,reorderListVariant:`full`};function rs(e){let t=Q(e),n=jr(t,Ar);n.progressAutoHideResultTimeoutMs=Math.max(1e3,n.progressAutoHideResultTimeoutMs);let r=Q(t.enabledShops),i=Q(t.shopPurchases),a=Q(t.currencyLimits),o=Q(t.soulExchange),s=Q(t.artifactFragmentSale),c=Sa(!0),l=Ca(),u=Ca(),d=wa(),f=Ta(!1),p=Ea(!1);return G.forEach(e=>{c[e]=$o(r,e)!==!1,ba(e).forEach(t=>{var n;let r=$o(es(i,e),t);u[e][t]=typeof r==`boolean`?r:!!((n=l[e])!=null&&n[t])})}),Xi.forEach(e=>{d[e]=ca($o(a,e),0)}),W.forEach(e=>{f[e]=!!$o(o,e)}),Bi.forEach(e=>{p[e]=!!$o(s,e)}),{enabledShops:c,shopPurchases:u,currencyLimits:d,soulExchange:f,artifactFragmentSale:p,checklistSoulExchangeTypes:Da(t.checklistSoulExchangeTypes),checklistActionTypes:Oa(t.checklistActionTypes,t.checklistSoulExchangeTypes===void 0?ns.checklistActionTypes:[Gi,...Da(t.checklistSoulExchangeTypes)]),vacuumButtonPlacement:ka(t.vacuumButtonPlacement),doYourBestPlacement:ts(t.doYourBestPlacement),syncAfterRun:!!t.syncAfterRun,...n,accordionAutoScrollMode:qn(t.accordionAutoScrollMode,ns.accordionAutoScrollMode),reorderListVariant:Zo(t.reorderListVariant,ns.reorderListVariant)}}var is=rs(ns);function as(e){if(!K(e)||!K(e.state))throw Error(`Invalid HWH Shop Vacuum settings store.`);return{state:e.state,save:typeof e.save==`function`?e.save.bind(e):()=>{}}}function os(e){return en(e,`hwhvacuum.json`)}function ss(e,t,{scriptName:n,scriptVersion:r,getUserId:i}){return $t({scriptId:`hwhvacuum`,scriptName:String(n==null?`HWH Shop Vacuum`:n),scriptVersion:String(r==null?``:r),exportVersion:1,storageSchemaVersion:4,userId:i(t),data:{settings:rs(e)}})}function cs(e){return[{key:`settings`,label:e(`~iP`),icon:`settings`,checked:!0,title:e(`~iQ`)}]}function ls(e){return{exportSelectTitle:e(`~hw`),importSelectTitle:e(`~hz`),exportSelectConfirm:e(`~hw`),importSelectConfirm:e(`~hz`),cancel:e(`~gX`),importFileLabel:e(`~iM`),searchPlaceholder:e(`~iN`),clearSearch:e(`~iK`),noOptions:e(`~iL`),selectAll:e(`~iO`),clearAll:e(`~iJ`),sort:e(`~iR`),sortByLabel:e(`~iT`),sortSelected:e(`~iV`),sortAsc:e(`~iS`),sortDesc:e(`~iU`),exportDone:e(`~hZ`),importDone:e(`~i1`),parseError:e(`~i4`)}}function us(e,t){let n=K(e)?e:{},r=K(n.data)?n.data:{};if(n.scriptId!==`hwhvacuum`||!K(n.data)||!K(r.settings))throw Error(t(`~i3`));return r.settings}async function ds(e,t,n){return kn({payload:e,normalize:rs,write:async e=>{Er(t.state,e),await t.save()},invalidMessage:n(`~i3`)})}function fs({translate:e,getUserId:t,getScriptInfo:n,showNotice:r}){let i=cs(e);return An({buildPayload:(e,r)=>{let i=n();return ss(e,r,{scriptName:i.name,scriptVersion:i.version,getUserId:t})},buildFileName:e=>os((K(e)?e:{}).userId),parseImport:t=>us(t,e),applyImport:(t,n)=>ds(t,as(n),e),showNotice:r,labels:ls(e),exportOptions:i,importOptions:i,alwaysShowChecklist:!0})}function ps(e){return Array.isArray(e)?e:e==null?[]:[e]}function ms(e){return String(e==null?``:e).trim().replace(/^()+/i,``)}function hs(e){return typeof e==`string`?{kind:e}:e}function gs(e,t={},n=0){let{kind:r=`technical`}=hs(t);return{key:`${r}-${n}`,html:String(e==null?``:e),kind:r}}function _s({key:e,title:t,icon:n,rows:r,count:i,tone:a=`technical`,rowKind:o=`technical`,wrapRows:s=!0,defaultOpen:c=!0,formatCount:l=e=>String(e),normalizeRows:u=ps}={}){let d=u(r),f=[];for(let e=0;eString(e),normalizeRows:o=ps}={}){return{buildAccordionModel(e={}){return _s({tone:t,rowKind:n,wrapRows:r,defaultOpen:i,formatCount:a,normalizeRows:o,...e})}}}function ys({translate:e,formatNumber:t}){let n=vs({kind:`shop`,tone:`shop`,rowKind:`shop`,formatCount:t}).buildAccordionModel,r=(e,t=`hwhx-blue`,n=``)=>Xn(e,{className:t,title:n}),a=(e,t,n=`hwhx-blue`,r=``)=>Zn(e,t,{className:n,iconClassName:n,title:r});function o(e,t,n=`package`){return`${r(n,``,String(e==null?``:e))}${i(e)}${i(t)}`}function s(e){return(e==null?[]:e).filter(e=>Number(e.amount)>0).map(e=>`${t(e.amount)} ${e.label}`).join(`, `)}function c(t){let n=s(t);return n?e(`~iB`,{reward:n}):``}function l(r,s=``){var l;let u=((l=r.exchangeActions)==null?[]:l).map(n=>{if(!n.success){let e=n.actionKind===`artifactFragmentSale`?`${n.groupLabel}: ${n.label}`:n.label;return a(`alert-triangle`,`${e}${n.errorMessage?`: ${n.errorMessage}`:``}`,`hwhx-danger`)}return n.actionKind===`artifactFragmentSale`?a(n.icon,e(`~iw`,{group:n.groupLabel,name:n.label,amount:t(n.fragmentAmount),reward:c(n.rewardBalances)}),``):a(n.icon,e(`~iD`,{name:n.label,amount:t(n.coinAmount)}),``)}),d=r.purchasesByShop.flatMap((e,r)=>{let i=va(e.shopId),a=[...e.items.values()].map(e=>o(e.label,`x${t(e.amount)}`)),s=n({title:e.shopName,icon:i.icon,rows:a,tone:`shop`,rowKind:`shop`,defaultOpen:r===0});return s?[s]:[]}),f=d.length>0?d:[n({title:e(`~iA`),icon:`shopping-cart`,rows:[`${i(e(`~ix`))}`],tone:`technical`,rowKind:`technical`,defaultOpen:!0})].filter(e=>e!==null),p=r.spentByCurrency.map(n=>{var r;return a(`coins`,e(`~iF`,{name:String((r=n.label)==null?``:r),spent:t(n.amount),left:t(n.remainingAmount)}),``)}),m=r.failures.map(e=>a(`alert-triangle`,e,`hwhx-danger`));return{className:`hwhx-popup hwhx-popup--compact`,messageHtml:s,accordions:[n({title:e(`~iC`),icon:`sparkles`,rows:u,tone:`technical`,rowKind:`technical`,defaultOpen:!0}),...f,n({title:e(`~iE`),icon:`coins`,rows:p.length>0?p:[i(e(`~iy`))],tone:`technical`,rowKind:`spent`,defaultOpen:!0}),n({title:e(`~iz`),icon:`alert-triangle`,rows:m,tone:`technical`,rowKind:`technical`,defaultOpen:!0})].filter(e=>e!==null)}}return l}var bs=[`shopGetAll`,`inventoryGet`,`userGetInfo`],xs={name:`pet_getAll`,args:{},ident:`pet_getAll`};function $(e){return K(e)?e:{}}function Ss(e={}){let t=!!e.includeExchangeData;return{includeShops:e.includeShops!==!1,includeUserInfo:e.includeUserInfo!==!1,includeHeroes:t||!!e.includeHeroes,includeTitans:t||!!e.includeTitans,includePets:t||!!e.includePets}}function Cs(e={}){let t=Ss(e),n=[];return t.includeShops&&n.push(bs[0]),n.push(bs[1]),t.includeUserInfo&&n.push(bs[2]),t.includeHeroes&&n.push(`heroGetAll`),t.includeTitans&&n.push(`titanGetAll`),t.includePets&&n.push(xs),n}function ws(e,t={}){var n,r,i;let a=Ss(t),o=Array.isArray(e)?e:[],s=0,c=a.includeShops?o[s++]:{},l=o[s++],u=a.includeUserInfo?o[s++]:{},d=a.includeHeroes?o[s++]:{},f=a.includeTitans?o[s++]:{},p=a.includePets?o[s]:{},m=$(p),h=$(m.result);return{shops:$(c),inventory:$(l),userInfo:$(u),heroes:$(d),titans:$(f),pets:$((n=(r=(i=h.response)==null?m.response:i)==null?p:r)==null?{}:n)}}async function Ts(e,t={}){return ws(await e.send(Cs(t)),t)}function Es([e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_]){return async function(ee,v={}){try{let _=e(ee);g({phase:`loading`,detail:m(`~hQ`)});let te=c(_,v),ne=await n(t(_,v)),y=te?r(ne):{},re=a(_,ne,v);g({phase:`planning`,itemCount:re.length,detail:m(`~iq`),explainSingleBatch:!1});let ie=await o(re),ae=te?s(y,ie):y,{calls:b,plannedPurchases:x}=te?l(_,i(ne),ae):{calls:[],plannedPurchases:[]},S=b.length;if(S===0&&ie.length===0){h(m(`~hO`),!0);return}let C=[];S>0&&(C=await u(b)),g({phase:`applying`,itemCount:C.length+ie.length,detail:m(`~hM`,{count:C.length}),explainSingleBatch:!1}),p(d(x,C,ae,ie),f({settings:_,options:v}))}catch(e){console.error(`[Vacuum] Error:`,e),h(_(e),!0)}}}function Ds(e){"use strict";var t,n;if(!Pe({attempt:Number(e)||0,maxAttempts:120,delayMs:500,requiredKeys:[`HWHFuncs`,`HWHData`,`HWHClasses`,`Caller`],retry:Ds,logPrefix:`[Vacuum]`,scriptName:`HWH Shop Vacuum`}))return;hn();let{HWHFuncs:r,HWHData:a,HWHClasses:o,cheats:s}=globalThis,c=Le(globalThis),{addExtentionName:l,I18N:u}=r,d=Lo({scriptId:`hwhvacuum`,title:GM_info.script.name}),{setProgress:f,showResult:h,configure:g}=d,_=(t=a.i18nLangData)==null?a.i18nLangData={}:t;_.en!=null||(_.en={}),_.ru!=null||(_.ru={});let ee=a.buttons&&typeof a.buttons==`object`?a.buttons:a.buttons={},v=Array.isArray(a.othersPopupButtons)?a.othersPopupButtons:a.othersPopupButtons=[];yt(_,{en:ra,ru:ia});let y=bt({I18N:u,i18nLangData:_,preferGameI18N:!1,fallbackLanguage:`en`,cacheMissingTranslations:!0}),ie=p({locale:`ru-RU`});function ae(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function b(e){return ae(e)?e:{}}function x(e,t){return b(e)[String(t)]}function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e,...t){return b(t.reduce((e,t)=>x(e,t),e))}function oe(e,t=``){var n;if(e instanceof Error)return e.message||t;let r=b(e),i=(n=r.message)==null?r.description:n;return typeof i==`string`&&i?i:t}let se=(e,t,n=`hwhx-blue`,r=``)=>Zn(e,t,{className:n,iconClassName:n,title:r}),ce=new Rn({keyPrefix:Li,schemaVersion:4}),le=tt({translate:y,keys:{none:`~ho`,end:`~hl`,before:`~hk`,after:`~hj`}}),ue=Ze({getDoYourBestClass:()=>Ke(o),logPrefix:`[Vacuum]`}),de=gt({buildSuccessMessage:()=>`
${se(`refresh-cw`,y(`~hI`),``)}`,buildFailureMessage:()=>`
${se(`refresh-cw`,y(`~hJ`),`hwhx-gold`)}`,logPrefix:`[Vacuum]`});console.log(`%c${y(`~iv`,{name:GM_info.script.name,author:GM_info.script.author,version:GM_info.script.version})}`,`color: #ff9c57`),l(GM_info.script.name,GM_info.script.version,GM_info.script.author);let fe=Ho((n=GM_info)==null?void 0:n.script),pe=new Map,me=new Map,he=new Map,ge=new Map,_e=new Set(W),w={heroes:{collectionKey:`heroes`,inventoryTypes:[`fragmentHero`],translationKeyPrefix:`LIB_HERO_NAME_`},titans:{collectionKey:`titans`,inventoryTypes:[`fragmentTitan`],translationKeyPrefix:`LIB_TITAN_NAME_`},pets:{collectionKey:`pets`,inventoryTypes:[`fragmentPet`,`petSoulStone`,`petStone`,`petFragment`,`fragmentPetStone`],translationKeyPrefix:`LIB_PET_NAME_`}};async function ve(){await Go(y)}async function T(){await Ko(y)}function E(e){return y(va(e).nameKey,{id:e})}function D(e){var t;let n=String(e==null?``:e),r=ya(n),i=(t=n.split(`:`)[1])==null?`?`:t;return y(r.nameKey,{id:i})}let O=Ct({storage:ce,defaultValue:is,normalize:rs,afterRead:e=>{g(e),Jn(e.accordionAutoScrollMode)},afterWrite:e=>{g(e),Jn(e.accordionAutoScrollMode),ht(e),ct()}}),ye=O.readSync,be=O.writeSync,{useStore:xe}=Dr(`hwhvacuum`,is,rs,{read:()=>ye(),write:e=>be(e)});function Se(e){return j(e)===Ri}function Ce(e){for(let[t,n]of Object.entries(b(e))){if(t===`gold`){let e=b(n),r=Number(n)||Number(x(e,0))||Number(x(e,`0`))||Number(e.gold)||0;if(r>0)return{costType:t,currencyId:`0`,amount:r,balanceKey:`gold:0`,currencyLabel:D(`gold:0`)};continue}for(let[e,r]of Object.entries(b(n))){let n=Number(r)||0;if(n<=0)continue;let i=`${t}:${e}`;return{costType:t,currencyId:String(e),amount:n,balanceKey:i,currencyLabel:D(i)}}}return null}function k(e){let t=String(e==null?``:e).trim();if(pe.has(t)){var n;return(n=pe.get(t))==null?``:n}let r=t&&typeof(s==null?void 0:s.translate)==`function`?s.translate(t):``,i=r&&r!==t?r:``;return pe.set(t,i),i}function we(e){let t=String(e==null?``:e).trim(),n=b(globalThis.lib);if(!t||!n)return{};let r=me.get(t);if(r)return r;let i=b(b(n.data)[t]);if(Object.keys(i).length>0)return me.set(t,i),i;let a=b(n[t]);if(Object.keys(a).length>0)return me.set(t,a),a;if(typeof n.getData==`function`)try{let e=b(n.getData(t));return me.set(t,e),e}catch(e){return{}}return{}}function Te(e,t){var n;let r=Math.max(0,Number(t)||0);if(r<=0)return;let i=`${String(e==null?``:e)}:${r}`;if(he.has(i))return he.get(i);let a=we(e),o=(n=x(a,r))==null?x(b(a.id),r):n,s=ae(o)?o:void 0;return he.set(i,s),s}function Ee(e,t){let n=String(t==null?``:t).trim();if(!n)return;let r=`${String(e==null?``:e)}:${n}`;if(ge.has(r))return ge.get(r);let i=x(b(we(e).type),n),a=ae(i)?i:void 0;return ge.set(r,a),a}function De(e){return k(`LIB_ARTIFACT_NAME_${e}`)||y(`~hE`,{id:e})}function Oe(e){return k(`LIB_TITAN_ARTIFACT_NAME_${e}`)||y(`~hE`,{id:e})}function ke(e){let t=Te(`artifact`,e);return Ra(Ee(`artifact`,t==null?void 0:t.type))}function Ae(e,t){let n=Te(`titanArtifact`,e);return Ra(Ee(`titanArtifact`,Number(t)===2?`amulet`:n==null?void 0:n.type))}function je(e){let t=e.inventory,n=new Map,r=new Set,i=Fa(e.heroes);for(let e in i){if(S(i,e)===!1)continue;let t=i[e],a=b(t),o=Te(`hero`,e),s=Array.isArray(o==null?void 0:o.artifacts)?o.artifacts:[];for(let e=0;et.amount-e.amount||St(e.name,t.name)),o}function A(e,t){let n=String(e==null?``:e),r=String(t==null?``:t);if(!r)return y(`~hE`,{id:`?`});if(n===`consumable`&&Number(r)===65)return y(`~hH`);if(n===`fragmentHero`){let e=k(`LIB_HERO_NAME_${r}`)||y(`~hE`,{id:r});return y(`~hF`,{name:e})}let i=n===`fragmentGear`?`gear`:n===`fragmentScroll`?`scroll`:n,a=k(i===`gear`?`LIB_GEAR_NAME_${r}`:i===`scroll`?`LIB_SCROLL_NAME_${r}`:i===`consumable`?`LIB_CONSUMABLE_NAME_${r}`:``)||y(i===`gear`?`~hD`:i===`scroll`?`~hG`:i===`consumable`?`~hB`:`~hE`,{id:r});return n.startsWith(`fragment`)?y(`~hC`,{name:a}):a}function Fe(e,t,n){let r=[],i=[],a={...n==null?{}:n};for(let n of G){if(!e.enabledShops[n])continue;let c=b(ja(t,n)),l=Ma(c);for(let t of l){var o,s;if(t!=null&&t.bought||!(t!=null&&t.reward)||!(t!=null&&t.cost))continue;let l=Ce(t.cost);if(!l)continue;let u=$a(e,n,t,l);if(!u)continue;let d=Number(a[l.balanceKey])||0,f=eo(e,l.balanceKey);if(d-l.amount0&&r.push({exchangeType:i,actionKind:`soulExchange`,definition:e,entries:n,amount:a,call:b(e.call)});continue}let e=b(na[i]),n=i===`heroArtifactFragments`?je(t):Me(t);for(let t of n)r.push({exchangeType:i,actionKind:`artifactFragmentSale`,definition:e,entry:t,amount:t.amount,call:{name:`inventorySell`,args:{type:e.inventorySellType,libId:t.id,amount:t.amount,fragment:!0},ident:`body`}})}return r}function Re(e){var t,n,r;let i=b(e),a=(t=(n=b(i.result).response)==null?i.response:n)==null?i:t,o=b((r=b(a).reward)==null?a:r),s=[],c=Number(o.gold)||0;c>0&&s.push({key:`gold:0`,label:D(`gold:0`),amount:c});let l=b(o.coin);for(let e in l){if(S(l,e)===!1)continue;let t=Number(l[e])||0;if(t<=0)continue;let n=`coin:${e}`;s.push({key:n,label:D(n),amount:t})}let u=b(o.petcoin);for(let e in u){if(S(u,e)===!1)continue;let t=Number(u[e])||0;if(t<=0)continue;let n=`petcoin:${e}`;s.push({key:n,label:D(n),amount:t})}return s}function ze(e,t,n){let r=Number(n)||0;return r<=0||!t.coinKey||e.some(e=>e.key===t.coinKey)||e.push({key:String(t.coinKey),label:D(t.coinKey),amount:r}),e}function Be(e,t){let n=[];for(let s=0;sc.send(e)}),Ue=Jo({...d,sendCallsInChunks:He}),We=ne,Ge=te,qe=ys({translate:y,formatNumber:ie}),Je=m({ttlMs:5e3,load:()=>Ts(c)}),Xe=Es([rs,qa,e=>Ts(c,e),e=>to(e.inventory,e.userInfo),e=>e.shops,Ie,Ve,no,Ka,Fe,e=>Ue.send(e,y(`~hR`,{count:e.length})),(e,t,n,r)=>Yo({plannedPurchases:e,purchaseResults:t,balances:n,exchangeActions:r,isCallResultSucceeded:We,getCallResultErrorMessage:Ge}),de,(e,t)=>h(``,{component:Po,props:qe(e,t),resultLabel:y(`~hM`,{count:e.successCount})}),y,f,d.setStageProgress,e=>`${y(`~hN`)}
${i(oe(e,y(`~hs`)))}`]),Qe=async(e,t={})=>{Je.invalidate();try{await Xe(e,t)}finally{Je.invalidate()}};function et(e=void 0){var t,n,r,i,o;let s=b(e),c=b(a),l=b(c.user);return String((t=(n=(r=(i=s.id)==null?l.id:i)==null?c.userId:r)==null?(o=globalThis.NXFlashVars)==null?void 0:o.user_id:n)==null?``:t).trim()||`unknown`}function nt(e,t=`check`,n=`hwhx-green`){h(se(t,String(e==null?``:e),n))}let it=fs({translate:y,getUserId:et,getScriptInfo:()=>{var e,t;return{name:(e=GM_info)==null||(e=e.script)==null?void 0:e.name,version:(t=GM_info)==null||(t=t.script)==null?void 0:t.version}},showNotice:e=>nt(e)});async function at(e,t){await it.exportToJson({...e.state},t)}async function ot(e){return it.importFromJson(e)}async function st(){let e=Bo({shops:{},inventory:{},userInfo:{},heroes:{},titans:{},pets:{}}),t=Je.get().then(t=>(Object.assign(e,t),t),t=>{let n=oe(t,y(`~hs`));return console.error(`[Vacuum] snapshot failed`,t),nt(n,`alert-triangle`,`hwhx-danger`),e});Ro();let n=xe();for(await n.load(),g(n.state),Jn(n.state.accordionAutoScrollMode);;){let r=ue().filter(e=>!Se(e)),i=le(r).map(e=>{var t;return{...e,label:String((t=e.label)==null?e.value:t)}}),a=Uo(fe,y),o=await zo({title:a,header:Vo(a),headerActions:Wo(y),component:Fo,props:{state:n.state,snapshot:e,translate:y,doYourBestPlacementOptions:i,saveSettings:()=>n.save()},actions:[{label:y(`~hg`),result:`donate`,icon:`coins`,tone:`secondary`,placement:`left`,iconOnly:!0},{label:y(`~hW`),result:`save`,icon:`save`,tone:`success`},{label:y(`~hV`),result:`run`,icon:`play`,tone:`primary`}],className:`hwhx-popup--wide`,closeLabel:y(`~gX`),onAction:async r=>{if(r===`exportSettings`){await t,await at(n,e.userInfo);return}r===`dumpGameLibrary`&&pt(`hwhvacuum`)}});if(!o)return;if(o===`enableAllShops`){Aa(e==null?void 0:e.shops).forEach(e=>{n.state.enabledShops[e]=!0});continue}if(o===`disableAllShops`){Aa(e==null?void 0:e.shops).forEach(e=>{n.state.enabledShops[e]=!1});continue}if(o===`exportSettings`){await t,await at(n,e.userInfo);continue}if(o===`donate`){await T();continue}if(o===`help`){await ve();continue}if(o===`dumpGameLibrary`){pt(`hwhvacuum`);continue}if(o===`importSettings`){try{await ot(n)}catch(e){let t=oe(e,y(`~hs`));console.error(`[Vacuum] import failed`,e),nt(y(`~i2`,{message:t}),`alert-triangle`,`hwhx-danger`)}continue}if(await n.save(),g(n.state),Jn(n.state.accordionAutoScrollMode),o===`save`){ht(n.state),ct(),nt(y(`~i5`));return}if(o===`run`){ht(n.state),ct(),await Qe(n.state);return}}}function ct(){var e,t;let n=Ke(o);if(!n)return;let r=Ye(n),i=new n,a=Array.isArray(i.funcList)?i.funcList.filter(Boolean):[],s=a.find(Se),c=a.filter(e=>!Se(e)),l=ye(),u=Oa(l.checklistActionTypes,[]),d={name:Ri,label:y(`~hi`),checked:!!(s!=null&&s.checked)&&u.length>0};if(l.doYourBestPlacement!==`none`){let e=$e(c,l.doYourBestPlacement);c.splice(e,0,d)}let f={...(e=i.functions)==null?{}:e,[Ri]:async()=>{Oa(ye().checklistActionTypes,[]).length<=0||await Qe(ye(),{source:`checklist`})}},p=a.map(j).join(``),m=c.map(j).join(``),h=typeof((t=i.functions)==null?void 0:t[Ri])==`function`;if(p===m&&h)return;class g extends r{constructor(...e){super(...e),this.funcList=c.map(e=>({...e})),this.functions={...f}}}o.doYourBest=g}async function lt(){await st()}let ut=rt({actionKey:Wi,color:`pink`,icon:`shopping-cart`,getLabel:()=>y(`~gI`),getTitle:()=>y(`~gM`),onClick:lt,buildIconLabel:(e,t)=>se(e,t,``)});function dt(){return ut.createMainButton()}function mt(){return ut.createOtherButton()}function ht(e=void 0){ft({HWHData:a,mainMenuButtons:ee,othersPopupButtons:v,settings:e,settingsKey:`vacuumButtonPlacement`,readStoredPlacement:()=>ye().vacuumButtonPlacement,normalizePlacement:ka,mainKey:`hwhvacuum`,actionKey:Wi,createMainButton:dt,createOtherButton:mt,mainPlacementValue:Hi,otherPlacementValue:Ui})}function _t(){ht()}ct(),_t()}Ds(0)})();