|
{"version":3,"file":"module.js","sources":["src/constants/constants.js","src/systems/dnd4e.js","src/systems/dnd5e.js","src/systems/dnd5e-2.0.3.js","src/systems/pf1.js","node_modules/svelte/internal/index.mjs","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/util/index.js","node_modules/svelte/store/index.mjs","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/store/index.js","node_modules/svelte/easing/index.mjs","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/math/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationControl.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationManager.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/constants.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/convertRelative.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationAPI.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationGroupControl.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationGroupAPI.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/initial/Centered.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/initial/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/PositionChangeSet.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/PositionData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/PositionStateAPI.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/StyleCache.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/transform/TransformData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/AdapterValidators.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/BasicBounds.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/TransformBounds.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/transform/Transforms.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/update/UpdateElementData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/animate/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/update/UpdateElementManager.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/Position.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/ApplicationState.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/GetSvelteData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/loadSvelteConfig.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/SvelteReactive.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/SvelteApplication.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/cssVariables.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/action/index.js","node_modules/svelte/transition/index.mjs","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/transition/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/TJSGlassPane.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/AppShellContextInternal.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/helper/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/TJSHeaderButton.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/TJSApplicationHeader.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/TJSFocusWrap.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/ResizableHandle.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/ApplicationShell.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/dialog/DialogContent.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/dialog/DialogShell.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/TJSDialogData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/TJSDialog.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/index.js","src/applications/components/BasicItemDialog.svelte","src/systems/pf2e.js","src/systems/ds4.js","src/systems/d35e.js","src/systems/sfrpg.js","src/systems/swade.js","src/systems/tormenta20.js","src/systems/wfrp4e.js","src/systems/splittermond.js","src/systems/forbidden-lands.js","src/systems/icrpg.js","src/systems/swse.js","src/systems/sw5e.js","src/systems/sw5e-2.0.3.2.3.8.js","src/systems/fallout.js","src/systems/cyberpunk-red-core.js","src/systems/knave.js","src/systems/t2k4e.js","src/systems/yzecoriolis.js","src/systems/kamigakari.js","src/systems/symbaroum.js","src/systems/wwn.js","src/systems/cyphersystem.js","src/systems/ptu.js","src/systems/dcc.js","src/systems/a5e.js","src/systems/dark-heresy.js","src/systems/naheulbeuk.js","src/systems/icrpgme.js","src/systems/blade-runner.js","src/systems/alienrpg.js","src/systems/pirateborg.js","src/systems.js","src/applications/settings-app/Setting.svelte","src/applications/components/FilePicker.svelte","src/applications/components/DropZone.svelte","src/applications/editors/currencies-editor/CurrencyList.svelte","src/applications/editors/currencies-editor/currency-store.js","src/applications/editors/currencies-editor/currencies-editor-shell.svelte","src/applications/editors/Editor.js","src/applications/editors/currencies-editor/currencies-editor.js","src/applications/editors/item-filters-editor/item-filters-editor.svelte","src/applications/editors/item-filters-editor/item-filters-editor.js","src/applications/editors/string-list-editor/string-list-editor.svelte","src/applications/editors/string-list-editor/string-list-editor.js","src/applications/components/SliderInput.svelte","src/applications/editors/price-modifiers-editor/price-modifiers-editor-shell.svelte","src/applications/editors/price-modifiers-editor/price-modifiers-editor.js","node_modules/svelte/animate/index.mjs","node_modules/svelte-dnd-action/src/helpers/dispatcher.js","node_modules/svelte-dnd-action/src/constants.js","node_modules/svelte-dnd-action/src/helpers/intersection.js","node_modules/svelte-dnd-action/src/helpers/listUtil.js","node_modules/svelte-dnd-action/src/helpers/scroller.js","node_modules/svelte-dnd-action/src/helpers/util.js","node_modules/svelte-dnd-action/src/helpers/observer.js","node_modules/svelte-dnd-action/src/helpers/windowScroller.js","node_modules/svelte-dnd-action/src/helpers/svelteNodeClone.js","node_modules/svelte-dnd-action/src/helpers/styler.js","node_modules/svelte-dnd-action/src/pointerAction.js","node_modules/svelte-dnd-action/src/helpers/aria.js","node_modules/svelte-dnd-action/src/keyboardAction.js","node_modules/svelte-dnd-action/src/action.js","src/helpers/caches.js","src/helpers/sharing-utilities.js","src/applications/dialogs/drop-item-dialog/drop-item-dialog-shell.svelte","src/applications/dialogs/drop-item-dialog/drop-item-dialog.js","src/applications/item-pile-inventory-app/ListEntry.svelte","src/applications/item-pile-inventory-app/ItemList.svelte","src/applications/item-pile-inventory-app/CurrencyList.svelte","src/applications/components/ActorPicker.svelte","src/plugins/base-plugin.js","src/helpers/transaction.js","src/plugins/simple-calendar.js","src/plugins/levels-3d-preview.js","src/plugins/rarity-colors.js","src/plugins/main.js","src/stores/pile-item.js","src/applications/dialogs/drop-currency-dialog/drop-currency-dialog-shell.svelte","src/applications/dialogs/drop-currency-dialog/drop-currency-dialog.js","src/stores/item-pile-store.js","src/applications/item-pile-inventory-app/CategorizedItemList.svelte","src/applications/item-pile-inventory-app/item-pile-inventory-shell.svelte","src/applications/components/Tabs.svelte","node_modules/@typhonjs-fvtt/svelte-standard/_dist/fvtt/index.js","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/internal/cssVariables.js","node_modules/@typhonjs-fvtt/svelte-standard/_dist/prosemirror/index.js","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/standard/editor/prosemirror/TJSProseMirror.svelte","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/standard/label/TJSToggleLabel.svelte","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/standard/menu/TJSMenu.svelte","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/standard/menu/context/TJSContextMenuImpl.svelte","node_modules/@typhonjs-fvtt/svelte-standard/_dist/component/standard/index.js","src/applications/components/PriceSelector.svelte","src/applications/dialogs/trade-merchant-item-dialog/trade-merchant-item-dialog-shell.svelte","src/applications/dialogs/trade-merchant-item-dialog/trade-merchant-item-dialog.js","src/applications/merchant-app/CustomColumn.svelte","src/applications/merchant-app/QuantityColumn.svelte","src/applications/merchant-app/ItemEntry.svelte","src/applications/item-editor/ItemPriceStore.js","src/applications/components/MacroSelector.svelte","src/applications/components/CustomCategoryInput.svelte","src/applications/item-editor/item-editor-shell.svelte","src/applications/item-editor/item-editor.js","src/applications/merchant-app/EntryButtons.svelte","src/stores/merchant-store.js","src/applications/dialogs/text-editor-dialog/text-editor-dialog-shell.svelte","src/applications/dialogs/text-editor-dialog/text-editor-dialog.js","src/applications/merchant-app/MerchantLeftPane.svelte","src/applications/merchant-app/MerchantItemEntry.svelte","src/applications/merchant-app/CategoryHeader.svelte","src/applications/merchant-app/MerchantItemTab.svelte","src/applications/components/CustomDialog.svelte","src/applications/merchant-app/MerchantPopulateItemsTab.svelte","src/applications/components/CurrencyListEntry.svelte","src/applications/components/CurrencyList.svelte","src/applications/merchant-app/MerchantFooter.svelte","src/applications/merchant-app/MerchantRightPane.svelte","src/applications/merchant-app/MerchantTopBar.svelte","src/applications/merchant-app/merchant-app-shell.svelte","src/applications/dialogs/user-select-dialog/user-select-dialog-shell.svelte","src/applications/dialogs/user-select-dialog/user-select-dialog.js","src/applications/merchant-app/merchant-app.js","node_modules/@typhonjs-fvtt/svelte-standard/_dist/application/TJSContextMenu.js","src/applications/components/Grid/grid-utils.js","src/applications/components/Grid/GridItem.svelte","src/applications/components/Grid/Grid.svelte","src/applications/vault-app/VaultItemEntry.svelte","src/stores/vault-store.js","src/applications/vault-app/VaultExpanderEntry.svelte","src/applications/editors/vault-access-editor/vault-access-editor-shell.svelte","src/applications/editors/vault-access-editor/vault-access-editor.js","src/applications/item-pile-config/settings/vault.svelte","src/applications/components/FloatingElement/FloatingElementImpl.svelte","src/applications/components/FloatingElement/FloatingElement.js","src/applications/vault-app/vault-shell.svelte","src/applications/vault-app/vault-app.js","src/applications/item-pile-config/settings/main.svelte","src/applications/editors/item-type-price-modifiers-editor/item-type-price-modifiers-editor.svelte","src/applications/editors/item-type-price-modifiers-editor/item-type-price-modifiers-editor.js","src/applications/components/PropertyPathInput.svelte","src/applications/editors/merchant-columns-editor/merchant-columns-editor-shell.svelte","src/applications/editors/merchant-columns-editor/merchant-columns-editor.js","src/applications/item-pile-config/settings/merchant.svelte","src/applications/item-pile-config/settings/itempile.svelte","src/applications/item-pile-config/settings/container.svelte","src/applications/item-pile-config/settings/sharing.svelte","src/applications/item-pile-config/settings/custom.svelte","src/applications/item-pile-config/item-pile-config.svelte","src/applications/item-pile-config/item-pile-config.js","src/applications/item-pile-inventory-app/item-pile-inventory-app.js","src/applications/dialogs/give-items-dialog/give-items-shell.svelte","src/API/private-api.js","src/hotkeys.js","src/helpers/compendium-utilities.js","src/helpers/pile-utilities.js","src/applications/components/PriceList.svelte","src/applications/editors/price-preset-editor/price-preset-editor-shell.svelte","src/applications/editors/price-preset-editor/price-preset-editor.js","src/applications/editors/unstackable-item-types-editor/unstackable-item-types-editor.svelte","src/applications/editors/unstackable-item-types-editor/unstackable-item-types-editor.js","src/applications/editors/styles-editor/styles-editor.svelte","src/applications/editors/styles-editor/styles-editor.js","src/applications/editors/vault-styles-editor/StyleEntry.svelte","src/applications/editors/vault-styles-editor/vault-styles-editor.svelte","src/applications/editors/vault-styles-editor/vault-styles-editor.js","src/applications/editors/index.js","src/applications/settings-app/SettingButton.svelte","src/applications/settings-app/settings-shell.svelte","src/applications/settings-app/settings-app.js","src/settings.js","src/constants/settings.js","src/helpers/utilities.js","src/applications/trade-dialogs/ActorDropSelect.svelte","src/applications/trade-dialogs/trade-dialog-prompt.svelte","node_modules/svelte/motion/index.mjs","src/applications/trade-dialogs/trade-dialog-request.svelte","src/applications/trade-dialogs/trade-dialogs.js","src/applications/trading-app/trade-store.js","src/applications/trading-app/TradeEntry.svelte","src/applications/trading-app/trading-app-shell.svelte","src/applications/trading-app/trading-app.js","src/API/trade-api.js","src/API/chat-api.js","src/socket.js","src/helpers/helpers.js","src/foundry-ui-overrides.js","src/libwrapper.js","src/API/api.js","src/migrations.js","src/module.js"],"sourcesContent":["const module_name = \"item-piles\";\r\nconst module_path = `modules/${module_name}/`;\r\nconst baseFlag = `flags.${module_name}.`\r\n\r\nconst CONSTANTS = {\r\n\r\n\tMODULE_NAME: module_name,\r\n\tPATH: module_path,\r\n\r\n\tACTOR_DELTA_PROPERTY: \"actorData\",\r\n\r\n\tFLAGS: {\r\n\t\tVERSION: baseFlag + \"version\",\r\n\t\tPILE: baseFlag + \"data\",\r\n\t\tITEM: baseFlag + \"item\",\r\n\t\tNO_VERSION: baseFlag + \"-=version\",\r\n\t\tNO_PILE: baseFlag + \"-=data\",\r\n\t\tNO_ITEM: baseFlag + \"-=item\",\r\n\t\tLOG: baseFlag + \"log\",\r\n\t\tSHARING: baseFlag + \"sharing\",\r\n\t\tPUBLIC_TRADE_ID: baseFlag + \"publicTradeId\",\r\n\t\tTRADE_USERS: baseFlag + \"tradeUsers\",\r\n\t\tTEMPORARY_ITEM: baseFlag + \"temporary_item\",\r\n\t\tCUSTOM_CATEGORY: baseFlag + \"item.customCategory\"\r\n\t},\r\n\r\n\tITEM_DEFAULTS: {\r\n\t\t// Merchants\r\n\t\thidden: false,\r\n\t\tnotForSale: false,\r\n\t\tinfiniteQuantity: \"default\",\r\n\t\tdisplayQuantity: \"default\",\r\n\t\tfree: false,\r\n\t\tkeepZeroQuantity: false,\r\n\t\tdisableNormalCost: false,\r\n\t\tcantBeSoldToMerchants: false,\r\n\t\tisService: false,\r\n\t\tkeepOnMerchant: false,\r\n\t\tmacro: \"\",\r\n\t\tcustomCategory: \"\",\r\n\t\tprices: [],\r\n\r\n\t\t// Vaults\r\n\t\tvaultExpander: false,\r\n\t\tvaultSlot: null,\r\n\t\taddsCols: 0,\r\n\t\taddsRows: 0,\r\n\t\tx: null,\r\n\t\ty: null,\r\n\t\twidth: 1,\r\n\t\theight: 1,\r\n\t\tcanStack: \"default\"\r\n\t},\r\n\r\n\tPILE_TYPES: {\r\n\t\tPILE: \"pile\",\r\n\t\tCONTAINER: \"container\",\r\n\t\tMERCHANT: \"merchant\",\r\n\t\tVAULT: \"vault\"\r\n\t},\r\n\r\n\tVAULT_LOGGING_TYPES: {\r\n\t\tUSER_ACTOR: \"user_actor\",\r\n\t\tUSER: \"user\",\r\n\t\tACTOR: \"actor\",\r\n\t},\r\n\r\n\tCUSTOM_PILE_TYPES: {},\r\n\r\n\tPILE_DEFAULTS: {\r\n\t\t// Core settings\r\n\t\tenabled: false,\r\n\t\ttype: \"pile\",\r\n\t\tdistance: 1,\r\n\t\tmacro: \"\",\r\n\t\tdeleteWhenEmpty: \"default\",\r\n\t\tcanInspectItems: true,\r\n\t\tdisplayItemTypes: false,\r\n\t\tdescription: \"\",\r\n\r\n\t\t// Overrides\r\n\t\toverrideItemFilters: false,\r\n\t\toverrideCurrencies: false,\r\n\t\toverrideSecondaryCurrencies: false,\r\n\r\n\t\t// Token settings\r\n\t\tdisplayOne: false,\r\n\t\tshowItemName: false,\r\n\t\toverrideSingleItemScale: false,\r\n\t\tsingleItemScale: 1.0,\r\n\r\n\t\t// Sharing settings\r\n\t\tshareItemsEnabled: false,\r\n\t\tshareCurrenciesEnabled: true,\r\n\t\ttakeAllEnabled: false,\r\n\t\tsplitAllEnabled: true,\r\n\t\tactivePlayers: false,\r\n\r\n\t\t// Container settings\r\n\t\tclosed: false,\r\n\t\tlocked: false,\r\n\t\tclosedImage: \"\",\r\n\t\tclosedImages: [],\r\n\t\temptyImage: \"\",\r\n\t\temptyImages: [],\r\n\t\topenedImage: \"\",\r\n\t\topenedImages: [],\r\n\t\tlockedImage: \"\",\r\n\t\tlockedImages: [],\r\n\t\tcloseSound: \"\",\r\n\t\tcloseSounds: [],\r\n\t\topenSound: \"\",\r\n\t\topenSounds: [],\r\n\t\tlockedSound: \"\",\r\n\t\tlockedSounds: [],\r\n\t\tunlockedSound: \"\",\r\n\t\tunlockedSounds: [],\r\n\r\n\t\t// Merchant settings\r\n\t\tmerchantImage: \"\",\r\n\t\tinfiniteQuantity: false,\r\n\t\tinfiniteCurrencies: true,\r\n\t\tpurchaseOnly: false,\r\n\t\thideNewItems: false,\r\n\t\thideItemsWithZeroCost: false,\r\n\t\tkeepZeroQuantity: false,\r\n\t\tonlyAcceptBasePrice: true,\r\n\t\tdisplayQuantity: \"yes\",\r\n\t\tbuyPriceModifier: 1,\r\n\t\tsellPriceModifier: 0.5,\r\n\t\titemTypePriceModifiers: [],\r\n\t\tactorPriceModifiers: [],\r\n\t\ttablesForPopulate: [],\r\n\t\tmerchantColumns: [],\r\n\t\topenTimes: {\r\n\t\t\tenabled: false,\r\n\t\t\tstatus: \"open\",\r\n\t\t\t/*\r\n\t\t\tauto = rely on simple calendar\r\n\t\t\topen = always open\r\n\t\t\tclosed = always closed\r\n\t\t\t */\r\n\t\t\topen: {\r\n\t\t\t\thour: 9,\r\n\t\t\t\tminute: 0\r\n\t\t\t},\r\n\t\t\tclose: {\r\n\t\t\t\thour: 18,\r\n\t\t\t\tminute: 0\r\n\t\t\t},\r\n\t\t},\r\n\t\tclosedDays: [],\r\n\t\tclosedHolidays: [],\r\n\t\trefreshItemsOnOpen: false,\r\n\t\trefreshItemsDays: [],\r\n\t\trefreshItemsHolidays: [],\r\n\r\n\t\t// Vault settings\r\n\t\tcols: 10,\r\n\t\trows: 5,\r\n\t\trestrictVaultAccess: false,\r\n\t\tvaultExpansion: false,\r\n\t\tbaseExpansionCols: 0,\r\n\t\tbaseExpansionRows: 0,\r\n\t\tvaultAccess: [],\r\n\t\tlogVaultActions: false,\r\n\t\tvaultLogType: \"user_actor\",\r\n\t\tcanStackItems: true\r\n\t}\r\n}\r\n\r\nCONSTANTS.ITEM_FORCED_UNIQUE_KEYS = [\"vaultExpander\"]\r\n\t.map(val => CONSTANTS.FLAGS.ITEM + \".\" + val);\r\n\r\nconst prefix = (string) => (strings, ...expressions) => `${string}-${strings.reduce((a, c, i) => a + expressions[i - 1] + c)}`\r\nconst module = prefix(CONSTANTS.MODULE_NAME);\r\n\r\nCONSTANTS.HOOKS = {\r\n\tREADY: module`ready`,\r\n\tRESET_SETTINGS: module`resetSettings`,\r\n\tPRE_TRANSFER_EVERYTHING: module`preTransferEverything`,\r\n\tTRANSFER_EVERYTHING: module`transferEverything`,\r\n\tPRE_RENDER_SHEET: module`preRenderActorSheet`,\r\n\tPRE_RENDER_INTERFACE: module`preRenderInterface`,\r\n\tPRE_OPEN_INTERFACE: module`preOpenInterface`,\r\n\tOPEN_INTERFACE: module`openInterface`,\r\n\tPRE_CLOSE_INTERFACE: module`preCloseInterface`,\r\n\tCLOSE_INTERFACE: module`closeInterface`,\r\n\tPILE: {\r\n\t\tPRE_CREATE: module`preCreateItemPile`,\r\n\t\tCREATE: module`createItemPile`,\r\n\t\tPRE_UPDATE: module`preUpdateItemPile`,\r\n\t\tUPDATE: module`updateItemPile`,\r\n\t\tPRE_DELETE: module`preDeleteItemPile`,\r\n\t\tDELETE: module`deleteItemPile`,\r\n\t\tPRE_CLOSE: module`preCloseItemPile`,\r\n\t\tCLOSE: module`closeItemPile`,\r\n\t\tPRE_OPEN: module`preOpenItemPile`,\r\n\t\tOPEN: module`openItemPile`,\r\n\t\tPRE_LOCK: module`preLockItemPile`,\r\n\t\tLOCK: module`lockItemPile`,\r\n\t\tPRE_UNLOCK: module`preUnlockItemPile`,\r\n\t\tUNLOCK: module`unlockItemPile`,\r\n\t\tPRE_RATTLE: module`preRattleItemPile`,\r\n\t\tRATTLE: module`rattleItemPile`,\r\n\t\tPRE_TURN_INTO: module`preTurnIntoItemPiles`,\r\n\t\tTURN_INTO: module`turnIntoItemPiles`,\r\n\t\tPRE_REVERT_FROM: module`preRevertFromItemPiles`,\r\n\t\tREVERT_FROM: module`revertFromItemPiles`,\r\n\t\tPRE_SPLIT_INVENTORY: module`preSplitItemPileContent`,\r\n\t\tSPLIT_INVENTORY: module`splitItemPileContent`,\r\n\t\tPRE_CLICK: module`preClickItemPile`,\r\n\t\tPRE_DIRECTORY_CLICK: module`preClickDirectoryItemPile`,\r\n\t\tPRE_RIGHT_CLICK_ITEM: module`preRightClickItem`\r\n\t},\r\n\tITEM: {\r\n\t\tPRE_DROP_DETERMINED: module`preDropItemDetermined`,\r\n\t\tPRE_DROP: module`preDropItem`,\r\n\t\tDROP: module`dropItem`,\r\n\t\tPRE_TRANSFER: module`preTransferItems`,\r\n\t\tTRANSFER: module`transferItems`,\r\n\t\tPRE_ADD: module`preAddItems`,\r\n\t\tADD: module`addItems`,\r\n\t\tPRE_REMOVE: module`preRemoveItems`,\r\n\t\tREMOVE: module`removeItems`,\r\n\t\tPRE_TRANSFER_ALL: module`preTransferAllItems`,\r\n\t\tTRANSFER_ALL: module`transferAllItems`,\r\n\t\tPRE_CALC_TRADE: module`preCalculateTradeItems`,\r\n\t\tPRE_TRADE: module`preTradeItems`,\r\n\t\tTRADE: module`tradeItems`,\r\n\t\tPRE_GIVE: module`preGiveItem`,\r\n\t\tGIVE: module`giveItem`,\r\n\t},\r\n\tCURRENCY: {\r\n\t\tPRE_TRANSFER: module`preTransferCurrencies`,\r\n\t\tTRANSFER: module`transferCurrencies`,\r\n\t\tPRE_ADD: module`preAddCurrencies`,\r\n\t\tADD: module`addCurrencies`,\r\n\t\tPRE_REMOVE: module`preRemoveCurrencies`,\r\n\t\tREMOVE: module`removeCurrencies`,\r\n\t\tPRE_TRANSFER_ALL: module`preTransferAllCurrencies`,\r\n\t\tTRANSFER_ALL: module`transferAllCurrencies`,\r\n\t},\r\n\tATTRIBUTE: {\r\n\t\tPRE_TRANSFER: module`preTransferAttributes`,\r\n\t\tTRANSFER: module`transferAttributes`,\r\n\t\tPRE_SET: module`preSetAttributes`,\r\n\t\tSET: module`setAttributes`,\r\n\t\tPRE_ADD: module`preAddAttributes`,\r\n\t\tADD: module`addAttributes`,\r\n\t\tPRE_REMOVE: module`preRemoveAttributes`,\r\n\t\tREMOVE: module`removeAttributes`,\r\n\t\tPRE_TRANSFER_ALL: module`preTransferAllAttributes`,\r\n\t\tTRANSFER_ALL: module`transferAllAttributes`,\r\n\t},\r\n\tTRADE: {\r\n\t\tSTARTED: module`tradeStarted`,\r\n\t\tCOMPLETE: module`tradeComplete`\r\n\t}\r\n}\r\n\r\nexport default CONSTANTS;\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.4\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"Player Character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"classFeats,feat,raceFeats,pathFeats,destinyFeats,ritual,power\"\r\n }\r\n ],\r\n\r\n // This function is an optional system handler that specifically transforms an item when it is added to actors\r\n \"ITEM_TRANSFORMER\": async (itemData) => {\r\n [\"equipped\", \"proficient\", \"prepared\"].forEach(key => {\r\n if (itemData?.system?.[key] !== undefined) {\r\n delete itemData.system[key];\r\n }\r\n });\r\n setProperty(itemData, \"system.attunement\", false);\r\n return itemData;\r\n },\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"DND4EBETA.CurrencyAD\",\r\n img: \"icons/commodities/gems/gem-faceted-round-white.webp\",\r\n abbreviation: \"{#}AD\",\r\n data: {\r\n path: \"system.currency.ad\"\r\n },\r\n primary: false,\r\n exchangeRate: 10000\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND4EBETA.CurrencyPP\",\r\n img: \"icons/commodities/currency/coin-inset-snail-silver.webp\",\r\n abbreviation: \"{#}PP\",\r\n data: {\r\n path: \"system.currency.pp\"\r\n },\r\n primary: false,\r\n exchangeRate: 100\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND4EBETA.CurrencyGP\",\r\n img: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\r\n abbreviation: \"{#}GP\",\r\n data: {\r\n path: \"system.currency.gp\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND4EBETA.CurrencySP\",\r\n img: \"icons/commodities/currency/coin-engraved-moon-silver.webp\",\r\n abbreviation: \"{#}SP\",\r\n data: {\r\n path: \"system.currency.sp\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND4EBETA.CurrencyCP\",\r\n img: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\r\n abbreviation: \"{#}CP\",\r\n data: {\r\n path: \"system.currency.cp\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND4EBETA.RitualCompAR\",\r\n img: \"icons/commodities/materials/bowl-powder-teal.webp\",\r\n abbreviation: \"{#}AR\",\r\n data: {\r\n path: \"system.ritualcomp.ar\",\r\n },\r\n primary: false,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND4EBETA.RitualCompMS\",\r\n img: \"icons/commodities/materials/bowl-liquid-white.webp\",\r\n abbreviation: \"{#}MS\",\r\n data: {\r\n path: \"system.ritualcomp.ms\",\r\n },\r\n primary: false,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND4EBETA.RitualCompRH\",\r\n img: \"icons/commodities/materials/plant-sprout-seed-brown-green.webp\",\r\n abbreviation: \"{#}RH\",\r\n data: {\r\n path: \"system.ritualcomp.rh\",\r\n },\r\n primary: false,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND4EBETA.RitualCompSI\",\r\n img: \"icons/commodities/materials/bowl-liquid-red.webp\",\r\n abbreviation: \"{#}SI\",\r\n data: {\r\n path: \"system.ritualcomp.si\",\r\n },\r\n primary: false,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND4EBETA.RitualCompRS\",\r\n img: \"icons/commodities/gems/gem-faceted-cushion-teal.webp\",\r\n abbreviation: \"{#}RS\",\r\n data: {\r\n path: \"system.ritualcomp.rs\",\r\n },\r\n primary: false,\r\n exchangeRate: 1\r\n }\r\n ]\r\n}\r\n","export default {\n\n \"VERSION\": \"1.0.6\",\n\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\n \"ACTOR_CLASS_TYPE\": \"character\",\n\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\n\n // The item price attribute is the path to the attribute on each item that determine how much it costs\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price.value\",\n\n // Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\n \"ITEM_FILTERS\": [\n {\n \"path\": \"type\",\n \"filters\": \"spell,feat,class,subclass,background\"\n },\n {\n \"path\": \"system.weaponType\",\n \"filters\": \"natural\"\n }\n ],\n\n // This function is an optional system handler that specifically transforms an item when it is added to actors\n \"ITEM_TRANSFORMER\": async (itemData) => {\n [\"equipped\", \"proficient\", \"prepared\"].forEach(key => {\n if (itemData?.system?.[key] !== undefined) {\n delete itemData.system[key];\n }\n });\n setProperty(itemData, \"system.attunement\", Math.min(CONFIG.DND5E.attunementTypes.REQUIRED, itemData?.system?.attunement ?? 0));\n if (itemData.type === \"spell\") {\n try {\n const scroll = await Item.implementation.createScrollFromSpell(itemData);\n itemData = scroll.toObject();\n } catch (err) {\n }\n }\n return itemData;\n },\n\n // This function is an optional system handler that specifically transforms an item's price into a more unified numeric format\n \"ITEM_COST_TRANSFORMER\": (item, currencies) => {\n const overallCost = Number(getProperty(item, \"system.price.value\")) ?? 0;\n const priceDenomination = getProperty(item, \"system.price.denomination\");\n if (priceDenomination) {\n const currencyDenomination = currencies\n .filter(currency => currency.type === \"attribute\")\n .find(currency => {\n return currency.data.path.toLowerCase().endsWith(priceDenomination);\n });\n if (currencyDenomination) {\n return overallCost * currencyDenomination.exchangeRate;\n }\n }\n return overallCost ?? 0;\n },\n\n \"PILE_DEFAULTS\": {\n merchantColumns: [{\n label: \"<i class=\\\"fa-solid fa-shield\\\"></i>\",\n path: \"system.equipped\",\n formatting: \"{#}\",\n buying: false,\n selling: true,\n mapping: {\n \"true\": \"✔\",\n \"false\": \"\"\n }\n }, {\n label: \"Rarity\",\n path: \"system.rarity\",\n formatting: \"{#}\",\n buying: true,\n selling: true,\n mapping: {\n \"common\": \"DND5E.ItemRarityCommon\",\n \"uncommon\": \"DND5E.ItemRarityUncommon\",\n \"rare\": \"DND5E.ItemRarityRare\",\n \"veryRare\": \"DND5E.ItemRarityVeryRare\",\n \"legendary\": \"DND5E.ItemRarityLegendary\",\n \"artifact\": \"DND5E.ItemRarityArtifact\"\n }\n }]\n },\n\n // Item similarities determines how item piles detect similarities and differences in the system\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\n\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\n // In the case of attributes, the path is relative to the \"actor.system\"\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\n \"CURRENCIES\": [\n {\n type: \"attribute\",\n name: \"DND5E.CurrencyPP\",\n img: \"icons/commodities/currency/coin-inset-snail-silver.webp\",\n abbreviation: \"{#}PP\",\n data: {\n path: \"system.currency.pp\"\n },\n primary: false,\n exchangeRate: 10\n },\n {\n type: \"attribute\",\n name: \"DND5E.CurrencyGP\",\n img: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\n abbreviation: \"{#}GP\",\n data: {\n path: \"system.currency.gp\",\n },\n primary: true,\n exchangeRate: 1\n },\n {\n type: \"attribute\",\n name: \"DND5E.CurrencyEP\",\n img: \"icons/commodities/currency/coin-inset-copper-axe.webp\",\n abbreviation: \"{#}EP\",\n data: {\n path: \"system.currency.ep\",\n },\n primary: false,\n exchangeRate: 0.5\n },\n {\n type: \"attribute\",\n name: \"DND5E.CurrencySP\",\n img: \"icons/commodities/currency/coin-engraved-moon-silver.webp\",\n abbreviation: \"{#}SP\",\n data: {\n path: \"system.currency.sp\",\n },\n primary: false,\n exchangeRate: 0.1\n },\n {\n type: \"attribute\",\n name: \"DND5E.CurrencyCP\",\n img: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\n abbreviation: \"{#}CP\",\n data: {\n path: \"system.currency.cp\",\n },\n primary: false,\n exchangeRate: 0.01\n }\n ],\n\n \"VAULT_STYLES\": [\n {\n path: \"system.rarity\",\n value: \"artifact\",\n styling: {\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(255,191,0,1)\"\n }\n },\n {\n path: \"system.rarity\",\n value: \"legendary\",\n styling: {\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(255,119,0,1)\"\n }\n },\n {\n path: \"system.rarity\",\n value: \"veryRare\",\n styling: {\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(255,0,247,1)\"\n }\n },\n {\n path: \"system.rarity\",\n value: \"rare\",\n styling: {\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(0,136,255,1)\"\n }\n },\n {\n path: \"system.rarity\",\n value: \"uncommon\",\n styling: {\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(0,255,9,1)\"\n }\n }\n ]\n}\n","export default {\n\n \"VERSION\": \"1.0.3\",\n\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\n \"ACTOR_CLASS_TYPE\": \"character\",\n\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\n\n // The item price attribute is the path to the attribute on each item that determine how much it costs\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\n\n // Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\n \"ITEM_FILTERS\": [\n {\n \"path\": \"type\",\n \"filters\": \"spell,feat,class,subclass,background\"\n },\n {\n \"path\": \"system.weaponType\",\n \"filters\": \"natural\"\n }\n ],\n\n // This function is an optional system handler that specifically transforms an item when it is added to actors\n \"ITEM_TRANSFORMER\": async (itemData) => {\n [\"equipped\", \"proficient\", \"prepared\"].forEach(key => {\n if (itemData?.system?.[key] !== undefined) {\n delete itemData.system[key];\n }\n });\n setProperty(itemData, \"system.attunement\", Math.min(CONFIG.DND5E.attunementTypes.REQUIRED, itemData?.system?.attunement ?? 0));\n if (itemData.type === \"spell\") {\n try {\n const scroll = await Item.implementation.createScrollFromSpell(itemData);\n itemData = scroll.toObject();\n } catch (err) {\n }\n }\n return itemData;\n },\n\n // Item similarities determines how item piles detect similarities and differences in the system\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\n\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\n // In the case of attributes, the path is relative to the \"actor.system\"\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\n \"CURRENCIES\": [\n {\n type: \"attribute\",\n name: \"DND5E.CurrencyPP\",\n img: \"icons/commodities/currency/coin-inset-snail-silver.webp\",\n abbreviation: \"{#}PP\",\n data: {\n path: \"system.currency.pp\"\n },\n primary: false,\n exchangeRate: 10\n },\n {\n type: \"attribute\",\n name: \"DND5E.CurrencyGP\",\n img: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\n abbreviation: \"{#}GP\",\n data: {\n path: \"system.currency.gp\",\n },\n primary: true,\n exchangeRate: 1\n },\n {\n type: \"attribute\",\n name: \"DND5E.CurrencyEP\",\n img: \"icons/commodities/currency/coin-inset-copper-axe.webp\",\n abbreviation: \"{#}EP\",\n data: {\n path: \"system.currency.ep\",\n },\n primary: false,\n exchangeRate: 0.5\n },\n {\n type: \"attribute\",\n name: \"DND5E.CurrencySP\",\n img: \"icons/commodities/currency/coin-engraved-moon-silver.webp\",\n abbreviation: \"{#}SP\",\n data: {\n path: \"system.currency.sp\",\n },\n primary: false,\n exchangeRate: 0.1\n },\n {\n type: \"attribute\",\n name: \"DND5E.CurrencyCP\",\n img: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\n abbreviation: \"{#}CP\",\n data: {\n path: \"system.currency.cp\",\n },\n primary: false,\n exchangeRate: 0.01\n }\n ],\n\n VAULT_STYLES: [\n {\n path: \"system.rarity\",\n value: \"artifact\",\n styling: {\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(255,191,0,1)\"\n }\n },\n {\n path: \"system.rarity\",\n value: \"legendary\",\n styling: {\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(255,119,0,1)\"\n }\n },\n {\n path: \"system.rarity\",\n value: \"veryRare\",\n styling: {\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(255,0,247,1)\"\n }\n },\n {\n path: \"system.rarity\",\n value: \"rare\",\n styling: {\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(0,136,255,1)\"\n }\n },\n {\n path: \"system.rarity\",\n value: \"uncommon\",\n styling: {\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(0,255,9,1)\"\n }\n }\n ]\n}\n","export default {\r\n\r\n \"VERSION\": \"1.0.5\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"npc\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // This function is an optional system handler that specifically transforms an item's price into a more unified numeric format\r\n \"ITEM_COST_TRANSFORMER\": (item, currencies) => {\r\n // Account for wand charges, broken condition, and other traits that are not reflected in base price.\r\n // Spoof quantity to 1 temporarily\r\n const origQuantity = item.system.quantity;\r\n item.system.quantity = 1;\r\n // Get actual value\r\n const value = item.getValue({ sellValue: 1.0 });\r\n // Restore quantity\r\n item.system.quantity = origQuantity;\r\n return value;\r\n },\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"attack,buff,class,feat,race,spell\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"PF1.CurrencyPlatinumP\",\r\n img: \"systems/pf1/icons/items/inventory/coins-silver.jpg\",\r\n abbreviation: \"{#}P\",\r\n data: {\r\n path: \"system.currency.pp\",\r\n },\r\n primary: false,\r\n exchangeRate: 10\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"PF1.CurrencyGoldP\",\r\n img: \"systems/pf1/icons/items/inventory/coin-gold.jpg\",\r\n abbreviation: \"{#}G\",\r\n data: {\r\n path: \"system.currency.gp\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"PF1.CurrencySilverP\",\r\n img: \"systems/pf1/icons/items/inventory/coin-silver.jpg\",\r\n abbreviation: \"{#}S\",\r\n data: {\r\n path: \"system.currency.sp\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"PF1.CurrencyCopperP\",\r\n img: \"systems/pf1/icons/items/inventory/coin-copper.jpg\",\r\n abbreviation: \"{#}C\",\r\n data: {\r\n path: \"system.currency.cp\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n }\r\n ]\r\n};\r\n","function noop() { }\nconst identity = x => x;\nfunction assign(tar, src) {\n // @ts-ignore\n for (const k in src)\n tar[k] = src[k];\n return tar;\n}\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\nfunction is_promise(value) {\n return !!value && (typeof value === 'object' || typeof value === 'function') && typeof value.then === 'function';\n}\nfunction add_location(element, file, line, column, char) {\n element.__svelte_meta = {\n loc: { file, line, column, char }\n };\n}\nfunction run(fn) {\n return fn();\n}\nfunction blank_object() {\n return Object.create(null);\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === 'function';\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');\n}\nlet src_url_equal_anchor;\nfunction src_url_equal(element_src, url) {\n if (!src_url_equal_anchor) {\n src_url_equal_anchor = document.createElement('a');\n }\n src_url_equal_anchor.href = url;\n return element_src === src_url_equal_anchor.href;\n}\nfunction not_equal(a, b) {\n return a != a ? b == b : a !== b;\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nfunction validate_store(store, name) {\n if (store != null && typeof store.subscribe !== 'function') {\n throw new Error(`'${name}' is not a store with a 'subscribe' method`);\n }\n}\nfunction subscribe(store, ...callbacks) {\n if (store == null) {\n return noop;\n }\n const unsub = store.subscribe(...callbacks);\n return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\nfunction get_store_value(store) {\n let value;\n subscribe(store, _ => value = _)();\n return value;\n}\nfunction component_subscribe(component, store, callback) {\n component.$$.on_destroy.push(subscribe(store, callback));\n}\nfunction create_slot(definition, ctx, $$scope, fn) {\n if (definition) {\n const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n return definition[0](slot_ctx);\n }\n}\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n return definition[1] && fn\n ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))\n : $$scope.ctx;\n}\nfunction get_slot_changes(definition, $$scope, dirty, fn) {\n if (definition[2] && fn) {\n const lets = definition[2](fn(dirty));\n if ($$scope.dirty === undefined) {\n return lets;\n }\n if (typeof lets === 'object') {\n const merged = [];\n const len = Math.max($$scope.dirty.length, lets.length);\n for (let i = 0; i < len; i += 1) {\n merged[i] = $$scope.dirty[i] | lets[i];\n }\n return merged;\n }\n return $$scope.dirty | lets;\n }\n return $$scope.dirty;\n}\nfunction update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);\n}\nfunction get_all_dirty_from_scope($$scope) {\n if ($$scope.ctx.length > 32) {\n const dirty = [];\n const length = $$scope.ctx.length / 32;\n for (let i = 0; i < length; i++) {\n dirty[i] = -1;\n }\n return dirty;\n }\n return -1;\n}\nfunction exclude_internal_props(props) {\n const result = {};\n for (const k in props)\n if (k[0] !== '$')\n result[k] = props[k];\n return result;\n}\nfunction compute_rest_props(props, keys) {\n const rest = {};\n keys = new Set(keys);\n for (const k in props)\n if (!keys.has(k) && k[0] !== '$')\n rest[k] = props[k];\n return rest;\n}\nfunction compute_slots(slots) {\n const result = {};\n for (const key in slots) {\n result[key] = true;\n }\n return result;\n}\nfunction once(fn) {\n let ran = false;\n return function (...args) {\n if (ran)\n return;\n ran = true;\n fn.call(this, ...args);\n };\n}\nfunction null_to_empty(value) {\n return value == null ? '' : value;\n}\nfunction set_store_value(store, ret, value) {\n store.set(value);\n return ret;\n}\nconst has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nfunction action_destroyer(action_result) {\n return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\nfunction split_css_unit(value) {\n const split = typeof value === 'string' && value.match(/^\\s*(-?[\\d.]+)([^\\s]*)\\s*$/);\n return split ? [parseFloat(split[1]), split[2] || 'px'] : [value, 'px'];\n}\n\nconst is_client = typeof window !== 'undefined';\nlet now = is_client\n ? () => window.performance.now()\n : () => Date.now();\nlet raf = is_client ? cb => requestAnimationFrame(cb) : noop;\n// used internally for testing\nfunction set_now(fn) {\n now = fn;\n}\nfunction set_raf(fn) {\n raf = fn;\n}\n\nconst tasks = new Set();\nfunction run_tasks(now) {\n tasks.forEach(task => {\n if (!task.c(now)) {\n tasks.delete(task);\n task.f();\n }\n });\n if (tasks.size !== 0)\n raf(run_tasks);\n}\n/**\n * For testing purposes only!\n */\nfunction clear_loops() {\n tasks.clear();\n}\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n */\nfunction loop(callback) {\n let task;\n if (tasks.size === 0)\n raf(run_tasks);\n return {\n promise: new Promise(fulfill => {\n tasks.add(task = { c: callback, f: fulfill });\n }),\n abort() {\n tasks.delete(task);\n }\n };\n}\n\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\nfunction start_hydrating() {\n is_hydrating = true;\n}\nfunction end_hydrating() {\n is_hydrating = false;\n}\nfunction upper_bound(low, high, key, value) {\n // Return first index of value larger than input value in the range [low, high)\n while (low < high) {\n const mid = low + ((high - low) >> 1);\n if (key(mid) <= value) {\n low = mid + 1;\n }\n else {\n high = mid;\n }\n }\n return low;\n}\nfunction init_hydrate(target) {\n if (target.hydrate_init)\n return;\n target.hydrate_init = true;\n // We know that all children have claim_order values since the unclaimed have been detached if target is not <head>\n let children = target.childNodes;\n // If target is <head>, there may be children without claim_order\n if (target.nodeName === 'HEAD') {\n const myChildren = [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n if (node.claim_order !== undefined) {\n myChildren.push(node);\n }\n }\n children = myChildren;\n }\n /*\n * Reorder claimed children optimally.\n * We can reorder claimed children optimally by finding the longest subsequence of\n * nodes that are already claimed in order and only moving the rest. The longest\n * subsequence of nodes that are claimed in order can be found by\n * computing the longest increasing subsequence of .claim_order values.\n *\n * This algorithm is optimal in generating the least amount of reorder operations\n * possible.\n *\n * Proof:\n * We know that, given a set of reordering operations, the nodes that do not move\n * always form an increasing subsequence, since they do not move among each other\n * meaning that they must be already ordered among each other. Thus, the maximal\n * set of nodes that do not move form a longest increasing subsequence.\n */\n // Compute longest increasing subsequence\n // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n const m = new Int32Array(children.length + 1);\n // Predecessor indices + 1\n const p = new Int32Array(children.length);\n m[0] = -1;\n let longest = 0;\n for (let i = 0; i < children.length; i++) {\n const current = children[i].claim_order;\n // Find the largest subsequence length such that it ends in a value less than our current value\n // upper_bound returns first greater value, so we subtract one\n // with fast path for when we are on the current longest subsequence\n const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;\n p[i] = m[seqLen] + 1;\n const newLen = seqLen + 1;\n // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n m[newLen] = i;\n longest = Math.max(newLen, longest);\n }\n // The longest increasing subsequence of nodes (initially reversed)\n const lis = [];\n // The rest of the nodes, nodes that will be moved\n const toMove = [];\n let last = children.length - 1;\n for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n lis.push(children[cur - 1]);\n for (; last >= cur; last--) {\n toMove.push(children[last]);\n }\n last--;\n }\n for (; last >= 0; last--) {\n toMove.push(children[last]);\n }\n lis.reverse();\n // We sort the nodes being moved to guarantee that their insertion order matches the claim order\n toMove.sort((a, b) => a.claim_order - b.claim_order);\n // Finally, we move the nodes\n for (let i = 0, j = 0; i < toMove.length; i++) {\n while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {\n j++;\n }\n const anchor = j < lis.length ? lis[j] : null;\n target.insertBefore(toMove[i], anchor);\n }\n}\nfunction append(target, node) {\n target.appendChild(node);\n}\nfunction append_styles(target, style_sheet_id, styles) {\n const append_styles_to = get_root_for_style(target);\n if (!append_styles_to.getElementById(style_sheet_id)) {\n const style = element('style');\n style.id = style_sheet_id;\n style.textContent = styles;\n append_stylesheet(append_styles_to, style);\n }\n}\nfunction get_root_for_style(node) {\n if (!node)\n return document;\n const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n if (root && root.host) {\n return root;\n }\n return node.ownerDocument;\n}\nfunction append_empty_stylesheet(node) {\n const style_element = element('style');\n append_stylesheet(get_root_for_style(node), style_element);\n return style_element.sheet;\n}\nfunction append_stylesheet(node, style) {\n append(node.head || node, style);\n return style.sheet;\n}\nfunction append_hydration(target, node) {\n if (is_hydrating) {\n init_hydrate(target);\n if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentNode !== target))) {\n target.actual_end_child = target.firstChild;\n }\n // Skip nodes of undefined ordering\n while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {\n target.actual_end_child = target.actual_end_child.nextSibling;\n }\n if (node !== target.actual_end_child) {\n // We only insert if the ordering of this node should be modified or the parent node is not target\n if (node.claim_order !== undefined || node.parentNode !== target) {\n target.insertBefore(node, target.actual_end_child);\n }\n }\n else {\n target.actual_end_child = node.nextSibling;\n }\n }\n else if (node.parentNode !== target || node.nextSibling !== null) {\n target.appendChild(node);\n }\n}\nfunction insert(target, node, anchor) {\n target.insertBefore(node, anchor || null);\n}\nfunction insert_hydration(target, node, anchor) {\n if (is_hydrating && !anchor) {\n append_hydration(target, node);\n }\n else if (node.parentNode !== target || node.nextSibling != anchor) {\n target.insertBefore(node, anchor || null);\n }\n}\nfunction detach(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\nfunction destroy_each(iterations, detaching) {\n for (let i = 0; i < iterations.length; i += 1) {\n if (iterations[i])\n iterations[i].d(detaching);\n }\n}\nfunction element(name) {\n return document.createElement(name);\n}\nfunction element_is(name, is) {\n return document.createElement(name, { is });\n}\nfunction object_without_properties(obj, exclude) {\n const target = {};\n for (const k in obj) {\n if (has_prop(obj, k)\n // @ts-ignore\n && exclude.indexOf(k) === -1) {\n // @ts-ignore\n target[k] = obj[k];\n }\n }\n return target;\n}\nfunction svg_element(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n}\nfunction text(data) {\n return document.createTextNode(data);\n}\nfunction space() {\n return text(' ');\n}\nfunction empty() {\n return text('');\n}\nfunction listen(node, event, handler, options) {\n node.addEventListener(event, handler, options);\n return () => node.removeEventListener(event, handler, options);\n}\nfunction prevent_default(fn) {\n return function (event) {\n event.preventDefault();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_propagation(fn) {\n return function (event) {\n event.stopPropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_immediate_propagation(fn) {\n return function (event) {\n event.stopImmediatePropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction self(fn) {\n return function (event) {\n // @ts-ignore\n if (event.target === this)\n fn.call(this, event);\n };\n}\nfunction trusted(fn) {\n return function (event) {\n // @ts-ignore\n if (event.isTrusted)\n fn.call(this, event);\n };\n}\nfunction attr(node, attribute, value) {\n if (value == null)\n node.removeAttribute(attribute);\n else if (node.getAttribute(attribute) !== value)\n node.setAttribute(attribute, value);\n}\nfunction set_attributes(node, attributes) {\n // @ts-ignore\n const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n for (const key in attributes) {\n if (attributes[key] == null) {\n node.removeAttribute(key);\n }\n else if (key === 'style') {\n node.style.cssText = attributes[key];\n }\n else if (key === '__value') {\n node.value = node[key] = attributes[key];\n }\n else if (descriptors[key] && descriptors[key].set) {\n node[key] = attributes[key];\n }\n else {\n attr(node, key, attributes[key]);\n }\n }\n}\nfunction set_svg_attributes(node, attributes) {\n for (const key in attributes) {\n attr(node, key, attributes[key]);\n }\n}\nfunction set_custom_element_data_map(node, data_map) {\n Object.keys(data_map).forEach((key) => {\n set_custom_element_data(node, key, data_map[key]);\n });\n}\nfunction set_custom_element_data(node, prop, value) {\n if (prop in node) {\n node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n }\n else {\n attr(node, prop, value);\n }\n}\nfunction set_dynamic_element_data(tag) {\n return (/-/.test(tag)) ? set_custom_element_data_map : set_attributes;\n}\nfunction xlink_attr(node, attribute, value) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\nfunction get_binding_group_value(group, __value, checked) {\n const value = new Set();\n for (let i = 0; i < group.length; i += 1) {\n if (group[i].checked)\n value.add(group[i].__value);\n }\n if (!checked) {\n value.delete(__value);\n }\n return Array.from(value);\n}\nfunction init_binding_group(group) {\n let _inputs;\n return {\n /* push */ p(...inputs) {\n _inputs = inputs;\n _inputs.forEach(input => group.push(input));\n },\n /* remove */ r() {\n _inputs.forEach(input => group.splice(group.indexOf(input), 1));\n }\n };\n}\nfunction init_binding_group_dynamic(group, indexes) {\n let _group = get_binding_group(group);\n let _inputs;\n function get_binding_group(group) {\n for (let i = 0; i < indexes.length; i++) {\n group = group[indexes[i]] = group[indexes[i]] || [];\n }\n return group;\n }\n function push() {\n _inputs.forEach(input => _group.push(input));\n }\n function remove() {\n _inputs.forEach(input => _group.splice(_group.indexOf(input), 1));\n }\n return {\n /* update */ u(new_indexes) {\n indexes = new_indexes;\n const new_group = get_binding_group(group);\n if (new_group !== _group) {\n remove();\n _group = new_group;\n push();\n }\n },\n /* push */ p(...inputs) {\n _inputs = inputs;\n push();\n },\n /* remove */ r: remove\n };\n}\nfunction to_number(value) {\n return value === '' ? null : +value;\n}\nfunction time_ranges_to_array(ranges) {\n const array = [];\n for (let i = 0; i < ranges.length; i += 1) {\n array.push({ start: ranges.start(i), end: ranges.end(i) });\n }\n return array;\n}\nfunction children(element) {\n return Array.from(element.childNodes);\n}\nfunction init_claim_info(nodes) {\n if (nodes.claim_info === undefined) {\n nodes.claim_info = { last_index: 0, total_claimed: 0 };\n }\n}\nfunction claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {\n // Try to find nodes in an order such that we lengthen the longest increasing subsequence\n init_claim_info(nodes);\n const resultNode = (() => {\n // We first try to find an element after the previous one\n for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n return node;\n }\n }\n // Otherwise, we try to find one before\n // We iterate in reverse so that we don't go too far back\n for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n else if (replacement === undefined) {\n // Since we spliced before the last_index, we decrease it\n nodes.claim_info.last_index--;\n }\n return node;\n }\n }\n // If we can't find any matching node, we create a new one\n return createNode();\n })();\n resultNode.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n return resultNode;\n}\nfunction claim_element_base(nodes, name, attributes, create_element) {\n return claim_node(nodes, (node) => node.nodeName === name, (node) => {\n const remove = [];\n for (let j = 0; j < node.attributes.length; j++) {\n const attribute = node.attributes[j];\n if (!attributes[attribute.name]) {\n remove.push(attribute.name);\n }\n }\n remove.forEach(v => node.removeAttribute(v));\n return undefined;\n }, () => create_element(name));\n}\nfunction claim_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, element);\n}\nfunction claim_svg_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, svg_element);\n}\nfunction claim_text(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 3, (node) => {\n const dataStr = '' + data;\n if (node.data.startsWith(dataStr)) {\n if (node.data.length !== dataStr.length) {\n return node.splitText(dataStr.length);\n }\n }\n else {\n node.data = dataStr;\n }\n }, () => text(data), true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n );\n}\nfunction claim_space(nodes) {\n return claim_text(nodes, ' ');\n}\nfunction find_comment(nodes, text, start) {\n for (let i = start; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n return i;\n }\n }\n return nodes.length;\n}\nfunction claim_html_tag(nodes, is_svg) {\n // find html opening tag\n const start_index = find_comment(nodes, 'HTML_TAG_START', 0);\n const end_index = find_comment(nodes, 'HTML_TAG_END', start_index);\n if (start_index === end_index) {\n return new HtmlTagHydration(undefined, is_svg);\n }\n init_claim_info(nodes);\n const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n detach(html_tag_nodes[0]);\n detach(html_tag_nodes[html_tag_nodes.length - 1]);\n const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n for (const n of claimed_nodes) {\n n.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n }\n return new HtmlTagHydration(claimed_nodes, is_svg);\n}\nfunction set_data(text, data) {\n data = '' + data;\n if (text.wholeText !== data)\n text.data = data;\n}\nfunction set_input_value(input, value) {\n input.value = value == null ? '' : value;\n}\nfunction set_input_type(input, type) {\n try {\n input.type = type;\n }\n catch (e) {\n // do nothing\n }\n}\nfunction set_style(node, key, value, important) {\n if (value === null) {\n node.style.removeProperty(key);\n }\n else {\n node.style.setProperty(key, value, important ? 'important' : '');\n }\n}\nfunction select_option(select, value, mounting) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n if (option.__value === value) {\n option.selected = true;\n return;\n }\n }\n if (!mounting || value !== undefined) {\n select.selectedIndex = -1; // no option should be selected\n }\n}\nfunction select_options(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n option.selected = ~value.indexOf(option.__value);\n }\n}\nfunction select_value(select) {\n const selected_option = select.querySelector(':checked');\n return selected_option && selected_option.__value;\n}\nfunction select_multiple_value(select) {\n return [].map.call(select.querySelectorAll(':checked'), option => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\nlet crossorigin;\nfunction is_crossorigin() {\n if (crossorigin === undefined) {\n crossorigin = false;\n try {\n if (typeof window !== 'undefined' && window.parent) {\n void window.parent.document;\n }\n }\n catch (error) {\n crossorigin = true;\n }\n }\n return crossorigin;\n}\nfunction add_resize_listener(node, fn) {\n const computed_style = getComputedStyle(node);\n if (computed_style.position === 'static') {\n node.style.position = 'relative';\n }\n const iframe = element('iframe');\n iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');\n iframe.setAttribute('aria-hidden', 'true');\n iframe.tabIndex = -1;\n const crossorigin = is_crossorigin();\n let unsubscribe;\n if (crossorigin) {\n iframe.src = \"data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>\";\n unsubscribe = listen(window, 'message', (event) => {\n if (event.source === iframe.contentWindow)\n fn();\n });\n }\n else {\n iframe.src = 'about:blank';\n iframe.onload = () => {\n unsubscribe = listen(iframe.contentWindow, 'resize', fn);\n // make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)\n // see https://github.com/sveltejs/svelte/issues/4233\n fn();\n };\n }\n append(node, iframe);\n return () => {\n if (crossorigin) {\n unsubscribe();\n }\n else if (unsubscribe && iframe.contentWindow) {\n unsubscribe();\n }\n detach(iframe);\n };\n}\nfunction toggle_class(element, name, toggle) {\n element.classList[toggle ? 'add' : 'remove'](name);\n}\nfunction custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n const e = document.createEvent('CustomEvent');\n e.initCustomEvent(type, bubbles, cancelable, detail);\n return e;\n}\nfunction query_selector_all(selector, parent = document.body) {\n return Array.from(parent.querySelectorAll(selector));\n}\nfunction head_selector(nodeId, head) {\n const result = [];\n let started = 0;\n for (const node of head.childNodes) {\n if (node.nodeType === 8 /* comment node */) {\n const comment = node.textContent.trim();\n if (comment === `HEAD_${nodeId}_END`) {\n started -= 1;\n result.push(node);\n }\n else if (comment === `HEAD_${nodeId}_START`) {\n started += 1;\n result.push(node);\n }\n }\n else if (started > 0) {\n result.push(node);\n }\n }\n return result;\n}\nclass HtmlTag {\n constructor(is_svg = false) {\n this.is_svg = false;\n this.is_svg = is_svg;\n this.e = this.n = null;\n }\n c(html) {\n this.h(html);\n }\n m(html, target, anchor = null) {\n if (!this.e) {\n if (this.is_svg)\n this.e = svg_element(target.nodeName);\n /** #7364 target for <template> may be provided as #document-fragment(11) */\n else\n this.e = element((target.nodeType === 11 ? 'TEMPLATE' : target.nodeName));\n this.t = target.tagName !== 'TEMPLATE' ? target : target.content;\n this.c(html);\n }\n this.i(anchor);\n }\n h(html) {\n this.e.innerHTML = html;\n this.n = Array.from(this.e.nodeName === 'TEMPLATE' ? this.e.content.childNodes : this.e.childNodes);\n }\n i(anchor) {\n for (let i = 0; i < this.n.length; i += 1) {\n insert(this.t, this.n[i], anchor);\n }\n }\n p(html) {\n this.d();\n this.h(html);\n this.i(this.a);\n }\n d() {\n this.n.forEach(detach);\n }\n}\nclass HtmlTagHydration extends HtmlTag {\n constructor(claimed_nodes, is_svg = false) {\n super(is_svg);\n this.e = this.n = null;\n this.l = claimed_nodes;\n }\n c(html) {\n if (this.l) {\n this.n = this.l;\n }\n else {\n super.c(html);\n }\n }\n i(anchor) {\n for (let i = 0; i < this.n.length; i += 1) {\n insert_hydration(this.t, this.n[i], anchor);\n }\n }\n}\nfunction attribute_to_object(attributes) {\n const result = {};\n for (const attribute of attributes) {\n result[attribute.name] = attribute.value;\n }\n return result;\n}\nfunction get_custom_elements_slots(element) {\n const result = {};\n element.childNodes.forEach((node) => {\n result[node.slot || 'default'] = true;\n });\n return result;\n}\nfunction construct_svelte_component(component, props) {\n return new component(props);\n}\n\n// we need to store the information for multiple documents because a Svelte application could also contain iframes\n// https://github.com/sveltejs/svelte/issues/3624\nconst managed_styles = new Map();\nlet active = 0;\n// https://github.com/darkskyapp/string-hash/blob/master/index.js\nfunction hash(str) {\n let hash = 5381;\n let i = str.length;\n while (i--)\n hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n return hash >>> 0;\n}\nfunction create_style_information(doc, node) {\n const info = { stylesheet: append_empty_stylesheet(node), rules: {} };\n managed_styles.set(doc, info);\n return info;\n}\nfunction create_rule(node, a, b, duration, delay, ease, fn, uid = 0) {\n const step = 16.666 / duration;\n let keyframes = '{\\n';\n for (let p = 0; p <= 1; p += step) {\n const t = a + (b - a) * ease(p);\n keyframes += p * 100 + `%{${fn(t, 1 - t)}}\\n`;\n }\n const rule = keyframes + `100% {${fn(b, 1 - b)}}\\n}`;\n const name = `__svelte_${hash(rule)}_${uid}`;\n const doc = get_root_for_style(node);\n const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node);\n if (!rules[name]) {\n rules[name] = true;\n stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length);\n }\n const animation = node.style.animation || '';\n node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`;\n active += 1;\n return name;\n}\nfunction delete_rule(node, name) {\n const previous = (node.style.animation || '').split(', ');\n const next = previous.filter(name\n ? anim => anim.indexOf(name) < 0 // remove specific animation\n : anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations\n );\n const deleted = previous.length - next.length;\n if (deleted) {\n node.style.animation = next.join(', ');\n active -= deleted;\n if (!active)\n clear_rules();\n }\n}\nfunction clear_rules() {\n raf(() => {\n if (active)\n return;\n managed_styles.forEach(info => {\n const { ownerNode } = info.stylesheet;\n // there is no ownerNode if it runs on jsdom.\n if (ownerNode)\n detach(ownerNode);\n });\n managed_styles.clear();\n });\n}\n\nfunction create_animation(node, from, fn, params) {\n if (!from)\n return noop;\n const to = node.getBoundingClientRect();\n if (from.left === to.left && from.right === to.right && from.top === to.top && from.bottom === to.bottom)\n return noop;\n const { delay = 0, duration = 300, easing = identity, \n // @ts-ignore todo: should this be separated from destructuring? Or start/end added to public api and documentation?\n start: start_time = now() + delay, \n // @ts-ignore todo:\n end = start_time + duration, tick = noop, css } = fn(node, { from, to }, params);\n let running = true;\n let started = false;\n let name;\n function start() {\n if (css) {\n name = create_rule(node, 0, 1, duration, delay, easing, css);\n }\n if (!delay) {\n started = true;\n }\n }\n function stop() {\n if (css)\n delete_rule(node, name);\n running = false;\n }\n loop(now => {\n if (!started && now >= start_time) {\n started = true;\n }\n if (started && now >= end) {\n tick(1, 0);\n stop();\n }\n if (!running) {\n return false;\n }\n if (started) {\n const p = now - start_time;\n const t = 0 + 1 * easing(p / duration);\n tick(t, 1 - t);\n }\n return true;\n });\n start();\n tick(0, 1);\n return stop;\n}\nfunction fix_position(node) {\n const style = getComputedStyle(node);\n if (style.position !== 'absolute' && style.position !== 'fixed') {\n const { width, height } = style;\n const a = node.getBoundingClientRect();\n node.style.position = 'absolute';\n node.style.width = width;\n node.style.height = height;\n add_transform(node, a);\n }\n}\nfunction add_transform(node, a) {\n const b = node.getBoundingClientRect();\n if (a.left !== b.left || a.top !== b.top) {\n const style = getComputedStyle(node);\n const transform = style.transform === 'none' ? '' : style.transform;\n node.style.transform = `${transform} translate(${a.left - b.left}px, ${a.top - b.top}px)`;\n }\n}\n\nlet current_component;\nfunction set_current_component(component) {\n current_component = component;\n}\nfunction get_current_component() {\n if (!current_component)\n throw new Error('Function called outside component initialization');\n return current_component;\n}\n/**\n * Schedules a callback to run immediately before the component is updated after any state change.\n *\n * The first time the callback runs will be before the initial `onMount`\n *\n * https://svelte.dev/docs#run-time-svelte-beforeupdate\n */\nfunction beforeUpdate(fn) {\n get_current_component().$$.before_update.push(fn);\n}\n/**\n * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.\n * It must be called during the component's initialisation (but doesn't need to live *inside* the component;\n * it can be called from an external module).\n *\n * `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).\n *\n * https://svelte.dev/docs#run-time-svelte-onmount\n */\nfunction onMount(fn) {\n get_current_component().$$.on_mount.push(fn);\n}\n/**\n * Schedules a callback to run immediately after the component has been updated.\n *\n * The first time the callback runs will be after the initial `onMount`\n */\nfunction afterUpdate(fn) {\n get_current_component().$$.after_update.push(fn);\n}\n/**\n * Schedules a callback to run immediately before the component is unmounted.\n *\n * Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the\n * only one that runs inside a server-side component.\n *\n * https://svelte.dev/docs#run-time-svelte-ondestroy\n */\nfunction onDestroy(fn) {\n get_current_component().$$.on_destroy.push(fn);\n}\n/**\n * Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname).\n * Event dispatchers are functions that can take two arguments: `name` and `detail`.\n *\n * Component events created with `createEventDispatcher` create a\n * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).\n * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).\n * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)\n * property and can contain any type of data.\n *\n * https://svelte.dev/docs#run-time-svelte-createeventdispatcher\n */\nfunction createEventDispatcher() {\n const component = get_current_component();\n return (type, detail, { cancelable = false } = {}) => {\n const callbacks = component.$$.callbacks[type];\n if (callbacks) {\n // TODO are there situations where events could be dispatched\n // in a server (non-DOM) environment?\n const event = custom_event(type, detail, { cancelable });\n callbacks.slice().forEach(fn => {\n fn.call(component, event);\n });\n return !event.defaultPrevented;\n }\n return true;\n };\n}\n/**\n * Associates an arbitrary `context` object with the current component and the specified `key`\n * and returns that object. The context is then available to children of the component\n * (including slotted content) with `getContext`.\n *\n * Like lifecycle functions, this must be called during component initialisation.\n *\n * https://svelte.dev/docs#run-time-svelte-setcontext\n */\nfunction setContext(key, context) {\n get_current_component().$$.context.set(key, context);\n return context;\n}\n/**\n * Retrieves the context that belongs to the closest parent component with the specified `key`.\n * Must be called during component initialisation.\n *\n * https://svelte.dev/docs#run-time-svelte-getcontext\n */\nfunction getContext(key) {\n return get_current_component().$$.context.get(key);\n}\n/**\n * Retrieves the whole context map that belongs to the closest parent component.\n * Must be called during component initialisation. Useful, for example, if you\n * programmatically create a component and want to pass the existing context to it.\n *\n * https://svelte.dev/docs#run-time-svelte-getallcontexts\n */\nfunction getAllContexts() {\n return get_current_component().$$.context;\n}\n/**\n * Checks whether a given `key` has been set in the context of a parent component.\n * Must be called during component initialisation.\n *\n * https://svelte.dev/docs#run-time-svelte-hascontext\n */\nfunction hasContext(key) {\n return get_current_component().$$.context.has(key);\n}\n// TODO figure out if we still want to support\n// shorthand events, or if we want to implement\n// a real bubbling mechanism\nfunction bubble(component, event) {\n const callbacks = component.$$.callbacks[event.type];\n if (callbacks) {\n // @ts-ignore\n callbacks.slice().forEach(fn => fn.call(this, event));\n }\n}\n\nconst dirty_components = [];\nconst intros = { enabled: false };\nconst binding_callbacks = [];\nlet render_callbacks = [];\nconst flush_callbacks = [];\nconst resolved_promise = /* @__PURE__ */ Promise.resolve();\nlet update_scheduled = false;\nfunction schedule_update() {\n if (!update_scheduled) {\n update_scheduled = true;\n resolved_promise.then(flush);\n }\n}\nfunction tick() {\n schedule_update();\n return resolved_promise;\n}\nfunction add_render_callback(fn) {\n render_callbacks.push(fn);\n}\nfunction add_flush_callback(fn) {\n flush_callbacks.push(fn);\n}\n// flush() calls callbacks in this order:\n// 1. All beforeUpdate callbacks, in order: parents before children\n// 2. All bind:this callbacks, in reverse order: children before parents.\n// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT\n// for afterUpdates called during the initial onMount, which are called in\n// reverse order: children before parents.\n// Since callbacks might update component values, which could trigger another\n// call to flush(), the following steps guard against this:\n// 1. During beforeUpdate, any updated components will be added to the\n// dirty_components array and will cause a reentrant call to flush(). Because\n// the flush index is kept outside the function, the reentrant call will pick\n// up where the earlier call left off and go through all dirty components. The\n// current_component value is saved and restored so that the reentrant call will\n// not interfere with the \"parent\" flush() call.\n// 2. bind:this callbacks cannot trigger new flush() calls.\n// 3. During afterUpdate, any updated components will NOT have their afterUpdate\n// callback called a second time; the seen_callbacks set, outside the flush()\n// function, guarantees this behavior.\nconst seen_callbacks = new Set();\nlet flushidx = 0; // Do *not* move this inside the flush() function\nfunction flush() {\n // Do not reenter flush while dirty components are updated, as this can\n // result in an infinite loop. Instead, let the inner flush handle it.\n // Reentrancy is ok afterwards for bindings etc.\n if (flushidx !== 0) {\n return;\n }\n const saved_component = current_component;\n do {\n // first, call beforeUpdate functions\n // and update components\n try {\n while (flushidx < dirty_components.length) {\n const component = dirty_components[flushidx];\n flushidx++;\n set_current_component(component);\n update(component.$$);\n }\n }\n catch (e) {\n // reset dirty state to not end up in a deadlocked state and then rethrow\n dirty_components.length = 0;\n flushidx = 0;\n throw e;\n }\n set_current_component(null);\n dirty_components.length = 0;\n flushidx = 0;\n while (binding_callbacks.length)\n binding_callbacks.pop()();\n // then, once components are updated, call\n // afterUpdate functions. This may cause\n // subsequent updates...\n for (let i = 0; i < render_callbacks.length; i += 1) {\n const callback = render_callbacks[i];\n if (!seen_callbacks.has(callback)) {\n // ...so guard against infinite loops\n seen_callbacks.add(callback);\n callback();\n }\n }\n render_callbacks.length = 0;\n } while (dirty_components.length);\n while (flush_callbacks.length) {\n flush_callbacks.pop()();\n }\n update_scheduled = false;\n seen_callbacks.clear();\n set_current_component(saved_component);\n}\nfunction update($$) {\n if ($$.fragment !== null) {\n $$.update();\n run_all($$.before_update);\n const dirty = $$.dirty;\n $$.dirty = [-1];\n $$.fragment && $$.fragment.p($$.ctx, dirty);\n $$.after_update.forEach(add_render_callback);\n }\n}\n/**\n * Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.\n */\nfunction flush_render_callbacks(fns) {\n const filtered = [];\n const targets = [];\n render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));\n targets.forEach((c) => c());\n render_callbacks = filtered;\n}\n\nlet promise;\nfunction wait() {\n if (!promise) {\n promise = Promise.resolve();\n promise.then(() => {\n promise = null;\n });\n }\n return promise;\n}\nfunction dispatch(node, direction, kind) {\n node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`));\n}\nconst outroing = new Set();\nlet outros;\nfunction group_outros() {\n outros = {\n r: 0,\n c: [],\n p: outros // parent group\n };\n}\nfunction check_outros() {\n if (!outros.r) {\n run_all(outros.c);\n }\n outros = outros.p;\n}\nfunction transition_in(block, local) {\n if (block && block.i) {\n outroing.delete(block);\n block.i(local);\n }\n}\nfunction transition_out(block, local, detach, callback) {\n if (block && block.o) {\n if (outroing.has(block))\n return;\n outroing.add(block);\n outros.c.push(() => {\n outroing.delete(block);\n if (callback) {\n if (detach)\n block.d(1);\n callback();\n }\n });\n block.o(local);\n }\n else if (callback) {\n callback();\n }\n}\nconst null_transition = { duration: 0 };\nfunction create_in_transition(node, fn, params) {\n const options = { direction: 'in' };\n let config = fn(node, params, options);\n let running = false;\n let animation_name;\n let task;\n let uid = 0;\n function cleanup() {\n if (animation_name)\n delete_rule(node, animation_name);\n }\n function go() {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n if (css)\n animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);\n tick(0, 1);\n const start_time = now() + delay;\n const end_time = start_time + duration;\n if (task)\n task.abort();\n running = true;\n add_render_callback(() => dispatch(node, true, 'start'));\n task = loop(now => {\n if (running) {\n if (now >= end_time) {\n tick(1, 0);\n dispatch(node, true, 'end');\n cleanup();\n return running = false;\n }\n if (now >= start_time) {\n const t = easing((now - start_time) / duration);\n tick(t, 1 - t);\n }\n }\n return running;\n });\n }\n let started = false;\n return {\n start() {\n if (started)\n return;\n started = true;\n delete_rule(node);\n if (is_function(config)) {\n config = config(options);\n wait().then(go);\n }\n else {\n go();\n }\n },\n invalidate() {\n started = false;\n },\n end() {\n if (running) {\n cleanup();\n running = false;\n }\n }\n };\n}\nfunction create_out_transition(node, fn, params) {\n const options = { direction: 'out' };\n let config = fn(node, params, options);\n let running = true;\n let animation_name;\n const group = outros;\n group.r += 1;\n function go() {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n if (css)\n animation_name = create_rule(node, 1, 0, duration, delay, easing, css);\n const start_time = now() + delay;\n const end_time = start_time + duration;\n add_render_callback(() => dispatch(node, false, 'start'));\n loop(now => {\n if (running) {\n if (now >= end_time) {\n tick(0, 1);\n dispatch(node, false, 'end');\n if (!--group.r) {\n // this will result in `end()` being called,\n // so we don't need to clean up here\n run_all(group.c);\n }\n return false;\n }\n if (now >= start_time) {\n const t = easing((now - start_time) / duration);\n tick(1 - t, t);\n }\n }\n return running;\n });\n }\n if (is_function(config)) {\n wait().then(() => {\n // @ts-ignore\n config = config(options);\n go();\n });\n }\n else {\n go();\n }\n return {\n end(reset) {\n if (reset && config.tick) {\n config.tick(1, 0);\n }\n if (running) {\n if (animation_name)\n delete_rule(node, animation_name);\n running = false;\n }\n }\n };\n}\nfunction create_bidirectional_transition(node, fn, params, intro) {\n const options = { direction: 'both' };\n let config = fn(node, params, options);\n let t = intro ? 0 : 1;\n let running_program = null;\n let pending_program = null;\n let animation_name = null;\n function clear_animation() {\n if (animation_name)\n delete_rule(node, animation_name);\n }\n function init(program, duration) {\n const d = (program.b - t);\n duration *= Math.abs(d);\n return {\n a: t,\n b: program.b,\n d,\n duration,\n start: program.start,\n end: program.start + duration,\n group: program.group\n };\n }\n function go(b) {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n const program = {\n start: now() + delay,\n b\n };\n if (!b) {\n // @ts-ignore todo: improve typings\n program.group = outros;\n outros.r += 1;\n }\n if (running_program || pending_program) {\n pending_program = program;\n }\n else {\n // if this is an intro, and there's a delay, we need to do\n // an initial tick and/or apply CSS animation immediately\n if (css) {\n clear_animation();\n animation_name = create_rule(node, t, b, duration, delay, easing, css);\n }\n if (b)\n tick(0, 1);\n running_program = init(program, duration);\n add_render_callback(() => dispatch(node, b, 'start'));\n loop(now => {\n if (pending_program && now > pending_program.start) {\n running_program = init(pending_program, duration);\n pending_program = null;\n dispatch(node, running_program.b, 'start');\n if (css) {\n clear_animation();\n animation_name = create_rule(node, t, running_program.b, running_program.duration, 0, easing, config.css);\n }\n }\n if (running_program) {\n if (now >= running_program.end) {\n tick(t = running_program.b, 1 - t);\n dispatch(node, running_program.b, 'end');\n if (!pending_program) {\n // we're done\n if (running_program.b) {\n // intro — we can tidy up immediately\n clear_animation();\n }\n else {\n // outro — needs to be coordinated\n if (!--running_program.group.r)\n run_all(running_program.group.c);\n }\n }\n running_program = null;\n }\n else if (now >= running_program.start) {\n const p = now - running_program.start;\n t = running_program.a + running_program.d * easing(p / running_program.duration);\n tick(t, 1 - t);\n }\n }\n return !!(running_program || pending_program);\n });\n }\n }\n return {\n run(b) {\n if (is_function(config)) {\n wait().then(() => {\n // @ts-ignore\n config = config(options);\n go(b);\n });\n }\n else {\n go(b);\n }\n },\n end() {\n clear_animation();\n running_program = pending_program = null;\n }\n };\n}\n\nfunction handle_promise(promise, info) {\n const token = info.token = {};\n function update(type, index, key, value) {\n if (info.token !== token)\n return;\n info.resolved = value;\n let child_ctx = info.ctx;\n if (key !== undefined) {\n child_ctx = child_ctx.slice();\n child_ctx[key] = value;\n }\n const block = type && (info.current = type)(child_ctx);\n let needs_flush = false;\n if (info.block) {\n if (info.blocks) {\n info.blocks.forEach((block, i) => {\n if (i !== index && block) {\n group_outros();\n transition_out(block, 1, 1, () => {\n if (info.blocks[i] === block) {\n info.blocks[i] = null;\n }\n });\n check_outros();\n }\n });\n }\n else {\n info.block.d(1);\n }\n block.c();\n transition_in(block, 1);\n block.m(info.mount(), info.anchor);\n needs_flush = true;\n }\n info.block = block;\n if (info.blocks)\n info.blocks[index] = block;\n if (needs_flush) {\n flush();\n }\n }\n if (is_promise(promise)) {\n const current_component = get_current_component();\n promise.then(value => {\n set_current_component(current_component);\n update(info.then, 1, info.value, value);\n set_current_component(null);\n }, error => {\n set_current_component(current_component);\n update(info.catch, 2, info.error, error);\n set_current_component(null);\n if (!info.hasCatch) {\n throw error;\n }\n });\n // if we previously had a then/catch block, destroy it\n if (info.current !== info.pending) {\n update(info.pending, 0);\n return true;\n }\n }\n else {\n if (info.current !== info.then) {\n update(info.then, 1, info.value, promise);\n return true;\n }\n info.resolved = promise;\n }\n}\nfunction update_await_block_branch(info, ctx, dirty) {\n const child_ctx = ctx.slice();\n const { resolved } = info;\n if (info.current === info.then) {\n child_ctx[info.value] = resolved;\n }\n if (info.current === info.catch) {\n child_ctx[info.error] = resolved;\n }\n info.block.p(child_ctx, dirty);\n}\n\nconst globals = (typeof window !== 'undefined'\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : global);\n\nfunction destroy_block(block, lookup) {\n block.d(1);\n lookup.delete(block.key);\n}\nfunction outro_and_destroy_block(block, lookup) {\n transition_out(block, 1, 1, () => {\n lookup.delete(block.key);\n });\n}\nfunction fix_and_destroy_block(block, lookup) {\n block.f();\n destroy_block(block, lookup);\n}\nfunction fix_and_outro_and_destroy_block(block, lookup) {\n block.f();\n outro_and_destroy_block(block, lookup);\n}\nfunction update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) {\n let o = old_blocks.length;\n let n = list.length;\n let i = o;\n const old_indexes = {};\n while (i--)\n old_indexes[old_blocks[i].key] = i;\n const new_blocks = [];\n const new_lookup = new Map();\n const deltas = new Map();\n const updates = [];\n i = n;\n while (i--) {\n const child_ctx = get_context(ctx, list, i);\n const key = get_key(child_ctx);\n let block = lookup.get(key);\n if (!block) {\n block = create_each_block(key, child_ctx);\n block.c();\n }\n else if (dynamic) {\n // defer updates until all the DOM shuffling is done\n updates.push(() => block.p(child_ctx, dirty));\n }\n new_lookup.set(key, new_blocks[i] = block);\n if (key in old_indexes)\n deltas.set(key, Math.abs(i - old_indexes[key]));\n }\n const will_move = new Set();\n const did_move = new Set();\n function insert(block) {\n transition_in(block, 1);\n block.m(node, next);\n lookup.set(block.key, block);\n next = block.first;\n n--;\n }\n while (o && n) {\n const new_block = new_blocks[n - 1];\n const old_block = old_blocks[o - 1];\n const new_key = new_block.key;\n const old_key = old_block.key;\n if (new_block === old_block) {\n // do nothing\n next = new_block.first;\n o--;\n n--;\n }\n else if (!new_lookup.has(old_key)) {\n // remove old block\n destroy(old_block, lookup);\n o--;\n }\n else if (!lookup.has(new_key) || will_move.has(new_key)) {\n insert(new_block);\n }\n else if (did_move.has(old_key)) {\n o--;\n }\n else if (deltas.get(new_key) > deltas.get(old_key)) {\n did_move.add(new_key);\n insert(new_block);\n }\n else {\n will_move.add(old_key);\n o--;\n }\n }\n while (o--) {\n const old_block = old_blocks[o];\n if (!new_lookup.has(old_block.key))\n destroy(old_block, lookup);\n }\n while (n)\n insert(new_blocks[n - 1]);\n run_all(updates);\n return new_blocks;\n}\nfunction validate_each_keys(ctx, list, get_context, get_key) {\n const keys = new Set();\n for (let i = 0; i < list.length; i++) {\n const key = get_key(get_context(ctx, list, i));\n if (keys.has(key)) {\n throw new Error('Cannot have duplicate keys in a keyed each');\n }\n keys.add(key);\n }\n}\n\nfunction get_spread_update(levels, updates) {\n const update = {};\n const to_null_out = {};\n const accounted_for = { $$scope: 1 };\n let i = levels.length;\n while (i--) {\n const o = levels[i];\n const n = updates[i];\n if (n) {\n for (const key in o) {\n if (!(key in n))\n to_null_out[key] = 1;\n }\n for (const key in n) {\n if (!accounted_for[key]) {\n update[key] = n[key];\n accounted_for[key] = 1;\n }\n }\n levels[i] = n;\n }\n else {\n for (const key in o) {\n accounted_for[key] = 1;\n }\n }\n }\n for (const key in to_null_out) {\n if (!(key in update))\n update[key] = undefined;\n }\n return update;\n}\nfunction get_spread_object(spread_props) {\n return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};\n}\n\nconst _boolean_attributes = [\n 'allowfullscreen',\n 'allowpaymentrequest',\n 'async',\n 'autofocus',\n 'autoplay',\n 'checked',\n 'controls',\n 'default',\n 'defer',\n 'disabled',\n 'formnovalidate',\n 'hidden',\n 'inert',\n 'ismap',\n 'itemscope',\n 'loop',\n 'multiple',\n 'muted',\n 'nomodule',\n 'novalidate',\n 'open',\n 'playsinline',\n 'readonly',\n 'required',\n 'reversed',\n 'selected'\n];\n/**\n * List of HTML boolean attributes (e.g. `<input disabled>`).\n * Source: https://html.spec.whatwg.org/multipage/indices.html\n */\nconst boolean_attributes = new Set([..._boolean_attributes]);\n\n/** regex of all html void element names */\nconst void_element_names = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;\nfunction is_void(name) {\n return void_element_names.test(name) || name.toLowerCase() === '!doctype';\n}\n\nconst invalid_attribute_name_character = /[\\s'\">/=\\u{FDD0}-\\u{FDEF}\\u{FFFE}\\u{FFFF}\\u{1FFFE}\\u{1FFFF}\\u{2FFFE}\\u{2FFFF}\\u{3FFFE}\\u{3FFFF}\\u{4FFFE}\\u{4FFFF}\\u{5FFFE}\\u{5FFFF}\\u{6FFFE}\\u{6FFFF}\\u{7FFFE}\\u{7FFFF}\\u{8FFFE}\\u{8FFFF}\\u{9FFFE}\\u{9FFFF}\\u{AFFFE}\\u{AFFFF}\\u{BFFFE}\\u{BFFFF}\\u{CFFFE}\\u{CFFFF}\\u{DFFFE}\\u{DFFFF}\\u{EFFFE}\\u{EFFFF}\\u{FFFFE}\\u{FFFFF}\\u{10FFFE}\\u{10FFFF}]/u;\n// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n// https://infra.spec.whatwg.org/#noncharacter\nfunction spread(args, attrs_to_add) {\n const attributes = Object.assign({}, ...args);\n if (attrs_to_add) {\n const classes_to_add = attrs_to_add.classes;\n const styles_to_add = attrs_to_add.styles;\n if (classes_to_add) {\n if (attributes.class == null) {\n attributes.class = classes_to_add;\n }\n else {\n attributes.class += ' ' + classes_to_add;\n }\n }\n if (styles_to_add) {\n if (attributes.style == null) {\n attributes.style = style_object_to_string(styles_to_add);\n }\n else {\n attributes.style = style_object_to_string(merge_ssr_styles(attributes.style, styles_to_add));\n }\n }\n }\n let str = '';\n Object.keys(attributes).forEach(name => {\n if (invalid_attribute_name_character.test(name))\n return;\n const value = attributes[name];\n if (value === true)\n str += ' ' + name;\n else if (boolean_attributes.has(name.toLowerCase())) {\n if (value)\n str += ' ' + name;\n }\n else if (value != null) {\n str += ` ${name}=\"${value}\"`;\n }\n });\n return str;\n}\nfunction merge_ssr_styles(style_attribute, style_directive) {\n const style_object = {};\n for (const individual_style of style_attribute.split(';')) {\n const colon_index = individual_style.indexOf(':');\n const name = individual_style.slice(0, colon_index).trim();\n const value = individual_style.slice(colon_index + 1).trim();\n if (!name)\n continue;\n style_object[name] = value;\n }\n for (const name in style_directive) {\n const value = style_directive[name];\n if (value) {\n style_object[name] = value;\n }\n else {\n delete style_object[name];\n }\n }\n return style_object;\n}\nconst ATTR_REGEX = /[&\"]/g;\nconst CONTENT_REGEX = /[&<]/g;\n/**\n * Note: this method is performance sensitive and has been optimized\n * https://github.com/sveltejs/svelte/pull/5701\n */\nfunction escape(value, is_attr = false) {\n const str = String(value);\n const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;\n pattern.lastIndex = 0;\n let escaped = '';\n let last = 0;\n while (pattern.test(str)) {\n const i = pattern.lastIndex - 1;\n const ch = str[i];\n escaped += str.substring(last, i) + (ch === '&' ? '&' : (ch === '\"' ? '"' : '<'));\n last = i + 1;\n }\n return escaped + str.substring(last);\n}\nfunction escape_attribute_value(value) {\n // keep booleans, null, and undefined for the sake of `spread`\n const should_escape = typeof value === 'string' || (value && typeof value === 'object');\n return should_escape ? escape(value, true) : value;\n}\nfunction escape_object(obj) {\n const result = {};\n for (const key in obj) {\n result[key] = escape_attribute_value(obj[key]);\n }\n return result;\n}\nfunction each(items, fn) {\n let str = '';\n for (let i = 0; i < items.length; i += 1) {\n str += fn(items[i], i);\n }\n return str;\n}\nconst missing_component = {\n $$render: () => ''\n};\nfunction validate_component(component, name) {\n if (!component || !component.$$render) {\n if (name === 'svelte:component')\n name += ' this={...}';\n throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${name}>.`);\n }\n return component;\n}\nfunction debug(file, line, column, values) {\n console.log(`{@debug} ${file ? file + ' ' : ''}(${line}:${column})`); // eslint-disable-line no-console\n console.log(values); // eslint-disable-line no-console\n return '';\n}\nlet on_destroy;\nfunction create_ssr_component(fn) {\n function $$render(result, props, bindings, slots, context) {\n const parent_component = current_component;\n const $$ = {\n on_destroy,\n context: new Map(context || (parent_component ? parent_component.$$.context : [])),\n // these will be immediately discarded\n on_mount: [],\n before_update: [],\n after_update: [],\n callbacks: blank_object()\n };\n set_current_component({ $$ });\n const html = fn(result, props, bindings, slots);\n set_current_component(parent_component);\n return html;\n }\n return {\n render: (props = {}, { $$slots = {}, context = new Map() } = {}) => {\n on_destroy = [];\n const result = { title: '', head: '', css: new Set() };\n const html = $$render(result, props, {}, $$slots, context);\n run_all(on_destroy);\n return {\n html,\n css: {\n code: Array.from(result.css).map(css => css.code).join('\\n'),\n map: null // TODO\n },\n head: result.title + result.head\n };\n },\n $$render\n };\n}\nfunction add_attribute(name, value, boolean) {\n if (value == null || (boolean && !value))\n return '';\n const assignment = (boolean && value === true) ? '' : `=\"${escape(value, true)}\"`;\n return ` ${name}${assignment}`;\n}\nfunction add_classes(classes) {\n return classes ? ` class=\"${classes}\"` : '';\n}\nfunction style_object_to_string(style_object) {\n return Object.keys(style_object)\n .filter(key => style_object[key])\n .map(key => `${key}: ${escape_attribute_value(style_object[key])};`)\n .join(' ');\n}\nfunction add_styles(style_object) {\n const styles = style_object_to_string(style_object);\n return styles ? ` style=\"${styles}\"` : '';\n}\n\nfunction bind(component, name, callback) {\n const index = component.$$.props[name];\n if (index !== undefined) {\n component.$$.bound[index] = callback;\n callback(component.$$.ctx[index]);\n }\n}\nfunction create_component(block) {\n block && block.c();\n}\nfunction claim_component(block, parent_nodes) {\n block && block.l(parent_nodes);\n}\nfunction mount_component(component, target, anchor, customElement) {\n const { fragment, after_update } = component.$$;\n fragment && fragment.m(target, anchor);\n if (!customElement) {\n // onMount happens before the initial afterUpdate\n add_render_callback(() => {\n const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);\n // if the component was destroyed immediately\n // it will update the `$$.on_destroy` reference to `null`.\n // the destructured on_destroy may still reference to the old array\n if (component.$$.on_destroy) {\n component.$$.on_destroy.push(...new_on_destroy);\n }\n else {\n // Edge case - component was destroyed immediately,\n // most likely as a result of a binding initialising\n run_all(new_on_destroy);\n }\n component.$$.on_mount = [];\n });\n }\n after_update.forEach(add_render_callback);\n}\nfunction destroy_component(component, detaching) {\n const $$ = component.$$;\n if ($$.fragment !== null) {\n flush_render_callbacks($$.after_update);\n run_all($$.on_destroy);\n $$.fragment && $$.fragment.d(detaching);\n // TODO null out other refs, including component.$$ (but need to\n // preserve final state?)\n $$.on_destroy = $$.fragment = null;\n $$.ctx = [];\n }\n}\nfunction make_dirty(component, i) {\n if (component.$$.dirty[0] === -1) {\n dirty_components.push(component);\n schedule_update();\n component.$$.dirty.fill(0);\n }\n component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));\n}\nfunction init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {\n const parent_component = current_component;\n set_current_component(component);\n const $$ = component.$$ = {\n fragment: null,\n ctx: [],\n // state\n props,\n update: noop,\n not_equal,\n bound: blank_object(),\n // lifecycle\n on_mount: [],\n on_destroy: [],\n on_disconnect: [],\n before_update: [],\n after_update: [],\n context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),\n // everything else\n callbacks: blank_object(),\n dirty,\n skip_bound: false,\n root: options.target || parent_component.$$.root\n };\n append_styles && append_styles($$.root);\n let ready = false;\n $$.ctx = instance\n ? instance(component, options.props || {}, (i, ret, ...rest) => {\n const value = rest.length ? rest[0] : ret;\n if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {\n if (!$$.skip_bound && $$.bound[i])\n $$.bound[i](value);\n if (ready)\n make_dirty(component, i);\n }\n return ret;\n })\n : [];\n $$.update();\n ready = true;\n run_all($$.before_update);\n // `false` as a special case of no DOM component\n $$.fragment = create_fragment ? create_fragment($$.ctx) : false;\n if (options.target) {\n if (options.hydrate) {\n start_hydrating();\n const nodes = children(options.target);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n $$.fragment && $$.fragment.l(nodes);\n nodes.forEach(detach);\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n $$.fragment && $$.fragment.c();\n }\n if (options.intro)\n transition_in(component.$$.fragment);\n mount_component(component, options.target, options.anchor, options.customElement);\n end_hydrating();\n flush();\n }\n set_current_component(parent_component);\n}\nlet SvelteElement;\nif (typeof HTMLElement === 'function') {\n SvelteElement = class extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n connectedCallback() {\n const { on_mount } = this.$$;\n this.$$.on_disconnect = on_mount.map(run).filter(is_function);\n // @ts-ignore todo: improve typings\n for (const key in this.$$.slotted) {\n // @ts-ignore todo: improve typings\n this.appendChild(this.$$.slotted[key]);\n }\n }\n attributeChangedCallback(attr, _oldValue, newValue) {\n this[attr] = newValue;\n }\n disconnectedCallback() {\n run_all(this.$$.on_disconnect);\n }\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n // TODO should this delegate to addEventListener?\n if (!is_function(callback)) {\n return noop;\n }\n const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n };\n}\n/**\n * Base class for Svelte components. Used when dev=false.\n */\nclass SvelteComponent {\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n if (!is_function(callback)) {\n return noop;\n }\n const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n}\n\nfunction dispatch_dev(type, detail) {\n document.dispatchEvent(custom_event(type, Object.assign({ version: '3.57.0' }, detail), { bubbles: true }));\n}\nfunction append_dev(target, node) {\n dispatch_dev('SvelteDOMInsert', { target, node });\n append(target, node);\n}\nfunction append_hydration_dev(target, node) {\n dispatch_dev('SvelteDOMInsert', { target, node });\n append_hydration(target, node);\n}\nfunction insert_dev(target, node, anchor) {\n dispatch_dev('SvelteDOMInsert', { target, node, anchor });\n insert(target, node, anchor);\n}\nfunction insert_hydration_dev(target, node, anchor) {\n dispatch_dev('SvelteDOMInsert', { target, node, anchor });\n insert_hydration(target, node, anchor);\n}\nfunction detach_dev(node) {\n dispatch_dev('SvelteDOMRemove', { node });\n detach(node);\n}\nfunction detach_between_dev(before, after) {\n while (before.nextSibling && before.nextSibling !== after) {\n detach_dev(before.nextSibling);\n }\n}\nfunction detach_before_dev(after) {\n while (after.previousSibling) {\n detach_dev(after.previousSibling);\n }\n}\nfunction detach_after_dev(before) {\n while (before.nextSibling) {\n detach_dev(before.nextSibling);\n }\n}\nfunction listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation, has_stop_immediate_propagation) {\n const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];\n if (has_prevent_default)\n modifiers.push('preventDefault');\n if (has_stop_propagation)\n modifiers.push('stopPropagation');\n if (has_stop_immediate_propagation)\n modifiers.push('stopImmediatePropagation');\n dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });\n const dispose = listen(node, event, handler, options);\n return () => {\n dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });\n dispose();\n };\n}\nfunction attr_dev(node, attribute, value) {\n attr(node, attribute, value);\n if (value == null)\n dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });\n else\n dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });\n}\nfunction prop_dev(node, property, value) {\n node[property] = value;\n dispatch_dev('SvelteDOMSetProperty', { node, property, value });\n}\nfunction dataset_dev(node, property, value) {\n node.dataset[property] = value;\n dispatch_dev('SvelteDOMSetDataset', { node, property, value });\n}\nfunction set_data_dev(text, data) {\n data = '' + data;\n if (text.wholeText === data)\n return;\n dispatch_dev('SvelteDOMSetData', { node: text, data });\n text.data = data;\n}\nfunction validate_each_argument(arg) {\n if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {\n let msg = '{#each} only iterates over array-like objects.';\n if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {\n msg += ' You can use a spread to convert this iterable into an array.';\n }\n throw new Error(msg);\n }\n}\nfunction validate_slots(name, slot, keys) {\n for (const slot_key of Object.keys(slot)) {\n if (!~keys.indexOf(slot_key)) {\n console.warn(`<${name}> received an unexpected slot \"${slot_key}\".`);\n }\n }\n}\nfunction validate_dynamic_element(tag) {\n const is_string = typeof tag === 'string';\n if (tag && !is_string) {\n throw new Error('<svelte:element> expects \"this\" attribute to be a string.');\n }\n}\nfunction validate_void_dynamic_element(tag) {\n if (tag && is_void(tag)) {\n console.warn(`<svelte:element this=\"${tag}\"> is self-closing and cannot have content.`);\n }\n}\nfunction construct_svelte_component_dev(component, props) {\n const error_message = 'this={...} of <svelte:component> should specify a Svelte component.';\n try {\n const instance = new component(props);\n if (!instance.$$ || !instance.$set || !instance.$on || !instance.$destroy) {\n throw new Error(error_message);\n }\n return instance;\n }\n catch (err) {\n const { message } = err;\n if (typeof message === 'string' && message.indexOf('is not a constructor') !== -1) {\n throw new Error(error_message);\n }\n else {\n throw err;\n }\n }\n}\n/**\n * Base class for Svelte components with some minor dev-enhancements. Used when dev=true.\n */\nclass SvelteComponentDev extends SvelteComponent {\n constructor(options) {\n if (!options || (!options.target && !options.$$inline)) {\n throw new Error(\"'target' is a required option\");\n }\n super();\n }\n $destroy() {\n super.$destroy();\n this.$destroy = () => {\n console.warn('Component was already destroyed'); // eslint-disable-line no-console\n };\n }\n $capture_state() { }\n $inject_state() { }\n}\n/**\n * Base class to create strongly typed Svelte components.\n * This only exists for typing purposes and should be used in `.d.ts` files.\n *\n * ### Example:\n *\n * You have component library on npm called `component-library`, from which\n * you export a component called `MyComponent`. For Svelte+TypeScript users,\n * you want to provide typings. Therefore you create a `index.d.ts`:\n * ```ts\n * import { SvelteComponentTyped } from \"svelte\";\n * export class MyComponent extends SvelteComponentTyped<{foo: string}> {}\n * ```\n * Typing this makes it possible for IDEs like VS Code with the Svelte extension\n * to provide intellisense and to use the component like this in a Svelte file\n * with TypeScript:\n * ```svelte\n * <script lang=\"ts\">\n * \timport { MyComponent } from \"component-library\";\n * </script>\n * <MyComponent foo={'bar'} />\n * ```\n *\n * #### Why not make this part of `SvelteComponent(Dev)`?\n * Because\n * ```ts\n * class ASubclassOfSvelteComponent extends SvelteComponent<{foo: string}> {}\n * const component: typeof SvelteComponent = ASubclassOfSvelteComponent;\n * ```\n * will throw a type error, so we need to separate the more strictly typed class.\n */\nclass SvelteComponentTyped extends SvelteComponentDev {\n constructor(options) {\n super(options);\n }\n}\nfunction loop_guard(timeout) {\n const start = Date.now();\n return () => {\n if (Date.now() - start > timeout) {\n throw new Error('Infinite loop detected');\n }\n };\n}\n\nexport { HtmlTag, HtmlTagHydration, SvelteComponent, SvelteComponentDev, SvelteComponentTyped, SvelteElement, action_destroyer, add_attribute, add_classes, add_flush_callback, add_location, add_render_callback, add_resize_listener, add_styles, add_transform, afterUpdate, append, append_dev, append_empty_stylesheet, append_hydration, append_hydration_dev, append_styles, assign, attr, attr_dev, attribute_to_object, beforeUpdate, bind, binding_callbacks, blank_object, bubble, check_outros, children, claim_component, claim_element, claim_html_tag, claim_space, claim_svg_element, claim_text, clear_loops, component_subscribe, compute_rest_props, compute_slots, construct_svelte_component, construct_svelte_component_dev, createEventDispatcher, create_animation, create_bidirectional_transition, create_component, create_in_transition, create_out_transition, create_slot, create_ssr_component, current_component, custom_event, dataset_dev, debug, destroy_block, destroy_component, destroy_each, detach, detach_after_dev, detach_before_dev, detach_between_dev, detach_dev, dirty_components, dispatch_dev, each, element, element_is, empty, end_hydrating, escape, escape_attribute_value, escape_object, exclude_internal_props, fix_and_destroy_block, fix_and_outro_and_destroy_block, fix_position, flush, flush_render_callbacks, getAllContexts, getContext, get_all_dirty_from_scope, get_binding_group_value, get_current_component, get_custom_elements_slots, get_root_for_style, get_slot_changes, get_spread_object, get_spread_update, get_store_value, globals, group_outros, handle_promise, hasContext, has_prop, head_selector, identity, init, init_binding_group, init_binding_group_dynamic, insert, insert_dev, insert_hydration, insert_hydration_dev, intros, invalid_attribute_name_character, is_client, is_crossorigin, is_empty, is_function, is_promise, is_void, listen, listen_dev, loop, loop_guard, merge_ssr_styles, missing_component, mount_component, noop, not_equal, now, null_to_empty, object_without_properties, onDestroy, onMount, once, outro_and_destroy_block, prevent_default, prop_dev, query_selector_all, raf, run, run_all, safe_not_equal, schedule_update, select_multiple_value, select_option, select_options, select_value, self, setContext, set_attributes, set_current_component, set_custom_element_data, set_custom_element_data_map, set_data, set_data_dev, set_dynamic_element_data, set_input_type, set_input_value, set_now, set_raf, set_store_value, set_style, set_svg_attributes, space, split_css_unit, spread, src_url_equal, start_hydrating, stop_immediate_propagation, stop_propagation, subscribe, svg_element, text, tick, time_ranges_to_array, to_number, toggle_class, transition_in, transition_out, trusted, update_await_block_branch, update_keyed_each, update_slot, update_slot_base, validate_component, validate_dynamic_element, validate_each_argument, validate_each_keys, validate_slots, validate_store, validate_void_dynamic_element, xlink_attr };\n","import { group_outros, transition_out, check_outros } from 'svelte/internal';\n\n/**\n * Provides common object manipulation utilities including depth traversal, obtaining accessors, safely setting values /\n * equality tests, and validation.\n */\n\nconst s_TAG_OBJECT = '[object Object]';\n\n/**\n * Recursively deep merges all source objects into the target object in place. Like `Object.assign` if you provide `{}`\n * as the target a copy is produced. If the target and source property are object literals they are merged.\n * Deleting keys is supported by specifying a property starting with `-=`.\n *\n * @param {object} target - Target object.\n *\n * @param {...object} sourceObj - One or more source objects.\n *\n * @returns {object} Target object.\n */\nfunction deepMerge(target = {}, ...sourceObj)\n{\n if (Object.prototype.toString.call(target) !== s_TAG_OBJECT)\n {\n throw new TypeError(`deepMerge error: 'target' is not an 'object'.`);\n }\n\n for (let cntr = 0; cntr < sourceObj.length; cntr++)\n {\n if (Object.prototype.toString.call(sourceObj[cntr]) !== s_TAG_OBJECT)\n {\n throw new TypeError(`deepMerge error: 'sourceObj[${cntr}]' is not an 'object'.`);\n }\n }\n\n return _deepMerge(target, ...sourceObj);\n}\n\n/**\n * Tests for whether an object is iterable.\n *\n * @param {*} value - Any value.\n *\n * @returns {boolean} Whether object is iterable.\n */\nfunction isIterable(value)\n{\n if (value === null || value === void 0 || typeof value !== 'object') { return false; }\n\n return typeof value[Symbol.iterator] === 'function';\n}\n\n/**\n * Tests for whether an object is async iterable.\n *\n * @param {*} value - Any value.\n *\n * @returns {boolean} Whether value is async iterable.\n */\nfunction isIterableAsync(value)\n{\n if (value === null || value === void 0 || typeof value !== 'object') { return false; }\n\n return typeof value[Symbol.asyncIterator] === 'function';\n}\n\n/**\n * Tests for whether object is not null and a typeof object.\n *\n * @param {*} value - Any value.\n *\n * @returns {boolean} Is it an object.\n */\nfunction isObject(value)\n{\n return value !== null && typeof value === 'object';\n}\n\n/**\n * Tests for whether the given value is a plain object.\n *\n * An object is plain if it is created by either: {}, new Object() or Object.create(null).\n *\n * @param {*} value - Any value\n *\n * @returns {boolean} Is it a plain object.\n */\nfunction isPlainObject(value)\n{\n if (Object.prototype.toString.call(value) !== s_TAG_OBJECT) { return false; }\n\n const prototype = Object.getPrototypeOf(value);\n return prototype === null || prototype === Object.prototype;\n}\n\n/**\n * Provides a way to safely access an objects data / entries given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * @param {object} data - An object to access entry data.\n *\n * @param {string} accessor - A string describing the entries to access.\n *\n * @param {*} defaultValue - (Optional) A default value to return if an entry for accessor is not found.\n *\n * @returns {object} The data object.\n */\nfunction safeAccess(data, accessor, defaultValue = void 0)\n{\n if (typeof data !== 'object') { return defaultValue; }\n if (typeof accessor !== 'string') { return defaultValue; }\n\n const access = accessor.split('.');\n\n // Walk through the given object by the accessor indexes.\n for (let cntr = 0; cntr < access.length; cntr++)\n {\n // If the next level of object access is undefined or null then return the empty string.\n if (typeof data[access[cntr]] === 'undefined' || data[access[cntr]] === null) { return defaultValue; }\n\n data = data[access[cntr]];\n }\n\n return data;\n}\n\n/**\n * Provides a way to safely set an objects data / entries given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * @param {object} data - An object to access entry data.\n *\n * @param {string} accessor - A string describing the entries to access.\n *\n * @param {*} value - A new value to set if an entry for accessor is found.\n *\n * @param {string} [operation='set'] - Operation to perform including: 'add', 'div', 'mult', 'set',\n * 'set-undefined', 'sub'.\n *\n * @param {boolean} [createMissing=true] - If true missing accessor entries will be created as objects\n * automatically.\n *\n * @returns {boolean} True if successful.\n */\nfunction safeSet(data, accessor, value, operation = 'set', createMissing = true)\n{\n if (typeof data !== 'object') { throw new TypeError(`safeSet Error: 'data' is not an 'object'.`); }\n if (typeof accessor !== 'string') { throw new TypeError(`safeSet Error: 'accessor' is not a 'string'.`); }\n\n const access = accessor.split('.');\n\n // Walk through the given object by the accessor indexes.\n for (let cntr = 0; cntr < access.length; cntr++)\n {\n // If data is an array perform validation that the accessor is a positive integer otherwise quit.\n if (Array.isArray(data))\n {\n const number = (+access[cntr]);\n\n if (!Number.isInteger(number) || number < 0) { return false; }\n }\n\n if (cntr === access.length - 1)\n {\n switch (operation)\n {\n case 'add':\n data[access[cntr]] += value;\n break;\n\n case 'div':\n data[access[cntr]] /= value;\n break;\n\n case 'mult':\n data[access[cntr]] *= value;\n break;\n\n case 'set':\n data[access[cntr]] = value;\n break;\n\n case 'set-undefined':\n if (typeof data[access[cntr]] === 'undefined') { data[access[cntr]] = value; }\n break;\n\n case 'sub':\n data[access[cntr]] -= value;\n break;\n }\n }\n else\n {\n // If createMissing is true and the next level of object access is undefined then create a new object entry.\n if (createMissing && typeof data[access[cntr]] === 'undefined') { data[access[cntr]] = {}; }\n\n // Abort if the next level is null or not an object and containing a value.\n if (data[access[cntr]] === null || typeof data[access[cntr]] !== 'object') { return false; }\n\n data = data[access[cntr]];\n }\n }\n\n return true;\n}\n\n/**\n * Internal implementation for `deepMerge`.\n *\n * @param {object} target - Target object.\n *\n * @param {...object} sourceObj - One or more source objects.\n *\n * @returns {object} Target object.\n */\nfunction _deepMerge(target = {}, ...sourceObj)\n{\n // Iterate and merge all source objects into target.\n for (let cntr = 0; cntr < sourceObj.length; cntr++)\n {\n const obj = sourceObj[cntr];\n\n for (const prop in obj)\n {\n if (Object.prototype.hasOwnProperty.call(obj, prop))\n {\n // Handle the special property starting with '-=' to delete keys.\n if (prop.startsWith('-='))\n {\n delete target[prop.slice(2)];\n continue;\n }\n\n // If target already has prop and both target[prop] and obj[prop] are object literals then merge them\n // otherwise assign obj[prop] to target[prop].\n target[prop] = Object.prototype.hasOwnProperty.call(target, prop) && target[prop]?.constructor === Object &&\n obj[prop]?.constructor === Object ? _deepMerge({}, target[prop], obj[prop]) : obj[prop];\n }\n }\n }\n\n return target;\n}\n\n/**\n * Provides several helpful utility methods for accessibility and keyboard navigation.\n */\nclass A11yHelper\n{\n /**\n * Apply focus to the HTMLElement targets in a given A11yFocusSource data object. An iterable list `options.focusEl`\n * can contain HTMLElements or selector strings. If multiple focus targets are provided in a list then the first\n * valid target found will be focused. If focus target is a string then a lookup via `document.querySelector` is\n * performed. In this case you should provide a unique selector for the desired focus target.\n *\n * Note: The body of this method is postponed to the next clock tick to allow any changes in the DOM to occur that\n * might alter focus targets before applying.\n *\n * @param {A11yFocusSource|{ focusSource: A11yFocusSource }} options - The focus options instance to apply.\n */\n static applyFocusSource(options)\n {\n if (!isObject(options)) { return; }\n\n // Handle the case of receiving an object with embedded `focusSource`.\n const focusOpts = isObject(options?.focusSource) ? options.focusSource : options;\n\n setTimeout(() =>\n {\n const debug = typeof focusOpts.debug === 'boolean' ? focusOpts.debug : false;\n\n if (isIterable(focusOpts.focusEl))\n {\n if (debug)\n {\n console.debug(`A11yHelper.applyFocusSource debug - Attempting to apply focus target: `, focusOpts.focusEl);\n }\n\n for (const target of focusOpts.focusEl)\n {\n if (target instanceof HTMLElement && target.isConnected)\n {\n target.focus();\n if (debug)\n {\n console.debug(`A11yHelper.applyFocusSource debug - Applied focus to target: `, target);\n }\n break;\n }\n else if (typeof target === 'string')\n {\n const element = document.querySelector(target);\n if (element instanceof HTMLElement && element.isConnected)\n {\n element.focus();\n if (debug)\n {\n console.debug(`A11yHelper.applyFocusSource debug - Applied focus to target: `, element);\n }\n break;\n }\n else if (debug)\n {\n console.debug(`A11yHelper.applyFocusSource debug - Could not query selector: `, target);\n }\n }\n }\n }\n else if (debug)\n {\n console.debug(`A11yHelper.applyFocusSource debug - No focus targets defined.`);\n }\n }, 0);\n }\n\n /**\n * Returns first focusable element within a specified element.\n *\n * @param {HTMLElement|Document} [element=document] - Optional element to start query.\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {Iterable<string>} [options.ignoreClasses] - Iterable list of classes to ignore elements.\n *\n * @param {Set<HTMLElement>} [options.ignoreElements] - Set of elements to ignore.\n *\n * @returns {HTMLElement} First focusable child element\n */\n static getFirstFocusableElement(element = document, options)\n {\n const focusableElements = this.getFocusableElements(element, options);\n\n return focusableElements.length > 0 ? focusableElements[0] : void 0;\n }\n\n /**\n * Returns all focusable elements within a specified element.\n *\n * @param {HTMLElement|Document} [element=document] Optional element to start query.\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {boolean} [options.anchorHref=true] - When true anchors must have an HREF.\n *\n * @param {Iterable<string>} [options.ignoreClasses] - Iterable list of classes to ignore elements.\n *\n * @param {Set<HTMLElement>} [options.ignoreElements] - Set of elements to ignore.\n *\n * @param {string} [options.selectors] - Custom list of focusable selectors for `querySelectorAll`.\n *\n * @returns {Array<HTMLElement>} Child keyboard focusable\n */\n static getFocusableElements(element = document, { anchorHref = true, ignoreClasses, ignoreElements, selectors } = {})\n {\n if (!(element instanceof HTMLElement) && !(element instanceof Document))\n {\n throw new TypeError(`'element' is not a HTMLElement or Document instance.`);\n }\n\n if (typeof anchorHref !== 'boolean')\n {\n throw new TypeError(`'anchorHref' is not a boolean.`);\n }\n\n if (ignoreClasses !== void 0 && !isIterable(ignoreClasses))\n {\n throw new TypeError(`'ignoreClasses' is not an iterable list.`);\n }\n\n if (ignoreElements !== void 0 && !(ignoreElements instanceof Set))\n {\n throw new TypeError(`'ignoreElements' is not a Set.`);\n }\n\n if (selectors !== void 0 && typeof selectors !== 'string')\n {\n throw new TypeError(`'selectors' is not a string.`);\n }\n\n const selectorQuery = selectors ?? this.#getFocusableSelectors(anchorHref);\n\n const allElements = [...element.querySelectorAll(selectorQuery)];\n\n if (ignoreElements && ignoreClasses)\n {\n return allElements.filter((el) =>\n {\n let hasIgnoreClass = false;\n for (const ignoreClass of ignoreClasses)\n {\n if (el.classList.contains(ignoreClass))\n {\n hasIgnoreClass = true;\n break;\n }\n }\n\n return !hasIgnoreClass && !ignoreElements.has(el) && el.style.display !== 'none' &&\n el.style.visibility !== 'hidden' && !el.hasAttribute('disabled') && !el.hasAttribute('inert') &&\n el.getAttribute('aria-hidden') !== 'true';\n });\n }\n else if (ignoreClasses)\n {\n return allElements.filter((el) =>\n {\n let hasIgnoreClass = false;\n for (const ignoreClass of ignoreClasses)\n {\n if (el.classList.contains(ignoreClass))\n {\n hasIgnoreClass = true;\n break;\n }\n }\n\n return !hasIgnoreClass && el.style.display !== 'none' && el.style.visibility !== 'hidden' &&\n !el.hasAttribute('disabled') && !el.hasAttribute('inert') && el.getAttribute('aria-hidden') !== 'true';\n });\n }\n else if (ignoreElements)\n {\n return allElements.filter((el) =>\n {\n return !ignoreElements.has(el) && el.style.display !== 'none' && el.style.visibility !== 'hidden' &&\n !el.hasAttribute('disabled') && !el.hasAttribute('inert') && el.getAttribute('aria-hidden') !== 'true';\n });\n }\n else\n {\n return allElements.filter((el) =>\n {\n return el.style.display !== 'none' && el.style.visibility !== 'hidden' && !el.hasAttribute('disabled') &&\n !el.hasAttribute('inert') && el.getAttribute('aria-hidden') !== 'true';\n });\n }\n }\n\n /**\n * Returns the default focusable selectors query.\n *\n * @param {boolean} [anchorHref=true] - When true anchors must have an HREF.\n *\n * @returns {string} Focusable selectors for `querySelectorAll`.\n */\n static #getFocusableSelectors(anchorHref = true)\n {\n return `button, [contenteditable=\"\"], [contenteditable=\"true\"], details summary:not([tabindex=\"-1\"]), embed, a${\n anchorHref ? '[href]' : ''}, iframe, object, input:not([type=hidden]), select, textarea, ` +\n `[tabindex]:not([tabindex=\"-1\"])`;\n }\n\n /**\n * Gets a A11yFocusSource object from the given DOM event allowing for optional X / Y screen space overrides.\n * Browsers (Firefox / Chrome) forwards a mouse event for the context menu keyboard button. Provides detection of\n * when the context menu event is from the keyboard. Firefox as of (1/23) does not provide the correct screen space\n * coordinates, so for keyboard context menu presses coordinates are generated from the centroid point of the\n * element.\n *\n * A default fallback element or selector string may be provided to provide the focus target. If the event comes from\n * the keyboard however the source focused element is inserted as the target with the fallback value appended to the\n * list of focus targets. When A11yFocusSource is applied by {@link A11yHelper.applyFocusSource} the target focus\n * list is iterated through until a connected target is found and focus applied.\n *\n * @param {object} options - Options\n *\n * @param {KeyboardEvent|MouseEvent} [options.event] - The source DOM event.\n *\n * @param {boolean} [options.debug] - When true {@link A11yHelper.applyFocusSource} logs focus target data.\n *\n * @param {HTMLElement|string} [options.focusEl] - A specific HTMLElement or selector string as the focus target.\n *\n * @param {number} [options.x] - Used when an event isn't provided; integer of event source in screen space.\n *\n * @param {number} [options.y] - Used when an event isn't provided; integer of event source in screen space.\n *\n * @returns {A11yFocusSource} A A11yFocusSource object.\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1426671\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=314314\n *\n * TODO: Evaluate / test against touch input devices.\n */\n static getFocusSource({ event, x, y, focusEl, debug = false })\n {\n if (focusEl !== void 0 && !(focusEl instanceof HTMLElement) && typeof focusEl !== 'string')\n {\n throw new TypeError(\n `A11yHelper.getFocusSource error: 'focusEl' is not a HTMLElement or string.`);\n }\n\n if (debug !== void 0 && typeof debug !== 'boolean')\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'debug' is not a boolean.`);\n }\n\n // Handle the case when no event is provided and x, y, or focusEl is explicitly defined.\n if (event === void 0)\n {\n if (typeof x !== 'number')\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'event' not defined and 'x' is not a number.`);\n }\n\n if (typeof y !== 'number')\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'event' not defined and 'y' is not a number.`);\n }\n\n return {\n debug,\n focusEl: focusEl !== void 0 ? [focusEl] : void 0,\n x,\n y,\n };\n }\n\n if (!(event instanceof KeyboardEvent) && !(event instanceof MouseEvent))\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'event' is not a KeyboardEvent or MouseEvent.`);\n }\n\n if (x !== void 0 && !Number.isInteger(x))\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'x' is not a number.`);\n }\n\n if (y !== void 0 && !Number.isInteger(y))\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'y' is not a number.`);\n }\n\n /** @type {HTMLElement} */\n const targetEl = event.target;\n\n if (!(targetEl instanceof HTMLElement))\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'event.target' is not an HTMLElement.`);\n }\n\n const result = { debug };\n\n if (event instanceof MouseEvent)\n {\n // Firefox currently (1/23) does not correctly determine the location of a keyboard originated\n // context menu location, so calculate position from middle of the event target.\n // Firefox fires a mouse event for the context menu key.\n if (event?.button !== 2 && event.type === 'contextmenu')\n {\n const rect = targetEl.getBoundingClientRect();\n result.x = x ?? rect.left + (rect.width / 2);\n result.y = y ?? rect.top + (rect.height / 2);\n result.focusEl = focusEl !== void 0 ? [targetEl, focusEl] : [targetEl];\n result.source = 'keyboard';\n }\n else\n {\n result.x = x ?? event.pageX;\n result.y = y ?? event.pageY;\n result.focusEl = focusEl !== void 0 ? [focusEl] : void 0;\n }\n }\n else\n {\n const rect = targetEl.getBoundingClientRect();\n result.x = x ?? rect.left + (rect.width / 2);\n result.y = y ?? rect.top + (rect.height / 2);\n result.focusEl = focusEl !== void 0 ? [targetEl, focusEl] : [targetEl];\n result.source = 'keyboard';\n }\n\n return result;\n }\n\n /**\n * Returns first focusable element within a specified element.\n *\n * @param {HTMLElement|Document} [element=document] - Optional element to start query.\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {Iterable<string>} [options.ignoreClasses] - Iterable list of classes to ignore elements.\n *\n * @param {Set<HTMLElement>} [options.ignoreElements] - Set of elements to ignore.\n *\n * @returns {HTMLElement} First focusable child element\n */\n static getLastFocusableElement(element = document, options)\n {\n const focusableElements = this.getFocusableElements(element, options);\n\n return focusableElements.length > 0 ? focusableElements[focusableElements.length - 1] : void 0;\n }\n\n /**\n * Tests if the given element is focusable.\n *\n * @param {HTMLElement} [el] - Element to test.\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {boolean} [options.anchorHref=true] - When true anchors must have an HREF.\n *\n * @param {Iterable<string>} [options.ignoreClasses] - Iterable list of classes to ignore elements.\n *\n * @returns {boolean} Element is focusable.\n */\n static isFocusable(el, { anchorHref = true, ignoreClasses } = {})\n {\n if (el === void 0 || el === null || !(el instanceof HTMLElement) || el?.hidden || !el?.isConnected)\n {\n return false;\n }\n\n if (typeof anchorHref !== 'boolean')\n {\n throw new TypeError(`'anchorHref' is not a boolean.`);\n }\n\n if (ignoreClasses !== void 0 && !isIterable(ignoreClasses))\n {\n throw new TypeError(`'ignoreClasses' is not an iterable list.`);\n }\n\n const contenteditableAttr = el.getAttribute('contenteditable');\n const contenteditableFocusable = typeof contenteditableAttr === 'string' &&\n (contenteditableAttr === '' || contenteditableAttr === 'true');\n\n const tabindexAttr = el.getAttribute('tabindex');\n const tabindexFocusable = typeof tabindexAttr === 'string' && tabindexAttr !== '-1';\n\n const isAnchor = el instanceof HTMLAnchorElement;\n\n if (contenteditableFocusable || tabindexFocusable || isAnchor || el instanceof HTMLButtonElement ||\n el instanceof HTMLDetailsElement || el instanceof HTMLEmbedElement || el instanceof HTMLIFrameElement ||\n el instanceof HTMLInputElement || el instanceof HTMLObjectElement || el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement)\n {\n if (isAnchor && anchorHref && typeof el.getAttribute('href') !== 'string')\n {\n return false;\n }\n\n return el.style.display !== 'none' && el.style.visibility !== 'hidden' && !el.hasAttribute('disabled') &&\n !el.hasAttribute('inert') && el.getAttribute('aria-hidden') !== 'true';\n }\n\n return false;\n }\n\n /**\n * Convenience method to check if the given data is a valid focus source.\n *\n * @param {HTMLElement|string} data - Either an HTMLElement or selector string.\n *\n * @returns {boolean} Is valid focus source.\n */\n static isFocusSource(data)\n {\n return data instanceof HTMLElement || typeof data === 'string';\n }\n}\n\n/**\n * @typedef {object} A11yFocusSource - Provides essential data to return focus to an HTMLElement after a series of UI\n * actions like working with context menus and modal dialogs.\n *\n * @property {boolean} [debug] - When true logs to console the actions taken in {@link A11yHelper.applyFocusSource}.\n *\n * @property {Iterable<HTMLElement|string>} [focusEl] - List of targets to attempt to focus.\n *\n * @property {string} [source] - The source of the event: 'keyboard' for instance.\n *\n * @property {number} [x] - Potential X coordinate of initial event.\n *\n * @property {number} [y] - Potential Y coordinate of initial event.\n */\n\n/**\n * Provides management of a single Promise that can be shared and accessed across JS & Svelte components. This allows a\n * Promise to be created and managed as part of the TRL application lifecycle and accessed safely in various control\n * flow scenarios. When resolution of the current managed Promise starts further interaction is prevented.\n *\n * Note: to enable debugging / log statements set the static `logging` variable to true.\n */\nclass ManagedPromise\n{\n /** @type {boolean} */\n static #logging = false;\n\n /** @type {{ isProcessing?: boolean, promise?: Promise, reject: Function, resolve: Function }} */\n #current;\n\n /**\n * @returns {boolean} Whether global logging is enabled.\n */\n static get logging()\n {\n return this.#logging;\n }\n\n /**\n * @returns {boolean} Whether there is an active managed Promise.\n */\n get isActive()\n {\n return this.#current !== void 0;\n }\n\n /**\n * @returns {boolean} Whether there is an active managed Promise and resolution is currently being processed.\n */\n get isProcessing()\n {\n return this.#current !== void 0 ? this.#current.isProcessing : false;\n }\n\n /**\n * Sets global logging enabled state.\n *\n * @param {boolean} logging - New logging enabled state.\n */\n static set logging(logging)\n {\n if (typeof logging !== 'boolean')\n {\n throw new TypeError(`[TRL] ManagedPromise.logging error: 'logging' is not a boolean.`);\n }\n\n this.#logging = logging;\n }\n\n // ----------------------------------------------------------------------------------------------------------------\n\n /**\n * Resolves any current Promise with undefined and creates a new current Promise.\n *\n * @template T\n *\n * @param {object} opts - Options.\n *\n * @param {boolean} [opts.reuse=false] - When true if there is an existing live Promise it is returned immediately.\n *\n * @returns {Promise<T>} The new current managed Promise.\n */\n create({ reuse = false } = {})\n {\n if (typeof reuse !== 'boolean')\n {\n throw new TypeError(`[TRL] ManagedPromise.create error: 'reuse' is not a boolean.`);\n }\n\n if (reuse && this.#current !== void 0 && this.#current.promise instanceof Promise)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.create info: Reusing / returning existing managed Promise.`);\n }\n\n return this.#current.promise;\n }\n\n if (this.#current !== void 0)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(\n `[TRL] ManagedPromise.create info: Creating a new Promise and resolving existing immediately.`);\n }\n\n this.#current.resolve(void 0);\n this.#current = void 0;\n }\n\n const promise = new Promise((resolve, reject) =>\n {\n this.#current = {\n isProcessing: false,\n reject,\n resolve\n };\n });\n\n this.#current.promise = promise;\n\n return promise;\n }\n\n /**\n * Gets the current Promise if any.\n *\n * @returns {Promise<any>} Current Promise.\n */\n get()\n {\n return this.#current ? this.#current.promise : void 0;\n }\n\n /**\n * Rejects the current Promise if applicable.\n *\n * @param {*} [result] - Result to reject.\n *\n * @returns {boolean} Was the promise rejected.\n */\n reject(result = void 0)\n {\n // Early out as Promise resolution is currently processing.\n if (this.#current !== void 0 && this.#current.isProcessing)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.reject info: Currently processing promise.`);\n }\n\n return true;\n }\n\n if (this.#current !== void 0)\n {\n this.#current.isProcessing = true;\n\n if (result instanceof Promise)\n {\n result.then((value) =>\n {\n this.#current.reject(value);\n this.#current = void 0;\n }).catch((err) =>\n {\n this.#current.reject(err);\n this.#current = void 0;\n });\n }\n else\n {\n this.#current.reject(result);\n this.#current = void 0;\n }\n\n return true;\n }\n else\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.reject warning: No current managed Promise to reject.`);\n }\n\n return false;\n }\n }\n\n /**\n * Resolves the current Promise if applicable.\n *\n * @param {*} [result] - Result to resolve.\n *\n * @returns {boolean} Was the promise resolved.\n */\n resolve(result = void 0)\n {\n // Early out as Promise resolution is currently processing.\n if (this.#current !== void 0 && this.#current.isProcessing)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.resolve info: Currently processing promise.`);\n }\n\n return true;\n }\n\n if (this.#current !== void 0)\n {\n if (result instanceof Promise)\n {\n this.#current.isProcessing = true;\n\n result.then((value) =>\n {\n this.#current.resolve(value);\n this.#current = void 0;\n }).catch((err) =>\n {\n this.#current.reject(err);\n this.#current = void 0;\n });\n }\n else\n {\n this.#current.resolve(result);\n this.#current = void 0;\n }\n\n return true;\n }\n else\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.resolve warning: No current managed Promise to resolve.`);\n }\n\n return false;\n }\n }\n}\n\n/**\n * Provides access to the Clipboard API for reading / writing text strings. This requires a secure context.\n *\n * Note: `writeText` will attempt to use the older `execCommand` if available when `navigator.clipboard` is not\n * available.\n */\nclass ClipboardAccess\n{\n /**\n * Uses `navigator.clipboard` if available to read text from the clipboard.\n *\n * Note: Always returns `undefined` when `navigator.clipboard` is not available or the clipboard contains the\n * empty string.\n *\n * @returns {Promise<string|undefined>} The current clipboard text or undefined.\n */\n static async readText()\n {\n let result;\n\n if (globalThis?.navigator?.clipboard)\n {\n try\n {\n result = await globalThis.navigator.clipboard.readText();\n }\n catch (err) { /**/ }\n }\n\n return result === '' ? void 0 : result;\n }\n\n /**\n * Uses `navigator.clipboard` if available then falls back to `document.execCommand('copy')` if available to copy\n * the given text to the clipboard.\n *\n * @param {string} text - Text to copy to the browser clipboard.\n *\n * @returns {Promise<boolean>} Copy successful.\n */\n static async writeText(text)\n {\n if (typeof text !== 'string')\n {\n throw new TypeError(`ClipboardAccess.writeText error: 'text' is not a string.`);\n }\n\n let success = false;\n\n if (globalThis?.navigator?.clipboard)\n {\n try\n {\n await globalThis.navigator.clipboard.writeText(text);\n success = true;\n }\n catch (err) { /**/ }\n }\n else if (globalThis?.document?.execCommand instanceof Function)\n {\n const textArea = globalThis.document.createElement('textarea');\n\n // Place in the top-left corner of screen regardless of scroll position.\n textArea.style.position = 'fixed';\n textArea.style.top = '0';\n textArea.style.left = '0';\n\n // Ensure it has a small width and height. Setting to 1px / 1em\n // doesn't work as this gives a negative w/h on some browsers.\n textArea.style.width = '2em';\n textArea.style.height = '2em';\n\n // We don't need padding, reducing the size if it does flash render.\n textArea.style.padding = '0';\n\n // Clean up any borders.\n textArea.style.border = 'none';\n textArea.style.outline = 'none';\n textArea.style.boxShadow = 'none';\n\n // Avoid flash of the white box if rendered for any reason.\n textArea.style.background = 'transparent';\n\n textArea.value = text;\n\n globalThis.document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n\n try\n {\n success = document.execCommand('copy');\n }\n catch (err) { /**/ }\n\n document.body.removeChild(textArea);\n }\n\n return success;\n }\n}\n\n/**\n * Provides a solid string hashing algorithm.\n *\n * Sourced from: https://stackoverflow.com/a/52171480\n *\n * @param {string} str - String to hash.\n *\n * @param {number} seed - A seed value altering the hash.\n *\n * @returns {number} Hash code.\n */\nfunction hashCode(str, seed = 0)\n{\n if (typeof str !== 'string') { return 0; }\n\n let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n\n for (let ch, i = 0; i < str.length; i++)\n {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}\n\nconst s_UUIDV4_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;\n\n/**\n * Generates a UUID v4 compliant ID. Please use a complete UUID generation package for guaranteed compliance.\n *\n * This code is an evolution of the following Gist.\n * https://gist.github.com/jed/982883\n *\n * There is a public domain / free copy license attached to it that is not a standard OSS license...\n * https://gist.github.com/jed/982883#file-license-txt\n *\n * @returns {string} UUIDv4\n */\nfunction uuidv4()\n{\n return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>\n (c ^ (globalThis.crypto || globalThis.msCrypto).getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));\n}\n\n/**\n * Validates that the given string is formatted as a UUIDv4 string.\n *\n * @param {string} uuid - UUID string to test.\n *\n * @returns {boolean} Is UUIDv4 string.\n */\nuuidv4.isValid = (uuid) => s_UUIDV4_REGEX.test(uuid);\n\n/**\n * Normalizes a string.\n *\n * @param {string} query - A string to normalize for comparisons.\n *\n * @returns {string} Cleaned string.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize\n */\nfunction normalizeString(query)\n{\n return query.trim().normalize('NFD').replace(/[\\x00-\\x1F]/gm, ''); // eslint-disable-line no-control-regex\n}\n\n/**\n * Recursive function that finds the closest parent stacking context.\n * See also https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n *\n * Original author: Kerry Liu / https://github.com/gwwar\n *\n * @see https://github.com/gwwar/z-context/blob/master/content-script.js\n * @see https://github.com/gwwar/z-context/blob/master/LICENSE\n *\n * @param {Element} node -\n *\n * @returns {StackingContext} The closest parent stacking context\n */\nfunction getStackingContext(node)\n{\n // the root element (HTML).\n if (!node || node.nodeName === 'HTML')\n {\n return { node: document.documentElement, reason: 'root' };\n }\n\n // handle shadow root elements.\n if (node.nodeName === '#document-fragment')\n {\n return getStackingContext(node.host);\n }\n\n const computedStyle = globalThis.getComputedStyle(node);\n\n // position: fixed or sticky.\n if (computedStyle.position === 'fixed' || computedStyle.position === 'sticky')\n {\n return { node, reason: `position: ${computedStyle.position}` };\n }\n\n // positioned (absolutely or relatively) with a z-index value other than \"auto\".\n if (computedStyle.zIndex !== 'auto' && computedStyle.position !== 'static')\n {\n return { node, reason: `position: ${computedStyle.position}; z-index: ${computedStyle.zIndex}` };\n }\n\n // elements with an opacity value less than 1.\n if (computedStyle.opacity !== '1')\n {\n return { node, reason: `opacity: ${computedStyle.opacity}` };\n }\n\n // elements with a transform value other than \"none\".\n if (computedStyle.transform !== 'none')\n {\n return { node, reason: `transform: ${computedStyle.transform}` };\n }\n\n // elements with a mix-blend-mode value other than \"normal\".\n if (computedStyle.mixBlendMode !== 'normal')\n {\n return { node, reason: `mixBlendMode: ${computedStyle.mixBlendMode}` };\n }\n\n // elements with a filter value other than \"none\".\n if (computedStyle.filter !== 'none')\n {\n return { node, reason: `filter: ${computedStyle.filter}` };\n }\n\n // elements with a perspective value other than \"none\".\n if (computedStyle.perspective !== 'none')\n {\n return { node, reason: `perspective: ${computedStyle.perspective}` };\n }\n\n // elements with a clip-path value other than \"none\".\n if (computedStyle.clipPath !== 'none')\n {\n return { node, reason: `clip-path: ${computedStyle.clipPath} ` };\n }\n\n // elements with a mask value other than \"none\".\n const mask = computedStyle.mask || computedStyle.webkitMask;\n if (mask !== 'none' && mask !== undefined)\n {\n return { node, reason: `mask: ${mask}` };\n }\n\n // elements with a mask-image value other than \"none\".\n const maskImage = computedStyle.maskImage || computedStyle.webkitMaskImage;\n if (maskImage !== 'none' && maskImage !== undefined)\n {\n return { node, reason: `mask-image: ${maskImage}` };\n }\n\n // elements with a mask-border value other than \"none\".\n const maskBorder = computedStyle.maskBorder || computedStyle.webkitMaskBorder;\n if (maskBorder !== 'none' && maskBorder !== undefined)\n {\n return { node, reason: `mask-border: ${maskBorder}` };\n }\n\n // elements with isolation set to \"isolate\".\n if (computedStyle.isolation === 'isolate')\n {\n return { node, reason: `isolation: ${computedStyle.isolation}` };\n }\n\n // transform or opacity in will-change even if you don't specify values for these attributes directly.\n if (computedStyle.willChange === 'transform' || computedStyle.willChange === 'opacity')\n {\n return { node, reason: `willChange: ${computedStyle.willChange}` };\n }\n\n // elements with -webkit-overflow-scrolling set to \"touch\".\n if (computedStyle.webkitOverflowScrolling === 'touch')\n {\n return { node, reason: '-webkit-overflow-scrolling: touch' };\n }\n\n // an item with a z-index value other than \"auto\".\n if (computedStyle.zIndex !== 'auto')\n {\n const parentStyle = globalThis.getComputedStyle(node.parentNode);\n // with a flex|inline-flex parent.\n if (parentStyle.display === 'flex' || parentStyle.display === 'inline-flex')\n {\n return { node, reason: `flex-item; z-index: ${computedStyle.zIndex}` };\n // with a grid parent.\n }\n else if (parentStyle.grid !== 'none / none / none / row / auto / auto')\n {\n return { node, reason: `child of grid container; z-index: ${computedStyle.zIndex}` };\n }\n }\n\n // contain with a value of layout, or paint, or a composite value that includes either of them\n const contain = computedStyle.contain;\n if (['layout', 'paint', 'strict', 'content'].indexOf(contain) > -1 ||\n contain.indexOf('paint') > -1 ||\n contain.indexOf('layout') > -1\n )\n {\n return { node, reason: `contain: ${contain}` };\n }\n\n return getStackingContext(node.parentNode);\n}\n\n/**\n * @typedef {object} StackingContext\n *\n * @property {Element} node - A DOM Element.\n *\n * @property {string} reason - Reason for why a stacking context was created.\n */\n\n/**\n * Provides a managed dynamic style sheet / element useful in configuring global CSS variables. When creating an\n * instance of StyleManager you must provide a \"document key\" / string for the style element added. The style element\n * can be accessed via `document[docKey]`.\n *\n * Instances of StyleManager can also be versioned by supplying a positive integer greater than or equal to `1` via the\n * 'version' option. This version number is assigned to the associated style element. When a StyleManager instance is\n * created and there is an existing instance with a version that is lower than the current instance all CSS rules are\n * removed letting the higher version to take precedence. This isn't a perfect system and requires thoughtful\n * construction of CSS variables exposed, but allows multiple independently compiled TRL packages to load the latest\n * CSS variables. It is recommended to always set `overwrite` option of {@link StyleManager.setProperty} and\n * {@link StyleManager.setProperties} to `false` when loading initial values.\n */\nclass StyleManager\n{\n /** @type {CSSStyleRule} */\n #cssRule;\n\n /** @type {string} */\n #docKey;\n\n /** @type {string} */\n #selector;\n\n /** @type {HTMLStyleElement} */\n #styleElement;\n\n /** @type {number} */\n #version;\n\n /**\n *\n * @param {object} opts - Options.\n *\n * @param {string} opts.docKey - Required key providing a link to a specific style sheet element.\n *\n * @param {string} [opts.selector=:root] - Selector element.\n *\n * @param {Document} [opts.document] - Target document to load styles into.\n *\n * @param {number} [opts.version] - An integer representing the version / level of styles being managed.\n *\n */\n constructor({ docKey, selector = ':root', document = globalThis.document, version } = {})\n {\n if (typeof docKey !== 'string') { throw new TypeError(`StyleManager error: 'docKey' is not a string.`); }\n\n // TODO: Verify 'document' type from Popout FVTT module. For some reason the popout document trips this\n // unintentionally.\n // if (!(document instanceof Document))\n // {\n // throw new TypeError(`StyleManager error: 'document' is not an instance of Document.`);\n // }\n\n if (typeof selector !== 'string') { throw new TypeError(`StyleManager error: 'selector' is not a string.`); }\n\n if (version !== void 0 && !Number.isSafeInteger(version) && version < 1)\n {\n throw new TypeError(`StyleManager error: 'version' is defined and is not a positive integer >= 1.`);\n }\n\n this.#selector = selector;\n this.#docKey = docKey;\n this.#version = version;\n\n if (document[this.#docKey] === void 0)\n {\n this.#styleElement = document.createElement('style');\n\n document.head.append(this.#styleElement);\n\n // Set initial style manager version if any supplied.\n this.#styleElement._STYLE_MANAGER_VERSION = version;\n\n this.#styleElement.sheet.insertRule(`${selector} {}`, 0);\n\n this.#cssRule = this.#styleElement.sheet.cssRules[0];\n\n document[docKey] = this.#styleElement;\n }\n else\n {\n this.#styleElement = document[docKey];\n this.#cssRule = this.#styleElement.sheet.cssRules[0];\n\n if (version)\n {\n const existingVersion = this.#styleElement._STYLE_MANAGER_VERSION ?? 0;\n\n // Remove all existing CSS rules / text if version is greater than existing version.\n if (version > existingVersion)\n {\n this.#cssRule.style.cssText = '';\n }\n }\n }\n }\n\n /**\n * @returns {string} Provides an accessor to get the `cssText` for the style sheet.\n */\n get cssText()\n {\n return this.#cssRule.style.cssText;\n }\n\n /**\n * @returns {number} Returns the version of this instance.\n */\n get version()\n {\n return this.#version;\n }\n\n /**\n * Provides a copy constructor to duplicate an existing StyleManager instance into a new document.\n *\n * Note: This is used to support the `PopOut` module.\n *\n * @param {Document} [document] Target browser document to clone into.\n *\n * @returns {StyleManager} New style manager instance.\n */\n clone(document = globalThis.document)\n {\n const newStyleManager = new StyleManager({\n selector: this.#selector,\n docKey: this.#docKey,\n document,\n version: this.#version\n });\n\n newStyleManager.#cssRule.style.cssText = this.#cssRule.style.cssText;\n\n return newStyleManager;\n }\n\n get()\n {\n const cssText = this.#cssRule.style.cssText;\n\n const result = {};\n\n if (cssText !== '')\n {\n for (const entry of cssText.split(';'))\n {\n if (entry !== '')\n {\n const values = entry.split(':');\n result[values[0].trim()] = values[1];\n }\n }\n }\n\n return result;\n }\n\n /**\n * Gets a particular CSS variable.\n *\n * @param {string} key - CSS variable property key.\n *\n * @returns {string} Returns CSS variable value.\n */\n getProperty(key)\n {\n if (typeof key !== 'string') { throw new TypeError(`StyleManager error: 'key' is not a string.`); }\n\n return this.#cssRule.style.getPropertyValue(key);\n }\n\n /**\n * Set rules by property / value; useful for CSS variables.\n *\n * @param {Object<string, string>} rules - An object with property / value string pairs to load.\n *\n * @param {boolean} [overwrite=true] - When true overwrites any existing values.\n */\n setProperties(rules, overwrite = true)\n {\n if (!isObject(rules)) { throw new TypeError(`StyleManager error: 'rules' is not an object.`); }\n\n if (typeof overwrite !== 'boolean') { throw new TypeError(`StyleManager error: 'overwrite' is not a boolean.`); }\n\n if (overwrite)\n {\n for (const [key, value] of Object.entries(rules))\n {\n this.#cssRule.style.setProperty(key, value);\n }\n }\n else\n {\n // Only set property keys for entries that don't have an existing rule set.\n for (const [key, value] of Object.entries(rules))\n {\n if (this.#cssRule.style.getPropertyValue(key) === '')\n {\n this.#cssRule.style.setProperty(key, value);\n }\n }\n }\n }\n\n /**\n * Sets a particular property.\n *\n * @param {string} key - CSS variable property key.\n *\n * @param {string} value - CSS variable value.\n *\n * @param {boolean} [overwrite=true] - Overwrite any existing value.\n */\n setProperty(key, value, overwrite = true)\n {\n if (typeof key !== 'string') { throw new TypeError(`StyleManager error: 'key' is not a string.`); }\n\n if (typeof value !== 'string') { throw new TypeError(`StyleManager error: 'value' is not a string.`); }\n\n if (typeof overwrite !== 'boolean') { throw new TypeError(`StyleManager error: 'overwrite' is not a boolean.`); }\n\n if (overwrite)\n {\n this.#cssRule.style.setProperty(key, value);\n }\n else\n {\n if (this.#cssRule.style.getPropertyValue(key) === '')\n {\n this.#cssRule.style.setProperty(key, value);\n }\n }\n }\n\n /**\n * Removes the property keys specified. If `keys` is an iterable list then all property keys in the list are removed.\n *\n * @param {Iterable<string>} keys - The property keys to remove.\n */\n removeProperties(keys)\n {\n if (!isIterable(keys)) { throw new TypeError(`StyleManager error: 'keys' is not an iterable list.`); }\n\n for (const key of keys)\n {\n if (typeof key === 'string') { this.#cssRule.style.removeProperty(key); }\n }\n }\n\n /**\n * Removes a particular CSS variable.\n *\n * @param {string} key - CSS variable property key.\n *\n * @returns {string} CSS variable value when removed.\n */\n removeProperty(key)\n {\n if (typeof key !== 'string') { throw new TypeError(`StyleManager error: 'key' is not a string.`); }\n\n return this.#cssRule.style.removeProperty(key);\n }\n}\n\nconst s_REGEX = /(\\d+)\\s*px/;\n\n/**\n * Parses a pixel string / computed styles. Ex. `100px` returns `100`.\n *\n * @param {string} value - Value to parse.\n *\n * @returns {number|undefined} The integer component of a pixel string.\n */\nfunction styleParsePixels(value)\n{\n if (typeof value !== 'string') { return void 0; }\n\n const isPixels = s_REGEX.test(value);\n const number = parseInt(value);\n\n return isPixels && Number.isFinite(number) ? number : void 0;\n}\n\n/**\n * Defines the application shell contract. If Svelte components export getter / setters for the following properties\n * then that component is considered an application shell.\n *\n * @type {string[]}\n */\nconst applicationShellContract = ['elementRoot'];\n\nObject.freeze(applicationShellContract);\n\n/**\n * Provides a method to determine if the passed in object / Svelte component follows the application shell contract.\n * This involves ensuring that the accessors defined in `applicationShellContract`.\n *\n * Note: A caveat is that when using Vite in a developer build components are wrapped in a proxy / ProxyComponent that\n * defines instance accessors versus on the prototype, so the check below ensures that all accessors in the contract are\n * either available on the prototype or directly on the instance.\n *\n * @param {*} component - Object / component to test.\n *\n * @returns {boolean} Whether the component is a ApplicationShell or TJSApplicationShell.\n */\nfunction isApplicationShell(component)\n{\n if (component === null || component === void 0) { return false; }\n\n let compHasContract = true;\n let protoHasContract = true;\n\n // Check for accessors on the instance.\n for (const accessor of applicationShellContract)\n {\n const descriptor = Object.getOwnPropertyDescriptor(component, accessor);\n if (descriptor === void 0 || descriptor.get === void 0 || descriptor.set === void 0) { compHasContract = false; }\n }\n\n // Get the prototype which is the parent SvelteComponent that has any getter / setters.\n const prototype = Object.getPrototypeOf(component);\n\n // Verify the application shell contract. If the accessors (getters / setters) are defined for\n // `applicationShellContract`.\n for (const accessor of applicationShellContract)\n {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, accessor);\n if (descriptor === void 0 || descriptor.get === void 0 || descriptor.set === void 0) { protoHasContract = false; }\n }\n\n return compHasContract || protoHasContract;\n}\n\n/**\n * Provides basic duck typing to determine if the provided object is a HMR ProxyComponent instance or class.\n *\n * @param {*} comp - Data to check as a HMR proxy component.\n *\n * @returns {boolean} Whether basic duck typing succeeds.\n */\nfunction isHMRProxy(comp)\n{\n const instanceName = comp?.constructor?.name;\n if (typeof instanceName === 'string' && (instanceName.startsWith('Proxy<') || instanceName === 'ProxyComponent'))\n {\n return true;\n }\n\n const prototypeName = comp?.prototype?.constructor?.name;\n return typeof prototypeName === 'string' && (prototypeName.startsWith('Proxy<') ||\n prototypeName === 'ProxyComponent');\n}\n\n/**\n * Provides basic duck typing to determine if the provided function is a constructor function for a Svelte component.\n *\n * @param {*} comp - Data to check as a Svelte component.\n *\n * @returns {boolean} Whether basic duck typing succeeds.\n */\nfunction isSvelteComponent(comp)\n{\n if (comp === null || comp === void 0 || typeof comp !== 'function') { return false; }\n\n // When using Vite in a developer build the SvelteComponent is wrapped in a ProxyComponent class.\n // This class doesn't define methods on the prototype, so we must check if the constructor name\n // starts with `Proxy<` as it provides the wrapped component as `Proxy<_wrapped component name_>`.\n const prototypeName = comp?.prototype?.constructor?.name;\n if (typeof prototypeName === 'string' && (prototypeName.startsWith('Proxy<') || prototypeName === 'ProxyComponent'))\n {\n return true;\n }\n\n return typeof window !== void 0 ?\n typeof comp.prototype.$destroy === 'function' && typeof comp.prototype.$on === 'function' : // client-side\n typeof comp.render === 'function'; // server-side\n}\n\n/**\n * Runs outro transition then destroys Svelte component.\n *\n * Workaround for https://github.com/sveltejs/svelte/issues/4056\n *\n * @param {*} instance - A Svelte component.\n */\nasync function outroAndDestroy(instance)\n{\n return new Promise((resolve) =>\n {\n if (instance.$$.fragment && instance.$$.fragment.o)\n {\n group_outros();\n transition_out(instance.$$.fragment, 0, 0, () =>\n {\n instance.$destroy();\n resolve();\n });\n check_outros();\n }\n else\n {\n instance.$destroy();\n resolve();\n }\n });\n}\n\n/**\n * Parses a TyphonJS Svelte config object ensuring that classes specified are Svelte components and props are set\n * correctly.\n *\n * @param {object} config - Svelte config object.\n *\n * @param {*} [thisArg] - `This` reference to set for invoking any props function.\n *\n * @returns {object} The processed Svelte config object.\n */\nfunction parseSvelteConfig(config, thisArg = void 0)\n{\n if (typeof config !== 'object')\n {\n throw new TypeError(`parseSvelteConfig - 'config' is not an object:\\n${JSON.stringify(config)}.`);\n }\n\n if (!isSvelteComponent(config.class))\n {\n throw new TypeError(\n `parseSvelteConfig - 'class' is not a Svelte component constructor for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.hydrate !== void 0 && typeof config.hydrate !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'hydrate' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.intro !== void 0 && typeof config.intro !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'intro' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.target !== void 0 && typeof config.target !== 'string' && !(config.target instanceof HTMLElement) &&\n !(config.target instanceof ShadowRoot) && !(config.target instanceof DocumentFragment))\n {\n throw new TypeError(\n `parseSvelteConfig - 'target' is not a string, HTMLElement, ShadowRoot, or DocumentFragment for config:\\n${\n JSON.stringify(config)}.`);\n }\n\n if (config.anchor !== void 0 && typeof config.anchor !== 'string' && !(config.anchor instanceof HTMLElement) &&\n !(config.anchor instanceof ShadowRoot) && !(config.anchor instanceof DocumentFragment))\n {\n throw new TypeError(\n `parseSvelteConfig - 'anchor' is not a string, HTMLElement, ShadowRoot, or DocumentFragment for config:\\n${\n JSON.stringify(config)}.`);\n }\n\n if (config.context !== void 0 && typeof config.context !== 'function' && !(config.context instanceof Map) &&\n typeof config.context !== 'object')\n {\n throw new TypeError(\n `parseSvelteConfig - 'context' is not a Map, function or object for config:\\n${JSON.stringify(config)}.`);\n }\n\n // Validate extra TyphonJS options --------------------------------------------------------------------------------\n\n // `selectorTarget` optionally stores a target element found in main element.\n if (config.selectorTarget !== void 0 && typeof config.selectorTarget !== 'string')\n {\n throw new TypeError(\n `parseSvelteConfig - 'selectorTarget' is not a string for config:\\n${JSON.stringify(config)}.`);\n }\n\n // `options` stores `injectApp`, `injectEventbus`, and `selectorElement`.\n if (config.options !== void 0 && typeof config.options !== 'object')\n {\n throw new TypeError(\n `parseSvelteConfig - 'options' is not an object for config:\\n${JSON.stringify(config)}.`);\n }\n\n // Validate TyphonJS standard options.\n if (config.options !== void 0)\n {\n if (config.options.injectApp !== void 0 && typeof config.options.injectApp !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'options.injectApp' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.options.injectEventbus !== void 0 && typeof config.options.injectEventbus !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'options.injectEventbus' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n // `selectorElement` optionally stores a main element selector to be found in a HTMLElement target.\n if (config.options.selectorElement !== void 0 && typeof config.options.selectorElement !== 'string')\n {\n throw new TypeError(\n `parseSvelteConfig - 'selectorElement' is not a string for config:\\n${JSON.stringify(config)}.`);\n }\n }\n\n const svelteConfig = { ...config };\n\n // Delete extra Svelte options.\n delete svelteConfig.options;\n\n let externalContext = {};\n\n // If a context callback function is provided then invoke it with `this` being the Foundry app.\n // If an object is returned it adds the entries to external context.\n if (typeof svelteConfig.context === 'function')\n {\n const contextFunc = svelteConfig.context;\n delete svelteConfig.context;\n\n const result = contextFunc.call(thisArg);\n if (isObject(result))\n {\n externalContext = { ...result };\n }\n else\n {\n throw new Error(`parseSvelteConfig - 'context' is a function that did not return an object for config:\\n${\n JSON.stringify(config)}`);\n }\n }\n else if (svelteConfig.context instanceof Map)\n {\n externalContext = Object.fromEntries(svelteConfig.context);\n delete svelteConfig.context;\n }\n else if (isObject(svelteConfig.context))\n {\n externalContext = svelteConfig.context;\n delete svelteConfig.context;\n }\n\n // If a props is a function then invoke it with `this` being the Foundry app.\n // If an object is returned set it as the props.\n svelteConfig.props = s_PROCESS_PROPS(svelteConfig.props, thisArg, config);\n\n // Process children components attaching to external context.\n if (Array.isArray(svelteConfig.children))\n {\n const children = [];\n\n for (let cntr = 0; cntr < svelteConfig.children.length; cntr++)\n {\n const child = svelteConfig.children[cntr];\n\n if (!isSvelteComponent(child.class))\n {\n throw new Error(`parseSvelteConfig - 'class' is not a Svelte component for child[${cntr}] for config:\\n${\n JSON.stringify(config)}`);\n }\n\n child.props = s_PROCESS_PROPS(child.props, thisArg, config);\n\n children.push(child);\n }\n\n if (children.length > 0)\n {\n externalContext.children = children;\n }\n\n delete svelteConfig.children;\n }\n else if (isObject(svelteConfig.children))\n {\n if (!isSvelteComponent(svelteConfig.children.class))\n {\n throw new Error(`parseSvelteConfig - 'class' is not a Svelte component for children object for config:\\n${\n JSON.stringify(config)}`);\n }\n\n svelteConfig.children.props = s_PROCESS_PROPS(svelteConfig.children.props, thisArg, config);\n\n externalContext.children = [svelteConfig.children];\n delete svelteConfig.children;\n }\n\n if (!(svelteConfig.context instanceof Map))\n {\n svelteConfig.context = new Map();\n }\n\n svelteConfig.context.set('#external', externalContext);\n\n return svelteConfig;\n}\n\n/**\n * Processes Svelte props. Potentially props can be a function to invoke with `thisArg`.\n *\n * @param {object|Function} props - Svelte props.\n *\n * @param {*} thisArg - `This` reference to set for invoking any props function.\n *\n * @param {object} config - Svelte config\n *\n * @returns {object|void} Svelte props.\n */\nfunction s_PROCESS_PROPS(props, thisArg, config)\n{\n // If a props is a function then invoke it with `this` being the Foundry app.\n // If an object is returned set it as the props.\n if (typeof props === 'function')\n {\n const result = props.call(thisArg);\n if (isObject(result))\n {\n return result;\n }\n else\n {\n throw new Error(`parseSvelteConfig - 'props' is a function that did not return an object for config:\\n${\n JSON.stringify(config)}`);\n }\n }\n else if (isObject(props))\n {\n return props;\n }\n else if (props !== void 0)\n {\n throw new Error(\n `parseSvelteConfig - 'props' is not a function or an object for config:\\n${JSON.stringify(config)}`);\n }\n\n return {};\n}\n\n/**\n * Wraps a callback in a debounced timeout.\n *\n * Delay execution of the callback function until the function has not been called for the given delay in milliseconds.\n *\n * @param {Function} callback - A function to execute once the debounced threshold has been passed.\n *\n * @param {number} delay - An amount of time in milliseconds to delay.\n *\n * @returns {Function} A wrapped function that can be called to debounce execution.\n */\nfunction debounce(callback, delay)\n{\n let timeoutId;\n\n return function(...args)\n {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => { callback.apply(this, args); }, delay);\n };\n}\n\n/**\n * Provides a method to determine if the passed in Svelte component has a getter accessor.\n *\n * @param {*} object - An object.\n *\n * @param {string} accessor - Accessor to test.\n *\n * @returns {boolean} Whether the component has the getter for accessor.\n */\nfunction hasGetter(object, accessor)\n{\n if (object === null || object === void 0) { return false; }\n\n // Check for instance accessor.\n const iDescriptor = Object.getOwnPropertyDescriptor(object, accessor);\n if (iDescriptor !== void 0 && iDescriptor.get !== void 0) { return true; }\n\n // Walk parent prototype chain. Check for descriptor at each prototype level.\n for (let o = Object.getPrototypeOf(object); o; o = Object.getPrototypeOf(o))\n {\n const descriptor = Object.getOwnPropertyDescriptor(o, accessor);\n if (descriptor !== void 0 && descriptor.get !== void 0) { return true; }\n }\n\n return false;\n}\n\n/**\n * Provides a method to determine if the passed in Svelte component has a getter & setter accessor.\n *\n * @param {*} object - An object.\n *\n * @param {string} accessor - Accessor to test.\n *\n * @returns {boolean} Whether the component has the getter and setter for accessor.\n */\nfunction hasAccessor(object, accessor)\n{\n if (object === null || object === void 0) { return false; }\n\n // Check for instance accessor.\n const iDescriptor = Object.getOwnPropertyDescriptor(object, accessor);\n if (iDescriptor !== void 0 && iDescriptor.get !== void 0 && iDescriptor.set !== void 0) { return true; }\n\n // Walk parent prototype chain. Check for descriptor at each prototype level.\n for (let o = Object.getPrototypeOf(object); o; o = Object.getPrototypeOf(o))\n {\n const descriptor = Object.getOwnPropertyDescriptor(o, accessor);\n if (descriptor !== void 0 && descriptor.get !== void 0 && descriptor.set !== void 0) { return true; }\n }\n\n return false;\n}\n\n/**\n * Provides a method to determine if the passed in Svelte component has a setter accessor.\n *\n * @param {*} object - An object.\n *\n * @param {string} accessor - Accessor to test.\n *\n * @returns {boolean} Whether the component has the setter for accessor.\n */\nfunction hasSetter(object, accessor)\n{\n if (object === null || object === void 0) { return false; }\n\n // Check for instance accessor.\n const iDescriptor = Object.getOwnPropertyDescriptor(object, accessor);\n if (iDescriptor !== void 0 && iDescriptor.set !== void 0) { return true; }\n\n // Walk parent prototype chain. Check for descriptor at each prototype level.\n for (let o = Object.getPrototypeOf(object); o; o = Object.getPrototypeOf(o))\n {\n const descriptor = Object.getOwnPropertyDescriptor(o, accessor);\n if (descriptor !== void 0 && descriptor.set !== void 0) { return true; }\n }\n\n return false;\n}\n\n/**\n * Returns whether the target is or has the given prototype walking up the prototype chain.\n *\n * @param {*} target - Any target to test.\n *\n * @param {Function} Prototype - Prototype function / class constructor to find.\n *\n * @returns {boolean} Target matches prototype.\n */\nfunction hasPrototype(target, Prototype)\n{\n /* c8 ignore next */\n if (typeof target !== 'function') { return false; }\n\n if (target === Prototype) { return true; }\n\n // Walk parent prototype chain. Check for descriptor at each prototype level.\n for (let proto = Object.getPrototypeOf(target); proto; proto = Object.getPrototypeOf(proto))\n {\n if (proto === Prototype) { return true; }\n }\n\n return false;\n}\n\nfunction set(obj, key, val) {\n\tif (typeof val.value === 'object') val.value = klona(val.value);\n\tif (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === '__proto__') {\n\t\tObject.defineProperty(obj, key, val);\n\t} else obj[key] = val.value;\n}\n\nfunction klona(x) {\n\tif (typeof x !== 'object') return x;\n\n\tvar i=0, k, list, tmp, str=Object.prototype.toString.call(x);\n\n\tif (str === '[object Object]') {\n\t\ttmp = Object.create(x.__proto__ || null);\n\t} else if (str === '[object Array]') {\n\t\ttmp = Array(x.length);\n\t} else if (str === '[object Set]') {\n\t\ttmp = new Set;\n\t\tx.forEach(function (val) {\n\t\t\ttmp.add(klona(val));\n\t\t});\n\t} else if (str === '[object Map]') {\n\t\ttmp = new Map;\n\t\tx.forEach(function (val, key) {\n\t\t\ttmp.set(klona(key), klona(val));\n\t\t});\n\t} else if (str === '[object Date]') {\n\t\ttmp = new Date(+x);\n\t} else if (str === '[object RegExp]') {\n\t\ttmp = new RegExp(x.source, x.flags);\n\t} else if (str === '[object DataView]') {\n\t\ttmp = new x.constructor( klona(x.buffer) );\n\t} else if (str === '[object ArrayBuffer]') {\n\t\ttmp = x.slice(0);\n\t} else if (str.slice(-6) === 'Array]') {\n\t\t// ArrayBuffer.isView(x)\n\t\t// ~> `new` bcuz `Buffer.slice` => ref\n\t\ttmp = new x.constructor(x);\n\t}\n\n\tif (tmp) {\n\t\tfor (list=Object.getOwnPropertySymbols(x); i < list.length; i++) {\n\t\t\tset(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));\n\t\t}\n\n\t\tfor (i=0, list=Object.getOwnPropertyNames(x); i < list.length; i++) {\n\t\t\tif (Object.hasOwnProperty.call(tmp, k=list[i]) && tmp[k] === x[k]) continue;\n\t\t\tset(tmp, k, Object.getOwnPropertyDescriptor(x, k));\n\t\t}\n\t}\n\n\treturn tmp || x;\n}\n\nfunction isSpace(character) {\n return character == \" \" || character == \"\\n\" || character == \"\\r\" || character == \"\\t\";\n}\nfunction isQuote(character) {\n return character == '\"' || character == \"'\";\n}\nconst TAG_START = \"<\";\nconst TAG_END = \">\";\nconst ENCODED_TAG_START = \"<\";\nconst ENCODED_TAG_END = \">\";\nclass InPlaintextState {\n constructor(options) {\n this.options = options;\n }\n consume(character, transition) {\n if (character == TAG_START) {\n transition(new InTagNameState(this.options));\n return \"\";\n }\n else if (character == TAG_END && this.options.encodePlaintextTagDelimiters) {\n return ENCODED_TAG_END;\n }\n return character;\n }\n}\nclass InTagNameState {\n constructor(options) {\n this.options = options;\n this.nameBuffer = \"\";\n this.isClosingTag = false;\n }\n consume(character, transition) {\n if (this.nameBuffer.length == 0) {\n if (isSpace(character)) {\n transition(new InPlaintextState(this.options));\n return ((this.options.encodePlaintextTagDelimiters ? ENCODED_TAG_START : \"<\") +\n character);\n }\n if (character == \"/\") {\n this.isClosingTag = true;\n return \"\";\n }\n }\n if (isSpace(character)) {\n if (this.isNameBufferAnAllowedTag()) {\n transition(new InTagState(0 /* TagMode.Allowed */, this.options));\n return TAG_START + (this.isClosingTag ? \"/\" : \"\") + this.nameBuffer + character;\n }\n else {\n transition(new InTagState(1 /* TagMode.Disallowed */, this.options));\n return this.options.tagReplacementText;\n }\n }\n if (character == TAG_START) {\n this.nameBuffer += ENCODED_TAG_START;\n return \"\";\n }\n if (character == TAG_END) {\n transition(new InPlaintextState(this.options));\n if (this.isNameBufferAnAllowedTag()) {\n return TAG_START + (this.isClosingTag ? \"/\" : \"\") + this.nameBuffer + character;\n }\n else {\n return this.options.tagReplacementText;\n }\n }\n if (character == \"-\" && this.nameBuffer == \"!-\") {\n transition(new InCommentState(this.options));\n return \"\";\n }\n this.nameBuffer += character;\n return \"\";\n }\n isNameBufferAnAllowedTag() {\n const tagName = this.nameBuffer.toLowerCase();\n if (this.options.allowedTags) {\n return this.options.allowedTags.has(tagName);\n }\n else if (this.options.disallowedTags) {\n return !this.options.disallowedTags.has(tagName);\n }\n else {\n return false;\n }\n }\n}\nclass InTagState {\n constructor(mode, options) {\n this.mode = mode;\n this.options = options;\n }\n consume(character, transition) {\n if (character == TAG_END) {\n transition(new InPlaintextState(this.options));\n }\n else if (isQuote(character)) {\n transition(new InQuotedStringInTagState(this.mode, character, this.options));\n }\n if (this.mode == 1 /* TagMode.Disallowed */) {\n return \"\";\n }\n if (character == TAG_START) {\n return ENCODED_TAG_START;\n }\n else {\n return character;\n }\n }\n}\nclass InQuotedStringInTagState {\n constructor(mode, quoteCharacter, options) {\n this.mode = mode;\n this.quoteCharacter = quoteCharacter;\n this.options = options;\n }\n consume(character, transition) {\n if (character == this.quoteCharacter) {\n transition(new InTagState(this.mode, this.options));\n }\n if (this.mode == 1 /* TagMode.Disallowed */) {\n return \"\";\n }\n if (character == TAG_START) {\n return ENCODED_TAG_START;\n }\n else if (character == TAG_END) {\n return ENCODED_TAG_END;\n }\n else {\n return character;\n }\n }\n}\nclass InCommentState {\n constructor(options) {\n this.options = options;\n this.consecutiveHyphens = 0;\n }\n consume(character, transition) {\n if (character == \">\" && this.consecutiveHyphens >= 2) {\n transition(new InPlaintextState(this.options));\n }\n else if (character == \"-\") {\n this.consecutiveHyphens++;\n }\n else {\n this.consecutiveHyphens = 0;\n }\n return \"\";\n }\n}\n\nconst DefaultStateMachineOptions = {\n tagReplacementText: \"\",\n encodePlaintextTagDelimiters: true,\n};\nclass StateMachine {\n constructor(partialOptions = {}) {\n this.state = new InPlaintextState(Object.assign(Object.assign({}, DefaultStateMachineOptions), partialOptions));\n this.transitionFunction = ((next) => {\n this.state = next;\n }).bind(this);\n }\n consume(text) {\n let outputBuffer = \"\";\n for (const character of text) {\n outputBuffer += this.state.consume(character, this.transitionFunction);\n }\n return outputBuffer;\n }\n}\nfunction striptags(text, options = {}) {\n return new StateMachine(options).consume(text);\n}\n\n/**\n * Attempts to create a Foundry UUID from standard drop data. This may not work for all systems.\n *\n * @param {object} data - Drop transfer data.\n *\n * @param {ParseDataTransferOptions} opts - Optional parameters.\n *\n * @returns {string|undefined} Foundry UUID for drop data.\n */\nfunction getUUIDFromDataTransfer(data, { actor = true, compendium = true, world = true, types = void 0 } = {})\n{\n if (typeof data !== 'object') { return void 0; }\n if (Array.isArray(types) && !types.includes(data.type)) { return void 0; }\n\n let uuid = void 0;\n\n if (typeof data.uuid === 'string') // v10 and above provides a full UUID.\n {\n const isCompendium = data.uuid.startsWith('Compendium');\n\n if (isCompendium && compendium)\n {\n uuid = data.uuid;\n }\n else if (world)\n {\n uuid = data.uuid;\n }\n }\n else // v9 and below parsing.\n {\n if (actor && world && data.actorId && data.type)\n {\n uuid = `Actor.${data.actorId}.${data.type}.${data.data._id}`;\n }\n else if (typeof data.id === 'string') // v9 and below uses `id`\n {\n if (compendium && typeof data.pack === 'string')\n {\n uuid = `Compendium.${data.pack}.${data.id}`;\n }\n else if (world)\n {\n uuid = `${data.type}.${data.id}`;\n }\n }\n }\n\n return uuid;\n}\n\nexport { A11yHelper, ClipboardAccess, ManagedPromise, StyleManager, debounce, deepMerge, getStackingContext, getUUIDFromDataTransfer, hasAccessor, hasGetter, hasPrototype, hasSetter, hashCode, isApplicationShell, isHMRProxy, isIterable, isIterableAsync, isObject, isPlainObject, isSvelteComponent, klona, normalizeString, outroAndDestroy, parseSvelteConfig, safeAccess, safeSet, striptags, styleParsePixels, uuidv4 };\n//# sourceMappingURL=index.js.map\n","import { noop, safe_not_equal, subscribe, run_all, is_function } from '../internal/index.mjs';\nexport { get_store_value as get } from '../internal/index.mjs';\n\nconst subscriber_queue = [];\n/**\n * Creates a `Readable` store that allows reading by subscription.\n * @param value initial value\n * @param {StartStopNotifier}start start and stop notifications for subscriptions\n */\nfunction readable(value, start) {\n return {\n subscribe: writable(value, start).subscribe\n };\n}\n/**\n * Create a `Writable` store that allows both updating and reading by subscription.\n * @param {*=}value initial value\n * @param {StartStopNotifier=}start start and stop notifications for subscriptions\n */\nfunction writable(value, start = noop) {\n let stop;\n const subscribers = new Set();\n function set(new_value) {\n if (safe_not_equal(value, new_value)) {\n value = new_value;\n if (stop) { // store is ready\n const run_queue = !subscriber_queue.length;\n for (const subscriber of subscribers) {\n subscriber[1]();\n subscriber_queue.push(subscriber, value);\n }\n if (run_queue) {\n for (let i = 0; i < subscriber_queue.length; i += 2) {\n subscriber_queue[i][0](subscriber_queue[i + 1]);\n }\n subscriber_queue.length = 0;\n }\n }\n }\n }\n function update(fn) {\n set(fn(value));\n }\n function subscribe(run, invalidate = noop) {\n const subscriber = [run, invalidate];\n subscribers.add(subscriber);\n if (subscribers.size === 1) {\n stop = start(set) || noop;\n }\n run(value);\n return () => {\n subscribers.delete(subscriber);\n if (subscribers.size === 0 && stop) {\n stop();\n stop = null;\n }\n };\n }\n return { set, update, subscribe };\n}\nfunction derived(stores, fn, initial_value) {\n const single = !Array.isArray(stores);\n const stores_array = single\n ? [stores]\n : stores;\n const auto = fn.length < 2;\n return readable(initial_value, (set) => {\n let started = false;\n const values = [];\n let pending = 0;\n let cleanup = noop;\n const sync = () => {\n if (pending) {\n return;\n }\n cleanup();\n const result = fn(single ? values[0] : values, set);\n if (auto) {\n set(result);\n }\n else {\n cleanup = is_function(result) ? result : noop;\n }\n };\n const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => {\n values[i] = value;\n pending &= ~(1 << i);\n if (started) {\n sync();\n }\n }, () => {\n pending |= (1 << i);\n }));\n started = true;\n sync();\n return function stop() {\n run_all(unsubscribers);\n cleanup();\n // We need to set this to false because callbacks can still happen despite having unsubscribed:\n // Callbacks might already be placed in the queue which doesn't know it should no longer\n // invoke this derived store.\n started = false;\n };\n });\n}\n/**\n * Takes a store and returns a new one derived from the old one that is readable.\n *\n * @param store - store to make readonly\n */\nfunction readonly(store) {\n return {\n subscribe: store.subscribe.bind(store)\n };\n}\n\nexport { derived, readable, readonly, writable };\n","import { isIterable, uuidv4, isPlainObject, getUUIDFromDataTransfer, isObject, hasPrototype } from '@typhonjs-fvtt/runtime/svelte/util';\r\nimport { writable as writable$2, derived, get } from 'svelte/store';\r\nimport { noop, run_all, is_function } from 'svelte/internal';\r\n\r\nclass DynReducerUtils {\r\n /**\r\n * Checks for array equality between two arrays of numbers.\r\n *\r\n * @param a - Array A\r\n *\r\n * @param b - Array B\r\n *\r\n * @returns Arrays are equal.\r\n */\r\n static arrayEquals(a, b) {\r\n if (a === b) {\r\n return true;\r\n }\r\n if (a === null || b === null) {\r\n return false;\r\n }\r\n /* c8 ignore next */\r\n if (a.length !== b.length) {\r\n return false;\r\n }\r\n for (let cntr = a.length; --cntr >= 0;) {\r\n /* c8 ignore next */\r\n if (a[cntr] !== b[cntr]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Provides a solid string hashing algorithm.\r\n *\r\n * Sourced from: https://stackoverflow.com/a/52171480\r\n *\r\n * @param str - String to hash.\r\n *\r\n * @param seed - A seed value altering the hash.\r\n *\r\n * @returns Hash code.\r\n */\r\n static hashString(str, seed = 0) {\r\n let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\r\n for (let ch, i = 0; i < str.length; i++) {\r\n ch = str.charCodeAt(i);\r\n h1 = Math.imul(h1 ^ ch, 2654435761);\r\n h2 = Math.imul(h2 ^ ch, 1597334677);\r\n }\r\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\r\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\r\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\r\n }\r\n /**\r\n * Converts an unknown value for hashing purposes in {@link AdapterIndexer.calcHashUpdate}.\r\n *\r\n * Currently objects / Map w/ object keys is not supported. Potentially can include `object-hash` to handle this\r\n * case, but it is not common to use objects as keys in Maps.\r\n *\r\n * @param value - An unknown value to convert to a number.\r\n */\r\n static hashUnknown(value) {\r\n if (value === null || value === void 0) {\r\n return 0;\r\n }\r\n let result = 0;\r\n switch (typeof value) {\r\n case 'boolean':\r\n result = value ? 1 : 0;\r\n break;\r\n case 'bigint':\r\n result = Number(BigInt.asIntN(64, value));\r\n break;\r\n case 'function':\r\n result = this.hashString(value.name);\r\n break;\r\n case 'number':\r\n result = Number.isFinite(value) ? value : 0;\r\n break;\r\n case 'object':\r\n // TODO: consider hashing an object IE `object-hash` and convert to number.\r\n break;\r\n case 'string':\r\n result = this.hashString(value);\r\n break;\r\n case 'symbol':\r\n result = this.hashString(Symbol.keyFor(value));\r\n break;\r\n }\r\n return result;\r\n }\r\n /**\r\n * @param target -\r\n *\r\n * @param Prototype -\r\n *\r\n * @returns target constructor function has Prototype.\r\n */\r\n static hasPrototype(target, Prototype) {\r\n /* c8 ignore next */\r\n if (typeof target !== 'function') {\r\n return false;\r\n }\r\n if (target === Prototype) {\r\n return true;\r\n }\r\n // Walk parent prototype chain. Check for descriptor at each prototype level.\r\n for (let proto = Object.getPrototypeOf(target); proto; proto = Object.getPrototypeOf(proto)) {\r\n if (proto === Prototype) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Provides a utility method to determine if the given data is iterable / implements iterator protocol.\r\n *\r\n * @param data - Data to verify as iterable.\r\n *\r\n * @returns Is data iterable.\r\n */\r\n static isIterable(data) {\r\n return data !== null && data !== void 0 && typeof data === 'object' &&\r\n typeof data[Symbol.iterator] === 'function';\r\n }\r\n}\r\n\r\n/**\r\n * Provides the `derived` API for all dynamic reducers.\r\n */\r\nclass AdapterDerived {\r\n #hostData;\r\n #DerivedReducerCtor;\r\n #parentIndex;\r\n #derived = new Map();\r\n #destroyed = false;\r\n /**\r\n * @param hostData - Hosted data structure.\r\n *\r\n * @param parentIndex - Any associated parent index API.\r\n *\r\n * @param DerivedReducerCtor - The default derived reducer constructor function.\r\n */\r\n constructor(hostData, parentIndex, DerivedReducerCtor) {\r\n this.#hostData = hostData;\r\n this.#parentIndex = parentIndex;\r\n this.#DerivedReducerCtor = DerivedReducerCtor;\r\n Object.freeze(this);\r\n }\r\n /**\r\n * Creates a new derived reducer.\r\n *\r\n * @param options - Options defining the new derived reducer.\r\n *\r\n * @returns Newly created derived reducer.\r\n */\r\n create(options) {\r\n if (this.#destroyed) {\r\n throw Error(`AdapterDerived.create error: this instance has been destroyed.`);\r\n }\r\n let name;\r\n let rest = {};\r\n let ctor;\r\n const DerivedReducerCtor = this.#DerivedReducerCtor;\r\n if (typeof options === 'string') {\r\n name = options;\r\n ctor = DerivedReducerCtor;\r\n }\r\n else if (typeof options === 'function' && DynReducerUtils.hasPrototype(options, DerivedReducerCtor)) {\r\n ctor = options;\r\n }\r\n else if (typeof options === 'object' && options !== null) {\r\n ({ name, ctor = DerivedReducerCtor, ...rest } = options);\r\n }\r\n else {\r\n throw new TypeError(`AdapterDerived.create error: 'options' does not conform to allowed parameters.`);\r\n }\r\n if (!DynReducerUtils.hasPrototype(ctor, DerivedReducerCtor)) {\r\n throw new TypeError(`AdapterDerived.create error: 'ctor' is not a '${DerivedReducerCtor?.name}'.`);\r\n }\r\n name = name ?? ctor?.name;\r\n if (typeof name !== 'string') {\r\n throw new TypeError(`AdapterDerived.create error: 'name' is not a string.`);\r\n }\r\n const derivedReducer = new ctor(this.#hostData, this.#parentIndex, rest);\r\n this.#derived.set(name, derivedReducer);\r\n return derivedReducer;\r\n }\r\n /**\r\n * Removes all derived reducers and associated subscriptions.\r\n */\r\n clear() {\r\n if (this.#destroyed) {\r\n return;\r\n }\r\n for (const reducer of this.#derived.values()) {\r\n reducer.destroy();\r\n }\r\n this.#derived.clear();\r\n }\r\n /**\r\n * Deletes and destroys a derived reducer by name.\r\n *\r\n * @param name - Name of the derived reducer.\r\n */\r\n delete(name) {\r\n if (this.#destroyed) {\r\n throw Error(`AdapterDerived.delete error: this instance has been destroyed.`);\r\n }\r\n const reducer = this.#derived.get(name);\r\n if (reducer) {\r\n reducer.destroy();\r\n }\r\n return this.#derived.delete(name);\r\n }\r\n /**\r\n * Removes all derived reducers, subscriptions, and cleans up all resources.\r\n */\r\n destroy() {\r\n if (this.#destroyed) {\r\n return;\r\n }\r\n this.clear();\r\n this.#hostData = [null];\r\n this.#parentIndex = null;\r\n this.#destroyed = true;\r\n }\r\n /**\r\n * Returns an existing derived reducer.\r\n *\r\n * @param name - Name of derived reducer.\r\n */\r\n get(name) {\r\n if (this.#destroyed) {\r\n throw Error(`AdapterDerived.get error: this instance has been destroyed.`);\r\n }\r\n return this.#derived.get(name);\r\n }\r\n /**\r\n * Updates all managed derived reducer indexes.\r\n *\r\n * @param [force] - Force an update to subscribers.\r\n */\r\n update(force = false) {\r\n if (this.#destroyed) {\r\n return;\r\n }\r\n for (const reducer of this.#derived.values()) {\r\n reducer.index.update(force);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Provides the storage and sequencing of managed filters. Each filter added may be a bespoke function or a\r\n * {@link DataFilter} object containing an `id`, `filter`, and `weight` attributes; `filter` is the only required\r\n * attribute.\r\n *\r\n * The `id` attribute can be anything that creates a unique ID for the filter; recommended strings or numbers. This\r\n * allows filters to be removed by ID easily.\r\n *\r\n * The `weight` attribute is a number between 0 and 1 inclusive that allows filters to be added in a\r\n * predictable order which is especially handy if they are manipulated at runtime. A lower weighted filter always runs\r\n * before a higher weighted filter. For speed and efficiency always set the heavier / more inclusive filter with a\r\n * lower weight; an example of this is a keyword / name that will filter out many entries making any further filtering\r\n * faster. If no weight is specified the default of '1' is assigned and it is appended to the end of the filters list.\r\n *\r\n * This class forms the public API which is accessible from the `.filters` getter in the main reducer implementation.\r\n * ```\r\n * const dynArray = new DynArrayReducer([...]);\r\n * dynArray.filters.add(...);\r\n * dynArray.filters.clear();\r\n * dynArray.filters.length;\r\n * dynArray.filters.remove(...);\r\n * dynArray.filters.removeBy(...);\r\n * dynArray.filters.removeById(...);\r\n * ```\r\n */\r\nclass AdapterFilters {\r\n #filtersData;\r\n #indexUpdate;\r\n #mapUnsubscribe = new Map();\r\n /**\r\n * @param indexUpdate - update function for the indexer.\r\n *\r\n * @param filtersAdapter - Stores the filter function data.\r\n */\r\n constructor(indexUpdate, filtersAdapter) {\r\n this.#indexUpdate = indexUpdate;\r\n this.#filtersData = filtersAdapter;\r\n Object.freeze(this);\r\n }\r\n /**\r\n * @returns Returns the length of the filter data.\r\n */\r\n get length() { return this.#filtersData.filters.length; }\r\n /**\r\n * Provides an iterator for filters.\r\n *\r\n * @returns Generator / iterator of filters.\r\n * @yields {DataFilter<T>}\r\n */\r\n *[Symbol.iterator]() {\r\n if (this.#filtersData.filters.length === 0) {\r\n return;\r\n }\r\n for (const entry of this.#filtersData.filters) {\r\n yield { ...entry };\r\n }\r\n }\r\n /**\r\n * @param filters -\r\n */\r\n add(...filters) {\r\n /**\r\n * Tracks the number of filters added that have subscriber functionality.\r\n */\r\n let subscribeCount = 0;\r\n for (const filter of filters) {\r\n const filterType = typeof filter;\r\n if (filterType !== 'function' && (filterType !== 'object' || filter === null)) {\r\n throw new TypeError(`AdapterFilters error: 'filter' is not a function or object.`);\r\n }\r\n let data = void 0;\r\n let subscribeFn = void 0;\r\n if (filterType === 'function') {\r\n data = {\r\n id: void 0,\r\n filter,\r\n weight: 1\r\n };\r\n subscribeFn = filter.subscribe;\r\n }\r\n else if (filterType === 'object') {\r\n if ('filter' in filter) {\r\n if (typeof filter.filter !== 'function') {\r\n throw new TypeError(`AdapterFilters error: 'filter' attribute is not a function.`);\r\n }\r\n if (filter.weight !== void 0 && typeof filter.weight !== 'number' ||\r\n (filter.weight < 0 || filter.weight > 1)) {\r\n throw new TypeError(`AdapterFilters error: 'weight' attribute is not a number between '0 - 1' inclusive.`);\r\n }\r\n data = {\r\n id: filter.id !== void 0 ? filter.id : void 0,\r\n filter: filter.filter,\r\n weight: filter.weight || 1\r\n };\r\n subscribeFn = filter.filter.subscribe ?? filter.subscribe;\r\n }\r\n else {\r\n throw new TypeError(`AdapterFilters error: 'filter' attribute is not a function.`);\r\n }\r\n }\r\n // Find the index to insert where data.weight is less than existing values weight.\r\n const index = this.#filtersData.filters.findIndex((value) => {\r\n return data.weight < value.weight;\r\n });\r\n // If an index was found insert at that location.\r\n if (index >= 0) {\r\n this.#filtersData.filters.splice(index, 0, data);\r\n }\r\n else // push to end of filters.\r\n {\r\n this.#filtersData.filters.push(data);\r\n }\r\n if (typeof subscribeFn === 'function') {\r\n const unsubscribe = subscribeFn(this.#indexUpdate);\r\n // Ensure that unsubscribe is a function.\r\n if (typeof unsubscribe !== 'function') {\r\n throw new TypeError('AdapterFilters error: Filter has subscribe function, but no unsubscribe function is returned.');\r\n }\r\n // Ensure that the same filter is not subscribed to multiple times.\r\n if (this.#mapUnsubscribe.has(data.filter)) {\r\n throw new Error('AdapterFilters error: Filter added already has an unsubscribe function registered.');\r\n }\r\n this.#mapUnsubscribe.set(data.filter, unsubscribe);\r\n subscribeCount++;\r\n }\r\n }\r\n // Filters with subscriber functionality are assumed to immediately invoke the `subscribe` callback. If the\r\n // subscriber count is less than the amount of filters added then automatically trigger an index update manually.\r\n if (subscribeCount < filters.length) {\r\n this.#indexUpdate();\r\n }\r\n }\r\n /**\r\n * Clears and removes all filters.\r\n */\r\n clear() {\r\n this.#filtersData.filters.length = 0;\r\n // Unsubscribe from all filters with subscription support.\r\n for (const unsubscribe of this.#mapUnsubscribe.values()) {\r\n unsubscribe();\r\n }\r\n this.#mapUnsubscribe.clear();\r\n this.#indexUpdate();\r\n }\r\n /**\r\n * @param filters -\r\n */\r\n remove(...filters) {\r\n const length = this.#filtersData.filters.length;\r\n if (length === 0) {\r\n return;\r\n }\r\n for (const data of filters) {\r\n // Handle the case that the filter may either be a function or a filter entry / object.\r\n const actualFilter = typeof data === 'function' ? data : data !== null && typeof data === 'object' ?\r\n data.filter : void 0;\r\n if (!actualFilter) {\r\n continue;\r\n }\r\n for (let cntr = this.#filtersData.filters.length; --cntr >= 0;) {\r\n if (this.#filtersData.filters[cntr].filter === actualFilter) {\r\n this.#filtersData.filters.splice(cntr, 1);\r\n // Invoke any unsubscribe function for given filter then remove from tracking.\r\n let unsubscribe = void 0;\r\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(actualFilter)) === 'function') {\r\n unsubscribe();\r\n this.#mapUnsubscribe.delete(actualFilter);\r\n }\r\n }\r\n }\r\n }\r\n // Update the index a filter was removed.\r\n if (length !== this.#filtersData.filters.length) {\r\n this.#indexUpdate();\r\n }\r\n }\r\n /**\r\n * Remove filters by the provided callback. The callback takes 3 parameters: `id`, `filter`, and `weight`.\r\n * Any truthy value returned will remove that filter.\r\n *\r\n * @param callback - Callback function to evaluate each filter entry.\r\n */\r\n removeBy(callback) {\r\n const length = this.#filtersData.filters.length;\r\n if (length === 0) {\r\n return;\r\n }\r\n if (typeof callback !== 'function') {\r\n throw new TypeError(`AdapterFilters error: 'callback' is not a function.`);\r\n }\r\n this.#filtersData.filters = this.#filtersData.filters.filter((data) => {\r\n const remove = callback.call(callback, { ...data });\r\n if (remove) {\r\n let unsubscribe;\r\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.filter)) === 'function') {\r\n unsubscribe();\r\n this.#mapUnsubscribe.delete(data.filter);\r\n }\r\n }\r\n // Reverse remove boolean to properly filter / remove this filter.\r\n return !remove;\r\n });\r\n if (length !== this.#filtersData.filters.length) {\r\n this.#indexUpdate();\r\n }\r\n }\r\n /**\r\n * @param ids - Removes filters by ID.\r\n */\r\n removeById(...ids) {\r\n const length = this.#filtersData.filters.length;\r\n if (length === 0) {\r\n return;\r\n }\r\n this.#filtersData.filters = this.#filtersData.filters.filter((data) => {\r\n let remove = 0;\r\n for (const id of ids) {\r\n remove |= (data.id === id ? 1 : 0);\r\n }\r\n // If not keeping invoke any unsubscribe function for given filter then remove from tracking.\r\n if (!!remove) {\r\n let unsubscribe;\r\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.filter)) === 'function') {\r\n unsubscribe();\r\n this.#mapUnsubscribe.delete(data.filter);\r\n }\r\n }\r\n return !remove; // Swap here to actually remove the item via array filter method.\r\n });\r\n if (length !== this.#filtersData.filters.length) {\r\n this.#indexUpdate();\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Provides construction and management of indexed data when there are parent indexes or filter / sort functions\r\n * applied.\r\n */\r\nclass AdapterIndexer {\r\n derivedAdapter;\r\n filtersData;\r\n hostData;\r\n hostUpdate;\r\n indexData;\r\n sortData;\r\n sortFn;\r\n destroyed = false;\r\n /**\r\n * @param hostData - Hosted data structure.\r\n *\r\n * @param hostUpdate - Host update function invoked on index updates.\r\n *\r\n * @param [parentIndexer] - Any associated parent index API.\r\n *\r\n * @returns Indexer adapter instance.\r\n */\r\n constructor(hostData, hostUpdate, parentIndexer) {\r\n this.hostData = hostData;\r\n this.hostUpdate = hostUpdate;\r\n this.indexData = { index: null, hash: null, reversed: false, parent: parentIndexer };\r\n }\r\n /**\r\n * @returns Returns whether the index is active.\r\n */\r\n get active() {\r\n return this.filtersData.filters.length > 0 || this.sortData.compareFn !== null ||\r\n this.indexData.parent?.active === true;\r\n }\r\n /**\r\n * @returns Returns length of reduced index.\r\n */\r\n get length() {\r\n return this.indexData.index ? this.indexData.index.length : 0;\r\n }\r\n /* c8 ignore start */\r\n /**\r\n * @returns Returns reversed state.\r\n */\r\n get reversed() { return this.indexData.reversed; }\r\n /* c8 ignore end */\r\n /**\r\n * @param reversed - New reversed state.\r\n */\r\n set reversed(reversed) { this.indexData.reversed = reversed; }\r\n // -------------------------------------------------------------------------------------------------------------------\r\n /**\r\n * Calculates a new hash value for the new index array if any. If the new index array is null then the hash value\r\n * is set to null. Set calculated new hash value to the index adapter hash value.\r\n *\r\n * After hash generation compare old and new hash values and perform an update if they are different. If they are\r\n * equal check for array equality between the old and new index array and perform an update if they are not equal.\r\n *\r\n * @param oldIndex - Old index array.\r\n *\r\n * @param oldHash - Old index hash value.\r\n *\r\n * @param [force=false] - When true forces an update to subscribers.\r\n */\r\n calcHashUpdate(oldIndex, oldHash, force = false) {\r\n // Use force if a boolean otherwise default to false.\r\n const actualForce = typeof force === 'boolean' ? force : /* c8 ignore next */ false;\r\n let newHash = null;\r\n const newIndex = this.indexData.index;\r\n if (newIndex) {\r\n for (let cntr = newIndex.length; --cntr >= 0;) {\r\n newHash ^= DynReducerUtils.hashUnknown(newIndex[cntr]) + 0x9e3779b9 + (newHash << 6) + (newHash >> 2);\r\n }\r\n }\r\n this.indexData.hash = newHash;\r\n if (actualForce || (oldHash === newHash ? !DynReducerUtils.arrayEquals(oldIndex, newIndex) : true)) {\r\n this.hostUpdate();\r\n }\r\n }\r\n /**\r\n * Destroys all resources.\r\n */\r\n destroy() {\r\n if (this.destroyed) {\r\n return;\r\n }\r\n this.indexData.index = null;\r\n this.indexData.hash = null;\r\n this.indexData.reversed = null;\r\n this.indexData.parent = null;\r\n this.destroyed = true;\r\n }\r\n /**\r\n * Store associated filter and sort data that are constructed after the indexer.\r\n *\r\n * @param filtersData - Associated AdapterFilters instance.\r\n *\r\n * @param sortData - Associated AdapterSort instance.\r\n *\r\n * @param derivedAdapter - Associated AdapterDerived instance.\r\n */\r\n initAdapters(filtersData, sortData, derivedAdapter) {\r\n this.filtersData = filtersData;\r\n this.sortData = sortData;\r\n this.derivedAdapter = derivedAdapter;\r\n this.sortFn = this.createSortFn();\r\n }\r\n}\r\n\r\n/**\r\n * Provides the storage and sequencing of a managed sort function. The sort function set may be a bespoke function or a\r\n * {@link DataSort} object containing an `compare`, and `subscribe` attributes; `compare` is the only required\r\n * attribute.\r\n *\r\n * Note: You can set a compare function that also has a subscribe function attached as the `subscribe` attribute.\r\n * If a subscribe function is provided the sort function can notify any updates that may change sort order and this\r\n * triggers an index update.\r\n *\r\n * This class forms the public API which is accessible from the `.sort` getter in the main reducer implementation.\r\n * ```\r\n * const dynArray = new DynArrayReducer([...]);\r\n * dynArray.sort.clear();\r\n * dynArray.sort.set(...);\r\n * ```\r\n */\r\nclass AdapterSort {\r\n #sortData;\r\n #indexUpdate;\r\n #unsubscribe;\r\n /**\r\n * @param indexUpdate - Function to update indexer.\r\n *\r\n * @param sortData - Storage for compare function.\r\n */\r\n constructor(indexUpdate, sortData) {\r\n this.#indexUpdate = indexUpdate;\r\n this.#sortData = sortData;\r\n Object.freeze(this);\r\n }\r\n /**\r\n * Clears & removes any assigned sort function and triggers an index update.\r\n */\r\n clear() {\r\n const oldCompareFn = this.#sortData.compareFn;\r\n this.#sortData.compareFn = null;\r\n if (typeof this.#unsubscribe === 'function') {\r\n this.#unsubscribe();\r\n this.#unsubscribe = void 0;\r\n }\r\n // Only update index if an old compare function is set.\r\n if (typeof oldCompareFn === 'function') {\r\n this.#indexUpdate();\r\n }\r\n }\r\n /**\r\n * @param data - A callback function that compares two values. Return > 0 to sort b before a;\r\n * < 0 to sort a before b; or 0 to keep original order of a & b.\r\n *\r\n * Note: You can set a compare function that also has a subscribe function attached as the `subscribe` attribute.\r\n *\r\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#parameters\r\n */\r\n set(data) {\r\n if (typeof this.#unsubscribe === 'function') {\r\n this.#unsubscribe();\r\n this.#unsubscribe = void 0;\r\n }\r\n let compareFn = void 0;\r\n let subscribeFn = void 0;\r\n switch (typeof data) {\r\n case 'function':\r\n compareFn = data;\r\n subscribeFn = data.subscribe;\r\n break;\r\n case 'object':\r\n // Early out if data is null / noop.\r\n if (data === null) {\r\n break;\r\n }\r\n if (typeof data.compare !== 'function') {\r\n throw new TypeError(`AdapterSort error: 'compare' attribute is not a function.`);\r\n }\r\n compareFn = data.compare;\r\n subscribeFn = data.compare.subscribe ?? data.subscribe;\r\n break;\r\n }\r\n if (typeof compareFn === 'function') {\r\n this.#sortData.compareFn = compareFn;\r\n }\r\n else {\r\n const oldCompareFn = this.#sortData.compareFn;\r\n this.#sortData.compareFn = null;\r\n // Update index if the old compare function exists.\r\n if (typeof oldCompareFn === 'function') {\r\n this.#indexUpdate();\r\n }\r\n return;\r\n }\r\n if (typeof subscribeFn === 'function') {\r\n this.#unsubscribe = subscribeFn(this.#indexUpdate);\r\n // Ensure that unsubscribe is a function.\r\n if (typeof this.#unsubscribe !== 'function') {\r\n throw new Error(`AdapterSort error: sort has 'subscribe' function, but no 'unsubscribe' function is returned.`);\r\n }\r\n }\r\n else {\r\n // A sort function with subscriber functionality are assumed to immediately invoke the `subscribe` callback.\r\n // Only manually update the index if there is no subscriber functionality.\r\n this.#indexUpdate();\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Provides the public API for accessing the index API.\r\n *\r\n * This class forms the public API which is accessible from the `.index` getter in the main reducer implementation.\r\n * ```\r\n * const dynArray = new DynArrayReducer([...]);\r\n * dynArray.index.active;\r\n * dynArray.index.hash;\r\n * dynArray.index.length;\r\n * dynArray.index.update(...);\r\n * ```\r\n */\r\nclass IndexerAPI {\r\n #indexData;\r\n /**\r\n * Provides a getter to determine if the index is active.\r\n */\r\n active;\r\n /**\r\n * Provides length of reduced / indexed elements.\r\n */\r\n length;\r\n /**\r\n * Manually invoke an update of the index.\r\n *\r\n * @param force - Force update to any subscribers.\r\n */\r\n update;\r\n constructor(adapterIndexer) {\r\n this.#indexData = adapterIndexer.indexData;\r\n this.update = adapterIndexer.update.bind(adapterIndexer);\r\n // Defines getters on the public API to get the index hash, active state, and index length.\r\n Object.defineProperties(this, {\r\n active: { get: () => adapterIndexer.active },\r\n length: { get: () => adapterIndexer.length }\r\n });\r\n Object.freeze(this);\r\n }\r\n /**\r\n * - Current hash value of the index.\r\n */\r\n get hash() {\r\n return this.#indexData.hash;\r\n }\r\n /**\r\n * Provides an iterator over the index array.\r\n *\r\n * @returns Iterator / generator\r\n * @yields {K}\r\n */\r\n *[Symbol.iterator]() {\r\n const indexData = this.#indexData;\r\n if (!indexData.index) {\r\n return;\r\n }\r\n const reversed = indexData.reversed;\r\n const length = indexData.index.length;\r\n if (reversed) {\r\n for (let cntr = length; --cntr >= 0;) {\r\n yield indexData.index[cntr];\r\n }\r\n }\r\n else {\r\n for (let cntr = 0; cntr < length; cntr++) {\r\n yield indexData.index[cntr];\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Provides the public API for derived reducers. There are several ways to create a derived reducer from utilizing the\r\n * default implementation or passing in a constructor function / class for a custom derived reducer.\r\n *\r\n * This class forms the public API which is accessible from the `.derived` getter in the main reducer implementation.\r\n * ```\r\n * const dynArray = new DynArrayReducer([...]);\r\n * dynArray.derived.clear();\r\n * dynArray.derived.create(...);\r\n * dynArray.derived.delete(...);\r\n * dynArray.derived.destroy();\r\n * dynArray.derived.get(...);\r\n * ```\r\n */\r\nclass DerivedAPI {\r\n /**\r\n * Removes all derived reducers and associated subscriptions.\r\n */\r\n clear;\r\n /**\r\n * @param options - Options for creating a reducer.\r\n *\r\n * @returns Newly created derived reducer.\r\n */\r\n create;\r\n /**\r\n * Deletes and destroys a derived reducer.\r\n *\r\n * @param name - Name of the derived reducer\r\n */\r\n delete;\r\n /**\r\n * Removes all derived reducers, associated subscriptions, and cleans up all resources.\r\n */\r\n destroy;\r\n /**\r\n * Returns an existing derived reducer.\r\n *\r\n * @param name - Name of derived reducer.\r\n */\r\n get;\r\n constructor(adapterDerived) {\r\n this.clear = adapterDerived.clear.bind(adapterDerived);\r\n this.create = adapterDerived.create.bind(adapterDerived);\r\n this.delete = adapterDerived.delete.bind(adapterDerived);\r\n this.destroy = adapterDerived.destroy.bind(adapterDerived);\r\n this.get = adapterDerived.get.bind(adapterDerived);\r\n Object.freeze(this);\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass Indexer$1 extends AdapterIndexer {\r\n /**\r\n * @inheritDoc\r\n */\r\n createSortFn() {\r\n return (a, b) => this.sortData.compareFn(this.hostData[0][a], this.hostData[0][b]);\r\n }\r\n /**\r\n * Provides the custom filter / reduce step that is ~25-40% faster than implementing with `Array.reduce`.\r\n *\r\n * Note: Other loop unrolling techniques like Duff's Device gave a slight faster lower bound on large data sets,\r\n * but the maintenance factor is not worth the extra complication.\r\n *\r\n * @returns New filtered index array.\r\n */\r\n reduceImpl() {\r\n const data = [];\r\n const array = this.hostData[0];\r\n if (!array) {\r\n return data;\r\n }\r\n const filters = this.filtersData.filters;\r\n let include = true;\r\n const parentIndex = this.indexData.parent;\r\n // Source index data is coming from an active parent index.\r\n if (DynReducerUtils.isIterable(parentIndex) && parentIndex.active) {\r\n for (const adjustedIndex of parentIndex) {\r\n const value = array[adjustedIndex];\r\n include = true;\r\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\r\n if (!filters[filCntr].filter(value)) {\r\n include = false;\r\n break;\r\n }\r\n }\r\n if (include) {\r\n data.push(adjustedIndex);\r\n }\r\n }\r\n }\r\n else {\r\n for (let cntr = 0, length = array.length; cntr < length; cntr++) {\r\n include = true;\r\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\r\n if (!filters[filCntr].filter(array[cntr])) {\r\n include = false;\r\n break;\r\n }\r\n }\r\n if (include) {\r\n data.push(cntr);\r\n }\r\n }\r\n }\r\n return data;\r\n }\r\n /**\r\n * Update the reducer indexes. If there are changes subscribers are notified. If data order is changed externally\r\n * pass in true to force an update to subscribers.\r\n *\r\n * @param [force=false] - When true forces an update to subscribers.\r\n */\r\n update(force = false) {\r\n if (this.destroyed) {\r\n return;\r\n }\r\n const oldIndex = this.indexData.index;\r\n const oldHash = this.indexData.hash;\r\n const array = this.hostData[0];\r\n const parentIndex = this.indexData.parent;\r\n // Clear index if there are no filters and no sort function or the index length doesn't match the item length.\r\n if ((this.filtersData.filters.length === 0 && !this.sortData.compareFn) ||\r\n (this.indexData.index && array?.length !== this.indexData.index.length)) {\r\n this.indexData.index = null;\r\n }\r\n // If there are filters build new index.\r\n if (this.filtersData.filters.length > 0) {\r\n this.indexData.index = this.reduceImpl();\r\n }\r\n // If the index isn't built yet and there is an active parent index then create it from the parent.\r\n if (!this.indexData.index && parentIndex?.active) {\r\n this.indexData.index = [...parentIndex];\r\n }\r\n if (this.sortData.compareFn && Array.isArray(array)) {\r\n // If there is no index then create one with keys matching host item length.\r\n if (!this.indexData.index) {\r\n this.indexData.index = [...Array(array.length).keys()];\r\n }\r\n this.indexData.index.sort(this.sortFn);\r\n }\r\n this.calcHashUpdate(oldIndex, oldHash, force);\r\n // Update all derived reducers.\r\n this.derivedAdapter?.update(force);\r\n }\r\n}\r\n\r\n/**\r\n * Provides the base implementation derived reducer for arrays / DynArrayReducer.\r\n */\r\nclass DerivedArrayReducer {\r\n #array;\r\n #derived;\r\n #derivedPublicAPI;\r\n #filters;\r\n #filtersData = { filters: [] };\r\n #index;\r\n #indexPublicAPI;\r\n #reversed = false;\r\n #sort;\r\n #sortData = { compareFn: null };\r\n #subscriptions = [];\r\n #destroyed = false;\r\n /**\r\n * @param array - Data host array.\r\n *\r\n * @param parentIndex - Parent indexer.\r\n *\r\n * @param options - Any filters and sort functions to apply.\r\n */\r\n constructor(array, parentIndex, options) {\r\n this.#array = array;\r\n this.#index = new Indexer$1(this.#array, this.#updateSubscribers.bind(this), parentIndex);\r\n this.#indexPublicAPI = new IndexerAPI(this.#index);\r\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\r\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\r\n this.#derived = new AdapterDerived(this.#array, this.#indexPublicAPI, DerivedArrayReducer);\r\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\r\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\r\n let filters = void 0;\r\n let sort = void 0;\r\n if (options !== void 0 && ('filters' in options || 'sort' in options)) {\r\n if (options.filters !== void 0) {\r\n if (DynReducerUtils.isIterable(options.filters)) {\r\n filters = options.filters;\r\n }\r\n else {\r\n throw new TypeError(`DerivedArrayReducer error (DataDerivedOptions): 'filters' attribute is not iterable.`);\r\n }\r\n }\r\n if (options.sort !== void 0) {\r\n if (typeof options.sort === 'function') {\r\n sort = options.sort;\r\n }\r\n else if (typeof options.sort === 'object' && options.sort !== null) {\r\n sort = options.sort;\r\n }\r\n else {\r\n throw new TypeError(`DerivedArrayReducer error (DataDerivedOptions): 'sort' attribute is not a function or object.`);\r\n }\r\n }\r\n }\r\n // Add any filters and sort function defined by DataDynArray.\r\n if (filters) {\r\n this.filters.add(...filters);\r\n }\r\n if (sort) {\r\n this.sort.set(sort);\r\n }\r\n // Invoke an custom initialization for child classes.\r\n this.initialize();\r\n }\r\n /**\r\n * Returns the internal data of this instance. Be careful!\r\n *\r\n * Note: if an array is set as initial data then that array is used as the internal data. If any changes are\r\n * performed to the data externally do invoke {@link IndexerAPI.update} with `true` to recalculate the index and\r\n * notify all subscribers.\r\n *\r\n * @returns The internal data.\r\n */\r\n get data() { return this.#array[0]; }\r\n /**\r\n * @returns Derived public API.\r\n */\r\n get derived() { return this.#derivedPublicAPI; }\r\n /**\r\n * @returns The filters adapter.\r\n */\r\n get filters() { return this.#filters; }\r\n /**\r\n * Returns the Indexer public API.\r\n *\r\n * @returns Indexer API - is also iterable.\r\n */\r\n get index() { return this.#indexPublicAPI; }\r\n /**\r\n * Returns whether this derived reducer is destroyed.\r\n */\r\n get destroyed() { return this.#destroyed; }\r\n /**\r\n * @returns Main data / items length or indexed length.\r\n */\r\n get length() {\r\n const array = this.#array[0];\r\n return this.#index.active ? this.index.length :\r\n array ? array.length : 0;\r\n }\r\n /**\r\n * @returns Gets current reversed state.\r\n */\r\n get reversed() { return this.#reversed; }\r\n /**\r\n * @returns The sort adapter.\r\n */\r\n get sort() { return this.#sort; }\r\n /**\r\n * Sets reversed state and notifies subscribers.\r\n *\r\n * @param reversed - New reversed state.\r\n */\r\n set reversed(reversed) {\r\n if (typeof reversed !== 'boolean') {\r\n throw new TypeError(`DerivedArrayReducer.reversed error: 'reversed' is not a boolean.`);\r\n }\r\n this.#reversed = reversed;\r\n this.#index.reversed = reversed;\r\n // Recalculate index and force an update to any subscribers.\r\n this.index.update(true);\r\n }\r\n /**\r\n * Removes all derived reducers, subscriptions, and cleans up all resources.\r\n */\r\n destroy() {\r\n this.#destroyed = true;\r\n // Remove any external data reference and perform a final update.\r\n this.#array = [null];\r\n this.#index.update(true);\r\n // Remove all subscriptions.\r\n this.#subscriptions.length = 0;\r\n this.#derived.destroy();\r\n this.#index.destroy();\r\n this.#filters.clear();\r\n this.#sort.clear();\r\n }\r\n /**\r\n * Provides a callback for custom derived reducers to initialize any data / custom configuration. This allows\r\n * child classes to avoid implementing the constructor.\r\n *\r\n * @protected\r\n */\r\n initialize() { }\r\n /**\r\n * Provides an iterator for data stored in DerivedArrayReducer.\r\n *\r\n * @returns Generator / iterator of all data.\r\n */\r\n *[Symbol.iterator]() {\r\n const array = this.#array[0];\r\n if (this.#destroyed || array === null || array?.length === 0) {\r\n return;\r\n }\r\n if (this.#index.active) {\r\n for (const entry of this.index) {\r\n yield array[entry];\r\n }\r\n }\r\n else {\r\n if (this.reversed) {\r\n for (let cntr = array.length; --cntr >= 0;) {\r\n yield array[cntr];\r\n }\r\n }\r\n else {\r\n for (let cntr = 0; cntr < array.length; cntr++) {\r\n yield array[cntr];\r\n }\r\n }\r\n }\r\n }\r\n // -------------------------------------------------------------------------------------------------------------------\r\n /**\r\n * Subscribe to this DerivedArrayReducer.\r\n *\r\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\r\n *\r\n * @returns Unsubscribe function.\r\n */\r\n subscribe(handler) {\r\n this.#subscriptions.push(handler); // add handler to the array of subscribers\r\n handler(this); // call handler with current value\r\n // Return unsubscribe function.\r\n return () => {\r\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\r\n if (index >= 0) {\r\n this.#subscriptions.splice(index, 1);\r\n }\r\n };\r\n }\r\n /**\r\n * Updates subscribers on changes.\r\n */\r\n #updateSubscribers() {\r\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\r\n this.#subscriptions[cntr](this);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Provides a managed array with non-destructive reducing / filtering / sorting capabilities with subscription /\r\n * Svelte store support.\r\n */\r\nclass DynArrayReducer {\r\n #array = [null];\r\n #derived;\r\n #derivedPublicAPI;\r\n #filters;\r\n #filtersData = { filters: [] };\r\n #index;\r\n #indexPublicAPI;\r\n #reversed = false;\r\n #sort;\r\n #sortData = { compareFn: null };\r\n #subscriptions = [];\r\n #destroyed = false;\r\n /**\r\n * Initializes DynArrayReducer. Any iterable is supported for initial data. Take note that if `data` is an array it\r\n * will be used as the host array and not copied. All non-array iterables otherwise create a new array / copy.\r\n *\r\n * @param [data] - Data iterable to store if array or copy otherwise.\r\n */\r\n constructor(data) {\r\n let dataIterable = void 0;\r\n let filters = void 0;\r\n let sort = void 0;\r\n if (data === null) {\r\n throw new TypeError(`DynArrayReducer error: 'data' is not iterable.`);\r\n }\r\n if (data !== void 0 && typeof data !== 'object' && !DynReducerUtils.isIterable(data)) {\r\n throw new TypeError(`DynArrayReducer error: 'data' is not iterable.`);\r\n }\r\n if (data !== void 0 && Symbol.iterator in data) {\r\n dataIterable = data;\r\n }\r\n else if (data !== void 0 && ('data' in data || 'filters' in data || 'sort' in data)) {\r\n if (data.data !== void 0 && !DynReducerUtils.isIterable(data.data)) {\r\n throw new TypeError(`DynArrayReducer error (DataDynArray): 'data' attribute is not iterable.`);\r\n }\r\n dataIterable = data.data;\r\n if (data.filters !== void 0) {\r\n if (DynReducerUtils.isIterable(data.filters)) {\r\n filters = data.filters;\r\n }\r\n else {\r\n throw new TypeError(`DynArrayReducer error (DataDynArray): 'filters' attribute is not iterable.`);\r\n }\r\n }\r\n if (data.sort !== void 0) {\r\n if (typeof data.sort === 'function') {\r\n sort = data.sort;\r\n }\r\n else if (typeof data.sort === 'object' && data.sort !== null) {\r\n sort = data.sort;\r\n }\r\n else {\r\n throw new TypeError(`DynArrayReducer error (DataDynArray): 'sort' attribute is not a function or object.`);\r\n }\r\n }\r\n }\r\n // In the case of the main data being an array directly use the array otherwise create a copy.\r\n if (dataIterable) {\r\n this.#array[0] = Array.isArray(dataIterable) ? dataIterable : [...dataIterable];\r\n }\r\n this.#index = new Indexer$1(this.#array, this.#updateSubscribers.bind(this));\r\n this.#indexPublicAPI = new IndexerAPI(this.#index);\r\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\r\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\r\n this.#derived = new AdapterDerived(this.#array, this.#indexPublicAPI, DerivedArrayReducer);\r\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\r\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\r\n // Add any filters and sort function defined by DataDynArray.\r\n if (filters) {\r\n this.filters.add(...filters);\r\n }\r\n if (sort) {\r\n this.sort.set(sort);\r\n }\r\n // Invoke an custom initialization for child classes.\r\n this.initialize();\r\n }\r\n /**\r\n * Returns the internal data of this instance. Be careful!\r\n *\r\n * Note: if an array is set as initial data then that array is used as the internal data. If any changes are\r\n * performed to the data externally do invoke {@link AdapterIndexer.index.update} with `true` to recalculate the\r\n * index and notify all subscribers.\r\n *\r\n * @returns The internal data.\r\n */\r\n get data() { return this.#array[0]; }\r\n /**\r\n * @returns Derived public API.\r\n */\r\n get derived() { return this.#derivedPublicAPI; }\r\n /**\r\n * @returns The filters adapter.\r\n */\r\n get filters() { return this.#filters; }\r\n /**\r\n * @returns Returns the Indexer public API.\r\n */\r\n get index() { return this.#indexPublicAPI; }\r\n /**\r\n * Returns whether this instance is destroyed.\r\n */\r\n get destroyed() { return this.#destroyed; }\r\n /**\r\n * Gets the main data / items length.\r\n *\r\n * @returns {number} Main data / items length.\r\n */\r\n get length() {\r\n const array = this.#array[0];\r\n return this.#index.active ? this.#indexPublicAPI.length :\r\n array ? array.length : 0;\r\n }\r\n /**\r\n * Gets current reversed state.\r\n *\r\n * @returns {boolean} Reversed state.\r\n */\r\n get reversed() { return this.#reversed; }\r\n /**\r\n * @returns The sort adapter.\r\n */\r\n get sort() { return this.#sort; }\r\n /**\r\n * Sets reversed state and notifies subscribers.\r\n *\r\n * @param reversed - New reversed state.\r\n */\r\n set reversed(reversed) {\r\n if (typeof reversed !== 'boolean') {\r\n throw new TypeError(`DynArrayReducer.reversed error: 'reversed' is not a boolean.`);\r\n }\r\n this.#reversed = reversed;\r\n this.#index.reversed = reversed;\r\n // Recalculate index and force an update to any subscribers.\r\n this.index.update(true);\r\n }\r\n /**\r\n * Removes all derived reducers, subscriptions, and cleans up all resources.\r\n */\r\n destroy() {\r\n if (this.#destroyed) {\r\n return;\r\n }\r\n this.#destroyed = true;\r\n this.#derived.destroy();\r\n // Set the backing data to null and provide a final update.\r\n this.#array = [null];\r\n this.index.update(true);\r\n // Remove all subscriptions.\r\n this.#subscriptions.length = 0;\r\n this.#index.destroy();\r\n this.#filters.clear();\r\n this.#sort.clear();\r\n }\r\n /**\r\n * Provides a callback for custom reducers to initialize any data / custom configuration. This allows\r\n * child classes to avoid implementing the constructor.\r\n *\r\n * @protected\r\n */\r\n initialize() { }\r\n /**\r\n * Removes internal data and pushes new data. This does not destroy any initial array set to internal data unless\r\n * `replace` is set to true.\r\n *\r\n * @param data - New data to set to internal data.\r\n *\r\n * @param replace=false - New data to set to internal data.\r\n */\r\n setData(data, replace = false) {\r\n if (data !== null && !DynReducerUtils.isIterable(data)) {\r\n throw new TypeError(`DynArrayReducer.setData error: 'data' is not iterable.`);\r\n }\r\n if (typeof replace !== 'boolean') {\r\n throw new TypeError(`DynArrayReducer.setData error: 'replace' is not a boolean.`);\r\n }\r\n const array = this.#array[0];\r\n // If the array isn't defined or 'replace' is true then replace internal data with new array or create an array\r\n // from an iterable.\r\n if (!Array.isArray(array) || replace) {\r\n if (data) {\r\n this.#array[0] = Array.isArray(data) ? data : [...data];\r\n }\r\n }\r\n else {\r\n if (data) {\r\n // Remove all entries in internal data. This will not replace any initially set array.\r\n array.length = 0;\r\n // Add all new data.\r\n array.push(...data);\r\n }\r\n else {\r\n this.#array[0] = null;\r\n }\r\n }\r\n // Recalculate index and force an update to any subscribers.\r\n this.index.update(true);\r\n }\r\n /**\r\n * Add a subscriber to this DynArrayReducer instance.\r\n *\r\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\r\n *\r\n * @returns Unsubscribe function.\r\n */\r\n subscribe(handler) {\r\n this.#subscriptions.push(handler); // add handler to the array of subscribers\r\n handler(this); // call handler with current value\r\n // Return unsubscribe function.\r\n return () => {\r\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\r\n if (index >= 0) {\r\n this.#subscriptions.splice(index, 1);\r\n }\r\n };\r\n }\r\n /**\r\n * Updates subscribers on changes.\r\n */\r\n #updateSubscribers() {\r\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\r\n this.#subscriptions[cntr](this);\r\n }\r\n }\r\n /**\r\n * Provides an iterator for data stored in DynArrayReducer.\r\n *\r\n * @returns Generator / iterator of all data.\r\n * @yields {T}\r\n */\r\n *[Symbol.iterator]() {\r\n const array = this.#array[0];\r\n if (this.#destroyed || array === null || array?.length === 0) {\r\n return;\r\n }\r\n if (this.#index.active) {\r\n for (const entry of this.index) {\r\n yield array[entry];\r\n }\r\n }\r\n else {\r\n if (this.reversed) {\r\n for (let cntr = array.length; --cntr >= 0;) {\r\n yield array[cntr];\r\n }\r\n }\r\n else {\r\n for (let cntr = 0; cntr < array.length; cntr++) {\r\n yield array[cntr];\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass Indexer extends AdapterIndexer {\r\n /**\r\n * @inheritDoc\r\n */\r\n createSortFn() {\r\n return (a, b) => this.sortData.compareFn(this.hostData[0].get(a), this.hostData[0].get(b));\r\n }\r\n /**\r\n * Provides the custom filter / reduce step that is ~25-40% faster than implementing with `Array.reduce`.\r\n *\r\n * Note: Other loop unrolling techniques like Duff's Device gave a slight faster lower bound on large data sets,\r\n * but the maintenance factor is not worth the extra complication.\r\n *\r\n * @returns New filtered index array.\r\n */\r\n reduceImpl() {\r\n const data = [];\r\n const map = this.hostData[0];\r\n if (!map) {\r\n return data;\r\n }\r\n const filters = this.filtersData.filters;\r\n let include = true;\r\n const parentIndex = this.indexData.parent;\r\n // Source index data is coming from an active parent index.\r\n if (DynReducerUtils.isIterable(parentIndex) && parentIndex.active) {\r\n for (const key of parentIndex) {\r\n const value = map.get(key);\r\n include = true;\r\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\r\n if (!filters[filCntr].filter(value)) {\r\n include = false;\r\n break;\r\n }\r\n }\r\n if (include) {\r\n data.push(key);\r\n }\r\n }\r\n }\r\n else {\r\n for (const key of map.keys()) {\r\n include = true;\r\n const value = map.get(key);\r\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\r\n if (!filters[filCntr].filter(value)) {\r\n include = false;\r\n break;\r\n }\r\n }\r\n if (include) {\r\n data.push(key);\r\n }\r\n }\r\n }\r\n return data;\r\n }\r\n /**\r\n * Update the reducer indexes. If there are changes subscribers are notified. If data order is changed externally\r\n * pass in true to force an update to subscribers.\r\n *\r\n * @param [force=false] - When true forces an update to subscribers.\r\n */\r\n update(force = false) {\r\n if (this.destroyed) {\r\n return;\r\n }\r\n const oldIndex = this.indexData.index;\r\n const oldHash = this.indexData.hash;\r\n const map = this.hostData[0];\r\n const parentIndex = this.indexData.parent;\r\n // Clear index if there are no filters and no sort function or the index length doesn't match the item length.\r\n if ((this.filtersData.filters.length === 0 && !this.sortData.compareFn) ||\r\n (this.indexData.index && map?.size !== this.indexData.index.length)) {\r\n this.indexData.index = null;\r\n }\r\n // If there are filters build new index.\r\n if (this.filtersData.filters.length > 0) {\r\n this.indexData.index = this.reduceImpl();\r\n }\r\n // If the index isn't built yet and there is an active parent index then create it from the parent.\r\n if (!this.indexData.index && parentIndex?.active) {\r\n this.indexData.index = [...parentIndex];\r\n }\r\n if (this.sortData.compareFn && map instanceof Map) {\r\n // If there is no index then create one with keys matching host item length.\r\n if (!this.indexData.index) {\r\n this.indexData.index = this.indexData.index = [...map.keys()];\r\n }\r\n this.indexData.index.sort(this.sortFn);\r\n }\r\n this.calcHashUpdate(oldIndex, oldHash, force);\r\n // Update all derived reducers.\r\n this.derivedAdapter?.update(force);\r\n }\r\n}\r\n\r\n/**\r\n * Provides the base implementation derived reducer for arrays / DynArrayReducer.\r\n */\r\nclass DerivedMapReducer {\r\n #map;\r\n #derived;\r\n #derivedPublicAPI;\r\n #filters;\r\n #filtersData = { filters: [] };\r\n #index;\r\n #indexPublicAPI;\r\n #reversed = false;\r\n #sort;\r\n #sortData = { compareFn: null };\r\n #subscriptions = [];\r\n #destroyed = false;\r\n /**\r\n * @param map - Data host Map.\r\n *\r\n * @param parentIndex - Parent indexer.\r\n *\r\n * @param options - Any filters and sort functions to apply.\r\n */\r\n constructor(map, parentIndex, options) {\r\n this.#map = map;\r\n this.#index = new Indexer(this.#map, this.#updateSubscribers.bind(this), parentIndex);\r\n this.#indexPublicAPI = new IndexerAPI(this.#index);\r\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\r\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\r\n this.#derived = new AdapterDerived(this.#map, this.#indexPublicAPI, DerivedMapReducer);\r\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\r\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\r\n let filters = void 0;\r\n let sort = void 0;\r\n if (options !== void 0 && ('filters' in options || 'sort' in options)) {\r\n if (options.filters !== void 0) {\r\n if (DynReducerUtils.isIterable(options.filters)) {\r\n filters = options.filters;\r\n }\r\n else {\r\n throw new TypeError(`DerivedMapReducer error (DataDerivedOptions): 'filters' attribute is not iterable.`);\r\n }\r\n }\r\n if (options.sort !== void 0) {\r\n if (typeof options.sort === 'function') {\r\n sort = options.sort;\r\n }\r\n else if (typeof options.sort === 'object' && options.sort !== null) {\r\n sort = options.sort;\r\n }\r\n else {\r\n throw new TypeError(`DerivedMapReducer error (DataDerivedOptions): 'sort' attribute is not a function or object.`);\r\n }\r\n }\r\n }\r\n // Add any filters and sort function defined by DataDynArray.\r\n if (filters) {\r\n this.filters.add(...filters);\r\n }\r\n if (sort) {\r\n this.sort.set(sort);\r\n }\r\n // Invoke an custom initialization for child classes.\r\n this.initialize();\r\n }\r\n /**\r\n * Returns the internal data of this instance. Be careful!\r\n *\r\n * Note: The returned map is the same map set by the main reducer. If any changes are performed to the data\r\n * externally do invoke {@link IndexerAPI.update} with `true` to recalculate the index and notify all subscribers.\r\n *\r\n * @returns The internal data.\r\n */\r\n get data() { return this.#map[0]; }\r\n /**\r\n * @returns Derived public API.\r\n */\r\n get derived() { return this.#derivedPublicAPI; }\r\n /**\r\n * @returns The filters adapter.\r\n */\r\n get filters() { return this.#filters; }\r\n /**\r\n * Returns the Indexer public API.\r\n *\r\n * @returns Indexer API - is also iterable.\r\n */\r\n get index() { return this.#indexPublicAPI; }\r\n /**\r\n * Returns whether this derived reducer is destroyed.\r\n */\r\n get destroyed() { return this.#destroyed; }\r\n /**\r\n * @returns Main data / items length or indexed length.\r\n */\r\n get length() {\r\n const map = this.#map[0];\r\n return this.#index.active ? this.index.length :\r\n map ? map.size : 0;\r\n }\r\n /**\r\n * @returns Gets current reversed state.\r\n */\r\n get reversed() { return this.#reversed; }\r\n /**\r\n * @returns The sort adapter.\r\n */\r\n get sort() { return this.#sort; }\r\n /**\r\n * Sets reversed state and notifies subscribers.\r\n *\r\n * @param reversed - New reversed state.\r\n */\r\n set reversed(reversed) {\r\n if (typeof reversed !== 'boolean') {\r\n throw new TypeError(`DerivedMapReducer.reversed error: 'reversed' is not a boolean.`);\r\n }\r\n this.#reversed = reversed;\r\n this.#index.reversed = reversed;\r\n // Recalculate index and force an update to any subscribers.\r\n this.index.update(true);\r\n }\r\n /**\r\n * Removes all derived reducers, subscriptions, and cleans up all resources.\r\n */\r\n destroy() {\r\n this.#destroyed = true;\r\n // Remove any external data reference and perform a final update.\r\n this.#map = [null];\r\n this.#index.update(true);\r\n // Remove all subscriptions.\r\n this.#subscriptions.length = 0;\r\n this.#derived.destroy();\r\n this.#index.destroy();\r\n this.#filters.clear();\r\n this.#sort.clear();\r\n }\r\n /**\r\n * Provides a callback for custom derived reducers to initialize any data / custom configuration. This allows\r\n * child classes to avoid implementing the constructor.\r\n *\r\n * @protected\r\n */\r\n initialize() { }\r\n /**\r\n * Provides an iterator for data stored in DerivedMapReducer.\r\n *\r\n * @returns Generator / iterator of all data.\r\n */\r\n *[Symbol.iterator]() {\r\n const map = this.#map[0];\r\n if (this.#destroyed || map === null || map?.size === 0) {\r\n return;\r\n }\r\n if (this.#index.active) {\r\n for (const key of this.index) {\r\n yield map.get(key);\r\n }\r\n }\r\n else {\r\n if (this.reversed) {\r\n // TODO: Not efficient due to creating temporary values array.\r\n const values = [...map.values()];\r\n for (let cntr = values.length; --cntr >= 0;) {\r\n yield values[cntr];\r\n }\r\n }\r\n else {\r\n for (const value of map.values()) {\r\n yield value;\r\n }\r\n }\r\n }\r\n }\r\n // -------------------------------------------------------------------------------------------------------------------\r\n /**\r\n * Subscribe to this DerivedMapReducer.\r\n *\r\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\r\n *\r\n * @returns Unsubscribe function.\r\n */\r\n subscribe(handler) {\r\n this.#subscriptions.push(handler); // add handler to the array of subscribers\r\n handler(this); // call handler with current value\r\n // Return unsubscribe function.\r\n return () => {\r\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\r\n if (index >= 0) {\r\n this.#subscriptions.splice(index, 1);\r\n }\r\n };\r\n }\r\n /**\r\n * Updates subscribers on changes.\r\n */\r\n #updateSubscribers() {\r\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\r\n this.#subscriptions[cntr](this);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Provides a managed Map with non-destructive reducing / filtering / sorting capabilities with subscription /\r\n * Svelte store support.\r\n */\r\nclass DynMapReducer {\r\n #map = [null];\r\n #derived;\r\n #derivedPublicAPI;\r\n #filters;\r\n #filtersData = { filters: [] };\r\n #index;\r\n #indexPublicAPI;\r\n #reversed = false;\r\n #sort;\r\n #sortData = { compareFn: null };\r\n #subscriptions = [];\r\n #destroyed = false;\r\n /**\r\n * Initializes DynMapReducer. Any iterable is supported for initial data. Take note that if `data` is an array it\r\n * will be used as the host array and not copied. All non-array iterables otherwise create a new array / copy.\r\n *\r\n * @param [data] - Data iterable to store if array or copy otherwise.\r\n */\r\n constructor(data) {\r\n let dataMap = void 0;\r\n let filters = void 0;\r\n let sort = void 0;\r\n if (data === null) {\r\n throw new TypeError(`DynMapReducer error: 'data' is not an object or Map.`);\r\n }\r\n if (data !== void 0 && typeof data !== 'object' && !(data instanceof Map)) {\r\n throw new TypeError(`DynMapReducer error: 'data' is not an object or Map.`);\r\n }\r\n if (data !== void 0 && data instanceof Map) {\r\n dataMap = data;\r\n }\r\n else if (data !== void 0 && ('data' in data || 'filters' in data || 'sort' in data)) {\r\n if (data.data !== void 0 && !(data.data instanceof Map)) {\r\n throw new TypeError(`DynMapReducer error (DataDynMap): 'data' attribute is not a Map.`);\r\n }\r\n dataMap = data.data;\r\n if (data.filters !== void 0) {\r\n if (DynReducerUtils.isIterable(data.filters)) {\r\n filters = data.filters;\r\n }\r\n else {\r\n throw new TypeError(`DynMapReducer error (DataDynMap): 'filters' attribute is not iterable.`);\r\n }\r\n }\r\n if (data.sort !== void 0) {\r\n if (typeof data.sort === 'function') {\r\n sort = data.sort;\r\n }\r\n else if (typeof data.sort === 'object' && data.sort !== null) {\r\n sort = data.sort;\r\n }\r\n else {\r\n throw new TypeError(`DynMapReducer error (DataDynMap): 'sort' attribute is not a function or object.`);\r\n }\r\n }\r\n }\r\n // In the case of the main data being an array directly use the array otherwise create a copy.\r\n if (dataMap) {\r\n this.#map[0] = dataMap;\r\n }\r\n this.#index = new Indexer(this.#map, this.#updateSubscribers.bind(this));\r\n this.#indexPublicAPI = new IndexerAPI(this.#index);\r\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\r\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\r\n this.#derived = new AdapterDerived(this.#map, this.#indexPublicAPI, DerivedMapReducer);\r\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\r\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\r\n // Add any filters and sort function defined by DataDynMap.\r\n if (filters) {\r\n this.filters.add(...filters);\r\n }\r\n if (sort) {\r\n this.sort.set(sort);\r\n }\r\n // Invoke an custom initialization for child classes.\r\n this.initialize();\r\n }\r\n /**\r\n * Returns the internal data of this instance. Be careful!\r\n *\r\n * Note: When a map is set as data then that map is used as the internal data. If any changes are\r\n * performed to the data externally do invoke {@link AdapterIndexer.index.update} with `true` to recalculate the\r\n * index and notify all subscribers.\r\n *\r\n * @returns The internal data.\r\n */\r\n get data() { return this.#map[0]; }\r\n /**\r\n * @returns Derived public API.\r\n */\r\n get derived() { return this.#derivedPublicAPI; }\r\n /**\r\n * @returns The filters adapter.\r\n */\r\n get filters() { return this.#filters; }\r\n /**\r\n * @returns Returns the Indexer public API.\r\n */\r\n get index() { return this.#indexPublicAPI; }\r\n /**\r\n * Returns whether this instance is destroyed.\r\n */\r\n get destroyed() { return this.#destroyed; }\r\n /**\r\n * Gets the main data / items length.\r\n *\r\n * @returns {number} Main data / items length.\r\n */\r\n get length() {\r\n const map = this.#map[0];\r\n return this.#index.active ? this.#indexPublicAPI.length :\r\n map ? map.size : 0;\r\n }\r\n /**\r\n * Gets current reversed state.\r\n *\r\n * @returns {boolean} Reversed state.\r\n */\r\n get reversed() { return this.#reversed; }\r\n /**\r\n * @returns The sort adapter.\r\n */\r\n get sort() { return this.#sort; }\r\n /**\r\n * Sets reversed state and notifies subscribers.\r\n *\r\n * @param reversed - New reversed state.\r\n */\r\n set reversed(reversed) {\r\n if (typeof reversed !== 'boolean') {\r\n throw new TypeError(`DynMapReducer.reversed error: 'reversed' is not a boolean.`);\r\n }\r\n this.#reversed = reversed;\r\n this.#index.reversed = reversed;\r\n // Recalculate index and force an update to any subscribers.\r\n this.index.update(true);\r\n }\r\n /**\r\n * Removes all derived reducers, subscriptions, and cleans up all resources.\r\n */\r\n destroy() {\r\n if (this.#destroyed) {\r\n return;\r\n }\r\n this.#destroyed = true;\r\n this.#derived.destroy();\r\n // Set the backing data to null and provide a final update.\r\n this.#map = [null];\r\n this.index.update(true);\r\n // Remove all subscriptions.\r\n this.#subscriptions.length = 0;\r\n this.#index.destroy();\r\n this.#filters.clear();\r\n this.#sort.clear();\r\n }\r\n /**\r\n * Provides a callback for custom reducers to initialize any data / custom configuration. This allows\r\n * child classes to avoid implementing the constructor.\r\n *\r\n * @protected\r\n */\r\n initialize() { }\r\n /**\r\n * Removes internal data and pushes new data. This does not destroy any initial array set to internal data unless\r\n * `replace` is set to true.\r\n *\r\n * @param data - New data to set to internal data.\r\n *\r\n * @param replace=false - New data to set to internal data.\r\n */\r\n setData(data, replace = false) {\r\n if (data !== null && !(data instanceof Map)) {\r\n throw new TypeError(`DynMapReducer.setData error: 'data' is not iterable.`);\r\n }\r\n if (typeof replace !== 'boolean') {\r\n throw new TypeError(`DynMapReducer.setData error: 'replace' is not a boolean.`);\r\n }\r\n const map = this.#map[0];\r\n // If the array isn't defined or 'replace' is true then replace internal data with new array or create an array\r\n // from an iterable.\r\n if (!(map instanceof Map) || replace) {\r\n this.#map[0] = data instanceof Map ? data : null;\r\n }\r\n else if (data instanceof Map && map instanceof Map) {\r\n // Create a set of all current entry IDs.\r\n const removeKeySet = new Set(map.keys());\r\n for (const key of data.keys()) {\r\n map.set(key, data.get(key));\r\n if (removeKeySet.has(key)) {\r\n removeKeySet.delete(key);\r\n }\r\n }\r\n // Remove entries that are no longer in data.\r\n for (const key of removeKeySet) {\r\n map.delete(key);\r\n }\r\n }\r\n else if (data === null) {\r\n this.#map[0] = null;\r\n }\r\n // Recalculate index and force an update to any subscribers.\r\n this.index.update(true);\r\n }\r\n /**\r\n * Add a subscriber to this DynMapReducer instance.\r\n *\r\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\r\n *\r\n * @returns Unsubscribe function.\r\n */\r\n subscribe(handler) {\r\n this.#subscriptions.push(handler); // add handler to the array of subscribers\r\n handler(this); // call handler with current value\r\n // Return unsubscribe function.\r\n return () => {\r\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\r\n if (index >= 0) {\r\n this.#subscriptions.splice(index, 1);\r\n }\r\n };\r\n }\r\n /**\r\n * Updates subscribers on changes.\r\n */\r\n #updateSubscribers() {\r\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\r\n this.#subscriptions[cntr](this);\r\n }\r\n }\r\n /**\r\n * Provides an iterator for data stored in DynMapReducer.\r\n *\r\n * @returns Generator / iterator of all data.\r\n * @yields {T}\r\n */\r\n *[Symbol.iterator]() {\r\n const map = this.#map[0];\r\n if (this.#destroyed || map === null || map?.size === 0) {\r\n return;\r\n }\r\n if (this.#index.active) {\r\n for (const key of this.index) {\r\n yield map.get(key);\r\n }\r\n }\r\n else {\r\n if (this.reversed) {\r\n // TODO: Not efficient due to creating temporary values array.\r\n const values = [...map.values()];\r\n for (let cntr = values.length; --cntr >= 0;) {\r\n yield values[cntr];\r\n }\r\n }\r\n else {\r\n for (const value of map.values()) {\r\n yield value;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Provides a readable store to track keys actively pressed. KeyStore is designed to be used with the {@link keyforward}\r\n * action.\r\n */\r\nclass KeyStore\r\n{\r\n #keySet;\r\n\r\n /**\r\n * @type {Map<string, number>}\r\n */\r\n #keyMap = new Map();\r\n\r\n /**\r\n * @type {KeyStoreOptions}\r\n */\r\n #options = { preventDefault: true, useCode: true, stopPropagation: true };\r\n\r\n /**\r\n * Stores the subscribers.\r\n *\r\n * @type {(function(KeyStore): void)[]}\r\n */\r\n #subscriptions = [];\r\n\r\n /**\r\n * @param {Iterable<string>} [keyNames] -\r\n *\r\n * @param {KeyStoreOptions} [options] - Optional parameters\r\n */\r\n constructor(keyNames, options)\r\n {\r\n if (!isIterable(keyNames))\r\n {\r\n throw new TypeError(`'keyNames' is not an iterable list.`);\r\n }\r\n\r\n this.setOptions(options);\r\n\r\n this.#keySet = new Set(keyNames);\r\n }\r\n\r\n /**\r\n * Add given key to the tracking key set.\r\n *\r\n * @param {string} key - Key to add.\r\n */\r\n addKey(key)\r\n {\r\n if (typeof key !== 'string') { throw new TypeError(`'key' is not a string.`); }\r\n\r\n this.#keySet.add(key);\r\n }\r\n\r\n /**\r\n * @returns {boolean} True if any keys in the key set are pressed.\r\n */\r\n\r\n /**\r\n * Returns true if any of given keys are pressed. If `keys` is undefined then the result is true if any keys being\r\n * tracked are pressed.\r\n *\r\n * @param {string|Iterable<string>|undefined} keys - Zero or more key strings or list to verify if any pressed.\r\n *\r\n * @returns {boolean} True if any keys set are pressed.\r\n */\r\n anyPressed(keys)\r\n {\r\n // When no keys given then check if any key is pressed.\r\n if (keys === void 0) { return this.#keyMap.size > 0; }\r\n\r\n const isList = isIterable(keys);\r\n\r\n if (typeof keys !== 'string' && !isList)\r\n {\r\n throw new TypeError(`'keys' is not a string or iterable list of strings.`);\r\n }\r\n\r\n let result = false;\r\n\r\n if (isList)\r\n {\r\n for (const key of keys)\r\n {\r\n if (this.#keyMap.has(key))\r\n {\r\n result = true;\r\n break;\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if (this.#keyMap.has(keys)) { result = true; }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Is the given key in the tracking key set.\r\n *\r\n * @param {string} key - Key to check.\r\n */\r\n hasKey(key)\r\n {\r\n if (typeof key !== 'string') { throw new TypeError(`'key' is not a string.`); }\r\n\r\n this.#keySet.has(key);\r\n }\r\n\r\n /**\r\n * Returns true if all given keys are pressed.\r\n *\r\n * @param {string|Iterable<string>} keys - One or more key strings to verify if pressed.\r\n *\r\n * @returns {boolean} Are all keys pressed.\r\n */\r\n isPressed(keys)\r\n {\r\n const isList = isIterable(keys);\r\n\r\n if (typeof keys !== 'string' && !isList)\r\n {\r\n throw new TypeError(`'keys' is not a string or iterable list of strings.`);\r\n }\r\n\r\n let result = true;\r\n\r\n if (isList)\r\n {\r\n for (const key of keys)\r\n {\r\n if (!this.#keyMap.has(key))\r\n {\r\n result = false;\r\n break;\r\n }\r\n }\r\n }\r\n else\r\n {\r\n if (!this.#keyMap.has(keys)) { result = false; }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Handle keydown event adding any key from the tracked key set.\r\n *\r\n * @param {KeyboardEvent} event - KeyboardEvent.\r\n */\r\n keydown(event)\r\n {\r\n const key = this.#options.useCode ? event.code : event.key;\r\n\r\n if (this.#keySet.has(key))\r\n {\r\n if (!this.#keyMap.has(key))\r\n {\r\n this.#keyMap.set(key, 1);\r\n this._updateSubscribers();\r\n }\r\n\r\n if (this.#options.preventDefault) { event.preventDefault(); }\r\n if (this.#options.stopPropagation) { event.stopPropagation(); }\r\n }\r\n }\r\n\r\n /**\r\n * @returns {IterableIterator<string>} Returns current pressed keys iterator.\r\n */\r\n keysPressed()\r\n {\r\n return this.#keyMap.keys();\r\n }\r\n\r\n /**\r\n * @returns {IterableIterator<string>} Returns currently tracked keys iterator.\r\n */\r\n keysTracked()\r\n {\r\n return this.#keySet.keys();\r\n }\r\n\r\n /**\r\n * Handle keyup event removing any key from the tracked key set.\r\n *\r\n * @param {KeyboardEvent} event - KeyboardEvent.\r\n */\r\n keyup(event)\r\n {\r\n const key = this.#options.useCode ? event.code : event.key;\r\n\r\n if (this.#keySet.has(key))\r\n {\r\n if (this.#keyMap.has(key))\r\n {\r\n this.#keyMap.delete(key);\r\n this._updateSubscribers();\r\n }\r\n\r\n if (this.#options.preventDefault) { event.preventDefault(); }\r\n if (this.#options.stopPropagation) { event.stopPropagation(); }\r\n }\r\n }\r\n\r\n /**\r\n * Remove the given key from the tracking key set.\r\n *\r\n * @param {string} key - Key to remove.\r\n */\r\n removeKey(key)\r\n {\r\n if (typeof key !== 'string') { throw new TypeError(`'key' is not a string.`); }\r\n\r\n if (this.#keySet.has(key))\r\n {\r\n this.#keySet.delete(key);\r\n\r\n if (this.#keyMap.has(key))\r\n {\r\n this.#keyMap.delete(key);\r\n this._updateSubscribers();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Update options.\r\n *\r\n * @param {KeyStoreOptions} options - Options to set.\r\n */\r\n setOptions(options)\r\n {\r\n if (typeof options?.preventDefault === 'boolean') { this.#options.preventDefault = options.preventDefault; }\r\n if (typeof options?.useCode === 'boolean') { this.#options.useCode = options.useCode; }\r\n if (typeof options?.stopPropagation === 'boolean') { this.#options.stopPropagation = options.stopPropagation; }\r\n }\r\n\r\n /**\r\n * @param {string} key - key or key code to lookup.\r\n *\r\n * @returns {number} 1 if currently pressed and 0 if not pressed.\r\n */\r\n value(key)\r\n {\r\n return this.#keyMap.has(key) ? 1 : 0;\r\n }\r\n\r\n // Store subscriber implementation --------------------------------------------------------------------------------\r\n\r\n /**\r\n * @param {function(KeyStore): void} handler - Callback function that is invoked on update / changes.\r\n *\r\n * @returns {(function(): void)} Unsubscribe function.\r\n */\r\n subscribe(handler)\r\n {\r\n this.#subscriptions.push(handler); // add handler to the array of subscribers\r\n\r\n handler(this); // call handler with current value\r\n\r\n // Return unsubscribe function.\r\n return () =>\r\n {\r\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\r\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\r\n };\r\n }\r\n\r\n /**\r\n * Updates subscribers.\r\n *\r\n * @protected\r\n */\r\n _updateSubscribers()\r\n {\r\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) { this.#subscriptions[cntr](this); }\r\n }\r\n}\r\n\r\n/**\r\n * @typedef {object} KeyStoreOptions\r\n *\r\n * @property {boolean} [preventDefault=true] - Invoke `preventDefault` on key events.\r\n *\r\n * @property {boolean} [useCode=true] - When true use `event.code` otherwise use `event.key` to get active key.\r\n *\r\n * @property {boolean} [stopPropagation=true] - Invoke `stopPropagation` on key events.\r\n */\r\n\r\n// src/generator.ts\r\nfunction isSimpleDeriver(deriver) {\r\n return deriver.length < 2;\r\n}\r\nfunction generator(storage) {\r\n function readable(key, value, start) {\r\n return {\r\n subscribe: writable(key, value, start).subscribe\r\n };\r\n }\r\n function writable(key, value, start = noop) {\r\n function wrap_start(ogSet) {\r\n return start(function wrap_set(new_value) {\r\n if (storage) {\r\n storage.setItem(key, JSON.stringify(new_value));\r\n }\r\n return ogSet(new_value);\r\n });\r\n }\r\n if (storage) {\r\n const storageValue = storage.getItem(key);\r\n try {\r\n if (storageValue) {\r\n value = JSON.parse(storageValue);\r\n }\r\n } catch (err) {\r\n }\r\n storage.setItem(key, JSON.stringify(value));\r\n }\r\n const ogStore = writable$2(value, start ? wrap_start : void 0);\r\n function set(new_value) {\r\n if (storage) {\r\n storage.setItem(key, JSON.stringify(new_value));\r\n }\r\n ogStore.set(new_value);\r\n }\r\n function update(fn) {\r\n set(fn(get(ogStore)));\r\n }\r\n function subscribe(run, invalidate = noop) {\r\n return ogStore.subscribe(run, invalidate);\r\n }\r\n return {set, update, subscribe};\r\n }\r\n function derived(key, stores, fn, initial_value) {\r\n const single = !Array.isArray(stores);\r\n const stores_array = single ? [stores] : stores;\r\n if (storage && storage.getItem(key)) {\r\n try {\r\n initial_value = JSON.parse(storage.getItem(key));\r\n } catch (err) {\r\n }\r\n }\r\n return readable(key, initial_value, (set) => {\r\n let inited = false;\r\n const values = [];\r\n let pending = 0;\r\n let cleanup = noop;\r\n const sync = () => {\r\n if (pending) {\r\n return;\r\n }\r\n cleanup();\r\n const input = single ? values[0] : values;\r\n if (isSimpleDeriver(fn)) {\r\n set(fn(input));\r\n } else {\r\n const result = fn(input, set);\r\n cleanup = is_function(result) ? result : noop;\r\n }\r\n };\r\n const unsubscribers = stores_array.map((store, i) => store.subscribe((value) => {\r\n values[i] = value;\r\n pending &= ~(1 << i);\r\n if (inited) {\r\n sync();\r\n }\r\n }, () => {\r\n pending |= 1 << i;\r\n }));\r\n inited = true;\r\n sync();\r\n return function stop() {\r\n run_all(unsubscribers);\r\n cleanup();\r\n };\r\n });\r\n }\r\n return {\r\n readable,\r\n writable,\r\n derived,\r\n get: get\r\n };\r\n}\r\n\r\n// src/local.ts\r\nvar storage$1 = typeof window !== \"undefined\" ? window.localStorage : void 0;\r\nvar g$1 = generator(storage$1);\r\nvar writable$1 = g$1.writable;\r\n\r\nclass TJSLocalStorage\r\n{\r\n /**\r\n * @type {Map<string, import('svelte/store').Writable>}\r\n */\r\n #stores = new Map();\r\n\r\n /**\r\n * Creates a new writable store for the given key.\r\n *\r\n * @param {string} key - Key to lookup in stores map.\r\n *\r\n * @param {boolean} [defaultValue] - A default value to set for the store.\r\n *\r\n * @returns {import('svelte/store').Writable} The new store.\r\n */\r\n static #createStore(key, defaultValue = void 0)\r\n {\r\n try\r\n {\r\n const value = localStorage.getItem(key);\r\n if (value !== null) { defaultValue = value === 'undefined' ? void 0 : JSON.parse(value); }\r\n }\r\n catch (err) { /**/ }\r\n\r\n return writable$1(key, defaultValue);\r\n }\r\n\r\n /**\r\n * Gets a store from the stores Map or creates a new store for the key and a given default value.\r\n *\r\n * @param {string} key - Key to lookup in stores map.\r\n *\r\n * @param {boolean} [defaultValue] - A default value to set for the store.\r\n *\r\n * @returns {import('svelte/store').Writable} The store for the given key.\r\n */\r\n #getStore(key, defaultValue = void 0)\r\n {\r\n let store = this.#stores.get(key);\r\n if (store === void 0)\r\n {\r\n store = TJSLocalStorage.#createStore(key, defaultValue);\r\n this.#stores.set(key, store);\r\n }\r\n\r\n return store;\r\n }\r\n\r\n /**\r\n * Get value from the localStorage.\r\n *\r\n * @param {string} key - Key to lookup in localStorage.\r\n *\r\n * @param {*} [defaultValue] - A default value to return if key not present in session storage.\r\n *\r\n * @returns {*} Value from session storage or if not defined any default value provided.\r\n */\r\n getItem(key, defaultValue)\r\n {\r\n let value = defaultValue;\r\n\r\n const storageValue = localStorage.getItem(key);\r\n\r\n if (storageValue !== null)\r\n {\r\n try\r\n {\r\n value = storageValue === 'undefined' ? void 0 : JSON.parse(storageValue);\r\n }\r\n catch (err)\r\n {\r\n value = defaultValue;\r\n }\r\n }\r\n else if (defaultValue !== void 0)\r\n {\r\n try\r\n {\r\n const newValue = JSON.stringify(defaultValue);\r\n\r\n // If there is no existing storage value and defaultValue is defined the storage value needs to be set.\r\n localStorage.setItem(key, newValue === 'undefined' ? void 0 : newValue);\r\n }\r\n catch (err) { /* */ }\r\n }\r\n\r\n return value;\r\n }\r\n\r\n /**\r\n * Returns the backing Svelte store for the given key; potentially sets a default value if the key\r\n * is not already set.\r\n *\r\n * @param {string} key - Key to lookup in localStorage.\r\n *\r\n * @param {*} [defaultValue] - A default value to return if key not present in session storage.\r\n *\r\n * @returns {import('svelte/store').Writable} The Svelte store for this key.\r\n */\r\n getStore(key, defaultValue)\r\n {\r\n return this.#getStore(key, defaultValue);\r\n }\r\n\r\n /**\r\n * Sets the value for the given key in localStorage.\r\n *\r\n * @param {string} key - Key to lookup in localStorage.\r\n *\r\n * @param {*} value - A value to set for this key.\r\n */\r\n setItem(key, value)\r\n {\r\n const store = this.#getStore(key);\r\n store.set(value);\r\n }\r\n\r\n /**\r\n * Convenience method to swap a boolean value stored in session storage.\r\n *\r\n * @param {string} key - Key to lookup in localStorage.\r\n *\r\n * @param {boolean} [defaultValue] - A default value to return if key not present in session storage.\r\n *\r\n * @returns {boolean} The boolean swap for the given key.\r\n */\r\n swapItemBoolean(key, defaultValue)\r\n {\r\n const store = this.#getStore(key, defaultValue);\r\n\r\n let currentValue = false;\r\n\r\n try\r\n {\r\n currentValue = !!JSON.parse(localStorage.getItem(key));\r\n }\r\n catch (err) { /**/ }\r\n\r\n const newValue = typeof currentValue === 'boolean' ? !currentValue : false;\r\n\r\n store.set(newValue);\r\n return newValue;\r\n }\r\n}\r\n\r\n// src/session.ts\r\nvar storage = typeof window !== \"undefined\" ? window.sessionStorage : void 0;\r\nvar g = generator(storage);\r\nvar writable = g.writable;\r\n\r\nclass TJSSessionStorage\r\n{\r\n /**\r\n * @type {Map<string, import('svelte/store').Writable>}\r\n */\r\n #stores = new Map();\r\n\r\n /**\r\n * Creates a new store for the given key.\r\n *\r\n * @param {string} key - Key to lookup in stores map.\r\n *\r\n * @param {boolean} [defaultValue] - A default value to set for the store.\r\n *\r\n * @returns {import('svelte/store').Writable} The new store.\r\n */\r\n static #createStore(key, defaultValue = void 0)\r\n {\r\n try\r\n {\r\n const value = sessionStorage.getItem(key);\r\n if (value !== null) { defaultValue = value === 'undefined' ? void 0 : JSON.parse(value); }\r\n }\r\n catch (err) { /**/ }\r\n\r\n return writable(key, defaultValue);\r\n }\r\n\r\n /**\r\n * Gets a store from the `stores` Map or creates a new store for the key and a given default value.\r\n *\r\n * @param {string} key - Key to lookup in stores map.\r\n *\r\n * @param {boolean} [defaultValue] - A default value to set for the store.\r\n *\r\n * @returns {import('svelte/store').Writable} The store for the given key.\r\n */\r\n #getStore(key, defaultValue = void 0)\r\n {\r\n let store = this.#stores.get(key);\r\n if (store === void 0)\r\n {\r\n store = TJSSessionStorage.#createStore(key, defaultValue);\r\n this.#stores.set(key, store);\r\n }\r\n\r\n return store;\r\n }\r\n\r\n /**\r\n * Get value from the sessionStorage.\r\n *\r\n * @param {string} key - Key to lookup in sessionStorage.\r\n *\r\n * @param {*} [defaultValue] - A default value to return if key not present in session storage.\r\n *\r\n * @returns {*} Value from session storage or if not defined any default value provided.\r\n */\r\n getItem(key, defaultValue)\r\n {\r\n let value = defaultValue;\r\n\r\n const storageValue = sessionStorage.getItem(key);\r\n\r\n if (storageValue !== null)\r\n {\r\n try\r\n {\r\n value = storageValue === 'undefined' ? void 0 : JSON.parse(storageValue);\r\n }\r\n catch (err)\r\n {\r\n value = defaultValue;\r\n }\r\n }\r\n else if (defaultValue !== void 0)\r\n {\r\n try\r\n {\r\n const newValue = JSON.stringify(defaultValue);\r\n\r\n // If there is no existing storage value and defaultValue is defined the storage value needs to be set.\r\n sessionStorage.setItem(key, newValue === 'undefined' ? void 0 : newValue);\r\n }\r\n catch (err) { /* */ }\r\n }\r\n\r\n return value;\r\n }\r\n\r\n /**\r\n * Returns the backing Svelte store for the given key; potentially sets a default value if the key\r\n * is not already set.\r\n *\r\n * @param {string} key - Key to lookup in sessionStorage.\r\n *\r\n * @param {*} [defaultValue] - A default value to return if key not present in session storage.\r\n *\r\n * @returns {import('svelte/store').Writable} The Svelte store for this key.\r\n */\r\n getStore(key, defaultValue)\r\n {\r\n return this.#getStore(key, defaultValue);\r\n }\r\n\r\n /**\r\n * Sets the value for the given key in sessionStorage.\r\n *\r\n * @param {string} key - Key to lookup in sessionStorage.\r\n *\r\n * @param {*} value - A value to set for this key.\r\n */\r\n setItem(key, value)\r\n {\r\n const store = this.#getStore(key);\r\n store.set(value);\r\n }\r\n\r\n /**\r\n * Convenience method to swap a boolean value stored in session storage.\r\n *\r\n * @param {string} key - Key to lookup in sessionStorage.\r\n *\r\n * @param {boolean} [defaultValue] - A default value to return if key not present in session storage.\r\n *\r\n * @returns {boolean} The boolean swap for the given key.\r\n */\r\n swapItemBoolean(key, defaultValue)\r\n {\r\n const store = this.#getStore(key, defaultValue);\r\n\r\n let currentValue = false;\r\n\r\n try\r\n {\r\n currentValue = !!JSON.parse(sessionStorage.getItem(key));\r\n }\r\n catch (err) { /**/ }\r\n\r\n const newValue = typeof currentValue === 'boolean' ? !currentValue : false;\r\n\r\n store.set(newValue);\r\n return newValue;\r\n }\r\n}\r\n\r\n/**\r\n * Provides a basic test for a given variable to test if it has the shape of a readable store by having a `subscribe`\r\n * function.\r\n *\r\n * Note: functions are also objects, so test that the variable might be a function w/ a `subscribe` function.\r\n *\r\n * @param {*} store - variable to test that might be a store.\r\n *\r\n * @returns {boolean} Whether the variable tested has the shape of a store.\r\n */\r\nfunction isReadableStore(store)\r\n{\r\n if (store === null || store === void 0) { return false; }\r\n\r\n switch (typeof store)\r\n {\r\n case 'function':\r\n case 'object':\r\n return typeof store.subscribe === 'function';\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Provides a basic test for a given variable to test if it has the shape of a writable store by having a `subscribe`\r\n * function and an `update` function.\r\n *\r\n * Note: functions are also objects, so test that the variable might be a function w/ a `subscribe` function.\r\n *\r\n * @param {*} store - variable to test that might be a store.\r\n *\r\n * @returns {boolean} Whether the variable tested has the shape of a store.\r\n */\r\nfunction isUpdatableStore(store)\r\n{\r\n if (store === null || store === void 0) { return false; }\r\n\r\n switch (typeof store)\r\n {\r\n case 'function':\r\n case 'object':\r\n return typeof store.subscribe === 'function' && typeof store.update === 'function';\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Provides a basic test for a given variable to test if it has the shape of a writable store by having a `subscribe`\r\n * `set`, and `update` functions.\r\n *\r\n * Note: functions are also objects, so test that the variable might be a function w/ `subscribe` & `set` functions.\r\n *\r\n * @param {*} store - variable to test that might be a store.\r\n *\r\n * @returns {boolean} Whether the variable tested has the shape of a store.\r\n */\r\nfunction isWritableStore(store)\r\n{\r\n if (store === null || store === void 0) { return false; }\r\n\r\n switch (typeof store)\r\n {\r\n case 'function':\r\n case 'object':\r\n return typeof store.subscribe === 'function' && typeof store.set === 'function';\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Subscribes to the given store with the update function provided and ignores the first automatic\r\n * update. All future updates are dispatched to the update function.\r\n *\r\n * @param {import('svelte/store').Readable | import('svelte/store').Writable} store -\r\n * Store to subscribe to...\r\n *\r\n * @param {import('svelte/store').Updater} update - function to receive future updates.\r\n *\r\n * @returns {import('svelte/store').Unsubscriber} Store unsubscribe function.\r\n */\r\nfunction subscribeIgnoreFirst(store, update)\r\n{\r\n let firedFirst = false;\r\n\r\n return store.subscribe((value) =>\r\n {\r\n if (!firedFirst)\r\n {\r\n firedFirst = true;\r\n }\r\n else\r\n {\r\n update(value);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Subscribes to the given store with two update functions provided. The first function is invoked on the initial\r\n * subscription. All future updates are dispatched to the update function.\r\n *\r\n * @param {import('svelte/store').Readable | import('svelte/store').Writable} store -\r\n * Store to subscribe to...\r\n *\r\n * @param {import('svelte/store').Updater} first - Function to receive first update.\r\n *\r\n * @param {import('svelte/store').Updater} update - Function to receive future updates.\r\n *\r\n * @returns {import('svelte/store').Unsubscriber} Store unsubscribe function.\r\n */\r\nfunction subscribeFirstRest(store, first, update)\r\n{\r\n let firedFirst = false;\r\n\r\n return store.subscribe((value) =>\r\n {\r\n if (!firedFirst)\r\n {\r\n firedFirst = true;\r\n first(value);\r\n }\r\n else\r\n {\r\n update(value);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * @external Store\r\n * @see [Svelte stores](https://svelte.dev/docs#component-format-script-4-prefix-stores-with-$-to-access-their-values-store-contract)\r\n */\r\n\r\n/**\r\n * Create a store similar to [Svelte's `derived`](https://svelte.dev/docs#run-time-svelte-store-writable),\r\n * but which has its own `set` and `update` methods and can send values back to the origin stores.\r\n * [Read more...](https://github.com/PixievoltNo1/svelte-writable-derived#default-export-writablederived)\r\n *\r\n * @param {Store|Store[]} origins One or more stores to derive from. Same as\r\n * [`derived`](https://svelte.dev/docs#run-time-svelte-store-writable)'s 1st parameter.\r\n * @param {!Function} derive The callback to determine the derived value. Same as\r\n * [`derived`](https://svelte.dev/docs#run-time-svelte-store-writable)'s 2nd parameter.\r\n * @param {!Function} reflect Called when the derived store gets a new value via its `set` or\r\n * `update` methods, and determines new values for the origin stores.\r\n * [Read more...](https://github.com/PixievoltNo1/svelte-writable-derived#new-parameter-reflect)\r\n * @param [initial] The new store's initial value. Same as\r\n * [`derived`](https://svelte.dev/docs#run-time-svelte-store-writable)'s 3rd parameter.\r\n *\r\n * @returns {Store} A writable store.\r\n */\r\nfunction writableDerived(origins, derive, reflect, initial) {\r\n\tvar childDerivedSetter, originValues, blockNextDerive = false;\r\n\tvar reflectOldValues = reflect.length >= 2;\r\n\tvar wrappedDerive = (got, set) => {\r\n\t\tchildDerivedSetter = set;\r\n\t\tif (reflectOldValues) {\r\n\t\t\toriginValues = got;\r\n\t\t}\r\n\t\tif (!blockNextDerive) {\r\n\t\t\tlet returned = derive(got, set);\r\n\t\t\tif (derive.length < 2) {\r\n\t\t\t\tset(returned);\r\n\t\t\t} else {\r\n\t\t\t\treturn returned;\r\n\t\t\t}\r\n\t\t}\r\n\t\tblockNextDerive = false;\r\n\t};\r\n\tvar childDerived = derived(origins, wrappedDerive, initial);\r\n\r\n\tvar singleOrigin = !Array.isArray(origins);\r\n\tfunction doReflect(reflecting) {\r\n\t\tvar setWith = reflect(reflecting, originValues);\r\n\t\tif (singleOrigin) {\r\n\t\t\tblockNextDerive = true;\r\n\t\t\torigins.set(setWith);\r\n\t\t} else {\r\n\t\t\tsetWith.forEach( (value, i) => {\r\n\t\t\t\tblockNextDerive = true;\r\n\t\t\t\torigins[i].set(value);\r\n\t\t\t} );\r\n\t\t}\r\n\t\tblockNextDerive = false;\r\n\t}\r\n\r\n\tvar tryingSet = false;\r\n\tfunction update(fn) {\r\n\t\tvar isUpdated, mutatedBySubscriptions, oldValue, newValue;\r\n\t\tif (tryingSet) {\r\n\t\t\tnewValue = fn( get(childDerived) );\r\n\t\t\tchildDerivedSetter(newValue);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar unsubscribe = childDerived.subscribe( (value) => {\r\n\t\t\tif (!tryingSet) {\r\n\t\t\t\toldValue = value;\r\n\t\t\t} else if (!isUpdated) {\r\n\t\t\t\tisUpdated = true;\r\n\t\t\t} else {\r\n\t\t\t\tmutatedBySubscriptions = true;\r\n\t\t\t}\r\n\t\t} );\r\n\t\tnewValue = fn(oldValue);\r\n\t\ttryingSet = true;\r\n\t\tchildDerivedSetter(newValue);\r\n\t\tunsubscribe();\r\n\t\ttryingSet = false;\r\n\t\tif (mutatedBySubscriptions) {\r\n\t\t\tnewValue = get(childDerived);\r\n\t\t}\r\n\t\tif (isUpdated) {\r\n\t\t\tdoReflect(newValue);\r\n\t\t}\r\n\t}\r\n\treturn {\r\n\t\tsubscribe: childDerived.subscribe,\r\n\t\tset(value) { update( () => value ); },\r\n\t\tupdate,\r\n\t};\r\n}\r\n\r\n/**\r\n * Create a store for a property value in an object contained in another store.\r\n * [Read more...](https://github.com/PixievoltNo1/svelte-writable-derived#named-export-propertystore)\r\n *\r\n * @param {Store} origin The store containing the object to get/set from.\r\n * @param {string|number|symbol|Array<string|number|symbol>} propName The property to get/set, or a path of\r\n * properties in nested objects.\r\n *\r\n * @returns {Store} A writable store.\r\n */\r\nfunction propertyStore(origin, propName) {\r\n\tif (!Array.isArray(propName)) {\r\n\t\treturn writableDerived(\r\n\t\t\torigin,\r\n\t\t\t(object) => object[propName],\r\n\t\t\t(reflecting, object) => {\r\n\t\t\t\tobject[propName] = reflecting;\r\n\t\t\t\treturn object;\r\n\t\t\t},\r\n\t\t);\r\n\t} else {\r\n\t\tlet props = propName.concat();\r\n\t\treturn writableDerived(\r\n\t\t\torigin,\r\n\t\t\t(value) => {\r\n\t\t\t\tfor (let i = 0; i < props.length; ++i) {\r\n\t\t\t\t\tvalue = value[ props[i] ];\r\n\t\t\t\t}\r\n\t\t\t\treturn value;\r\n\t\t\t},\r\n\t\t\t(reflecting, object) => {\r\n\t\t\t\tlet target = object;\r\n\t\t\t\tfor (let i = 0; i < props.length - 1; ++i) {\r\n\t\t\t\t\ttarget = target[ props[i] ];\r\n\t\t\t\t}\r\n\t\t\t\ttarget[ props[props.length - 1] ] = reflecting;\r\n\t\t\t\treturn object;\r\n\t\t\t},\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * Provides management of reactive embedded collections.\r\n *\r\n * TODO: Consider subscribing to TJSDocument rather than exposing {@link EmbeddedStoreManager.handleDocChange} and\r\n * {@link EmbeddedStoreManager.handleUpdate}\r\n */\r\nclass EmbeddedStoreManager\r\n{\r\n /**\r\n * RegExp for detecting CRUD updates for renderContext.\r\n *\r\n * @type {RegExp}\r\n */\r\n static #renderContextRegex = /(?<action>create|delete|update)(?<sep>\\.?)(?<name>\\w+)/;\r\n\r\n /**\r\n * @type {Map<string, EmbeddedCollectionData>}\r\n */\r\n #name = new Map();\r\n\r\n /**\r\n * @type {foundry.abstract.Document[]}\r\n */\r\n #document;\r\n\r\n /**\r\n * @type {Map<string, string>}\r\n */\r\n #collectionToDocName = new Map();\r\n\r\n /**\r\n * @type {Set<string>}\r\n */\r\n #embeddedNames = new Set();\r\n\r\n /**\r\n * @param {foundry.abstract.Document[]} document - The associated document holder.\r\n */\r\n constructor(document)\r\n {\r\n this.#document = document;\r\n\r\n this.handleDocChange();\r\n\r\n Object.seal(this);\r\n }\r\n\r\n /**\r\n * @template T\r\n *\r\n * @param {string} embeddedName -\r\n *\r\n * @param {import('@typhonjs-fvtt/svelte/store').OptionsDynMapCreate<string, T>} options -\r\n *\r\n * @returns {import('@typhonjs-fvtt/svelte/store').DynMapReducer<string, T>} DynMapReducer instance\r\n */\r\n create(embeddedName, options)\r\n {\r\n /** @type {foundry.abstract.Document} */\r\n const doc = this.#document[0];\r\n\r\n let collection = null;\r\n\r\n if (doc)\r\n {\r\n try\r\n {\r\n collection = doc.getEmbeddedCollection(embeddedName);\r\n }\r\n catch (err)\r\n {\r\n console.warn(`EmbeddedStoreManager.create error: No valid embedded collection for: ${embeddedName}`);\r\n }\r\n }\r\n\r\n let embeddedData;\r\n\r\n if (!this.#name.has(embeddedName))\r\n {\r\n embeddedData = {\r\n collection,\r\n stores: new Map()\r\n };\r\n\r\n this.#name.set(embeddedName, embeddedData);\r\n }\r\n else\r\n {\r\n embeddedData = this.#name.get(embeddedName);\r\n }\r\n\r\n /** @type {string} */\r\n let name;\r\n\r\n /** @type {import('@typhonjs-fvtt/svelte/store').DataOptions<T>} */\r\n let rest = {};\r\n\r\n /** @type {import('@typhonjs-fvtt/svelte/store').IDynMapReducerCtor<string, T>} */\r\n let ctor;\r\n\r\n if (typeof options === 'string')\r\n {\r\n name = options;\r\n ctor = DynMapReducer;\r\n }\r\n else if (typeof options === 'function' && hasPrototype(options, DynMapReducer))\r\n {\r\n ctor = options;\r\n }\r\n else if (isObject(options))\r\n {\r\n ({ name, ctor = DynMapReducer, ...rest } = options);\r\n }\r\n else\r\n {\r\n throw new TypeError(`EmbeddedStoreManager.create error: 'options' does not conform to allowed parameters.`);\r\n }\r\n\r\n if (!hasPrototype(ctor, DynMapReducer))\r\n {\r\n throw new TypeError(`EmbeddedStoreManager.create error: 'ctor' is not a 'DynMapReducer'.`);\r\n }\r\n\r\n name = name ?? ctor?.name;\r\n\r\n if (typeof name !== 'string') { throw new TypeError(`EmbeddedStoreManager.create error: 'name' is not a string.`); }\r\n\r\n if (embeddedData.stores.has(name))\r\n {\r\n return embeddedData.stores.get(name);\r\n }\r\n else\r\n {\r\n const storeOptions = collection ? { data: collection, ...rest } : { ...rest };\r\n const store = new ctor(storeOptions);\r\n embeddedData.stores.set(name, store);\r\n return store;\r\n }\r\n }\r\n\r\n /**\r\n * Destroys and removes embedded collection stores. Invoking this method with no parameters destroys all stores.\r\n * Invoking with an embedded name destroys all stores for that particular collection. If you provide an embedded and\r\n * store name just that particular store is destroyed and removed.\r\n *\r\n * @param {string} [embeddedName] - Specific embedded collection name.\r\n *\r\n * @param {string} [storeName] - Specific store name.\r\n *\r\n * @returns {boolean} One or more stores destroyed?\r\n */\r\n destroy(embeddedName, storeName)\r\n {\r\n let count = 0;\r\n\r\n // Destroy all embedded stores\r\n if (embeddedName === void 0)\r\n {\r\n for (const embeddedData of this.#name.values())\r\n {\r\n embeddedData.collection = null;\r\n for (const store of embeddedData.stores.values())\r\n {\r\n store.destroy();\r\n count++;\r\n }\r\n }\r\n\r\n this.#name.clear();\r\n }\r\n else if (typeof embeddedName === 'string' && storeName === void 0)\r\n {\r\n const embeddedData = this.#name.get(embeddedName);\r\n if (embeddedData)\r\n {\r\n embeddedData.collection = null;\r\n for (const store of embeddedData.stores.values())\r\n {\r\n store.destroy();\r\n count++;\r\n }\r\n }\r\n\r\n this.#name.delete(embeddedName);\r\n }\r\n else if (typeof embeddedName === 'string' && storeName === 'string')\r\n {\r\n const embeddedData = this.#name.get(embeddedName);\r\n if (embeddedData)\r\n {\r\n const store = embeddedData.stores.get(storeName);\r\n if (store)\r\n {\r\n store.destroy();\r\n count++;\r\n }\r\n }\r\n }\r\n\r\n return count > 0;\r\n }\r\n\r\n /**\r\n * @template T\r\n *\r\n * @param {string} embeddedName -\r\n *\r\n * @param {string} storeName -\r\n *\r\n * @returns {import('@typhonjs-fvtt/svelte/store').DynMapReducer<string, T>} DynMapReducer instance.\r\n */\r\n get(embeddedName, storeName)\r\n {\r\n if (!this.#name.has(embeddedName)) { return void 0; }\r\n\r\n return this.#name.get(embeddedName).stores.get(storeName);\r\n }\r\n\r\n /**\r\n * Updates all existing embedded collection stores with the associated embedded collection\r\n */\r\n handleDocChange()\r\n {\r\n const doc = this.#document[0];\r\n\r\n if (doc instanceof globalThis.foundry.abstract.Document)\r\n {\r\n const existingEmbeddedNames = new Set(this.#name.keys());\r\n\r\n /** @type {string[]} */\r\n const embeddedNames = Object.entries(doc.constructor?.metadata?.embedded ?? []);\r\n\r\n this.#collectionToDocName.clear();\r\n\r\n // Remove all previously stored embedded name CRUD keys.\r\n this.#embeddedNames.clear();\r\n\r\n for (const [docName, collectionName] of embeddedNames)\r\n {\r\n // Remove processed embedded doc name from existingEmbeddedNames set.\r\n existingEmbeddedNames.delete(docName);\r\n\r\n // Update CRUD keys for v10.\r\n this.#embeddedNames.add(`create${docName}`);\r\n this.#embeddedNames.add(`delete${docName}`);\r\n this.#embeddedNames.add(`update${docName}`);\r\n\r\n // Update CRUD keys for v11.\r\n this.#embeddedNames.add(`create.${collectionName}`);\r\n this.#embeddedNames.add(`delete.${collectionName}`);\r\n this.#embeddedNames.add(`update.${collectionName}`);\r\n\r\n // v10 collection to doc name lookup.\r\n this.#collectionToDocName.set(docName, docName);\r\n this.#collectionToDocName.set(collectionName, docName);\r\n\r\n let collection = null;\r\n\r\n try\r\n {\r\n // Update any existing stores with the actual collection.\r\n collection = doc.getEmbeddedCollection(docName);\r\n }\r\n catch (err)\r\n {\r\n console.warn(`EmbeddedStoreManager.handleDocUpdate error: No valid embedded collection for: ${docName}`);\r\n }\r\n\r\n // Update EmbeddedData for new collection.\r\n const embeddedData = this.#name.get(docName);\r\n if (embeddedData)\r\n {\r\n embeddedData.collection = collection;\r\n\r\n // Update all existing stores.\r\n for (const store of embeddedData.stores.values()) { store.setData(collection, true); }\r\n }\r\n }\r\n\r\n // Update all existing embedded collections with null data that aren't processed above.\r\n for (const embeddedName of existingEmbeddedNames)\r\n {\r\n const embeddedData = this.#name.get(embeddedName);\r\n if (embeddedData)\r\n {\r\n embeddedData.collection = null;\r\n\r\n for (const store of embeddedData.stores.values()) { store.setData(null, true); }\r\n }\r\n }\r\n }\r\n else // Reset all embedded reducer stores to null data.\r\n {\r\n this.#collectionToDocName.clear();\r\n this.#embeddedNames.clear();\r\n\r\n for (const embeddedData of this.#name.values())\r\n {\r\n embeddedData.collection = null;\r\n\r\n for (const store of embeddedData.stores.values()) { store.setData(null, true); }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Handles updates to embedded stores parsing the render context for valid embedded store types.\r\n *\r\n * On create, delete, update parse the type being modified then force index updates for the embedded type.\r\n *\r\n * @param {string} renderContext - render context update from document.\r\n */\r\n handleUpdate(renderContext)\r\n {\r\n if (!this.#embeddedNames.has(renderContext)) { return; }\r\n\r\n const match = EmbeddedStoreManager.#renderContextRegex.exec(renderContext);\r\n\r\n if (match)\r\n {\r\n const docOrCollectionName = match.groups.name;\r\n const embeddedName = this.#collectionToDocName.get(docOrCollectionName);\r\n\r\n if (!this.#name.has(embeddedName)) { return; }\r\n\r\n for (const store of this.#name.get(embeddedName).stores.values())\r\n {\r\n store.index.update(true);\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * @typedef {object} EmbeddedCollectionData\r\n *\r\n * @property {foundry.abstract.Collection} collection -\r\n *\r\n * @property {Map<string, import('@typhonjs-fvtt/svelte/store').DynMapReducer<string, T>>} stores -\r\n */\r\n\r\n/**\r\n * Provides a wrapper implementing the Svelte store / subscriber protocol around any Document / ClientMixinDocument.\r\n * This makes documents reactive in a Svelte component, but otherwise provides subscriber functionality external to\r\n * Svelte.\r\n */\r\nclass TJSDocument\r\n{\r\n /**\r\n * @type {foundry.abstract.Document[]}\r\n */\r\n #document = [void 0];\r\n\r\n /**\r\n * @type {EmbeddedStoreManager}\r\n */\r\n #embeddedStoreManager;\r\n #embeddedAPI;\r\n\r\n /**\r\n * @type {string}\r\n */\r\n #uuidv4;\r\n\r\n /**\r\n * @type {TJSDocumentOptions}\r\n */\r\n #options = { delete: void 0, preDelete: void 0 };\r\n\r\n #subscriptions = [];\r\n #updateOptions;\r\n\r\n /**\r\n * @param {foundry.abstract.Document | TJSDocumentOptions} [document] - Document to wrap or TJSDocumentOptions.\r\n *\r\n * @param {TJSDocumentOptions} [options] - TJSDocument options.\r\n */\r\n constructor(document, options = {})\r\n {\r\n this.#uuidv4 = `tjs-document-${uuidv4()}`;\r\n\r\n if (isPlainObject(document)) // Handle case when only options are passed into ctor.\r\n {\r\n this.setOptions(document);\r\n }\r\n else\r\n {\r\n this.setOptions(options);\r\n this.set(document);\r\n }\r\n }\r\n\r\n /**\r\n * @returns {EmbeddedAPI} Embedded store manager.\r\n */\r\n get embedded()\r\n {\r\n if (!this.#embeddedAPI)\r\n {\r\n this.#embeddedStoreManager = new EmbeddedStoreManager(this.#document);\r\n this.#embeddedAPI = {\r\n create: (embeddedName, options) => this.#embeddedStoreManager.create(embeddedName, options),\r\n destroy: (embeddedName, storeName) => this.#embeddedStoreManager.destroy(embeddedName, storeName),\r\n get: (embeddedName, storeName) => this.#embeddedStoreManager.get(embeddedName, storeName)\r\n };\r\n }\r\n\r\n return this.#embeddedAPI;\r\n }\r\n\r\n /**\r\n * Returns the options passed on last update.\r\n *\r\n * @returns {object} Last update options.\r\n */\r\n get updateOptions() { return this.#updateOptions ?? {}; }\r\n\r\n /**\r\n * Returns the UUID assigned to this store.\r\n *\r\n * @returns {string} UUID\r\n */\r\n get uuidv4() { return this.#uuidv4; }\r\n\r\n /**\r\n * Handles cleanup when the document is deleted. Invoking any optional delete function set in the constructor.\r\n *\r\n * @returns {Promise<void>}\r\n */\r\n async #deleted()\r\n {\r\n const doc = this.#document[0];\r\n\r\n // Check to see if the document is still in the associated collection to determine if actually deleted.\r\n if (doc instanceof globalThis.foundry.abstract.Document && !doc?.collection?.has(doc.id))\r\n {\r\n delete doc?.apps[this.#uuidv4];\r\n this.#setDocument(void 0);\r\n\r\n if (typeof this.#options.preDelete === 'function')\r\n {\r\n await this.#options.preDelete(doc);\r\n }\r\n\r\n this.#updateSubscribers(false, { action: 'delete', data: void 0 });\r\n\r\n if (typeof this.#options.delete === 'function')\r\n {\r\n await this.#options.delete(doc);\r\n }\r\n\r\n this.#updateOptions = void 0;\r\n }\r\n }\r\n\r\n /**\r\n * Completely removes all internal subscribers, any optional delete callback, and unregisters from the\r\n * ClientDocumentMixin `apps` tracking object.\r\n */\r\n destroy()\r\n {\r\n const doc = this.#document[0];\r\n\r\n if (this.#embeddedStoreManager)\r\n {\r\n this.#embeddedStoreManager.destroy();\r\n this.#embeddedStoreManager = void 0;\r\n this.#embeddedAPI = void 0;\r\n }\r\n\r\n if (doc instanceof globalThis.foundry.abstract.Document)\r\n {\r\n delete doc?.apps[this.#uuidv4];\r\n this.#setDocument(void 0);\r\n }\r\n\r\n this.#options.delete = void 0;\r\n this.#subscriptions.length = 0;\r\n }\r\n\r\n /**\r\n * @param {boolean} [force] - unused - signature from Foundry render function.\r\n *\r\n * @param {object} [options] - Options from render call; will have document update context.\r\n */\r\n #updateSubscribers(force = false, options = {}) // eslint-disable-line no-unused-vars\r\n {\r\n this.#updateOptions = options;\r\n\r\n const doc = this.#document[0];\r\n\r\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) { this.#subscriptions[cntr](doc, options); }\r\n\r\n if (this.#embeddedStoreManager)\r\n {\r\n this.#embeddedStoreManager.handleUpdate(options.renderContext);\r\n }\r\n }\r\n\r\n /**\r\n * @returns {foundry.abstract.Document | undefined} Current document\r\n */\r\n get() { return this.#document[0]; }\r\n\r\n /**\r\n * @param {foundry.abstract.Document | undefined} document - New document to set.\r\n *\r\n * @param {object} [options] - New document update options to set.\r\n */\r\n set(document, options = {})\r\n {\r\n if (this.#document[0])\r\n {\r\n delete this.#document[0].apps[this.#uuidv4];\r\n }\r\n\r\n if (document !== void 0 && !(document instanceof globalThis.foundry.abstract.Document))\r\n {\r\n throw new TypeError(`TJSDocument set error: 'document' is not a valid Document or undefined.`);\r\n }\r\n\r\n if (options === null || typeof options !== 'object')\r\n {\r\n throw new TypeError(`TJSDocument set error: 'options' is not an object.`);\r\n }\r\n\r\n if (document instanceof globalThis.foundry.abstract.Document)\r\n {\r\n document.apps[this.#uuidv4] = {\r\n close: this.#deleted.bind(this),\r\n render: this.#updateSubscribers.bind(this)\r\n };\r\n }\r\n\r\n this.#setDocument(document);\r\n this.#updateOptions = options;\r\n this.#updateSubscribers();\r\n }\r\n\r\n /**\r\n *\r\n * @param {foundry.abstract.Document | undefined} doc -\r\n */\r\n #setDocument(doc)\r\n {\r\n this.#document[0] = doc;\r\n\r\n if (this.#embeddedStoreManager) { this.#embeddedStoreManager.handleDocChange(); }\r\n }\r\n\r\n /**\r\n * Potentially sets new document from data transfer object.\r\n *\r\n * @param {object} data - Document transfer data.\r\n *\r\n * @param {ParseDataTransferOptions & TJSDocumentOptions} [options] - Optional parameters.\r\n *\r\n * @returns {Promise<boolean>} Returns true if new document set from data transfer blob.\r\n */\r\n async setFromDataTransfer(data, options)\r\n {\r\n return this.setFromUUID(getUUIDFromDataTransfer(data, options), options);\r\n }\r\n\r\n /**\r\n * Sets the document by Foundry UUID performing a lookup and setting the document if found.\r\n *\r\n * @param {string} uuid - A Foundry UUID to lookup.\r\n *\r\n * @param {TJSDocumentOptions} [options] - New document update options to set.\r\n *\r\n * @returns {Promise<boolean>} True if successfully set document from UUID.\r\n */\r\n async setFromUUID(uuid, options = {})\r\n {\r\n if (typeof uuid !== 'string' || uuid.length === 0) { return false; }\r\n\r\n try\r\n {\r\n const doc = await globalThis.fromUuid(uuid);\r\n\r\n if (doc)\r\n {\r\n this.set(doc, options);\r\n return true;\r\n }\r\n }\r\n catch (err) { /**/ }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Sets options for this document wrapper / store.\r\n *\r\n * @param {TJSDocumentOptions} options - Options for TJSDocument.\r\n */\r\n setOptions(options)\r\n {\r\n if (!isObject(options))\r\n {\r\n throw new TypeError(`TJSDocument error: 'options' is not a plain object.`);\r\n }\r\n\r\n // Verify valid values -------------\r\n\r\n if (options.delete !== void 0 && typeof options.delete !== 'function')\r\n {\r\n throw new TypeError(`TJSDocument error: 'delete' attribute in options is not a function.`);\r\n }\r\n\r\n if (options.preDelete !== void 0 && typeof options.preDelete !== 'function')\r\n {\r\n throw new TypeError(`TJSDocument error: 'preDelete' attribute in options is not a function.`);\r\n }\r\n\r\n // Set any valid values -------------\r\n\r\n if (options.delete === void 0 || typeof options.delete === 'function')\r\n {\r\n this.#options.delete = options.delete;\r\n }\r\n\r\n if (options.preDelete === void 0 || typeof options.preDelete === 'function')\r\n {\r\n this.#options.preDelete = options.preDelete;\r\n }\r\n }\r\n\r\n /**\r\n * @param {function(foundry.abstract.Document, object): void} handler - Callback function that is invoked on update / changes.\r\n *\r\n * @returns {(function(): void)} Unsubscribe function.\r\n */\r\n subscribe(handler)\r\n {\r\n this.#subscriptions.push(handler); // Add handler to the array of subscribers.\r\n\r\n const updateOptions = { action: 'subscribe', data: void 0 };\r\n\r\n handler(this.#document[0], updateOptions); // Call handler with current value and update options.\r\n\r\n // Return unsubscribe function.\r\n return () =>\r\n {\r\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\r\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * @typedef {object} TJSDocumentOptions\r\n *\r\n * @property {(doc: foundry.abstract.Document) => void} [delete] - Optional post delete function to invoke when\r\n * document is deleted _after_ subscribers have been notified.\r\n *\r\n * @property {(doc: foundry.abstract.Document) => void} [preDelete] - Optional pre delete function to invoke when\r\n * document is deleted _before_ subscribers are notified.\r\n */\r\n\r\n/**\r\n * @typedef {object} EmbeddedAPI\r\n *\r\n * @property {(embeddedName: string, options: import('@typhonjs-fvtt/runtime/svelte/store').OptionsDynMapCreate<string, any>) => import('@typhonjs-fvtt/runtime/svelte/store').DynMapReducer<string, T>} create - Creates an embedded collection store.\r\n *\r\n * @property {(embeddedName?: string, storeName?: string) => boolean} destroy - Destroys one or more embedded collection stores.\r\n *\r\n * @property {(embeddedName: string, storeName: string) => import('@typhonjs-fvtt/runtime/svelte/store').DynMapReducer<string, T>} get - Returns a specific existing embedded collection store.\r\n */\r\n\r\n/**\r\n * Provides a wrapper implementing the Svelte store / subscriber protocol around any DocumentCollection. This makes\r\n * document collections reactive in a Svelte component, but otherwise provides subscriber functionality external to\r\n * Svelte.\r\n *\r\n * @template {DocumentCollection} T\r\n */\r\nclass TJSDocumentCollection\r\n{\r\n #collection;\r\n #collectionCallback;\r\n #uuid;\r\n\r\n /**\r\n * @type {TJSDocumentCollectionOptions}\r\n */\r\n #options = { delete: void 0, preDelete: void 0 };\r\n\r\n #subscriptions = [];\r\n #updateOptions;\r\n\r\n /**\r\n * @param {T|TJSDocumentCollectionOptions} [collection] - Collection to wrap or TJSDocumentCollectionOptions.\r\n *\r\n * @param {TJSDocumentCollectionOptions} [options] - TJSDocumentCollection options.\r\n */\r\n constructor(collection, options = {})\r\n {\r\n this.#uuid = `tjs-collection-${uuidv4()}`;\r\n\r\n if (isPlainObject(collection)) // Handle case when only options are passed into ctor.\r\n {\r\n this.setOptions(collection);\r\n }\r\n else\r\n {\r\n this.setOptions(options);\r\n this.set(collection);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the options passed on last update.\r\n *\r\n * @returns {object} Last update options.\r\n */\r\n get updateOptions() { return this.#updateOptions ?? {}; }\r\n\r\n /**\r\n * Returns the UUID assigned to this store.\r\n *\r\n * @returns {*} UUID\r\n */\r\n get uuid() { return this.#uuid; }\r\n\r\n /**\r\n * Handles cleanup when the collection is deleted. Invoking any optional delete function set in the constructor.\r\n *\r\n * @returns {Promise<void>}\r\n */\r\n async #deleted()\r\n {\r\n const collection = this.#collection;\r\n\r\n if (collection instanceof DocumentCollection)\r\n {\r\n const index = collection?.apps?.findIndex((sub) => sub === this.#collectionCallback);\r\n if (index >= 0) { collection?.apps?.splice(index, 1); }\r\n\r\n this.#collection = void 0;\r\n }\r\n\r\n if (typeof this.#options.preDelete === 'function')\r\n {\r\n await this.#options.preDelete(collection);\r\n }\r\n\r\n this.#notify(false, { action: 'delete', documentType: collection.documentName, documents: [], data: [] });\r\n\r\n if (typeof this.#options.delete === 'function')\r\n {\r\n await this.#options.delete(collection);\r\n }\r\n\r\n this.#updateOptions = void 0;\r\n }\r\n\r\n /**\r\n * Completely removes all internal subscribers, any optional delete callback, and unregisters from the\r\n * DocumentCollection `apps` tracking array.\r\n */\r\n destroy()\r\n {\r\n const collection = this.#collection;\r\n\r\n if (collection instanceof DocumentCollection)\r\n {\r\n const index = collection?.apps?.findIndex((sub) => sub === this.#collectionCallback);\r\n if (index >= 0) { collection?.apps?.splice(index, 1); }\r\n\r\n this.#collection = void 0;\r\n }\r\n\r\n this.#options.delete = void 0;\r\n this.#subscriptions.length = 0;\r\n }\r\n\r\n /**\r\n * @param {boolean} [force] - unused - signature from Foundry render function.\r\n *\r\n * @param {object} [options] - Options from render call; will have collection update context.\r\n */\r\n #notify(force = false, options = {}) // eslint-disable-line no-unused-vars\r\n {\r\n this.#updateOptions = options;\r\n\r\n // Subscriptions are stored locally as on the browser Babel is still used for private class fields / Babel\r\n // support until 2023. IE not doing this will require several extra method calls otherwise.\r\n const subscriptions = this.#subscriptions;\r\n const collection = this.#collection;\r\n\r\n for (let cntr = 0; cntr < subscriptions.length; cntr++) { subscriptions[cntr](collection, options); }\r\n }\r\n\r\n /**\r\n * @returns {T | undefined} Current collection\r\n */\r\n get() { return this.#collection; }\r\n\r\n /**\r\n * @param {T | undefined} collection - New collection to set.\r\n *\r\n * @param {object} [options] - New collection update options to set.\r\n */\r\n set(collection, options = {})\r\n {\r\n if (this.#collection)\r\n {\r\n const index = this.#collection.apps.findIndex((sub) => sub === this.#collectionCallback);\r\n if (index >= 0) { this.#collection.apps.splice(index, 1); }\r\n\r\n this.#collectionCallback = void 0;\r\n }\r\n\r\n if (collection !== void 0 && !(collection instanceof DocumentCollection))\r\n {\r\n throw new TypeError(\r\n `TJSDocumentCollection set error: 'collection' is not a valid DocumentCollection or undefined.`);\r\n }\r\n\r\n if (!isObject(options))\r\n {\r\n throw new TypeError(`TJSDocument set error: 'options' is not an object.`);\r\n }\r\n\r\n if (collection instanceof DocumentCollection)\r\n {\r\n this.#collectionCallback = {\r\n close: this.#deleted.bind(this),\r\n render: this.#notify.bind(this)\r\n };\r\n\r\n collection?.apps?.push(this.#collectionCallback);\r\n }\r\n\r\n this.#collection = collection;\r\n this.#updateOptions = options;\r\n this.#notify();\r\n }\r\n\r\n /**\r\n * Sets options for this collection wrapper / store.\r\n *\r\n * @param {TJSDocumentCollectionOptions} options - Options for TJSDocumentCollection.\r\n */\r\n setOptions(options)\r\n {\r\n if (!isObject(options))\r\n {\r\n throw new TypeError(`TJSDocumentCollection error: 'options' is not an object.`);\r\n }\r\n\r\n // Verify valid values -------------\r\n\r\n if (options.delete !== void 0 && typeof options.delete !== 'function')\r\n {\r\n throw new TypeError(`TJSDocumentCollection error: 'delete' attribute in options is not a function.`);\r\n }\r\n\r\n if (options.preDelete !== void 0 && typeof options.preDelete !== 'function')\r\n {\r\n throw new TypeError(`TJSDocumentCollection error: 'preDelete' attribute in options is not a function.`);\r\n }\r\n\r\n // Set any valid values -------------\r\n\r\n if (options.delete === void 0 || typeof options.delete === 'function')\r\n {\r\n this.#options.delete = options.delete;\r\n }\r\n\r\n if (options.preDelete === void 0 || typeof options.preDelete === 'function')\r\n {\r\n this.#options.preDelete = options.preDelete;\r\n }\r\n }\r\n\r\n /**\r\n * @param {function(T, object): void} handler - Callback function that is invoked on update / changes.\r\n *\r\n * @returns {(function(): void)} Unsubscribe function.\r\n */\r\n subscribe(handler)\r\n {\r\n this.#subscriptions.push(handler); // Add handler to the array of subscribers.\r\n\r\n const collection = this.#collection;\r\n\r\n const documentType = collection?.documentName ?? void 0;\r\n\r\n const updateOptions = { action: 'subscribe', documentType, documents: [], data: [] };\r\n\r\n handler(collection, updateOptions); // Call handler with current value and update options.\r\n\r\n // Return unsubscribe function.\r\n return () =>\r\n {\r\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\r\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * @typedef TJSDocumentCollectionOptions\r\n *\r\n * @property {(collection: foundry.abstract.DocumentCollection) => void} [delete] - Optional post delete function\r\n * to invoke when document is deleted _after_ subscribers have been notified.\r\n *\r\n * @property {(collection: foundry.abstract.DocumentCollection) => void} [preDelete] - Optional pre delete function to\r\n * invoke when document is deleted _before_ subscribers are notified.\r\n */\r\n\r\nconst storeState = writable$2(void 0);\r\n\r\n/**\r\n * @type {GameState} Provides a Svelte store wrapping the Foundry runtime / global game state.\r\n */\r\nconst gameState = {\r\n subscribe: storeState.subscribe,\r\n get: () => game\r\n};\r\n\r\nObject.freeze(gameState);\r\n\r\nHooks.once('ready', () => storeState.set(game));\r\n\r\nexport { DerivedArrayReducer, DerivedMapReducer, DynArrayReducer, DynMapReducer, KeyStore, TJSDocument, TJSDocumentCollection, TJSLocalStorage, TJSSessionStorage, gameState, isReadableStore, isUpdatableStore, isWritableStore, propertyStore, subscribeFirstRest, subscribeIgnoreFirst, writableDerived };\r\n//# sourceMappingURL=index.js.map\r\n","export { identity as linear } from '../internal/index.mjs';\n\n/*\nAdapted from https://github.com/mattdesl\nDistributed under MIT License https://github.com/mattdesl/eases/blob/master/LICENSE.md\n*/\nfunction backInOut(t) {\n const s = 1.70158 * 1.525;\n if ((t *= 2) < 1)\n return 0.5 * (t * t * ((s + 1) * t - s));\n return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2);\n}\nfunction backIn(t) {\n const s = 1.70158;\n return t * t * ((s + 1) * t - s);\n}\nfunction backOut(t) {\n const s = 1.70158;\n return --t * t * ((s + 1) * t + s) + 1;\n}\nfunction bounceOut(t) {\n const a = 4.0 / 11.0;\n const b = 8.0 / 11.0;\n const c = 9.0 / 10.0;\n const ca = 4356.0 / 361.0;\n const cb = 35442.0 / 1805.0;\n const cc = 16061.0 / 1805.0;\n const t2 = t * t;\n return t < a\n ? 7.5625 * t2\n : t < b\n ? 9.075 * t2 - 9.9 * t + 3.4\n : t < c\n ? ca * t2 - cb * t + cc\n : 10.8 * t * t - 20.52 * t + 10.72;\n}\nfunction bounceInOut(t) {\n return t < 0.5\n ? 0.5 * (1.0 - bounceOut(1.0 - t * 2.0))\n : 0.5 * bounceOut(t * 2.0 - 1.0) + 0.5;\n}\nfunction bounceIn(t) {\n return 1.0 - bounceOut(1.0 - t);\n}\nfunction circInOut(t) {\n if ((t *= 2) < 1)\n return -0.5 * (Math.sqrt(1 - t * t) - 1);\n return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);\n}\nfunction circIn(t) {\n return 1.0 - Math.sqrt(1.0 - t * t);\n}\nfunction circOut(t) {\n return Math.sqrt(1 - --t * t);\n}\nfunction cubicInOut(t) {\n return t < 0.5 ? 4.0 * t * t * t : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0;\n}\nfunction cubicIn(t) {\n return t * t * t;\n}\nfunction cubicOut(t) {\n const f = t - 1.0;\n return f * f * f + 1.0;\n}\nfunction elasticInOut(t) {\n return t < 0.5\n ? 0.5 *\n Math.sin(((+13.0 * Math.PI) / 2) * 2.0 * t) *\n Math.pow(2.0, 10.0 * (2.0 * t - 1.0))\n : 0.5 *\n Math.sin(((-13.0 * Math.PI) / 2) * (2.0 * t - 1.0 + 1.0)) *\n Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) +\n 1.0;\n}\nfunction elasticIn(t) {\n return Math.sin((13.0 * t * Math.PI) / 2) * Math.pow(2.0, 10.0 * (t - 1.0));\n}\nfunction elasticOut(t) {\n return (Math.sin((-13.0 * (t + 1.0) * Math.PI) / 2) * Math.pow(2.0, -10.0 * t) + 1.0);\n}\nfunction expoInOut(t) {\n return t === 0.0 || t === 1.0\n ? t\n : t < 0.5\n ? +0.5 * Math.pow(2.0, 20.0 * t - 10.0)\n : -0.5 * Math.pow(2.0, 10.0 - t * 20.0) + 1.0;\n}\nfunction expoIn(t) {\n return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0));\n}\nfunction expoOut(t) {\n return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t);\n}\nfunction quadInOut(t) {\n t /= 0.5;\n if (t < 1)\n return 0.5 * t * t;\n t--;\n return -0.5 * (t * (t - 2) - 1);\n}\nfunction quadIn(t) {\n return t * t;\n}\nfunction quadOut(t) {\n return -t * (t - 2.0);\n}\nfunction quartInOut(t) {\n return t < 0.5\n ? +8.0 * Math.pow(t, 4.0)\n : -8.0 * Math.pow(t - 1.0, 4.0) + 1.0;\n}\nfunction quartIn(t) {\n return Math.pow(t, 4.0);\n}\nfunction quartOut(t) {\n return Math.pow(t - 1.0, 3.0) * (1.0 - t) + 1.0;\n}\nfunction quintInOut(t) {\n if ((t *= 2) < 1)\n return 0.5 * t * t * t * t * t;\n return 0.5 * ((t -= 2) * t * t * t * t + 2);\n}\nfunction quintIn(t) {\n return t * t * t * t * t;\n}\nfunction quintOut(t) {\n return --t * t * t * t * t + 1;\n}\nfunction sineInOut(t) {\n return -0.5 * (Math.cos(Math.PI * t) - 1);\n}\nfunction sineIn(t) {\n const v = Math.cos(t * Math.PI * 0.5);\n if (Math.abs(v) < 1e-14)\n return 1;\n else\n return 1 - v;\n}\nfunction sineOut(t) {\n return Math.sin((t * Math.PI) / 2);\n}\n\nexport { backIn, backInOut, backOut, bounceIn, bounceInOut, bounceOut, circIn, circInOut, circOut, cubicIn, cubicInOut, cubicOut, elasticIn, elasticInOut, elasticOut, expoIn, expoInOut, expoOut, quadIn, quadInOut, quadOut, quartIn, quartInOut, quartOut, quintIn, quintInOut, quintOut, sineIn, sineInOut, sineOut };\n","/**\n * Performs linear interpolation between a start & end value by given amount between 0 - 1 inclusive.\n *\n * @param {number} start - Start value.\n *\n * @param {number} end - End value.\n *\n * @param {number} amount - Current amount between 0 - 1 inclusive.\n *\n * @returns {number} Linear interpolated value between start & end.\n */\nfunction lerp$5(start, end, amount)\n{\n return (1 - amount) * start + amount * end;\n}\n\n/**\n * Converts the given number from degrees to radians.\n *\n * @param {number} deg - Degree number to convert\n *\n * @returns {number} Degree as radians.\n */\nfunction degToRad(deg)\n{\n return deg * (Math.PI / 180.0);\n}\n\n/**\n * Converts the given number from radians to degrees.\n *\n * @param {number} rad - Radian number to convert.\n *\n * @returns {number} Degree as radians.\n */\nfunction radToDeg(rad)\n{\n return rad * (180.0 / Math.PI);\n}\n\n/**\n * Common utilities\n * @module glMatrix\n */\n// Configuration Constants\nvar EPSILON = 0.000001;\nvar ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;\nvar RANDOM = Math.random;\n/**\n * Sets the type of array used when creating new vectors and matrices\n *\n * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array\n */\n\nfunction setMatrixArrayType(type) {\n ARRAY_TYPE = type;\n}\nvar degree = Math.PI / 180;\n/**\n * Convert Degree To Radian\n *\n * @param {Number} a Angle in Degrees\n */\n\nfunction toRadian(a) {\n return a * degree;\n}\n/**\n * Tests whether or not the arguments have approximately the same value, within an absolute\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\n * than or equal to 1.0, and a relative tolerance is used for larger values)\n *\n * @param {Number} a The first number to test.\n * @param {Number} b The second number to test.\n * @returns {Boolean} True if the numbers are approximately equal, false otherwise.\n */\n\nfunction equals$9(a, b) {\n return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));\n}\nif (!Math.hypot) Math.hypot = function () {\n var y = 0,\n i = arguments.length;\n\n while (i--) {\n y += arguments[i] * arguments[i];\n }\n\n return Math.sqrt(y);\n};\n\nconst common = /*#__PURE__*/Object.freeze({\n __proto__: null,\n get ARRAY_TYPE () { return ARRAY_TYPE; },\n EPSILON: EPSILON,\n RANDOM: RANDOM,\n equals: equals$9,\n setMatrixArrayType: setMatrixArrayType,\n toRadian: toRadian\n});\n\n/**\n * 2x2 Matrix\n * @module mat2\n */\n\n/**\n * Creates a new identity mat2\n *\n * @returns {mat2} a new 2x2 matrix\n */\n\nfunction create$8() {\n var out = new ARRAY_TYPE(4);\n\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n }\n\n out[0] = 1;\n out[3] = 1;\n return out;\n}\n/**\n * Creates a new mat2 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat2} a matrix to clone\n * @returns {mat2} a new 2x2 matrix\n */\n\nfunction clone$8(a) {\n var out = new ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Copy the values from one mat2 to another\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the source matrix\n * @returns {mat2} out\n */\n\nfunction copy$8(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Set a mat2 to the identity matrix\n *\n * @param {mat2} out the receiving matrix\n * @returns {mat2} out\n */\n\nfunction identity$5(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\n * Create a new mat2 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m10 Component in column 1, row 0 position (index 2)\n * @param {Number} m11 Component in column 1, row 1 position (index 3)\n * @returns {mat2} out A new 2x2 matrix\n */\n\nfunction fromValues$8(m00, m01, m10, m11) {\n var out = new ARRAY_TYPE(4);\n out[0] = m00;\n out[1] = m01;\n out[2] = m10;\n out[3] = m11;\n return out;\n}\n/**\n * Set the components of a mat2 to the given values\n *\n * @param {mat2} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m10 Component in column 1, row 0 position (index 2)\n * @param {Number} m11 Component in column 1, row 1 position (index 3)\n * @returns {mat2} out\n */\n\nfunction set$8(out, m00, m01, m10, m11) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m10;\n out[3] = m11;\n return out;\n}\n/**\n * Transpose the values of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the source matrix\n * @returns {mat2} out\n */\n\nfunction transpose$2(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache\n // some values\n if (out === a) {\n var a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n\n return out;\n}\n/**\n * Inverts a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the source matrix\n * @returns {mat2} out\n */\n\nfunction invert$5(out, a) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3]; // Calculate the determinant\n\n var det = a0 * a3 - a2 * a1;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the source matrix\n * @returns {mat2} out\n */\n\nfunction adjoint$2(out, a) {\n // Caching this value is nessecary if out == a\n var a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n return out;\n}\n/**\n * Calculates the determinant of a mat2\n *\n * @param {ReadonlyMat2} a the source matrix\n * @returns {Number} determinant of a\n */\n\nfunction determinant$3(a) {\n return a[0] * a[3] - a[2] * a[1];\n}\n/**\n * Multiplies two mat2's\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the first operand\n * @param {ReadonlyMat2} b the second operand\n * @returns {mat2} out\n */\n\nfunction multiply$8(out, a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n}\n/**\n * Rotates a mat2 by the given angle\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\n\nfunction rotate$4(out, a, rad) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n}\n/**\n * Scales the mat2 by the dimensions in the given vec2\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the matrix to rotate\n * @param {ReadonlyVec2} v the vec2 to scale the matrix by\n * @returns {mat2} out\n **/\n\nfunction scale$8(out, a, v) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var v0 = v[0],\n v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n}\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.rotate(dest, dest, rad);\n *\n * @param {mat2} out mat2 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\n\nfunction fromRotation$4(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.scale(dest, dest, vec);\n *\n * @param {mat2} out mat2 receiving operation result\n * @param {ReadonlyVec2} v Scaling vector\n * @returns {mat2} out\n */\n\nfunction fromScaling$3(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n return out;\n}\n/**\n * Returns a string representation of a mat2\n *\n * @param {ReadonlyMat2} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\n\nfunction str$8(a) {\n return \"mat2(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \")\";\n}\n/**\n * Returns Frobenius norm of a mat2\n *\n * @param {ReadonlyMat2} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\n\nfunction frob$3(a) {\n return Math.hypot(a[0], a[1], a[2], a[3]);\n}\n/**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @param {ReadonlyMat2} L the lower triangular matrix\n * @param {ReadonlyMat2} D the diagonal matrix\n * @param {ReadonlyMat2} U the upper triangular matrix\n * @param {ReadonlyMat2} a the input matrix to factorize\n */\n\nfunction LDU(L, D, U, a) {\n L[2] = a[2] / a[0];\n U[0] = a[0];\n U[1] = a[1];\n U[3] = a[3] - L[2] * U[1];\n return [L, D, U];\n}\n/**\n * Adds two mat2's\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the first operand\n * @param {ReadonlyMat2} b the second operand\n * @returns {mat2} out\n */\n\nfunction add$8(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the first operand\n * @param {ReadonlyMat2} b the second operand\n * @returns {mat2} out\n */\n\nfunction subtract$6(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat2} a The first matrix.\n * @param {ReadonlyMat2} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction exactEquals$8(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat2} a The first matrix.\n * @param {ReadonlyMat2} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction equals$8(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat2} out\n */\n\nfunction multiplyScalar$3(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\n * Adds two mat2's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat2} out the receiving vector\n * @param {ReadonlyMat2} a the first operand\n * @param {ReadonlyMat2} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat2} out\n */\n\nfunction multiplyScalarAndAdd$3(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\n * Alias for {@link mat2.multiply}\n * @function\n */\n\nvar mul$8 = multiply$8;\n/**\n * Alias for {@link mat2.subtract}\n * @function\n */\n\nvar sub$6 = subtract$6;\n\nconst mat2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n LDU: LDU,\n add: add$8,\n adjoint: adjoint$2,\n clone: clone$8,\n copy: copy$8,\n create: create$8,\n determinant: determinant$3,\n equals: equals$8,\n exactEquals: exactEquals$8,\n frob: frob$3,\n fromRotation: fromRotation$4,\n fromScaling: fromScaling$3,\n fromValues: fromValues$8,\n identity: identity$5,\n invert: invert$5,\n mul: mul$8,\n multiply: multiply$8,\n multiplyScalar: multiplyScalar$3,\n multiplyScalarAndAdd: multiplyScalarAndAdd$3,\n rotate: rotate$4,\n scale: scale$8,\n set: set$8,\n str: str$8,\n sub: sub$6,\n subtract: subtract$6,\n transpose: transpose$2\n});\n\n/**\n * 2x3 Matrix\n * @module mat2d\n * @description\n * A mat2d contains six elements defined as:\n * <pre>\n * [a, b,\n * c, d,\n * tx, ty]\n * </pre>\n * This is a short form for the 3x3 matrix:\n * <pre>\n * [a, b, 0,\n * c, d, 0,\n * tx, ty, 1]\n * </pre>\n * The last column is ignored so the array is shorter and operations are faster.\n */\n\n/**\n * Creates a new identity mat2d\n *\n * @returns {mat2d} a new 2x3 matrix\n */\n\nfunction create$7() {\n var out = new ARRAY_TYPE(6);\n\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[4] = 0;\n out[5] = 0;\n }\n\n out[0] = 1;\n out[3] = 1;\n return out;\n}\n/**\n * Creates a new mat2d initialized with values from an existing matrix\n *\n * @param {ReadonlyMat2d} a matrix to clone\n * @returns {mat2d} a new 2x3 matrix\n */\n\nfunction clone$7(a) {\n var out = new ARRAY_TYPE(6);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n}\n/**\n * Copy the values from one mat2d to another\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the source matrix\n * @returns {mat2d} out\n */\n\nfunction copy$7(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n}\n/**\n * Set a mat2d to the identity matrix\n *\n * @param {mat2d} out the receiving matrix\n * @returns {mat2d} out\n */\n\nfunction identity$4(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n/**\n * Create a new mat2d with the given values\n *\n * @param {Number} a Component A (index 0)\n * @param {Number} b Component B (index 1)\n * @param {Number} c Component C (index 2)\n * @param {Number} d Component D (index 3)\n * @param {Number} tx Component TX (index 4)\n * @param {Number} ty Component TY (index 5)\n * @returns {mat2d} A new mat2d\n */\n\nfunction fromValues$7(a, b, c, d, tx, ty) {\n var out = new ARRAY_TYPE(6);\n out[0] = a;\n out[1] = b;\n out[2] = c;\n out[3] = d;\n out[4] = tx;\n out[5] = ty;\n return out;\n}\n/**\n * Set the components of a mat2d to the given values\n *\n * @param {mat2d} out the receiving matrix\n * @param {Number} a Component A (index 0)\n * @param {Number} b Component B (index 1)\n * @param {Number} c Component C (index 2)\n * @param {Number} d Component D (index 3)\n * @param {Number} tx Component TX (index 4)\n * @param {Number} ty Component TY (index 5)\n * @returns {mat2d} out\n */\n\nfunction set$7(out, a, b, c, d, tx, ty) {\n out[0] = a;\n out[1] = b;\n out[2] = c;\n out[3] = d;\n out[4] = tx;\n out[5] = ty;\n return out;\n}\n/**\n * Inverts a mat2d\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the source matrix\n * @returns {mat2d} out\n */\n\nfunction invert$4(out, a) {\n var aa = a[0],\n ab = a[1],\n ac = a[2],\n ad = a[3];\n var atx = a[4],\n aty = a[5];\n var det = aa * ad - ab * ac;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n}\n/**\n * Calculates the determinant of a mat2d\n *\n * @param {ReadonlyMat2d} a the source matrix\n * @returns {Number} determinant of a\n */\n\nfunction determinant$2(a) {\n return a[0] * a[3] - a[1] * a[2];\n}\n/**\n * Multiplies two mat2d's\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the first operand\n * @param {ReadonlyMat2d} b the second operand\n * @returns {mat2d} out\n */\n\nfunction multiply$7(out, a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n}\n/**\n * Rotates a mat2d by the given angle\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\n\nfunction rotate$3(out, a, rad) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5];\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n out[4] = a4;\n out[5] = a5;\n return out;\n}\n/**\n * Scales the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to translate\n * @param {ReadonlyVec2} v the vec2 to scale the matrix by\n * @returns {mat2d} out\n **/\n\nfunction scale$7(out, a, v) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5];\n var v0 = v[0],\n v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n out[4] = a4;\n out[5] = a5;\n return out;\n}\n/**\n * Translates the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to translate\n * @param {ReadonlyVec2} v the vec2 to translate the matrix by\n * @returns {mat2d} out\n **/\n\nfunction translate$3(out, a, v) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5];\n var v0 = v[0],\n v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\n return out;\n}\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.rotate(dest, dest, rad);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\n\nfunction fromRotation$3(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.scale(dest, dest, vec);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {ReadonlyVec2} v Scaling vector\n * @returns {mat2d} out\n */\n\nfunction fromScaling$2(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.translate(dest, dest, vec);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {ReadonlyVec2} v Translation vector\n * @returns {mat2d} out\n */\n\nfunction fromTranslation$3(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = v[0];\n out[5] = v[1];\n return out;\n}\n/**\n * Returns a string representation of a mat2d\n *\n * @param {ReadonlyMat2d} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\n\nfunction str$7(a) {\n return \"mat2d(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \")\";\n}\n/**\n * Returns Frobenius norm of a mat2d\n *\n * @param {ReadonlyMat2d} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\n\nfunction frob$2(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], 1);\n}\n/**\n * Adds two mat2d's\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the first operand\n * @param {ReadonlyMat2d} b the second operand\n * @returns {mat2d} out\n */\n\nfunction add$7(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the first operand\n * @param {ReadonlyMat2d} b the second operand\n * @returns {mat2d} out\n */\n\nfunction subtract$5(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat2d} out\n */\n\nfunction multiplyScalar$2(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n return out;\n}\n/**\n * Adds two mat2d's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat2d} out the receiving vector\n * @param {ReadonlyMat2d} a the first operand\n * @param {ReadonlyMat2d} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat2d} out\n */\n\nfunction multiplyScalarAndAdd$2(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat2d} a The first matrix.\n * @param {ReadonlyMat2d} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction exactEquals$7(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat2d} a The first matrix.\n * @param {ReadonlyMat2d} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction equals$7(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5));\n}\n/**\n * Alias for {@link mat2d.multiply}\n * @function\n */\n\nvar mul$7 = multiply$7;\n/**\n * Alias for {@link mat2d.subtract}\n * @function\n */\n\nvar sub$5 = subtract$5;\n\nconst mat2d = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$7,\n clone: clone$7,\n copy: copy$7,\n create: create$7,\n determinant: determinant$2,\n equals: equals$7,\n exactEquals: exactEquals$7,\n frob: frob$2,\n fromRotation: fromRotation$3,\n fromScaling: fromScaling$2,\n fromTranslation: fromTranslation$3,\n fromValues: fromValues$7,\n identity: identity$4,\n invert: invert$4,\n mul: mul$7,\n multiply: multiply$7,\n multiplyScalar: multiplyScalar$2,\n multiplyScalarAndAdd: multiplyScalarAndAdd$2,\n rotate: rotate$3,\n scale: scale$7,\n set: set$7,\n str: str$7,\n sub: sub$5,\n subtract: subtract$5,\n translate: translate$3\n});\n\n/**\n * 3x3 Matrix\n * @module mat3\n */\n\n/**\n * Creates a new identity mat3\n *\n * @returns {mat3} a new 3x3 matrix\n */\n\nfunction create$6() {\n var out = new ARRAY_TYPE(9);\n\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n }\n\n out[0] = 1;\n out[4] = 1;\n out[8] = 1;\n return out;\n}\n/**\n * Copies the upper-left 3x3 values into the given mat3.\n *\n * @param {mat3} out the receiving 3x3 matrix\n * @param {ReadonlyMat4} a the source 4x4 matrix\n * @returns {mat3} out\n */\n\nfunction fromMat4$1(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n}\n/**\n * Creates a new mat3 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat3} a matrix to clone\n * @returns {mat3} a new 3x3 matrix\n */\n\nfunction clone$6(a) {\n var out = new ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Copy the values from one mat3 to another\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\n\nfunction copy$6(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Create a new mat3 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\n * @returns {mat3} A new mat3\n */\n\nfunction fromValues$6(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n var out = new ARRAY_TYPE(9);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\n * Set the components of a mat3 to the given values\n *\n * @param {mat3} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\n * @returns {mat3} out\n */\n\nfunction set$6(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\n * Set a mat3 to the identity matrix\n *\n * @param {mat3} out the receiving matrix\n * @returns {mat3} out\n */\n\nfunction identity$3(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Transpose the values of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\n\nfunction transpose$1(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n\n return out;\n}\n/**\n * Inverts a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\n\nfunction invert$3(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b01 = a22 * a11 - a12 * a21;\n var b11 = -a22 * a10 + a12 * a20;\n var b21 = a21 * a10 - a11 * a20; // Calculate the determinant\n\n var det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\n\nfunction adjoint$1(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n}\n/**\n * Calculates the determinant of a mat3\n *\n * @param {ReadonlyMat3} a the source matrix\n * @returns {Number} determinant of a\n */\n\nfunction determinant$1(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n}\n/**\n * Multiplies two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\n\nfunction multiply$6(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b00 = b[0],\n b01 = b[1],\n b02 = b[2];\n var b10 = b[3],\n b11 = b[4],\n b12 = b[5];\n var b20 = b[6],\n b21 = b[7],\n b22 = b[8];\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n}\n/**\n * Translate a mat3 by the given vector\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to translate\n * @param {ReadonlyVec2} v vector to translate by\n * @returns {mat3} out\n */\n\nfunction translate$2(out, a, v) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n x = v[0],\n y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n}\n/**\n * Rotates a mat3 by the given angle\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\n\nfunction rotate$2(out, a, rad) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n}\n/**\n * Scales the mat3 by the dimensions in the given vec2\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to rotate\n * @param {ReadonlyVec2} v the vec2 to scale the matrix by\n * @returns {mat3} out\n **/\n\nfunction scale$6(out, a, v) {\n var x = v[0],\n y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.translate(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyVec2} v Translation vector\n * @returns {mat3} out\n */\n\nfunction fromTranslation$2(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.rotate(dest, dest, rad);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\n\nfunction fromRotation$2(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.scale(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyVec2} v Scaling vector\n * @returns {mat3} out\n */\n\nfunction fromScaling$1(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Copies the values from a mat2d into a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to copy\n * @returns {mat3} out\n **/\n\nfunction fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n}\n/**\n * Calculates a 3x3 matrix from the given quaternion\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyQuat} q Quaternion to create matrix from\n *\n * @returns {mat3} out\n */\n\nfunction fromQuat$1(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n}\n/**\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\n *\n * @returns {mat3} out\n */\n\nfunction normalFromMat4(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n}\n/**\n * Generates a 2D projection matrix with the given bounds\n *\n * @param {mat3} out mat3 frustum matrix will be written into\n * @param {number} width Width of your gl context\n * @param {number} height Height of gl context\n * @returns {mat3} out\n */\n\nfunction projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n}\n/**\n * Returns a string representation of a mat3\n *\n * @param {ReadonlyMat3} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\n\nfunction str$6(a) {\n return \"mat3(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \")\";\n}\n/**\n * Returns Frobenius norm of a mat3\n *\n * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\n\nfunction frob$1(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);\n}\n/**\n * Adds two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\n\nfunction add$6(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\n\nfunction subtract$4(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat3} out\n */\n\nfunction multiplyScalar$1(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n}\n/**\n * Adds two mat3's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat3} out the receiving vector\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat3} out\n */\n\nfunction multiplyScalarAndAdd$1(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat3} a The first matrix.\n * @param {ReadonlyMat3} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction exactEquals$6(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat3} a The first matrix.\n * @param {ReadonlyMat3} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction equals$6(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7],\n a8 = a[8];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7],\n b8 = b[8];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8));\n}\n/**\n * Alias for {@link mat3.multiply}\n * @function\n */\n\nvar mul$6 = multiply$6;\n/**\n * Alias for {@link mat3.subtract}\n * @function\n */\n\nvar sub$4 = subtract$4;\n\nconst mat3 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$6,\n adjoint: adjoint$1,\n clone: clone$6,\n copy: copy$6,\n create: create$6,\n determinant: determinant$1,\n equals: equals$6,\n exactEquals: exactEquals$6,\n frob: frob$1,\n fromMat2d: fromMat2d,\n fromMat4: fromMat4$1,\n fromQuat: fromQuat$1,\n fromRotation: fromRotation$2,\n fromScaling: fromScaling$1,\n fromTranslation: fromTranslation$2,\n fromValues: fromValues$6,\n identity: identity$3,\n invert: invert$3,\n mul: mul$6,\n multiply: multiply$6,\n multiplyScalar: multiplyScalar$1,\n multiplyScalarAndAdd: multiplyScalarAndAdd$1,\n normalFromMat4: normalFromMat4,\n projection: projection,\n rotate: rotate$2,\n scale: scale$6,\n set: set$6,\n str: str$6,\n sub: sub$4,\n subtract: subtract$4,\n translate: translate$2,\n transpose: transpose$1\n});\n\n/**\n * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.\n * @module mat4\n */\n\n/**\n * Creates a new identity mat4\n *\n * @returns {mat4} a new 4x4 matrix\n */\n\nfunction create$5() {\n var out = new ARRAY_TYPE(16);\n\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\n\nfunction clone$5(a) {\n var out = new ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nfunction copy$5(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Create a new mat4 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} A new mat4\n */\n\nfunction fromValues$5(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\n * Set the components of a mat4 to the given values\n *\n * @param {mat4} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} out\n */\n\nfunction set$5(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\n\nfunction identity$2(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nfunction transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nfunction invert$2(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nfunction adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n}\n/**\n * Calculates the determinant of a mat4\n *\n * @param {ReadonlyMat4} a the source matrix\n * @returns {Number} determinant of a\n */\n\nfunction determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n}\n/**\n * Multiplies two mat4s\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nfunction multiply$5(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15]; // Cache only the current line of the second matrix\n\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to translate\n * @param {ReadonlyVec3} v vector to translate by\n * @returns {mat4} out\n */\n\nfunction translate$1(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n}\n/**\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {ReadonlyVec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\n\nfunction scale$5(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Rotates a mat4 by the given angle around the given axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\n\nfunction rotate$1(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n\n if (len < EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11]; // Construct the elements of the rotation matrix\n\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c; // Perform rotation-specific matrix multiplication\n\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction rotateX$3(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction rotateY$3(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction rotateZ$3(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\n\nfunction fromTranslation$1(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Scaling vector\n * @returns {mat4} out\n */\n\nfunction fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\n\nfunction fromRotation$1(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n\n if (len < EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c; // Perform rotation-specific matrix multiplication\n\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\n\nfunction fromRotationTranslation$1(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a new mat4 from a dual quat.\n *\n * @param {mat4} out Matrix\n * @param {ReadonlyQuat2} a Dual Quaternion\n * @returns {mat4} mat4 receiving operation result\n */\n\nfunction fromQuat2(out, a) {\n var translation = new ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense\n\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n\n fromRotationTranslation$1(out, a, translation);\n return out;\n}\n/**\n * Returns the translation vector component of a transformation\n * matrix. If a matrix is built with fromRotationTranslation,\n * the returned vector will be the same as the translation vector\n * originally supplied.\n * @param {vec3} out Vector to receive translation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n\nfunction getTranslation$1(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\n * Returns the scaling factor component of a transformation\n * matrix. If a matrix is built with fromRotationTranslationScale\n * with a normalized Quaternion paramter, the returned vector will be\n * the same as the scaling vector\n * originally supplied.\n * @param {vec3} out Vector to receive scaling factor component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n\nfunction getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.hypot(m11, m12, m13);\n out[1] = Math.hypot(m21, m22, m23);\n out[2] = Math.hypot(m31, m32, m33);\n return out;\n}\n/**\n * Returns a quaternion representing the rotational component\n * of a transformation matrix. If a matrix is built with\n * fromRotationTranslation, the returned quaternion will be the\n * same as the quaternion originally supplied.\n * @param {quat} out Quaternion to receive the rotation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {quat} out\n */\n\nfunction getRotation(out, mat) {\n var scaling = new ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @returns {mat4} out\n */\n\nfunction fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @param {ReadonlyVec3} o The origin vector around which to scale and rotate\n * @returns {mat4} out\n */\n\nfunction fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\n * Calculates a 4x4 matrix from the given quaternion\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyQuat} q Quaternion to create matrix from\n *\n * @returns {mat4} out\n */\n\nfunction fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nfunction frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\n\nfunction perspectiveNO(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n\n return out;\n}\n/**\n * Alias for {@link mat4.perspectiveNO}\n * @function\n */\n\nvar perspective = perspectiveNO;\n/**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\n\nfunction perspectiveZO(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -near;\n }\n\n return out;\n}\n/**\n * Generates a perspective projection matrix with the given field of view.\n * This is primarily useful for generating projection matrices to be used\n * with the still experiemental WebVR API.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nfunction perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nfunction orthoNO(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\n * Alias for {@link mat4.orthoNO}\n * @function\n */\n\nvar ortho = orthoNO;\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nfunction orthoZO(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = near * nf;\n out[15] = 1;\n return out;\n}\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\n\nfunction lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n\n if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) {\n return identity$2(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\n * Generates a matrix that makes something look at something else.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\n\nfunction targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n/**\n * Returns a string representation of a mat4\n *\n * @param {ReadonlyMat4} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\n\nfunction str$5(a) {\n return \"mat4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \", \" + a[9] + \", \" + a[10] + \", \" + a[11] + \", \" + a[12] + \", \" + a[13] + \", \" + a[14] + \", \" + a[15] + \")\";\n}\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\n\nfunction frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);\n}\n/**\n * Adds two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nfunction add$5(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nfunction subtract$3(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat4} out\n */\n\nfunction multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat4} out the receiving vector\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat4} out\n */\n\nfunction multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction exactEquals$5(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction equals$5(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\n\nvar mul$5 = multiply$5;\n/**\n * Alias for {@link mat4.subtract}\n * @function\n */\n\nvar sub$3 = subtract$3;\n\nconst mat4 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$5,\n adjoint: adjoint,\n clone: clone$5,\n copy: copy$5,\n create: create$5,\n determinant: determinant,\n equals: equals$5,\n exactEquals: exactEquals$5,\n frob: frob,\n fromQuat: fromQuat,\n fromQuat2: fromQuat2,\n fromRotation: fromRotation$1,\n fromRotationTranslation: fromRotationTranslation$1,\n fromRotationTranslationScale: fromRotationTranslationScale,\n fromRotationTranslationScaleOrigin: fromRotationTranslationScaleOrigin,\n fromScaling: fromScaling,\n fromTranslation: fromTranslation$1,\n fromValues: fromValues$5,\n fromXRotation: fromXRotation,\n fromYRotation: fromYRotation,\n fromZRotation: fromZRotation,\n frustum: frustum,\n getRotation: getRotation,\n getScaling: getScaling,\n getTranslation: getTranslation$1,\n identity: identity$2,\n invert: invert$2,\n lookAt: lookAt,\n mul: mul$5,\n multiply: multiply$5,\n multiplyScalar: multiplyScalar,\n multiplyScalarAndAdd: multiplyScalarAndAdd,\n ortho: ortho,\n orthoNO: orthoNO,\n orthoZO: orthoZO,\n perspective: perspective,\n perspectiveFromFieldOfView: perspectiveFromFieldOfView,\n perspectiveNO: perspectiveNO,\n perspectiveZO: perspectiveZO,\n rotate: rotate$1,\n rotateX: rotateX$3,\n rotateY: rotateY$3,\n rotateZ: rotateZ$3,\n scale: scale$5,\n set: set$5,\n str: str$5,\n sub: sub$3,\n subtract: subtract$3,\n targetTo: targetTo,\n translate: translate$1,\n transpose: transpose\n});\n\n/**\n * 3 Dimensional Vector\n * @module vec3\n */\n\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\n\nfunction create$4() {\n var out = new ARRAY_TYPE(3);\n\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n return out;\n}\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {ReadonlyVec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\n\nfunction clone$4(a) {\n var out = new ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\n * Calculates the length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nfunction length$4(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.hypot(x, y, z);\n}\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\n\nfunction fromValues$4(x, y, z) {\n var out = new ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the source vector\n * @returns {vec3} out\n */\n\nfunction copy$4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\n\nfunction set$4(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction add$4(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction subtract$2(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction multiply$4(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction divide$2(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\n * Math.ceil the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to ceil\n * @returns {vec3} out\n */\n\nfunction ceil$2(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\n * Math.floor the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to floor\n * @returns {vec3} out\n */\n\nfunction floor$2(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction min$2(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction max$2(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\n * Math.round the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to round\n * @returns {vec3} out\n */\n\nfunction round$2(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n}\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\n\nfunction scale$4(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\n\nfunction scaleAndAdd$2(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} distance between a and b\n */\n\nfunction distance$2(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.hypot(x, y, z);\n}\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\n\nfunction squaredDistance$2(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\n * Calculates the squared length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\n\nfunction squaredLength$4(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to negate\n * @returns {vec3} out\n */\n\nfunction negate$2(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to invert\n * @returns {vec3} out\n */\n\nfunction inverse$2(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to normalize\n * @returns {vec3} out\n */\n\nfunction normalize$4(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} dot product of a and b\n */\n\nfunction dot$4(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction cross$2(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nfunction lerp$4(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\n * Performs a hermite interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nfunction hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\n * Performs a bezier interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nfunction bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec3} out\n */\n\nfunction random$3(out, scale) {\n scale = scale || 1.0;\n var r = RANDOM() * 2.0 * Math.PI;\n var z = RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec3} out\n */\n\nfunction transformMat4$2(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat3} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\n\nfunction transformMat3$1(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\n * Transforms the vec3 with a quat\n * Can also be used for dual quaternions. (Multiply it with the real part)\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyQuat} q quaternion to transform with\n * @returns {vec3} out\n */\n\nfunction transformQuat$1(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var x = a[0],\n y = a[1],\n z = a[2]; // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n\n var uvx = qy * z - qz * y,\n uvy = qz * x - qx * z,\n uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);\n\n var uuvx = qy * uvz - qz * uvy,\n uuvy = qz * uvx - qx * uvz,\n uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);\n\n var w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2; // vec3.scale(uuv, uuv, 2);\n\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));\n\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nfunction rotateX$2(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nfunction rotateY$2(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nfunction rotateZ$2(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2]; //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Get the angle between two 3D vectors\n * @param {ReadonlyVec3} a The first operand\n * @param {ReadonlyVec3} b The second operand\n * @returns {Number} The angle in radians\n */\n\nfunction angle$1(a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n bx = b[0],\n by = b[1],\n bz = b[2],\n mag1 = Math.sqrt(ax * ax + ay * ay + az * az),\n mag2 = Math.sqrt(bx * bx + by * by + bz * bz),\n mag = mag1 * mag2,\n cosine = mag && dot$4(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\n * Set the components of a vec3 to zero\n *\n * @param {vec3} out the receiving vector\n * @returns {vec3} out\n */\n\nfunction zero$2(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec3} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nfunction str$4(a) {\n return \"vec3(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";\n}\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction exactEquals$4(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction equals$4(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\n\nvar sub$2 = subtract$2;\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\n\nvar mul$4 = multiply$4;\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\n\nvar div$2 = divide$2;\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\n\nvar dist$2 = distance$2;\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\n\nvar sqrDist$2 = squaredDistance$2;\n/**\n * Alias for {@link vec3.length}\n * @function\n */\n\nvar len$4 = length$4;\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\n\nvar sqrLen$4 = squaredLength$4;\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\n\nvar forEach$2 = function () {\n var vec = create$4();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 3;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n\n return a;\n };\n}();\n\nconst vec3 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$4,\n angle: angle$1,\n bezier: bezier,\n ceil: ceil$2,\n clone: clone$4,\n copy: copy$4,\n create: create$4,\n cross: cross$2,\n dist: dist$2,\n distance: distance$2,\n div: div$2,\n divide: divide$2,\n dot: dot$4,\n equals: equals$4,\n exactEquals: exactEquals$4,\n floor: floor$2,\n forEach: forEach$2,\n fromValues: fromValues$4,\n hermite: hermite,\n inverse: inverse$2,\n len: len$4,\n length: length$4,\n lerp: lerp$4,\n max: max$2,\n min: min$2,\n mul: mul$4,\n multiply: multiply$4,\n negate: negate$2,\n normalize: normalize$4,\n random: random$3,\n rotateX: rotateX$2,\n rotateY: rotateY$2,\n rotateZ: rotateZ$2,\n round: round$2,\n scale: scale$4,\n scaleAndAdd: scaleAndAdd$2,\n set: set$4,\n sqrDist: sqrDist$2,\n sqrLen: sqrLen$4,\n squaredDistance: squaredDistance$2,\n squaredLength: squaredLength$4,\n str: str$4,\n sub: sub$2,\n subtract: subtract$2,\n transformMat3: transformMat3$1,\n transformMat4: transformMat4$2,\n transformQuat: transformQuat$1,\n zero: zero$2\n});\n\n/**\n * 4 Dimensional Vector\n * @module vec4\n */\n\n/**\n * Creates a new, empty vec4\n *\n * @returns {vec4} a new 4D vector\n */\n\nfunction create$3() {\n var out = new ARRAY_TYPE(4);\n\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n\n return out;\n}\n/**\n * Creates a new vec4 initialized with values from an existing vector\n *\n * @param {ReadonlyVec4} a vector to clone\n * @returns {vec4} a new 4D vector\n */\n\nfunction clone$3(a) {\n var out = new ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Creates a new vec4 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} a new 4D vector\n */\n\nfunction fromValues$3(x, y, z, w) {\n var out = new ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\n * Copy the values from one vec4 to another\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the source vector\n * @returns {vec4} out\n */\n\nfunction copy$3(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Set the components of a vec4 to the given values\n *\n * @param {vec4} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} out\n */\n\nfunction set$3(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\n * Adds two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction add$3(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction subtract$1(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\n * Multiplies two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction multiply$3(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n}\n/**\n * Divides two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction divide$1(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n}\n/**\n * Math.ceil the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to ceil\n * @returns {vec4} out\n */\n\nfunction ceil$1(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n/**\n * Math.floor the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to floor\n * @returns {vec4} out\n */\n\nfunction floor$1(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n/**\n * Returns the minimum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction min$1(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n/**\n * Returns the maximum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction max$1(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n/**\n * Math.round the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to round\n * @returns {vec4} out\n */\n\nfunction round$1(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n}\n/**\n * Scales a vec4 by a scalar number\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec4} out\n */\n\nfunction scale$3(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\n * Adds two vec4's after scaling the second operand by a scalar value\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec4} out\n */\n\nfunction scaleAndAdd$1(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} distance between a and b\n */\n\nfunction distance$1(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\n * Calculates the squared euclidian distance between two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} squared distance between a and b\n */\n\nfunction squaredDistance$1(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\n * Calculates the length of a vec4\n *\n * @param {ReadonlyVec4} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nfunction length$3(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\n * Calculates the squared length of a vec4\n *\n * @param {ReadonlyVec4} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\n\nfunction squaredLength$3(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\n * Negates the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to negate\n * @returns {vec4} out\n */\n\nfunction negate$1(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to invert\n * @returns {vec4} out\n */\n\nfunction inverse$1(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n/**\n * Normalize a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to normalize\n * @returns {vec4} out\n */\n\nfunction normalize$3(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n var len = x * x + y * y + z * z + w * w;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} dot product of a and b\n */\n\nfunction dot$3(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n/**\n * Returns the cross-product of three vectors in a 4-dimensional space\n *\n * @param {ReadonlyVec4} result the receiving vector\n * @param {ReadonlyVec4} U the first vector\n * @param {ReadonlyVec4} V the second vector\n * @param {ReadonlyVec4} W the third vector\n * @returns {vec4} result\n */\n\nfunction cross$1(out, u, v, w) {\n var A = v[0] * w[1] - v[1] * w[0],\n B = v[0] * w[2] - v[2] * w[0],\n C = v[0] * w[3] - v[3] * w[0],\n D = v[1] * w[2] - v[2] * w[1],\n E = v[1] * w[3] - v[3] * w[1],\n F = v[2] * w[3] - v[3] * w[2];\n var G = u[0];\n var H = u[1];\n var I = u[2];\n var J = u[3];\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec4} out\n */\n\nfunction lerp$3(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec4} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec4} out\n */\n\nfunction random$2(out, scale) {\n scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n\n var v1, v2, v3, v4;\n var s1, s2;\n\n do {\n v1 = RANDOM() * 2 - 1;\n v2 = RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n\n do {\n v3 = RANDOM() * 2 - 1;\n v4 = RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n\n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n}\n/**\n * Transforms the vec4 with a mat4.\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec4} out\n */\n\nfunction transformMat4$1(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n/**\n * Transforms the vec4 with a quat\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to transform\n * @param {ReadonlyQuat} q quaternion to transform with\n * @returns {vec4} out\n */\n\nfunction transformQuat(out, a, q) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3]; // calculate quat * vec\n\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat\n\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n/**\n * Set the components of a vec4 to zero\n *\n * @param {vec4} out the receiving vector\n * @returns {vec4} out\n */\n\nfunction zero$1(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec4} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nfunction str$3(a) {\n return \"vec4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \")\";\n}\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec4} a The first vector.\n * @param {ReadonlyVec4} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction exactEquals$3(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec4} a The first vector.\n * @param {ReadonlyVec4} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction equals$3(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\n * Alias for {@link vec4.subtract}\n * @function\n */\n\nvar sub$1 = subtract$1;\n/**\n * Alias for {@link vec4.multiply}\n * @function\n */\n\nvar mul$3 = multiply$3;\n/**\n * Alias for {@link vec4.divide}\n * @function\n */\n\nvar div$1 = divide$1;\n/**\n * Alias for {@link vec4.distance}\n * @function\n */\n\nvar dist$1 = distance$1;\n/**\n * Alias for {@link vec4.squaredDistance}\n * @function\n */\n\nvar sqrDist$1 = squaredDistance$1;\n/**\n * Alias for {@link vec4.length}\n * @function\n */\n\nvar len$3 = length$3;\n/**\n * Alias for {@link vec4.squaredLength}\n * @function\n */\n\nvar sqrLen$3 = squaredLength$3;\n/**\n * Perform some operation over an array of vec4s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\n\nvar forEach$1 = function () {\n var vec = create$3();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 4;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n\n return a;\n };\n}();\n\nconst vec4 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$3,\n ceil: ceil$1,\n clone: clone$3,\n copy: copy$3,\n create: create$3,\n cross: cross$1,\n dist: dist$1,\n distance: distance$1,\n div: div$1,\n divide: divide$1,\n dot: dot$3,\n equals: equals$3,\n exactEquals: exactEquals$3,\n floor: floor$1,\n forEach: forEach$1,\n fromValues: fromValues$3,\n inverse: inverse$1,\n len: len$3,\n length: length$3,\n lerp: lerp$3,\n max: max$1,\n min: min$1,\n mul: mul$3,\n multiply: multiply$3,\n negate: negate$1,\n normalize: normalize$3,\n random: random$2,\n round: round$1,\n scale: scale$3,\n scaleAndAdd: scaleAndAdd$1,\n set: set$3,\n sqrDist: sqrDist$1,\n sqrLen: sqrLen$3,\n squaredDistance: squaredDistance$1,\n squaredLength: squaredLength$3,\n str: str$3,\n sub: sub$1,\n subtract: subtract$1,\n transformMat4: transformMat4$1,\n transformQuat: transformQuat,\n zero: zero$1\n});\n\n/**\n * Quaternion\n * @module quat\n */\n\n/**\n * Creates a new identity quat\n *\n * @returns {quat} a new quaternion\n */\n\nfunction create$2() {\n var out = new ARRAY_TYPE(4);\n\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n out[3] = 1;\n return out;\n}\n/**\n * Set a quat to the identity quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\n\nfunction identity$1(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyVec3} axis the axis around which to rotate\n * @param {Number} rad the angle in radians\n * @returns {quat} out\n **/\n\nfunction setAxisAngle(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n}\n/**\n * Gets the rotation axis and angle for a given\n * quaternion. If a quaternion is created with\n * setAxisAngle, this method will return the same\n * values as providied in the original parameter list\n * OR functionally equivalent values.\n * Example: The quaternion formed by axis [0, 0, 1] and\n * angle -90 is the same as the quaternion formed by\n * [0, 0, 1] and 270. This method favors the latter.\n * @param {vec3} out_axis Vector receiving the axis of rotation\n * @param {ReadonlyQuat} q Quaternion to be decomposed\n * @return {Number} Angle, in radians, of the rotation\n */\n\nfunction getAxisAngle(out_axis, q) {\n var rad = Math.acos(q[3]) * 2.0;\n var s = Math.sin(rad / 2.0);\n\n if (s > EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n } else {\n // If s is zero, return any axis (no rotation - axis does not matter)\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n\n return rad;\n}\n/**\n * Gets the angular distance between two unit quaternions\n *\n * @param {ReadonlyQuat} a Origin unit quaternion\n * @param {ReadonlyQuat} b Destination unit quaternion\n * @return {Number} Angle, in radians, between the two quaternions\n */\n\nfunction getAngle(a, b) {\n var dotproduct = dot$2(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n}\n/**\n * Multiplies two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {quat} out\n */\n\nfunction multiply$2(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the X axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\n\nfunction rotateX$1(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the Y axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\n\nfunction rotateY$1(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var by = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the Z axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\n\nfunction rotateZ$1(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bz = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n}\n/**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate W component of\n * @returns {quat} out\n */\n\nfunction calculateW(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n}\n/**\n * Calculate the exponential of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @returns {quat} out\n */\n\nfunction exp(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var et = Math.exp(w);\n var s = r > 0 ? et * Math.sin(r) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n}\n/**\n * Calculate the natural logarithm of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @returns {quat} out\n */\n\nfunction ln(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n}\n/**\n * Calculate the scalar power of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @param {Number} b amount to scale the quaternion by\n * @returns {quat} out\n */\n\nfunction pow(out, a, b) {\n ln(out, a);\n scale$2(out, out, b);\n exp(out, out);\n return out;\n}\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n */\n\nfunction slerp(out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n var omega, cosom, sinom, scale0, scale1; // calc cosine\n\n cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)\n\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n } // calculate coefficients\n\n\n if (1.0 - cosom > EPSILON) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n } // calculate final values\n\n\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n}\n/**\n * Generates a random unit quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\n\nfunction random$1(out) {\n // Implementation of http://planning.cs.uiuc.edu/node198.html\n // TODO: Calling random 3 times is probably not the fastest solution\n var u1 = RANDOM();\n var u2 = RANDOM();\n var u3 = RANDOM();\n var sqrt1MinusU1 = Math.sqrt(1 - u1);\n var sqrtU1 = Math.sqrt(u1);\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n return out;\n}\n/**\n * Calculates the inverse of a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate inverse of\n * @returns {quat} out\n */\n\nfunction invert$1(out, a) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n}\n/**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate conjugate of\n * @returns {quat} out\n */\n\nfunction conjugate$1(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to renormalize the quaternion yourself where necessary.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyMat3} m rotation matrix\n * @returns {quat} out\n * @function\n */\n\nfunction fromMat3(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if (fTrace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot; // 1/(4w)\n\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if (m[4] > m[0]) i = 1;\n if (m[8] > m[i * 3 + i]) i = 2;\n var j = (i + 1) % 3;\n var k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n\n return out;\n}\n/**\n * Creates a quaternion from the given euler angle x, y, z.\n *\n * @param {quat} out the receiving quaternion\n * @param {x} Angle to rotate around X axis in degrees.\n * @param {y} Angle to rotate around Y axis in degrees.\n * @param {z} Angle to rotate around Z axis in degrees.\n * @returns {quat} out\n * @function\n */\n\nfunction fromEuler(out, x, y, z) {\n var halfToRad = 0.5 * Math.PI / 180.0;\n x *= halfToRad;\n y *= halfToRad;\n z *= halfToRad;\n var sx = Math.sin(x);\n var cx = Math.cos(x);\n var sy = Math.sin(y);\n var cy = Math.cos(y);\n var sz = Math.sin(z);\n var cz = Math.cos(z);\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n return out;\n}\n/**\n * Returns a string representation of a quatenion\n *\n * @param {ReadonlyQuat} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nfunction str$2(a) {\n return \"quat(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \")\";\n}\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {ReadonlyQuat} a quaternion to clone\n * @returns {quat} a new quaternion\n * @function\n */\n\nvar clone$2 = clone$3;\n/**\n * Creates a new quat initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} a new quaternion\n * @function\n */\n\nvar fromValues$2 = fromValues$3;\n/**\n * Copy the values from one quat to another\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the source quaternion\n * @returns {quat} out\n * @function\n */\n\nvar copy$2 = copy$3;\n/**\n * Set the components of a quat to the given values\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} out\n * @function\n */\n\nvar set$2 = set$3;\n/**\n * Adds two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {quat} out\n * @function\n */\n\nvar add$2 = add$3;\n/**\n * Alias for {@link quat.multiply}\n * @function\n */\n\nvar mul$2 = multiply$2;\n/**\n * Scales a quat by a scalar number\n *\n * @param {quat} out the receiving vector\n * @param {ReadonlyQuat} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {quat} out\n * @function\n */\n\nvar scale$2 = scale$3;\n/**\n * Calculates the dot product of two quat's\n *\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\n\nvar dot$2 = dot$3;\n/**\n * Performs a linear interpolation between two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n * @function\n */\n\nvar lerp$2 = lerp$3;\n/**\n * Calculates the length of a quat\n *\n * @param {ReadonlyQuat} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nvar length$2 = length$3;\n/**\n * Alias for {@link quat.length}\n * @function\n */\n\nvar len$2 = length$2;\n/**\n * Calculates the squared length of a quat\n *\n * @param {ReadonlyQuat} a vector to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\n\nvar squaredLength$2 = squaredLength$3;\n/**\n * Alias for {@link quat.squaredLength}\n * @function\n */\n\nvar sqrLen$2 = squaredLength$2;\n/**\n * Normalize a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quaternion to normalize\n * @returns {quat} out\n * @function\n */\n\nvar normalize$2 = normalize$3;\n/**\n * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyQuat} a The first quaternion.\n * @param {ReadonlyQuat} b The second quaternion.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nvar exactEquals$2 = exactEquals$3;\n/**\n * Returns whether or not the quaternions have approximately the same elements in the same position.\n *\n * @param {ReadonlyQuat} a The first vector.\n * @param {ReadonlyQuat} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nvar equals$2 = equals$3;\n/**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n *\n * @param {quat} out the receiving quaternion.\n * @param {ReadonlyVec3} a the initial vector\n * @param {ReadonlyVec3} b the destination vector\n * @returns {quat} out\n */\n\nvar rotationTo = function () {\n var tmpvec3 = create$4();\n var xUnitVec3 = fromValues$4(1, 0, 0);\n var yUnitVec3 = fromValues$4(0, 1, 0);\n return function (out, a, b) {\n var dot = dot$4(a, b);\n\n if (dot < -0.999999) {\n cross$2(tmpvec3, xUnitVec3, a);\n if (len$4(tmpvec3) < 0.000001) cross$2(tmpvec3, yUnitVec3, a);\n normalize$4(tmpvec3, tmpvec3);\n setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n cross$2(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return normalize$2(out, out);\n }\n };\n}();\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {ReadonlyQuat} c the third operand\n * @param {ReadonlyQuat} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n */\n\nvar sqlerp = function () {\n var temp1 = create$2();\n var temp2 = create$2();\n return function (out, a, b, c, d, t) {\n slerp(temp1, a, d, t);\n slerp(temp2, b, c, t);\n slerp(out, temp1, temp2, 2 * t * (1 - t));\n return out;\n };\n}();\n/**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n *\n * @param {ReadonlyVec3} view the vector representing the viewing direction\n * @param {ReadonlyVec3} right the vector representing the local \"right\" direction\n * @param {ReadonlyVec3} up the vector representing the local \"up\" direction\n * @returns {quat} out\n */\n\nvar setAxes = function () {\n var matr = create$6();\n return function (out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n return normalize$2(out, fromMat3(out, matr));\n };\n}();\n\nconst quat = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$2,\n calculateW: calculateW,\n clone: clone$2,\n conjugate: conjugate$1,\n copy: copy$2,\n create: create$2,\n dot: dot$2,\n equals: equals$2,\n exactEquals: exactEquals$2,\n exp: exp,\n fromEuler: fromEuler,\n fromMat3: fromMat3,\n fromValues: fromValues$2,\n getAngle: getAngle,\n getAxisAngle: getAxisAngle,\n identity: identity$1,\n invert: invert$1,\n len: len$2,\n length: length$2,\n lerp: lerp$2,\n ln: ln,\n mul: mul$2,\n multiply: multiply$2,\n normalize: normalize$2,\n pow: pow,\n random: random$1,\n rotateX: rotateX$1,\n rotateY: rotateY$1,\n rotateZ: rotateZ$1,\n rotationTo: rotationTo,\n scale: scale$2,\n set: set$2,\n setAxes: setAxes,\n setAxisAngle: setAxisAngle,\n slerp: slerp,\n sqlerp: sqlerp,\n sqrLen: sqrLen$2,\n squaredLength: squaredLength$2,\n str: str$2\n});\n\n/**\n * Dual Quaternion<br>\n * Format: [real, dual]<br>\n * Quaternion format: XYZW<br>\n * Make sure to have normalized dual quaternions, otherwise the functions may not work as intended.<br>\n * @module quat2\n */\n\n/**\n * Creates a new identity dual quat\n *\n * @returns {quat2} a new dual quaternion [real -> rotation, dual -> translation]\n */\n\nfunction create$1() {\n var dq = new ARRAY_TYPE(8);\n\n if (ARRAY_TYPE != Float32Array) {\n dq[0] = 0;\n dq[1] = 0;\n dq[2] = 0;\n dq[4] = 0;\n dq[5] = 0;\n dq[6] = 0;\n dq[7] = 0;\n }\n\n dq[3] = 1;\n return dq;\n}\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {ReadonlyQuat2} a dual quaternion to clone\n * @returns {quat2} new dual quaternion\n * @function\n */\n\nfunction clone$1(a) {\n var dq = new ARRAY_TYPE(8);\n dq[0] = a[0];\n dq[1] = a[1];\n dq[2] = a[2];\n dq[3] = a[3];\n dq[4] = a[4];\n dq[5] = a[5];\n dq[6] = a[6];\n dq[7] = a[7];\n return dq;\n}\n/**\n * Creates a new dual quat initialized with the given values\n *\n * @param {Number} x1 X component\n * @param {Number} y1 Y component\n * @param {Number} z1 Z component\n * @param {Number} w1 W component\n * @param {Number} x2 X component\n * @param {Number} y2 Y component\n * @param {Number} z2 Z component\n * @param {Number} w2 W component\n * @returns {quat2} new dual quaternion\n * @function\n */\n\nfunction fromValues$1(x1, y1, z1, w1, x2, y2, z2, w2) {\n var dq = new ARRAY_TYPE(8);\n dq[0] = x1;\n dq[1] = y1;\n dq[2] = z1;\n dq[3] = w1;\n dq[4] = x2;\n dq[5] = y2;\n dq[6] = z2;\n dq[7] = w2;\n return dq;\n}\n/**\n * Creates a new dual quat from the given values (quat and translation)\n *\n * @param {Number} x1 X component\n * @param {Number} y1 Y component\n * @param {Number} z1 Z component\n * @param {Number} w1 W component\n * @param {Number} x2 X component (translation)\n * @param {Number} y2 Y component (translation)\n * @param {Number} z2 Z component (translation)\n * @returns {quat2} new dual quaternion\n * @function\n */\n\nfunction fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) {\n var dq = new ARRAY_TYPE(8);\n dq[0] = x1;\n dq[1] = y1;\n dq[2] = z1;\n dq[3] = w1;\n var ax = x2 * 0.5,\n ay = y2 * 0.5,\n az = z2 * 0.5;\n dq[4] = ax * w1 + ay * z1 - az * y1;\n dq[5] = ay * w1 + az * x1 - ax * z1;\n dq[6] = az * w1 + ax * y1 - ay * x1;\n dq[7] = -ax * x1 - ay * y1 - az * z1;\n return dq;\n}\n/**\n * Creates a dual quat from a quaternion and a translation\n *\n * @param {ReadonlyQuat2} dual quaternion receiving operation result\n * @param {ReadonlyQuat} q a normalized quaternion\n * @param {ReadonlyVec3} t tranlation vector\n * @returns {quat2} dual quaternion receiving operation result\n * @function\n */\n\nfunction fromRotationTranslation(out, q, t) {\n var ax = t[0] * 0.5,\n ay = t[1] * 0.5,\n az = t[2] * 0.5,\n bx = q[0],\n by = q[1],\n bz = q[2],\n bw = q[3];\n out[0] = bx;\n out[1] = by;\n out[2] = bz;\n out[3] = bw;\n out[4] = ax * bw + ay * bz - az * by;\n out[5] = ay * bw + az * bx - ax * bz;\n out[6] = az * bw + ax * by - ay * bx;\n out[7] = -ax * bx - ay * by - az * bz;\n return out;\n}\n/**\n * Creates a dual quat from a translation\n *\n * @param {ReadonlyQuat2} dual quaternion receiving operation result\n * @param {ReadonlyVec3} t translation vector\n * @returns {quat2} dual quaternion receiving operation result\n * @function\n */\n\nfunction fromTranslation(out, t) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = t[0] * 0.5;\n out[5] = t[1] * 0.5;\n out[6] = t[2] * 0.5;\n out[7] = 0;\n return out;\n}\n/**\n * Creates a dual quat from a quaternion\n *\n * @param {ReadonlyQuat2} dual quaternion receiving operation result\n * @param {ReadonlyQuat} q the quaternion\n * @returns {quat2} dual quaternion receiving operation result\n * @function\n */\n\nfunction fromRotation(out, q) {\n out[0] = q[0];\n out[1] = q[1];\n out[2] = q[2];\n out[3] = q[3];\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n}\n/**\n * Creates a new dual quat from a matrix (4x4)\n *\n * @param {quat2} out the dual quaternion\n * @param {ReadonlyMat4} a the matrix\n * @returns {quat2} dual quat receiving operation result\n * @function\n */\n\nfunction fromMat4(out, a) {\n //TODO Optimize this\n var outer = create$2();\n getRotation(outer, a);\n var t = new ARRAY_TYPE(3);\n getTranslation$1(t, a);\n fromRotationTranslation(out, outer, t);\n return out;\n}\n/**\n * Copy the values from one dual quat to another\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the source dual quaternion\n * @returns {quat2} out\n * @function\n */\n\nfunction copy$1(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n return out;\n}\n/**\n * Set a dual quat to the identity dual quaternion\n *\n * @param {quat2} out the receiving quaternion\n * @returns {quat2} out\n */\n\nfunction identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n}\n/**\n * Set the components of a dual quat to the given values\n *\n * @param {quat2} out the receiving quaternion\n * @param {Number} x1 X component\n * @param {Number} y1 Y component\n * @param {Number} z1 Z component\n * @param {Number} w1 W component\n * @param {Number} x2 X component\n * @param {Number} y2 Y component\n * @param {Number} z2 Z component\n * @param {Number} w2 W component\n * @returns {quat2} out\n * @function\n */\n\nfunction set$1(out, x1, y1, z1, w1, x2, y2, z2, w2) {\n out[0] = x1;\n out[1] = y1;\n out[2] = z1;\n out[3] = w1;\n out[4] = x2;\n out[5] = y2;\n out[6] = z2;\n out[7] = w2;\n return out;\n}\n/**\n * Gets the real part of a dual quat\n * @param {quat} out real part\n * @param {ReadonlyQuat2} a Dual Quaternion\n * @return {quat} real part\n */\n\nvar getReal = copy$2;\n/**\n * Gets the dual part of a dual quat\n * @param {quat} out dual part\n * @param {ReadonlyQuat2} a Dual Quaternion\n * @return {quat} dual part\n */\n\nfunction getDual(out, a) {\n out[0] = a[4];\n out[1] = a[5];\n out[2] = a[6];\n out[3] = a[7];\n return out;\n}\n/**\n * Set the real component of a dual quat to the given quaternion\n *\n * @param {quat2} out the receiving quaternion\n * @param {ReadonlyQuat} q a quaternion representing the real part\n * @returns {quat2} out\n * @function\n */\n\nvar setReal = copy$2;\n/**\n * Set the dual component of a dual quat to the given quaternion\n *\n * @param {quat2} out the receiving quaternion\n * @param {ReadonlyQuat} q a quaternion representing the dual part\n * @returns {quat2} out\n * @function\n */\n\nfunction setDual(out, q) {\n out[4] = q[0];\n out[5] = q[1];\n out[6] = q[2];\n out[7] = q[3];\n return out;\n}\n/**\n * Gets the translation of a normalized dual quat\n * @param {vec3} out translation\n * @param {ReadonlyQuat2} a Dual Quaternion to be decomposed\n * @return {vec3} translation\n */\n\nfunction getTranslation(out, a) {\n var ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7],\n bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3];\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n return out;\n}\n/**\n * Translates a dual quat by the given vector\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to translate\n * @param {ReadonlyVec3} v vector to translate by\n * @returns {quat2} out\n */\n\nfunction translate(out, a, v) {\n var ax1 = a[0],\n ay1 = a[1],\n az1 = a[2],\n aw1 = a[3],\n bx1 = v[0] * 0.5,\n by1 = v[1] * 0.5,\n bz1 = v[2] * 0.5,\n ax2 = a[4],\n ay2 = a[5],\n az2 = a[6],\n aw2 = a[7];\n out[0] = ax1;\n out[1] = ay1;\n out[2] = az1;\n out[3] = aw1;\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\n return out;\n}\n/**\n * Rotates a dual quat around the X axis\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @param {number} rad how far should the rotation be\n * @returns {quat2} out\n */\n\nfunction rotateX(out, a, rad) {\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7],\n ax1 = ax * bw + aw * bx + ay * bz - az * by,\n ay1 = ay * bw + aw * by + az * bx - ax * bz,\n az1 = az * bw + aw * bz + ax * by - ay * bx,\n aw1 = aw * bw - ax * bx - ay * by - az * bz;\n rotateX$1(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n}\n/**\n * Rotates a dual quat around the Y axis\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @param {number} rad how far should the rotation be\n * @returns {quat2} out\n */\n\nfunction rotateY(out, a, rad) {\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7],\n ax1 = ax * bw + aw * bx + ay * bz - az * by,\n ay1 = ay * bw + aw * by + az * bx - ax * bz,\n az1 = az * bw + aw * bz + ax * by - ay * bx,\n aw1 = aw * bw - ax * bx - ay * by - az * bz;\n rotateY$1(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n}\n/**\n * Rotates a dual quat around the Z axis\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @param {number} rad how far should the rotation be\n * @returns {quat2} out\n */\n\nfunction rotateZ(out, a, rad) {\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7],\n ax1 = ax * bw + aw * bx + ay * bz - az * by,\n ay1 = ay * bw + aw * by + az * bx - ax * bz,\n az1 = az * bw + aw * bz + ax * by - ay * bx,\n aw1 = aw * bw - ax * bx - ay * by - az * bz;\n rotateZ$1(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n}\n/**\n * Rotates a dual quat by a given quaternion (a * q)\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @param {ReadonlyQuat} q quaternion to rotate by\n * @returns {quat2} out\n */\n\nfunction rotateByQuatAppend(out, a, q) {\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3],\n ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\n ax = a[4];\n ay = a[5];\n az = a[6];\n aw = a[7];\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\n return out;\n}\n/**\n * Rotates a dual quat by a given quaternion (q * a)\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat} q quaternion to rotate by\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @returns {quat2} out\n */\n\nfunction rotateByQuatPrepend(out, q, a) {\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3],\n bx = a[0],\n by = a[1],\n bz = a[2],\n bw = a[3];\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\n bx = a[4];\n by = a[5];\n bz = a[6];\n bw = a[7];\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\n return out;\n}\n/**\n * Rotates a dual quat around a given axis. Does the normalisation automatically\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @param {Number} rad how far the rotation should be\n * @returns {quat2} out\n */\n\nfunction rotateAroundAxis(out, a, axis, rad) {\n //Special case for rad = 0\n if (Math.abs(rad) < EPSILON) {\n return copy$1(out, a);\n }\n\n var axisLength = Math.hypot(axis[0], axis[1], axis[2]);\n rad = rad * 0.5;\n var s = Math.sin(rad);\n var bx = s * axis[0] / axisLength;\n var by = s * axis[1] / axisLength;\n var bz = s * axis[2] / axisLength;\n var bw = Math.cos(rad);\n var ax1 = a[0],\n ay1 = a[1],\n az1 = a[2],\n aw1 = a[3];\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n var ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n}\n/**\n * Adds two dual quat's\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the first operand\n * @param {ReadonlyQuat2} b the second operand\n * @returns {quat2} out\n * @function\n */\n\nfunction add$1(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n return out;\n}\n/**\n * Multiplies two dual quat's\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the first operand\n * @param {ReadonlyQuat2} b the second operand\n * @returns {quat2} out\n */\n\nfunction multiply$1(out, a, b) {\n var ax0 = a[0],\n ay0 = a[1],\n az0 = a[2],\n aw0 = a[3],\n bx1 = b[4],\n by1 = b[5],\n bz1 = b[6],\n bw1 = b[7],\n ax1 = a[4],\n ay1 = a[5],\n az1 = a[6],\n aw1 = a[7],\n bx0 = b[0],\n by0 = b[1],\n bz0 = b[2],\n bw0 = b[3];\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\n out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0;\n out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0;\n out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0;\n out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0;\n return out;\n}\n/**\n * Alias for {@link quat2.multiply}\n * @function\n */\n\nvar mul$1 = multiply$1;\n/**\n * Scales a dual quat by a scalar number\n *\n * @param {quat2} out the receiving dual quat\n * @param {ReadonlyQuat2} a the dual quat to scale\n * @param {Number} b amount to scale the dual quat by\n * @returns {quat2} out\n * @function\n */\n\nfunction scale$1(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n return out;\n}\n/**\n * Calculates the dot product of two dual quat's (The dot product of the real parts)\n *\n * @param {ReadonlyQuat2} a the first operand\n * @param {ReadonlyQuat2} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\n\nvar dot$1 = dot$2;\n/**\n * Performs a linear interpolation between two dual quats's\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when t = 0.5)\n *\n * @param {quat2} out the receiving dual quat\n * @param {ReadonlyQuat2} a the first operand\n * @param {ReadonlyQuat2} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat2} out\n */\n\nfunction lerp$1(out, a, b, t) {\n var mt = 1 - t;\n if (dot$1(a, b) < 0) t = -t;\n out[0] = a[0] * mt + b[0] * t;\n out[1] = a[1] * mt + b[1] * t;\n out[2] = a[2] * mt + b[2] * t;\n out[3] = a[3] * mt + b[3] * t;\n out[4] = a[4] * mt + b[4] * t;\n out[5] = a[5] * mt + b[5] * t;\n out[6] = a[6] * mt + b[6] * t;\n out[7] = a[7] * mt + b[7] * t;\n return out;\n}\n/**\n * Calculates the inverse of a dual quat. If they are normalized, conjugate is cheaper\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a dual quat to calculate inverse of\n * @returns {quat2} out\n */\n\nfunction invert(out, a) {\n var sqlen = squaredLength$1(a);\n out[0] = -a[0] / sqlen;\n out[1] = -a[1] / sqlen;\n out[2] = -a[2] / sqlen;\n out[3] = a[3] / sqlen;\n out[4] = -a[4] / sqlen;\n out[5] = -a[5] / sqlen;\n out[6] = -a[6] / sqlen;\n out[7] = a[7] / sqlen;\n return out;\n}\n/**\n * Calculates the conjugate of a dual quat\n * If the dual quaternion is normalized, this function is faster than quat2.inverse and produces the same result.\n *\n * @param {quat2} out the receiving quaternion\n * @param {ReadonlyQuat2} a quat to calculate conjugate of\n * @returns {quat2} out\n */\n\nfunction conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n out[4] = -a[4];\n out[5] = -a[5];\n out[6] = -a[6];\n out[7] = a[7];\n return out;\n}\n/**\n * Calculates the length of a dual quat\n *\n * @param {ReadonlyQuat2} a dual quat to calculate length of\n * @returns {Number} length of a\n * @function\n */\n\nvar length$1 = length$2;\n/**\n * Alias for {@link quat2.length}\n * @function\n */\n\nvar len$1 = length$1;\n/**\n * Calculates the squared length of a dual quat\n *\n * @param {ReadonlyQuat2} a dual quat to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\n\nvar squaredLength$1 = squaredLength$2;\n/**\n * Alias for {@link quat2.squaredLength}\n * @function\n */\n\nvar sqrLen$1 = squaredLength$1;\n/**\n * Normalize a dual quat\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a dual quaternion to normalize\n * @returns {quat2} out\n * @function\n */\n\nfunction normalize$1(out, a) {\n var magnitude = squaredLength$1(a);\n\n if (magnitude > 0) {\n magnitude = Math.sqrt(magnitude);\n var a0 = a[0] / magnitude;\n var a1 = a[1] / magnitude;\n var a2 = a[2] / magnitude;\n var a3 = a[3] / magnitude;\n var b0 = a[4];\n var b1 = a[5];\n var b2 = a[6];\n var b3 = a[7];\n var a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\n }\n\n return out;\n}\n/**\n * Returns a string representation of a dual quatenion\n *\n * @param {ReadonlyQuat2} a dual quaternion to represent as a string\n * @returns {String} string representation of the dual quat\n */\n\nfunction str$1(a) {\n return \"quat2(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \")\";\n}\n/**\n * Returns whether or not the dual quaternions have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyQuat2} a the first dual quaternion.\n * @param {ReadonlyQuat2} b the second dual quaternion.\n * @returns {Boolean} true if the dual quaternions are equal, false otherwise.\n */\n\nfunction exactEquals$1(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7];\n}\n/**\n * Returns whether or not the dual quaternions have approximately the same elements in the same position.\n *\n * @param {ReadonlyQuat2} a the first dual quat.\n * @param {ReadonlyQuat2} b the second dual quat.\n * @returns {Boolean} true if the dual quats are equal, false otherwise.\n */\n\nfunction equals$1(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7));\n}\n\nconst quat2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$1,\n clone: clone$1,\n conjugate: conjugate,\n copy: copy$1,\n create: create$1,\n dot: dot$1,\n equals: equals$1,\n exactEquals: exactEquals$1,\n fromMat4: fromMat4,\n fromRotation: fromRotation,\n fromRotationTranslation: fromRotationTranslation,\n fromRotationTranslationValues: fromRotationTranslationValues,\n fromTranslation: fromTranslation,\n fromValues: fromValues$1,\n getDual: getDual,\n getReal: getReal,\n getTranslation: getTranslation,\n identity: identity,\n invert: invert,\n len: len$1,\n length: length$1,\n lerp: lerp$1,\n mul: mul$1,\n multiply: multiply$1,\n normalize: normalize$1,\n rotateAroundAxis: rotateAroundAxis,\n rotateByQuatAppend: rotateByQuatAppend,\n rotateByQuatPrepend: rotateByQuatPrepend,\n rotateX: rotateX,\n rotateY: rotateY,\n rotateZ: rotateZ,\n scale: scale$1,\n set: set$1,\n setDual: setDual,\n setReal: setReal,\n sqrLen: sqrLen$1,\n squaredLength: squaredLength$1,\n str: str$1,\n translate: translate\n});\n\n/**\n * 2 Dimensional Vector\n * @module vec2\n */\n\n/**\n * Creates a new, empty vec2\n *\n * @returns {vec2} a new 2D vector\n */\n\nfunction create() {\n var out = new ARRAY_TYPE(2);\n\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n }\n\n return out;\n}\n/**\n * Creates a new vec2 initialized with values from an existing vector\n *\n * @param {ReadonlyVec2} a vector to clone\n * @returns {vec2} a new 2D vector\n */\n\nfunction clone(a) {\n var out = new ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\n * Creates a new vec2 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} a new 2D vector\n */\n\nfunction fromValues(x, y) {\n var out = new ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\n * Copy the values from one vec2 to another\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the source vector\n * @returns {vec2} out\n */\n\nfunction copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\n * Set the components of a vec2 to the given values\n *\n * @param {vec2} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} out\n */\n\nfunction set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\n * Adds two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n}\n/**\n * Multiplies two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n}\n/**\n * Divides two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n}\n/**\n * Math.ceil the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to ceil\n * @returns {vec2} out\n */\n\nfunction ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n}\n/**\n * Math.floor the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to floor\n * @returns {vec2} out\n */\n\nfunction floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n}\n/**\n * Returns the minimum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n}\n/**\n * Returns the maximum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n}\n/**\n * Math.round the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to round\n * @returns {vec2} out\n */\n\nfunction round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n return out;\n}\n/**\n * Scales a vec2 by a scalar number\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec2} out\n */\n\nfunction scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n}\n/**\n * Adds two vec2's after scaling the second operand by a scalar value\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec2} out\n */\n\nfunction scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec2's\n *\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {Number} distance between a and b\n */\n\nfunction distance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.hypot(x, y);\n}\n/**\n * Calculates the squared euclidian distance between two vec2's\n *\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {Number} squared distance between a and b\n */\n\nfunction squaredDistance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x * x + y * y;\n}\n/**\n * Calculates the length of a vec2\n *\n * @param {ReadonlyVec2} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nfunction length(a) {\n var x = a[0],\n y = a[1];\n return Math.hypot(x, y);\n}\n/**\n * Calculates the squared length of a vec2\n *\n * @param {ReadonlyVec2} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\n\nfunction squaredLength(a) {\n var x = a[0],\n y = a[1];\n return x * x + y * y;\n}\n/**\n * Negates the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to negate\n * @returns {vec2} out\n */\n\nfunction negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to invert\n * @returns {vec2} out\n */\n\nfunction inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n}\n/**\n * Normalize a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to normalize\n * @returns {vec2} out\n */\n\nfunction normalize(out, a) {\n var x = a[0],\n y = a[1];\n var len = x * x + y * y;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec2's\n *\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {Number} dot product of a and b\n */\n\nfunction dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n}\n/**\n * Computes the cross product of two vec2's\n * Note that the cross product must by definition produce a 3D vector\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec3} out\n */\n\nfunction cross(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec2} out\n */\n\nfunction lerp(out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec2} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec2} out\n */\n\nfunction random(out, scale) {\n scale = scale || 1.0;\n var r = RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n}\n/**\n * Transforms the vec2 with a mat2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the vector to transform\n * @param {ReadonlyMat2} m matrix to transform with\n * @returns {vec2} out\n */\n\nfunction transformMat2(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n}\n/**\n * Transforms the vec2 with a mat2d\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the vector to transform\n * @param {ReadonlyMat2d} m matrix to transform with\n * @returns {vec2} out\n */\n\nfunction transformMat2d(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\n/**\n * Transforms the vec2 with a mat3\n * 3rd vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the vector to transform\n * @param {ReadonlyMat3} m matrix to transform with\n * @returns {vec2} out\n */\n\nfunction transformMat3(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n}\n/**\n * Transforms the vec2 with a mat4\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec2} out\n */\n\nfunction transformMat4(out, a, m) {\n var x = a[0];\n var y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n}\n/**\n * Rotate a 2D vector\n * @param {vec2} out The receiving vec2\n * @param {ReadonlyVec2} a The vec2 point to rotate\n * @param {ReadonlyVec2} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec2} out\n */\n\nfunction rotate(out, a, b, rad) {\n //Translate point to the origin\n var p0 = a[0] - b[0],\n p1 = a[1] - b[1],\n sinC = Math.sin(rad),\n cosC = Math.cos(rad); //perform rotation and translate to correct position\n\n out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n}\n/**\n * Get the angle between two 2D vectors\n * @param {ReadonlyVec2} a The first operand\n * @param {ReadonlyVec2} b The second operand\n * @returns {Number} The angle in radians\n */\n\nfunction angle(a, b) {\n var x1 = a[0],\n y1 = a[1],\n x2 = b[0],\n y2 = b[1],\n // mag is the product of the magnitudes of a and b\n mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2),\n // mag &&.. short circuits if mag == 0\n cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\n\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\n * Set the components of a vec2 to zero\n *\n * @param {vec2} out the receiving vector\n * @returns {vec2} out\n */\n\nfunction zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec2} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nfunction str(a) {\n return \"vec2(\" + a[0] + \", \" + a[1] + \")\";\n}\n/**\n * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec2} a The first vector.\n * @param {ReadonlyVec2} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec2} a The first vector.\n * @param {ReadonlyVec2} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction equals(a, b) {\n var a0 = a[0],\n a1 = a[1];\n var b0 = b[0],\n b1 = b[1];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1));\n}\n/**\n * Alias for {@link vec2.length}\n * @function\n */\n\nvar len = length;\n/**\n * Alias for {@link vec2.subtract}\n * @function\n */\n\nvar sub = subtract;\n/**\n * Alias for {@link vec2.multiply}\n * @function\n */\n\nvar mul = multiply;\n/**\n * Alias for {@link vec2.divide}\n * @function\n */\n\nvar div = divide;\n/**\n * Alias for {@link vec2.distance}\n * @function\n */\n\nvar dist = distance;\n/**\n * Alias for {@link vec2.squaredDistance}\n * @function\n */\n\nvar sqrDist = squaredDistance;\n/**\n * Alias for {@link vec2.squaredLength}\n * @function\n */\n\nvar sqrLen = squaredLength;\n/**\n * Perform some operation over an array of vec2s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\n\nvar forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 2;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n }\n\n return a;\n };\n}();\n\nconst vec2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add,\n angle: angle,\n ceil: ceil,\n clone: clone,\n copy: copy,\n create: create,\n cross: cross,\n dist: dist,\n distance: distance,\n div: div,\n divide: divide,\n dot: dot,\n equals: equals,\n exactEquals: exactEquals,\n floor: floor,\n forEach: forEach,\n fromValues: fromValues,\n inverse: inverse,\n len: len,\n length: length,\n lerp: lerp,\n max: max,\n min: min,\n mul: mul,\n multiply: multiply,\n negate: negate,\n normalize: normalize,\n random: random,\n rotate: rotate,\n round: round,\n scale: scale,\n scaleAndAdd: scaleAndAdd,\n set: set,\n sqrDist: sqrDist,\n sqrLen: sqrLen,\n squaredDistance: squaredDistance,\n squaredLength: squaredLength,\n str: str,\n sub: sub,\n subtract: subtract,\n transformMat2: transformMat2,\n transformMat2d: transformMat2d,\n transformMat3: transformMat3,\n transformMat4: transformMat4,\n zero: zero\n});\n\n/**\n * Provides a way to calculate velocity via effectively creating a \"complementary filter\".\n *\n * `velQuick` and `velSmooth` separately accumulate over time. `velInstant` and `velUsed` do not accumulate and are\n * discarded each update. `velQuick` is responsive, but noisy. `velSmooth` is laggy but eventually more accurate. By\n * tracking them separately the used result can be responsive in the short term and accurate in the long term.\n *\n * TODO: This class will be moved to a final location in the @typhonjs-svelte/lib/math package.\n */\nclass TJSVelocityTrack\n{\n /** @type {number} */\n #lastSampleTime;\n\n /**\n * Tracks the last sample point.\n *\n * @type {{x: number, y: number, z: number}}\n */\n #lastSamplePoint = { x: 0, y: 0, z: 0 };\n\n /**\n * Defines the settle time in milliseconds that resets any tracked velocity state.\n *\n * @type {number}\n */\n #resetDeltaTime;\n\n /**\n * Stores the scaling conversion for used velocity calculation. By default, this is 1000 which converts the velocity\n * calculation to velocity per second. Set to `1` for instance for velocity per millisecond.\n *\n * @type {number}\n */\n #scaleTime;\n\n /**\n * Stores the instant velocity between current and last sample point.\n *\n * @type {{x: number, y: number, z: number}}\n */\n #velInstant = { x: 0, y: 0, z: 0 };\n\n /**\n * Stores the `quick` running calculated velocity.\n *\n * @type {{x: number, y: number, z: number}}\n */\n #velQuick = { x: 0, y: 0, z: 0 };\n\n /**\n * Stores the `smooth` running calculated velocity.\n *\n * @type {{x: number, y: number, z: number}}\n */\n #velSmooth = { x: 0, y: 0, z: 0 };\n\n /**\n * Stores the mix between `quick` and `smooth` running velocity.\n *\n * @type {{x: number, y: number, z: number}}\n */\n #velUsed = { x: 0, y: 0, z: 0 };\n\n /**\n * Creates a velocity tracker instance.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.resetDeltaTime=50] - Delta time in milliseconds that resets velocity tracking.\n *\n * @param {number} [opts.scaleTime=1000] - Scales velocity calculation to new time frame. 1000 is velocity per\n * second.\n */\n constructor({ resetDeltaTime = 50, scaleTime = 1000 } = {})\n {\n this.resetDeltaTime = resetDeltaTime;\n this.scaleTime = scaleTime;\n\n Object.seal(this.#velUsed);\n }\n\n /**\n * @returns {number} Gets `resetDeltaTime`.\n */\n get resetDeltaTime() { return this.#resetDeltaTime; }\n\n /**\n * @returns {number} Gets `scaleTime`.\n */\n get scaleTime() { return this.#scaleTime; }\n\n /**\n * Sets `resetDeltaTime`.\n *\n * @param {number} resetDeltaTime - Delta time in milliseconds that resets velocity tracking.\n */\n set resetDeltaTime(resetDeltaTime)\n {\n if (!Number.isFinite(resetDeltaTime) || resetDeltaTime < 0)\n {\n throw new TypeError(`'resetDeltaTime' is not a positive finite number.`);\n }\n\n this.#resetDeltaTime = resetDeltaTime;\n }\n\n /**\n * Sets `scaleTime`.\n *\n * @param {number} scaleTime - Scales velocity calculation to new time frame. 1000 is velocity per second.\n */\n set scaleTime(scaleTime)\n {\n if (!Number.isFinite(scaleTime) || scaleTime < 0)\n {\n throw new TypeError(`'scaleTime' is not a positive finite number.`);\n }\n\n this.#scaleTime = scaleTime;\n }\n\n /**\n * Resets velocity tracking data.\n *\n * @param {number} [x=0] - 'X' value to set to last sample point.\n *\n * @param {number} [y=0] - 'Y' value to set to last sample point.\n *\n * @param {number} [z=0] - 'Z' value to set to last sample point.\n *\n * @param {number} [sampleTime=performance.now()] - A sample time in milliseconds resolution.\n */\n reset(x = 0, y = 0, z = 0, sampleTime = performance.now())\n {\n if (!Number.isFinite(x)) { throw new TypeError(`'x' is not a finite number.`); }\n if (!Number.isFinite(y)) { throw new TypeError(`'y' is not a finite number.`); }\n if (!Number.isFinite(z)) { throw new TypeError(`'z' is not a finite number.`); }\n if (!Number.isFinite(sampleTime)) { throw new TypeError(`'sampleTime' is not a finite number.`); }\n\n // Reset velocity tracking variables.\n this.#lastSampleTime = sampleTime;\n\n this.#lastSamplePoint.x = x;\n this.#lastSamplePoint.y = y;\n this.#lastSamplePoint.z = z;\n\n this.#velInstant.x = this.#velQuick.x = this.#velSmooth.x = this.#velUsed.x = 0;\n this.#velInstant.y = this.#velQuick.y = this.#velSmooth.y = this.#velUsed.y = 0;\n this.#velInstant.z = this.#velQuick.z = this.#velSmooth.z = this.#velUsed.z = 0;\n }\n\n /**\n * Runs ongoing velocity calculation of x / y / z given a sample time.\n *\n * @param {number|undefined} x - New sample X\n *\n * @param {number|undefined} y - New sample Y\n *\n * @param {number|undefined} z - New sample Z\n *\n * @param {number} [sampleTime=performance.now()] - An optional specific time w/ millisecond resolution.\n *\n * @returns {{x: number, y: number, z: number}} current velocity.\n */\n update(x = void 0, y = void 0, z = void 0, sampleTime = performance.now())\n {\n if (!Number.isFinite(sampleTime)) { throw new TypeError(`'sampleTime' is not a finite number.`); }\n\n const deltaTime = sampleTime - this.#lastSampleTime + Number.EPSILON;\n this.#lastSampleTime = sampleTime;\n\n // Reset velocity tracking if the delta time is greater than `resetDeltaTime`.\n if (deltaTime > this.#resetDeltaTime)\n {\n this.reset(x, y, z, sampleTime);\n return this.#velUsed;\n }\n\n if (Number.isFinite(x))\n {\n this.#velInstant.x = (x - this.#lastSamplePoint.x) / deltaTime;\n\n this.#lastSamplePoint.x = x;\n\n this.#velQuick.x = lerp$5(this.#velQuick.x, this.#velInstant.x, 0.1);\n this.#velSmooth.x = lerp$5(this.#velSmooth.x, this.#velInstant.x, 0.01);\n this.#velUsed.x = lerp$5(this.#velSmooth.x, this.#velQuick.x, 0.5) * this.#scaleTime;\n }\n\n if (Number.isFinite(y))\n {\n this.#velInstant.y = (y - this.#lastSamplePoint.y) / deltaTime;\n\n this.#lastSamplePoint.y = y;\n\n this.#velQuick.y = lerp$5(this.#velQuick.y, this.#velInstant.y, 0.1);\n this.#velSmooth.y = lerp$5(this.#velSmooth.y, this.#velInstant.y, 0.01);\n\n this.#velUsed.y = lerp$5(this.#velSmooth.y, this.#velQuick.y, 0.5) * this.#scaleTime;\n }\n\n if (Number.isFinite(z))\n {\n this.#velInstant.z = (z - this.#lastSamplePoint.z) / deltaTime;\n\n this.#lastSamplePoint.z = z;\n\n this.#velQuick.z = lerp$5(this.#velQuick.z, this.#velInstant.z, 0.1);\n this.#velSmooth.z = lerp$5(this.#velSmooth.z, this.#velInstant.z, 0.01);\n this.#velUsed.z = lerp$5(this.#velSmooth.z, this.#velQuick.z, 0.5) * this.#scaleTime;\n }\n\n return this.#velUsed;\n }\n\n /**\n * Gets the current velocity tracking data.\n *\n * @returns {{x: number, y: number, z: number}} Velocity tracking data.\n */\n get()\n {\n this.#velUsed.x = lerp$5(this.#velSmooth.x, this.#velQuick.x, 0.5) * this.#scaleTime;\n this.#velUsed.y = lerp$5(this.#velSmooth.y, this.#velQuick.y, 0.5) * this.#scaleTime;\n this.#velUsed.z = lerp$5(this.#velSmooth.z, this.#velQuick.z, 0.5) * this.#scaleTime;\n\n return this.#velUsed;\n }\n}\n\nexport { TJSVelocityTrack, degToRad, common as glMatrix, lerp$5 as lerp, mat2, mat2d, mat3, mat4, quat, quat2, radToDeg, vec2, vec3, vec4 };\n//# sourceMappingURL=index.js.map\n","import { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Provides a basic {@link TJSBasicAnimation} implementation for Position animation.\n */\nexport class AnimationControl\n{\n /** @type {object} */\n #animationData;\n\n /** @type {Promise<void>} */\n #finishedPromise;\n\n #willFinish;\n\n /**\n * Defines a static empty / void animation control.\n *\n * @type {AnimationControl}\n */\n static #voidControl = new AnimationControl(null);\n\n /**\n * Provides a static void / undefined AnimationControl that is automatically resolved.\n *\n * @returns {AnimationControl} Void AnimationControl\n */\n static get voidControl() { return this.#voidControl; }\n\n /**\n * @param {object|null} [animationData] - Animation data from {@link AnimationAPI}.\n *\n * @param {boolean} [willFinish] - Promise that tracks animation finished state.\n */\n constructor(animationData, willFinish = false)\n {\n this.#animationData = animationData;\n this.#willFinish = willFinish;\n\n // Set this control to animation data.\n if (isObject(animationData)) { animationData.control = this; }\n }\n\n /**\n * Get a promise that resolves when animation is finished.\n *\n * @returns {Promise<void>}\n */\n get finished()\n {\n if (!(this.#finishedPromise instanceof Promise))\n {\n this.#finishedPromise = this.#willFinish ? new Promise((resolve) => this.#animationData.resolve = resolve) :\n Promise.resolve();\n }\n\n return this.#finishedPromise;\n }\n\n /**\n * Returns whether this animation is currently active / animating.\n *\n * Note: a delayed animation may not be started / active yet. Use {@link AnimationControl.isFinished} to determine\n * if an animation is actually finished.\n *\n * @returns {boolean} Animation active state.\n */\n get isActive() { return this.#animationData.active; }\n\n /**\n * Returns whether this animation is completely finished.\n *\n * @returns {boolean} Animation finished state.\n */\n get isFinished() { return this.#animationData.finished; }\n\n /**\n * Cancels the animation.\n */\n cancel()\n {\n const animationData = this.#animationData;\n\n if (animationData === null || animationData === void 0) { return; }\n\n // Set cancelled state to true and this animation data instance will be removed from AnimationManager on next\n // update.\n animationData.cancelled = true;\n }\n}\n","/**\n * Provides animation management and scheduling allowing all Position instances to utilize one micro-task.\n */\nexport class AnimationManager\n{\n /**\n * @type {object[]}\n */\n static activeList = [];\n\n /**\n * @type {object[]}\n */\n static newList = [];\n\n /**\n * @type {number}\n */\n static current;\n\n /**\n * Add animation data.\n *\n * @param {object} data -\n */\n static add(data)\n {\n const now = performance.now();\n\n // Offset start time by delta between last rAF time. This allows continuous tween cycles to appear naturally as\n // starting from the instant they are added to the AnimationManager. This is what makes `draggable` smooth when\n // easing is enabled.\n data.start = now + (AnimationManager.current - now);\n\n AnimationManager.newList.push(data);\n }\n\n /**\n * Manage all animation\n */\n static animate()\n {\n const current = AnimationManager.current = performance.now();\n\n // Early out of the rAF callback when there are no current animations.\n if (AnimationManager.activeList.length === 0 && AnimationManager.newList.length === 0)\n {\n globalThis.requestAnimationFrame(AnimationManager.animate);\n return;\n }\n\n if (AnimationManager.newList.length)\n {\n // Process new data\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n\n // If animation instance has been cancelled before start then remove it from new list and cleanup.\n if (data.cancelled)\n {\n AnimationManager.newList.splice(cntr, 1);\n data.cleanup(data);\n }\n\n // If data is active then process it now. Delayed animations start with `active` false.\n if (data.active)\n {\n // Remove from new list and add to active list.\n AnimationManager.newList.splice(cntr, 1);\n AnimationManager.activeList.push(data);\n }\n }\n }\n\n // Process active animations.\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n\n // Remove any animations that have been canceled.\n // Ensure that the element is still connected otherwise remove it from active list and continue.\n if (data.cancelled || (data.el !== void 0 && !data.el.isConnected))\n {\n AnimationManager.activeList.splice(cntr, 1);\n data.cleanup(data);\n continue;\n }\n\n data.current = current - data.start;\n\n // Remove this animation instance if current animating time exceeds duration.\n if (data.current >= data.duration)\n {\n // Prepare final update with end position data.\n for (let dataCntr = data.keys.length; --dataCntr >= 0;)\n {\n const key = data.keys[dataCntr];\n data.newData[key] = data.destination[key];\n }\n\n data.position.set(data.newData);\n\n AnimationManager.activeList.splice(cntr, 1);\n data.cleanup(data);\n\n continue;\n }\n\n // Apply easing to create an eased time.\n const easedTime = data.ease(data.current / data.duration);\n\n for (let dataCntr = data.keys.length; --dataCntr >= 0;)\n {\n const key = data.keys[dataCntr];\n data.newData[key] = data.interpolate(data.initial[key], data.destination[key], easedTime);\n }\n\n data.position.set(data.newData);\n }\n\n globalThis.requestAnimationFrame(AnimationManager.animate);\n }\n\n /**\n * Cancels all animations for given Position instance.\n *\n * @param {Position} position - Position instance.\n */\n static cancel(position)\n {\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n if (data.position === position)\n {\n AnimationManager.activeList.splice(cntr, 1);\n data.cancelled = true;\n data.cleanup(data);\n }\n }\n\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n if (data.position === position)\n {\n AnimationManager.newList.splice(cntr, 1);\n data.cancelled = true;\n data.cleanup(data);\n }\n }\n }\n\n /**\n * Cancels all active and delayed animations.\n */\n static cancelAll()\n {\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n data.cancelled = true;\n data.cleanup(data);\n }\n\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n data.cancelled = true;\n data.cleanup(data);\n }\n\n AnimationManager.activeList.length = 0;\n AnimationManager.newList.length = 0;\n }\n\n /**\n * Gets all {@link AnimationControl} instances for a given Position instance.\n *\n * @param {Position} position - Position instance.\n *\n * @returns {AnimationControl[]} All scheduled AnimationControl instances for the given Position instance.\n */\n static getScheduled(position)\n {\n const results = [];\n\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n if (data.position === position)\n {\n results.push(data.control);\n }\n }\n\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n if (data.position === position)\n {\n results.push(data.control);\n }\n }\n\n return results;\n }\n}\n\n// Start animation manager immediately. It constantly is running in background.\nAnimationManager.animate();\n","/**\n * Stores the PositionData properties that can be animated.\n *\n * @type {Set<string>}\n */\nconst animateKeys = new Set([\n // Main keys\n 'left', 'top', 'maxWidth', 'maxHeight', 'minWidth', 'minHeight', 'width', 'height',\n 'rotateX', 'rotateY', 'rotateZ', 'scale', 'translateX', 'translateY', 'translateZ', 'zIndex',\n\n // Aliases\n 'rotation'\n]);\n\n/**\n * Defines the keys of PositionData that are transform keys.\n *\n * @type {string[]}\n */\nconst transformKeys = ['rotateX', 'rotateY', 'rotateZ', 'scale', 'translateX', 'translateY', 'translateZ'];\n\nObject.freeze(transformKeys);\n\n/**\n * Parses a relative value string in the form of '+=', '-=', or '*=' and float / numeric value. IE '+=0.2'.\n *\n * @type {RegExp}\n */\nconst relativeRegex = /^([-+*])=(-?[\\d]*\\.?[\\d]+)$/;\n\n/**\n * Provides numeric defaults for all parameters. This is used by {@link Position.get} to optionally provide\n * numeric defaults.\n *\n * @type {{rotation: number, scale: number, minWidth: null, minHeight: null, translateZ: number, top: number, left: number, maxHeight: null, translateY: number, translateX: number, width: number, transformOrigin: null, rotateX: number, rotateY: number, height: number, maxWidth: null, zIndex: null, rotateZ: number}}\n */\nconst numericDefaults = {\n // Other keys\n height: 0,\n left: 0,\n maxHeight: null,\n maxWidth: null,\n minHeight: null,\n minWidth: null,\n top: 0,\n transformOrigin: null,\n width: 0,\n zIndex: null,\n\n rotateX: 0,\n rotateY: 0,\n rotateZ: 0,\n scale: 1,\n translateX: 0,\n translateY: 0,\n translateZ: 0,\n\n rotation: 0\n};\n\nObject.freeze(numericDefaults);\n\n/**\n * Sets numeric defaults for a {@link PositionData} like object.\n *\n * @param {object} data - A PositionData like object.\n */\nfunction setNumericDefaults(data)\n{\n // Transform keys\n if (data.rotateX === null) { data.rotateX = 0; }\n if (data.rotateY === null) { data.rotateY = 0; }\n if (data.rotateZ === null) { data.rotateZ = 0; }\n if (data.translateX === null) { data.translateX = 0; }\n if (data.translateY === null) { data.translateY = 0; }\n if (data.translateZ === null) { data.translateZ = 0; }\n if (data.scale === null) { data.scale = 1; }\n\n // Aliases\n if (data.rotation === null) { data.rotation = 0; }\n}\n\n/**\n * Defines bitwise keys for transforms used in {@link Transforms.getMat4}.\n *\n * @type {object}\n */\nconst transformKeysBitwise = {\n rotateX: 1,\n rotateY: 2,\n rotateZ: 4,\n scale: 8,\n translateX: 16,\n translateY: 32,\n translateZ: 64\n};\n\nObject.freeze(transformKeysBitwise);\n\n/**\n * Defines the default transform origin.\n *\n * @type {string}\n */\nconst transformOriginDefault = 'top left';\n\n/**\n * Defines the valid transform origins.\n *\n * @type {string[]}\n */\nconst transformOrigins = ['top left', 'top center', 'top right', 'center left', 'center', 'center right', 'bottom left',\n 'bottom center', 'bottom right'];\n\nObject.freeze(transformOrigins);\n\nexport {\n animateKeys,\n numericDefaults,\n relativeRegex,\n setNumericDefaults,\n transformKeys,\n transformKeysBitwise,\n transformOriginDefault,\n transformOrigins\n};\n","import * as constants from './constants.js';\n\n/**\n * Converts any relative string values for animatable keys to actual updates performed against current data.\n *\n * @param {PositionDataExtended} positionData - position data.\n *\n * @param {Position|PositionData} position - The source position instance.\n */\nexport function convertRelative(positionData, position)\n{\n for (const key in positionData)\n {\n // Key is animatable / numeric.\n if (constants.animateKeys.has(key))\n {\n const value = positionData[key];\n\n if (typeof value !== 'string') { continue; }\n\n // Ignore 'auto' and 'inherit' string values.\n if (value === 'auto' || value === 'inherit') { continue; }\n\n const regexResults = constants.relativeRegex.exec(value);\n\n if (!regexResults)\n {\n throw new Error(\n `convertRelative error: malformed relative key (${key}) with value (${value})`);\n }\n\n const current = position[key];\n\n switch (regexResults[1])\n {\n case '-':\n positionData[key] = current - parseFloat(regexResults[2]);\n break;\n\n case '+':\n positionData[key] = current + parseFloat(regexResults[2]);\n break;\n\n case '*':\n positionData[key] = current * parseFloat(regexResults[2]);\n break;\n }\n }\n }\n}\n","import { cubicOut } from 'svelte/easing';\n\nimport { lerp } from '@typhonjs-fvtt/runtime/svelte/math';\nimport {\n isIterable,\n isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport { AnimationControl } from './AnimationControl.js';\nimport { AnimationManager } from './AnimationManager.js';\n\nimport { convertRelative } from '../convertRelative.js';\n\nimport {\n animateKeys,\n setNumericDefaults } from '../constants.js';\n\nexport class AnimationAPI\n{\n /** @type {PositionData} */\n #data;\n\n /** @type {Position} */\n #position;\n\n /**\n * Tracks the number of animation control instances that are active.\n *\n * @type {number}\n */\n #instanceCount = 0;\n\n /**\n * Provides a bound function to pass as data to AnimationManager to invoke\n *\n * @type {Function}\n * @see {AnimationAPI.#cleanupInstance}\n */\n #cleanup;\n\n constructor(position, data)\n {\n this.#position = position;\n this.#data = data;\n\n this.#cleanup = this.#cleanupInstance.bind(this);\n }\n\n /**\n * Returns whether there are scheduled animations whether active or delayed for this Position.\n *\n * @returns {boolean} Are there active animation instances.\n */\n get isScheduled()\n {\n return this.#instanceCount > 0;\n }\n\n /**\n * Adds / schedules an animation w/ the AnimationManager. This contains the final steps common to all tweens.\n *\n * @param {object} initial -\n *\n * @param {object} destination -\n *\n * @param {number} duration -\n *\n * @param {HTMLElement} el -\n *\n * @param {number} delay -\n *\n * @param {Function} ease -\n *\n * @param {Function} interpolate -\n *\n * @returns {AnimationControl} The associated animation control.\n */\n #addAnimation(initial, destination, duration, el, delay, ease, interpolate)\n {\n // Set initial data for transform values that are often null by default.\n setNumericDefaults(initial);\n setNumericDefaults(destination);\n\n // Reject all initial data that is not a number.\n for (const key in initial)\n {\n if (!Number.isFinite(initial[key])) { delete initial[key]; }\n }\n\n const keys = Object.keys(initial);\n const newData = Object.assign({ immediateElementUpdate: true }, initial);\n\n // Nothing to animate, so return now.\n if (keys.length === 0) { return AnimationControl.voidControl; }\n\n const animationData = {\n active: true,\n cleanup: this.#cleanup,\n cancelled: false,\n control: void 0,\n current: 0,\n destination,\n duration: duration * 1000, // Internally the AnimationManager works in ms.\n ease,\n el,\n finished: false,\n initial,\n interpolate,\n keys,\n newData,\n position: this.#position,\n resolve: void 0,\n start: void 0\n };\n\n if (delay > 0)\n {\n animationData.active = false;\n\n // Delay w/ setTimeout and schedule w/ AnimationManager if not already canceled\n setTimeout(() =>\n {\n if (!animationData.cancelled)\n {\n animationData.active = true;\n\n const now = performance.now();\n\n // Offset start time by delta between last rAF time. This allows a delayed tween to start from the\n // precise delayed time.\n animationData.start = now + (AnimationManager.current - now);\n }\n }, delay * 1000);\n }\n\n // Schedule immediately w/ AnimationManager\n this.#instanceCount++;\n AnimationManager.add(animationData);\n\n // Create animation control\n return new AnimationControl(animationData, true);\n }\n\n /**\n * Cancels all animation instances for this Position instance.\n */\n cancel()\n {\n AnimationManager.cancel(this.#position);\n }\n\n /**\n * Cleans up an animation instance.\n *\n * @param {object} data - Animation data for an animation instance.\n */\n #cleanupInstance(data)\n {\n this.#instanceCount--;\n\n data.active = false;\n data.finished = true;\n\n if (typeof data.resolve === 'function') { data.resolve(data.cancelled); }\n }\n\n /**\n * Returns all currently scheduled AnimationControl instances for this Position instance.\n *\n * @returns {AnimationControl[]} All currently scheduled animation controls for this Position instance.\n */\n getScheduled()\n {\n return AnimationManager.getScheduled(this.#position);\n }\n\n /**\n * Provides a tween from given position data to the current position.\n *\n * @param {PositionDataExtended} fromData - The starting position.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.delay=0] - Delay in seconds before animation starts.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {AnimationControl} A control object that can cancel animation and provides a `finished` Promise.\n */\n from(fromData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isObject(fromData))\n {\n throw new TypeError(`AnimationAPI.from error: 'fromData' is not an object.`);\n }\n\n const position = this.#position;\n const parent = position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return AnimationControl.voidControl;\n }\n\n // Cache any target element allowing AnimationManager to stop animation if it becomes disconnected from DOM.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n if (!Number.isFinite(delay) || delay < 0)\n {\n throw new TypeError(`AnimationAPI.from error: 'delay' is not a positive number.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.from error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.from error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.from error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key in fromData)\n {\n if (data[key] !== void 0 && fromData[key] !== data[key])\n {\n initial[key] = fromData[key];\n destination[key] = data[key];\n }\n }\n\n convertRelative(initial, data);\n\n return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate);\n }\n\n /**\n * Provides a tween from given position data to the current position.\n *\n * @param {PositionDataExtended} fromData - The starting position.\n *\n * @param {PositionDataExtended} toData - The ending position.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.delay=0] - Delay in seconds before animation starts.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {AnimationControl} A control object that can cancel animation and provides a `finished` Promise.\n */\n fromTo(fromData, toData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isObject(fromData))\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'fromData' is not an object.`);\n }\n\n if (!isObject(toData))\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'toData' is not an object.`);\n }\n\n const parent = this.#position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return AnimationControl.voidControl;\n }\n\n // Cache any target element allowing AnimationManager to stop animation if it becomes disconnected from DOM.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n if (!Number.isFinite(delay) || delay < 0)\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'delay' is not a positive number.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key in fromData)\n {\n if (toData[key] === void 0)\n {\n console.warn(\n `AnimationAPI.fromTo warning: key ('${key}') from 'fromData' missing in 'toData'; skipping this key.`);\n continue;\n }\n\n if (data[key] !== void 0)\n {\n initial[key] = fromData[key];\n destination[key] = toData[key];\n }\n }\n\n convertRelative(initial, data);\n convertRelative(destination, data);\n\n return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate);\n }\n\n /**\n * Provides a tween to given position data from the current position.\n *\n * @param {PositionDataExtended} toData - The destination position.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.delay=0] - Delay in seconds before animation starts.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {AnimationControl} A control object that can cancel animation and provides a `finished` Promise.\n */\n to(toData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isObject(toData))\n {\n throw new TypeError(`AnimationAPI.to error: 'toData' is not an object.`);\n }\n\n const parent = this.#position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return AnimationControl.voidControl;\n }\n\n // Cache any target element allowing AnimationManager to stop animation if it becomes disconnected from DOM.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n if (!Number.isFinite(delay) || delay < 0)\n {\n throw new TypeError(`AnimationAPI.to error: 'delay' is not a positive number.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.to error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.to error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.to error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key in toData)\n {\n if (data[key] !== void 0 && toData[key] !== data[key])\n {\n destination[key] = toData[key];\n initial[key] = data[key];\n }\n }\n\n convertRelative(destination, data);\n\n return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate);\n }\n\n /**\n * Returns a function that provides an optimized way to constantly update a to-tween.\n *\n * @param {Iterable<string>} keys - The keys for quickTo.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {quickToCallback} quick-to tween function.\n */\n quickTo(keys, { duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isIterable(keys))\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'keys' is not an iterable list.`);\n }\n\n const parent = this.#position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n throw new Error(`AnimationAPI.quickTo error: 'parent' is not positionable.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key of keys)\n {\n if (typeof key !== 'string')\n {\n throw new TypeError(`AnimationAPI.quickTo error: key is not a string.`);\n }\n\n if (!animateKeys.has(key))\n {\n throw new Error(`AnimationAPI.quickTo error: key ('${key}') is not animatable.`);\n }\n\n if (data[key] !== void 0)\n {\n destination[key] = data[key];\n initial[key] = data[key];\n }\n }\n\n const keysArray = [...keys];\n\n Object.freeze(keysArray);\n\n const newData = Object.assign({ immediateElementUpdate: true }, initial);\n\n const animationData = {\n active: true,\n cleanup: this.#cleanup,\n cancelled: false,\n control: void 0,\n current: 0,\n destination,\n duration: duration * 1000, // Internally the AnimationManager works in ms.\n ease,\n el: void 0,\n finished: true, // Note: start in finished state to add to AnimationManager on first callback.\n initial,\n interpolate,\n keys,\n newData,\n position: this.#position,\n resolve: void 0,\n start: void 0\n };\n\n const quickToCB = (...args) =>\n {\n const argsLength = args.length;\n\n if (argsLength === 0) { return; }\n\n for (let cntr = keysArray.length; --cntr >= 0;)\n {\n const key = keysArray[cntr];\n if (data[key] !== void 0) { initial[key] = data[key]; }\n }\n\n // Handle case where the first arg is an object. Update all quickTo keys from data contained in the object.\n if (isObject(args[0]))\n {\n const objData = args[0];\n\n for (const key in objData)\n {\n if (destination[key] !== void 0) { destination[key] = objData[key]; }\n }\n }\n else // Assign each variable argument to the key specified in the initial `keys` array above.\n {\n for (let cntr = 0; cntr < argsLength && cntr < keysArray.length; cntr++)\n {\n const key = keysArray[cntr];\n if (destination[key] !== void 0) { destination[key] = args[cntr]; }\n }\n }\n\n convertRelative(destination, data);\n\n // Set initial data for transform values that are often null by default.\n setNumericDefaults(initial);\n setNumericDefaults(destination);\n\n // Set target element to animation data to track if it is removed from the DOM hence ending the animation.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n animationData.el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n // Reschedule the quickTo animation with AnimationManager as it is finished.\n if (animationData.finished)\n {\n animationData.finished = false;\n animationData.active = true;\n animationData.current = 0;\n\n this.#instanceCount++;\n AnimationManager.add(animationData);\n }\n else // QuickTo animation is currently scheduled w/ AnimationManager so reset start and current time.\n {\n const now = performance.now();\n\n // Offset start time by delta between last rAF time. This allows a delayed tween to start from the\n // precise delayed time.\n animationData.start = now + (AnimationManager.current - now);\n animationData.current = 0;\n }\n };\n\n quickToCB.keys = keysArray;\n\n /**\n * Sets options of quickTo tween.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.duration] - Duration in seconds.\n *\n * @param {Function} [opts.ease] - Easing function.\n *\n * @param {Function} [opts.interpolate] - Interpolation function.\n *\n * @returns {quickToCallback} The quickTo callback.\n */\n quickToCB.options = ({ duration, ease, interpolate } = {}) => // eslint-disable-line no-shadow\n {\n if (duration !== void 0 && (!Number.isFinite(duration) || duration < 0))\n {\n throw new TypeError(`AnimationAPI.quickTo.options error: 'duration' is not a positive number.`);\n }\n\n if (ease !== void 0 && typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo.options error: 'ease' is not a function.`);\n }\n\n if (interpolate !== void 0 && typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo.options error: 'interpolate' is not a function.`);\n }\n\n if (duration >= 0) { animationData.duration = duration * 1000; }\n if (ease) { animationData.ease = ease; }\n if (interpolate) { animationData.interpolate = interpolate; }\n\n return quickToCB;\n };\n\n return quickToCB;\n }\n}\n\n/**\n * @callback quickToCallback\n *\n * @param {...number|object} args - Either individual numbers corresponding to the order in which keys are specified or\n * a single object with keys specified and numerical values.\n *\n * @property {({duration?: number, ease?: Function, interpolate?: Function}) => quickToCallback} options - A function\n * to update options for quickTo function.\n */\n","/**\n * Provides a basic {@link TJSBasicAnimation} implementation for a Position animation for a group of Position instances.\n */\nexport class AnimationGroupControl\n{\n /** @type {AnimationControl[]} */\n #animationControls;\n\n /** @type {Promise<Awaited<unknown>[]>} */\n #finishedPromise;\n\n /**\n * Defines a static empty / void animation control.\n *\n * @type {AnimationGroupControl}\n */\n static #voidControl = new AnimationGroupControl(null);\n\n /**\n * Provides a static void / undefined AnimationGroupControl that is automatically resolved.\n *\n * @returns {AnimationGroupControl} Void AnimationGroupControl\n */\n static get voidControl() { return this.#voidControl; }\n\n /**\n * @param {AnimationControl[]} animationControls - An array of AnimationControl instances.\n */\n constructor(animationControls)\n {\n this.#animationControls = animationControls;\n }\n\n /**\n * Get a promise that resolves when all animations are finished.\n *\n * @returns {Promise<Awaited<unknown>[]>|Promise<void>} Finished Promise for all animations.\n */\n get finished()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return Promise.resolve(); }\n\n if (!(this.#finishedPromise instanceof Promise))\n {\n const promises = [];\n for (let cntr = animationControls.length; --cntr >= 0;)\n {\n promises.push(animationControls[cntr].finished);\n }\n\n this.#finishedPromise = Promise.all(promises);\n }\n\n return this.#finishedPromise;\n }\n\n /**\n * Returns whether there are active animation instances for this group.\n *\n * Note: a delayed animation may not be started / active yet. Use {@link AnimationGroupControl.isFinished} to\n * determine if all animations in the group are finished.\n *\n * @returns {boolean} Are there active animation instances.\n */\n get isActive()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return false; }\n\n for (let cntr = animationControls.length; --cntr >= 0;)\n {\n if (animationControls[cntr].isActive) { return true; }\n }\n\n return false;\n }\n\n /**\n * Returns whether all animations in the group are finished.\n *\n * @returns {boolean} Are all animation instances finished.\n */\n get isFinished()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return true; }\n\n for (let cntr = animationControls.length; --cntr >= 0;)\n {\n if (!animationControls[cntr].isFinished) { return false; }\n }\n\n return false;\n }\n\n /**\n * Cancels the all animations.\n */\n cancel()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return; }\n\n for (let cntr = this.#animationControls.length; --cntr >= 0;)\n {\n this.#animationControls[cntr].cancel();\n }\n }\n}\n","import {\n isIterable,\n isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport { AnimationManager } from './AnimationManager.js';\nimport { AnimationAPI } from './AnimationAPI.js';\nimport { AnimationGroupControl } from './AnimationGroupControl.js';\n\n/**\n * Provides a public API for grouping multiple {@link Position} animations together with the AnimationManager.\n *\n * Note: To remove cyclic dependencies as this class provides the Position static / group Animation API `instanceof`\n * checks are not done against Position. Instead, a check for the animate property being an instanceof\n * {@link AnimationAPI} is performed in {@link AnimationGroupAPI.#isPosition}.\n *\n * @see AnimationAPI\n */\nexport class AnimationGroupAPI\n{\n /**\n * Checks of the given object is a Position instance by checking for AnimationAPI.\n *\n * @param {*} object - Any data.\n *\n * @returns {boolean} Is Position.\n */\n static #isPosition(object)\n {\n return isObject(object) && object.animate instanceof AnimationAPI;\n }\n\n /**\n * Cancels any animation for given Position data.\n *\n * @param {Position|{position: Position}|Iterable<Position>|Iterable<{position: Position}>} position -\n */\n static cancel(position)\n {\n if (isIterable(position))\n {\n let index = -1;\n\n for (const entry of position)\n {\n index++;\n\n const actualPosition = this.#isPosition(entry) ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.cancel warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n AnimationManager.cancel(actualPosition);\n }\n }\n else\n {\n const actualPosition = this.#isPosition(position) ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.cancel warning: No Position instance found.`);\n return;\n }\n\n AnimationManager.cancel(actualPosition);\n }\n }\n\n /**\n * Cancels all Position animation.\n */\n static cancelAll() { AnimationManager.cancelAll(); }\n\n /**\n * Gets all animation controls for the given position data.\n *\n * @param {Position|{position: Position}|Iterable<Position>|Iterable<{position: Position}>} position -\n *\n * @returns {{position: Position, data: object|void, controls: AnimationControl[]}[]} Results array.\n */\n static getScheduled(position)\n {\n const results = [];\n\n if (isIterable(position))\n {\n let index = -1;\n\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.getScheduled warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n const controls = AnimationManager.getScheduled(actualPosition);\n\n results.push({ position: actualPosition, data: isPosition ? void 0 : entry, controls });\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.getScheduled warning: No Position instance found.`);\n return results;\n }\n\n const controls = AnimationManager.getScheduled(actualPosition);\n\n results.push({ position: actualPosition, data: isPosition ? void 0 : position, controls });\n }\n\n return results;\n }\n\n /**\n * Provides the `from` animation tween for one or more Position instances as a group.\n *\n * @param {Position|{position: Position}|Iterable<Position>|Iterable<{position: Position}>} position -\n *\n * @param {object|Function} fromData -\n *\n * @param {object|Function} options -\n *\n * @returns {TJSBasicAnimation} Basic animation control.\n */\n static from(position, fromData, options)\n {\n if (!isObject(fromData) && typeof fromData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.from error: 'fromData' is not an object or function.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.from error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {AnimationControl[]}\n */\n const animationControls = [];\n\n let index = -1;\n let callbackOptions;\n\n const hasDataCallback = typeof fromData === 'function';\n const hasOptionCallback = typeof options === 'function';\n const hasCallback = hasDataCallback || hasOptionCallback;\n\n if (hasCallback) { callbackOptions = { index, position: void 0, data: void 0 }; }\n\n let actualFromData = fromData;\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.from warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n }\n\n if (hasDataCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualFromData === null || actualFromData === void 0) { continue; }\n\n if (typeof actualFromData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.from error: fromData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.from error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.from(actualFromData, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.from warning: No Position instance found.`);\n return AnimationGroupControl.voidControl;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n }\n\n if (hasDataCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n if (typeof actualFromData !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.from error: fromData callback function failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.from error: options callback function failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.from(actualFromData, actualOptions));\n }\n\n return new AnimationGroupControl(animationControls);\n }\n\n /**\n * Provides the `fromTo` animation tween for one or more Position instances as a group.\n *\n * @param {Position|{position: Position}|Iterable<Position>|Iterable<{position: Position}>} position -\n *\n * @param {object|Function} fromData -\n *\n * @param {object|Function} toData -\n *\n * @param {object|Function} options -\n *\n * @returns {TJSBasicAnimation} Basic animation control.\n */\n static fromTo(position, fromData, toData, options)\n {\n if (!isObject(fromData) && typeof fromData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: 'fromData' is not an object or function.`);\n }\n\n if (!isObject(toData) && typeof toData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: 'toData' is not an object or function.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {AnimationControl[]}\n */\n const animationControls = [];\n\n let index = -1;\n let callbackOptions;\n\n const hasFromCallback = typeof fromData === 'function';\n const hasToCallback = typeof toData === 'function';\n const hasOptionCallback = typeof options === 'function';\n const hasCallback = hasFromCallback || hasToCallback || hasOptionCallback;\n\n if (hasCallback) { callbackOptions = { index, position: void 0, data: void 0 }; }\n\n let actualFromData = fromData;\n let actualToData = toData;\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.fromTo warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n }\n\n if (hasFromCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualFromData === null || actualFromData === void 0) { continue; }\n\n if (typeof actualFromData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: fromData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasToCallback)\n {\n actualToData = toData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualToData === null || actualToData === void 0) { continue; }\n\n if (typeof actualToData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: toData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.fromTo(actualFromData, actualToData, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.fromTo warning: No Position instance found.`);\n return AnimationGroupControl.voidControl;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n }\n\n if (hasFromCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n if (typeof actualFromData !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.fromTo error: fromData callback function failed to return an object.`);\n }\n }\n\n if (hasToCallback)\n {\n actualToData = toData(callbackOptions);\n\n if (typeof actualToData !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.fromTo error: toData callback function failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.fromTo error: options callback function failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.fromTo(actualFromData, actualToData, actualOptions));\n }\n\n return new AnimationGroupControl(animationControls);\n }\n\n /**\n * Provides the `to` animation tween for one or more Position instances as a group.\n *\n * @param {Position|{position: Position}|Iterable<Position>|Iterable<{position: Position}>} position -\n *\n * @param {object|Function} toData -\n *\n * @param {object|Function} options -\n *\n * @returns {TJSBasicAnimation} Basic animation control.\n */\n static to(position, toData, options)\n {\n if (!isObject(toData) && typeof toData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.to error: 'toData' is not an object or function.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.to error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {AnimationControl[]}\n */\n const animationControls = [];\n\n let index = -1;\n let callbackOptions;\n\n const hasDataCallback = typeof toData === 'function';\n const hasOptionCallback = typeof options === 'function';\n const hasCallback = hasDataCallback || hasOptionCallback;\n\n if (hasCallback) { callbackOptions = { index, position: void 0, data: void 0 }; }\n\n let actualToData = toData;\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.to warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n }\n\n if (hasDataCallback)\n {\n actualToData = toData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualToData === null || actualToData === void 0) { continue; }\n\n if (typeof actualToData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.to error: toData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.to error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.to(actualToData, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.to warning: No Position instance found.`);\n return AnimationGroupControl.voidControl;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n }\n\n if (hasDataCallback)\n {\n actualToData = toData(callbackOptions);\n\n if (typeof actualToData !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.to error: toData callback function failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.to error: options callback function failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.to(actualToData, actualOptions));\n }\n\n return new AnimationGroupControl(animationControls);\n }\n\n /**\n * Provides the `to` animation tween for one or more Position instances as a group.\n *\n * @param {Position|{position: Position}|Iterable<Position>|Iterable<{position: Position}>} position -\n *\n * @param {Iterable<string>} keys -\n *\n * @param {object|Function} options -\n *\n * @returns {quickToCallback} Basic animation control.\n */\n static quickTo(position, keys, options)\n {\n if (!isIterable(keys))\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: 'keys' is not an iterable list.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {quickToCallback[]}\n */\n const quickToCallbacks = [];\n\n let index = -1;\n\n const hasOptionCallback = typeof options === 'function';\n\n const callbackOptions = { index, position: void 0, data: void 0 };\n\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.quickTo warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n quickToCallbacks.push(actualPosition.animate.quickTo(keys, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.quickTo warning: No Position instance found.`);\n return () => null;\n }\n\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.quickTo error: options callback function failed to return an object.`);\n }\n }\n\n quickToCallbacks.push(actualPosition.animate.quickTo(keys, actualOptions));\n }\n\n const keysArray = [...keys];\n\n Object.freeze(keysArray);\n\n const quickToCB = (...args) =>\n {\n const argsLength = args.length;\n\n if (argsLength === 0) { return; }\n\n if (typeof args[0] === 'function')\n {\n const dataCallback = args[0];\n\n index = -1;\n let cntr = 0;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition)) { continue; }\n\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n\n const toData = dataCallback(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (toData === null || toData === void 0) { continue; }\n\n /**\n * @type {boolean}\n */\n const toDataIterable = isIterable(toData);\n\n if (!Number.isFinite(toData) && !toDataIterable && typeof toData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: toData callback function iteration(${\n index}) failed to return a finite number, iterable list, or object.`);\n }\n\n if (toDataIterable)\n {\n quickToCallbacks[cntr++](...toData);\n }\n else\n {\n quickToCallbacks[cntr++](toData);\n }\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition)) { return; }\n\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n\n const toData = dataCallback(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (toData === null || toData === void 0) { return; }\n\n const toDataIterable = isIterable(toData);\n\n if (!Number.isFinite(toData) && !toDataIterable && typeof toData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: toData callback function iteration(${\n index}) failed to return a finite number, iterable list, or object.`);\n }\n\n if (toDataIterable)\n {\n quickToCallbacks[cntr++](...toData);\n }\n else\n {\n quickToCallbacks[cntr++](toData);\n }\n }\n }\n else\n {\n for (let cntr = quickToCallbacks.length; --cntr >= 0;)\n {\n quickToCallbacks[cntr](...args);\n }\n }\n };\n\n quickToCB.keys = keysArray;\n\n /**\n * Sets options of quickTo tween.\n *\n * @param {object|Function} [options] - Optional parameters.\n *\n * @param {number} [options.duration] - Duration in seconds.\n *\n * @param {Function} [options.ease] - Easing function.\n *\n * @param {Function} [options.interpolate] - Interpolation function.\n *\n * @returns {quickToCallback} The quickTo callback.\n */\n quickToCB.options = (options) => // eslint-disable-line no-shadow\n {\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: 'options' is not an object or function.`);\n }\n\n // Set options object for each quickTo callback.\n if (isObject(options))\n {\n for (let cntr = quickToCallbacks.length; --cntr >= 0;) { quickToCallbacks[cntr].options(options); }\n }\n else if (typeof options === 'function')\n {\n if (isIterable(position))\n {\n index = -1;\n let cntr = 0;\n\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(\n `AnimationGroupAPI.quickTo.options warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.quickTo.options error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n\n quickToCallbacks[cntr++].options(actualOptions);\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.quickTo.options warning: No Position instance found.`);\n return quickToCB;\n }\n\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n\n actualOptions = options(callbackOptions);\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.quickTo error: options callback function failed to return an object.`);\n }\n\n quickToCallbacks[0].options(actualOptions);\n }\n }\n\n return quickToCB;\n };\n\n return quickToCB;\n }\n}\n","export class Centered\n{\n /**\n * @type {HTMLElement}\n */\n #element;\n\n /**\n * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not\n * performance oriented. If manually set this height is used instead of `offsetHeight`.\n *\n * @type {number}\n */\n #height;\n\n /**\n * Set from an optional value in the constructor to lock accessors preventing modification.\n */\n #lock;\n\n /**\n * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not\n * performance oriented. If manually set this width is used instead of `offsetWidth`.\n *\n * @type {number}\n */\n #width;\n\n constructor({ element, lock = false, width, height } = {})\n {\n this.element = element;\n this.width = width;\n this.height = height;\n\n this.#lock = typeof lock === 'boolean' ? lock : false;\n }\n\n get element() { return this.#element; }\n\n get height() { return this.#height; }\n\n get width() { return this.#width; }\n\n set element(element)\n {\n if (this.#lock) { return; }\n\n if (element === void 0 || element === null || element instanceof HTMLElement)\n {\n this.#element = element;\n }\n else\n {\n throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`);\n }\n }\n\n set height(height)\n {\n if (this.#lock) { return; }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n set width(width)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n }\n\n setDimension(width, height)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n getLeft(width)\n {\n // Determine containing bounds from manual values; or any element; lastly the browser width / height.\n const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth;\n\n return (boundsWidth - width) / 2;\n }\n\n getTop(height)\n {\n const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight;\n\n return (boundsHeight - height) / 2;\n }\n}\n","import { Centered } from './Centered.js';\n\nconst browserCentered = new Centered();\n\nexport { browserCentered, Centered };\n\n","export class PositionChangeSet\n{\n constructor()\n {\n this.left = false;\n this.top = false;\n this.width = false;\n this.height = false;\n this.maxHeight = false;\n this.maxWidth = false;\n this.minHeight = false;\n this.minWidth = false;\n this.zIndex = false;\n this.transform = false;\n this.transformOrigin = false;\n }\n\n hasChange()\n {\n return this.left || this.top || this.width || this.height || this.maxHeight || this.maxWidth || this.minHeight ||\n this.minWidth || this.zIndex || this.transform || this.transformOrigin;\n }\n\n set(value)\n {\n this.left = value;\n this.top = value;\n this.width = value;\n this.height = value;\n this.maxHeight = value;\n this.maxWidth = value;\n this.minHeight = value;\n this.minWidth = value;\n this.zIndex = value;\n this.transform = value;\n this.transformOrigin = value;\n }\n}\n","/**\n * Defines stored positional data.\n */\nexport class PositionData\n{\n constructor({ height = null, left = null, maxHeight = null, maxWidth = null, minHeight = null, minWidth = null,\n rotateX = null, rotateY = null, rotateZ = null, scale = null, translateX = null, translateY = null,\n translateZ = null, top = null, transformOrigin = null, width = null, zIndex = null } = {})\n {\n /**\n * @type {number|'auto'|'inherit'|null}\n */\n this.height = height;\n\n /**\n * @type {number|null}\n */\n this.left = left;\n\n /**\n * @type {number|null}\n */\n this.maxHeight = maxHeight;\n\n /**\n * @type {number|null}\n */\n this.maxWidth = maxWidth;\n\n /**\n * @type {number|null}\n */\n this.minHeight = minHeight;\n\n /**\n * @type {number|null}\n */\n this.minWidth = minWidth;\n\n /**\n * @type {number|null}\n */\n this.rotateX = rotateX;\n\n /**\n * @type {number|null}\n */\n this.rotateY = rotateY;\n\n /**\n * @type {number|null}\n */\n this.rotateZ = rotateZ;\n\n /**\n * @type {number|null}\n */\n this.scale = scale;\n\n /**\n * @type {number|null}\n */\n this.top = top;\n\n /**\n * @type {string|null}\n */\n this.transformOrigin = transformOrigin;\n\n /**\n * @type {number|null}\n */\n this.translateX = translateX;\n\n /**\n * @type {number|null}\n */\n this.translateY = translateY;\n\n /**\n * @type {number|null}\n */\n this.translateZ = translateZ;\n\n /**\n * @type {number|'auto'|'inherit'|null}\n */\n this.width = width;\n\n /**\n * @type {number|null}\n */\n this.zIndex = zIndex;\n\n Object.seal(this);\n }\n\n /**\n * Copies given data to this instance.\n *\n * @param {PositionData} data - Copy from this instance.\n *\n * @returns {PositionData} This instance.\n */\n copy(data)\n {\n this.height = data.height;\n this.left = data.left;\n this.maxHeight = data.maxHeight;\n this.maxWidth = data.maxWidth;\n this.minHeight = data.minHeight;\n this.minWidth = data.minWidth;\n this.rotateX = data.rotateX;\n this.rotateY = data.rotateY;\n this.rotateZ = data.rotateZ;\n this.scale = data.scale;\n this.top = data.top;\n this.transformOrigin = data.transformOrigin;\n this.translateX = data.translateX;\n this.translateY = data.translateY;\n this.translateZ = data.translateZ;\n this.width = data.width;\n this.zIndex = data.zIndex;\n\n return this;\n }\n}\n","import { linear } from 'svelte/easing';\n\nimport { lerp } from '@typhonjs-fvtt/runtime/svelte/math';\nimport { isIterable } from '@typhonjs-fvtt/runtime/svelte/util';\n\nexport class PositionStateAPI\n{\n /** @type {PositionData} */\n #data;\n\n /**\n * @type {Map<string, PositionDataExtended>}\n */\n #dataSaved = new Map();\n\n /** @type {Position} */\n #position;\n\n /** @type {Transforms} */\n #transforms;\n\n constructor(position, data, transforms)\n {\n this.#position = position;\n this.#data = data;\n this.#transforms = transforms;\n }\n\n /**\n * Returns any stored save state by name.\n *\n * @param {string} name - Saved data set name.\n *\n * @returns {PositionDataExtended} The saved data set.\n */\n get({ name })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - getSave error: 'name' is not a string.`); }\n\n return this.#dataSaved.get(name);\n }\n\n /**\n * Returns any associated default data.\n *\n * @returns {PositionDataExtended} Associated default data.\n */\n getDefault()\n {\n return this.#dataSaved.get('#defaultData');\n }\n\n /**\n * Removes and returns any position state by name.\n *\n * @param {object} options - Options.\n *\n * @param {string} options.name - Name to remove and retrieve.\n *\n * @returns {PositionDataExtended} Saved position data.\n */\n remove({ name })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - remove: 'name' is not a string.`); }\n\n const data = this.#dataSaved.get(name);\n this.#dataSaved.delete(name);\n\n return data;\n }\n\n /**\n * Resets data to default values and invokes set.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.keepZIndex=false] - When true keeps current z-index.\n *\n * @param {boolean} [opts.invokeSet=true] - When true invokes set method.\n *\n * @returns {boolean} Operation successful.\n */\n reset({ keepZIndex = false, invokeSet = true } = {})\n {\n const defaultData = this.#dataSaved.get('#defaultData');\n\n // Quit early if there is no saved default data.\n if (typeof defaultData !== 'object') { return false; }\n\n // Cancel all animations for Position if there are currently any scheduled.\n if (this.#position.animate.isScheduled)\n {\n this.#position.animate.cancel();\n }\n\n const zIndex = this.#position.zIndex;\n\n const data = Object.assign({}, defaultData);\n\n if (keepZIndex) { data.zIndex = zIndex; }\n\n // Reset the transform data.\n this.#transforms.reset(data);\n\n // If current minimized invoke `maximize`.\n if (this.#position.parent?.reactive?.minimized)\n {\n this.#position.parent?.maximize?.({ animate: false, duration: 0 });\n }\n\n // Note next clock tick scheduling.\n if (invokeSet) { setTimeout(() => this.#position.set(data), 0); }\n\n return true;\n }\n\n /**\n * Restores a saved positional state returning the data. Several optional parameters are available\n * to control whether the restore action occurs silently (no store / inline styles updates), animates\n * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} allows\n * specification of the duration, easing, and interpolate functions along with configuring a Promise to be\n * returned if awaiting the end of the animation.\n *\n * @param {object} params - Parameters\n *\n * @param {string} params.name - Saved data set name.\n *\n * @param {boolean} [params.remove=false] - Remove data set.\n *\n * @param {Iterable<string>} [params.properties] - Specific properties to set / animate.\n *\n * @param {boolean} [params.silent] - Set position data directly; no store or style updates.\n *\n * @param {boolean} [params.async=false] - If animating return a Promise that resolves with any saved data.\n *\n * @param {boolean} [params.animateTo=false] - Animate to restore data.\n *\n * @param {number} [params.duration=0.1] - Duration in seconds.\n *\n * @param {Function} [params.ease=linear] - Easing function.\n *\n * @param {Function} [params.interpolate=lerp] - Interpolation function.\n *\n * @returns {PositionDataExtended|Promise<PositionDataExtended>} Saved position data.\n */\n restore({ name, remove = false, properties, silent = false, async = false, animateTo = false, duration = 0.1,\n ease = linear, interpolate = lerp })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - restore error: 'name' is not a string.`); }\n\n const dataSaved = this.#dataSaved.get(name);\n\n if (dataSaved)\n {\n if (remove) { this.#dataSaved.delete(name); }\n\n let data = dataSaved;\n\n if (isIterable(properties))\n {\n data = {};\n for (const property of properties) { data[property] = dataSaved[property]; }\n }\n\n // Update data directly with no store or inline style updates.\n if (silent)\n {\n for (const property in data) { this.#data[property] = data[property]; }\n return dataSaved;\n }\n else if (animateTo) // Animate to saved data.\n {\n // Provide special handling to potentially change transform origin as this parameter is not animated.\n if (data.transformOrigin !== this.#position.transformOrigin)\n {\n this.#position.transformOrigin = data.transformOrigin;\n }\n\n // Return a Promise with saved data that resolves after animation ends.\n if (async)\n {\n return this.#position.animate.to(data, { duration, ease, interpolate }).finished.then(() => dataSaved);\n }\n else // Animate synchronously.\n {\n this.#position.animate.to(data, { duration, ease, interpolate });\n }\n }\n else\n {\n // Default options is to set data for an immediate update.\n this.#position.set(data);\n }\n }\n\n return dataSaved;\n }\n\n /**\n * Saves current position state with the opportunity to add extra data to the saved state.\n *\n * @param {object} opts - Options.\n *\n * @param {string} opts.name - name to index this saved data.\n *\n * @param {...*} [opts.extra] - Extra data to add to saved data.\n *\n * @returns {PositionData} Current position data\n */\n save({ name, ...extra })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - save error: 'name' is not a string.`); }\n\n const data = this.#position.get(extra);\n\n this.#dataSaved.set(name, data);\n\n return data;\n }\n\n /**\n * Directly sets a position state.\n *\n * @param {object} opts - Options.\n *\n * @param {string} opts.name - name to index this saved data.\n *\n * @param {...*} [opts.data] - Position data to set.\n */\n set({ name, ...data })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - set error: 'name' is not a string.`); }\n\n this.#dataSaved.set(name, data);\n }\n}\n","import { writable } from 'svelte/store';\n\nimport { propertyStore } from '@typhonjs-fvtt/runtime/svelte/store';\nimport { styleParsePixels } from '@typhonjs-fvtt/runtime/svelte/util';\n\nexport class StyleCache\n{\n constructor()\n {\n /** @type {HTMLElement|undefined} */\n this.el = void 0;\n\n /** @type {CSSStyleDeclaration} */\n this.computed = void 0;\n\n /** @type {number|undefined} */\n this.marginLeft = void 0;\n\n /** @type {number|undefined} */\n this.marginTop = void 0;\n\n /** @type {number|undefined} */\n this.maxHeight = void 0;\n\n /** @type {number|undefined} */\n this.maxWidth = void 0;\n\n /** @type {number|undefined} */\n this.minHeight = void 0;\n\n /** @type {number|undefined} */\n this.minWidth = void 0;\n\n /** @type {boolean} */\n this.hasWillChange = false;\n\n /**\n * @type {ResizeObserverData}\n */\n this.resizeObserved = {\n contentHeight: void 0,\n contentWidth: void 0,\n offsetHeight: void 0,\n offsetWidth: void 0\n };\n\n /**\n * Provides a writable store to track offset & content width / height from an associated `resizeObserver` action.\n *\n * @type {Writable<ResizeObserverData>}\n */\n const storeResizeObserved = writable(this.resizeObserved);\n\n this.stores = {\n element: writable(this.el),\n resizeContentHeight: propertyStore(storeResizeObserved, 'contentHeight'),\n resizeContentWidth: propertyStore(storeResizeObserved, 'contentWidth'),\n resizeObserved: storeResizeObserved,\n resizeOffsetHeight: propertyStore(storeResizeObserved, 'offsetHeight'),\n resizeOffsetWidth: propertyStore(storeResizeObserved, 'offsetWidth')\n };\n }\n\n /**\n * Returns the cached offsetHeight from any attached `resizeObserver` action otherwise gets the offsetHeight from\n * the element directly. The more optimized path is using `resizeObserver` as getting it from the element\n * directly is more expensive and alters the execution order of an animation frame.\n *\n * @returns {number} The element offsetHeight.\n */\n get offsetHeight()\n {\n if (this.el instanceof HTMLElement)\n {\n return this.resizeObserved.offsetHeight !== void 0 ? this.resizeObserved.offsetHeight : this.el.offsetHeight;\n }\n\n throw new Error(`StyleCache - get offsetHeight error: no element assigned.`);\n }\n\n /**\n * Returns the cached offsetWidth from any attached `resizeObserver` action otherwise gets the offsetWidth from\n * the element directly. The more optimized path is using `resizeObserver` as getting it from the element\n * directly is more expensive and alters the execution order of an animation frame.\n *\n * @returns {number} The element offsetHeight.\n */\n get offsetWidth()\n {\n if (this.el instanceof HTMLElement)\n {\n return this.resizeObserved.offsetWidth !== void 0 ? this.resizeObserved.offsetWidth : this.el.offsetWidth;\n }\n\n throw new Error(`StyleCache - get offsetWidth error: no element assigned.`);\n }\n\n /**\n * @param {HTMLElement} el -\n *\n * @returns {boolean} Does element match cached element.\n */\n hasData(el) { return this.el === el; }\n\n /**\n * Resets the style cache.\n */\n reset()\n {\n // Remove will-change inline style from previous element if it is still connected.\n if (this.el instanceof HTMLElement && this.el.isConnected && !this.hasWillChange)\n {\n this.el.style.willChange = null;\n }\n\n this.el = void 0;\n this.computed = void 0;\n this.marginLeft = void 0;\n this.marginTop = void 0;\n this.maxHeight = void 0;\n this.maxWidth = void 0;\n this.minHeight = void 0;\n this.minWidth = void 0;\n\n this.hasWillChange = false;\n\n // Silently reset `resizedObserved`; With proper usage the `resizeObserver` action issues an update on removal.\n this.resizeObserved.contentHeight = void 0;\n this.resizeObserved.contentWidth = void 0;\n this.resizeObserved.offsetHeight = void 0;\n this.resizeObserved.offsetWidth = void 0;\n\n // Reset the tracked element this Position instance is modifying.\n this.stores.element.set(void 0);\n }\n\n /**\n * Updates the style cache with new data from the given element.\n *\n * @param {HTMLElement} el - An HTML element.\n */\n update(el)\n {\n this.el = el;\n\n this.computed = globalThis.getComputedStyle(el);\n\n this.marginLeft = styleParsePixels(el.style.marginLeft) ?? styleParsePixels(this.computed.marginLeft);\n this.marginTop = styleParsePixels(el.style.marginTop) ?? styleParsePixels(this.computed.marginTop);\n this.maxHeight = styleParsePixels(el.style.maxHeight) ?? styleParsePixels(this.computed.maxHeight);\n this.maxWidth = styleParsePixels(el.style.maxWidth) ?? styleParsePixels(this.computed.maxWidth);\n\n // Note that the computed styles for below will always be 0px / 0 when no style is active.\n this.minHeight = styleParsePixels(el.style.minHeight) ?? styleParsePixels(this.computed.minHeight);\n this.minWidth = styleParsePixels(el.style.minWidth) ?? styleParsePixels(this.computed.minWidth);\n\n // Tracks if there already is a will-change property on the inline or computed styles.\n const willChange = el.style.willChange !== '' ? el.style.willChange : void 0 ?? this.computed.willChange;\n\n this.hasWillChange = willChange !== '' && willChange !== 'auto';\n\n // Update the tracked element this Position instance is modifying.\n this.stores.element.set(el);\n }\n}\n","import { mat4, vec3 } from '@typhonjs-fvtt/runtime/svelte/math';\n\n/**\n * Provides the output data for {@link Transforms.getData}.\n */\nexport class TransformData\n{\n constructor()\n {\n Object.seal(this);\n }\n\n /**\n * Stores the calculated bounding rectangle.\n *\n * @type {DOMRect}\n */\n #boundingRect = new DOMRect();\n\n /**\n * Stores the individual transformed corner points of the window in screenspace clockwise from:\n * top left -> top right -> bottom right -> bottom left.\n *\n * @type {Vector3[]}\n */\n #corners = [vec3.create(), vec3.create(), vec3.create(), vec3.create()];\n\n /**\n * Stores the current gl-matrix mat4 data.\n *\n * @type {Matrix4}\n */\n #mat4 = mat4.create();\n\n /**\n * Stores the pre & post origin translations to apply to matrix transforms.\n *\n * @type {Matrix4[]}\n */\n #originTranslations = [mat4.create(), mat4.create()];\n\n /**\n * @returns {DOMRect} The bounding rectangle.\n */\n get boundingRect() { return this.#boundingRect; }\n\n /**\n * @returns {Vector3[]} The transformed corner points as vec3 in screen space.\n */\n get corners() { return this.#corners; }\n\n /**\n * @returns {string} Returns the CSS style string for the transform matrix.\n */\n get css() { return `matrix3d(${this.mat4.join(',')})`; }\n\n /**\n * @returns {Matrix4} The transform matrix.\n */\n get mat4() { return this.#mat4; }\n\n /**\n * @returns {Matrix4[]} The pre / post translation matrices for origin translation.\n */\n get originTranslations() { return this.#originTranslations; }\n}\n\n/**\n * @typedef {Float32Array} Vector3 - 3 Dimensional Vector.\n *\n * @see https://glmatrix.net/docs/module-vec3.html\n */\n\n/**\n * @typedef {Float32Array} Matrix4 - 4x4 Matrix; Format: column-major, when typed out it looks like row-major.\n *\n * @see https://glmatrix.net/docs/module-mat4.html\n */\n","import { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Provides the storage and sequencing of managed position validators. Each validator added may be a bespoke function or\n * a {@link ValidatorData} object containing an `id`, `validator`, and `weight` attributes; `validator` is the only\n * required attribute.\n *\n * The `id` attribute can be anything that creates a unique ID for the validator; recommended strings or numbers. This\n * allows validators to be removed by ID easily.\n *\n * The `weight` attribute is a number between 0 and 1 inclusive that allows validators to be added in a\n * predictable order which is especially handy if they are manipulated at runtime. A lower weighted validator always\n * runs before a higher weighted validator. If no weight is specified the default of '1' is assigned and it is appended\n * to the end of the validators list.\n *\n * This class forms the public API which is accessible from the `.validators` getter in the main Position instance.\n * ```\n * const position = new Position(<PositionData>);\n * position.validators.add(...);\n * position.validators.clear();\n * position.validators.length;\n * position.validators.remove(...);\n * position.validators.removeBy(...);\n * position.validators.removeById(...);\n * ```\n */\nexport class AdapterValidators\n{\n /** @type {boolean} */\n #enabled = true;\n\n /**\n * @type {ValidatorData[]}\n */\n #validatorData;\n\n #mapUnsubscribe = new Map();\n\n /**\n * @returns {[AdapterValidators, ValidatorData[]]} Returns this and internal storage for validator adapter.\n */\n constructor()\n {\n this.#validatorData = [];\n\n Object.seal(this);\n\n return [this, this.#validatorData];\n }\n\n /**\n * @returns {boolean} Returns the enabled state.s\n */\n get enabled() { return this.#enabled; }\n\n /**\n * @returns {number} Returns the length of the validators array.\n */\n get length() { return this.#validatorData.length; }\n\n /**\n * @param {boolean} enabled - Sets enabled state.\n */\n set enabled(enabled)\n {\n if (typeof enabled !== 'boolean') { throw new TypeError(`'enabled' is not a boolean.`); }\n\n this.#enabled = enabled;\n }\n\n /**\n * Provides an iterator for validators.\n *\n * @returns {Generator<ValidatorData|undefined>} Generator / iterator of validators.\n * @yields {ValidatorData}\n */\n *[Symbol.iterator]()\n {\n if (this.#validatorData.length === 0) { return; }\n\n for (const entry of this.#validatorData)\n {\n yield { ...entry };\n }\n }\n\n /**\n * @param {...(ValidatorFn|ValidatorData)} validators -\n */\n add(...validators)\n {\n /**\n * Tracks the number of validators added that have subscriber functionality.\n *\n * @type {number}\n */\n // let subscribeCount = 0; // TODO: Currently unused\n\n for (const validator of validators)\n {\n const validatorType = typeof validator;\n\n if (validatorType !== 'function' && validatorType !== 'object' || validator === null)\n {\n throw new TypeError(`AdapterValidator error: 'validator' is not a function or object.`);\n }\n\n let data = void 0;\n let subscribeFn = void 0;\n\n switch (validatorType)\n {\n case 'function':\n data = {\n id: void 0,\n validator,\n weight: 1\n };\n\n subscribeFn = validator.subscribe;\n break;\n\n case 'object':\n if (typeof validator.validator !== 'function')\n {\n throw new TypeError(`AdapterValidator error: 'validator' attribute is not a function.`);\n }\n\n if (validator.weight !== void 0 && typeof validator.weight !== 'number' ||\n (validator.weight < 0 || validator.weight > 1))\n {\n throw new TypeError(\n `AdapterValidator error: 'weight' attribute is not a number between '0 - 1' inclusive.`);\n }\n\n data = {\n id: validator.id !== void 0 ? validator.id : void 0,\n validator: validator.validator.bind(validator),\n weight: validator.weight || 1,\n instance: validator\n };\n\n subscribeFn = validator.validator.subscribe ?? validator.subscribe;\n break;\n }\n\n // Find the index to insert where data.weight is less than existing values weight.\n const index = this.#validatorData.findIndex((value) =>\n {\n return data.weight < value.weight;\n });\n\n // If an index was found insert at that location.\n if (index >= 0)\n {\n this.#validatorData.splice(index, 0, data);\n }\n else // push to end of validators.\n {\n this.#validatorData.push(data);\n }\n\n if (typeof subscribeFn === 'function')\n {\n // TODO: consider how to handle validator updates.\n const unsubscribe = subscribeFn();\n\n // Ensure that unsubscribe is a function.\n if (typeof unsubscribe !== 'function')\n {\n throw new TypeError(\n 'AdapterValidator error: Filter has subscribe function, but no unsubscribe function is returned.');\n }\n\n // Ensure that the same validator is not subscribed to multiple times.\n if (this.#mapUnsubscribe.has(data.validator))\n {\n throw new Error(\n 'AdapterValidator error: Filter added already has an unsubscribe function registered.');\n }\n\n this.#mapUnsubscribe.set(data.validator, unsubscribe);\n // subscribeCount++; // TODO: Currently unused\n }\n }\n\n // Filters with subscriber functionality are assumed to immediately invoke the `subscribe` callback. If the\n // subscriber count is less than the amount of validators added then automatically trigger an index update\n // manually.\n // TODO: handle validator updates.\n // if (subscribeCount < validators.length) { this.#indexUpdate(); }\n }\n\n clear()\n {\n this.#validatorData.length = 0;\n\n // Unsubscribe from all validators with subscription support.\n for (const unsubscribe of this.#mapUnsubscribe.values())\n {\n unsubscribe();\n }\n\n this.#mapUnsubscribe.clear();\n\n // TODO: handle validator updates.\n // this.#indexUpdate();\n }\n\n /**\n * @param {...(ValidatorFn|ValidatorData)} validators -\n */\n remove(...validators)\n {\n const length = this.#validatorData.length;\n\n if (length === 0) { return; }\n\n for (const data of validators)\n {\n // Handle the case that the validator may either be a function or a validator entry / object.\n const actualValidator = typeof data === 'function' ? data : isObject(data) ? data.validator : void 0;\n\n if (!actualValidator) { continue; }\n\n for (let cntr = this.#validatorData.length; --cntr >= 0;)\n {\n if (this.#validatorData[cntr].validator === actualValidator)\n {\n this.#validatorData.splice(cntr, 1);\n\n // Invoke any unsubscribe function for given validator then remove from tracking.\n let unsubscribe = void 0;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(actualValidator)) === 'function')\n {\n unsubscribe();\n this.#mapUnsubscribe.delete(actualValidator);\n }\n }\n }\n }\n\n // Update the index a validator was removed.\n // TODO: handle validator updates.\n // if (length !== this.#validatorData.length) { this.#indexUpdate(); }\n }\n\n /**\n * Remove validators by the provided callback. The callback takes 3 parameters: `id`, `validator`, and `weight`.\n * Any truthy value returned will remove that validator.\n *\n * @param {function(*, ValidatorFn, number): boolean} callback - Callback function to evaluate each validator\n * entry.\n */\n removeBy(callback)\n {\n const length = this.#validatorData.length;\n\n if (length === 0) { return; }\n\n if (typeof callback !== 'function')\n {\n throw new TypeError(`AdapterValidator error: 'callback' is not a function.`);\n }\n\n this.#validatorData = this.#validatorData.filter((data) =>\n {\n const remove = callback.call(callback, { ...data });\n\n if (remove)\n {\n let unsubscribe;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.validator)) === 'function')\n {\n unsubscribe();\n this.#mapUnsubscribe.delete(data.validator);\n }\n }\n\n // Reverse remove boolean to properly validator / remove this validator.\n return !remove;\n });\n\n // TODO: handle validator updates.\n // if (length !== this.#validatorData.length) { this.#indexUpdate(); }\n }\n\n removeById(...ids)\n {\n const length = this.#validatorData.length;\n\n if (length === 0) { return; }\n\n this.#validatorData = this.#validatorData.filter((data) =>\n {\n let remove = false;\n\n for (const id of ids) { remove |= data.id === id; }\n\n // If not keeping invoke any unsubscribe function for given validator then remove from tracking.\n if (remove)\n {\n let unsubscribe;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.validator)) === 'function')\n {\n unsubscribe();\n this.#mapUnsubscribe.delete(data.validator);\n }\n }\n\n return !remove; // Swap here to actually remove the item via array validator method.\n });\n\n // TODO: handle validator updates.\n // if (length !== this.#validatorData.length) { this.#indexUpdate(); }\n }\n}\n\n/**\n * @callback ValidatorFn - Position validator function that takes a {@link PositionData} instance potentially\n * modifying it or returning null if invalid.\n *\n * @param {ValidationData} valData - Validation data.\n *\n * @returns {PositionData|null} The validated position data or null to cancel position update.\n *\n */\n\n/**\n * @typedef {object} ValidatorData\n *\n * @property {*} [id=undefined] - An ID associated with this validator. Can be used to remove the validator.\n *\n * @property {ValidatorFn} validator - Position validator function that takes a {@link PositionData} instance\n * potentially modifying it or returning null if invalid.\n *\n * @property {number} [weight=1] - A number between 0 and 1 inclusive to position this validator against others.\n *\n * @property {Function} [subscribe] - Optional subscribe function following the Svelte store / subscribe pattern.\n */\n\n/**\n * @typedef {ValidatorFn|ValidatorData|Iterable<ValidatorFn|ValidatorData>} PositionValidatorOptions Defines the\n * position validator options.\n */\n","export class BasicBounds\n{\n /**\n * When true constrains the min / max width or height to element.\n *\n * @type {boolean}\n */\n #constrain;\n\n /**\n * @type {HTMLElement}\n */\n #element;\n\n /**\n * When true the validator is active.\n *\n * @type {boolean}\n */\n #enabled;\n\n /**\n * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not\n * performance oriented. If manually set this height is used instead of `offsetHeight`.\n *\n * @type {number}\n */\n #height;\n\n /**\n * Set from an optional value in the constructor to lock accessors preventing modification.\n */\n #lock;\n\n /**\n * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not\n * performance oriented. If manually set this width is used instead of `offsetWidth`.\n *\n * @type {number}\n */\n #width;\n\n constructor({ constrain = true, element, enabled = true, lock = false, width, height } = {})\n {\n this.element = element;\n this.constrain = constrain;\n this.enabled = enabled;\n this.width = width;\n this.height = height;\n\n this.#lock = typeof lock === 'boolean' ? lock : false;\n }\n\n get constrain() { return this.#constrain; }\n\n get element() { return this.#element; }\n\n get enabled() { return this.#enabled; }\n\n get height() { return this.#height; }\n\n get width() { return this.#width; }\n\n set constrain(constrain)\n {\n if (this.#lock) { return; }\n\n if (typeof constrain !== 'boolean') { throw new TypeError(`'constrain' is not a boolean.`); }\n\n this.#constrain = constrain;\n }\n\n set element(element)\n {\n if (this.#lock) { return; }\n\n if (element === void 0 || element === null || element instanceof HTMLElement)\n {\n this.#element = element;\n }\n else\n {\n throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`);\n }\n }\n\n set enabled(enabled)\n {\n if (this.#lock) { return; }\n\n if (typeof enabled !== 'boolean') { throw new TypeError(`'enabled' is not a boolean.`); }\n\n this.#enabled = enabled;\n }\n\n set height(height)\n {\n if (this.#lock) { return; }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n set width(width)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n }\n\n setDimension(width, height)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n /**\n * Provides a validator that respects transforms in positional data constraining the position to within the target\n * elements bounds.\n *\n * @param {ValidationData} valData - The associated validation data for position updates.\n *\n * @returns {PositionData} Potentially adjusted position data.\n */\n validator(valData)\n {\n // Early out if element is undefined or local enabled state is false.\n if (!this.#enabled) { return valData.position; }\n\n // Determine containing bounds from manual values; or any element; lastly the browser width / height.\n const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth;\n const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight;\n\n if (typeof valData.position.width === 'number')\n {\n const maxW = valData.maxWidth ?? (this.#constrain ? boundsWidth : Number.MAX_SAFE_INTEGER);\n valData.position.width = valData.width = Math.clamped(valData.position.width, valData.minWidth, maxW);\n\n if ((valData.width + valData.position.left + valData.marginLeft) > boundsWidth)\n {\n valData.position.left = boundsWidth - valData.width - valData.marginLeft;\n }\n }\n\n if (typeof valData.position.height === 'number')\n {\n const maxH = valData.maxHeight ?? (this.#constrain ? boundsHeight : Number.MAX_SAFE_INTEGER);\n valData.position.height = valData.height = Math.clamped(valData.position.height, valData.minHeight, maxH);\n\n if ((valData.height + valData.position.top + valData.marginTop) > boundsHeight)\n {\n valData.position.top = boundsHeight - valData.height - valData.marginTop;\n }\n }\n\n const maxL = Math.max(boundsWidth - valData.width - valData.marginLeft, 0);\n valData.position.left = Math.round(Math.clamped(valData.position.left, 0, maxL));\n\n const maxT = Math.max(boundsHeight - valData.height - valData.marginTop, 0);\n valData.position.top = Math.round(Math.clamped(valData.position.top, 0, maxT));\n\n return valData.position;\n }\n}\n","import { TransformData } from '../transform/TransformData.js';\n\nconst s_TRANSFORM_DATA = new TransformData();\n\nexport class TransformBounds\n{\n /**\n * When true constrains the min / max width or height to element.\n *\n * @type {boolean}\n */\n #constrain;\n\n /**\n * @type {HTMLElement}\n */\n #element;\n\n /**\n * When true the validator is active.\n *\n * @type {boolean}\n */\n #enabled;\n\n /**\n * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not\n * performance oriented. If manually set this height is used instead of `offsetHeight`.\n *\n * @type {number}\n */\n #height;\n\n /**\n * Set from an optional value in the constructor to lock accessors preventing modification.\n */\n #lock;\n\n /**\n * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not\n * performance oriented. If manually set this width is used instead of `offsetWidth`.\n *\n * @type {number}\n */\n #width;\n\n constructor({ constrain = true, element, enabled = true, lock = false, width, height } = {})\n {\n this.element = element;\n this.constrain = constrain;\n this.enabled = enabled;\n this.width = width;\n this.height = height;\n\n this.#lock = typeof lock === 'boolean' ? lock : false;\n }\n\n get constrain() { return this.#constrain; }\n\n get element() { return this.#element; }\n\n get enabled() { return this.#enabled; }\n\n get height() { return this.#height; }\n\n get width() { return this.#width; }\n\n set constrain(constrain)\n {\n if (this.#lock) { return; }\n\n if (typeof constrain !== 'boolean') { throw new TypeError(`'constrain' is not a boolean.`); }\n\n this.#constrain = constrain;\n }\n\n set element(element)\n {\n if (this.#lock) { return; }\n\n if (element === void 0 || element === null || element instanceof HTMLElement)\n {\n this.#element = element;\n }\n else\n {\n throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`);\n }\n }\n\n set enabled(enabled)\n {\n if (this.#lock) { return; }\n\n if (typeof enabled !== 'boolean') { throw new TypeError(`'enabled' is not a boolean.`); }\n\n this.#enabled = enabled;\n }\n\n set height(height)\n {\n if (this.#lock) { return; }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n set width(width)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n }\n\n setDimension(width, height)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n /**\n * Provides a validator that respects transforms in positional data constraining the position to within the target\n * elements bounds.\n *\n * @param {ValidationData} valData - The associated validation data for position updates.\n *\n * @returns {PositionData} Potentially adjusted position data.\n */\n validator(valData)\n {\n // Early out if element is undefined or local enabled state is false.\n if (!this.#enabled) { return valData.position; }\n\n // Determine containing bounds from manual values; or any element; lastly the browser width / height.\n const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth;\n const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight;\n\n // Ensure min / max width constraints when position width is a number; not 'auto' or 'inherit'. If constrain is\n // true cap width bounds.\n if (typeof valData.position.width === 'number')\n {\n const maxW = valData.maxWidth ?? (this.#constrain ? boundsWidth : Number.MAX_SAFE_INTEGER);\n valData.position.width = Math.clamped(valData.width, valData.minWidth, maxW);\n }\n\n // Ensure min / max height constraints when position height is a number; not 'auto' or 'inherit'. If constrain\n // is true cap height bounds.\n if (typeof valData.position.height === 'number')\n {\n const maxH = valData.maxHeight ?? (this.#constrain ? boundsHeight : Number.MAX_SAFE_INTEGER);\n valData.position.height = Math.clamped(valData.height, valData.minHeight, maxH);\n }\n\n // Get transform data. First set constraints including any margin top / left as offsets and width / height. Used\n // when position width / height is 'auto'.\n const data = valData.transforms.getData(valData.position, s_TRANSFORM_DATA, valData);\n\n // Check the bounding rectangle against browser height / width. Adjust position based on how far the overlap of\n // the bounding rect is outside the bounds height / width. The order below matters as the constraints are top /\n // left oriented, so perform those checks last.\n\n const initialX = data.boundingRect.x;\n const initialY = data.boundingRect.y;\n\n if (data.boundingRect.bottom + valData.marginTop > boundsHeight)\n {\n data.boundingRect.y += boundsHeight - data.boundingRect.bottom - valData.marginTop;\n }\n\n if (data.boundingRect.right + valData.marginLeft > boundsWidth)\n {\n data.boundingRect.x += boundsWidth - data.boundingRect.right - valData.marginLeft;\n }\n\n if (data.boundingRect.top - valData.marginTop < 0)\n {\n data.boundingRect.y += Math.abs(data.boundingRect.top - valData.marginTop);\n }\n\n if (data.boundingRect.left - valData.marginLeft < 0)\n {\n data.boundingRect.x += Math.abs(data.boundingRect.left - valData.marginLeft);\n }\n\n valData.position.left -= initialX - data.boundingRect.x;\n valData.position.top -= initialY - data.boundingRect.y;\n\n return valData.position;\n }\n}\n","import { BasicBounds } from './BasicBounds.js';\nimport { TransformBounds } from './TransformBounds.js';\n\nconst basicWindow = new BasicBounds({ lock: true });\nconst transformWindow = new TransformBounds({ lock: true });\n\nexport { basicWindow, BasicBounds, transformWindow, TransformBounds };\n","import { degToRad, mat4, vec3 } from '@typhonjs-fvtt/runtime/svelte/math';\n\nimport * as constants from '../constants.js';\n\nimport { TransformData } from './TransformData.js';\n\n/** @type {number[]} */\nconst s_SCALE_VECTOR = [1, 1, 1];\n\n/** @type {number[]} */\nconst s_TRANSLATE_VECTOR = [0, 0, 0];\n\n/** @type {Matrix4} */\nconst s_MAT4_RESULT = mat4.create();\n\n/** @type {Matrix4} */\nconst s_MAT4_TEMP = mat4.create();\n\n/** @type {Vector3} */\nconst s_VEC3_TEMP = vec3.create();\n\nexport class Transforms\n{\n /**\n * Stores the transform keys in the order added.\n *\n * @type {string[]}\n */\n #orderList = [];\n\n constructor()\n {\n this._data = {};\n }\n\n /**\n * @returns {boolean} Whether there are active transforms in local data.\n */\n get isActive() { return this.#orderList.length > 0; }\n\n /**\n * @returns {number|undefined} Any local rotateX data.\n */\n get rotateX() { return this._data.rotateX; }\n\n /**\n * @returns {number|undefined} Any local rotateY data.\n */\n get rotateY() { return this._data.rotateY; }\n\n /**\n * @returns {number|undefined} Any local rotateZ data.\n */\n get rotateZ() { return this._data.rotateZ; }\n\n /**\n * @returns {number|undefined} Any local rotateZ scale.\n */\n get scale() { return this._data.scale; }\n\n /**\n * @returns {number|undefined} Any local translateZ data.\n */\n get translateX() { return this._data.translateX; }\n\n /**\n * @returns {number|undefined} Any local translateZ data.\n */\n get translateY() { return this._data.translateY; }\n\n /**\n * @returns {number|undefined} Any local translateZ data.\n */\n get translateZ() { return this._data.translateZ; }\n\n /**\n * Sets the local rotateX data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set rotateX(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.rotateX === void 0) { this.#orderList.push('rotateX'); }\n\n this._data.rotateX = value;\n }\n else\n {\n if (this._data.rotateX !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'rotateX');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.rotateX;\n }\n }\n\n /**\n * Sets the local rotateY data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set rotateY(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.rotateY === void 0) { this.#orderList.push('rotateY'); }\n\n this._data.rotateY = value;\n }\n else\n {\n if (this._data.rotateY !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'rotateY');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.rotateY;\n }\n }\n\n /**\n * Sets the local rotateZ data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set rotateZ(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.rotateZ === void 0) { this.#orderList.push('rotateZ'); }\n\n this._data.rotateZ = value;\n }\n\n else\n {\n if (this._data.rotateZ !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'rotateZ');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.rotateZ;\n }\n }\n\n /**\n * Sets the local scale data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set scale(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.scale === void 0) { this.#orderList.push('scale'); }\n\n this._data.scale = value;\n }\n else\n {\n if (this._data.scale !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'scale');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.scale;\n }\n }\n\n /**\n * Sets the local translateX data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set translateX(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.translateX === void 0) { this.#orderList.push('translateX'); }\n\n this._data.translateX = value;\n }\n\n else\n {\n if (this._data.translateX !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'translateX');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.translateX;\n }\n }\n\n /**\n * Sets the local translateY data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set translateY(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.translateY === void 0) { this.#orderList.push('translateY'); }\n\n this._data.translateY = value;\n }\n\n else\n {\n if (this._data.translateY !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'translateY');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.translateY;\n }\n }\n\n /**\n * Sets the local translateZ data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set translateZ(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.translateZ === void 0) { this.#orderList.push('translateZ'); }\n\n this._data.translateZ = value;\n }\n\n else\n {\n if (this._data.translateZ !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'translateZ');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.translateZ;\n }\n }\n\n /**\n * Returns the matrix3d CSS transform for the given position / transform data.\n *\n * @param {object} [data] - Optional position data otherwise use local stored transform data.\n *\n * @returns {string} The CSS matrix3d string.\n */\n getCSS(data = this._data)\n {\n return `matrix3d(${this.getMat4(data, s_MAT4_RESULT).join(',')})`;\n }\n\n /**\n * Returns the matrix3d CSS transform for the given position / transform data.\n *\n * @param {object} [data] - Optional position data otherwise use local stored transform data.\n *\n * @returns {string} The CSS matrix3d string.\n */\n getCSSOrtho(data = this._data)\n {\n return `matrix3d(${this.getMat4Ortho(data, s_MAT4_RESULT).join(',')})`;\n }\n\n /**\n * Collects all data including a bounding rect, transform matrix, and points array of the given {@link PositionData}\n * instance with the applied local transform data.\n *\n * @param {PositionData} position - The position data to process.\n *\n * @param {TransformData} [output] - Optional TransformData output instance.\n *\n * @param {object} [validationData] - Optional validation data for adjustment parameters.\n *\n * @returns {TransformData} The output TransformData instance.\n */\n getData(position, output = new TransformData(), validationData = {})\n {\n const valWidth = validationData.width ?? 0;\n const valHeight = validationData.height ?? 0;\n const valOffsetTop = validationData.offsetTop ?? validationData.marginTop ?? 0;\n const valOffsetLeft = validationData.offsetLeft ?? validationData.offsetLeft ?? 0;\n\n position.top += valOffsetTop;\n position.left += valOffsetLeft;\n\n const width = Number.isFinite(position.width) ? position.width : valWidth;\n const height = Number.isFinite(position.height) ? position.height : valHeight;\n\n const rect = output.corners;\n\n if (this.hasTransform(position))\n {\n rect[0][0] = rect[0][1] = rect[0][2] = 0;\n rect[1][0] = width;\n rect[1][1] = rect[1][2] = 0;\n rect[2][0] = width;\n rect[2][1] = height;\n rect[2][2] = 0;\n rect[3][0] = 0;\n rect[3][1] = height;\n rect[3][2] = 0;\n\n const matrix = this.getMat4(position, output.mat4);\n\n const translate = s_GET_ORIGIN_TRANSLATION(position.transformOrigin, width, height, output.originTranslations);\n\n if (constants.transformOriginDefault === position.transformOrigin)\n {\n vec3.transformMat4(rect[0], rect[0], matrix);\n vec3.transformMat4(rect[1], rect[1], matrix);\n vec3.transformMat4(rect[2], rect[2], matrix);\n vec3.transformMat4(rect[3], rect[3], matrix);\n }\n else\n {\n vec3.transformMat4(rect[0], rect[0], translate[0]);\n vec3.transformMat4(rect[0], rect[0], matrix);\n vec3.transformMat4(rect[0], rect[0], translate[1]);\n\n vec3.transformMat4(rect[1], rect[1], translate[0]);\n vec3.transformMat4(rect[1], rect[1], matrix);\n vec3.transformMat4(rect[1], rect[1], translate[1]);\n\n vec3.transformMat4(rect[2], rect[2], translate[0]);\n vec3.transformMat4(rect[2], rect[2], matrix);\n vec3.transformMat4(rect[2], rect[2], translate[1]);\n\n vec3.transformMat4(rect[3], rect[3], translate[0]);\n vec3.transformMat4(rect[3], rect[3], matrix);\n vec3.transformMat4(rect[3], rect[3], translate[1]);\n }\n\n rect[0][0] = position.left + rect[0][0];\n rect[0][1] = position.top + rect[0][1];\n rect[1][0] = position.left + rect[1][0];\n rect[1][1] = position.top + rect[1][1];\n rect[2][0] = position.left + rect[2][0];\n rect[2][1] = position.top + rect[2][1];\n rect[3][0] = position.left + rect[3][0];\n rect[3][1] = position.top + rect[3][1];\n }\n else\n {\n rect[0][0] = position.left;\n rect[0][1] = position.top;\n rect[1][0] = position.left + width;\n rect[1][1] = position.top;\n rect[2][0] = position.left + width;\n rect[2][1] = position.top + height;\n rect[3][0] = position.left;\n rect[3][1] = position.top + height;\n\n mat4.identity(output.mat4);\n }\n\n let maxX = Number.MIN_SAFE_INTEGER;\n let maxY = Number.MIN_SAFE_INTEGER;\n let minX = Number.MAX_SAFE_INTEGER;\n let minY = Number.MAX_SAFE_INTEGER;\n\n for (let cntr = 4; --cntr >= 0;)\n {\n if (rect[cntr][0] > maxX) { maxX = rect[cntr][0]; }\n if (rect[cntr][0] < minX) { minX = rect[cntr][0]; }\n if (rect[cntr][1] > maxY) { maxY = rect[cntr][1]; }\n if (rect[cntr][1] < minY) { minY = rect[cntr][1]; }\n }\n\n const boundingRect = output.boundingRect;\n boundingRect.x = minX;\n boundingRect.y = minY;\n boundingRect.width = maxX - minX;\n boundingRect.height = maxY - minY;\n\n position.top -= valOffsetTop;\n position.left -= valOffsetLeft;\n\n return output;\n }\n\n /**\n * Creates a transform matrix based on local data applied in order it was added.\n *\n * If no data object is provided then the source is the local transform data. If another data object is supplied\n * then the stored local transform order is applied then all remaining transform keys are applied. This allows the\n * construction of a transform matrix in advance of setting local data and is useful in collision detection.\n *\n * @param {object} [data] - PositionData instance or local transform data.\n *\n * @param {Matrix4} [output] - The output mat4 instance.\n *\n * @returns {Matrix4} Transform matrix.\n */\n getMat4(data = this._data, output = mat4.create())\n {\n const matrix = mat4.identity(output);\n\n // Bitwise tracks applied transform keys from local transform data.\n let seenKeys = 0;\n\n const orderList = this.#orderList;\n\n // First apply ordered transforms from local transform data.\n for (let cntr = 0; cntr < orderList.length; cntr++)\n {\n const key = orderList[cntr];\n\n switch (key)\n {\n case 'rotateX':\n seenKeys |= constants.transformKeysBitwise.rotateX;\n mat4.multiply(matrix, matrix, mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n seenKeys |= constants.transformKeysBitwise.rotateY;\n mat4.multiply(matrix, matrix, mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n seenKeys |= constants.transformKeysBitwise.rotateZ;\n mat4.multiply(matrix, matrix, mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'scale':\n seenKeys |= constants.transformKeysBitwise.scale;\n s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data[key];\n mat4.multiply(matrix, matrix, mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR));\n break;\n\n case 'translateX':\n seenKeys |= constants.transformKeysBitwise.translateX;\n s_TRANSLATE_VECTOR[0] = data.translateX;\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = 0;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateY':\n seenKeys |= constants.transformKeysBitwise.translateY;\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = data.translateY;\n s_TRANSLATE_VECTOR[2] = 0;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateZ':\n seenKeys |= constants.transformKeysBitwise.translateZ;\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = data.translateZ;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n }\n }\n\n // Now apply any new keys not set in local transform data that have not been applied yet.\n if (data !== this._data)\n {\n for (let cntr = 0; cntr < constants.transformKeys.length; cntr++)\n {\n const key = constants.transformKeys[cntr];\n\n // Reject bad / no data or if the key has already been applied.\n if (data[key] === null || (seenKeys & constants.transformKeysBitwise[key]) > 0) { continue; }\n\n switch (key)\n {\n case 'rotateX':\n mat4.multiply(matrix, matrix, mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n mat4.multiply(matrix, matrix, mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n mat4.multiply(matrix, matrix, mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'scale':\n s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data[key];\n mat4.multiply(matrix, matrix, mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR));\n break;\n\n case 'translateX':\n s_TRANSLATE_VECTOR[0] = data[key];\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = 0;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateY':\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = data[key];\n s_TRANSLATE_VECTOR[2] = 0;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateZ':\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = data[key];\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n }\n }\n }\n\n return matrix;\n }\n\n /**\n * Provides an orthographic enhancement to convert left / top positional data to a translate operation.\n *\n * This transform matrix takes into account that the remaining operations are , but adds any left / top attributes from passed in data to\n * translate X / Y.\n *\n * If no data object is provided then the source is the local transform data. If another data object is supplied\n * then the stored local transform order is applied then all remaining transform keys are applied. This allows the\n * construction of a transform matrix in advance of setting local data and is useful in collision detection.\n *\n * @param {object} [data] - PositionData instance or local transform data.\n *\n * @param {Matrix4} [output] - The output mat4 instance.\n *\n * @returns {Matrix4} Transform matrix.\n */\n getMat4Ortho(data = this._data, output = mat4.create())\n {\n const matrix = mat4.identity(output);\n\n // Attempt to retrieve values from passed in data otherwise default to 0.\n // Always perform the translation last regardless of order added to local transform data.\n // Add data.left to translateX and data.top to translateY.\n s_TRANSLATE_VECTOR[0] = (data.left ?? 0) + (data.translateX ?? 0);\n s_TRANSLATE_VECTOR[1] = (data.top ?? 0) + (data.translateY ?? 0);\n s_TRANSLATE_VECTOR[2] = data.translateZ ?? 0;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n\n // Scale can also be applied out of order.\n if (data.scale !== null)\n {\n s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data.scale;\n mat4.multiply(matrix, matrix, mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR));\n }\n\n // Early out if there is not rotation data.\n if (data.rotateX === null && data.rotateY === null && data.rotateZ === null) { return matrix; }\n\n // Rotation transforms must be applied in the order they are added.\n\n // Bitwise tracks applied transform keys from local transform data.\n let seenKeys = 0;\n\n const orderList = this.#orderList;\n\n // First apply ordered transforms from local transform data.\n for (let cntr = 0; cntr < orderList.length; cntr++)\n {\n const key = orderList[cntr];\n\n switch (key)\n {\n case 'rotateX':\n seenKeys |= constants.transformKeysBitwise.rotateX;\n mat4.multiply(matrix, matrix, mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n seenKeys |= constants.transformKeysBitwise.rotateY;\n mat4.multiply(matrix, matrix, mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n seenKeys |= constants.transformKeysBitwise.rotateZ;\n mat4.multiply(matrix, matrix, mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n }\n }\n\n // Now apply any new keys not set in local transform data that have not been applied yet.\n if (data !== this._data)\n {\n for (let cntr = 0; cntr < constants.transformKeys.length; cntr++)\n {\n const key = constants.transformKeys[cntr];\n\n // Reject bad / no data or if the key has already been applied.\n if (data[key] === null || (seenKeys & constants.transformKeysBitwise[key]) > 0) { continue; }\n\n switch (key)\n {\n case 'rotateX':\n mat4.multiply(matrix, matrix, mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n mat4.multiply(matrix, matrix, mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n mat4.multiply(matrix, matrix, mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n }\n }\n }\n\n return matrix;\n }\n\n /**\n * Tests an object if it contains transform keys and the values are finite numbers.\n *\n * @param {object} data - An object to test for transform data.\n *\n * @returns {boolean} Whether the given PositionData has transforms.\n */\n hasTransform(data)\n {\n for (const key of constants.transformKeys)\n {\n if (Number.isFinite(data[key])) { return true; }\n }\n\n return false;\n }\n\n /**\n * Resets internal data from the given object containing valid transform keys.\n *\n * @param {object} data - An object with transform data.\n */\n reset(data)\n {\n for (const key in data)\n {\n if (constants.transformKeys.includes(key))\n {\n if (Number.isFinite(data[key]))\n {\n this._data[key] = data[key];\n }\n else\n {\n const index = this.#orderList.findIndex((entry) => entry === key);\n if (index >= 0) { this.#orderList.splice(index, 1); }\n\n delete this._data[key];\n }\n }\n }\n }\n}\n\n/**\n * Returns the translations necessary to translate a matrix operation based on the `transformOrigin` parameter of the\n * given position instance. The first entry / index 0 is the pre-translation and last entry / index 1 is the post-\n * translation.\n *\n * This method is used internally, but may be useful if you need the origin translation matrices to transform\n * bespoke points based on any `transformOrigin` set in {@link PositionData}.\n *\n * @param {string} transformOrigin - The transform origin attribute from PositionData.\n *\n * @param {number} width - The PositionData width or validation data width when 'auto'.\n *\n * @param {number} height - The PositionData height or validation data height when 'auto'.\n *\n * @param {Matrix4[]} output - Output Mat4 array.\n *\n * @returns {Matrix4[]} Output Mat4 array.\n */\nfunction s_GET_ORIGIN_TRANSLATION(transformOrigin, width, height, output)\n{\n const vector = s_VEC3_TEMP;\n\n switch (transformOrigin)\n {\n case 'top left':\n vector[0] = vector[1] = 0;\n mat4.fromTranslation(output[0], vector);\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'top center':\n vector[0] = -width * 0.5;\n vector[1] = 0;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width * 0.5;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'top right':\n vector[0] = -width;\n vector[1] = 0;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'center left':\n vector[0] = 0;\n vector[1] = -height * 0.5;\n mat4.fromTranslation(output[0], vector);\n vector[1] = height * 0.5;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case null: // By default null / no transform is center.\n case 'center':\n vector[0] = -width * 0.5;\n vector[1] = -height * 0.5;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width * 0.5;\n vector[1] = height * 0.5;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'center right':\n vector[0] = -width;\n vector[1] = -height * 0.5;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width;\n vector[1] = height * 0.5;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'bottom left':\n vector[0] = 0;\n vector[1] = -height;\n mat4.fromTranslation(output[0], vector);\n vector[1] = height;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'bottom center':\n vector[0] = -width * 0.5;\n vector[1] = -height;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width * 0.5;\n vector[1] = height;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'bottom right':\n vector[0] = -width;\n vector[1] = -height;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width;\n vector[1] = height;\n mat4.fromTranslation(output[1], vector);\n break;\n\n // No valid transform origin parameter; set identity.\n default:\n mat4.identity(output[0]);\n mat4.identity(output[1]);\n break;\n }\n\n return output;\n}\n","import { writable } from 'svelte/store';\n\nimport { TransformData } from '../transform/TransformData.js';\nimport { PositionData } from '../PositionData.js';\n\nexport class UpdateElementData\n{\n constructor()\n {\n /**\n * Stores the private data from Position.\n *\n * @type {PositionData}\n */\n this.data = void 0;\n\n /**\n * Provides a copy of local data sent to subscribers.\n *\n * @type {PositionData}\n */\n this.dataSubscribers = new PositionData();\n\n /**\n * Stores the current dimension data used for the readable `dimension` store.\n *\n * @type {{width: number | 'auto', height: number | 'auto'}}\n */\n this.dimensionData = { width: 0, height: 0 };\n\n /**\n * @type {PositionChangeSet}\n */\n this.changeSet = void 0;\n\n /**\n * @type {PositionOptions}\n */\n this.options = void 0;\n\n /**\n * Stores if this Position / update data is queued for update.\n *\n * @type {boolean}\n */\n this.queued = false;\n\n /**\n * @type {StyleCache}\n */\n this.styleCache = void 0;\n\n /**\n * @type {Transforms}\n */\n this.transforms = void 0;\n\n /**\n * Stores the current transform data used for the readable `transform` store. It is only active when there are\n * subscribers to the store or calculateTransform options is true.\n *\n * @type {TransformData}\n */\n this.transformData = new TransformData();\n\n /**\n * @type {(function(PositionData): void)[]}\n */\n this.subscriptions = void 0;\n\n /**\n * @type {Writable<{width: (number|\"auto\"), height: (number|\"auto\")}>}\n */\n this.storeDimension = writable(this.dimensionData);\n\n // When there are subscribers set option to calculate transform updates; set to false when no subscribers.\n\n /**\n * @type {Writable<TransformData>}\n */\n this.storeTransform = writable(this.transformData, () =>\n {\n this.options.transformSubscribed = true;\n return () => this.options.transformSubscribed = false;\n });\n\n /**\n * Stores the queued state for update element processing.\n *\n * @type {boolean}\n */\n this.queued = false;\n\n // Seal data backing readable stores.\n Object.seal(this.dimensionData);\n }\n}\n","import { isWritableStore } from '@typhonjs-fvtt/runtime/svelte/store';\n\n/**\n * Svelte doesn't provide any events for the animate directive.\n *\n * The provided function below wraps a Svelte animate directive function generating bubbling events for start & end of\n * animation.\n *\n * These events are `animate:start` and `animate:end`.\n *\n * This is useful for instance if you are animating several nodes in a scrollable container where the overflow parameter\n * needs to be set to `none` while animating such that the scrollbar is not activated by the animation.\n *\n * Optionally you may also provide a boolean writable store that will be set to true when animation is active. In some\n * cases this leads to an easier implementation for gating on animation state.\n *\n * @example <caption>With events</caption>\n * const flipWithEvents = animateEvents(flip);\n * </script>\n *\n * <main on:animate:start={() => console.log('animate:start')\n * on:animate:end={() => console.log('animate:end')}>\n * {#each someData as entry (entry.id)}\n * <section animate:flipWithEvents />\n * {/each}\n\n * @example <caption>With optional store</caption>\n * const isAnimating = writable(false);\n * const flipWithEvents = animateEvents(flip, isAnimating);\n * </script>\n *\n * <main class:no-scroll={$isAnimating}>\n * {#each someData as entry (entry.id)}\n * <section animate:flipWithEvents />\n * {/each}\n *\n * @param {(node: Element, { from: DOMRect, to: DOMRect }, params?: *) => import('svelte/animate').AnimationConfig} fn -\n * A Svelte animation function.\n *\n * @param {import('svelte/store').Writable<boolean>} [store] - An optional boolean writable store that is set to true\n * when animation is active.\n *\n * @returns {(node: Element, { from: DOMRect, to: DOMRect }, params?: *) => import('svelte/animate').AnimationConfig}\n * Wrapped animation function.\n */\nfunction animateEvents(fn, store = void 0)\n{\n if (typeof fn !== 'function') { throw new TypeError(`'fn' is not a function.`); }\n if (store !== void 0 && !isWritableStore(store)) { throw new TypeError(`'store' is not a writable store.`); }\n\n // Track a single start / end sequence across all animations.\n let startFired = false;\n let endFired = false;\n\n return (node, animations, params = {}) =>\n {\n const animationConfig = fn(node, animations, params);\n\n // Store any existing tick function.\n const existingTick = animationConfig.tick;\n\n // Use tick callback to fire events only once when t / time is 0 and 1.\n animationConfig.tick = (t, u) =>\n {\n // If there is any tick function then invoke it.\n if (existingTick) { existingTick(t, u); }\n\n if (!startFired && t === 0)\n {\n if (store) { store.set(true); }\n node.dispatchEvent(new CustomEvent('animate:start', { bubbles: true }));\n startFired = true;\n endFired = false;\n }\n\n if (!endFired && t === 1)\n {\n if (store) { store.set(false); }\n node.dispatchEvent(new CustomEvent('animate:end', { bubbles: true }));\n endFired = true;\n startFired = false;\n }\n };\n\n return animationConfig;\n };\n}\n\n/**\n * Awaits `requestAnimationFrame` calls by the counter specified. This allows asynchronous applications for direct /\n * inline style modification amongst other direct animation techniques.\n *\n * @param {number} [cntr=1] - A positive integer greater than 0 for amount of requestAnimationFrames to wait.\n *\n * @returns {Promise<number>} Returns current time equivalent to `performance.now()`.\n */\nasync function nextAnimationFrame(cntr = 1)\n{\n if (!Number.isInteger(cntr) || cntr < 1)\n {\n throw new TypeError(`nextAnimationFrame error: 'cntr' must be a positive integer greater than 0.`);\n }\n\n let currentTime = performance.now();\n for (;--cntr >= 0;)\n {\n currentTime = await new Promise((resolve) => requestAnimationFrame(resolve));\n }\n\n return currentTime;\n}\n\nexport { animateEvents, nextAnimationFrame };\n//# sourceMappingURL=index.js.map\n","import { nextAnimationFrame } from '@typhonjs-fvtt/runtime/svelte/animate';\n\n/**\n * Decouples updates to any parent target HTMLElement inline styles. Invoke {@link Position.elementUpdated} to await\n * on the returned promise that is resolved with the current render time via `nextAnimationFrame` /\n * `requestAnimationFrame`. This allows the underlying data model to be updated immediately while updates to the\n * element are in sync with the browser and potentially in the future be further throttled.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n */\nexport class UpdateElementManager\n{\n static list = [];\n static listCntr = 0;\n\n static updatePromise;\n\n static get promise() { return this.updatePromise; }\n\n /**\n * Potentially adds the given element and internal updateData instance to the list.\n *\n * @param {HTMLElement} el - An HTMLElement instance.\n *\n * @param {UpdateElementData} updateData - An UpdateElementData instance.\n *\n * @returns {Promise<number>} The unified next frame update promise. Returns `currentTime`.\n */\n static add(el, updateData)\n {\n if (this.listCntr < this.list.length)\n {\n const entry = this.list[this.listCntr];\n entry[0] = el;\n entry[1] = updateData;\n }\n else\n {\n this.list.push([el, updateData]);\n }\n\n this.listCntr++;\n updateData.queued = true;\n\n if (!this.updatePromise) { this.updatePromise = this.wait(); }\n\n return this.updatePromise;\n }\n\n /**\n * Await on `nextAnimationFrame` and iterate over list map invoking callback functions.\n *\n * @returns {Promise<number>} The next frame Promise / currentTime from nextAnimationFrame.\n */\n static async wait()\n {\n // Await the next animation frame. In the future this can be extended to multiple frames to divide update rate.\n const currentTime = await nextAnimationFrame();\n\n this.updatePromise = void 0;\n\n for (let cntr = this.listCntr; --cntr >= 0;)\n {\n // Obtain data for entry.\n const entry = this.list[cntr];\n const el = entry[0];\n const updateData = entry[1];\n\n // Clear entry data.\n entry[0] = void 0;\n entry[1] = void 0;\n\n // Reset queued state.\n updateData.queued = false;\n\n // Early out if the element is no longer connected to the DOM / shadow root.\n // if (!el.isConnected || !updateData.changeSet.hasChange()) { continue; }\n if (!el.isConnected) { continue; }\n\n if (updateData.options.ortho)\n {\n s_UPDATE_ELEMENT_ORTHO(el, updateData);\n }\n else\n {\n s_UPDATE_ELEMENT(el, updateData);\n }\n\n // If calculate transform options is enabled then update the transform data and set the readable store.\n if (updateData.options.calculateTransform || updateData.options.transformSubscribed)\n {\n s_UPDATE_TRANSFORM(el, updateData);\n }\n\n // Update all subscribers with changed data.\n this.updateSubscribers(updateData);\n }\n\n this.listCntr = 0;\n\n return currentTime;\n }\n\n /**\n * Potentially immediately updates the given element.\n *\n * @param {HTMLElement} el - An HTMLElement instance.\n *\n * @param {UpdateElementData} updateData - An UpdateElementData instance.\n */\n static immediate(el, updateData)\n {\n // Early out if the element is no longer connected to the DOM / shadow root.\n // if (!el.isConnected || !updateData.changeSet.hasChange()) { continue; }\n if (!el.isConnected) { return; }\n\n if (updateData.options.ortho)\n {\n s_UPDATE_ELEMENT_ORTHO(el, updateData);\n }\n else\n {\n s_UPDATE_ELEMENT(el, updateData);\n }\n\n // If calculate transform options is enabled then update the transform data and set the readable store.\n if (updateData.options.calculateTransform || updateData.options.transformSubscribed)\n {\n s_UPDATE_TRANSFORM(el, updateData);\n }\n\n // Update all subscribers with changed data.\n this.updateSubscribers(updateData);\n }\n\n /**\n * @param {UpdateElementData} updateData - Data change set.\n */\n static updateSubscribers(updateData)\n {\n const data = updateData.data;\n const changeSet = updateData.changeSet;\n\n if (!changeSet.hasChange()) { return; }\n\n // Make a copy of the data.\n const output = updateData.dataSubscribers.copy(data);\n\n const subscriptions = updateData.subscriptions;\n\n // Early out if there are no subscribers.\n if (subscriptions.length > 0)\n {\n for (let cntr = 0; cntr < subscriptions.length; cntr++) { subscriptions[cntr](output); }\n }\n\n // Update dimension data if width / height has changed.\n if (changeSet.width || changeSet.height)\n {\n updateData.dimensionData.width = data.width;\n updateData.dimensionData.height = data.height;\n updateData.storeDimension.set(updateData.dimensionData);\n }\n\n changeSet.set(false);\n }\n}\n\n/**\n * Decouples updates to any parent target HTMLElement inline styles. Invoke {@link Position.elementUpdated} to await\n * on the returned promise that is resolved with the current render time via `nextAnimationFrame` /\n * `requestAnimationFrame`. This allows the underlying data model to be updated immediately while updates to the\n * element are in sync with the browser and potentially in the future be further throttled.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n *\n * @param {UpdateElementData} updateData - Update data.\n */\nfunction s_UPDATE_ELEMENT(el, updateData)\n{\n const changeSet = updateData.changeSet;\n const data = updateData.data;\n\n if (changeSet.left)\n {\n el.style.left = `${data.left}px`;\n }\n\n if (changeSet.top)\n {\n el.style.top = `${data.top}px`;\n }\n\n if (changeSet.zIndex)\n {\n el.style.zIndex = typeof data.zIndex === 'number' ? `${data.zIndex}` : null;\n }\n\n if (changeSet.width)\n {\n el.style.width = typeof data.width === 'number' ? `${data.width}px` : data.width;\n }\n\n if (changeSet.height)\n {\n el.style.height = typeof data.height === 'number' ? `${data.height}px` : data.height;\n }\n\n if (changeSet.transformOrigin)\n {\n // When set to 'center' we can simply set the transform to null which is center by default.\n el.style.transformOrigin = data.transformOrigin === 'center' ? null : data.transformOrigin;\n }\n\n // Update all transforms in order added to transforms object.\n if (changeSet.transform)\n {\n el.style.transform = updateData.transforms.isActive ? updateData.transforms.getCSS() : null;\n }\n}\n\n/**\n * Decouples updates to any parent target HTMLElement inline styles. Invoke {@link Position.elementUpdated} to await\n * on the returned promise that is resolved with the current render time via `nextAnimationFrame` /\n * `requestAnimationFrame`. This allows the underlying data model to be updated immediately while updates to the\n * element are in sync with the browser and potentially in the future be further throttled.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n *\n * @param {UpdateElementData} updateData - Update data.\n */\nfunction s_UPDATE_ELEMENT_ORTHO(el, updateData)\n{\n const changeSet = updateData.changeSet;\n const data = updateData.data;\n\n if (changeSet.zIndex)\n {\n el.style.zIndex = typeof data.zIndex === 'number' ? `${data.zIndex}` : null;\n }\n\n if (changeSet.width)\n {\n el.style.width = typeof data.width === 'number' ? `${data.width}px` : data.width;\n }\n\n if (changeSet.height)\n {\n el.style.height = typeof data.height === 'number' ? `${data.height}px` : data.height;\n }\n\n if (changeSet.transformOrigin)\n {\n // When set to 'center' we can simply set the transform to null which is center by default.\n el.style.transformOrigin = data.transformOrigin === 'center' ? null : data.transformOrigin;\n }\n\n // Update all transforms in order added to transforms object.\n if (changeSet.left || changeSet.top || changeSet.transform)\n {\n el.style.transform = updateData.transforms.getCSSOrtho(data);\n }\n}\n\n/**\n * Updates the applied transform data and sets the readble `transform` store.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n *\n * @param {UpdateElementData} updateData - Update element data.\n */\nfunction s_UPDATE_TRANSFORM(el, updateData)\n{\n s_VALIDATION_DATA.height = updateData.data.height !== 'auto' ? updateData.data.height :\n updateData.styleCache.offsetHeight;\n\n s_VALIDATION_DATA.width = updateData.data.width !== 'auto' ? updateData.data.width :\n updateData.styleCache.offsetWidth;\n\n s_VALIDATION_DATA.marginLeft = updateData.styleCache.marginLeft;\n\n s_VALIDATION_DATA.marginTop = updateData.styleCache.marginTop;\n\n // Get transform data. First set constraints including any margin top / left as offsets and width / height. Used\n // when position width / height is 'auto'.\n updateData.transforms.getData(updateData.data, updateData.transformData, s_VALIDATION_DATA);\n\n updateData.storeTransform.set(updateData.transformData);\n}\n\nconst s_VALIDATION_DATA = {\n height: void 0,\n width: void 0,\n marginLeft: void 0,\n marginTop: void 0\n};\n","import {\n propertyStore,\n subscribeIgnoreFirst } from '@typhonjs-fvtt/runtime/svelte/store';\n\nimport {\n isIterable,\n isObject,\n isPlainObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport { AnimationAPI } from './animation/AnimationAPI.js';\nimport { AnimationGroupAPI } from './animation/AnimationGroupAPI.js';\nimport * as constants from './constants.js';\nimport { convertRelative } from './convertRelative.js';\nimport * as positionInitial from './initial/index.js';\nimport { PositionChangeSet } from './PositionChangeSet.js';\nimport { PositionData } from './PositionData.js';\nimport { PositionStateAPI } from './PositionStateAPI.js';\nimport { StyleCache } from './StyleCache.js';\nimport { TransformData } from './transform/TransformData.js';\nimport { AdapterValidators } from './validators/AdapterValidators.js';\nimport * as positionValidators from './validators/index.js';\nimport { Transforms } from './transform/Transforms.js';\nimport { UpdateElementData } from './update/UpdateElementData.js';\nimport { UpdateElementManager } from './update/UpdateElementManager.js';\n\n/**\n * Provides a store for position following the subscriber protocol in addition to providing individual writable derived\n * stores for each independent variable.\n */\nexport class Position\n{\n /**\n * @type {PositionData}\n */\n #data = new PositionData();\n\n /**\n * Provides the animation API.\n *\n * @type {AnimationAPI}\n */\n #animate = new AnimationAPI(this, this.#data);\n\n /**\n * Provides a way to turn on / off the position handling.\n *\n * @type {boolean}\n */\n #enabled = true;\n\n /**\n * Stores the style attributes that changed on update.\n *\n * @type {PositionChangeSet}\n */\n #positionChangeSet = new PositionChangeSet();\n\n /**\n * Stores ongoing options that are set in the constructor or by transform store subscription.\n *\n * @type {PositionOptions}\n */\n #options = {\n calculateTransform: false,\n initialHelper: void 0,\n ortho: true,\n transformSubscribed: false\n };\n\n /**\n * The associated parent for positional data tracking. Used in validators.\n *\n * @type {PositionParent}\n */\n #parent;\n\n /**\n * @type {StorePosition}\n */\n #stores;\n\n /**\n * Stores an instance of the computer styles for the target element.\n *\n * @type {StyleCache}\n */\n #styleCache;\n\n /**\n * Stores the subscribers.\n *\n * @type {(function(PositionData): void)[]}\n */\n #subscriptions = [];\n\n /**\n * @type {Transforms}\n */\n #transforms = new Transforms();\n\n /**\n * @type {UpdateElementData}\n */\n #updateElementData;\n\n /**\n * Stores the UpdateElementManager wait promise.\n *\n * @type {Promise}\n */\n #updateElementPromise;\n\n /**\n * @type {AdapterValidators}\n */\n #validators;\n\n /**\n * @type {ValidatorData[]}\n */\n #validatorData;\n\n /**\n * @type {PositionStateAPI}\n */\n #state = new PositionStateAPI(this, this.#data, this.#transforms);\n\n /**\n * @returns {AnimationGroupAPI} Public Animation API.\n */\n static get Animate() { return AnimationGroupAPI; }\n\n /**\n * @returns {{browserCentered?: Centered, Centered?: *}} Initial position helpers.\n */\n static get Initial() { return positionInitial; }\n\n /**\n * Returns TransformData class / constructor.\n *\n * @returns {TransformData} TransformData class / constructor.\n */\n static get TransformData() { return TransformData; }\n\n /**\n * Returns default validators.\n *\n * Note: `basicWindow` and `BasicBounds` will eventually be removed.\n *\n * @returns {{basicWindow?: BasicBounds, transformWindow?: TransformBounds, TransformBounds?: *, BasicBounds?: *}}\n * Available validators.\n */\n static get Validators() { return positionValidators; }\n\n /**\n * Returns a duplicate of a given position instance copying any options and validators.\n *\n * // TODO: Consider more safety over options processing.\n *\n * @param {Position} position - A position instance.\n *\n * @param {PositionOptions} options - Position options.\n *\n * @returns {Position} A duplicate position instance.\n */\n static duplicate(position, options)\n {\n if (!(position instanceof Position)) { throw new TypeError(`'position' is not an instance of Position.`); }\n\n const newPosition = new Position(options);\n\n newPosition.#options = Object.assign({}, position.#options, options);\n newPosition.#validators.add(...position.#validators);\n\n newPosition.set(position.#data);\n\n return newPosition;\n }\n\n /**\n * @param {PositionParent|PositionOptionsAll} [parent] - A potential parent element or object w/ `elementTarget`\n * getter. May also be the PositionOptions object w/ 1 argument.\n *\n * @param {PositionOptionsAll} [options] - Default values.\n */\n constructor(parent, options)\n {\n // Test if `parent` is a plain object; if so treat as options object.\n if (isPlainObject(parent))\n {\n options = parent;\n }\n else\n {\n this.#parent = parent;\n }\n\n const data = this.#data;\n const transforms = this.#transforms;\n\n this.#styleCache = new StyleCache();\n\n const updateData = new UpdateElementData();\n\n updateData.changeSet = this.#positionChangeSet;\n updateData.data = this.#data;\n updateData.options = this.#options;\n updateData.styleCache = this.#styleCache;\n updateData.subscriptions = this.#subscriptions;\n updateData.transforms = this.#transforms;\n\n this.#updateElementData = updateData;\n\n if (isObject(options))\n {\n // Set Position options\n if (typeof options.calculateTransform === 'boolean')\n {\n this.#options.calculateTransform = options.calculateTransform;\n }\n\n if (typeof options.ortho === 'boolean')\n {\n this.#options.ortho = options.ortho;\n }\n\n // Set default values from options.\n\n if (Number.isFinite(options.height) || options.height === 'auto' || options.height === 'inherit' ||\n options.height === null)\n {\n data.height = updateData.dimensionData.height = typeof options.height === 'number' ?\n Math.round(options.height) : options.height;\n }\n\n if (Number.isFinite(options.left) || options.left === null)\n {\n data.left = typeof options.left === 'number' ? Math.round(options.left) : options.left;\n }\n\n if (Number.isFinite(options.maxHeight) || options.maxHeight === null)\n {\n data.maxHeight = typeof options.maxHeight === 'number' ? Math.round(options.maxHeight) : options.maxHeight;\n }\n\n if (Number.isFinite(options.maxWidth) || options.maxWidth === null)\n {\n data.maxWidth = typeof options.maxWidth === 'number' ? Math.round(options.maxWidth) : options.maxWidth;\n }\n\n if (Number.isFinite(options.minHeight) || options.minHeight === null)\n {\n data.minHeight = typeof options.minHeight === 'number' ? Math.round(options.minHeight) : options.minHeight;\n }\n\n if (Number.isFinite(options.minWidth) || options.minWidth === null)\n {\n data.minWidth = typeof options.minWidth === 'number' ? Math.round(options.minWidth) : options.minWidth;\n }\n\n if (Number.isFinite(options.rotateX) || options.rotateX === null)\n {\n transforms.rotateX = data.rotateX = options.rotateX;\n }\n\n if (Number.isFinite(options.rotateY) || options.rotateY === null)\n {\n transforms.rotateY = data.rotateY = options.rotateY;\n }\n\n if (Number.isFinite(options.rotateZ) || options.rotateZ === null)\n {\n transforms.rotateZ = data.rotateZ = options.rotateZ;\n }\n\n if (Number.isFinite(options.scale) || options.scale === null)\n {\n transforms.scale = data.scale = options.scale;\n }\n\n if (Number.isFinite(options.top) || options.top === null)\n {\n data.top = typeof options.top === 'number' ? Math.round(options.top) : options.top;\n }\n\n if (typeof options.transformOrigin === 'string' || options.transformOrigin === null)\n {\n data.transformOrigin = constants.transformOrigins.includes(options.transformOrigin) ?\n options.transformOrigin : null;\n }\n\n if (Number.isFinite(options.translateX) || options.translateX === null)\n {\n transforms.translateX = data.translateX = options.translateX;\n }\n\n if (Number.isFinite(options.translateY) || options.translateY === null)\n {\n transforms.translateY = data.translateY = options.translateY;\n }\n\n if (Number.isFinite(options.translateZ) || options.translateZ === null)\n {\n transforms.translateZ = data.translateZ = options.translateZ;\n }\n\n if (Number.isFinite(options.width) || options.width === 'auto' || options.width === 'inherit' ||\n options.width === null)\n {\n data.width = updateData.dimensionData.width = typeof options.width === 'number' ?\n Math.round(options.width) : options.width;\n }\n\n if (Number.isFinite(options.zIndex) || options.zIndex === null)\n {\n data.zIndex = typeof options.zIndex === 'number' ? Math.round(options.zIndex) : options.zIndex;\n }\n }\n\n this.#stores = {\n // The main properties for manipulating Position.\n height: propertyStore(this, 'height'),\n left: propertyStore(this, 'left'),\n rotateX: propertyStore(this, 'rotateX'),\n rotateY: propertyStore(this, 'rotateY'),\n rotateZ: propertyStore(this, 'rotateZ'),\n scale: propertyStore(this, 'scale'),\n top: propertyStore(this, 'top'),\n transformOrigin: propertyStore(this, 'transformOrigin'),\n translateX: propertyStore(this, 'translateX'),\n translateY: propertyStore(this, 'translateY'),\n translateZ: propertyStore(this, 'translateZ'),\n width: propertyStore(this, 'width'),\n zIndex: propertyStore(this, 'zIndex'),\n\n // Stores that control validation when width / height is not `auto`.\n maxHeight: propertyStore(this, 'maxHeight'),\n maxWidth: propertyStore(this, 'maxWidth'),\n minHeight: propertyStore(this, 'minHeight'),\n minWidth: propertyStore(this, 'minWidth'),\n\n // Readable stores based on updates or from resize observer changes.\n dimension: { subscribe: updateData.storeDimension.subscribe },\n element: { subscribe: this.#styleCache.stores.element.subscribe },\n resizeContentHeight: { subscribe: this.#styleCache.stores.resizeContentHeight.subscribe },\n resizeContentWidth: { subscribe: this.#styleCache.stores.resizeContentWidth.subscribe },\n resizeOffsetHeight: { subscribe: this.#styleCache.stores.resizeOffsetHeight.subscribe },\n resizeOffsetWidth: { subscribe: this.#styleCache.stores.resizeOffsetWidth.subscribe },\n transform: { subscribe: updateData.storeTransform.subscribe },\n\n // Protected store that should only be set by resizeObserver action.\n resizeObserved: this.#styleCache.stores.resizeObserved,\n };\n\n // When resize change from any applied resizeObserver action automatically set data for new validation run.\n // A resizeObserver prop should be set to true for ApplicationShell components or usage of resizeObserver action\n // to monitor for changes. This should only be used on elements that have 'auto' for width or height.\n subscribeIgnoreFirst(this.#stores.resizeObserved, (resizeData) =>\n {\n const parent = this.#parent;\n const el = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n\n // Only invoke set if there is a target element and the resize data has a valid offset width & height.\n if (el instanceof HTMLElement && Number.isFinite(resizeData?.offsetWidth) &&\n Number.isFinite(resizeData?.offsetHeight))\n {\n this.set(data);\n }\n });\n\n this.#stores.transformOrigin.values = constants.transformOrigins;\n\n [this.#validators, this.#validatorData] = new AdapterValidators();\n\n if (options?.initial || options?.positionInitial)\n {\n const initialHelper = options.initial ?? options.positionInitial;\n\n if (typeof initialHelper?.getLeft !== 'function' || typeof initialHelper?.getTop !== 'function')\n {\n throw new Error(\n `'options.initial' position helper does not contain 'getLeft' and / or 'getTop' functions.`);\n }\n\n this.#options.initialHelper = options.initial;\n }\n\n if (options?.validator)\n {\n if (isIterable(options?.validator)) { this.validators.add(...options.validator); }\n else { this.validators.add(options.validator); }\n }\n }\n\n /**\n * Returns the animation API.\n *\n * @returns {AnimationAPI} Animation API.\n */\n get animate()\n {\n return this.#animate;\n }\n\n /**\n * Returns the dimension data for the readable store.\n *\n * @returns {{width: number | 'auto', height: number | 'auto'}} Dimension data.\n */\n get dimension()\n {\n return this.#updateElementData.dimensionData;\n }\n\n /**\n * Returns the enabled state.\n *\n * @returns {boolean} Enabled state.\n */\n get enabled()\n {\n return this.#enabled;\n }\n\n /**\n * Returns the current HTMLElement being positioned.\n *\n * @returns {HTMLElement|undefined} Current HTMLElement being positioned.\n */\n get element()\n {\n return this.#styleCache.el;\n }\n\n /**\n * Returns a promise that is resolved on the next element update with the time of the update.\n *\n * @returns {Promise<number>} Promise resolved on element update.\n */\n get elementUpdated()\n {\n return this.#updateElementPromise;\n }\n\n /**\n * Returns the associated {@link PositionParent} instance.\n *\n * @returns {PositionParent} The PositionParent instance.\n */\n get parent() { return this.#parent; }\n\n /**\n * Returns the state API.\n *\n * @returns {PositionStateAPI} Position state API.\n */\n get state() { return this.#state; }\n\n /**\n * Returns the derived writable stores for individual data variables.\n *\n * @returns {StorePosition} Derived / writable stores.\n */\n get stores() { return this.#stores; }\n\n /**\n * Returns the transform data for the readable store.\n *\n * @returns {TransformData} Transform Data.\n */\n get transform()\n {\n return this.#updateElementData.transformData;\n }\n\n /**\n * Returns the validators.\n *\n * @returns {AdapterValidators} validators.\n */\n get validators() { return this.#validators; }\n\n /**\n * Sets the enabled state.\n *\n * @param {boolean} enabled - New enabled state.\n */\n set enabled(enabled)\n {\n if (typeof enabled !== 'boolean')\n {\n throw new TypeError(`'enabled' is not a boolean.`);\n }\n\n this.#enabled = enabled;\n }\n\n /**\n * Sets the associated {@link PositionParent} instance. Resets the style cache and default data.\n *\n * @param {PositionParent|void} parent - A PositionParent instance.\n */\n set parent(parent)\n {\n if (parent !== void 0 && !(parent instanceof HTMLElement) && !isObject(parent))\n {\n throw new TypeError(`'parent' is not an HTMLElement, object, or undefined.`);\n }\n\n this.#parent = parent;\n\n // Reset any stored default data & the style cache.\n this.#state.remove({ name: '#defaultData' });\n this.#styleCache.reset();\n\n // If a parent is defined then invoke set to update any parent element.\n if (parent) { this.set(this.#data); }\n }\n\n// Data accessors ----------------------------------------------------------------------------------------------------\n\n /**\n * @returns {number|'auto'|'inherit'|null} height\n */\n get height() { return this.#data.height; }\n\n /**\n * @returns {number|null} left\n */\n get left() { return this.#data.left; }\n\n /**\n * @returns {number|null} maxHeight\n */\n get maxHeight() { return this.#data.maxHeight; }\n\n /**\n * @returns {number|null} maxWidth\n */\n get maxWidth() { return this.#data.maxWidth; }\n\n /**\n * @returns {number|null} minHeight\n */\n get minHeight() { return this.#data.minHeight; }\n\n /**\n * @returns {number|null} minWidth\n */\n get minWidth() { return this.#data.minWidth; }\n\n /**\n * @returns {number|null} rotateX\n */\n get rotateX() { return this.#data.rotateX; }\n\n /**\n * @returns {number|null} rotateY\n */\n get rotateY() { return this.#data.rotateY; }\n\n /**\n * @returns {number|null} rotateZ\n */\n get rotateZ() { return this.#data.rotateZ; }\n\n /**\n * @returns {number|null} alias for rotateZ\n */\n get rotation() { return this.#data.rotateZ; }\n\n /**\n * @returns {number|null} scale\n */\n get scale() { return this.#data.scale; }\n\n /**\n * @returns {number|null} top\n */\n get top() { return this.#data.top; }\n\n /**\n * @returns {string} transformOrigin\n */\n get transformOrigin() { return this.#data.transformOrigin; }\n\n /**\n * @returns {number|null} translateX\n */\n get translateX() { return this.#data.translateX; }\n\n /**\n * @returns {number|null} translateY\n */\n get translateY() { return this.#data.translateY; }\n\n /**\n * @returns {number|null} translateZ\n */\n get translateZ() { return this.#data.translateZ; }\n\n /**\n * @returns {number|'auto'|'inherit'|null} width\n */\n get width() { return this.#data.width; }\n\n /**\n * @returns {number|null} z-index\n */\n get zIndex() { return this.#data.zIndex; }\n\n /**\n * @param {number|string|null} height -\n */\n set height(height)\n {\n this.#stores.height.set(height);\n }\n\n /**\n * @param {number|string|null} left -\n */\n set left(left)\n {\n this.#stores.left.set(left);\n }\n\n /**\n * @param {number|string|null} maxHeight -\n */\n set maxHeight(maxHeight)\n {\n this.#stores.maxHeight.set(maxHeight);\n }\n\n /**\n * @param {number|string|null} maxWidth -\n */\n set maxWidth(maxWidth)\n {\n this.#stores.maxWidth.set(maxWidth);\n }\n\n /**\n * @param {number|string|null} minHeight -\n */\n set minHeight(minHeight)\n {\n this.#stores.minHeight.set(minHeight);\n }\n\n /**\n * @param {number|string|null} minWidth -\n */\n set minWidth(minWidth)\n {\n this.#stores.minWidth.set(minWidth);\n }\n\n /**\n * @param {number|string|null} rotateX -\n */\n set rotateX(rotateX)\n {\n this.#stores.rotateX.set(rotateX);\n }\n\n /**\n * @param {number|string|null} rotateY -\n */\n set rotateY(rotateY)\n {\n this.#stores.rotateY.set(rotateY);\n }\n\n /**\n * @param {number|string|null} rotateZ -\n */\n set rotateZ(rotateZ)\n {\n this.#stores.rotateZ.set(rotateZ);\n }\n\n /**\n * @param {number|string|null} rotateZ - alias for rotateZ\n */\n set rotation(rotateZ)\n {\n this.#stores.rotateZ.set(rotateZ);\n }\n\n /**\n * @param {number|string|null} scale -\n */\n set scale(scale)\n {\n this.#stores.scale.set(scale);\n }\n\n /**\n * @param {number|string|null} top -\n */\n set top(top)\n {\n this.#stores.top.set(top);\n }\n\n /**\n * @param {string} transformOrigin -\n */\n set transformOrigin(transformOrigin)\n {\n if (constants.transformOrigins.includes(transformOrigin)) { this.#stores.transformOrigin.set(transformOrigin); }\n }\n\n /**\n * @param {number|string|null} translateX -\n */\n set translateX(translateX)\n {\n this.#stores.translateX.set(translateX);\n }\n\n /**\n * @param {number|string|null} translateY -\n */\n set translateY(translateY)\n {\n this.#stores.translateY.set(translateY);\n }\n\n /**\n * @param {number|string|null} translateZ -\n */\n set translateZ(translateZ)\n {\n this.#stores.translateZ.set(translateZ);\n }\n\n /**\n * @param {number|string|null} width -\n */\n set width(width)\n {\n this.#stores.width.set(width);\n }\n\n /**\n * @param {number|string|null} zIndex -\n */\n set zIndex(zIndex)\n {\n this.#stores.zIndex.set(zIndex);\n }\n\n /**\n * Assigns current position to object passed into method.\n *\n * @param {object|PositionData} [position] - Target to assign current position data.\n *\n * @param {PositionGetOptions} [options] - Defines options for specific keys and substituting null for numeric\n * default values.\n *\n * @returns {PositionData} Passed in object with current position data.\n */\n get(position = {}, options)\n {\n const keys = options?.keys;\n const excludeKeys = options?.exclude;\n const numeric = options?.numeric ?? false;\n\n if (isIterable(keys))\n {\n // Replace any null values potentially with numeric default values.\n if (numeric)\n {\n for (const key of keys) { position[key] = this[key] ?? constants.numericDefaults[key]; }\n }\n else // Accept current values.\n {\n for (const key of keys) { position[key] = this[key]; }\n }\n\n // Remove any excluded keys.\n if (isIterable(excludeKeys))\n {\n for (const key of excludeKeys) { delete position[key]; }\n }\n\n return position;\n }\n else\n {\n const data = Object.assign(position, this.#data);\n\n // Remove any excluded keys.\n if (isIterable(excludeKeys))\n {\n for (const key of excludeKeys) { delete data[key]; }\n }\n\n // Potentially set numeric defaults.\n if (numeric) { constants.setNumericDefaults(data); }\n\n return data;\n }\n }\n\n /**\n * @returns {PositionData} Current position data.\n */\n toJSON()\n {\n return Object.assign({}, this.#data);\n }\n\n /**\n * All calculation and updates of position are implemented in {@link Position}. This allows position to be fully\n * reactive and in control of updating inline styles for the application.\n *\n * Note: the logic for updating position is improved and changes a few aspects from the default\n * {@link Application.setPosition}. The gate on `popOut` is removed, so to ensure no positional application occurs\n * popOut applications can set `this.options.positionable` to false ensuring no positional inline styles are\n * applied.\n *\n * The initial set call on an application with a target element will always set width / height as this is\n * necessary for correct calculations.\n *\n * When a target element is present updated styles are applied after validation. To modify the behavior of set\n * implement one or more validator functions and add them from the application via\n * `this.position.validators.add(<Function>)`.\n *\n * Updates to any target element are decoupled from the underlying Position data. This method returns this instance\n * that you can then await on the target element inline style update by using {@link Position.elementUpdated}.\n *\n * @param {PositionDataExtended} [position] - Position data to set.\n *\n * @returns {Position} This Position instance.\n */\n set(position = {})\n {\n if (typeof position !== 'object') { throw new TypeError(`Position - set error: 'position' is not an object.`); }\n\n const parent = this.#parent;\n\n // An early out to prevent `set` from taking effect if not enabled.\n if (!this.#enabled)\n {\n return this;\n }\n\n // An early out to prevent `set` from taking effect if options `positionable` is false.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return this;\n }\n\n // Callers can specify to immediately update an associated element. This is useful if set is called from\n // requestAnimationFrame / rAF. Library integrations like GSAP invoke set from rAF.\n const immediateElementUpdate = position.immediateElementUpdate === true;\n\n const data = this.#data;\n const transforms = this.#transforms;\n\n // Find the target HTML element and verify that it is connected storing it in `el`.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n const changeSet = this.#positionChangeSet;\n const styleCache = this.#styleCache;\n\n if (el)\n {\n // Cache the computed styles of the element.\n if (!styleCache.hasData(el))\n {\n styleCache.update(el);\n\n // Add will-change property if not already set in inline or computed styles.\n if (!styleCache.hasWillChange)\n {\n // TODO: This is commented out as there is a Chrome bug that reduces quality / blurs\n // child elements when `will-change: transform` is set.\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1343711#c4\n\n // el.style.willChange = this.#options.ortho ? 'transform' : 'top, left, transform';\n }\n\n // Update all properties / clear queued state.\n changeSet.set(true);\n this.#updateElementData.queued = false;\n }\n\n // Converts any relative string position data to numeric inputs.\n convertRelative(position, this);\n\n position = this.#updatePosition(position, parent, el, styleCache);\n\n // Check if a validator cancelled the update.\n if (position === null) { return this; }\n }\n\n if (Number.isFinite(position.left))\n {\n position.left = Math.round(position.left);\n\n if (data.left !== position.left) { data.left = position.left; changeSet.left = true; }\n }\n\n if (Number.isFinite(position.top))\n {\n position.top = Math.round(position.top);\n\n if (data.top !== position.top) { data.top = position.top; changeSet.top = true; }\n }\n\n if (Number.isFinite(position.maxHeight) || position.maxHeight === null)\n {\n position.maxHeight = typeof position.maxHeight === 'number' ? Math.round(position.maxHeight) : null;\n\n if (data.maxHeight !== position.maxHeight) { data.maxHeight = position.maxHeight; changeSet.maxHeight = true; }\n }\n\n if (Number.isFinite(position.maxWidth) || position.maxWidth === null)\n {\n position.maxWidth = typeof position.maxWidth === 'number' ? Math.round(position.maxWidth) : null;\n\n if (data.maxWidth !== position.maxWidth) { data.maxWidth = position.maxWidth; changeSet.maxWidth = true; }\n }\n\n if (Number.isFinite(position.minHeight) || position.minHeight === null)\n {\n position.minHeight = typeof position.minHeight === 'number' ? Math.round(position.minHeight) : null;\n\n if (data.minHeight !== position.minHeight) { data.minHeight = position.minHeight; changeSet.minHeight = true; }\n }\n\n if (Number.isFinite(position.minWidth) || position.minWidth === null)\n {\n position.minWidth = typeof position.minWidth === 'number' ? Math.round(position.minWidth) : null;\n\n if (data.minWidth !== position.minWidth) { data.minWidth = position.minWidth; changeSet.minWidth = true; }\n }\n\n if (Number.isFinite(position.rotateX) || position.rotateX === null)\n {\n if (data.rotateX !== position.rotateX)\n {\n data.rotateX = transforms.rotateX = position.rotateX;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.rotateY) || position.rotateY === null)\n {\n if (data.rotateY !== position.rotateY)\n {\n data.rotateY = transforms.rotateY = position.rotateY;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.rotateZ) || position.rotateZ === null)\n {\n if (data.rotateZ !== position.rotateZ)\n {\n data.rotateZ = transforms.rotateZ = position.rotateZ;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.scale) || position.scale === null)\n {\n position.scale = typeof position.scale === 'number' ? Math.max(0, Math.min(position.scale, 1000)) : null;\n\n if (data.scale !== position.scale)\n {\n data.scale = transforms.scale = position.scale;\n changeSet.transform = true;\n }\n }\n\n if ((typeof position.transformOrigin === 'string' && constants.transformOrigins.includes(\n position.transformOrigin)) || position.transformOrigin === null)\n {\n if (data.transformOrigin !== position.transformOrigin)\n {\n data.transformOrigin = position.transformOrigin;\n changeSet.transformOrigin = true;\n }\n }\n\n if (Number.isFinite(position.translateX) || position.translateX === null)\n {\n if (data.translateX !== position.translateX)\n {\n data.translateX = transforms.translateX = position.translateX;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.translateY) || position.translateY === null)\n {\n if (data.translateY !== position.translateY)\n {\n data.translateY = transforms.translateY = position.translateY;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.translateZ) || position.translateZ === null)\n {\n if (data.translateZ !== position.translateZ)\n {\n data.translateZ = transforms.translateZ = position.translateZ;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.zIndex))\n {\n position.zIndex = Math.round(position.zIndex);\n\n if (data.zIndex !== position.zIndex) { data.zIndex = position.zIndex; changeSet.zIndex = true; }\n }\n\n if (Number.isFinite(position.width) || position.width === 'auto' || position.width === 'inherit' ||\n position.width === null)\n {\n position.width = typeof position.width === 'number' ? Math.round(position.width) : position.width;\n\n if (data.width !== position.width) { data.width = position.width; changeSet.width = true; }\n }\n\n if (Number.isFinite(position.height) || position.height === 'auto' || position.height === 'inherit' ||\n position.height === null)\n {\n position.height = typeof position.height === 'number' ? Math.round(position.height) : position.height;\n\n if (data.height !== position.height) { data.height = position.height; changeSet.height = true; }\n }\n\n if (el)\n {\n const defaultData = this.#state.getDefault();\n\n // Set default data after first set operation that has a target element.\n if (typeof defaultData !== 'object')\n {\n this.#state.save({ name: '#defaultData', ...Object.assign({}, data) });\n }\n\n // If `immediateElementUpdate` is true in position data passed to `set` then update the element immediately.\n // This is for rAF based library integrations like GSAP.\n if (immediateElementUpdate)\n {\n UpdateElementManager.immediate(el, this.#updateElementData);\n this.#updateElementPromise = Promise.resolve(performance.now());\n }\n // Else if not queued then queue an update for the next rAF callback.\n else if (!this.#updateElementData.queued)\n {\n this.#updateElementPromise = UpdateElementManager.add(el, this.#updateElementData);\n }\n }\n else\n {\n // Notify main store subscribers.\n UpdateElementManager.updateSubscribers(this.#updateElementData);\n }\n\n return this;\n }\n\n /**\n *\n * @param {function(PositionData): void} handler - Callback function that is invoked on update / changes. Receives\n * a copy of the PositionData.\n *\n * @returns {(function(): void)} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n\n handler(Object.assign({}, this.#data)); // call handler with current value\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n\n /**\n * @param {PositionDataExtended} opts -\n *\n * @param {number|null} opts.left -\n *\n * @param {number|null} opts.top -\n *\n * @param {number|null} opts.maxHeight -\n *\n * @param {number|null} opts.maxWidth -\n *\n * @param {number|null} opts.minHeight -\n *\n * @param {number|null} opts.minWidth -\n *\n * @param {number|'auto'|null} opts.width -\n *\n * @param {number|'auto'|null} opts.height -\n *\n * @param {number|null} opts.rotateX -\n *\n * @param {number|null} opts.rotateY -\n *\n * @param {number|null} opts.rotateZ -\n *\n * @param {number|null} opts.scale -\n *\n * @param {string} opts.transformOrigin -\n *\n * @param {number|null} opts.translateX -\n *\n * @param {number|null} opts.translateY -\n *\n * @param {number|null} opts.translateZ -\n *\n * @param {number|null} opts.zIndex -\n *\n * @param {number|null} opts.rotation - alias for rotateZ\n *\n * @param {*} opts.rest -\n *\n * @param {object} parent -\n *\n * @param {HTMLElement} el -\n *\n * @param {StyleCache} styleCache -\n *\n * @returns {null|PositionData} Updated position data or null if validation fails.\n */\n #updatePosition({\n // Directly supported parameters\n left, top, maxWidth, maxHeight, minWidth, minHeight, width, height, rotateX, rotateY, rotateZ, scale,\n transformOrigin, translateX, translateY, translateZ, zIndex,\n\n // Aliased parameters\n rotation,\n\n ...rest\n } = {}, parent, el, styleCache)\n {\n let currentPosition = s_DATA_UPDATE.copy(this.#data);\n\n // Update width if an explicit value is passed, or if no width value is set on the element.\n if (el.style.width === '' || width !== void 0)\n {\n if (width === 'auto' || (currentPosition.width === 'auto' && width !== null))\n {\n currentPosition.width = 'auto';\n width = styleCache.offsetWidth;\n }\n else if (width === 'inherit' || (currentPosition.width === 'inherit' && width !== null))\n {\n currentPosition.width = 'inherit';\n width = styleCache.offsetWidth;\n }\n else\n {\n const newWidth = Number.isFinite(width) ? width : currentPosition.width;\n currentPosition.width = width = Number.isFinite(newWidth) ? Math.round(newWidth) : styleCache.offsetWidth;\n }\n }\n else\n {\n width = Number.isFinite(currentPosition.width) ? currentPosition.width : styleCache.offsetWidth;\n }\n\n // Update height if an explicit value is passed, or if no height value is set on the element.\n if (el.style.height === '' || height !== void 0)\n {\n if (height === 'auto' || (currentPosition.height === 'auto' && height !== null))\n {\n currentPosition.height = 'auto';\n height = styleCache.offsetHeight;\n }\n else if (height === 'inherit' || (currentPosition.height === 'inherit' && height !== null))\n {\n currentPosition.height = 'inherit';\n height = styleCache.offsetHeight;\n }\n else\n {\n const newHeight = Number.isFinite(height) ? height : currentPosition.height;\n currentPosition.height = height = Number.isFinite(newHeight) ? Math.round(newHeight) :\n styleCache.offsetHeight;\n }\n }\n else\n {\n height = Number.isFinite(currentPosition.height) ? currentPosition.height : styleCache.offsetHeight;\n }\n\n // Update left\n if (Number.isFinite(left))\n {\n currentPosition.left = left;\n }\n else if (!Number.isFinite(currentPosition.left))\n {\n // Potentially use any initial position helper if available or set to 0.\n currentPosition.left = typeof this.#options.initialHelper?.getLeft === 'function' ?\n this.#options.initialHelper.getLeft(width) : 0;\n }\n\n // Update top\n if (Number.isFinite(top))\n {\n currentPosition.top = top;\n }\n else if (!Number.isFinite(currentPosition.top))\n {\n // Potentially use any initial position helper if available or set to 0.\n currentPosition.top = typeof this.#options.initialHelper?.getTop === 'function' ?\n this.#options.initialHelper.getTop(height) : 0;\n }\n\n if (Number.isFinite(maxHeight) || maxHeight === null)\n {\n currentPosition.maxHeight = Number.isFinite(maxHeight) ? Math.round(maxHeight) : null;\n }\n\n if (Number.isFinite(maxWidth) || maxWidth === null)\n {\n currentPosition.maxWidth = Number.isFinite(maxWidth) ? Math.round(maxWidth) : null;\n }\n\n if (Number.isFinite(minHeight) || minHeight === null)\n {\n currentPosition.minHeight = Number.isFinite(minHeight) ? Math.round(minHeight) : null;\n }\n\n if (Number.isFinite(minWidth) || minWidth === null)\n {\n currentPosition.minWidth = Number.isFinite(minWidth) ? Math.round(minWidth) : null;\n }\n\n // Update rotate X/Y/Z, scale, z-index\n if (Number.isFinite(rotateX) || rotateX === null) { currentPosition.rotateX = rotateX; }\n if (Number.isFinite(rotateY) || rotateY === null) { currentPosition.rotateY = rotateY; }\n\n // Handle alias for rotateZ. First check if `rotateZ` is valid and different from the current value. Next check if\n // `rotation` is valid and use it for `rotateZ`.\n if (rotateZ !== currentPosition.rotateZ && (Number.isFinite(rotateZ) || rotateZ === null))\n {\n currentPosition.rotateZ = rotateZ;\n }\n else if (rotation !== currentPosition.rotateZ && (Number.isFinite(rotation) || rotation === null))\n {\n currentPosition.rotateZ = rotation;\n }\n\n if (Number.isFinite(translateX) || translateX === null) { currentPosition.translateX = translateX; }\n if (Number.isFinite(translateY) || translateY === null) { currentPosition.translateY = translateY; }\n if (Number.isFinite(translateZ) || translateZ === null) { currentPosition.translateZ = translateZ; }\n\n if (Number.isFinite(scale) || scale === null)\n {\n currentPosition.scale = typeof scale === 'number' ? Math.max(0, Math.min(scale, 1000)) : null;\n }\n\n if (typeof transformOrigin === 'string' || transformOrigin === null)\n {\n currentPosition.transformOrigin = constants.transformOrigins.includes(transformOrigin) ? transformOrigin :\n null;\n }\n\n if (Number.isFinite(zIndex) || zIndex === null)\n {\n currentPosition.zIndex = typeof zIndex === 'number' ? Math.round(zIndex) : zIndex;\n }\n\n const validatorData = this.#validatorData;\n\n // If there are any validators allow them to potentially modify position data or reject the update.\n if (this.#validators.enabled && validatorData.length)\n {\n s_VALIDATION_DATA.parent = parent;\n\n s_VALIDATION_DATA.el = el;\n\n s_VALIDATION_DATA.computed = styleCache.computed;\n\n s_VALIDATION_DATA.transforms = this.#transforms;\n\n s_VALIDATION_DATA.height = height;\n\n s_VALIDATION_DATA.width = width;\n\n s_VALIDATION_DATA.marginLeft = styleCache.marginLeft;\n\n s_VALIDATION_DATA.marginTop = styleCache.marginTop;\n\n s_VALIDATION_DATA.maxHeight = styleCache.maxHeight ?? currentPosition.maxHeight;\n\n s_VALIDATION_DATA.maxWidth = styleCache.maxWidth ?? currentPosition.maxWidth;\n\n // Given a parent w/ reactive state and is minimized ignore styleCache min-width/height.\n const isMinimized = parent?.reactive?.minimized ?? false;\n\n // Note the use of || for accessing the style cache as the left hand is ignored w/ falsy values such as '0'.\n s_VALIDATION_DATA.minHeight = isMinimized ? currentPosition.minHeight ?? 0 :\n styleCache.minHeight || (currentPosition.minHeight ?? 0);\n\n s_VALIDATION_DATA.minWidth = isMinimized ? currentPosition.minWidth ?? 0 :\n styleCache.minWidth || (currentPosition.minWidth ?? 0);\n\n for (let cntr = 0; cntr < validatorData.length; cntr++)\n {\n s_VALIDATION_DATA.position = currentPosition;\n s_VALIDATION_DATA.rest = rest;\n currentPosition = validatorData[cntr].validator(s_VALIDATION_DATA);\n\n if (currentPosition === null) { return null; }\n }\n }\n\n // Return the updated position object.\n return currentPosition;\n }\n}\n\nconst s_DATA_UPDATE = new PositionData();\n\n/**\n * @type {ValidationData}\n */\nconst s_VALIDATION_DATA = {\n position: void 0,\n parent: void 0,\n el: void 0,\n computed: void 0,\n transforms: void 0,\n height: void 0,\n width: void 0,\n marginLeft: void 0,\n marginTop: void 0,\n maxHeight: void 0,\n maxWidth: void 0,\n minHeight: void 0,\n minWidth: void 0,\n rest: void 0\n};\n\nObject.seal(s_VALIDATION_DATA);\n\n/**\n * @typedef {object} PositionInitialHelper\n *\n * @property {(width: number) => number} getLeft - Returns the left position given the width of the browser window.\n *\n * @property {(height: number) => number} getTop - Returns the top position given the height of the browser window.\n */\n\n/**\n * @typedef {object} PositionDataExtended\n *\n * @property {number|string|null} [height] -\n *\n * @property {number|string|null} [left] -\n *\n * @property {number|string|null} [maxHeight] -\n *\n * @property {number|string|null} [maxWidth] -\n *\n * @property {number|string|null} [minHeight] -\n *\n * @property {number|string|null} [minWidth] -\n *\n * @property {number|string|null} [rotateX] -\n *\n * @property {number|string|null} [rotateY] -\n *\n * @property {number|string|null} [rotateZ] -\n *\n * @property {number|string|null} [scale] -\n *\n * @property {number|string|null} [top] -\n *\n * @property {string|null} [transformOrigin] -\n *\n * @property {number|string|null} [translateX] -\n *\n * @property {number|string|null} [translateY] -\n *\n * @property {number|string|null} [translateZ] -\n *\n * @property {number|string|null} [width] -\n *\n * @property {number|string|null} [zIndex] -\n *\n * Extended properties -----------------------------------------------------------------------------------------------\n *\n * @property {boolean} [immediateElementUpdate] - When true any associated element is updated immediately.\n *\n * @property {number|null} [rotation] - Alias for `rotateZ`.\n */\n\n/**\n * @typedef {object} PositionGetOptions\n *\n * @property {Iterable<string>} keys - When provided only these keys are copied.\n *\n * @property {Iterable<string>} exclude - When provided these keys are excluded.\n *\n * @property {boolean} numeric - When true any `null` values are converted into defaults.\n */\n\n/**\n * @typedef {object} PositionOptions - Options set in constructor.\n *\n * @property {boolean} calculateTransform - When true always calculate transform data.\n *\n * @property {PositionInitialHelper} initialHelper - Provides a helper for setting initial position data.\n *\n * @property {boolean} ortho - Sets Position to orthographic mode using just transform / matrix3d for positioning.\n *\n * @property {boolean} transformSubscribed - Set to true when there are subscribers to the readable transform store.\n */\n\n/**\n * @typedef {PositionOptions & PositionData} PositionOptionsAll\n */\n\n/**\n * @typedef {HTMLElement | object} PositionParent\n *\n * @property {Function} [elementTarget] - Potentially returns any parent object.\n */\n\n/**\n * @typedef {object} ResizeObserverData\n *\n * @property {number|undefined} contentHeight -\n *\n * @property {number|undefined} contentWidth -\n *\n * @property {number|undefined} offsetHeight -\n *\n * @property {number|undefined} offsetWidth -\n */\n\n/**\n * @typedef {object} StorePosition - Provides individual writable stores for {@link Position}.\n *\n * @property {import('svelte/store').Readable<{width: number, height: number}>} dimension - Readable store for dimension\n * data.\n *\n * @property {import('svelte/store').Readable<HTMLElement>} element - Readable store for current element.\n *\n * @property {import('svelte/store').Writable<number|null>} left - Derived store for `left` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} top - Derived store for `top` updates.\n *\n * @property {import('svelte/store').Writable<number|'auto'|null>} width - Derived store for `width` updates.\n *\n * @property {import('svelte/store').Writable<number|'auto'|null>} height - Derived store for `height` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} maxHeight - Derived store for `maxHeight` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} maxWidth - Derived store for `maxWidth` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} minHeight - Derived store for `minHeight` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} minWidth - Derived store for `minWidth` updates.\n *\n * @property {import('svelte/store').Readable<number|undefined>} resizeContentHeight - Readable store for `contentHeight`.\n *\n * @property {import('svelte/store').Readable<number|undefined>} resizeContentWidth - Readable store for `contentWidth`.\n *\n * @property {import('svelte/store').Writable<ResizeObserverData>} resizeObserved - Protected store for resize observer updates.\n *\n * @property {import('svelte/store').Readable<number|undefined>} resizeOffsetHeight - Readable store for `offsetHeight`.\n *\n * @property {import('svelte/store').Readable<number|undefined>} resizeOffsetWidth - Readable store for `offsetWidth`.\n *\n * @property {import('svelte/store').Writable<number|null>} rotate - Derived store for `rotate` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} rotateX - Derived store for `rotateX` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} rotateY - Derived store for `rotateY` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} rotateZ - Derived store for `rotateZ` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} scale - Derived store for `scale` updates.\n *\n * @property {import('svelte/store').Readable<TransformData>} transform - Readable store for transform data.\n *\n * @property {import('svelte/store').Writable<string>} transformOrigin - Derived store for `transformOrigin`.\n *\n * @property {import('svelte/store').Writable<number|null>} translateX - Derived store for `translateX` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} translateY - Derived store for `translateY` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} translateZ - Derived store for `translateZ` updates.\n *\n * @property {import('svelte/store').Writable<number|null>} zIndex - Derived store for `zIndex` updates.\n */\n\n/**\n * @typedef {object} ValidationData\n *\n * @property {PositionData} position -\n *\n * @property {PositionParent} parent -\n *\n * @property {HTMLElement} el -\n *\n * @property {CSSStyleDeclaration} computed -\n *\n * @property {Transforms} transforms -\n *\n * @property {number} height -\n *\n * @property {number} width -\n *\n * @property {number|undefined} marginLeft -\n *\n * @property {number|undefined} marginTop -\n *\n * @property {number|undefined} maxHeight -\n *\n * @property {number|undefined} maxWidth -\n *\n * @property {number|undefined} minHeight -\n *\n * @property {number|undefined} minWidth -\n *\n * @property {object} rest - The rest of any data submitted to {@link Position.set}\n */\n","import { linear } from 'svelte/easing';\n\nimport { lerp } from '@typhonjs-fvtt/runtime/svelte/math';\nimport { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Provides the ability the save / restore application state for positional and UI state such as minimized status.\n *\n * You can restore a saved state with animation; please see the options of {@link ApplicationState.restore}.\n */\nexport class ApplicationState\n{\n /** @type {ApplicationShellExt} */\n #application;\n\n /** @type {Map<string, ApplicationStateData>} */\n #dataSaved = new Map();\n\n /**\n * @param {ApplicationShellExt} application - The application.\n */\n constructor(application)\n {\n this.#application = application;\n\n Object.seal(this);\n }\n\n /**\n * Returns current application state along with any extra data passed into method.\n *\n * @param {object} [extra] - Extra data to add to application state.\n *\n * @returns {ApplicationStateData} Passed in object with current application state.\n */\n get(extra = {})\n {\n return Object.assign(extra, {\n position: this.#application?.position?.get(),\n beforeMinimized: this.#application?.position?.state.get({ name: '#beforeMinimized' }),\n options: Object.assign({}, this.#application?.options),\n ui: { minimized: this.#application?.reactive?.minimized }\n });\n }\n\n /**\n * Returns any stored save state by name.\n *\n * @param {string} name - Saved data set name.\n *\n * @returns {ApplicationStateData} The saved data set.\n */\n getSave({ name })\n {\n if (typeof name !== 'string')\n {\n throw new TypeError(`ApplicationState - getSave error: 'name' is not a string.`);\n }\n\n return this.#dataSaved.get(name);\n }\n\n /**\n * Removes and returns any application state by name.\n *\n * @param {object} options - Options.\n *\n * @param {string} options.name - Name to remove and retrieve.\n *\n * @returns {ApplicationStateData} Saved application data.\n */\n remove({ name })\n {\n if (typeof name !== 'string') { throw new TypeError(`ApplicationState - remove: 'name' is not a string.`); }\n\n const data = this.#dataSaved.get(name);\n this.#dataSaved.delete(name);\n\n return data;\n }\n\n /**\n * Restores a saved application state returning the data. Several optional parameters are available\n * to control whether the restore action occurs silently (no store / inline styles updates), animates\n * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} allows\n * specification of the duration, easing, and interpolate functions along with configuring a Promise to be\n * returned if awaiting the end of the animation.\n *\n * @param {object} params - Parameters\n *\n * @param {string} params.name - Saved data set name.\n *\n * @param {boolean} [params.remove=false] - Remove data set.\n *\n * @param {boolean} [params.async=false] - If animating return a Promise that resolves with any saved data.\n *\n * @param {boolean} [params.animateTo=false] - Animate to restore data.\n *\n * @param {number} [params.duration=0.1] - Duration in seconds.\n *\n * @param {Function} [params.ease=linear] - Easing function.\n *\n * @param {Function} [params.interpolate=lerp] - Interpolation function.\n *\n * @returns {ApplicationStateData|Promise<ApplicationStateData>} Saved application data.\n */\n restore({ name, remove = false, async = false, animateTo = false, duration = 0.1, ease = linear,\n interpolate = lerp })\n {\n if (typeof name !== 'string')\n {\n throw new TypeError(`ApplicationState - restore error: 'name' is not a string.`);\n }\n\n const dataSaved = this.#dataSaved.get(name);\n\n if (dataSaved)\n {\n if (remove) { this.#dataSaved.delete(name); }\n\n if (async)\n {\n return this.set(dataSaved, { async, animateTo, duration, ease, interpolate }).then(() => dataSaved);\n }\n else\n {\n this.set(dataSaved, { async, animateTo, duration, ease, interpolate });\n }\n }\n\n return dataSaved;\n }\n\n /**\n * Saves current application state with the opportunity to add extra data to the saved state.\n *\n * @param {object} options - Options.\n *\n * @param {string} options.name - name to index this saved data.\n *\n * @param {...*} [options.extra] - Extra data to add to saved data.\n *\n * @returns {ApplicationStateData} Current application data\n */\n save({ name, ...extra })\n {\n if (typeof name !== 'string') { throw new TypeError(`ApplicationState - save error: 'name' is not a string.`); }\n\n const data = this.get(extra);\n\n this.#dataSaved.set(name, data);\n\n return data;\n }\n\n /**\n * Restores a saved application state returning the data. Several optional parameters are available\n * to control whether the restore action occurs silently (no store / inline styles updates), animates\n * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} allows\n * specification of the duration, easing, and interpolate functions along with configuring a Promise to be\n * returned if awaiting the end of the animation.\n *\n * Note: If serializing application state any minimized apps will use the before minimized state on initial render\n * of the app as it is currently not possible to render apps with Foundry VTT core API in the minimized state.\n *\n * TODO: THIS METHOD NEEDS TO BE REFACTORED WHEN TRL IS MADE INTO A STANDALONE FRAMEWORK.\n *\n * @param {ApplicationStateData} data - Saved data set name.\n *\n * @param {object} [opts] - Optional parameters\n *\n * @param {boolean} [opts.async=false] - If animating return a Promise that resolves with any saved data.\n *\n * @param {boolean} [opts.animateTo=false] - Animate to restore data.\n *\n * @param {number} [opts.duration=0.1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=linear] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {ApplicationShellExt|Promise<ApplicationShellExt>} When synchronous the application or Promise when\n * animating resolving with application.\n */\n set(data, { async = false, animateTo = false, duration = 0.1, ease = linear, interpolate = lerp } = {})\n {\n if (!isObject(data))\n {\n throw new TypeError(`ApplicationState - restore error: 'data' is not an object.`);\n }\n\n const application = this.#application;\n\n if (!isObject(data?.position))\n {\n console.warn(`ApplicationState.set warning: 'data.position' is not an object.`);\n return application;\n }\n\n // TODO: TAKE NOTE THAT WE ARE ACCESSING A FOUNDRY APP v1 GETTER HERE TO DETERMINE IF APPLICATION IS RENDERED.\n // TODO: THIS NEEDS TO BE REFACTORED WHEN CONVERTING TRL TO A GENERIC FRAMEWORK.\n const rendered = application.rendered;\n\n if (animateTo && !rendered)\n {\n console.warn(`ApplicationState.set warning: Application is not rendered and 'animateTo' is true.`);\n return application;\n }\n\n // Update data directly with no store or inline style updates.\n if (animateTo) // Animate to saved data.\n {\n // Provide special handling to potentially change transform origin as this parameter is not animated.\n if (data.position.transformOrigin !== application.position.transformOrigin)\n {\n application.position.transformOrigin = data.position.transformOrigin;\n }\n\n if (isObject(data?.ui))\n {\n const minimized = typeof data.ui?.minimized === 'boolean' ? data.ui.minimized : false;\n\n if (application?.reactive?.minimized && !minimized)\n {\n application.maximize({ animate: false, duration: 0 });\n }\n }\n\n const promise = application.position.animate.to(data.position,\n { duration, ease, interpolate }).finished.then((cancelled) =>\n {\n if (cancelled) { return application; }\n\n // Merge in saved options to application.\n if (isObject(data?.options))\n {\n application?.reactive.mergeOptions(data.options);\n }\n\n if (isObject(data?.ui))\n {\n const minimized = typeof data.ui?.minimized === 'boolean' ? data.ui.minimized : false;\n\n // Application is currently minimized and stored state is not, so reset minimized state without\n // animation.\n if (!application?.reactive?.minimized && minimized)\n {\n application.minimize({ animate: false, duration: 0 });\n }\n }\n\n if (isObject(data?.beforeMinimized))\n {\n application.position.state.set({ name: '#beforeMinimized', ...data.beforeMinimized });\n }\n\n return application;\n });\n\n // Return a Promise with the application that resolves after animation ends.\n if (async) { return promise; }\n }\n else\n {\n if (rendered)\n {\n // Merge in saved options to application.\n if (isObject(data?.options))\n {\n application?.reactive.mergeOptions(data.options);\n }\n\n if (isObject(data?.ui))\n {\n const minimized = typeof data.ui?.minimized === 'boolean' ? data.ui.minimized : false;\n\n // Application is currently minimized and stored state is not, so reset minimized state without\n // animation.\n if (application?.reactive?.minimized && !minimized)\n {\n application.maximize({ animate: false, duration: 0 });\n }\n else if (!application?.reactive?.minimized && minimized)\n {\n application.minimize({ animate: false, duration });\n }\n }\n\n if (isObject(data?.beforeMinimized))\n {\n application.position.state.set({ name: '#beforeMinimized', ...data.beforeMinimized });\n }\n\n // Default options is to set data for an immediate update.\n application.position.set(data.position);\n }\n else\n {\n // When not rendered set position to the 'beforeMinimized' data if it exists otherwise set w/ 'position'.\n // Currently, w/ Foundry core Application API it is impossible to initially render an app in the minimized\n // state.\n\n let positionData = data.position;\n\n if (isObject(data.beforeMinimized))\n {\n // Take before minimized data.\n positionData = data.beforeMinimized;\n\n // Apply position left / top to before minimized data. This covers the case when an app is minimized,\n // but then moved. This allows restoration of the before minimized parameters w/ the last position\n // location.\n positionData.left = data.position.left;\n positionData.top = data.position.top;\n }\n\n application.position.set(positionData);\n }\n }\n\n return application;\n }\n}\n\n/**\n * @typedef {object} ApplicationStateData\n *\n * @property {PositionDataExtended} position - Application position.\n *\n * @property {object} beforeMinimized - Any application saved position state for #beforeMinimized\n *\n * @property {object} options - Application options.\n *\n * @property {object} ui - Application UI state.\n */\n","import { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Provides a helper class for {@link SvelteApplication} by combining all methods that work on the {@link SvelteData[]}\n * of mounted components. This class is instantiated and can be retrieved by the getter `svelte` via SvelteApplication.\n */\nexport class GetSvelteData\n{\n /**\n * @type {MountedAppShell[]|null[]}\n */\n #applicationShellHolder;\n\n /**\n * @type {SvelteData[]}\n */\n #svelteData;\n\n /**\n * Keep a direct reference to the SvelteData array in an associated {@link SvelteApplication}.\n *\n * @param {MountedAppShell[]|null[]} applicationShellHolder - A reference to the MountedAppShell array.\n *\n * @param {SvelteData[]} svelteData - A reference to the SvelteData array of mounted components.\n */\n constructor(applicationShellHolder, svelteData)\n {\n this.#applicationShellHolder = applicationShellHolder;\n this.#svelteData = svelteData;\n }\n\n /**\n * Returns any mounted {@link MountedAppShell}.\n *\n * @returns {MountedAppShell|null} Any mounted application shell.\n */\n get applicationShell() { return this.#applicationShellHolder[0]; }\n\n /**\n * Returns the indexed Svelte component.\n *\n * @param {number} index -\n *\n * @returns {object} The loaded Svelte component.\n */\n component(index)\n {\n const data = this.#svelteData[index];\n return isObject(data) ? data?.component : void 0;\n }\n\n /**\n * Returns the Svelte component entries iterator.\n *\n * @returns {Generator<Array<number|SvelteComponent>>} Svelte component entries iterator.\n * @yields\n */\n *componentEntries()\n {\n for (let cntr = 0; cntr < this.#svelteData.length; cntr++)\n {\n yield [cntr, this.#svelteData[cntr].component];\n }\n }\n\n /**\n * Returns the Svelte component values iterator.\n *\n * @returns {Generator<SvelteComponent>} Svelte component values iterator.\n * @yields\n */\n *componentValues()\n {\n for (let cntr = 0; cntr < this.#svelteData.length; cntr++)\n {\n yield this.#svelteData[cntr].component;\n }\n }\n\n /**\n * Returns the indexed SvelteData entry.\n *\n * @param {number} index -\n *\n * @returns {SvelteData} The loaded Svelte config + component.\n */\n data(index)\n {\n return this.#svelteData[index];\n }\n\n /**\n * Returns the {@link SvelteData} instance for a given component.\n *\n * @param {object} component - Svelte component.\n *\n * @returns {SvelteData} - The loaded Svelte config + component.\n */\n dataByComponent(component)\n {\n for (const data of this.#svelteData)\n {\n if (data.component === component) { return data; }\n }\n\n return void 0;\n }\n\n /**\n * Returns the SvelteData entries iterator.\n *\n * @returns {IterableIterator<[number, SvelteData]>} SvelteData entries iterator.\n */\n dataEntries()\n {\n return this.#svelteData.entries();\n }\n\n /**\n * Returns the SvelteData values iterator.\n *\n * @returns {IterableIterator<SvelteData>} SvelteData values iterator.\n */\n dataValues()\n {\n return this.#svelteData.values();\n }\n\n /**\n * Returns the length of the mounted Svelte component list.\n *\n * @returns {number} Length of mounted Svelte component list.\n */\n get length()\n {\n return this.#svelteData.length;\n }\n}\n","import {\n isApplicationShell,\n isObject,\n parseSvelteConfig } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Instantiates and attaches a Svelte component to the main inserted HTML.\n *\n * @param {object} opts - Optional parameters.\n *\n * @param {object} opts.app - The target application\n *\n * @param {HTMLElement} opts.template - Any HTML template.\n *\n * @param {object} opts.config - Svelte component options\n *\n * @param {Function} opts.elementRootUpdate - A callback to assign to the external context.\n *\n * @returns {SvelteData} The config + instantiated Svelte component.\n */\nexport function loadSvelteConfig({ app, template, config, elementRootUpdate } = {})\n{\n const svelteOptions = isObject(config.options) ? config.options : {};\n\n let target;\n\n // A specific HTMLElement to append Svelte component.\n if (config.target instanceof HTMLElement)\n {\n target = config.target;\n }\n // A string target defines a selector to find in existing HTML.\n else if (template instanceof HTMLElement && typeof config.target === 'string')\n {\n target = template.querySelector(config.target);\n }\n else // No target defined, create a document fragment.\n {\n target = document.createDocumentFragment();\n }\n\n if (target === void 0)\n {\n console.log(\n `%c[TRL] loadSvelteConfig error - could not find target selector, '${config.target}', for config:\\n`,\n 'background: rgb(57,34,34)', config);\n\n throw new Error();\n }\n\n const NewSvelteComponent = config.class;\n\n const svelteConfig = parseSvelteConfig({ ...config, target }, app);\n\n const externalContext = svelteConfig.context.get('#external');\n\n // Inject the Foundry application instance and `elementRootUpdate` to the external context.\n externalContext.application = app;\n externalContext.elementRootUpdate = elementRootUpdate;\n externalContext.sessionStorage = app.reactive.sessionStorage;\n\n let eventbus;\n\n // Potentially inject any TyphonJS eventbus and track the proxy in the SvelteData instance.\n if (isObject(app._eventbus) && typeof app._eventbus.createProxy === 'function')\n {\n eventbus = app._eventbus.createProxy();\n externalContext.eventbus = eventbus;\n }\n\n // Seal external context so that it can't be extended.\n Object.seal(externalContext);\n\n // TODO: Remove deprecation warning in the future -----------------------------------------------------------------\n\n svelteConfig.context.set('external', new Proxy({}, {\n get(targetUnused, prop)\n {\n console.warn(`[TRL] Deprecation warning: Please change getContext('external') to getContext('#external').`);\n return externalContext[prop];\n }\n }));\n\n // TODO: Remove deprecation warning in the future -----------------------------------------------------------------\n\n // Create the Svelte component.\n /**\n * @type {import('svelte').SvelteComponent}\n */\n const component = new NewSvelteComponent(svelteConfig);\n\n // Set any eventbus to the config.\n svelteConfig.eventbus = eventbus;\n\n /**\n * @type {HTMLElement}\n */\n let element;\n\n // We can directly get the root element from components which follow the application store contract.\n if (isApplicationShell(component))\n {\n element = component.elementRoot;\n }\n\n // Detect if target is a synthesized DocumentFragment with a child element. Child elements will be present\n // if the Svelte component mounts and renders initial content into the document fragment.\n if (target instanceof DocumentFragment && target.firstElementChild)\n {\n if (element === void 0) { element = target.firstElementChild; }\n template.append(target);\n }\n else if (config.target instanceof HTMLElement && element === void 0)\n {\n if (config.target instanceof HTMLElement && typeof svelteOptions.selectorElement !== 'string')\n {\n console.log(\n `%c[TRL] loadSvelteConfig error - HTMLElement target with no 'selectorElement' defined.\\n` +\n `\\nNote: If configuring an application shell and directly targeting a HTMLElement did you bind an` +\n `'elementRoot' and include '<svelte:options accessors={true}/>'?\\n` +\n `\\nOffending config:\\n`, 'background: rgb(57,34,34)', config);\n\n throw new Error();\n }\n\n // The target is an HTMLElement so find the Application element from `selectorElement` option.\n element = target.querySelector(svelteOptions.selectorElement);\n\n if (element === null || element === void 0)\n {\n console.log(\n `%c[TRL] loadSvelteConfig error - HTMLElement target with 'selectorElement', '${\n svelteOptions.selectorElement}', not found for config:\\n`,\n 'background: rgb(57,34,34)', config);\n\n throw new Error();\n }\n }\n\n // If the configuration / original target is an HTML element then do not inject HTML.\n const injectHTML = !(config.target instanceof HTMLElement);\n\n return { config: svelteConfig, component, element, injectHTML };\n}\n","import { derived, writable } from \"svelte/store\";\n\nimport {\n propertyStore,\n subscribeIgnoreFirst,\n TJSSessionStorage } from '@typhonjs-fvtt/runtime/svelte/store';\n\nimport {\n deepMerge,\n safeAccess,\n safeSet } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Contains the reactive functionality / Svelte stores associated with SvelteApplication and retrievable by\n * {@link SvelteApplication.reactive}.\n *\n * There are several reactive getters for UI state such and for two-way bindings / stores see\n * {@link SvelteReactive.storeUIState}:\n * - {@link SvelteReactive.dragging}\n * - {@link SvelteReactive.minimized}\n * - {@link SvelteReactive.resizing}\n *\n * There are also reactive getters / setters for {@link SvelteApplicationOptions} and Foundry\n * {@link ApplicationOptions}. You can use the following as one way bindings and update the associated stores. For\n * two-way bindings / stores see {@link SvelteReactive.storeAppOptions}.\n *\n * - {@link SvelteReactive.draggable}\n * - {@link SvelteReactive.focusAuto}\n * - {@link SvelteReactive.focusKeep}\n * - {@link SvelteReactive.focusTrap}\n * - {@link SvelteReactive.headerButtonNoClose}\n * - {@link SvelteReactive.headerButtonNoLabel}\n * - {@link SvelteReactive.headerIcon}\n * - {@link SvelteReactive.headerNoTitleMinimized}\n * - {@link SvelteReactive.minimizable}\n * - {@link SvelteReactive.popOut}\n * - {@link SvelteReactive.positionable}\n * - {@link SvelteReactive.resizable}\n * - {@link SvelteReactive.title}\n *\n * An instance of TJSSessionStorage is accessible via {@link SvelteReactive.sessionStorage}. Optionally you can pass\n * in an existing instance that can be shared across multiple SvelteApplications by setting\n * {@link SvelteApplicationOptions.sessionStorage}.\n *\n * -------------------------------------------------------------------------------------------------------------------\n *\n * This API is not sealed, and it is recommended that you extend it with accessors to get / set data that is reactive\n * in your application. An example of setting an exported prop `document` from the main mounted application shell.\n *\n * @example\n * import { hasSetter } from '@typhonjs-fvtt/runtime/svelte/util';\n *\n * // Note: make a normal comment.\n * // * @member {object} document - Adds accessors to SvelteReactive to get / set the document associated with\n * // * Document with the mounted application shell Svelte component.\n * // *\n * // * @memberof SvelteReactive#\n * // *\n * Object.defineProperty(this.reactive, 'document', {\n * get: () => this.svelte?.applicationShell?.document,\n * set: (document) =>\n * {\n * const component = this.svelte?.applicationShell;\n * if (hasSetter(component, 'document')) { component.document = document; }\n * }\n * });\n */\nexport class SvelteReactive\n{\n /**\n * @type {SvelteApplication}\n */\n #application;\n\n /**\n * @type {boolean}\n */\n #initialized = false;\n\n /** @type {TJSSessionStorage} */\n #sessionStorage;\n\n /**\n * The Application option store which is injected into mounted Svelte component context under the `external` key.\n *\n * @type {StoreAppOptions}\n */\n #storeAppOptions;\n\n /**\n * Stores the update function for `#storeAppOptions`.\n *\n * @type {import('svelte/store').Writable.update}\n */\n #storeAppOptionsUpdate;\n\n /**\n * Stores the UI state data to make it accessible via getters.\n *\n * @type {object}\n */\n #dataUIState;\n\n /**\n * The UI option store which is injected into mounted Svelte component context under the `external` key.\n *\n * @type {StoreUIOptions}\n */\n #storeUIState;\n\n /**\n * Stores the update function for `#storeUIState`.\n *\n * @type {import('svelte/store').Writable.update}\n */\n #storeUIStateUpdate;\n\n /**\n * Stores the unsubscribe functions from local store subscriptions.\n *\n * @type {import('svelte/store').Unsubscriber[]}\n */\n #storeUnsubscribe = [];\n\n /**\n * @param {SvelteApplication} application - The host Foundry application.\n */\n constructor(application)\n {\n this.#application = application;\n const optionsSessionStorage = application?.options?.sessionStorage;\n\n if (optionsSessionStorage !== void 0 && !(optionsSessionStorage instanceof TJSSessionStorage))\n {\n throw new TypeError(`'options.sessionStorage' is not an instance of TJSSessionStorage.`);\n }\n\n this.#sessionStorage = optionsSessionStorage !== void 0 ? optionsSessionStorage : new TJSSessionStorage();\n }\n\n /**\n * Initializes reactive support. Package private for internal use.\n *\n * @returns {SvelteStores|void} Internal methods to interact with Svelte stores.\n * @package\n */\n initialize()\n {\n if (this.#initialized) { return; }\n\n this.#initialized = true;\n\n this.#storesInitialize();\n\n return {\n appOptionsUpdate: this.#storeAppOptionsUpdate,\n uiOptionsUpdate: this.#storeUIStateUpdate,\n subscribe: this.#storesSubscribe.bind(this),\n unsubscribe: this.#storesUnsubscribe.bind(this)\n };\n }\n\n// Store getters -----------------------------------------------------------------------------------------------------\n\n /**\n * @returns {TJSSessionStorage} Returns TJSSessionStorage instance.\n */\n get sessionStorage()\n {\n return this.#sessionStorage;\n }\n\n /**\n * Returns the store for app options.\n *\n * @returns {StoreAppOptions} App options store.\n */\n get storeAppOptions() { return this.#storeAppOptions; }\n\n /**\n * Returns the store for UI options.\n *\n * @returns {StoreUIOptions} UI options store.\n */\n get storeUIState() { return this.#storeUIState; }\n\n// Only reactive getters ---------------------------------------------------------------------------------------------\n\n /**\n * Returns the current dragging UI state.\n *\n * @returns {boolean} Dragging UI state.\n */\n get dragging() { return this.#dataUIState.dragging; }\n\n /**\n * Returns the current minimized UI state.\n *\n * @returns {boolean} Minimized UI state.\n */\n get minimized() { return this.#dataUIState.minimized; }\n\n /**\n * Returns the current resizing UI state.\n *\n * @returns {boolean} Resizing UI state.\n */\n get resizing() { return this.#dataUIState.resizing; }\n\n// Reactive getter / setters -----------------------------------------------------------------------------------------\n\n /**\n * Returns the draggable app option.\n *\n * @returns {boolean} Draggable app option.\n */\n get draggable() { return this.#application?.options?.draggable; }\n\n /**\n * Returns the focusAuto app option.\n *\n * @returns {boolean} When true auto-management of app focus is enabled.\n */\n get focusAuto() { return this.#application?.options?.focusAuto; }\n\n /**\n * Returns the focusKeep app option.\n *\n * @returns {boolean} When `focusAuto` and `focusKeep` is true; keeps internal focus.\n */\n get focusKeep() { return this.#application?.options?.focusKeep; }\n\n /**\n * Returns the focusTrap app option.\n *\n * @returns {boolean} When true focus trapping / wrapping is enabled keeping focus inside app.\n */\n get focusTrap() { return this.#application?.options?.focusTrap; }\n\n /**\n * Returns the headerButtonNoClose app option.\n *\n * @returns {boolean} Remove the close the button in header app option.\n */\n get headerButtonNoClose() { return this.#application?.options?.headerButtonNoClose; }\n\n /**\n * Returns the headerButtonNoLabel app option.\n *\n * @returns {boolean} Remove the labels from buttons in header app option.\n */\n get headerButtonNoLabel() { return this.#application?.options?.headerButtonNoLabel; }\n\n /**\n * Returns the headerIcon app option.\n *\n * @returns {string|void} URL for header app icon.\n */\n get headerIcon() { return this.#application?.options?.headerIcon; }\n\n /**\n * Returns the headerNoTitleMinimized app option.\n *\n * @returns {boolean} When true removes the header title when minimized.\n */\n get headerNoTitleMinimized() { return this.#application?.options?.headerNoTitleMinimized; }\n\n /**\n * Returns the minimizable app option.\n *\n * @returns {boolean} Minimizable app option.\n */\n get minimizable() { return this.#application?.options?.minimizable; }\n\n /**\n * Returns the Foundry popOut state; {@link Application.popOut}\n *\n * @returns {boolean} Positionable app option.\n */\n get popOut() { return this.#application.popOut; }\n\n /**\n * Returns the positionable app option; {@link SvelteApplicationOptions.positionable}\n *\n * @returns {boolean} Positionable app option.\n */\n get positionable() { return this.#application?.options?.positionable; }\n\n /**\n * Returns the resizable option.\n *\n * @returns {boolean} Resizable app option.\n */\n get resizable() { return this.#application?.options?.resizable; }\n\n /**\n * Returns the title accessor from the parent Application class; {@link Application.title}\n * TODO: Application v2; note that super.title localizes `this.options.title`; IMHO it shouldn't.\n *\n * @returns {string} Title.\n */\n get title() { return this.#application.title; }\n\n /**\n * Sets `this.options.draggable` which is reactive for application shells.\n *\n * @param {boolean} draggable - Sets the draggable option.\n */\n set draggable(draggable)\n {\n if (typeof draggable === 'boolean') { this.setOptions('draggable', draggable); }\n }\n\n /**\n * Sets `this.options.focusAuto` which is reactive for application shells.\n *\n * @param {boolean} focusAuto - Sets the focusAuto option.\n */\n set focusAuto(focusAuto)\n {\n if (typeof focusAuto === 'boolean') { this.setOptions('focusAuto', focusAuto); }\n }\n\n /**\n * Sets `this.options.focusKeep` which is reactive for application shells.\n *\n * @param {boolean} focusKeep - Sets the focusKeep option.\n */\n set focusKeep(focusKeep)\n {\n if (typeof focusKeep === 'boolean') { this.setOptions('focusKeep', focusKeep); }\n }\n\n /**\n * Sets `this.options.focusTrap` which is reactive for application shells.\n *\n * @param {boolean} focusTrap - Sets the focusTrap option.\n */\n set focusTrap(focusTrap)\n {\n if (typeof focusTrap === 'boolean') { this.setOptions('focusTrap', focusTrap); }\n }\n\n /**\n * Sets `this.options.headerButtonNoClose` which is reactive for application shells.\n *\n * @param {boolean} headerButtonNoClose - Sets the headerButtonNoClose option.\n */\n set headerButtonNoClose(headerButtonNoClose)\n {\n if (typeof headerButtonNoClose === 'boolean') { this.setOptions('headerButtonNoClose', headerButtonNoClose); }\n }\n\n /**\n * Sets `this.options.headerButtonNoLabel` which is reactive for application shells.\n *\n * @param {boolean} headerButtonNoLabel - Sets the headerButtonNoLabel option.\n */\n set headerButtonNoLabel(headerButtonNoLabel)\n {\n if (typeof headerButtonNoLabel === 'boolean') { this.setOptions('headerButtonNoLabel', headerButtonNoLabel); }\n }\n\n /**\n * Sets `this.options.headerIcon` which is reactive for application shells.\n *\n * @param {string|void} headerIcon - Sets the headerButtonNoLabel option.\n */\n set headerIcon(headerIcon)\n {\n if (headerIcon === void 0 || typeof headerIcon === 'string') { this.setOptions('headerIcon', headerIcon); }\n }\n\n /**\n * Sets `this.options.headerNoTitleMinimized` which is reactive for application shells.\n *\n * @param {boolean} headerNoTitleMinimized - Sets the headerNoTitleMinimized option.\n */\n set headerNoTitleMinimized(headerNoTitleMinimized)\n {\n if (typeof headerNoTitleMinimized === 'boolean')\n {\n this.setOptions('headerNoTitleMinimized', headerNoTitleMinimized);\n }\n }\n\n /**\n * Sets `this.options.minimizable` which is reactive for application shells that are also pop out.\n *\n * @param {boolean} minimizable - Sets the minimizable option.\n */\n set minimizable(minimizable)\n {\n if (typeof minimizable === 'boolean') { this.setOptions('minimizable', minimizable); }\n }\n\n /**\n * Sets `this.options.popOut` which is reactive for application shells. This will add / remove this application\n * from `ui.windows`.\n *\n * @param {boolean} popOut - Sets the popOut option.\n */\n set popOut(popOut)\n {\n if (typeof popOut === 'boolean') { this.setOptions('popOut', popOut); }\n }\n\n /**\n * Sets `this.options.positionable` enabling / disabling {@link SvelteApplication.position.set}.\n *\n * @param {boolean} positionable - Sets the positionable option.\n */\n set positionable(positionable)\n {\n if (typeof positionable === 'boolean') { this.setOptions('positionable', positionable); }\n }\n\n /**\n * Sets `this.options.resizable` which is reactive for application shells.\n *\n * @param {boolean} resizable - Sets the resizable option.\n */\n set resizable(resizable)\n {\n if (typeof resizable === 'boolean') { this.setOptions('resizable', resizable); }\n }\n\n /**\n * Sets `this.options.title` which is reactive for application shells.\n *\n * Note: Will set empty string if title is undefined or null.\n *\n * @param {string|undefined|null} title - Application title; will be localized, so a translation key is fine.\n */\n set title(title)\n {\n if (typeof title === 'string')\n {\n this.setOptions('title', title);\n }\n else if (title === void 0 || title === null)\n {\n this.setOptions('title', '');\n }\n }\n\n // Reactive Options API -------------------------------------------------------------------------------------------\n\n /**\n * Provides a way to safely get this applications options given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * // TODO DOCUMENT the accessor in more detail.\n *\n * @param {string} accessor - The path / key to set. You can set multiple levels.\n *\n * @param {*} [defaultValue] - A default value returned if the accessor is not found.\n *\n * @returns {*} Value at the accessor.\n */\n getOptions(accessor, defaultValue)\n {\n return safeAccess(this.#application.options, accessor, defaultValue);\n }\n\n /**\n * Provides a way to merge `options` into this applications options and update the appOptions store.\n *\n * @param {object} options - The options object to merge with `this.options`.\n */\n mergeOptions(options)\n {\n this.#storeAppOptionsUpdate((instanceOptions) => deepMerge(instanceOptions, options));\n }\n\n /**\n * Provides a way to safely set this applications options given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * Additionally if an application shell Svelte component is mounted and exports the `appOptions` property then\n * the application options is set to `appOptions` potentially updating the application shell / Svelte component.\n *\n * // TODO DOCUMENT the accessor in more detail.\n *\n * @param {string} accessor - The path / key to set. You can set multiple levels.\n *\n * @param {*} value - Value to set.\n */\n setOptions(accessor, value)\n {\n const success = safeSet(this.#application.options, accessor, value);\n\n // If `this.options` modified then update the app options store.\n if (success)\n {\n this.#storeAppOptionsUpdate(() => this.#application.options);\n }\n }\n\n /**\n * Initializes the Svelte stores and derived stores for the application options and UI state.\n *\n * While writable stores are created the update method is stored in private variables locally and derived Readable\n * stores are provided for essential options which are commonly used.\n *\n * These stores are injected into all Svelte components mounted under the `external` context: `storeAppOptions` and\n * ` storeUIState`.\n */\n #storesInitialize()\n {\n const writableAppOptions = writable(this.#application.options);\n\n // Keep the update function locally, but make the store essentially readable.\n this.#storeAppOptionsUpdate = writableAppOptions.update;\n\n /**\n * Create custom store. The main subscribe method for all app options changes is provided along with derived\n * writable stores for all reactive options.\n *\n * @type {StoreAppOptions}\n */\n const storeAppOptions = {\n subscribe: writableAppOptions.subscribe,\n\n draggable: propertyStore(writableAppOptions, 'draggable'),\n focusAuto: propertyStore(writableAppOptions, 'focusAuto'),\n focusKeep: propertyStore(writableAppOptions, 'focusKeep'),\n focusTrap: propertyStore(writableAppOptions, 'focusTrap'),\n headerButtonNoClose: propertyStore(writableAppOptions, 'headerButtonNoClose'),\n headerButtonNoLabel: propertyStore(writableAppOptions, 'headerButtonNoLabel'),\n headerIcon: propertyStore(writableAppOptions, 'headerIcon'),\n headerNoTitleMinimized: propertyStore(writableAppOptions, 'headerNoTitleMinimized'),\n minimizable: propertyStore(writableAppOptions, 'minimizable'),\n popOut: propertyStore(writableAppOptions, 'popOut'),\n positionable: propertyStore(writableAppOptions, 'positionable'),\n resizable: propertyStore(writableAppOptions, 'resizable'),\n title: propertyStore(writableAppOptions, 'title')\n };\n\n Object.freeze(storeAppOptions);\n\n this.#storeAppOptions = storeAppOptions;\n\n this.#dataUIState = {\n dragging: false,\n headerButtons: [],\n minimized: this.#application._minimized,\n resizing: false\n };\n\n // Create a store for UI state data.\n const writableUIOptions = writable(this.#dataUIState);\n\n // Keep the update function locally, but make the store essentially readable.\n this.#storeUIStateUpdate = writableUIOptions.update;\n\n /**\n * @type {StoreUIOptions}\n */\n const storeUIState = {\n subscribe: writableUIOptions.subscribe,\n\n dragging: propertyStore(writableUIOptions, 'dragging'),\n headerButtons: derived(writableUIOptions, ($options, set) => set($options.headerButtons)),\n minimized: derived(writableUIOptions, ($options, set) => set($options.minimized)),\n resizing: propertyStore(writableUIOptions, 'resizing')\n };\n\n Object.freeze(storeUIState);\n\n // Initialize the store with options set in the Application constructor.\n this.#storeUIState = storeUIState;\n }\n\n /**\n * Registers local store subscriptions for app options. `popOut` controls registering this app with `ui.windows`.\n *\n * @see SvelteApplication._injectHTML\n */\n #storesSubscribe()\n {\n // Register local subscriptions.\n\n // Handles updating header buttons to add / remove the close button.\n this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.headerButtonNoClose, (value) =>\n {\n this.updateHeaderButtons({ headerButtonNoClose: value });\n }));\n\n // Handles updating header buttons to add / remove button labels.\n this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.headerButtonNoLabel, (value) =>\n {\n this.updateHeaderButtons({ headerButtonNoLabel: value });\n }));\n\n // Handles adding / removing this application from `ui.windows` when popOut changes.\n this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.popOut, (value) =>\n {\n if (value && this.#application.rendered)\n {\n globalThis.ui.windows[this.#application.appId] = this.#application;\n }\n else\n {\n delete globalThis.ui.windows[this.#application.appId];\n }\n }));\n }\n\n /**\n * Unsubscribes from any locally monitored stores.\n *\n * @see SvelteApplication.close\n */\n #storesUnsubscribe()\n {\n this.#storeUnsubscribe.forEach((unsubscribe) => unsubscribe());\n this.#storeUnsubscribe = [];\n }\n\n /**\n * Updates the UI Options store with the current header buttons. You may dynamically add / remove header buttons\n * if using an application shell Svelte component. In either overriding `_getHeaderButtons` or responding to the\n * Hooks fired return a new button array and the uiOptions store is updated and the application shell will render\n * the new buttons.\n *\n * Optionally you can set in the SvelteApplication app options {@link SvelteApplicationOptions.headerButtonNoClose}\n * to remove the close button and {@link SvelteApplicationOptions.headerButtonNoLabel} to true and labels will be\n * removed from the header buttons.\n *\n * @param {object} opts - Optional parameters (for internal use)\n *\n * @param {boolean} opts.headerButtonNoClose - The value for `headerButtonNoClose`.\n *\n * @param {boolean} opts.headerButtonNoLabel - The value for `headerButtonNoLabel`.\n */\n updateHeaderButtons({ headerButtonNoClose = this.#application.options.headerButtonNoClose,\n headerButtonNoLabel = this.#application.options.headerButtonNoLabel } = {})\n {\n let buttons = this.#application._getHeaderButtons();\n\n // Remove close button if this.options.headerButtonNoClose is true;\n if (typeof headerButtonNoClose === 'boolean' && headerButtonNoClose)\n {\n buttons = buttons.filter((button) => button.class !== 'close');\n }\n\n // Remove labels if this.options.headerButtonNoLabel is true;\n if (typeof headerButtonNoLabel === 'boolean' && headerButtonNoLabel)\n {\n for (const button of buttons) { button.label = void 0; }\n }\n\n this.#storeUIStateUpdate((options) =>\n {\n options.headerButtons = buttons;\n return options;\n });\n }\n}\n","// import { Position } from '@typhonjs-fvtt/runtime/svelte/store';\nimport { Position } from './position/Position.js';\n\nimport {\n A11yHelper,\n deepMerge,\n hasGetter,\n isApplicationShell,\n isHMRProxy,\n isObject,\n outroAndDestroy } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport {\n ApplicationState,\n GetSvelteData,\n loadSvelteConfig,\n SvelteReactive } from './internal/index.js';\n\n/**\n * Provides a Svelte aware extension to Application to control the app lifecycle appropriately. You can declaratively\n * load one or more components from `defaultOptions`.\n */\nexport class SvelteApplication extends Application\n{\n /**\n * Stores the first mounted component which follows the application shell contract.\n *\n * @type {MountedAppShell[]|null[]} Application shell.\n */\n #applicationShellHolder = [null];\n\n /**\n * Stores and manages application state for saving / restoring / serializing.\n *\n * @type {ApplicationState}\n */\n #applicationState;\n\n /**\n * Stores the target element which may not necessarily be the main element.\n *\n * @type {HTMLElement}\n */\n #elementTarget = null;\n\n /**\n * Stores the content element which is set for application shells.\n *\n * @type {HTMLElement}\n */\n #elementContent = null;\n\n /**\n * Stores initial z-index from `_renderOuter` to set to target element / Svelte component.\n *\n * @type {number}\n */\n #initialZIndex = 95;\n\n /**\n * Stores on mount state which is checked in _render to trigger onSvelteMount callback.\n *\n * @type {boolean}\n */\n #onMount = false;\n\n /**\n * The position store.\n *\n * @type {Position}\n */\n #position;\n\n /**\n * Contains the Svelte stores and reactive accessors.\n *\n * @type {SvelteReactive}\n */\n #reactive;\n\n /**\n * Stores SvelteData entries with instantiated Svelte components.\n *\n * @type {SvelteData[]}\n */\n #svelteData = [];\n\n /**\n * Provides a helper class that combines multiple methods for interacting with the mounted components tracked in\n * {@link SvelteData}.\n *\n * @type {GetSvelteData}\n */\n #getSvelteData = new GetSvelteData(this.#applicationShellHolder, this.#svelteData);\n\n /**\n * Contains methods to interact with the Svelte stores.\n *\n * @type {SvelteStores}\n */\n #stores;\n\n /**\n * @param {SvelteApplicationOptions} options - The options for the application.\n *\n * @inheritDoc\n */\n constructor(options = {})\n {\n super(options);\n\n this.#applicationState = new ApplicationState(this);\n\n // Initialize Position with the position object set by Application.\n this.#position = new Position(this, {\n ...this.position,\n ...this.options,\n initial: this.options.positionInitial,\n ortho: this.options.positionOrtho,\n validator: this.options.positionValidator\n });\n\n // Remove old position field.\n delete this.position;\n\n /**\n * Define accessors to retrieve Position by `this.position`.\n *\n * @member {Position} position - Adds accessors to SvelteApplication to get / set the position data.\n *\n * @memberof SvelteApplication#\n */\n Object.defineProperty(this, 'position', {\n get: () => this.#position,\n set: (position) => { if (isObject(position)) { this.#position.set(position); } }\n });\n\n this.#reactive = new SvelteReactive(this);\n\n this.#stores = this.#reactive.initialize();\n }\n\n /**\n * Specifies the default options that SvelteApplication supports.\n *\n * @returns {SvelteApplicationOptions} options - Application options.\n * @see https://foundryvtt.com/api/interfaces/client.ApplicationOptions.html\n */\n static get defaultOptions()\n {\n return deepMerge(super.defaultOptions, {\n defaultCloseAnimation: true, // If false the default slide close animation is not run.\n draggable: true, // If true then application shells are draggable.\n focusAuto: true, // When true auto-management of app focus is enabled.\n focusKeep: false, // When `focusAuto` and `focusKeep` is true; keeps internal focus.\n focusSource: void 0, // Stores any A11yFocusSource data that is applied when app is closed.\n focusTrap: true, // When true focus trapping / wrapping is enabled keeping focus inside app.\n headerButtonNoClose: false, // If true then the close header button is removed.\n headerButtonNoLabel: false, // If true then header button labels are removed for application shells.\n headerIcon: void 0, // Sets a header icon given an image URL.\n headerNoTitleMinimized: false, // If true then header title is hidden when application is minimized.\n minHeight: MIN_WINDOW_HEIGHT, // Assigned to position. Number specifying minimum window height.\n minWidth: MIN_WINDOW_WIDTH, // Assigned to position. Number specifying minimum window width.\n positionable: true, // If false then `position.set` does not take effect.\n positionInitial: Position.Initial.browserCentered, // A helper for initial position placement.\n positionOrtho: true, // When true Position is optimized for orthographic use.\n positionValidator: Position.Validators.transformWindow, // A function providing the default validator.\n sessionStorage: void 0, // An instance of SessionStorage to share across SvelteApplications.\n svelte: void 0, // A Svelte configuration object.\n transformOrigin: 'top left' // By default, 'top / left' respects rotation when minimizing.\n });\n }\n\n /**\n * Returns the content element if an application shell is mounted.\n *\n * @returns {HTMLElement} Content element.\n */\n get elementContent() { return this.#elementContent; }\n\n /**\n * Returns the target element or main element if no target defined.\n *\n * @returns {HTMLElement} Target element.\n */\n get elementTarget() { return this.#elementTarget; }\n\n /**\n * Returns the reactive accessors & Svelte stores for SvelteApplication.\n *\n * @returns {SvelteReactive} The reactive accessors & Svelte stores.\n */\n get reactive() { return this.#reactive; }\n\n /**\n * Returns the application state manager.\n *\n * @returns {ApplicationState} The application state manager.\n */\n get state() { return this.#applicationState; }\n\n /**\n * Returns the Svelte helper class w/ various methods to access mounted Svelte components.\n *\n * @returns {GetSvelteData} GetSvelteData\n */\n get svelte() { return this.#getSvelteData; }\n\n /**\n * In this case of when a template is defined in app options `html` references the inner HTML / template. However,\n * to activate classic v1 tabs for a Svelte component the element target is passed as an array simulating JQuery as\n * the element is retrieved immediately and the core listeners use standard DOM queries.\n *\n * @inheritDoc\n * @protected\n * @ignore\n */\n _activateCoreListeners(html)\n {\n super._activateCoreListeners(typeof this.options.template === 'string' ? html : [this.#elementTarget]);\n }\n\n /**\n * Provide an override to set this application as the active window regardless of z-index. Changes behaviour from\n * Foundry core. This is important / used for instance in dialog key handling for left / right button selection.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.force=false] - Force bring to top; will increment z-index by popOut order.\n *\n */\n bringToTop({ force = false } = {})\n {\n if (force || this.popOut) { super.bringToTop(); }\n\n // If the activeElement is not `document.body` and not contained in this app via elementTarget then blur the\n // current active element and make `document.body`focused. This allows <esc> key to close all open apps / windows.\n if (document.activeElement !== document.body && !this.elementTarget.contains(document.activeElement))\n {\n // Blur current active element.\n if (document.activeElement instanceof HTMLElement) { document.activeElement.blur(); }\n\n // Make document body focused.\n document.body.focus();\n }\n\n globalThis.ui.activeWindow = this;\n }\n\n /**\n * Note: This method is fully overridden and duplicated as Svelte components need to be destroyed manually and the\n * best visual result is to destroy them after the default slide up animation occurs, but before the element\n * is removed from the DOM.\n *\n * If you destroy the Svelte components before the slide up animation the Svelte elements are removed immediately\n * from the DOM. The purpose of overriding ensures the slide up animation is always completed before\n * the Svelte components are destroyed and then the element is removed from the DOM.\n *\n * Close the application and un-register references to it within UI mappings.\n * This function returns a Promise which resolves once the window closing animation concludes\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {boolean} [options.force] - Force close regardless of render state.\n *\n * @returns {Promise<void>} A Promise which resolves once the application is closed.\n * @ignore\n */\n async close(options = {})\n {\n const states = Application.RENDER_STATES;\n if (!options.force && ![states.RENDERED, states.ERROR].includes(this._state)) { return; }\n\n // Unsubscribe from any local stores.\n this.#stores.unsubscribe();\n\n /**\n * @ignore\n */\n this._state = states.CLOSING;\n\n /**\n * Get the element.\n *\n * @type {HTMLElement}\n */\n const el = this.#elementTarget;\n if (!el) { return this._state = states.CLOSED; }\n\n // Make any window content overflow hidden to avoid any scrollbars appearing in default or Svelte outro\n // transitions.\n const content = el.querySelector('.window-content');\n if (content)\n {\n content.style.overflow = 'hidden';\n\n // Set all children of content to overflow hidden as if there is going to be additional scrolling elements\n // they are likely one level deep.\n for (let cntr = content.children.length; --cntr >= 0;)\n {\n content.children[cntr].style.overflow = 'hidden';\n }\n }\n\n // Dispatch Hooks for closing the base and subclass applications\n for (const cls of this.constructor._getInheritanceChain())\n {\n /**\n * A hook event that fires whenever this Application is closed.\n *\n * @param {Application} app The Application instance being closed\n *\n * @param {jQuery[]} html The application HTML when it is closed\n *\n * @function closeApplication\n *\n * @memberof hookEvents\n */\n Hooks.call(`close${cls.name}`, this, el);\n }\n\n // If options `defaultCloseAnimation` is false then do not execute the standard slide up animation.\n // This allows Svelte components to provide any out transition. Application shells will automatically set\n // `defaultCloseAnimation` based on any out transition set or unset.\n const animate = typeof this.options.defaultCloseAnimation === 'boolean' ? this.options.defaultCloseAnimation :\n true;\n\n if (animate)\n {\n // Set min height for full slide.\n el.style.minHeight = '0';\n\n const { paddingBottom, paddingTop } = globalThis.getComputedStyle(el);\n\n // Slide-up application.\n await el.animate([\n { maxHeight: `${el.clientHeight}px`, paddingTop, paddingBottom },\n { maxHeight: 0, paddingTop: 0, paddingBottom: 0 }\n ], { duration: 250, easing: 'ease-in', fill: 'forwards' }).finished;\n }\n\n // Stores the Promises returned from running outro transitions and destroying each Svelte component.\n const svelteDestroyPromises = [];\n\n // Manually invoke the destroy callbacks for all Svelte components.\n for (const entry of this.#svelteData)\n {\n // Use `outroAndDestroy` to run outro transitions before destroying.\n svelteDestroyPromises.push(outroAndDestroy(entry.component));\n\n // If any proxy eventbus has been added then remove all event registrations from the component.\n const eventbus = entry.config.eventbus;\n if (isObject(eventbus) && typeof eventbus.off === 'function')\n {\n eventbus.off();\n entry.config.eventbus = void 0;\n }\n }\n\n // Await all Svelte components to destroy.\n await Promise.all(svelteDestroyPromises);\n\n // Reset SvelteData like this to maintain reference to GetSvelteData / `this.svelte`.\n this.#svelteData.length = 0;\n\n // Remove element from the DOM. Most SvelteComponents have already removed it.\n el.remove();\n\n // Silently restore any width / height state before minimized as applicable.\n this.position.state.restore({\n name: '#beforeMinimized',\n properties: ['width', 'height'],\n silent: true,\n remove: true\n });\n\n // Clean up data\n this.#applicationShellHolder[0] = null;\n /**\n * @ignore\n */\n this._element = null;\n this.#elementContent = null;\n this.#elementTarget = null;\n delete globalThis.ui.windows[this.appId];\n /**\n * @ignore\n */\n this._minimized = false;\n /**\n * @ignore\n */\n this._scrollPositions = null;\n this._state = states.CLOSED;\n\n this.#onMount = false;\n\n // Update the minimized UI store options.\n this.#stores.uiOptionsUpdate((storeOptions) => deepMerge(storeOptions, { minimized: this._minimized }));\n\n // Apply any stored focus options and then remove them from options.\n A11yHelper.applyFocusSource(this.options.focusSource);\n\n delete this.options.focusSource;\n }\n\n /**\n * Inject the Svelte components defined in `this.options.svelte`. The Svelte component can attach to the existing\n * pop-out of Application or provide no template and render into a document fragment which is then attached to the\n * DOM.\n *\n * @param {JQuery} html -\n *\n * @inheritDoc\n * @ignore\n */\n _injectHTML(html)\n {\n if (this.popOut && html.length === 0 && Array.isArray(this.options.svelte))\n {\n throw new Error(\n 'SvelteApplication - _injectHTML - A popout app with no template can only support one Svelte component.');\n }\n\n // Make sure the store is updated with the latest header buttons. Also allows filtering buttons before display.\n this.reactive.updateHeaderButtons();\n\n // Create a function to generate a callback for Svelte components to invoke to update the tracked elements for\n // application shells in the rare cases that the main element root changes. The update is only trigged on\n // successive changes of `elementRoot`. Returns a boolean to indicate the element roots are updated.\n const elementRootUpdate = () =>\n {\n let cntr = 0;\n\n return (elementRoot) =>\n {\n if (elementRoot !== null && elementRoot !== void 0 && cntr++ > 0)\n {\n this.#updateApplicationShell();\n return true;\n }\n\n return false;\n };\n };\n\n if (Array.isArray(this.options.svelte))\n {\n for (const svelteConfig of this.options.svelte)\n {\n const svelteData = loadSvelteConfig({\n app: this,\n template: html[0],\n config: svelteConfig,\n elementRootUpdate\n });\n\n if (isApplicationShell(svelteData.component))\n {\n if (this.svelte.applicationShell !== null)\n {\n throw new Error(\n `SvelteApplication - _injectHTML - An application shell is already mounted; offending config:\n ${JSON.stringify(svelteConfig)}`);\n }\n\n this.#applicationShellHolder[0] = svelteData.component;\n\n // If Vite / HMR / svelte_hmr is enabled then add a hook to receive callbacks when the ProxyComponent\n // refreshes. Update the element root accordingly and force an update to Position.\n // See this issue for info about `on_hmr`:\n // https://github.com/sveltejs/svelte-hmr/issues/57\n if (isHMRProxy(svelteData.component) && Array.isArray(svelteData.component?.$$?.on_hmr))\n {\n svelteData.component.$$.on_hmr.push(() => () => this.#updateApplicationShell());\n }\n }\n\n this.#svelteData.push(svelteData);\n }\n }\n else if (isObject(this.options.svelte))\n {\n const svelteData = loadSvelteConfig({\n app: this,\n template: html[0],\n config: this.options.svelte,\n elementRootUpdate\n });\n\n if (isApplicationShell(svelteData.component))\n {\n // A sanity check as shouldn't hit this case as only one component is being mounted.\n if (this.svelte.applicationShell !== null)\n {\n throw new Error(\n `SvelteApplication - _injectHTML - An application shell is already mounted; offending config:\n ${JSON.stringify(this.options.svelte)}`);\n }\n\n this.#applicationShellHolder[0] = svelteData.component;\n\n // If Vite / HMR / svelte_hmr is enabled then add a hook to receive callbacks when the ProxyComponent\n // refreshes. Update the element root accordingly and force an update to Position.\n // See this issue for info about `on_hmr`:\n // https://github.com/sveltejs/svelte-hmr/issues/57\n if (isHMRProxy(svelteData.component) && Array.isArray(svelteData.component?.$$?.on_hmr))\n {\n svelteData.component.$$.on_hmr.push(() => () => this.#updateApplicationShell());\n }\n }\n\n this.#svelteData.push(svelteData);\n }\n\n // Detect if this is a synthesized DocumentFragment.\n const isDocumentFragment = html.length && html[0] instanceof DocumentFragment;\n\n // If any of the Svelte components mounted directly targets an HTMLElement then do not inject HTML.\n let injectHTML = true;\n for (const svelteData of this.#svelteData)\n {\n if (!svelteData.injectHTML) { injectHTML = false; break; }\n }\n if (injectHTML) { super._injectHTML(html); }\n\n if (this.svelte.applicationShell !== null)\n {\n this._element = $(this.svelte.applicationShell.elementRoot);\n\n // Detect if the application shell exports an `elementContent` accessor.\n this.#elementContent = hasGetter(this.svelte.applicationShell, 'elementContent') ?\n this.svelte.applicationShell.elementContent : null;\n\n // Detect if the application shell exports an `elementTarget` accessor.\n this.#elementTarget = hasGetter(this.svelte.applicationShell, 'elementTarget') ?\n this.svelte.applicationShell.elementTarget : null;\n }\n else if (isDocumentFragment) // Set the element of the app to the first child element in order of Svelte components mounted.\n {\n for (const svelteData of this.#svelteData)\n {\n if (svelteData.element instanceof HTMLElement)\n {\n this._element = $(svelteData.element);\n break;\n }\n }\n }\n\n // Potentially retrieve a specific target element if `selectorTarget` is defined otherwise make the target the\n // main element.\n if (this.#elementTarget === null)\n {\n this.#elementTarget = typeof this.options.selectorTarget === 'string' ?\n this._element[0].querySelector(this.options.selectorTarget) : this._element[0];\n }\n\n if (this.#elementTarget === null || this.#elementTarget === void 0)\n {\n throw new Error(`SvelteApplication - _injectHTML: Target element '${this.options.selectorTarget}' not found.`);\n }\n\n // The initial zIndex may be set in application options or for popOut applications is stored by `_renderOuter`\n // in `this.#initialZIndex`.\n if (typeof this.options.positionable === 'boolean' && this.options.positionable)\n {\n this.#elementTarget.style.zIndex = typeof this.options.zIndex === 'number' ? this.options.zIndex :\n this.#initialZIndex ?? 95;\n }\n\n // Subscribe to local store handling.\n this.#stores.subscribe();\n }\n\n /**\n * Provides a mechanism to update the UI options store for maximized.\n *\n * Note: the sanity check is duplicated from {@link Application.maximize} the store is updated _before_\n * performing the rest of animations. This allows application shells to remove / show any resize handlers\n * correctly. Extra constraint data is stored in a saved position state in {@link SvelteApplication.minimize}\n * to animate the content area.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.animate=true] - When true perform default maximizing animation.\n *\n * @param {number} [opts.duration=0.1] - Controls content area animation duration in seconds.\n */\n async maximize({ animate = true, duration = 0.1 } = {})\n {\n if (!this.popOut || [false, null].includes(this._minimized)) { return; }\n\n this._minimized = null;\n\n const durationMS = duration * 1000; // For WAAPI.\n\n // Get content\n const element = this.elementTarget;\n const header = element.querySelector('.window-header');\n const content = element.querySelector('.window-content');\n\n // Get the complete position before minimized. Used to reset min width & height to initial values later.\n const positionBefore = this.position.state.get({ name: '#beforeMinimized' });\n\n // First animate / restore width / async.\n if (animate)\n {\n await this.position.state.restore({\n name: '#beforeMinimized',\n async: true,\n animateTo: true,\n properties: ['width'],\n duration: 0.1\n });\n }\n\n element.classList.remove('minimized');\n\n // Reset display none on all children of header.\n for (let cntr = header.children.length; --cntr >= 0;) { header.children[cntr].style.display = null; }\n\n content.style.display = null;\n\n let constraints;\n\n if (animate)\n {\n // Next animate / restore height synchronously and remove key. Retrieve constraints data for slide up animation\n // below.\n ({ constraints } = this.position.state.restore({\n name: '#beforeMinimized',\n animateTo: true,\n properties: ['height'],\n remove: true,\n duration\n }));\n }\n else\n {\n ({ constraints } = this.position.state.remove({ name: '#beforeMinimized' }));\n }\n\n // Slide down content with stored constraints.\n await content.animate([\n { maxHeight: 0, paddingTop: 0, paddingBottom: 0, offset: 0 },\n { ...constraints, offset: 1 },\n { maxHeight: '100%', offset: 1 },\n ], { duration: durationMS, fill: 'forwards' }).finished; // WAAPI in ms.\n\n // Restore previous min width & height from saved data, app options, or default Foundry values.\n this.position.set({\n minHeight: positionBefore.minHeight ?? this.options?.minHeight ?? MIN_WINDOW_HEIGHT,\n minWidth: positionBefore.minWidth ?? this.options?.minWidth ?? MIN_WINDOW_WIDTH,\n });\n\n // Remove inline styles that override any styles assigned to the app.\n element.style.minWidth = null;\n element.style.minHeight = null;\n\n this._minimized = false;\n\n // Using a 50ms timeout prevents any instantaneous display of scrollbars with the above maximize animation.\n setTimeout(() =>\n {\n content.style.overflow = null;\n\n // Reset all children of content removing overflow hidden.\n for (let cntr = content.children.length; --cntr >= 0;)\n {\n content.children[cntr].style.overflow = null;\n }\n }, 50);\n\n this.#stores.uiOptionsUpdate((options) => deepMerge(options, { minimized: false }));\n }\n\n /**\n * Provides a mechanism to update the UI options store for minimized.\n *\n * Note: the sanity check is duplicated from {@link Application.minimize} the store is updated _before_\n * performing the rest of animations. This allows application shells to remove / show any resize handlers\n * correctly. Extra constraint data is stored in a saved position state in {@link SvelteApplication.minimize}\n * to animate the content area.\n *\n * @param {object} [opts] - Optional parameters\n *\n * @param {boolean} [opts.animate=true] - When true perform default minimizing animation.\n *\n * @param {number} [opts.duration=0.1] - Controls content area animation duration in seconds.\n */\n async minimize({ animate = true, duration = 0.1 } = {})\n {\n if (!this.rendered || !this.popOut || [true, null].includes(this._minimized)) { return; }\n\n this.#stores.uiOptionsUpdate((options) => deepMerge(options, { minimized: true }));\n\n this._minimized = null;\n\n const durationMS = duration * 1000; // For WAAPI.\n\n const element = this.elementTarget;\n\n // Get content\n const header = element.querySelector('.window-header');\n const content = element.querySelector('.window-content');\n\n // Save current max / min height & width.\n const beforeMinWidth = this.position.minWidth;\n const beforeMinHeight = this.position.minHeight;\n\n // Set minimized min width & height for header bar.\n this.position.set({ minWidth: 100, minHeight: 30 });\n\n // Also set inline styles to override any styles scoped to the app.\n element.style.minWidth = '100px';\n element.style.minHeight = '30px';\n\n if (content)\n {\n content.style.overflow = 'hidden';\n\n // Set all children of content to overflow hidden as if there is going to be additional scrolling elements\n // they are likely one level deep.\n for (let cntr = content.children.length; --cntr >= 0;)\n {\n content.children[cntr].style.overflow = 'hidden';\n }\n }\n\n const { paddingBottom, paddingTop } = globalThis.getComputedStyle(content);\n\n // Extra data that is saved with the current position. Used during `maximize`.\n const constraints = {\n maxHeight: `${content.clientHeight}px`,\n paddingTop,\n paddingBottom\n };\n\n // Slide-up content\n if (animate)\n {\n const animation = content.animate([\n constraints,\n { maxHeight: 0, paddingTop: 0, paddingBottom: 0 }\n ], { duration: durationMS, fill: 'forwards' }); // WAAPI in ms.\n\n // Set display style to none when animation finishes.\n animation.finished.then(() => content.style.display = 'none');\n }\n else\n {\n setTimeout(() => content.style.display = 'none', durationMS);\n }\n\n // Save current position state and add the constraint data to use in `maximize`.\n const saved = this.position.state.save({ name: '#beforeMinimized', constraints });\n\n // Set the initial before min width & height.\n saved.minWidth = beforeMinWidth;\n saved.minHeight = beforeMinHeight;\n\n const headerOffsetHeight = header.offsetHeight;\n\n // minHeight needs to be adjusted to header height.\n this.position.minHeight = headerOffsetHeight;\n\n if (animate)\n {\n // First await animation of height upward.\n await this.position.animate.to({ height: headerOffsetHeight }, { duration }).finished;\n }\n\n // Set all header buttons besides close and the window title to display none.\n for (let cntr = header.children.length; --cntr >= 0;)\n {\n const className = header.children[cntr].className;\n\n if (className.includes('window-title') || className.includes('close')) { continue; }\n\n // v10+ of Foundry core styles automatically hides anything besides the window title and close button, so\n // explicitly set display to block.\n if (className.includes('keep-minimized'))\n {\n header.children[cntr].style.display = 'block';\n continue;\n }\n\n header.children[cntr].style.display = 'none';\n }\n\n if (animate)\n {\n // Await animation of width to the left / minimum width.\n await this.position.animate.to({ width: MIN_WINDOW_WIDTH }, { duration: 0.1 }).finished;\n }\n\n element.classList.add('minimized');\n\n this._minimized = true;\n }\n\n /**\n * Provides a callback after all Svelte components are initialized.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {HTMLElement} [opts.element] - HTMLElement container for main application element.\n *\n * @param {HTMLElement} [opts.elementContent] - HTMLElement container for content area of application shells.\n *\n * @param {HTMLElement} [opts.elementTarget] - HTMLElement container for main application target element.\n */\n onSvelteMount({ element, elementContent, elementTarget } = {}) {} // eslint-disable-line no-unused-vars\n\n /**\n * Provides a callback after the main application shell is remounted. This may occur during HMR / hot module\n * replacement or directly invoked from the `elementRootUpdate` callback passed to the application shell component\n * context.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {HTMLElement} [opts.element] - HTMLElement container for main application element.\n *\n * @param {HTMLElement} [opts.elementContent] - HTMLElement container for content area of application shells.\n *\n * @param {HTMLElement} [opts.elementTarget] - HTMLElement container for main application target element.\n */\n onSvelteRemount({ element, elementContent, elementTarget } = {}) {} // eslint-disable-line no-unused-vars\n\n /**\n * Override replacing HTML as Svelte components control the rendering process. Only potentially change the outer\n * application frame / title for pop-out applications.\n *\n * @inheritDoc\n * @ignore\n */\n _replaceHTML(element, html) // eslint-disable-line no-unused-vars\n {\n if (!element.length) { return; }\n\n this.reactive.updateHeaderButtons();\n }\n\n /**\n * Provides an override verifying that a new Application being rendered for the first time doesn't have a\n * corresponding DOM element already loaded. This is a check that only occurs when `this._state` is\n * `Application.RENDER_STATES.NONE`. It is useful in particular when SvelteApplication has a static ID\n * explicitly set in `this.options.id` and long intro / outro transitions are assigned. If a new application\n * sharing this static ID attempts to open / render for the first time while an existing DOM element sharing\n * this static ID exists then the initial render is cancelled below rather than crashing later in the render\n * cycle {@link Position.set}.\n *\n * @inheritDoc\n * @protected\n * @ignore\n */\n async _render(force = false, options = {})\n {\n // Store any focusSource instance.\n if (isObject(options?.focusSource)) { this.options.focusSource = options.focusSource; }\n\n if (this._state === Application.RENDER_STATES.NONE &&\n document.querySelector(`#${this.id}`) instanceof HTMLElement)\n {\n console.warn(`SvelteApplication - _render: A DOM element already exists for CSS ID '${this.id\n }'. Cancelling initial render for new application with appId '${this.appId}'.`);\n\n return;\n }\n\n await super._render(force, options);\n\n if (!this.#onMount)\n {\n this.onSvelteMount({ element: this._element[0], elementContent: this.#elementContent, elementTarget:\n this.#elementTarget });\n\n this.#onMount = true;\n }\n }\n\n /**\n * Render the inner application content. Only render a template if one is defined otherwise provide an empty\n * JQuery element per the core Foundry API.\n *\n * @param {object} data The data used to render the inner template\n *\n * @returns {Promise.<JQuery>} A promise resolving to the constructed jQuery object\n *\n * @protected\n * @ignore\n */\n async _renderInner(data)\n {\n const html = typeof this.template === 'string' ? await renderTemplate(this.template, data) :\n document.createDocumentFragment();\n\n return $(html);\n }\n\n /**\n * Stores the initial z-index set in `_renderOuter` which is used in `_injectHTML` to set the target element\n * z-index after the Svelte component is mounted.\n *\n * @returns {Promise<JQuery>} Outer frame / unused.\n * @protected\n * @ignore\n */\n async _renderOuter()\n {\n const html = await super._renderOuter();\n this.#initialZIndex = html[0].style.zIndex;\n return html;\n }\n\n /**\n * All calculation and updates of position are implemented in {@link Position.set}. This allows position to be fully\n * reactive and in control of updating inline styles for the application.\n *\n * This method remains for backward compatibility with Foundry. If you have a custom override quite likely you need\n * to update to using the {@link Position.validators} functionality.\n *\n * @param {PositionDataExtended} [position] - Position data.\n *\n * @returns {Position} The updated position object for the application containing the new values\n */\n setPosition(position)\n {\n return this.position.set(position);\n }\n\n /**\n * This method is invoked by the `elementRootUpdate` callback that is added to the external context passed to\n * Svelte components. When invoked it updates the local element roots tracked by SvelteApplication.\n *\n * This method may also be invoked by HMR / hot module replacement via `svelte-hmr`.\n */\n #updateApplicationShell()\n {\n const applicationShell = this.svelte.applicationShell;\n\n if (applicationShell !== null)\n {\n this._element = $(applicationShell.elementRoot);\n\n // Detect if the application shell exports an `elementContent` accessor.\n this.#elementContent = hasGetter(applicationShell, 'elementContent') ?\n applicationShell.elementContent : null;\n\n // Detect if the application shell exports an `elementTarget` accessor.\n this.#elementTarget = hasGetter(applicationShell, 'elementTarget') ?\n applicationShell.elementTarget : null;\n\n if (this.#elementTarget === null)\n {\n this.#elementTarget = typeof this.options.selectorTarget === 'string' ?\n this._element[0].querySelector(this.options.selectorTarget) : this._element[0];\n }\n\n // The initial zIndex may be set in application options or for popOut applications is stored by `_renderOuter`\n // in `this.#initialZIndex`.\n if (typeof this.options.positionable === 'boolean' && this.options.positionable)\n {\n this.#elementTarget.style.zIndex = typeof this.options.zIndex === 'number' ? this.options.zIndex :\n this.#initialZIndex ?? 95;\n\n super.bringToTop();\n\n // Ensure that new root element has inline position styles set.\n this.position.set(this.position.get());\n }\n\n super._activateCoreListeners([this.#elementTarget]);\n\n this.onSvelteRemount({ element: this._element[0], elementContent: this.#elementContent, elementTarget:\n this.#elementTarget });\n }\n }\n}\n\n/**\n * @typedef {ApplicationOptions} SvelteApplicationOptions\n *\n * @property {boolean} [defaultCloseAnimation=true] - If false the default slide close animation is not run.\n *\n * @property {boolean} [draggable=true] - If true then application shells are draggable.\n *\n * @property {boolean} [focusAuto=true] - When true auto-management of app focus is enabled.\n *\n * @property {boolean} [focusKeep=false] - When `focusAuto` and `focusKeep` is true; keeps internal focus.\n *\n * @property {object} [focusSource] - Defines A11yHelper focus source to apply when application closes.\n *\n * @property {boolean} [headerButtonNoClose=false] - If true then the close header button is removed.\n *\n * @property {boolean} [headerButtonNoLabel=false] - If true then header button labels are removed.\n *\n * @property {boolean} [headerNoTitleMinimized=false] - If true then header title is hidden when minimized.\n *\n * @property {number} [minHeight=MIN_WINDOW_HEIGHT] - Assigned to position. Number specifying minimum window height.\n *\n * @property {number} [minWidth=MIN_WINDOW_WIDTH] - Assigned to position. Number specifying minimum window width.\n *\n * @property {boolean} [positionable=true] - If false then `position.set` does not take effect.\n *\n * @property {PositionInitialHelper} [positionInitial] - A helper for initial position placement.\n *\n * @property {boolean} [positionOrtho=true] - When true Position is optimized for orthographic use.\n *\n * @property {PositionValidatorOptions} [positionValidator] - A validator function or data or list of validators.\n *\n * @property {object} [sessionStorage] - An instance of TJSSessionStorage to share across SvelteApplications.\n *\n * @property {object} [svelte] - A Svelte configuration object defining the main component.\n *\n * @property {string} [transformOrigin='top left'] - By default, 'top / left' respects rotation when minimizing.\n */\n\n/**\n * @typedef {object} SvelteData\n *\n * @property {object} config -\n *\n * @property {import('svelte').SvelteComponent} component -\n *\n * @property {HTMLElement} element -\n *\n * @property {boolean} injectHTML -\n */\n\n/**\n * @typedef {object} SvelteStores\n *\n * @property {import('svelte/store').Writable.update} appOptionsUpdate - Update function for app options store.\n *\n * @property {Function} subscribe - Subscribes to local stores.\n *\n * @property {import('svelte/store').Writable.update} uiOptionsUpdate - Update function for UI options store.\n *\n * @property {Function} unsubscribe - Unsubscribes from local stores.\n */\n","import { StyleManager } from '@typhonjs-fvtt/runtime/svelte/util';\n\nconst s_STYLE_KEY = '#__trl-root-styles';\n\nconst cssVariables = new StyleManager({ docKey: s_STYLE_KEY, version: 1 });\n\nexport { cssVariables };\n","import { isUpdatableStore, isWritableStore } from '@typhonjs-fvtt/runtime/svelte/store';\nimport { styleParsePixels, isObject, debounce, hasSetter, isIterable } from '@typhonjs-fvtt/runtime/svelte/util';\nimport { cubicOut } from 'svelte/easing';\n\n/**\n * Provides an action to always blur the element when any pointer up event occurs on the element.\n *\n * @param {HTMLElement} node - The node to handle always blur on pointer up.\n *\n * @returns {{destroy: Function}} Lifecycle functions.\n */\nfunction alwaysBlur(node)\n{\n /**\n * Blurs node if active element.\n */\n function blurNode()\n {\n setTimeout(() => { if (document.activeElement === node) { node.blur(); } }, 0);\n }\n\n node.addEventListener('pointerup', blurNode);\n\n return {\n destroy: () => node.removeEventListener('pointerup', blurNode)\n };\n}\n\n/**\n * Provides an action to monitor the given HTMLElement node with `ResizeObserver` posting width / height changes\n * to the target in various ways depending on the shape of the target. The target can be one of the following and the\n * precedence order is listed from top to bottom:\n *\n * - has a `resizeObserved` function as attribute; offset then content width / height are passed as parameters.\n * - has a `setContentBounds` function as attribute; content width / height are passed as parameters.\n * - has a `setDimension` function as attribute; offset width / height are passed as parameters.\n * - target is an object; offset and content width / height attributes are directly set on target.\n * - target is a function; the function is invoked with offset then content width / height parameters.\n * - has a writable store `resizeObserved` as an attribute; updated with offset & content width / height.\n * - has an object 'stores' that has a writable store `resizeObserved` as an attribute; updated with offset &\n * content width / height.\n *\n * Note: Svelte currently uses an archaic IFrame based workaround to monitor offset / client width & height changes.\n * A more up to date way to do this is with ResizeObserver. To track when Svelte receives ResizeObserver support\n * monitor this issue: {@link https://github.com/sveltejs/svelte/issues/4233}\n *\n * Can-I-Use: {@link https://caniuse.com/resizeobserver}\n *\n * @param {HTMLElement} node - The node associated with the action.\n *\n * @param {ResizeObserverTarget} target - An object or function to update with observed width & height changes.\n *\n * @returns {{update: Function, destroy: Function}} The action lifecycle methods.\n * @see {@link https://github.com/sveltejs/svelte/issues/4233}\n */\nfunction resizeObserver(node, target)\n{\n ResizeObserverManager.add(node, target);\n\n return {\n update: (newTarget) =>\n {\n ResizeObserverManager.remove(node, target);\n target = newTarget;\n ResizeObserverManager.add(node, target);\n },\n\n destroy: () =>\n {\n ResizeObserverManager.remove(node, target);\n }\n };\n}\n\n/**\n * Provides a function that when invoked with an element updates the cached styles for each subscriber of the element.\n *\n * The style attributes cached to calculate offset height / width include border & padding dimensions. You only need\n * to update the cache if you change border or padding attributes of the element.\n *\n * @param {HTMLElement} el - An HTML element.\n */\nresizeObserver.updateCache = function(el)\n{\n if (!(el instanceof HTMLElement)) { throw new TypeError(`resizeObserverUpdate error: 'el' is not an HTMLElement.`); }\n\n const subscribers = s_MAP.get(el);\n\n if (Array.isArray(subscribers))\n {\n const computed = globalThis.getComputedStyle(el);\n\n // Cache styles first from any inline styles then computed styles defaulting to 0 otherwise.\n // Used to create the offset width & height values from the context box ResizeObserver provides.\n const borderBottom = styleParsePixels(el.style.borderBottom) ?? styleParsePixels(computed.borderBottom) ?? 0;\n const borderLeft = styleParsePixels(el.style.borderLeft) ?? styleParsePixels(computed.borderLeft) ?? 0;\n const borderRight = styleParsePixels(el.style.borderRight) ?? styleParsePixels(computed.borderRight) ?? 0;\n const borderTop = styleParsePixels(el.style.borderTop) ?? styleParsePixels(computed.borderTop) ?? 0;\n const paddingBottom = styleParsePixels(el.style.paddingBottom) ?? styleParsePixels(computed.paddingBottom) ?? 0;\n const paddingLeft = styleParsePixels(el.style.paddingLeft) ?? styleParsePixels(computed.paddingLeft) ?? 0;\n const paddingRight = styleParsePixels(el.style.paddingRight) ?? styleParsePixels(computed.paddingRight) ?? 0;\n const paddingTop = styleParsePixels(el.style.paddingTop) ?? styleParsePixels(computed.paddingTop) ?? 0;\n\n const additionalWidth = borderLeft + borderRight + paddingLeft + paddingRight;\n const additionalHeight = borderTop + borderBottom + paddingTop + paddingBottom;\n\n for (const subscriber of subscribers)\n {\n subscriber.styles.additionalWidth = additionalWidth;\n subscriber.styles.additionalHeight = additionalHeight;\n s_UPDATE_SUBSCRIBER(subscriber, subscriber.contentWidth, subscriber.contentHeight);\n }\n }\n};\n\n// Below is the static ResizeObserverManager ------------------------------------------------------------------------\n\nconst s_MAP = new Map();\n\n/**\n * Provides a static / single instance of ResizeObserver that can notify listeners in different ways.\n *\n * The action, {@link resizeObserver}, utilizes ResizeObserverManager for automatic registration and removal\n * via Svelte.\n */\nclass ResizeObserverManager\n{\n /**\n * Add an HTMLElement and ResizeObserverTarget instance for monitoring. Create cached style attributes for the\n * given element include border & padding dimensions for offset width / height calculations.\n *\n * @param {HTMLElement} el - The element to observe.\n *\n * @param {ResizeObserverTarget} target - A target that contains one of several mechanisms for updating resize data.\n */\n static add(el, target)\n {\n const updateType = s_GET_UPDATE_TYPE(target);\n\n if (updateType === 0)\n {\n throw new Error(`'target' does not match supported ResizeObserverManager update mechanisms.`);\n }\n\n const computed = globalThis.getComputedStyle(el);\n\n // Cache styles first from any inline styles then computed styles defaulting to 0 otherwise.\n // Used to create the offset width & height values from the context box ResizeObserver provides.\n const borderBottom = styleParsePixels(el.style.borderBottom) ?? styleParsePixels(computed.borderBottom) ?? 0;\n const borderLeft = styleParsePixels(el.style.borderLeft) ?? styleParsePixels(computed.borderLeft) ?? 0;\n const borderRight = styleParsePixels(el.style.borderRight) ?? styleParsePixels(computed.borderRight) ?? 0;\n const borderTop = styleParsePixels(el.style.borderTop) ?? styleParsePixels(computed.borderTop) ?? 0;\n const paddingBottom = styleParsePixels(el.style.paddingBottom) ?? styleParsePixels(computed.paddingBottom) ?? 0;\n const paddingLeft = styleParsePixels(el.style.paddingLeft) ?? styleParsePixels(computed.paddingLeft) ?? 0;\n const paddingRight = styleParsePixels(el.style.paddingRight) ?? styleParsePixels(computed.paddingRight) ?? 0;\n const paddingTop = styleParsePixels(el.style.paddingTop) ?? styleParsePixels(computed.paddingTop) ?? 0;\n\n const data = {\n updateType,\n target,\n\n // Stores most recent contentRect.width and contentRect.height values from ResizeObserver.\n contentWidth: 0,\n contentHeight: 0,\n\n // Convenience data for total border & padding for offset width & height calculations.\n styles: {\n additionalWidth: borderLeft + borderRight + paddingLeft + paddingRight,\n additionalHeight: borderTop + borderBottom + paddingTop + paddingBottom\n }\n };\n\n if (s_MAP.has(el))\n {\n const subscribers = s_MAP.get(el);\n subscribers.push(data);\n }\n else\n {\n s_MAP.set(el, [data]);\n }\n\n s_RESIZE_OBSERVER.observe(el);\n }\n\n /**\n * Removes all targets from monitoring when just an element is provided otherwise removes a specific target\n * from the monitoring map. If no more targets remain then the element is removed from monitoring.\n *\n * @param {HTMLElement} el - Element to remove from monitoring.\n *\n * @param {ResizeObserverTarget} [target] - A specific target to remove from monitoring.\n */\n static remove(el, target = void 0)\n {\n const subscribers = s_MAP.get(el);\n if (Array.isArray(subscribers))\n {\n const index = subscribers.findIndex((entry) => entry.target === target);\n if (index >= 0)\n {\n // Update target subscriber with undefined values.\n s_UPDATE_SUBSCRIBER(subscribers[index], void 0, void 0);\n\n subscribers.splice(index, 1);\n }\n\n // Remove element monitoring if last target removed.\n if (subscribers.length === 0)\n {\n s_MAP.delete(el);\n s_RESIZE_OBSERVER.unobserve(el);\n }\n }\n }\n}\n\n/**\n * Defines the various shape / update type of the given target.\n *\n * @type {Record<string, number>}\n */\nconst s_UPDATE_TYPES = {\n none: 0,\n attribute: 1,\n function: 2,\n resizeObserved: 3,\n setContentBounds: 4,\n setDimension: 5,\n storeObject: 6,\n storesObject: 7\n};\n\nconst s_RESIZE_OBSERVER = new ResizeObserver((entries) =>\n{\n for (const entry of entries)\n {\n const subscribers = s_MAP.get(entry?.target);\n\n if (Array.isArray(subscribers))\n {\n const contentWidth = entry.contentRect.width;\n const contentHeight = entry.contentRect.height;\n\n for (const subscriber of subscribers)\n {\n s_UPDATE_SUBSCRIBER(subscriber, contentWidth, contentHeight);\n }\n }\n }\n});\n\n/**\n * Determines the shape of the target instance regarding valid update mechanisms to set width & height changes.\n *\n * @param {*} target - The target instance.\n *\n * @returns {number} Update type value.\n */\nfunction s_GET_UPDATE_TYPE(target)\n{\n if (target?.resizeObserved instanceof Function) { return s_UPDATE_TYPES.resizeObserved; }\n if (target?.setDimension instanceof Function) { return s_UPDATE_TYPES.setDimension; }\n if (target?.setContentBounds instanceof Function) { return s_UPDATE_TYPES.setContentBounds; }\n\n const targetType = typeof target;\n\n // Does the target have resizeObserved writable store?\n if (targetType !== null && (targetType === 'object' || targetType === 'function'))\n {\n if (isUpdatableStore(target.resizeObserved))\n {\n return s_UPDATE_TYPES.storeObject;\n }\n\n // Now check for a child stores object which is a common TRL pattern for exposing stores.\n const stores = target?.stores;\n if (isObject(stores) || typeof stores === 'function')\n {\n if (isUpdatableStore(stores.resizeObserved))\n {\n return s_UPDATE_TYPES.storesObject;\n }\n }\n }\n\n if (targetType !== null && targetType === 'object') { return s_UPDATE_TYPES.attribute; }\n\n if (targetType === 'function') { return s_UPDATE_TYPES.function; }\n\n return s_UPDATE_TYPES.none;\n}\n\n/**\n * Updates a subscriber target with given content width & height values. Offset width & height is calculated from\n * the content values + cached styles.\n *\n * @param {object} subscriber - Internal data about subscriber.\n *\n * @param {number|undefined} contentWidth - ResizeObserver contentRect.width value or undefined.\n *\n * @param {number|undefined} contentHeight - ResizeObserver contentRect.height value or undefined.\n */\nfunction s_UPDATE_SUBSCRIBER(subscriber, contentWidth, contentHeight)\n{\n const styles = subscriber.styles;\n\n subscriber.contentWidth = contentWidth;\n subscriber.contentHeight = contentHeight;\n\n const offsetWidth = Number.isFinite(contentWidth) ? contentWidth + styles.additionalWidth : void 0;\n const offsetHeight = Number.isFinite(contentHeight) ? contentHeight + styles.additionalHeight : void 0;\n\n const target = subscriber.target;\n\n switch (subscriber.updateType)\n {\n case s_UPDATE_TYPES.attribute:\n target.contentWidth = contentWidth;\n target.contentHeight = contentHeight;\n target.offsetWidth = offsetWidth;\n target.offsetHeight = offsetHeight;\n break;\n\n case s_UPDATE_TYPES.function:\n target?.(offsetWidth, offsetHeight, contentWidth, contentHeight);\n break;\n\n case s_UPDATE_TYPES.resizeObserved:\n target.resizeObserved?.(offsetWidth, offsetHeight, contentWidth, contentHeight);\n break;\n\n case s_UPDATE_TYPES.setContentBounds:\n target.setContentBounds?.(contentWidth, contentHeight);\n break;\n\n case s_UPDATE_TYPES.setDimension:\n target.setDimension?.(offsetWidth, offsetHeight);\n break;\n\n case s_UPDATE_TYPES.storeObject:\n target.resizeObserved.update((object) =>\n {\n object.contentHeight = contentHeight;\n object.contentWidth = contentWidth;\n object.offsetHeight = offsetHeight;\n object.offsetWidth = offsetWidth;\n\n return object;\n });\n break;\n\n case s_UPDATE_TYPES.storesObject:\n target.stores.resizeObserved.update((object) =>\n {\n object.contentHeight = contentHeight;\n object.contentWidth = contentWidth;\n object.offsetHeight = offsetHeight;\n object.offsetWidth = offsetWidth;\n\n return object;\n });\n break;\n }\n}\n\n/**\n * @typedef {object | Function} ResizeObserverTarget\n *\n * @property {number} [contentHeight] -\n *\n * @property {number} [contentWidth] -\n *\n * @property {number} [offsetHeight] -\n *\n * @property {number} [offsetWidth] -\n *\n * @property {Writable<object> | Function} [resizedObserver] - Either a function or a writable store.\n *\n * @property {Function} [setContentSize] - A function that is invoked with content width & height changes.\n *\n * @property {Function} [setDimension] - A function that is invoked with offset width & height changes.\n *\n * @property {{resizedObserver: Writable<object>}} [stores] - An object with a writable store.\n */\n\n/**\n * Provides an action to save `scrollTop` of an element with a vertical scrollbar. This action should be used on the\n * scrollable element and must include a writable store that holds the active store for the current `scrollTop` value.\n * You may switch the stores externally and this action will set the `scrollTop` based on the newly set store. This is\n * useful for instance providing a select box that controls the scrollable container.\n *\n * @param {HTMLElement} element - The target scrollable HTML element.\n *\n * @param {import('svelte/store').Writable<number>} store - A writable store that stores the element scrollTop.\n *\n * @returns {{destroy: Function, update: Function}} Lifecycle functions.\n */\nfunction applyScrolltop(element, store)\n{\n if (!isWritableStore(store))\n {\n throw new TypeError(`applyScrolltop error: 'store' must be a writable Svelte store.`);\n }\n\n /**\n * Updates element `scrollTop`.\n *\n * @param {number} value -\n */\n function storeUpdate(value)\n {\n if (!Number.isFinite(value)) { return; }\n\n // For some reason for scrollTop to take on first update from a new element setTimeout is necessary.\n setTimeout(() => element.scrollTop = value, 0);\n }\n\n let unsubscribe = store.subscribe(storeUpdate);\n\n const resizeControl = resizeObserver(element, debounce(() =>\n {\n if (element.isConnected) { store.set(element.scrollTop); }\n }, 500));\n\n /**\n * Save target `scrollTop` to the current set store.\n *\n * @param {Event} event -\n */\n function onScroll(event)\n {\n store.set(event.target.scrollTop);\n }\n\n const debounceFn = debounce((e) => onScroll(e), 500);\n\n element.addEventListener('scroll', debounceFn);\n\n return {\n update: (newStore) =>\n {\n unsubscribe();\n store = newStore;\n\n if (!isWritableStore(store))\n {\n throw new TypeError(`applyScrolltop.update error: 'store' must be a writable Svelte store.`);\n }\n\n unsubscribe = store.subscribe(storeUpdate);\n },\n\n destroy: () =>\n {\n element.removeEventListener('scroll', debounceFn);\n unsubscribe();\n resizeControl.destroy();\n }\n };\n}\n\n/**\n * Provides an action to blur the element when any pointer down event occurs outside the element. This can be useful\n * for input elements including select to blur / unfocus the element when any pointer down occurs outside the element.\n *\n * @param {HTMLElement} node - The node to handle automatic blur on focus loss.\n *\n * @returns {{destroy: Function}} Lifecycle functions.\n */\nfunction autoBlur(node)\n{\n /**\n * Removes listener on blur.\n */\n function onBlur() { document.body.removeEventListener('pointerdown', onPointerDown); }\n\n /**\n * Adds listener on focus.\n */\n function onFocus() { document.body.addEventListener('pointerdown', onPointerDown); }\n\n /**\n * Blur the node if a pointer down event happens outside the node.\n *\n * @param {PointerEvent} event -\n */\n function onPointerDown(event)\n {\n if (event.target === node || node.contains(event.target)) { return; }\n\n if (document.activeElement === node) { node.blur(); }\n }\n\n node.addEventListener('blur', onBlur);\n node.addEventListener('focus', onFocus);\n\n return {\n destroy: () =>\n {\n document.body.removeEventListener('pointerdown', onPointerDown);\n node.removeEventListener('blur', onBlur);\n node.removeEventListener('focus', onFocus);\n }\n };\n}\n\n/**\n * Provides an action to monitor focus state of a given element and set an associated store with current focus state.\n *\n * This action is usable with any writable store.\n *\n * @param {HTMLElement} node - Target element.\n *\n * @param {import('svelte/store').Writable<boolean>} storeFocused - Update store for focus changes.\n *\n * @returns {{update: (function(object): void), destroy: (function(): void)}} Action lifecycle methods.\n */\nfunction isFocused(node, storeFocused)\n{\n let localFocused = false;\n\n /**\n * Updates `storeFocused` w/ current focused state.\n *\n * @param {boolean} current - current focused state.\n */\n function setFocused(current)\n {\n localFocused = current;\n\n if (isWritableStore(storeFocused)) { storeFocused.set(localFocused); }\n }\n\n /**\n * Focus event listener.\n */\n function onFocus()\n {\n setFocused(true);\n }\n\n /**\n * Blur event listener.\n */\n function onBlur()\n {\n setFocused(false);\n }\n\n /**\n * Activate listeners.\n */\n function activateListeners()\n {\n node.addEventListener('focus', onFocus);\n node.addEventListener('blur', onBlur);\n }\n\n /**\n * Remove listeners.\n */\n function removeListeners()\n {\n node.removeEventListener('focus', onFocus);\n node.removeEventListener('blur', onBlur);\n }\n\n activateListeners();\n\n return {\n update: (newStoreFocused) => // eslint-disable-line no-shadow\n {\n storeFocused = newStoreFocused;\n setFocused(localFocused);\n },\n\n destroy: () => removeListeners()\n };\n}\n\n/**\n * Provides an action to forward on key down & up events. This can be any object that has associated `keydown` and\n * `keyup` methods. See {@link KeyStore} for a store implementation.\n *\n * @param {HTMLElement} node - Target element.\n *\n * @param {{keydown: Function, keyup: Function}} keyStore - Object to forward events key down / up events to...\n *\n * @returns {{update: (function(object): void), destroy: (function(): void)}} Action lifecycle methods.\n */\nfunction keyforward(node, keyStore)\n{\n if (typeof keyStore?.keydown !== 'function' || typeof keyStore.keyup !== 'function')\n {\n throw new TypeError(`'keyStore' doesn't have required 'keydown' or 'keyup' methods.`);\n }\n\n /**\n * @param {KeyboardEvent} event -\n */\n function onKeydown(event)\n {\n keyStore.keydown(event);\n }\n\n /**\n * @param {KeyboardEvent} event -\n */\n function onKeyup(event)\n {\n keyStore.keyup(event);\n }\n\n /**\n * Activates key listeners.\n */\n function activateListeners()\n {\n node.addEventListener('keydown', onKeydown);\n node.addEventListener('keyup', onKeyup);\n }\n\n /**\n * Removes key listeners.\n */\n function removeListeners()\n {\n node.removeEventListener('keydown', onKeydown);\n node.removeEventListener('keyup', onKeyup);\n }\n\n activateListeners();\n\n return {\n update: (newKeyStore) => // eslint-disable-line no-shadow\n {\n keyStore = newKeyStore;\n\n if (typeof keyStore?.keydown !== 'function' || typeof keyStore.keyup !== 'function')\n {\n throw new TypeError(`'newKeyStore' doesn't have required 'keydown' or 'keyup' methods.`);\n }\n },\n\n destroy: () => removeListeners()\n };\n}\n\n/**\n * Provides an action to apply style properties provided as an object.\n *\n * @param {HTMLElement} node - Target element\n *\n * @param {object} properties - Key / value object of properties to set.\n *\n * @returns {Function} Update function.\n */\nfunction applyStyles(node, properties)\n{\n /** Sets properties on node. */\n function setProperties()\n {\n if (typeof properties !== 'object') { return; }\n\n for (const prop of Object.keys(properties))\n {\n node.style.setProperty(`${prop}`, properties[prop]);\n }\n }\n\n setProperties();\n\n return {\n update(newProperties)\n {\n properties = newProperties;\n setProperties();\n }\n };\n}\n\n/**\n * Provides an action to apply a Position instance to a HTMLElement and invoke `position.parent`\n *\n * @param {HTMLElement} node - The node associated with the action.\n *\n * @param {Position} position - A position instance.\n *\n * @returns {{update: Function, destroy: Function}} The action lifecycle methods.\n */\nfunction applyPosition(node, position)\n{\n if (hasSetter(position, 'parent')) { position.parent = node; }\n\n return {\n update: (newPosition) =>\n {\n // Sanity case to short circuit update if positions are the same instance.\n if (newPosition === position && newPosition.parent === position.parent) { return; }\n\n if (hasSetter(position)) { position.parent = void 0; }\n\n position = newPosition;\n\n if (hasSetter(position, 'parent')) { position.parent = node; }\n },\n\n destroy: () => { if (hasSetter(position, 'parent')) { position.parent = void 0; } }\n };\n}\n\n/**\n * Provides an action to enable pointer dragging of an HTMLElement and invoke `position.set` on a given {@link Position}\n * instance provided. When the attached boolean store state changes the draggable action is enabled or disabled.\n *\n * @param {HTMLElement} node - The node associated with the action.\n *\n * @param {object} params - Required parameters.\n *\n * @param {Position} params.position - A position instance.\n *\n * @param {boolean} [params.active=true] - A boolean value; attached to a readable store.\n *\n * @param {number} [params.button=0] - MouseEvent button; {@link https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button}.\n *\n * @param {import('svelte/store').Writable<boolean>} [params.storeDragging] - A writable store that tracks \"dragging\"\n * state.\n *\n * @param {boolean} [params.ease=true] - When true easing is enabled.\n *\n * @param {object} [params.easeOptions] - Gsap `to / `quickTo` vars object.\n *\n * @param {Iterable<string>} [params.hasTargetClassList] - When defined any event targets that have a class in this\n * list are allowed.\n *\n * @param {Iterable<string>} [params.ignoreTargetClassList] - When defined any event targets that have a class in this\n * list are ignored.\n *\n * @returns {{update: Function, destroy: Function}} The action lifecycle methods.\n */\nfunction draggable(node, { position, active = true, button = 0, storeDragging = void 0, ease = false,\n easeOptions = { duration: 0.1, ease: cubicOut }, hasTargetClassList, ignoreTargetClassList })\n{\n if (hasTargetClassList !== void 0 && !isIterable(hasTargetClassList))\n {\n throw new TypeError(`'hasTargetClassList' is not iterable.`);\n }\n\n if (ignoreTargetClassList !== void 0 && !isIterable(ignoreTargetClassList))\n {\n throw new TypeError(`'ignoreTargetClassList' is not iterable.`);\n }\n\n /**\n * Duplicate the app / Positionable starting position to track differences.\n *\n * @type {object}\n */\n let initialPosition = null;\n\n /**\n * Stores the initial X / Y on drag down.\n *\n * @type {object}\n */\n let initialDragPoint = {};\n\n /**\n * Stores the current dragging state and gates the move pointer as the dragging store is not\n * set until the first pointer move.\n *\n * @type {boolean}\n */\n let dragging = false;\n\n /**\n * Stores the quickTo callback to use for optimized tweening when easing is enabled.\n *\n * @type {quickToCallback}\n */\n let quickTo = position.animate.quickTo(['top', 'left'], easeOptions);\n\n /**\n * Remember event handlers associated with this action so they may be later unregistered.\n *\n * @type {object}\n */\n const handlers = {\n dragDown: ['pointerdown', (e) => onDragPointerDown(e), false],\n dragMove: ['pointermove', (e) => onDragPointerChange(e), false],\n dragUp: ['pointerup', (e) => onDragPointerUp(e), false]\n };\n\n /**\n * Activates listeners.\n */\n function activateListeners()\n {\n // Drag handlers\n node.addEventListener(...handlers.dragDown);\n node.classList.add('draggable');\n }\n\n /**\n * Removes listeners.\n */\n function removeListeners()\n {\n if (typeof storeDragging?.set === 'function') { storeDragging.set(false); }\n\n // Drag handlers\n node.removeEventListener(...handlers.dragDown);\n node.removeEventListener(...handlers.dragMove);\n node.removeEventListener(...handlers.dragUp);\n node.classList.remove('draggable');\n }\n\n if (active)\n {\n activateListeners();\n }\n\n /**\n * Handle the initial pointer down that activates dragging behavior for the positionable.\n *\n * @param {PointerEvent} event - The pointer down event.\n */\n function onDragPointerDown(event)\n {\n if (event.button !== button || !event.isPrimary) { return; }\n\n // Do not process if the position system is not enabled.\n if (!position.enabled) { return; }\n\n // Potentially ignore this event if `ignoreTargetClassList` is defined and the `event.target` has a matching\n // class.\n if (ignoreTargetClassList !== void 0 && event.target instanceof HTMLElement)\n {\n for (const targetClass of ignoreTargetClassList)\n {\n if (event.target.classList.contains(targetClass)) { return; }\n }\n }\n\n // Potentially ignore this event if `hasTargetClassList` is defined and the `event.target` does not have any\n // matching class from the list.\n if (hasTargetClassList !== void 0 && event.target instanceof HTMLElement)\n {\n let foundTarget = false;\n\n for (const targetClass of hasTargetClassList)\n {\n if (event.target.classList.contains(targetClass))\n {\n foundTarget = true;\n break;\n }\n }\n\n if (!foundTarget) { return; }\n }\n\n event.preventDefault();\n\n dragging = false;\n\n // Record initial position.\n initialPosition = position.get();\n initialDragPoint = { x: event.clientX, y: event.clientY };\n\n // Add move and pointer up handlers.\n node.addEventListener(...handlers.dragMove);\n node.addEventListener(...handlers.dragUp);\n\n node.setPointerCapture(event.pointerId);\n }\n\n /**\n * Move the positionable.\n *\n * @param {PointerEvent} event - The pointer move event.\n */\n function onDragPointerChange(event)\n {\n // See chorded button presses for pointer events:\n // https://www.w3.org/TR/pointerevents3/#chorded-button-interactions\n // TODO: Support different button configurations for PointerEvents.\n if ((event.buttons & 1) === 0)\n {\n onDragPointerUp(event);\n return;\n }\n\n if (event.button !== -1 || !event.isPrimary) { return; }\n\n event.preventDefault();\n\n // Only set store dragging on first move event.\n if (!dragging && typeof storeDragging?.set === 'function')\n {\n dragging = true;\n storeDragging.set(true);\n }\n\n /** @type {number} */\n const newLeft = initialPosition.left + (event.clientX - initialDragPoint.x);\n /** @type {number} */\n const newTop = initialPosition.top + (event.clientY - initialDragPoint.y);\n\n if (ease)\n {\n quickTo(newTop, newLeft);\n }\n else\n {\n s_POSITION_DATA.left = newLeft;\n s_POSITION_DATA.top = newTop;\n\n position.set(s_POSITION_DATA);\n }\n }\n\n /**\n * Finish dragging and set the final position and removing listeners.\n *\n * @param {PointerEvent} event - The pointer up event.\n */\n function onDragPointerUp(event)\n {\n event.preventDefault();\n\n dragging = false;\n if (typeof storeDragging?.set === 'function') { storeDragging.set(false); }\n\n node.removeEventListener(...handlers.dragMove);\n node.removeEventListener(...handlers.dragUp);\n }\n\n return {\n // The default of active being true won't automatically add listeners twice.\n update: (options) =>\n {\n if (typeof options.active === 'boolean')\n {\n active = options.active;\n if (active) { activateListeners(); }\n else { removeListeners(); }\n }\n\n if (typeof options.button === 'number')\n {\n button = options.button;\n }\n\n if (options.position !== void 0 && options.position !== position)\n {\n position = options.position;\n quickTo = position.animate.quickTo(['top', 'left'], easeOptions);\n }\n\n if (typeof options.ease === 'boolean') { ease = options.ease; }\n\n if (isObject(options.easeOptions))\n {\n easeOptions = options.easeOptions;\n quickTo.options(easeOptions);\n }\n\n if (options.hasTargetClassList !== void 0)\n {\n if (!isIterable(options.hasTargetClassList))\n {\n throw new TypeError(`'hasTargetClassList' is not iterable.`);\n }\n else\n {\n hasTargetClassList = options.hasTargetClassList;\n }\n }\n\n if (options.ignoreTargetClassList !== void 0)\n {\n if (!isIterable(options.ignoreTargetClassList))\n {\n throw new TypeError(`'ignoreTargetClassList' is not iterable.`);\n }\n else\n {\n ignoreTargetClassList = options.ignoreTargetClassList;\n }\n }\n },\n\n destroy: () => removeListeners()\n };\n}\n\nclass DraggableOptions\n{\n #ease = false;\n\n #easeOptions = { duration: 0.1, ease: cubicOut };\n\n /**\n * Stores the subscribers.\n *\n * @type {(function(DraggableOptions): void)[]}\n */\n #subscriptions = [];\n\n constructor({ ease, easeOptions } = {})\n {\n // Define the following getters directly on this instance and make them enumerable. This allows them to be\n // picked up w/ `Object.assign`.\n Object.defineProperty(this, 'ease', {\n get: () => { return this.#ease; },\n set: (newEase) =>\n {\n if (typeof newEase !== 'boolean') { throw new TypeError(`'ease' is not a boolean.`); }\n\n this.#ease = newEase;\n this.#updateSubscribers();\n },\n enumerable: true\n });\n\n Object.defineProperty(this, 'easeOptions', {\n get: () => { return this.#easeOptions; },\n set: (newEaseOptions) =>\n {\n if (newEaseOptions === null || typeof newEaseOptions !== 'object')\n {\n throw new TypeError(`'easeOptions' is not an object.`);\n }\n\n if (newEaseOptions.duration !== void 0)\n {\n if (!Number.isFinite(newEaseOptions.duration))\n {\n throw new TypeError(`'easeOptions.duration' is not a finite number.`);\n }\n\n if (newEaseOptions.duration < 0) { throw new Error(`'easeOptions.duration' is less than 0.`); }\n\n this.#easeOptions.duration = newEaseOptions.duration;\n }\n\n if (newEaseOptions.ease !== void 0)\n {\n if (typeof newEaseOptions.ease !== 'function' && typeof newEaseOptions.ease !== 'string')\n {\n throw new TypeError(`'easeOptions.ease' is not a function or string.`);\n }\n\n this.#easeOptions.ease = newEaseOptions.ease;\n }\n\n this.#updateSubscribers();\n },\n enumerable: true\n });\n\n // Set default options.\n if (ease !== void 0) { this.ease = ease; }\n if (easeOptions !== void 0) { this.easeOptions = easeOptions; }\n }\n\n\n /**\n * @returns {number} Get ease duration\n */\n get easeDuration() { return this.#easeOptions.duration; }\n\n /**\n * @returns {string|Function} Get easing function value.\n */\n get easeValue() { return this.#easeOptions.ease; }\n\n\n /**\n * @param {number} duration - Set ease duration.\n */\n set easeDuration(duration)\n {\n if (!Number.isFinite(duration))\n {\n throw new TypeError(`'duration' is not a finite number.`);\n }\n\n if (duration < 0) { throw new Error(`'duration' is less than 0.`); }\n\n this.#easeOptions.duration = duration;\n this.#updateSubscribers();\n }\n\n /**\n * @param {string|Function} value - Get easing function value.\n */\n set easeValue(value)\n {\n if (typeof value !== 'function' && typeof value !== 'string')\n {\n throw new TypeError(`'value' is not a function or string.`);\n }\n\n this.#easeOptions.ease = value;\n this.#updateSubscribers();\n }\n\n /**\n * Resets all options data to default values.\n */\n reset()\n {\n this.#ease = false;\n this.#easeOptions = { duration: 0.1, ease: cubicOut };\n this.#updateSubscribers();\n }\n\n /**\n * Resets easing options to default values.\n */\n resetEase()\n {\n this.#easeOptions = { duration: 0.1, ease: cubicOut };\n this.#updateSubscribers();\n }\n\n /**\n *\n * @param {function(DraggableOptions): void} handler - Callback function that is invoked on update / changes.\n * Receives the DraggableOptions object / instance.\n *\n * @returns {(function(): void)} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n\n handler(this); // call handler with current value\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n\n #updateSubscribers()\n {\n const subscriptions = this.#subscriptions;\n\n // Early out if there are no subscribers.\n if (subscriptions.length > 0)\n {\n for (let cntr = 0; cntr < subscriptions.length; cntr++) { subscriptions[cntr](this); }\n }\n }\n}\n\n/**\n * Define a function to get a DraggableOptions instance.\n *\n * @param {{ ease?: boolean, easeOptions?: object }} options - Draggable options.\n *\n * @returns {DraggableOptions} A new options instance.\n */\ndraggable.options = (options) => new DraggableOptions(options);\n\n/**\n * Used for direct call to `position.set`.\n *\n * @type {{top: number, left: number}}\n */\nconst s_POSITION_DATA = { left: 0, top: 0 };\n\nexport { alwaysBlur, applyPosition, applyScrolltop, applyStyles, autoBlur, draggable, isFocused, keyforward, resizeObserver };\n//# sourceMappingURL=index.js.map\n","import { cubicInOut, linear, cubicOut } from '../easing/index.mjs';\nimport { split_css_unit, is_function, assign } from '../internal/index.mjs';\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\n\nfunction blur(node, { delay = 0, duration = 400, easing = cubicInOut, amount = 5, opacity = 0 } = {}) {\n const style = getComputedStyle(node);\n const target_opacity = +style.opacity;\n const f = style.filter === 'none' ? '' : style.filter;\n const od = target_opacity * (1 - opacity);\n const [value, unit] = split_css_unit(amount);\n return {\n delay,\n duration,\n easing,\n css: (_t, u) => `opacity: ${target_opacity - (od * u)}; filter: ${f} blur(${u * value}${unit});`\n };\n}\nfunction fade(node, { delay = 0, duration = 400, easing = linear } = {}) {\n const o = +getComputedStyle(node).opacity;\n return {\n delay,\n duration,\n easing,\n css: t => `opacity: ${t * o}`\n };\n}\nfunction fly(node, { delay = 0, duration = 400, easing = cubicOut, x = 0, y = 0, opacity = 0 } = {}) {\n const style = getComputedStyle(node);\n const target_opacity = +style.opacity;\n const transform = style.transform === 'none' ? '' : style.transform;\n const od = target_opacity * (1 - opacity);\n const [xValue, xUnit] = split_css_unit(x);\n const [yValue, yUnit] = split_css_unit(y);\n return {\n delay,\n duration,\n easing,\n css: (t, u) => `\n\t\t\ttransform: ${transform} translate(${(1 - t) * xValue}${xUnit}, ${(1 - t) * yValue}${yUnit});\n\t\t\topacity: ${target_opacity - (od * u)}`\n };\n}\nfunction slide(node, { delay = 0, duration = 400, easing = cubicOut, axis = 'y' } = {}) {\n const style = getComputedStyle(node);\n const opacity = +style.opacity;\n const primary_property = axis === 'y' ? 'height' : 'width';\n const primary_property_value = parseFloat(style[primary_property]);\n const secondary_properties = axis === 'y' ? ['top', 'bottom'] : ['left', 'right'];\n const capitalized_secondary_properties = secondary_properties.map((e) => `${e[0].toUpperCase()}${e.slice(1)}`);\n const padding_start_value = parseFloat(style[`padding${capitalized_secondary_properties[0]}`]);\n const padding_end_value = parseFloat(style[`padding${capitalized_secondary_properties[1]}`]);\n const margin_start_value = parseFloat(style[`margin${capitalized_secondary_properties[0]}`]);\n const margin_end_value = parseFloat(style[`margin${capitalized_secondary_properties[1]}`]);\n const border_width_start_value = parseFloat(style[`border${capitalized_secondary_properties[0]}Width`]);\n const border_width_end_value = parseFloat(style[`border${capitalized_secondary_properties[1]}Width`]);\n return {\n delay,\n duration,\n easing,\n css: t => 'overflow: hidden;' +\n `opacity: ${Math.min(t * 20, 1) * opacity};` +\n `${primary_property}: ${t * primary_property_value}px;` +\n `padding-${secondary_properties[0]}: ${t * padding_start_value}px;` +\n `padding-${secondary_properties[1]}: ${t * padding_end_value}px;` +\n `margin-${secondary_properties[0]}: ${t * margin_start_value}px;` +\n `margin-${secondary_properties[1]}: ${t * margin_end_value}px;` +\n `border-${secondary_properties[0]}-width: ${t * border_width_start_value}px;` +\n `border-${secondary_properties[1]}-width: ${t * border_width_end_value}px;`\n };\n}\nfunction scale(node, { delay = 0, duration = 400, easing = cubicOut, start = 0, opacity = 0 } = {}) {\n const style = getComputedStyle(node);\n const target_opacity = +style.opacity;\n const transform = style.transform === 'none' ? '' : style.transform;\n const sd = 1 - start;\n const od = target_opacity * (1 - opacity);\n return {\n delay,\n duration,\n easing,\n css: (_t, u) => `\n\t\t\ttransform: ${transform} scale(${1 - (sd * u)});\n\t\t\topacity: ${target_opacity - (od * u)}\n\t\t`\n };\n}\nfunction draw(node, { delay = 0, speed, duration, easing = cubicInOut } = {}) {\n let len = node.getTotalLength();\n const style = getComputedStyle(node);\n if (style.strokeLinecap !== 'butt') {\n len += parseInt(style.strokeWidth);\n }\n if (duration === undefined) {\n if (speed === undefined) {\n duration = 800;\n }\n else {\n duration = len / speed;\n }\n }\n else if (typeof duration === 'function') {\n duration = duration(len);\n }\n return {\n delay,\n duration,\n easing,\n css: (_, u) => `\n\t\t\tstroke-dasharray: ${len};\n\t\t\tstroke-dashoffset: ${u * len};\n\t\t`\n };\n}\nfunction crossfade(_a) {\n var { fallback } = _a, defaults = __rest(_a, [\"fallback\"]);\n const to_receive = new Map();\n const to_send = new Map();\n function crossfade(from_node, node, params) {\n const { delay = 0, duration = d => Math.sqrt(d) * 30, easing = cubicOut } = assign(assign({}, defaults), params);\n const from = from_node.getBoundingClientRect();\n const to = node.getBoundingClientRect();\n const dx = from.left - to.left;\n const dy = from.top - to.top;\n const dw = from.width / to.width;\n const dh = from.height / to.height;\n const d = Math.sqrt(dx * dx + dy * dy);\n const style = getComputedStyle(node);\n const transform = style.transform === 'none' ? '' : style.transform;\n const opacity = +style.opacity;\n return {\n delay,\n duration: is_function(duration) ? duration(d) : duration,\n easing,\n css: (t, u) => `\n\t\t\t\topacity: ${t * opacity};\n\t\t\t\ttransform-origin: top left;\n\t\t\t\ttransform: ${transform} translate(${u * dx}px,${u * dy}px) scale(${t + (1 - t) * dw}, ${t + (1 - t) * dh});\n\t\t\t`\n };\n }\n function transition(items, counterparts, intro) {\n return (node, params) => {\n items.set(params.key, node);\n return () => {\n if (counterparts.has(params.key)) {\n const other_node = counterparts.get(params.key);\n counterparts.delete(params.key);\n return crossfade(other_node, node, params);\n }\n // if the node is disappearing altogether\n // (i.e. wasn't claimed by the other list)\n // then we need to supply an outro\n items.delete(params.key);\n return fallback && fallback(node, params, intro);\n };\n };\n }\n return [\n transition(to_send, to_receive, false),\n transition(to_receive, to_send, true)\n ];\n}\n\nexport { blur, crossfade, draw, fade, fly, scale, slide };\n","import { linear } from 'svelte/easing';\nimport { lerp } from '@typhonjs-fvtt/runtime/svelte/math';\nimport { fade, slide } from 'svelte/transition';\n\n/**\n * Provides a rotate transition. For options `easing` is applied to to the rotate transition. The default easing is\n * linear.\n *\n * Note: that when reversing the transition that time goes from `1 - 0`, so if specific options are applied for\n * rotating out transition then `end` and `initial` are swapped.\n *\n * @param {HTMLElement} node - The transition node.\n *\n * @param {object} options - Optional parameters.\n *\n * @param {number} [options.delay] - Delay in ms before start of transition.\n *\n * @param {number} [options.duration] - Total transition length in ms.\n *\n * @param {Function} [options.easing=linear] - The easing function to apply to the rotate transition.\n *\n * @param {number} [options.end=0] - End rotation in degrees.\n *\n * @param {number} [options.initial=0] - Initial rotation in degrees.\n *\n * @returns {{duration: number, css: (function(*=): string), delay: number, easing: (x: number) => number}}\n * Transition object.\n */\nfunction rotate(node, options)\n{\n const easingRotate = options.easing ?? linear;\n\n const initialDeg = options.initial ?? 0;\n const endDeg = options.end ?? 0;\n\n return {\n delay: options.delay ?? 0,\n duration: options.duration ?? 500,\n easing: linear,\n css: (t) =>\n {\n const rotateT = easingRotate(t);\n return `transform: rotate(${lerp(initialDeg, endDeg, rotateT)}deg)`;\n }\n };\n}\n\n/**\n * Combines rotate & fade transitions into a single transition. For options `easing` this is applied to both transitions,\n * however if provided `easingRotate` and / or `easingFade` will take precedence. The default easing is linear.\n *\n * Note: that when reversing the transition that time goes from `1 - 0`, so if specific options are applied for\n * rotating out transition then `end` and `initial` are swapped.\n *\n * @param {HTMLElement} node - The transition node.\n *\n * @param {object} options - Optional parameters.\n *\n * @param {number} [options.delay] - Delay in ms before start of transition.\n *\n * @param {number} [options.duration] - Total transition length in ms.\n *\n * @param {Function} [options.easing=linear] - The easing function to apply to both slide & fade transitions.\n *\n * @param {Function} [options.easingFade=linear] - The easing function to apply to the fade transition.\n *\n * @param {Function} [options.easingRotate=linear] - The easing function to apply to the rotate transition.\n *\n * @param {number} [options.end=0] - End rotation in degrees.\n *\n * @param {number} [options.initial=0] - Initial rotation in degrees.\n *\n * @returns {{duration: number, css: (function(*=): string), delay: number, easing: (x: number) => number}}\n * Transition object.\n */\nfunction rotateFade(node, options)\n{\n const easingFade = options.easingFade || options.easing || linear;\n const easingRotate = options.easingRotate || options.easing || linear;\n\n const fadeTransition = fade(node);\n\n const initialDeg = options.initial ?? 0;\n const endDeg = options.end ?? 0;\n\n return {\n delay: options.delay ?? 0,\n duration: options.duration ?? 500,\n easing: linear,\n css: (t) =>\n {\n const fadeT = easingFade(t);\n const rotateT = easingRotate(t);\n\n return `transform: rotate(${lerp(initialDeg, endDeg, rotateT)}deg); ${fadeTransition.css(fadeT, 1 - fadeT)}`;\n }\n };\n}\n\n/**\n * Combines slide & fade transitions into a single transition. For options `easing` this is applied to both transitions,\n * however if provided `easingSlide` and / or `easingFade` will take precedence. The default easing is linear.\n *\n * @param {HTMLElement} node - The transition node.\n *\n * @param {object} options - Optional parameters.\n *\n * @param {number} [options.delay] - Delay in ms before start of transition.\n *\n * @param {number} [options.duration] - Total transition length in ms.\n *\n * @param {Function} [options.easing=linear] - The easing function to apply to both slide & fade transitions.\n *\n * @param {Function} [options.easingFade=linear] - The easing function to apply to the fade transition.\n *\n * @param {Function} [options.easingSlide=linear] - The easing function to apply to the slide transition.\n *\n * @returns {{duration: number, css: (function(*=): string), delay: number, easing: (x: number) => number}}\n * Transition object.\n */\nfunction slideFade(node, options)\n{\n const fadeEasing = options.easingFade || options.easing || linear;\n const slideEasing = options.easingSlide || options.easing || linear;\n\n const fadeTransition = fade(node);\n const slideTransition = slide(node);\n\n return {\n delay: options.delay || 0,\n duration: options.duration || 500,\n easing: linear,\n css: (t) =>\n {\n const fadeT = fadeEasing(t);\n const slideT = slideEasing(t);\n return `${slideTransition.css(slideT, 1 - slideT)}; ${fadeTransition.css(fadeT, 1 - fadeT)}`;\n }\n };\n}\n\n/**\n * Converts a Svelte transition to an animation. Both transitions & animations use the same CSS / styles solution and\n * resulting data so wrap the transition function with the signature of an animation.\n *\n * @param {(node: Element, params?: object) => import('svelte/transition').TransitionConfig} fn -\n * A Svelte transition function.\n *\n * @returns {(node: Element, { from: DOMRect, to: DOMRect }, params?: object) => import('svelte/transition').TransitionConfig} -\n * Transition function converted to an animation.\n */\nfunction toAnimation(fn)\n{\n return (node, animations, params = {}) => fn(node, params);\n}\n\nconst s_DEFAULT_TRANSITION = () => void 0;\nconst s_DEFAULT_TRANSITION_OPTIONS = {};\n\nexport { rotate, rotateFade, s_DEFAULT_TRANSITION, s_DEFAULT_TRANSITION_OPTIONS, slideFade, toAnimation };\n//# sourceMappingURL=index.js.map\n","<script>\n import { applyStyles } from '@typhonjs-fvtt/runtime/svelte/action';\n\n import {\n s_DEFAULT_TRANSITION,\n s_DEFAULT_TRANSITION_OPTIONS } from '@typhonjs-fvtt/runtime/svelte/transition';\n\n import { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n /** @type {string} */\n export let background = '#50505080';\n\n /** @type {boolean} */\n export let captureInput = true;\n\n /** @type {string} */\n export let id = void 0;\n\n /** @type {boolean} */\n export let slotSeparate = void 0;\n\n /** @type {Record<string, string>} */\n export let styles = void 0;\n\n /** @type {number} */\n export let zIndex = Number.MAX_SAFE_INTEGER;\n\n /** @type {HTMLDivElement} */\n let backgroundEl, containerEl, glassPaneEl;\n\n $: slotSeparate = typeof slotSeparate === 'boolean' ? slotSeparate : false;\n\n // ---------------------------------------------------------------------------------------------------------------\n\n // The following block is somewhat complex, but allows transition options to be updated reactively during\n // runtime execution.\n\n // Exports properties to set a transition w/ in / out options.\n export let transition = void 0;\n export let inTransition = s_DEFAULT_TRANSITION;\n export let outTransition = s_DEFAULT_TRANSITION;\n\n // Exports properties to set options for any transitions.\n export let transitionOptions = void 0;\n export let inTransitionOptions = s_DEFAULT_TRANSITION_OPTIONS;\n export let outTransitionOptions = s_DEFAULT_TRANSITION_OPTIONS;\n\n // Tracks last transition state.\n let oldTransition = void 0;\n let oldTransitionOptions = void 0\n\n // Run this reactive block when the last transition state is not equal to the current state.\n $: if (oldTransition !== transition)\n {\n // If transition is defined and not the default transition then set it to both in and out transition otherwise\n // set the default transition to both in & out transitions.\n const newTransition = s_DEFAULT_TRANSITION !== transition && typeof transition === 'function' ? transition :\n s_DEFAULT_TRANSITION;\n\n inTransition = newTransition;\n outTransition = newTransition;\n\n oldTransition = newTransition;\n }\n\n // Run this reactive block when the last transition options state is not equal to the current options state.\n $: if (oldTransitionOptions !== transitionOptions)\n {\n const newOptions = transitionOptions !== s_DEFAULT_TRANSITION_OPTIONS && isObject(transitionOptions) ?\n transitionOptions : s_DEFAULT_TRANSITION_OPTIONS;\n\n inTransitionOptions = newOptions;\n outTransitionOptions = newOptions;\n\n oldTransitionOptions = newOptions;\n }\n\n // Handle cases if inTransition is unset; assign noop default transition function.\n $: if (typeof inTransition !== 'function') { inTransition = s_DEFAULT_TRANSITION; }\n\n // Handle cases if outTransition is unset; assign noop default transition function.\n $: if (typeof outTransition !== 'function') { outTransition = s_DEFAULT_TRANSITION; }\n\n // Handle cases if inTransitionOptions is unset; assign empty default transition options.\n $: if (typeof inTransitionOptions !== 'object') { inTransitionOptions = s_DEFAULT_TRANSITION_OPTIONS; }\n\n // Handle cases if outTransitionOptions is unset; assign empty default transition options.\n $: if (typeof outTransitionOptions !== 'object') { outTransitionOptions = s_DEFAULT_TRANSITION_OPTIONS; }\n\n // ---------------------------------------------------------------------------------------------------------------\n\n /**\n * Swallows / stops propagation for all events where the event target is not contained by the glass pane element.\n *\n * @param {Event} event - The event to swallow.\n */\n function swallow(event)\n {\n const targetEl = event.target;\n\n if (targetEl !== glassPaneEl && targetEl !== backgroundEl && targetEl !== containerEl &&\n glassPaneEl.contains(targetEl))\n {\n return;\n }\n\n if (captureInput)\n {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n</script>\n\n<!-- Capture all input -->\n<svelte:window\n on:contextmenu|capture={swallow}\n on:dblclick|capture={swallow}\n on:keydown|capture={swallow}\n on:keyup|capture={swallow}\n on:mousedown|capture={swallow}\n on:mousemove|capture={swallow}\n on:mouseup|capture={swallow}\n on:pointerdown|capture={swallow}\n on:pointermove|capture={swallow}\n on:pointerup|capture={swallow}\n on:touchend|capture={swallow}\n on:touchmove|capture={swallow}\n on:touchstart|capture={swallow}\n on:wheel|capture={swallow}\n/>\n\n<div id={id}\n bind:this={glassPaneEl}\n class=tjs-glass-pane\n style:z-index={zIndex}>\n\n {#if slotSeparate}\n <div class=tjs-glass-pane-background\n bind:this={backgroundEl}\n style:background={background}\n in:inTransition={inTransitionOptions}\n out:outTransition={outTransitionOptions}\n use:applyStyles={styles} />\n\n <div class=tjs-glass-pane-container bind:this={containerEl}>\n <slot />\n </div>\n {:else}\n <div class=tjs-glass-pane-background\n bind:this={backgroundEl}\n style:background={background}\n in:inTransition={inTransitionOptions}\n out:outTransition={outTransitionOptions}\n use:applyStyles={styles} >\n <slot />\n </div>\n {/if}\n</div>\n\n<style>\n .tjs-glass-pane, .tjs-glass-pane-background , .tjs-glass-pane-container {\n position: absolute;\n overflow: hidden;\n\n height: 100%;\n width: 100%;\n max-height: 100%;\n max-width: 100%;\n }\n</style>\n","import { writable } from 'svelte/store';\n\n/**\n * Provides the internal context to all application shells.\n */\nexport class AppShellContextInternal\n{\n /** @type {InternalAppStores} */\n #stores;\n\n constructor()\n {\n this.#stores = {\n elementContent: writable(void 0),\n elementRoot: writable(void 0)\n };\n\n Object.freeze(this.#stores);\n Object.seal(this);\n }\n\n /**\n * @returns {InternalAppStores} The internal context stores for elementContent / elementRoot\n */\n get stores()\n {\n return this.#stores;\n }\n}\n\n/**\n * @typedef {object} InternalAppStores\n *\n * @property {import('svelte/store').Writable<HTMLElement>} elementContent - The window content element.\n *\n * @property {import('svelte/store').Writable<HTMLElement>} elementRoot - The window root element.\n */\n","/**\n * A helper to create a set of radio checkbox input elements in a named set.\n * The provided keys are the possible radio values while the provided values are human readable labels.\n *\n * @param {string} name The radio checkbox field name\n *\n * @param {object} choices A mapping of radio checkbox values to human readable labels\n *\n * @param {object} options Options which customize the radio boxes creation\n *\n * @param {string} options.checked Which key is currently checked?\n *\n * @param {boolean} options.localize Pass each label through string localization?\n *\n * @returns {string} HTML for radio boxes.\n *\n * @example <caption>The provided input data</caption>\n * let groupName = \"importantChoice\";\n * let choices = {a: \"Choice A\", b: \"Choice B\"};\n * let chosen = \"a\";\n *\n * @example <caption>The template HTML structure</caption>\n * <div class=\"form-group\">\n * <label>Radio Group Label</label>\n * <div class=\"form-fields\">\n * {@html radioBoxes(groupName, choices, { checked: chosen, localize: true})}\n * </div>\n * </div>\n */\nfunction radioBoxes(name, choices, options)\n{\n const checked = options['checked'] || null;\n\n const localize = options['localize'] || false;\n\n let html = '';\n\n for (let [key, label] of Object.entries(choices)) // eslint-disable-line prefer-const\n {\n if (localize) { label = globalThis.game.i18n.localize(label); }\n const isChecked = checked === key;\n html += `<label class=\"checkbox\"><input type=\"radio\" name=\"${name}\" value=\"${key}\" ${isChecked ? \"checked\" : \"\"}> ${label}</label>`;\n }\n\n return new globalThis.Handlebars.SafeString(html);\n}\n\n/**\n * Converts the `selectOptions` Handlebars helper to be Svelte compatible. This is useful when initially converting\n * over an app to Svelte and for essential usage to several dialogs that mirror the core Foundry experience. For\n * an example of usage see {@link TJSDocumentOwnership}.\n *\n * A helper to create a set of <option> elements in a <select> block based on a provided dictionary.\n * The provided keys are the option values while the provided values are human-readable labels.\n * This helper supports both single-select as well as multi-select input fields.\n *\n * @param {object} choices A mapping of radio checkbox values to human readable labels\n *\n * @param {object} options Helper options\n *\n * @param {string|string[]} [options.selected] Which key or array of keys that are currently selected?\n *\n * @param {boolean} [options.localize=false] Pass each label through string localization?\n *\n * @param {string} [options.blank] Add a blank option as the first option with this label\n *\n * @param {string} [options.nameAttr] Look up a property in the choice object values to use as the option value\n *\n * @param {string} [options.labelAttr] Look up a property in the choice object values to use as the option label\n *\n * @param {boolean} [options.inverted=false] Use the choice object value as the option value, and the key as the label\n * instead of vice-versa\n *\n * @returns {string} The <options> HTML element(s).\n *\n * @example <caption>The provided input data</caption>\n * let choices = {a: 'Choice A', b: 'Choice B'};\n * let value = 'a';\n *\n * @example <caption>The template HTML structure</caption>\n * <select name=\"importantChoice\">\n * {@html selectOptions(choices { selected: value, localize: true })}\n * </select>\n *\n * @example <caption>The resulting HTML</caption>\n * <select name=\"importantChoice\">\n * <option value=\"a\" selected>Choice A</option>\n * <option value=\"b\">Choice B</option>\n * </select>\n *\n * @example <caption>Using inverted</caption>\n * let choices = {'Choice A': 'a', 'Choice B': 'b'};\n * let value = 'a';\n *\n * @example <caption>The template HTML structure</caption>\n * <select name=\"importantChoice\">\n * {@html selectOptions(choices, { selected: value, inverted: true })}\n * </select>\n *\n * @example <caption>Using nameAttr and labelAttr with objects</caption>\n * let choices = {foo: {key: 'a', label: 'Choice A'}, bar: {key: 'b', label: 'Choice B'}};\n * let value = 'b';\n *\n * @example <caption>The template HTML structure</caption>\n * <select name=\"importantChoice\">\n * {@html selectOptions(choices, { selected: value, nameAttr: 'key', labelAttr: 'label' })}\n * </select>\n *\n * @example <caption>Using nameAttr and labelAttr with arrays</caption>\n * let choices = [{key: 'a', label: 'Choice A'}, {key: 'b', label: 'Choice B'}];\n * let value = 'b';\n *\n * @example <caption>The template HTML structure</caption>\n * <select name=\"importantChoice\">\n * {@html selectOptions(choices, { selected: value, nameAttr: 'key', labelAttr: 'label' })}\n * </select>\n */\nfunction selectOptions(choices, options)\n{\n const { localize = false, blank = null, sort = false, nameAttr, labelAttr, inverted } = options;\n let { selected = null } = options;\n\n selected = selected instanceof Array ? selected.map(String) : [String(selected)];\n\n // Prepare the choices as an array of objects\n const selectChoices = [];\n\n if (choices instanceof Array)\n {\n for (const choice of choices)\n {\n const name = String(choice[nameAttr]);\n let label = choice[labelAttr];\n if (localize) { label = globalThis.game.i18n.localize(label); }\n selectChoices.push({ name, label });\n }\n }\n else\n {\n for (const choice of Object.entries(choices))\n {\n const [key, value] = inverted ? choice.reverse() : choice;\n const name = String(nameAttr ? value[nameAttr] : key);\n let label = labelAttr ? value[labelAttr] : value;\n if (localize) { label = globalThis.game.i18n.localize(label); }\n selectChoices.push({ name, label });\n }\n }\n\n // Sort the array of options\n if (sort) { selectChoices.sort((a, b) => a.label.localeCompare(b.label)); }\n\n // Prepend a blank option\n if (blank !== null)\n {\n const label = localize ? globalThis.game.i18n.localize(blank) : blank;\n selectChoices.unshift({ name: '', label });\n }\n\n // Create the HTML\n let html = '';\n for (const option of selectChoices)\n {\n const label = globalThis.Handlebars.escapeExpression(option.label);\n const isSelected = selected.includes(option.name);\n html += `<option value=\"${option.name}\" ${isSelected ? \"selected\" : \"\"}>${label}</option>`;\n }\n\n return new globalThis.Handlebars.SafeString(html);\n}\n\n/**\n * Localize a string including variable formatting for input arguments. Provide a string ID which defines the localized\n * template. Variables can be included in the template enclosed in braces and will be substituted using those named\n * keys.\n *\n * @param {string} stringId - The string ID to translate.\n *\n * @param {object} [data] - Provided input data.\n *\n * @returns {string} The translated and formatted string\n */\nfunction localize(stringId, data)\n{\n const result = typeof data !== 'object' ? globalThis.game.i18n.localize(stringId) :\n globalThis.game.i18n.format(stringId, data);\n\n return result !== void 0 ? result : '';\n}\n\nexport { localize, radioBoxes, selectOptions };\n//# sourceMappingURL=index.js.map\n","<script>\n /**\n * Provides an app header button conforming to the Foundry {@link ApplicationHeaderButton} type. Additionally, a\n * `title` field is supported to give a tool tip for the button. For backward compatibility `onclick` is supported,\n * but for uniformity across TRL defining an `onPress` function is recommended. If defined it is invoked when\n * the button is clicked or `Enter` key pressed and state is updated accordingly.\n *\n * TRL also supports the following extra button data:\n * - {keyCode='Enter'} keyCode: A string conforming to `KeyboardEvent.code` to activate `onPress` callback.\n * - {keepMinimized=false} keepMinimized: When true the button is not removed when app minimized.\n * - {Function} onContextMenu: Invoked when right mouse button or contextmenu key is pressed.\n * - {Function} onPress: Invoked when left mouse button or `keyCode` key is pressed.\n * - {Record<string, string>} styles: Additional inline styles to apply to button.\n * - {string} title: Tooltip title.\n */\n import { applyStyles } from '@typhonjs-fvtt/runtime/svelte/action';\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n import { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n export let button = void 0;\n\n const s_REGEX_HTML = /^\\s*<.*>$/;\n\n $: title = isObject(button) && typeof button.title === 'string' ? localize(button.title) : '';\n\n // Handle icon and treat bare strings as the icon class; otherwise assume the icon is fully formed HTML.\n $: icon = isObject(button) && typeof button.icon !== 'string' ? void 0 : s_REGEX_HTML.test(button.icon) ?\n button.icon : `<i class=\"${button.icon}\" title=\"${title}\"></i>`;\n\n $: label = isObject(button) && typeof button.label === 'string' ? localize(button.label) : void 0;\n\n $: keepMinimized = isObject(button) && typeof button.keepMinimized === 'boolean' ? button.keepMinimized : false;\n\n $: keyCode = isObject(button) && typeof button.keyCode === 'string' ? button.keyCode : 'Enter';\n\n $: styles = isObject(button) && isObject(button.styles) ? button.styles : void 0;\n\n function onClick(event)\n {\n // Accept `onPress or `onclick` as the function / data to invoke.\n const invoke = button?.onPress ?? button?.onclick;\n\n if (typeof invoke === 'function')\n {\n invoke.call(button, event);\n button = button; // This provides a reactive update if button data changes.\n }\n }\n\n function onContextMenu(event)\n {\n // Accept `onContextMenu` as the function / data to invoke.\n const invoke = button?.onContextMenu;\n\n if (typeof invoke === 'function')\n {\n invoke.call(button, event);\n button = button; // This provides a reactive update if button data changes.\n }\n }\n\n /**\n * Consume / stop propagation of key down when key codes match.\n *\n * @param {KeyboardEvent} event -\n */\n function onKeydown(event)\n {\n if (event.code === keyCode)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle press event if key codes match.\n *\n * @param {KeyboardEvent} event -\n */\n function onKeyup(event)\n {\n if (event.code === keyCode)\n {\n const invoke = button.onPress ?? button.onclick;\n\n if (typeof invoke === 'function')\n {\n invoke.call(button, event);\n button = button; // This provides a reactive update if button data changes.\n }\n\n event.preventDefault();\n event.stopPropagation();\n }\n }\n</script>\n\n<svelte:options accessors={true}/>\n\n<!-- svelte-ignore a11y-missing-attribute -->\n<a on:click|preventDefault|stopPropagation={onClick}\n on:contextmenu|preventDefault|stopPropagation={onContextMenu}\n on:keydown={onKeydown}\n on:keyup={onKeyup}\n use:applyStyles={styles}\n class=\"header-button {button.class}\"\n class:keep-minimized={keepMinimized}\n aria-label={label}\n tabindex=0\n role=button>\n {@html icon}{#if label}<span class:has-icon={icon !== void 0}>{label}</span>{/if}\n</a>\n\n<style>\n a {\n padding: var(--tjs-app-header-button-padding, 0 3px);\n }\n\n a :global(i) {\n padding: var(--tjs-app-header-button-icon-padding, 0);\n }\n\n a:hover {\n text-shadow: var(--tjs-app-header-button-text-shadow-hover, var(--tjs-default-text-shadow-focus-hover, inherit));\n }\n\n a:focus-visible {\n box-shadow: var(--tjs-app-header-button-box-shadow-focus-visible, var(--tjs-default-box-shadow-focus-visible));\n outline: var(--tjs-app-header-button-outline-focus-visible, var(--tjs-default-outline-focus-visible, revert));\n transition: var(--tjs-app-header-button-transition-focus-visible, var(--tjs-default-transition-focus-visible));\n text-shadow: var(--tjs-app-header-button-text-shadow-focus-visible, var(--tjs-default-text-shadow-focus-hover, inherit));\n }\n\n span {\n padding: var(--tjs-app-header-button-label-padding, 0);\n }\n\n span.has-icon {\n padding: var(--tjs-app-header-button-label-padding, 0 0 0 3px);\n }\n</style>\n","<script>\n import { getContext } from 'svelte';\n import { cubicOut } from 'svelte/easing';\n\n import {\n draggable as dragDefault } from '@typhonjs-fvtt/runtime/svelte/action';\n\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n\n import {\n isObject,\n isSvelteComponent } from '@typhonjs-fvtt/runtime/svelte/util';\n\n import TJSHeaderButton from './TJSHeaderButton.svelte';\n\n export let draggable = void 0;\n export let draggableOptions = void 0;\n\n const { application } = getContext('#external');\n\n // Focus related app options stores.\n const { focusAuto, focusKeep } = application.reactive.storeAppOptions;\n\n const { elementRoot } = getContext('#internal').stores;\n\n const storeTitle = application.reactive.storeAppOptions.title;\n const storeDraggable = application.reactive.storeAppOptions.draggable;\n const storeDragging = application.reactive.storeUIState.dragging;\n const storeHeaderButtons = application.reactive.storeUIState.headerButtons;\n const storeHeaderIcon = application.reactive.storeAppOptions.headerIcon;\n const storeHeaderNoTitleMinimized = application.reactive.storeAppOptions.headerNoTitleMinimized;\n const storeMinimizable = application.reactive.storeAppOptions.minimizable;\n const storeMinimized = application.reactive.storeUIState.minimized;\n\n // These classes in the window header allow dragging.\n const s_DRAG_TARGET_CLASSLIST = Object.freeze(['tjs-app-icon', 'tjs-window-header-spacer',\n 'window-header', 'window-title']);\n\n let dragOptions;\n\n $: draggable = typeof draggable === 'function' ? draggable : dragDefault;\n\n // Combines external options with defaults for TJSApplicationHeader. By default, easing is turned on w/ duration of\n // 0.08 seconds and cubicOut, but can be overridden by any provided `draggableOptions`. `position`, `active`, and\n // `storeDragging` are always overridden by application position / stores.\n $: dragOptions = Object.assign({}, { ease: true, easeOptions: { duration: 0.08, ease: cubicOut } },\n isObject(draggableOptions) ? draggableOptions : {}, { position: application.position, active:\n $storeDraggable, storeDragging, hasTargetClassList: s_DRAG_TARGET_CLASSLIST });\n\n let displayHeaderTitle;\n\n $: displayHeaderTitle = $storeHeaderNoTitleMinimized && $storeMinimized ? 'none' : null;\n\n let buttonsLeft;\n let buttonsRight;\n\n $:\n {\n buttonsLeft = [];\n buttonsRight = [];\n\n for (const button of $storeHeaderButtons)\n {\n const buttonsList = typeof button?.alignLeft === 'boolean' && button?.alignLeft ? buttonsLeft : buttonsRight;\n\n // If the button is a Svelte component set it as the class otherwise use `TJSHeaderButton` w/ button as props.\n buttonsList.push(isSvelteComponent(button) ? { class: button, props: {} } :\n { class: TJSHeaderButton, props: { button } });\n }\n }\n\n function minimizable(node, booleanStore)\n {\n const callback = (event) =>\n {\n // Only toggle minimize state if window title or header is the event target. Also allow toggle state if the\n // event target has 'keep-minimized' class.\n if (event.target.classList.contains('window-title') || event.target.classList.contains('window-header') ||\n event.target.classList.contains('keep-minimized'))\n {\n application._onToggleMinimize(event);\n }\n }\n\n function activateListeners() { node.addEventListener('dblclick', callback); }\n function removeListeners() { node.removeEventListener('dblclick', callback); }\n\n if (booleanStore) { activateListeners(); }\n\n return {\n update: (booleanStore) => // eslint-disable-line no-shadow\n {\n if (booleanStore) { activateListeners(); }\n else { removeListeners(); }\n },\n\n destroy: () => removeListeners()\n };\n }\n\n /**\n * Explicitly focus `elementRoot` if pointer event is not consumed by header buttons / components. This allows\n * keyboard tab navigation to select header buttons.\n *\n * Note: if `focusKeep` app option store is set to true `elementRoot` is only focused if the current browser wide\n * active element is not contained inside the app element.\n */\n function onPointerdown(event)\n {\n const rootEl = $elementRoot;\n\n if ($focusAuto && rootEl instanceof HTMLElement && rootEl?.isConnected)\n {\n if ($focusKeep)\n {\n const focusOutside = document.activeElement instanceof HTMLElement &&\n !rootEl.contains(document.activeElement);\n\n // Only focus the content element if the active element is outside the app; maintaining internal focused\n // element.\n if (focusOutside)\n {\n rootEl.focus();\n }\n else\n {\n event.preventDefault();\n }\n }\n else\n {\n rootEl.focus();\n }\n }\n }\n</script>\n\n{#key draggable}\n <header class=\"window-header flexrow\"\n use:draggable={dragOptions}\n use:minimizable={$storeMinimizable}\n on:pointerdown={onPointerdown}>\n {#if typeof $storeHeaderIcon === 'string'}\n <img class=\"tjs-app-icon keep-minimized\" src={$storeHeaderIcon} alt=icon>\n {/if}\n <h4 class=window-title style:display={displayHeaderTitle}>\n {localize($storeTitle)}\n </h4>\n {#each buttonsLeft as button}\n <svelte:component this={button.class} {...button.props} />\n {/each}\n <span class=\"tjs-window-header-spacer keep-minimized\" />\n {#each buttonsRight as button}\n <svelte:component this={button.class} {...button.props} />\n {/each}\n </header>\n{/key}\n\n<style>\n /**\n * Provides a zero space element that expands to the right creating the gap between window title and left aligned\n * buttons and right aligned buttons. Note the use of a negative left margin to remove the gap between elements.\n */\n .tjs-window-header-spacer {\n flex: 0;\n margin-left: calc(-1 * var(--tjs-app-header-gap, 5px));\n margin-right: auto;\n }\n\n .window-header {\n flex: var(--tjs-app-header-flex, 0 0 30px);\n gap: var(--tjs-app-header-gap, 5px);\n padding: var(--tjs-app-header-padding, 0 4px);\n }\n\n .window-header .tjs-app-icon {\n align-self: center;\n border-radius: var(--tjs-app-header-icon-border-radius, 4px);\n flex: 0 0 var(--tjs-app-header-icon-width, 24px);\n height: var(--tjs-app-header-icon-height, 24px);\n }\n\n .window-title {\n gap: var(--tjs-app-header-gap, 5px);\n max-width: fit-content;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n</style>\n","<script>\n import { A11yHelper } from '@typhonjs-fvtt/runtime/svelte/util';\n\n /** @type {HTMLElement} */\n export let elementRoot = void 0;\n\n /** @type {boolean} */\n export let enabled = true;\n\n let ignoreElements, wrapEl;\n\n $: if (wrapEl) { ignoreElements = new Set([wrapEl]); }\n\n function onFocus()\n {\n // Early out if not enabled.\n if (!enabled) { return; }\n\n if (elementRoot instanceof HTMLElement)\n {\n const firstFocusEl = A11yHelper.getFirstFocusableElement(elementRoot, ignoreElements);\n\n if (firstFocusEl instanceof HTMLElement && firstFocusEl !== wrapEl)\n {\n firstFocusEl.focus();\n }\n else\n {\n // No focus target found, so focus elementRoot.\n elementRoot.focus();\n }\n }\n }\n</script>\n\n<!-- svelte-ignore a11y-no-noninteractive-tabindex -->\n<div bind:this={wrapEl} class=tjs-focus-wrap tabindex=0 on:focus={onFocus} />\n\n<style>\n div {\n width: 0;\n height: 0;\n flex: 0;\n }\n\n div:focus {\n outline: none;\n }\n</style>\n","<script>\n import { getContext } from 'svelte';\n\n export let isResizable = false;\n\n const application = getContext('#external').application;\n\n // Allows retrieval of the element root at runtime.\n const storeElementRoot = getContext('storeElementRoot');\n\n const storeResizable = application.reactive.storeAppOptions.resizable;\n\n const storeMinimized = application.reactive.storeUIState.minimized;\n const storeResizing = application.reactive.storeUIState.resizing;\n\n let elementResize;\n\n $: if (elementResize)\n {\n // Instead of creating a derived store it is easier to use isResizable and the minimized store below.\n elementResize.style.display = isResizable && !$storeMinimized ? 'block' : 'none';\n\n // Add / remove `resizable` class from element root.\n const elementRoot = $storeElementRoot;\n if (elementRoot) { elementRoot.classList[isResizable ? 'add' : 'remove']('resizable'); }\n }\n\n /**\n * Provides an action to handle resizing the application shell based on the resizable app option.\n *\n * @param {HTMLElement} node - The node associated with the action.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.active=true] - A boolean value; attached to a readable store.\n *\n * @param {Writable<boolean>} [opts.storeResizing] - A writable store that tracks \"resizing\" state.\n *\n * @returns {{update: Function, destroy: Function}} The action lifecycle methods.\n */\n function resizable(node, { active = true, storeResizing = void 0 } = {})\n {\n /**\n * Duplicate the app / Positionable starting position to track differences.\n *\n * @type {object}\n */\n let position = null;\n\n /**\n * Stores the initial X / Y on drag down.\n *\n * @type {object}\n */\n let initialPosition = {};\n\n /**\n * Stores the current resizing state and gates the move pointer as the resizing store is not\n * set until the first pointer move.\n *\n * @type {boolean}\n */\n let resizing = false;\n\n /**\n * Remember event handlers associated with this action so they may be later unregistered.\n *\n * @type {Object}\n */\n const handlers = {\n resizeDown: ['pointerdown', (e) => onResizePointerDown(e), false],\n resizeMove: ['pointermove', (e) => onResizePointerMove(e), false],\n resizeUp: ['pointerup', (e) => onResizePointerUp(e), false]\n };\n\n /**\n * Activates listeners.\n */\n function activateListeners()\n {\n // Resize handlers\n node.addEventListener(...handlers.resizeDown);\n\n isResizable = true;\n\n node.style.display = 'block';\n }\n\n /**\n * Removes listeners.\n */\n function removeListeners()\n {\n if (typeof storeResizing?.set === 'function') { storeResizing.set(false); }\n\n // Resize handlers\n node.removeEventListener(...handlers.resizeDown);\n node.removeEventListener(...handlers.resizeMove);\n node.removeEventListener(...handlers.resizeUp);\n\n node.style.display = 'none';\n\n isResizable = false;\n }\n\n // On mount if resizable is true then activate listeners otherwise set element display to `none`.\n if (active)\n {\n activateListeners();\n }\n else\n {\n node.style.display = 'none';\n }\n\n /**\n * Handle the initial pointer down that activates resizing capture.\n */\n function onResizePointerDown(event)\n {\n event.preventDefault();\n\n resizing = false;\n\n // Record initial position\n position = application.position.get();\n\n if (position.height === 'auto') { position.height = $storeElementRoot.clientHeight; }\n if (position.width === 'auto') { position.width = $storeElementRoot.clientWidth; }\n\n initialPosition = { x: event.clientX, y: event.clientY };\n\n // Add temporary handlers\n node.addEventListener(...handlers.resizeMove);\n node.addEventListener(...handlers.resizeUp);\n\n node.setPointerCapture(event.pointerId);\n }\n\n /**\n * Sets the width / height of the positionable application.\n */\n function onResizePointerMove(event)\n {\n event.preventDefault();\n\n if (!resizing && typeof storeResizing?.set === 'function')\n {\n resizing = true;\n storeResizing.set(true);\n }\n\n application.position.set({\n width: position.width + (event.clientX - initialPosition.x),\n height: position.height + (event.clientY - initialPosition.y)\n });\n }\n\n /**\n * Conclude the dragging behavior when the pointer is released setting the final position and\n * removing listeners.\n */\n function onResizePointerUp(event)\n {\n resizing = false;\n if (typeof storeResizing?.set === 'function') { storeResizing.set(false); }\n\n event.preventDefault();\n node.removeEventListener(...handlers.resizeMove);\n node.removeEventListener(...handlers.resizeUp);\n\n application._onResize(event);\n }\n\n return {\n update: ({ active }) => // eslint-disable-line no-shadow\n {\n if (active) { activateListeners(); }\n else { removeListeners(); }\n },\n\n destroy: () => removeListeners()\n };\n }\n\n</script>\n\n<div class=\"window-resizable-handle\"\n use:resizable={{active: $storeResizable, storeResizing}}\n bind:this={elementResize}>\n <i class=\"fas fa-arrows-alt-h\"></i>\n</div>\n","<script>\n /**\n * Provides an application shell is a main top level slotted component that provides a reactive\n * outer wrapper and header bar for the main content component.\n */\n\n import {\n getContext,\n onMount,\n setContext } from 'svelte';\n\n import {\n applyStyles,\n resizeObserver } from '@typhonjs-fvtt/runtime/svelte/action';\n\n import {\n A11yHelper,\n isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n import { AppShellContextInternal } from './AppShellContextInternal.js';\n import TJSApplicationHeader from './TJSApplicationHeader.svelte';\n import TJSFocusWrap from './TJSFocusWrap.svelte';\n import ResizableHandle from './ResizableHandle.svelte';\n\n import {\n s_DEFAULT_TRANSITION_OPTIONS } from '@typhonjs-fvtt/runtime/svelte/transition';\n\n // Bound to the content and root elements. Can be used by parent components. SvelteApplication will also\n // use 'elementRoot' to set the element of the Application. You can also provide `elementContent` and\n // `elementTarget`. Please see SvelteApplication lifecycle documentation.\n export let elementContent = void 0;\n export let elementRoot = void 0;\n\n // Allows custom draggable implementations to be forwarded to TJSApplicationHeader.\n export let draggable = void 0;\n export let draggableOptions = void 0;\n\n // The children array can be specified by a parent via prop or is read below from the external context.\n // export let children = void 0;\n\n // Explicit style overrides for the main app and content elements. Uses action `applyStyles`.\n export let stylesApp = void 0;\n export let stylesContent = void 0;\n\n // If a parent component binds and sets `appOffsetHeight` to true then a resizeObserver action is enabled on the\n // outer application `div`. Additionally, the SvelteApplication position resizeObserved store is updated.\n export let appOffsetHeight = false;\n export let appOffsetWidth = false;\n\n // Set to `resizeObserver` if either of the above props are truthy otherwise a null operation.\n const appResizeObserver = !!appOffsetHeight || !!appOffsetWidth ? resizeObserver : () => null;\n\n // If a parent component binds and sets `contentOffsetHeight` or `contentOffsetWidth` to true then a\n // resizeObserver action is enabled on the content `section`.\n export let contentOffsetHeight = false;\n export let contentOffsetWidth = false;\n\n // Set to `resizeObserver` if either of the above props are truthy otherwise a null operation.\n const contentResizeObserver = !!contentOffsetHeight || !!contentOffsetWidth ? resizeObserver : () => null;\n\n // Provides the internal context for data / stores of the application shell.\n const internal = new AppShellContextInternal();\n\n // Provides options to `A11yHelper.getFocusableElements` to ignore TJSFocusWrap by CSS class.\n const s_IGNORE_CLASSES = { ignoreClasses: ['tjs-focus-wrap'] };\n\n // Internal context for `elementContent` / `elementRoot` stores.\n setContext('#internal', internal);\n\n // Only update the `elementContent` store if the new `elementContent` is not null or undefined.\n $: if (elementContent !== void 0 && elementContent !== null)\n {\n getContext('#internal').stores.elementContent.set(elementContent);\n }\n\n // Only update the `elementRoot` store if the new `elementRoot` is not null or undefined.\n $: if (elementRoot !== void 0 && elementRoot !== null)\n {\n getContext('#internal').stores.elementRoot.set(elementRoot);\n }\n\n // Store application reference.\n const { application } = getContext('#external');\n\n // Focus related app options stores.\n const { focusAuto, focusKeep, focusTrap } = application.reactive.storeAppOptions;\n\n const { minimized } = application.reactive.storeUIState;\n\n let focusWrapEnabled;\n\n // Enable TJSFocusWrap component when focus trapping app option is true and app is not minimized.\n $: focusWrapEnabled = $focusAuto && $focusTrap && !$minimized;\n\n // ---------------------------------------------------------------------------------------------------------------\n\n // The following block is somewhat complex, but allows transition options to be updated reactively during\n // runtime execution.\n\n // Exports properties to set a transition w/ in / out options.\n export let transition = void 0;\n export let inTransition = void 0;\n export let outTransition = void 0;\n\n // Exports properties to set options for any transitions.\n export let transitionOptions = void 0;\n export let inTransitionOptions = s_DEFAULT_TRANSITION_OPTIONS;\n export let outTransitionOptions = s_DEFAULT_TRANSITION_OPTIONS;\n\n // Tracks last transition state.\n let oldTransition = void 0;\n let oldTransitionOptions = void 0\n\n // Run this reactive block when the last transition state is not equal to the current state.\n $: if (oldTransition !== transition)\n {\n // If transition is defined and not the default transition then set it to both in and out transition otherwise\n // set the default transition to both in & out transitions.\n const newTransition = typeof transition === 'function' ? transition : void 0;\n\n inTransition = newTransition;\n outTransition = newTransition;\n\n oldTransition = newTransition;\n }\n\n // Run this reactive block when the last transition options state is not equal to the current options state.\n $: if (oldTransitionOptions !== transitionOptions)\n {\n const newOptions = transitionOptions !== s_DEFAULT_TRANSITION_OPTIONS && isObject(transitionOptions) ?\n transitionOptions : s_DEFAULT_TRANSITION_OPTIONS;\n\n inTransitionOptions = newOptions;\n outTransitionOptions = newOptions;\n\n oldTransitionOptions = newOptions;\n }\n\n // Handle cases if inTransition is unset; assign noop default transition function.\n $: if (typeof inTransition !== 'function') { inTransition = void 0; }\n\n $:\n {\n // Handle cases if outTransition is unset; assign noop default transition function.\n if (typeof outTransition !== 'function') { outTransition = void 0; }\n\n // Set jquery close animation to either run or not when an out transition is changed.\n if (application && typeof application?.options?.defaultCloseAnimation === 'boolean')\n {\n application.options.defaultCloseAnimation = outTransition === void 0;\n }\n }\n\n // Handle cases if inTransitionOptions is unset; assign empty default transition options.\n $: if (typeof inTransitionOptions !== 'object') { inTransitionOptions = s_DEFAULT_TRANSITION_OPTIONS; }\n\n // Handle cases if outTransitionOptions is unset; assign empty default transition options.\n $: if (typeof outTransitionOptions !== 'object') { outTransitionOptions = s_DEFAULT_TRANSITION_OPTIONS; }\n\n // ---------------------------------------------------------------------------------------------------------------\n\n // Focus `elementRoot` on mount to allow keyboard tab navigation of header buttons.\n onMount(() => elementRoot.focus());\n\n // ---------------------------------------------------------------------------------------------------------------\n\n /**\n * Provides a handler for the custom `close:popup` event fired by `svelte-standard` components like TJSMenu. The\n * intention is to handle focus management of a component that is no longer connected in the DOM. If a target element\n * that is the source of the close event is attached attempt to resolve internal focus to the application.\n *\n * @param {CustomEvent} event - A custom event for `close:popup`.\n */\n function onClosePopup(event)\n {\n // Early out as automatic focus management is not enabled.\n if (!$focusAuto) { return; }\n\n const targetEl = event?.detail?.target;\n\n // Early out if there is no target element.\n if (!(targetEl instanceof HTMLElement)) { return; }\n\n // Early out if the target element is focusable as it will gain focus naturally.\n if (A11yHelper.isFocusable(targetEl)) { return; }\n\n const elementRootContains = elementRoot.contains(targetEl);\n\n // First check for if the target is elementRoot or elementContent then fallback to contains checks.\n if (targetEl === elementRoot)\n {\n elementRoot.focus();\n }\n else if (targetEl === elementContent)\n {\n elementContent.focus();\n }\n else if (elementRootContains)\n {\n if (elementContent.contains(targetEl))\n {\n elementContent.focus();\n }\n else\n {\n elementRoot.focus();\n }\n }\n }\n\n /**\n * Provides focus cycling inside the application capturing `<Shift-Tab>` and if `elementRoot` or `firstFocusEl` is\n * the actively focused element then last focusable element is focused skipping `TJSFocusWrap`.\n *\n * Also, if a popout app all key down events will bring this application to the top such that when focus is trapped\n * the app is top most.\n *\n * @param {KeyboardEvent} event - Keyboard Event.\n */\n function onKeydown(event)\n {\n if (focusWrapEnabled && event.shiftKey && event.code === 'Tab')\n {\n // Collect all focusable elements from `elementRoot` and ignore TJSFocusWrap.\n const allFocusable = A11yHelper.getFocusableElements(elementRoot, s_IGNORE_CLASSES);\n\n // Find first and last focusable elements.\n const firstFocusEl = allFocusable.length > 0 ? allFocusable[0] : void 0;\n const lastFocusEl = allFocusable.length > 0 ? allFocusable[allFocusable.length - 1] : void 0;\n\n // Only cycle focus to the last keyboard focusable app element if `elementRoot` or first focusable element\n // is the active element.\n if (elementRoot === document.activeElement || firstFocusEl === document.activeElement)\n {\n if (lastFocusEl instanceof HTMLElement && firstFocusEl !== lastFocusEl) { lastFocusEl.focus(); }\n\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n // Make sure this application is top most when it receives keyboard events.\n if (typeof application?.options?.popOut === 'boolean' && application.options.popOut &&\n application !== globalThis.ui?.activeWindow)\n {\n application.bringToTop.call(application);\n }\n }\n\n /**\n * If the application is a popOut application then when clicked bring to top if not already the Foundry\n * `activeWindow`.\n */\n function onPointerdownApp()\n {\n if (typeof application?.options?.popOut === 'boolean' && application.options.popOut &&\n application !== globalThis.ui?.activeWindow)\n {\n application.bringToTop.call(application);\n }\n }\n\n /**\n * Focus `elementContent` if the event target is not focusable and `focusAuto` is enabled.\n *\n * Note: `focusAuto` is an app option store. This check is a bit tricky as `section.window-content` has a tabindex\n * of '-1', so it is focusable manually.\n */\n function onPointerdownContent(event)\n {\n const focusable = A11yHelper.isFocusable(event.target);\n\n if (!focusable && $focusAuto)\n {\n if ($focusKeep)\n {\n const focusOutside = document.activeElement instanceof HTMLElement &&\n !elementRoot.contains(document.activeElement);\n\n // Only focus the content element if the active element is outside the app; maintaining internal focused\n // element.\n if (focusOutside)\n {\n elementContent.focus();\n }\n else\n {\n event.preventDefault();\n }\n }\n else\n {\n elementContent.focus();\n }\n }\n }\n\n /**\n * Callback for content resizeObserver action. This is enabled when contentOffsetHeight or contentOffsetWidth is\n * bound.\n *\n * @param {number} offsetWidth - Observed offsetWidth.\n *\n * @param {number} offsetHeight - Observed offsetHeight\n */\n function resizeObservedContent(offsetWidth, offsetHeight)\n {\n contentOffsetWidth = offsetWidth;\n contentOffsetHeight = offsetHeight;\n }\n\n /**\n * Callback for app resizeObserver action. This is enabled when appOffsetHeight or appOffsetWidth is\n * bound. Additionally, the Application position resizeObserved store is updated.\n *\n * @param {number} contentWidth - Observed contentWidth.\n * @param {number} contentHeight - Observed contentHeight\n * @param {number} offsetWidth - Observed offsetWidth.\n * @param {number} offsetHeight - Observed offsetHeight\n */\n function resizeObservedApp(offsetWidth, offsetHeight, contentWidth, contentHeight)\n {\n application.position.stores.resizeObserved.update((object) =>\n {\n object.contentWidth = contentWidth;\n object.contentHeight = contentHeight;\n object.offsetWidth = offsetWidth;\n object.offsetHeight = offsetHeight;\n\n return object;\n });\n\n appOffsetHeight = offsetHeight;\n appOffsetWidth = offsetWidth;\n }\n\n /**\n * Transitions can cause side effects. Work around this issue by using an if conditional.\n * Due to timing issues and the onDestroy / outro transitions can cause elementRoot / elementContent to be set to\n * null when swapped dynamically. There is a feature request to allow transition functions to be undefined:\n *\n * @see: https://github.com/sveltejs/svelte/issues/6942\n */\n</script>\n\n<svelte:options accessors={true}/>\n\n{#if inTransition || outTransition}\n <div id={application.id}\n class=\"app window-app {application.options.classes.join(' ')}\"\n data-appid={application.appId}\n bind:this={elementRoot}\n in:inTransition={inTransitionOptions}\n out:outTransition={outTransitionOptions}\n on:close:popup|preventDefault|stopPropagation={onClosePopup}\n on:keydown|capture={onKeydown}\n on:pointerdown={onPointerdownApp}\n use:applyStyles={stylesApp}\n use:appResizeObserver={resizeObservedApp}\n tabindex=-1>\n <TJSApplicationHeader {draggable} {draggableOptions} />\n <section class=window-content\n bind:this={elementContent}\n on:pointerdown={onPointerdownContent}\n use:applyStyles={stylesContent}\n use:contentResizeObserver={resizeObservedContent}\n tabindex=-1>\n <slot />\n </section>\n <ResizableHandle />\n <TJSFocusWrap {elementRoot} />\n </div>\n{:else}\n <div id={application.id}\n class=\"app window-app {application.options.classes.join(' ')}\"\n data-appid={application.appId}\n bind:this={elementRoot}\n on:close:popup|preventDefault|stopPropagation={onClosePopup}\n on:keydown|capture={onKeydown}\n on:pointerdown={onPointerdownApp}\n use:applyStyles={stylesApp}\n use:appResizeObserver={resizeObservedApp}\n tabindex=-1>\n <TJSApplicationHeader {draggable} {draggableOptions} />\n <section class=window-content\n bind:this={elementContent}\n on:pointerdown={onPointerdownContent}\n use:applyStyles={stylesContent}\n use:contentResizeObserver={resizeObservedContent}\n tabindex=-1>\n <slot />\n </section>\n <ResizableHandle />\n <TJSFocusWrap {elementRoot} enabled={focusWrapEnabled} />\n </div>\n{/if}\n\n<style>\n /* Note: this is different than stock Foundry and allows rounded corners from .app core styles */\n .window-app {\n overflow: var(--tjs-app-overflow, hidden);\n }\n\n .window-app:focus-visible {\n outline: var(--tjs-app-outline-focus-visible, var(--tjs-default-a11y-outline-focus-visible, 2px solid transparent));\n }\n\n .window-content:focus-visible {\n outline: var(--tjs-app-content-outline-focus-visible, var(--tjs-default-a11y-outline-focus-visible, 2px solid transparent));\n }\n\n /* Override Foundry default; adjust --tjs-app-header-gap to change gap size */\n .window-app :global(.window-header a) {\n flex: none;\n margin: 0;\n }\n\n /* Override Foundry default; See TJSHeaderButton for CSS variables */\n .window-app :global(.window-header i[class^=fa]) {\n margin: 0\n }\n</style>\n","<script>\n import {\n getContext,\n onDestroy,\n onMount } from 'svelte';\n\n import { applyStyles } from '@typhonjs-fvtt/runtime/svelte/action';\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n\n import {\n A11yHelper,\n isObject,\n isSvelteComponent,\n parseSvelteConfig } from '@typhonjs-fvtt/runtime/svelte/util';\n\n export let data = void 0;\n export let preventDefault = false;\n export let stopPropagation = false;\n\n export let dialogComponent = void 0;\n\n const s_REGEX_HTML = /^\\s*<.*>$/;\n\n let buttons;\n\n /** @type {HTMLDivElement} */\n let contentEl;\n\n /** @type {HTMLDivElement} */\n let buttonsEl;\n\n let content = void 0;\n let dialogClass;\n let dialogProps = {};\n\n let { elementRoot } = getContext('#internal').stores;\n\n let { application } = getContext('#external');\n\n let managedPromise = getContext('#managedPromise');\n\n let currentButtonId = data.default;\n\n // Remove key listeners from elementRoot.\n onDestroy(() =>\n {\n const rootEl = $elementRoot;\n if (rootEl instanceof HTMLElement)\n {\n rootEl.removeEventListener('keydown', onKeydown)\n rootEl.removeEventListener('keyup', onKeyup)\n }\n })\n\n // If `focusFirst` is true then focus first focusable element iin dialog content.\n onMount(() =>\n {\n if (focusFirst)\n {\n const focusEl = A11yHelper.getFirstFocusableElement(contentEl);\n\n if (focusEl instanceof HTMLElement)\n {\n // Focus on next tick to allow application / dialog to mount to bypass ApplicationShell onMount focus\n // handling.\n setTimeout(() => focusEl.focus(), 0);\n }\n }\n });\n\n // Add key listeners to elementRoot when it is bound.\n $: if ($elementRoot)\n {\n const rootEl = $elementRoot;\n if (rootEl instanceof HTMLElement)\n {\n rootEl.addEventListener('keydown', onKeydown)\n rootEl.addEventListener('keyup', onKeyup)\n }\n }\n\n // Automatically close the dialog on button click handler completion.\n $: autoClose = typeof data.autoClose === 'boolean' ? data.autoClose : true;\n\n // When true the first focusable element that isn't a button is focused.\n $: focusFirst = typeof data.focusFirst === 'boolean' ? data.focusFirst : false;\n\n // Focus current button when `buttonsEl` is bound.\n $: if (!focusFirst && buttonsEl instanceof HTMLElement)\n {\n const buttonEl = buttonsEl.querySelector(`.${currentButtonId}`);\n if (buttonEl instanceof HTMLElement) { buttonEl.focus(); }\n }\n\n // When false the dialog does not automatically close when button selected.\n $: resolveId = typeof data.resolveId === 'boolean' ? data.resolveId : false;\n\n // If `data.buttons` is not an object then set an empty array otherwise reduce the button data.\n $:\n {\n buttons = !isObject(data.buttons) ? [] : Object.keys(data.buttons).reduce((array, key) =>\n {\n const b = data.buttons[key];\n\n // Handle icon and treat bare strings as the icon class; otherwise assume the icon is fully formed HTML.\n const icon = typeof b.icon !== 'string' ? void 0 : s_REGEX_HTML.test(b.icon) ? b.icon :\n `<i class=\"${b.icon}\"></i>`;\n\n const autoClose = typeof b.autoClose === 'boolean' ? b.autoClose : true;\n\n const disabled = typeof b.disabled === 'boolean' ? b.disabled : false;\n\n const label = typeof b.label === 'string' ? `${icon !== void 0 ? ' ' : ''}${localize(b.label)}` : '';\n\n const title = typeof b.title === 'string' ? localize(b.title) : void 0;\n\n // Test any condition supplied otherwise default to true.\n const condition = typeof b.condition === 'function' ? b.condition.call(b) : b.condition ?? true;\n\n if (condition) { array.push({ ...b, id: key, autoClose, icon, label, title, disabled }); }\n\n return array;\n }, []);\n }\n\n /**\n * This reactivity block will trigger on arrow left / right key presses _and_ when buttons change. It is OK for it to\n * trigger on both.\n */\n $: if (!buttons.find((button) => button.id === currentButtonId)) { currentButtonId = void 0; }\n\n $: if (content !== data.content) // Only update the content if it has changed.\n {\n content = data.content;\n\n try\n {\n if (isSvelteComponent(content))\n {\n dialogClass = content;\n dialogProps = {};\n }\n else if (isObject(content))\n {\n const svelteConfig = parseSvelteConfig(content, application);\n dialogClass = svelteConfig.class;\n dialogProps = svelteConfig.props ?? {};\n\n // Check for any children parsed and added to the external context.\n const children = svelteConfig?.context?.get('external')?.children;\n\n // If so add to dialogProps.\n if (Array.isArray(children)) { dialogProps.children = children; }\n }\n else\n {\n dialogClass = void 0;\n dialogProps = {};\n }\n }\n catch (err)\n {\n dialogClass = void 0;\n dialogProps = {};\n\n content = err.message;\n console.error(err);\n }\n }\n\n /**\n * Handle button click.\n *\n * @param {object} button - button data.\n *\n * TODO: When app eventbus is available send event for UI notification instead of Foundry API usage.\n *\n * @returns {*}\n */\n function onClick(button)\n {\n try\n {\n let result = void 0;\n\n const callback = button?.onPress;\n\n switch (typeof callback)\n {\n case 'function':\n // Pass back the TJSDialog instance.\n result = callback(application);\n break;\n\n case 'string':\n // Attempt lookup by function name in dialog instance component.\n if (dialogComponent !== void 0 && typeof dialogComponent[callback] === 'function')\n {\n result = dialogComponent[callback](application);\n }\n else\n {\n if (dialogComponent === void 0)\n {\n console.warn(`[TRL] TJSDialog warning: 'onPress' defined as a string with no associated ` +\n `content Svelte component.`);\n }\n else if (typeof dialogComponent?.[callback] !== 'function')\n {\n console.warn(`[TRL] TJSDialog warning: The content Svelte component does not contain an ` +\n `associated function '${callback}'. Did you remember to add ` +\n `'<svelte:options accessors={true} />' and export the function?`);\n }\n }\n break;\n }\n\n // By default, both 'button.autoClose' & autoClose are true, so skip auto-closing when either is false.\n if (button.autoClose && autoClose)\n {\n // If `resolveId` dialog option is true and current result is undefined then set result to the button ID.\n if (resolveId && result === void 0) { result = button.id; }\n\n managedPromise.resolve(result);\n }\n }\n catch(err)\n {\n const notifyError = typeof data.notifyError === 'boolean' ? data.notifyError : true;\n if (notifyError)\n {\n // TODO: When app eventbus is available send event for UI notification instead of Foundry API usage.\n globalThis.ui.notifications.error(err, { console: false });\n }\n\n // Attempt to first reject the error with any current managed Promise otherwise rethrow error.\n if (!managedPromise.reject(err)) { throw err; }\n }\n finally\n {\n // By default, both 'button.autoClose' & autoClose are true, so skip auto-closing when either is false.\n if (button.autoClose && autoClose) { application.close(); }\n }\n }\n\n /**\n * Handles key down events for stopping propagation for arrow keys. Also handles tab / focus traversal with a timeout\n * to update `currentButtonId` on the next clock tick comparing against `document.activeElement`.\n *\n * @param {KeyboardEvent} event - A KeyboardEvent.\n */\n function onKeydown(event)\n {\n switch (event.code)\n {\n case 'ArrowLeft':\n case 'ArrowRight':\n case 'Enter':\n event.stopPropagation();\n break;\n\n case 'Tab':\n event.stopPropagation();\n\n // Check `activeElement` on next tick to potentially update `currentButtonId` from tab / keyboard\n // navigation.\n setTimeout(() =>\n {\n const activeElement = document.activeElement;\n if (activeElement instanceof HTMLElement && buttonsEl instanceof HTMLElement &&\n buttonsEl.contains(activeElement))\n {\n // Find class that isn't `dialog-button` or `default` and is a key in `data.buttons`.\n for (let cntr = 0; cntr < activeElement.classList.length; cntr++)\n {\n const item = activeElement.classList.item(cntr);\n if (item !== 'dialog-button' && item !== 'default' && typeof data.buttons[item] !== void 0)\n {\n currentButtonId = item;\n break;\n }\n }\n }\n }, 0);\n break;\n\n default:\n if (preventDefault) { event.preventDefault(); }\n if (stopPropagation) { event.stopPropagation(); }\n break;\n }\n }\n\n /**\n * Handles key up events for arrow key button navigation.\n *\n * @param {KeyboardEvent} event - A KeyboardEvent.\n */\n function onKeyup(event)\n {\n switch (event.code)\n {\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n\n const activeEl = document.activeElement;\n\n if (buttonsEl instanceof HTMLElement)\n {\n // Only advance button via arrow key if a button is already focused.\n if (activeEl instanceof HTMLElement && buttonsEl.contains(activeEl))\n {\n const currentIndex = buttons.findIndex((button) => button.id === currentButtonId);\n if (buttons.length && currentIndex > 0) { currentButtonId = buttons[currentIndex - 1].id; }\n }\n\n const buttonEl = buttonsEl.querySelector(`.${currentButtonId}`);\n if (buttonEl instanceof HTMLElement) { buttonEl.focus(); }\n }\n break;\n }\n\n case 'ArrowRight':\n {\n event.preventDefault();\n event.stopPropagation();\n\n const activeEl = document.activeElement;\n\n if (buttonsEl instanceof HTMLElement)\n {\n // Only advance button via arrow key if a button is already focused or there is no current button ID\n if (activeEl instanceof HTMLElement && (buttonsEl.contains(activeEl) || currentButtonId === void 0))\n {\n const currentIndex = buttons.findIndex((button) => button.id === currentButtonId);\n if (buttons.length && currentIndex < buttons.length - 1) { currentButtonId = buttons[currentIndex + 1].id; }\n }\n\n const buttonEl = buttonsEl.querySelector(`.${currentButtonId}`);\n if (buttonEl instanceof HTMLElement) { buttonEl.focus(); }\n }\n break;\n }\n\n case 'Enter':\n event.preventDefault();\n event.stopPropagation();\n break;\n\n default:\n if (preventDefault) { event.preventDefault(); }\n if (stopPropagation) { event.stopPropagation(); }\n break;\n }\n }\n</script>\n\n<main>\n <div bind:this={contentEl} class=dialog-content>\n {#if typeof content === 'string'}\n {@html content}\n {:else if dialogClass}\n <svelte:component bind:this={dialogComponent} this={dialogClass} {...dialogProps} />\n {/if}\n </div>\n\n {#if buttons.length}\n <div bind:this={buttonsEl} class=dialog-buttons>\n {#each buttons as button (button.id)}\n <button class=\"dialog-button {button.id}\"\n on:click|preventDefault|stopPropagation={() => onClick(button)}\n on:focus={() => currentButtonId = button.id}\n disabled={button.disabled}\n use:applyStyles={button.styles}>\n <span title={button.title}>{#if button.icon}{@html button.icon}{/if}{button.label}</span>\n </button>\n {/each}\n </div>\n {/if}\n</main>\n\n<style>\n .dialog-buttons {\n padding-top: 8px;\n }\n</style>\n","<script>\n import {\n getContext,\n onDestroy,\n onMount,\n setContext } from 'svelte';\n\n import { fade } from 'svelte/transition';\n\n import { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n import ApplicationShell from '../application/ApplicationShell.svelte';\n import DialogContent from './DialogContent.svelte';\n import TJSGlassPane from '../TJSGlassPane.svelte';\n\n // ApplicationShell contract.\n export let elementContent = void 0;\n export let elementRoot = void 0;\n\n // The dialog data.\n export let data = {};\n\n export let dialogComponent = void 0;\n\n export let managedPromise = void 0;\n\n const application = getContext('#external').application;\n\n setContext('#managedPromise', managedPromise);\n\n const s_MODAL_TRANSITION = fade;\n const s_MODAL_TRANSITION_OPTIONS = { duration: 200 };\n const s_MODAL_BACKGROUND = '#50505080'\n\n let modal = void 0;\n\n // Stores props for the ApplicationShell.\n const appProps = {\n // Stores any transition functions.\n transition: void 0,\n inTransition: void 0,\n outTransition: void 0,\n\n // Stores properties to set for options for any transitions.\n transitionOptions: void 0,\n inTransitionOptions: void 0,\n outTransitionOptions: void 0,\n\n // Stores any style overrides for application shell.\n stylesApp: void 0,\n stylesContent: void 0\n }\n\n const modalProps = {\n // Background CSS style string.\n background: void 0,\n slotSeparate: void 0,\n styles: void 0,\n\n // Stores any transition functions.\n transition: void 0,\n inTransition: void 0,\n outTransition: void 0,\n\n // Stores properties to set for options for any transitions.\n transitionOptions: void 0,\n inTransitionOptions: void 0,\n outTransitionOptions: void 0,\n }\n\n let zIndex = void 0;\n\n let minimizable = true;\n\n // Only set modal once on mount. You can't change between a modal an non-modal dialog during runtime.\n if (modal === void 0) { modal = typeof data?.modal === 'boolean' ? data.modal : false; }\n\n // Special modal handling -----------------------------------------------------------------------------------------\n\n if (modal)\n {\n // Add a capture listener on window keydown to act before any other event listener.\n onDestroy(() => window.removeEventListener('keydown', onKeydownModal, { capture: true }));\n onMount(() => window.addEventListener('keydown', onKeydownModal, { capture: true }));\n }\n else\n {\n // Add a listener on document keydown to act before or equal with other event listeners.\n onDestroy(() => document.removeEventListener('keydown', onKeydown));\n onMount(() => document.addEventListener('keydown', onKeydown));\n }\n\n // Aria Attributes ------------------------------------------------------------------------------------------------\n\n $: if (elementRoot instanceof HTMLElement)\n {\n elementRoot.setAttribute('role', 'dialog');\n\n if (modal) { elementRoot.setAttribute('aria-modal', 'true'); }\n }\n\n // SvelteApplication options --------------------------------------------------------------------------------------\n\n // Retrieve values from the DialogData object and also potentially set any SvelteApplication accessors.\n // Explicit checks are performed against existing local variables as the only externally reactive variable is `data`.\n // All of the checks below trigger when there are any external changes to the `data` prop.\n // Prevent any unnecessary changing of local & `application` variables unless actual changes occur.\n\n $: if (isObject(data))\n {\n const newZIndex = Number.isInteger(data.zIndex) || data.zIndex === null ? data.zIndex :\n modal ? Number.MAX_SAFE_INTEGER : Number.MAX_SAFE_INTEGER - 1\n if (zIndex !== newZIndex) { zIndex = newZIndex; }\n\n // Update the main foundry options when data changes. Perform explicit checks against existing data in `application`.\n const newDraggable = typeof data.draggable === 'boolean' ? data.draggable : void 0;\n if (newDraggable !== void 0 && application.reactive.draggable !== newDraggable)\n {\n application.reactive.draggable = newDraggable;\n }\n\n const newFocusAuto = typeof data.focusAuto === 'boolean' ? data.focusAuto : void 0;\n if (newFocusAuto !== void 0 && application.reactive.focusAuto !== newFocusAuto)\n {\n application.reactive.focusAuto = newFocusAuto;\n }\n\n const newFocusKeep = typeof data.focusKeep === 'boolean' ? data.focusKeep : void 0;\n if (newFocusKeep !== void 0 && application.reactive.focusKeep !== newFocusKeep)\n {\n application.reactive.focusKeep = newFocusKeep;\n }\n\n const newFocusTrap = typeof data.focusTrap === 'boolean' ? data.focusTrap : void 0;\n if (newFocusTrap !== void 0 && application.reactive.focusTrap !== newFocusTrap)\n {\n application.reactive.focusTrap = newFocusTrap;\n }\n\n const newMinimizable = typeof data.minimizable === 'boolean' ? data.minimizable : void 0;\n if (newMinimizable !== void 0 && application.reactive.minimizable !== newMinimizable)\n {\n application.reactive.minimizable = newMinimizable;\n }\n\n const newResizable = typeof data.resizable === 'boolean' ? data.resizable : void 0;\n if (newResizable !== void 0 && application.reactive.resizable !== newResizable)\n {\n application.reactive.resizable = newResizable;\n }\n\n // Note application.title from Application localizes `options.title`, so compare with `application.options.title`.\n const newTitle = data.title ?? 'Dialog';\n if (newTitle !== application?.options?.title) { application.reactive.title = newTitle; }\n\n if (application.position.zIndex !== zIndex) { application.position.zIndex = zIndex; }\n }\n\n // ApplicationShell transition options ----------------------------------------------------------------------------\n\n $: if (isObject(data?.transition))\n {\n // Store data.transitions to shorten statements below.\n const d = data.transition;\n\n if (d?.transition !== appProps.transition) { appProps.transition = d.transition; }\n if (d?.inTransition !== appProps.inTransition) { appProps.inTransition = d.inTransition; }\n if (d?.outTransition !== appProps.outTransition) { appProps.outTransition = d.outTransition; }\n if (d?.transitionOptions !== appProps.transitionOptions) { appProps.transitionOptions = d.transitionOptions; }\n\n if (d?.inTransitionOptions !== appProps.inTransitionOptions)\n {\n appProps.inTransitionOptions = d.inTransitionOptions;\n }\n\n if (d?.outTransitionOptions !== appProps.outTransitionOptions)\n {\n appProps.outTransitionOptions = d.outTransitionOptions;\n }\n }\n\n // Modal options --------------------------------------------------------------------------------------------------\n\n $:\n {\n const newModalBackground = typeof data?.modalOptions?.background === 'string' ? data.modalOptions.background :\n s_MODAL_BACKGROUND;\n\n if (newModalBackground !== modalProps.background) { modalProps.background = newModalBackground; }\n }\n\n $:\n {\n const newModalSlotSeparate = typeof data?.modalOptions?.slotSeparate === 'boolean' ?\n data.modalOptions.slotSeparate : void 0;\n\n if (newModalSlotSeparate !== modalProps.slotSeparate) { modalProps.slotSeparate = newModalSlotSeparate; }\n }\n\n $:\n {\n const newModalStyles = isObject(data?.modalOptions?.styles) ? data.modalOptions.styles : void 0;\n\n if (newModalStyles !== modalProps.styles) { modalProps.styles = newModalStyles; }\n }\n\n $: if (isObject(data?.modalOptions?.transition))\n {\n // Store data.transitions to shorten statements below.\n const d = data.modalOptions.transition;\n\n if (d?.transition !== modalProps.transition)\n {\n modalProps.transition = typeof d?.transition === 'function' ? d.transition : s_MODAL_TRANSITION;\n }\n\n if (d?.inTransition !== modalProps.inTransition) { modalProps.inTransition = d.inTransition; }\n if (d?.outTransition !== modalProps.outTransition) { modalProps.outTransition = d.outTransition; }\n\n // Provide default transition options if not defined.\n if (d?.transitionOptions !== modalProps.transitionOptions)\n {\n modalProps.transitionOptions = isObject(d?.transitionOptions) ? d.transitionOptions :\n s_MODAL_TRANSITION_OPTIONS;\n }\n\n if (d?.inTransitionOptions !== modalProps.inTransitionOptions)\n {\n modalProps.inTransitionOptions = d.inTransitionOptions;\n }\n\n if (d?.outTransitionOptions !== modalProps.outTransitionOptions)\n {\n modalProps.outTransitionOptions = d.outTransitionOptions;\n }\n }\n else // Provide a fallback / default glass pane transition when `data.modalOptions.transition` is not defined.\n {\n const newModalTransition = typeof data?.modalOptions?.transition?.transition === 'function' ?\n data.modalOptions.transition.transition : s_MODAL_TRANSITION;\n\n if (newModalTransition !== modalProps.transition) { modalProps.transition = newModalTransition; }\n\n const newModalTransitionOptions = isObject(data?.modalOptions?.transitionOptions) ?\n data.modalOptions.transitionOptions : s_MODAL_TRANSITION_OPTIONS;\n\n if (newModalTransitionOptions !== modalProps.transitionOptions)\n {\n modalProps.transitionOptions = newModalTransitionOptions;\n }\n }\n\n /**\n * Handles closing all open TJSDialog instances when <Esc> key is pressed.\n *\n * @param {KeyboardEvent} event - A KeyboardEvent.\n */\n function onKeydown(event)\n {\n if (event.code === 'Escape')\n {\n event.preventDefault();\n event.stopPropagation();\n application.close();\n }\n }\n\n /**\n * Handles closing any modal window and is assigned to `window` with capture acting before any other browser wide\n * event listeners stopping immediate propagation.\n *\n * @param {KeyboardEvent} event - A KeyboardEvent.\n */\n function onKeydownModal(event)\n {\n if (event.code === 'Escape')\n {\n event.preventDefault();\n event.stopImmediatePropagation();\n application.close();\n }\n }\n</script>\n\n<svelte:options accessors={true}/>\n\n{#if modal}\n <TJSGlassPane id={`${application.id}-glasspane`} {...modalProps} {zIndex}>\n <ApplicationShell bind:elementRoot bind:elementContent {...appProps} appOffsetHeight={true}>\n <DialogContent bind:dialogComponent {data} stopPropagation={true} />\n </ApplicationShell>\n </TJSGlassPane>\n{:else}\n <ApplicationShell bind:elementRoot bind:elementContent {...appProps} appOffsetHeight={true}>\n <DialogContent bind:dialogComponent {data} />\n </ApplicationShell>\n{/if}\n","import { cssVariables } from './cssVariables.js';\n\nexport { default as TJSComponentShell } from './TJSComponentShell.svelte';\nexport { default as TJSContainer } from './TJSContainer.svelte';\nexport { default as TJSGlassPane } from './TJSGlassPane.svelte';\nexport * from './application/index.js';\nexport * from './dialog/index.js';\n\n/**\n * @typedef {object} TransformData\n *\n * @property {Function} transition - A transition applying to both in & out.\n *\n * @property {Function} inTransition - A transition applying to in.\n *\n * @property {Function} outTransition - A transition applying to out.\n *\n * @property {object} transitionOptions - The options config object for in & out transitions.\n *\n * @property {object} inTransitionOptions - The options config object for in transitions.\n *\n * @property {object} outTransitionOptions - The options config object for out transitions.\n */\n\n/**\n * Provides default CSS variables for core components.\n */\ncssVariables.setProperties({\n // Anchor text shadow / header buttons\n '--tjs-default-text-shadow-focus-hover': '0 0 8px var(--color-shadow-primary)',\n\n // TJSApplicationShell app background.\n '--tjs-app-background': `url(\"${globalThis.foundry.utils.getRoute('/ui/denim075.png')}\")`,\n}, false);\n","import {\n deepMerge,\n safeAccess,\n safeSet } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Provides storage for all dialog options adding `get`, `merge` and `set` methods that safely access and update\n * data changed to the mounted DialogShell component reactively.\n */\nexport class TJSDialogData\n{\n /**\n * @type {SvelteApplication}\n */\n #application;\n\n /**\n * Provides configuration of the dialog button bar.\n *\n * @type {Record<string, TJSDialogButtonData>}\n */\n buttons;\n\n /**\n * A Svelte configuration object or HTML string content.\n *\n * @type {object|string}\n */\n content;\n\n /**\n * The default button ID to focus initially.\n *\n * @type {string}\n */\n default;\n\n /**\n * The dialog is draggable when true.\n *\n * @type {boolean}\n */\n draggable;\n\n /**\n * When true auto-management of app focus is enabled.\n *\n * @type {boolean}\n */\n focusAuto;\n\n /**\n * When true the first focusable element that isn't a button is focused.\n *\n * @type {boolean}\n */\n focusFirst;\n\n /**\n * When `focusAuto` and `focusKeep` is true; keeps internal focus.\n *\n * @type {boolean}\n */\n focusKeep;\n\n /**\n * When true the dialog is minimizable.\n *\n * @type {boolean}\n */\n minimizable;\n\n /**\n * When true a modal dialog is displayed.\n *\n * @type {boolean}\n */\n modal;\n\n /**\n * Additional options for modal dialog display.\n *\n * @type {object}\n * TODO: Better specify type / options.\n */\n modalOptions;\n\n /**\n * When true and an error is raised in dialog callback functions post a UI error notification.\n *\n * @type {boolean}\n */\n notifyError;\n\n /**\n * Callback invoked when dialog is closed; no button option selected. When defined as a string any matching function\n * by name exported from content Svelte component is invoked.\n *\n * @type {string|((application: TJSDialog) => any)}\n */\n onClose;\n\n /**\n * When true and a Promise has been created by {@link TJSDialog.wait} and the Promise is not in the process of being\n * resolved or rejected on close of the dialog any `onClose` function is invoked and any result that is undefined\n * will cause the Promise to then be rejected.\n *\n * @type {boolean}\n */\n rejectClose;\n\n /**\n * When true the dialog is resizable.\n *\n * @type {boolean}\n */\n resizable;\n\n /**\n * When true and resolving any Promises and there are undefined results from any button callbacks the button ID is\n * resolved.\n *\n * @type {boolean}\n */\n resolveId;\n\n /**\n * The dialog window title.\n *\n * @type {string}\n */\n title;\n\n /**\n * Transition options for the dialog.\n *\n * @type {object}\n * TODO: Better specify type / options.\n */\n transition;\n\n /**\n * A specific z-index for the dialog. Pass null for the dialog to act like other applications in regard bringing to\n * top when activated.\n *\n * @type {number|null}\n */\n zIndex;\n\n /**\n * @param {SvelteApplication} application - The host Foundry application.\n */\n constructor(application)\n {\n this.#application = application;\n }\n\n /**\n * Provides a way to safely get this dialogs data given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * // TODO DOCUMENT the accessor in more detail.\n *\n * @param {string} accessor - The path / key to set. You can set multiple levels.\n *\n * @param {*} [defaultValue] - A default value returned if the accessor is not found.\n *\n * @returns {*} Value at the accessor.\n */\n get(accessor, defaultValue)\n {\n return safeAccess(this, accessor, defaultValue);\n }\n\n /**\n * @param {object} data - Merge provided data object into Dialog data.\n */\n merge(data)\n {\n deepMerge(this, data);\n\n const component = this.#application.svelte.component(0);\n if (component?.data) { component.data = this; }\n }\n\n /**\n * Provides a way to safely set this dialogs data given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * Automatically the dialog data will be updated in the associated DialogShell Svelte component.\n *\n * // TODO DOCUMENT the accessor in more detail.\n *\n * @param {string} accessor - The path / key to set. You can set multiple levels.\n *\n * @param {*} value - Value to set.\n *\n * @returns {boolean} True if successful.\n */\n set(accessor, value)\n {\n const success = safeSet(this, accessor, value);\n\n // If `this.options` modified then update the app options store.\n if (success)\n {\n const component = this.#application.svelte.component(0);\n if (component?.data) { component.data = this; }\n }\n\n return success;\n }\n}\n","import { DialogShell } from '@typhonjs-fvtt/runtime/svelte/component/core';\n\nimport {\n deepMerge,\n isObject,\n ManagedPromise } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport { TJSDialogData } from './internal/TJSDialogData.js';\nimport { SvelteApplication } from './SvelteApplication.js';\n\n/**\n * Provides a reactive dialog implementation configured from a unique dialog options object. The dialog features a\n * bottom button bar for user selection.\n *\n * A glasspane / modal option with various styling and transition capabilities is available when setting `modal: true`.\n *\n * Most importantly the `content` attribute of dialog data can be a Svelte component configuration object to render\n * your custom component as the dialog content. When using a Svelte component as the content you can assign a string\n * to the various `on<XXX>` dialog callbacks and an exported function from your component will be invoked to handle the\n * button callback. All dialog button callbacks and `onClose` callback receive a single argument which is the dialog /\n * application instance.\n *\n * When making a form with form validation or other dialog that you don't want to close immediately on button press you\n * can set `autoClose: false`, however you are 100% in control of resolving any Promise callbacks from button presses\n * and also closing the application. Each button can also be configured with `autoClose: false` in the button data.\n *\n * There is a handy Promise management capability to track a single Promise for the lifetime of a dialog available\n * at {@link TJSDialog.managedPromise}. By default when the user closes the dialog / application any managed Promise is\n * resolved with `null`. The managed Promise is available in any Svelte content component by using\n * `const managedPromise = getContext('#managedPromise')`. When handling any custom resolution particularly when\n * setting `autoClose: false` for a given button you are 100% in control of resolving or rejecting asynchronous data to\n * return from the dialog.\n *\n * To create and wait upon a managed promise for asynchronous return results use the static or member variation of\n * {@link TJSDialog.wait}.\n *\n * Please refer to {@link TJSDialogOptions} for the various options used to construct the dialog.\n *\n * There are a couple of static helper methods to quickly create standard dialogs such as a 'yes' / 'no' confirmation\n * dialog with {@link TJSDialog.confirm} and an 'ok' single button dialog with {@link TJSDialog.prompt}.\n *\n * TODO: document all extended dialog data parameters such as transition options / modal transitions.\n */\nexport class TJSDialog extends SvelteApplication\n{\n /** @type {TJSDialogData} */\n #data;\n\n /** @type {ManagedPromise} */\n #managedPromise;\n\n /**\n * @param {TJSDialogOptions} data - Dialog options.\n *\n * @param {SvelteApplicationOptions} [options] - SvelteApplication options.\n */\n constructor(data, options = {})\n {\n super(options);\n\n this.#managedPromise = new ManagedPromise();\n\n this.#data = new TJSDialogData(this);\n this.data = data;\n\n /**\n * @member {object} dialogComponent - A getter to SvelteData to retrieve any mounted Svelte component as the\n * dialog content.\n *\n * @memberof GetSvelteData#\n * @readonly\n */\n Object.defineProperty(this.svelte, 'dialogComponent', {\n get: () => this.svelte?.applicationShell?.dialogComponent,\n });\n }\n\n /**\n * Default options for TJSDialog. Provides a default width and setting `height` to `auto` to always display dialog\n * content even if it changes. The default `DialogShell` / `svelte` options should not be changed and instead mount\n * the dialog content component by supplying a Svelte configuration object to dialog data `content` field.\n *\n * @returns {SvelteApplicationOptions} Default options\n */\n static get defaultOptions()\n {\n return deepMerge(super.defaultOptions, {\n classes: ['dialog'],\n width: 400,\n height: 'auto',\n svelte: {\n class: DialogShell,\n intro: true,\n target: document.body,\n props: function() // `this` is the TJSDialog instance when invoked.\n {\n return {\n data: this.#data,\n managedPromise: this.#managedPromise\n };\n }\n }\n });\n }\n\n /**\n * Returns the dialog data.\n *\n * @returns {TJSDialogData} Dialog data.\n */\n get data() { return this.#data; }\n\n /**\n * @returns {ManagedPromise} Returns the managed promise.\n */\n get managedPromise() { return this.#managedPromise; }\n\n /**\n * Sets the dialog data; this is reactive.\n *\n * @param {object} data - Dialog data.\n */\n set data(data)\n {\n if (!isObject(data)) { throw new TypeError(`TJSDialog set data error: 'data' is not an object'.`); }\n\n const descriptors = Object.getOwnPropertyDescriptors(this.#data);\n\n // Remove old data for all configurable descriptors.\n for (const descriptor in descriptors)\n {\n if (descriptors[descriptor].configurable) { delete this.#data[descriptor]; }\n }\n\n // Merge new data and perform a reactive update.\n this.#data.merge(data);\n }\n\n /**\n * Close the dialog and un-register references to it within UI mappings.\n * This function returns a Promise which resolves once the window closing animation concludes.\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {boolean} [options.force] - Force close regardless of render state.\n *\n * @returns {Promise<void>} A Promise which resolves once the application is closed with the callback value or\n * `true`.\n */\n async close(options)\n {\n try\n {\n // Note: When handling a managed promise if a button selection has already been made the managed promise is\n // already processing and the resolution below is skipped.\n if (this.#managedPromise.isActive && !this.#managedPromise.isProcessing)\n {\n const result = TJSDialog.#invokeFn(this.#data.onClose, this, null);\n const rejectClose = typeof this.#data.rejectClose === 'boolean' ? this.#data.rejectClose : false;\n\n if (rejectClose && result === null)\n {\n this.#managedPromise.reject(new Error('TJSDialog was closed without a choice being made.'));\n }\n else\n {\n this.#managedPromise.resolve(result);\n }\n }\n }\n catch (err)\n {\n const notifyError = typeof this.#data.notifyError === 'boolean' ? this.#data.notifyError : true;\n if (notifyError)\n {\n // TODO: When app eventbus is available send event for UI notification instead of Foundry API usage.\n globalThis.ui.notifications.error(err, { console: false });\n }\n\n // If there is a managed Promise reject it or re-throw error.\n if (!this.#managedPromise.reject(err)) { throw err; }\n }\n finally\n {\n await super.close(options);\n }\n }\n\n /**\n * Brings to top or renders this dialog returning a Promise that is resolved any button pressed or when the dialog\n * is closed.\n *\n * Creates an anonymous data defined TJSDialog returning a Promise that can be awaited upon for the user to make a\n * choice.\n *\n * Note: `null` is returned if the dialog is closed without a user making a choice.\n *\n * @template T\n *\n * @param {object} [options] - Options.\n *\n * @param {boolean} [options.reuse=false] - When true if there is an existing managed Promise this allows multiple\n * sources to await on the same result.\n *\n * @returns {Promise<T>} A promise for dialog resolution.\n */\n async wait(options)\n {\n // TODO: Direct usage of Foundry core Application API.\n if (this.rendered)\n {\n this.bringToTop();\n }\n else\n {\n this.render(true, { focus: true });\n }\n\n // Return a managed Promise which is automatically resolved on button press via `DialogContent` component or when\n // the dialog is closed.\n return this.#managedPromise.create(options);\n }\n\n // ---------------------------------------------------------------------------------------------------------------\n\n /**\n * A helper factory method to create simple confirmation dialog windows which consist of simple yes / no prompts.\n * If you require more flexibility, a custom TJSDialog instance is preferred. The default focused button is 'yes'.\n * You can change the default focused button by setting `default` to `yes` or `no`.\n *\n * @template T\n *\n * @param {TJSDialogOptions} data - Confirm dialog options.\n *\n * @param {string|((application: TJSDialog) => any)} [data.onYes] - Callback function upon `yes`; may be an async\n * function. When defined as a string any matching function by name exported from content Svelte component is\n * invoked.\n *\n * @param {string|((application: TJSDialog) => any)} [data.onNo] - Callback function upon `no`; may be an async\n * function. When defined as a string any matching function by name exported from content Svelte component is\n * invoked.\n *\n * @param {SvelteApplicationOptions} [options] SvelteApplication options passed to the TJSDialog constructor.\n *\n * @returns {Promise<T>} A promise which resolves with result of yes / no callbacks or true / false.\n *\n * @example\n * const result = await TJSDialog.confirm({\n * title: 'A Yes or No Question',\n * content: '<p>Choose wisely.</p>',\n * onYes: () => 'YES Result'\n * onNo: () => 'NO Result'\n * });\n *\n * // Logs 'YES result', 'NO Result', or null if the user closed the dialog without making a selection.\n * console.log(result);\n */\n static async confirm({ onYes, onNo, ...data } = {}, options = {})\n {\n // Allow overwriting of default icon and labels.\n const mergedButtons = deepMerge({\n yes: {\n icon: 'fas fa-check',\n label: 'Yes'\n },\n no: {\n icon: 'fas fa-times',\n label: 'No',\n }\n }, data.buttons ?? {});\n\n return this.wait({\n ...data,\n buttons: deepMerge(mergedButtons, {\n yes: {\n onPress: (application) => this.#invokeFn(onYes, application, true)\n },\n no: {\n onPress: (application) => this.#invokeFn(onNo, application, false)\n }\n }),\n default: data.default ?? 'yes'\n }, options);\n }\n\n /**\n * A helper method to invoke a callback function directly or lookup an exported function with the same name from any\n * content Svelte component to invoke. This is used internally to apply default values for `confirm` and `prompt`.\n *\n * @param {string|((application: TJSDialog) => any)} callback - Callback function to invoke; may be an async\n * function. When defined as a string any matching function by name exported from content Svelte component is\n * invoked.\n *\n * @param {TJSDialog} application - TJSDialog instance passed to callback.\n *\n * @param {*} [defaultResult] - An optional default result to return; undefined if not specified.\n *\n * @returns {*} Result.\n */\n static #invokeFn(callback, application, defaultResult = void 0)\n {\n let result = defaultResult;\n\n switch (typeof callback)\n {\n case 'function':\n // Pass the dialog instance to the callback.\n result = callback(application);\n break;\n\n case 'string':\n {\n const dialogComponent = application?.svelte?.dialogComponent;\n\n // Attempt lookup by function name in dialog instance component.\n if (dialogComponent !== void 0 && typeof dialogComponent?.[callback] === 'function')\n {\n result = dialogComponent?.[callback](application);\n }\n else\n {\n if (dialogComponent === void 0)\n {\n console.warn(`[TRL] TJSDialog warning: 'onPress' defined as a string with no ` +\n `associated content Svelte component.`);\n }\n else if (typeof dialogComponent?.[callback] !== 'function')\n {\n console.warn(`[TRL] TJSDialog warning: The content Svelte component does not contain ` +\n `an associated function '${callback}'. Did you remember to add ` +\n `'<svelte:options accessors={true} />' and export the function?`);\n }\n }\n break;\n }\n }\n\n return result;\n }\n\n /**\n * A helper factory method to display a basic \"prompt\" style TJSDialog with a single button.\n *\n * @template T\n *\n * @param {TJSDialogOptions} [data] - Prompt dialog options.\n *\n * @param {string|((application: TJSDialog) => any)} [data.onOk] - Callback function upon `ok`; may be an async\n * function. When defined as a string any matching function by name exported from content Svelte component is\n * invoked.\n *\n * @param {string} [data.label] - The OK prompt button text.\n *\n * @param {string} [data.icon=\"fas fa-check\"] - Set another icon besides `fas fa-check` for button.\n *\n * @param {SvelteApplicationOptions} [options] SvelteApplication options passed to the TJSDialog constructor.\n *\n * @returns {Promise<T>} The returned value from the provided callback function or `true` if the button\n * is pressed.\n *\n * @example\n * const result = await TJSDialog.prompt({\n * title: 'Are you OK?',\n * content: '<p>Are you OK?.</p>',\n * label: 'Feeling Fine!'\n * onOk: () => 'OK'\n * });\n *\n * // Logs 'OK' or null if the user closed the dialog without making a selection.\n * console.log(result);\n */\n static async prompt({ onOk, label, icon = 'fas fa-check', ...data } = {}, options = {})\n {\n return this.wait({\n ...data,\n buttons: {\n ok: {\n icon,\n label,\n onPress: (application) => this.#invokeFn(onOk, application, true)\n }\n },\n default: 'ok'\n }, options);\n }\n\n /**\n * Creates an anonymous data defined TJSDialog returning a Promise that can be awaited upon for the user to make a\n * choice.\n *\n * Note: By default `null` is returned if the dialog is closed without a user making a choice.\n *\n * @template T\n *\n * @param {TJSDialogOptions} data - Dialog data passed to the TJSDialog constructor.\n *\n * @param {SvelteApplicationOptions} [options] SvelteApplication options passed to the TJSDialog constructor.\n *\n * @returns {Promise<T>} A Promise that resolves to the chosen result.\n */\n static async wait(data, options = {})\n {\n if (!isObject(data)) { throw new TypeError(`TJSDialog.wait error: 'data' is not an object'.`); }\n\n // Instantiate and render the dialog.\n return new this({ ...data }, options).wait();\n }\n}\n\n/**\n * @typedef {object} TJSDialogOptions - Defines the common dialog configuration data.\n *\n * @property {Record<string, TJSDialogButtonData>} [buttons={}] - Provides configuration of the dialog button bar.\n *\n * @property {object|string} content - A Svelte configuration object or HTML string content.\n *\n * @property {string} [default] - The default button ID to focus initially.\n *\n * @property {boolean} [draggable=true] - The dialog is draggable when true.\n *\n * @property {boolean} [focusAuto=true] - When true auto-management of app focus is enabled.\n *\n * @property {boolean} [focusFirst=false] - When true the first focusable element that isn't a button is focused.\n *\n * @property {boolean} [focusKeep=false] - When `focusAuto` and `focusKeep` is true; keeps internal focus.\n *\n * @property {boolean} [focusTrap=true] - When true focus trapping / wrapping is enabled keeping focus inside app.\n *\n * @property {boolean} [minimizable=true] - When true the dialog is minimizable.\n *\n * @property {boolean} [modal=false] - When true a modal dialog is displayed.\n *\n * @property {object} [modalOptions] - Additional options for modal dialog display.\n *\n * @property {boolean} [notifyError=true] - When true and an error is raised in dialog callback functions post a UI\n * error notification.\n *\n * @property {string|((application: TJSDialog) => any)} [onClose] - Callback invoked when dialog is closed; no button\n * option selected. When defined as a string any matching function by name exported from content Svelte\n * component is invoked.\n *\n * @property {boolean} [rejectClose=false] - When true and a Promise has been created by {@link TJSDialog.wait} and\n * the Promise is not in the process of being resolved or rejected on close of the dialog any `onClose`\n * function is invoked and any result that is undefined will cause the Promise to then be rejected.\n *\n * @property {boolean} [resizable=false] - When true the dialog is resizable.\n *\n * @property {boolean} [resolveId=false] - When true and resolving any Promises and there are undefined results from\n * any button callbacks the button ID is resolved.\n *\n * @property {string} [title] - The dialog window title.\n *\n * @property {object} [transition] - Transition options for the dialog.\n *\n * @property {number|null} [zIndex] - A specific z-index for the dialog. Pass null for the dialog to act like other\n * applications in regard bringing to top when activated.\n */\n\n/**\n * @typedef {object} TJSDialogButtonData - TJSDialog button data.\n *\n * @property {boolean} [autoClose=true] - When false the dialog does not automatically close when button selected.\n *\n * @property {boolean|(() => boolean)} [condition] - Determines if the button is accessible providing a truthy value.\n *\n * @property {string} [label] - Button label; will be localized.\n *\n * @property {string} [icon] - Button icon; you should supply the direct Font Awesome class names: IE \"fas fa-check\".\n *\n * @property {string|((application: TJSDialog) => any)} [onPress] - Callback for button press. When defined as a\n * string any matching function by name exported from content Svelte component is invoked.\n *\n * @property {Record<string, string>} [styles] - Inline styles to apply to the button.\n */\n","import { SvelteApplication } from './SvelteApplication.js';\n\nexport * from './SvelteApplication.js';\nexport * from './TJSDialog.js';\n\n// TODO: temporary\nexport * from './position/Position.js';\n\n// Handle `PopOut!` module hooks to allow applications to popout to their own browser window -------------------------\n\nHooks.on('PopOut:loading', (app) =>\n{\n if (app instanceof SvelteApplication) { app.position.enabled = false; }\n});\n\nHooks.on('PopOut:popin', (app) =>\n{\n if (app instanceof SvelteApplication) { app.position.enabled = true; }\n});\n\nHooks.on('PopOut:close', (app) =>\n{\n if (app instanceof SvelteApplication) { app.position.enabled = true; }\n});\n\n/**\n * @typedef {object} MountedAppShell - Application shell contract for Svelte components.\n *\n * @property {HTMLElement} elementRoot - The root element / exported prop.\n *\n * @property {HTMLElement} [elementContent] - The content element / exported prop.\n *\n * @property {HTMLElement} [elementTarget] - The target element / exported prop.\n */\n\n/**\n * @typedef {ApplicationShell} ApplicationShellExt\n *\n * @property {SvelteReactive} reactive -\n *\n * @property {object} options -\n *\n * @property {Position} position -\n */\n\n/**\n * @typedef {object} StoreAppOptions - Provides a custom readable Svelte store for Application options state.\n *\n * @property {import('svelte/store').Readable<object>} subscribe - Subscribe to all app options updates.\n *\n * @property {import('svelte/store').Writable<boolean>} draggable - Derived store for `draggable` updates.\n *\n * @property {import('svelte/store').Writable<boolean>} focusAuto - Derived store for `focusAuto` updates.\n *\n * @property {import('svelte/store').Writable<boolean>} focusKeep - Derived store for `focusKeep` updates.\n *\n * @property {import('svelte/store').Writable<boolean>} focusTrap - Derived store for `focusTrap` updates.\n *\n * @property {import('svelte/store').Writable<boolean>} headerButtonNoClose - Derived store for `headerButtonNoClose`\n * updates.\n *\n * @property {import('svelte/store').Writable<boolean>} headerButtonNoLabel - Derived store for `headerButtonNoLabel`\n * updates.\n *\n * @property {import('svelte/store').Writable<string>} headerIcon - Derived store for `headerIcon` updates.\n *\n * @property {import('svelte/store').Writable<boolean>} headerNoTitleMinimized - Derived store for\n * `headerNoTitleMinimized` updates.\n *\n * @property {import('svelte/store').Writable<boolean>} minimizable - Derived store for `minimizable` updates.\n *\n * @property {import('svelte/store').Writable<boolean>} popOut - Derived store for `popOut` updates.\n *\n * @property {import('svelte/store').Writable<boolean>} positionable - Derived store for `positionable` updates.\n *\n * @property {import('svelte/store').Writable<boolean>} resizable - Derived store for `resizable` updates.\n *\n * @property {import('svelte/store').Writable<string>} title - Derived store for `title` updates.\n */\n\n/**\n * @typedef {object} StoreUIOptions - Provides a custom readable Svelte store for UI options state.\n *\n * @property {import('svelte/store').Readable.subscribe} subscribe - Subscribe to all UI options updates.\n *\n * @property {import('svelte/store').Writable<boolean>} dragging - Derived store for `dragging` updates.\n *\n * @property {import('svelte/store').Readable<ApplicationHeaderButton[]>} headerButtons - Derived store for\n * `headerButtons` updates.\n *\n * @property {import('svelte/store').Readable<boolean>} minimized - Derived store for `minimized` updates.\n *\n * @property {import('svelte/store').Writable<boolean>} resizing - Derived store for `resizing` updates.\n */\n\n/**\n * @typedef {object} TransformData\n *\n * @property {Function} transition - A transition applying to both in & out.\n *\n * @property {Function} inTransition - A transition applying to in.\n *\n * @property {Function} outTransition - A transition applying to out.\n *\n * @property {object} transitionOptions - The options config object for in & out transitions.\n *\n * @property {object} inTransitionOptions - The options config object for in transitions.\n *\n * @property {object} outTransitionOptions - The options config object for out transitions.\n */\n","<script>\r\n\r\n export let item;\r\n\r\n</script>\r\n\r\n<form>\r\n\r\n\t<header class=\"sheet-header\">\r\n\t\t<img data-edit=\"img\" src={item.img}>\r\n\t\t<div class=\"details\">\r\n\t\t\t<input disabled name=\"name\" placeholder=\"Name\" spellcheck=\"false\" type=\"text\" value={item.name}/>\r\n\r\n\t\t\t<span class=\"level\">\r\n\t\t\t\t\t<span>Item</span>\r\n\t\t\t\t\t<input data-property=\"system.level.value\" disabled type=\"text\" value=\"?\">\r\n\t\t\t</span>\r\n\t\t\t<template class=\"traits-extra\"></template>\r\n\t\t\t<!-- showTraits true -->\r\n\t\t\t<tags class=\"tagify paizo-style tags tagify--noTags tagify--empty\" data-name=\"system.traits.value\" disabled=\"\"\r\n\t\t\t\t\t\ttabindex=\"-1\">\r\n\t\t\t\t<select class=\"tag\">\r\n\t\t\t\t\t<option value=\"common\">Unknown</option>\r\n\t\t\t\t</select>\r\n\r\n\t\t\t\t<span aria-autocomplete=\"both\" aria-multiline=\"false\" aria-placeholder=\"Traits\" class=\"tagify__input\"\r\n\t\t\t\t\t\t\tdata-placeholder=\"Traits\"\r\n\t\t\t\t\t\t\trole=\"textbox\" tabindex=\"0\"></span>\r\n\t\t\t\t\r\n\t\t\t</tags>\r\n\t\t\t<input class=\"paizo-style tags\" data-dtype=\"JSON\" disabled=\"\" name=\"system.traits.value\" placeholder=\"Traits\"\r\n\t\t\t\t\t\t tabindex=\"-1\" value=\"[]\">\r\n\t\t</div>\r\n\t</header>\r\n\r\n\t<span style=\"padding: 0.5rem;\">\r\n\t\t{@html item.system.description.value}\r\n\t</span>\r\n\r\n</form>\r\n\r\n<style lang=\"scss\">\r\n\r\n</style>\r\n","import { TJSDialog } from \"@typhonjs-fvtt/runtime/svelte/application\";\r\nimport BasicItemDialog from \"../applications/components/BasicItemDialog.svelte\";\r\n\r\nexport default {\r\n\r\n \"VERSION\": \"1.0.4\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"loot\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // The quantity for price attribute is the path to the attribute on each item that determine how many you get for its price\r\n \"QUANTITY_FOR_PRICE_ATTRIBUTE\": \"system.price.per\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [{\r\n \"path\": \"type\",\r\n \"filters\": 'action,ancestry,background,class,condition,deity,effect,feat,heritage,lore,melee,spell,spellcastingEntry'\r\n }],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\", \"system.temporary.value\"],\r\n\r\n // This function is an optional system handler that specifically transforms an item's price into a more unified numeric format\r\n \"ITEM_COST_TRANSFORMER\": (item) => {\r\n const itemCost = getProperty(item, \"system.price\");\r\n const { copperValue } = new game.pf2e.Coins(itemCost?.value ?? {});\r\n return copperValue / 100;\r\n },\r\n\r\n \"PREVIEW_ITEM_TRANSFORMER\": (item) => {\r\n if (game.user.isGM || item?.identificationStatus !== \"unidentified\") return item;\r\n new TJSDialog({\r\n title: item.name,\r\n content: {\r\n class: BasicItemDialog,\r\n props: {\r\n item\r\n }\r\n }\r\n }, {\r\n classes: [\"pf2e item sheet dorako-ui\"],\r\n resizable: false,\r\n height: \"auto\",\r\n width: \"auto\"\r\n }).render(true);\r\n return false;\r\n },\r\n\r\n \"PILE_DEFAULTS\": {\r\n merchantColumns: [{\r\n \"label\": \"Rarity\",\r\n \"path\": \"system.traits.rarity\",\r\n \"formatting\": \"{#}\",\r\n \"buying\": true,\r\n \"selling\": true,\r\n \"mapping\": {\r\n \"common\": \"PF2E.TraitCommon\",\r\n \"uncommon\": \"PF2E.TraitUncommon\",\r\n \"rare\": \"PF2E.TraitRare\",\r\n \"unique\": \"PF2E.TraitUnique\"\r\n }\r\n }, {\r\n \"label\": \"Bulk\",\r\n \"path\": \"system.bulk.value\",\r\n \"formatting\": \"{#}\",\r\n \"buying\": true,\r\n \"selling\": true,\r\n \"mapping\": { \"0\": \"\" }\r\n }]\r\n },\r\n\r\n \"TOKEN_FLAG_DEFAULTS\": {\r\n flags: {\r\n pf2e: {\r\n linkToActorSize: false,\r\n autoscale: false\r\n }\r\n }\r\n },\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()`, put it into `data.item`, and strip out any module data\r\n \"CURRENCIES\": [{\r\n type: \"item\",\r\n name: \"Platinum Pieces\",\r\n img: \"systems/pf2e/icons/equipment/treasure/currency/platinum-pieces.webp\",\r\n abbreviation: \"{#}PP\",\r\n data: {\r\n uuid: \"Compendium.pf2e.equipment-srd.JuNPeK5Qm1w6wpb4\"\r\n },\r\n primary: false,\r\n exchangeRate: 10\r\n }, {\r\n type: \"item\",\r\n name: \"Gold Pieces\",\r\n img: \"systems/pf2e/icons/equipment/treasure/currency/gold-pieces.webp\",\r\n abbreviation: \"{#}GP\",\r\n data: {\r\n uuid: \"Compendium.pf2e.equipment-srd.B6B7tBWJSqOBz5zz\"\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n }, {\r\n type: \"item\",\r\n name: \"Silver Pieces\",\r\n img: \"systems/pf2e/icons/equipment/treasure/currency/silver-pieces.webp\",\r\n abbreviation: \"{#}SP\",\r\n data: {\r\n uuid: \"Compendium.pf2e.equipment-srd.5Ew82vBF9YfaiY9f\"\r\n },\r\n primary: false,\r\n exchangeRate: 0.1\r\n }, {\r\n type: \"item\",\r\n name: \"Copper Pieces\",\r\n img: \"systems/pf2e/icons/equipment/treasure/currency/copper-pieces.webp\",\r\n abbreviation: \"{#}CP\",\r\n data: {\r\n uuid: \"Compendium.pf2e.equipment-srd.lzJ8AVhRcbFul5fh\"\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n }]\r\n}\r\n","// Item Piles Definitions for Foundry VTT Game System Dungeonslayers 4\n\nexport default {\n\n \"VERSION\": \"1.0.2\",\n\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\n \"ACTOR_CLASS_TYPE\": \"character\",\n\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\n\n // The item price attribute is the path to the attribute on each item that determine how much it costs\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\n\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\n \"ITEM_FILTERS\": [\n {\n \"path\": \"type\",\n \"filters\": \"spell,talent,racialAbility,language,alphabet,specialCreatureAbility\"\n }\n ],\n\n // Item similarities determines how item piles detect similarities and differences in the system\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\n\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\n // In the case of attributes, the path is relative to the \"actor.system\"\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\n \"CURRENCIES\": [\n {\n type: \"attribute\",\n name: \"DS4.CharacterCurrencyGold\",\n img: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\n abbreviation: \"{#}G\",\n data: {\n path: \"system.currency.gold\",\n },\n primary: true,\n exchangeRate: 1\n },\n {\n type: \"attribute\",\n name: \"DS4.CharacterCurrencySilver\",\n img: \"icons/commodities/currency/coin-inset-snail-silver.webp\",\n abbreviation: \"{#}S\",\n data: {\n path: \"system.currency.silver\",\n },\n primary: false,\n exchangeRate: 0.1\n },\n {\n type: \"attribute\",\n name: \"DS4.CharacterCurrencyCopper\",\n img: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\n abbreviation: \"{#}C\",\n data: {\n path: \"system.currency.copper\",\n },\n primary: false,\n exchangeRate: 0.01\n }\n ]\n}\n","export default {\r\n\r\n \"VERSION\": \"1.0.2\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"npc\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"spell,feat,class,race,attack,full-attack,buff,aura,alignment,enhancement,damage-type,material\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"DND5E.CurrencyPP\",\r\n img: \"icons/commodities/currency/coin-inset-snail-silver.webp\",\r\n abbreviation: \"{#}PP\",\r\n data: {\r\n path: \"system.currency.pp\"\r\n },\r\n primary: false,\r\n exchangeRate: 10\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND5E.CurrencyGP\",\r\n img: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\r\n abbreviation: \"{#}GP\",\r\n data: {\r\n path: \"system.currency.gp\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND5E.CurrencySP\",\r\n img: \"icons/commodities/currency/coin-engraved-moon-silver.webp\",\r\n abbreviation: \"{#}SP\",\r\n data: {\r\n path: \"system.currency.sp\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"DND5E.CurrencyCP\",\r\n img: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\r\n abbreviation: \"{#}CP\",\r\n data: {\r\n path: \"system.currency.cp\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n }\r\n ]\r\n}\r\n","export default {\n\n \"VERSION\": \"1.0.2\",\n\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\n \"ACTOR_CLASS_TYPE\": \"npc2\",\n\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\n\n // The item price attribute is the path to the attribute on each item that determine how much it costs\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\n\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\n \"ITEM_FILTERS\": [\n {\n \"path\": \"type\",\n \"filters\": \"attack,buff,class,feat,race,spell\"\n }\n ],\n\n // Item similarities determines how item piles detect similarities and differences in the system\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\n\n \"CURRENCIES\": [\n {\n type: \"attribute\",\n name: \"SFRPG.Currencies.Credits\",\n img: \"systems/sfrpg/icons/equipment/goods/credstick.webp\",\n abbreviation: \"{#}C\",\n data: {\n path: \"system.currency.credit\",\n },\n primary: true,\n exchangeRate: 1\n },\n {\n type: \"attribute\",\n name: \"SFRPG.Currencies.UPBs\",\n img: \"systems/sfrpg/icons/equipment/goods/upb.webp\",\n abbreviation: \"{#} UBP\",\n data: {\n path: \"system.currency.upb\",\n },\n primary: false,\n exchangeRate: 1\n }\n ],\n\n \"CURRENCY_DECIMAL_DIGITS\": 0.01\n}\n","export default {\r\n\r\n \"VERSION\": \"1.0.4\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"edge,hindrance,skill,power,ability\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"SWADE.Currency\",\r\n img: \"icons/svg/coins.svg\",\r\n abbreviation: \"{#}T\",\r\n data: {\r\n path: \"system.details.currency\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n }\r\n ],\r\n\r\n \"CURRENCY_DECIMAL_DIGITS\": 0.01\r\n\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.2\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.qtd\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price.gc\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"magia,poder,classe\"\r\n },\r\n {\r\n \"path\": \"system.tipoUso\",\r\n \"filters\": \"nat\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"Ouro\",\r\n img: \"icons/commodities/currency/coin-embossed-insect-gold.webp\",\r\n abbreviation: \"{#}O\",\r\n data: {\r\n path: \"system.dinheiro.to\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Prata\",\r\n img: \"icons/commodities/currency/coin-embossed-unicorn-silver.webp\",\r\n abbreviation: \"{#}P\",\r\n data: {\r\n path: \"system.dinheiro.tp\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Cobre\",\r\n img: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\r\n abbreviation: \"{#}C\",\r\n data: {\r\n path: \"system.dinheiro.tc\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n }\r\n ]\r\n}\r\n","import CONSTANTS from \"../constants/constants.js\";\r\n\r\nexport default {\r\n\r\n \"VERSION\": \"1.0.7\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity.value\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"career,container,critical,disease,injury,mutation,prayer,psychology,talent,skill,spell,trait,extendedTest,vehicleMod,cargo\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // This function is an optional system handler that specifically transforms an item's price into a more unified numeric format\r\n \"ITEM_COST_TRANSFORMER\": (item) => {\r\n let overallCost = 0;\r\n const prices = getProperty(item, \"system.price\");\r\n overallCost += (Number(prices?.[\"gc\"]) ?? 0) * 240;\r\n overallCost += (Number(prices?.[\"ss\"]) ?? 0) * 12;\r\n overallCost += (Number(prices?.[\"bp\"]) ?? 0) * 1;\r\n return overallCost;\r\n },\r\n\r\n \"PILE_TYPE_DEFAULTS\": {\r\n [CONSTANTS.PILE_TYPES.MERCHANT]: {\r\n merchantColumns: [{\r\n label: \"Availability\",\r\n path: \"system.availability.value\"\r\n }],\r\n }\r\n },\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"item\",\r\n name: \"Gold Crown\",\r\n img: \"modules/wfrp4e-core/icons/currency/goldcrown.png\",\r\n abbreviation: \"{#}GC\",\r\n data: {\r\n item: {\r\n \"name\": \"Gold Crown\",\r\n \"type\": \"money\",\r\n \"img\": \"modules/wfrp4e-core/icons/currency/goldcrown.png\",\r\n \"system\": {\r\n \"quantity\": { \"type\": \"Number\", \"label\": \"Quantity\", \"value\": 1 },\r\n \"encumbrance\": { \"type\": \"Number\", \"label\": \"Encumbrance\", \"value\": 0.005 },\r\n \"coinValue\": { \"label\": \"Value (in d)\", \"type\": \"Number\", \"value\": 240 },\r\n \"source\": { \"type\": \"String\", \"label\": \"Source\" }\r\n }\r\n }\r\n },\r\n primary: false,\r\n exchangeRate: 240\r\n },\r\n {\r\n type: \"item\",\r\n name: \"Silver Shilling\",\r\n img: \"modules/wfrp4e-core/icons/currency/silvershilling.png\",\r\n abbreviation: \"{#}SS\",\r\n data: {\r\n item: {\r\n \"name\": \"Silver Shilling\",\r\n \"type\": \"money\",\r\n \"img\": \"modules/wfrp4e-core/icons/currency/silvershilling.png\",\r\n \"system\": {\r\n \"quantity\": { \"type\": \"Number\", \"label\": \"Quantity\", \"value\": 1 },\r\n \"encumbrance\": { \"type\": \"Number\", \"label\": \"Encumbrance\", \"value\": 0.01 },\r\n \"coinValue\": { \"label\": \"Value (in d)\", \"type\": \"Number\", \"value\": 12 },\r\n \"source\": { \"type\": \"String\", \"label\": \"Source\" }\r\n }\r\n }\r\n },\r\n primary: false,\r\n exchangeRate: 12\r\n },\r\n {\r\n type: \"item\",\r\n name: \"Brass Penny\",\r\n img: \"modules/wfrp4e-core/icons/currency/brasspenny.png\",\r\n abbreviation: \"{#}BP\",\r\n data: {\r\n item: {\r\n \"name\": \"Brass Penny\",\r\n \"type\": \"money\",\r\n \"img\": \"modules/wfrp4e-core/icons/currency/brasspenny.png\",\r\n \"system\": {\r\n \"quantity\": { \"type\": \"Number\", \"label\": \"Quantity\", \"value\": 1 },\r\n \"encumbrance\": { \"type\": \"Number\", \"label\": \"Encumbrance\", \"value\": 0.01 },\r\n \"coinValue\": { \"label\": \"Value (in d)\", \"type\": \"Number\", \"value\": 1 },\r\n \"source\": { \"type\": \"String\", \"label\": \"Source\" }\r\n }\r\n }\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n }\r\n ]\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.4\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"npc\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"spell,strength,weakness,mastery,species,culture,ancestry,education,resource,npcfeature,moonsign,language,culturelore,statuseffect,spelleffect,npcattack\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\", \"system.sufferedDamage\", \"system.quality\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"Solare\",\r\n img: \"icons/commodities/currency/coins-assorted-mix-copper.webp\",\r\n abbreviation: \"{#}S\",\r\n data: {\r\n path: \"system.currency.S\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Lunare\",\r\n img: \"icons/commodities/currency/coins-assorted-mix-silver.webp\",\r\n abbreviation: \"{#}L\",\r\n data: {\r\n path: \"system.currency.L\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Telare\",\r\n img: \"icons/commodities/currency/coins-assorted-mix-platinum.webp\",\r\n abbreviation: \"{#}T\",\r\n data: {\r\n path: \"system.currency.T\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.0001\r\n }\r\n ]\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.1\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.cost\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"criticalInjury,monsterAttack,monsterTalent\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"Gold\",\r\n img: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\r\n abbreviation: \"{#}GP\",\r\n data: {\r\n path: \"system.currency.gold\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Silver\",\r\n img: \"icons/commodities/currency/coin-engraved-moon-silver.webp\",\r\n abbreviation: \"{#}SP\",\r\n data: {\r\n path: \"system.currency.silver\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Copper\",\r\n img: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\r\n abbreviation: \"{#}CP\",\r\n data: {\r\n path: \"system.currency.copper\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n }\r\n ]\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.3\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"ability\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"Coin\",\r\n img: \"icons/svg/coins.svg\",\r\n abbreviation: \"{#}C\",\r\n data: {\r\n path: \"system.coin.value\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n }\r\n ],\r\n\r\n \"CURRENCY_DECIMAL_DIGITS\": 0.01\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.2\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"affiliation,background,class,beast quality,destiny,feat,forcePower,forceRegimen,forceSecret,forceTechnique,species,talent,template,trait,vehicleSystem\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"type\", \"name\", \"strippable\", \"hasPrerequisites\", \"modifiable\", \"hasLevels\"],\r\n\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"Credits\",\r\n img: \"icons/svg/coins.svg\",\r\n abbreviation: \"{#}C\",\r\n data: {\r\n path: \"system.common.credits\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n }\r\n ],\r\n\r\n \"CURRENCY_DECIMAL_DIGITS\": 0.01\r\n}\r\n","export default {\n VERSION: \"1.0.1\",\n\n ACTOR_CLASS_TYPE: \"character\",\n\n ITEM_QUANTITY_ATTRIBUTE: \"system.quantity\",\n\n ITEM_PRICE_ATTRIBUTE: \"system.price.value\",\n\n ITEM_FILTERS: [\n {\n path: \"type\",\n filters: \"power,feat,class,archetype,background\",\n },\n {\n path: \"system.weaponType\",\n filters: \"natural\",\n },\n ],\n\n ITEM_TRANSFORMER: async (itemData, actor = false) => {\n [\"equipped\", \"proficient\", \"prepared\"].forEach((key) => {\n if (itemData?.system?.[key] !== void 0) {\n delete itemData.system[key];\n }\n });\n setProperty(\n itemData,\n \"system.attunement\",\n Math.min(\n CONFIG.SW5E.attunementTypes.REQUIRED,\n itemData?.system?.attunement ?? 0\n )\n );\n return itemData;\n },\n\n ITEM_SIMILARITIES: [\"name\", \"type\"],\n\n CURRENCIES: [\n {\n type: \"attribute\",\n name: \"SW5E.CurrencyGC\",\n img: \"systems/sw5e/packs/Icons/Data Recording and Storage/CreditChip.webp\",\n abbreviation: \"{#}GC\",\n data: {\n path: \"system.currency.gc\",\n },\n primary: true,\n exchangeRate: 1,\n },\n ],\n};\n","export default {\n VERSION: \"1.0.1\",\n\n ACTOR_CLASS_TYPE: \"character\",\n\n ITEM_QUANTITY_ATTRIBUTE: \"system.quantity\",\n\n ITEM_PRICE_ATTRIBUTE: \"system.price\",\n\n ITEM_FILTERS: [\n {\n path: \"type\",\n filters: \"power,feat,class,archetype,background\",\n },\n {\n path: \"system.weaponType\",\n filters: \"natural\",\n },\n ],\n\n ITEM_TRANSFORMER: async (itemData, actor = false) => {\n [\"equipped\", \"proficient\", \"prepared\"].forEach((key) => {\n if (itemData?.system?.[key] !== void 0) {\n delete itemData.system[key];\n }\n });\n setProperty(\n itemData,\n \"system.attunement\",\n Math.min(\n CONFIG.SW5E.attunementTypes.REQUIRED,\n itemData?.system?.attunement ?? 0\n )\n );\n return itemData;\n },\n\n ITEM_SIMILARITIES: [\"name\", \"type\"],\n\n CURRENCIES: [\n {\n type: \"attribute\",\n name: \"SW5E.CurrencyGC\",\n img: \"systems/sw5e/packs/Icons/Data Recording and Storage/CreditChip.webp\",\n abbreviation: \"{#}GC\",\n data: {\n path: \"system.currency.gc\",\n },\n primary: true,\n exchangeRate: 1,\n },\n ],\n};\n","export default {\r\n\r\n \"VERSION\": \"1.0.3\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.cost\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"skill,perk,special_ability\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"FALLOUT.UI.CAPS\",\r\n img: \"icons/commodities/currency/coins-engraved-copper.webp\",\r\n abbreviation: \"{#}C\",\r\n data: {\r\n path: \"system.currency.caps\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n }\r\n ],\r\n\r\n \"CURRENCY_DECIMAL_DIGITS\": 0.01\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.3\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.amount\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price.market\",\r\n\r\n // Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"role, skill, criticalInjury\"\r\n },\r\n {\r\n \"path\": \"system.isInstalled\",\r\n \"filters\": [true]\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"CPR.characterSheet.rightPane.eurobucks.eurobucks\",\r\n img: \"icons/svg/coins.svg\",\r\n abbreviation: \"{#}€$\",\r\n data: {\r\n path: \"system.wealth.value\"\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n }\r\n ],\r\n\r\n \"CURRENCY_DECIMAL_DIGITS\": 0.01\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.0\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.coppers\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"spell\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": []\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.0\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.qty\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"specialty,injury\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": []\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.0\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"npc\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.cost\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"injury, shipProblem, shipCriticalDamage, shipLogbook\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"YZECORIOLIS.Birr\",\r\n img: \"icons/commodities/currency/coin-inset-insect-gold.webp\",\r\n abbreviation: \"{#}B\",\r\n data: {\r\n path: \"system.birr\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n }\r\n ],\r\n\r\n \"CURRENCY_DECIMAL_DIGITS\": 0.01\r\n}\r\n","export default {\n\n \"VERSION\": \"1.0.0\",\n\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\n \"ACTOR_CLASS_TYPE\": \"character\",\n\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\n\n // The item price attribute is the path to the attribute on each item that determine how much it costs\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\n\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\n \"ITEM_FILTERS\": [\n {\n \"path\": \"type\",\n \"filters\": \"talent,attackOption,race,style,facade,bond\"\n }\n ],\n\n // Item similarities determines how item piles detect similarities and differences in the system\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\n\n \"CURRENCIES\": [\n {\n type: \"attribute\",\n name: \"KG.Money\",\n img: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\n abbreviation: \"{#}G\",\n data: {\n path: \"system.attributes.money\",\n },\n primary: true,\n exchangeRate: 1\n }\n ],\n\n \"CURRENCY_DECIMAL_DIGITS\": 0.01\n}\n","export default {\r\n\r\n \"VERSION\": \"1.0.0\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"monster\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.number\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.cost\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"ability,boon,burden,mysticalPower,ritual,trait\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"Thaler\",\r\n img: \"icons/commodities/currency/coins-assorted-mix-copper.webp\",\r\n abbreviation: \"{#}T\",\r\n data: {\r\n path: \"system.money.thaler\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Shilling\",\r\n img: \"icons/commodities/currency/coins-assorted-mix-silver.webp\",\r\n abbreviation: \"{#}S\",\r\n data: {\r\n path: \"system.money.shilling\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Orteg\",\r\n img: \"icons/commodities/currency/coins-assorted-mix-platinum.webp\",\r\n abbreviation: \"{#}O\",\r\n data: {\r\n path: \"system.money.orteg\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n }\r\n ]\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.0\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"ability, art, asset, focus, skill, spell\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"WWN.items.PP.long\",\r\n img: \"icons/commodities/currency/coin-inset-snail-silver.webp\",\r\n abbreviation: \"{#}PP\",\r\n data: {\r\n path: \"system.currency.pp\"\r\n },\r\n primary: false,\r\n exchangeRate: 50\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"WWN.items.GP.long\",\r\n img: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\r\n abbreviation: \"{#}GP\",\r\n data: {\r\n path: \"system.currency.gp\",\r\n },\r\n primary: false,\r\n exchangeRate: 10\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"WWN.items.EP.long\",\r\n img: \"icons/commodities/currency/coin-inset-copper-axe.webp\",\r\n abbreviation: \"{#}EP\",\r\n data: {\r\n path: \"system.currency.ep\",\r\n },\r\n primary: false,\r\n exchangeRate: 5\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"WWN.items.SP.long\",\r\n img: \"icons/commodities/currency/coin-engraved-moon-silver.webp\",\r\n abbreviation: \"{#}SP\",\r\n data: {\r\n path: \"system.currency.sp\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"WWN.items.CP.long\",\r\n img: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\r\n abbreviation: \"{#}CP\",\r\n data: {\r\n path: \"system.currency.cp\",\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n }\r\n ]\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.1\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"pc\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.basic.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"flags.item-piles.system.price\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"ability, lasting-damage, power-shift, recursion, skill, tag\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"Adamantine pieces\",\r\n img: \"icons/commodities/currency/coin-embossed-ruby-gold.webp\",\r\n abbreviation: \"{#} ap\",\r\n data: {\r\n path: \"system.settings.equipment.currency.quantity6\"\r\n },\r\n primary: false,\r\n exchangeRate: 1000\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Mithral pieces\",\r\n img: \"icons/commodities/currency/coin-embossed-unicorn-silver.webp\",\r\n abbreviation: \"{#} mp\",\r\n data: {\r\n path: \"system.settings.equipment.currency.quantity5\"\r\n },\r\n primary: false,\r\n exchangeRate: 100\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Platinum pieces\",\r\n img: \"icons/commodities/currency/coin-engraved-moon-silver.webp\",\r\n abbreviation: \"{#} pp\",\r\n data: {\r\n path: \"system.settings.equipment.currency.quantity4\"\r\n },\r\n primary: false,\r\n exchangeRate: 10\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Gold pieces\",\r\n img: \"icons/commodities/currency/coins-plain-gold.webp\",\r\n abbreviation: \"{#} gp\",\r\n data: {\r\n path: \"system.settings.equipment.currency.quantity3\"\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Silver pieces\",\r\n img: \"icons/commodities/currency/coins-engraved-face-silver.webp\",\r\n abbreviation: \"{#} sp\",\r\n data: {\r\n path: \"system.settings.equipment.currency.quantity2\"\r\n },\r\n primary: false,\r\n exchangeRate: 0.1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"Copper pieces\",\r\n img: \"icons/commodities/currency/coins-engraved-copper.webp\",\r\n abbreviation: \"{#} cp\",\r\n data: {\r\n path: \"system.settings.equipment.currency.quantity1\"\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n }\r\n ]\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.0\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.cost\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"feat,edge,ability,move,capability,pokeedge,dexentry\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"PTU.Money\",\r\n img: \"icons/commodities/currency/coin-inset-snail-silver.webp\",\r\n abbreviation: \"{#}₱\",\r\n data: {\r\n path: \"system.money\"\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n }\r\n ]\r\n}\r\n","export default {\n\n \"VERSION\": \"1.0.0\",\n\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\n \"ACTOR_CLASS_TYPE\": \"Player\",\n\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\n\n // The item price attribute is the path to the attribute on each item that determine how much it costs\n \"ITEM_PRICE_ATTRIBUTE\": \"system.value\",\n\n // Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\n \"ITEM_FILTERS\": [\n {\n \"path\": \"type\",\n \"filters\": \"spell,skill\"\n },\n ],\n\n // This function is an optional system handler that specifically transforms an item when it is added to actors\n \"ITEM_TRANSFORMER\": async (itemData) => {\n // Transferred items should become unequipped\n if (itemData?.system?.equipped) {\n itemData.system.equipped = false;\n }\n // Transferring spells doesn't make a lot of sense, but if it happens the lost flag and mercurial effect should be cleared\n [\"lost\", \"mercurialEffect\"].forEach(key => {\n if (itemData?.system?.[key] !== undefined) {\n delete itemData.system[key];\n }\n });\n return itemData;\n },\n\n // This function is an optional system handler that specifically transforms an item's price into a more unified numeric format\n \"ITEM_COST_TRANSFORMER\": (item, currencies) => {\n let overallCost = 0;\n currencies.forEach((currency, index) => {\n let denominationCost = Number(getProperty(item, currency.data.path.replace(\"system.currency.\", \"system.value.\")));\n if (!isNaN(denominationCost)) {\n overallCost += denominationCost * currency.exchangeRate;\n }\n })\n return overallCost ?? 0;\n },\n\n // Item similarities determines how item piles detect similarities and differences in the system\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\n\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\n // In the case of attributes, the path is relative to the \"actor.system\"\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\n \"CURRENCIES\": [\n {\n type: \"attribute\",\n name: \"DCC.CurrencyPP\",\n img: \"icons/commodities/currency/coin-inset-snail-silver.webp\",\n abbreviation: \"{#}Pp\",\n data: {\n path: \"system.currency.pp\",\n },\n primary: false,\n exchangeRate: 100\n },\n {\n type: \"attribute\",\n name: \"DCC.CurrencyEP\",\n img: \"icons/commodities/currency/coin-inset-copper-axe.webp\",\n abbreviation: \"{#} Ep\",\n data: {\n path: \"system.currency.ep\",\n },\n primary: false,\n exchangeRate: 10\n },\n {\n type: \"attribute\",\n name: \"DCC.CurrencyGP\",\n img: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\n abbreviation: \"{#} Gp\",\n data: {\n path: \"system.currency.gp\",\n },\n primary: true,\n exchangeRate: 1\n },\n {\n type: \"attribute\",\n name: \"DCC.CurrencySP\",\n img: \"icons/commodities/currency/coin-engraved-moon-silver.webp\",\n abbreviation: \"{#} Sp\",\n data: {\n path: \"system.currency.sp\",\n },\n primary: false,\n exchangeRate: 0.1\n },\n {\n type: \"attribute\",\n name: \"DCC.CurrencyCP\",\n img: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\n abbreviation: \"{#} Cp\",\n data: {\n path: \"system.currency.cp\",\n },\n primary: false,\n exchangeRate: 0.01\n }\n ],\n}\n","import CONSTANTS from \"../constants/constants.js\";\n\nexport default {\n\n \"VERSION\": \"1.0.1\",\n\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\n \"ACTOR_CLASS_TYPE\": \"character\",\n\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\n\n // The item price attribute is the path to the attribute on each item that determine how much it costs\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\n\n // Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\n \"ITEM_FILTERS\": [\n {\n \"path\": \"type\",\n \"filters\": \"feature, maneuver, spell, background, culture, heritage, destiny\"\n }\n ],\n\n // Item similarities determines how item piles detect similarities and differences in the system\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\n\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\n // In the case of attributes, the path is relative to the \"actor.system\"\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\n \"CURRENCIES\": [\n {\n type: \"attribute\",\n name: \"Platinum Pieces\",\n img: \"icons/commodities/currency/coin-inset-snail-silver.webp\",\n abbreviation: \"{#}PP\",\n data: {\n path: \"system.currency.pp\"\n },\n primary: false,\n exchangeRate: 10\n },\n {\n type: \"attribute\",\n name: \"Gold Pieces\",\n img: \"icons/commodities/currency/coin-embossed-crown-gold.webp\",\n abbreviation: \"{#}GP\",\n data: {\n path: \"system.currency.gp\",\n },\n primary: true,\n exchangeRate: 1\n },\n {\n type: \"attribute\",\n name: \"Electrum Pieces\",\n img: \"icons/commodities/currency/coin-inset-copper-axe.webp\",\n abbreviation: \"{#}EP\",\n data: {\n path: \"system.currency.ep\",\n },\n primary: false,\n exchangeRate: 0.5\n },\n {\n type: \"attribute\",\n name: \"Silver Pieces\",\n img: \"icons/commodities/currency/coin-engraved-moon-silver.webp\",\n abbreviation: \"{#}SP\",\n data: {\n path: \"system.currency.sp\",\n },\n primary: false,\n exchangeRate: 0.1\n },\n {\n type: \"attribute\",\n name: \"Copper Pieces\",\n img: \"icons/commodities/currency/coin-engraved-waves-copper.webp\",\n abbreviation: \"{#}CP\",\n data: {\n path: \"system.currency.cp\",\n },\n primary: false,\n exchangeRate: 0.01\n }\n ],\n\n \"SHEET_OVERRIDES\": () => {\n\n libWrapper.register(CONSTANTS.MODULE_NAME, `game.a5e.applications.ActorSheetA5e.prototype.render`, function (wrapped, forced, options, ...args) {\n const renderItemPileInterface = Hooks.call(CONSTANTS.HOOKS.PRE_RENDER_SHEET, this.actor, forced, options) === false;\n if (this._state > Application.RENDER_STATES.NONE) {\n if (renderItemPileInterface) {\n wrapped(forced, options, ...args)\n } else {\n return wrapped(forced, options, ...args)\n }\n }\n if (renderItemPileInterface) return;\n return wrapped(forced, options, ...args);\n }, \"MIXED\");\n\n }\n};\n","export default {\n\n \"VERSION\": \"1.0.0\",\n\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\n \"ACTOR_CLASS_TYPE\": \"acolyte\",\n\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\n\n // The item price attribute is the path to the attribute on each item that determine how much it costs\n \"ITEM_PRICE_ATTRIBUTE\": \"\",\n\n // Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\n \"ITEM_FILTERS\": [\n {\n \"path\": \"type\",\n \"filters\": \"specialAbility, aptitude, talent, psychicPower, trait\"\n },\n {\n \"path\": \"system.installed\",\n \"filters\": \"installed\"\n }\n ],\n\n // Item similarities determines how item piles detect similarities and differences in the system\n \"ITEM_SIMILARITIES\": [],\n\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\n // In the case of attributes, the path is relative to the \"actor.system\"\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\n \"CURRENCIES\": [],\n\n \"CURRENCY_DECIMAL_DIGITS\": 0.00001\n}\n ","export default {\r\n\r\n \"VERSION\": \"1.0.0\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.prix\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"ape,attaque,competence,coup,etat,metier,origine,region,sort,trait\"\r\n }\r\n ],\r\n\r\n // This function is an optional system handler that specifically transforms an item when it is added to actors\r\n \"ITEM_TRANSFORMER\": async (itemData) => {\r\n [\"equipe\"].forEach(key => {\r\n if (itemData?.system?.[key] !== undefined) {\r\n delete itemData.system[key];\r\n }\r\n });\r\n return itemData;\r\n },\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"item\",\r\n name: \"Pièce d'argent\",\r\n img: \"systems/naheulbeuk/assets/from-rexard-icons/Tresors/tresor%20(101).webp\",\r\n abbreviation: \"{#}PA\",\r\n data: {\r\n uuid: \"Compendium.naheulbeuk.trucs.BTUFKc6sEbJLmlas\"\r\n },\r\n primary: false,\r\n exchangeRate: 10\r\n },\r\n {\r\n type: \"item\",\r\n name: \"Pièce d'or\",\r\n img: \"systems/naheulbeuk/assets/from-rexard-icons/Tresors/tresor%20(52).webp\",\r\n abbreviation: \"{#}PO\",\r\n data: {\r\n uuid: \"Compendium.naheulbeuk.trucs.AKuErwzQ6wDxtzyp\"\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"item\",\r\n name: \"Lingot de Thrytil\",\r\n img: \"systems/naheulbeuk/assets/from-rexard-icons/Objets/Materiaux/objet%20(291).webp\",\r\n abbreviation: \"{#}LT\",\r\n data: {\r\n uuid: \"Compendium.naheulbeuk.trucs.tOTNc2WYpkyf2Yyl\"\r\n },\r\n primary: false,\r\n exchangeRate: 0.01\r\n },\r\n {\r\n type: \"item\",\r\n name: \"Lingot de Berylium\",\r\n img: \"systems/naheulbeuk/assets/from-rexard-icons/Objets/Materiaux/objet%20(252).webp\",\r\n abbreviation: \"{#}LB\",\r\n data: {\r\n uuid: \"Compendium.naheulbeuk.trucs.r4qLXqXaIIdyKzOf\"\r\n },\r\n primary: false,\r\n exchangeRate: 0.002\r\n }\r\n ]\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.0\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"flags.item-piles.system.price\",\r\n\r\n // Item types and the filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"ability,power,augment,spell,part,property\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [],\r\n\r\n \"CURRENCY_DECIMAL_DIGITS\": 0.01\r\n\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.0\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"loot\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.qty\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.cost\",\r\n\r\n // Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"upgrade,specialty,injury\"\r\n }\r\n ],\r\n\r\n \"UNSTACKABLE_ITEM_TYPES\": [\"weapon\", \"armor\"],\r\n\r\n \"PILE_DEFAULTS\": {\r\n merchantColumns: [{\r\n label: \"FLBR.ItemAvailability\",\r\n path: \"system.availability\",\r\n formatting: \"{#}\",\r\n mapping: {\r\n 5: 'FLBR.ITEM_AVAILABILITY.Incidental',\r\n 4: 'FLBR.ITEM_AVAILABILITY.Standard',\r\n 3: 'FLBR.ITEM_AVAILABILITY.Premium',\r\n 2: 'FLBR.ITEM_AVAILABILITY.Rare',\r\n 1: 'FLBR.ITEM_AVAILABILITY.Luxury',\r\n }\r\n }]\r\n },\r\n\r\n // This function is an optional system handler that specifically transforms an item when it is added to actors\r\n \"ITEM_TRANSFORMER\": async (itemData) => {\r\n if (itemData?.system?.mounted) itemData.system.mounted = false;\r\n return itemData;\r\n },\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"FLBR.HEADER.ChinyenPoints\",\r\n img: \"icons/commodities/currency/coins-plain-stack-silver.webp\",\r\n abbreviation: \"{#}C¥\",\r\n data: {\r\n path: \"system.metaCurrencies.chinyen\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"FLBR.HEADER.PromotionPoints\",\r\n img: \"icons/commodities/treasure/medal-ribbon-gold-blue.webp\",\r\n abbreviation: \"{#}PP\",\r\n data: {\r\n path: \"system.metaCurrencies.promotion\",\r\n },\r\n primary: false,\r\n exchangeRate: 1\r\n },\r\n {\r\n type: \"attribute\",\r\n name: \"FLBR.HEADER.HumanityPoints\",\r\n img: \"icons/sundries/gaming/chess-knight-white.webp\",\r\n abbreviation: \"{#}HP\",\r\n data: {\r\n path: \"system.metaCurrencies.humanity\",\r\n },\r\n primary: false,\r\n exchangeRate: 1\r\n }\r\n ],\r\n\r\n \"VAULT_STYLES\": [\r\n {\r\n path: \"system.availability\",\r\n value: 1,\r\n styling: {\r\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(255,119,0,1)\"\r\n }\r\n },\r\n {\r\n path: \"system.availability\",\r\n value: 2,\r\n styling: {\r\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(255,0,247,1)\"\r\n }\r\n },\r\n {\r\n path: \"system.availability\",\r\n value: 3,\r\n styling: {\r\n \"box-shadow\": \"inset 0px 0px 7px 0px rgba(0,136,255,1)\"\r\n }\r\n }\r\n ]\r\n}\r\n","export default {\r\n \"VERSION\": \"1.0.0\",\r\n \"CURRENCIES\": [\r\n {\r\n \"type\": \"attribute\",\r\n \"name\": \"Dollar\",\r\n \"img\": \"\",\r\n \"abbreviation\": \"${#}\",\r\n \"data\": {\r\n \"path\": \"system.attributes.cash.value\"\r\n },\r\n \"primary\": true,\r\n \"exchangeRate\": 1\r\n }\r\n ],\r\n \"CURRENCY_DECIMAL_DIGITS\": 0.01,\r\n \"ITEM_FILTERS\": [{\r\n \"path\": \"type\",\r\n \"filters\": \"talent,planet-system,skill-stunts,agenda,specialty,critical-injury\"\r\n }],\r\n \"ITEM_COST_TRANSFORMER\": (item) => {\r\n let overallCost = getProperty(item, \"system.attributes.cost.value\");\r\n if (overallCost) {\r\n overallCost = overallCost.replace(\"$\", \"\").replace(\",\", \"\");\r\n }\r\n return Number(overallCost) ?? 0;\r\n },\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n \"ACTOR_CLASS_TYPE\": \"character\",\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.attributes.quantity.value\",\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.attributes.cost.value\"\r\n}\r\n","export default {\r\n\r\n \"VERSION\": \"1.0.0\",\r\n\r\n // The actor class type is the type of actor that will be used for the default item pile actor that is created on first item drop.\r\n \"ACTOR_CLASS_TYPE\": \"container\",\r\n\r\n // The item quantity attribute is the path to the attribute on items that denote how many of that item that exists\r\n \"ITEM_QUANTITY_ATTRIBUTE\": \"system.quantity\",\r\n\r\n // The item price attribute is the path to the attribute on each item that determine how much it costs\r\n \"ITEM_PRICE_ATTRIBUTE\": \"system.price\",\r\n\r\n // Item filters actively remove items from the item pile inventory UI that users cannot loot, such as spells, feats, and classes\r\n \"ITEM_FILTERS\": [\r\n {\r\n \"path\": \"type\",\r\n \"filters\": \"feature,class,subclass,background\"\r\n }\r\n ],\r\n\r\n // Item similarities determines how item piles detect similarities and differences in the system\r\n \"ITEM_SIMILARITIES\": [\"name\", \"type\"],\r\n\r\n // Currencies in item piles is a versatile system that can accept actor attributes (a number field on the actor's sheet) or items (actual items in their inventory)\r\n // In the case of attributes, the path is relative to the \"actor.system\"\r\n // In the case of items, it is recommended you export the item with `.toObject()` and strip out any module data\r\n \"CURRENCIES\": [\r\n {\r\n type: \"attribute\",\r\n name: \"PB.Silver\",\r\n img: \"systems/pirateborg/icons/misc/thing-of-importance.png\",\r\n abbreviation: \"{#}SP\",\r\n data: {\r\n path: \"system.silver\",\r\n },\r\n primary: true,\r\n exchangeRate: 1\r\n }\r\n ]\r\n}\r\n","// ↓ IMPORT SYSTEMS HERE ↓\nimport dnd4e from \"./systems/dnd4e.js\";\nimport dnd5e from \"./systems/dnd5e.js\";\nimport dnd5e203 from \"./systems/dnd5e-2.0.3.js\";\nimport pf1 from \"./systems/pf1.js\";\nimport pf2e from \"./systems/pf2e.js\";\nimport ds4 from \"./systems/ds4.js\";\nimport d35e from \"./systems/d35e.js\";\nimport sfrpg from \"./systems/sfrpg.js\";\nimport swade from \"./systems/swade.js\";\nimport tormenta20 from \"./systems/tormenta20.js\";\nimport wfrp4e from \"./systems/wfrp4e.js\";\nimport splittermond from \"./systems/splittermond.js\";\nimport forbiddenLands from \"./systems/forbidden-lands.js\";\nimport icrpg from \"./systems/icrpg.js\";\nimport swse from \"./systems/swse.js\";\nimport sw5e from \"./systems/sw5e.js\";\nimport sw5e203 from \"./systems/sw5e-2.0.3.2.3.8.js\";\nimport fallout from \"./systems/fallout.js\";\nimport cyberpunkRedCore from \"./systems/cyberpunk-red-core.js\";\nimport knave from \"./systems/knave.js\";\nimport t2k4e from \"./systems/t2k4e.js\";\nimport yzecoriolis from \"./systems/yzecoriolis.js\";\nimport kamigakari from \"./systems/kamigakari.js\";\nimport symbaroum from \"./systems/symbaroum.js\";\nimport wwn from \"./systems/wwn.js\";\nimport cyphersystem from \"./systems/cyphersystem.js\";\nimport ptu from \"./systems/ptu.js\";\nimport dcc from \"./systems/dcc.js\";\nimport a5e from \"./systems/a5e.js\";\nimport darkHeresy2e from \"./systems/dark-heresy.js\";\nimport naheulbeuk from \"./systems/naheulbeuk.js\";\nimport icrpgme from \"./systems/icrpgme.js\";\nimport bladeRunner from \"./systems/blade-runner.js\";\nimport alienrpg from \"./systems/alienrpg.js\";\nimport pirateborg from \"./systems/pirateborg.js\";\n// ↑ IMPORT SYSTEMS HERE ↑\n\n/**\n * NOTE: YOUR PULL REQUEST WILL NOT BE ACCEPTED IF YOU DO NOT\n * FOLLOW THE CONVENTION IN THE D&D 5E SYSTEM FILE\n */\nexport const SYSTEMS = {\n\n SUPPORTED_SYSTEMS: {\n // ↓ ADD SYSTEMS HERE ↓\n \"alienrpg\": {\n \"latest\": alienrpg\n },\n \"dnd4e\": {\n \"latest\": dnd4e\n },\n \"dnd5e\": {\n \"latest\": dnd5e,\n \"2.0.3\": dnd5e203,\n },\n \"pf1\": {\n \"latest\": pf1\n },\n \"pf2e\": {\n \"latest\": pf2e\n },\n \"ds4\": {\n \"latest\": ds4\n },\n \"d35e\": {\n \"latest\": d35e\n },\n \"blade-runner\": {\n \"latest\": bladeRunner\n },\n \"sfrpg\": {\n \"latest\": sfrpg\n },\n \"swade\": {\n \"latest\": swade\n },\n \"tormenta20\": {\n \"latest\": tormenta20\n },\n \"wfrp4e\": {\n \"latest\": wfrp4e\n },\n \"splittermond\": {\n \"latest\": splittermond\n },\n \"forbidden-lands\": {\n \"latest\": forbiddenLands\n },\n \"icrpg\": {\n \"latest\": icrpg\n },\n \"icrpgme\": {\n \"latest\": icrpgme\n },\n \"swse\": {\n \"latest\": swse\n },\n \"sw5e\": {\n \"latest\": sw5e,\n \"2.0.3.2.3.8\": sw5e203\n },\n \"fallout\": {\n \"latest\": fallout\n },\n \"cyberpunk-red-core\": {\n \"latest\": cyberpunkRedCore\n },\n \"knave\": {\n \"latest\": knave\n },\n \"t2k4e\": {\n \"latest\": t2k4e\n },\n \"yzecoriolis\": {\n \"latest\": yzecoriolis\n },\n \"kamigakari\": {\n \"latest\": kamigakari\n },\n \"wwn\": {\n \"latest\": wwn\n },\n \"symbaroum\": {\n \"latest\": symbaroum\n },\n \"cyphersystem\": {\n \"latest\": cyphersystem\n },\n \"ptu\": {\n \"latest\": ptu\n },\n \"dcc\": {\n \"latest\": dcc\n },\n \"a5e\": {\n \"latest\": a5e\n },\n \"dark-heresy\": {\n \"latest\": darkHeresy2e\n },\n \"naheulbeuk\": {\n \"latest\": naheulbeuk\n },\n \"pirateborg\": {\n \"latest\": pirateborg\n }\n // ↑ ADD SYSTEMS HERE ↑\n },\n\n DEFAULT_SETTINGS: {\n ACTOR_CLASS_TYPE: \"\",\n ITEM_QUANTITY_ATTRIBUTE: \"\",\n ITEM_PRICE_ATTRIBUTE: \"\",\n QUANTITY_FOR_PRICE_ATTRIBUTE: \"flags.item-piles.system.quantityForPrice\",\n ITEM_FILTERS: [],\n ITEM_SIMILARITIES: [],\n VAULT_STYLES: [],\n CSS_VARIABLES: [],\n UNSTACKABLE_ITEM_TYPES: [],\n CURRENCIES: [],\n SECONDARY_CURRENCIES: [],\n PILE_DEFAULTS: {},\n TOKEN_FLAG_DEFAULTS: {},\n CURRENCY_DECIMAL_DIGITS: 0.00001\n },\n\n get HAS_SYSTEM_SUPPORT() {\n return !!this.SUPPORTED_SYSTEMS?.[game.system.id.toLowerCase()];\n },\n\n _currentSystem: false,\n\n get DATA() {\n\n if (this._currentSystem) return this._currentSystem;\n\n const system = this.SUPPORTED_SYSTEMS?.[game.system.id.toLowerCase()];\n if (!system) return this.DEFAULT_SETTINGS;\n\n if (system[game.system.version]) {\n this._currentSystem = foundry.utils.mergeObject(this.DEFAULT_SETTINGS, system[game.system.version]);\n return this._currentSystem;\n }\n\n const versions = Object.keys(system);\n if (versions.length === 1) {\n this._currentSystem = foundry.utils.mergeObject(this.DEFAULT_SETTINGS, system[versions[0]]);\n return this._currentSystem;\n }\n\n versions.sort((a, b) => {\n return a === \"latest\" || b === \"latest\" ? -Infinity : (isNewerVersion(b, a) ? -1 : 1);\n });\n const version = versions.find(version => {\n return version === \"latest\" || !isNewerVersion(game.system.version, version);\n });\n\n this._currentSystem = foundry.utils.mergeObject(this.DEFAULT_SETTINGS, system[version]);\n\n return this._currentSystem;\n },\n\n addSystem(data) {\n this.SUPPORTED_SYSTEMS[game.system.id.toLowerCase()] = { latest: data };\n }\n};\n","<script>\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n\r\n export let key;\r\n export let data;\r\n export let disabled = false;\r\n\r\n</script>\r\n\r\n<div class=\"item-pile-setting form-scope item-piles-flexrow\">\r\n\r\n\t<div class=\"label-side\">\r\n\t\t<label>{localize(data.name)} <a>\r\n\t\t\t<i class=\"fas fa-undo reset-setting\" data-fast-tooltip=\"Reset data\"\r\n\t\t\t\t on:click={() => { data.value = data.default; }}></i></a>\r\n\t\t</label>\r\n\t\t<p class=\"notes\">{localize(data.hint)}</p>\r\n\t</div>\r\n\r\n\t<div class=\"form-fields input-side\">\r\n\r\n\t\t{#if data.type === Boolean}\r\n\r\n\t\t\t<input type=\"checkbox\" bind:checked={data.value} disabled={disabled}/>\r\n\r\n\t\t{:else if data.choices}\r\n\r\n\t\t\t<div class=\"choice-container\">\r\n\t\t\t\t<select name={data.key} bind:value={data.value} disabled={disabled}>\r\n\t\t\t\t\t{#each Object.entries(data.choices) as [key, choice], index (index)}\r\n\t\t\t\t\t\t{#if data.type === Number}\r\n\t\t\t\t\t\t\t<option value=\"{index}\">{localize(choice)}</option>\r\n\t\t\t\t\t\t{:else}\r\n\t\t\t\t\t\t\t<option value=\"{key}\">{localize(choice)}</option>\r\n\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t{/each}\r\n\t\t\t\t</select>\r\n\t\t\t</div>\r\n\r\n\t\t{:else if data.type === Number}\r\n\r\n\t\t\t<input\r\n\t\t\t\ttype=\"number\"\r\n\t\t\t\tdisabled={disabled}\r\n\t\t\t\tbind:value={data.value}\r\n\t\t\t\tclass:invalid={!data.value && data.value !== 0}\r\n\t\t\t\tstep={data.step}\r\n\t\t\t\tmin={data.min}\r\n\t\t\t\tmax={data.max}\r\n\t\t\t/>\r\n\r\n\t\t{:else}\r\n\r\n\t\t\t<div class=\"item-pile-setting-container\">\r\n\t\t\t\t<input type=\"text\" bind:value={data.value} disabled={disabled}/>\r\n\t\t\t\t{#if data.localize}\r\n\t\t\t\t\t<input type=\"text\" disabled value={localize(data.value)}/>\r\n\t\t\t\t{/if}\r\n\t\t\t</div>\r\n\r\n\t\t{/if}\r\n\t</div>\r\n\r\n</div>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-pile-setting:not(:last-child) {\r\n\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.25);\r\n margin-bottom: 0.4rem;\r\n padding-bottom: 0.4rem;\r\n\r\n }\r\n\r\n .item-pile-setting {\r\n\r\n .reset-setting {\r\n font-size: 0.75rem;\r\n margin-left: 0.5rem;\r\n opacity: 0.5;\r\n transition: opacity 250ms;\r\n\r\n &:hover {\r\n opacity: 1.0;\r\n }\r\n }\r\n\r\n .invalid {\r\n border: 2px solid #d93131;\r\n }\r\n\r\n label {\r\n flex: 1 0 auto;\r\n }\r\n\r\n .form-fields {\r\n flex: 0 1 auto;\r\n align-self: center;\r\n }\r\n\r\n select {\r\n min-width: 200px;\r\n }\r\n\r\n .item-pile-setting-container {\r\n min-width: 200px;\r\n display: flex;\r\n flex-direction: column;\r\n\r\n input:first-child {\r\n margin-bottom: 0.25rem;\r\n }\r\n }\r\n\r\n .label-side {\r\n flex: 1;\r\n margin-right: 1rem;\r\n }\r\n\r\n .choice-container {\r\n max-width: 400px;\r\n }\r\n\r\n input[type=\"number\"] {\r\n min-width: 100px;\r\n }\r\n\r\n }\r\n\r\n</style>\r\n","<script>\r\n export let value;\r\n export let type;\r\n export let placeholder = \"\";\r\n export let showImage = false;\r\n export let showInput = true;\r\n\r\n let filePicker = false;\r\n\r\n function handleClick() {\r\n if (!filePicker) {\r\n filePicker = new FilePicker({\r\n type: type,\r\n current: value,\r\n callback: path => {\r\n value = path;\r\n filePicker = false;\r\n }\r\n });\r\n }\r\n\r\n filePicker.render(true, { focus: true });\r\n }\r\n\r\n</script>\r\n\r\n<div>\r\n\t{#if showImage}\r\n\t\t<div class=\"item-piles-img-container\">\r\n\t\t\t<img class=\"item-piles-img\" src={value}/>\r\n\t\t</div>\r\n\t{/if}\r\n\t{#if showInput}\r\n\t\t<input type=\"text\" placeholder=\"{placeholder}\" bind:value=\"{value}\"/>\r\n\t{/if}\r\n\t<button on:click={handleClick} type=\"button\"><i class=\"fas fa-file-import\"></i></button>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n div {\r\n width: 100%;\r\n display: inline-flex;\r\n flex-direction: row;\r\n align-items: center;\r\n\r\n button {\r\n padding: 0.25rem 0.25rem;\r\n line-height: 1rem !important;\r\n flex: 0;\r\n }\r\n }\r\n\r\n</style>\r\n","<script>\r\n\r\n export let callback;\r\n export let isHovering;\r\n export let active = true;\r\n export let enterCallback = () => {\r\n };\r\n export let overCallback = () => {\r\n };\r\n export let leaveCallback = () => {\r\n };\r\n\r\n function dropData(event, ...args) {\r\n if (!active) return;\r\n counter = 0;\r\n let data;\r\n try {\r\n data = JSON.parse(event.dataTransfer.getData('text/plain'));\r\n } catch (err) {\r\n return false;\r\n }\r\n callback(data, event, ...args);\r\n }\r\n\r\n let counter = 0;\r\n\r\n function enter(event) {\r\n if (!active) return;\r\n counter++;\r\n if (counter === 1) {\r\n enterCallback(event);\r\n }\r\n }\r\n\r\n function leave(event) {\r\n if (!active) return;\r\n counter--;\r\n if (counter === 0) {\r\n leaveCallback(event);\r\n }\r\n }\r\n\r\n $: isHovering = counter > 0;\r\n\r\n</script>\r\n\r\n<div\r\n\ton:dragenter={enter}\r\n\ton:dragleave={leave}\r\n\ton:dragover={overCallback}\r\n\ton:dragstart|preventDefault\r\n\ton:drop|preventDefault={dropData}\r\n\tstyle={$$props.style}\r\n>\r\n\t<slot/>\r\n</div>\r\n","<script>\r\n import FilePicker from \"../../components/FilePicker.svelte\";\r\n import DropZone from \"../../components/DropZone.svelte\";\r\n import * as Helpers from \"../../../helpers/helpers.js\";\r\n import { applyStyles } from '@typhonjs-fvtt/runtime/svelte/action';\r\n\r\n export let store;\r\n\r\n const currenciesStore = store.currencies;\r\n let isHovering = false;\r\n\r\n $: currencies = $currenciesStore;\r\n $: {\r\n $currenciesStore;\r\n store.sortCurrencies();\r\n }\r\n\r\n async function dropData(data) {\r\n\r\n if (!data.type) {\r\n throw Helpers.custom_error(\"Something went wrong when dropping this item!\")\r\n }\r\n\r\n if (data.type !== \"Item\") {\r\n throw Helpers.custom_error(\"You must drop an item, not \" + data.type.toLowerCase() + \"!\")\r\n }\r\n\r\n store.addItem(data);\r\n\r\n }\r\n\r\n $: style = {\r\n \"grid-template-columns\": `${store.secondary ? \"\" : \"28px\"} 1.25fr ${store.secondary ? \"\" : \"60px\"} 0.5fr 60px 1fr 28px`\r\n }\r\n\r\n</script>\r\n\r\n<DropZone bind:isHovering={isHovering} callback={dropData}>\r\n\t<div class=\"item-piles-sortable-list-columns header\" use:applyStyles={style}>\r\n\t\t{#if !store.secondary}\r\n\t\t\t<div style=\"justify-content:flex-start;\">Primary</div>\r\n\t\t{/if}\r\n\t\t<div>Name</div>\r\n\t\t{#if !store.secondary}\r\n\t\t\t<div>Exchange</div>\r\n\t\t{/if}\r\n\t\t<div>Short</div>\r\n\t\t<div>Icon</div>\r\n\t\t<div>Data</div>\r\n\t\t<div><a on:click={() => store.addAttribute()}><i class=\"fas fa-plus\"></i></a></div>\r\n\t</div>\r\n\t<div class=\"table-container\">\r\n\t\t{#if isHovering}\r\n\t\t\t<div class=\"drop-to-add\">Drop to add</div>\r\n\t\t{/if}\r\n\t\t{#if !currencies.length}\r\n\t\t\t<div class=\"item-piles-sortable-list-columns\">\r\n\t\t\t\t<div class=\"full-span\" class:invisible={isHovering}>\r\n\t\t\t\t\tDrop an item or click the plus button to get started!\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t{/if}\r\n\t\t{#each currencies as item, index (item.id)}\r\n\t\t\t<div class=\"item-piles-sortable-list-columns\" use:applyStyles={style}>\r\n\t\t\t\t{#if !store.secondary}\r\n\t\t\t\t\t<div><input type=\"checkbox\" checked={item.primary} on:change={() => store.setPrimary(index)}/></div>\r\n\t\t\t\t{/if}\r\n\t\t\t\t<div><input type=\"text\" bind:value={item.name}/></div>\r\n\t\t\t\t{#if !store.secondary}\r\n\t\t\t\t\t<div><input type=\"number\" step=\"0.000000001\" bind:value={item.exchangeRate}/></div>\r\n\t\t\t\t{/if}\r\n\t\t\t\t<div><input type=\"text\" bind:value={item.abbreviation}/></div>\r\n\t\t\t\t<div>\r\n\t\t\t\t\t<FilePicker type=\"imagevideo\" showImage={true} showInput={false} bind:value={item.img}/>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div>\r\n\t\t\t\t\t{#if item.type === \"attribute\"}\r\n\t\t\t\t\t\t<input type=\"text\" bind:value={item.data.path} placeholder=\"system.attributes.hp.value\"/>\r\n\t\t\t\t\t{:else}\r\n\t\t\t\t\t\t<button type=\"button\" on:click={() => store.editItem(index)}>\r\n\t\t\t\t\t\t\t<i class=\"fas fa-eye\"></i> View item\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t{/if}\r\n\t\t\t\t</div>\r\n\t\t\t\t<div>\r\n\t\t\t\t\t<button type=\"button\" class=\"delete-button\" on:click={() => store.removeEntry(index)}>\r\n\t\t\t\t\t\t<i class=\"fas fa-times\"></i>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t{/each}\r\n\t</div>\r\n</DropZone>\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-piles-sortable-list-columns {\r\n\r\n .full-span {\r\n padding: 2rem 1rem;\r\n grid-column: 1/-1;\r\n font-size: 1.5rem;\r\n border-radius: 5px;\r\n border: 2px dashed rgba(0, 0, 0, 0.35);\r\n }\r\n }\r\n\r\n .invisible {\r\n opacity: 0;\r\n }\r\n\r\n .table-container {\r\n position: relative;\r\n }\r\n\r\n .drop-to-add {\r\n position: absolute;\r\n top: 0;\r\n bottom: 0;\r\n right: 0;\r\n left: 0;\r\n border-radius: 5px;\r\n box-shadow: inset 0 0 15px 5px rgb(0, 0, 0, 0.5);\r\n background-color: rgba(255, 255, 255, 0.75);\r\n z-index: 100000;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n font-size: 2rem;\r\n }\r\n\r\n</style>\r\n","import { get, writable } from 'svelte/store';\r\nimport * as Utilities from \"../../../helpers/utilities.js\";\r\nimport CONSTANTS from \"../../../constants/constants.js\";\r\nimport * as Helpers from \"../../../helpers/helpers.js\";\r\nimport { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n\r\nexport default class CurrencyStore {\r\n\r\n constructor(data, secondary = false) {\r\n this.secondary = secondary;\r\n this.currencies = writable(data.map((entry, index) => {\r\n return {\r\n ...entry,\r\n index,\r\n id: entry.data?.path ?? entry.data?._id ?? randomID()\r\n }\r\n }));\r\n }\r\n\r\n setPrimary(index) {\r\n if (this.secondary) return;\r\n this.currencies.update(currencies => {\r\n currencies.forEach((entry, entryIndex) => {\r\n entry.primary = entryIndex === index;\r\n });\r\n return currencies;\r\n });\r\n }\r\n\r\n sortCurrencies() {\r\n if (this.secondary) return;\r\n this.currencies.update(currencies => {\r\n currencies.sort((a, b) => {\r\n return b.exchangeRate - a.exchangeRate;\r\n });\r\n return currencies;\r\n });\r\n }\r\n\r\n addAttribute() {\r\n this.currencies.update(currencies => {\r\n currencies.push(foundry.utils.mergeObject({\r\n type: \"attribute\",\r\n name: \"New Attribute\",\r\n img: \"\",\r\n abbreviation: \"{#}N\",\r\n data: {\r\n path: \"\"\r\n }\r\n }, this.secondary ? {} : {\r\n primary: !currencies.length,\r\n exchangeRate: 1\r\n }));\r\n return currencies;\r\n });\r\n }\r\n\r\n async addItem(data) {\r\n\r\n let uuid = false;\r\n if (data.pack) {\r\n uuid = \"Compendium\" + data.pack + \".\" + data.id;\r\n }\r\n\r\n let item = await Item.implementation.fromDropData(data);\r\n let itemData = item.toObject();\r\n\r\n if (!itemData) {\r\n console.error(data);\r\n throw Helpers.custom_error(\"Something went wrong when dropping this item!\")\r\n }\r\n\r\n this.currencies.update(currencies => {\r\n const itemCurrencies = currencies.map(entry => entry.data?.item ?? {});\r\n const foundItem = Utilities.findSimilarItem(itemCurrencies, itemData);\r\n if (foundItem) {\r\n const index = itemCurrencies.indexOf(foundItem);\r\n currencies[index].data = {\r\n uuid,\r\n item: itemData\r\n }\r\n Helpers.custom_notify(`Updated item data for ${localize(currencies[index].name)} (item name ${itemData.name})`)\r\n } else {\r\n currencies.push(foundry.utils.mergeObject({\r\n id: randomID(),\r\n type: \"item\",\r\n name: itemData.name,\r\n img: itemData.img,\r\n abbreviation: \"{#} \" + itemData.name,\r\n data: {\r\n uuid,\r\n item: itemData\r\n },\r\n }, this.secondary ? {} : {\r\n primary: !currencies.length,\r\n exchangeRate: 1\r\n }));\r\n }\r\n return currencies;\r\n });\r\n }\r\n\r\n async editItem(index) {\r\n const currencies = get(this.currencies);\r\n const data = currencies[index].data;\r\n let item;\r\n if (data.uuid) {\r\n item = await fromUuid(data.uuid);\r\n } else {\r\n let itemData = data.item;\r\n if (itemData._id) delete itemData._id;\r\n if (itemData.ownership) delete itemData.ownership;\r\n const items = Array.from(game.items);\r\n item = Utilities.findSimilarItem(items, itemData);\r\n if (!item) {\r\n setProperty(itemData, CONSTANTS.FLAGS.TEMPORARY_ITEM, true);\r\n item = await Item.implementation.create(itemData);\r\n Helpers.custom_notify(`An item has been created for ${item.name} - drag and drop it into the list to update the stored item data`)\r\n }\r\n }\r\n item.sheet.render(true);\r\n }\r\n\r\n removeEntry(index) {\r\n this.currencies.update(currencies => {\r\n currencies.splice(index, 1);\r\n return currencies;\r\n })\r\n }\r\n\r\n export() {\r\n return get(this.currencies);\r\n }\r\n\r\n}\r\n","<script>\r\n\r\n import { ApplicationShell } from '@typhonjs-fvtt/runtime/svelte/component/core';\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { getSetting } from \"../../../helpers/helpers.js\";\r\n import SETTINGS from \"../../../constants/settings.js\";\r\n import CurrencyList from \"./CurrencyList.svelte\";\r\n import CurrencyStore from \"./currency-store.js\"\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let data;\r\n export let secondary = false\r\n\r\n export let elementRoot;\r\n\r\n const store = new CurrencyStore(data || getSetting(SETTINGS.CURRENCIES), secondary);\r\n\r\n let form;\r\n\r\n async function updateSettings() {\r\n application.options.resolve(store.export());\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<form autocomplete=off bind:this={form} on:submit|preventDefault={updateSettings}>\r\n\r\n\t\t<p>{localize(`ITEM-PILES.Applications.${secondary ? \"Secondary\" : \"\"}CurrenciesEditor.Explanation`)}</p>\r\n\r\n\t\t<p class=\"small\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.CurrenciesEditor.ExplanationSmallAttributes\")}\r\n\t\t</p>\r\n\r\n\t\t<p class=\"small item-piles-bottom-divider\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.CurrenciesEditor.ExplanationSmallItems\")}\r\n\t\t</p>\r\n\r\n\t\t<CurrencyList {store}/>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"Save\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n form {\r\n padding: 0 0.25rem;\r\n position: relative;\r\n }\r\n\r\n footer {\r\n border-top: 1px solid rgba(0, 0, 0, 0.5);\r\n margin-top: 0.5rem;\r\n padding-top: 0.5rem;\r\n display: flex;\r\n }\r\n\r\n .small {\r\n font-size: 0.75rem;\r\n }\r\n\r\n</style>\r\n","import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport { getActiveApps } from \"../../helpers/helpers.js\";\r\n\r\nexport default class Editor extends SvelteApplication {\r\n\r\n constructor(data, options, dialogOptions) {\r\n super({\r\n svelte: {\r\n props: {\r\n data\r\n }\r\n },\r\n ...options\r\n }, dialogOptions);\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n width: 400,\r\n height: \"auto\",\r\n classes: [\"item-piles-app\"],\r\n close: () => this.options.resolve(null),\r\n svelte: {\r\n target: document.body,\r\n }\r\n })\r\n }\r\n\r\n static async show(data, options = {}, dialogOptions = {}) {\r\n const app = options?.id ? getActiveApps(options?.id, true) : false;\r\n if (app) return app.render(false, { focus: true });\r\n return new Promise(resolve => {\r\n options.resolve = resolve;\r\n return new this(data, options, dialogOptions).render(true, { focus: true });\r\n });\r\n }\r\n}\r\n","import CurrenciesEditorShell from './currencies-editor-shell.svelte';\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport class CurrenciesEditor extends Editor {\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: game.i18n.localize(\"ITEM-PILES.Applications.CurrenciesEditor.Title\"),\r\n width: 630,\r\n svelte: {\r\n class: CurrenciesEditorShell,\r\n }\r\n })\r\n }\r\n}\r\n\r\nexport class SecondaryCurrenciesEditor extends CurrenciesEditor {\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: game.i18n.localize(\"ITEM-PILES.Applications.SecondaryCurrenciesEditor.Title\"),\r\n svelte: {\r\n props: {\r\n secondary: true\r\n }\r\n }\r\n })\r\n }\r\n}\r\n","<script>\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n\r\n import { getSetting } from \"../../../helpers/helpers.js\";\r\n import SETTINGS from \"../../../constants/settings.js\";\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import { get, writable } from \"svelte/store\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let data;\r\n export let elementRoot;\r\n\r\n let form;\r\n\r\n const itemFilters = writable(data ? data : getSetting(SETTINGS.ITEM_FILTERS))\r\n\r\n function add() {\r\n itemFilters.update(val => {\r\n val.push({ path: \"\", filters: \"\" });\r\n return val;\r\n })\r\n }\r\n\r\n function remove(index) {\r\n itemFilters.update(val => {\r\n val.splice(index, 1)\r\n return val;\r\n })\r\n }\r\n\r\n async function updateSettings() {\r\n application.options.resolve(get(itemFilters));\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<form autocomplete=off bind:this={form} on:submit|preventDefault={updateSettings}>\r\n\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.FilterEditor.Explanation\")}</p>\r\n\r\n\t\t<table>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>{localize(\"ITEM-PILES.Applications.FilterEditor.Path\")}</th>\r\n\t\t\t\t<th>{localize(\"ITEM-PILES.Applications.FilterEditor.Filters\")}</th>\r\n\t\t\t\t<th class=\"custom-small\"><a class=\"item-piles-clickable\" on:click={add}><i class=\"fas fa-plus\"></i></a></th>\r\n\t\t\t</tr>\r\n\t\t\t{#each $itemFilters as { path, filters }, index (index)}\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td><input type=\"text\" required placeholder=\"type\" bind:value=\"{path}\"/></td>\r\n\t\t\t\t\t<td><input type=\"text\" required placeholder=\"class, spell, feat\" bind:value=\"{filters}\"/></td>\r\n\t\t\t\t\t<td class=\"custom-small\">\r\n\t\t\t\t\t\t<button type=\"button\" on:click={remove(index)}><i class=\"fas fa-times\"></i></button>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t{/each}\r\n\t\t</table>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"Save\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n table {\r\n vertical-align: middle;\r\n\r\n tr {\r\n border-spacing: 15px;\r\n }\r\n\r\n .custom-small {\r\n width: 26px;\r\n }\r\n\r\n button {\r\n padding: 0.25rem 0.25rem;\r\n line-height: 1rem;\r\n text-align: center;\r\n }\r\n\r\n a {\r\n text-align: center;\r\n }\r\n }\r\n\r\n</style>\r\n","import ItemFiltersShell from './item-filters-editor.svelte';\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport default class ItemFiltersEditor extends Editor {\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: \"ITEM-PILES.Applications.FilterEditor.Title\",\r\n svelte: {\r\n class: ItemFiltersShell,\r\n }\r\n })\r\n }\r\n}\r\n","<script>\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { get, writable } from \"svelte/store\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n let form;\r\n\r\n export let elementRoot;\r\n export let data;\r\n\r\n const keyValuePair = application.options?.keyValuePair ?? false;\r\n const stringListStore = writable(data);\r\n\r\n function add() {\r\n stringListStore.update(val => {\r\n if (keyValuePair) {\r\n val.push([\"\", \"\"]);\r\n } else {\r\n val.push(\"\");\r\n }\r\n return val;\r\n })\r\n }\r\n\r\n function remove(index) {\r\n stringListStore.update(val => {\r\n val.splice(index, 1);\r\n return val;\r\n })\r\n }\r\n\r\n async function updateSettings() {\r\n application.options.resolve(get(stringListStore));\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\t<form autocomplete=off bind:this={form} on:submit|preventDefault={updateSettings}>\r\n\r\n\t\t{#if application.options.content}\r\n\t\t\t<p>{localize(application.options.content)}</p>\r\n\t\t{/if}\r\n\r\n\t\t<table>\r\n\t\t\t<tr>\r\n\t\t\t\t{#if keyValuePair}\r\n\t\t\t\t\t<th>{localize(application.options?.columnKey)}</th>\r\n\t\t\t\t{/if}\r\n\t\t\t\t<th>{localize(application.options?.column)}</th>\r\n\t\t\t\t<th class=\"small\"><a class=\"item-piles-clickable\" on:click={add}><i class=\"fas fa-plus\"></i></a></th>\r\n\t\t\t</tr>\r\n\t\t\t{#if keyValuePair}\r\n\t\t\t\t{#each $stringListStore as [key, path], index (index)}\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td><input type=\"text\" required bind:value=\"{key}\"/></td>\r\n\t\t\t\t\t\t<td><input type=\"text\" bind:value=\"{path}\"/></td>\r\n\t\t\t\t\t\t<td class=\"small\">\r\n\t\t\t\t\t\t\t<button type=\"button\" on:click={remove(index)}><i class=\"fas fa-times\"></i></button>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t{/each}\r\n\t\t\t{:else}\r\n\t\t\t\t{#each $stringListStore as path, index (index)}\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td><input type=\"text\" required bind:value=\"{path}\"/></td>\r\n\t\t\t\t\t\t<td class=\"small\">\r\n\t\t\t\t\t\t\t<button type=\"button\" on:click={remove(index)}><i class=\"fas fa-times\"></i></button>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t{/each}\r\n\t\t\t{/if}\r\n\t\t</table>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"Save\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n table {\r\n vertical-align: middle;\r\n\r\n tr {\r\n border-spacing: 15px;\r\n }\r\n\r\n .small {\r\n width: 26px;\r\n }\r\n\r\n button {\r\n padding: 0.25rem 0.25rem;\r\n line-height: 1rem;\r\n flex: 0;\r\n text-align: center;\r\n }\r\n\r\n a {\r\n text-align: center;\r\n }\r\n }\r\n\r\n</style>\r\n","import StringListEditorShell from './string-list-editor.svelte';\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport default class StringListEditor extends Editor {\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n svelte: {\r\n class: StringListEditorShell\r\n }\r\n })\r\n }\r\n}\r\n","<script>\r\n\r\n export let value;\r\n export let min = 0;\r\n export let max = 200;\r\n export let maxInput = Infinity;\r\n export let step = 1;\r\n export let divideBy = 100;\r\n\r\n let displayValue = value * divideBy;\r\n\r\n $: {\r\n value = displayValue / divideBy;\r\n }\r\n\r\n</script>\r\n\r\n<div class=\"slider-group\" style={$$props.style}>\r\n\t<input bind:value=\"{displayValue}\" {max} {min} {step} type=\"range\"/>\r\n\t<input bind:value=\"{displayValue}\" max={maxInput} {min} required {step} type=\"number\"/>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n .slider-group {\r\n display: flex;\r\n align-items: center;\r\n flex: 3;\r\n\r\n input[type=\"range\"] {\r\n flex: 3;\r\n }\r\n\r\n input[type=\"number\"] {\r\n flex: 0 1 40px;\r\n margin-left: 1rem;\r\n height: 20px;\r\n font-size: 0.8rem;\r\n }\r\n }\r\n\r\n</style>\r\n","<script>\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import SliderInput from \"../../components/SliderInput.svelte\";\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import { getSourceActorFromDropData, getUuid } from \"../../../helpers/utilities.js\";\r\n import { get, writable } from \"svelte/store\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n let form;\r\n\r\n export let data;\r\n export let elementRoot;\r\n\r\n const priceModifiers = writable(data.map(data => {\r\n data.actor = globalThis.fromUuidSync(data.actorUuid);\r\n if (!data.actor) return false;\r\n return data;\r\n }).filter(Boolean));\r\n\r\n function remove(index) {\r\n priceModifiers.update(val => {\r\n val.splice(index, 1)\r\n return val;\r\n })\r\n }\r\n\r\n async function updateSettings() {\r\n let result = get(priceModifiers);\r\n result.forEach(data => {\r\n data.actorUuid = getUuid(data.actor);\r\n })\r\n application.options.resolve?.(result);\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n async function dropData(event) {\r\n\r\n event.preventDefault();\r\n\r\n let data;\r\n try {\r\n data = JSON.parse(event.dataTransfer.getData('text/plain'));\r\n } catch (err) {\r\n return false;\r\n }\r\n\r\n if (data.type !== \"Actor\") return;\r\n\r\n const actor = getSourceActorFromDropData(data);\r\n\r\n if (!actor) return;\r\n\r\n priceModifiers.update(val => {\r\n\r\n if (val.find(data => data.actor === actor)) return val;\r\n\r\n val.push({\r\n override: false,\r\n actor: actor,\r\n buyPriceModifier: 1,\r\n sellPriceModifier: 0.5\r\n });\r\n\r\n return val;\r\n\r\n })\r\n }\r\n\r\n function preventDefault(event) {\r\n event.preventDefault();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<form autocomplete=off bind:this={form} on:submit|preventDefault={updateSettings}>\r\n\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.PriceModifiersEditor.Explanation\")}</p>\r\n\r\n\t\t<div class:border-highlight={!$priceModifiers.length} on:dragover={preventDefault} on:dragstart={preventDefault}\r\n\t\t\t\t on:drop={dropData}>\r\n\r\n\t\t\t{#if $priceModifiers.length}\r\n\t\t\t\t<table>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th style=\"width:5%;\">{localize(\"ITEM-PILES.Applications.PriceModifiersEditor.Override\")}</th>\r\n\t\t\t\t\t\t<th style=\"width:25%;\">{localize(\"ITEM-PILES.Applications.PriceModifiersEditor.Actor\")}</th>\r\n\t\t\t\t\t\t<th style=\"width:35%;\">{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.BuyPriceModifier\")}</th>\r\n\t\t\t\t\t\t<th style=\"width:35%;\">{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.SellPriceModifier\")}</th>\r\n\t\t\t\t\t\t<th style=\"width:5%;\"></th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t{#each $priceModifiers as priceData, index (index)}\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={priceData.override}>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<a class=\"item-piles-actor-name-clickable\"\r\n\t\t\t\t\t\t\t\t\t on:click={(priceData.actor.sheet.render(true, { bypassItemPiles: true }))}>{priceData.actor.name}</a>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<div class=\"item-piles-flexrow\" style=\"margin: 0 0.25rem\">\r\n\t\t\t\t\t\t\t\t\t<SliderInput bind:value={priceData.buyPriceModifier}/>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<div class=\"item-piles-flexrow\" style=\"margin: 0 0.25rem\">\r\n\t\t\t\t\t\t\t\t\t<SliderInput bind:value={priceData.sellPriceModifier}/>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td class=\"small\">\r\n\t\t\t\t\t\t\t\t<button type=\"button\" on:click={remove(index)}><i class=\"fas fa-times\"></i></button>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t{/each}\r\n\t\t\t\t</table>\r\n\t\t\t{/if}\r\n\r\n\t\t\t<p class=\"item-piles-text-center\">{localize(\"ITEM-PILES.Applications.PriceModifiersEditor.DragDrop\")}</p>\r\n\r\n\t\t</div>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"Save\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .border-highlight {\r\n padding: 1rem;\r\n margin: 0.25rem;\r\n border-radius: 10px;\r\n border: 2px dashed gray;\r\n }\r\n\r\n table {\r\n vertical-align: middle;\r\n\r\n tr {\r\n border-spacing: 15px;\r\n }\r\n\r\n .small {\r\n width: 26px;\r\n }\r\n\r\n button {\r\n padding: 0.25rem 0.25rem;\r\n line-height: 1rem;\r\n flex: 0;\r\n text-align: center;\r\n }\r\n\r\n a {\r\n text-align: center;\r\n }\r\n }\r\n\r\n</style>\r\n","import PriceModifiersEditorShell from './price-modifiers-editor-shell.svelte';\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport default class PriceModifiersEditor extends Editor {\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: game.i18n.localize(\"ITEM-PILES.Applications.PriceModifiersEditor.Title\"),\r\n width: 600,\r\n svelte: {\r\n class: PriceModifiersEditorShell\r\n }\r\n })\r\n }\r\n}\r\n","import { cubicOut } from '../easing/index.mjs';\nimport { is_function } from '../internal/index.mjs';\n\nfunction flip(node, { from, to }, params = {}) {\n const style = getComputedStyle(node);\n const transform = style.transform === 'none' ? '' : style.transform;\n const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat);\n const dx = (from.left + from.width * ox / to.width) - (to.left + ox);\n const dy = (from.top + from.height * oy / to.height) - (to.top + oy);\n const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing = cubicOut } = params;\n return {\n delay,\n duration: is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration,\n easing,\n css: (t, u) => {\n const x = u * dx;\n const y = u * dy;\n const sx = t + u * from.width / to.width;\n const sy = t + u * from.height / to.height;\n return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`;\n }\n };\n}\n\nexport { flip };\n","// external events\nconst FINALIZE_EVENT_NAME = \"finalize\";\nconst CONSIDER_EVENT_NAME = \"consider\";\n\n/**\n * @typedef {Object} Info\n * @property {string} trigger\n * @property {string} id\n * @property {string} source\n * @param {Node} el\n * @param {Array} items\n * @param {Info} info\n */\nexport function dispatchFinalizeEvent(el, items, info) {\n el.dispatchEvent(\n new CustomEvent(FINALIZE_EVENT_NAME, {\n detail: {items, info}\n })\n );\n}\n\n/**\n * Dispatches a consider event\n * @param {Node} el\n * @param {Array} items\n * @param {Info} info\n */\nexport function dispatchConsiderEvent(el, items, info) {\n el.dispatchEvent(\n new CustomEvent(CONSIDER_EVENT_NAME, {\n detail: {items, info}\n })\n );\n}\n\n// internal events\nexport const DRAGGED_ENTERED_EVENT_NAME = \"draggedEntered\";\nexport const DRAGGED_LEFT_EVENT_NAME = \"draggedLeft\";\nexport const DRAGGED_OVER_INDEX_EVENT_NAME = \"draggedOverIndex\";\nexport const DRAGGED_LEFT_DOCUMENT_EVENT_NAME = \"draggedLeftDocument\";\n\nexport const DRAGGED_LEFT_TYPES = {\n LEFT_FOR_ANOTHER: \"leftForAnother\",\n OUTSIDE_OF_ANY: \"outsideOfAny\"\n};\n\nexport function dispatchDraggedElementEnteredContainer(containerEl, indexObj, draggedEl) {\n containerEl.dispatchEvent(\n new CustomEvent(DRAGGED_ENTERED_EVENT_NAME, {\n detail: {indexObj, draggedEl}\n })\n );\n}\n\n/**\n * @param containerEl - the dropzone the element left\n * @param draggedEl - the dragged element\n * @param theOtherDz - the new dropzone the element entered\n */\nexport function dispatchDraggedElementLeftContainerForAnother(containerEl, draggedEl, theOtherDz) {\n containerEl.dispatchEvent(\n new CustomEvent(DRAGGED_LEFT_EVENT_NAME, {\n detail: {draggedEl, type: DRAGGED_LEFT_TYPES.LEFT_FOR_ANOTHER, theOtherDz}\n })\n );\n}\n\nexport function dispatchDraggedElementLeftContainerForNone(containerEl, draggedEl) {\n containerEl.dispatchEvent(\n new CustomEvent(DRAGGED_LEFT_EVENT_NAME, {\n detail: {draggedEl, type: DRAGGED_LEFT_TYPES.OUTSIDE_OF_ANY}\n })\n );\n}\nexport function dispatchDraggedElementIsOverIndex(containerEl, indexObj, draggedEl) {\n containerEl.dispatchEvent(\n new CustomEvent(DRAGGED_OVER_INDEX_EVENT_NAME, {\n detail: {indexObj, draggedEl}\n })\n );\n}\nexport function dispatchDraggedLeftDocument(draggedEl) {\n window.dispatchEvent(\n new CustomEvent(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, {\n detail: {draggedEl}\n })\n );\n}\n","import {DRAGGED_ENTERED_EVENT_NAME, DRAGGED_LEFT_EVENT_NAME, DRAGGED_OVER_INDEX_EVENT_NAME} from \"./helpers/dispatcher\";\n\nexport const TRIGGERS = {\n DRAG_STARTED: \"dragStarted\",\n DRAGGED_ENTERED: DRAGGED_ENTERED_EVENT_NAME,\n DRAGGED_ENTERED_ANOTHER: \"dragEnteredAnother\",\n DRAGGED_OVER_INDEX: DRAGGED_OVER_INDEX_EVENT_NAME,\n DRAGGED_LEFT: DRAGGED_LEFT_EVENT_NAME,\n DRAGGED_LEFT_ALL: \"draggedLeftAll\",\n DROPPED_INTO_ZONE: \"droppedIntoZone\",\n DROPPED_INTO_ANOTHER: \"droppedIntoAnother\",\n DROPPED_OUTSIDE_OF_ANY: \"droppedOutsideOfAny\",\n DRAG_STOPPED: \"dragStopped\"\n};\n\nexport const SOURCES = {\n POINTER: \"pointer\",\n KEYBOARD: \"keyboard\"\n};\n\nexport const SHADOW_ITEM_MARKER_PROPERTY_NAME = \"isDndShadowItem\";\nexport const SHADOW_ELEMENT_ATTRIBUTE_NAME = \"data-is-dnd-shadow-item\";\nexport const SHADOW_PLACEHOLDER_ITEM_ID = \"id:dnd-shadow-placeholder-0000\";\nexport const DRAGGED_ELEMENT_ID = \"dnd-action-dragged-el\";\n\nexport let ITEM_ID_KEY = \"id\";\nlet activeDndZoneCount = 0;\nexport function incrementActiveDropZoneCount() {\n activeDndZoneCount++;\n}\nexport function decrementActiveDropZoneCount() {\n if (activeDndZoneCount === 0) {\n throw new Error(\"Bug! trying to decrement when there are no dropzones\");\n }\n activeDndZoneCount--;\n}\n\n/**\n * Allows using another key instead of \"id\" in the items data. This is global and applies to all dndzones.\n * Has to be called when there are no rendered dndzones whatsoever.\n * @param {String} newKeyName\n * @throws {Error} if it was called when there are rendered dndzones or if it is given the wrong type (not a string)\n */\nexport function overrideItemIdKeyNameBeforeInitialisingDndZones(newKeyName) {\n if (activeDndZoneCount > 0) {\n throw new Error(\"can only override the id key before initialising any dndzone\");\n }\n if (typeof newKeyName !== \"string\") {\n throw new Error(\"item id key has to be a string\");\n }\n printDebug(() => [\"overriding item id key name\", newKeyName]);\n ITEM_ID_KEY = newKeyName;\n}\n\nexport const isOnServer = typeof window === \"undefined\";\n\nexport let printDebug = () => {};\n\n/**\n * Allows the user to show/hide console debug output\n * * @param {Boolean} isDebug\n */\nexport function setDebugMode(isDebug) {\n if (isDebug) {\n printDebug = (generateMessage, logFunction = console.debug) => {\n const message = generateMessage();\n if (Array.isArray(message)) {\n logFunction(...message);\n } else {\n logFunction(message);\n }\n };\n } else {\n printDebug = () => {};\n }\n}\n","// This is based off https://stackoverflow.com/questions/27745438/how-to-compute-getboundingclientrect-without-considering-transforms/57876601#57876601\n// It removes the transforms that are potentially applied by the flip animations\n/**\n * Gets the bounding rect but removes transforms (ex: flip animation)\n * @param {HTMLElement} el\n * @return {{top: number, left: number, bottom: number, right: number}}\n */\nexport function getBoundingRectNoTransforms(el) {\n let ta;\n const rect = el.getBoundingClientRect();\n const style = getComputedStyle(el);\n const tx = style.transform;\n\n if (tx) {\n let sx, sy, dx, dy;\n if (tx.startsWith(\"matrix3d(\")) {\n ta = tx.slice(9, -1).split(/, /);\n sx = +ta[0];\n sy = +ta[5];\n dx = +ta[12];\n dy = +ta[13];\n } else if (tx.startsWith(\"matrix(\")) {\n ta = tx.slice(7, -1).split(/, /);\n sx = +ta[0];\n sy = +ta[3];\n dx = +ta[4];\n dy = +ta[5];\n } else {\n return rect;\n }\n\n const to = style.transformOrigin;\n const x = rect.x - dx - (1 - sx) * parseFloat(to);\n const y = rect.y - dy - (1 - sy) * parseFloat(to.slice(to.indexOf(\" \") + 1));\n const w = sx ? rect.width / sx : el.offsetWidth;\n const h = sy ? rect.height / sy : el.offsetHeight;\n return {\n x: x,\n y: y,\n width: w,\n height: h,\n top: y,\n right: x + w,\n bottom: y + h,\n left: x\n };\n } else {\n return rect;\n }\n}\n\n/**\n * Gets the absolute bounding rect (accounts for the window's scroll position and removes transforms)\n * @param {HTMLElement} el\n * @return {{top: number, left: number, bottom: number, right: number}}\n */\nexport function getAbsoluteRectNoTransforms(el) {\n const rect = getBoundingRectNoTransforms(el);\n return {\n top: rect.top + window.scrollY,\n bottom: rect.bottom + window.scrollY,\n left: rect.left + window.scrollX,\n right: rect.right + window.scrollX\n };\n}\n\n/**\n * Gets the absolute bounding rect (accounts for the window's scroll position)\n * @param {HTMLElement} el\n * @return {{top: number, left: number, bottom: number, right: number}}\n */\nexport function getAbsoluteRect(el) {\n const rect = el.getBoundingClientRect();\n return {\n top: rect.top + window.scrollY,\n bottom: rect.bottom + window.scrollY,\n left: rect.left + window.scrollX,\n right: rect.right + window.scrollX\n };\n}\n\n/**\n * finds the center :)\n * @typedef {Object} Rect\n * @property {number} top\n * @property {number} bottom\n * @property {number} left\n * @property {number} right\n * @param {Rect} rect\n * @return {{x: number, y: number}}\n */\nexport function findCenter(rect) {\n return {\n x: (rect.left + rect.right) / 2,\n y: (rect.top + rect.bottom) / 2\n };\n}\n\n/**\n * @typedef {Object} Point\n * @property {number} x\n * @property {number} y\n * @param {Point} pointA\n * @param {Point} pointB\n * @return {number}\n */\nfunction calcDistance(pointA, pointB) {\n return Math.sqrt(Math.pow(pointA.x - pointB.x, 2) + Math.pow(pointA.y - pointB.y, 2));\n}\n\n/**\n * @param {Point} point\n * @param {Rect} rect\n * @return {boolean|boolean}\n */\nexport function isPointInsideRect(point, rect) {\n return point.y <= rect.bottom && point.y >= rect.top && point.x >= rect.left && point.x <= rect.right;\n}\n\n/**\n * find the absolute coordinates of the center of a dom element\n * @param el {HTMLElement}\n * @returns {{x: number, y: number}}\n */\nexport function findCenterOfElement(el) {\n return findCenter(getAbsoluteRect(el));\n}\n\n/**\n * @param {HTMLElement} elA\n * @param {HTMLElement} elB\n * @return {boolean}\n */\nexport function isCenterOfAInsideB(elA, elB) {\n const centerOfA = findCenterOfElement(elA);\n const rectOfB = getAbsoluteRectNoTransforms(elB);\n return isPointInsideRect(centerOfA, rectOfB);\n}\n\n/**\n * @param {HTMLElement|ChildNode} elA\n * @param {HTMLElement|ChildNode} elB\n * @return {number}\n */\nexport function calcDistanceBetweenCenters(elA, elB) {\n const centerOfA = findCenterOfElement(elA);\n const centerOfB = findCenterOfElement(elB);\n return calcDistance(centerOfA, centerOfB);\n}\n\n/**\n * @param {HTMLElement} el - the element to check\n * @returns {boolean} - true if the element in its entirety is off screen including the scrollable area (the normal dom events look at the mouse rather than the element)\n */\nexport function isElementOffDocument(el) {\n const rect = getAbsoluteRect(el);\n return rect.right < 0 || rect.left > document.documentElement.scrollWidth || rect.bottom < 0 || rect.top > document.documentElement.scrollHeight;\n}\n\n/**\n * If the point is inside the element returns its distances from the sides, otherwise returns null\n * @param {Point} point\n * @param {HTMLElement} el\n * @return {null|{top: number, left: number, bottom: number, right: number}}\n */\nexport function calcInnerDistancesBetweenPointAndSidesOfElement(point, el) {\n const rect = getAbsoluteRect(el);\n if (!isPointInsideRect(point, rect)) {\n return null;\n }\n return {\n top: point.y - rect.top,\n bottom: rect.bottom - point.y,\n left: point.x - rect.left,\n // TODO - figure out what is so special about right (why the rect is too big)\n right: Math.min(rect.right, document.documentElement.clientWidth) - point.x\n };\n}\n","import {isCenterOfAInsideB, calcDistanceBetweenCenters, getAbsoluteRectNoTransforms, isPointInsideRect, findCenterOfElement} from \"./intersection\";\nimport {printDebug, SHADOW_ELEMENT_ATTRIBUTE_NAME} from \"../constants\";\n\nlet dzToShadowIndexToRect;\n\n/**\n * Resets the cache that allows for smarter \"would be index\" resolution. Should be called after every drag operation\n */\nexport function resetIndexesCache() {\n printDebug(() => \"resetting indexes cache\");\n dzToShadowIndexToRect = new Map();\n}\nresetIndexesCache();\n\n/**\n * Resets the cache that allows for smarter \"would be index\" resolution for a specific dropzone, should be called after the zone was scrolled\n * @param {HTMLElement} dz\n */\nexport function resetIndexesCacheForDz(dz) {\n printDebug(() => \"resetting indexes cache for dz\");\n dzToShadowIndexToRect.delete(dz);\n}\n\n/**\n * Caches the coordinates of the shadow element when it's in a certain index in a certain dropzone.\n * Helpful in order to determine \"would be index\" more effectively\n * @param {HTMLElement} dz\n * @return {number} - the shadow element index\n */\nfunction cacheShadowRect(dz) {\n const shadowElIndex = Array.from(dz.children).findIndex(child => child.getAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME));\n if (shadowElIndex >= 0) {\n if (!dzToShadowIndexToRect.has(dz)) {\n dzToShadowIndexToRect.set(dz, new Map());\n }\n dzToShadowIndexToRect.get(dz).set(shadowElIndex, getAbsoluteRectNoTransforms(dz.children[shadowElIndex]));\n return shadowElIndex;\n }\n return undefined;\n}\n\n/**\n * @typedef {Object} Index\n * @property {number} index - the would be index\n * @property {boolean} isProximityBased - false if the element is actually over the index, true if it is not over it but this index is the closest\n */\n/**\n * Find the index for the dragged element in the list it is dragged over\n * @param {HTMLElement} floatingAboveEl\n * @param {HTMLElement} collectionBelowEl\n * @returns {Index|null} - if the element is over the container the Index object otherwise null\n */\nexport function findWouldBeIndex(floatingAboveEl, collectionBelowEl) {\n if (!isCenterOfAInsideB(floatingAboveEl, collectionBelowEl)) {\n return null;\n }\n const children = collectionBelowEl.children;\n // the container is empty, floating element should be the first\n if (children.length === 0) {\n return {index: 0, isProximityBased: true};\n }\n const shadowElIndex = cacheShadowRect(collectionBelowEl);\n\n // the search could be more efficient but keeping it simple for now\n // a possible improvement: pass in the lastIndex it was found in and check there first, then expand from there\n for (let i = 0; i < children.length; i++) {\n if (isCenterOfAInsideB(floatingAboveEl, children[i])) {\n const cachedShadowRect = dzToShadowIndexToRect.has(collectionBelowEl) && dzToShadowIndexToRect.get(collectionBelowEl).get(i);\n if (cachedShadowRect) {\n if (!isPointInsideRect(findCenterOfElement(floatingAboveEl), cachedShadowRect)) {\n return {index: shadowElIndex, isProximityBased: false};\n }\n }\n return {index: i, isProximityBased: false};\n }\n }\n // this can happen if there is space around the children so the floating element has\n //entered the container but not any of the children, in this case we will find the nearest child\n let minDistanceSoFar = Number.MAX_VALUE;\n let indexOfMin = undefined;\n // we are checking all of them because we don't know whether we are dealing with a horizontal or vertical container and where the floating element entered from\n for (let i = 0; i < children.length; i++) {\n const distance = calcDistanceBetweenCenters(floatingAboveEl, children[i]);\n if (distance < minDistanceSoFar) {\n minDistanceSoFar = distance;\n indexOfMin = i;\n }\n }\n return {index: indexOfMin, isProximityBased: true};\n}\n","import {calcInnerDistancesBetweenPointAndSidesOfElement} from \"./intersection\";\nconst SCROLL_ZONE_PX = 25;\n\nexport function makeScroller() {\n let scrollingInfo;\n function resetScrolling() {\n scrollingInfo = {directionObj: undefined, stepPx: 0};\n }\n resetScrolling();\n // directionObj {x: 0|1|-1, y:0|1|-1} - 1 means down in y and right in x\n function scrollContainer(containerEl) {\n const {directionObj, stepPx} = scrollingInfo;\n if (directionObj) {\n containerEl.scrollBy(directionObj.x * stepPx, directionObj.y * stepPx);\n window.requestAnimationFrame(() => scrollContainer(containerEl));\n }\n }\n function calcScrollStepPx(distancePx) {\n return SCROLL_ZONE_PX - distancePx;\n }\n\n /**\n * If the pointer is next to the sides of the element to scroll, will trigger scrolling\n * Can be called repeatedly with updated pointer and elementToScroll values without issues\n * @return {boolean} - true if scrolling was needed\n */\n function scrollIfNeeded(pointer, elementToScroll) {\n if (!elementToScroll) {\n return false;\n }\n const distances = calcInnerDistancesBetweenPointAndSidesOfElement(pointer, elementToScroll);\n if (distances === null) {\n resetScrolling();\n return false;\n }\n const isAlreadyScrolling = !!scrollingInfo.directionObj;\n let [scrollingVertically, scrollingHorizontally] = [false, false];\n // vertical\n if (elementToScroll.scrollHeight > elementToScroll.clientHeight) {\n if (distances.bottom < SCROLL_ZONE_PX) {\n scrollingVertically = true;\n scrollingInfo.directionObj = {x: 0, y: 1};\n scrollingInfo.stepPx = calcScrollStepPx(distances.bottom);\n } else if (distances.top < SCROLL_ZONE_PX) {\n scrollingVertically = true;\n scrollingInfo.directionObj = {x: 0, y: -1};\n scrollingInfo.stepPx = calcScrollStepPx(distances.top);\n }\n if (!isAlreadyScrolling && scrollingVertically) {\n scrollContainer(elementToScroll);\n return true;\n }\n }\n // horizontal\n if (elementToScroll.scrollWidth > elementToScroll.clientWidth) {\n if (distances.right < SCROLL_ZONE_PX) {\n scrollingHorizontally = true;\n scrollingInfo.directionObj = {x: 1, y: 0};\n scrollingInfo.stepPx = calcScrollStepPx(distances.right);\n } else if (distances.left < SCROLL_ZONE_PX) {\n scrollingHorizontally = true;\n scrollingInfo.directionObj = {x: -1, y: 0};\n scrollingInfo.stepPx = calcScrollStepPx(distances.left);\n }\n if (!isAlreadyScrolling && scrollingHorizontally) {\n scrollContainer(elementToScroll);\n return true;\n }\n }\n resetScrolling();\n return false;\n }\n\n return {\n scrollIfNeeded,\n resetScrolling\n };\n}\n","/**\n * @param {Object} object\n * @return {string}\n */\nexport function toString(object) {\n return JSON.stringify(object, null, 2);\n}\n\n/**\n * Finds the depth of the given node in the DOM tree\n * @param {HTMLElement} node\n * @return {number} - the depth of the node\n */\nexport function getDepth(node) {\n if (!node) {\n throw new Error(\"cannot get depth of a falsy node\");\n }\n return _getDepth(node, 0);\n}\nfunction _getDepth(node, countSoFar = 0) {\n if (!node.parentElement) {\n return countSoFar - 1;\n }\n return _getDepth(node.parentElement, countSoFar + 1);\n}\n\n/**\n * A simple util to shallow compare objects quickly, it doesn't validate the arguments so pass objects in\n * @param {Object} objA\n * @param {Object} objB\n * @return {boolean} - true if objA and objB are shallow equal\n */\nexport function areObjectsShallowEqual(objA, objB) {\n if (Object.keys(objA).length !== Object.keys(objB).length) {\n return false;\n }\n for (const keyA in objA) {\n if (!{}.hasOwnProperty.call(objB, keyA) || objB[keyA] !== objA[keyA]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Shallow compares two arrays\n * @param arrA\n * @param arrB\n * @return {boolean} - whether the arrays are shallow equal\n */\nexport function areArraysShallowEqualSameOrder(arrA, arrB) {\n if (arrA.length !== arrB.length) {\n return false;\n }\n for (let i = 0; i < arrA.length; i++) {\n if (arrA[i] !== arrB[i]) {\n return false;\n }\n }\n return true;\n}\n","import {findWouldBeIndex, resetIndexesCache, resetIndexesCacheForDz} from \"./listUtil\";\nimport {findCenterOfElement, isElementOffDocument} from \"./intersection\";\nimport {\n dispatchDraggedElementEnteredContainer,\n dispatchDraggedElementLeftContainerForAnother,\n dispatchDraggedElementLeftContainerForNone,\n dispatchDraggedLeftDocument,\n dispatchDraggedElementIsOverIndex\n} from \"./dispatcher\";\nimport {makeScroller} from \"./scroller\";\nimport {getDepth} from \"./util\";\nimport {printDebug} from \"../constants\";\n\nconst INTERVAL_MS = 200;\nconst TOLERANCE_PX = 10;\nconst {scrollIfNeeded, resetScrolling} = makeScroller();\nlet next;\n\n/**\n * Tracks the dragged elements and performs the side effects when it is dragged over a drop zone (basically dispatching custom-events scrolling)\n * @param {Set<HTMLElement>} dropZones\n * @param {HTMLElement} draggedEl\n * @param {number} [intervalMs = INTERVAL_MS]\n */\nexport function observe(draggedEl, dropZones, intervalMs = INTERVAL_MS) {\n // initialization\n let lastDropZoneFound;\n let lastIndexFound;\n let lastIsDraggedInADropZone = false;\n let lastCentrePositionOfDragged;\n // We are sorting to make sure that in case of nested zones of the same type the one \"on top\" is considered first\n const dropZonesFromDeepToShallow = Array.from(dropZones).sort((dz1, dz2) => getDepth(dz2) - getDepth(dz1));\n\n /**\n * The main function in this module. Tracks where everything is/ should be a take the actions\n */\n function andNow() {\n const currentCenterOfDragged = findCenterOfElement(draggedEl);\n const scrolled = scrollIfNeeded(currentCenterOfDragged, lastDropZoneFound);\n // we only want to make a new decision after the element was moved a bit to prevent flickering\n if (\n !scrolled &&\n lastCentrePositionOfDragged &&\n Math.abs(lastCentrePositionOfDragged.x - currentCenterOfDragged.x) < TOLERANCE_PX &&\n Math.abs(lastCentrePositionOfDragged.y - currentCenterOfDragged.y) < TOLERANCE_PX\n ) {\n next = window.setTimeout(andNow, intervalMs);\n return;\n }\n if (isElementOffDocument(draggedEl)) {\n printDebug(() => \"off document\");\n dispatchDraggedLeftDocument(draggedEl);\n return;\n }\n\n lastCentrePositionOfDragged = currentCenterOfDragged;\n // this is a simple algorithm, potential improvement: first look at lastDropZoneFound\n let isDraggedInADropZone = false;\n for (const dz of dropZonesFromDeepToShallow) {\n if (scrolled) resetIndexesCacheForDz(lastDropZoneFound);\n const indexObj = findWouldBeIndex(draggedEl, dz);\n if (indexObj === null) {\n // it is not inside\n continue;\n }\n const {index} = indexObj;\n isDraggedInADropZone = true;\n // the element is over a container\n if (dz !== lastDropZoneFound) {\n lastDropZoneFound && dispatchDraggedElementLeftContainerForAnother(lastDropZoneFound, draggedEl, dz);\n dispatchDraggedElementEnteredContainer(dz, indexObj, draggedEl);\n lastDropZoneFound = dz;\n } else if (index !== lastIndexFound) {\n dispatchDraggedElementIsOverIndex(dz, indexObj, draggedEl);\n lastIndexFound = index;\n }\n // we handle looping with the 'continue' statement above\n break;\n }\n // the first time the dragged element is not in any dropzone we need to notify the last dropzone it was in\n if (!isDraggedInADropZone && lastIsDraggedInADropZone && lastDropZoneFound) {\n dispatchDraggedElementLeftContainerForNone(lastDropZoneFound, draggedEl);\n lastDropZoneFound = undefined;\n lastIndexFound = undefined;\n lastIsDraggedInADropZone = false;\n } else {\n lastIsDraggedInADropZone = true;\n }\n next = window.setTimeout(andNow, intervalMs);\n }\n andNow();\n}\n\n// assumption - we can only observe one dragged element at a time, this could be changed in the future\nexport function unobserve() {\n printDebug(() => \"unobserving\");\n clearTimeout(next);\n resetScrolling();\n resetIndexesCache();\n}\n","import {makeScroller} from \"./scroller\";\nimport {printDebug} from \"../constants\";\nimport {resetIndexesCache} from \"./listUtil\";\n\nconst INTERVAL_MS = 300;\nlet mousePosition;\n\n/**\n * Do not use this! it is visible for testing only until we get over the issue Cypress not triggering the mousemove listeners\n * // TODO - make private (remove export)\n * @param {{clientX: number, clientY: number}} e\n */\nexport function updateMousePosition(e) {\n const c = e.touches ? e.touches[0] : e;\n mousePosition = {x: c.clientX, y: c.clientY};\n}\nconst {scrollIfNeeded, resetScrolling} = makeScroller();\nlet next;\n\nfunction loop() {\n if (mousePosition) {\n const scrolled = scrollIfNeeded(mousePosition, document.documentElement);\n if (scrolled) resetIndexesCache();\n }\n next = window.setTimeout(loop, INTERVAL_MS);\n}\n\n/**\n * will start watching the mouse pointer and scroll the window if it goes next to the edges\n */\nexport function armWindowScroller() {\n printDebug(() => \"arming window scroller\");\n window.addEventListener(\"mousemove\", updateMousePosition);\n window.addEventListener(\"touchmove\", updateMousePosition);\n loop();\n}\n\n/**\n * will stop watching the mouse pointer and won't scroll the window anymore\n */\nexport function disarmWindowScroller() {\n printDebug(() => \"disarming window scroller\");\n window.removeEventListener(\"mousemove\", updateMousePosition);\n window.removeEventListener(\"touchmove\", updateMousePosition);\n mousePosition = undefined;\n window.clearTimeout(next);\n resetScrolling();\n}\n","/**\n * Fixes svelte issue when cloning node containing (or being) <select> which will loose it's value.\n * Since svelte manages select value internally.\n * @see https://github.com/sveltejs/svelte/issues/6717\n * @see https://github.com/isaacHagoel/svelte-dnd-action/issues/306\n * \n * @param {HTMLElement} el \n * @returns \n */\nexport function svelteNodeClone(el) {\n const cloned = el.cloneNode(true);\n\n const values = [];\n const elIsSelect = el.tagName === \"SELECT\";\n const selects = elIsSelect ? [el] : [...el.querySelectorAll('select')];\n for (const select of selects) {\n values.push(select.value);\n }\n\n if (selects.length <= 0) {\n return cloned;\n }\n\n const clonedSelects = elIsSelect ? [cloned] : [...cloned.querySelectorAll('select')];\n for (let i = 0; i < clonedSelects.length; i++) {\n const select = clonedSelects[i];\n const value = values[i];\n const optionEl = select.querySelector(`option[value=\"${value}\"`);\n if (optionEl) {\n optionEl.setAttribute('selected', true);\n }\n }\n\n return cloned;\n}\n","import {SHADOW_ELEMENT_ATTRIBUTE_NAME, DRAGGED_ELEMENT_ID} from \"../constants\";\nimport {findCenter} from \"./intersection\";\nimport {svelteNodeClone} from \"./svelteNodeClone\";\n\nconst TRANSITION_DURATION_SECONDS = 0.2;\n\n/**\n * private helper function - creates a transition string for a property\n * @param {string} property\n * @return {string} - the transition string\n */\nfunction trs(property) {\n return `${property} ${TRANSITION_DURATION_SECONDS}s ease`;\n}\n/**\n * clones the given element and applies proper styles and transitions to the dragged element\n * @param {HTMLElement} originalElement\n * @param {Point} [positionCenterOnXY]\n * @return {Node} - the cloned, styled element\n */\nexport function createDraggedElementFrom(originalElement, positionCenterOnXY) {\n const rect = originalElement.getBoundingClientRect();\n const draggedEl = svelteNodeClone(originalElement);\n copyStylesFromTo(originalElement, draggedEl);\n draggedEl.id = DRAGGED_ELEMENT_ID;\n draggedEl.style.position = \"fixed\";\n let elTopPx = rect.top;\n let elLeftPx = rect.left;\n draggedEl.style.top = `${elTopPx}px`;\n draggedEl.style.left = `${elLeftPx}px`;\n if (positionCenterOnXY) {\n const center = findCenter(rect);\n elTopPx -= center.y - positionCenterOnXY.y;\n elLeftPx -= center.x - positionCenterOnXY.x;\n window.setTimeout(() => {\n draggedEl.style.top = `${elTopPx}px`;\n draggedEl.style.left = `${elLeftPx}px`;\n }, 0);\n }\n draggedEl.style.margin = \"0\";\n // we can't have relative or automatic height and width or it will break the illusion\n draggedEl.style.boxSizing = \"border-box\";\n draggedEl.style.height = `${rect.height}px`;\n draggedEl.style.width = `${rect.width}px`;\n draggedEl.style.transition = `${trs(\"top\")}, ${trs(\"left\")}, ${trs(\"background-color\")}, ${trs(\"opacity\")}, ${trs(\"color\")} `;\n // this is a workaround for a strange browser bug that causes the right border to disappear when all the transitions are added at the same time\n window.setTimeout(() => (draggedEl.style.transition += `, ${trs(\"width\")}, ${trs(\"height\")}`), 0);\n draggedEl.style.zIndex = \"9999\";\n draggedEl.style.cursor = \"grabbing\";\n\n return draggedEl;\n}\n\n/**\n * styles the dragged element to a 'dropped' state\n * @param {HTMLElement} draggedEl\n */\nexport function moveDraggedElementToWasDroppedState(draggedEl) {\n draggedEl.style.cursor = \"grab\";\n}\n\n/**\n * Morphs the dragged element style, maintains the mouse pointer within the element\n * @param {HTMLElement} draggedEl\n * @param {HTMLElement} copyFromEl - the element the dragged element should look like, typically the shadow element\n * @param {number} currentMouseX\n * @param {number} currentMouseY\n */\nexport function morphDraggedElementToBeLike(draggedEl, copyFromEl, currentMouseX, currentMouseY) {\n copyStylesFromTo(copyFromEl, draggedEl);\n const newRect = copyFromEl.getBoundingClientRect();\n const draggedElRect = draggedEl.getBoundingClientRect();\n const widthChange = newRect.width - draggedElRect.width;\n const heightChange = newRect.height - draggedElRect.height;\n if (widthChange || heightChange) {\n const relativeDistanceOfMousePointerFromDraggedSides = {\n left: (currentMouseX - draggedElRect.left) / draggedElRect.width,\n top: (currentMouseY - draggedElRect.top) / draggedElRect.height\n };\n draggedEl.style.height = `${newRect.height}px`;\n draggedEl.style.width = `${newRect.width}px`;\n draggedEl.style.left = `${parseFloat(draggedEl.style.left) - relativeDistanceOfMousePointerFromDraggedSides.left * widthChange}px`;\n draggedEl.style.top = `${parseFloat(draggedEl.style.top) - relativeDistanceOfMousePointerFromDraggedSides.top * heightChange}px`;\n }\n}\n\n/**\n * @param {HTMLElement} copyFromEl\n * @param {HTMLElement} copyToEl\n */\nfunction copyStylesFromTo(copyFromEl, copyToEl) {\n const computedStyle = window.getComputedStyle(copyFromEl);\n Array.from(computedStyle)\n .filter(\n s =>\n s.startsWith(\"background\") ||\n s.startsWith(\"padding\") ||\n s.startsWith(\"font\") ||\n s.startsWith(\"text\") ||\n s.startsWith(\"align\") ||\n s.startsWith(\"justify\") ||\n s.startsWith(\"display\") ||\n s.startsWith(\"flex\") ||\n s.startsWith(\"border\") ||\n s === \"opacity\" ||\n s === \"color\" ||\n s === \"list-style-type\"\n )\n .forEach(s => copyToEl.style.setProperty(s, computedStyle.getPropertyValue(s), computedStyle.getPropertyPriority(s)));\n}\n\n/**\n * makes the element compatible with being draggable\n * @param {HTMLElement} draggableEl\n * @param {boolean} dragDisabled\n */\nexport function styleDraggable(draggableEl, dragDisabled) {\n draggableEl.draggable = false;\n draggableEl.ondragstart = () => false;\n if (!dragDisabled) {\n draggableEl.style.userSelect = \"none\";\n draggableEl.style.WebkitUserSelect = \"none\";\n draggableEl.style.cursor = \"grab\";\n } else {\n draggableEl.style.userSelect = \"\";\n draggableEl.style.WebkitUserSelect = \"\";\n draggableEl.style.cursor = \"\";\n }\n}\n\n/**\n * Hides the provided element so that it can stay in the dom without interrupting\n * @param {HTMLElement} dragTarget\n */\nexport function hideElement(dragTarget) {\n dragTarget.style.display = \"none\";\n dragTarget.style.position = \"fixed\";\n dragTarget.style.zIndex = \"-5\";\n}\n\n/**\n * styles the shadow element\n * @param {HTMLElement} shadowEl\n */\nexport function decorateShadowEl(shadowEl) {\n shadowEl.style.visibility = \"hidden\";\n shadowEl.setAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME, \"true\");\n}\n\n/**\n * undo the styles the shadow element\n * @param {HTMLElement} shadowEl\n */\nexport function unDecorateShadowElement(shadowEl) {\n shadowEl.style.visibility = \"\";\n shadowEl.removeAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME);\n}\n\n/**\n * will mark the given dropzones as visually active\n * @param {Array<HTMLElement>} dropZones\n * @param {Function} getStyles - maps a dropzone to a styles object (so the styles can be removed)\n * @param {Function} getClasses - maps a dropzone to a classList\n */\nexport function styleActiveDropZones(dropZones, getStyles = () => {}, getClasses = () => []) {\n dropZones.forEach(dz => {\n const styles = getStyles(dz);\n Object.keys(styles).forEach(style => {\n dz.style[style] = styles[style];\n });\n getClasses(dz).forEach(c => dz.classList.add(c));\n });\n}\n\n/**\n * will remove the 'active' styling from given dropzones\n * @param {Array<HTMLElement>} dropZones\n * @param {Function} getStyles - maps a dropzone to a styles object\n * @param {Function} getClasses - maps a dropzone to a classList\n */\nexport function styleInactiveDropZones(dropZones, getStyles = () => {}, getClasses = () => []) {\n dropZones.forEach(dz => {\n const styles = getStyles(dz);\n Object.keys(styles).forEach(style => {\n dz.style[style] = \"\";\n });\n getClasses(dz).forEach(c => dz.classList.contains(c) && dz.classList.remove(c));\n });\n}\n\n/**\n * will prevent the provided element from shrinking by setting its minWidth and minHeight to the current width and height values\n * @param {HTMLElement} el\n * @return {function(): void} - run this function to undo the operation and restore the original values\n */\nexport function preventShrinking(el) {\n const originalMinHeight = el.style.minHeight;\n el.style.minHeight = window.getComputedStyle(el).getPropertyValue(\"height\");\n const originalMinWidth = el.style.minWidth;\n el.style.minWidth = window.getComputedStyle(el).getPropertyValue(\"width\");\n return function undo() {\n el.style.minHeight = originalMinHeight;\n el.style.minWidth = originalMinWidth;\n };\n}\n","import {\n decrementActiveDropZoneCount,\n incrementActiveDropZoneCount,\n ITEM_ID_KEY,\n printDebug,\n SHADOW_ITEM_MARKER_PROPERTY_NAME,\n SHADOW_PLACEHOLDER_ITEM_ID,\n SOURCES,\n TRIGGERS\n} from \"./constants\";\nimport {observe, unobserve} from \"./helpers/observer\";\nimport {armWindowScroller, disarmWindowScroller} from \"./helpers/windowScroller\";\nimport {\n createDraggedElementFrom,\n decorateShadowEl,\n hideElement,\n morphDraggedElementToBeLike,\n moveDraggedElementToWasDroppedState,\n preventShrinking,\n styleActiveDropZones,\n styleDraggable,\n styleInactiveDropZones,\n unDecorateShadowElement\n} from \"./helpers/styler\";\nimport {\n dispatchConsiderEvent,\n dispatchFinalizeEvent,\n DRAGGED_ENTERED_EVENT_NAME,\n DRAGGED_LEFT_DOCUMENT_EVENT_NAME,\n DRAGGED_LEFT_EVENT_NAME,\n DRAGGED_LEFT_TYPES,\n DRAGGED_OVER_INDEX_EVENT_NAME\n} from \"./helpers/dispatcher\";\nimport {areArraysShallowEqualSameOrder, areObjectsShallowEqual, toString} from \"./helpers/util\";\nimport {getBoundingRectNoTransforms} from \"./helpers/intersection\";\n\nconst DEFAULT_DROP_ZONE_TYPE = \"--any--\";\nconst MIN_OBSERVATION_INTERVAL_MS = 100;\nconst MIN_MOVEMENT_BEFORE_DRAG_START_PX = 3;\nconst DEFAULT_DROP_TARGET_STYLE = {\n outline: \"rgba(255, 255, 102, 0.7) solid 2px\"\n};\n\nlet originalDragTarget;\nlet draggedEl;\nlet draggedElData;\nlet draggedElType;\nlet originDropZone;\nlet originIndex;\nlet shadowElData;\nlet shadowElDropZone;\nlet dragStartMousePosition;\nlet currentMousePosition;\nlet isWorkingOnPreviousDrag = false;\nlet finalizingPreviousDrag = false;\nlet unlockOriginDzMinDimensions;\nlet isDraggedOutsideOfAnyDz = false;\nlet scheduledForRemovalAfterDrop = [];\n\n// a map from type to a set of drop-zones\nconst typeToDropZones = new Map();\n// important - this is needed because otherwise the config that would be used for everyone is the config of the element that created the event listeners\nconst dzToConfig = new Map();\n// this is needed in order to be able to cleanup old listeners and avoid stale closures issues (as the listener is defined within each zone)\nconst elToMouseDownListener = new WeakMap();\n\n/* drop-zones registration management */\nfunction registerDropZone(dropZoneEl, type) {\n printDebug(() => \"registering drop-zone if absent\");\n if (!typeToDropZones.has(type)) {\n typeToDropZones.set(type, new Set());\n }\n if (!typeToDropZones.get(type).has(dropZoneEl)) {\n typeToDropZones.get(type).add(dropZoneEl);\n incrementActiveDropZoneCount();\n }\n}\nfunction unregisterDropZone(dropZoneEl, type) {\n typeToDropZones.get(type).delete(dropZoneEl);\n decrementActiveDropZoneCount();\n if (typeToDropZones.get(type).size === 0) {\n typeToDropZones.delete(type);\n }\n}\n\n/* functions to manage observing the dragged element and trigger custom drag-events */\nfunction watchDraggedElement() {\n printDebug(() => \"watching dragged element\");\n armWindowScroller();\n const dropZones = typeToDropZones.get(draggedElType);\n for (const dz of dropZones) {\n dz.addEventListener(DRAGGED_ENTERED_EVENT_NAME, handleDraggedEntered);\n dz.addEventListener(DRAGGED_LEFT_EVENT_NAME, handleDraggedLeft);\n dz.addEventListener(DRAGGED_OVER_INDEX_EVENT_NAME, handleDraggedIsOverIndex);\n }\n window.addEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, handleDrop);\n // it is important that we don't have an interval that is faster than the flip duration because it can cause elements to jump bach and forth\n const observationIntervalMs = Math.max(\n MIN_OBSERVATION_INTERVAL_MS,\n ...Array.from(dropZones.keys()).map(dz => dzToConfig.get(dz).dropAnimationDurationMs)\n );\n observe(draggedEl, dropZones, observationIntervalMs * 1.07);\n}\nfunction unWatchDraggedElement() {\n printDebug(() => \"unwatching dragged element\");\n disarmWindowScroller();\n const dropZones = typeToDropZones.get(draggedElType);\n for (const dz of dropZones) {\n dz.removeEventListener(DRAGGED_ENTERED_EVENT_NAME, handleDraggedEntered);\n dz.removeEventListener(DRAGGED_LEFT_EVENT_NAME, handleDraggedLeft);\n dz.removeEventListener(DRAGGED_OVER_INDEX_EVENT_NAME, handleDraggedIsOverIndex);\n }\n window.removeEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, handleDrop);\n unobserve();\n}\n\n// finds the initial placeholder that is placed there on drag start\nfunction findShadowPlaceHolderIdx(items) {\n return items.findIndex(item => item[ITEM_ID_KEY] === SHADOW_PLACEHOLDER_ITEM_ID);\n}\nfunction findShadowElementIdx(items) {\n // checking that the id is not the placeholder's for Dragula like usecases\n return items.findIndex(item => !!item[SHADOW_ITEM_MARKER_PROPERTY_NAME] && item[ITEM_ID_KEY] !== SHADOW_PLACEHOLDER_ITEM_ID);\n}\n\n/* custom drag-events handlers */\nfunction handleDraggedEntered(e) {\n printDebug(() => [\"dragged entered\", e.currentTarget, e.detail]);\n let {items, dropFromOthersDisabled} = dzToConfig.get(e.currentTarget);\n if (dropFromOthersDisabled && e.currentTarget !== originDropZone) {\n printDebug(() => \"ignoring dragged entered because drop is currently disabled\");\n return;\n }\n isDraggedOutsideOfAnyDz = false;\n // this deals with another race condition. in rare occasions (super rapid operations) the list hasn't updated yet\n items = items.filter(item => item[ITEM_ID_KEY] !== shadowElData[ITEM_ID_KEY]);\n printDebug(() => `dragged entered items ${toString(items)}`);\n\n if (originDropZone !== e.currentTarget) {\n const originZoneItems = dzToConfig.get(originDropZone).items;\n const newOriginZoneItems = originZoneItems.filter(item => !item[SHADOW_ITEM_MARKER_PROPERTY_NAME]);\n dispatchConsiderEvent(originDropZone, newOriginZoneItems, {\n trigger: TRIGGERS.DRAGGED_ENTERED_ANOTHER,\n id: draggedElData[ITEM_ID_KEY],\n source: SOURCES.POINTER\n });\n } else {\n const shadowPlaceHolderIdx = findShadowPlaceHolderIdx(items);\n if (shadowPlaceHolderIdx !== -1) {\n // only happens right after drag start, on the first drag entered event\n printDebug(() => \"removing placeholder item from origin dz\");\n items.splice(shadowPlaceHolderIdx, 1);\n }\n }\n\n const {index, isProximityBased} = e.detail.indexObj;\n const shadowElIdx = isProximityBased && index === e.currentTarget.children.length - 1 ? index + 1 : index;\n shadowElDropZone = e.currentTarget;\n items.splice(shadowElIdx, 0, shadowElData);\n dispatchConsiderEvent(e.currentTarget, items, {trigger: TRIGGERS.DRAGGED_ENTERED, id: draggedElData[ITEM_ID_KEY], source: SOURCES.POINTER});\n}\n\nfunction handleDraggedLeft(e) {\n // dealing with a rare race condition on extremely rapid clicking and dropping\n if (!isWorkingOnPreviousDrag) return;\n printDebug(() => [\"dragged left\", e.currentTarget, e.detail]);\n const {items, dropFromOthersDisabled} = dzToConfig.get(e.currentTarget);\n if (dropFromOthersDisabled && e.currentTarget !== originDropZone && e.currentTarget !== shadowElDropZone) {\n printDebug(() => \"drop is currently disabled\");\n return;\n }\n const shadowElIdx = findShadowElementIdx(items);\n const shadowItem = items.splice(shadowElIdx, 1)[0];\n shadowElDropZone = undefined;\n const {type, theOtherDz} = e.detail;\n if (\n type === DRAGGED_LEFT_TYPES.OUTSIDE_OF_ANY ||\n (type === DRAGGED_LEFT_TYPES.LEFT_FOR_ANOTHER && theOtherDz !== originDropZone && dzToConfig.get(theOtherDz).dropFromOthersDisabled)\n ) {\n printDebug(() => \"dragged left all, putting shadow element back in the origin dz\");\n isDraggedOutsideOfAnyDz = true;\n shadowElDropZone = originDropZone;\n const originZoneItems = dzToConfig.get(originDropZone).items;\n originZoneItems.splice(originIndex, 0, shadowItem);\n dispatchConsiderEvent(originDropZone, originZoneItems, {\n trigger: TRIGGERS.DRAGGED_LEFT_ALL,\n id: draggedElData[ITEM_ID_KEY],\n source: SOURCES.POINTER\n });\n }\n // for the origin dz, when the dragged is outside of any, this will be fired in addition to the previous. this is for simplicity\n dispatchConsiderEvent(e.currentTarget, items, {\n trigger: TRIGGERS.DRAGGED_LEFT,\n id: draggedElData[ITEM_ID_KEY],\n source: SOURCES.POINTER\n });\n}\nfunction handleDraggedIsOverIndex(e) {\n printDebug(() => [\"dragged is over index\", e.currentTarget, e.detail]);\n const {items, dropFromOthersDisabled} = dzToConfig.get(e.currentTarget);\n if (dropFromOthersDisabled && e.currentTarget !== originDropZone) {\n printDebug(() => \"drop is currently disabled\");\n return;\n }\n isDraggedOutsideOfAnyDz = false;\n const {index} = e.detail.indexObj;\n const shadowElIdx = findShadowElementIdx(items);\n items.splice(shadowElIdx, 1);\n items.splice(index, 0, shadowElData);\n dispatchConsiderEvent(e.currentTarget, items, {trigger: TRIGGERS.DRAGGED_OVER_INDEX, id: draggedElData[ITEM_ID_KEY], source: SOURCES.POINTER});\n}\n\n// Global mouse/touch-events handlers\nfunction handleMouseMove(e) {\n e.preventDefault();\n const c = e.touches ? e.touches[0] : e;\n currentMousePosition = {x: c.clientX, y: c.clientY};\n draggedEl.style.transform = `translate3d(${currentMousePosition.x - dragStartMousePosition.x}px, ${\n currentMousePosition.y - dragStartMousePosition.y\n }px, 0)`;\n}\n\nfunction handleDrop() {\n printDebug(() => \"dropped\");\n finalizingPreviousDrag = true;\n // cleanup\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"touchmove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleDrop);\n window.removeEventListener(\"touchend\", handleDrop);\n unWatchDraggedElement();\n moveDraggedElementToWasDroppedState(draggedEl);\n\n if (!shadowElDropZone) {\n printDebug(() => \"element was dropped right after it left origin but before entering somewhere else\");\n shadowElDropZone = originDropZone;\n }\n printDebug(() => [\"dropped in dz\", shadowElDropZone]);\n let {items, type} = dzToConfig.get(shadowElDropZone);\n styleInactiveDropZones(\n typeToDropZones.get(type),\n dz => dzToConfig.get(dz).dropTargetStyle,\n dz => dzToConfig.get(dz).dropTargetClasses\n );\n let shadowElIdx = findShadowElementIdx(items);\n // the handler might remove the shadow element, ex: dragula like copy on drag\n if (shadowElIdx === -1) shadowElIdx = originIndex;\n items = items.map(item => (item[SHADOW_ITEM_MARKER_PROPERTY_NAME] ? draggedElData : item));\n function finalizeWithinZone() {\n unlockOriginDzMinDimensions();\n dispatchFinalizeEvent(shadowElDropZone, items, {\n trigger: isDraggedOutsideOfAnyDz ? TRIGGERS.DROPPED_OUTSIDE_OF_ANY : TRIGGERS.DROPPED_INTO_ZONE,\n id: draggedElData[ITEM_ID_KEY],\n source: SOURCES.POINTER\n });\n if (shadowElDropZone !== originDropZone) {\n // letting the origin drop zone know the element was permanently taken away\n dispatchFinalizeEvent(originDropZone, dzToConfig.get(originDropZone).items, {\n trigger: TRIGGERS.DROPPED_INTO_ANOTHER,\n id: draggedElData[ITEM_ID_KEY],\n source: SOURCES.POINTER\n });\n }\n unDecorateShadowElement(shadowElDropZone.children[shadowElIdx]);\n cleanupPostDrop();\n }\n animateDraggedToFinalPosition(shadowElIdx, finalizeWithinZone);\n}\n\n// helper function for handleDrop\nfunction animateDraggedToFinalPosition(shadowElIdx, callback) {\n const shadowElRect = getBoundingRectNoTransforms(shadowElDropZone.children[shadowElIdx]);\n const newTransform = {\n x: shadowElRect.left - parseFloat(draggedEl.style.left),\n y: shadowElRect.top - parseFloat(draggedEl.style.top)\n };\n const {dropAnimationDurationMs} = dzToConfig.get(shadowElDropZone);\n const transition = `transform ${dropAnimationDurationMs}ms ease`;\n draggedEl.style.transition = draggedEl.style.transition ? draggedEl.style.transition + \",\" + transition : transition;\n draggedEl.style.transform = `translate3d(${newTransform.x}px, ${newTransform.y}px, 0)`;\n window.setTimeout(callback, dropAnimationDurationMs);\n}\n\nfunction scheduleDZForRemovalAfterDrop(dz, destroy) {\n scheduledForRemovalAfterDrop.push({dz, destroy});\n window.requestAnimationFrame(() => {\n hideElement(dz);\n document.body.appendChild(dz);\n });\n}\n/* cleanup */\nfunction cleanupPostDrop() {\n draggedEl.remove();\n originalDragTarget.remove();\n if (scheduledForRemovalAfterDrop.length) {\n printDebug(() => [\"will destroy zones that were removed during drag\", scheduledForRemovalAfterDrop]);\n scheduledForRemovalAfterDrop.forEach(({dz, destroy}) => {\n destroy();\n dz.remove();\n });\n scheduledForRemovalAfterDrop = [];\n }\n draggedEl = undefined;\n originalDragTarget = undefined;\n draggedElData = undefined;\n draggedElType = undefined;\n originDropZone = undefined;\n originIndex = undefined;\n shadowElData = undefined;\n shadowElDropZone = undefined;\n dragStartMousePosition = undefined;\n currentMousePosition = undefined;\n isWorkingOnPreviousDrag = false;\n finalizingPreviousDrag = false;\n unlockOriginDzMinDimensions = undefined;\n isDraggedOutsideOfAnyDz = false;\n}\n\nexport function dndzone(node, options) {\n let initialized = false;\n const config = {\n items: undefined,\n type: undefined,\n flipDurationMs: 0,\n dragDisabled: false,\n morphDisabled: false,\n dropFromOthersDisabled: false,\n dropTargetStyle: DEFAULT_DROP_TARGET_STYLE,\n dropTargetClasses: [],\n transformDraggedElement: () => {},\n centreDraggedOnCursor: false\n };\n printDebug(() => [`dndzone good to go options: ${toString(options)}, config: ${toString(config)}`, {node}]);\n let elToIdx = new Map();\n\n function addMaybeListeners() {\n window.addEventListener(\"mousemove\", handleMouseMoveMaybeDragStart, {passive: false});\n window.addEventListener(\"touchmove\", handleMouseMoveMaybeDragStart, {passive: false, capture: false});\n window.addEventListener(\"mouseup\", handleFalseAlarm, {passive: false});\n window.addEventListener(\"touchend\", handleFalseAlarm, {passive: false});\n }\n function removeMaybeListeners() {\n window.removeEventListener(\"mousemove\", handleMouseMoveMaybeDragStart);\n window.removeEventListener(\"touchmove\", handleMouseMoveMaybeDragStart);\n window.removeEventListener(\"mouseup\", handleFalseAlarm);\n window.removeEventListener(\"touchend\", handleFalseAlarm);\n }\n function handleFalseAlarm() {\n removeMaybeListeners();\n originalDragTarget = undefined;\n dragStartMousePosition = undefined;\n currentMousePosition = undefined;\n }\n\n function handleMouseMoveMaybeDragStart(e) {\n e.preventDefault();\n const c = e.touches ? e.touches[0] : e;\n currentMousePosition = {x: c.clientX, y: c.clientY};\n if (\n Math.abs(currentMousePosition.x - dragStartMousePosition.x) >= MIN_MOVEMENT_BEFORE_DRAG_START_PX ||\n Math.abs(currentMousePosition.y - dragStartMousePosition.y) >= MIN_MOVEMENT_BEFORE_DRAG_START_PX\n ) {\n removeMaybeListeners();\n handleDragStart();\n }\n }\n function handleMouseDown(e) {\n // on safari clicking on a select element doesn't fire mouseup at the end of the click and in general this makes more sense\n if (e.target !== e.currentTarget && (e.target.value !== undefined || e.target.isContentEditable)) {\n printDebug(() => \"won't initiate drag on a nested input element\");\n return;\n }\n // prevents responding to any button but left click which equals 0 (which is falsy)\n if (e.button) {\n printDebug(() => `ignoring none left click button: ${e.button}`);\n return;\n }\n if (isWorkingOnPreviousDrag) {\n printDebug(() => \"cannot start a new drag before finalizing previous one\");\n return;\n }\n e.stopPropagation();\n const c = e.touches ? e.touches[0] : e;\n dragStartMousePosition = {x: c.clientX, y: c.clientY};\n currentMousePosition = {...dragStartMousePosition};\n originalDragTarget = e.currentTarget;\n addMaybeListeners();\n }\n\n function handleDragStart() {\n printDebug(() => [`drag start config: ${toString(config)}`, originalDragTarget]);\n isWorkingOnPreviousDrag = true;\n\n // initialising globals\n const currentIdx = elToIdx.get(originalDragTarget);\n originIndex = currentIdx;\n originDropZone = originalDragTarget.parentElement;\n /** @type {ShadowRoot | HTMLDocument} */\n const rootNode = originDropZone.getRootNode();\n const originDropZoneRoot = rootNode.body || rootNode;\n const {items, type, centreDraggedOnCursor} = config;\n draggedElData = {...items[currentIdx]};\n draggedElType = type;\n shadowElData = {...draggedElData, [SHADOW_ITEM_MARKER_PROPERTY_NAME]: true};\n // The initial shadow element. We need a different id at first in order to avoid conflicts and timing issues\n const placeHolderElData = {...shadowElData, [ITEM_ID_KEY]: SHADOW_PLACEHOLDER_ITEM_ID};\n\n // creating the draggable element\n draggedEl = createDraggedElementFrom(originalDragTarget, centreDraggedOnCursor && currentMousePosition);\n // We will keep the original dom node in the dom because touch events keep firing on it, we want to re-add it after the framework removes it\n function keepOriginalElementInDom() {\n if (!draggedEl.parentElement) {\n originDropZoneRoot.appendChild(draggedEl);\n // to prevent the outline from disappearing\n draggedEl.focus();\n watchDraggedElement();\n hideElement(originalDragTarget);\n originDropZoneRoot.appendChild(originalDragTarget);\n } else {\n window.requestAnimationFrame(keepOriginalElementInDom);\n }\n }\n window.requestAnimationFrame(keepOriginalElementInDom);\n\n styleActiveDropZones(\n Array.from(typeToDropZones.get(config.type)).filter(dz => dz === originDropZone || !dzToConfig.get(dz).dropFromOthersDisabled),\n dz => dzToConfig.get(dz).dropTargetStyle,\n dz => dzToConfig.get(dz).dropTargetClasses\n );\n\n // removing the original element by removing its data entry\n items.splice(currentIdx, 1, placeHolderElData);\n unlockOriginDzMinDimensions = preventShrinking(originDropZone);\n\n dispatchConsiderEvent(originDropZone, items, {trigger: TRIGGERS.DRAG_STARTED, id: draggedElData[ITEM_ID_KEY], source: SOURCES.POINTER});\n\n // handing over to global handlers - starting to watch the element\n window.addEventListener(\"mousemove\", handleMouseMove, {passive: false});\n window.addEventListener(\"touchmove\", handleMouseMove, {passive: false, capture: false});\n window.addEventListener(\"mouseup\", handleDrop, {passive: false});\n window.addEventListener(\"touchend\", handleDrop, {passive: false});\n }\n\n function configure({\n items = undefined,\n flipDurationMs: dropAnimationDurationMs = 0,\n type: newType = DEFAULT_DROP_ZONE_TYPE,\n dragDisabled = false,\n morphDisabled = false,\n dropFromOthersDisabled = false,\n dropTargetStyle = DEFAULT_DROP_TARGET_STYLE,\n dropTargetClasses = [],\n transformDraggedElement = () => {},\n centreDraggedOnCursor = false\n }) {\n config.dropAnimationDurationMs = dropAnimationDurationMs;\n if (config.type && newType !== config.type) {\n unregisterDropZone(node, config.type);\n }\n config.type = newType;\n registerDropZone(node, newType);\n config.items = [...items];\n config.dragDisabled = dragDisabled;\n config.morphDisabled = morphDisabled;\n config.transformDraggedElement = transformDraggedElement;\n config.centreDraggedOnCursor = centreDraggedOnCursor;\n\n // realtime update for dropTargetStyle\n if (\n initialized &&\n isWorkingOnPreviousDrag &&\n !finalizingPreviousDrag &&\n (!areObjectsShallowEqual(dropTargetStyle, config.dropTargetStyle) ||\n !areArraysShallowEqualSameOrder(dropTargetClasses, config.dropTargetClasses))\n ) {\n styleInactiveDropZones(\n [node],\n () => config.dropTargetStyle,\n () => dropTargetClasses\n );\n styleActiveDropZones(\n [node],\n () => dropTargetStyle,\n () => dropTargetClasses\n );\n }\n config.dropTargetStyle = dropTargetStyle;\n config.dropTargetClasses = [...dropTargetClasses];\n\n // realtime update for dropFromOthersDisabled\n function getConfigProp(dz, propName) {\n return dzToConfig.get(dz) ? dzToConfig.get(dz)[propName] : config[propName];\n }\n if (initialized && isWorkingOnPreviousDrag && config.dropFromOthersDisabled !== dropFromOthersDisabled) {\n if (dropFromOthersDisabled) {\n styleInactiveDropZones(\n [node],\n dz => getConfigProp(dz, \"dropTargetStyle\"),\n dz => getConfigProp(dz, \"dropTargetClasses\")\n );\n } else {\n styleActiveDropZones(\n [node],\n dz => getConfigProp(dz, \"dropTargetStyle\"),\n dz => getConfigProp(dz, \"dropTargetClasses\")\n );\n }\n }\n config.dropFromOthersDisabled = dropFromOthersDisabled;\n\n dzToConfig.set(node, config);\n const shadowElIdx = findShadowElementIdx(config.items);\n for (let idx = 0; idx < node.children.length; idx++) {\n const draggableEl = node.children[idx];\n styleDraggable(draggableEl, dragDisabled);\n if (idx === shadowElIdx) {\n config.transformDraggedElement(draggedEl, draggedElData, idx);\n if (!morphDisabled) {\n morphDraggedElementToBeLike(draggedEl, draggableEl, currentMousePosition.x, currentMousePosition.y);\n }\n decorateShadowEl(draggableEl);\n continue;\n }\n draggableEl.removeEventListener(\"mousedown\", elToMouseDownListener.get(draggableEl));\n draggableEl.removeEventListener(\"touchstart\", elToMouseDownListener.get(draggableEl));\n if (!dragDisabled) {\n draggableEl.addEventListener(\"mousedown\", handleMouseDown);\n draggableEl.addEventListener(\"touchstart\", handleMouseDown);\n elToMouseDownListener.set(draggableEl, handleMouseDown);\n }\n // updating the idx\n elToIdx.set(draggableEl, idx);\n\n if (!initialized) {\n initialized = true;\n }\n }\n }\n configure(options);\n\n return {\n update: newOptions => {\n printDebug(() => `pointer dndzone will update newOptions: ${toString(newOptions)}`);\n configure(newOptions);\n },\n destroy: () => {\n function destroyDz() {\n printDebug(() => \"pointer dndzone will destroy\");\n unregisterDropZone(node, dzToConfig.get(node).type);\n dzToConfig.delete(node);\n }\n if (isWorkingOnPreviousDrag) {\n printDebug(() => \"pointer dndzone will be scheduled for destruction\");\n scheduleDZForRemovalAfterDrop(node, destroyDz);\n } else {\n destroyDz();\n }\n }\n };\n}\n","import {isOnServer} from \"../constants\";\n\nconst INSTRUCTION_IDs = {\n DND_ZONE_ACTIVE: \"dnd-zone-active\",\n DND_ZONE_DRAG_DISABLED: \"dnd-zone-drag-disabled\"\n};\nconst ID_TO_INSTRUCTION = {\n [INSTRUCTION_IDs.DND_ZONE_ACTIVE]: \"Tab to one the items and press space-bar or enter to start dragging it\",\n [INSTRUCTION_IDs.DND_ZONE_DRAG_DISABLED]: \"This is a disabled drag and drop list\"\n};\n\nconst ALERT_DIV_ID = \"dnd-action-aria-alert\";\nlet alertsDiv;\n\nfunction initAriaOnBrowser() {\n if (alertsDiv) {\n // it is already initialized\n return;\n }\n // setting the dynamic alerts\n alertsDiv = document.createElement(\"div\");\n (function initAlertsDiv() {\n alertsDiv.id = ALERT_DIV_ID;\n // tab index -1 makes the alert be read twice on chrome for some reason\n //alertsDiv.tabIndex = -1;\n alertsDiv.style.position = \"fixed\";\n alertsDiv.style.bottom = \"0\";\n alertsDiv.style.left = \"0\";\n alertsDiv.style.zIndex = \"-5\";\n alertsDiv.style.opacity = \"0\";\n alertsDiv.style.height = \"0\";\n alertsDiv.style.width = \"0\";\n alertsDiv.setAttribute(\"role\", \"alert\");\n })();\n document.body.prepend(alertsDiv);\n\n // setting the instructions\n Object.entries(ID_TO_INSTRUCTION).forEach(([id, txt]) => document.body.prepend(instructionToHiddenDiv(id, txt)));\n}\n\n/**\n * Initializes the static aria instructions so they can be attached to zones\n * @return {{DND_ZONE_ACTIVE: string, DND_ZONE_DRAG_DISABLED: string} | null} - the IDs for static aria instruction (to be used via aria-describedby) or null on the server\n */\nexport function initAria() {\n if (isOnServer) return null;\n if (document.readyState === \"complete\") {\n initAriaOnBrowser();\n } else {\n window.addEventListener(\"DOMContentLoaded\", initAriaOnBrowser);\n }\n return {...INSTRUCTION_IDs};\n}\n\n/**\n * Removes all the artifacts (dom elements) added by this module\n */\nexport function destroyAria() {\n if (isOnServer || !alertsDiv) return;\n Object.keys(ID_TO_INSTRUCTION).forEach(id => document.getElementById(id)?.remove());\n alertsDiv.remove();\n alertsDiv = undefined;\n}\n\nfunction instructionToHiddenDiv(id, txt) {\n const div = document.createElement(\"div\");\n div.id = id;\n div.innerHTML = `<p>${txt}</p>`;\n div.style.display = \"none\";\n div.style.position = \"fixed\";\n div.style.zIndex = \"-5\";\n return div;\n}\n\n/**\n * Will make the screen reader alert the provided text to the user\n * @param {string} txt\n */\nexport function alertToScreenReader(txt) {\n if (isOnServer) return;\n if (!alertsDiv) {\n initAriaOnBrowser();\n }\n alertsDiv.innerHTML = \"\";\n const alertText = document.createTextNode(txt);\n alertsDiv.appendChild(alertText);\n // this is needed for Safari\n alertsDiv.style.display = \"none\";\n alertsDiv.style.display = \"inline\";\n}\n","import {decrementActiveDropZoneCount, incrementActiveDropZoneCount, ITEM_ID_KEY, SOURCES, TRIGGERS} from \"./constants\";\nimport {styleActiveDropZones, styleInactiveDropZones} from \"./helpers/styler\";\nimport {dispatchConsiderEvent, dispatchFinalizeEvent} from \"./helpers/dispatcher\";\nimport {initAria, alertToScreenReader, destroyAria} from \"./helpers/aria\";\nimport {toString} from \"./helpers/util\";\nimport {printDebug} from \"./constants\";\n\nconst DEFAULT_DROP_ZONE_TYPE = \"--any--\";\nconst DEFAULT_DROP_TARGET_STYLE = {\n outline: \"rgba(255, 255, 102, 0.7) solid 2px\"\n};\n\nlet isDragging = false;\nlet draggedItemType;\nlet focusedDz;\nlet focusedDzLabel = \"\";\nlet focusedItem;\nlet focusedItemId;\nlet focusedItemLabel = \"\";\nconst allDragTargets = new WeakSet();\nconst elToKeyDownListeners = new WeakMap();\nconst elToFocusListeners = new WeakMap();\nconst dzToHandles = new Map();\nconst dzToConfig = new Map();\nconst typeToDropZones = new Map();\n\n/* TODO (potentially)\n * what's the deal with the black border of voice-reader not following focus?\n * maybe keep focus on the last dragged item upon drop?\n */\n\nlet INSTRUCTION_IDs;\n\n/* drop-zones registration management */\nfunction registerDropZone(dropZoneEl, type) {\n printDebug(() => \"registering drop-zone if absent\");\n if (typeToDropZones.size === 0) {\n printDebug(() => \"adding global keydown and click handlers\");\n INSTRUCTION_IDs = initAria();\n window.addEventListener(\"keydown\", globalKeyDownHandler);\n window.addEventListener(\"click\", globalClickHandler);\n }\n if (!typeToDropZones.has(type)) {\n typeToDropZones.set(type, new Set());\n }\n if (!typeToDropZones.get(type).has(dropZoneEl)) {\n typeToDropZones.get(type).add(dropZoneEl);\n incrementActiveDropZoneCount();\n }\n}\nfunction unregisterDropZone(dropZoneEl, type) {\n printDebug(() => \"unregistering drop-zone\");\n if (focusedDz === dropZoneEl) {\n handleDrop();\n }\n typeToDropZones.get(type).delete(dropZoneEl);\n decrementActiveDropZoneCount();\n if (typeToDropZones.get(type).size === 0) {\n typeToDropZones.delete(type);\n }\n if (typeToDropZones.size === 0) {\n printDebug(() => \"removing global keydown and click handlers\");\n window.removeEventListener(\"keydown\", globalKeyDownHandler);\n window.removeEventListener(\"click\", globalClickHandler);\n INSTRUCTION_IDs = undefined;\n destroyAria();\n }\n}\n\nfunction globalKeyDownHandler(e) {\n if (!isDragging) return;\n switch (e.key) {\n case \"Escape\": {\n handleDrop();\n break;\n }\n }\n}\n\nfunction globalClickHandler() {\n if (!isDragging) return;\n if (!allDragTargets.has(document.activeElement)) {\n printDebug(() => \"clicked outside of any draggable\");\n handleDrop();\n }\n}\n\nfunction handleZoneFocus(e) {\n printDebug(() => \"zone focus\");\n if (!isDragging) return;\n const newlyFocusedDz = e.currentTarget;\n if (newlyFocusedDz === focusedDz) return;\n\n focusedDzLabel = newlyFocusedDz.getAttribute(\"aria-label\") || \"\";\n const {items: originItems} = dzToConfig.get(focusedDz);\n const originItem = originItems.find(item => item[ITEM_ID_KEY] === focusedItemId);\n const originIdx = originItems.indexOf(originItem);\n const itemToMove = originItems.splice(originIdx, 1)[0];\n const {items: targetItems, autoAriaDisabled} = dzToConfig.get(newlyFocusedDz);\n if (\n newlyFocusedDz.getBoundingClientRect().top < focusedDz.getBoundingClientRect().top ||\n newlyFocusedDz.getBoundingClientRect().left < focusedDz.getBoundingClientRect().left\n ) {\n targetItems.push(itemToMove);\n if (!autoAriaDisabled) {\n alertToScreenReader(`Moved item ${focusedItemLabel} to the end of the list ${focusedDzLabel}`);\n }\n } else {\n targetItems.unshift(itemToMove);\n if (!autoAriaDisabled) {\n alertToScreenReader(`Moved item ${focusedItemLabel} to the beginning of the list ${focusedDzLabel}`);\n }\n }\n const dzFrom = focusedDz;\n dispatchFinalizeEvent(dzFrom, originItems, {trigger: TRIGGERS.DROPPED_INTO_ANOTHER, id: focusedItemId, source: SOURCES.KEYBOARD});\n dispatchFinalizeEvent(newlyFocusedDz, targetItems, {trigger: TRIGGERS.DROPPED_INTO_ZONE, id: focusedItemId, source: SOURCES.KEYBOARD});\n focusedDz = newlyFocusedDz;\n}\n\nfunction triggerAllDzsUpdate() {\n dzToHandles.forEach(({update}, dz) => update(dzToConfig.get(dz)));\n}\n\nfunction handleDrop(dispatchConsider = true) {\n printDebug(() => \"drop\");\n if (!dzToConfig.get(focusedDz).autoAriaDisabled) {\n alertToScreenReader(`Stopped dragging item ${focusedItemLabel}`);\n }\n if (allDragTargets.has(document.activeElement)) {\n document.activeElement.blur();\n }\n if (dispatchConsider) {\n dispatchConsiderEvent(focusedDz, dzToConfig.get(focusedDz).items, {\n trigger: TRIGGERS.DRAG_STOPPED,\n id: focusedItemId,\n source: SOURCES.KEYBOARD\n });\n }\n styleInactiveDropZones(\n typeToDropZones.get(draggedItemType),\n dz => dzToConfig.get(dz).dropTargetStyle,\n dz => dzToConfig.get(dz).dropTargetClasses\n );\n focusedItem = null;\n focusedItemId = null;\n focusedItemLabel = \"\";\n draggedItemType = null;\n focusedDz = null;\n focusedDzLabel = \"\";\n isDragging = false;\n triggerAllDzsUpdate();\n}\n//////\nexport function dndzone(node, options) {\n const config = {\n items: undefined,\n type: undefined,\n dragDisabled: false,\n zoneTabIndex: 0,\n dropFromOthersDisabled: false,\n dropTargetStyle: DEFAULT_DROP_TARGET_STYLE,\n dropTargetClasses: [],\n autoAriaDisabled: false\n };\n\n function swap(arr, i, j) {\n if (arr.length <= 1) return;\n arr.splice(j, 1, arr.splice(i, 1, arr[j])[0]);\n }\n\n function handleKeyDown(e) {\n printDebug(() => [\"handling key down\", e.key]);\n switch (e.key) {\n case \"Enter\":\n case \" \": {\n // we don't want to affect nested input elements or clickable elements\n if ((e.target.disabled !== undefined || e.target.href || e.target.isContentEditable) && !allDragTargets.has(e.target)) {\n return;\n }\n e.preventDefault(); // preventing scrolling on spacebar\n e.stopPropagation();\n if (isDragging) {\n // TODO - should this trigger a drop? only here or in general (as in when hitting space or enter outside of any zone)?\n handleDrop();\n } else {\n // drag start\n handleDragStart(e);\n }\n break;\n }\n case \"ArrowDown\":\n case \"ArrowRight\": {\n if (!isDragging) return;\n e.preventDefault(); // prevent scrolling\n e.stopPropagation();\n const {items} = dzToConfig.get(node);\n const children = Array.from(node.children);\n const idx = children.indexOf(e.currentTarget);\n printDebug(() => [\"arrow down\", idx]);\n if (idx < children.length - 1) {\n if (!config.autoAriaDisabled) {\n alertToScreenReader(`Moved item ${focusedItemLabel} to position ${idx + 2} in the list ${focusedDzLabel}`);\n }\n swap(items, idx, idx + 1);\n dispatchFinalizeEvent(node, items, {trigger: TRIGGERS.DROPPED_INTO_ZONE, id: focusedItemId, source: SOURCES.KEYBOARD});\n }\n break;\n }\n case \"ArrowUp\":\n case \"ArrowLeft\": {\n if (!isDragging) return;\n e.preventDefault(); // prevent scrolling\n e.stopPropagation();\n const {items} = dzToConfig.get(node);\n const children = Array.from(node.children);\n const idx = children.indexOf(e.currentTarget);\n printDebug(() => [\"arrow up\", idx]);\n if (idx > 0) {\n if (!config.autoAriaDisabled) {\n alertToScreenReader(`Moved item ${focusedItemLabel} to position ${idx} in the list ${focusedDzLabel}`);\n }\n swap(items, idx, idx - 1);\n dispatchFinalizeEvent(node, items, {trigger: TRIGGERS.DROPPED_INTO_ZONE, id: focusedItemId, source: SOURCES.KEYBOARD});\n }\n break;\n }\n }\n }\n function handleDragStart(e) {\n printDebug(() => \"drag start\");\n setCurrentFocusedItem(e.currentTarget);\n focusedDz = node;\n draggedItemType = config.type;\n isDragging = true;\n const dropTargets = Array.from(typeToDropZones.get(config.type)).filter(dz => dz === focusedDz || !dzToConfig.get(dz).dropFromOthersDisabled);\n styleActiveDropZones(\n dropTargets,\n dz => dzToConfig.get(dz).dropTargetStyle,\n dz => dzToConfig.get(dz).dropTargetClasses\n );\n if (!config.autoAriaDisabled) {\n let msg = `Started dragging item ${focusedItemLabel}. Use the arrow keys to move it within its list ${focusedDzLabel}`;\n if (dropTargets.length > 1) {\n msg += `, or tab to another list in order to move the item into it`;\n }\n alertToScreenReader(msg);\n }\n dispatchConsiderEvent(node, dzToConfig.get(node).items, {trigger: TRIGGERS.DRAG_STARTED, id: focusedItemId, source: SOURCES.KEYBOARD});\n triggerAllDzsUpdate();\n }\n\n function handleClick(e) {\n if (!isDragging) return;\n if (e.currentTarget === focusedItem) return;\n e.stopPropagation();\n handleDrop(false);\n handleDragStart(e);\n }\n function setCurrentFocusedItem(draggableEl) {\n const {items} = dzToConfig.get(node);\n const children = Array.from(node.children);\n const focusedItemIdx = children.indexOf(draggableEl);\n focusedItem = draggableEl;\n focusedItem.tabIndex = 0;\n focusedItemId = items[focusedItemIdx][ITEM_ID_KEY];\n focusedItemLabel = children[focusedItemIdx].getAttribute(\"aria-label\") || \"\";\n }\n\n function configure({\n items = [],\n type: newType = DEFAULT_DROP_ZONE_TYPE,\n dragDisabled = false,\n zoneTabIndex = 0,\n dropFromOthersDisabled = false,\n dropTargetStyle = DEFAULT_DROP_TARGET_STYLE,\n dropTargetClasses = [],\n autoAriaDisabled = false\n }) {\n config.items = [...items];\n config.dragDisabled = dragDisabled;\n config.dropFromOthersDisabled = dropFromOthersDisabled;\n config.zoneTabIndex = zoneTabIndex;\n config.dropTargetStyle = dropTargetStyle;\n config.dropTargetClasses = dropTargetClasses;\n config.autoAriaDisabled = autoAriaDisabled;\n if (config.type && newType !== config.type) {\n unregisterDropZone(node, config.type);\n }\n config.type = newType;\n registerDropZone(node, newType);\n if (!autoAriaDisabled) {\n node.setAttribute(\"aria-disabled\", dragDisabled);\n node.setAttribute(\"role\", \"list\");\n node.setAttribute(\"aria-describedby\", dragDisabled ? INSTRUCTION_IDs.DND_ZONE_DRAG_DISABLED : INSTRUCTION_IDs.DND_ZONE_ACTIVE);\n }\n dzToConfig.set(node, config);\n\n if (isDragging) {\n node.tabIndex =\n node === focusedDz ||\n focusedItem.contains(node) ||\n config.dropFromOthersDisabled ||\n (focusedDz && config.type !== dzToConfig.get(focusedDz).type)\n ? -1\n : 0;\n } else {\n node.tabIndex = config.zoneTabIndex;\n }\n\n node.addEventListener(\"focus\", handleZoneFocus);\n\n for (let i = 0; i < node.children.length; i++) {\n const draggableEl = node.children[i];\n allDragTargets.add(draggableEl);\n draggableEl.tabIndex = isDragging ? -1 : 0;\n if (!autoAriaDisabled) {\n draggableEl.setAttribute(\"role\", \"listitem\");\n }\n draggableEl.removeEventListener(\"keydown\", elToKeyDownListeners.get(draggableEl));\n draggableEl.removeEventListener(\"click\", elToFocusListeners.get(draggableEl));\n if (!dragDisabled) {\n draggableEl.addEventListener(\"keydown\", handleKeyDown);\n elToKeyDownListeners.set(draggableEl, handleKeyDown);\n draggableEl.addEventListener(\"click\", handleClick);\n elToFocusListeners.set(draggableEl, handleClick);\n }\n if (isDragging && config.items[i][ITEM_ID_KEY] === focusedItemId) {\n printDebug(() => [\"focusing on\", {i, focusedItemId}]);\n // if it is a nested dropzone, it was re-rendered and we need to refresh our pointer\n focusedItem = draggableEl;\n focusedItem.tabIndex = 0;\n // without this the element loses focus if it moves backwards in the list\n draggableEl.focus();\n }\n }\n }\n configure(options);\n\n const handles = {\n update: newOptions => {\n printDebug(() => `keyboard dndzone will update newOptions: ${toString(newOptions)}`);\n configure(newOptions);\n },\n destroy: () => {\n printDebug(() => \"keyboard dndzone will destroy\");\n unregisterDropZone(node, config.type);\n dzToConfig.delete(node);\n dzToHandles.delete(node);\n }\n };\n dzToHandles.set(node, handles);\n return handles;\n}\n","import {dndzone as pointerDndZone} from \"./pointerAction\";\nimport {dndzone as keyboardDndZone} from \"./keyboardAction\";\nimport {ITEM_ID_KEY} from \"./constants\";\nimport {toString} from \"./helpers/util\";\n\n/**\n * A custom action to turn any container to a dnd zone and all of its direct children to draggables\n * Supports mouse, touch and keyboard interactions.\n * Dispatches two events that the container is expected to react to by modifying its list of items,\n * which will then feed back in to this action via the update function\n *\n * @typedef {object} Options\n * @property {array} items - the list of items that was used to generate the children of the given node (the list used in the #each block\n * @property {string} [type] - the type of the dnd zone. children dragged from here can only be dropped in other zones of the same type, default to a base type\n * @property {number} [flipDurationMs] - if the list animated using flip (recommended), specifies the flip duration such that everything syncs with it without conflict, defaults to zero\n * @property {boolean} [dragDisabled]\n * @property {boolean} [morphDisabled] - whether dragged element should morph to zone dimensions\n * @property {boolean} [dropFromOthersDisabled]\n * @property {number} [zoneTabIndex] - set the tabindex of the list container when not dragging\n * @property {object} [dropTargetStyle]\n * @property {string[]} [dropTargetClasses]\n * @property {function} [transformDraggedElement]\n * @param {HTMLElement} node - the element to enhance\n * @param {Options} options\n * @return {{update: function, destroy: function}}\n */\nexport function dndzone(node, options) {\n validateOptions(options);\n const pointerZone = pointerDndZone(node, options);\n const keyboardZone = keyboardDndZone(node, options);\n return {\n update: newOptions => {\n validateOptions(newOptions);\n pointerZone.update(newOptions);\n keyboardZone.update(newOptions);\n },\n destroy: () => {\n pointerZone.destroy();\n keyboardZone.destroy();\n }\n };\n}\n\nfunction validateOptions(options) {\n /*eslint-disable*/\n const {\n items,\n flipDurationMs,\n type,\n dragDisabled,\n morphDisabled,\n dropFromOthersDisabled,\n zoneTabIndex,\n dropTargetStyle,\n dropTargetClasses,\n transformDraggedElement,\n autoAriaDisabled,\n centreDraggedOnCursor,\n ...rest\n } = options;\n /*eslint-enable*/\n if (Object.keys(rest).length > 0) {\n console.warn(`dndzone will ignore unknown options`, rest);\n }\n if (!items) {\n throw new Error(\"no 'items' key provided to dndzone\");\n }\n const itemWithMissingId = items.find(item => !{}.hasOwnProperty.call(item, ITEM_ID_KEY));\n if (itemWithMissingId) {\n throw new Error(`missing '${ITEM_ID_KEY}' property for item ${toString(itemWithMissingId)}`);\n }\n if (dropTargetClasses && !Array.isArray(dropTargetClasses)) {\n throw new Error(`dropTargetClasses should be an array but instead it is a ${typeof dropTargetClasses}, ${toString(dropTargetClasses)}`);\n }\n if (zoneTabIndex && !isInt(zoneTabIndex)) {\n throw new Error(`zoneTabIndex should be a number but instead it is a ${typeof zoneTabIndex}, ${toString(zoneTabIndex)}`);\n }\n}\n\nfunction isInt(value) {\n return !isNaN(value) && (function(x) { return (x | 0) === x; })(parseFloat(value));\n}\n","import CONSTANTS from \"../constants/constants.js\";\r\nimport * as Utilities from \"./utilities.js\";\r\n\r\nexport function setupCaches() {\r\n\r\n Hooks.on(CONSTANTS.HOOKS.PILE.DELETE, (doc) => {\r\n const uuid = Utilities.getUuid(doc);\r\n let actor = Utilities.getActor(doc);\r\n if (actor instanceof Actor) {\r\n actor = actor.toObject();\r\n }\r\n deletedActorCache.set(uuid, actor);\r\n });\r\n\r\n}\r\n\r\nclass DebouncedCache extends Map {\r\n\r\n #debounceClear = {};\r\n #timeout = {};\r\n\r\n constructor(timeout = 50) {\r\n super();\r\n this.#timeout = timeout;\r\n }\r\n\r\n set(key, value) {\r\n this.#setDebounce(key)\r\n return super.set(key, value);\r\n }\r\n\r\n #setDebounce(key) {\r\n if (!this.#debounceClear[key]) {\r\n this.#debounceClear[key] = foundry.utils.debounce(() => {\r\n delete this.#debounceClear[key];\r\n this.delete(key);\r\n }, this.#timeout)\r\n }\r\n this.#debounceClear[key]();\r\n }\r\n}\r\n\r\n\r\nexport const deletedActorCache = new DebouncedCache(5000);\r\nexport const cachedActorCurrencies = new DebouncedCache();\r\nexport const cachedFilterList = new DebouncedCache();\r\nexport const cachedCurrencyList = new DebouncedCache();\r\n\r\n","import CONSTANTS from \"../constants/constants.js\";\r\nimport * as Utilities from \"./utilities.js\"\r\nimport * as PileUtilities from \"./pile-utilities.js\"\r\n\r\nexport function getActivePlayers(onlyActive = false) {\r\n return Array.from(game.users).filter(u => (u.active || !onlyActive) && u.character);\r\n}\r\n\r\n/**\r\n * Gets the players that can interact with this item pile\r\n *\r\n * @param {Actor|TokenDocument|String} target\r\n * @returns {Array<User>}\r\n */\r\nexport function getPlayersForItemPile(target) {\r\n const targetActor = Utilities.getActor(target);\r\n if (!PileUtilities.isValidItemPile(targetActor)) return [];\r\n const pileData = PileUtilities.getActorFlagData(targetActor);\r\n return getActivePlayers(pileData.activePlayers);\r\n}\r\n\r\n/**\r\n * Determines whether a pile can be split\r\n *\r\n * @param target\r\n * @returns {boolean}\r\n */\r\nexport function canItemPileBeSplit(target) {\r\n const pileData = PileUtilities.getActorFlagData(target);\r\n const shareData = getItemPileSharingData(target);\r\n const playerActors = getPlayersForItemPile(target).map(player => Utilities.getUserCharacter(player));\r\n const items = pileData.shareItemsEnabled ? PileUtilities.getActorItems(target) : [];\r\n const currencies = pileData.shareCurrenciesEnabled || pileData.splitAllEnabled ? PileUtilities.getActorCurrencies(target) : [];\r\n for (const item of items) {\r\n if (playerActors.every(character => getItemSharesLeftForActor(target, item, character, {\r\n shareData,\r\n floor: true,\r\n players: playerActors.length\r\n }))) {\r\n return true;\r\n }\r\n }\r\n for (const currency of currencies) {\r\n if (currency.type === \"item\") {\r\n if (playerActors.every(character => getItemSharesLeftForActor(target, currency.item, character, {\r\n shareData,\r\n floor: true,\r\n players: playerActors.length\r\n }))) {\r\n return true;\r\n }\r\n } else {\r\n if (playerActors.every(character => getAttributeSharesLeftForActor(target, currency.path, character, {\r\n shareData,\r\n floor: true,\r\n players: playerActors.length\r\n }))) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n}\r\n\r\n/**\r\n * Retrieves an item pile's sharing data\r\n *\r\n * @param {Actor|TokenDocument|String} target\r\n * @returns {Object}\r\n */\r\nexport function getItemPileSharingData(target) {\r\n const targetActor = Utilities.getActor(target);\r\n return foundry.utils.duplicate(getProperty(targetActor, CONSTANTS.FLAGS.SHARING) ?? {});\r\n}\r\n\r\n/**\r\n * Updates an item pile's sharing data\r\n *\r\n * @param {Actor|TokenDocument|String} target\r\n * @param {Object} incomingSharingData\r\n * @returns {Promise}\r\n */\r\nexport function updateItemPileSharingData(target, incomingSharingData) {\r\n const targetActor = Utilities.getActor(target);\r\n const currentSharingData = getItemPileSharingData(targetActor);\r\n const newSharingData = foundry.utils.mergeObject(currentSharingData, incomingSharingData);\r\n return targetActor.update({\r\n [CONSTANTS.FLAGS.SHARING]: newSharingData\r\n });\r\n}\r\n\r\n/**\r\n * Clears an item pile's sharing data\r\n *\r\n * @param {Actor|TokenDocument|foundry.abstract.Document|String} target\r\n * @returns {Promise}\r\n */\r\nexport function clearItemPileSharingData(target) {\r\n const targetActor = Utilities.getActor(target);\r\n return targetActor.update({\r\n [CONSTANTS.FLAGS.SHARING]: null\r\n });\r\n}\r\n\r\n/**\r\n * Merges and resolves existing sharing data on a given item pile\r\n *\r\n * @param {String} sourceUuid\r\n * @param {String} targetUuid\r\n * @param {Array<Object>} [items]\r\n * @param {Array<Object>} [attributes]\r\n */\r\nexport async function setItemPileSharingData(sourceUuid, targetUuid, { items = [], attributes = [] } = {}) {\r\n\r\n const sourceActor = Utilities.getActor(sourceUuid);\r\n const targetActor = Utilities.getActor(targetUuid);\r\n\r\n const sourceIsItemPile = PileUtilities.isValidItemPile(sourceActor);\r\n const targetIsItemPile = PileUtilities.isValidItemPile(targetActor);\r\n\r\n // If both the source and target are item piles, we want to ignore this execution\r\n if (sourceIsItemPile && targetIsItemPile) return;\r\n\r\n if (items.length) {\r\n items = items.map(itemData => {\r\n Utilities.setItemQuantity(itemData.item, Math.abs(itemData.quantity));\r\n return itemData.item;\r\n })\r\n }\r\n\r\n if (!Array.isArray(attributes) && typeof attributes === \"object\") {\r\n attributes = Object.entries(attributes).map(entry => {\r\n return {\r\n path: entry[0],\r\n quantity: Math.abs(entry[1])\r\n }\r\n })\r\n }\r\n\r\n if (sourceIsItemPile) {\r\n\r\n if (PileUtilities.isItemPileEmpty(sourceIsItemPile)) {\r\n return clearItemPileSharingData(sourceIsItemPile);\r\n }\r\n\r\n const sharingData = addToItemPileSharingData(sourceActor, targetActor.uuid, { items, attributes });\r\n return updateItemPileSharingData(sourceActor, sharingData);\r\n\r\n }\r\n\r\n const sharingData = removeFromItemPileSharingData(targetActor, sourceActor.uuid, { items, attributes });\r\n return updateItemPileSharingData(targetActor, sharingData);\r\n\r\n}\r\n\r\nexport function addToItemPileSharingData(itemPile, actorUuid, {\r\n sharingData = false,\r\n items = [],\r\n attributes = []\r\n} = {}) {\r\n\r\n const pileData = PileUtilities.getActorFlagData(itemPile);\r\n\r\n const pileCurrencies = PileUtilities.getActorCurrencies(itemPile, { getAll: true });\r\n\r\n const filteredItems = items.filter(item => !pileCurrencies.some(currency => item.id !== currency.id));\r\n const currencies = items.filter(item => !pileCurrencies.some(currency => item.id === currency.id));\r\n\r\n let pileSharingData = {};\r\n if (!sharingData && ((pileData.shareItemsEnabled && filteredItems.length) || (pileData.shareCurrenciesEnabled && (attributes.length || currencies.length)))) {\r\n pileSharingData = getItemPileSharingData(itemPile);\r\n }\r\n\r\n if ((pileData.shareItemsEnabled && filteredItems.length) || (pileData.shareCurrenciesEnabled && currencies.length)) {\r\n\r\n if (!pileSharingData.items) {\r\n pileSharingData.items = [];\r\n }\r\n\r\n for (const item of filteredItems.concat(currencies)) {\r\n\r\n let existingItem = Utilities.findSimilarItem(pileSharingData.items, item);\r\n\r\n if (!existingItem) {\r\n let itemIndex = pileSharingData.items.push(Utilities.setSimilarityProperties({\r\n actors: [{ uuid: actorUuid, quantity: 0 }]\r\n }, item))\r\n existingItem = pileSharingData.items[itemIndex - 1];\r\n } else if (!existingItem.actors) {\r\n existingItem.actors = [];\r\n existingItem._id = item.id;\r\n }\r\n\r\n let actorData = existingItem.actors.find(data => data.uuid === actorUuid);\r\n\r\n const itemQuantity = Utilities.getItemQuantity(item);\r\n if (!actorData) {\r\n if (itemQuantity > 0) {\r\n existingItem.actors.push({ uuid: actorUuid, quantity: itemQuantity })\r\n }\r\n } else {\r\n actorData.quantity += itemQuantity;\r\n if (actorData.quantity <= 0) {\r\n existingItem.actors.splice(existingItem.actors.indexOf(actorData), 1);\r\n }\r\n if (existingItem.actors.length === 0) {\r\n pileSharingData.items.splice(pileSharingData.items.indexOf(existingItem), 1)\r\n }\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n if (pileData.shareCurrenciesEnabled && attributes.length) {\r\n\r\n if (!pileSharingData.attributes) {\r\n pileSharingData.attributes = [];\r\n }\r\n\r\n for (const attribute of attributes) {\r\n\r\n let existingCurrency = pileSharingData.attributes.find(sharingCurrency => sharingCurrency.path === attribute.path);\r\n\r\n if (!existingCurrency) {\r\n let itemIndex = pileSharingData.attributes.push({\r\n path: attribute.path,\r\n actors: [{ uuid: actorUuid, quantity: 0 }]\r\n })\r\n existingCurrency = pileSharingData.attributes[itemIndex - 1];\r\n } else {\r\n if (!existingCurrency.actors) {\r\n existingCurrency.actors = [];\r\n }\r\n }\r\n\r\n let actorData = existingCurrency.actors.find(data => data.uuid === actorUuid);\r\n\r\n if (!actorData) {\r\n if (attribute.quantity > 0) {\r\n existingCurrency.actors.push({ uuid: actorUuid, quantity: attribute.quantity })\r\n }\r\n } else {\r\n actorData.quantity += attribute.quantity;\r\n if (actorData.quantity <= 0) {\r\n existingCurrency.actors.splice(existingCurrency.actors.indexOf(actorData), 1);\r\n }\r\n if (existingCurrency.actors.length === 0) {\r\n pileSharingData.attributes.splice(pileSharingData.attributes.indexOf(existingCurrency), 1)\r\n }\r\n }\r\n }\r\n }\r\n\r\n\r\n return pileSharingData;\r\n\r\n}\r\n\r\nexport function removeFromItemPileSharingData(itemPile, actorUuid, { items = [], attributes = [] } = {}) {\r\n\r\n items = items.map(item => {\r\n Utilities.setItemQuantity(item, Utilities.getItemQuantity(item) * -1)\r\n return item;\r\n });\r\n\r\n attributes = attributes.map(attribute => {\r\n attribute.quantity = attribute.quantity * -1;\r\n return attribute;\r\n });\r\n\r\n return addToItemPileSharingData(itemPile, actorUuid, { items, attributes });\r\n\r\n}\r\n\r\nexport function getItemSharesLeftForActor(pile, item, recipient, {\r\n currentQuantity = null,\r\n floor = null,\r\n players = null,\r\n shareData = null\r\n} = {}) {\r\n\r\n if (item instanceof String) {\r\n item = pile.items.get(item);\r\n }\r\n let previouslyTaken = 0;\r\n let recipientUuid = Utilities.getUuid(recipient);\r\n currentQuantity = currentQuantity ?? Math.abs(Utilities.getItemQuantity(item));\r\n let totalShares = currentQuantity;\r\n\r\n shareData = shareData ?? getItemPileSharingData(pile);\r\n if (shareData?.items?.length) {\r\n const foundItem = Utilities.findSimilarItem(shareData.items, item);\r\n if (foundItem) {\r\n totalShares = foundItem.actors.reduce((acc, actor) => acc + actor.quantity, currentQuantity);\r\n const quantityTakenBefore = foundItem.actors.find(actor => actor.uuid === recipientUuid);\r\n previouslyTaken = quantityTakenBefore ? quantityTakenBefore.quantity : 0;\r\n }\r\n }\r\n\r\n players = players ?? getPlayersForItemPile(pile).length;\r\n let totalActorShare = totalShares / players;\r\n if (!Number.isInteger(totalActorShare) && !floor) {\r\n totalActorShare += 1;\r\n }\r\n\r\n return Math.max(0, Math.min(currentQuantity, Math.floor(totalActorShare - previouslyTaken)));\r\n\r\n}\r\n\r\nexport function getAttributeSharesLeftForActor(pile, path, recipient, {\r\n currentQuantity = null,\r\n floor = null,\r\n players = null,\r\n shareData = null\r\n} = {}) {\r\n\r\n let previouslyTaken = 0;\r\n let recipientUuid = Utilities.getUuid(recipient);\r\n currentQuantity = currentQuantity ?? Number(getProperty(pile, path) ?? 0);\r\n let totalShares = currentQuantity;\r\n\r\n shareData = shareData ?? getItemPileSharingData(pile);\r\n if (shareData?.attributes?.length) {\r\n const existingCurrency = shareData.attributes.find(storedCurrency => storedCurrency.path === path);\r\n if (existingCurrency) {\r\n totalShares = existingCurrency.actors.reduce((acc, actor) => acc + actor.quantity, currentQuantity);\r\n\r\n const quantityTakenBefore = existingCurrency?.actors?.find(actor => actor.uuid === recipientUuid);\r\n previouslyTaken = quantityTakenBefore ? quantityTakenBefore.quantity : 0;\r\n }\r\n }\r\n\r\n players = players ?? getPlayersForItemPile(pile).length;\r\n let totalActorShare = totalShares / players;\r\n if (!Number.isInteger(totalActorShare) && !floor) {\r\n totalActorShare += 1;\r\n }\r\n\r\n return Math.max(0, Math.min(currentQuantity, Math.floor(totalActorShare - previouslyTaken)));\r\n\r\n}\r\n","<script>\n import { getContext } from \"svelte\";\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\n import * as Utilities from \"../../../helpers/utilities.js\";\n import * as PileUtilities from \"../../../helpers/pile-utilities.js\";\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\n import SliderInput from \"../../components/SliderInput.svelte\";\n\n const { application } = getContext('#external');\n\n export let item;\n export let elementRoot;\n export let target = false;\n\n const unlimitedQuantity = application.options?.unlimitedQuantity ?? false;\n\n let form;\n let quantity = 1;\n\n const itemQuantity = Utilities.getItemQuantity(item);\n const sliderQuantity = itemQuantity + (application.options?.quantityAdjustment ?? 0);\n const canItemStack = PileUtilities.canItemStack(item, target);\n\n function requestSubmit() {\n form.requestSubmit();\n }\n\n function submit() {\n application.options.resolve(quantity);\n application.close();\n }\n\n</script>\n\n<svelte:options accessors={true}/>\n\n<ApplicationShell bind:elementRoot>\n\t<form autocomplete=\"off\" bind:this={form} class=\"item-piles-flexcol\" on:submit|once|preventDefault={submit}\n\t\t\t\tstyle=\"padding:0.5rem;\">\n\n\t\t<h3 style=\"text-align: center;\">\n\t\t\t{localize(`ITEM-PILES.Applications.${application.options.localizationTitle}.Header`, {\n item_name: item.name\n })}\n\t\t</h3>\n\n\t\t{#if target}\n\n\t\t\t<p class=\"item-piles-text-center\">\n\t\t\t\t{localize(`ITEM-PILES.Applications.${application.options.localizationTitle}.Content`, {\n target_name: target.name\n })}\n\t\t\t</p>\n\n\t\t{/if}\n\n\t\t{#if (itemQuantity > 1 || unlimitedQuantity) && canItemStack}\n\n\t\t\t<div class=\"form-group item-piles-text-center\">\n\t\t\t\t<label>{localize(`ITEM-PILES.Applications.${application.options.localizationTitle}.${unlimitedQuantity ? \"ContentInfiniteQuantity\" : \"ContentMultipleQuantity\"}`, {\n target_name: target?.name ?? \"\",\n quantity: itemQuantity,\n itemName: item.name\n })}</label>\n\t\t\t</div>\n\t\t\t{#if unlimitedQuantity}\n\t\t\t\t<input type=\"number\" min=\"1\" bind:value={quantity}/>\n\t\t\t{:else}\n\t\t\t\t<SliderInput min={1} max={sliderQuantity} maxInput={sliderQuantity} divideBy={1} bind:value={quantity}/>\n\t\t\t{/if}\n\t\t{/if}\n\n\t\t<footer class=\"sheet-footer item-piles-flexrow\" style=\"margin-top: 1rem;\">\n\t\t\t{#if target}\n\t\t\t\t<button type=\"button\" on:click|once={requestSubmit}>\n\t\t\t\t\t<i class=\"fas fa-download\"></i>\n\t\t\t\t\t{localize(`ITEM-PILES.Applications.${application.options.localizationTitle}.Submit`)}\n\t\t\t\t</button>\n\t\t\t{:else}\n\t\t\t\t<button type=\"button\" on:click|once={requestSubmit}>\n\t\t\t\t\t<i class=\"fas fa-box\"></i>\n\t\t\t\t\t{localize(`ITEM-PILES.Applications.${application.options.localizationTitle}.SubmitNoTarget`)}\n\t\t\t\t</button>\n\t\t\t{/if}\n\t\t\t<button on:click={() => { application.close() }} type=\"button\">\n\t\t\t\t<i class=\"fas fa-times\"></i>\n\t\t\t\t{localize(\"Cancel\")}\n\t\t\t</button>\n\t\t</footer>\n\n\t</form>\n</ApplicationShell>\n","import DropItemDialogShell from \"./drop-item-dialog-shell.svelte\";\r\nimport { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport { getActiveApps } from \"../../../helpers/helpers\";\r\n\r\nexport default class DropItemDialog extends SvelteApplication {\r\n\r\n /**\r\n *\r\n * @param item\r\n * @param target\r\n * @param options\r\n */\r\n constructor(item, target, options = {\r\n localizationTitle: \"DropItem\"\r\n }) {\r\n super({\r\n title: game.i18n.localize(`ITEM-PILES.Applications.${options.localizationTitle}.Title`),\r\n id: `item-pile-drop-item-${item.id}${target ? \"-\" + target.id : \"\"}-${randomID()}`,\r\n svelte: {\r\n class: DropItemDialogShell,\r\n target: document.body,\r\n props: {\r\n item,\r\n target\r\n }\r\n },\r\n close: () => this.options.resolve?.(null),\r\n ...options\r\n });\r\n this.item = item;\r\n this.target = target;\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n width: 430,\r\n height: \"auto\",\r\n classes: [\"item-piles-app\"]\r\n })\r\n }\r\n\r\n static getActiveApps(id) {\r\n return getActiveApps(`item-pile-drop-item-${id}`);\r\n }\r\n\r\n static async show(item, target, options = {}) {\r\n if (!options?.localizationTitle) {\r\n options.localizationTitle = \"DropItem\";\r\n }\r\n const apps = this.getActiveApps(item.uuid + (target ? \"-\" + target.uuid : \"\"));\r\n if (apps.length) {\r\n for (let app of apps) {\r\n app.render(false, { focus: true });\r\n }\r\n return;\r\n }\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(item, target, options).render(true, { focus: true });\r\n })\r\n }\r\n\r\n}\r\n","<script>\r\n\r\n import { fade } from 'svelte/transition';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n\r\n export let store;\r\n export let entry;\r\n export let currency = false;\r\n\r\n const name = entry.name;\r\n const img = entry.img;\r\n const rarityColor = entry.rarityColor;\r\n const quantityLeft = entry.quantityLeft;\r\n const quantity = entry.quantity;\r\n const currentQuantity = entry.currentQuantity;\r\n const pileData = store.pileData;\r\n\r\n $: canInspectItems = entry.id && $pileData.canInspectItems;\r\n\r\n const editQuantities = store.editQuantities;\r\n\r\n function dragStart(event) {\r\n event.dataTransfer.setData('text/plain', JSON.stringify({\r\n type: \"Item\",\r\n uuid: entry.item.uuid\r\n }));\r\n }\r\n\r\n</script>\r\n\r\n<div class=\"item-piles-flexrow item-piles-item-row item-piles-even-color\"\r\n\t\t class:item-piles-disabled={!$editQuantities && (!$quantityLeft || !$quantity)}\r\n\t\t draggable={!!entry.id}\r\n\t\t on:dragstart={(event) => { dragStart(event) }}\r\n\t\t transition:fade={{duration: 250}}>\r\n\r\n\t<div class=\"item-piles-img-container\">\r\n\t\t<img class=\"item-piles-img\" src=\"{$img}\"/>\r\n\t</div>\r\n\r\n\t<div class=\"item-piles-name\">\r\n\t\t<div class=\"item-piles-name-container\">\r\n\t\t\t<p class:item-piles-clickable-link=\"{canInspectItems}\"\r\n\t\t\t\t on:click={() => { entry.preview() }}\r\n\t\t\t\t style=\"color: {$rarityColor || 'inherit'};\"\r\n\t\t\t>\r\n\t\t\t\t{$name}\r\n\t\t\t</p>\r\n\t\t\t{#if !$editQuantities && entry.canStack && !currency}\r\n\t\t\t\t<span class=\"item-piles-small-text\">(x{$quantity})</span>\r\n\t\t\t{/if}\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t{#if entry.canStack || !entry.id}\r\n\r\n\t\t<div class=\"item-piles-quantity-container\" style=\"flex:2.5;\">\r\n\r\n\t\t\t{#if $editQuantities}\r\n\r\n\t\t\t\t<div class=\"item-piles-quantity-input-container\">\r\n\t\t\t\t\t<input class=\"item-piles-quantity\" type=\"number\" min=\"0\" bind:value=\"{$quantity}\"\r\n\t\t\t\t\t\t\t\t draggable=\"true\" on:dragstart|stopPropagation|preventDefault/>\r\n\t\t\t\t</div>\r\n\r\n\t\t\t{:else}\r\n\r\n\t\t\t\t{#if $quantityLeft && $quantity}\r\n\t\t\t\t\t<div class=\"item-piles-quantity-input-container\">\r\n\t\t\t\t\t\t<input class=\"item-piles-quantity\" type=\"number\" min=\"1\" bind:value=\"{$currentQuantity}\"\r\n\t\t\t\t\t\t\t\t\t max=\"{$quantity}\" disabled=\"{!$quantity}\"/>\r\n\r\n\t\t\t\t\t\t<span class=\"item-piles-input-divider\" class:item-piles-text-right={!store.recipient}>\r\n / {$quantityLeft}\r\n </span>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t{:else}\r\n <span>\r\n {localize(`ITEM-PILES.Inspect.${entry.toShare && $quantity ? \"NoShareLeft\" : \"NoneLeft\"}`)}\r\n </span>\r\n\t\t\t\t{/if}\r\n\t\t\t{/if}\r\n\r\n\t\t</div>\r\n\r\n\t{/if}\r\n\r\n\t{#if !$editQuantities}\r\n\r\n\t\t<button\r\n\t\t\ton:click={() => { entry.take() }}\r\n\t\t\tclass=\"item-piles-item-take-button\"\r\n\t\t\ttype=\"button\"\r\n\t\t\tdisabled={!$quantityLeft || !$quantity}>\r\n\t\t\t{localize(\"ITEM-PILES.Inspect.Take\")}\r\n\t\t</button>\r\n\r\n\t{:else if !entry.canStack && !entry.isCurrency}\r\n\r\n\t\t<button\r\n\t\t\ton:click={() => { entry.remove() }}\r\n\t\t\tclass=\"item-piles-item-take-button\"\r\n\t\t\ttype=\"button\"\r\n\t\t\tdisabled={!$quantityLeft}>\r\n\t\t\t{localize(\"Remove\")}\r\n\t\t</button>\r\n\r\n\t{/if}\r\n\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n</style>\r\n","<script>\r\n\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { fade } from 'svelte/transition';\r\n import ListEntry from \"./ListEntry.svelte\";\r\n\r\n export let store;\r\n const items = store.items;\r\n const numItems = store.numItems;\r\n\r\n</script>\r\n\r\n\r\n{#if $numItems > 0}\r\n\t<div in:fade|local={{duration: 150}}>\r\n\r\n\t\t<div class=\"item-piles-flexrow\"><h3>{localize(\"ITEM-PILES.Items\")}</h3></div>\r\n\r\n\t\t{#each $items as item (item.identifier)}\r\n\t\t\t<ListEntry {store} bind:entry={item}/>\r\n\t\t{/each}\r\n\r\n\t</div>\r\n\r\n{/if}\r\n","<script>\r\n\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import ListEntry from \"./ListEntry.svelte\";\r\n\r\n export let store;\r\n const currencies = store.currencies;\r\n const numItems = store.numItems;\r\n const numCurrencies = store.numCurrencies;\r\n const editQuantities = store.editQuantities;\r\n\r\n</script>\r\n\r\n<div>\r\n\r\n\t<div class=\"item-piles-flexrow\">\r\n\t\t{#if $numCurrencies > 0}\r\n\t\t\t<h3>{localize(\"ITEM-PILES.Currencies\")}:</h3>\r\n\t\t{/if}\r\n\t\t<a class=\"item-piles-clickable item-piles-text-right item-piles-small-text item-piles-middle\"\r\n\t\t\t on:click={() => store.addCurrency(store.recipient)}>\r\n\t\t\t<i class=\"fas fa-plus\"></i> {localize(\"ITEM-PILES.Inspect.AddCurrency\")}\r\n\t\t</a>\r\n\t</div>\r\n\t{#if $numCurrencies > 0}\r\n\t\t<div>\r\n\t\t\t{#each $currencies as currency, index (currency.identifier)}\r\n\t\t\t\t<ListEntry {store} bind:entry={currency} currency/>\r\n\t\t\t{/each}\r\n\t\t</div>\r\n\t{/if}\r\n\r\n</div>\r\n","<script>\r\n\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import * as Utilities from \"../../helpers/utilities.js\";\r\n\r\n export let store;\r\n export let localization = \"ITEM-PILES.Inspect.AsActor\";\r\n export let style = \"text-align: center; flex: 0 1 auto; height: 27px;\";\r\n\r\n let editQuantities = store.editQuantities;\r\n\r\n let changingActor = false;\r\n let playerActors = game.actors.filter(actor => actor.isOwner && actor !== store.pileActor && actor.prototypeToken.actorLink);\r\n let recipientUuid = Utilities.getUuid(store.recipient);\r\n const recipientDoc = store.recipientDocument;\r\n\r\n $: {\r\n $recipientDoc;\r\n recipientUuid = store.recipient ? Utilities.getUuid(store.recipient) : false;\r\n }\r\n\r\n function changeRecipientActor() {\r\n store.recipient = playerActors.find(actor => Utilities.getUuid(actor) === recipientUuid);\r\n store.update();\r\n changingActor = false;\r\n }\r\n\r\n</script>\r\n\r\n{#if $editQuantities}\r\n\t<div {style}>{localize(\"ITEM-PILES.Inspect.Owner\")}</div>\r\n{:else}\r\n\t<div {style}>\r\n\t\t{#if !changingActor}\r\n\t\t\t{localize(localization, { actorName: $recipientDoc.name })}\r\n\t\t{/if}\r\n\t\t{#if playerActors.length > 1}\r\n\t\t\t{#if !changingActor}\r\n\t\t\t\t<a class='item-piles-highlight' on:click={() => { changingActor = true }} class:active={!changingActor}>\r\n\t\t\t\t\tChange.\r\n\t\t\t\t</a>\r\n\t\t\t{:else}\r\n\t\t\t\t<select\r\n\t\t\t\t\tclass=\"item-piles-change-actor-select\"\r\n\t\t\t\t\tbind:value={recipientUuid}\r\n\t\t\t\t\ton:change={changeRecipientActor}\r\n\t\t\t\t\tclass:active={changingActor}\r\n\t\t\t\t\tstyle=\"height:auto;\"\r\n\t\t\t\t>\r\n\t\t\t\t\t{#each playerActors as actor, index (index)}\r\n\t\t\t\t\t\t<option value=\"{Utilities.getUuid(actor.uuid)}\">{actor.name}</option>\r\n\t\t\t\t\t{/each}\r\n\t\t\t\t</select>\r\n\t\t\t{/if}\r\n\t\t{/if}\r\n\t</div>\r\n{/if}\r\n","import * as Helpers from \"../helpers/helpers.js\";\r\n\r\nexport default class BasePlugin {\r\n\r\n invalidVersionError = \"\"\r\n minVersionError = \"\"\r\n\r\n constructor(pluginName, minVersion, invalidVersion) {\r\n this.pluginName = pluginName;\r\n this.minVersion = minVersion;\r\n this.invalidVersion = invalidVersion;\r\n this.initialized = false;\r\n this.initialize();\r\n }\r\n\r\n initialize() {\r\n\r\n if (!game.modules.get(this.pluginName)?.active) {\r\n return;\r\n }\r\n\r\n if (game.modules.get(this.pluginName).version === this.invalidVersion) {\r\n if (this.invalidVersionError) {\r\n throw Helpers.custom_error(this.invalidVersionError);\r\n }\r\n return;\r\n }\r\n\r\n if (isNewerVersion(this.minVersion, game.modules.get(this.pluginName).version)) {\r\n if (this.minVersionError) {\r\n throw Helpers.custom_error(this.minVersionError);\r\n }\r\n return;\r\n }\r\n\r\n this.registerHooks();\r\n\r\n this.initialized = true;\r\n\r\n }\r\n\r\n registerHooks() {\r\n\r\n }\r\n\r\n}\r\n","import * as Utilities from \"./utilities.js\";\r\nimport * as PileUtilities from \"./pile-utilities.js\";\r\nimport { getItemFlagData } from \"./pile-utilities.js\";\r\nimport ItemPileSocket from \"../socket.js\";\r\nimport PrivateAPI from \"../API/private-api.js\";\r\nimport { SYSTEMS } from \"../systems.js\";\r\nimport CONSTANTS from \"../constants/constants.js\";\r\n\r\nexport default class Transaction {\r\n\r\n\tconstructor(actor) {\r\n\t\tthis.actor = actor;\r\n\t\tthis.itemsToCreate = [];\r\n\t\tthis.itemsToUpdate = [];\r\n\t\tthis.itemsToDelete = [];\r\n\t\tthis.itemsToForceDelete = new Set();\r\n\t\tthis.itemsToNotDelete = new Set();\r\n\t\tthis.actorUpdates = {};\r\n\t\tthis.attributeDeltas = new Map();\r\n\t\tthis.attributeTypeMap = new Map();\r\n\t\tthis.itemDeltas = new Map();\r\n\t\tthis.itemTypeMap = new Map();\r\n\t\tthis.itemFlagMap = new Map();\r\n\t\tthis.preCommitted = false;\r\n\t}\r\n\r\n\tasync appendItemChanges(items, {\r\n\t\tremove = false,\r\n\t\ttype = \"item\",\r\n\t\tkeepIfZero = false,\r\n\t\tonlyDelta = false,\r\n\t} = {}) {\r\n\r\n\t\tfor (let data of items) {\r\n\r\n\t\t\tlet item = data.item ?? data;\r\n\r\n\t\t\ttype = PileUtilities.isItemCurrency(item, { target: this.actor })\r\n\t\t\t\t? \"currency\" : type;\r\n\r\n\t\t\tlet flags = data.flags ?? false;\r\n\t\t\tlet itemData = item instanceof Item ? item.toObject() : foundry.utils.duplicate(item);\r\n\t\t\tif (SYSTEMS.DATA.ITEM_TRANSFORMER && !remove) {\r\n\t\t\t\titemData = await SYSTEMS.DATA.ITEM_TRANSFORMER(itemData);\r\n\t\t\t}\r\n\t\t\tconst incomingQuantity = Math.abs(data.quantity ?? Utilities.getItemQuantity(itemData)) * (remove ? -1 : 1);\r\n\t\t\tlet itemId = itemData._id ?? itemData.id;\r\n\t\t\tconst actorHasItem = this.actor.items.get(itemId);\r\n\t\t\tconst actorExistingItem = actorHasItem || Utilities.findSimilarItem(this.actor.items, itemData, PileUtilities.getActorFlagData(this.actor), type === \"currency\");\r\n\t\t\tconst canItemStack = PileUtilities.canItemStack(actorExistingItem || itemData, this.actor);\r\n\r\n\t\t\tif (!canItemStack) {\r\n\r\n\t\t\t\tif (remove && actorExistingItem) {\r\n\t\t\t\t\tthis.itemTypeMap.set(actorExistingItem.id, type);\r\n\t\t\t\t\tif (!onlyDelta) {\r\n\t\t\t\t\t\tthis.itemsToForceDelete.add(actorExistingItem.id);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.itemDeltas.set(actorExistingItem.id, -1);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (!itemId) {\r\n\t\t\t\t\t\titemId = randomID();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tUtilities.setItemQuantity(itemData, incomingQuantity);\r\n\t\t\t\t\tthis.itemTypeMap.set(itemId, type)\r\n\t\t\t\t\tthis.itemsToCreate.push(itemData);\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if (actorExistingItem) {\r\n\r\n\t\t\t\tconst existingItemUpdate = remove ? this.itemsToUpdate.find(item => item._id === itemId) : Utilities.findSimilarItem(this.itemsToUpdate, itemData);\r\n\t\t\t\tif (keepIfZero || type === \"currency\") {\r\n\t\t\t\t\tthis.itemsToNotDelete.add(item.id);\r\n\t\t\t\t}\r\n\t\t\t\tif (!onlyDelta) {\r\n\t\t\t\t\tif (existingItemUpdate) {\r\n\t\t\t\t\t\tconst newQuantity = Utilities.getItemQuantity(existingItemUpdate) + incomingQuantity;\r\n\t\t\t\t\t\tUtilities.setItemQuantity(existingItemUpdate, newQuantity);\r\n\t\t\t\t\t\tif (keepIfZero && type !== \"currency\") {\r\n\t\t\t\t\t\t\tsetProperty(existingItemUpdate, CONSTANTS.FLAGS.ITEM + \".notForSale\", newQuantity === 0);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tconst newQuantity = Utilities.getItemQuantity(actorExistingItem) + incomingQuantity;\r\n\t\t\t\t\t\tconst update = Utilities.setItemQuantity(actorExistingItem.toObject(), newQuantity);\r\n\t\t\t\t\t\tif (keepIfZero && type !== \"currency\") {\r\n\t\t\t\t\t\t\tsetProperty(update, CONSTANTS.FLAGS.ITEM + \".notForSale\", newQuantity === 0);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.itemTypeMap.set(actorExistingItem.id, type)\r\n\t\t\t\t\t\tthis.itemsToUpdate.push(update);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.itemDeltas.set(actorExistingItem.id,\r\n\t\t\t\t\t(this.itemDeltas.has(actorExistingItem.id) ? this.itemDeltas.get(actorExistingItem.id) : 0) + incomingQuantity\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tif (!itemData._id) {\r\n\t\t\t\t\titemData._id = randomID();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst existingItemCreation = Utilities.findSimilarItem(this.itemsToCreate, itemData);\r\n\t\t\t\tif (existingItemCreation) {\r\n\t\t\t\t\tconst newQuantity = Utilities.getItemQuantity(existingItemCreation) + incomingQuantity;\r\n\t\t\t\t\tUtilities.setItemQuantity(existingItemCreation, newQuantity);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tUtilities.setItemQuantity(itemData, incomingQuantity);\r\n\t\t\t\t\tthis.itemsToCreate.push(itemData);\r\n\t\t\t\t\tthis.itemTypeMap.set(itemData._id, type)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (flags) {\r\n\t\t\t\tthis.itemFlagMap.set(itemData._id, flags);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tasync appendActorChanges(attributes, { set = false, remove = false, type = \"attribute\", onlyDelta = false } = {}) {\r\n\t\tif (!Array.isArray(attributes)) {\r\n\t\t\tattributes = Object.entries(attributes).map(entry => ({ path: entry[0], quantity: entry[1] }));\r\n\t\t}\r\n\t\tthis.actorUpdates = attributes.reduce((acc, attribute) => {\r\n\t\t\tconst incomingQuantity = Math.abs(attribute.quantity) * (remove ? -1 : 1);\r\n\t\t\tacc[attribute.path] = acc[attribute.path] ?? Number(getProperty(this.actor, attribute.path) ?? 0);\r\n\t\t\tif (set) {\r\n\t\t\t\tif (!onlyDelta) {\r\n\t\t\t\t\tacc[attribute.path] = incomingQuantity\r\n\t\t\t\t}\r\n\t\t\t\tthis.attributeDeltas.set(attribute.path,\r\n\t\t\t\t\t(this.attributeDeltas.has(attribute.path) ? this.attributeDeltas.get(attribute.path) : acc[attribute.path]) + incomingQuantity\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tif (!onlyDelta) {\r\n\t\t\t\t\tacc[attribute.path] += incomingQuantity\r\n\t\t\t\t}\r\n\t\t\t\tthis.attributeDeltas.set(attribute.path,\r\n\t\t\t\t\t(this.attributeDeltas.has(attribute.path) ? this.attributeDeltas.get(attribute.path) : 0) + incomingQuantity\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tthis.attributeTypeMap.set(attribute.path, type)\r\n\t\t\treturn acc;\r\n\t\t}, this.actorUpdates);\r\n\t}\r\n\r\n\tprepare() {\r\n\r\n\t\tthis.actorUpdates = Object.fromEntries(Object.entries(this.actorUpdates).filter(entry => {\r\n\t\t\tif (this.attributeDeltas.get(entry[0]) === 0) {\r\n\t\t\t\tthis.attributeDeltas.delete(entry[0]);\r\n\t\t\t}\r\n\t\t\treturn Number(getProperty(this.actor, entry[0])) !== entry[1];\r\n\t\t}))\r\n\t\tthis.itemsToCreate = this.itemsToCreate.filter(item => {\r\n\t\t\treturn !PileUtilities.canItemStack(item, this.actor) || Utilities.getItemQuantity(item) > 0 || this.itemTypeMap.get(item._id) === \"currency\"\r\n\t\t});\r\n\t\tthis.itemsToDelete = this.itemsToUpdate.filter(item => {\r\n\t\t\treturn Utilities.getItemQuantity(item) <= 0 && this.itemTypeMap.get(item._id) !== \"currency\";\r\n\t\t}).map(item => item._id).concat(Array.from(this.itemsToForceDelete));\r\n\r\n\t\tfor (const itemId of this.itemsToDelete) {\r\n\t\t\tif (this.itemsToNotDelete.has(itemId)) {\r\n\t\t\t\tthis.itemsToDelete.splice(this.itemsToDelete.indexOf(itemId), 1);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.itemDeltas = Array.from(this.itemDeltas).map(([id, quantity]) => {\r\n\t\t\tconst item = this.actor.items.get(id).toObject();\r\n\t\t\tconst existingFlags = getItemFlagData(item);\r\n\t\t\tsetProperty(item, CONSTANTS.FLAGS.ITEM, foundry.utils.mergeObject(\r\n\t\t\t\texistingFlags,\r\n\t\t\t\tthis.itemFlagMap.get(id) ?? {}\r\n\t\t\t));\r\n\t\t\tconst type = this.itemTypeMap.get(id);\r\n\t\t\tUtilities.setItemQuantity(item, quantity, true);\r\n\t\t\treturn { item, quantity, type };\r\n\t\t}).filter(delta => delta.quantity);\r\n\r\n\t\tthis.itemsToUpdate = this.itemsToUpdate\r\n\t\t\t.filter(item => Utilities.getItemQuantity(item) > 0 || this.itemsToNotDelete.has(item._id) || this.itemTypeMap.get(item._id) === \"currency\")\r\n\t\t\t.filter(itemData => {\r\n\t\t\t\tconst item = this.actor.items.get(itemData._id)\r\n\t\t\t\treturn Utilities.getItemQuantity(item) !== Utilities.getItemQuantity(itemData);\r\n\t\t\t});\r\n\t\tthis.attributeDeltas = Object.fromEntries(this.attributeDeltas);\r\n\t\tthis.preCommitted = true;\r\n\t\treturn {\r\n\t\t\tactorUpdates: this.actorUpdates,\r\n\t\t\titemsToCreate: this.itemsToCreate,\r\n\t\t\titemsToDelete: this.itemsToDelete,\r\n\t\t\titemsToUpdate: this.itemsToUpdate,\r\n\t\t\tattributeDeltas: this.attributeDeltas,\r\n\t\t\titemDeltas: this.itemDeltas,\r\n\t\t}\r\n\t}\r\n\r\n\tasync commit() {\r\n\r\n\t\tif (!this.preCommitted) {\r\n\t\t\tthis.prepare();\r\n\t\t}\r\n\r\n\t\tlet itemsCreated;\r\n\t\tconst actorUuid = Utilities.getUuid(this.actor);\r\n\t\tif (this.actor.isOwner) {\r\n\t\t\titemsCreated = await PrivateAPI._commitActorChanges(actorUuid, {\r\n\t\t\t\tactorUpdates: this.actorUpdates,\r\n\t\t\t\titemsToUpdate: this.itemsToUpdate,\r\n\t\t\t\titemsToDelete: this.itemsToDelete,\r\n\t\t\t\titemsToCreate: this.itemsToCreate\r\n\t\t\t})\r\n\t\t} else {\r\n\t\t\titemsCreated = await ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.COMMIT_ACTOR_CHANGES, actorUuid, {\r\n\t\t\t\tactorUpdates: this.actorUpdates,\r\n\t\t\t\titemsToUpdate: this.itemsToUpdate,\r\n\t\t\t\titemsToDelete: this.itemsToDelete,\r\n\t\t\t\titemsToCreate: this.itemsToCreate\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tattributeDeltas: this.attributeDeltas,\r\n\t\t\titemDeltas: this.itemDeltas.concat(itemsCreated.map(item => {\r\n\t\t\t\treturn {\r\n\t\t\t\t\titem,\r\n\t\t\t\t\tquantity: PileUtilities.canItemStack(item) ? Utilities.getItemQuantity(item) : 1\r\n\t\t\t\t}\r\n\t\t\t}))\r\n\t\t}\r\n\t}\r\n}\r\n","import BasePlugin from \"./base-plugin.js\";\r\nimport ItemPileStore from \"../stores/item-pile-store.js\";\r\nimport * as PileUtilities from \"../helpers/pile-utilities.js\";\r\nimport CONSTANTS from \"../constants/constants.js\";\r\nimport Transaction from \"../helpers/transaction.js\";\r\n\r\nlet previousState;\r\n\r\nexport default class SimpleCalendarPlugin extends BasePlugin {\r\n\r\n invalidVersionError = \"Simple Calendar version 1.3.75 is installed, but Item Piles requires version 2.0.0 or above. The author made a mistake, and you will need to reinstall the Simple Calendar module.\";\r\n minVersionError = \"Simple Calendar is out of date to be compatible with Item Piles, please update as soon as possible.\";\r\n\r\n registerHooks() {\r\n previousState = {\r\n dateTime: window.SimpleCalendar.api.currentDateTime(),\r\n weekday: window.SimpleCalendar.api.getCurrentWeekday(),\r\n timestamp: window.SimpleCalendar.api.dateToTimestamp({})\r\n }\r\n Hooks.on(window.SimpleCalendar.Hooks.DateTimeChange, () => {\r\n ItemPileStore.notifyAllOfChanges(\"updateOpenCloseStatus\");\r\n this.handleTimePassed();\r\n });\r\n }\r\n\r\n async handleTimePassed() {\r\n\r\n const newState = {\r\n dateTime: window.SimpleCalendar.api.currentDateTime(),\r\n weekday: window.SimpleCalendar.api.getCurrentWeekday(),\r\n timestamp: window.SimpleCalendar.api.dateToTimestamp({})\r\n }\r\n\r\n const currentCalendar = window.SimpleCalendar.api.getCurrentCalendar();\r\n const numWeekdays = currentCalendar.weekdays.length;\r\n\r\n const notes = window.SimpleCalendar.api.getNotes()\r\n .filter(note => getProperty(note, \"flags.foundryvtt-simple-calendar.noteData.categories\")?.length)\r\n .map(note => {\r\n const flags = getProperty(note, \"flags.foundryvtt-simple-calendar.noteData\");\r\n let timestampData = {\r\n year: flags.startDate.year,\r\n month: flags.startDate.month,\r\n day: flags.startDate.day,\r\n hour: flags.allDay ? 0 : flags.startDate.hour,\r\n minute: flags.allDay ? 0 : flags.startDate.minute,\r\n seconds: flags.allDay ? 0 : flags.startDate.seconds,\r\n };\r\n switch (flags?.repeats) {\r\n case window.SimpleCalendar.api.NoteRepeat.Weekly:\r\n const noteWeekDay = window.SimpleCalendar.api.timestampToDate(window.SimpleCalendar.api.dateToTimestamp(timestampData)).dayOfTheWeek - 1;\r\n const currentWeekDay = window.SimpleCalendar.api.timestampToDate(newState.timestamp).dayOfTheWeek - 1;\r\n let weekdayCountDifference = currentWeekDay - noteWeekDay;\r\n if (weekdayCountDifference < 0) {\r\n weekdayCountDifference += numWeekdays\r\n }\r\n timestampData.year = newState.dateTime.year;\r\n timestampData.month = newState.dateTime.month;\r\n timestampData.day = newState.dateTime.day;\r\n const weekInSeconds = SimpleCalendar.api.timestampPlusInterval(0, { day: 1 }) * weekdayCountDifference;\r\n const timestamp = window.SimpleCalendar.api.dateToTimestamp(timestampData) - weekInSeconds;\r\n timestampData.day = window.SimpleCalendar.api.timestampToDate(timestamp).day;\r\n break;\r\n\r\n case window.SimpleCalendar.api.NoteRepeat.Monthly:\r\n timestampData.year = newState.dateTime.year;\r\n timestampData.month = newState.dateTime.month;\r\n break;\r\n\r\n case window.SimpleCalendar.api.NoteRepeat.Yearly:\r\n timestampData.year = newState.dateTime.year;\r\n break;\r\n }\r\n return {\r\n document: note,\r\n flags,\r\n dateTime: timestampData,\r\n timestamp: window.SimpleCalendar.api.dateToTimestamp(timestampData)\r\n }\r\n })\r\n .filter(note => {\r\n return note.timestamp > previousState.timestamp && note.timestamp <= newState.timestamp;\r\n });\r\n\r\n const categories = new Set(notes.map(note => note.flags?.categories ?? []).deepFlatten());\r\n\r\n const actors = PileUtilities.getItemPileActors((actor) => {\r\n const flags = PileUtilities.getActorFlagData(actor, getProperty(actor, CONSTANTS.FLAGS.PILE));\r\n if (flags.type !== CONSTANTS.PILE_TYPES.MERCHANT) return false;\r\n return merchantRefreshFilter(flags, newState, previousState, categories);\r\n });\r\n\r\n const { validTokensOnScenes } = PileUtilities.getItemPileTokens((token) => {\r\n const flags = PileUtilities.getActorFlagData(token, getProperty(token, CONSTANTS.FLAGS.PILE));\r\n if (flags.type !== CONSTANTS.PILE_TYPES.MERCHANT) return false;\r\n return merchantRefreshFilter(flags, newState, previousState, categories);\r\n });\r\n\r\n previousState = newState;\r\n\r\n for (const actor of actors) {\r\n await this.refreshActorItems(actor);\r\n }\r\n\r\n for (const [_, tokens] of validTokensOnScenes) {\r\n for (const token of tokens) {\r\n await this.refreshActorItems(token.actor);\r\n }\r\n }\r\n }\r\n\r\n async refreshActorItems(actor) {\r\n\r\n const actorTransaction = new Transaction(actor);\r\n\r\n const actorItems = game.itempiles.API.getActorItems(actor);\r\n const newActorItems = await PileUtilities.rollMerchantTables({ actor });\r\n\r\n await actorTransaction.appendItemChanges(actorItems.filter(item => {\r\n const itemFlags = PileUtilities.getItemFlagData(item);\r\n return !itemFlags.keepOnMerchant && !itemFlags.keepIfZero;\r\n }), { remove: true });\r\n\r\n await actorTransaction.appendItemChanges(actorItems.filter(item => {\r\n const itemFlags = PileUtilities.getItemFlagData(item);\r\n return !itemFlags.keepOnMerchant && itemFlags.keepIfZero;\r\n }), { remove: true, keepIfZero: true });\r\n\r\n await actorTransaction.appendItemChanges(newActorItems.map(entry => ({\r\n item: entry.item, quantity: entry.quantity, flags: entry.flags\r\n })));\r\n\r\n await actorTransaction.commit();\r\n\r\n }\r\n}\r\n\r\nfunction merchantRefreshFilter(flags, newState, previousState, categories) {\r\n\r\n const openTimesEnabled = flags.openTimes.enabled;\r\n\r\n if (!openTimesEnabled) return false;\r\n\r\n const openTimes = flags.openTimes.open;\r\n const closeTimes = flags.openTimes.close;\r\n\r\n const openHour = openTimesEnabled ? openTimes.hour : 0;\r\n const openMinute = openTimesEnabled ? openTimes.minute : 0;\r\n const closeHour = openTimesEnabled ? closeTimes.hour : 0;\r\n const closeMinute = openTimesEnabled ? closeTimes.minute : 0;\r\n\r\n const openingTime = Number(openHour.toString() + \".\" + openMinute.toString());\r\n const closingTime = Number(closeHour.toString() + \".\" + closeMinute.toString());\r\n const previousTime = Number(previousState.dateTime.hour.toString() + \".\" + previousState.dateTime.minute.toString());\r\n const currentTime = Number(newState.dateTime.hour.toString() + \".\" + newState.dateTime.minute.toString());\r\n\r\n const wasOpen = openingTime > closingTime\r\n ? (previousTime >= openingTime || previousTime <= closingTime)\r\n : (previousTime >= openingTime && previousTime <= closingTime);\r\n\r\n const isOpen = openingTime > closingTime\r\n ? (currentTime >= openingTime || currentTime <= closingTime)\r\n : (currentTime >= openingTime && currentTime <= closingTime);\r\n\r\n const allWeekdays = window.SimpleCalendar.api.getAllWeekdays();\r\n const dayLength = SimpleCalendar.api.timestampPlusInterval(0, { day: 1 });\r\n\r\n const daysPassed = Math.floor((newState.timestamp - previousState.timestamp) / dayLength);\r\n\r\n const currentWeekday = newState.weekday;\r\n\r\n const shouldRefreshOnCurrentWeekday = flags.refreshItemsDays.includes(currentWeekday.name);\r\n const shouldRefreshPastWeekday = flags.refreshItemsDays.length > 0 && daysPassed >= allWeekdays.length;\r\n\r\n const shouldRefresh = (\r\n flags.refreshItemsOnOpen ||\r\n shouldRefreshOnCurrentWeekday ||\r\n shouldRefreshPastWeekday ||\r\n categories.intersection(new Set(flags.refreshItemsHolidays)).size > 0\r\n );\r\n\r\n return (!wasOpen && isOpen) && shouldRefresh;\r\n\r\n}\r\n","import BasePlugin from \"./base-plugin.js\";\r\nimport PrivateAPI from \"../API/private-api.js\";\r\n\r\nexport default class Levels3dPreview extends BasePlugin {\r\n\r\n registerHooks() {\r\n\r\n Hooks.on(\"3DCanvasConfig\", (config) => {\r\n config.INTERACTIONS.dropFunctions.Item = async function (event, data) {\r\n canvas.tokens.activate();\r\n return PrivateAPI._dropData(canvas, data);\r\n }\r\n });\r\n\r\n }\r\n\r\n}\r\n","import BasePlugin from \"./base-plugin.js\";\r\n\r\nexport default class RarityColors extends BasePlugin {\r\n\r\n getItemColor(item) {\r\n\r\n if (game.system.id !== \"dnd5e\") return false;\r\n\r\n const itemType = item.type;\r\n const rarity = item.system.rarity ? item.system.rarity.replaceAll(/\\s/g, \"\").toLowerCase().trim() : itemType;\r\n\r\n const isSpell = itemType === \"spell\";\r\n const spellFlag = game.settings.get(this.pluginName, \"spellFlag\");\r\n\r\n const isFeat = itemType === \"feat\";\r\n const featFlag = game.settings.get(this.pluginName, \"featFlag\");\r\n\r\n let doColor = false;\r\n if (item.system.rarity && item.system.rarity !== \"common\") {\r\n doColor = true;\r\n } else if (isSpell && spellFlag) {\r\n doColor = true;\r\n } else if (isFeat && featFlag) {\r\n doColor = true;\r\n }\r\n\r\n if (!doColor) return false;\r\n\r\n try {\r\n return game.settings.get(this.pluginName, rarity);\r\n } catch (err) {\r\n return false;\r\n }\r\n\r\n }\r\n\r\n}\r\n","import SimpleCalendarPlugin from \"./simple-calendar.js\";\r\nimport Levels3dPreview from \"./levels-3d-preview.js\";\r\nimport RarityColors from \"./rarity-colors.js\";\r\n\r\nexport const Plugins = {\r\n \"foundryvtt-simple-calendar\": {\r\n on: \"ready\",\r\n data: null,\r\n class: SimpleCalendarPlugin,\r\n minVersion: \"2.0.0\",\r\n invalidVersion: \"v1.3.75\"\r\n },\r\n \"levels-3d-preview\": {\r\n on: \"init\",\r\n data: null,\r\n class: Levels3dPreview,\r\n minVersion: \"4.9.6\"\r\n },\r\n \"rarity-colors\": {\r\n on: \"init\",\r\n data: null,\r\n class: RarityColors,\r\n minVersion: \"0.2.4\"\r\n }\r\n}\r\n\r\nexport function setupPlugins(hook) {\r\n for (const [plugin, pluginData] of Object.entries(Plugins).filter(e => e[1].on === hook)) {\r\n if (!game.modules.get(plugin)?.active) {\r\n continue;\r\n }\r\n pluginData.data = new pluginData.class(plugin, pluginData.minVersion, pluginData?.invalidVersion);\r\n }\r\n}\r\n","import { get, writable } from \"svelte/store\";\nimport * as Utilities from \"../helpers/utilities.js\";\nimport { TJSDocument } from '@typhonjs-fvtt/runtime/svelte/store';\nimport * as PileUtilities from \"../helpers/pile-utilities.js\";\nimport * as SharingUtilities from \"../helpers/sharing-utilities.js\";\nimport CONSTANTS from \"../constants/constants.js\";\nimport * as Helpers from \"../helpers/helpers.js\";\nimport { Plugins } from \"../plugins/main.js\";\nimport { SYSTEMS } from \"../systems.js\";\n\nclass PileBaseItem {\n\n constructor(store, data, isCurrency = false, isSecondaryCurrency = false) {\n this.store = store;\n this.subscriptions = [];\n this.isCurrency = isCurrency;\n this.isSecondaryCurrency = isSecondaryCurrency;\n this.setup(data);\n }\n\n setupStores() {\n this.category = writable({ service: false, type: \"\", label: \"\" });\n this.quantity = writable(1);\n this.currentQuantity = writable(1);\n this.quantityLeft = writable(1);\n this.filtered = writable(true);\n this.presentFromTheStart = writable(false);\n this.rarityColor = writable(false);\n }\n\n setupSubscriptions() {\n // Higher order implementation\n }\n\n setup(data) {\n this.unsubscribe();\n this.setupStores(data);\n this.setupSubscriptions(data);\n }\n\n subscribeTo(target, callback) {\n this.subscriptions.push(target.subscribe(callback));\n }\n\n unsubscribe() {\n this.subscriptions.forEach(unsubscribe => unsubscribe());\n this.subscriptions = [];\n }\n\n preview() {\n }\n}\n\nexport class PileItem extends PileBaseItem {\n\n setupStores(item) {\n super.setupStores();\n this.item = item;\n this.itemDocument = new TJSDocument(this.item);\n this.canStack = PileUtilities.canItemStack(this.item, this.actor);\n this.presentFromTheStart.set(Utilities.getItemQuantity(this.item) > 0 || !this.canStack);\n this.quantity.set(this.canStack ? Utilities.getItemQuantity(this.item) : 1);\n this.currentQuantity.set(Math.min(get(this.currentQuantity), get(this.quantityLeft), get(this.quantity)));\n this.id = this.item.id;\n this.type = this.item.type;\n this.name = writable(this.item.name);\n this.img = writable(this.item.img);\n this.abbreviation = writable(\"\");\n this.identifier = randomID();\n this.itemFlagData = writable(PileUtilities.getItemFlagData(this.item));\n }\n\n setupSubscriptions() {\n super.setupSubscriptions()\n\n this.subscribeTo(this.store.pileData, () => {\n this.setupProperties();\n });\n this.subscribeTo(this.store.pileCurrencies, () => {\n this.setupProperties();\n });\n\n this.subscribeTo(this.store.shareData, () => {\n if (!this.toShare) {\n this.quantityLeft.set(get(this.quantity));\n return;\n }\n const quantityLeft = SharingUtilities.getItemSharesLeftForActor(this.store.actor, this.item, this.store.recipient);\n this.quantityLeft.set(quantityLeft);\n });\n\n this.subscribeTo(this.itemDocument, () => {\n const { data } = this.itemDocument.updateOptions;\n this.name.set(this.item.name);\n this.img.set(this.item.img);\n this.similarities = Utilities.setSimilarityProperties({}, this.item);\n if (PileUtilities.canItemStack(this.item, this.store.actor) && Utilities.hasItemQuantity(data)) {\n this.quantity.set(Utilities.getItemQuantity(data));\n const quantity = Math.min(get(this.currentQuantity), get(this.quantityLeft), get(this.quantity));\n this.currentQuantity.set(quantity);\n }\n if (hasProperty(data, CONSTANTS.FLAGS.ITEM)) {\n this.itemFlagData.set(PileUtilities.getItemFlagData(this.item));\n this.updateCategory();\n this.store.refreshItems();\n }\n if (Plugins[\"rarity-colors\"].data) {\n this.rarityColor.set(Plugins[\"rarity-colors\"].data.getItemColor(this.item));\n }\n });\n\n this.updateCategory();\n\n this.subscribeTo(this.quantity, this.filter.bind(this));\n this.subscribeTo(this.store.search, this.filter.bind(this));\n this.subscribeTo(this.category, this.filter.bind(this));\n }\n\n setupProperties() {\n const actorIsItemPile = PileUtilities.isValidItemPile(this.store.actor, get(this.store.pileData));\n const pileActor = actorIsItemPile ? this.store.actor : this.store.recipient;\n const pileActorData = actorIsItemPile ? this.store.pileData : this.store.recipientPileData;\n const pileCurrencies = actorIsItemPile ? get(this.store.pileCurrencies) : get(this.store.recipientCurrencies);\n this.isCurrency = PileUtilities.isItemCurrency(this.item, {\n target: pileActor,\n actorCurrencies: pileCurrencies\n });\n const currency = this.isCurrency ? PileUtilities.getItemCurrencyData(this.item, {\n target: pileActor,\n actorCurrencies: pileCurrencies\n }) : {};\n this.isSecondaryCurrency = !!currency?.secondary;\n this.abbreviation.set(currency?.abbreviation ?? \"\");\n this.similarities = Utilities.setSimilarityProperties({}, this.item);\n this.name.set(this.isCurrency ? currency.name : this.item.name);\n this.img.set(this.isCurrency ? currency.img : this.item.img);\n this.toShare = this.isCurrency\n ? get(pileActorData).shareCurrenciesEnabled && !!this.store.recipient\n : get(pileActorData).shareItemsEnabled && !!this.store.recipient;\n }\n\n updateCategory() {\n const pileData = get(this.store.pileData);\n const itemFlagData = get(this.itemFlagData);\n this.category.update(cat => {\n cat.service = itemFlagData?.isService;\n if (itemFlagData.customCategory) {\n cat.type = itemFlagData.customCategory.toLowerCase();\n cat.label = itemFlagData.customCategory;\n } else if (cat.service && pileData.enabled && pileData.type === CONSTANTS.PILE_TYPES.MERCHANT) {\n cat.type = \"item-piles-service\";\n cat.label = \"ITEM-PILES.Merchant.Service\";\n } else {\n cat.type = this.type;\n cat.label = CONFIG.Item.typeLabels[this.type];\n }\n return cat;\n });\n }\n\n filter() {\n const name = get(this.name).trim();\n const search = get(this.store.search).trim();\n const presentFromTheStart = get(this.presentFromTheStart);\n const quantity = get(this.quantity);\n if (quantity === 0 && !presentFromTheStart) {\n this.filtered.set(true);\n } else if (search) {\n this.filtered.set(!name.toLowerCase().includes(search.toLowerCase()));\n } else {\n this.filtered.set(!presentFromTheStart && quantity === 0);\n }\n }\n\n take() {\n const quantity = Math.min(get(this.currentQuantity), get(this.quantityLeft));\n if (!quantity) return;\n return game.itempiles.API.transferItems(\n this.store.actor,\n this.store.recipient,\n [{ _id: this.id, quantity }],\n { interactionId: this.store.interactionId }\n );\n }\n\n async remove() {\n return game.itempiles.API.removeItems(this.store.actor, [this.id]);\n }\n\n updateQuantity(quantity, add = false) {\n let total = typeof quantity === \"string\" ? (new Roll(quantity).evaluate({ async: false })).total : quantity;\n if (add) {\n total += get(this.quantity);\n }\n this.quantity.set(total);\n return this.item.update(Utilities.setItemQuantity({}, total));\n }\n\n async updateFlags() {\n await this.item.update({\n [CONSTANTS.FLAGS.ITEM]: get(this.itemFlagData),\n [CONSTANTS.FLAGS.VERSION]: Helpers.getModuleVersion()\n })\n }\n\n preview() {\n const pileData = get(this.store.pileData);\n if (!pileData.canInspectItems && !game.user.isGM) return;\n if (SYSTEMS.DATA?.PREVIEW_ITEM_TRANSFORMER) {\n if (!SYSTEMS.DATA?.PREVIEW_ITEM_TRANSFORMER(this.item)) {\n return;\n }\n }\n if (game.user.isGM || this.item.permission[game.user.id] === 3) {\n return this.item.sheet.render(true);\n }\n const cls = this.item._getSheetClass();\n const sheet = new cls(this.item, { editable: false });\n return sheet._render(true);\n }\n}\n\nexport class PileAttribute extends PileBaseItem {\n\n setupStores(attribute) {\n super.setupStores();\n this.attribute = attribute;\n this.path = this.attribute.path;\n this.name = writable(this.attribute.name);\n this.img = writable(this.attribute.img);\n this.abbreviation = writable(this.attribute.abbreviation);\n this.identifier = randomID()\n const startingQuantity = Number(getProperty(this.store.actor, this.path) ?? 0);\n this.presentFromTheStart.set(startingQuantity > 0);\n this.quantity.set(startingQuantity);\n this.currentQuantity.set(Math.min(get(this.currentQuantity), get(this.quantityLeft), get(this.quantity)));\n this.category.set({ type: \"currency\", label: \"ITEM-PILES.Currency\" });\n }\n\n setupSubscriptions() {\n super.setupSubscriptions();\n\n this.subscribeTo(this.store.pileData, this.setupProperties.bind(this));\n\n this.subscribeTo(this.store.shareData, (val) => {\n if (!this.toShare) {\n this.quantityLeft.set(get(this.quantity));\n return;\n }\n const quantityLeft = SharingUtilities.getAttributeSharesLeftForActor(this.store.actor, this.path, this.store.recipient);\n this.quantityLeft.set(quantityLeft);\n });\n\n this.subscribeTo(this.store.document, () => {\n const { data } = this.store.document.updateOptions;\n this.path = this.attribute.path;\n this.name.set(this.attribute.name);\n this.img.set(this.attribute.img);\n if (hasProperty(data, this.path)) {\n this.quantity.set(Number(getProperty(data, this.path) ?? 0));\n this.currentQuantity.set(Math.min(get(this.currentQuantity), get(this.quantityLeft), get(this.quantity)));\n this.store.refreshItems();\n }\n });\n\n this.subscribeTo(this.quantity, this.filter.bind(this));\n this.subscribeTo(this.store.search, this.filter.bind(this));\n }\n\n setupProperties() {\n this.toShare = get(this.store.pileData).shareCurrenciesEnabled && !!this.store.recipient;\n }\n\n filter() {\n const name = get(this.name);\n const search = get(this.store.search);\n const presentFromTheStart = get(this.presentFromTheStart);\n const quantity = get(this.quantity);\n if (quantity === 0 && !presentFromTheStart) {\n this.filtered.set(true);\n } else if (search) {\n this.filtered.set(!name.toLowerCase().includes(search.toLowerCase()));\n } else {\n this.filtered.set(!presentFromTheStart && quantity === 0);\n }\n }\n\n take() {\n const quantity = Math.min(get(this.currentQuantity), get(this.quantityLeft));\n return game.itempiles.API.transferAttributes(\n this.store.actor,\n this.store.recipient,\n { [this.path]: quantity },\n { interactionId: this.store.interactionId }\n );\n }\n\n updateQuantity() {\n return this.store.actor.update({\n [this.path]: get(this.quantity)\n });\n }\n\n}\n","<script>\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n import { getContext } from \"svelte\";\n import * as PileUtilities from \"../../../helpers/pile-utilities.js\";\n import { abbreviateNumbers } from \"../../../helpers/helpers.js\";\n\n const { application } = getContext('#external');\n\n export let sourceActor;\n export let targetActor;\n export let localization;\n export let settings;\n export let elementRoot;\n\n const targetCurrencyData = PileUtilities.getCurrencyList(targetActor);\n\n const currencies = PileUtilities.getActorCurrencies(sourceActor, {\n currencyList: targetActor ? targetCurrencyData.currencies : false,\n getAll: settings?.unlimitedCurrencies\n });\n\n let attributes = currencies.filter(entry => entry.type === \"attribute\")\n .map(currency => {\n currency.currentQuantity = 0;\n return currency;\n });\n\n if (settings?.existingCurrencies) {\n attributes.forEach(currency => {\n const existingCurrency = settings?.existingCurrencies.find(existingCurrency => existingCurrency.id === currency.id);\n if (existingCurrency) {\n currency.currentQuantity = existingCurrency.quantity;\n }\n });\n }\n\n let items = currencies.filter(entry => entry.type !== \"attribute\")\n .map(currency => {\n currency.create = !currency.id;\n currency.id = currency.id ?? randomID();\n currency.currentQuantity = 0;\n return currency;\n });\n\n if (settings?.existingCurrencies) {\n items.forEach(currency => {\n const existingCurrency = settings?.existingCurrencies.find(existingCurrency => existingCurrency.id === currency.id);\n if (existingCurrency) {\n currency.currentQuantity = existingCurrency.quantity;\n }\n });\n }\n\n let form;\n\n function requestSubmit() {\n form.requestSubmit();\n }\n\n function submit() {\n\n const itemsToUpdate = items\n .filter(item => (settings.unlimitedCurrencies || item.currentQuantity) && !item.create)\n .map(item => {\n return {\n _id: item.id,\n quantity: settings.getUpdates && item.quantity ? Math.min(item.quantity, item.currentQuantity - item.quantity) : item.currentQuantity\n }\n })\n\n const itemsToCreate = items\n .filter(item => item.currentQuantity && item.create)\n .map(item => ({\n item: item.data.item,\n quantity: settings.unlimitedCurrencies ? item.currentQuantity : Math.max(0, Math.min(item.quantity, item.currentQuantity))\n }))\n\n application.options.resolve({\n attributes: Object.fromEntries(attributes\n .filter(attribute => settings.unlimitedCurrencies || attribute.currentQuantity)\n .map(attribute => [attribute.path, settings.unlimitedCurrencies ? attribute.currentQuantity : Math.max(0, Math.min(attribute.quantity, attribute.currentQuantity))])\n ),\n items: itemsToUpdate.concat(itemsToCreate)\n });\n application.close();\n }\n\n</script>\n\n<svelte:options accessors={true}/>\n\n<ApplicationShell bind:elementRoot>\n\n\t<form autocomplete=\"off\" bind:this={form} class=\"item-piles-flexcol\" on:submit|once|preventDefault={submit}\n\t\t\t\tstyle=\"padding:0.5rem;\">\n\n\t\t{#if attributes.length || items.length}\n\n\t\t\t<p style=\"text-align: center; margin: 0;\" class=\"item-piles-bottom-divider\">\n\t\t\t\t{settings?.content ?? localize(`ITEM-PILES.Applications.${localization}.Content`)}\n\t\t\t</p>\n\n\t\t\t{#each attributes.filter(currency => !currency.secondary) as attribute, index (attribute.path)}\n\t\t\t\t<div class=\"form-group item-piles-slider-group item-piles-odd-color\">\n\t\t\t\t\t<div class=\"item-piles-img-container\">\n\t\t\t\t\t\t<img class=\"item-piles-img\" src=\"{attribute.img}\">\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"item-piles-name item-piles-text\">\n\t\t\t\t\t\t<div>{attribute.name}</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{#if settings?.unlimitedCurrencies}\n\t\t\t\t\t\t<input class=\"item-piles-range-input\" style=\"flex: 2; margin-left:1rem;\" type=\"number\"\n\t\t\t\t\t\t\t\t\t bind:value={attribute.currentQuantity}/>\n\t\t\t\t\t{:else}\n\t\t\t\t\t\t<input class=\"item-piles-range-slider\" style=\"flex: 5;\" type=\"range\" min=\"0\" max=\"{attribute.quantity}\"\n\t\t\t\t\t\t\t\t\t bind:value={attribute.currentQuantity}/>\n\t\t\t\t\t\t<input class=\"item-piles-range-input\" style=\"flex: 2; margin-left:1rem;\" type=\"number\"\n\t\t\t\t\t\t\t\t\t bind:value={attribute.currentQuantity}\n\t\t\t\t\t\t\t\t\t on:click={() => {\n attribute.currentQuantity = Math.max(0, Math.min(attribute.quantity, attribute.currentQuantity));\n }}/>\n\t\t\t\t\t\t<div style=\"flex:0 1 50px; margin: 0 5px;\">/ {abbreviateNumbers(attribute.quantity)}</div>\n\t\t\t\t\t{/if}\n\t\t\t\t</div>\n\t\t\t{/each}\n\n\t\t\t{#each items.filter(currency => !currency.secondary) as item, index (item.id)}\n\t\t\t\t<div class=\"form-group item-piles-slider-group item-piles-odd-color\">\n\t\t\t\t\t<div class=\"item-piles-img-container\">\n\t\t\t\t\t\t<img class=\"item-piles-img\" src=\"{item.img}\">\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"item-piles-name item-piles-text\">\n\t\t\t\t\t\t<div>{item.name}</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{#if settings?.unlimitedCurrencies}\n\t\t\t\t\t\t<input class=\"item-piles-range-input\" style=\"flex: 2; margin-left:1rem;\" type=\"number\"\n\t\t\t\t\t\t\t\t\t bind:value={item.currentQuantity}/>\n\t\t\t\t\t{:else}\n\t\t\t\t\t\t<input class=\"item-piles-range-slider\" style=\"flex: 5;\" type=\"range\" min=\"0\" max=\"{item.quantity}\"\n\t\t\t\t\t\t\t\t\t bind:value={item.currentQuantity}/>\n\t\t\t\t\t\t<input class=\"item-piles-range-input\" style=\"flex: 1.5; margin-left:1rem;\" type=\"number\"\n\t\t\t\t\t\t\t\t\t bind:value={item.currentQuantity}\n\t\t\t\t\t\t\t\t\t on:click={() => {\n item.currentQuantity = Math.max(0, Math.min(item.quantity, item.currentQuantity));\n }}/>\n\t\t\t\t\t\t<div style=\"flex:0 1 50px; margin: 0 5px;\">/ {abbreviateNumbers(item.quantity)}</div>\n\t\t\t\t\t{/if}\n\t\t\t\t</div>\n\t\t\t{/each}\n\n\t\t\t{#if attributes.filter(currency => currency.secondary).length || items.filter(currency => currency.secondary).length}\n\n\t\t\t\t<div class=\"item-piles-top-divider\"></div>\n\n\t\t\t\t{#each attributes.filter(currency => currency.secondary) as attribute, index (attribute.path)}\n\t\t\t\t\t<div class=\"form-group item-piles-slider-group item-piles-odd-color\">\n\t\t\t\t\t\t<div class=\"item-piles-img-container\">\n\t\t\t\t\t\t\t<img class=\"item-piles-img\" src=\"{attribute.img}\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"item-piles-name item-piles-text\">\n\t\t\t\t\t\t\t<div>{attribute.name}</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{#if settings?.unlimitedCurrencies}\n\t\t\t\t\t\t\t<input class=\"item-piles-range-input\" style=\"flex: 2; margin-left:1rem;\" type=\"number\"\n\t\t\t\t\t\t\t\t\t\t bind:value={attribute.currentQuantity}/>\n\t\t\t\t\t\t{:else}\n\t\t\t\t\t\t\t<input class=\"item-piles-range-slider\" style=\"flex: 5;\" type=\"range\" min=\"0\" max=\"{attribute.quantity}\"\n\t\t\t\t\t\t\t\t\t\t bind:value={attribute.currentQuantity}/>\n\t\t\t\t\t\t\t<input class=\"item-piles-range-input\" style=\"flex: 2; margin-left:1rem;\" type=\"number\"\n\t\t\t\t\t\t\t\t\t\t bind:value={attribute.currentQuantity}\n\t\t\t\t\t\t\t\t\t\t on:click={() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tattribute.currentQuantity = Math.max(0, Math.min(attribute.quantity, attribute.currentQuantity));\n\t\t\t\t\t\t\t\t\t\t }}/>\n\t\t\t\t\t\t\t<div style=\"flex:0 1 50px; margin: 0 5px;\">/ {abbreviateNumbers(attribute.quantity)}</div>\n\t\t\t\t\t\t{/if}\n\t\t\t\t\t</div>\n\t\t\t\t{/each}\n\n\t\t\t\t{#each items.filter(currency => currency.secondary) as item, index (item.id)}\n\t\t\t\t\t<div class=\"form-group item-piles-slider-group item-piles-odd-color\">\n\t\t\t\t\t\t<div class=\"item-piles-img-container\">\n\t\t\t\t\t\t\t<img class=\"item-piles-img\" src=\"{item.img}\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"item-piles-name item-piles-text\">\n\t\t\t\t\t\t\t<div>{item.name}</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{#if settings?.unlimitedCurrencies}\n\t\t\t\t\t\t\t<input class=\"item-piles-range-input\" style=\"flex: 2; margin-left:1rem;\" type=\"number\"\n\t\t\t\t\t\t\t\t\t\t bind:value={item.currentQuantity}/>\n\t\t\t\t\t\t{:else}\n\t\t\t\t\t\t\t<input class=\"item-piles-range-slider\" style=\"flex: 5;\" type=\"range\" min=\"0\" max=\"{item.quantity}\"\n\t\t\t\t\t\t\t\t\t\t bind:value={item.currentQuantity}/>\n\t\t\t\t\t\t\t<input class=\"item-piles-range-input\" style=\"flex: 1.5; margin-left:1rem;\" type=\"number\"\n\t\t\t\t\t\t\t\t\t\t bind:value={item.currentQuantity}\n\t\t\t\t\t\t\t\t\t\t on:click={() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\titem.currentQuantity = Math.max(0, Math.min(item.quantity, item.currentQuantity));\n\t\t\t\t\t\t\t\t\t\t }}/>\n\t\t\t\t\t\t\t<div style=\"flex:0 1 50px; margin: 0 5px;\">/ {abbreviateNumbers(item.quantity)}</div>\n\t\t\t\t\t\t{/if}\n\t\t\t\t\t</div>\n\t\t\t\t{/each}\n\n\t\t\t{/if}\n\n\t\t{:else}\n\n\t\t\t<p style=\"text-align: center;\">\n\t\t\t\t{localize(`ITEM-PILES.Applications.${localization}.NoCurrency`, { actor_name: sourceActor.name })}\n\t\t\t</p>\n\n\t\t{/if}\n\n\t\t<footer class=\"sheet-footer item-piles-flexrow\" style=\"margin-top: 1rem;\">\n\t\t\t{#if attributes.length || items.length}\n\t\t\t\t<button type=\"button\" on:click|once={requestSubmit}>\n\t\t\t\t\t<i class=\"fas fa-download\"></i>\n\t\t\t\t\t{localize(settings?.button ?? `ITEM-PILES.Applications.${localization}.Submit`)}\n\t\t\t\t</button>\n\t\t\t{/if}\n\n\t\t\t<button on:click|once={() => { application.close() }} type=\"button\">\n\t\t\t\t<i class=\"fas fa-times\"></i>\n\t\t\t\t{localize(\"Cancel\")}\n\t\t\t</button>\n\t\t</footer>\n\n\t</form>\n\n</ApplicationShell>\n","import DropCurrencyDialogShell from \"./drop-currency-dialog-shell.svelte\";\r\nimport { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport { getActiveApps } from \"../../../helpers/helpers\";\r\n\r\nexport default class DropCurrencyDialog extends SvelteApplication {\r\n\r\n /**\r\n *\r\n * @param sourceActor\r\n * @param targetActor\r\n * @param settings\r\n * @param options\r\n */\r\n constructor(sourceActor, targetActor, settings = {}, options = {}) {\r\n const localization = settings.localization || \"DropCurrencies\";\r\n super({\r\n id: `item-pile-drop-currency-${sourceActor ? (sourceActor.id + (targetActor ? \"-\" + targetActor.id : \"\")) : \"\"}-${randomID()}`,\r\n title: settings.title ?? game.i18n.localize(`ITEM-PILES.Applications.${localization}.Title`),\r\n svelte: {\r\n class: DropCurrencyDialogShell,\r\n target: document.body,\r\n props: {\r\n sourceActor,\r\n targetActor,\r\n localization,\r\n settings\r\n }\r\n },\r\n close: () => this.options.resolve?.(null),\r\n ...options\r\n })\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n width: 430,\r\n height: \"auto\",\r\n classes: [\"item-piles-app\"]\r\n })\r\n }\r\n\r\n static getActiveApps(id) {\r\n return getActiveApps(`item-pile-drop-currency-${id}`);\r\n }\r\n\r\n static async show(sourceActor, targetActor, settings = {}, options = {}) {\r\n if (sourceActor) {\r\n const apps = this.getActiveApps(targetActor ? sourceActor.uuid + \"-\" + targetActor.uuid : sourceActor.uuid);\r\n if (apps.length) {\r\n for (let app of apps) {\r\n app.render(false, { focus: true });\r\n }\r\n return;\r\n }\r\n }\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(sourceActor, targetActor, settings, options).render(true, { focus: true });\r\n })\r\n }\r\n\r\n}\r\n","import { get, writable } from \"svelte/store\";\nimport { TJSDocument } from '@typhonjs-fvtt/runtime/svelte/store';\nimport CONSTANTS from \"../constants/constants.js\";\nimport * as Utilities from \"../helpers/utilities.js\";\nimport * as PileUtilities from \"../helpers/pile-utilities.js\";\nimport * as SharingUtilities from \"../helpers/sharing-utilities.js\";\nimport * as Helpers from \"../helpers/helpers.js\";\nimport { InterfaceTracker } from \"../socket.js\";\nimport { PileAttribute, PileItem } from \"./pile-item.js\";\nimport DropCurrencyDialog from \"../applications/dialogs/drop-currency-dialog/drop-currency-dialog.js\";\n\nconst __STORES__ = new Map();\n\nexport default class ItemPileStore {\n\n constructor(application, source, recipient = false, { recipientPileData = false } = {}) {\n\n this.subscriptions = [];\n\n this.interactionId = randomID();\n this.application = application;\n\n this.uuid = Utilities.getUuid(source);\n this.actor = Utilities.getActor(source);\n this.document = new TJSDocument(this.actor);\n\n this.recipient = recipient ? Utilities.getActor(recipient) : false;\n this.recipientDocument = recipient ? new TJSDocument(this.recipient) : new TJSDocument();\n this.recipientPileData = writable(recipientPileData);\n\n this.pileData = writable({});\n this.shareData = writable({});\n\n this.recipientPileData = writable({})\n this.recipientShareData = writable({});\n\n this.deleted = writable(false);\n\n this.search = writable(\"\");\n this.editQuantities = writable(true);\n\n this.allItems = writable([]);\n this.attributes = writable([]);\n\n this.items = writable([]);\n this.visibleItems = writable([]);\n\n this.pileCurrencies = writable([]);\n this.recipientCurrencies = writable([]);\n\n this.currencies = writable([]);\n this.allCurrencies = writable([]);\n\n this.itemsPerCategory = writable({});\n this.categories = writable([]);\n this.itemCategories = writable([]);\n\n this.numItems = writable(0);\n this.numCurrencies = writable(0);\n\n this.name = writable(\"\");\n this.img = writable(\"\");\n\n __STORES__.set(this.uuid, this);\n\n }\n\n get ItemClass() {\n return PileItem;\n };\n\n get AttributeClass() {\n return PileAttribute;\n };\n\n get searchDelay() {\n return 200;\n }\n\n static make(...args) {\n const store = new this(...args)\n store.setupStores();\n store.setupSubscriptions();\n return store;\n }\n\n static getStore(actor) {\n const uuid = Utilities.getUuid(actor);\n return __STORES__.get(uuid);\n }\n\n static notifyChanges(event, actor, ...args) {\n const store = this.getStore(actor);\n if (store) {\n store[event](...args);\n }\n }\n\n static notifyAllOfChanges(event, ...args) {\n for (const store of __STORES__.values()) {\n if (store[event]) {\n store[event](...args);\n }\n }\n }\n\n setupStores() {\n\n this.pileData.set(PileUtilities.getActorFlagData(this.actor));\n this.shareData.set(SharingUtilities.getItemPileSharingData(this.actor));\n\n this.recipientPileData.set(this.recipient ? PileUtilities.getActorFlagData(this.recipient) : {});\n this.recipientShareData.set(this.recipient ? SharingUtilities.getItemPileSharingData(this.recipient) : {});\n\n this.deleted.set(false);\n\n this.search.set(\"\");\n this.editQuantities.set(!this.recipient);\n\n this.allItems.set([]);\n this.attributes.set([]);\n\n this.items.set([]);\n this.visibleItems.set([]);\n\n this.pileCurrencies.set(PileUtilities.getActorCurrencies(this.actor, { getAll: true }));\n this.recipientCurrencies.set(this.recipient ? PileUtilities.getActorCurrencies(this.recipient, { getAll: true }) : []);\n\n this.currencies.set([]);\n this.allCurrencies.set([]);\n\n this.itemsPerCategory.set({});\n this.categories.set([]);\n this.itemCategories.set([]);\n\n this.numItems.set(0);\n this.numCurrencies.set(0);\n\n this.name.set(\"\");\n this.img.set(\"\");\n\n }\n\n getActorImage() {\n return this.actor.img;\n }\n\n setupSubscriptions() {\n\n this.subscribeTo(this.document, () => {\n const { data } = this.document.updateOptions;\n if (hasProperty(data, CONSTANTS.FLAGS.SHARING)) {\n this.shareData.set(SharingUtilities.getItemPileSharingData(this.actor));\n this.refreshItems();\n }\n if (hasProperty(data, CONSTANTS.FLAGS.PILE)) {\n this.pileData.set(PileUtilities.getActorFlagData(this.actor));\n this.pileCurrencies.set(PileUtilities.getActorCurrencies(this.actor, { getAll: true }));\n this.refreshItems();\n }\n this.name.set(this.actor.name);\n this.img.set(this.getActorImage());\n });\n\n if (this.recipientDocument) {\n this.subscribeTo(this.recipientDocument, () => {\n const { data } = this.document.updateOptions;\n if (hasProperty(data, CONSTANTS.FLAGS.SHARING)) {\n this.recipientShareData.set(SharingUtilities.getItemPileSharingData(this.recipient));\n this.refreshItems();\n }\n if (hasProperty(data, CONSTANTS.FLAGS.PILE)) {\n this.recipientPileData.set(PileUtilities.getActorFlagData(this.recipient));\n this.recipientCurrencies.set(PileUtilities.getActorCurrencies(this.recipient, { getAll: true }));\n this.refreshItems();\n }\n });\n }\n\n const items = [];\n const attributes = [];\n\n const pileData = PileUtilities.isValidItemPile(this.actor) || !this.recipient ? get(this.pileData) : get(this.recipientPileData);\n\n PileUtilities.getActorItems(this.actor, { itemFilters: pileData.overrideItemFilters }).map(item => {\n items.push(new this.ItemClass(this, item));\n });\n\n PileUtilities.getActorCurrencies(this.actor, { forActor: this.recipient, getAll: true }).forEach(currency => {\n if (currency.type === \"item\") {\n if (!currency.item) return\n items.push(new this.ItemClass(this, currency.item, true, !!currency?.secondary));\n } else {\n attributes.push(new this.AttributeClass(this, currency, true, !!currency?.secondary));\n }\n });\n\n this.allItems.set(items);\n this.attributes.set(attributes);\n\n this.subscribeTo(this.allItems, () => {\n this.refreshItems();\n });\n this.subscribeTo(this.attributes, () => {\n this.refreshItems();\n });\n\n const filterDebounce = foundry.utils.debounce(() => {\n this.refreshItems();\n }, this.searchDelay);\n this.subscribeTo(this.search, (val) => {\n filterDebounce()\n });\n\n }\n\n updateSource(newSource) {\n this.uuid = Utilities.getUuid(newSource);\n this.actor = Utilities.getActor(newSource);\n this.document.set(this.actor);\n __STORES__.set(this.uuid, this);\n this.unsubscribe();\n this.setupStores();\n this.setupSubscriptions();\n }\n\n updateRecipient(newRecipient) {\n this.recipient = newRecipient;\n this.recipientDocument.set(this.recipient);\n this.unsubscribe();\n this.setupStores();\n this.setupSubscriptions();\n }\n\n visibleItemFilterFunction(entry, actorIsMerchant, pileData, recipientPileData) {\n const itemFlagData = entry.itemFlagData ? get(entry.itemFlagData) : {};\n return !entry.isCurrency\n && (this.actor.isOwner || !actorIsMerchant || !itemFlagData?.hidden);\n }\n\n itemSortFunction(a, b, inverse) {\n return (b.item.name > a.item.name ? -1 : 1) * (inverse ? -1 : 1);\n }\n\n refreshItems() {\n const allItems = get(this.allItems);\n const pileData = get(this.pileData);\n const recipientPileData = this.recipient ? PileUtilities.getActorFlagData(this.recipient) : {}\n const actorIsMerchant = PileUtilities.isItemPileMerchant(this.actor, pileData);\n\n const visibleItems = allItems.filter(entry => this.visibleItemFilterFunction(entry, actorIsMerchant, pileData, recipientPileData));\n const itemCurrencies = allItems.filter(entry => entry.isCurrency && !entry.isSecondaryCurrency);\n const secondaryItemCurrencies = allItems.filter(entry => entry.isSecondaryCurrency);\n\n this.visibleItems.set(visibleItems);\n\n const items = visibleItems.filter(entry => !get(entry.filtered));\n\n this.numItems.set(items.filter(entry => get(entry.quantity) > 0).length);\n this.items.set(items.sort((a, b) => this.itemSortFunction(a, b)));\n\n const currencies = get(this.attributes).filter(entry => !entry.isSecondaryCurrency).concat(itemCurrencies);\n const secondaryCurrencies = get(this.attributes).filter(entry => entry.isSecondaryCurrency).concat(secondaryItemCurrencies);\n\n this.numCurrencies.set(currencies.concat(secondaryCurrencies).filter(entry => get(entry.quantity) > 0).length);\n\n this.currencies.set(currencies.concat(secondaryCurrencies).filter(entry => !get(entry.filtered)));\n this.allCurrencies.set(currencies.concat(secondaryCurrencies));\n\n this.itemCategories.set(Object.values(visibleItems.reduce((acc, item) => {\n const category = get(item.category);\n if (!acc[category.type]) {\n acc[category.type] = { ...category };\n }\n return acc;\n }, {})).sort((a, b) => a.label < b.label ? -1 : 1));\n\n const itemsPerCategory = items\n .reduce((acc, item) => {\n const category = get(item.category);\n if (!acc[category.type]) {\n acc[category.type] = {\n service: category.service,\n type: category.type,\n label: category.label,\n items: []\n };\n }\n acc[category.type].items.push(item);\n return acc;\n }, {})\n\n Object.values(itemsPerCategory).forEach(category => category.items.sort((a, b) => {\n return a.item.name < b.item.name ? -1 : 1;\n }));\n\n this.itemsPerCategory.set(itemsPerCategory);\n\n this.categories.set(Object.values(itemsPerCategory).map(category => {\n return {\n service: category.service,\n label: category.label,\n type: category.type\n }\n }).sort((a, b) => a.label < b.label ? -1 : 1));\n }\n\n createItem(item) {\n if (PileUtilities.isItemInvalid(this.actor, item)) return;\n const items = get(this.allItems);\n const deletedItems = items\n .filter(item => item.id === null)\n .map(item => ({\n pileItem: item,\n ...item.similarities\n }));\n const previouslyDeletedItem = Utilities.findSimilarItem(deletedItems, item);\n if (previouslyDeletedItem) {\n previouslyDeletedItem.pileItem.setup(item);\n } else {\n items.push(new this.ItemClass(this, item));\n }\n this.allItems.set(items);\n }\n\n deleteItem(item) {\n if (PileUtilities.isItemInvalid(this.actor, item)) return;\n const items = get(this.allItems);\n const pileItem = items.find(pileItem => pileItem.id === item.id);\n if (!pileItem) return;\n if (get(this.editQuantities) || !InterfaceTracker.isOpened(this.application.id)) {\n items.splice(items.indexOf(pileItem), 1);\n this.allItems.set(items);\n } else {\n pileItem.id = null;\n pileItem.quantity.set(0);\n pileItem.quantityLeft.set(0);\n }\n pileItem.unsubscribe();\n }\n\n hasSimilarItem(item) {\n const items = get(this.allItems).map(item => item.item);\n return !!Utilities.findSimilarItem(items, item, get(this.pileData));\n }\n\n delete() {\n this.deleted.set(true);\n }\n\n async update() {\n\n const itemsToUpdate = [];\n const itemsToDelete = [];\n const attributesToUpdate = {};\n\n const items = get(this.allItems).filter(item => item.id);\n for (let item of items) {\n const itemQuantity = get(item.quantity);\n if (itemQuantity === 0) {\n itemsToDelete.push(item.id);\n } else {\n if (PileUtilities.canItemStack(item.item, this.actor)) {\n itemsToUpdate.push(Utilities.setItemQuantity({ _id: item.id }, itemQuantity));\n }\n }\n }\n\n const attributes = get(this.attributes);\n for (let attribute of attributes) {\n attributesToUpdate[attribute.path] = get(attribute.quantity);\n }\n\n const pileSharingData = SharingUtilities.getItemPileSharingData(this.actor);\n\n await this.actor.update(attributesToUpdate);\n if (pileSharingData?.currencies) {\n pileSharingData.currencies = pileSharingData.currencies.map(currency => {\n if (attributesToUpdate[currency.path] !== undefined) {\n currency.actors = currency.actors.map(actor => {\n actor.quantity = Math.max(0, Math.min(actor.quantity, attributesToUpdate[currency.path]));\n return actor;\n })\n }\n return currency;\n })\n }\n\n await this.actor.updateEmbeddedDocuments(\"Item\", itemsToUpdate);\n await this.actor.deleteEmbeddedDocuments(\"Item\", itemsToDelete);\n if (pileSharingData?.items) {\n pileSharingData.items = pileSharingData.items.map(item => {\n const sharingItem = itemsToUpdate.find(item => item._id === item.id);\n if (sharingItem) {\n item.actors = item.actors.map(actor => {\n actor.quantity = Math.max(0, Math.min(actor.quantity, sharingItem.quantity));\n return actor;\n })\n }\n return item;\n })\n }\n\n await SharingUtilities.updateItemPileSharingData(this.actor, pileSharingData);\n\n this.refreshItems();\n\n Helpers.custom_notify(game.i18n.localize(\"ITEM-PILES.Notifications.UpdateItemPileSuccess\"));\n\n }\n\n async depositCurrency() {\n const result = await DropCurrencyDialog.show(this.recipient, this.actor, { localization: \"DepositCurrencies\" });\n return this._addCurrency(result, this.recipient, this.actor);\n }\n\n async withdrawCurrency() {\n const result = await DropCurrencyDialog.show(this.actor, this.recipient, { localization: \"WithdrawCurrencies\" });\n return this._addCurrency(result, this.actor, this.recipient);\n }\n\n async addCurrency(recipient = false) {\n const source = recipient || this.actor;\n const target = recipient ? this.actor : false;\n const result = await DropCurrencyDialog.show(source, target, {\n localization: !target ? \"EditCurrencies\" : false,\n unlimitedCurrencies: !target && game.user.isGM,\n existingCurrencies: PileUtilities.getActorCurrencies(source, { combine: true }),\n getUpdates: !target\n });\n return this._addCurrency(result, source, target);\n }\n\n async _addCurrency(currencies, source, target = false) {\n\n if (!currencies) return;\n\n if (!target) {\n\n if (!game.user.isGM) return;\n\n if (!foundry.utils.isEmpty(currencies.attributes)) {\n await game.itempiles.API.setAttributes(source, currencies.attributes, { interactionId: this.interactionId })\n }\n if (currencies.items.length) {\n const itemsToAdd = currencies.items.filter(currency => currency.quantity > 0);\n const itemsToRemove = currencies.items.filter(currency => currency.quantity < 0);\n await game.itempiles.API.addItems(source, itemsToAdd, { interactionId: this.interactionId })\n await game.itempiles.API.removeItems(source, itemsToRemove, { interactionId: this.interactionId })\n }\n\n } else {\n\n if (!foundry.utils.isEmpty(currencies.attributes)) {\n await game.itempiles.API.transferAttributes(source, target, currencies.attributes, { interactionId: this.interactionId })\n }\n if (currencies.items.length) {\n await game.itempiles.API.transferItems(source, target, currencies.items, { interactionId: this.interactionId })\n }\n }\n\n }\n\n takeAll() {\n game.itempiles.API.transferEverything(\n this.actor,\n this.recipient,\n { interactionId: this.interactionId }\n );\n }\n\n splitAll() {\n return game.itempiles.API.splitItemPileContents(this.actor, { instigator: this.recipient });\n }\n\n closeContainer() {\n if (!InterfaceTracker.isOpened(this.application.id)) {\n return game.itempiles.API.closeItemPile(this.actor, this.recipient);\n }\n }\n\n subscribeTo(target, callback) {\n this.subscriptions.push(target.subscribe(callback));\n }\n\n unsubscribe() {\n this.subscriptions.forEach(unsubscribe => unsubscribe());\n this.subscriptions = [];\n }\n\n onDestroy() {\n this.unsubscribe();\n __STORES__.delete(this.uuid);\n }\n}\n","<script>\r\n\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { fade } from 'svelte/transition';\r\n import ListEntry from \"./ListEntry.svelte\";\r\n\r\n export let store;\r\n const numItems = store.numItems;\r\n const categories = store.categories;\r\n const itemsPerCategory = store.itemsPerCategory;\r\n\r\n</script>\r\n\r\n\r\n{#if $numItems > 0}\r\n\r\n\t<div in:fade|local={{duration: 150}}>\r\n\r\n\t\t{#each $categories as category, index (category.type)}\r\n\t\t\t<div class=\"item-group-type item-piles-flexrow\">\r\n\t\t\t\t<h3>{localize(category.label)}</h3>\r\n\t\t\t</div>\r\n\r\n\t\t\t<div class=\"item-piles-items-list\">\r\n\t\t\t\t{#each $itemsPerCategory[category.type].items as item (item.id)}\r\n\t\t\t\t\t<ListEntry {store} bind:entry={item}/>\r\n\t\t\t\t{/each}\r\n\t\t\t</div>\r\n\t\t{/each}\r\n\r\n\t</div>\r\n\r\n{/if}\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-group-type {\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.2);\r\n margin: 0.5rem 0 0.25rem 0;\r\n padding-right: 10px;\r\n height: 1.5rem;\r\n align-items: center;\r\n }\r\n\r\n</style>\r\n","<script>\r\n import { getContext, onDestroy } from 'svelte';\r\n import { fade } from 'svelte/transition';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { ApplicationShell } from '@typhonjs-fvtt/runtime/svelte/component/core';\r\n\r\n import ItemList from \"./ItemList.svelte\";\r\n import CurrencyList from \"./CurrencyList.svelte\";\r\n import ActorPicker from \"../components/ActorPicker.svelte\";\r\n\r\n import * as SharingUtilities from \"../../helpers/sharing-utilities.js\";\r\n import * as PileUtilities from \"../../helpers/pile-utilities.js\";\r\n import PrivateAPI from \"../../API/private-api.js\";\r\n import ItemPileStore from \"../../stores/item-pile-store.js\";\r\n import CategorizedItemList from \"./CategorizedItemList.svelte\";\r\n import * as Helpers from \"../../helpers/helpers.js\";\r\n import { getSourceActorFromDropData } from \"../../helpers/utilities.js\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let elementRoot;\r\n export let actor;\r\n export let recipient;\r\n\r\n export let store = ItemPileStore.make(application, actor, recipient);\r\n\r\n // Stores\r\n let canBeSplit = false;\r\n let searchStore = store.search;\r\n let editQuantities = store.editQuantities;\r\n let pileData = store.pileData;\r\n let deleted = store.deleted;\r\n\r\n const items = store.allItems;\r\n const currencies = store.currencies;\r\n const numItems = store.numItems;\r\n const shareData = store.shareData;\r\n const numCurrencies = store.numCurrencies;\r\n\r\n $: isPileEmpty = $numItems === 0 && $numCurrencies === 0;\r\n $: hasItems = $numItems > 0;\r\n $: showSearchBar = $numItems >= 8;\r\n $: isContainer = PileUtilities.isItemPileContainer(actor, $pileData)\r\n $: {\r\n $shareData;\r\n $items;\r\n $currencies;\r\n canBeSplit = SharingUtilities.canItemPileBeSplit(actor);\r\n }\r\n\r\n let num_players = SharingUtilities.getPlayersForItemPile(actor).length;\r\n\r\n async function dropData(event) {\r\n\r\n event.preventDefault();\r\n\r\n let data;\r\n try {\r\n data = JSON.parse(event.dataTransfer.getData('text/plain'));\r\n } catch (err) {\r\n return false;\r\n }\r\n\r\n if (data.type === \"Actor\" && game.user.isGM) {\r\n const newRecipient = data.uuid ? (await fromUuid(data.uuid)) : game.actors.get(data.id);\r\n return store.updateRecipient(newRecipient)\r\n }\r\n\r\n if (data.type !== \"Item\") {\r\n Helpers.custom_warning(`You can't drop documents of type \"${data.type}\" into this Item Piles vault!`, true)\r\n return false;\r\n }\r\n\r\n const item = await Item.implementation.fromDropData(data);\r\n const itemData = item.toObject();\r\n\r\n if (!itemData) {\r\n console.error(data);\r\n throw Helpers.custom_error(\"Something went wrong when dropping this item!\")\r\n }\r\n\r\n const source = getSourceActorFromDropData(data);\r\n\r\n return PrivateAPI._dropItem({\r\n source: source,\r\n target: store.actor,\r\n itemData: {\r\n item: itemData, quantity: 1\r\n },\r\n skipCheck: true\r\n });\r\n\r\n }\r\n\r\n function preventDefaultGM(event) {\r\n if (game.user.isGM) return;\r\n event.preventDefault();\r\n }\r\n\r\n function preventDefault(event) {\r\n event.preventDefault();\r\n }\r\n\r\n let itemListElement;\r\n let scrolled = false;\r\n\r\n function evaluateShadow() {\r\n scrolled = itemListElement.scrollTop > 20;\r\n }\r\n\r\n onDestroy(() => {\r\n store.onDestroy();\r\n });\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<main in:fade={{duration: 500}}>\r\n\r\n\t\t<div class=\"item-piles-item-drop-container\" on:dragover={preventDefault} on:dragstart={preventDefaultGM}\r\n\t\t\t\t on:drop={dropData}>\r\n\r\n\t\t\t{#if $deleted}\r\n\t\t\t\t<p style=\"text-align: center; flex: 0 1 auto;\">\r\n\t\t\t\t\t{localize(\"ITEM-PILES.Inspect.Destroyed\")}\r\n\t\t\t\t</p>\r\n\t\t\t{:else}\r\n\r\n\t\t\t\t<ActorPicker {store}/>\r\n\r\n\t\t\t\t{#if showSearchBar}\r\n\t\t\t\t\t<div class=\"form-group item-piles-flexrow item-piles-top-divider item-piles-bottom-divider\"\r\n\t\t\t\t\t\t\t style=\"margin-bottom: 0.5rem; align-items: center;\" transition:fade={{duration: 250}}>\r\n\t\t\t\t\t\t<label style=\"flex:0 1 auto; margin-right: 5px;\">Search:</label>\r\n\t\t\t\t\t\t<input type=\"text\" bind:value={$searchStore}>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t\t{#if isPileEmpty}\r\n\t\t\t\t\t<p class=\"item-piles-top-divider\" style=\"text-align: center; flex: 0 1 auto;\">\r\n\t\t\t\t\t\t{localize(\"ITEM-PILES.Inspect.Empty\")}\r\n\t\t\t\t\t</p>\r\n\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t\t<div class=\"item-piles-items-list\" bind:this={itemListElement} on:scroll={evaluateShadow}>\r\n\r\n\t\t\t\t\t{#if scrolled}\r\n\t\t\t\t\t\t<div class=\"item-pile-shadow scroll-shadow-top\" transition:fade={{duration:300}}></div>\r\n\t\t\t\t\t\t<div></div>\r\n\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t{#if $pileData.displayItemTypes}\r\n\t\t\t\t\t\t<CategorizedItemList {store}/>\r\n\t\t\t\t\t{:else}\r\n\t\t\t\t\t\t<ItemList {store}/>\r\n\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t{#if hasItems}\r\n\t\t\t\t\t\t<hr>\r\n\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t<CurrencyList {store}/>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t{/if}\r\n\r\n\t\t\t<footer class=\"sheet-footer item-piles-flexrow item-piles-top-divider\">\r\n\t\t\t\t{#if editQuantities}\r\n\t\t\t\t\t<button type=\"button\" on:click={() => { store.update() }}>\r\n\t\t\t\t\t\t<i class=\"fas fa-save\"></i> {localize(\"ITEM-PILES.Applications.ItemPileConfig.Update\")}\r\n\t\t\t\t\t</button>\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t\t{#if $pileData.splitAllEnabled}\r\n\t\t\t\t\t<button type=\"button\" on:click={() => { store.splitAll() }} disabled=\"{isPileEmpty || !canBeSplit}\">\r\n\t\t\t\t\t\t<i class=\"fas fa-handshake\"></i>\r\n\t\t\t\t\t\t{#if $pileData.shareItemsEnabled}\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Inspect.SplitAll\", { num_players })}\r\n\t\t\t\t\t\t{:else}\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Inspect.SplitCurrencies\", { num_players })}\r\n\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t</button>\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t\t{#if store.recipient && $pileData.takeAllEnabled}\r\n\t\t\t\t\t<button type=\"submit\" on:click={() => { store.takeAll() }} disabled=\"{isPileEmpty}\">\r\n\t\t\t\t\t\t<i class=\"fas fa-fist-raised\"></i> {localize(\"ITEM-PILES.Inspect.TakeAll\")}\r\n\t\t\t\t\t</button>\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t\t{#if isContainer && !application.options.remote}\r\n\t\t\t\t\t<button type=\"submit\" on:click={() => { store.closeContainer(); application.close(); }}>\r\n\t\t\t\t\t\t<i class=\"fas fa-box\"></i> {localize(\"ITEM-PILES.Inspect.Close\")}\r\n\t\t\t\t\t</button>\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t\t<button on:click={() => { application.close() }} type=\"submit\">\r\n\t\t\t\t\t<i class=\"fas fa-sign-out-alt\"></i> {localize(\"ITEM-PILES.Inspect.Leave\")}\r\n\t\t\t\t</button>\r\n\t\t\t</footer>\r\n\r\n\t\t</div>\r\n\r\n\t</main>\r\n\r\n</ApplicationShell>\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-piles-items-list {\r\n max-height: 500px;\r\n overflow-y: scroll;\r\n display: block;\r\n padding-right: 5px;\r\n\r\n .item-pile-shadow {\r\n\r\n position: absolute;\r\n width: calc(100% - 1rem);\r\n height: 50px;\r\n z-index: 25;\r\n pointer-events: none;\r\n border-radius: 5px;\r\n\r\n &.scroll-shadow-top {\r\n box-shadow: inset 0px 22px 15px -14px rgba(0, 0, 0, 0.5);\r\n }\r\n\r\n }\r\n\r\n .item-piles-add-currency {\r\n margin-right: 5px;\r\n flex: 0 1 auto;\r\n vertical-align: middle;\r\n }\r\n\r\n }\r\n\r\n #item-piles-preview-container {\r\n\r\n position: absolute;\r\n display: inline-block;\r\n\r\n #item-piles-preview-image {\r\n border: 0;\r\n width: 300px;\r\n border-radius: 1rem;\r\n box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;\r\n }\r\n }\r\n\r\n .hidden {\r\n display: none;\r\n }\r\n\r\n .item-piles-img-container {\r\n min-height: 25px;\r\n max-width: 25px;\r\n max-height: 25px;\r\n margin: 2px;\r\n }\r\n</style>\r\n","<script>\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n\r\n export let activeTab;\r\n export let tabs;\r\n export let underscore = false;\r\n export let separateElements = false;\r\n\r\n</script>\r\n\r\n<nav class=\"tabs\" data-group=\"primary\" style={$$props.style}>\r\n\t{#each tabs.filter(tab => !tab.hidden) as tab, index (tab.value)}\r\n\t\t{#if separateElements && index > 0}\r\n\t\t\t<div style=\"border-right: 1px solid rgba(0,0,0,0.5); margin: 0 10px;\"></div>\r\n\t\t{/if}\r\n\t\t<div on:click={() => { activeTab = tab.value}}\r\n\t\t\t\t class=\"item item-piles-flexrow item-piles-clickable-link\"\r\n\t\t\t\t class:underscore={underscore}\r\n\t\t\t\t class:active={activeTab === tab.value}\r\n\t\t\t\t data-tab=\"rest\">\r\n\t\t\t{#if tab.icon} <i class=\"icon {tab.icon}\"></i> {/if}\r\n\t\t\t{localize(tab.label)}\r\n\t\t\t{#if tab.highlight}\r\n\t\t\t\t<div class=\"blob\"><i class=\"fas fa-exclamation\"></i></div>\r\n\t\t\t{/if}\r\n\t\t</div>\r\n\t{/each}\r\n</nav>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .tabs {\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.25);\r\n margin-bottom: 0.5rem;\r\n padding-bottom: 0.5rem;\r\n }\r\n\r\n .item {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n border-bottom: 2px solid transparent;\r\n\r\n &.active {\r\n text-shadow: 0 0 10px var(--item-piles-shadow-primary);\r\n\r\n &.underscore {\r\n text-shadow: none;\r\n border-bottom: 2px solid rgba(125, 0, 0, 0.5);\r\n }\r\n }\r\n }\r\n\r\n .icon {\r\n margin-right: 0.25rem;\r\n }\r\n\r\n</style>\r\n","/**\n * Provides a helper class to determine the version of the Foundry platform starting a version `9`.\n *\n * Note: You must use any of these utility methods after the Foundry `init` hook.\n */\nclass FVTTVersion\n{\n static #regexMajorVersion = /(\\d+)\\./;\n\n /**\n * Returns true when Foundry is at least the specific major version number provided.\n *\n * @param {number} version - Major version to check against.\n *\n * @returns {boolean} Foundry version is at least the major version specified.\n */\n static isAtLeast(version)\n {\n if (!Number.isInteger(version) && version < 9)\n {\n throw new TypeError(`'version' is not a positive integer greater than '9'.`);\n }\n\n return !globalThis.foundry.utils.isNewerVersion(version, globalThis.game.version ??\n globalThis.game?.data?.version);\n }\n\n /**\n * Returns true when Foundry is between the min / max major version numbers provided.\n *\n * @param {number} min - Major minimum version to check against.\n *\n * @param {number} max - Major maximum version to check against.\n *\n * @returns {boolean} Foundry version is at least the major version specified.\n */\n static isBetween(min, max)\n {\n if (!Number.isInteger(min) && min < 9)\n {\n throw new TypeError(`FVTTVersion.isBetween error: 'min' is not a positive integer greater than '9'.`);\n }\n\n if (!Number.isInteger(max) && max < 9)\n {\n throw new TypeError(`FVTTVersion.isBetween error: 'max' is not a positive integer greater than '9'.`);\n }\n\n if (min > max)\n {\n throw new TypeError(`FVTTVersion.isBetween error: 'min' is greater than 'max'.`);\n }\n\n const match = this.#regexMajorVersion.exec(globalThis.game.version ?? globalThis.game?.data?.version);\n if (!match)\n {\n throw new Error(`FVTTVersion.isBetween error: Could not parse 'globalThis.game.version'.`);\n }\n\n const version = parseInt(match[1], 10);\n\n return version >= min && version <= max;\n }\n}\n\n/**\n * Loads FVTT core fonts supporting `FontConfig` on Foundry v10+.\n *\n * Note: This class contains code modified from Foundry VTT core client code. There are only so many ways to process\n * core Foundry data structures correctly.\n */\nclass FontManager\n{\n /**\n * Collect all the font definitions and combine them.\n *\n * @returns {Object<FontFamilyDefinition>[]} Core font definitions.\n */\n static getCoreDefinitions()\n {\n const fonts = [];\n\n if (FVTTVersion.isAtLeast(10))\n {\n let legacyFamilies;\n\n /**\n * @deprecated since v10, so check that it exists.\n */\n if (Array.isArray(globalThis.CONFIG?._fontFamilies))\n {\n legacyFamilies = globalThis.CONFIG._fontFamilies.reduce((obj, f) =>\n {\n obj[f] = { editor: true, fonts: [] };\n return obj;\n }, {});\n }\n\n if (Array.isArray(globalThis.CONFIG?.fontDefinitions))\n {\n fonts.push(globalThis.foundry.utils.duplicate(globalThis.CONFIG.fontDefinitions));\n }\n\n const coreFonts = globalThis.game?.settings.get('core', 'fonts');\n if (Array.isArray(coreFonts))\n {\n fonts.push(globalThis.foundry.utils.duplicate(coreFonts));\n }\n\n if (legacyFamilies) { fonts.push(legacyFamilies); }\n }\n else\n {\n if (Array.isArray(globalThis.CONFIG?.fontFamilies))\n {\n // Handle v9 and below legacy font families.\n const legacyFamilies = globalThis.CONFIG.fontFamilies.reduce((obj, f) =>\n {\n obj[f] = { editor: true, fonts: [] };\n return obj;\n }, {});\n\n fonts.push(legacyFamilies);\n }\n }\n\n FontManager.removeDuplicateDefinitions(fonts);\n\n return fonts;\n }\n\n /**\n * Load a font definition.\n *\n * @param {string} fontSpecification - The font specification.\n *\n * @param {string} family - The font family name (case-sensitive).\n *\n * @param {FontFamilyDefinition} definition - The font family definition.\n *\n * @param {Document} document - Target Document to load font into.\n *\n * @returns {Promise<boolean>} Returns true if the font was successfully loaded.\n */\n static async #loadFont(fontSpecification, family, definition, document)\n {\n try\n {\n for (const fontEntry of definition.fonts)\n {\n // Collect URLs from FontDefinition.\n const urls = fontEntry.urls.map((url) => `url(\"${url}\")`).join(', ');\n\n // Note: 'font' contains 'FontFaceDescriptors' data.\n const fontFace = new FontFace(family, urls, fontEntry);\n await fontFace.load();\n\n document.fonts.add(fontFace);\n }\n\n await document.fonts.load(fontSpecification);\n }\n catch (err)\n {\n console.warn(`Font family \"${family}\" failed to load: `, err);\n return false;\n }\n\n if (!document.fonts.check(fontSpecification))\n {\n console.warn(`Font family \"${family}\" failed to load.`);\n return false;\n }\n\n return true;\n }\n\n /**\n * Ensure that fonts have loaded and are ready for use.\n * Enforce a maximum timeout in milliseconds.\n * Proceed after that point even if fonts are not yet available.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.ms=4500] - The maximum time to spend loading fonts before proceeding.\n *\n * @param {Document} [opts.document] - The target document to load the fonts into.\n *\n * @param {boolean} [opts.editor=true] - When true verifies the `editor` field of {@link FontFamilyDefinition}.\n *\n * @param {Object<FontFamilyDefinition>[]|Object<FontFamilyDefinition>} [opts.fonts] - A custom set of font family\n * definitions to load. If not defined the core font family definitions are loaded.\n *\n * @returns {Promise<void>}\n */\n static async loadFonts({ ms = 4500, document = globalThis.document, editor = true, fonts } = {})\n {\n // TODO sanity checks\n\n const allFonts = fonts ? Array.isArray(fonts) ? fonts : [fonts] : this.getCoreDefinitions();\n\n const promises = [];\n\n for (const definitions of allFonts)\n {\n if (typeof definitions === 'object')\n {\n for (const [family, definition] of Object.entries(definitions))\n {\n // Don't load a font that is not marked to be used in the editor.\n if (editor && (typeof definition.editor !== 'boolean' || !definition.editor)) { continue; }\n\n const fontSpecification = `1rem \"${family}\"`;\n\n // Early out if the font is already loaded.\n if (document.fonts.check(fontSpecification)) { continue; }\n\n promises.push(this.#loadFont(fontSpecification, family, definition, document));\n }\n }\n }\n\n const timeout = new Promise((resolve) => setTimeout(resolve, ms));\n const ready = Promise.all(promises).then(() => document.fonts.ready);\n\n return Promise.race([ready, timeout]);\n }\n\n /**\n * Removes duplicate font definitions.\n *\n * @param {Object<FontFamilyDefinition>[]} fonts - An array of FontFamilyDefinition objects to process.\n *\n * @returns {Object<FontFamilyDefinition>[]} Filtered font definitions.\n */\n static removeDuplicateDefinitions(fonts)\n {\n if (!Array.isArray(fonts))\n {\n throw new TypeError(`FontManager.removeDuplicateDefinitions error: 'fonts' is not an array.`);\n }\n\n const familySet = new Set();\n\n for (const definitions of fonts)\n {\n if (typeof definitions !== 'object' || definitions === null)\n {\n throw new TypeError(`FontManager.removeDuplicateDefinitions error: 'definitions' is not an object.`);\n }\n\n for (const family of Object.keys(definitions))\n {\n // Remove duplicate from current definitions set.\n if (familySet.has(family))\n {\n delete definitions[family];\n }\n else\n {\n familySet.add(family);\n }\n }\n }\n\n return fonts;\n }\n}\n\n/**\n * Parses the core Foundry style sheet creating an indexed object of properties by selector.\n */\nclass FoundryStyles\n{\n static #sheet = void 0;\n\n static #sheetMap = new Map();\n\n static #initialized = false;\n\n /**\n * Called once on initialization / first usage. Parses the core foundry style sheet.\n */\n static #initialize()\n {\n this.#initialized = true;\n\n const styleSheets = Array.from(document.styleSheets).filter((entry) => entry.href !== null);\n\n let sheet;\n\n const foundryStyleSheet = globalThis.foundry.utils.getRoute('/css/style.css');\n\n // Find the core Foundry stylesheet.\n for (const styleSheet of styleSheets)\n {\n let url;\n\n try\n {\n url = new URL(styleSheet.href);\n }\n catch (err) { continue; }\n\n if (typeof url.pathname === 'string' && url.pathname === foundryStyleSheet)\n {\n this.#sheet = sheet = styleSheet;\n break;\n }\n }\n\n // Quit now if the Foundry style sheet was not found.\n if (!sheet) { return; }\n\n // Parse each CSSStyleRule and build the map of selectors to parsed properties.\n for (const rule of sheet.cssRules)\n {\n if (!(rule instanceof CSSStyleRule)) { continue; }\n\n const obj = {};\n\n // Parse `cssText` into an object of properties & values.\n for (const entry of rule.style.cssText.split(';'))\n {\n const parts = entry.split(':');\n\n // Sanity check.\n if (parts.length < 2) { continue; }\n\n obj[parts[0].trim()] = parts[1].trim();\n }\n\n this.#sheetMap.set(rule.selectorText, obj);\n }\n }\n\n /**\n * Gets the properties object associated with the selector. Try and use a direct match otherwise all keys\n * are iterated to find a selector string that includes the `selector`.\n *\n * @param {string} selector - Selector to find.\n *\n * @returns {Object<string, string>} Properties object.\n */\n static getProperties(selector)\n {\n if (!this.#initialized) { this.#initialize(); }\n\n // If there is a direct selector match then return a value immediately.\n if (this.#sheetMap.has(selector))\n {\n return this.#sheetMap.get(selector);\n }\n\n for (const key of this.#sheetMap.keys())\n {\n if (key.includes(selector)) { return this.#sheetMap.get(key); }\n }\n\n return void 0;\n }\n\n /**\n * Gets a specific property value from the given `selector` and `property` key. Try and use a direct selector\n * match otherwise all keys are iterated to find a selector string that includes `selector`.\n *\n * @param {string} selector - Selector to find.\n *\n * @param {string} property - Specific property to locate.\n *\n * @returns {string|undefined} Property value.\n */\n static getProperty(selector, property)\n {\n if (!this.#initialized) { this.#initialize(); }\n\n // If there is a direct selector match then return a value immediately.\n if (this.#sheetMap.has(selector))\n {\n const data = this.#sheetMap.get(selector);\n return typeof data === 'object' && property in data ? data[property] : void 0;\n }\n\n for (const key of this.#sheetMap.keys())\n {\n if (key.includes(selector))\n {\n const data = this.#sheetMap.get(key);\n if (typeof data === 'object' && property in data) { return data[property]; }\n }\n }\n\n return void 0;\n }\n}\n\nexport { FVTTVersion, FontManager, FoundryStyles };\n//# sourceMappingURL=index.js.map\n","import { StyleManager } from '@typhonjs-fvtt/runtime/svelte/util';\n\nconst s_STYLE_KEY = '#__tjs-root-styles';\n\nconst cssVariables = new StyleManager({ docKey: s_STYLE_KEY, version: 1 });\n\nexport { cssVariables };\n","/**\n * Provides helper utilities to manipulate the PM editor view for various options from TJSProseMirror component.\n */\nclass PMImpl\n{\n /**\n * Clamps a value between min / max values.\n *\n * @param {number} value - Value to clamp.\n *\n * @param {number} min - Minimum value.\n *\n * @param {number} max - Maximum value.\n *\n * @returns {number} Clamped value.\n * TODO: Move Math utility function to @typhonjs-svelte/lib\n */\n static #clamp(value = 0, min = 0, max = 0)\n {\n return Math.min(Math.max(value, min), max);\n }\n\n /**\n * Handles `options.initialSelection`: Sets the initial cursor / selection range to the start, end, or selects\n * all text.\n *\n * @param {EditorView} view - PM editor view.\n *\n * @param {object} options - TJSProseMirror options.\n */\n static setInitialSelection(view, options)\n {\n const tr = view.state.tr;\n const doc = tr.doc;\n\n const initialSelection = options.initialSelection;\n\n const type = initialSelection === 'all' || initialSelection === 'end' || initialSelection === 'start' ?\n initialSelection : 'start';\n\n const minPos = globalThis.ProseMirror.TextSelection.atStart(doc).from;\n const maxPos = globalThis.ProseMirror.TextSelection.atEnd(doc).to;\n\n let transaction;\n\n switch (type)\n {\n case 'all':\n {\n const resolvedFrom = this.#clamp(0, minPos, maxPos);\n const resolvedEnd = this.#clamp(doc.content.size, minPos, maxPos);\n transaction = tr.setSelection(globalThis.ProseMirror.TextSelection.create(doc, resolvedFrom, resolvedEnd));\n break;\n }\n\n case 'end':\n {\n const resolvedFrom = this.#clamp(doc.content.size, minPos, maxPos);\n const resolvedEnd = this.#clamp(doc.content.size, minPos, maxPos);\n transaction = tr.setSelection(globalThis.ProseMirror.TextSelection.create(doc, resolvedFrom, resolvedEnd));\n break;\n }\n\n case 'start':\n {\n const resolvedFrom = this.#clamp(0, minPos, maxPos);\n const resolvedEnd = this.#clamp(0, minPos, maxPos);\n transaction = tr.setSelection(globalThis.ProseMirror.TextSelection.create(doc, resolvedFrom, resolvedEnd));\n break;\n }\n }\n\n if (transaction)\n {\n transaction.scrollIntoView();\n\n view.dispatch(transaction);\n }\n }\n}\n\n// Protect for absent global `ProseMirror` on Foundry v9.\nconst ProseMirrorKeyMaps = globalThis.ProseMirror ? globalThis.ProseMirror.ProseMirrorKeyMaps : class {};\n\n/**\n * Provides an additional key mapping to `Escape` to destroy / cancel the active editor.\n */\nclass TJSKeyMaps extends ProseMirrorKeyMaps\n{\n #onQuit;\n\n /**\n * @param {Schema} schema - The ProseMirror schema to build keymaps for.\n *\n * @param {object} [options] - Additional options to configure the plugin's behaviour.\n *\n * @param {Function} [options.onSave] - A function to call when Ctrl+S is pressed.\n *\n * @param {Function} [options.onQuit] - A function to call when Ctrl+Q is pressed.\n */\n constructor(schema, options)\n {\n super(schema, options);\n\n if (typeof options.onQuit === 'function') { this.#onQuit = options.onQuit; }\n }\n\n /**\n * Swaps the Foundry default `Escape` / selectParentNode to `Mod-p` and enables `onQuit` function for `Escape`.\n *\n * @returns {Object<ProseMirrorCommand>} ProseMirror keymap data.\n */\n buildMapping()\n {\n const mapping = super.buildMapping();\n\n // Add onQuit callback if defined.\n if (this.#onQuit)\n {\n // Swap Foundry core mapping for `Escape` / selectParentNode to `Mod-p`.\n if (mapping['Escape']) { mapping['Mod-p'] = mapping['Escape']; }\n\n mapping['Escape'] = () => this.#onQuit();\n }\n\n return mapping;\n }\n}\n\n// Protect for absent global `ProseMirror` on Foundry v9.\nconst Plugin = globalThis.ProseMirror ? globalThis.ProseMirror.Plugin : class {};\n\n/**\n * A ProseMirror plugin to transform pasted text that is a raw document UUID into a document link suitable for\n * `TextEditor.enrichHTML`.\n */\nclass TJSPasteUUID\n{\n /**\n * Defines a regex to check for the shape of a raw Foundry document UUID.\n *\n * @type {RegExp}\n */\n static #s_UUID_REGEX = /(\\.).*([a-zA-Z0-9]{16})/;\n\n /**\n * @returns {Plugin<any>} PM Plugin.\n */\n static build()\n {\n const instance = new this();\n return new Plugin({\n // key: new PluginKey('tjsPasteRawUUID'), // TODO: Add back when exported by Foundry / ProseMirror bundle.\n props: {\n transformPastedText: (text) => instance.#transformUUID(text)\n }\n });\n }\n\n /**\n * Transforms pasted text. Check if pasted test matches the shape of a raw UUID. If so do a lookup and if a\n * document is retrieved transform it to a document link.\n *\n * @param {string} text - pasted text to transform.\n *\n * @returns {string} Potentially transformed pasted text.\n */\n #transformUUID(text)\n {\n if (typeof text === 'string')\n {\n if (TJSPasteUUID.#s_UUID_REGEX.test(text))\n {\n const uuidDoc = globalThis.fromUuidSync(text);\n if (uuidDoc)\n {\n text = `@UUID[${text}]{${typeof uuidDoc.name === 'string' ? uuidDoc.name : 'Unknown'}}`;\n }\n }\n }\n\n return text;\n }\n}\n\nconst index = /*#__PURE__*/Object.freeze({\n __proto__: null,\n TJSKeyMaps: TJSKeyMaps,\n TJSPasteUUID: TJSPasteUUID\n});\n\nexport { PMImpl, index as Plugins };\n//# sourceMappingURL=index.js.map\n","<script>\n /**\n * Provides a reactive wrapper for Foundry ProseMirror editor support. Allows editing Foundry document data or\n * directly from content prop. Automatic HTML enrichment occurs for the content when saved.\n *\n * There are no required props, but the following are available to set.\n * `content` - Provides an initial content string; you can bind to `content` from a parent component to get reactive\n * updates when `content` changes. Two-way binding.\n *\n * `enrichedContent` - Provides the enriched content via {@link TextEditor.enrichHTML} when `content` changes.\n * You can bind to `enrichedContent` from a parent component to get reactive updates though it is not\n * recommended to change `enrichedContent` externally. One-way binding.\n *\n * `options` - Defines the options object for this component and passed on to the Foundry TinyMCE support.\n * Please review all the options defined below {@link TJSProseMirrorOptions}.\n *\n *\n * Notable options passed onto Foundry ProseMirror support.\n * ---------------------------------\n *\n * `options.collaborate` - [boolean: false] When a `document` and `fieldName` is provided set this to true to enable\n * collaborative editing.\n *\n * `options.plugins` - [object] An additional set of ProseMirror plugins to load.\n *\n *\n * Events: There are three events fired when the editor is canceled, saved, and started.\n * ---------------------------------\n * `editor:cancel` - Fired when editing is canceled by a user action or reactive response to document changes.\n *\n * `editor:document:deleted` - Fired when the edited document is deleted. Access the document from\n * `event.detail.document`.\n *\n * `editor:enrichedContent` - Fired when content is enriched. Access enriched content from\n * `event.detail.enrichedContent`.\n *\n * `editor:save` - Fired when editing is saved. Access the content from `event.detail.content`.\n *\n * `editor:start` - Fired when editing is started.\n *\n * The following CSS variables control the associated styles with the default values.\n *\n * `.editor` HTMLDivElement:\n * ---------------------------------\n * --tjs-editor-background - none\n * --tjs-editor-border - none\n * --tjs-editor-border-radius - 0\n * --tjs-editor-height - 100%\n * --tjs-editor-margin - 0\n * --tjs-editor-overflow - auto\n * --tjs-editor-transition\n * --tjs-editor-width - 100%\n *\n * `.editor` HTMLDivElement; properties available when activated:\n * ---------------------------------\n * --tjs-editor-active-box-shadow, unset; Foundry default: 0 0 5px var(--color-shadow-primary)\n * --tjs-editor-active-outline - unset\n * --tjs-editor-active-overflow - unset; When inactive the editor overflow is auto; when active overflow is unset.\n *\n * `.editor` HTMLDivElement; properties available when inactive, but manually focused:\n * ---------------------------------\n * --tjs-editor-inactive-box-shadow-focus-visible - fallback: --tjs-default-box-shadow-focus-visible\n * --tjs-editor-inactive-outline-focus-visible - fallback: --tjs-default-outline-focus-visible; default: revert\n * --tjs-editor-inactive-transition-focus-visible - fallback: --tjs-default-transition-focus-visible\n *\n * `.editor` HTMLDivElement; properties available when inactive, but hovered:\n * ---------------------------------\n * --tjs-editor-inactive-cursor-hover - text\n * --tjs-editor-inactive-box-shadow-hover - unset\n * --tjs-editor-inactive-outline-hover - unset\n * --tjs-editor-inactive-user-select-hover - text\n *\n * `.editor-content` HTMLDivElement; when editing - the content overflow is set to auto:\n * ---------------------------------\n * --tjs-editor-content-overflow - auto\n * --tjs-editor-content-padding - 0 0 0 0.25em\n *\n * `.editor-container` HTMLDivElement; when editing - removes default margins.\n * ---------------------------------\n * --tjs-editor-container-margin - 0\n *\n * .editor-edit; Defines the position of the edit button from top / right absolute positioning:\n * ---------------------------------\n * --tjs-editor-edit-button-right - 5px\n * --tjs-editor-edit-button-top - 0\n *\n * .editor-menu; Defines the toolbar / menu.\n * ---------------------------------\n * --tjs-editor-toolbar-background - rgba(0, 0, 0, 0.1)\n * --tjs-editor-toolbar-border-radius - 6px\n * --tjs-editor-toolbar-box-shadow - 0 2px 2px -2px rgb(34 47 62 / 10%), 0 8px 8px -4px rgb(34 47 62 / 7%)\n * --tjs-editor-toolbar-padding - 2px 0\n * --tjs-editor-toolbar-width - 100%\n */\n\n /**\n * @typedef {object} TJSProseMirrorOptions\n *\n * @property {boolean} [button=true] - Provides an edit button to start editing. When button is false editing is\n * always enabled.\n *\n * @property {string[]} [classes] - An array of strings to add to the `.editor` element classes. This allows easier\n * setting of CSS variables across a range of various editor components.\n *\n * @property {boolean} [clickToEdit=false] - When true the edit button is not shown and a click on the editor\n * content initializes the editor.\n *\n * @property {boolean} [collaborate=false] - Enables ProseMirror collaboration; requires a document to be set.\n *\n * @property {foundry.abstract.Document} [document] - Set to a Foundry document to load and save content from it.\n * Requires `fieldName` to be set.\n *\n * @property {{ sanitizeWithVideo: function }} [DOMPurify] - The DOMPurify export from\n * `@typhonjs-fvtt/runtime/dompurify`. Sanitizes content client side. Note: TinyMCE already does essential\n * `<script>` sanitization, so this is just an extra option that is available as an extra precaution.\n *\n * @property {boolean} [editable=true] - Prevents editing and hides button. When set to false any active editor\n * is cancelled.\n *\n * @property {boolean} [enrichContent=true] - When set to false content won't be enriched by\n * `TextEditor.enrichHTML`.\n *\n * @property {string} [fieldName] - A field name to load and save to / from associated document. IE `a.b.c`.\n *\n * @property {'all'|'end'|'start'} [initialSelection='start'] - Initial selection range; 'all', 'end' or 'start'.\n *\n * @property {string} [keyCode='Enter'] - Defines the key event code to activate the editor when focused.\n *\n * @property {Object<string, string>} [styles] - Additional CSS property names and values to set as inline styles.\n * This is useful for dynamically overriding any built in styles and in particular setting CSS variables\n * supported.\n */\n\n /**\n * The following options that both {@link TJSTinyMCE} and {@link TJSContentEdit} support likely won't be implemented\n * for the ProseMirror component as they involve significant effort in modifying ProseMirror which is not trivial at\n * all without potentially weeks of work or entirely replacing the built-in Foundry ProseMirror toolbar / support.\n *\n * // @property {Object<FontFamilyDefinition>} [fonts] - An additional object defining module / custom fonts to\n * // load specific to this editor.\n *\n * // @property {number} [maxCharacterLength] - When defined as an integer greater than 0 this limits the max\n * // characters that can be entered.\n *\n * // @property {boolean} [preventEnterKey=false] - When true this prevents enter key from creating a new line /\n * // paragraph.\n *\n * // @property {boolean} [preventPaste=false] - Prevents pasting content into the editor.\n *\n * // @property {boolean} [saveOnBlur=false] - When true any loss of focus / blur from the editor saves the editor\n * // state.\n *\n * // @property {boolean} [saveOnEnterKey=false] - When true saves the editor state when the enter key is pressed.\n * // This is useful when configuring the editor for single line entry.\n */\n\n /**\n * @typedef {object} PMEditorExtra - Defines extra data passed to TJSEditorOptions ProseMirror plugin.\n *\n * @property {string} initialSelectionDefault - The default value if `options.initialSelection is not defined.\n */\n\n import {\n createEventDispatcher,\n onDestroy,\n onMount,\n tick\n } from 'svelte';\n\n import { applyStyles } from '@typhonjs-fvtt/runtime/svelte/action';\n\n import { TJSDocument } from '@typhonjs-fvtt/runtime/svelte/store';\n\n import {\n Plugins,\n PMImpl } from '@typhonjs-fvtt/svelte-standard/prosemirror';\n\n /** @type {string} */\n export let content = '';\n\n /** @type {string} */\n export let enrichedContent = '';\n\n /**\n * Provides the options object that can be reactively updated. See documentation above.\n *\n * @type {TJSProseMirrorOptions}\n */\n export let options = {};\n\n const dispatch = createEventDispatcher();\n\n // Provides reactive updates for any associated Foundry document.\n const doc = new TJSDocument({ delete: onDocumentDeleted });\n\n /** @type {boolean} */\n let clickToEdit;\n\n /** @type {boolean} */\n let editable = true;\n\n /** @type {HTMLDivElement} */\n let editorContentEl;\n\n /** @type {ProseMirrorEditor} */\n let editor;\n\n /** @type {boolean} */\n let editorActive = false;\n\n /** @type {boolean} */\n let editorButton;\n\n /** @type {HTMLDivElement} */\n let editorEl;\n\n /** @type {string} */\n let keyCode;\n\n /** @type {boolean} */\n let keyFocused = false;\n\n /**\n * Respond to changes in `options.editable`.\n */\n $:\n {\n editable = typeof options.editable === 'boolean' ? options.editable : true;\n if (!editable) { destroyEditor(); }\n }\n\n /**\n * When `options.editable` & `options.clickToEdit` is true and the editor is not active enable clickToEdit.\n */\n $: clickToEdit = !editorActive && editable &&\n (typeof options.clickToEdit === 'boolean' ? options.clickToEdit : false);\n\n /**\n * When `options.button` & `options.editable` is true and the editor is not active and `clickToEdit` is false\n * enable the edit button.\n */\n $: editorButton = !editorActive && editable && (typeof options.button === 'boolean' ? options.button : true) &&\n !clickToEdit;\n\n /**\n * Allows another KeyboardEvent.code to be used to activate the editor.\n */\n $: keyCode = typeof options.keyCode === 'string' ? options.keyCode : 'Enter';\n\n /**\n * Respond to changes in `options.document`\n */\n $: if (options.document !== void 0)\n {\n if (!(options.document instanceof globalThis.foundry.abstract.Document))\n {\n throw new TypeError(`TJSProseMirror error: 'options.document' is not a Foundry document.`);\n }\n\n if (typeof options.fieldName !== 'string')\n {\n throw new TypeError(\n `TJSProseMirror error: 'options.document' is defined, but 'options.fieldName' is not a string.`);\n }\n\n // Remove any existing editor if document changes.\n if (options.document !== $doc)\n {\n enrichedContent = '';\n content = '';\n destroyEditor();\n }\n\n doc.set(options.document);\n }\n else\n {\n // Remove any existing editor if there was a document set, but now it is removed.\n if ($doc)\n {\n enrichedContent = '';\n content = '';\n\n destroyEditor();\n\n doc.set(void 0);\n }\n }\n\n // If there is a valid document then retrieve content from `fieldName` otherwise use `content` string.\n $:\n {\n content = $doc !== void 0 ? globalThis.foundry.utils.getProperty($doc, options.fieldName) :\n typeof content === 'string' ? content : '';\n\n // Avoid double trigger of reactive statement as enriching content is async.\n onContentChanged(content, typeof options.enrichContent === 'boolean' ? options.enrichContent : true);\n }\n\n onDestroy(() =>\n {\n // Handle the case when the component is destroyed / IE application closed, but the editor isn't saved.\n if (editorActive)\n {\n saveEditor({ remove: typeof options.button === 'boolean' ? options.button : true });\n }\n else\n {\n destroyEditor();\n }\n });\n\n /**\n * If `options.editable` is true and `options.button` && `options.clickToEdit` is false then start the editor on\n * mount.\n */\n onMount(() => { if (editable && !editorButton && !clickToEdit) { initEditor(); } });\n\n /**\n * Destroys any active editor.\n */\n function destroyEditor(fireCancel = true)\n {\n if (editor)\n {\n editor.destroy();\n editor = void 0;\n\n // Post on next micro-task to allow any event propagation for `Escape` key to trigger first.\n setTimeout(() => { editorActive = false; }, 0);\n\n // If the editor was initialized by keyboard action then focus it after a short delay to allow the template\n // to update.\n if (keyFocused)\n {\n keyFocused = false;\n\n setTimeout(() =>\n {\n if (editorEl instanceof HTMLElement && editorEl?.isConnected) { editorEl.focus(); }\n }, 100);\n }\n\n if (fireCancel) { dispatch('editor:cancel'); }\n }\n }\n\n /**\n * Initializes editor.\n *\n * @returns {Promise<void>}\n */\n async function initEditor()\n {\n // If editor button is enabled then remove the menu / editing interface on save.\n const remove = typeof options.button === 'boolean' ? options.button : true;\n\n const editorOptions = {\n ...options,\n\n plugins: {\n ...ProseMirror.defaultPlugins,\n\n menu: ProseMirror.ProseMirrorMenu.build(ProseMirror.defaultSchema, {\n destroyOnSave: remove,\n onSave: () => saveEditor({ remove })\n }),\n\n keyMaps: Plugins.TJSKeyMaps.build(ProseMirror.defaultSchema, {\n onSave: () => saveEditor({ remove }),\n onQuit: () => destroyEditor()\n }),\n\n tjsPasteRawUUID: Plugins.TJSPasteUUID.build(),\n\n ...(typeof options.plugins === 'object' ? options.plugins : {})\n }\n };\n\n editorActive = true;\n\n // Editor is now active; wait until the template updates w/ new bound `editorContentEl`.\n await tick();\n\n editor = await ProseMirrorEditor.create(editorContentEl, content, editorOptions);\n\n // `.editor-container` div is added automatically; add inline style to set margin to 0.\n const containerEl = editorEl.querySelector('.editor-container');\n if (containerEl) { containerEl.style = 'margin: var(--tjs-editor-container-margin, 0)'; }\n\n editor.view.focus();\n\n PMImpl.setInitialSelection(editor.view, options);\n\n dispatch('editor:start');\n }\n\n /**\n * Potentially handles initializing the editor when it is not active and `options.clickToEdit` is true.\n *\n * @param {MouseEvent} event -\n */\n function onClick(event)\n {\n if (!editorActive && clickToEdit) { initEditor(); }\n }\n\n /**\n * Separated into a standalone method so applying async value to enriched content doesn't double trigger a reactive\n * statement twice.\n *\n * @param {string} content - Content prop.\n *\n * @param {boolean} enrichContent - `options.enrichContent` or default of `true.\n *\n * @returns {Promise<void>}\n */\n async function onContentChanged(content, enrichContent)\n {\n if (typeof content === 'string')\n {\n if (enrichContent)\n {\n enrichedContent = await TextEditor.enrichHTML(content, { async: true, secrets: globalThis.game.user.isGM });\n }\n else\n {\n enrichedContent = content;\n }\n }\n else\n {\n enrichedContent = '';\n }\n\n dispatch('editor:enrichedContent', { enrichedContent });\n }\n\n /**\n * Handles cleaning up the editor state after any associated document has been deleted.\n *\n * @param {foundry.abstract.Document} document - The deleted document.\n */\n function onDocumentDeleted(document)\n {\n options.document = void 0;\n\n destroyEditor();\n\n dispatch('editor:document:deleted', { document });\n\n content = '';\n enrichedContent = '';\n }\n\n /**\n * Prevents `Escape` key or `Ctrl-s` from propagating when the editor is active preventing the app from being closed.\n * The `Escape` key is used to close the active editor first. Foundry by default when `Ctrl-s` is pressed as of v10\n * scrolls the canvas down which is undesired when saving an editor as well.\n *\n * @param {KeyboardEvent} event - A keyboard event from `.editor`.\n */\n function onKeydown(event)\n {\n if (editorActive)\n {\n if (event.code === 'Escape' || (event.code === 'KeyS' && (event.ctrlKey || event.metaKey)))\n {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n else\n {\n if (event.code === keyCode)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n\n /**\n * Handle activating the editor if key codes match.\n *\n * @param {KeyboardEvent} event - A KeyboardEvent.\n */\n function onKeyup(event)\n {\n if (event.code === keyCode)\n {\n if (!editorActive)\n {\n keyFocused = true;\n initEditor();\n }\n\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Saves the editor contents to the associated document or updates content directly.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.remove=true] - Removes the editor.\n */\n function saveEditor({ remove = true } = {})\n {\n if (editor)\n {\n if (editor.isDirty())\n {\n let data = ProseMirror.dom.serializeString(editor.view.state.doc);\n\n // Perform client side sanitization if DOMPurify is available in options.\n // ProseMirror does essential `<script>` based sanitization, so this is just an extra option to provide\n // specific sanitization.\n if (options?.DOMPurify && typeof options?.DOMPurify?.sanitizeWithVideo === 'function')\n {\n data = options.DOMPurify.sanitizeWithVideo(data);\n }\n\n // Save to document if available\n if ($doc && options.fieldName)\n {\n $doc.update({ [options.fieldName]: data })\n }\n else // Otherwise save to content.\n {\n content = data;\n }\n\n dispatch('editor:save', { content: data });\n }\n\n // Remove the editor\n if (remove) { destroyEditor(false); }\n }\n }\n</script>\n\n<div bind:this={editorEl}\n class=\"editor prosemirror tjs-editor {Array.isArray(options.classes) ? options.classes.join(' ') : ''}\"\n class:click-to-edit={clickToEdit}\n class:editor-active={editorActive}\n use:applyStyles={options.styles}\n on:click={onClick}\n on:keydown={onKeydown}\n on:keyup={onKeyup}\n role=textbox\n tabindex=0>\n {#if editorButton}\n <!-- svelte-ignore a11y-missing-attribute a11y-click-events-have-key-events -->\n <a class=editor-edit on:click={() => initEditor()} role=button><i class=\"fas fa-edit\"></i></a>\n {/if}\n {#if editorActive}\n <div bind:this={editorContentEl} class=editor-content />\n {:else}\n <div class=editor-enriched>\n {@html enrichedContent}\n </div>\n {/if}\n</div>\n\n<style>\n .editor {\n background: var(--tjs-editor-background, none);\n border: var(--tjs-editor-border, none);\n border-radius: var(--tjs-editor-border-radius, 0);\n height: var(--tjs-editor-height, 100%);\n margin: var(--tjs-editor-margin, 0);\n outline-offset: var(--tjs-editor-outline-offset, 0.25em);\n overflow: var(--tjs-editor-overflow, auto);\n transition: var(--tjs-editor-transition);\n width: var(--tjs-editor-width, 100%);\n\n /* For Firefox. */\n scrollbar-width: thin;\n }\n\n /**\n * This class is added to editor when `editorActive` is true and unsets overflow allowing content to be scrollable\n * keeping the menu bar always visible at the top of the component.\n */\n .editor-active {\n box-shadow: var(--tjs-editor-active-box-shadow);\n outline: var(--tjs-editor-active-outline);\n overflow: var(--tjs-editor-active-overflow, unset);\n }\n\n /**\n * Defines cursor and box-shadow / outline when the editor is inactive and hovered.\n */\n .tjs-editor:not(.editor-active):focus-visible {\n box-shadow: var(--tjs-editor-inactive-box-shadow-focus-visible, var(--tjs-default-box-shadow-focus-visible));\n outline: var(--tjs-editor-inactive-outline-focus-visible, var(--tjs-default-outline-focus-visible, revert));\n transition: var(--tjs-editor-inactive-transition-focus-visible, var(--tjs-default-transition-focus-visible));\n }\n\n /**\n * Defines cursor and box-shadow / outline when the editor is inactive and hovered, but not manually focused.\n */\n .tjs-editor:not(.editor-active):not(:focus-visible):hover {\n box-shadow: var(--tjs-editor-inactive-box-shadow-hover);\n outline: var(--tjs-editor-inactive-outline-hover);\n }\n\n /**\n * Defines user-select when the editor is inactive and hovered.\n */\n .tjs-editor:not(.editor-active):hover {\n user-select: var(--tjs-editor-inactive-user-select-hover, text);\n }\n\n /**\n * Defines cursor when the editor is not active, but configured for click to edit. Give the user some indication\n * via showing the text cursor across the whole editor element.\n */\n .tjs-editor.click-to-edit:not(.editor-active):hover {\n cursor: var(--tjs-editor-inactive-cursor-hover, text);\n }\n\n .editor-content {\n overflow: var(--tjs-editor-content-overflow, auto);\n padding: var(--tjs-editor-content-padding, 0 0 0 0.25em);\n\n /* For Firefox. */\n scrollbar-width: thin;\n }\n\n .editor-edit {\n right: var(--tjs-editor-edit-button-right, 5px);\n top: var(--tjs-editor-edit-button-top, 0);\n }\n\n .editor-enriched {\n padding: var(--tjs-editor-content-padding, 0 0 0 0.25em);\n }\n\n /* Controls whether the editor content text is selectable when the editor is inactive. */\n .tjs-editor:not(.editor-active) .editor-enriched {\n user-select: var(--tjs-editor-inactive-user-select-hover, text);\n }\n\n /* Don't add an initial margin top to first paragraph element in `.editor-content`. */\n .tjs-editor .editor-container .editor-content :global(p:first-of-type) {\n margin-top: 0;\n }\n\n .tjs-editor .editor-enriched :global(p:first-of-type) {\n margin-top: 0;\n }\n\n /* Provides global styles scoped to `.tjs-editor` for dynamic `.editor-menu` element */\n .tjs-editor :global(.editor-menu) {\n background: var(--tjs-editor-toolbar-background, rgba(0, 0, 0, 0.1));\n border-radius: var(--tjs-editor-toolbar-border-radius, 6px);\n box-shadow: var(--tjs-editor-toolbar-box-shadow, 0 2px 2px -2px rgb(34 47 62 / 10%), 0 8px 8px -4px rgb(34 47 62 / 7%));\n margin-bottom: 0.25em;\n padding: var(--tjs-editor-toolbar-padding, 2px 0);\n width: var(--tjs-editor-toolbar-width, 100%);\n\n transition: box-shadow 500ms ease-in-out;\n }\n\n /* Removes the awkward 1rem padding from core */\n .tjs-editor.prosemirror.editing-source :global(textarea) {\n padding: 0;\n }\n</style>\n","<script>\n /**\n * --tjs-toggle-label-background\n * --tjs-toggle-label-background-focus-visible\n * --tjs-toggle-label-background-hover\n * --tjs-toggle-label-background-selected\n * --tjs-toggle-label-border\n * --tjs-toggle-label-border-radius\n * --tjs-toggle-label-box-shadow-focus-visible - fallback: --tjs-default-box-shadow-focus-visible\n * --tjs-toggle-label-font-size - inherit\n * --tjs-toggle-label-font-weight - inherit\n * --tjs-toggle-label-font-family - inherit\n * --tjs-toggle-label-overflow - hidden\n * --tjs-toggle-label-padding - 0\n * --tjs-toggle-label-text-shadow-focus - undefined; default: --tjs-default-text-shadow-focus-hover\n * --tjs-toggle-label-text-shadow-hover - undefined; default: --tjs-default-text-shadow-focus-hover\n * --tjs-toggle-label-text-shadow-selected - undefined; default: --tjs-default-text-shadow-focus-hover\n * --tjs-toggle-label-transition - global default: 'background 0.2s ease-in-out'\n * --tjs-toggle-label-transition-focus-visible - fallback: --tjs-default-transition-focus-visible\n */\n import { createEventDispatcher } from 'svelte';\n\n import { applyStyles } from '@typhonjs-fvtt/runtime/svelte/action';\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n import { isWritableStore } from '@typhonjs-fvtt/runtime/svelte/store';\n import {\n isObject,\n isSvelteComponent } from '@typhonjs-fvtt/runtime/svelte/util';\n\n export let label = void 0;\n export let text = void 0;\n export let comp = void 0;\n export let title = void 0;\n export let titleSelected = void 0;\n export let store = void 0;\n export let styles = void 0;\n export let efx = void 0;\n export let keyCode = void 0;\n export let onPress = void 0;\n export let onClose = void 0;\n export let onContextMenu = void 0;\n export let onClickPropagate = void 0;\n\n const dispatch = createEventDispatcher();\n\n $: text = isObject(label) && typeof label.text === 'string' ? label.text :\n typeof text === 'string' ? text : void 0;\n $: comp = isObject(label) && isSvelteComponent(label.comp) ? label.comp :\n isSvelteComponent(comp) ? comp : void 0;\n $: title = isObject(label) && typeof label.title === 'string' ? label.title :\n typeof title === 'string' ? title : '';\n $: titleSelected = isObject(label) && typeof label.titleSelected === 'string' ? label.titleSelected :\n typeof titleSelected === 'string' ? titleSelected : '';\n $: store = isObject(label) && isWritableStore(label.store) ? label.store : isWritableStore(store) ?\n store : void 0;\n $: styles = isObject(label) && typeof label.styles === 'object' ? label.styles :\n typeof styles === 'object' ? styles : void 0;\n $: efx = isObject(label) && typeof label.efx === 'function' ? label.efx :\n typeof efx === 'function' ? efx : () => {};\n $: keyCode = isObject(label) && typeof label.keyCode === 'string' ? label.keyCode :\n typeof keyCode === 'string' ? keyCode : 'Enter';\n\n $: onPress = isObject(label) && typeof label.onPress === 'function' ? label.onPress :\n typeof onPress === 'function' ? onPress : void 0;\n $: onClose = isObject(label) && typeof label.onClose === 'function' ? label.onClose :\n typeof onClose === 'function' ? onClose : void 0;\n $: onContextMenu = isObject(label) && typeof label.onContextMenu === 'function' ? label.onContextMenu :\n typeof onContextMenu === 'function' ? onContextMenu : void 0;\n\n $: onClickPropagate = isObject(label) && typeof label.onClickPropagate === 'boolean' ? label.onClickPropagate :\n typeof onClickPropagate === 'boolean' ? onClickPropagate : false;\n\n let spanEl;\n let selected = false;\n\n $: if (store) { selected = $store; }\n\n // Chose the current title when `selected` changes; if there is no `titleSelected` fallback to `title`.\n $: titleCurrent = selected && titleSelected !== '' ? titleSelected : title\n\n /**\n * Handle click event.\n *\n * @param {MouseEvent} event -\n */\n function onClick(event)\n {\n selected = !selected;\n if (store) { store.set(selected); }\n\n if (typeof onPress === 'function') { onPress(selected); }\n\n dispatch('press', { selected });\n\n if (!onClickPropagate)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * In this case we can't set pointer-events: none for the div due to the slotted component, so process clicks on the\n * div in respect to onClickPropagate.\n *\n * @param {MouseEvent} event -\n */\n function onClickDiv(event)\n {\n if (!onClickPropagate)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handles `close:popup` event from any children components like TJSMenu.\n */\n function onClosePopup(event)\n {\n selected = false;\n if (store) { store.set(false); }\n\n if (typeof onClose === 'function') { onClose(selected); }\n\n // The close event was triggered from a key press, so focus the anchor element / button.\n if (typeof event?.detail?.keyboardFocus === 'boolean' && event.detail.keyboardFocus && spanEl?.isConnected)\n {\n spanEl.focus();\n\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n /**\n * @param {MouseEvent} event -\n */\n function onContextMenuPress(event)\n {\n if (typeof onContextMenu === 'function') { onContextMenu(); }\n\n if (!onClickPropagate)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Consume / stop propagation of key down when key codes match.\n *\n * @param {KeyboardEvent} event -\n */\n function onKeydown(event)\n {\n if (event.code === keyCode)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * Handle press event if key codes match.\n *\n * @param {KeyboardEvent} event -\n */\n function onKeyup(event)\n {\n if (event.code === keyCode)\n {\n selected = !selected;\n if (store) { store.set(selected); }\n\n if (typeof onPress === 'function') { onPress(selected); }\n\n dispatch('press', { selected });\n\n event.preventDefault();\n event.stopPropagation();\n }\n }\n</script>\n\n<!-- svelte-ignore a11y-click-events-have-key-events -->\n<div class=tjs-toggle-label\n on:click={onClickDiv}\n on:close:popup={onClosePopup}\n title={localize(titleCurrent)}\n use:applyStyles={styles}>\n <slot name=outer />\n <span bind:this={spanEl}\n class:selected\n on:click={onClick}\n on:contextmenu={onContextMenuPress}\n on:keydown={onKeydown}\n on:keyup={onKeyup}\n on:click\n on:contextmenu\n role=button\n tabindex=0\n use:efx>\n <slot name=left />\n {#if comp}\n <svelte:component this={comp}/>\n {:else if typeof text === 'string'}\n <!-- svelte-ignore a11y-missing-attribute -->\n <a role=presentation>{localize(text)}</a>\n {/if}\n <slot name=right />\n </span>\n {#if selected}\n <slot/>\n {/if}\n</div>\n\n<style>\n div {\n display: block;\n position: relative;\n }\n\n span {\n position: relative;\n\n display: flex;\n justify-content: var(--tjs-toggle-label-justify-content, center);\n align-items: var(--tjs-toggle-label-align-items, center);\n\n pointer-events: initial;\n\n width: 100%;\n height: 100%;\n\n background: var(--tjs-toggle-label-background);\n border: var(--tjs-toggle-label-border, none);\n border-radius: var(--tjs-toggle-label-border-radius);\n font-size: var(--tjs-toggle-label-font-size, inherit);\n font-weight: var(--tjs-toggle-label-font-weight, inherit);\n font-family: var(--tjs-toggle-label-font-family, inherit);\n overflow: var(--tjs-toggle-label-overflow, hidden);\n padding: var(--tjs-toggle-label-padding, 0 0.25em);\n transform-style: preserve-3d;\n transition: var(--tjs-toggle-label-transition, background 0.2s ease-in-out);\n }\n\n span:focus {\n background: var(--tjs-toggle-label-background-focus);\n text-shadow: var(--tjs-toggle-label-text-shadow-focus, var(--tjs-default-text-shadow-focus-hover));\n }\n\n span:focus-visible {\n background: var(--tjs-toggle-label-background-focus-visible);\n box-shadow: var(--tjs-toggle-label-box-shadow-focus-visible, var(--tjs-default-box-shadow-focus-visible));\n outline: var(--tjs-toggle-label-outline-focus-visible, var(--tjs-default-outline-focus-visible, revert));\n transition: var(--tjs-toggle-label-transition-focus-visible, var(--tjs-default-transition-focus-visible));\n }\n\n span:hover {\n background: var(--tjs-toggle-label-background-hover);\n text-shadow: var(--tjs-toggle-label-text-shadow-hover, var(--tjs-default-text-shadow-focus-hover));\n }\n\n span.selected {\n background: var(--tjs-toggle-label-background-selected);\n text-shadow: var(--tjs-toggle-label-text-shadow-selected, var(--tjs-default-text-shadow-focus-hover));\n }\n</style>\n","<script>\n /**\n * TJSMenu provides a menu component that can be slotted into toggle components like TJSToggleIconButton and\n * TJSToggleLabel.\n *\n * TJSMenu supports a flexible data driven way to construct the menu items. Depending on the item data that is passed\n * into the menu you can define 4 types of items: 'icon / label', 'image / label', 'class / Svelte component', and\n * 'separator / hr'. TJSMenu also accepts a main slot allowing the entire menu contents to be replaced with a custom\n * component as well as named slots `before` and `after` which place named components before or after the main menu\n * data driven items.\n *\n * ----------------------------------------------------------------------------------------------------------------\n * Exported props include:\n * `menu` ({@link TJSMenuData}): An object defining all properties of a menu including potentially data driven\n * minimal Svelte configuration objects (`slotAfter`, `slotBefore`, and `slotDefault`) providing default\n * component implementations.\n *\n * Or in lieu of passing the folder object you can assign these props directly:\n * `items`: An iterable list of {@link TJSMenuItemData}; defines data driven menu items.\n * `offset`: Optional X / Y offsets for the menu display.\n * `styles`: Styles to be applied inline via `applyStyles` action.\n * `efx`: Currently unused; for any future action effects.\n * `keyCode`: The key code to activate menu items.\n * `transitionOptions`: Custom transition options for duration and easing function.\n *\n * ----------------------------------------------------------------------------------------------------------------\n * Events: There is a single that is fired and bubbled up through parent elements:\n *\n * `close:popup` - A CustomEvent fired when the menu closes allowing any parent components to update state. The\n * `detail` data may have two optional fields of data including `keyboardFocus` / boolean if the\n * close action originated from keyboard navigation and the other is `target` / HTMLElement that is\n * the original event target for the close action.\n *\n * ----------------------------------------------------------------------------------------------------------------\n * Styling: To style this component use `.tjs-menu` as the base selector.\n *\n * There are several local CSS variables that you can use to change the appearance dynamically. Either use\n * CSS props or pass in a `styles` object w/ key / value props to set to the details. The default fallback variables\n * target both TJSMenu and TJSContextMenu. The few `popup` defaults target first level overlaid components inside an\n * application.\n *\n * The following CSS variables are supported, but not defined by default.\n * --tjs-menu-background - fallback: --tjs-default-menu-background; fallback: --tjs-default-popup-background; default: #23221d\n * --tjs-menu-border - fallback: --tjs-default-popup-border; default: 1px solid #000\n * --tjs-menu-border-radius - fallback: --tjs-default-popup-border-radius; default: 5px\n * --tjs-menu-box-shadow - fallback: --tjs-default-popup-box-shadow; default: 0 0 2px #000\n * --tjs-menu-primary-color - fallback: --tjs-default-menu-primary-color; fallback: --tjs-default-popup-primary-color; default: #b5b3a4\n * --tjs-menu-max-width - fallback: --tjs-default-menu-max-width; default: 360px\n * --tjs-menu-min-width - fallback: --tjs-default-menu-min-width; default: 20px\n * --tjs-menu-z-index - fallback: --tjs-default-popup-z-index; default: 100\n *\n * The following CSS variables define attributes for the data driven menu items.\n *\n * All menu items:\n * --tjs-menu-item-line-height - fallback: --tjs-default-menu-item-line-height; default: 2em\n * --tjs-menu-item-padding - fallback: --tjs-default-menu-item-padding; default: 0 0.5em 0 0\n *\n * Icon / Image menu items (considered a button item):\n * --tjs-menu-item-button-gap - fallback: --tjs-default-menu-item-button-gap; default: 0.25em\n * --tjs-menu-item-highlight-color - fallback: --tjs-default-menu-highlight-color; fallback: --tjs-default-popup-highlight-color; default: #f0f0e0\n * --tjs-menu-item-text-shadow-focus-hover - fallback: --tjs-default-text-shadow-focus-hover; default: 0 0 8px red\n *\n * Specific targeting for the label of button items (allows control of wrapping / set `white-space` to `nowrap`):\n * --tjs-menu-item-label-overflow - fallback: --tjs-default-menu-item-label-overflow; default: hidden\n * --tjs-menu-item-label-text-overflow - fallback: --tjs-default-menu-item-label-text-overflow; default: ellipsis\n * --tjs-menu-item-label-white-space - fallback: --tjs-default-menu-item-label-white-space; default: undefined\n *\n * Icon menu item:\n * --tjs-menu-item-icon-width - fallback: --tjs-default-menu-item-icon-width; default: 1.25em\n *\n * Image menu item:\n * --tjs-menu-item-image-width - fallback: --tjs-default-menu-item-image-width; default: 1.25em\n * --tjs-menu-item-image-height - fallback: --tjs-default-menu-item-image-height; default: 1.25em\n *\n * Separator / HR:\n * --tjs-menu-hr-margin - fallback: --tjs-default-hr-margin; default: 0 0.25em\n * --tjs-menu-hr-border-top - fallback: --tjs-default-hr-border-top; default: 1px solid #555\n * --tjs-menu-hr-border-bottom - fallback: --tjs-default-hr-border-bottom; default: 1px solid #444\n *\n * The following CSS variables define the keyboard / a11y focus indicator for menu items:\n * --tjs-menu-focus-indicator-align-self - fallback: --tjs-default-focus-indicator-align-self; default: stretch\n * --tjs-menu-focus-indicator-background - fallback: --tjs-default-focus-indicator-background; default: white\n * --tjs-menu-focus-indicator-border - fallback: --tjs-default-focus-indicator-border; default: undefined\n * --tjs-menu-focus-indicator-border-radius - fallback: --tjs-default-focus-indicator-border-radius; default: 0.1em\n * --tjs-menu-focus-indicator-height - fallback: --tjs-default-focus-indicator-height; default: undefined\n * --tjs-menu-focus-indicator-width - fallback: --tjs-default-focus-indicator-width; default: 0.25em\n * --tjs-menu-focus-indicator-transition - fallback: --tjs-default-focus-indicator-transition\n */\n\n import { onMount } from 'svelte';\n\n import { quintOut } from 'svelte/easing';\n\n import { applyStyles } from '@typhonjs-fvtt/runtime/svelte/action';\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n import { slideFade } from '@typhonjs-fvtt/runtime/svelte/transition';\n import {\n A11yHelper,\n getStackingContext,\n isIterable,\n isObject,\n isSvelteComponent } from '@typhonjs-fvtt/runtime/svelte/util';\n\n import { TJSFocusWrap } from '@typhonjs-fvtt/runtime/svelte/component/core';\n\n /** @type {TJSMenuData} */\n export let menu = void 0;\n\n /** @type {Iterable<TJSMenuItemData>} */\n export let items = void 0;\n\n /** @type {HTMLElement|string} */\n export let focusEl = void 0;\n\n /** @type {{ x?: number, y?: number }} */\n export let offset = void 0;\n\n /** @type {Record<string, string>} */\n export let styles = void 0;\n\n /** @type {Function} */\n export let efx = void 0;\n\n /** @type {string} */\n export let keyCode = void 0;\n\n /** @type {{ duration: number, easing: Function }} */\n export let transitionOptions = void 0;\n\n const s_DEFAULT_OFFSET = { x: 0, y: 0 };\n\n // Provides options to `A11yHelper.getFocusableElements` to ignore TJSFocusWrap by CSS class.\n const s_IGNORE_CLASSES = { ignoreClasses: ['tjs-focus-wrap'] };\n\n /** @type {Iterable<TJSMenuItemData>} */\n let allItems;\n\n $: {\n const tempList = isObject(menu) && isIterable(menu.items) ? menu.items :\n isIterable(items) ? items : [];\n\n const tempItems = [];\n\n let cntr = -1;\n\n for (const item of tempList)\n {\n cntr++;\n if (!isObject(item)) { throw new TypeError(`TJSMenu error: 'item[${cntr}]' is not an object.`); }\n\n // Filter items for any condition that prevents display.\n if (typeof item.condition === 'function' && !item.condition()) { continue; }\n if (typeof item.condition === 'boolean' && !item.condition) { continue; }\n\n let type;\n\n if (isSvelteComponent(item.class)) { type = 'class'; }\n else if (typeof item.icon === 'string') { type = 'icon'; }\n else if (typeof item.image === 'string') { type = 'image'; }\n else if (typeof item.separator === 'string')\n {\n if (item.separator !== 'hr')\n {\n throw new Error (\n `TJSMenu error: 'item[${cntr}]' has unknown separator type; only 'hr' is currently supported.`)\n }\n\n type = 'separator-hr';\n }\n\n if (type === void 0) { throw new TypeError(`TJSMenu error: Unknown type for 'item[${cntr}]'.`); }\n\n tempItems.push({ ...item, '#type': type });\n }\n\n allItems = tempItems;\n }\n\n $: focusEl = isObject(menu) && A11yHelper.isFocusSource(menu.focusEl) ? menu.focusEl :\n A11yHelper.isFocusSource(focusEl) ? focusEl : void 0;\n\n $: offset = isObject(menu) && isObject(menu.offset) ? menu.offset :\n isObject(offset) ? offset : s_DEFAULT_OFFSET;\n\n $: styles = isObject(menu) && isObject(menu.styles) ? menu.styles :\n isObject(styles) ? styles : void 0;\n\n $: efx = isObject(menu) && typeof menu.efx === 'function' ? menu.efx :\n typeof efx === 'function' ? efx : () => {};\n\n $: keyCode = isObject(menu) && typeof menu.keyCode === 'string' ? menu.keyCode :\n typeof keyCode === 'string' ? keyCode : 'Enter';\n\n $: transitionOptions = isObject(menu) && isObject(menu.transitionOptions) ? menu.transitionOptions :\n isObject(transitionOptions) ? transitionOptions : { duration: 200, easing: quintOut };\n\n // Bound to the nav element / menu.\n let menuEl;\n\n // Stores if this context menu is closed.\n let closed = false;\n\n // Stores any associated `focusSource` options to pass to menu callbacks when menu was activated by keys.\n let focusOptions = void 0;\n\n // Stores if menu has keyboard focus; detected on mount, when tab navigation occurs, and used to set `keyboardFocus`\n // for close event.\n let hasKeyboardFocus = false;\n\n // ----------------------------------------------------------------------------------------------------------------\n\n onMount(() =>\n {\n const activeEl = document.activeElement;\n const parentEl = menuEl.parentElement;\n\n // Determine if the parent element to the menu contains the active element and that it is explicitly focused\n // via `:focus-visible` / keyboard navigation. If so then explicitly focus the first menu item possible.\n if (parentEl instanceof HTMLElement && activeEl instanceof HTMLElement && parentEl.contains(activeEl) &&\n activeEl.matches(':focus-visible'))\n {\n const firstFocusEl = A11yHelper.getFirstFocusableElement(menuEl);\n\n if (firstFocusEl instanceof HTMLElement && !firstFocusEl.classList.contains('tjs-focus-wrap'))\n {\n firstFocusEl.focus();\n hasKeyboardFocus = true;\n }\n else\n {\n // Silently focus the menu element so that keyboard handling functions.\n menuEl.focus();\n }\n\n // Menu opened by keyboard navigation; set focus source to activeEl and pass to menu item callbacks.\n focusOptions = {\n focusSource: {\n focusEl: [activeEl]\n }\n };\n\n // Append any optional focus source from `focusEl` prop.\n if (focusEl) { focusOptions.focusSource.focusEl.push(focusEl); }\n }\n else\n {\n // Silently focus the menu element so that keyboard handling functions.\n menuEl.focus();\n\n // Create focus source from optional `focusEl` prop.\n if (focusEl)\n {\n focusOptions = {\n focusSource: {\n focusEl: [focusEl]\n }\n };\n }\n }\n });\n\n // ----------------------------------------------------------------------------------------------------------------\n\n /**\n * Provides a custom transform allowing inspection of the element to change positioning styles based on the\n * height / width of the element and the containing stacking context element. This allows the menu to expand left or\n * right when the menu exceeds the bounds of the containing stacking context element.\n *\n * @param {HTMLElement} node - nav element.\n *\n * @returns {object} Transition object.\n */\n function animate(node)\n {\n const result = getStackingContext(node.parentElement);\n\n if (!(result?.node instanceof HTMLElement))\n {\n console.warn(`'TJSMenu.animate warning: Could not locate parent stacking context element.`);\n return;\n }\n\n const stackingContextRect = result?.node.getBoundingClientRect();\n const stackingContextRight = stackingContextRect.x + stackingContextRect.width;\n\n const nodeRect = node.getBoundingClientRect();\n const parentRect = node.parentElement.getBoundingClientRect();\n\n const adjustedOffset = {...s_DEFAULT_OFFSET, ...offset};\n\n node.style.top = `${adjustedOffset.y + parentRect.height}px`;\n\n // Check to make sure that the menu width does not exceed the right side of the stacking context element.\n // If not open to the right.\n if (parentRect.x + nodeRect.width < stackingContextRight)\n {\n node.style.left = `${adjustedOffset.x}px`;\n node.style.removeProperty('right');\n }\n else // Open left.\n {\n node.style.right = `${adjustedOffset.x}px`;\n node.style.removeProperty('left');\n }\n\n return slideFade(node, transitionOptions);\n }\n\n /**\n * Invokes a function on click of a menu item then fires the `close` event and automatically runs the outro\n * transition and destroys the component.\n *\n * @param {TJSMenuItemData} [item] - Menu item data.\n */\n function onClick(item)\n {\n const callback = item?.onPress;\n\n if (typeof callback === 'function') { callback(item, focusOptions); }\n\n if (!closed)\n {\n closed = true;\n menuEl.dispatchEvent(new CustomEvent('close:popup', { bubbles: true, cancelable: true }));\n }\n }\n\n /**\n * Determines if a pointer event is pressed outside the menu which closes the menu. Use a bubbling custom event\n * `close:popup` and attach the original target. The TRL application shells will respond to this event to handle\n * any additional automatic focus management.\n *\n * @param {PointerEvent} event - Pointer event from document body click.\n */\n async function onClose(event)\n {\n // Early out if the pointer down is inside the menu element.\n if (event.target === menuEl || menuEl.contains(event.target)) { return; }\n\n if (event.target === menuEl.parentElement || menuEl.parentElement.contains(event.target)) { return; }\n\n if (!closed)\n {\n closed = true;\n\n menuEl.dispatchEvent(new CustomEvent('close:popup', {\n bubbles: true,\n cancelable: true,\n detail: { target: event.target }\n }));\n }\n }\n\n /**\n * Handle key commands for closing the menu ('Esc') and reverse focus cycling via 'Shift-Tab'. Also stop propagation\n * for the key code assigned for menu item selection ('Enter').\n *\n * @param {KeyboardEvent} event - KeyboardEvent.\n */\n function onKeydownMenu(event)\n {\n // Handle menu item keyCode selection.\n if (event.code === keyCode)\n {\n event.stopPropagation();\n return;\n }\n\n switch(event.code)\n {\n case 'Tab':\n event.stopPropagation();\n\n // Handle reverse focus cycling with `<Shift-Tab>`.\n if (event.shiftKey)\n {\n // Collect all focusable elements from `elementRoot` and ignore TJSFocusWrap.\n const allFocusable = A11yHelper.getFocusableElements(menuEl, s_IGNORE_CLASSES);\n\n // Find first and last focusable elements.\n const firstFocusEl = allFocusable.length > 0 ? allFocusable[0] : void 0;\n const lastFocusEl = allFocusable.length > 0 ? allFocusable[allFocusable.length - 1] : void 0;\n\n // Only cycle focus to the last keyboard focusable app element if `elementRoot` or first focusable\n // element is the active element.\n if (menuEl === document.activeElement || firstFocusEl === document.activeElement)\n {\n if (lastFocusEl instanceof HTMLElement && firstFocusEl !== lastFocusEl) { lastFocusEl.focus(); }\n\n event.preventDefault();\n }\n }\n\n break;\n\n default:\n // Any other key stop propagation preventing any global key handlers from responding.\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * Handle key commands for closing the menu ('Esc') and reverse focus cycling via 'Shift-Tab'. Also stop propagation\n * for the key code assigned for menu item selection ('Enter').\n *\n * @param {KeyboardEvent} event - KeyboardEvent.\n */\n function onKeyupMenu(event)\n {\n switch (event.code)\n {\n case 'Escape':\n if (!closed)\n {\n closed = true;\n menuEl.dispatchEvent(new CustomEvent('close:popup',\n { bubbles: true, cancelable: true, detail: { keyboardFocus: hasKeyboardFocus } }));\n }\n\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * Handle key presses on menu items.\n *\n * @param {KeyboardEvent} event - KeyboardEvent.\n *\n * @param {TJSMenuItemData} [item] - Menu item data.\n */\n function onKeyupItem(event, item)\n {\n if (event.code === keyCode)\n {\n const callback = item?.onPress;\n\n if (typeof callback === 'function') { callback(item, focusOptions); }\n\n if (!closed)\n {\n closed = true;\n\n event.preventDefault();\n event.stopPropagation();\n\n menuEl.dispatchEvent(new CustomEvent('close:popup',\n { bubbles: true, cancelable: true, detail: { keyboardFocus: hasKeyboardFocus } }));\n }\n }\n }\n\n /**\n * Closes menu when browser window is blurred.\n */\n function onWindowBlur()\n {\n if (!closed)\n {\n closed = true;\n menuEl.dispatchEvent(new CustomEvent('close:popup', { bubbles: true, cancelable: true }));\n }\n }\n</script>\n\n<!-- bind to `document.body` to receive pointer down & scroll wheel events to close the menu. -->\n<svelte:body on:pointerdown={onClose} on:wheel={onClose}/>\n\n<!-- bind to 'window' to close menu when browser window is blurred. -->\n<svelte:window on:blur={onWindowBlur}/>\n\n<nav class=tjs-menu\n bind:this={menuEl}\n on:click|preventDefault|stopPropagation={() => null}\n on:keydown|stopPropagation={onKeydownMenu}\n on:keyup|preventDefault|stopPropagation={onKeyupMenu}\n on:pointerdown|stopPropagation={() => null}\n on:pointerup|stopPropagation={() => null}\n transition:animate\n use:applyStyles={styles}\n use:efx\n tabindex=-1\n >\n\n <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->\n <ol class=tjs-menu-items role=menu>\n <!-- TJSMenu supports hosting a slot for menu content -->\n <slot>\n {#if isSvelteComponent(menu?.slotDefault?.class)}\n <svelte:component this={menu.slotDefault.class} {...(isObject(menu?.slotDefault?.props) ? menu.slotDefault.props : {})} />\n {/if}\n </slot>\n\n {#if $$slots.before}\n <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->\n <li class=tjs-menu-item\n on:click={() => onClick()}\n on:keyup={(event) => onKeyupItem(event)}\n role=menuitem\n tabindex=0>\n <span class=tjs-menu-focus-indicator />\n <slot name=before />\n </li>\n {/if}\n {#each allItems as item}\n {#if item['#type'] === 'class'}\n <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->\n <li class=tjs-menu-item\n on:click={() => onClick(item)}\n on:keyup={(event) => onKeyupItem(event, item)}\n role=menuitem\n tabindex=0>\n <span class=tjs-menu-focus-indicator />\n <svelte:component this={item.class} {...(isObject(item.props) ? item.props : {})} />\n </li>\n {:else if item['#type'] === 'icon'}\n <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->\n <li class=\"tjs-menu-item tjs-menu-item-button\"\n on:click={() => onClick(item)}\n on:keyup={(event) => onKeyupItem(event, item)}\n role=menuitem\n tabindex=0>\n <span class=tjs-menu-focus-indicator />\n <i class={item.icon}></i>\n <span class=tjs-menu-item-label>{localize(item.label)}</span>\n </li>\n {:else if item['#type'] === 'image'}\n <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->\n <li class=\"tjs-menu-item tjs-menu-item-button\"\n on:click={() => onClick(item)}\n on:keyup={(event) => onKeyupItem(event, item)}\n role=menuitem\n tabindex=0>\n <span class=tjs-menu-focus-indicator />\n <img src={item.image} alt={item.imageAlt}>\n <span class=tjs-menu-item-label>{localize(item.label)}</span>\n </li>\n {:else if item['#type'] === 'separator-hr'}\n <hr>\n {/if}\n {/each}\n {#if $$slots.after}\n <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->\n <li class=tjs-menu-item\n on:click={() => onClick()}\n on:keyup={(event) => onKeyupItem(event)}\n role=menuitem\n tabindex=0>\n <span class=tjs-menu-focus-indicator />\n <slot name=after />\n </li>\n {/if}\n </ol>\n <TJSFocusWrap elementRoot={menuEl} />\n</nav>\n\n<style>\n .tjs-menu {\n position: absolute;\n width: max-content;\n height: max-content;\n overflow: hidden;\n\n background: var(--tjs-menu-background, var(--tjs-default-menu-background, var(--tjs-default-popup-background, #23221d)));\n border: var(--tjs-menu-border, var(--tjs-default-popup-border, 1px solid #000));\n border-radius: var(--tjs-menu-border-radius, var(--tjs-default-popup-border-radius, 5px));\n box-shadow: var(--tjs-menu-box-shadow, var(--tjs-default-popup-box-shadow, 0 0 2px #000));\n color: var(--tjs-menu-primary-color, var(--tjs-default-menu-primary-color, var(--tjs-default-popup-primary-color, #b5b3a4)));\n max-width: var(--tjs-menu-max-width, var(--tjs-default-menu-max-width, 360px));\n min-width: var(--tjs-menu-min-width, var(--tjs-default-menu-min-width, 20px));\n\n text-align: start;\n\n /* Defines z-index in local stacking context */\n z-index: var(--tjs-menu-z-index, var(--tjs-default-popup-z-index, 100));\n }\n\n .tjs-menu:focus-visible {\n outline: var(--tjs-default-a11y-outline-focus-visible, 2px solid transparent);\n }\n\n .tjs-menu-items {\n margin: 0;\n padding: 0;\n }\n\n .tjs-menu-items hr {\n margin-block-start: 0;\n margin-block-end: 0;\n margin: var(--tjs-menu-hr-margin, var(--tjs-default-hr-margin, 0 0.25em));\n border-top: var(--tjs-menu-hr-border-top, var(--tjs-default-hr-border-top, 1px solid #555));\n border-bottom: var(--tjs-menu-hr-border-bottom, var(--tjs-default-hr-border-bottom, 1px solid #444));\n }\n\n .tjs-menu-item {\n display: flex;\n align-items: center;\n line-height: var(--tjs-menu-item-line-height, var(--tjs-default-menu-item-line-height, 2em));\n padding: var(--tjs-menu-item-padding, var(--tjs-default-menu-item-padding, 0 0.5em 0 0));\n }\n\n /* Disable default outline for focus visible / within */\n .tjs-menu-item:focus-within, .tjs-menu-item:focus-visible {\n outline: none;\n }\n\n .tjs-menu-item i {\n text-align: center;\n width: var(--tjs-menu-item-icon-width, var(--tjs-default-menu-item-icon-width, 1.25em));\n }\n\n .tjs-menu-item img {\n width: var(--tjs-menu-item-image-width, var(--tjs-default-menu-item-image-width, 1.25em));\n height: var(--tjs-menu-item-image-height, var(--tjs-default-menu-item-image-height, 1.25em));\n }\n\n .tjs-menu-item-button {\n gap: var(--tjs-menu-item-button-gap, var(--tjs-default-menu-item-button-gap, 0.25em));\n }\n\n .tjs-menu-item-button:hover {\n color: var(--tjs-menu-item-highlight-color, var(--tjs-default-menu-highlight-color, var(--tjs-default-popup-highlight-color, #f0f0e0)));\n text-shadow: var(--tjs-menu-item-text-shadow-focus-hover, var(--tjs-default-text-shadow-focus-hover, 0 0 8px red));\n }\n\n .tjs-menu-item-button:focus-visible {\n color: var(--tjs-menu-item-highlight-color, var(--tjs-default-menu-highlight-color, var(--tjs-default-popup-highlight-color, #f0f0e0)));\n text-shadow: var(--tjs-menu-item-text-shadow-focus-hover, var(--tjs-default-text-shadow-focus-hover, 0 0 8px red));\n }\n\n .tjs-menu-focus-indicator {\n align-self: var(--tjs-menu-focus-indicator-align-self, var(--tjs-default-focus-indicator-align-self, stretch));\n border: var(--tjs-menu-focus-indicator-border, var(--tjs-default-focus-indicator-border));\n border-radius: var(--tjs-menu-focus-indicator-border-radius, var(--tjs-default-focus-indicator-border-radius, 0.1em));\n height: var(--tjs-menu-focus-indicator-height, var(--tjs-default-focus-indicator-height));\n width: var(--tjs-menu-focus-indicator-width, var(--tjs-default-focus-indicator-width, 0.25em));\n transition: var(--tjs-menu-focus-indicator-transition, var(--tjs-default-focus-indicator-transition));\n }\n\n /* Enable focus indicator for focus-within */\n /* Note: the use of `has` pseudo-selector that requires a child with :focus-visible */\n .tjs-menu-item:focus-within:has(:focus-visible) .tjs-menu-focus-indicator {\n background: var(--tjs-menu-focus-indicator-background, var(--tjs-default-focus-indicator-background, white));\n }\n\n /* Fallback for browsers that don't support 'has'; any user interaction including mouse will trigger */\n @supports not (selector(:has(*))) {\n .tjs-menu-item:focus-within .tjs-menu-focus-indicator {\n background: var(--tjs-menu-focus-indicator-background, var(--tjs-default-focus-indicator-background, white));\n }\n }\n\n /* Enable focus indicator for focus visible */\n .tjs-menu-item:focus-visible .tjs-menu-focus-indicator {\n background: var(--tjs-menu-focus-indicator-background, var(--tjs-default-focus-indicator-background, white));\n }\n\n .tjs-menu-item-label {\n overflow: var(--tjs-menu-item-label-overflow, var(--tjs-default-menu-item-label-overflow, hidden));\n text-overflow: var(--tjs-menu-item-label-text-overflow, var(--tjs-default-menu-item-label-text-overflow, ellipsis));\n white-space: var(--tjs-menu-item-label-white-space, var(--tjs-default-menu-item-label-white-space));\n }\n</style>\n","<script>\n /**\n * TJSContextMenuImpl provides a context menu implementation component that is not meant to be directly used as it is\n * controlled as a single browser wide context menu from {@link TJSContextMenu} that is imported via:\n * `import { TJSContextMenu } from '@typhonjs-fvtt/svelte-standard/application';` The front end for\n * TJSContextMenuImpl processes data and invokes / manages a single context menu.\n *\n * TJSContextMenuImpl supports a flexible data driven way to construct the menu items with the same format as\n * {@link TJSMenu}. Depending on the item data that is passed into the menu you can define 4 types of items:\n * 'icon / label', 'image / label', 'class / Svelte component', and 'separator / hr'. The main difference is that\n * TJSContextMenu does not support default or named slots.\n *\n * ----------------------------------------------------------------------------------------------------------------\n * Exported props include:\n * `menu` ({@link TJSMenuData}): An object defining all properties of a menu.\n *\n * Or in lieu of passing the folder object you can assign these props directly:\n * `items`: An iterable list of {@link TJSContextMenuItemData}; defines data driven menu items.\n * `styles`: Styles to be applied inline via `applyStyles` action.\n * `efx`: Currently unused; for any future action effects.\n * `keyCode`: The key code to activate menu items.\n * `focusSource`: A `A11yFocusSource` object containing the target element to return focus to on close.\n * `transitionOptions`: Custom transition options for duration and easing function.\n *\n * ----------------------------------------------------------------------------------------------------------------\n * Events: There is a single that is fired and _not_ bubbled up through parent elements:\n * `close`- Fired when the menu closes allowing {@link TJSContextMenu} to clean up resources.\n *\n * ----------------------------------------------------------------------------------------------------------------\n * Styling: To style this component use `.tjs-context-menu` as the base selector.\n *\n * There are several local CSS variables that you can use to change the appearance dynamically. Either use\n * CSS props or pass in a `styles` object w/ key / value props to set to the details. The default fallback variables\n * target both TJSMenu and TJSContextMenu. The few `popover` defaults target components that independently pop over\n * other elements browser wide.\n *\n * The following CSS variables are supported, but not defined by default.\n * --tjs-context-menu-background - fallback: --tjs-default-menu-background; fallback: --tjs-default-popup-background; default: #23221d\n * --tjs-context-menu-border - fallback: --tjs-default-popup-border; default: 1px solid #000\n * --tjs-context-menu-border-radius - fallback: --tjs-default-popup-border-radius; default: 5px\n * --tjs-context-menu-box-shadow - fallback: --tjs-default-popup-box-shadow; default: 0 0 2px #000\n * --tjs-context-menu-primary-color - fallback: --tjs-default-menu-primary-color; fallback: --tjs-default-popup-primary-color; default: #b5b3a4\n * --tjs-context-menu-max-width - fallback: --tjs-default-menu-max-width; default: 360px\n * --tjs-context-menu-min-width - fallback: --tjs-default-menu-min-width; default: 20px\n *\n * The following CSS variables define attributes for the data driven menu items.\n *\n * All menu items:\n * --tjs-context-menu-item-line-height - fallback: --tjs-default-menu-item-line-height; default: 2em\n * --tjs-context-menu-item-padding - fallback: --tjs-default-menu-item-padding; default: 0 0.5em 0 0\n *\n * Icon / Image menu items (considered a button item):\n * --tjs-context-menu-item-button-gap - fallback: --tjs-default-menu-item-button-gap; default: 0.25em\n * --tjs-context-menu-item-highlight-color - fallback: --tjs-default-menu-highlight-color; fallback: --tjs-default-popup-highlight-color; default: #f0f0e0\n * --tjs-context-menu-item-text-shadow-focus-hover - fallback: --tjs-default-text-shadow-focus-hover; default: 0 0 8px red\n *\n * Specific targeting for the label of button items (allows control of wrapping / set `white-space` to `nowrap`):\n * --tjs-context-menu-item-label-overflow - fallback: --tjs-default-menu-item-label-overflow; default: hidden\n * --tjs-context-menu-item-label-text-overflow - fallback: --tjs-default-menu-item-label-text-overflow; default: ellipsis\n * --tjs-context-menu-item-label-white-space - fallback: --tjs-default-menu-item-label-white-space; default: undefined\n *\n * Icon menu item:\n * --tjs-context-menu-item-icon-width - fallback: --tjs-default-menu-item-icon-width; default: 1.25em\n *\n * Image menu item:\n * --tjs-context-menu-item-image-width - fallback: --tjs-default-menu-item-image-width; default: 1.25em\n * --tjs-context-menu-item-image-height - fallback: --tjs-default-menu-item-image-height; default: 1.25em\n *\n * Separator / HR:\n * --tjs-context-menu-hr-margin - fallback: --tjs-default-hr-margin; default: 0 0.25em\n * --tjs-context-menu-hr-border-top - fallback: --tjs-default-hr-border-top; default: 1px solid #555\n * --tjs-context-menu-hr-border-bottom - fallback: --tjs-default-hr-border-bottom; default: 1px solid #444\n *\n * The following CSS variables define the keyboard / a11y focus indicator for menu items:\n * --tjs-context-menu-focus-indicator-align-self - fallback: --tjs-default-focus-indicator-align-self; default: stretch\n * --tjs-context-menu-focus-indicator-background - fallback: --tjs-default-focus-indicator-background; default: white\n * --tjs-context-menu-focus-indicator-border - fallback: --tjs-default-focus-indicator-border; default: undefined\n * --tjs-context-menu-focus-indicator-border-radius - fallback: --tjs-default-focus-indicator-border-radius; default: 0.1em\n * --tjs-context-menu-focus-indicator-height - fallback: --tjs-default-focus-indicator-height; default: undefined\n * --tjs-context-menu-focus-indicator-width - fallback: --tjs-default-focus-indicator-width; default: 0.25em\n * --tjs-menu-focus-indicator-transition - fallback: --tjs-default-focus-indicator-transition\n */\n\n import {\n createEventDispatcher,\n onMount } from 'svelte';\n\n import { current_component } from 'svelte/internal';\n\n import { applyStyles } from '@typhonjs-fvtt/runtime/svelte/action';\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n import { slideFade } from '@typhonjs-fvtt/runtime/svelte/transition';\n\n import {\n A11yHelper,\n isObject,\n outroAndDestroy } from '@typhonjs-fvtt/runtime/svelte/util';\n\n import { TJSFocusWrap } from '@typhonjs-fvtt/runtime/svelte/component/core';\n\n export let menu = void 0;\n\n export let id = '';\n\n export let x = 0;\n\n export let y = 0;\n\n export let items = [];\n\n export let zIndex = Number.MAX_SAFE_INTEGER - 100;\n\n /** @type {Record<string, string>} */\n export let styles = void 0;\n\n /** @type {string} */\n export let keyCode = void 0;\n\n export let focusSource = void 0;\n\n /** @type {{ duration: number, easing: Function }} */\n export let transitionOptions = void 0;\n\n $: styles = isObject(menu) && isObject(menu.styles) ? menu.styles :\n isObject(styles) ? styles : void 0;\n\n $: keyCode = isObject(menu) && typeof menu.keyCode === 'string' ? menu.keyCode :\n typeof keyCode === 'string' ? keyCode : 'Enter';\n\n // Provides options to `A11yHelper.getFocusableElements` to ignore TJSFocusWrap by CSS class.\n const s_IGNORE_CLASSES = { ignoreClasses: ['tjs-focus-wrap'] };\n\n // Store this component reference.\n const local = current_component;\n\n // Dispatches `close` event.\n const dispatch = createEventDispatcher();\n\n // Bound to the nav element / menu.\n let menuEl;\n\n // Stores if this context menu is closed.\n let closed = false;\n\n // Stores if menu has keyboard focus; detected on mount, when tab navigation occurs, and used to set `keypress` for\n // close event.\n // let hasKeyboardFocus = false;\n\n // ----------------------------------------------------------------------------------------------------------------\n\n onMount(() =>\n {\n const keyboardFocus = focusSource?.source === 'keyboard';\n\n // If the focus options designate that the source of the context menu came from the keyboard then focus the first\n // menu item on mount.\n if (keyboardFocus)\n {\n const firstFocusEl = A11yHelper.getFirstFocusableElement(menuEl);\n if (firstFocusEl instanceof HTMLElement && !firstFocusEl.classList.contains('tjs-focus-wrap'))\n {\n firstFocusEl.focus();\n }\n else\n {\n // Silently focus the menu element so that keyboard handling functions.\n menuEl.focus();\n }\n }\n else\n {\n // Silently focus the menu element so that keyboard handling functions.\n menuEl.focus();\n }\n });\n\n // ----------------------------------------------------------------------------------------------------------------\n\n /**\n * Provides a custom animate callback allowing inspection of the element to change positioning styles based on the\n * height / width of the element and `document.body`. This allows the context menu to expand up when the menu\n * is outside the height bound of `document.body` and expand to the left if width is greater than `document.body`.\n *\n * @param {HTMLElement} node - nav element.\n *\n * @returns {object} Transition object.\n */\n function animate(node)\n {\n const expandUp = y + node.clientHeight > document.body.clientHeight\n const expandLeft = x + node.clientWidth > document.body.clientWidth\n\n node.style.top = expandUp ? null : `${y}px`;\n node.style.bottom = expandUp ? `${document.body.clientHeight - y}px` : null;\n\n node.style.left = expandLeft ? null : `${x}px`;\n node.style.right = expandLeft ? `${document.body.clientWidth - x}px` : null;\n\n return slideFade(node, transitionOptions);\n }\n\n /**\n * Invokes a function on click of a menu item then fires the `close` event and automatically runs the outro\n * transition and destroys the component.\n *\n * @param {object} item - Function to invoke on click.\n */\n function onClick(item)\n {\n const callback = item?.onPress;\n\n if (typeof callback === 'function')\n {\n callback(item, { focusSource });\n }\n else\n {\n A11yHelper.applyFocusSource(focusSource)\n focusSource = void 0;\n }\n\n if (!closed)\n {\n dispatch('close');\n closed = true;\n outroAndDestroy(local);\n }\n }\n\n /**\n * Determines if a pointer pressed to the document body closes the context menu. If the click occurs outside the\n * context menu then fire the `close` event and run the outro transition then destroy the component.\n *\n * @param {PointerEvent|MouseEvent} event - Pointer or mouse event from document body click / scroll wheel.\n *\n * @param {boolean} [isWheel=false] - True when scroll wheel; do not perform 2nd early out test.\n */\n function onClose(event, isWheel = false)\n {\n // Early out if the pointer down is inside the menu element.\n if (event.target === menuEl || menuEl.contains(event.target)) { return; }\n\n // Early out if the event page X / Y is the same as this context menu.\n if (!isWheel && Math.floor(event.pageX) === x && Math.floor(event.pageY) === y) { return; }\n\n if (!closed)\n {\n dispatch('close');\n closed = true;\n outroAndDestroy(local);\n }\n }\n\n /**\n * Handle key commands for closing the menu ('Esc') and reverse focus cycling via 'Shift-Tab'. Also stop propagation\n * for the key code assigned for menu item selection ('Enter').\n *\n * @param {KeyboardEvent} event - KeyboardEvent.\n */\n function onKeydownMenu(event)\n {\n // Handle menu item keyCode selection.\n if (event.code === keyCode)\n {\n event.stopPropagation();\n return;\n }\n\n switch (event.code)\n {\n case 'Tab':\n event.stopPropagation();\n\n // Handle reverse focus cycling with `<Shift-Tab>`.\n if (event.shiftKey)\n {\n // Collect all focusable elements from `elementRoot` and ignore TJSFocusWrap.\n const allFocusable = A11yHelper.getFocusableElements(menuEl, s_IGNORE_CLASSES);\n\n // Find first and last focusable elements.\n const firstFocusEl = allFocusable.length > 0 ? allFocusable[0] : void 0;\n const lastFocusEl = allFocusable.length > 0 ? allFocusable[allFocusable.length - 1] : void 0;\n\n // Only cycle focus to the last keyboard focusable app element if `elementRoot` or first focusable\n // element is the active element.\n if (menuEl === document.activeElement || firstFocusEl === document.activeElement)\n {\n if (lastFocusEl instanceof HTMLElement && firstFocusEl !== lastFocusEl) { lastFocusEl.focus(); }\n\n event.preventDefault();\n }\n }\n\n break;\n\n default:\n // Any other key stop propagation preventing any global key handlers from responding.\n event.stopPropagation();\n break;\n }\n }\n\n /**\n * Handle key commands for closing the menu ('Esc') and reverse focus cycling via 'Shift-Tab'. Also stop propagation\n * for the key code assigned for menu item selection ('Enter').\n *\n * @param {KeyboardEvent} event - KeyboardEvent.\n */\n function onKeyupMenu(event)\n {\n switch (event.code)\n {\n case 'ContextMenu':\n case 'Escape':\n event.preventDefault();\n event.stopPropagation();\n\n if (!closed)\n {\n closed = true;\n dispatch('close');\n outroAndDestroy(local);\n\n A11yHelper.applyFocusSource(focusSource)\n focusSource = void 0;\n }\n break;\n }\n }\n\n /**\n * Handle key presses on menu items.\n *\n * @param {KeyboardEvent} event - KeyboardEvent.\n *\n * @param {TJSMenuItemData} item - Menu item data.\n */\n function onKeyupItem(event, item)\n {\n if (event.code === keyCode)\n {\n if (!closed)\n {\n closed = true;\n dispatch('close');\n outroAndDestroy(local);\n\n event.preventDefault();\n event.stopPropagation();\n }\n\n const callback = item?.onPress;\n if (typeof callback === 'function')\n {\n callback(item, { focusSource });\n }\n else\n {\n A11yHelper.applyFocusSource(focusSource)\n focusSource = void 0;\n }\n }\n }\n\n /**\n * Closes context menu when browser window is blurred.\n */\n function onWindowBlur()\n {\n if (!closed)\n {\n dispatch('close');\n closed = true;\n outroAndDestroy(local);\n\n A11yHelper.applyFocusSource(focusSource)\n focusSource = void 0;\n }\n }\n</script>\n\n<!-- bind to `document.body` to receive pointer down & scroll wheel events to close the context menu. -->\n<svelte:body on:pointerdown={onClose} on:wheel={(event) => onClose(event, true)}/>\n\n<!-- bind to 'window' to close context menu when browser window is blurred. -->\n<svelte:window on:blur={onWindowBlur}/>\n\n<nav id={id}\n class=tjs-context-menu\n bind:this={menuEl}\n on:click|preventDefault|stopPropagation={() => null}\n on:keydown|stopPropagation={onKeydownMenu}\n on:keyup|preventDefault|stopPropagation={onKeyupMenu}\n style:z-index={zIndex}\n transition:animate\n use:applyStyles={styles}\n tabindex=-1>\n\n <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->\n <ol class=tjs-context-menu-items role=menu>\n {#each items as item}\n {#if item['#type'] === 'class'}\n <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->\n <li class=tjs-context-menu-item\n on:click={() => onClick(item)}\n on:keyup={(event) => onKeyupItem(event, item)}\n role=menuitem\n tabindex=0>\n <span class=tjs-context-menu-focus-indicator />\n <svelte:component this={item.class} {...(isObject(item.props) ? item.props : {})} />\n </li>\n {:else if item['#type'] === 'icon'}\n <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->\n <li class=\"tjs-context-menu-item tjs-context-menu-item-button\"\n on:click={() => onClick(item)}\n on:keyup={(event) => onKeyupItem(event, item)}\n role=menuitem\n tabindex=0>\n <span class=tjs-context-menu-focus-indicator />\n <i class={item.icon}></i>\n <span class=tjs-context-menu-item-label>{localize(item.label)}</span>\n </li>\n {:else if item['#type'] === 'image'}\n <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->\n <li class=\"tjs-context-menu-item tjs-context-menu-item-button\"\n on:click={() => onClick(item)}\n on:keyup={(event) => onKeyupItem(event, item)}\n role=menuitem\n tabindex=0>\n <span class=tjs-context-menu-focus-indicator />\n <img src={item.image} alt={item.imageAlt}>\n <span class=tjs-context-menu-item-label>{localize(item.label)}</span>\n </li>\n {:else if item['#type'] === 'separator-hr'}\n <hr>\n {/if}\n {/each}\n </ol>\n <TJSFocusWrap elementRoot={menuEl} />\n</nav>\n\n<style>\n .tjs-context-menu {\n position: fixed;\n width: fit-content;\n height: max-content;\n overflow: hidden;\n\n background: var(--tjs-context-menu-background, var(--tjs-default-menu-background, var(--tjs-default-popup-background, #23221d)));\n border: var(--tjs-context-menu-border, var(--tjs-default-popover-border, 1px solid #000));\n border-radius: var(--tjs-context-menu-border-radius, var(--tjs-default-popover-border-radius, 5px));\n box-shadow: var(--tjs-context-menu-box-shadow, var(--tjs-default-popover-box-shadow, 0 0 10px #000));\n color: var(--tjs-context-menu-primary-color, var(--tjs-default-menu-primary-color, var(--tjs-default-popup-primary-color, #b5b3a4)));\n max-width: var(--tjs-context-menu-max-width, var(--tjs-default-menu-max-width, 360px));\n min-width: var(--tjs-context-menu-min-width, var(--tjs-default-menu-min-width, 20px));\n\n text-align: start;\n }\n\n .tjs-context-menu:focus-visible {\n outline: var(--tjs-default-a11y-outline-focus-visible, 2px solid transparent);\n }\n\n .tjs-context-menu-items {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n .tjs-context-menu-items hr {\n margin-block-start: 0;\n margin-block-end: 0;\n margin: var(--tjs-context-menu-hr-margin, var(--tjs-default-hr-margin, 0 0.25em));\n border-top: var(--tjs-context-menu-hr-border-top, var(--tjs-default-hr-border-top, 1px solid #555));\n border-bottom: var(--tjs-context-menu-hr-border-bottom, var(--tjs-default-hr-border-bottom, 1px solid #444));\n }\n\n .tjs-context-menu-item {\n display: flex;\n align-items: center;\n line-height: var(--tjs-context-menu-item-line-height, var(--tjs-default-menu-item-line-height, 2em));\n padding: var(--tjs-context-menu-item-padding, var(--tjs-default-menu-item-padding, 0 0.5em 0 0));\n }\n\n /* Disable default outline for focus visible / within */\n .tjs-context-menu-item:focus-within, .tjs-context-menu-item:focus-visible {\n outline: var(--tjs-default-a11y-outline-focus-visible, 2px solid transparent);\n }\n\n .tjs-context-menu-item i {\n text-align: center;\n width: var(--tjs-context-menu-item-icon-width, var(--tjs-default-menu-item-icon-width, 1.25em));\n }\n\n .tjs-context-menu-item img {\n width: var(--tjs-context-menu-item-image-width, var(--tjs-default-menu-item-image-width, 1.25em));\n height: var(--tjs-context-menu-item-image-height, var(--tjs-default-menu-item-image-height, 1.25em));\n }\n\n .tjs-context-menu-item-button {\n gap: var(--tjs-context-menu-item-button-gap, var(--tjs-default-menu-item-button-gap, 0.25em));\n }\n\n .tjs-context-menu-item-button:hover {\n color: var(--tjs-context-menu-item-highlight-color, var(--tjs-default-menu-highlight-color, var(--tjs-default-popup-highlight-color, #f0f0e0)));\n text-shadow: var(--tjs-context-menu-item-text-shadow-focus-hover, var(--tjs-default-text-shadow-focus-hover, 0 0 8px red));\n }\n\n .tjs-context-menu-item-button:focus-visible {\n color: var(--tjs-context-menu-item-highlight-color, var(--tjs-default-menu-highlight-color, var(--tjs-default-popup-highlight-color, #f0f0e0)));\n text-shadow: var(--tjs-context-menu-item-text-shadow-focus-hover, var(--tjs-default-text-shadow-focus-hover, 0 0 8px red));\n }\n\n .tjs-context-menu-focus-indicator {\n align-self: var(--tjs-context-menu-focus-indicator-align-self, var(--tjs-default-focus-indicator-align-self, stretch));\n border: var(--tjs-context-menu-focus-indicator-border, var(--tjs-default-focus-indicator-border));\n border-radius: var(--tjs-context-menu-focus-indicator-border-radius, var(--tjs-default-focus-indicator-border-radius, 0.1em));\n height: var(--tjs-context-menu-focus-indicator-height, var(--tjs-default-focus-indicator-height));\n width: var(--tjs-context-menu-focus-indicator-width, var(--tjs-default-focus-indicator-width, 0.25em));\n transition: var(--tjs-context-menu-focus-indicator-transition, var(--tjs-default-focus-indicator-transition));\n }\n\n .tjs-context-menu-item:focus-visible .tjs-context-menu-focus-indicator {\n background: var(--tjs-context-menu-focus-indicator-background, var(--tjs-default-focus-indicator-background, white));\n }\n\n /* Enable focus indicator for focus-within */\n /* Note: the use of `has` pseudo-selector that requires a child with :focus-visible */\n .tjs-context-menu-item:focus-within:has(:focus-visible) .tjs-context-menu-focus-indicator {\n background: var(--tjs-context-menu-focus-indicator-background, var(--tjs-default-focus-indicator-background, white));\n }\n\n /* Fallback for browsers that don't support 'has'; any user interaction including mouse will trigger */\n @supports not (selector(:has(*))) {\n .tjs-context-menu-item:focus-within .tjs-context-menu-focus-indicator {\n background: var(--tjs-context-menu-focus-indicator-background, var(--tjs-default-focus-indicator-background, white));\n }\n }\n\n .tjs-context-menu-item-label {\n overflow: var(--tjs-context-menu-item-label-overflow, var(--tjs-default-menu-item-label-overflow, hidden));\n text-overflow: var(--tjs-context-menu-item-label-text-overflow, var(--tjs-default-menu-item-label-text-overflow, ellipsis));\n white-space: var(--tjs-context-menu-item-label-white-space, var(--tjs-default-menu-item-label-white-space));\n }\n</style>\n","import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\n\nimport { FoundryStyles } from '@typhonjs-fvtt/svelte-standard/fvtt';\n\nimport { cssVariables } from '../internal/index.js'; // TODO: Figure out better build to use #internal again.\n\nexport * from './button/index.js';\nexport * from './color/index.js';\nexport * from './container/index.js';\nexport * from './editor/index.js';\nexport * from './folder/index.js';\nexport * from './form/index.js';\nexport * from './label/index.js';\nexport * from './layers/index.js';\nexport * from './menu/index.js';\nexport * from './settings/index.js';\n\n// -------------------------------------------------------------------------------------------------------------------\n\n/**\n * Assign all TyphonJS thematic CSS variables.\n */\n\ncssVariables.setProperties({\n // For components w/ transparent background checkered pattern.\n '--tjs-checkerboard-background-dark': 'rgb(205, 205, 205)',\n '--tjs-checkerboard-background-10': `url('data:image/svg+xml;utf8,<svg preserveAspectRatio=\"none\" viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"0\" y=\"0\" width=\"5\" height=\"5\" fill=\"transparent\" /><rect x=\"5\" y=\"5\" width=\"5\" height=\"5\" fill=\"transparent\" /><rect x=\"5\" y=\"0\" width=\"5\" height=\"5\" fill=\"white\" /><rect x=\"0\" y=\"5\" width=\"5\" height=\"5\" fill=\"white\" /></svg>') 0 0 / 10px 10px, var(--tjs-checkerboard-background-dark, rgb(205, 205, 205))`\n}, false);\n\n// -------------------------------------------------------------------------------------------------------------------\n\n/**\n * Assign all TyphonJS CSS variables to Foundry defaults.\n */\n\ncssVariables.setProperties({\n '--tjs-action-ripple-background': 'rgba(0, 0, 0, 0.35)'\n}, false);\n\n// -------------------------------------------------------------------------------------------------------------------\n\ncssVariables.setProperties({\n '--tjs-icon-button-background-hover': 'rgba(0, 0, 0, 0.10)',\n '--tjs-icon-button-background-selected': 'rgba(0, 0, 0, 0.20)',\n}, false);\n\n{\n /**\n * All input related components including: TJSSelect,\n */\n const props = FoundryStyles.getProperties('input[type=\"text\"], input[type=\"number\"]');\n\n if (typeof props === 'object')\n {\n cssVariables.setProperties({\n '--tjs-input-background': 'background' in props ? props.background : 'rgba(0, 0, 0, 0.05)',\n '--tjs-input-border': 'border' in props ? props.border : '1px solid var(--color-border-light-tertiary)',\n '--tjs-input-border-radius': 'border-radius' in props ? props['border-radius'] : '3px',\n '--tjs-input-height': 'height' in props ? props.height : 'var(--form-field-height)',\n '--tjs-input-min-width': 'min-width' in props ? props['min-width'] : '20px',\n '--tjs-input-padding': 'padding' in props ? props['padding'] : '1px 3px',\n '--tjs-input-width': 'width' in props ? props.width : 'calc(100% - 2px)',\n\n // Set default values that are only to be referenced and not set.\n '--_tjs-default-input-height': 'height' in props ? props.height : 'var(--form-field-height)',\n\n // Set directly / no lookup:\n '--tjs-input-border-color': 'var(--color-border-light-tertiary)',\n }, false);\n }\n}\n\ncssVariables.setProperties({\n // `popup` is for components that are slightly elevated, but connected to an application;\n // see: TJSMenu / TJSContextMenu / TJSColordPicker\n '--tjs-default-popup-background': 'var(--color-text-dark-header, #23221d)',\n '--tjs-default-popup-border': '1px solid var(--color-border-dark, #000)',\n '--tjs-default-popup-box-shadow': '0 0 2px var(--color-shadow-dark, #000)',\n '--tjs-default-popup-primary-color': 'var(--color-text-light-primary, #b5b3a4)',\n '--tjs-default-popup-highlight-color': 'var(--color-text-light-highlight, #f0f0e0)',\n\n // `popover` is for components that are elevated and independent; see: TJSContextMenu\n '--tjs-default-popover-border': '1px solid var(--color-border-dark, #000)',\n '--tjs-default-popover-box-shadow': '0 0 10px var(--color-shadow-dark, #000)',\n}, false);\n\n// Handle `PopOut!` module hooks to allow applications to popout to their own browser window -------------------------\n\nHooks.on('PopOut:loading', (app, popout) =>\n{\n if (app instanceof SvelteApplication)\n {\n // Clone and load `svelte-standard` CSS variables into new window document.\n popout.document.addEventListener('DOMContentLoaded', () => cssVariables.clone(popout.document));\n }\n});\n","<script>\r\n\r\n import { writable } from \"svelte/store\";\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { TJSMenu, TJSToggleLabel } from '@typhonjs-fvtt/svelte-standard/component';\r\n\r\n export let item;\r\n export let standalone = false;\r\n\r\n let labelText = \"\";\r\n\r\n const prices = item.prices;\r\n const itemFlagData = item.itemFlagData;\r\n const selectedPriceGroup = item.selectedPriceGroup;\r\n const priceSelector = standalone ? writable(\"\") : item.store.priceSelector;\r\n\r\n $: cantAfford = $prices.length > 0 && !$prices[$selectedPriceGroup]?.maxQuantity && item.store.recipient && !standalone;\r\n $: cantAffordMultiplePrices = cantAfford && !$prices.filter(group => group.maxQuantity).length;\r\n $: labelText = (standalone && $prices.length > 1 ? \"<i class=\\\"fas fa-edit\\\"></i> \" : \"\")\r\n + ($prices[$selectedPriceGroup]?.free\r\n ? localize(\"ITEM-PILES.Merchant.ItemFree\")\r\n : $prices[$selectedPriceGroup]?.basePriceString\r\n );\r\n\r\n</script>\r\n\r\n<div class=\"price-container\">\r\n\t{#if $prices.length > 1}\r\n\t\t<TJSToggleLabel>\r\n\t\t\t<div slot=left\r\n\t\t\t\t\t class:multiple-prices={$prices.length > 1 && !standalone}\r\n\t\t\t\t\t class:cant-afford={cantAfford}\r\n\t\t\t\t\t class:cant-afford-multiple-prices={cantAffordMultiplePrices}\r\n\t\t\t\t\t class:item-piles-clickable-link={$prices.length > 1}>\r\n\t\t\t\t<small>{@html labelText}</small>\r\n\t\t\t</div>\r\n\t\t\t<TJSMenu offset={{y: 4}}>\r\n\t\t\t\t<div class=\"price-list\">\r\n\t\t\t\t\t{#each $prices as priceGroup, index (index)}\r\n\t\t\t\t\t\t<div class=\"price-group\" class:selected={$selectedPriceGroup === index}>\r\n\t\t\t\t\t\t\t{#each priceGroup.prices.filter(price => price.cost) as price (price.id)}\r\n\t\t\t\t\t\t\t\t<div class=\"price-group-container\"\r\n\t\t\t\t\t\t\t\t\t\t on:click={() => {\r\n $selectedPriceGroup = index;\r\n $priceSelector = \"\";\r\n }}\r\n\t\t\t\t\t\t\t\t\t\t class:cant-afford={!priceGroup.maxQuantity && item.store.recipient}>\r\n\t\t\t\t\t\t\t\t\t<div class=\"item-piles-img-container\"\r\n\t\t\t\t\t\t\t\t\t\t\t class:not-for-sale={!price.maxQuantity && item.store.recipient}>\r\n\t\t\t\t\t\t\t\t\t\t<img class=\"item-piles-img\" src=\"{price.img}\"/>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t<div class=\"item-piles-name item-piles-text\">\r\n\t\t\t\t\t\t\t\t\t\t<small>{price.baseCost + (priceGroup.prices.length === 0 && price.percent ? \"%\" : \"\")} {price.name}</small>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t{/each}\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t{/each}\r\n\t\t\t\t</div>\r\n\t\t\t</TJSMenu>\r\n\t\t</TJSToggleLabel>\r\n\t{:else}\r\n\t\t<small class:cant-afford={cantAfford}>{@html labelText}</small>\r\n\t{/if}\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n .price-container {\r\n align-items: center;\r\n position: relative;\r\n --tjs-label-justify-content: flex-start;\r\n --tjs-label-overflow: visible;\r\n --tjs-menu-primary-color: black;\r\n --tjs-menu-color: black;\r\n --tjs-menu-border: 1px solid #444;\r\n --tjs-menu-box-shadow: 0 6px 9px -1px rgba(0, 0, 0, 0.5);\r\n display: flex;\r\n justify-content: center;\r\n height: 100%;\r\n\r\n small {\r\n padding-left: 2px;\r\n }\r\n\r\n span {\r\n justify-content: flex-start;\r\n }\r\n\r\n .cant-afford {\r\n opacity: 0.5;\r\n }\r\n\r\n .multiple-prices {\r\n overflow: visible;\r\n }\r\n\r\n .multiple-prices::before,\r\n .multiple-prices::after {\r\n content: '';\r\n position: absolute;\r\n top: -0.2rem;\r\n left: -0.2rem;\r\n border-color: transparent;\r\n border-style: solid;\r\n }\r\n\r\n .multiple-prices::after {\r\n border-width: 0.3rem;\r\n border-right-color: #3ead2c;\r\n transform: rotate(45deg);\r\n }\r\n\r\n .cant-afford-multiple-prices::after {\r\n border-right-color: #cf5234;\r\n }\r\n\r\n }\r\n</style>\r\n","<script>\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n import { getContext } from \"svelte\";\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\n import { get } from \"svelte/store\";\n import * as PileUtilities from \"../../../helpers/pile-utilities.js\";\n import PriceSelector from \"../../components/PriceSelector.svelte\";\n\n const { application } = getContext('#external');\n\n export let item;\n export let seller;\n export let buyer;\n export let settings;\n export let elementRoot;\n export let store = item.store;\n\n const itemNameStore = item.name;\n const itemImg = item.img;\n const itemInfiniteQuantity = item.infiniteQuantity;\n const itemRarityColor = item.rarityColor;\n const itemFlagData = item.itemFlagData;\n const quantityToBuy = item.quantityToBuy;\n const itemMaxQuantityStore = item.quantity;\n const itemQuantityForPriceStore = item.quantityForPrice;\n const prices = item.prices;\n\n const sellerPileData = store.pileData;\n const buyerPileData = store.recipientPileData;\n\n let maxItemPurchaseQuantity;\n let currentQuantityToBuy;\n\n const selectedPriceGroup = item.selectedPriceGroup;\n $: {\n $selectedPriceGroup;\n currentQuantityToBuy = 1;\n $quantityToBuy = 1;\n }\n\n let paymentData = {};\n $: {\n paymentData = PileUtilities.getPaymentData({\n purchaseData: [{\n item: item.item,\n quantity: $quantityToBuy,\n paymentIndex: $selectedPriceGroup\n }],\n seller,\n buyer,\n sellerFlagData: $sellerPileData,\n buyerFlagData: $buyerPileData,\n });\n }\n\n $: maxSellerItemQuantity = $itemInfiniteQuantity ? Infinity : Math.ceil($itemMaxQuantityStore / $itemQuantityForPriceStore);\n $: maxItemQuantity = $prices[$selectedPriceGroup]?.maxQuantity ?? Infinity;\n $: maxItemPurchaseQuantity = Math.min(maxItemQuantity, maxSellerItemQuantity);\n $: itemName = localize($itemNameStore) + ($itemQuantityForPriceStore > 1 ? ` (${$itemQuantityForPriceStore})` : \"\");\n\n function submit() {\n game.itempiles.API.tradeItems(seller, buyer, [{\n item: item.item,\n paymentIndex: get(selectedPriceGroup),\n quantity: get(quantityToBuy),\n }], {\n interactionId: store.interactionId\n });\n application.options.resolve();\n application.close();\n }\n\n</script>\n\n<svelte:options accessors={true}/>\n\n<ApplicationShell bind:elementRoot>\n\t<div>\n\n\t\t<div style=\"display: grid; grid-template-columns: 1fr 0.75fr; margin-bottom: 0.5rem;\">\n\t\t\t<div style=\"display:flex; align-items: center; font-size:1rem; grid-row: 1;\">\n\t\t\t\t<div class=\"item-piles-img-container\" style=\"margin-right: 0.25rem;\">\n\t\t\t\t\t<img class=\"item-piles-img\" src={$itemImg}/>\n\t\t\t\t</div>\n\t\t\t\t<span style=\"color: {$itemRarityColor || 'inherit'};\">{itemName}</span>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tstyle=\"display:flex; justify-content:flex-end; align-items: center; text-align: right;\">\n\t\t\t\t{#if paymentData.canBuy}\n\t\t\t\t\t<div style=\"display: flex; flex-direction: column; align-items: flex-end; margin-right: 0.5rem;\">\n\t\t\t\t\t\t<small>{localize(\"ITEM-PILES.Applications.TradeMerchantItem.Quantity\")}</small>\n\t\t\t\t\t\t<small style=\"font-style:italic;\">\n\t\t\t\t\t\t\t({localize(\"ITEM-PILES.Applications.TradeMerchantItem.MaxQuantity\", {\n quantity: maxItemPurchaseQuantity\n })})\n\t\t\t\t\t\t</small>\n\t\t\t\t\t</div>\n\t\t\t\t\t<input style=\"max-width: 40px; max-height: 24px;\" type=\"number\" bind:value={currentQuantityToBuy} on:change={(evt) => {\n $quantityToBuy = Math.max(1, Math.min(currentQuantityToBuy, maxItemPurchaseQuantity));\n currentQuantityToBuy = $quantityToBuy;\n }}/>\n\t\t\t\t{:else}\n\t\t\t\t\t<small>\n\t\t\t\t\t\t{localize(...paymentData.reason)}\n\t\t\t\t\t</small>\n\t\t\t\t{/if}\n\t\t\t</div>\n\t\t\t<div style=\"margin-top: 0.25rem; display: flex; align-items: flex-start;\">\n\t\t\t\t<PriceSelector {item} standalone/>\n\t\t\t</div>\n\t\t\t<div style=\"margin-right: 0.25rem; text-align: right;\">\n\t\t\t\t{#if paymentData.canBuy && $quantityToBuy > 1 && paymentData.primary}\n\t\t\t\t\t<small>{paymentData.basePriceString}</small>\n\t\t\t\t\t<!-- `ITEM-PILES.Applications.TradeMerchantItem.${settings.selling ? \"They\" : \"You\"}CantAfford` -->\n\t\t\t\t{/if}\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"item-piles-bottom-divider\" style=\"display: grid; grid-template-columns: auto auto;\">\n\n\t\t\t<strong class=\"item-piles-bottom-divider\" style=\"margin-bottom:0.25rem; padding-bottom:0.25rem;\">\n\t\t\t\t{localize(\"ITEM-PILES.Applications.TradeMerchantItem.\" + (settings.selling ? \"YouReceive\" : \"YouPay\"))}:\n\t\t\t</strong>\n\n\t\t\t<strong class=\"item-piles-bottom-divider item-piles-text-right\"\n\t\t\t\t\t\t\tstyle=\"margin-bottom:0.25rem; padding-bottom:0.25rem;\">\n\t\t\t\t{localize(\"ITEM-PILES.Applications.TradeMerchantItem.\" + (settings.selling ? \"TheyReceive\" : \"YouReceive\"))}:\n\t\t\t</strong>\n\n\t\t\t<div>\n\t\t\t\t{#each paymentData.finalPrices as price}\n\t\t\t\t\t{#if price.quantity}\n\t\t\t\t\t\t<div style=\"display:flex; align-items: center;\">\n\t\t\t\t\t\t\t<div class=\"item-piles-img-container\" style=\"margin-right: 0.25rem;\">\n\t\t\t\t\t\t\t\t<img class=\"item-piles-img\" src={price.img}/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<span>{price.quantity} {localize(price.name)}</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t{/if}\n\t\t\t\t{/each}\n\t\t\t</div>\n\n\t\t\t<div style=\"display:flex; flex-direction: column; align-items: flex-end;\">\n\t\t\t\t{#each paymentData.buyerReceive as price}\n\t\t\t\t\t<div style=\"display:flex; align-items: center;\">\n\t\t\t\t\t\t<span>{price.quantity > 1 ? price.quantity + \" \" : \"\"}{price.name}</span>\n\t\t\t\t\t\t<div class=\"item-piles-img-container\" style=\"margin-left: 0.25rem;\">\n\t\t\t\t\t\t\t<img class=\"item-piles-img\" src={price.img}/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t{/each}\n\t\t\t\t{#if paymentData.buyerChange.length}\n <span class=\"item-piles-small-text item-piles-text-right\" style=\"margin-right: 0.25rem; margin-top: 0.5rem;\">\n {localize(\"ITEM-PILES.Applications.TradeMerchantItem.Change\")}:\n </span>\n\t\t\t\t\t{#each paymentData.buyerChange as change}\n\t\t\t\t\t\t{#if change.quantity}\n\t\t\t\t\t\t\t<div style=\"display:flex; align-items: center;\">\n\t\t\t\t\t\t\t\t<span>{change.quantity} {localize(change.name)}</span>\n\t\t\t\t\t\t\t\t<div class=\"item-piles-img-container\" style=\"margin-left: 0.25rem;\">\n\t\t\t\t\t\t\t\t\t<img class=\"item-piles-img\" src={change.img}/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{/if}\n\t\t\t\t\t{/each}\n\t\t\t\t{/if}\n\t\t\t</div>\n\n\t\t</div>\n\n\t\t<footer class=\"sheet-footer item-piles-flexrow\">\n\t\t\t<button disabled={!paymentData.canBuy} on:click|once={ () => { submit() } } type=\"button\">\n\t\t\t\t{#if settings.selling}\n\t\t\t\t\t<i class=\"fas fa-hand-holding-usd\"></i> {localize(\"ITEM-PILES.Applications.TradeMerchantItem.SellItem\")}\n\t\t\t\t{:else}\n\t\t\t\t\t<i class=\"fas fa-shopping-cart\"></i> {localize(\"ITEM-PILES.Applications.TradeMerchantItem.BuyItem\")}\n\t\t\t\t{/if}\n\t\t\t</button>\n\n\t\t\t<button on:click|once={() => { application.close() }} type=\"button\">\n\t\t\t\t<i class=\"fas fa-times\"></i>\n\t\t\t\t{localize(\"Cancel\")}\n\t\t\t</button>\n\t\t</footer>\n\n\t</div>\n\n</ApplicationShell>\n\n<style lang=\"scss\">\n\n .highlight {\n box-shadow: inset 0 0 13px 5px rgba(255, 117, 0, 0.73);\n }\n\n</style>\n","import TradeMerchantItemDialogShell from \"./trade-merchant-item-dialog-shell.svelte\";\r\nimport { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport { get } from \"svelte/store\";\r\nimport { getActiveApps } from \"../../../helpers/helpers\";\r\n\r\nexport default class TradeMerchantItemDialog extends SvelteApplication {\r\n\r\n /**\r\n *\r\n * @param item\r\n * @param seller\r\n * @param buyer\r\n * @param settings\r\n * @param options\r\n */\r\n constructor(item, seller, buyer, settings = {}, options = {}) {\r\n super({\r\n id: `item-pile-buy-item-dialog-${item.id}-${seller.id}-${buyer.id}-${randomID()}`,\r\n title: game.i18n.format(\"ITEM-PILES.Applications.TradeMerchantItem.Title\", { item_name: get(item.name) }),\r\n svelte: {\r\n class: TradeMerchantItemDialogShell,\r\n target: document.body,\r\n props: {\r\n item,\r\n seller,\r\n buyer,\r\n settings\r\n }\r\n },\r\n close: () => this.options.resolve?.(null),\r\n ...options\r\n });\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n width: 330,\r\n height: \"auto\",\r\n classes: [\"item-piles-app\"]\r\n })\r\n }\r\n\r\n static getActiveApps(id) {\r\n return getActiveApps(`item-pile-buy-item-dialog-${id}`);\r\n }\r\n\r\n static async show(item, seller, buyer, settings = {}, options = {}) {\r\n const apps = this.getActiveApps(item.uuid + \"-\" + seller.uuid + \"-\" + buyer.uuid);\r\n if (apps.length) {\r\n for (let app of apps) {\r\n app.render(false, { focus: true });\r\n }\r\n return;\r\n }\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(item, seller, buyer, settings, options).render(true, { focus: true });\r\n })\r\n }\r\n\r\n}\r\n","<script>\r\n\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n\r\n export let item;\r\n export let data;\r\n\r\n const doc = item.itemDocument;\r\n\r\n let text;\r\n\r\n $: value = data.path ? getProperty($doc, data.path) ?? \"\" : \"\";\r\n $: {\r\n let localized = localize(`${data.mapping?.[value] ?? value}`);\r\n text = data.formatting ? data.formatting.replace(\"{#}\", localized) : localized;\r\n }\r\n\r\n</script>\r\n\r\n<div>\r\n\t<span>{@html text}</span>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n div {\r\n padding: 0 10px;\r\n text-align: center;\r\n height: 100%;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n flex: 1;\r\n font-size: smaller;\r\n }\r\n\r\n</style>\r\n","<script>\r\n\r\n export let item;\r\n export let showX = false;\r\n\r\n const store = item.store;\r\n const displayQuantityStore = item.displayQuantity;\r\n const infiniteQuantityStore = item.infiniteQuantity;\r\n const quantityStore = item.quantity;\r\n\r\n let showEditQuantity = false;\r\n $: editQuantity = $quantityStore;\r\n\r\n</script>\r\n\r\n<div>\r\n\t{#if $displayQuantityStore && item.canStack}\r\n\t\t{#if $infiniteQuantityStore}\r\n\t\t\t<span>∞</span>\r\n\t\t{:else if showEditQuantity}\r\n\t\t\t<input\r\n\t\t\t\tstyle=\"height: 18px; max-width: 35px;\"\r\n\t\t\t\ttype=\"text\"\r\n\t\t\t\tbind:value={editQuantity}\r\n\t\t\t\tautofocus\r\n\t\t\t\ton:change={() => {\r\n showEditQuantity = false;\r\n item.updateQuantity(editQuantity);\r\n }}\r\n\t\t\t\ton:keydown={(evt) => {\r\n if (evt.key === \"Enter\") showEditQuantity = false;\r\n }}\r\n\t\t\t/>\r\n\t\t{:else if !showEditQuantity}\r\n <span\r\n\t\t\t\t\tclass:item-piles-clickable-link={game.user.isGM}\r\n\t\t\t\t\ton:click={() => {\r\n if (game.user.isGM) showEditQuantity = true;\r\n }}>{showX ? \"x\" : \"\"}{$quantityStore}</span\r\n\t\t\t\t>\r\n\t\t{/if}\r\n\t{/if}\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n div {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n padding: 0 10px;\r\n text-align: center;\r\n min-height: 28px;\r\n height: 100%;\r\n }\r\n</style>\r\n","<script>\r\n\r\n import QuantityColumn from \"./QuantityColumn.svelte\";\r\n\r\n export let item;\r\n export let showQuantity = false;\r\n\r\n const itemNameStore = item.name;\r\n const itemImage = item.img;\r\n const itemRarityColor = item.rarityColor;\r\n const itemQuantityForPrice = item.quantityForPrice;\r\n\r\n const store = item.store;\r\n const pileData = store.pileData;\r\n const displayQuantityStore = item.displayQuantity;\r\n const infiniteQuantityStore = item.infiniteQuantity;\r\n const quantityStore = item.quantity;\r\n const itemFlagDataStore = item.itemFlagData;\r\n\r\n $: itemFlagData = $itemFlagDataStore;\r\n $: displayQuantity = $displayQuantityStore;\r\n $: infiniteQuantity = $infiniteQuantityStore;\r\n\r\n $: quantity = $quantityStore;\r\n $: editQuantity = $quantityStore;\r\n $: itemName = $itemNameStore + ($itemQuantityForPrice > 1 ? ` (${$itemQuantityForPrice})` : \"\");\r\n\r\n const displayControlButtons = store.actor.isOwner;\r\n const displayBuyButton = !!store.recipient;\r\n\r\n</script>\r\n\r\n<div class=\"item-piles-merchant-item-container\"\r\n\t\t class:merchant-item-hidden={itemFlagData.hidden}>\r\n\r\n\t<div\r\n\t\tclass=\"item-piles-img-container\"\r\n\t\tclass:not-for-sale={itemFlagData.notForSale || !quantity}\r\n\t\tdata-fast-tooltip={itemFlagData.notForSale ? \"Not for sale\" : \"\"}\r\n\t>\r\n\t\t<img class=\"item-piles-img\" src={$itemImage}/>\r\n\t</div>\r\n\r\n\t<div class=\"item-piles-name item-piles-text\">\r\n\t\t<div class=\"item-piles-name-container\">\r\n\t\t\t<span style=\"color: {$itemRarityColor || 'inherit'};\">\r\n\t\t\t\t{#if $pileData.canInspectItems || game.user.isGM}\r\n\t\t\t\t\t<a class=\"item-piles-clickable\" on:click={() => { item.preview() }}>\r\n\t\t\t\t\t\t{itemName}\r\n\t\t\t\t\t</a>\r\n\t\t\t\t{:else}\r\n\t\t\t\t\t{itemName}\r\n\t\t\t\t{/if}\r\n\t\t\t</span>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t{#if showQuantity}\r\n\t\t<div class=\"item-piles-quantity-container\">\r\n\t\t\t<QuantityColumn {item} showX/>\r\n\t\t</div>\r\n\t{/if}\r\n\r\n\t<slot name=\"right\"/>\r\n\r\n</div>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-piles-merchant-item-container {\r\n display: flex;\r\n border-top-left-radius: 5px;\r\n border-bottom-left-radius: 5px;\r\n }\r\n\r\n .merchant-item-hidden > * {\r\n font-style: italic;\r\n opacity: 0.5;\r\n }\r\n\r\n .item-piles-name {\r\n flex: 0 1 auto;\r\n }\r\n\r\n .item-piles-quantity-container {\r\n flex: 1;\r\n }\r\n\r\n</style>\r\n","import { TJSDocument } from \"@typhonjs-fvtt/runtime/svelte/store\";\nimport { get, writable } from \"svelte/store\";\nimport CONSTANTS from \"../../constants/constants.js\";\nimport * as PileUtilities from \"../../helpers/pile-utilities.js\";\nimport { getItemCost } from \"../../helpers/utilities.js\";\n\nconst existingStores = new Map();\n\nexport default class ItemPriceStore {\n\n constructor(item) {\n\n this.item = item;\n this.itemDoc = new TJSDocument(this.item);\n\n const quantityForPriceProp = game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE;\n\n this.price = writable(0);\n this.quantityForPrice = writable(getProperty(item, quantityForPriceProp) ?? 1);\n\n const data = PileUtilities.getItemFlagData(this.item);\n\n data.prices.forEach(group => {\n group.forEach(price => {\n if (!price.id) {\n price.id = randomID();\n }\n });\n });\n\n this.data = writable(data);\n\n this.itemDoc.subscribe((item, changes) => {\n const { data } = changes;\n if (hasProperty(data, CONSTANTS.FLAGS.ITEM)) {\n const newData = getProperty(data, CONSTANTS.FLAGS.ITEM);\n const oldData = get(this.data);\n this.data.set(foundry.utils.mergeObject(oldData, newData));\n }\n this.price.set(getItemCost(this.item));\n const quantityForPriceProp = game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE;\n if (quantityForPriceProp && hasProperty(data, quantityForPriceProp)) {\n this.quantityForPrice.set(getProperty(item, quantityForPriceProp))\n }\n });\n\n }\n\n static make(item) {\n if (existingStores.has(item.id)) {\n return existingStores.get(item.id);\n }\n return new this(item);\n }\n\n removeGroup(groupIndex) {\n const data = get(this.data);\n data.prices.splice(groupIndex, 1);\n this.data.set(data);\n }\n\n export() {\n const data = {\n data: {\n [game.itempiles.API.ITEM_PRICE_ATTRIBUTE]: get(this.price),\n },\n flags: get(this.data)\n };\n if (game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE) {\n data[\"data\"][game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE] = get(this.quantityForPrice);\n }\n return data;\n }\n\n}\n","<script>\r\n\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import { custom_notify } from \"../../helpers/helpers.js\";\r\n import { writable } from \"svelte/store\";\r\n\r\n export let macro;\r\n\r\n let macros = writable([]);\r\n\r\n const id = randomID() + \"-list\";\r\n\r\n function filterMacros() {\r\n\r\n let allResults = Array.from(game.macros)\r\n .map(m => ({\r\n id: m.id,\r\n name: m.name\r\n }));\r\n\r\n const compendiums = Array.from(game.packs)\r\n .filter(pack => pack.documentName === \"Macro\")\r\n .map(pack => ({\r\n id: pack.metadata.id,\r\n name: \"Compendium.\" + pack.metadata.id\r\n }))\r\n\r\n allResults = allResults.concat(compendiums);\r\n\r\n allResults = allResults.filter(m => {\r\n return m.name.toLowerCase().includes(macro.toLowerCase()) || !macro\r\n })\r\n\r\n if (macro.startsWith(\"Compendium.\") && allResults.length === 1) {\r\n allResults = Array.from(game.packs.get(allResults[0].id).index).map(m => {\r\n return {\r\n id: allResults[0].id + \".\" + m._id,\r\n name: allResults[0].name + \".\" + m.name\r\n }\r\n });\r\n }\r\n\r\n macros.set(allResults);\r\n\r\n }\r\n\r\n async function openMacro() {\r\n\r\n // Credit to Otigon, Zhell, Gazkhan and MrVauxs for the code in this section\r\n if (macro.startsWith(\"Compendium\")) {\r\n let packArray = macro.split(\".\");\r\n let pack = game.packs.get(`${packArray[1]}.${packArray[2]}`);\r\n if (!pack) {\r\n custom_notify(`Compendium ${packArray[1]}.${packArray[2]} was not found`);\r\n return;\r\n }\r\n let macroFilter = pack.index.filter((m) => m.name === packArray[3]);\r\n if (!macroFilter.length) {\r\n custom_notify(`A macro named ${packArray[3]} was not found in Compendium ${packArray[1]}.${packArray[2]}`);\r\n return;\r\n }\r\n let macroDocument = await pack.getDocument(macroFilter[0]._id);\r\n macroDocument.sheet.render(true);\r\n } else {\r\n if (!macro) {\r\n return;\r\n }\r\n let getTest = game.macros.getName(macro);\r\n if (!getTest) {\r\n custom_notify(`Could not find the macro named ${macro}`);\r\n return;\r\n }\r\n game.macros.getName(macro).sheet.render(true);\r\n }\r\n\r\n }\r\n\r\n filterMacros();\r\n\r\n</script>\r\n\r\n<div class=\"item-piles-flexrow\">\r\n\t<input bind:value={macro}\r\n\t\t\t\t list={id}\r\n\t\t\t\t on:change={() => { filterMacros() }}\r\n\t\t\t\t on:keyup={() => { filterMacros() }}\r\n\t\t\t\t placeholder={localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.MacroPlaceholder\")}\r\n\t\t\t\t style=\"flex:1; margin-right:5px;\"\r\n\t\t\t\t type=\"text\"\r\n\t/>\r\n\t<datalist id={id}>\r\n\t\t{#each $macros as m (m.id)}\r\n\t\t\t<option value={m.name}>{m.text ?? \"\"}</option>\r\n\t\t{/each}\r\n\t</datalist>\r\n\t<i\r\n\t\tclass=\"fas fa-edit item-piles-clickable-link\"\r\n\t\tdata-fast-tooltip=\"Open Macro\"\r\n\t\ton:click={() => openMacro()}\r\n\t\tstyle=\"margin-top: 5px; font-size: 1rem; flex:0;\"\r\n\t></i>\r\n</div>\r\n","<script>\r\n\r\n import { writable } from \"svelte/store\";\r\n import * as Helpers from \"../../helpers/helpers.js\";\r\n import { openEditor } from \"../../helpers/helpers.js\";\r\n import SETTINGS from \"../../constants/settings.js\";\r\n\r\n export let value;\r\n export let placeholder = \"\";\r\n\r\n async function showCustomItemCategoryEditor() {\r\n openEditor(SETTINGS.CUSTOM_ITEM_CATEGORIES).then((result) => {\r\n Helpers.setSetting(SETTINGS.CUSTOM_ITEM_CATEGORIES, Array.from(new Set(result)));\r\n currentCustomCategories.set(Helpers.getSetting(SETTINGS.CUSTOM_ITEM_CATEGORIES));\r\n })\r\n }\r\n\r\n let currentCustomCategories = writable(Array.from(new Set(Helpers.getSetting(SETTINGS.CUSTOM_ITEM_CATEGORIES))));\r\n\r\n const id = randomID();\r\n\r\n</script>\r\n\r\n<div class=\"item-piles-flexrow\" style=\"align-items: center;\">\r\n\t<input bind:value list={\"item-editor-list-\"+id} placeholder={placeholder} type=\"text\"/>\r\n\t<a on:click={() => showCustomItemCategoryEditor()} style=\"flex: 0; margin: 0 0.5rem;\"><i\r\n\t\tclass=\"fas fa-cog\"></i></a>\r\n\t{#if $currentCustomCategories.length}\r\n\t\t<datalist id={\"item-editor-list-\"+id}>\r\n\t\t\t{#each $currentCustomCategories as category}\r\n\t\t\t\t<option>{category}</option>\r\n\t\t\t{/each}\r\n\t\t</datalist>\r\n\t{/if}\r\n</div>\r\n","<script>\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import * as Helpers from \"../../helpers/helpers.js\";\r\n import * as PileUtilities from \"../../helpers/pile-utilities.js\";\r\n import ItemPriceStore from \"./ItemPriceStore.js\";\r\n import Tabs from \"../components/Tabs.svelte\";\r\n import PriceList from \"../components/PriceList.svelte\";\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import MacroSelector from \"../components/MacroSelector.svelte\";\r\n import { get, writable } from \"svelte/store\";\r\n import SETTINGS from \"../../constants/settings.js\";\r\n import CustomCategoryInput from \"../components/CustomCategoryInput.svelte\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let item;\r\n export let elementRoot;\r\n\r\n let store = ItemPriceStore.make(item);\r\n\r\n let currentCustomCategories = writable(Array.from(new Set(Helpers.getSetting(SETTINGS.CUSTOM_ITEM_CATEGORIES))));\r\n\r\n const flagDataStore = store.data;\r\n let price = store.price;\r\n let quantityForPrice = store.quantityForPrice;\r\n let oldPrice = get(price);\r\n\r\n $: itemFlagData = $flagDataStore;\r\n\r\n let form;\r\n\r\n async function updateSettings() {\r\n const flagData = store.export();\r\n if (flagData.flags.customCategory) {\r\n let customCategories = get(currentCustomCategories);\r\n customCategories.push(flagData.flags.customCategory)\r\n await Helpers.setSetting(SETTINGS.CUSTOM_ITEM_CATEGORIES, Array.from(new Set(customCategories)));\r\n }\r\n await PileUtilities.updateItemData(item, flagData);\r\n application.options.resolve();\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n function addGroup() {\r\n itemFlagData.prices = [\r\n ...itemFlagData.prices,\r\n []\r\n ]\r\n }\r\n\r\n let activeTab = \"general\";\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<form autocomplete=off bind:this={form} class=\"item-piles-config-container\" on:submit|preventDefault={updateSettings}>\r\n\r\n\t\t<Tabs bind:activeTab tabs={[\r\n { value: \"general\", label: localize(\"ITEM-PILES.Applications.ItemEditor.General\") },\r\n { value: \"price\", label: localize(\"ITEM-PILES.Applications.ItemEditor.Price\") },\r\n { value: \"vault\", label: localize(\"ITEM-PILES.Applications.ItemEditor.Vault\") },\r\n ]}/>\r\n\r\n\t\t<section class=\"tab-body\">\r\n\r\n\t\t\t<div class=\"tab flex\">\r\n\r\n\t\t\t\t{#if activeTab === 'general'}\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.CustomCategory\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.CustomCategoryExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<div style=\"flex: 4;\">\r\n\t\t\t\t\t\t\t<CustomCategoryInput bind:value={itemFlagData.customCategory} placeholder={item.type}/>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.Hidden\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.HiddenExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={itemFlagData.hidden}/>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.NotForSale\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.NotForSaleExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={itemFlagData.notForSale}/>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.CantBeSoldToMerchants\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.CantBeSoldToMerchantsExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={itemFlagData.cantBeSoldToMerchants}/>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.InfiniteQuantity\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.InfiniteQuantityExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<select style=\"flex: 0 1 auto;\" bind:value={itemFlagData.infiniteQuantity}>\r\n\t\t\t\t\t\t\t<option value=\"default\">\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.InfiniteQuantityDefault\")}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t<option value=\"yes\">\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.InfiniteQuantityYes\")}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t<option value=\"no\">\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.InfiniteQuantityNo\")}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemEditor.KeepZero\")}</span>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.KeepZeroExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={itemFlagData.keepZeroQuantity}/>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemEditor.KeepOnMerchant\")}</span>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.KeepOnMerchantExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={itemFlagData.keepOnMerchant}/>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.DisplayQuantity\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.DisplayQuantityExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<select style=\"flex: 0 1 auto;\" bind:value={itemFlagData.displayQuantity}>\r\n\t\t\t\t\t\t\t<option value=\"default\">\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.DisplayQuantityDefault\")}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t<option value=\"yes\">\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.DisplayQuantityYes\")}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t<option value=\"no\">\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.DisplayQuantityNo\")}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.Service\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.ServiceExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={itemFlagData.isService}/>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemEditor.PurchaseMacro\")}</span>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.PurchaseMacroExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<MacroSelector bind:macro={itemFlagData.macro}/>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t\t{#if activeTab === 'price'}\r\n\r\n\t\t\t\t\t{#if game.system.id !== \"pf2e\"}\r\n\t\t\t\t\t\t{#if game.system.id !== \"wfrp4e\"}\r\n\t\t\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.BasePrice\")}<br>\r\n\t\t\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.BasePriceExplanation\")}</p>\r\n\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t<input type=\"text\" bind:value={$price} on:change={() => {\r\n const forceNumber = game.system.id === \"dnd5e\";\r\n\t\t\t\t\t\t\t\tconst isPriceNumber = !isNaN(Number($price));\r\n $price = isPriceNumber || forceNumber\r\n \t? Math.max(0, isPriceNumber ? Number($price) : oldPrice)\r\n \t: $price;\r\n oldPrice = $price;\r\n }}/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.QuantityForPrice\")}<br>\r\n\t\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.QuantityForPriceExplanation\")}</p>\r\n\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t<input type=\"number\" bind:value={$quantityForPrice}/>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.Free\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.FreeExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={itemFlagData.free}/>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.DisableNormalCost\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.DisableNormalCostExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={itemFlagData.disableNormalCost}/>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.PurchaseOptions\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.PurchaseOptionsExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\r\n\t\t\t\t\t\t<button type=\"button\" on:click={() => { addGroup() }}>\r\n\t\t\t\t\t\t\t<i class=\"fas fa-plus\"></i>\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.AddPurchaseOption\")}\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t{#if itemFlagData.prices.length}\r\n\t\t\t\t\t\t{#each itemFlagData.prices as prices, groupIndex (groupIndex)}\r\n\t\t\t\t\t\t\t<PriceList {item} bind:prices={prices} remove={() => { store.removeGroup(groupIndex) }}/>\r\n\t\t\t\t\t\t{/each}\r\n\t\t\t\t\t{/if}\r\n\r\n\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t\t{#if activeTab === 'vault'}\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.CanStack\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.CanStackExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<select style=\"flex: 0 1 auto;\" bind:value={itemFlagData.canStack}>\r\n\t\t\t\t\t\t\t<option value=\"default\">\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.CanStackDefault\")}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t<option value=\"yes\">\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.CanStackYes\")}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t<option value=\"no\">\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.CanStackNo\")}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.VaultExpander\")}<br>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.VaultExpanderExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={itemFlagData.vaultExpander}/>\r\n\t\t\t\t\t</div>\r\n\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:6;\">\r\n\t\t\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemEditor.ExpandColumnsRows\")}</span>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemEditor.ExpandColumnsRowsExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<div class=\"item-piles-grid-columns\" style=\"flex: 3;\">\r\n\t\t\t\t\t\t\t<div style=\"text-align: center; font-size: 0.7rem;\">\r\n\t\t\t\t\t\t\t\t<i>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.Columns\")}</i>\r\n\t\t\t\t\t\t\t\t<i>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.Rows\")}</i>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t<div style=\"align-items: center;\">\r\n\t\t\t\t\t\t\t\t<input style=\"text-align: right;\" type=\"number\" placeholder=\"Enter a number...\"\r\n\t\t\t\t\t\t\t\t\t\t\t bind:value={itemFlagData.addsCols}/>\r\n\t\t\t\t\t\t\t\t<span style=\"flex: 0;\">x</span>\r\n\t\t\t\t\t\t\t\t<input type=\"number\" placeholder=\"Enter a number...\" bind:value={itemFlagData.addsRows}/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</section>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"ITEM-PILES.Applications.ItemEditor.Update\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n\r\n</ApplicationShell>\r\n\r\n<style lang=\"scss\">\r\n\r\n .tab {\r\n max-height: 500px;\r\n overflow-y: auto;\r\n overflow-x: hidden;\r\n }\r\n\r\n table {\r\n\r\n td {\r\n vertical-align: middle;\r\n }\r\n\r\n tr {\r\n\r\n &.is-active {\r\n background-color: #3273dc;\r\n color: #fff;\r\n }\r\n\r\n &.is-dragging {\r\n background-color: rgba(50, 220, 132, 0.55);\r\n color: #fff;\r\n }\r\n }\r\n\r\n .small {\r\n width: 26px;\r\n }\r\n\r\n button {\r\n padding: 0.25rem 0.25rem;\r\n line-height: 1rem;\r\n flex: 0;\r\n text-align: center;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n }\r\n\r\n a {\r\n text-align: center;\r\n }\r\n }\r\n\r\n .item-piles-grid-columns {\r\n display: flex;\r\n flex-direction: column;\r\n\r\n & > div {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n\r\n & > * {\r\n flex: 1;\r\n margin: 0 0.25rem;\r\n }\r\n\r\n & > span {\r\n flex: 0;\r\n }\r\n }\r\n }\r\n\r\n</style>\r\n","import ItemEditorShell from './item-editor-shell.svelte';\r\nimport { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport { getActiveApps } from '../../helpers/helpers';\r\n\r\nexport default class ItemEditor extends SvelteApplication {\r\n\r\n constructor(item = false, options) {\r\n super({\r\n id: `item-pile-item-editor-${item.id}-${randomID()}`,\r\n title: game.i18n.format(\"ITEM-PILES.Applications.ItemEditor.Title\", { item_name: item.name }),\r\n svelte: {\r\n class: ItemEditorShell,\r\n target: document.body,\r\n props: {\r\n item\r\n }\r\n },\r\n close: () => this.options.resolve(null),\r\n ...options\r\n });\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n width: 500,\r\n height: \"auto\",\r\n classes: [\"item-piles-app\"]\r\n })\r\n }\r\n\r\n static getActiveApp(id) {\r\n return getActiveApps(`item-pile-item-editor-${id}`, true);\r\n }\r\n\r\n static async show(item = false, options = {}, dialogData = {}) {\r\n const app = this.getActiveApp(item.uuid);\r\n if (app) return app.render(false, { focus: true });\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(item, options, dialogData).render(true, { focus: true });\r\n })\r\n }\r\n}\r\n","<script>\r\n\r\n import ItemEditor from \"../item-editor/item-editor.js\";\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n\r\n export let item;\r\n\r\n const itemName = item.name;\r\n const itemImage = item.img;\r\n const quantity = item.quantity;\r\n const store = item.store;\r\n const isMerchant = store.isMerchant;\r\n\r\n const itemFlagDataStore = item.itemFlagData;\r\n\r\n const displayControlButtons = item.store.actor.isOwner;\r\n const displayBuyButton = !!item.store.recipient;\r\n\r\n</script>\r\n\r\n<div class=\"item-piles-flexrow sidebar-buttons\">\r\n\t{#if displayControlButtons && isMerchant}\r\n\t\t{#if game.user.isGM}\r\n <span class=\"item-piles-clickable-link\" on:click={() => { ItemEditor.show(item.item); }}>\r\n <i class=\"fas fa-cog\"></i>\r\n </span>\r\n\t\t{/if}\r\n\t\t<span class=\"item-piles-clickable-link\"\r\n\t\t\t\t\ton:click={() => { $itemFlagDataStore.hidden = !$itemFlagDataStore.hidden; item.updateItemFlagData(); }}>\r\n <i class=\"fas\" class:fa-eye={!$itemFlagDataStore.hidden} class:fa-eye-slash={$itemFlagDataStore.hidden}></i>\r\n </span>\r\n\t\t<span class=\"item-piles-clickable-link\"\r\n\t\t\t\t\ton:click={() => { $itemFlagDataStore.notForSale = !$itemFlagDataStore.notForSale; item.updateItemFlagData(); }}>\r\n <i class=\"fas\" class:fa-store={!$itemFlagDataStore.notForSale}\r\n\t\t\t\t\t class:fa-store-slash={$itemFlagDataStore.notForSale}></i>\r\n </span>\r\n\t{/if}\r\n\t{#if displayBuyButton}\r\n\t\t{#if isMerchant}\r\n <span\r\n\t\t\t\tclass:item-piles-clickable-link={!$itemFlagDataStore.notForSale || game.user.isGM}\r\n\t\t\t\tclass:item-piles-clickable-link-disabled={$quantity <= 0 || ($itemFlagDataStore.notForSale && !game.user.isGM)}\r\n\t\t\t\tclass:buy-button={displayControlButtons}\r\n\t\t\t\ton:click={() => {\r\n if($quantity <= 0 || ($itemFlagDataStore.notForSale && !game.user.isGM)) return;\r\n store.tradeItem(item)\r\n }}>\r\n <i class=\"fas fa-shopping-cart\"></i>\r\n\t\t\t\t{#if !displayControlButtons} {localize(\"ITEM-PILES.Merchant.Buy\")}{/if}\r\n </span>\r\n\t\t{:else}\r\n <span\r\n\t\t\t\tstyle=\"margin-left: 0.25rem;\"\r\n\t\t\t\tclass:item-piles-clickable-link={$quantity > 0 && !$itemFlagDataStore.cantBeSoldToMerchants}\r\n\t\t\t\tclass:item-piles-clickable-link-disabled={$quantity <= 0 || $itemFlagDataStore.cantBeSoldToMerchants}\r\n\t\t\t\ton:click={() => {\r\n if(($quantity <= 0 || $itemFlagDataStore.cantBeSoldToMerchants)) return;\r\n store.tradeItem(item, true)\r\n }}>\r\n <i class=\"fas fa-hand-holding-usd\"></i> {localize(\"ITEM-PILES.Merchant.Sell\")}\r\n </span>\r\n\t\t{/if}\r\n\t{/if}\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n\r\n .sidebar-buttons {\r\n flex: 0 1 auto;\r\n align-items: center;\r\n justify-content: flex-end;\r\n text-align: right;\r\n height: 100%;\r\n border-top-right-radius: 5px;\r\n border-bottom-right-radius: 5px;\r\n\r\n & > span {\r\n flex: 0 1 auto;\r\n margin-right: 0.25rem;\r\n min-width: 17.5px;\r\n }\r\n\r\n .buy-button {\r\n padding-left: 0.25rem;\r\n border-left: 1px solid rgba(0, 0, 0, 0.5)\r\n }\r\n }\r\n\r\n</style>\r\n","import { get, writable } from \"svelte/store\";\nimport { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\nimport { PileItem } from \"./pile-item.js\";\nimport * as PileUtilities from \"../helpers/pile-utilities.js\";\nimport CONSTANTS from \"../constants/constants.js\";\nimport * as Helpers from \"../helpers/helpers.js\";\nimport { isResponsibleGM } from \"../helpers/helpers.js\";\nimport TradeMerchantItemDialog from \"../applications/dialogs/trade-merchant-item-dialog/trade-merchant-item-dialog.js\";\nimport * as Utilities from \"../helpers/utilities.js\";\nimport ItemPileStore from \"./item-pile-store.js\";\nimport CustomColumn from \"../applications/merchant-app/CustomColumn.svelte\";\nimport ItemEntry from \"../applications/merchant-app/ItemEntry.svelte\";\nimport QuantityColumn from \"../applications/merchant-app/QuantityColumn.svelte\";\nimport PriceSelector from \"../applications/components/PriceSelector.svelte\";\nimport EntryButtons from \"../applications/merchant-app/EntryButtons.svelte\";\n\nexport default class MerchantStore extends ItemPileStore {\n\n constructor(...args) {\n super(...args);\n this.services = writable({});\n this.editPrices = writable(false);\n this.typeFilter = writable(\"all\");\n this.sortType = writable(0);\n this.priceModifiersPerType = writable({});\n this.priceModifiersForActor = writable({});\n this.priceSelector = writable(\"\");\n this.closed = writable(false);\n this.itemColumns = writable([]);\n this.sortTypes = writable([]);\n this.inverseSort = writable(false);\n this.isMerchant = false;\n }\n\n get ItemClass() {\n return PileMerchantItem;\n }\n\n setupStores() {\n super.setupStores();\n this.services.set({});\n this.editPrices.set(false);\n this.typeFilter.set(\"all\");\n this.sortType.set(0);\n this.priceModifiersPerType.set({});\n this.priceModifiersForActor.set({});\n this.priceSelector.set(\"\");\n this.closed.set(false);\n this.itemColumns.set([]);\n this.sortTypes.set([]);\n this.inverseSort.set(false);\n this.isMerchant = false;\n }\n\n getActorImage() {\n const pileData = get(this.pileData);\n return pileData?.merchantImage || this.actor.img;\n }\n\n setupSubscriptions() {\n\n let setup = false;\n super.setupSubscriptions();\n this.subscribeTo(this.pileData, (pileData) => {\n this.isMerchant = PileUtilities.isItemPileMerchant(this.actor, pileData);\n this.setupColumns(pileData);\n if (!setup) return;\n this.updatePriceModifiers();\n this.updateOpenCloseStatus();\n });\n if (this.recipientDocument) {\n this.subscribeTo(this.recipientPileData, (pileData) => {\n if (PileUtilities.isItemPileMerchant(this.recipient, pileData)) {\n this.setupColumns(pileData);\n }\n if (!setup) return;\n this.updatePriceModifiers();\n });\n this.subscribeTo(this.recipientDocument, () => {\n if (!setup) return;\n this.refreshItemPrices();\n })\n }\n this.subscribeTo(this.typeFilter, (val) => {\n if (!setup) return;\n this.refreshItems()\n });\n this.subscribeTo(this.sortType, (val) => {\n if (!setup) return;\n this.refreshItems();\n })\n this.subscribeTo(this.inverseSort, (val) => {\n if (!setup) return;\n this.refreshItems();\n })\n setup = true;\n this.updatePriceModifiers();\n this.updateOpenCloseStatus();\n this.refreshItems();\n }\n\n setupColumns(pileData) {\n\n const customColumns = foundry.utils.deepClone(pileData.merchantColumns ?? [])\n .filter(column => {\n return this.isMerchant ? (column?.buying ?? true) : (column?.selling ?? true);\n })\n .map(column => ({\n label: localize(column.label),\n component: CustomColumn,\n data: column,\n sortMethod: (a, b, inverse) => {\n const path = column.path;\n const AProp = getProperty(b.item, path);\n const BProp = getProperty(a.item, path);\n if (!column?.mapping?.[AProp] || !column?.mapping?.[BProp]) {\n return (AProp > BProp ? 1 : -1) * (inverse ? -1 : 1);\n }\n const keys = Object.keys(column.mapping);\n return (keys.indexOf(AProp) - keys.indexOf(BProp)) * (inverse ? -1 : 1);\n }\n }));\n\n const columns = [];\n\n columns.push({\n label: \"Type\",\n component: ItemEntry\n });\n\n if (pileData.displayQuantity !== \"alwaysno\") {\n columns.push({\n label: \"Quantity\",\n component: QuantityColumn,\n sortMethod: (a, b, inverse) => {\n return (get(b.quantity) - get(a.quantity)) * (inverse ? -1 : 1);\n }\n })\n }\n\n columns.push(...customColumns)\n columns.push({\n label: \"Price\",\n component: PriceSelector,\n sortMethod: (a, b, inverse) => {\n const APrice = get(a.prices).find(price => price.primary);\n const BPrice = get(b.prices).find(price => price.primary);\n if (!APrice) return 1;\n if (!BPrice) return -1;\n return (BPrice.totalCost - APrice.totalCost) * (inverse ? -1 : 1);\n }\n })\n columns.push({\n label: false,\n component: EntryButtons\n });\n\n this.itemColumns.set(columns);\n\n const sortTypes = columns.filter(col => col.label);\n\n sortTypes.splice(1, 0, { label: \"Name\" });\n\n this.sortTypes.set(sortTypes)\n\n }\n\n refreshItemPrices() {\n const pileData = get(this.pileData);\n const recipientPileData = get(this.recipientPileData);\n get(this.allItems).forEach(item => {\n item.refreshPriceData(pileData, recipientPileData);\n });\n }\n\n visibleItemFilterFunction(entry, actorIsMerchant, pileData, recipientPileData) {\n const itemIsFree = !!get(entry.prices).find(price => price.free);\n return super.visibleItemFilterFunction(entry, actorIsMerchant, pileData, recipientPileData)\n && (\n actorIsMerchant\n ? !(pileData?.hideItemsWithZeroCost && itemIsFree)\n : !(recipientPileData?.hideItemsWithZeroCost && itemIsFree)\n );\n }\n\n itemSortFunction(a, b) {\n const sortType = get(this.sortType);\n const inverse = get(this.inverseSort);\n if (sortType <= 1) {\n return super.itemSortFunction(a, b, inverse);\n }\n const selectedSortType = get(this.sortTypes)[sortType];\n return selectedSortType?.sortMethod(a, b, inverse, selectedSortType);\n }\n\n createItem(item) {\n if (PileUtilities.isItemInvalid(this.actor, item)) return;\n const items = get(this.allItems);\n const itemClass = new this.ItemClass(this, item);\n itemClass.refreshPriceData();\n items.push(itemClass);\n this.allItems.set(items);\n this.refreshItems();\n }\n\n deleteItem(item) {\n if (PileUtilities.isItemInvalid(this.actor, item)) return;\n const items = get(this.allItems);\n const pileItem = items.find(pileItem => pileItem.id === item.id);\n if (!pileItem) return;\n pileItem.unsubscribe();\n items.splice(items.indexOf(pileItem), 1);\n this.allItems.set(items);\n this.refreshItems();\n }\n\n updatePriceModifiers() {\n let pileData = get(this.pileData);\n let change = false;\n if (pileData.itemTypePriceModifiers && typeof pileData.itemTypePriceModifiers === \"object\") {\n change = true;\n this.priceModifiersPerType.set((pileData.itemTypePriceModifiers ?? {}).reduce((acc, priceData) => {\n acc[priceData.category.toLowerCase() || priceData.type] = priceData;\n return acc;\n }, {}));\n }\n if (this.recipient && pileData.actorPriceModifiers && Array.isArray(pileData.actorPriceModifiers)) {\n change = true;\n const recipientUuid = Utilities.getUuid(this.recipient);\n const actorSpecificModifiers = pileData.actorPriceModifiers?.find(data => data.actorUuid === recipientUuid);\n if (actorSpecificModifiers) {\n this.priceModifiersForActor.set(actorSpecificModifiers);\n }\n }\n if (change) {\n this.refreshItemPrices();\n }\n }\n\n addOverrideTypePrice(type) {\n const pileData = get(this.pileData);\n const custom = Object.keys(CONFIG.Item.typeLabels).indexOf(type) === -1;\n pileData.itemTypePriceModifiers.push({\n category: custom ? type : \"\",\n type: custom ? \"custom\" : type,\n override: false,\n buyPriceModifier: 1,\n sellPriceModifier: 1\n })\n this.pileData.set(pileData);\n }\n\n removeOverrideTypePrice(type) {\n const pileData = get(this.pileData);\n const priceMods = pileData.itemTypePriceModifiers;\n const typeEntry = priceMods.find(entry => entry.type === type);\n priceMods.splice(priceMods.indexOf(typeEntry), 1);\n this.pileData.set(pileData);\n }\n\n async update() {\n const pileData = get(this.pileData);\n const priceModPerType = get(this.priceModifiersPerType);\n pileData.itemTypePriceModifiers = Object.values(priceModPerType);\n await PileUtilities.updateItemPileData(this.actor, pileData);\n Helpers.custom_notify(localize(\"ITEM-PILES.Notifications.UpdateMerchantSuccess\"));\n }\n\n tradeItem(pileItem, selling) {\n if (get(pileItem.itemFlagData).notForSale && !game.user.isGM) return;\n TradeMerchantItemDialog.show(\n pileItem,\n this.actor,\n this.recipient,\n { selling }\n );\n }\n\n async updateOpenCloseStatus() {\n const pileData = get(this.pileData);\n if (pileData.openTimes.status === \"auto\") {\n if (game.modules.get('foundryvtt-simple-calendar')?.active && pileData.openTimes.enabled) {\n const openTimes = pileData.openTimes.open;\n const closeTimes = pileData.openTimes.close;\n const timestamp = window.SimpleCalendar.api.timestampToDate(window.SimpleCalendar.api.timestamp());\n\n const openingTime = Number(openTimes.hour.toString() + \".\" + openTimes.minute.toString());\n const closingTime = Number(closeTimes.hour.toString() + \".\" + closeTimes.minute.toString());\n const currentTime = Number(timestamp.hour.toString() + \".\" + timestamp.minute.toString());\n\n let isClosed = openingTime > closingTime\n ? !(currentTime >= openingTime || currentTime <= closingTime) // Is the store open over midnight?\n : !(currentTime >= openingTime && currentTime <= closingTime); // or is the store open during normal daylight hours?\n\n const currentWeekday = window.SimpleCalendar.api.getCurrentWeekday();\n\n isClosed = isClosed || (pileData.closedDays ?? []).includes(currentWeekday.name);\n\n const currentDate = window.SimpleCalendar.api.currentDateTime();\n const notes = window.SimpleCalendar.api.getNotesForDay(currentDate.year, currentDate.month, currentDate.day);\n const categories = new Set(notes.map(note => getProperty(note, \"flags.foundryvtt-simple-calendar.noteData.categories\") ?? []).deepFlatten());\n\n isClosed = isClosed || categories.intersection(new Set(pileData.closedHolidays ?? [])).size > 0;\n\n this.closed.set(isClosed);\n\n } else if (isResponsibleGM()) {\n pileData.openTimes.status = \"open\";\n await PileUtilities.updateItemPileData(this.actor, pileData);\n }\n\n } else if (!pileData.openTimes.status.startsWith(\"auto\")) {\n\n this.closed.set(pileData.openTimes.status === \"closed\");\n\n }\n }\n\n async setOpenStatus(status) {\n const pileData = get(this.pileData);\n pileData.openTimes.status = status;\n await PileUtilities.updateItemPileData(this.actor, pileData);\n }\n\n}\n\nclass PileMerchantItem extends PileItem {\n\n setupStores(...args) {\n super.setupStores(...args);\n this.prices = writable([]);\n this.displayQuantity = writable(false);\n this.selectedPriceGroup = writable(-1);\n this.quantityToBuy = writable(1);\n this.quantityForPrice = writable(1);\n this.infiniteQuantity = writable(false);\n this.isService = false;\n }\n\n setupSubscriptions() {\n let setup = false;\n super.setupSubscriptions();\n this.subscribeTo(this.store.pileData, () => {\n if (!setup) return;\n this.refreshPriceData();\n this.refreshDisplayQuantity();\n });\n if (this.store.recipient) {\n this.subscribeTo(this.store.recipientPileData, () => {\n if (!setup) return\n this.refreshPriceData();\n this.refreshDisplayQuantity();\n });\n }\n this.subscribeTo(this.quantityToBuy, () => {\n if (!setup) return;\n this.refreshPriceData();\n });\n this.subscribeTo(this.itemDocument, () => {\n if (!setup) return;\n this.refreshPriceData();\n this.store.refreshItems();\n });\n this.subscribeTo(this.store.typeFilter, () => {\n if (!setup) return;\n this.filter()\n });\n this.subscribeTo(this.itemFlagData, (flagData) => {\n this.isService = flagData.isService;\n if (!setup) return;\n this.refreshPriceData();\n this.refreshDisplayQuantity();\n });\n this.refreshDisplayQuantity();\n setup = true;\n }\n\n refreshDisplayQuantity() {\n\n const pileData = get(this.store.pileData);\n const itemFlagData = get(this.itemFlagData);\n const isMerchant = PileUtilities.isItemPileMerchant(this.store.actor, pileData)\n\n const merchantDisplayQuantity = pileData.displayQuantity;\n const itemFlagDataQuantity = itemFlagData.displayQuantity;\n\n const itemInfiniteQuantity = {\n \"default\": pileData.infiniteQuantity,\n \"yes\": true,\n \"no\": false\n }[isMerchant ? (itemFlagData.infiniteQuantity ?? \"default\") : \"no\"];\n\n this.infiniteQuantity.set(itemInfiniteQuantity)\n\n if (itemFlagDataQuantity === \"always\") {\n return this.displayQuantity.set(true);\n }\n\n const itemDisplayQuantity = {\n \"default\": merchantDisplayQuantity === \"yes\",\n \"yes\": true,\n \"no\": false\n }[itemFlagDataQuantity ?? \"default\"];\n\n if (merchantDisplayQuantity.startsWith(\"always\")) {\n return this.displayQuantity.set(merchantDisplayQuantity.endsWith(\"yes\"));\n }\n\n this.displayQuantity.set(itemDisplayQuantity);\n\n }\n\n refreshPriceData(sellerFlagData, buyerFlagData) {\n\n const quantityToBuy = get(this.quantityToBuy);\n const itemFlagData = get(this.itemFlagData);\n sellerFlagData = sellerFlagData ?? get(this.store.pileData);\n buyerFlagData = buyerFlagData ?? get(this.store.recipientPileData);\n const priceData = PileUtilities.getPriceData({\n item: this.item,\n seller: this.store.actor,\n buyer: this.store.recipient,\n sellerFlagData,\n buyerFlagData,\n itemFlagData,\n quantity: quantityToBuy\n });\n\n let selectedPriceGroup = get(this.selectedPriceGroup);\n if (selectedPriceGroup === -1) {\n selectedPriceGroup = Math.max(0, priceData.findIndex(price => price.maxQuantity));\n this.selectedPriceGroup.set(selectedPriceGroup)\n }\n\n this.prices.set(priceData);\n\n this.quantityForPrice.set(\n game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE\n ? getProperty(this.item, game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE) ?? 1\n : 1\n );\n\n }\n\n filter() {\n const name = get(this.name).trim();\n const type = get(this.category).type;\n const search = get(this.store.search).trim();\n const typeFilter = get(this.store.typeFilter);\n const searchFiltered = !name.toLowerCase().includes(search.toLowerCase());\n const typeFiltered = typeFilter !== \"all\" && typeFilter.toLowerCase() !== type.toLowerCase();\n this.filtered.set(searchFiltered || typeFiltered);\n }\n\n async updateItemFlagData() {\n const itemFlagData = get(this.itemFlagData);\n await PileUtilities.updateItemData(this.item, { flags: itemFlagData });\n }\n\n updateQuantity(quantity) {\n const pileFlagData = get(this.store.pileData);\n const itemFlagData = get(this.itemFlagData);\n const roll = new Roll(quantity).evaluate({ async: false });\n this.quantity.set(roll.total);\n const baseData = {};\n if (itemFlagData.isService || pileFlagData.keepZeroQuantity || itemFlagData.keepZeroQuantity) {\n baseData[CONSTANTS.FLAGS.ITEM + \".notForSale\"] = roll.total <= 0;\n }\n return this.item.update(Utilities.setItemQuantity(baseData, roll.total));\n }\n\n}\n","<script>\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { getContext } from \"svelte\";\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import { TJSProseMirror } from '@typhonjs-fvtt/svelte-standard/component';\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let text;\r\n export let elementRoot;\r\n\r\n const options = application.options;\r\n\r\n const originalText = text;\r\n\r\n let form;\r\n\r\n function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n function submit() {\r\n application.options.resolve(text);\r\n application.close();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\t<form autocomplete=\"off\" bind:this={form} class=\"item-piles-flexcol\" on:submit|once|preventDefault={submit}\r\n\t\t\t\tstyle=\"padding:0.5rem;\">\r\n\r\n\t\t<TJSProseMirror\r\n\t\t\tbind:content={text}\r\n\t\t/>\r\n\r\n\t\t<footer class=\"sheet-footer item-piles-flexrow\" style=\"margin-top: 1rem; flex: 0;\">\r\n\t\t\t<button disabled={originalText === text} on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"fas fa-download\"></i>\r\n\t\t\t\t{localize(\"Save\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click={() => { application.close() }} type=\"button\">\r\n\t\t\t\t<i class=\"fas fa-times\"></i>\r\n\t\t\t\t{localize(\"Cancel\")}\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n\r\n</ApplicationShell>\r\n","import { SvelteApplication } from \"@typhonjs-fvtt/runtime/svelte/application\";\r\nimport { getActiveApps } from \"../../../helpers/helpers\";\r\nimport TextEditorDialogShell from \"./text-editor-dialog-shell.svelte\";\r\n\r\nexport default class TextEditorDialog extends SvelteApplication {\r\n\r\n constructor(text, options) {\r\n super({\r\n title: game.i18n.localize(\"ITEM-PILES.Dialogs.TextEditor.Title\"),\r\n id: `item-piles-text-editor${options?.id ? \"-\" + options.id : \"\"}-${randomID()}`,\r\n svelte: {\r\n class: TextEditorDialogShell,\r\n target: document.body,\r\n props: {\r\n text\r\n }\r\n },\r\n close: () => this.options.resolve?.(null),\r\n ...options\r\n });\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n width: 550,\r\n height: 450,\r\n classes: [\"item-piles-app\"],\r\n resizable: true\r\n })\r\n }\r\n\r\n static getActiveApps(id) {\r\n return getActiveApps(`item-pile-text-editor-${id}`);\r\n }\r\n\r\n static async show(text, options = {}) {\r\n const apps = options.id ? this.getActiveApps(options.id) : [];\r\n if (apps.length) {\r\n for (let app of apps) {\r\n app.render(false, { focus: true });\r\n }\r\n return;\r\n }\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(text, options).render(true, { focus: true });\r\n })\r\n }\r\n\r\n}\r\n","<script>\r\n\r\n import Tabs from \"../components/Tabs.svelte\";\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import SliderInput from \"../components/SliderInput.svelte\";\r\n import TextEditorDialog from \"../dialogs/text-editor-dialog/text-editor-dialog.js\";\r\n import { TJSProseMirror } from \"@typhonjs-fvtt/svelte-standard/component\";\r\n\r\n export let store;\r\n\r\n const merchantImg = store.img;\r\n const pileDataStore = store.pileData;\r\n const editPrices = store.editPrices;\r\n\r\n let tabs = [];\r\n let description;\r\n let activeSidebarTab = false;\r\n $: {\r\n description = $pileDataStore.description;\r\n }\r\n $: {\r\n tabs = [\r\n {\r\n value: 'description',\r\n label: `ITEM-PILES.Merchant.Description`,\r\n hidden: !game.user.isGM && !description\r\n },\r\n {\r\n value: 'settings',\r\n label: `ITEM-PILES.Merchant.Settings`,\r\n hidden: !game.user.isGM\r\n },\r\n ];\r\n activeSidebarTab = activeSidebarTab || tabs.find(tab => !tab.hidden)?.value;\r\n }\r\n\r\n function showDescriptionEditor() {\r\n return TextEditorDialog.show(description, { id: \"item-pile-text-editor-\" + store.actor.id }).then((result) => {\r\n store.pileData.update((pileData) => {\r\n pileData.description = result || \"\";\r\n return pileData;\r\n });\r\n store.update();\r\n });\r\n }\r\n\r\n</script>\r\n\r\n<div class=\"merchant-left-pane item-piles-flexcol\">\r\n\r\n\t<div class=\"item-piles-bottom-divider\">\r\n\t\t<div class=\"merchant-img\">\r\n\t\t\t<img src=\"{ $merchantImg }\">\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t{#if activeSidebarTab}\r\n\r\n\t\t<Tabs style=\"flex: 0 1 auto;\" {tabs} bind:activeTab={activeSidebarTab}/>\r\n\r\n\t\t<section class=\"tab-body item-piles-sections\" style=\"overflow-y:auto;\">\r\n\r\n\t\t\t{#if activeSidebarTab === 'description'}\r\n\t\t\t\t<div class=\"tab merchant-description\" style=\"padding:0;\">\r\n\t\t\t\t\t<TJSProseMirror\r\n\t\t\t\t\t\tcontent={description}\r\n\t\t\t\t\t\toptions={{ editable: false, secrets: game.user.isGM }}\r\n\t\t\t\t\t\tstyle={{\"display\": \"block\"}}\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t{#if game.user.isGM && !description}\r\n\t\t\t\t\t\t<button type=\"button\"\r\n\t\t\t\t\t\t\t\t\t\tstyle=\"flex:1;\"\r\n\t\t\t\t\t\t\t\t\t\ton:click={() => { showDescriptionEditor() }}\r\n\t\t\t\t\t\t>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.EditDescription\")}</button>\r\n\t\t\t\t\t{/if}\r\n\t\t\t\t</div>\r\n\t\t\t{/if}\r\n\r\n\t\t\t{#if activeSidebarTab === 'settings'}\r\n\t\t\t\t<div class=\"tab merchant-settings\">\r\n\r\n\t\t\t\t\t<div class=\"setting-container item-piles-config-container\">\r\n\r\n\t\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t\t<label style=\"flex:3;\">\r\n\t\t\t\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.PurchaseOnly\")}</span>\r\n\t\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.PurchaseOnlyExplanation\")}</p>\r\n\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={$pileDataStore.purchaseOnly}/>\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t\t<label style=\"flex:3;\">\r\n\t\t\t\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.HideNewItems\")}</span>\r\n\t\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.HideNewItemsExplanation\")}</p>\r\n\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={$pileDataStore.hideNewItems}/>\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t\t<label style=\"flex:3;\">\r\n\t\t\t\t\t\t\t\t<span>{localize(\"ITEM-PILES.Merchant.EditTypePrices\")}</span>\r\n\t\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Merchant.EditTypePricesExplanation\")}</p>\r\n\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={$editPrices}/>\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t<div class=\"form-group slider-group item-piles-flexcol\">\r\n\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.BuyPriceModifier\")}\r\n\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t<SliderInput bind:value={$pileDataStore.buyPriceModifier}/>\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t<div class=\"form-group slider-group item-piles-flexcol\">\r\n\t\t\t\t\t\t\t<label>\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.SellPriceModifier\")}\r\n\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t<SliderInput style=\"flex:4;\" bind:value={$pileDataStore.sellPriceModifier}/>\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<button type=\"button\" class=\"update-button\" on:click={() => { store.update(); }}>\r\n\t\t\t\t\t\t<i class=\"fas fa-download\"></i> Update\r\n\t\t\t\t\t</button>\r\n\t\t\t\t</div>\r\n\t\t\t{/if}\r\n\r\n\t\t</section>\r\n\r\n\t{/if}\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n .merchant-left-pane {\r\n\r\n flex: 0 1 35%;\r\n padding-right: 0.25rem;\r\n margin-right: 0.25rem;\r\n border-right: 1px solid rgba(0, 0, 0, 0.5);\r\n max-height: 100%;\r\n max-width: 300px;\r\n min-width: 250px;\r\n overflow-y: hidden;\r\n\r\n section {\r\n padding: 0.25rem;\r\n }\r\n\r\n .merchant-img {\r\n position: relative;\r\n flex: 0 1 auto;\r\n border-radius: 5px;\r\n\r\n img {\r\n width: 100%;\r\n height: auto;\r\n border: 0;\r\n border-radius: 3px;\r\n z-index: 1;\r\n }\r\n\r\n }\r\n\r\n .merchant-description {\r\n position: relative;\r\n padding: 0.25rem;\r\n\r\n .prosemirror {\r\n display: block;\r\n }\r\n }\r\n\r\n .merchant-settings {\r\n position: relative;\r\n height: calc(100% - 37px);\r\n\r\n\r\n .setting-container {\r\n overflow: hidden auto;\r\n top: 0;\r\n bottom: 0;\r\n position: absolute;\r\n padding: 0 0.25rem;\r\n\r\n .form-group {\r\n clear: both;\r\n display: flex;\r\n flex-wrap: wrap;\r\n margin: 3px 0;\r\n\r\n &.item-piles-flexcol {\r\n align-items: flex-start;\r\n }\r\n }\r\n }\r\n\r\n .update-button {\r\n position: absolute;\r\n bottom: -37px;\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n</style>\r\n","<script>\n import { fade } from 'svelte/transition';\n\n export let item;\n export let index;\n export let columns;\n\n const itemName = item.name;\n const itemImage = item.img;\n\n const store = item.store;\n const itemStore = item.itemDocument;\n const pileData = store.pileData;\n const displayQuantityStore = item.displayQuantity;\n const quantityStore = item.quantity;\n const itemFlagDataStore = item.itemFlagData;\n\n $: itemFlagData = $itemFlagDataStore;\n $: displayQuantity = $displayQuantityStore;\n $: quantity = $quantityStore;\n $: editQuantity = $quantityStore;\n let showEditQuantity = false;\n\n const displayControlButtons = store.actor.isOwner;\n const displayBuyButton = !!store.recipient;\n\n</script>\n\n<div class=\"item-piles-flexrow item-piles-item-row\"\n\t\t class:item-piles-child-even-color={index%2===0}\n\t\t class:item-piles-child-odd-color={index%2===1}\n\t\t class:merchant-item-hidden={itemFlagData.hidden}\n\t\t style=\"flex: 1 0 auto;\"\n\t\t transition:fade|local={{duration: 250}}>\n\n\t{#each columns as column}\n\t\t{#if column?.data}\n\t\t\t<svelte:component this={column.component} {item} data={column.data}/>\n\t\t{:else}\n\t\t\t<svelte:component this={column.component} {item}/>\n\t\t{/if}\n\t{/each}\n\n</div>\n\n\n<style lang=\"scss\">\n\n\n .item-piles-item-row:global(.item-piles-child-even-color > *) {\n background-color: var(--item-piles-even-color);\n }\n\n .item-piles-item-row:global(.item-piles-child-odd-color > *) {\n background-color: var(--item-piles-odd-color);\n }\n\n .item-piles-item-row {\n margin: 0;\n overflow: visible;\n display: contents;\n\n & > * {\n padding: 0 10px;\n text-align: center;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n }\n\n &.merchant-item-hidden > * {\n font-style: italic;\n opacity: 0.5;\n }\n\n .item-piles-text {\n font-size: inherit;\n }\n\n .item-piles-img-container {\n min-width: 20px;\n max-height: 20px;\n margin: 2px;\n flex: 1 0 auto;\n\n overflow: hidden;\n border-radius: 4px;\n border: 1px solid black;\n align-self: center;\n }\n\n .item-piles-name-container {\n line-height: 1.6;\n }\n\n }\n\n</style>\n","<script>\r\n\r\n import SliderInput from \"../components/SliderInput.svelte\";\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n\r\n export let store;\r\n export let category;\r\n\r\n const pileData = store.pileData;\r\n const searchStore = store.search;\r\n const visibleItemsStore = store.visibleItems;\r\n const itemsPerCategoryStore = store.itemsPerCategory;\r\n const categoryStore = store.categories;\r\n const priceModifiersPerType = store.priceModifiersPerType;\r\n const itemCategoriesStore = store.itemCategories;\r\n const typeFilterStore = store.typeFilter;\r\n const editPrices = store.editPrices;\r\n const columns = store.itemColumns;\r\n\r\n $: colSpan = $editPrices ? $columns.length + 1 : 1;\r\n $: type = category.type === \"custom\" ? category.label.toLowerCase() : category.type;\r\n\r\n</script>\r\n\r\n<div class=\"merchant-item-group-type item-piles-flexrow\" style=\"grid-column: 1/{colSpan};\">\r\n\t<h3>{localize(category.label)}</h3>\r\n\t{#if $editPrices}\r\n\t\t<div class=\"price-header\" style=\"font-size: 0.75rem;\">\r\n\t\t\t{#if $priceModifiersPerType[type]}\r\n\t\t\t\t{localize(\"ITEM-PILES.Merchant.Override\")}:\r\n\t\t\t\t<input type=\"checkbox\" bind:checked={$priceModifiersPerType[type].override}>\r\n\t\t\t\t<SliderInput bind:value={$priceModifiersPerType[type].buyPriceModifier}/>\r\n\t\t\t{/if}\r\n\t\t</div>\r\n\t\t<div style=\"flex: 0 1 auto\">\r\n\t\t\t{#if $priceModifiersPerType[type]}\r\n\t\t\t\t<i class=\"fas fa-times item-piles-clickable-red\"\r\n\t\t\t\t\t on:click={() => { store.removeOverrideTypePrice(type) }}></i>\r\n\t\t\t{:else}\r\n\t\t\t\t<i class=\"fas fa-plus item-piles-clickable-green\"\r\n\t\t\t\t\t on:click={() => { store.addOverrideTypePrice(type) }}></i>\r\n\t\t\t{/if}\r\n\t\t</div>\r\n\t{/if}\r\n</div>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .merchant-item-group-type {\r\n align-items: center;\r\n height: 1.5rem;\r\n margin-top: 10px;\r\n margin-bottom: 5px;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.2);\r\n\r\n h3 {\r\n margin: 0;\r\n flex: 1 0 auto;\r\n }\r\n\r\n .price-header {\r\n flex: 0 1 calc(50% - 10px);\r\n padding-right: 10px;\r\n justify-content: center;\r\n display: flex;\r\n align-items: center;\r\n\r\n input[type=\"checkbox\"] {\r\n height: 15px;\r\n }\r\n }\r\n }\r\n</style>\r\n","<script>\r\n\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import MerchantItemEntry from \"./MerchantItemEntry.svelte\";\r\n import CategoryHeader from \"./CategoryHeader.svelte\";\r\n import { get } from \"svelte/store\";\r\n\r\n export let store;\r\n export let noItemsLabel = \"ITEM-PILES.Merchant.NoItemsForSale\";\r\n export let services = false;\r\n\r\n const pileData = store.pileData;\r\n const searchStore = store.search;\r\n const visibleItemsStore = store.visibleItems;\r\n const itemsStore = store.items;\r\n const itemsPerCategoryStore = store.itemsPerCategory;\r\n const categoryStore = store.categories;\r\n const priceModifiersPerType = store.priceModifiersPerType;\r\n const itemCategoriesStore = store.itemCategories;\r\n const typeFilterStore = store.typeFilter;\r\n const sortTypesStore = store.sortTypes;\r\n const sortTypeStore = store.sortType;\r\n const inverseSortStore = store.inverseSort;\r\n const editPrices = store.editPrices;\r\n const itemColumns = store.itemColumns;\r\n\r\n $: categoryDropDown = $itemCategoriesStore.filter(category => category.service === services);\r\n $: categories = $categoryStore.filter(category => category.service === services);\r\n $: items = $itemsStore.filter(item => Boolean(get(item.itemFlagData)?.isService) === services)\r\n $: visibleItems = $visibleItemsStore.filter(item => Boolean(get(item.itemFlagData)?.isService) === services)\r\n\r\n let columns = [];\r\n $: {\r\n columns = [\r\n {\r\n label: \"Name\",\r\n component: CategoryHeader\r\n },\r\n ...$itemColumns.slice(1)\r\n ]\r\n }\r\n\r\n</script>\r\n<div class=\"item-piles-flexrow\">\r\n\t<input bind:value={$searchStore} placeholder=\"Type to search...\" type=\"text\">\r\n\t{#if categoryDropDown.length > 1}\r\n\t\t<select style=\"flex:0 1 auto; margin-left: 0.4rem; height: 26px;\" bind:value={$typeFilterStore}>\r\n\t\t\t<option value=\"all\">{localize(\"ITEM-PILES.Merchant.AllTypes\")}</option>\r\n\t\t\t{#each categoryDropDown as category (category.type)}\r\n\t\t\t\t<option value={category.type}>{localize(category.label)}</option>\r\n\t\t\t{/each}\r\n\t\t</select>\r\n\t{/if}\r\n\t<select bind:value={$sortTypeStore} style=\"flex:0 1 auto; margin-left: 0.4rem; height: 26px;\">\r\n\t\t{#each $sortTypesStore as column, index}\r\n\t\t\t<option value={index}>Sort by: {localize(column.label)}</option>\r\n\t\t{/each}\r\n\t</select>\r\n</div>\r\n\r\n<div class=\"item-piles-items-list\" style=\"grid-template-columns: auto repeat({columns.length-1}, max-content);\">\r\n\r\n\t{#if $sortTypeStore === 0 || $editPrices}\r\n\r\n\t\t{#each categories as category, index (category.type)}\r\n\r\n\t\t\t<div class=\"item-piles-item-list-header\">\r\n\t\t\t\t{#each columns as column, columnIndex}\r\n\t\t\t\t\t{#if columnIndex === 0}\r\n\t\t\t\t\t\t<CategoryHeader {store} {category}/>\r\n\t\t\t\t\t{:else if column.label && columnIndex > 0 && index === 0 && !$editPrices}\r\n\t\t\t\t\t\t<div class=\"item-piles-small-text\">\r\n\t\t\t\t\t\t\t<a on:click={() => {\r\n $inverseSortStore = $sortTypeStore === columnIndex+1 ? !$inverseSortStore : false;\r\n $sortTypeStore = columnIndex+1;\r\n\t\t\t\t\t\t}}>\r\n\t\t\t\t\t\t\t\t{@html column.label}\r\n\t\t\t\t\t\t\t\t<i class=\"fas\"\r\n\t\t\t\t\t\t\t\t\t class:fa-chevron-down={!$inverseSortStore && $sortTypeStore === columnIndex+1}\r\n\t\t\t\t\t\t\t\t\t class:fa-chevron-up={$inverseSortStore && $sortTypeStore === columnIndex+1}\r\n\t\t\t\t\t\t\t\t></i>\r\n\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t{:else if !$editPrices}\r\n\t\t\t\t\t\t<div></div>\r\n\t\t\t\t\t{/if}\r\n\t\t\t\t{/each}\r\n\t\t\t</div>\r\n\t\t\t{#each $itemsPerCategoryStore[category.type].items as item, itemIndex (item.id)}\r\n\t\t\t\t<MerchantItemEntry {item} index={itemIndex} columns={$itemColumns}/>\r\n\t\t\t{/each}\r\n\r\n\t\t{/each}\r\n\r\n\t{:else}\r\n\r\n\t\t<div class=\"item-piles-item-list-header\">\r\n\t\t\t{#each columns as column, columnIndex}\r\n\t\t\t\t{#if column.label}\r\n\t\t\t\t\t<div class=\"item-piles-small-text\" class:item-piles-merchant-first-label={!columnIndex}>\r\n\t\t\t\t\t\t<a on:click={() => {\r\n $inverseSortStore = $sortTypeStore === columnIndex + 1 ? !$inverseSortStore : false;\r\n $sortTypeStore = columnIndex + 1;\r\n\t\t\t\t\t\t}}>\r\n\t\t\t\t\t\t\t{@html column.label}\r\n\t\t\t\t\t\t\t<i class=\"fas\"\r\n\t\t\t\t\t\t\t\t class:fa-chevron-down={!$inverseSortStore && $sortTypeStore === columnIndex+1}\r\n\t\t\t\t\t\t\t\t class:fa-chevron-up={$inverseSortStore && $sortTypeStore === columnIndex+1}\r\n\t\t\t\t\t\t\t></i>\r\n\t\t\t\t\t\t</a>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t{:else}\r\n\t\t\t\t\t<div></div>\r\n\t\t\t\t{/if}\r\n\t\t\t{/each}\r\n\t\t</div>\r\n\t\t{#each items as item, itemIndex (item.id)}\r\n\t\t\t<MerchantItemEntry {item} index={itemIndex} columns={$itemColumns}/>\r\n\t\t{/each}\r\n\r\n\t{/if}\r\n\r\n\t{#if !$categoryStore.length}\r\n\r\n\t\t<div style=\"height: calc(100% - 51px);\" class=\"item-piles-flexcol align-center-col\">\r\n\r\n <span class=\"align-center-row\" style=\"font-size:1.25rem; opacity: 0.8;\">\r\n {#if visibleItems.length}\r\n {localize(\"ITEM-PILES.Merchant.NoMatchFound\")}\r\n {:else}\r\n {localize(noItemsLabel)}\r\n {/if}\r\n </span>\r\n\r\n\t\t</div>\r\n\r\n\t{/if}\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-piles-items-list {\r\n display: grid;\r\n overflow-y: scroll;\r\n padding-right: 5px;\r\n align-items: center;\r\n height: calc(100% - 31px);\r\n margin-top: 5px;\r\n align-content: flex-start;\r\n }\r\n\r\n .item-piles-item-list-header {\r\n display: contents;\r\n\r\n & > * {\r\n height: 1.5rem;\r\n margin-top: 10px;\r\n margin-bottom: 5px;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.2);\r\n padding: 0 5px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n }\r\n }\r\n\r\n .item-piles-merchant-first-label {\r\n justify-content: flex-start;\r\n }\r\n\r\n</style>\r\n","<script>\r\n\r\n export let icon = \"fas fa-exclamation-triangle\";\r\n export let header = \"Item Piles\";\r\n export let content;\r\n\r\n</script>\r\n\r\n\r\n<div>\r\n\r\n\t{#if icon}\r\n\t\t<p class=\"header-icon\"><i class=\"{icon}\"></i></p>\r\n\t{/if}\r\n\t{#if header}\r\n\t\t<p class=\"header\"><strong>{header}</strong></p>\r\n\t{/if}\r\n\t{#if Array.isArray(content)}\r\n\t\t{#each content as part}\r\n\t\t\t<p>{@html part}</p>\r\n\t\t{/each}\r\n\t{:else}\r\n\t\t<p>{@html content}</p>\r\n\t{/if}\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n div {\r\n\r\n margin-bottom: 0.5rem;\r\n font-size: 0.9rem;\r\n text-align: center;\r\n\r\n .header-icon {\r\n font-size: 3rem;\r\n margin: 0;\r\n }\r\n\r\n .header {\r\n margin-bottom: 0.5rem;\r\n font-size: 1.2rem;\r\n }\r\n\r\n }\r\n\r\n</style>\r\n","<script>\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import { get, writable } from \"svelte/store\";\r\n import { onDestroy } from \"svelte\";\r\n import { TJSDialog } from \"@typhonjs-fvtt/runtime/svelte/application\";\r\n import CustomDialog from \"../components/CustomDialog.svelte\";\r\n import ItemEntry from \"./ItemEntry.svelte\";\r\n import * as PileUtilities from \"../../helpers/pile-utilities.js\";\r\n import { getSetting } from \"../../helpers/helpers\";\r\n import { slide } from \"svelte/transition\";\r\n import { quintOut } from \"svelte/easing\";\r\n import SETTINGS from \"../../constants/settings\";\r\n import CustomCategoryInput from \"../components/CustomCategoryInput.svelte\";\r\n\r\n export let store;\r\n\r\n let tables = writable(getTables());\r\n\r\n let populationTables = writable((get(store.pileData).tablesForPopulate ?? [])\r\n .map(t => {\r\n if (t.id) {\r\n t.uuid = game.tables.get(t.id).uuid;\r\n }\r\n return {\r\n uuid: t.uuid,\r\n addAll: t.addAll ?? false,\r\n open: false,\r\n timesToRoll: t.timesToRoll ?? \"1d4\",\r\n items: t.items ?? {},\r\n customCategory: t.customCategory ?? \"\",\r\n };\r\n }));\r\n\r\n let timesRolled = \"\";\r\n let keepRolled = false;\r\n\r\n let itemStore = store.items;\r\n\r\n $: currentItems = $itemStore.sort((a, b) => {\r\n return a.item.name < b.item.name ? -1 : 1;\r\n }).filter(item => !item.isService);\r\n\r\n $: currentServices = $itemStore.sort((a, b) => {\r\n return a.item.name < b.item.name ? -1 : 1;\r\n }).filter(item => item.isService);\r\n\r\n $: {\r\n debounceSave($populationTables, $tables)\r\n }\r\n\r\n const debounceSave = foundry.utils.debounce((popTables, actualTables) => {\r\n const pileData = foundry.utils.deepClone(get(store.pileData));\r\n pileData.tablesForPopulate = popTables\r\n .filter((t) => actualTables[t.uuid])\r\n .map((t) => ({\r\n uuid: t.uuid, addAll: t.addAll, items: t.items, timesToRoll: t.timesToRoll, customCategory: t.customCategory\r\n }));\r\n PileUtilities.updateItemPileData(store.actor, pileData);\r\n }, 200);\r\n\r\n let selectableTables = [];\r\n let selectedTable = \"\";\r\n $: {\r\n selectableTables = Object.entries($tables).filter(entry => !$populationTables.some(table => table.uuid === entry[0]));\r\n const tableSet = new Set(selectableTables.map(e => e[0]));\r\n selectedTable = tableSet.has(selectedTable) ? selectedTable : tableSet.first();\r\n }\r\n\r\n let itemsRolled = writable([]);\r\n\r\n function recurseThroughFoldersForTables(folderId) {\r\n const folder = game.folders.find(f => f.type === \"RollTable\" && f.id === folderId);\r\n let folders = [folder.id];\r\n for (const child of folder.children) {\r\n folders = folders.concat(recurseThroughFoldersForTables(child.folder.id))\r\n }\r\n return folders;\r\n }\r\n\r\n function getTables() {\r\n let tables = Array.from(game.tables);\r\n const folderId = getSetting(SETTINGS.POPULATION_TABLES_FOLDER);\r\n if (\r\n folderId !== \"root\" && game.folders.find((f) => f.type === \"RollTable\" && f.id === folderId)\r\n ) {\r\n const folderIds = recurseThroughFoldersForTables(folderId)\r\n tables = tables.filter((t) => folderIds.includes(t.folder?.id));\r\n }\r\n\r\n const mappedTables = {};\r\n for (const table of tables) {\r\n mappedTables[table.uuid] = {\r\n name: table.name,\r\n items: Array.from(table.collections.results)\r\n }\r\n }\r\n return mappedTables;\r\n }\r\n\r\n async function rollAllTables() {\r\n if (!keepRolled) {\r\n itemsRolled.set([]);\r\n }\r\n for (const table of $populationTables) {\r\n table.open = false;\r\n await evaluateTable(table, true);\r\n }\r\n timesRolled = $itemsRolled.reduce((total, item) => {\r\n return total + item.quantity;\r\n }, 0);\r\n }\r\n\r\n async function evaluateTable(table, keepRolledItems) {\r\n\r\n const rollableTable = await fromUuid(table.uuid);\r\n if (!rollableTable) return;\r\n\r\n if (!keepRolledItems) {\r\n itemsRolled.set([]);\r\n }\r\n\r\n const newItems = await PileUtilities.rollMerchantTables({ tableData: [table] });\r\n\r\n const processedItems = newItems.map(itemData => {\r\n const prices = game.itempiles.API.getPricesForItem(itemData.item, {\r\n seller: store.actor,\r\n });\r\n itemData.price = prices[0]?.free ? localize(\"ITEM-PILES.Merchant.ItemFree\") : prices[0]?.priceString;\r\n return itemData;\r\n });\r\n\r\n itemsRolled.update((items) => {\r\n processedItems.forEach((newItem) => {\r\n const existingItem = items.find(\r\n (item) => item.documentId === newItem.documentId\r\n );\r\n if (existingItem) {\r\n existingItem.quantity += newItem.quantity;\r\n } else {\r\n items.push(newItem);\r\n }\r\n });\r\n items.sort((a, b) => {\r\n return a.text < b.text ? -1 : 1;\r\n });\r\n return items;\r\n });\r\n\r\n }\r\n\r\n async function addItem(itemToAdd) {\r\n await game.itempiles.API.addItems(store.actor, [itemToAdd].map(entry => ({\r\n item: entry.item,\r\n quantity: entry.quantity,\r\n flags: entry.flags\r\n })));\r\n removeItem(itemToAdd);\r\n }\r\n\r\n function removeItem(itemToRemove) {\r\n itemsRolled.update((items) => {\r\n const existingItemIndex = items.findIndex(\r\n (item) => item.documentId === itemToRemove.documentId\r\n );\r\n items.splice(existingItemIndex, 1);\r\n return items;\r\n });\r\n }\r\n\r\n async function addAllItems() {\r\n const itemsToAdd = get(itemsRolled).map(entry => ({\r\n item: entry.item,\r\n quantity: entry.quantity,\r\n flags: entry.flags\r\n }));\r\n await game.itempiles.API.addItems(store.actor, itemsToAdd);\r\n itemsRolled.set([]);\r\n }\r\n\r\n async function clearAllItems(services = false) {\r\n const localization = services ? \"Services\" : \"Items\";\r\n const doContinue = await TJSDialog.confirm({\r\n title: \"Item Piles - \" + localize(`ITEM-PILES.Dialogs.ClearAll${localization}.Title`),\r\n content: {\r\n class: CustomDialog,\r\n props: {\r\n icon: \"fas fa-exclamation-triangle\",\r\n content: localize(`ITEM-PILES.Dialogs.ClearAll${localization}.Content`),\r\n },\r\n },\r\n modal: true,\r\n draggable: false,\r\n options: {\r\n height: \"auto\",\r\n headerButtonNoClose: true,\r\n },\r\n });\r\n if (!doContinue) return false;\r\n await game.itempiles.API.removeItems(store.actor, game.itempiles.API.getActorItems(store.actor)\r\n .filter(item => {\r\n const itemFlags = PileUtilities.getItemFlagData(item);\r\n return services === itemFlags.isService && !itemFlags.keepOnMerchant && !itemFlags.keepIfZero;\r\n }));\r\n }\r\n\r\n async function previewItem(itemData) {\r\n itemData.item?.sheet?.render(true);\r\n }\r\n\r\n async function removeAddedItem(itemToRemove) {\r\n store.actor.deleteEmbeddedDocuments(\"Item\", [itemToRemove.item.id]);\r\n }\r\n\r\n function addTable() {\r\n populationTables.update((tabs) => {\r\n tabs.push({\r\n uuid: selectedTable,\r\n addAll: false,\r\n open: false,\r\n timesToRoll: \"1d4-1\",\r\n customCategory: \"\",\r\n items: {}\r\n });\r\n return tabs;\r\n });\r\n }\r\n\r\n async function removeTable(tableUuid) {\r\n\r\n const table = get(tables)[tableUuid];\r\n\r\n const doContinue = await TJSDialog.confirm({\r\n title: \"Item Piles - \" + game.i18n.localize(\"ITEM-PILES.Dialogs.RemoveMerchantTable.Title\"),\r\n content: {\r\n class: CustomDialog,\r\n props: {\r\n header: game.i18n.localize(\"ITEM-PILES.Dialogs.RemoveMerchantTable.Title\"),\r\n content: game.i18n.format(\"ITEM-PILES.Dialogs.RemoveMerchantTable.Content\", { table_name: table.name }),\r\n icon: \"fas fa-exclamation-triangle\"\r\n }\r\n },\r\n modal: true,\r\n draggable: false,\r\n rejectClose: false,\r\n defaultYes: true,\r\n options: {\r\n height: \"auto\"\r\n }\r\n });\r\n\r\n if (!doContinue) return;\r\n\r\n populationTables.update((tabs) => {\r\n return tabs.filter((t) => t.uuid !== tableUuid);\r\n });\r\n }\r\n\r\n let createId = Hooks.on(\"createRollTable\", () => {\r\n tables.set(getTables());\r\n });\r\n let deleteId = Hooks.on(\"deleteRollTable\", () => {\r\n tables.update(() => {\r\n const newTables = getTables();\r\n populationTables.update(values => values.filter((t) => newTables[t.uuid]));\r\n return newTables;\r\n });\r\n });\r\n\r\n onDestroy(() => {\r\n Hooks.off(\"createRollTable\", createId);\r\n Hooks.off(\"deleteRollTable\", deleteId);\r\n });\r\n\r\n</script>\r\n\r\n<div class=\"item-piles-flexrow\" style=\"height:100%;\">\r\n\t<div style=\"margin-right:0.5rem; max-width: 50%; max-height:100%; overflow-y:scroll;\">\r\n\t\t{#if !(currentItems.length + currentServices.length)}\r\n\t\t\t<div class=\"item-piles-populate-header\">\r\n\t\t\t\t{localize(\"ITEM-PILES.Merchant.BuyNoItems\")}\r\n\t\t\t</div>\r\n\t\t{/if}\r\n\r\n\t\t{#if currentServices.length}\r\n\t\t\t<div class=\"item-piles-populate-header\">\r\n\t\t\t\t{localize(\"ITEM-PILES.Merchant.CurrentServices\")}\r\n\t\t\t</div>\r\n\t\t{/if}\r\n\r\n\t\t{#each currentServices as item (item.id)}\r\n\t\t\t<div\r\n\t\t\t\tclass=\"item-piles-flexrow item-piles-item-row item-piles-even-color\"\r\n\t\t\t>\r\n\t\t\t\t<ItemEntry {item} showQuantity={true}>\r\n\t\t\t\t\t<button\r\n\t\t\t\t\t\tslot=\"right\"\r\n\t\t\t\t\t\tclass=\"item-piles-rolled-item-button\"\r\n\t\t\t\t\t\tstyle=\"color:red;\"\r\n\t\t\t\t\t\ton:click={() => removeAddedItem(item)}\r\n\t\t\t\t\t\tdata-fast-tooltip={localize(\"ITEM-PILES.Merchant.RemoveItem\")}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<i class=\"fas fa-trash\"/>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t</ItemEntry>\r\n\t\t\t</div>\r\n\t\t{/each}\r\n\r\n\t\t{#if currentServices.length}\r\n\t\t\t<button class=\"item-piles-button\" style=\"margin:5px 0;\" on:click={() => clearAllItems(true)}>\r\n\t\t\t\t<i class=\"fas fa-trash\"/>\r\n\t\t\t\t{localize(\"ITEM-PILES.Merchant.ClearAllServices\")}\r\n\t\t\t</button>\r\n\t\t{/if}\r\n\r\n\t\t{#if currentItems.length}\r\n\t\t\t<div class=\"item-piles-populate-header\">\r\n\t\t\t\t{localize(\"ITEM-PILES.Merchant.CurrentItems\")}\r\n\t\t\t</div>\r\n\t\t{/if}\r\n\r\n\t\t{#each currentItems as item (item.id)}\r\n\t\t\t<div\r\n\t\t\t\tclass=\"item-piles-flexrow item-piles-item-row item-piles-even-color\"\r\n\t\t\t>\r\n\t\t\t\t<ItemEntry {item} showQuantity={true}>\r\n\t\t\t\t\t<button\r\n\t\t\t\t\t\tslot=\"right\"\r\n\t\t\t\t\t\tclass=\"item-piles-rolled-item-button\"\r\n\t\t\t\t\t\tstyle=\"color:red;\"\r\n\t\t\t\t\t\ton:click={() => removeAddedItem(item)}\r\n\t\t\t\t\t\tdata-fast-tooltip={localize(\"ITEM-PILES.Merchant.RemoveItem\")}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<i class=\"fas fa-trash\"/>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t</ItemEntry>\r\n\t\t\t</div>\r\n\t\t{/each}\r\n\r\n\t\t{#if currentItems.length}\r\n\t\t\t<button class=\"item-piles-button\" style=\"margin:5px 0;\" on:click={() => clearAllItems()}>\r\n\t\t\t\t<i class=\"fas fa-trash\"/>\r\n\t\t\t\t{localize(\"ITEM-PILES.Merchant.ClearAllItems\")}\r\n\t\t\t</button>\r\n\t\t{/if}\r\n\t</div>\r\n\r\n\t<div style=\"padding-right:0.25rem; max-width: 50%; max-height:100%; overflow-y:scroll;\">\r\n\r\n\t\t<div class=\"item-piles-populate-header\">\r\n\t\t\t<span style=\"flex:1 0 auto;\">{localize(\"ITEM-PILES.Merchant.RollableTables\")}</span>\r\n\t\t\t<button on:click={() => { rollAllTables() }}\r\n\t\t\t\t\t\t\tstyle=\"height: 20px; line-height: inherit; font-size: 0.75rem; flex:1 0 auto; margin:0;\">\r\n\t\t\t\t<i class=\"fas fa-dice-d20\"></i> {localize(\"ITEM-PILES.Merchant.RollAllTables\")}\r\n\t\t\t</button>\r\n\t\t</div>\r\n\r\n\t\t{#each $populationTables as table}\r\n\t\t\t<div class=\"item-piles-item-row item-piles-even-color\"\r\n\t\t\t\t\t style=\"min-height: 28px; padding: 3px 3px 3px 5px;\">\r\n\t\t\t\t<div class=\"item-piles-flexrow\" style=\"align-items: center;\">\r\n\t\t\t\t\t<div style=\"max-width: 100%; overflow: hidden; text-overflow: ellipsis;\">\r\n\t\t\t\t\t\t<strong style=\"max-width:100%; word-break: break-all;\">{$tables[table.uuid].name}</strong>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<button class=\"item-piles-rolled-item-button\"\r\n\t\t\t\t\t\t\t\t\ton:click={() => { removeTable(table.uuid) }}\r\n\t\t\t\t\t\t\t\t\tdata-fast-tooltip={localize(\"ITEM-PILES.Merchant.ToolTipRemoveTable\")}\r\n\t\t\t\t\t\t\t\t\tdata-fast-tooltip-direction={TooltipManager.TOOLTIP_DIRECTIONS.UP}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<i class=\"fas fa-trash\" style=\"color:#de0e0e;\"></i>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t\t<button class=\"item-piles-rolled-item-button\"\r\n\t\t\t\t\t\t\t\t\ton:click={() => { table.open = !table.open; }}\r\n\t\t\t\t\t\t\t\t\tdata-fast-tooltip={localize(\"ITEM-PILES.Merchant.TooltipConfigureTable\")}\r\n\t\t\t\t\t\t\t\t\tdata-fast-tooltip-direction={TooltipManager.TOOLTIP_DIRECTIONS.UP}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<i class=\"fas fa-cog\"></i>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t\t<button class=\"item-piles-rolled-item-button\"\r\n\t\t\t\t\t\t\t\t\ton:click={() => { table.open = false; evaluateTable(table, keepRolled); }}\r\n\t\t\t\t\t\t\t\t\tdata-fast-tooltip={localize(\"ITEM-PILES.Merchant.TooltipRollTable\")}\r\n\t\t\t\t\t\t\t\t\tdata-fast-tooltip-direction={TooltipManager.TOOLTIP_DIRECTIONS.UP}\r\n\t\t\t\t\t\t\t\t\tstyle=\"margin-right:0;\">\r\n\t\t\t\t\t\t<i class=\"fas fa-dice-d20\"></i>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t</div>\r\n\t\t\t\t{#if table.open}\r\n\t\t\t\t\t<div class=\"item-piles-flexcol\" style=\"margin-top:5px;\"\r\n\t\t\t\t\t\t\t transition:slide={{ duration: 200, easing: quintOut }}>\r\n\t\t\t\t\t\t<div class=\"item-piles-flexrow\" style=\"align-items: center; margin-bottom: 0.25rem;\">\r\n\t\t\t\t\t\t\t<label\r\n\t\t\t\t\t\t\t\tstyle=\"margin-right:5px;\">{localize(\"ITEM-PILES.Merchant.TableCustomCategory\")}</label>\r\n\t\t\t\t\t\t\t<CustomCategoryInput bind:value={table.customCategory}/>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"item-piles-flexrow\">\r\n\t\t\t\t\t\t\t<div class=\"item-piles-flexrow\" style=\"align-items: center; flex:0 1 auto; min-height:26px;\">\r\n\t\t\t\t\t\t\t\t<label style=\"flex:0 1 auto; margin-right:5px;\"\r\n\t\t\t\t\t\t\t\t\t\t\t for={\"table-id-\"+table.uuid}>{localize(\"ITEM-PILES.Merchant.TableAddAllItems\")}</label>\r\n\t\t\t\t\t\t\t\t<input style=\"width:15px; height:15px; margin:0; flex:0;\" id={\"table-id-\"+table.uuid}\r\n\t\t\t\t\t\t\t\t\t\t\t bind:checked={table.addAll}\r\n\t\t\t\t\t\t\t\t\t\t\t on:change={() => {\r\n if(!table.addAll) return;\r\n table.items = Object.fromEntries($tables[table.uuid].items.map(item => [item.id, \"1d4\"]));\r\n }}\r\n\t\t\t\t\t\t\t\t\t\t\t type=\"checkbox\"/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t{#if !table.addAll}\r\n\t\t\t\t\t\t\t\t<div class=\"item-piles-flexrow item-piles-item-row\" style=\"align-items: center; flex:1;\">\r\n\t\t\t\t\t\t\t\t\t<label\r\n\t\t\t\t\t\t\t\t\t\tstyle=\"margin-right:5px; text-align: right;\">{localize(\"ITEM-PILES.Merchant.TableTimesToRoll\")}</label>\r\n\t\t\t\t\t\t\t\t\t<input type=\"text\" placeholder=\"2d6+4\" bind:value={table.timesToRoll}\r\n\t\t\t\t\t\t\t\t\t\t\t\t style=\"height:20px; margin: 3px; max-width: 50px; font-size: 0.75rem;\"\r\n\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t{#if table.addAll}\r\n\t\t\t\t\t\t\t{#each $tables[table.uuid].items as item (item.id)}\r\n\t\t\t\t\t\t\t\t<div class=\"item-piles-flexrow item-piles-item-row item-piles-odd-color\">\r\n\t\t\t\t\t\t\t\t\t<div class=\"item-piles-img-container\">\r\n\t\t\t\t\t\t\t\t\t\t<img class=\"item-piles-img\" src={item.img}/>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t\t<div class=\"item-piles-name item-piles-text\">\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"item-piles-name-container\">\r\n\t\t\t\t\t\t\t\t\t\t\t<a class=\"item-piles-clickable\" on:click={() => previewItem(item)}>{item.text}</a>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t\t<div class=\"item-piles-quantity-container\" style=\"flex:0 1 75px;\">\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"item-piles-quantity-input-container\">\r\n\t\t\t\t\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"item-piles-quantity\"\r\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={(table?.items?.[item.id] ?? \"1d4\")}\r\n\t\t\t\t\t\t\t\t\t\t\t\ton:change={(event) => {\r\n table.items[item.id] = event.target.value;\r\n }}\r\n\t\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t{/each}\r\n\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t{/if}\r\n\t\t\t</div>\r\n\t\t{/each}\r\n\r\n\t\t<div class=\"item-piles-flexrow\" style=\"margin-top: 0.5rem; flex-wrap:nowrap;\">\r\n\r\n\t\t\t<select bind:value={selectedTable} style=\"max-width: calc(100% - 81px);\">\r\n\t\t\t\t{#each selectableTables as [tableUuid, table] (tableUuid)}\r\n\t\t\t\t\t<option value={tableUuid}>{table.name}</option>\r\n\t\t\t\t{/each}\r\n\t\t\t\t{#if foundry.utils.isEmpty($tables)}\r\n\t\t\t\t\t<option value=\"\">\r\n\t\t\t\t\t\t{localize(\"ITEM-PILES.Merchant.NoRollTables\")}\r\n\t\t\t\t\t</option>\r\n\t\t\t\t{/if}\r\n\t\t\t</select>\r\n\r\n\t\t\t<button class=\"item-piles-button\" on:click={() => addTable()} style=\"max-width:80px; min-width:80px;\">\r\n\t\t\t\t{localize(\"ITEM-PILES.Merchant.AddTable\")}\r\n\t\t\t</button>\r\n\r\n\t\t</div>\r\n\r\n\t\t<hr style=\"margin:5px 0;\"/>\r\n\r\n\t\t<div class=\"item-piles-flexrow item-piles-roll-header\">\r\n\t\t\t<label>\r\n\t\t\t\t{localize(\r\n timesRolled && $itemsRolled.length\r\n ? \"ITEM-PILES.Merchant.RolledTimes\"\r\n : \"ITEM-PILES.Merchant.ClickRoll\",\r\n { rolls: timesRolled }\r\n )}\r\n\t\t\t</label>\r\n\r\n\t\t\t<div class=\"item-piles-flexrow item-piles-keep-rolled\">\r\n\t\t\t\t<label>{localize(\"ITEM-PILES.Merchant.KeepRolled\")}</label>\r\n\t\t\t\t<input bind:checked={keepRolled} type=\"checkbox\"/>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\r\n\t\t{#if $itemsRolled.length}\r\n\t\t\t{#each $itemsRolled as item (item.documentId)}\r\n\t\t\t\t<div\r\n\t\t\t\t\tclass=\"item-piles-flexrow item-piles-item-row item-piles-even-color\"\r\n\t\t\t\t>\r\n\t\t\t\t\t<button\r\n\t\t\t\t\t\tclass=\"item-piles-rolled-item-button\"\r\n\t\t\t\t\t\ton:click={() => addItem(item)}\r\n\t\t\t\t\t\tdata-fast-tooltip={localize(\"ITEM-PILES.Merchant.AddItem\")}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<i class=\"fas fa-arrow-left\"/>\r\n\t\t\t\t\t</button>\r\n\r\n\t\t\t\t\t<div class=\"item-piles-img-container\">\r\n\t\t\t\t\t\t<img class=\"item-piles-img\" src={item.img}/>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"item-piles-name\">\r\n\t\t\t\t\t\t<div class=\"item-piles-name-container\">\r\n\t\t\t\t\t\t\t<a\r\n\t\t\t\t\t\t\t\tclass=\"item-piles-clickable\"\r\n\t\t\t\t\t\t\t\ton:click={(_) => previewItem(item)}>{item.text}</a\r\n\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"item-piles-quantity-container\">\r\n\t\t\t\t\t\t{#if item.price}\r\n\t\t\t\t\t\t\t<small style=\"white-space: nowrap;\">{item.price}</small>\r\n\t\t\t\t\t\t\t<i\r\n\t\t\t\t\t\t\t\tclass=\"fas fa-times\"\r\n\t\t\t\t\t\t\t\tstyle=\"color: #555; font-size: 0.75rem; opacity: 0.75;\"\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t\t<div class=\"item-piles-quantity-input-container\">\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\tclass=\"item-piles-quantity\"\r\n\t\t\t\t\t\t\t\ttype=\"number\"\r\n\t\t\t\t\t\t\t\tmin=\"0\"\r\n\t\t\t\t\t\t\t\tbind:value={item.quantity}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<button\r\n\t\t\t\t\t\tclass=\"item-piles-rolled-item-button\"\r\n\t\t\t\t\t\tstyle=\"color:red;\"\r\n\t\t\t\t\t\ton:click={() => removeItem(item)}\r\n\t\t\t\t\t\tdata-fast-tooltip={localize(\"ITEM-PILES.Merchant.RemoveItem\")}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<i class=\"fas fa-trash\"/>\r\n\t\t\t\t\t</button>\r\n\t\t\t\t</div>\r\n\t\t\t{/each}\r\n\r\n\t\t\t<div class=\"item-piles-flexrow\" style=\"margin:5px 0;\">\r\n\r\n\t\t\t\t<button class=\"item-piles-button\" on:click={() => addAllItems()}>\r\n\t\t\t\t\t{localize(\"ITEM-PILES.Merchant.AddAll\")}\r\n\t\t\t\t\t<i class=\"fas fa-arrow-left\"/>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t\t<button class=\"item-piles-button\"\r\n\t\t\t\t\t\t\t\tstyle=\"color:red; max-width:30px;\"\r\n\t\t\t\t\t\t\t\ton:click={() => { $itemsRolled = []; }}\r\n\t\t\t\t\t\t\t\tdata-fast-tooltip={localize(\"ITEM-PILES.Merchant.ToolTipRemoveAllRolledItems\")}>\r\n\t\t\t\t\t<i class=\"fas fa-trash\"/>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\t\t{/if}\r\n\r\n\t</div>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-piles-populate {\r\n\r\n &-header {\r\n display: grid;\r\n grid-template-columns: 1fr auto;\r\n column-gap: 5px;\r\n align-items: center;\r\n min-height: 20px;\r\n margin: 0.125rem 0 0.5rem 0;\r\n }\r\n }\r\n\r\n .item-piles-roll-header {\r\n margin-bottom: 0.5rem;\r\n align-items: center;\r\n }\r\n\r\n .item-piles-keep-rolled {\r\n align-items: center;\r\n justify-content: flex-end;\r\n font-size: 0.75rem;\r\n text-align: right;\r\n flex: 0 1 auto;\r\n\r\n input {\r\n height: 14px;\r\n }\r\n }\r\n\r\n .item-piles-name {\r\n flex: 1 0 auto;\r\n }\r\n\r\n .item-piles-quantity-container {\r\n flex: 0 1 50px;\r\n gap: 4px;\r\n }\r\n\r\n .item-piles-button {\r\n height: 27px;\r\n line-height: inherit;\r\n\r\n /* alignt icons */\r\n flex-direction: row;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n gap: 0.25rem;\r\n }\r\n\r\n .item-piles-rolled-item-button {\r\n min-height: 22px;\r\n min-width: 22px;\r\n margin: 2px;\r\n font-size: 0.65rem;\r\n padding: 0.25rem;\r\n flex: 0;\r\n line-height: inherit;\r\n\r\n i {\r\n margin: 0;\r\n }\r\n }\r\n\r\n .fix-height-checkbox {\r\n height: 20px;\r\n }\r\n\r\n .item-piles-header-button {\r\n min-width: 30px;\r\n height: 30px;\r\n text-align: center;\r\n padding: 0;\r\n margin: 0;\r\n }\r\n\r\n .item-piles-remove-button {\r\n font-size: 0.75rem;\r\n width: 30px;\r\n height: 30px;\r\n align-items: center;\r\n display: flex;\r\n justify-content: center;\r\n\r\n color: red;\r\n\r\n &[disabled] {\r\n color: gray;\r\n }\r\n }\r\n\r\n .item-piles-quantity-input-container {\r\n min-width: 40px;\r\n }\r\n</style>\r\n\r\n","<script>\n\n import * as Helpers from \"../../helpers/helpers.js\"\n\n export let currency;\n export let options;\n\n let name = currency.name;\n let img = currency.img;\n let abbreviation = currency.abbreviation;\n let quantity = currency.quantity;\n\n let text = \"\";\n $: {\n let number = options.abbreviateNumbers ? Helpers.abbreviateNumbers($quantity) : $quantity;\n if ($abbreviation) {\n if (options.abbreviations) {\n text = $abbreviation.replace(\"{#}\", number);\n } else {\n text = number;\n }\n } else {\n text = `${$name} (x${$quantity})`;\n }\n }\n\n</script>\n\n<div class=\"item-piles-flexrow{options.reverse ? '-reverse' : ''} item-piles-item-row\" data-fast-tooltip={$name}\n\t\t data-fast-tooltip-activation-speed=\"0\" data-fast-tooltip-deactivation-speed=\"0\" style=\"flex:0 1 auto;\">\n\n\t<div class=\"item-piles-img-container\"\n\t\t\t style=\"min-height: {options.imgSize}px; min-width: {options.imgSize}px; max-width: {options.imgSize}px; max-height: {options.imgSize}px;\">\n\t\t<img class=\"item-piles-img\" src=\"{$img}\"/>\n\t</div>\n\n\t<div class=\"item-piles-name item-piles-text\" style=\"flex:0 1 auto; margin: 0 0.25rem;\">\n\t\t<div class=\"item-piles-name-container\">\n\t\t\t{text}\n\t\t</div>\n\t</div>\n\n</div>\n","<script>\r\n\r\n import CurrencyListEntry from \"./CurrencyListEntry.svelte\";\r\n\r\n export let currencies;\r\n export let options = {};\r\n\r\n $: primary = $currencies.filter(currency => !currency.isSecondaryCurrency);\r\n $: secondary = $currencies.filter(currency => currency.isSecondaryCurrency);\r\n\r\n options = foundry.utils.mergeObject({\r\n reverse: false,\r\n abbreviations: false,\r\n abbreviateNumbers: false,\r\n imgSize: 24\r\n }, options)\r\n\r\n</script>\r\n\r\n<div class=\"item-piles-flexrow item-piles-currency-list\" style={$$props.style}>\r\n\r\n\t{#each primary as currency (currency.identifier)}\r\n\t\t<CurrencyListEntry {currency} {options}/>\r\n\t{/each}\r\n\r\n\t{#if secondary.length}\r\n\r\n\t\t<div class=\"item-piles-vertical-divider\"></div>\r\n\r\n\t\t{#each secondary as currency (currency.identifier)}\r\n\t\t\t<CurrencyListEntry {currency} {options}/>\r\n\t\t{/each}\r\n\t{/if}\r\n\r\n\t<slot/>\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n .item-piles-vertical-divider {\r\n min-height: 1rem;\r\n flex: 0;\r\n margin: 2px 0.25rem 2px 0;\r\n min-width: 1px;\r\n background-color: rgba(0, 0, 0, 0.5);\r\n }\r\n</style>\r\n","<script>\r\n\r\n import CurrencyList from \"../components/CurrencyList.svelte\";\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import { writable } from \"svelte/store\";\r\n\r\n export let store;\r\n export let recipientStore;\r\n\r\n let recipientDocument = writable({});\r\n let currencies = writable([]);\r\n $: {\r\n recipientDocument = recipientStore?.document;\r\n currencies = recipientStore?.allCurrencies;\r\n }\r\n const merchantCurrencies = store?.allCurrencies;\r\n const merchantPileData = store.pileData;\r\n\r\n</script>\r\n\r\n{#if recipientStore}\r\n\t<div class=\"item-piles-flexrow merchant-bottom-row\">\r\n\t\t<div style=\"flex: 0 1 auto;\">\r\n\t\t\t{localize(\"ITEM-PILES.Merchant.ShoppingAs\", { actorName: $recipientDocument.name })}\r\n\t\t</div>\r\n\t\t<CurrencyList {currencies}\r\n\t\t\t\t\t\t\t\t\toptions={{ abbreviations: false, imgSize: 18, abbreviateNumbers: true }}\r\n\t\t\t\t\t\t\t\t\tclass=\"item-piles-currency-list\"/>\r\n\t</div>\r\n{:else if game.user.isGM && !$merchantPileData.infiniteCurrencies}\r\n\t<div class=\"item-piles-flexrow merchant-bottom-row\">\r\n\t\t<div style=\"flex: 0 1 auto;\">\r\n\t\t\t<a class=\"item-piles-clickable item-piles-text-right item-piles-small-text item-piles-middle\"\r\n\t\t\t\t on:click={() => store.addCurrency()}>\r\n\t\t\t\t<i class=\"fas fa-plus\"></i> {localize(\"ITEM-PILES.Inspect.AddCurrency\")}\r\n\t\t\t</a>\r\n\t\t</div>\r\n\t\t<CurrencyList currencies={merchantCurrencies}\r\n\t\t\t\t\t\t\t\t\toptions={{ abbreviations: false, imgSize: 18, abbreviateNumbers: true }}\r\n\t\t\t\t\t\t\t\t\tclass=\"item-piles-currency-list\"/>\r\n\t</div>\r\n{/if}\r\n\r\n<style>\r\n .merchant-bottom-row {\r\n flex: 0 1 auto;\r\n align-items: center;\r\n height: 31px;\r\n }\r\n</style>\r\n","<script>\r\n\r\n import MerchantItemTab from \"./MerchantItemTab.svelte\";\r\n import MerchantPopulateItemsTab from \"./MerchantPopulateItemsTab.svelte\";\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import MerchantFooter from \"./MerchantFooter.svelte\";\r\n import { writable } from \"svelte/store\";\r\n\r\n export let store;\r\n export let recipientStore;\r\n export let activeTab;\r\n\r\n let categories = store.categories;\r\n\r\n let closed = store.closed;\r\n\r\n const currencies = recipientStore?.allCurrencies || writable([]);\r\n\r\n</script>\r\n\r\n<div class=\"merchant-right-pane item-piles-flexcol\">\r\n\r\n\t<div class=\"merchant-tabbed-center\"\r\n\t\t\t style=\"flex: 1; max-height: calc(100% - {recipientStore && $currencies.length ? '34px' : '0px'})\">\r\n\r\n\t\t{#if $closed && !game.user.isGM}\r\n\t\t\t<div style=\"display: grid; place-items: center; height:100%;\">\r\n\t\t\t\t<span>{localize(\"ITEM-PILES.Merchant.MerchantClosed\")}</span>\r\n\t\t\t</div>\r\n\t\t{:else if $activeTab === \"buy\"}\r\n\t\t\t<MerchantItemTab {store} noItemsLabel=\"ITEM-PILES.Merchant.NoItemsForSale\"/>\r\n\t\t{:else if $activeTab === \"services\" }\r\n\t\t\t<MerchantItemTab {store} services={true}/>\r\n\t\t{:else if $activeTab === \"sell\"}\r\n\t\t\t<MerchantItemTab store={recipientStore} noItemsLabel=\"ITEM-PILES.Merchant.NoItemsToSell\"/>\r\n\t\t{:else if $activeTab === \"tables\"}\r\n\t\t\t<MerchantPopulateItemsTab {store}/>\r\n\t\t{/if}\r\n\r\n\t</div>\r\n\r\n\t<MerchantFooter {recipientStore} {store}/>\r\n\r\n</div>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .merchant-right-pane {\r\n flex: 1;\r\n max-height: 100%;\r\n overflow: hidden;\r\n padding-left: 0.25rem;\r\n }\r\n\r\n .merchant-tabbed-center {\r\n overflow: hidden;\r\n }\r\n\r\n</style>\r\n","<script>\r\n\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n\r\n export let store;\r\n\r\n const pileDataStore = store.pileData;\r\n const merchantName = store.name;\r\n const closed = store.closed;\r\n\r\n let openTimeText = \"\";\r\n\r\n const aboutTimeEnabled = game.modules.get('foundryvtt-simple-calendar')?.active || false;\r\n\r\n $: open = $pileDataStore.openTimes.enabled ? $pileDataStore.openTimes?.open : false;\r\n $: close = $pileDataStore.openTimes.enabled ? $pileDataStore.openTimes?.close : false;\r\n\r\n $: {\r\n if ($pileDataStore.openTimes.enabled) {\r\n let openText = `${open.hour.toString().padStart(2, \"0\")}:${open.minute.toString().padStart(2, \"0\")}`;\r\n let closeText = `${close.hour.toString().padStart(2, \"0\")}:${close.minute.toString().padStart(2, \"0\")}`;\r\n openTimeText = `${openText} - ${closeText}`;\r\n }\r\n }\r\n\r\n</script>\r\n\r\n<div class=\"item-piles-flexrow merchant-top-bar item-piles-bottom-divider\">\r\n\t<div class=\"merchant-name\">{$merchantName}</div>\r\n\t<div class=\"opening-hours item-piles-flexcol\">\r\n\t\t{#if $pileDataStore.openTimes.enabled}\r\n <span>\r\n {localize(\"ITEM-PILES.Merchant.OpenTimes\")}\r\n </span>\r\n\t\t\t<span style=\"font-style: italic;\">\r\n {#if game.user.isGM}\r\n {#if aboutTimeEnabled && $pileDataStore.openTimes.status !== \"auto\"}\r\n <a class=\"item-piles-right-divider\" on:click={() => { store.setOpenStatus(\"auto\"); }}>\r\n <i class=\"fas fa-clock\"></i>\r\n\t\t\t\t\t\t{localize(`ITEM-PILES.Merchant.OpenCloseAuto`)}\r\n </a>\r\n\t\t\t\t\t{/if}\r\n\t\t\t\t\t<a class=\"item-piles-right-divider\" on:click={() => { store.setOpenStatus($closed ? \"open\" : \"closed\"); }}>\r\n <i class=\"fas\" class:fa-door-open={!$closed} class:fa-door-closed={$closed}></i>\r\n\t\t\t\t\t\t{localize(`ITEM-PILES.Merchant.${!$closed ? \"Open\" : \"Closed\"}`)}\r\n </a>\r\n {/if}\r\n\t\t\t\t{openTimeText}\r\n </span>\r\n\t\t{:else if game.user.isGM}\r\n\t\t\t<a style=\"flex:0;\" on:click={() => { store.setOpenStatus($closed ? \"open\" : \"closed\"); }}>\r\n\t\t\t\t<i class=\"fas\" class:fa-door-open={!$closed} class:fa-door-closed={$closed}></i>\r\n\t\t\t\t{localize(`ITEM-PILES.Merchant.${!$closed ? \"Open\" : \"Closed\"}`)}\r\n\t\t\t</a>\r\n\t\t{/if}\r\n\t</div>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n .merchant-top-bar {\r\n\r\n flex: 0 1 auto;\r\n\r\n .opening-hours {\r\n text-align: right;\r\n flex: 0 1 auto;\r\n justify-content: center;\r\n\r\n .item-piles-right-divider {\r\n margin-right: 0.25rem;\r\n padding-right: 0.5rem;\r\n border-right: 1px solid rgba(0, 0, 0, 0.5);\r\n }\r\n }\r\n\r\n .merchant-name {\r\n font-size: 2em;\r\n }\r\n\r\n }\r\n\r\n</style>\r\n","<script>\r\n import { getContext, onDestroy } from 'svelte';\r\n import { ApplicationShell } from '@typhonjs-fvtt/runtime/svelte/component/core';\r\n import MerchantStore from \"../../stores/merchant-store.js\";\r\n import * as Helpers from \"../../helpers/helpers.js\";\r\n import * as PileUtilities from \"../../helpers/pile-utilities.js\";\r\n import DropZone from \"../components/DropZone.svelte\";\r\n import MerchantLeftPane from \"./MerchantLeftPane.svelte\";\r\n import MerchantRightPane from \"./MerchantRightPane.svelte\";\r\n import MerchantTopBar from \"./MerchantTopBar.svelte\";\r\n import Tabs from \"../components/Tabs.svelte\";\r\n import { get, writable } from \"svelte/store\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let elementRoot;\r\n\r\n export let merchant;\r\n export let recipient;\r\n\r\n export let store = MerchantStore.make(application, merchant, recipient);\r\n export let recipientStore = recipient ? MerchantStore.make(application, recipient, merchant, { recipientPileData: store.pileData }) : false;\r\n\r\n let pileData = store.pileData;\r\n\r\n onDestroy(() => {\r\n store.onDestroy();\r\n if (recipientStore) recipientStore.onDestroy();\r\n });\r\n\r\n let priceSelector = store.priceSelector;\r\n let categories = store.categories;\r\n let visibleItems = store.visibleItems;\r\n\r\n async function dropData(data) {\r\n\r\n if (!game.user.isGM) return;\r\n\r\n if (!data.type) {\r\n throw Helpers.custom_error(\"Something went wrong when dropping this item!\")\r\n }\r\n\r\n if (data.type === \"Actor\") {\r\n const newRecipient = data.uuid ? (await fromUuid(data.uuid)) : game.actors.get(data.id);\r\n store.updateRecipient(newRecipient);\r\n if (recipientStore) {\r\n return recipientStore.updateSource(newRecipient);\r\n }\r\n recipientStore = MerchantStore.make(application, newRecipient, merchant, { recipientPileData: store.pileData });\r\n return;\r\n }\r\n\r\n if (data.type !== \"Item\") {\r\n throw Helpers.custom_error(\"You must drop an item, not \" + data.type.toLowerCase() + \"!\")\r\n }\r\n\r\n const item = await Item.implementation.fromDropData(data);\r\n const validItem = await PileUtilities.checkItemType(merchant, item, {\r\n errorText: \"ITEM-PILES.Errors.DisallowedItemTrade\",\r\n warningTitle: \"ITEM-PILES.Dialogs.TypeWarning.Title\",\r\n warningContent: \"ITEM-PILES.Dialogs.TypeWarning.TradeContent\"\r\n });\r\n if (!validItem) return;\r\n\r\n return game.itempiles.API.addItems(merchant, [{\r\n item: validItem,\r\n quantity: 1\r\n }]);\r\n\r\n }\r\n\r\n const activeTab = writable(\"buy\");\r\n\r\n let tabs;\r\n $: {\r\n const hasItems = $visibleItems.some(item => !get(item.category).service)\r\n const hasServices = $visibleItems.some(item => get(item.category).service)\r\n const canSell = !$pileData.purchaseOnly && recipientStore;\r\n const showBuy = hasItems || (!hasItems && !hasServices && !canSell)\r\n tabs = [\r\n {\r\n value: 'buy',\r\n label: game.i18n.localize('ITEM-PILES.Merchant.BuyItems'),\r\n hidden: !showBuy\r\n },\r\n {\r\n value: 'services',\r\n label: game.i18n.localize('ITEM-PILES.Merchant.BuyServices'),\r\n hidden: !hasServices\r\n },\r\n {\r\n value: 'sell',\r\n label: game.i18n.localize('ITEM-PILES.Merchant.SellItems'),\r\n hidden: !canSell\r\n },\r\n {\r\n value: 'tables',\r\n label: game.i18n.localize('ITEM-PILES.Merchant.PopulateItems'),\r\n hidden: !game.user.isGM\r\n },\r\n ];\r\n if (tabs.find(tab => tab.value === $activeTab).hidden) {\r\n $activeTab = tabs.find(tab => !tab.hidden).value;\r\n }\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<svelte:window on:click={() => { $priceSelector = \"\"; }}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\t<DropZone callback={dropData} style=\"display: flex; flex-direction: column; height: 100%;\">\r\n\t\t<MerchantTopBar {store}/>\r\n\t\t<Tabs bind:activeTab={$activeTab}\r\n\t\t\t\t\tbind:tabs=\"{tabs}\"\r\n\t\t\t\t\tseparateElements\r\n\t\t\t\t\tstyle=\"flex: 0 1 auto; font-size: 1.1rem; justify-content: flex-start;\"\r\n\t\t\t\t\tunderscore\r\n\t\t/>\r\n\t\t<div class=\"item-piles-flexrow item-pile-merchant-content\">\r\n\t\t\t{#if $activeTab !== \"tables\"}\r\n\t\t\t\t<MerchantLeftPane {store}/>\r\n\t\t\t{/if}\r\n\t\t\t<MerchantRightPane {activeTab} {recipientStore} {store}/>\r\n\t\t</div>\r\n\t</DropZone>\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .hidden {\r\n display: none;\r\n }\r\n\r\n .item-pile-merchant-content {\r\n\r\n flex: 1;\r\n max-height: calc(100% - 84px);\r\n\r\n }\r\n\r\n\r\n</style>\r\n","<script>\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n import { getContext } from \"svelte\";\n import { getUserCharacter } from \"../../../helpers/utilities.js\";\n\n const { application } = getContext('#external');\n\n export let elementRoot;\n\n let form;\n\n getUserCharacter()\n\n const users = game.users\n .filter(u => u.active && (getUserCharacter(u) || u.isGM) && !(application.options.excludeSelf && u === game.user))\n .map(u => ({\n id: u.id,\n name: u.name,\n selected: true\n }));\n\n function requestSubmit() {\n form.requestSubmit();\n }\n\n function submit() {\n const finalUsers = users.filter(user => user.selected).map(user => user.id);\n application.options.resolve(finalUsers);\n application.close();\n }\n\n</script>\n\n<svelte:options accessors={true}/>\n\n<ApplicationShell bind:elementRoot>\n\n\t<form autocomplete=\"off\" bind:this={form} class=\"item-piles-flexcol\" on:submit|once|preventDefault={submit}\n\t\t\t\tstyle=\"padding:0.5rem;\">\n\n\t\t<p style=\"margin-top: 0;text-align: center;\">\n\t\t\t<strong>{localize(\"ITEM-PILES.Dialogs.UserSelect.Content\")}</strong>\n\t\t</p>\n\n\t\t<div style=\"display:grid; grid-template-columns: auto 25px;\">\n\n\t\t\t{#each users as user (user.id)}\n\n\t\t\t\t<div class=\"item-piles-flexrow\" style=\"align-items: center;\">\n\t\t\t\t\t<label for={\"item-piles-user-\" + user.id} class=\"item-piles-clickable\">{user.name}</label>\n\t\t\t\t</div>\n\t\t\t\t<input id={\"item-piles-user-\" + user.id} type=\"checkbox\" bind:checked={user.selected}/>\n\n\t\t\t{/each}\n\n\t\t</div>\n\n\t\t<footer class=\"sheet-footer item-piles-flexrow\" style=\"margin-top: 1rem;\">\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\n\t\t\t\t<i class=\"fas fa-check\"></i>\n\t\t\t\t{localize(\"Okay\")}\n\t\t\t</button>\n\t\t</footer>\n\n\t</form>\n\n</ApplicationShell>\n","import UserSelectDialogShell from \"./user-select-dialog-shell.svelte\";\r\nimport { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\n\r\nexport default class UserSelectDialog extends SvelteApplication {\r\n\r\n /**\r\n * @param options\r\n */\r\n constructor(options = {}) {\r\n super({\r\n title: game.i18n.localize(\"ITEM-PILES.Dialogs.UserSelect.Title\"),\r\n svelte: {\r\n class: UserSelectDialogShell,\r\n target: document.body,\r\n },\r\n close: () => this.options.resolve?.(null),\r\n ...options\r\n })\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n width: 200,\r\n height: \"auto\",\r\n classes: [\"item-piles-app\"]\r\n })\r\n }\r\n\r\n static async show(options = {}) {\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(options).render(true, { focus: true });\r\n })\r\n }\r\n\r\n}\r\n","import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport ItemPileConfig from \"../item-pile-config/item-pile-config\";\r\nimport MerchantAppShell from \"./merchant-app-shell.svelte\";\r\nimport * as Helpers from \"../../helpers/helpers.js\";\r\nimport UserSelectDialog from \"../dialogs/user-select-dialog/user-select-dialog.js\";\r\nimport SETTINGS from \"../../constants/settings.js\";\r\nimport CONSTANTS from \"../../constants/constants.js\";\r\nimport * as Utilities from \"../../helpers/utilities.js\";\r\n\r\nexport default class MerchantApp extends SvelteApplication {\r\n\r\n constructor(merchant, recipient = false, options = {}, dialogData = {}) {\r\n super({\r\n title: `Merchant: ${merchant.name}`,\r\n id: `item-pile-merchant-${merchant.id}-${randomID()}`,\r\n svelte: {\r\n class: MerchantAppShell,\r\n target: document.body,\r\n props: {\r\n merchant,\r\n recipient\r\n }\r\n },\r\n zIndex: 100,\r\n ...options\r\n }, dialogData);\r\n this.merchant = merchant;\r\n this.recipient = recipient;\r\n Helpers.hooks.callAll(CONSTANTS.HOOKS.OPEN_INTERFACE, this, merchant, recipient, options, dialogData);\r\n }\r\n\r\n /** @inheritdoc */\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n classes: [\"app window-app sheet\", \"item-piles-merchant-sheet\", \"item-piles\", \"item-piles-app\"],\r\n width: 800,\r\n height: 700,\r\n closeOnSubmit: false,\r\n resizable: true\r\n });\r\n }\r\n\r\n static getActiveApp(id) {\r\n return Helpers.getActiveApps(`item-pile-merchant-${id}`, true);\r\n }\r\n\r\n static async show(merchant, recipient = false, options = {}, dialogData = {}) {\r\n const merchantActor = Utilities.getActor(merchant);\r\n const recipientActor = Utilities.getActor(recipient);\r\n const result = Helpers.hooks.call(CONSTANTS.HOOKS.PRE_OPEN_INTERFACE, merchantActor, recipientActor, options, dialogData);\r\n if (result === false) return;\r\n const app = this.getActiveApp(merchant.uuid);\r\n if (app) return app.render(false, { focus: true });\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(merchant, recipientActor, options, dialogData).render(true, { focus: true, bypassItemPiles: true });\r\n })\r\n }\r\n\r\n refreshItems() {\r\n this.svelte.applicationShell.store.refreshItems();\r\n }\r\n\r\n /** @override */\r\n _getHeaderButtons() {\r\n let buttons = super._getHeaderButtons();\r\n const newButtons = [];\r\n\r\n if (this.merchant.isOwner) {\r\n newButtons.push(\r\n {\r\n label: !Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"ITEM-PILES.Inspect.OpenSheet\" : \"\",\r\n class: \"item-piles-open-actor-sheet\",\r\n icon: \"fas fa-user\",\r\n onclick: () => {\r\n this.merchant.sheet.render(true, { focus: true, bypassItemPiles: true });\r\n }\r\n }\r\n )\r\n }\r\n\r\n if (game.user.isGM) {\r\n newButtons.push(\r\n {\r\n label: !Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"ITEM-PILES.ContextMenu.ShowToPlayers\" : \"\",\r\n class: \"item-piles-show-to-players\",\r\n icon: \"fas fa-eye\",\r\n onclick: async (event) => {\r\n const activeUsers = Array.from(game.users).filter(u => u.active && u !== game.user).map(u => u.id);\r\n if (!activeUsers.length) {\r\n return Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Warnings.NoPlayersActive\"), true);\r\n }\r\n const users = event.altKey ? activeUsers : await UserSelectDialog.show({ excludeSelf: true });\r\n if (!users || !users.length) return;\r\n Helpers.custom_notify(game.i18n.format(\"ITEM-PILES.Notifications.ShownToPlayers\", { actor_name: this.merchant.name }))\r\n return game.itempiles.API.renderItemPileInterface(this.merchant, {\r\n userIds: users,\r\n useDefaultCharacter: true\r\n });\r\n }\r\n },\r\n {\r\n label: !Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"ITEM-PILES.HUD.Configure\" : \"\",\r\n class: \"item-piles-configure-pile\",\r\n icon: \"fas fa-box-open\",\r\n onclick: () => {\r\n ItemPileConfig.show(this.merchant);\r\n }\r\n }\r\n );\r\n }\r\n return newButtons.concat(buttons);\r\n }\r\n\r\n async close(options) {\r\n const result = Helpers.hooks.call(CONSTANTS.HOOKS.PRE_CLOSE_INTERFACE, this, this.merchant, this.recipient);\r\n if (result === false) return;\r\n for (const app of Object.values(ui.windows)) {\r\n if (app !== this && this.svelte.applicationShell.store === app?.svelte?.applicationShell?.store) {\r\n app.close();\r\n }\r\n }\r\n Helpers.hooks.callAll(CONSTANTS.HOOKS.CLOSE_INTERFACE, this, this.merchant, this.recipient);\r\n return super.close(options);\r\n }\r\n\r\n}\r\n","import { TJSContextMenuImpl } from '@typhonjs-fvtt/svelte-standard/component';\n\nimport {\n A11yHelper,\n isIterable,\n isObject,\n isSvelteComponent } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Provides and manages browser window wide context menu functionality. The best way to create a context menu is to\n * attach the source KeyboardEvent or MouseEvent / PointerEvent as data in {@link TJSContextMenu.create}. This allows\n * proper keyboard handling across browsers supporting the context menu key. A A11yFocusSource data object is generated\n * which allows tracking of the source element that triggered the context menu allowing focus to return to the source\n * when the context menu is closed. This A11yFocusSource object is also forwarded on through the `onPress` callback and\n * is intended to be supplied as `SvelteApplication` options particularly for modal dialogs allowing focus to return\n * to the original source after the modal dialog is closed.\n */\nexport class TJSContextMenu\n{\n /**\n * Stores any active context menu.\n */\n static #contextMenu = void 0;\n\n /**\n * Creates and manages a browser wide context menu. The best way to create the context menu is to pass in the source\n * DOM event as it is processed for the location of the context menu to display. Likewise, a A11yFocusSource object\n * is generated that allows focus to be returned to the source location. You may supply a default focus target as a\n * fallback via `focusEl`.\n *\n * @param {object} opts - Optional parameters.\n *\n * @param {string} [opts.id] - A custom CSS ID to add to the menu. This allows CSS style targeting.\n *\n * @param {KeyboardEvent|MouseEvent} [opts.event] - The source MouseEvent or KeyboardEvent.\n *\n * @param {number} [opts.x] - X position override for the top / left of the menu.\n *\n * @param {number} [opts.y] - Y position override for the top / left of the menu.\n *\n * @param {Iterable<TJSContextMenuItemData>} [opts.items] - Menu items to display.\n *\n * @param {boolean} [opts.focusDebug] - When true the associated A11yFocusSource object will log focus target\n * data when applied.\n *\n * @param {HTMLElement|string} [opts.focusEl] - A specific HTMLElement or selector string as the default focus\n * target.\n *\n * @param {string} [opts.keyCode='Enter'] - Key to select menu items.\n *\n * @param {Record<string, string>} [opts.styles] - Optional inline styles to apply.\n *\n * @param {number} [opts.zIndex=Number.MAX_SAFE_INTEGER - 100] - Z-index for context menu.\n *\n * @param {number} [opts.duration] - Transition option for duration of transition.\n *\n * @param {Function} [opts.easing] - Transition option for easing function.\n */\n static create({ id = '', event, x, y, items, focusDebug = false, focusEl, keyCode = 'Enter', styles,\n zIndex = Number.MAX_SAFE_INTEGER - 100, duration = 200, easing, } = {})\n {\n if (this.#contextMenu !== void 0) { return; }\n\n if (!event && (typeof x !== 'number' || typeof y !== 'number'))\n {\n throw new Error(`TJSContextMenu.create error: No event or absolute X / Y position not defined.`);\n }\n\n if (event !== void 0 && !(event instanceof KeyboardEvent) && !(event instanceof MouseEvent))\n {\n throw new TypeError(`TJSContextMenu.create error: 'event' is not a KeyboardEvent or MouseEvent.`);\n }\n\n const focusSource = A11yHelper.getFocusSource({ event, x, y, focusEl, debug: focusDebug });\n\n // Create the new context menu with the last click x / y point.\n this.#contextMenu = new TJSContextMenuImpl({\n target: document.body,\n intro: true,\n props: {\n id,\n x: focusSource.x,\n y: focusSource.y,\n items: this.#processItems(items),\n focusSource,\n keyCode,\n styles,\n transitionOptions: { duration, easing },\n zIndex\n }\n });\n\n // Register an event listener to remove any active context menu if closed from a menu selection or pointer\n // down event to `document.body`.\n this.#contextMenu.$on('close', () => { this.#contextMenu = void 0; });\n }\n\n /**\n * Processes menu item data for conditions and evaluating the type of menu item.\n *\n * @param {Iterable<TJSContextMenuItemData>} items - Menu item data.\n *\n * @returns {object[]} Processed menu items.\n */\n static #processItems(items)\n {\n if (!isIterable(items)) { throw new TypeError(`TJSContextMenu error: 'items' is not an iterable list.`); }\n\n const tempList = items;\n const tempItems = [];\n\n let cntr = -1;\n\n for (const item of tempList)\n {\n cntr++;\n if (!isObject(item)) { throw new TypeError(`TJSContextMenu error: 'item[${cntr}]' is not an object.`); }\n\n // Filter items for any condition that prevents display.\n if (typeof item.condition === 'function' && !item.condition()) { continue; }\n if (typeof item.condition === 'boolean' && !item.condition) { continue; }\n\n let type;\n\n if (isSvelteComponent(item.class)) { type = 'class'; }\n else if (typeof item.icon === 'string') { type = 'icon'; }\n else if (typeof item.image === 'string') { type = 'image'; }\n else if (typeof item.separator === 'string')\n {\n if (item.separator !== 'hr')\n {\n throw new Error(\n `TJSContextMenu error: 'item[${cntr}]' has unknown separator type; only 'hr' is currently supported.`);\n }\n\n type = 'separator-hr';\n }\n\n if (type === void 0) { throw new TypeError(`TJSContextMenu error: Unknown type for 'item[${cntr}]'.`); }\n\n tempItems.push({ ...item, '#type': type });\n }\n\n return tempItems;\n }\n}\n\n/**\n * @typedef {object} TJSContextMenuItemData - Defines a menu item entry. Depending on the item data that is passed\n * into the menu you can define 4 types of items: 'icon / label', 'image / label', 'class / Svelte component', and\n * 'separator / hr'. A single callback function `onPress` is supported.\n *\n * @property {(item: TJSContextMenuItemData, object) => void} [onPress] - A callback function that receives the selected\n * item data and an object containing the A11yFocusSource data that can be passed to any Application / particularly modal\n * dialogs returning focus when closed.\n *\n * @property {boolean|(() => boolean)} [condition] - If a boolean and false or a function that invoked returns a falsy value\n * this item is not added.\n *\n * @property {Function} [class] - A Svelte component class.\n *\n * @property {object} [props] - An object passed on as props for any Svelte component.\n *\n *\n * @property {string} [icon] - A string containing icon classes.\n *\n *\n * @property {string} [image] - An image icon path.\n *\n * @property {string} [imageAlt] - An image 'alt' text description.\n *\n *\n * @property {string} [label] - A text string that is passed through localization.\n *\n * @property {'hr'} [separator] - A menu item separator; only 'hr' supported.\n */\n","import { clamp } from \"../../../helpers/helpers\";\nimport { get } from \"svelte/store\";\n\nexport function isItemColliding(item, otherItem) {\n const transform = get(item.transform);\n const otherTransform = get(otherItem.transform);\n return (\n item.id !== otherItem.id &&\n transform.x <= otherTransform.x + otherTransform.w - 1 &&\n transform.y <= otherTransform.y + otherTransform.h - 1 &&\n transform.x + transform.w - 1 >= otherTransform.x &&\n transform.y + transform.h - 1 >= otherTransform.y\n );\n}\n\nexport function getCollisions(originalItem, items) {\n return items.filter((item) => isItemColliding(originalItem, item));\n}\n\nexport function coordinate2position(coordinate, cellSize, gap) {\n return coordinate * cellSize + (coordinate + 1) * gap;\n}\n\nexport function coordinate2size(coordinate, cellSize, gap) {\n return coordinate * cellSize + (coordinate - 1) * gap;\n}\n\nexport function position2coordinate(position, cellSize, size, gap) {\n return Math.round(position / (cellSize + gap));\n}\n\nexport function snapOnMove(left, top, transform, options) {\n const { gridSize, gap, cols, enabledCols, rows, enabledRows } = options;\n const { w, h } = transform;\n\n const width = w * gridSize;\n const height = h * gridSize;\n\n let x = position2coordinate(left, gridSize, width, gap);\n let y = position2coordinate(top, gridSize, height, gap);\n\n x = clamp(x, 0, Math.min(cols, enabledCols) - w);\n y = clamp(y, 0, Math.min(rows, enabledRows) - h);\n\n return { x, y };\n}\n\nexport function calcPosition(transform, options) {\n const { gridSize, gap } = options;\n return {\n left: coordinate2position(transform.x, gridSize, gap),\n top: coordinate2position(transform.y, gridSize, gap),\n width: coordinate2size(transform.w, gridSize, gap),\n height: coordinate2size(transform.h, gridSize, gap)\n };\n}\n","<script>\n\n import { createEventDispatcher } from 'svelte';\n import { get, writable } from 'svelte/store';\n import { styleFromObject } from '../../../helpers/helpers.js';\n import { calcPosition, getCollisions, snapOnMove } from './grid-utils.js';\n\n export let item;\n export let options;\n export let items;\n export let gridContainer;\n\n const dispatch = createEventDispatcher();\n\n let itemRef = HTMLElement;\n const transformStore = item.transform;\n const previewTransform = writable({});\n const tooltip = item.name;\n\n $: transform = $transformStore;\n $: gridTransform = calcPosition(transform, options);\n $: snappedGridTransform = calcPosition({\n ...snapOnMove($previewTransform.left, $previewTransform.top, transform, options),\n w: transform.w,\n h: transform.h,\n }, options);\n $: {\n if (!active) $previewTransform = $transformStore;\n }\n\n let classes = \"\";\n $: {\n classes = \"\";\n classes += \" \" + options.hoverClass;\n classes += (options.highlightItems && item.highlight ? \" \" + options.highlightClass : \"\")\n classes += (options.highlightItems && !item.highlight ? \" \" + options.dimClass : \"\")\n }\n\n $: style = styleFromObject({\n \"position\": \"absolute\",\n \"left\": gridTransform.left + \"px\",\n \"top\": gridTransform.top + \"px\",\n \"width\": gridTransform.width + \"px\",\n \"height\": gridTransform.height + \"px\",\n \"cursor\": 'move'\n });\n\n $: ghostStyle = styleFromObject({\n \"position\": \"absolute\",\n \"left\": snappedGridTransform.left + \"px\",\n \"top\": snappedGridTransform.top + \"px\",\n \"width\": snappedGridTransform.width + \"px\",\n \"height\": snappedGridTransform.height + \"px\",\n \"opacity\": \"0.75\",\n \"z-index\": \"5\"\n });\n\n let active = false;\n let splitting = false;\n let collisions = [];\n let pointerOffset = { left: 0, top: 0 };\n\n function doubleClick(event) {\n if (event.button !== 0) return;\n dispatch(\"itemdoubleclick\", { item });\n }\n\n function moveStart(event) {\n\n if (event.button === 2) {\n return rightClick(event);\n }\n\n if (!options.canOrganize) return;\n\n // If not left mouse, skip\n if (event.button !== 0) return;\n\n if (event.pointerId) {\n itemRef.setPointerCapture(event.pointerId);\n }\n\n // Get offset for pointer within the grid item\n pointerOffset = {\n left: event.pageX - gridTransform.left,\n top: event.pageY - gridTransform.top,\n internalLeft: event.offsetX,\n internalTop: event.offsetY,\n };\n\n dispatch(\"itembegindrag\", {\n item,\n target: itemRef,\n x: event.pageX - pointerOffset.internalLeft,\n y: event.pageY - pointerOffset.internalTop\n });\n\n // Setup events for when item is moved and dropped\n window.addEventListener('pointermove', move, { passive: false });\n window.addEventListener('pointerup', moveEnd, { passive: false });\n window.addEventListener('touchmove', move, { passive: false });\n window.addEventListener('touchend', moveEnd, { passive: false });\n\n }\n\n function splitStart(event) {\n\n splitting = true;\n\n // Get offset for pointer within the grid item\n pointerOffset = {\n left: event.pageX - gridTransform.left,\n top: event.pageY - gridTransform.top,\n internalLeft: event.offsetX,\n internalTop: event.offsetY,\n };\n\n // Setup events for when item is moved and dropped\n window.addEventListener('pointermove', move, { passive: false });\n window.addEventListener('pointerup', moveEnd, { passive: false });\n window.addEventListener('touchmove', move, { passive: false });\n window.addEventListener('touchend', moveEnd, { passive: false });\n\n }\n\n function move(event) {\n\n const { pageX, pageY } = (event.type === \"touchmove\" ? event.changedTouches[0] : event);\n\n active = true;\n\n const { left, top, outOfBounds } = constrainToContainer(\n pageX - pointerOffset.left,\n pageY - pointerOffset.top\n );\n active = !outOfBounds;\n dispatch(\"itemmove\", {\n x: pageX - pointerOffset.internalLeft,\n y: pageY - pointerOffset.internalTop\n });\n previewTransform.set({\n ...transform,\n ...gridTransform,\n ...snapOnMove(left, top, transform, options),\n left,\n top,\n });\n\n if (!splitting) {\n collisions = getCollisions({ id: item.id, transform: previewTransform }, items);\n }\n\n }\n\n function constrainToContainer(left, top) {\n\n let outOfBounds = false;\n const parentRect = gridContainer.getBoundingClientRect();\n const relativeRect = {\n left: (parentRect.left - parentRect.x),\n top: (parentRect.top - parentRect.y),\n right: (parentRect.right - parentRect.x),\n bottom: (parentRect.bottom - parentRect.y),\n }\n if (left < relativeRect.left) {\n if (left < (relativeRect.left - gridTransform.width / 2)) {\n outOfBounds = true;\n }\n left = relativeRect.left;\n }\n if (top < relativeRect.top) {\n if (top < (relativeRect.top - gridTransform.height / 2)) {\n outOfBounds = true;\n }\n top = relativeRect.top;\n }\n if ((left + gridTransform.width) > relativeRect.right) {\n if ((left + gridTransform.width) > (relativeRect.right + gridTransform.width / 2)) {\n outOfBounds = true;\n }\n left = relativeRect.right - gridTransform.width;\n }\n if ((top + gridTransform.height) > relativeRect.bottom) {\n if ((top + gridTransform.height) > (relativeRect.bottom + gridTransform.height / 2)) {\n outOfBounds = true;\n }\n top = relativeRect.bottom - gridTransform.height;\n }\n\n return { left, top, outOfBounds };\n\n }\n\n function moveEnd(event) {\n\n window.removeEventListener('pointermove', move);\n window.removeEventListener('pointerup', moveEnd);\n window.removeEventListener('touchmove', move);\n window.removeEventListener('touchend', moveEnd);\n\n const finalTransform = get(previewTransform);\n\n const { pageX, pageY } = (event.type === \"touchmove\" ? event.changedTouches[0] : event);\n\n if (event.button === 2) {\n dispatch(\"itemstopdrag\", { cancelled: true });\n active = false;\n } else {\n dispatch(\"itemstopdrag\", {\n item,\n outOfBounds: !active,\n x: pageX - pointerOffset.internalLeft,\n y: pageY - pointerOffset.internalTop,\n gridX: finalTransform.x,\n gridY: finalTransform.y,\n splitting\n })\n }\n\n if (!active) return;\n active = false;\n\n if (splitting) {\n splitting = false;\n return;\n }\n\n if (foundry.utils.isEmpty(finalTransform)\n || (finalTransform.x === transform.x && finalTransform.y === transform.y)\n ) {\n return;\n }\n\n if (collisions.length) {\n\n if (item.item.areItemsSimilar(collisions[0].item) && !globalThis.keyboard.downKeys.has(\"ControlLeft\")) {\n return collisions[0].item.merge(item.item);\n }\n\n const offset = collisions.reduce((acc, collision) => {\n const trans = get(collision.transform);\n if (trans.x < acc.x) acc.x = trans.x;\n if (trans.y < acc.y) acc.y = trans.y;\n return acc;\n }, { x: finalTransform.x, y: finalTransform.y });\n for (const collision of collisions) {\n collision.transform.update(trans => {\n trans.x = transform.x + (trans.x - offset.x);\n trans.y = transform.y + (trans.y - offset.y);\n return trans;\n });\n }\n }\n\n transformStore.update(trans => {\n trans.x = finalTransform.x;\n trans.y = finalTransform.y;\n return trans;\n });\n\n dispatch(\"itemchange\", { items: collisions.concat(item) });\n\n }\n\n function hoverOver() {\n const { x, y } = itemRef.getBoundingClientRect();\n dispatch(\"itemhover\", {\n item,\n target: itemRef,\n x: x + Math.floor(options.gridSize / 2),\n y: y + Math.floor(options.gridSize / 2)\n });\n }\n\n function hoverLeave() {\n const { x, y } = itemRef.getBoundingClientRect();\n dispatch(\"itemhoverleave\", {\n item,\n target: itemRef,\n x: x + Math.floor(options.gridSize / 2),\n y: y + Math.floor(options.gridSize / 2)\n });\n }\n\n function rightClick(event) {\n dispatch(\"itemrightclick\", {\n item,\n target: itemRef,\n x: event.pageX,\n y: event.pageY,\n splitStart,\n });\n }\n\n</script>\n\n<div\n\tbind:this={itemRef}\n\tclass={classes}\n\ton:dblclick={doubleClick}\n\ton:dragover|preventDefault\n\ton:pointerdown={moveStart}\n\ton:pointerleave={hoverLeave}\n\ton:pointerover={hoverOver}\n\ton:touchstart={moveStart}\n\tstyle={style}\n>\n\t<slot/>\n</div>\n\n{#if active}\n\t<div style={ghostStyle} class={collisions.length ? options.collisionClass : options.previewClass}></div>\n\n\t{#if collisions.length}\n\t\t<div style={style} class={collisions.length ? options.collisionClass : options.previewClass}></div>\n\t{/if}\n{/if}\n","<script>\n\n import { createEventDispatcher } from 'svelte';\n import { writable } from 'svelte/store';\n import { styleFromObject } from '../../../helpers/helpers';\n import { calcPosition } from './grid-utils';\n import GridItem from './GridItem.svelte';\n\n export let gridContainer = HTMLDivElement;\n export let items = [];\n export let dropGhost = false;\n export let options = {\n cols: null,\n rows: null,\n enabledCols: null,\n enabledRows: null,\n gap: 10,\n gridSize: 50,\n canOrganize: false,\n backgroundGrid: false,\n class: \"\",\n activeClass: \"\",\n previewClass: \"\",\n collisionClass: \"\",\n hoverClass: \"\",\n highlightClass: \"\",\n highlightItems: false\n }\n\n let containerHeight = writable(0);\n let containerWidth = writable(0);\n\n const dispatch = createEventDispatcher();\n\n function itemChangeEvent(event) {\n dispatch('change', { ...event.detail });\n }\n\n function itemHoverEvent(event) {\n dispatch('hover', { ...event.detail });\n }\n\n function itemBeginDrag(event) {\n dispatch('itembegindrag', { ...event.detail });\n }\n\n function itemStopDrag(event) {\n dispatch('itemstopdrag', { ...event.detail });\n }\n\n function itemMove(event) {\n dispatch('itemmove', { ...event.detail });\n }\n\n function itemHoverLeaveEvent(event) {\n dispatch('leave', { ...event.detail });\n }\n\n function itemRightClickEvent(event) {\n dispatch('rightclick', { ...event.detail });\n }\n\n function itemDoubleClickEvent(event) {\n dispatch('doubleclick', { ...event.detail });\n }\n\n $: $containerWidth = options.cols * (options.gridSize + options.gap) + options.gap;\n $: $containerHeight = options.rows * (options.gridSize + options.gap) + options.gap;\n\n $: containerStyle = styleFromObject({\n \"width\": $containerWidth + \"px\",\n \"height\": $containerHeight + \"px\",\n });\n\n let backgroundGridStyle = \"\";\n $: backgroundGridStyle = styleFromObject({\n \"grid-template-columns\": `repeat(${options.cols}, ${options.gridSize + options.gap / 2}px)`,\n \"grid-template-rows\": `repeat(${options.rows}, ${options.gridSize + options.gap / 2}px)`,\n \"gap\": `${options.gap / 2}px`,\n \"top\": `${options.gap / 2}px`\n });\n\n</script>\n\n<div class=item-piles-grid-container>\n\n\t<div\n\t\tbind:this={gridContainer}\n\t\tclass=\"item-piles-grid {options.class}\"\n\t\tstyle={containerStyle}\n\t>\n\t\t{#if dropGhost && dropGhost?.active}\n\t\t\t{@const dropElem = calcPosition(dropGhost, options)}\n\t\t\t<div\n\t\t\t\tstyle={`position: absolute; left:${dropElem.left}px; top:${dropElem.top}px;\n width: ${dropElem.width}px; height: ${dropElem.height}px;`}\n\t\t\t\tclass={options.previewClass}\n\t\t\t/>\n\t\t{/if}\n\t\t{#each items as item (item.id)}\n\t\t\t<GridItem\n\t\t\t\tbind:item={item}\n\t\t\t\tbind:items={items}\n\t\t\t\tbind:options={options}\n\t\t\t\t{gridContainer}\n\t\t\t\ton:itemdoubleclick={itemDoubleClickEvent}\n\t\t\t\ton:itemchange={itemChangeEvent}\n\t\t\t\ton:itemhover={itemHoverEvent}\n\t\t\t\ton:itembegindrag={itemBeginDrag}\n\t\t\t\ton:itemstopdrag={itemStopDrag}\n\t\t\t\ton:itemmove={itemMove}\n\t\t\t\ton:itemhoverleave={itemHoverLeaveEvent}\n\t\t\t\ton:itemrightclick={itemRightClickEvent}\n\t\t\t>\n\t\t\t\t<slot {item}/>\n\t\t\t</GridItem>\n\t\t{/each}\n\t</div>\n\n\t{#if options.backgroundGrid}\n\n\t\t<div class=\"item-piles-inner-grid\" style={backgroundGridStyle}>\n\t\t\t{#each Array(options.rows) as _, rowIndex (rowIndex)}\n\t\t\t\t{#each Array(options.cols) as _, colIndex (colIndex)}\n\t\t\t\t\t<div class:grid-disabled={colIndex >= options.enabledCols || rowIndex >= options.enabledRows}\n\t\t\t\t\t\t\t style=\"width: {options.gridSize + (options.gap/2)}px; height: {options.gridSize + (options.gap/2)}\"></div>\n\t\t\t\t{/each}\n\t\t\t{/each}\n\t\t</div>\n\n\t{/if}\n\n</div>\n\n<style lang=\"scss\">\n\n .item-piles-grid-container {\n position: relative;\n display: flex;\n justify-content: center;\n }\n\n .item-piles-grid {\n position: relative !important;\n margin: -2px;\n }\n\n .item-piles-inner-grid {\n display: grid;\n border-radius: 0.25rem;\n position: absolute;\n margin: -1px;\n pointer-events: none;\n\n > div {\n border-radius: 0.25rem;\n border: 1px solid rgba(0, 0, 0, 0.25);\n\n &.grid-disabled {\n background-color: rgba(0, 0, 0, 0.25);\n }\n }\n }\n\n</style>\n","<script>\n\n import * as Helpers from \"../../helpers/helpers.js\";\n\n export let entry;\n\n const item = entry.item;\n\n const name = item.name;\n const img = item.img;\n const quantity = item.quantity;\n const canStack = item.canStack;\n const style = item.style;\n\n $: styling = Helpers.styleFromObject($style);\n\n</script>\n\n<div class=\"grid-item\" data-fast-tooltip={$name}\n\t\t data-fast-tooltip-activation-speed=\"0\" data-fast-tooltip-deactivation-speed=\"0\">\n\t{#if $img}\n\t\t<img src={$img} alt={$name}/>\n\t{/if}\n\t{#if styling}\n\t\t<div class=\"grid-item-ghost\" style={styling}></div>\n\t{/if}\n\t{#if canStack && $quantity > 1}\n\t\t<span>{$quantity}</span>\n\t{/if}\n</div>\n\n<style lang=\"scss\">\n\n .grid-item {\n width: 100%;\n height: 100%;\n background-color: rgb(56, 56, 56);\n transition: transform 2s, top 2s, left 2s;\n border-radius: 0.25rem;\n position: relative;\n\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n border: 1px solid black;\n\n img {\n position: absolute;\n flex-shrink: 0;\n min-width: 100%;\n min-height: 100%;\n object-fit: cover;\n transition: transform 2s, opacity 2s;\n border: 0;\n }\n\n span {\n position: absolute;\n bottom: 0;\n right: 3px;\n text-align: right;\n color: white;\n text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;\n pointer-events: none;\n }\n\n .grid-item-ghost {\n position: absolute;\n width: 100%;\n height: 100%;\n }\n }\n\n</style>\n","import ItemPileStore from \"./item-pile-store.js\";\nimport { get, writable } from \"svelte/store\";\nimport CONSTANTS from \"../constants/constants.js\";\nimport { PileItem } from \"./pile-item.js\";\nimport * as Utilities from \"../helpers/utilities.js\";\nimport PrivateAPI from \"../API/private-api.js\";\nimport ItemPileSocket from \"../socket.js\";\nimport DropItemDialog from \"../applications/dialogs/drop-item-dialog/drop-item-dialog.js\";\nimport { TJSDialog } from \"@typhonjs-fvtt/runtime/svelte/application\";\nimport CustomDialog from \"../applications/components/CustomDialog.svelte\";\nimport * as PileUtilities from \"../helpers/pile-utilities.js\";\nimport * as helpers from \"../helpers/helpers.js\";\nimport * as Helpers from \"../helpers/helpers.js\";\nimport { SYSTEMS } from \"../systems.js\";\n\nexport class VaultStore extends ItemPileStore {\n\n constructor(...args) {\n super(...args);\n this.gridData = writable({});\n this.gridItems = writable([]);\n this.validGridItems = writable([]);\n this.canDepositCurrency = writable(false);\n this.canWithdrawCurrency = writable(false);\n this.logSearch = writable(\"\");\n this.vaultLog = writable([]);\n this.visibleLogItems = writable(18);\n this.highlightedGridItems = writable([]);\n this.vaultExpanderItems = writable([]);\n this.dragPosition = writable({ x: 0, y: 0, w: 1, h: 1, active: false, });\n this.mainContainer = false;\n }\n\n get searchDelay() {\n return 50;\n }\n\n get ItemClass() {\n return VaultItem;\n }\n\n setupStores(reset = false) {\n super.setupStores(reset);\n this.gridData.set({});\n this.gridItems.set([]);\n this.validGridItems.set([]);\n this.logSearch.set(\"\");\n this.vaultLog.set([]);\n this.visibleLogItems.set(18);\n this.highlightedGridItems.set([]);\n this.vaultExpanderItems.set([]);\n this.dragPosition.set({ x: 0, y: 0, w: 1, h: 1, active: false, });\n\n this.refreshGridDebounce = foundry.utils.debounce(() => {\n this.refreshGrid();\n }, this.searchDelay);\n }\n\n setupSubscriptions() {\n super.setupSubscriptions();\n this.subscribeTo(this.pileData, () => {\n this.refreshGridDebounce();\n this.processLogEntries();\n });\n\n this.subscribeTo(this.document, () => {\n const { data } = this.document.updateOptions;\n if (hasProperty(data, CONSTANTS.FLAGS.LOG)) {\n this.processLogEntries();\n }\n });\n\n this.subscribeTo(this.logSearch, this.filterLogEntries.bind(this));\n\n this.refreshGrid();\n this.processLogEntries();\n }\n\n processLogEntries() {\n\n const pileData = get(this.pileData);\n const logEntries = PileUtilities.getActorVaultLog(this.actor);\n\n logEntries.map(log => {\n\n let instigator = log.actor || \"Unknown character\";\n if (pileData.vaultLogType === \"user_actor\") {\n instigator = game.i18n.format(\"ITEM-PILES.Vault.LogUserActor\", {\n actor_name: log.actor || \"Unknown character\",\n user_name: game.users.get(log.user)?.name ?? \"unknown user\",\n })\n } else if (pileData.vaultLogType === \"user\") {\n instigator = game.users.get(log.user)?.name ?? \"unknown user\";\n }\n\n const quantity = Math.abs(log.qty) > 1\n ? game.i18n.format(\"ITEM-PILES.Vault.LogQuantity\", { quantity: Math.abs(log.qty) })\n : \"\";\n\n if (!log.action) {\n log.action = log.qty > 0 ? \"deposited\" : \"withdrew\";\n }\n\n const action = log.action === \"withdrew\" || log.action === \"deposited\"\n ? game.i18n.localize(\"ITEM-PILES.Vault.\" + (log.action.slice(0, 1).toUpperCase() + log.action.slice(1)))\n : log.action;\n\n log.text = game.i18n.format(\"ITEM-PILES.Vault.LogEntry\", {\n instigator,\n action: `<span>${action}</span>`,\n quantity: quantity,\n item_name: `<strong>${log.name}</strong>`,\n })\n log.visible = true;\n\n });\n\n this.vaultLog.set(logEntries);\n\n this.filterLogEntries()\n\n }\n\n filterLogEntries() {\n const search = get(this.logSearch).toLowerCase();\n const regex = new RegExp(search, \"g\");\n this.vaultLog.update((logs) => {\n for (let log of logs) {\n log.visible = log.text.toLowerCase().search(regex) !== -1;\n }\n return logs;\n })\n }\n\n refreshFreeSpaces() {\n const pileData = get(this.pileData);\n this.gridData.update(() => {\n\n const access = PileUtilities.getVaultAccess(this.actor, {\n flagData: pileData,\n hasRecipient: !!this.recipient\n });\n\n return {\n ...PileUtilities.getVaultGridData(this.actor, pileData),\n ...access,\n canEditCurrencies: game.user.isGM,\n fullAccess: game.user.isGM || Object.values(access).every(Boolean),\n gridSize: 40,\n gap: 4\n }\n })\n }\n\n canItemsFitWithout(itemToCompare) {\n\n const pileData = get(this.pileData);\n const items = get(this.validGridItems);\n const vaultExpanders = get(this.vaultExpanderItems);\n\n const expansions = vaultExpanders.reduce((acc, item) => {\n if (item === itemToCompare) return acc;\n acc.cols += get(item.itemFlagData).addsCols * get(item.quantity);\n acc.rows += get(item.itemFlagData).addsRows * get(item.quantity);\n return acc;\n }, {\n cols: pileData.baseExpansionCols ?? 0,\n rows: pileData.baseExpansionRows ?? 0\n });\n\n const enabledCols = Math.min(pileData.cols, expansions.cols);\n const enabledRows = Math.min(pileData.rows, expansions.rows);\n\n const enabledSpaces = enabledCols * enabledRows;\n\n return enabledSpaces - items.length;\n\n }\n\n updateGrid(items) {\n\n if (!items.length) return;\n\n const itemsToUpdate = items.map(item => {\n const transform = get(item.transform);\n return {\n _id: item.id,\n [CONSTANTS.FLAGS.ITEM + \".x\"]: transform.x,\n [CONSTANTS.FLAGS.ITEM + \".y\"]: transform.y\n }\n });\n\n helpers.debug(\"itemsToUpdate\", itemsToUpdate);\n\n const actorUuid = Utilities.getUuid(this.actor);\n if (this.actor.isOwner) {\n return PrivateAPI._commitActorChanges(actorUuid, {\n itemsToUpdate,\n });\n }\n\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.COMMIT_ACTOR_CHANGES, actorUuid, {\n itemsToUpdate,\n });\n }\n\n refreshItems() {\n super.refreshItems();\n const pileData = get(this.pileData);\n this.validGridItems.set(get(this.allItems).filter(entry => {\n const itemFlagData = get(entry.itemFlagData);\n return (!pileData.vaultExpansion || !itemFlagData.vaultExpander) && !entry.isCurrency;\n }));\n this.highlightedGridItems.set(get(this.items).filter(entry => {\n const itemFlagData = get(entry.itemFlagData);\n return !pileData.vaultExpansion || !itemFlagData.vaultExpander;\n }).map(item => item.id));\n this.vaultExpanderItems.set(get(this.allItems).filter(entry => {\n const itemFlagData = get(entry.itemFlagData);\n return !pileData.vaultExpansion || itemFlagData.vaultExpander;\n }));\n this.refreshGridDebounce();\n }\n\n createItem(...args) {\n super.createItem(...args);\n this.refreshGrid();\n }\n\n deleteItem(...args) {\n super.deleteItem(...args);\n this.refreshGrid();\n }\n\n refreshGrid() {\n this.refreshFreeSpaces();\n this.gridItems.set(this.placeItemsOnGrid());\n }\n\n placeItemsOnGrid() {\n const search = get(this.search)\n const highlightedItems = get(this.highlightedGridItems);\n const gridData = get(this.gridData);\n const allItems = [...get(this.validGridItems)];\n const existingItems = [];\n\n const grid = Array.from(Array(gridData.enabledCols).keys()).map((_, x) => {\n return Array.from(Array(gridData.enabledRows).keys()).map((_, y) => {\n const item = allItems.find(item => {\n return item.x === x && item.y === y\n });\n if (item) {\n allItems.splice(allItems.indexOf(item), 1);\n existingItems.push({\n id: item.id,\n transform: item.transform,\n highlight: search && highlightedItems.includes(item.id),\n item,\n });\n }\n return item?.id ?? null;\n });\n });\n\n helpers.debug(\"grid\", grid);\n\n helpers.debug(\"existingItems\", existingItems);\n\n helpers.debug(\"allItems\", allItems);\n\n const itemsToUpdate = allItems\n .map(item => {\n for (let x = 0; x < gridData.enabledCols; x++) {\n for (let y = 0; y < gridData.enabledRows; y++) {\n if (!grid[x][y]) {\n grid[x][y] = item.id;\n item.transform.update(trans => {\n trans.x = x;\n trans.y = y;\n return trans;\n });\n return {\n id: item.id,\n transform: item.transform,\n highlight: search && highlightedItems.includes(item.id),\n item\n };\n }\n }\n }\n })\n .filter(Boolean)\n\n this.updateGrid(itemsToUpdate)\n\n return itemsToUpdate.concat(existingItems);\n\n }\n\n async onDropData(data, event, isExpander) {\n\n const dragPosition = get(this.dragPosition);\n const { x, y } = dragPosition;\n this.dragPosition.set({ x: 0, y: 0, w: 1, h: 1, active: false, });\n\n if (data.type === \"Actor\" && game.user.isGM) {\n const oldHeight = this.mainContainer.getBoundingClientRect().height;\n const newRecipient = data.uuid ? (await fromUuid(data.uuid)) : game.actors.get(data.id);\n if (!this.recipient) {\n setTimeout(() => {\n const newHeight = this.mainContainer.getBoundingClientRect().height - oldHeight;\n this.application.position.stores.height.set(get(this.application.position.stores.height) + newHeight);\n });\n }\n this.updateRecipient(newRecipient);\n this.refreshFreeSpaces();\n return;\n }\n\n if (data.type !== \"Item\") {\n Helpers.custom_warning(`You can't drop documents of type \"${data.type}\" into this Item Piles vault!`, true)\n return false;\n }\n\n const item = await Item.implementation.fromDropData(data);\n\n const itemData = item.toObject();\n\n if (!itemData) {\n console.error(data);\n throw Helpers.custom_error(\"Something went wrong when dropping this item!\")\n }\n\n const source = (data.uuid ? fromUuidSync(data.uuid) : false)?.parent ?? false;\n const target = this.actor;\n\n if (source === target) {\n Helpers.custom_warning(`You can't drop items into the vault that originate from the vault!`, true)\n return false;\n }\n\n if (!source && !game.user.isGM) {\n Helpers.custom_warning(`Only GMs can drop items from the sidebar!`, true)\n return false;\n }\n\n const vaultExpander = getProperty(itemData, CONSTANTS.FLAGS.ITEM + \".vaultExpander\");\n\n if (isExpander && !vaultExpander) {\n Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Warnings.VaultItemNotExpander\"), true)\n return false;\n }\n\n const gridData = get(this.gridData);\n\n let flagData = PileUtilities.getItemFlagData(itemData);\n setProperty(flagData, \"x\", x);\n setProperty(flagData, \"y\", y);\n setProperty(itemData, CONSTANTS.FLAGS.ITEM, flagData);\n\n if (!this.hasSimilarItem(itemData) && !vaultExpander && !gridData?.freeSpaces) {\n Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Warnings.VaultFull\"), true)\n return false;\n }\n\n return PrivateAPI._depositWithdrawItem({\n source,\n target,\n itemData: {\n item: itemData,\n quantity: 1\n },\n gridPosition: { x, y }\n });\n\n }\n\n}\n\nexport class VaultItem extends PileItem {\n\n setupStores(...args) {\n super.setupStores(...args);\n this.transform = writable({\n x: 0, y: 0, w: 1, h: 1\n });\n this.x = 0;\n this.y = 0;\n this.style = writable({});\n }\n\n setupSubscriptions() {\n super.setupSubscriptions();\n let setup = false;\n this.subscribeTo(this.itemDocument, () => {\n let rarityColor = get(this.rarityColor);\n if (rarityColor) {\n this.style.set({ \"box-shadow\": `inset 0px 0px 7px 0px ${rarityColor}` });\n } else {\n this.style.set(SYSTEMS.DATA?.VAULT_STYLES ? SYSTEMS.DATA?.VAULT_STYLES.filter(style => {\n return getProperty(this.item, style.path) === style.value;\n }).reduce((acc, style) => {\n return foundry.utils.mergeObject(acc, style.styling);\n }, {}) : {});\n }\n });\n this.subscribeTo(this.itemFlagData, (data) => {\n if (setup) {\n helpers.debug(\"itemFlagData\", data);\n }\n this.transform.set({\n x: data.x, y: data.y, w: data.width ?? 1, h: data.height ?? 1\n });\n });\n this.subscribeTo(this.transform, (transform) => {\n if (setup) {\n helpers.debug(\"transform\", transform);\n }\n this.x = transform.x;\n this.y = transform.y;\n });\n this.subscribeTo(this.quantity, () => {\n const itemFlagData = get(this.itemFlagData);\n if (!itemFlagData.vaultExpander) return;\n this.store.refreshFreeSpaces();\n this.store.refreshGridDebounce();\n })\n setup = true;\n }\n\n async take() {\n\n const pileData = get(this.store.pileData);\n const itemFlagData = get(this.itemFlagData);\n\n if (pileData.vaultExpansion && itemFlagData.vaultExpander) {\n const slotsLeft = this.store.canItemsFitWithout(this);\n if (slotsLeft < 0) {\n return TJSDialog.prompt({\n title: \"Item Piles\", content: {\n class: CustomDialog, props: {\n header: game.i18n.localize(\"ITEM-PILES.Dialogs.CantRemoveVaultExpander.Title\"),\n content: game.i18n.format(\"ITEM-PILES.Dialogs.CantRemoveVaultExpander.Content\", {\n num_items: Math.abs(slotsLeft)\n })\n }\n },\n modal: true\n });\n }\n }\n\n let quantity = get(this.quantity);\n if (quantity > 1) {\n quantity = await DropItemDialog.show(this.item, this.store.actor, {\n localizationTitle: \"WithdrawItem\"\n });\n }\n return game.itempiles.API.transferItems(this.store.actor, this.store.recipient, [{\n _id: this.id,\n quantity\n }], { interactionId: this.store.interactionId });\n }\n\n async split(x, y) {\n\n let quantity = await DropItemDialog.show(this.item, this.store.actor, {\n localizationTitle: \"SplitItem\",\n quantityAdjustment: -1\n });\n\n await game.itempiles.API.removeItems(this.store.actor, [{\n _id: this.id,\n quantity\n }], { interactionId: this.store.interactionId });\n\n const itemData = this.item.toObject();\n\n const flagData = PileUtilities.getItemFlagData(this.item);\n setProperty(flagData, \"x\", x);\n setProperty(flagData, \"y\", y);\n setProperty(itemData, CONSTANTS.FLAGS.ITEM, flagData);\n\n await game.itempiles.API.addItems(this.store.actor, [{\n item: itemData,\n quantity\n }], { interactionId: this.store.interactionId });\n\n }\n\n async merge(itemToMerge) {\n\n const itemDelta = await game.itempiles.API.removeItems(this.store.actor, [{\n _id: itemToMerge.id\n }], {\n interactionId: this.store.interactionId,\n skipVaultLogging: true\n });\n\n return game.itempiles.API.addItems(this.store.actor, [{ id: this.id, quantity: Math.abs(itemDelta[0].quantity) }], {\n interactionId: this.store.interactionId,\n skipVaultLogging: true\n })\n\n }\n\n areItemsSimilar(itemToCompare) {\n return !Utilities.areItemsDifferent(this.item, itemToCompare.item)\n && PileUtilities.canItemStack(itemToCompare.item, this.store.actor);\n }\n\n}\n","<script>\r\n\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n\r\n export let store;\r\n export let item;\r\n\r\n const name = item.name;\r\n const img = item.img;\r\n const quantity = item.quantity;\r\n const itemFlagData = item.itemFlagData;\r\n const pileData = store.pileData;\r\n\r\n const editQuantities = store.editQuantities;\r\n\r\n</script>\r\n\r\n<div class=\"item-piles-flexrow item-piles-item-row item-piles-even-color\">\r\n\r\n\t<div class=\"item-piles-img-container\">\r\n\t\t<img class=\"item-piles-img\" src=\"{$img}\"/>\r\n\t</div>\r\n\r\n\t<div class=\"item-piles-name\">\r\n\t\t<div class=\"item-piles-name-container\">\r\n\t\t\t<p>{$name}</p>\r\n\t\t\t{#if !$editQuantities && item.canStack}\r\n\t\t\t\t<span class=\"item-piles-small-text\">(x{$quantity})</span>\r\n\t\t\t{/if}\r\n\t\t\t<span class=\"item-piles-small-text\">\r\n {($itemFlagData.addsCols ? localize(\"ITEM-PILES.Vault.ExpandsCols\", { cols: $itemFlagData.addsCols }) : \"\")\r\n + ($itemFlagData.addsCols && $itemFlagData.addsRows ? \", \" : \"\") +\r\n ($itemFlagData.addsRows ? localize(\"ITEM-PILES.Vault.ExpandsRows\", { rows: $itemFlagData.addsRows }) : \"\")}\r\n </span>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t{#if !$editQuantities}\r\n\r\n\t\t<button\r\n\t\t\ton:click={() => { item.take() }}\r\n\t\t\tclass=\"item-piles-item-take-button\"\r\n\t\t\ttype=\"button\">\r\n\t\t\t{localize(\"ITEM-PILES.Inspect.Take\")}\r\n\t\t</button>\r\n\r\n\t{:else}\r\n\r\n\t\t<button\r\n\t\t\ton:click={() => { item.remove() }}\r\n\t\t\tclass=\"item-piles-item-take-button\"\r\n\t\t\ttype=\"button\">\r\n\t\t\t{localize(\"Remove\")}\r\n\t\t</button>\r\n\r\n\t{/if}\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-piles-item-row .item-piles-name {\r\n flex: 1 0 auto;\r\n }\r\n\r\n</style>\r\n","<script>\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import { get, writable } from \"svelte/store\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n let form;\r\n\r\n export let data;\r\n export let elementRoot;\r\n\r\n const vaultAccessStore = writable(data.map(access => {\r\n return foundry.utils.mergeObject({\r\n view: true,\r\n organize: true,\r\n items: {\r\n withdraw: true,\r\n deposit: true\r\n },\r\n currencies: {\r\n withdraw: true,\r\n deposit: true\r\n }\r\n }, access)\r\n }));\r\n\r\n const validUsers = Array.from(game.users).filter(user => !user.isGM);\r\n\r\n const validActors = Array.from(game.actors).filter(actor => actor.hasPlayerOwner);\r\n\r\n const validDocs = validUsers.concat(validActors).map(document => ({ uuid: document.uuid, document }));\r\n\r\n $: validDocuments = validDocs.filter(document => !$vaultAccessStore.some(access => access.uuid === document.uuid))\r\n $: validUuids = new Set(validDocuments.map(document => document.uuid));\r\n\r\n function addAccess() {\r\n if (!validDocuments.length) return\r\n vaultAccessStore.update(value => {\r\n value.push({\r\n uuid: validDocuments[0].uuid,\r\n document: validDocuments[0].document,\r\n view: true,\r\n organize: true,\r\n items: {\r\n withdraw: true,\r\n deposit: true\r\n },\r\n currencies: {\r\n withdraw: true,\r\n deposit: true\r\n }\r\n });\r\n return value;\r\n });\r\n }\r\n\r\n function removeAccess(index) {\r\n vaultAccessStore.update(value => {\r\n value.splice(index, 1)\r\n return value;\r\n })\r\n }\r\n\r\n async function updateSettings() {\r\n application.options.resolve?.(get(vaultAccessStore).map(access => {\r\n delete access.document;\r\n return access;\r\n }));\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n function preventDefault(event) {\r\n event.preventDefault();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<form autocomplete=off bind:this={form} on:submit|preventDefault={updateSettings}>\r\n\r\n\t\t<p style=\"text-align: center;\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.VaultAccessEditor.Explanation\")}\r\n\t\t</p>\r\n\r\n\t\t<div class=\"form-group item-pile-access-grid\">\r\n\t\t\t<div class=\"item-piles-grid-row-wrapper\">\r\n\t\t\t\t<div style=\"text-align: left;\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.VaultAccessEditor.Character\")}</span>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.VaultAccessEditor.View\")}</span>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.VaultAccessEditor.Organize\")}</span>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Items\")}</span>\r\n\t\t\t\t\t<div><i>{localize(\"ITEM-PILES.Applications.VaultAccessEditor.Withdraw\")}</i> |\r\n\t\t\t\t\t\t<i>{localize(\"ITEM-PILES.Applications.VaultAccessEditor.Deposit\")}</i></div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Currencies\")}</span>\r\n\t\t\t\t\t<div><i>{localize(\"ITEM-PILES.Applications.VaultAccessEditor.Withdraw\")}</i> |\r\n\t\t\t\t\t\t<i>{localize(\"ITEM-PILES.Applications.VaultAccessEditor.Deposit\")}</i></div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<a on:click={() => addAccess()} style=\"margin-right: 0.5rem;\">\r\n\t\t\t\t\t<i class=\"fas fa-plus\"></i>\r\n\t\t\t\t</a>\r\n\t\t\t</div>\r\n\r\n\t\t\t{#each $vaultAccessStore as access, index (access.uuid)}\r\n\t\t\t\t<div class=\"item-piles-grid-row-wrapper\">\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<select bind:value={access.uuid}>\r\n\t\t\t\t\t\t\t{#each validDocs as document (document.uuid)}\r\n\t\t\t\t\t\t\t\t{#if access.uuid === document.uuid || validUuids.has(document.uuid)}\r\n\t\t\t\t\t\t\t\t\t<option value={document.uuid}>{document.document.name}</option>\r\n\t\t\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t\t\t{/each}\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div style=\"text-align: center;\">\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={access.view}>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div style=\"text-align: center;\">\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={access.organize}>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div style=\"text-align: center;\">\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={access.items.withdraw}>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={access.items.deposit}>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div style=\"text-align: center;\">\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={access.currencies.withdraw}>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={access.currencies.deposit}>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<a on:click={() => removeAccess(index)} class=\"item-piles-clickable-red\" style=\"margin-right: 0.5rem;\">\r\n\t\t\t\t\t\t<i class=\"fas fa-times\"></i>\r\n\t\t\t\t\t</a>\r\n\t\t\t\t</div>\r\n\t\t\t{/each}\r\n\t\t</div>\r\n\r\n\t\t<footer class=\"item-piles-top-divider\">\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"Save\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-pile-access-grid {\r\n display: grid;\r\n grid-template-columns: 1.5fr 0.5fr 0.5fr 1fr 1fr auto;\r\n gap: 4px;\r\n\r\n select {\r\n width: 100%;\r\n }\r\n\r\n .item-piles-grid-row-wrapper {\r\n display: contents;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.5);\r\n }\r\n\r\n .item-piles-grid-row-wrapper:first-of-type {\r\n > div {\r\n margin-bottom: 0.25rem;\r\n text-align: center;\r\n\r\n > div {\r\n font-size: 0.75rem;\r\n }\r\n }\r\n }\r\n }\r\n\r\n</style>\r\n","import VaultAccessEditorShell from './vault-access-editor-shell.svelte';\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport default class VaultAccessEditor extends Editor {\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: \"ITEM-PILES.Applications.VaultAccessEditor.Title\",\r\n width: 600,\r\n svelte: {\r\n class: VaultAccessEditorShell\r\n }\r\n })\r\n }\r\n}\r\n","<script>\r\n\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import VaultAccessEditor from \"../../editors/vault-access-editor/vault-access-editor.js\";\r\n import { TJSDialog } from \"@typhonjs-fvtt/runtime/svelte/application\";\r\n import CustomDialog from \"../../components/CustomDialog.svelte\";\r\n import * as PileUtilities from \"../../../helpers/pile-utilities.js\";\r\n import CONSTANTS from \"../../../constants/constants.js\";\r\n\r\n export let pileData;\r\n export let pileActor;\r\n\r\n async function showVaultAccessEditor() {\r\n const data = pileData.vaultAccess || [];\r\n return VaultAccessEditor.show(data, {\r\n id: `vault-access-editor-item-pile-config-${pileActor.id}`,\r\n title: localize(\"ITEM-PILES.Applications.VaultAccessEditor.Title\", { actor_name: pileActor.name }),\r\n }).then((result) => {\r\n pileData.vaultAccess = result || [];\r\n });\r\n }\r\n\r\n async function clearVaultLog() {\r\n const doThing = await TJSDialog.confirm({\r\n id: `sharing-dialog-item-pile-config-${pileActor.id}`,\r\n title: \"Item Piles - \" + localize(\"ITEM-PILES.Dialogs.ClearVaultLog.Title\"),\r\n content: {\r\n class: CustomDialog,\r\n props: {\r\n header: localize(\"ITEM-PILES.Dialogs.ClearVaultLog.Title\"),\r\n content: localize(\"ITEM-PILES.Dialogs.ClearVaultLog.Content\", { actor_name: pileActor.name })\r\n },\r\n },\r\n modal: true\r\n });\r\n if (!doThing) return;\r\n return PileUtilities.clearVaultLog(pileActor);\r\n }\r\n\r\n</script>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:6;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.Layout\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.LayoutExplanation\")}</p>\r\n\t</label>\r\n\t<div class=\"item-piles-grid-columns\" style=\"flex: 3;\">\r\n\t\t<div style=\"text-align: center; font-size: 0.7rem;\">\r\n\t\t\t<i>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.Columns\")}</i>\r\n\t\t\t<i>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.Rows\")}</i>\r\n\t\t</div>\r\n\t\t<div style=\"align-items: center;\">\r\n\t\t\t<input bind:value={pileData.cols} placeholder=\"Enter a number...\" style=\"text-align: right;\" type=\"number\"/>\r\n\t\t\t<span style=\"flex: 0;\">x</span>\r\n\t\t\t<input bind:value={pileData.rows} placeholder=\"Enter a number...\" type=\"number\"/>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.CanStackItems\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.CanStackItemsExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.canStackItems} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.EnableExpansion\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.EnableExpansionExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.vaultExpansion} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:6;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.BaseExpansion\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.BaseExpansionExplanation\")}</p>\r\n\t</label>\r\n\t<div class=\"item-piles-grid-columns\" style=\"flex: 3;\">\r\n\t\t<div style=\"text-align: center; font-size: 0.7rem;\">\r\n\t\t\t<i>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.Columns\")}</i>\r\n\t\t\t<i>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.Rows\")}</i>\r\n\t\t</div>\r\n\t\t<div style=\"align-items: center;\">\r\n\t\t\t<input bind:value={pileData.baseExpansionCols} disabled={!pileData.vaultExpansion} placeholder=\"Enter a number...\"\r\n\t\t\t\t\t\t style=\"text-align: right;\" type=\"number\"/>\r\n\t\t\t<span style=\"flex: 0;\">x</span>\r\n\t\t\t<input bind:value={pileData.baseExpansionRows} disabled={!pileData.vaultExpansion} placeholder=\"Enter a number...\"\r\n\t\t\t\t\t\t type=\"number\"/>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.RestrictAccess\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.RestrictAccessExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.restrictVaultAccess} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:4;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.Access\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.AccessExplanation\")}</p>\r\n\t</label>\r\n\t<button on:click={() => showVaultAccessEditor()} style=\"flex:2;\" type=\"button\">\r\n\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.ManageAccess\")}\r\n\t</button>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.LogVaultAccess\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.LogVaultAccessExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.logVaultActions} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:4;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.ClearVaultLog\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.ClearVaultLogExplanation\")}</p>\r\n\t</label>\r\n\t<button on:click={() => clearVaultLog()} style=\"flex:2;\" type=\"button\">\r\n\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.ClearVaultLog\")}\r\n\t</button>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.LoggingFormat\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.LoggingFormatExplanation\")}</p>\r\n\t</label>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<select bind:value={pileData.vaultLogType}>\r\n\t\t<option value={CONSTANTS.VAULT_LOGGING_TYPES.USER_ACTOR}>\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.LoggingFormatUserActor\")}\r\n\t\t</option>\r\n\t\t<option value={CONSTANTS.VAULT_LOGGING_TYPES.USER}>\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.LoggingFormatUser\")}\r\n\t\t</option>\r\n\t\t<option value={CONSTANTS.VAULT_LOGGING_TYPES.ACTOR}>\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Vault.LoggingFormatActor\")}\r\n\t\t</option>\r\n\t</select>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n .item-piles-grid-columns {\r\n display: flex;\r\n flex-direction: column;\r\n\r\n & > div {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n\r\n & > * {\r\n flex: 1;\r\n margin: 0 0.25rem;\r\n }\r\n\r\n & > span {\r\n flex: 0;\r\n }\r\n }\r\n }\r\n\r\n</style>\r\n","<script>\r\n\r\n\r\n import { current_component } from 'svelte/internal';\r\n import { styleFromObject } from \"../../../helpers/helpers.js\";\r\n\r\n export let position;\r\n export let zIndex;\r\n export let style;\r\n export let component;\r\n export let componentData;\r\n const local = current_component;\r\n\r\n $: elementStyle = styleFromObject({\r\n \"left\": $position.x + \"px\",\r\n \"top\": $position.y + \"px\",\r\n \"z-index\": zIndex,\r\n ...style\r\n });\r\n\r\n</script>\r\n\r\n\r\n<div class=\"item-piles-floting-element\" style={elementStyle}>\r\n\t<svelte:component {...componentData} this={component}/>\r\n</div>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-piles-floting-element {\r\n position: fixed;\r\n pointer-events: none;\r\n color: red;\r\n }\r\n\r\n</style>\r\n\r\n","import FloatingElementImpl from \"./FloatingElementImpl.svelte\";\r\nimport { writable } from \"svelte/store\";\r\n\r\nexport class FloatingElement {\r\n\r\n static id = void 0;\r\n static element = void 0;\r\n static positionStore = writable(false);\r\n\r\n static create({ id, x, y, zIndex = Number.MAX_SAFE_INTEGER - 100, style = {}, component, componentData } = {}) {\r\n\r\n if (this.element) return this.element;\r\n\r\n this.positionStore.set({ x, y })\r\n this.id = id;\r\n\r\n this.element = new FloatingElementImpl({\r\n target: document.body,\r\n props: {\r\n position: this.positionStore,\r\n zIndex,\r\n style,\r\n component,\r\n componentData\r\n }\r\n });\r\n\r\n }\r\n\r\n static destroy() {\r\n this.element.$destroy();\r\n this.element = void 0;\r\n this.id = void 0;\r\n this.positionStore.set(false);\r\n }\r\n\r\n\r\n}\r\n","<script>\r\n import CONSTANTS from '../../constants/constants.js';\r\n\r\n import { getContext, onDestroy } from 'svelte';\r\n import { fade } from 'svelte/transition';\r\n import { ApplicationShell } from '@typhonjs-fvtt/runtime/svelte/component/core';\r\n import { TJSContextMenu } from \"@typhonjs-fvtt/svelte-standard/application\";\r\n import { get, writable } from 'svelte/store';\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n\r\n import ItemPileInventoryApp from \"../item-pile-inventory-app/item-pile-inventory-app.js\";\r\n import VaultApp from \"./vault-app.js\";\r\n\r\n import Grid from '../components/Grid/Grid.svelte';\r\n import CurrencyList from '../components/CurrencyList.svelte';\r\n import DropZone from '../components/DropZone.svelte';\r\n import VaultItemEntry from './VaultItemEntry.svelte';\r\n\r\n import { snapOnMove } from '../components/Grid/grid-utils';\r\n import * as Helpers from \"../../helpers/helpers.js\";\r\n import { isCoordinateWithinPosition } from \"../../helpers/helpers.js\";\r\n\r\n import { VaultStore } from \"../../stores/vault-store.js\";\r\n import Tabs from \"../components/Tabs.svelte\";\r\n import VaultExpanderEntry from \"./VaultExpanderEntry.svelte\";\r\n import vault from \"../item-pile-config/settings/vault.svelte\";\r\n import { FloatingElement } from \"../components/FloatingElement/FloatingElement.js\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let elementRoot;\r\n export let actor;\r\n export let recipient;\r\n\r\n export let store = VaultStore.make(application, actor, recipient);\r\n\r\n const currencies = store.allCurrencies;\r\n const pileDataStore = store.pileData;\r\n const gridDataStore = store.gridData;\r\n const gridItems = store.gridItems;\r\n const vaultExpanderItems = store.vaultExpanderItems;\r\n const searchStore = store.search;\r\n const logSearchStore = store.logSearch;\r\n const vaultLog = store.vaultLog;\r\n const visibleLogItems = store.visibleLogItems;\r\n const recipientDocument = store.recipientDocument;\r\n const numCurrencies = store.numCurrencies;\r\n const dragPositionStore = store.dragPosition;\r\n\r\n $: pileData = $pileDataStore;\r\n $: gridData = $gridDataStore;\r\n\r\n const floatingElementPositionStore = FloatingElement.positionStore;\r\n let element;\r\n\r\n function onDragOverEvent(event) {\r\n onDragOver(event.clientX, event.clientY);\r\n }\r\n\r\n $: {\r\n if ($floatingElementPositionStore) {\r\n onDragOver($floatingElementPositionStore?.x + 20, $floatingElementPositionStore?.y + 20);\r\n } else {\r\n onDragLeave();\r\n }\r\n }\r\n\r\n async function onDragOver(clientX, clientY) {\r\n const rect = element.getBoundingClientRect();\r\n if (FloatingElement.id === application.id || !isCoordinateWithinPosition(clientX, clientY, rect)) {\r\n return onDragLeave();\r\n }\r\n const x = (clientX - rect.left) - (gridData.gridSize / 2); //x position within the element.\r\n const y = (clientY - rect.top) - (gridData.gridSize / 2); //y position within the element.\r\n dragPositionStore.set({\r\n ...snapOnMove(x, y, { w: 1, h: 1 }, { ...gridData }),\r\n w: 1,\r\n h: 1,\r\n active: true\r\n });\r\n }\r\n\r\n async function onDragLeave() {\r\n dragPositionStore.set({ x: 0, y: 0, w: 1, h: 1, active: false, });\r\n }\r\n\r\n onDestroy(() => {\r\n store.onDestroy();\r\n });\r\n\r\n function doubleClickItem(event) {\r\n if (!gridData.canWithdrawItems) return;\r\n event.detail.item.item.take();\r\n }\r\n\r\n function rightClickItem(event) {\r\n setTimeout(() => {\r\n\r\n const contextMenu = []\r\n\r\n if (gridData.canWithdrawItems) {\r\n contextMenu.push({\r\n icon: 'fas fa-hand', label: \"Take\", onPress: () => {\r\n event.detail.item.item.take();\r\n }\r\n });\r\n }\r\n\r\n const quantity = get(event.detail.item.item.quantity);\r\n const freeSpacesAfterSplit = gridData.freeSpaces;\r\n\r\n if ((gridData.canDepositItems || game.user.isGM) && event.detail.item.item.canStack && quantity > 1 && freeSpacesAfterSplit) {\r\n contextMenu.push({\r\n icon: 'fas fa-object-ungroup', label: \"Split\", onPress: () => {\r\n beginSplitItem(event)\r\n }\r\n });\r\n }\r\n\r\n if (pileData.canInspectItems || game.user.isGM) {\r\n contextMenu.push({\r\n icon: 'fas fa-eye', label: \"Inspect\", onPress: () => {\r\n event.detail.item.item.preview();\r\n }\r\n });\r\n }\r\n\r\n Hooks.call(CONSTANTS.HOOKS.PILE.PRE_RIGHT_CLICK_ITEM, event.detail.item.item.item, contextMenu, actor, store.recipient);\r\n\r\n if (!contextMenu.length) return;\r\n\r\n TJSContextMenu.create({\r\n x: event.detail.x,\r\n y: event.detail.y,\r\n zIndex: 1000000000000,\r\n transitionOptions: { duration: 0 },\r\n items: contextMenu\r\n })\r\n })\r\n }\r\n\r\n function beginSplitItem(event) {\r\n\r\n const { item, splitStart, x, y } = event.detail;\r\n\r\n FloatingElement.create({\r\n id: application.id,\r\n x,\r\n y,\r\n style: {\r\n width: gridData.gridSize + \"px\",\r\n height: gridData.gridSize + \"px\",\r\n opacity: 0.7,\r\n },\r\n component: VaultItemEntry,\r\n componentData: { entry: item }\r\n });\r\n\r\n splitStart({\r\n pageX: x,\r\n pageY: y,\r\n offsetX: Math.floor(gridData.gridSize / 2),\r\n offsetY: Math.floor(gridData.gridSize / 2)\r\n });\r\n\r\n }\r\n\r\n function itemBeginDrag(event) {\r\n const { x, y, item } = event.detail;\r\n FloatingElement.create({\r\n id: application.id,\r\n x,\r\n y,\r\n style: {\r\n width: gridData.gridSize + \"px\",\r\n height: gridData.gridSize + \"px\",\r\n opacity: 0.7,\r\n },\r\n component: VaultItemEntry,\r\n componentData: { entry: item }\r\n })\r\n }\r\n\r\n function itemStopDrag(event) {\r\n\r\n if (!FloatingElement.id) return;\r\n\r\n FloatingElement.destroy();\r\n\r\n if (event.detail.cancelled) return;\r\n\r\n const { item, outOfBounds, x, y, gridX, gridY, splitting } = event.detail;\r\n\r\n if (splitting) {\r\n if (outOfBounds) return;\r\n item.item.split(gridX, gridY);\r\n return;\r\n }\r\n\r\n if (!outOfBounds) return;\r\n\r\n const hitApps = Object.values(ui.windows)\r\n .sort((a, b) => b.position.zIndex - a.position.zIndex)\r\n .filter(app => {\r\n return (app instanceof ActorSheet || app instanceof ItemPileInventoryApp || app instanceof VaultApp)\r\n && isCoordinateWithinPosition(x, y, app.element[0].getBoundingClientRect());\r\n });\r\n\r\n let dropData = {\r\n type: \"Item\",\r\n uuid: item.item.item.uuid\r\n }\r\n\r\n if (hitApps.length) {\r\n if (hitApps[0] === application) return;\r\n dropData.target = hitApps[0].actor;\r\n if (hitApps[0] instanceof VaultApp) {\r\n return hitApps[0].store.onDropData(dropData);\r\n }\r\n } else {\r\n\r\n const position = Helpers.getCanvasMouse().getLocalPosition(canvas.app.stage);\r\n dropData.x = position.x;\r\n dropData.y = position.y;\r\n }\r\n\r\n Hooks.call(\"dropCanvasData\", canvas, dropData);\r\n\r\n }\r\n\r\n function itemMove(event) {\r\n const { x, y } = event.detail;\r\n if (!FloatingElement.id) return;\r\n FloatingElement.positionStore.set({ x, y });\r\n }\r\n\r\n let activeTab = writable(\"vault\");\r\n\r\n const applicationHeight = application.position.stores.height;\r\n const applicationWidth = application.position.stores.width;\r\n const applicationLeft = application.position.stores.left;\r\n const defaultWidth = get(application.position.stores.width);\r\n\r\n $: {\r\n if ($activeTab === \"vault\" && $applicationWidth) {\r\n application.position.stores.width.set(defaultWidth);\r\n }\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<main bind:this={store.mainContainer} class=\"item-piles-flexcol\" in:fade={{duration: 500}}>\r\n\r\n\t\t{#if gridData.fullAccess && (pileData.vaultExpansion || pileData.logVaultActions)}\r\n\t\t\t<Tabs bind:activeTab={$activeTab} tabs={[\r\n {\r\n value: \"vault\",\r\n label: \"ITEM-PILES.Vault.VaultTab\",\r\n icon: \"fas fa-vault\",\r\n },\r\n {\r\n value: \"expanders\",\r\n label: \"ITEM-PILES.Vault.ExpandersTab\",\r\n icon: \"fas fa-maximize\",\r\n hidden: !pileData.vaultExpansion || !gridData.fullAccess\r\n },\r\n {\r\n value: \"log\",\r\n label: \"ITEM-PILES.Vault.LogTab\",\r\n icon: \"fas fa-note-sticky\",\r\n hidden: !pileData.logVaultActions || !gridData.fullAccess\r\n }\r\n ]} style=\"flex: 0 1 auto; margin-bottom: 0.5rem; padding-bottom: 0.5rem;\"/>\r\n\t\t{/if}\r\n\r\n\t\t{#if $activeTab === \"vault\"}\r\n\r\n\t\t\t<div class=\"form-group item-piles-flexrow item-piles-bottom-divider\"\r\n\t\t\t\t\t style=\"margin: 0.25rem 0; align-items: center; flex: 0 1 auto;\">\r\n\t\t\t\t<label style=\"flex:0 1 auto; margin-right: 5px;\">Search:</label>\r\n\t\t\t\t<input type=\"text\" bind:value={$searchStore}>\r\n\t\t\t</div>\r\n\r\n\t\t\t<DropZone callback={(data) => store.onDropData(data)} overCallback={onDragOverEvent} leaveCallback={onDragLeave}\r\n\t\t\t\t\t\t\t\tstyle=\"display: flex; flex: 1; justify-content: center; align-items: center;\">\r\n\r\n\t\t\t\t<Grid bind:items={$gridItems}\r\n\t\t\t\t\t\t\tbind:gridContainer={element}\r\n\t\t\t\t\t\t\toptions={{\r\n ...gridData,\r\n class: \"item-piles-grid-background\",\r\n activeClass: \"item-piles-grid-item-active\",\r\n previewClass: \"item-piles-grid-item-preview\",\r\n collisionClass: \"item-piles-grid-item-collision\",\r\n hoverClass: \"item-piles-grid-item-hover\",\r\n highlightClass: \"item-piles-grid-item-highlight\",\r\n dimClass: \"item-piles-grid-item-dim\",\r\n backgroundGrid: true,\r\n highlightItems: !!$searchStore\r\n }}\r\n\t\t\t\t\t\t\tdropGhost={$dragPositionStore}\r\n\t\t\t\t\t\t\ton:change={(event) => store.updateGrid(event.detail.items)}\r\n\t\t\t\t\t\t\ton:itembegindrag={itemBeginDrag}\r\n\t\t\t\t\t\t\ton:itemstopdrag={itemStopDrag}\r\n\t\t\t\t\t\t\ton:itemmove={itemMove}\r\n\t\t\t\t\t\t\ton:rightclick={rightClickItem}\r\n\t\t\t\t\t\t\ton:doubleclick={doubleClickItem}\r\n\t\t\t\t\t\t\tlet:item\r\n\t\t\t\t>\r\n\t\t\t\t\t<VaultItemEntry entry={item}/>\r\n\t\t\t\t</Grid>\r\n\r\n\t\t\t</DropZone>\r\n\r\n\t\t\t{#if $recipientDocument?.name}\r\n\t\t\t\t<div class=\"item-piles-flexrow item-piles-top-divider\" style=\"flex: 0 1 auto; align-items: center;\">\r\n <span>\r\n <a on:click={() => {\r\n const [appPosition, actorPosition] = Helpers.getApplicationPositions(application, store.recipient.sheet);\r\n application.position.stores.left.set(appPosition.left);\r\n application.position.stores.top.set(appPosition.top);\r\n store.recipient.sheet.render(true, actorPosition);\r\n }}>\r\n <i class=\"fa-solid fa-suitcase\"></i>\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Vault.ViewingAs\", { actor_name: $recipientDocument.name })}\r\n </a>\r\n </span>\r\n\t\t\t\t\t{#if gridData.canDepositCurrencies || gridData.canWithdrawCurrencies}\r\n\t\t\t\t\t\t<div style=\"flex:0 1 auto; justify-self: flex-end; display: flex; justify-content: flex-end;\">\r\n\t\t\t\t\t\t\t{#if gridData.canWithdrawCurrencies}\r\n\t\t\t\t\t\t\t\t<button type=\"button\" class=\"item-piles-small-button\" on:click={() => store.withdrawCurrency()}>\r\n\t\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Vault.Withdraw\")}\r\n\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t\t\t{#if gridData.canDepositCurrencies}\r\n\t\t\t\t\t\t\t\t<button type=\"button\" class=\"item-piles-small-button\" on:click={() => store.depositCurrency()}>\r\n\t\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Vault.Deposit\")}\r\n\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t{/if}\r\n\t\t\t\t</div>\r\n\t\t\t{/if}\r\n\r\n\t\t\t<div class=\"item-piles-flexrow\" style=\"margin-top: 0.25rem; flex:0 1 auto;\">\r\n\r\n\t\t\t\t<CurrencyList {currencies}\r\n\t\t\t\t\t\t\t\t\t\t\toptions={{ abbreviations: false, imgSize: 18, abbreviateNumbers: true }}\r\n\t\t\t\t\t\t\t\t\t\t\tstyle=\"align-items: center;\">\r\n\t\t\t\t\t{#if gridData.canEditCurrencies}\r\n\t\t\t\t\t\t<a style=\"order: 100; display:flex; flex: 0; margin-left: 0.25rem;\" on:click={() => store.addCurrency()}>\r\n\t\t\t\t\t\t\t<i class=\"fas fa-cog\"></i>\r\n\t\t\t\t\t\t</a>\r\n\t\t\t\t\t{/if}\r\n\t\t\t\t</CurrencyList>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t{/if}\r\n\r\n\t\t{#if $activeTab === \"expanders\"}\r\n\r\n\t\t\t<DropZone callback={(data, event) => { store.onDropData(data, event, true) }}\r\n\t\t\t\t\t\t\t\tstyle=\"display: flex; flex-direction: column; flex:1;\">\r\n\r\n\t\t\t\t<div style=\"text-align: center;\" class=\"item-piles-bottom-divider\">\r\n\t\t\t\t\t{@html localize(\"ITEM-PILES.Vault.\" + (\r\n gridData.totalSpaces === gridData.enabledSpaces\r\n ? \"CapacityFull\"\r\n : (gridData.enabledSpaces ? \"CapacityLeft\" : \"NeedsCapacity\")), {\r\n total_capacity: `<strong>${gridData.totalSpaces}</strong>`,\r\n capacity: `<strong>${gridData.enabledSpaces}</strong>`,\r\n })}\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div class=\"item-piles-items-list\">\r\n\r\n\t\t\t\t\t{#each $vaultExpanderItems as item (item.id)}\r\n\t\t\t\t\t\t<VaultExpanderEntry {store} bind:item={item}/>\r\n\t\t\t\t\t{/each}\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t{#if !$vaultExpanderItems.length}\r\n\t\t\t\t\t<div style=\"flex: 1 0 auto; display: flex; align-items: center; place-content: center;\">\r\n\t\t\t\t\t\t<i>Drag and drop items to expand spaces</i>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t</DropZone>\r\n\r\n\t\t{/if}\r\n\r\n\t\t{#if $activeTab === \"log\"}\r\n\r\n\t\t\t<div class=\"form-group item-piles-flexrow item-piles-bottom-divider\"\r\n\t\t\t\t\t style=\"margin: 0.25rem 0; align-items: center; flex: 0 1 auto;\">\r\n\t\t\t\t<label style=\"flex:0 1 auto; margin-right: 5px;\">Log search:</label>\r\n\t\t\t\t<input type=\"text\" bind:value={$logSearchStore}>\r\n\t\t\t</div>\r\n\r\n\t\t\t<div class=\"item-piles-vault-log\"\r\n\t\t\t\t\t style=\"max-height: {$applicationHeight-130}px; overflow-y: scroll; font-size: 0.75rem; padding-right: 0.5rem;\">\r\n\r\n\t\t\t\t{#each $vaultLog.slice(0, $visibleLogItems).filter(log => log.visible) as log, index (index)}\r\n\t\t\t\t\t<div\r\n\t\t\t\t\t\tclass:item-piles-log-deposit={log.action === \"deposited\" || (!log.action && log.qty > 0)}\r\n\t\t\t\t\t\tclass:item-piles-log-withdrawal={log.action === \"withdrew\" || (!log.action && log.qty < 0)}\r\n\t\t\t\t\t\tclass:item-piles-log-other={log.action && log.action !== \"deposited\" && log.action !== \"withdrew\"}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t{@html log.text} - {Helpers.timeSince(log.date)} ago\r\n\t\t\t\t\t</div>\r\n\t\t\t\t{/each}\r\n\r\n\t\t\t\t{#if $vaultLog.length > $visibleLogItems}\r\n\t\t\t\t\t<div class=\"item-piles-top-divider\" style=\"text-align: center;\">\r\n\t\t\t\t\t\t<a on:click={() => { $visibleLogItems += 20; }}><i>Load more transactions ({$visibleLogItems}\r\n\t\t\t\t\t\t\t/ {$vaultLog.length})...</i></a>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t</div>\r\n\r\n\t\t{/if}\r\n\r\n\t</main>\r\n\r\n</ApplicationShell>\r\n\r\n<style lang=\"scss\">\r\n\r\n main {\r\n z-index: 0;\r\n }\r\n\r\n</style>\r\n","import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport VaultShell from \"./vault-shell.svelte\";\r\nimport * as Utilities from \"../../helpers/utilities.js\";\r\nimport ItemPileConfig from \"../item-pile-config/item-pile-config.js\";\r\nimport * as Helpers from \"../../helpers/helpers.js\";\r\nimport UserSelectDialog from \"../dialogs/user-select-dialog/user-select-dialog.js\";\r\nimport SETTINGS from \"../../constants/settings.js\";\r\nimport CONSTANTS from \"../../constants/constants.js\";\r\nimport { getVaultAccess } from \"../../helpers/pile-utilities.js\";\r\n\r\nexport default class VaultApp extends SvelteApplication {\r\n\r\n /**\r\n *\r\n * @param actor\r\n * @param recipient\r\n * @param options\r\n * @param dialogData\r\n */\r\n constructor(actor, recipient, options = {}, dialogData = {}) {\r\n super({\r\n id: `item-pile-vault-${actor?.token?.id ?? actor.id}-${randomID()}`,\r\n title: actor.name,\r\n svelte: {\r\n class: VaultShell,\r\n target: document.body,\r\n props: {\r\n actor,\r\n recipient\r\n }\r\n },\r\n zIndex: 100,\r\n ...options\r\n }, dialogData);\r\n\r\n this.actor = actor;\r\n this.recipient = recipient;\r\n\r\n Helpers.hooks.callAll(CONSTANTS.HOOKS.OPEN_INTERFACE, this, actor, recipient, options, dialogData);\r\n\r\n }\r\n\r\n /** @inheritdoc */\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n closeOnSubmit: false,\r\n classes: [\"app\", \"window-app\", \"sheet\", \"item-pile-vault\", \"item-piles\", \"item-piles-app\"],\r\n minWidth: 300,\r\n minHeight: 300,\r\n resizable: false\r\n });\r\n }\r\n\r\n get store() {\r\n return this.svelte.applicationShell.store;\r\n }\r\n\r\n static getActiveApps(id = \"\") {\r\n return Helpers.getActiveApps(`item-pile-vault-${id}`);\r\n }\r\n\r\n static async show(source, recipient = false, options = {}, dialogData = {}) {\r\n source = Utilities.getActor(source);\r\n recipient = Utilities.getActor(recipient);\r\n const result = Helpers.hooks.call(CONSTANTS.HOOKS.PRE_OPEN_INTERFACE, source, recipient, options, dialogData);\r\n if (result === false) return;\r\n const access = getVaultAccess(source, { hasRecipient: !!recipient });\r\n if (!access.canView) {\r\n ui.notifications.error(game.i18n.format(recipient\r\n ? \"ITEM-PILES.Errors.NoVaultAccessActor\"\r\n : \"ITEM-PILES.Errors.NoVaultAccess\", {\r\n actor_name: recipient?.name ?? \"\"\r\n }));\r\n return;\r\n }\r\n const apps = this.getActiveApps(source?.token?.uuid ?? source.uuid);\r\n if (apps.length) {\r\n for (let app of apps) {\r\n app.render(false, { focus: true });\r\n }\r\n return;\r\n }\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(source, recipient, options, dialogData).render(true, { focus: true });\r\n })\r\n }\r\n\r\n async close(options) {\r\n const result = Helpers.hooks.call(CONSTANTS.HOOKS.PRE_CLOSE_INTERFACE, this, this.actor, this.recipient, options);\r\n if (result === false) return;\r\n Helpers.hooks.callAll(CONSTANTS.HOOKS.CLOSE_INTERFACE, this, this.actor, this.recipient, options);\r\n return super.close(options);\r\n }\r\n\r\n /* -------------------------------------------- */\r\n\r\n /** @override */\r\n _getHeaderButtons() {\r\n let buttons = super._getHeaderButtons();\r\n const canConfigure = game.user.isGM;\r\n if (canConfigure) {\r\n buttons = [\r\n {\r\n label: !Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"ITEM-PILES.Inspect.OpenSheet\" : \"\",\r\n class: \"item-piles-open-actor-sheet\",\r\n icon: \"fas fa-user\",\r\n onclick: () => {\r\n this.actor.sheet.render(true, { focus: true, bypassItemPiles: true });\r\n }\r\n },\r\n {\r\n label: !Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"ITEM-PILES.ContextMenu.ShowToPlayers\" : \"\",\r\n class: \"item-piles-show-to-players\",\r\n icon: \"fas fa-eye\",\r\n onclick: async (event) => {\r\n const activeUsers = Array.from(game.users).filter(u => u.active && u !== game.user).map(u => u.id);\r\n if (!activeUsers.length) {\r\n return Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Warnings.NoPlayersActive\"), true);\r\n }\r\n const users = event.altKey ? activeUsers : await UserSelectDialog.show({ excludeSelf: true });\r\n if (!users || !users.length) return;\r\n Helpers.custom_notify(game.i18n.format(\"ITEM-PILES.Notifications.ShownToPlayers\", { actor_name: this.actor.name }))\r\n return game.itempiles.API.renderItemPileInterface(this.actor, {\r\n userIds: users,\r\n useDefaultCharacter: true\r\n });\r\n }\r\n },\r\n {\r\n label: !Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"ITEM-PILES.HUD.Configure\" : \"\",\r\n class: \"item-piles-configure-pile\",\r\n icon: \"fas fa-box-open\",\r\n onclick: () => {\r\n ItemPileConfig.show(this.actor);\r\n }\r\n },\r\n ].concat(buttons);\r\n }\r\n return buttons\r\n }\r\n\r\n}\r\n","<script>\r\n\r\n import { CurrenciesEditor, SecondaryCurrenciesEditor } from \"../../editors/currencies-editor/currencies-editor.js\";\r\n import ItemFiltersEditor from \"../../editors/item-filters-editor/item-filters-editor.js\";\r\n import MacroSelector from \"../../components/MacroSelector.svelte\";\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import * as Helpers from \"../../../helpers/helpers.js\";\r\n import SETTINGS from \"../../../constants/settings.js\";\r\n import TextEditorDialog from \"../../dialogs/text-editor-dialog/text-editor-dialog.js\";\r\n import { writable } from \"svelte/store\";\r\n\r\n export let pileActor;\r\n export let pileData;\r\n export let pileEnabled;\r\n\r\n const deleteWhenEmptySetting = localize(Helpers.getSetting(SETTINGS.DELETE_EMPTY_PILES) ? \"Yes\" : \"No\");\r\n\r\n let hasOverrideCurrencies = writable(typeof pileData?.overrideCurrencies === \"object\");\r\n let hasOverrideSecondaryCurrencies = writable(typeof pileData?.overrideSecondaryCurrencies === \"object\");\r\n let hasOverrideItemFilters = writable(typeof pileData?.overrideItemFilters === \"object\");\r\n\r\n $: {\r\n if (!$hasOverrideCurrencies) {\r\n pileData.overrideCurrencies = false;\r\n }\r\n }\r\n $: {\r\n if (!$hasOverrideSecondaryCurrencies) {\r\n pileData.overrideSecondaryCurrencies = false;\r\n }\r\n }\r\n $: {\r\n if (!$hasOverrideItemFilters) {\r\n pileData.overrideItemFilters = false;\r\n }\r\n }\r\n\r\n async function showCurrenciesEditor() {\r\n pileData.overrideCurrencies = pileData?.overrideCurrencies || foundry.utils.deepClone(game.itempiles.API.CURRENCIES);\r\n return CurrenciesEditor.show(\r\n pileData.overrideCurrencies,\r\n { id: `currencies-item-pile-config-${pileActor.id}` },\r\n { title: game.i18n.format(\"ITEM-PILES.Applications.CurrenciesEditor.TitleActor\", { actor_name: pileActor.name }), }\r\n ).then((result) => {\r\n pileData.overrideCurrencies = result;\r\n });\r\n }\r\n\r\n async function showSecondaryCurrenciesEditor() {\r\n pileData.overrideSecondaryCurrencies = pileData?.overrideSecondaryCurrencies || foundry.utils.deepClone(game.itempiles.API.SECONDARY_CURRENCIES);\r\n return SecondaryCurrenciesEditor.show(\r\n pileData.overrideSecondaryCurrencies,\r\n { id: `secondary-currencies-item-pile-config-${pileActor.id}` },\r\n { title: game.i18n.format(\"ITEM-PILES.Applications.SecondaryCurrenciesEditor.TitleActor\", { actor_name: pileActor.name }), }\r\n ).then((result) => {\r\n pileData.overrideSecondaryCurrencies = result;\r\n });\r\n }\r\n\r\n async function showItemFiltersEditor() {\r\n pileData.overrideItemFilters = pileData?.overrideItemFilters || foundry.utils.deepClone(game.itempiles.API.ITEM_FILTERS);\r\n return ItemFiltersEditor.show(\r\n pileData.overrideItemFilters,\r\n { id: `item-filters-item-pile-config-${pileActor.id}` },\r\n { title: game.i18n.format(\"ITEM-PILES.Applications.FilterEditor.TitleActor\", { actor_name: pileActor.name }), }\r\n ).then((result) => {\r\n pileData.overrideItemFilters = result;\r\n });\r\n }\r\n\r\n async function showDescriptionDialog() {\r\n return TextEditorDialog.show(pileData.description, { id: \"item-pile-text-editor-\" + pileActor.id }).then((result) => {\r\n pileData.description = result || \"\";\r\n });\r\n }\r\n\r\n</script>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.EnabledPile\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.EnabledPileExplanation\")}</p>\r\n\t</label>\r\n\r\n\t<span class=\"item-piles-flexrow\" style=\"max-width: 100px; justify-content: flex-end; align-items:center;\">\r\n {#if !$pileEnabled}\r\n <div style=\"flex:0 1 auto; margin-right: 1rem;\" class=\"blob\"><i class=\"fas fa-exclamation\"></i></div>\r\n {/if}\r\n\t\t<span style=\"flex:0 1 auto;\"><input bind:checked={$pileEnabled} type=\"checkbox\"/></span>\r\n </span>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:4;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.Distance\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.GridUnits\")}</p>\r\n\t</label>\r\n\t<input bind:value={pileData.distance} placeholder=\"Infinity\" style=\"flex:4;\" type=\"number\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.InspectItems\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.InspectItemsExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.canInspectItems} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.DisplayItemTypes\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.DisplayItemTypesExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.displayItemTypes} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:4;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.Macro\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.MacroExplanation\")}</p>\r\n\t</label>\r\n</div>\r\n<div class=\"form-group\">\r\n\t<MacroSelector bind:macro={pileData.macro}/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:4;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.DeleteWhenEmpty\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.DeleteWhenEmptyExplanation\")}</p>\r\n\t</label>\r\n\t<select bind:value={pileData.deleteWhenEmpty} style=\"flex:4;\">\r\n\t\t<option\r\n\t\t\tvalue=\"default\">{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.DeleteWhenEmptyDefault\")}\r\n\t\t\t({localize(deleteWhenEmptySetting)})\r\n\t\t</option>\r\n\t\t<option value={true}>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.DeleteWhenEmptyYes\")}</option>\r\n\t\t<option value={false}>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.DeleteWhenEmptyNo\")}</option>\r\n\t</select>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:4;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.EditDescription\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.EditDescriptionExplanation\")}</p>\r\n\t</label>\r\n</div>\r\n<div class=\"form-group\">\r\n\t<button on:click={() => { showDescriptionDialog() }} style=\"flex:4;\" type=\"button\">\r\n\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.EditDescription\")}\r\n\t</button>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:4;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.OverrideCurrencies\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.OverrideCurrenciesExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={$hasOverrideCurrencies} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<button disabled={!$hasOverrideCurrencies} on:click={() => { showCurrenciesEditor() }}\r\n\t\t\t\t\tstyle=\"flex:4;\" type=\"button\">\r\n\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.ConfigureOverrideCurrencies\")}\r\n\t</button>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:4;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.OverrideSecondaryCurrencies\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.OverrideSecondaryCurrenciesExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={$hasOverrideSecondaryCurrencies} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<button disabled={!$hasOverrideSecondaryCurrencies} on:click={() => { showSecondaryCurrenciesEditor() }}\r\n\t\t\t\t\tstyle=\"flex:4;\" type=\"button\">\r\n\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.ConfigureOverrideSecondaryCurrencies\")}\r\n\t</button>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label style=\"flex:4;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.OverrideItemFilters\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.OverrideItemFiltersExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={$hasOverrideItemFilters} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<button disabled={!$hasOverrideItemFilters} on:click={() => { showItemFiltersEditor() }}\r\n\t\t\t\t\tstyle=\"flex:4;\" type=\"button\">\r\n\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Main.ConfigureOverrideItemFilters\")}\r\n\t</button>\r\n</div>\r\n","<script>\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import SliderInput from \"../../components/SliderInput.svelte\";\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import { get, writable } from \"svelte/store\";\r\n import * as Helpers from \"../../../helpers/helpers.js\";\r\n import SETTINGS from \"../../../constants/settings.js\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let elementRoot;\r\n export let data = [];\r\n\r\n const itemTypePriceModifiers = writable(data);\r\n\r\n let form;\r\n let unusedTypes;\r\n let systemTypes = Object.entries(CONFIG.Item.typeLabels);\r\n let currentCustomCategories = Array.from(new Set(Helpers.getSetting(SETTINGS.CUSTOM_ITEM_CATEGORIES)));\r\n\r\n $: {\r\n const allTypes = systemTypes.map(([type]) => type).concat(currentCustomCategories).map(type => type.toLowerCase())\r\n unusedTypes = allTypes.filter(type => {\r\n return !$itemTypePriceModifiers.some(priceData => priceData.type === type || (priceData.type === \"custom\" && priceData.category === type))\r\n });\r\n }\r\n\r\n function add() {\r\n if (!unusedTypes.length) return;\r\n itemTypePriceModifiers.update(val => {\r\n val.push({\r\n type: unusedTypes[0],\r\n category: \"\",\r\n override: false,\r\n buyPriceModifier: 1,\r\n sellPriceModifier: 0.5\r\n });\r\n return val;\r\n })\r\n }\r\n\r\n function remove(index) {\r\n itemTypePriceModifiers.update(val => {\r\n val.splice(index, 1);\r\n return val;\r\n })\r\n }\r\n\r\n async function updateSettings() {\r\n application.options.resolve?.(get(itemTypePriceModifiers));\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\t<form autocomplete=off bind:this={form} on:submit|preventDefault={updateSettings}>\r\n\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemTypePriceModifiersEditor.Explanation\")}</p>\r\n\r\n\t\t<div>\r\n\r\n\t\t\t<table>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th style=\"width:5%;\">{localize(\"ITEM-PILES.Applications.ItemTypePriceModifiersEditor.Override\")}</th>\r\n\t\t\t\t\t<th style=\"width:20%;\">{localize(\"ITEM-PILES.Applications.ItemTypePriceModifiersEditor.ItemType\")}</th>\r\n\t\t\t\t\t<th style=\"width:35%;\">{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.BuyPriceModifier\")}</th>\r\n\t\t\t\t\t<th style=\"width:35%;\">{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.SellPriceModifier\")}</th>\r\n\t\t\t\t\t<th style=\"width:5%;\">\r\n <span class:item-piles-clickable-link={unusedTypes.length} on:click={add}>\r\n <i class=\"fas fa-plus\"></i>\r\n </span>\r\n\t\t\t\t\t</th>\r\n\t\t\t\t</tr>\r\n\t\t\t\t{#each $itemTypePriceModifiers as priceData, index (index)}\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={priceData.override}>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t\t\t<select on:change={(e) => {\r\n\t\t\t\t\t\t\t\t\tpriceData.type = e.target.value;\r\n\t\t\t\t\t\t\t\t\tpriceData.category = e.target.value === \"custom\" ? e.target.options[e.target.selectedIndex].text.toLowerCase() : \"\";\r\n\t\t\t\t\t\t\t\t}}>\r\n\t\t\t\t\t\t\t\t\t<optgroup label=\"System Types\">\r\n\t\t\t\t\t\t\t\t\t\t{#each systemTypes as [itemType, label] (itemType)}\r\n\t\t\t\t\t\t\t\t\t\t\t<option value=\"{itemType}\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tselected=\"{priceData.type === itemType}\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled=\"{itemType !== priceData.type && !unusedTypes.includes(itemType)}\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t{localize(label)}\r\n\t\t\t\t\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t\t\t\t{/each}\r\n\t\t\t\t\t\t\t\t\t</optgroup>\r\n\t\t\t\t\t\t\t\t\t{#if currentCustomCategories.length}\r\n\t\t\t\t\t\t\t\t\t\t<optgroup label=\"Custom Categories\">\r\n\t\t\t\t\t\t\t\t\t\t\t{#each currentCustomCategories as customCategory}\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"custom\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tselected=\"{priceData.type === 'custom' && customCategory.toLowerCase() === priceData.category.toLowerCase()}\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled=\"{customCategory.toLowerCase() !== priceData.category.toLowerCase() && !unusedTypes.includes(customCategory.toLowerCase())}\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{customCategory}\r\n\t\t\t\t\t\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t\t\t\t\t{/each}\r\n\t\t\t\t\t\t\t\t\t\t</optgroup>\r\n\t\t\t\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<div class=\"item-piles-flexrow\" style=\"margin: 0 0.25rem\">\r\n\t\t\t\t\t\t\t\t<SliderInput style=\"flex:4;\" bind:value={priceData.buyPriceModifier}/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<div class=\"item-piles-flexrow\" style=\"margin: 0 0.25rem\">\r\n\t\t\t\t\t\t\t\t<SliderInput style=\"flex:4;\" bind:value={priceData.sellPriceModifier}/>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td class=\"small\">\r\n\t\t\t\t\t\t\t<button type=\"button\" on:click={remove(index)}><i class=\"fas fa-times\"></i></button>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t{/each}\r\n\t\t\t</table>\r\n\r\n\t\t</div>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"Save\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .border-highlight {\r\n padding: 1rem;\r\n margin: 0.25rem;\r\n border-radius: 10px;\r\n border: 2px dashed gray;\r\n }\r\n\r\n table {\r\n vertical-align: middle;\r\n\r\n tr {\r\n border-spacing: 15px;\r\n }\r\n\r\n button {\r\n padding: 0.25rem 0.25rem;\r\n line-height: 1rem;\r\n flex: 0;\r\n text-align: center;\r\n }\r\n\r\n a {\r\n text-align: center;\r\n }\r\n }\r\n\r\n</style>\r\n","import ItemTypePriceModifiersShell from './item-type-price-modifiers-editor.svelte';\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport default class ItemTypePriceModifiersEditor extends Editor {\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: game.i18n.localize(\"ITEM-PILES.Applications.ItemTypePriceModifiersEditor.Title\"),\r\n width: 600,\r\n svelte: {\r\n class: ItemTypePriceModifiersShell,\r\n }\r\n })\r\n }\r\n}\r\n","<script>\r\n\r\n export let value = \"\";\r\n export let templateType;\r\n export let required = false;\r\n\r\n const id = \"property-list-\" + randomID();\r\n const templates = foundry.utils.deepClone(game.system.template[templateType]);\r\n const templateObject = {\r\n name: \"\",\r\n type: \"\",\r\n system: templates.types\r\n .map(type => {\r\n let obj = templates[type];\r\n if (obj['templates']) {\r\n for (const template of obj['templates']) {\r\n obj = foundry.utils.mergeObject(obj, templates[\"templates\"][template]);\r\n }\r\n delete obj['templates'];\r\n }\r\n return obj;\r\n })\r\n .reduce((acc, obj) => {\r\n return foundry.utils.mergeObject(acc, obj);\r\n }, {})\r\n };\r\n\r\n let suggestions = [];\r\n $: {\r\n let trimmedValue = value.trim();\r\n let options = getProperty(templateObject, trimmedValue);\r\n if (!options) {\r\n trimmedValue = trimmedValue.split(\".\").slice(0, -1).join(\".\")\r\n options = getProperty(templateObject, trimmedValue);\r\n }\r\n suggestions = options ? Object.keys(options).map(t => trimmedValue + \".\" + t).sort() : Object.keys(templateObject);\r\n }\r\n\r\n</script>\r\n\r\n<input bind:value list={id} required={required} type=\"text\"/>\r\n<datalist id={id}>\r\n\t{#each suggestions as suggestion}\r\n\t\t<option>{suggestion}</option>\r\n\t{/each}\r\n</datalist>\r\n","<script>\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import { get, writable } from \"svelte/store\";\r\n import PropertyPathInput from \"../../components/PropertyPathInput.svelte\";\r\n import StringListEditor from \"../string-list-editor/string-list-editor.js\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n let form;\r\n\r\n export let data;\r\n export let elementRoot;\r\n\r\n const merchantColumns = writable(data);\r\n\r\n function addColumn() {\r\n merchantColumns.update(value => {\r\n value.push({\r\n label: \"\",\r\n path: \"\",\r\n formatting: \"{#}\",\r\n mapping: {},\r\n buying: true,\r\n selling: true\r\n });\r\n return value;\r\n });\r\n }\r\n\r\n function removeColumn(index) {\r\n merchantColumns.update(value => {\r\n value.splice(index, 1)\r\n return value;\r\n })\r\n }\r\n\r\n async function showMappingEditor(index) {\r\n const data = get(merchantColumns)[index];\r\n return StringListEditor.show(\r\n Object.entries(data.mapping),\r\n {\r\n id: `merchant-columns-mapping-editor-${data.path}`,\r\n title: localize(\"ITEM-PILES.Applications.MerchantColumnsEditor.MappingTitle\", { label: data.label }),\r\n content: localize(\"ITEM-PILES.Applications.MerchantColumnsEditor.MappingContent\"),\r\n keyValuePair: true,\r\n }\r\n ).then((result) => {\r\n merchantColumns.update(value => {\r\n value[index].mapping = Object.fromEntries(result);\r\n return value;\r\n })\r\n });\r\n }\r\n\r\n async function updateSettings() {\r\n application.options.resolve(get(merchantColumns));\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n function preventDefault(event) {\r\n event.preventDefault();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<form autocomplete=off bind:this={form} on:submit|preventDefault={updateSettings}>\r\n\r\n\t\t<p style=\"text-align: center;\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.MerchantColumnsEditor.Explanation\")}\r\n\t\t</p>\r\n\r\n\t\t<div class=\"form-group item-pile-column-grid item-piles-top-divider\">\r\n\t\t\t<div class=\"item-piles-grid-row-wrapper\">\r\n\t\t\t\t<div style=\"text-align: left;\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.MerchantColumnsEditor.Label\")}</span>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.MerchantColumnsEditor.PropertyPath\")}</span>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.MerchantColumnsEditor.Formatting\")}</span>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.MerchantColumnsEditor.Buying\")}</span>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.MerchantColumnsEditor.Selling\")}</span>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"item-piles-flexcol\"></div>\r\n\t\t\t\t<a on:click={() => addColumn()} style=\"margin-right: 0.5rem;\">\r\n\t\t\t\t\t<i class=\"fas fa-plus\"></i>\r\n\t\t\t\t</a>\r\n\t\t\t</div>\r\n\r\n\t\t\t{#each $merchantColumns as column, index}\r\n\t\t\t\t<div class=\"item-piles-grid-row-wrapper\">\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<input type=\"text\" bind:value={column.label} required/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<PropertyPathInput bind:value={column.path} templateType=\"Item\" required/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<input type=\"text\" bind:value={column.formatting} required/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={column.buying}/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<input type=\"checkbox\" bind:checked={column.selling}/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<button type=\"button\" on:click={() => showMappingEditor(index)} disabled={!column.label || !column.path}>\r\n\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.MerchantColumnsEditor.ConfigureMapping\")}\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<a on:click={() => removeColumn(index)} class=\"item-piles-clickable-red\"\r\n\t\t\t\t\t\t style=\"margin-right: 0.5rem; text-align: center;\">\r\n\t\t\t\t\t\t<i class=\"fas fa-times\"></i>\r\n\t\t\t\t\t</a>\r\n\t\t\t\t</div>\r\n\t\t\t{/each}\r\n\t\t</div>\r\n\r\n\t\t<footer class=\"item-piles-top-divider\">\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> { localize(\"Save\") }\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-pile-column-grid {\r\n display: grid;\r\n grid-template-columns: 1fr 1fr 0.5fr 50px 50px 1fr auto;\r\n gap: 4px;\r\n\r\n select {\r\n width: 100%;\r\n }\r\n\r\n .item-piles-grid-row-wrapper {\r\n display: contents;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.5);\r\n\r\n & > div {\r\n display: flex;\r\n justify-content: center;\r\n }\r\n\r\n button {\r\n line-height: 1.3rem;\r\n }\r\n }\r\n\r\n .item-piles-grid-row-wrapper:first-of-type {\r\n & > div {\r\n display: block;\r\n margin-bottom: 0.25rem;\r\n text-align: center;\r\n\r\n > div {\r\n font-size: 0.75rem;\r\n }\r\n }\r\n }\r\n }\r\n\r\n</style>\r\n","import MerchantColumnsEditorShell from \"./merchant-columns-editor-shell.svelte\";\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport default class MerchantColumnsEditor extends Editor {\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: \"ITEM-PILES.Applications.MerchantColumnsEditor.Title\",\r\n width: 600,\r\n svelte: {\r\n class: MerchantColumnsEditorShell\r\n }\r\n })\r\n }\r\n}\r\n","<script>\r\n\r\n import ItemTypePriceModifiersEditor\r\n from \"../../editors/item-type-price-modifiers-editor/item-type-price-modifiers-editor.js\";\r\n import PriceModifiersEditor from \"../../editors/price-modifiers-editor/price-modifiers-editor.js\";\r\n import FilePicker from \"../../components/FilePicker.svelte\";\r\n import SliderInput from \"../../components/SliderInput.svelte\";\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import MerchantColumnsEditor from \"../../editors/merchant-columns-editor/merchant-columns-editor.js\";\r\n\r\n export let pileData;\r\n export let pileActor;\r\n\r\n const simpleCalendarActive = game.modules.get('foundryvtt-simple-calendar')?.active;\r\n\r\n const weekdays = (simpleCalendarActive ? window.SimpleCalendar.api.getAllWeekdays() : []).map(weekday => {\r\n weekday.selected = pileData.closedDays.includes(weekday.name);\r\n return weekday;\r\n });\r\n\r\n const refreshItemDays = (simpleCalendarActive ? window.SimpleCalendar.api.getAllWeekdays() : []).map(weekday => {\r\n weekday.selected = pileData.refreshItemsDays.includes(weekday.name);\r\n return weekday;\r\n });\r\n\r\n pileData.closedDays = pileData.closedDays.filter(closedWeekday => {\r\n return weekdays.some(weekday => weekday.name === closedWeekday);\r\n });\r\n\r\n const holidays = (simpleCalendarActive ? window.SimpleCalendar.api.getCurrentCalendar().noteCategories : []).map(holiday => {\r\n return { name: holiday.name, selected: pileData.closedHolidays.includes(holiday.name) };\r\n });\r\n\r\n pileData.closedHolidays = pileData.closedHolidays.filter(closedHoliday => {\r\n return holidays.some(holiday => holiday.name === closedHoliday);\r\n });\r\n\r\n const refreshItemsHolidays = (simpleCalendarActive ? window.SimpleCalendar.api.getCurrentCalendar().noteCategories : []).map(holiday => {\r\n return { name: holiday.name, selected: pileData.refreshItemsHolidays.includes(holiday.name) };\r\n });\r\n\r\n pileData.refreshItemsHolidays = pileData.refreshItemsHolidays.filter(refreshItemsHoliday => {\r\n return refreshItemsHolidays.some(holiday => holiday.name === refreshItemsHoliday);\r\n });\r\n\r\n async function showItemTypePriceModifiers() {\r\n const data = pileData.itemTypePriceModifiers || [];\r\n return ItemTypePriceModifiersEditor.show(\r\n data,\r\n { id: `item-type-price-modifier-item-pile-config-${pileActor.id}` },\r\n { title: localize(\"ITEM-PILES.Applications.ItemTypePriceModifiersEditor.TitleActor\", { actor_name: pileActor.name }), }\r\n ).then((result) => {\r\n pileData.itemTypePriceModifiers = result || [];\r\n });\r\n }\r\n\r\n async function showActorPriceModifiers() {\r\n const data = pileData.actorPriceModifiers || [];\r\n return PriceModifiersEditor.show(\r\n data,\r\n { id: `price-modifier-item-pile-config-${pileActor.id}` },\r\n { title: localize(\"ITEM-PILES.Applications.PriceModifiersEditor.TitleActor\", { actor_name: pileActor.name }), }\r\n ).then((result) => {\r\n pileData.actorPriceModifiers = result || [];\r\n pileData.actorPriceModifiers.forEach(modifier => {\r\n if (modifier.actor) {\r\n delete modifier['actor'];\r\n }\r\n })\r\n });\r\n }\r\n\r\n async function showMerchantColumns() {\r\n const data = pileData.merchantColumns || [];\r\n return MerchantColumnsEditor.show(\r\n data,\r\n { id: `merchant-columns-item-pile-config-${pileActor.id}` },\r\n { title: localize(\"ITEM-PILES.Applications.MerchantColumnsEditor.TitleActor\", { actor_name: pileActor.name }), }\r\n ).then((result) => {\r\n pileData.merchantColumns = result || [];\r\n });\r\n }\r\n\r\n</script>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.MerchantImage\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.MerchantImageExplanation\")}</p>\r\n\t</label>\r\n\t<div class=\"form-fields\">\r\n\t\t<FilePicker bind:value={pileData.merchantImage} placeholder=\"path/image.png\" type=\"imagevideo\"/>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.InfiniteQuantity\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.InfiniteQuantityExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.infiniteQuantity} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.InfiniteCurrency\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.InfiniteCurrencyExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.infiniteCurrencies} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.KeepZero\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.KeepZeroExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.keepZeroQuantity} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.DisplayQuantity\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.DisplayQuantityExplanation\")}</p>\r\n\t</label>\r\n\t<div class=\"break\"></div>\r\n\t<select bind:value={pileData.displayQuantity} style=\"flex:4;\">\r\n\t\t<option value=\"yes\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.DisplayQuantityYes\")}\r\n\t\t</option>\r\n\t\t<option value=\"no\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.DisplayQuantityNo\")}\r\n\t\t</option>\r\n\t\t<option value=\"alwaysyes\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.DisplayQuantityYesAlways\")}\r\n\t\t</option>\r\n\t\t<option value=\"alwaysno\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.DisplayQuantityNoAlways\")}\r\n\t\t</option>\r\n\t</select>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.PurchaseOnly\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.PurchaseOnlyExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.purchaseOnly} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.HideNewItems\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.HideNewItemsExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.hideNewItems} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.HideItemsWithZeroCost\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.HideItemsWithZeroCostExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.hideItemsWithZeroCost} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.OnlyAcceptBasePrice\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.OnlyAcceptBasePriceExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.onlyAcceptBasePrice} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group slider-group\">\r\n\t<label style=\"flex:3;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.PriceModifierTitle\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.PriceModifierExplanation\")}</p>\r\n\t</label>\r\n</div>\r\n\r\n<div class=\"form-group slider-group\">\r\n\t<label style=\"flex:3;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.BuyPriceModifier\")}</span>\r\n\t</label>\r\n\t<SliderInput bind:value={pileData.buyPriceModifier} style=\"flex:4;\"/>\r\n</div>\r\n\r\n<div class=\"form-group slider-group\">\r\n\t<label style=\"flex:3;\">\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.SellPriceModifier\")}</span>\r\n\t</label>\r\n\t<SliderInput bind:value={pileData.sellPriceModifier} style=\"flex:4;\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<div class=\"item-piles-flexcol\">\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ItemTypeModifier\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ItemTypeModifiersExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<button on:click={() => { showItemTypePriceModifiers() }} type=\"button\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ConfigureItemTypePriceModifiers\")}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<div class=\"item-piles-flexcol\">\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ActorPriceModifiers\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ActorPriceModifiersExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<button on:click={() => { showActorPriceModifiers() }} type=\"button\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ConfigureActorPriceModifiers\")}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<div class=\"item-piles-flexcol\">\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.MerchantColumns\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.MerchantColumnsExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<button on:click={() => { showMerchantColumns() }} type=\"button\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ConfigureMerchantColumns\")}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.OpenStatus\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.OpenStatusExplanation\")}</p>\r\n\t</label>\r\n\t<div class=\"break\"></div>\r\n\t<select bind:value={pileData.openTimes.status} style=\"flex:4;\">\r\n\t\t<option value=\"open\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.OpenStatusOpen\")}\r\n\t\t</option>\r\n\t\t<option value=\"closed\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.OpenStatusClosed\")}\r\n\t\t</option>\r\n\t\t{#if simpleCalendarActive && pileData.openTimes.enabled}\r\n\t\t\t<option value=\"auto\">\r\n\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.OpenStatusAuto\")}\r\n\t\t\t</option>\r\n\t\t{/if}\r\n\t</select>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.OpenTimes\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.OpenTimesExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.openTimes.enabled} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\" class:item-piles-disabled={!pileData.openTimes.enabled}>\r\n\t<div class=\"item-piles-flexcol\" style=\"margin-right:1rem\">\r\n\t\t<label class=\"item-piles-text-center\">\r\n\t\t\tOpen Time:\r\n\t\t</label>\r\n\t\t<div class=\"item-piles-flexrow\">\r\n\t\t\t<input bind:value=\"{pileData.openTimes.open.hour}\" disabled=\"{!pileData.openTimes.enabled}\"\r\n\t\t\t\t\t\t style=\"text-align: right;\"\r\n\t\t\t\t\t\t type=\"number\"/>\r\n\t\t\t<span style=\"flex: 0; line-height:1.7; margin: 0 0.25rem;\">:</span>\r\n\t\t\t<input bind:value=\"{pileData.openTimes.open.minute}\" disabled=\"{!pileData.openTimes.enabled}\"\r\n\t\t\t\t\t\t type=\"number\"/>\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"item-piles-flexcol\">\r\n\t\t<label class=\"item-piles-text-center\">\r\n\t\t\tClose Time:\r\n\t\t</label>\r\n\t\t<div class=\"item-piles-flexrow\">\r\n\t\t\t<input bind:value=\"{pileData.openTimes.close.hour}\" disabled=\"{!pileData.openTimes.enabled}\"\r\n\t\t\t\t\t\t style=\"text-align: right;\"\r\n\t\t\t\t\t\t type=\"number\"/>\r\n\t\t\t<span style=\"flex: 0; line-height:1.7; margin: 0 0.25rem;\">:</span>\r\n\t\t\t<input bind:value=\"{pileData.openTimes.close.minute}\" disabled=\"{!pileData.openTimes.enabled}\"\r\n\t\t\t\t\t\t type=\"number\"/>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n\r\n{#if simpleCalendarActive}\r\n\r\n\t<div class=\"form-group\" class:item-piles-disabled={!pileData.openTimes.enabled}>\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ClosedDays\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ClosedDaysExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<div class=\"break\"></div>\r\n\t\t<div class=\"item-piles-flexrow\" style=\"text-align: center;\">\r\n\t\t\t{#each weekdays as weekday (weekday.id + \"-weekday-close\")}\r\n\t\t\t\t<div class=\"item-piles-flexcol\" style=\"align-items: center;\">\r\n\t\t\t\t\t<label>{weekday.abbreviation}</label>\r\n\t\t\t\t\t<input type=\"checkbox\"\r\n\t\t\t\t\t\t\t\t bind:checked={weekday.selected}\r\n\t\t\t\t\t\t\t\t disabled={!pileData.openTimes.enabled}\r\n\t\t\t\t\t\t\t\t on:change={() => {\r\n let weekdaySet = new Set(pileData.closedDays);\r\n if(weekday.selected){\r\n weekdaySet.add(weekday.name)\r\n }else{\r\n weekdaySet.delete(weekday.name)\r\n }\r\n pileData.closedDays = Array.from(weekdaySet);\r\n }}\r\n\t\t\t\t\t/>\r\n\t\t\t\t</div>\r\n\t\t\t{/each}\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\" class:item-piles-disabled={!pileData.openTimes.enabled}>\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ClosedHolidays\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.ClosedHolidaysExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<div class=\"break\"></div>\r\n\t\t<div style=\"display: grid; grid-template-columns: 1fr 1fr;\">\r\n\t\t\t{#each holidays as holiday, index (holiday.name + \"-\" + index)}\r\n\t\t\t\t<div class=\"item-piles-flexrow\" style=\"flex:0 1 auto;\">\r\n\t\t\t\t\t<input type=\"checkbox\"\r\n\t\t\t\t\t\t\t\t bind:checked={holiday.selected}\r\n\t\t\t\t\t\t\t\t disabled={!pileData.openTimes.enabled}\r\n\t\t\t\t\t\t\t\t on:change={() => {\r\n let holidaySet = new Set(pileData.closedHolidays);\r\n if(holiday.selected){\r\n holidaySet.add(holiday.name)\r\n }else{\r\n holidaySet.delete(holiday.name)\r\n }\r\n pileData.closedHolidays = Array.from(holidaySet);\r\n }}/>\r\n\t\t\t\t\t<label>{holiday.name}</label>\r\n\t\t\t\t</div>\r\n\t\t\t{/each}\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div class=\"form-group item-piles-top-divider\">\r\n\t\t<label>\r\n\t\t\t<p style=\"color: #c02609;\">\r\n\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.RefreshItemsWarning\")}\r\n\t\t\t</p>\r\n\t\t</label>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\" class:item-piles-disabled={!pileData.openTimes.enabled}>\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.RefreshItemsOnOpen\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.RefreshItemsOnOpenExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<input type=\"checkbox\" bind:checked={pileData.refreshItemsOnOpen} disabled={!pileData.openTimes.enabled}/>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\" class:item-piles-disabled={!pileData.openTimes.enabled}>\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.RefreshItemsDays\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.RefreshItemsDaysExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<div class=\"break\"></div>\r\n\t\t<div class=\"item-piles-flexrow\" style=\"text-align: center;\">\r\n\t\t\t{#each refreshItemDays as weekday (weekday.id + \"-weekday-refresh\")}\r\n\t\t\t\t<div class=\"item-piles-flexcol\" style=\"align-items: center;\">\r\n\t\t\t\t\t<label>{weekday.abbreviation}</label>\r\n\t\t\t\t\t<input type=\"checkbox\"\r\n\t\t\t\t\t\t\t\t bind:checked={weekday.selected}\r\n\t\t\t\t\t\t\t\t disabled={!pileData.openTimes.enabled}\r\n\t\t\t\t\t\t\t\t on:change={() => {\r\n let weekdaySet = new Set(pileData.refreshItemsDays);\r\n if(weekday.selected){\r\n weekdaySet.add(weekday.name)\r\n }else{\r\n weekdaySet.delete(weekday.name)\r\n }\r\n pileData.refreshItemsDays = Array.from(weekdaySet);\r\n }}\r\n\t\t\t\t\t/>\r\n\t\t\t\t</div>\r\n\t\t\t{/each}\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\" class:item-piles-disabled={!pileData.openTimes.enabled}>\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.RefreshItemsHolidays\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Merchant.RefreshItemsHolidaysExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<div class=\"break\"></div>\r\n\t\t<div style=\"display: grid; grid-template-columns: 1fr 1fr;\">\r\n\t\t\t{#each refreshItemsHolidays as holiday, index (holiday.name + \"-remove-\" + index)}\r\n\t\t\t\t<div class=\"item-piles-flexrow\" style=\"flex:0 1 auto;\">\r\n\t\t\t\t\t<input type=\"checkbox\"\r\n\t\t\t\t\t\t\t\t bind:checked={holiday.selected}\r\n\t\t\t\t\t\t\t\t disabled={!pileData.openTimes.enabled}\r\n\t\t\t\t\t\t\t\t on:change={() => {\r\n\t\t\t\t\t\t\t\t\t let holidaySet = new Set(pileData.refreshItemsHolidays);\r\n\t\t\t\t\t\t\t\t\t if(holiday.selected){\r\n\t\t\t\t\t\t\t\t\t\t holidaySet.add(holiday.name)\r\n\t\t\t\t\t\t\t\t\t }else{\r\n\t\t\t\t\t\t\t\t\t\t holidaySet.delete(holiday.name)\r\n\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t pileData.refreshItemsHolidays = Array.from(holidaySet);\r\n\t\t\t\t\t\t\t\t }}/>\r\n\t\t\t\t\t<label>{holiday.name}</label>\r\n\t\t\t\t</div>\r\n\t\t\t{/each}\r\n\t\t</div>\r\n\t</div>\r\n\r\n{/if}\r\n\r\n\r\n<style>\r\n .form-group {\r\n border-radius: 5px;\r\n }\r\n</style>\r\n","<script>\r\n\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n\r\n export let pileData;\r\n\r\n</script>\r\n\r\n\r\n<div class=\"form-group\">\r\n\t<label>\r\n\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.SingleItem.DisplayOne\")}</span>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.SingleItem.DisplayOneExplanation\")}</p>\r\n\t</label>\r\n\t<input bind:checked={pileData.displayOne} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"item-pile-display-one-settings\">\r\n\r\n\t<div class=\"form-group\">\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.SingleItem.ItemName\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.SingleItem.ItemNameExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<input bind:checked={pileData.showItemName} type=\"checkbox\"/>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\">\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.SingleItem.OverrideScale\")}</span>\r\n\t\t</label>\r\n\t\t<input bind:checked={pileData.overrideSingleItemScale} type=\"checkbox\"/>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\" class:item-piles-disabled={!pileData.overrideSingleItemScale}>\r\n\t\t<label style=\"flex:3;\">\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.SingleItem.Scale\")}</span>\r\n\t\t</label>\r\n\t\t<input bind:value=\"{pileData.singleItemScale}\" class=\"item-piles-scaleRange\"\r\n\t\t\t\t\t disabled=\"{!pileData.overrideSingleItemScale}\" max=\"3\" min=\"0.2\" step=\"0.01\"\r\n\t\t\t\t\t style=\"flex:3;\" type=\"range\"/>\r\n\t\t<input bind:value=\"{pileData.singleItemScale}\" class=\"item-piles-scaleInput\"\r\n\t\t\t\t\t disabled=\"{!pileData.overrideSingleItemScale}\" step=\"0.01\"\r\n\t\t\t\t\t style=\"flex:0.5; margin-left:1rem;\" type=\"number\"/>\r\n\t</div>\r\n\r\n</div>\r\n","<script>\r\n\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import FilePicker from \"../../components/FilePicker.svelte\";\r\n\r\n export let pileData;\r\n\r\n</script>\r\n\r\n<div class=\"form-group\">\r\n\t<label>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Container.Closed\")}</label>\r\n\t<input bind:checked={pileData.closed} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Container.Locked\")}</label>\r\n\t<input bind:checked={pileData.locked} type=\"checkbox\"/>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Container.ClosedImagePath\")}</label>\r\n\t<div class=\"form-fields\">\r\n\t\t<FilePicker bind:value={pileData.closedImage} placeholder=\"path/image.png\" type=\"imagevideo\"/>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Container.OpenedImagePath\")}</label>\r\n\t<div class=\"form-fields\">\r\n\t\t<FilePicker bind:value={pileData.openedImage} placeholder=\"path/image.png\" type=\"imagevideo\"/>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Container.EmptyImagePath\")}</label>\r\n\t<div class=\"form-fields\">\r\n\t\t<FilePicker bind:value={pileData.emptyImage} placeholder=\"path/image.png\" type=\"imagevideo\"/>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Container.LockedImagePath\")}</label>\r\n\t<div class=\"form-fields\">\r\n\t\t<FilePicker bind:value={pileData.lockedImage} placeholder=\"path/image.png\" type=\"imagevideo\"/>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Container.CloseSoundPath\")}</label>\r\n\t<div class=\"form-fields\">\r\n\t\t<FilePicker bind:value={pileData.closeSound} placeholder=\"path/sound.wav\" type=\"audio\"/>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Container.OpenSoundPath\")}</label>\r\n\t<div class=\"form-fields\">\r\n\t\t<FilePicker bind:value={pileData.openSound} placeholder=\"path/sound.wav\" type=\"audio\"/>\r\n\t</div>\r\n</div>\r\n\r\n<div class=\"form-group\">\r\n\t<label>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Container.LockedSoundPath\")}</label>\r\n\t<div class=\"form-fields\">\r\n\t\t<FilePicker bind:value={pileData.lockedSound} placeholder=\"path/sound.wav\" type=\"audio\"/>\r\n\t</div>\r\n</div>\r\n","<script>\r\n\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import { TJSDialog } from \"@typhonjs-fvtt/runtime/svelte/application\";\r\n import CustomDialog from \"../../components/CustomDialog.svelte\";\r\n import * as SharingUtilities from \"../../../helpers/sharing-utilities.js\";\r\n\r\n export let pileData;\r\n export let pileActor;\r\n\r\n async function resetSharingData() {\r\n const doThing = await TJSDialog.confirm({\r\n id: `sharing-dialog-item-pile-config-${pileActor.id}`,\r\n title: \"Item Piles - \" + game.i18n.localize(\"ITEM-PILES.Dialogs.ResetSharingData.Title\"),\r\n content: {\r\n class: CustomDialog,\r\n props: {\r\n header: game.i18n.localize(\"ITEM-PILES.Dialogs.ResetSharingData.Title\"),\r\n content: game.i18n.localize(\"ITEM-PILES.Dialogs.ResetSharingData.Content\")\r\n },\r\n },\r\n buttons: {\r\n yes: {\r\n icon: '<i class=\"fas fa-check\"></i>',\r\n label: game.i18n.localize(\"ITEM-PILES.Dialogs.ResetSharingData.Confirm\"),\r\n }\r\n },\r\n modal: true\r\n });\r\n if (!doThing) return;\r\n return SharingUtilities.clearItemPileSharingData(pileActor);\r\n }\r\n\r\n</script>\r\n\r\n<details class=\"item-piles-collapsible item-piles-clickable\">\r\n\r\n\t<summary>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.Title\")}</summary>\r\n\r\n\t<div class=\"form-group\">\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.ShareItemsEnabled\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.ShareItemsEnabledExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<input bind:checked={pileData.shareItemsEnabled} type=\"checkbox\"/>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\">\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.ShareCurrenciesEnabled\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.ShareCurrenciesEnabledExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<input bind:checked={pileData.shareCurrenciesEnabled} type=\"checkbox\"/>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\">\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.TakeAllEnabled\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.TakeAllEnabledExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<input bind:checked={pileData.takeAllEnabled} type=\"checkbox\"/>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\">\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.SplitAllEnabled\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.SplitAllEnabledExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<input bind:checked={pileData.splitAllEnabled} type=\"checkbox\"/>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\">\r\n\t\t<label>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.InactivePlayers\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.InactivePlayersExplanation\")}</p>\r\n\t\t</label>\r\n\t\t<input bind:checked={pileData.activePlayers} type=\"checkbox\"/>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\">\r\n\t\t<label style=\"flex:4;\">\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.ResetSharingData\")}</span>\r\n\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.ResetSharingDataExplanation\")}</p>\r\n\t\t</label>\r\n\t</div>\r\n\r\n\t<div class=\"form-group\">\r\n\t\t<button class=\"item-piles-config-reset-sharing-data\" on:click={() => { resetSharingData() }} style=\"flex:4;\"\r\n\t\t\t\t\t\ttype=\"button\">\r\n\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Sharing.ResetSharingData\")}\r\n\t\t</button>\r\n\t</div>\r\n\r\n</details>\r\n","<script>\r\n\r\n import CONSTANTS from \"../../../constants/constants.js\";\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n\r\n export let pileData;\r\n\r\n const flags = Object.entries(CONSTANTS.CUSTOM_PILE_TYPES[pileData.type]);\r\n for (const [key, data] of flags) {\r\n if (pileData[key] === undefined) {\r\n pileData[key] = data.value;\r\n }\r\n }\r\n\r\n</script>\r\n\r\n\r\n{#each Object.entries(CONSTANTS.CUSTOM_PILE_TYPES[pileData.type]) as [key, data] (key)}\r\n\r\n\t<div class=\"form-group\">\r\n\t\t<label style=\"flex:4;\">\r\n\t\t\t<span>{localize(data.title)}</span>\r\n\t\t\t{#if data.label}\r\n\t\t\t\t<p>{localize(data.label)}</p>\r\n\t\t\t{/if}\r\n\t\t</label>\r\n\t\t{#if data.type === String}\r\n\t\t\t<input type=\"text\" bind:value={pileData[key]}/>\r\n\t\t{:else if data.type === Number}\r\n\t\t\t<input type=\"number\" bind:value={pileData[key]}/>\r\n\t\t{:else if data.type === Boolean}\r\n\t\t\t<input type=\"checkbox\" bind:checked={pileData[key]}/>\r\n\t\t{/if}\r\n\r\n\t</div>\r\n\r\n{/each}\r\n","<script>\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import CONSTANTS from \"../../constants/constants.js\";\r\n import * as Helpers from \"../../helpers/helpers.js\";\r\n\r\n import Tabs from \"../components/Tabs.svelte\";\r\n import * as PileUtilities from \"../../helpers/pile-utilities.js\";\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import { writable } from \"svelte/store\";\r\n\r\n import MerchantApp from \"../merchant-app/merchant-app.js\";\r\n import ItemPileInventoryApp from \"../item-pile-inventory-app/item-pile-inventory-app.js\";\r\n import VaultApp from \"../vault-app/vault-app.js\";\r\n\r\n import MainSettings from \"./settings/main.svelte\";\r\n import MerchantSettings from \"./settings/merchant.svelte\";\r\n import ItemPileSettings from \"./settings/itempile.svelte\";\r\n import ContainerSettings from \"./settings/container.svelte\";\r\n import SharingSettings from \"./settings/sharing.svelte\";\r\n import VaultSettings from \"./settings/vault.svelte\";\r\n import CustomSettings from \"./settings/custom.svelte\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let elementRoot;\r\n export let pileActor;\r\n\r\n let form;\r\n\r\n let pileData = PileUtilities.getActorFlagData(pileActor);\r\n\r\n if (typeof pileData?.deleteWhenEmpty === \"boolean\") {\r\n pileData.deleteWhenEmpty = !!pileData?.deleteWhenEmpty;\r\n }\r\n\r\n let pileEnabled = writable(pileData.enabled);\r\n\r\n $: pileData.enabled = $pileEnabled;\r\n\r\n async function updateSettings() {\r\n\r\n let defaults = foundry.utils.duplicate(CONSTANTS.PILE_DEFAULTS);\r\n\r\n const types = [\r\n \"closedImage\",\r\n \"emptyImage\",\r\n \"openedImage\",\r\n \"lockedImage\",\r\n \"closeSound\",\r\n \"openSound\",\r\n \"lockedSound\",\r\n \"unlockedSound\",\r\n ];\r\n\r\n for (let type of types) {\r\n if (pileData[type].includes(\"*\")) {\r\n pileData[type + \"s\"] = await Helpers.getFiles(pileData[type], { applyWildCard: true, softFail: true });\r\n pileData[type + \"s\"] = pileData[type + \"s\"] || [];\r\n }\r\n }\r\n\r\n const data = foundry.utils.mergeObject(defaults, pileData);\r\n\r\n data.deleteWhenEmpty = {\r\n \"default\": \"default\",\r\n \"true\": true,\r\n \"false\": false\r\n }[data.deleteWhenEmpty];\r\n\r\n const currentData = PileUtilities.getActorFlagData(pileActor);\r\n const diff = Object.keys(foundry.utils.diffObject(currentData, foundry.utils.deepClone(data)));\r\n\r\n game.itempiles.API.updateItemPile(pileActor, data).then(async () => {\r\n if (diff.includes(\"enabled\") || diff.includes(\"type\")) {\r\n const promises = [];\r\n let apps = [];\r\n switch (currentData.type) {\r\n case CONSTANTS.PILE_TYPES.MERCHANT:\r\n if (MerchantApp.getActiveApp(pileActor.uuid)) {\r\n promises.push(MerchantApp.getActiveApp(pileActor.uuid).close());\r\n }\r\n if (MerchantApp.getActiveApp(pileActor?.token?.uuid)) {\r\n promises.push(MerchantApp.getActiveApp(pileActor?.token?.uuid).close());\r\n }\r\n break;\r\n\r\n case CONSTANTS.PILE_TYPES.VAULT:\r\n apps = VaultApp.getActiveApps(pileActor.uuid)\r\n .concat(VaultApp.getActiveApps(pileActor?.token?.uuid));\r\n break;\r\n\r\n default:\r\n apps = ItemPileInventoryApp.getActiveApps(pileActor.uuid)\r\n .concat(ItemPileInventoryApp.getActiveApps(pileActor?.token?.uuid));\r\n break;\r\n }\r\n\r\n for (let app of apps) {\r\n promises.push(app.close());\r\n }\r\n\r\n if (promises.length || pileActor?.sheet.rendered) {\r\n await Promise.allSettled(promises);\r\n if (data.enabled) {\r\n pileActor?.sheet.close();\r\n game.itempiles.API.renderItemPileInterface(pileActor);\r\n } else if (!data.enabled) {\r\n pileActor?.sheet.render(true, { bypassItemPiles: true });\r\n }\r\n }\r\n }\r\n });\r\n\r\n application.close();\r\n\r\n }\r\n\r\n function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n let tabs = [];\r\n $: {\r\n tabs = [\r\n {\r\n value: \"main\",\r\n label: \"ITEM-PILES.Applications.ItemPileConfig.Main.Title\",\r\n highlight: !$pileEnabled\r\n },\r\n {\r\n value: \"other\",\r\n label: \"ITEM-PILES.Applications.ItemPileConfig.Other.Title\"\r\n }\r\n ]\r\n }\r\n\r\n let activeTab = \"main\";\r\n\r\n const customTypes = Object.keys(CONSTANTS.CUSTOM_PILE_TYPES);\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<form autocomplete=off bind:this={form} class=\"item-piles-config-container\"\r\n\t\t\t\ton:submit|once|preventDefault={updateSettings}>\r\n\r\n\t\t<Tabs bind:activeTab bind:tabs/>\r\n\r\n\t\t<section class=\"tab-body\">\r\n\r\n\t\t\t<div class=\"tab\">\r\n\r\n\t\t\t\t{#if activeTab === 'main'}\r\n\r\n\t\t\t\t\t<MainSettings bind:pileData {pileActor} {pileEnabled}/>\r\n\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t\t{#if activeTab === \"other\"}\r\n\r\n\t\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t\t<label style=\"flex:4;\">\r\n\t\t\t\t\t\t\t<span>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Other.Type\")}</span>\r\n\t\t\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.ItemPileConfig.Other.TypeExplanation\")}</p>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<select style=\"flex:4;\" bind:value={pileData.type}>\r\n\t\t\t\t\t\t\t{#each Object.values(CONSTANTS.PILE_TYPES) as type}\r\n\t\t\t\t\t\t\t\t<option value={type}>\r\n\t\t\t\t\t\t\t\t\t{localize(`ITEM-PILES.Types.${type}`)}\r\n\t\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t{/each}\r\n\t\t\t\t\t\t\t{#each customTypes as customType}\r\n\t\t\t\t\t\t\t\t<option value={customType}>\r\n\t\t\t\t\t\t\t\t\t{localize(`ITEM-PILES.Types.${customType}`)}\r\n\t\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t{/each}\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<hr>\r\n\r\n\t\t\t\t\t{#if pileData.type === CONSTANTS.PILE_TYPES.MERCHANT}\r\n\r\n\t\t\t\t\t\t<MerchantSettings bind:pileData {pileActor}/>\r\n\r\n\t\t\t\t\t{:else if pileData.type === CONSTANTS.PILE_TYPES.PILE || pileData.type === CONSTANTS.PILE_TYPES.CONTAINER}\r\n\r\n\t\t\t\t\t\t{#if pileData.type === CONSTANTS.PILE_TYPES.PILE}\r\n\r\n\t\t\t\t\t\t\t<ItemPileSettings bind:pileData/>\r\n\r\n\t\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t\t{#if pileData.type === CONSTANTS.PILE_TYPES.CONTAINER}\r\n\r\n\t\t\t\t\t\t\t<ContainerSettings bind:pileData/>\r\n\r\n\t\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t\t<hr>\r\n\r\n\t\t\t\t\t\t<SharingSettings bind:pileData {pileActor}/>\r\n\r\n\t\t\t\t\t{:else if pileData.type === CONSTANTS.PILE_TYPES.VAULT}\r\n\r\n\t\t\t\t\t\t<VaultSettings bind:pileData {pileActor}/>\r\n\r\n\t\t\t\t\t{:else if customTypes.includes(pileData.type)}\r\n\r\n\t\t\t\t\t\t<CustomSettings bind:pileData {pileActor}/>\r\n\r\n\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</section>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i>\r\n\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemPileConfig.Update\")}\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n\r\n</ApplicationShell>\r\n","import * as Utilities from \"../../helpers/utilities.js\";\r\nimport { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport ItemPileConfigShell from './item-pile-config.svelte';\r\nimport { getActiveApps } from \"../../helpers/helpers.js\";\r\n\r\nexport default class ItemPileConfig extends SvelteApplication {\r\n\r\n constructor(pileActor, options = {}) {\r\n\r\n super({\r\n id: `item-pile-config-${pileActor.id}-${randomID()}`,\r\n title: game.i18n.format(\"ITEM-PILES.Applications.ItemPileConfig.Title\", { actor_name: pileActor.name }),\r\n svelte: {\r\n class: ItemPileConfigShell,\r\n target: document.body,\r\n props: {\r\n pileActor\r\n }\r\n },\r\n close: () => this.options.resolve?.(null),\r\n ...options\r\n });\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n width: 430,\r\n height: 627,\r\n classes: [\"item-piles-config\", \"item-piles-app\"],\r\n resizable: true\r\n })\r\n }\r\n\r\n static getActiveApp(id) {\r\n return getActiveApps(`item-pile-config-${id}`, true)\r\n }\r\n\r\n static async show(target, options = {}, dialogData = {}) {\r\n const targetActor = Utilities.getActor(target);\r\n const app = this.getActiveApp(targetActor.uuid);\r\n if (app) return app.render(false, { focus: true });\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(targetActor, options, dialogData).render(true);\r\n })\r\n }\r\n\r\n async close(options) {\r\n Object.values(ui.windows).forEach(app => {\r\n if (app !== this && app.rendered && app.options?.parentApp === this) {\r\n app.close();\r\n }\r\n })\r\n return super.close(options);\r\n }\r\n}\r\n","import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport ItemPileInventoryShell from \"./item-pile-inventory-shell.svelte\";\r\nimport * as Utilities from \"../../helpers/utilities.js\";\r\nimport ItemPileConfig from \"../item-pile-config/item-pile-config.js\";\r\nimport * as Helpers from \"../../helpers/helpers.js\";\r\nimport UserSelectDialog from \"../dialogs/user-select-dialog/user-select-dialog.js\";\r\nimport SETTINGS from \"../../constants/settings.js\";\r\nimport CONSTANTS from \"../../constants/constants.js\";\r\n\r\nexport default class ItemPileInventoryApp extends SvelteApplication {\r\n\r\n /**\r\n *\r\n * @param actor\r\n * @param recipient\r\n * @param overrides\r\n * @param options\r\n * @param dialogData\r\n */\r\n constructor(actor, recipient, options = {}, dialogData = {}) {\r\n super({\r\n id: `item-pile-inventory-${actor?.token?.id ?? actor.id}-${randomID()}`,\r\n title: actor.name,\r\n svelte: {\r\n class: ItemPileInventoryShell,\r\n target: document.body,\r\n props: {\r\n actor,\r\n recipient\r\n }\r\n },\r\n zIndex: 100,\r\n ...options\r\n }, dialogData);\r\n\r\n this.actor = actor;\r\n this.recipient = recipient;\r\n\r\n Helpers.hooks.callAll(CONSTANTS.HOOKS.OPEN_INTERFACE, this, actor, recipient, options, dialogData);\r\n\r\n }\r\n\r\n /** @inheritdoc */\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n closeOnSubmit: false,\r\n classes: [\"app\", \"window-app\", \"sheet\", \"item-pile-inventory\", \"item-piles\", \"item-piles-app\"],\r\n width: 550,\r\n height: \"auto\",\r\n });\r\n }\r\n\r\n static getActiveApps(id) {\r\n return Helpers.getActiveApps(`item-pile-inventory-${id}`);\r\n }\r\n\r\n static async show(source, recipient = false, options = {}, dialogData = {}) {\r\n source = Utilities.getActor(source);\r\n recipient = Utilities.getActor(recipient);\r\n const result = Helpers.hooks.call(CONSTANTS.HOOKS.PRE_OPEN_INTERFACE, source, recipient, options, dialogData);\r\n if (result === false) return;\r\n const apps = this.getActiveApps(source?.token?.uuid ?? source.uuid);\r\n if (apps.length) {\r\n for (let app of apps) {\r\n app.render(false, { focus: true });\r\n }\r\n return;\r\n }\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(source, recipient, options, dialogData).render(true, { focus: true, bypassItemPiles: true });\r\n })\r\n }\r\n\r\n async close(options) {\r\n const result = Helpers.hooks.call(CONSTANTS.HOOKS.PRE_CLOSE_INTERFACE, this, this.actor, this.recipient, options);\r\n if (result === false) return;\r\n Helpers.hooks.callAll(CONSTANTS.HOOKS.CLOSE_INTERFACE, this, this.actor, this.recipient, options);\r\n return super.close(options);\r\n }\r\n\r\n /* -------------------------------------------- */\r\n\r\n /** @override */\r\n _getHeaderButtons() {\r\n let buttons = super._getHeaderButtons();\r\n\r\n const newButtons = [];\r\n\r\n if (this.actor.isOwner) {\r\n newButtons.push({\r\n label: !Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"ITEM-PILES.Inspect.OpenSheet\" : \"\",\r\n class: \"item-piles-open-actor-sheet\",\r\n icon: \"fas fa-user\",\r\n onclick: () => {\r\n this.actor.sheet.render(true, { focus: true, bypassItemPiles: true });\r\n }\r\n }\r\n );\r\n }\r\n\r\n if (game.user.isGM) {\r\n newButtons.push({\r\n label: !Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"ITEM-PILES.ContextMenu.ShowToPlayers\" : \"\",\r\n class: \"item-piles-show-to-players\",\r\n icon: \"fas fa-eye\",\r\n onclick: async (event) => {\r\n const activeUsers = Array.from(game.users).filter(u => u.active && u !== game.user).map(u => u.id);\r\n if (!activeUsers.length) {\r\n return Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Warnings.NoPlayersActive\"), true);\r\n }\r\n const users = event.altKey ? activeUsers : await UserSelectDialog.show({ excludeSelf: true });\r\n if (!users || !users.length) return;\r\n Helpers.custom_notify(game.i18n.format(\"ITEM-PILES.Notifications.ShownToPlayers\", { actor_name: this.actor.name }))\r\n return game.itempiles.API.renderItemPileInterface(this.actor, {\r\n userIds: users,\r\n useDefaultCharacter: true\r\n });\r\n }\r\n },\r\n {\r\n label: !Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"ITEM-PILES.HUD.Configure\" : \"\",\r\n class: \"item-piles-configure-pile\",\r\n icon: \"fas fa-box-open\",\r\n onclick: () => {\r\n ItemPileConfig.show(this.actor);\r\n }\r\n }\r\n );\r\n }\r\n\r\n return newButtons.concat(buttons)\r\n }\r\n\r\n}\r\n","<script>\r\n\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n\r\n export let item;\r\n export let quantity;\r\n export let sourceActor;\r\n export let targetActor;\r\n\r\n</script>\r\n\r\n\r\n<div class=\"item-piles-dialog-root\">\r\n\r\n\t<p class=\"header\">\r\n\t\t{localize(\"ITEM-PILES.Dialogs.ReceiveItem.Header\")}\r\n\t</p>\r\n\r\n\t<div class=\"item-piles-give-image-container\">\r\n\t\t<img src=\"{sourceActor.img}\"/>\r\n\t\t<i class=\"fas fa-arrow-right\"></i>\r\n\t\t<img src=\"{targetActor.img}\"/>\r\n\t</div>\r\n\r\n\t<div class=\"item-piles-give-item-container\">\r\n\t\t<img src=\"{item.img}\"/>\r\n\t\t<span>{item.name} ({quantity})</span>\r\n\t</div>\r\n\r\n\t<p>{localize(\"ITEM-PILES.Dialogs.ReceiveItem.Content\", {\r\n source_actor_name: sourceActor.name,\r\n target_actor_name: targetActor.name\r\n })}</p>\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-piles-dialog-root {\r\n\r\n margin-bottom: 0.5rem;\r\n font-size: 0.9rem;\r\n text-align: center;\r\n\r\n .header {\r\n margin-bottom: 0.5rem;\r\n font-size: 1.2rem;\r\n font-weight: bold;\r\n }\r\n\r\n .item-piles-give-item-container, .item-piles-give-image-container {\r\n display: grid;\r\n\r\n grid-auto-flow: column;\r\n align-items: center;\r\n justify-items: center;\r\n justify-content: center;\r\n align-content: center;\r\n gap: 1rem;\r\n\r\n margin-bottom: 0.5rem;\r\n\r\n }\r\n\r\n .item-piles-give-image-container {\r\n\r\n font-size: 2rem;\r\n\r\n img {\r\n max-height: 70px;\r\n border: 0;\r\n }\r\n }\r\n\r\n .item-piles-give-item-container {\r\n\r\n font-size: 1rem;\r\n\r\n img {\r\n max-height: 40px;\r\n border: 0;\r\n border-radius: 0.5rem;\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n</style>\r\n","import * as Helpers from \"../helpers/helpers.js\";\r\nimport * as Utilities from \"../helpers/utilities.js\";\r\nimport * as PileUtilities from \"../helpers/pile-utilities.js\";\r\nimport * as SharingUtilities from \"../helpers/sharing-utilities.js\";\r\nimport ItemPileSocket from \"../socket.js\";\r\nimport SETTINGS from \"../constants/settings.js\";\r\nimport CONSTANTS from \"../constants/constants.js\";\r\nimport DropItemDialog from \"../applications/dialogs/drop-item-dialog/drop-item-dialog.js\";\r\nimport ItemPileInventoryApp from \"../applications/item-pile-inventory-app/item-pile-inventory-app.js\";\r\nimport Transaction from \"../helpers/transaction.js\";\r\nimport ItemPileStore from \"../stores/item-pile-store.js\";\r\nimport MerchantApp from \"../applications/merchant-app/merchant-app.js\";\r\nimport { SYSTEMS } from \"../systems.js\";\r\nimport { TJSDialog } from \"@typhonjs-fvtt/runtime/svelte/application\";\r\nimport CustomDialog from \"../applications/components/CustomDialog.svelte\";\r\nimport GiveItemsShell from \"../applications/dialogs/give-items-dialog/give-items-shell.svelte\";\r\nimport BankVaultApp from \"../applications/vault-app/vault-app.js\";\r\nimport { hotkeyActionState } from \"../hotkeys.js\";\r\n\r\nconst preloadedFiles = new Set();\r\n\r\nexport default class PrivateAPI {\r\n\r\n\t/**\r\n\t * Initializes the API for Foundry's core hooks\r\n\t */\r\n\tstatic initialize() {\r\n\t\tHelpers.hooks.on(\"canvasReady\", this._onCanvasReady.bind(this));\r\n\t\tHelpers.hooks.on(\"createItem\", this._onCreateItem.bind(this));\r\n\t\tHelpers.hooks.on(\"updateItem\", this._onUpdateItem.bind(this));\r\n\t\tHelpers.hooks.on(\"deleteItem\", this._onDeleteItem.bind(this));\r\n\t\tHelpers.hooks.on(\"updateActor\", this._onUpdateActor.bind(this));\r\n\t\tHelpers.hooks.on(\"deleteToken\", this._onDeleteToken.bind(this));\r\n\t\tHelpers.hooks.on(\"deleteActor\", this._onDeleteActor.bind(this));\r\n\t\tHelpers.hooks.on(\"preCreateToken\", this._onPreCreateToken.bind(this))\r\n\t\tHelpers.hooks.on(\"preUpdateToken\", this._onPreUpdateToken.bind(this));\r\n\t\tHelpers.hooks.on(\"createToken\", this._onCreateToken.bind(this))\r\n\t\tHelpers.hooks.on(\"dropCanvasData\", this._dropData.bind(this));\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tstatic async _onCanvasReady(canvas) {\r\n\t\tconst tokens = [...canvas.tokens.placeables].map(token => token.document);\r\n\t\tfor (const doc of tokens) {\r\n\t\t\tawait this._preloadItemPileFiles(doc);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tstatic _onCreateItem(doc) {\r\n\t\tif (!doc.parent) return;\r\n\t\tItemPileStore.notifyChanges(\"createItem\", doc.parent, doc);\r\n\t\tif (!PileUtilities.isValidItemPile(doc.parent)) return;\r\n\t\tthis._evaluateItemPileChange(doc.parent, {}, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tstatic _onUpdateItem(doc) {\r\n\t\tif (!doc.parent) return;\r\n\t\tif (!PileUtilities.isValidItemPile(doc.parent)) return;\r\n\t\tthis._evaluateItemPileChange(doc.parent, {}, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tstatic _onDeleteItem(doc) {\r\n\t\tif (!doc.parent) return;\r\n\t\tItemPileStore.notifyChanges(\"deleteItem\", doc.parent, doc);\r\n\t\tif (!PileUtilities.isValidItemPile(doc.parent)) return;\r\n\t\tthis._evaluateItemPileChange(doc.parent, {}, true);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tstatic _onUpdateActor(doc, changes) {\r\n\t\tif (!PileUtilities.isValidItemPile(doc)) return;\r\n\t\tthis._evaluateItemPileChange(doc, changes);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tstatic _onDeleteToken(doc) {\r\n\t\tItemPileStore.notifyChanges(\"delete\", doc.actor)\r\n\t\tif (!PileUtilities.isValidItemPile(doc)) return;\r\n\t\tHelpers.hooks.callAll(CONSTANTS.HOOKS.PILE.DELETE, doc);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tstatic _onDeleteActor(doc) {\r\n\t\tItemPileStore.notifyChanges(\"delete\", doc)\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tstatic _onPreCreateToken(doc, data) {\r\n\t\tconst docData = foundry.utils.deepClone(data);\r\n\t\tconst sourceActor = game.actors.get(doc.actorId);\r\n\t\tconst itemPileConfig = foundry.utils.mergeObject(\r\n\t\t\tfoundry.utils.deepClone(CONSTANTS.PILE_DEFAULTS),\r\n\t\t\tfoundry.utils.mergeObject(\r\n\t\t\t\tgetProperty(docData, CONSTANTS.FLAGS.PILE) ?? {},\r\n\t\t\t\tfoundry.utils.deepClone(getProperty(sourceActor, CONSTANTS.FLAGS.PILE) ?? {})\r\n\t\t\t)\r\n\t\t)\r\n\t\tif (!itemPileConfig?.enabled) return;\r\n\t\tif (!doc.isLinked) {\r\n\t\t\tdocData[`${CONSTANTS.ACTOR_DELTA_PROPERTY}.flags.${CONSTANTS.MODULE_NAME}.-=sharing`] = null;\r\n\t\t}\r\n\t\tif (itemPileConfig.closedImage.includes(\"*\")) {\r\n\t\t\titemPileConfig.closedImage = Helpers.random_array_element(itemPileConfig.closedImages);\r\n\t\t\titemPileConfig.closedImages = [];\r\n\t\t}\r\n\t\tif (itemPileConfig.emptyImage.includes(\"*\")) {\r\n\t\t\titemPileConfig.emptyImage = Helpers.random_array_element(itemPileConfig.emptyImages);\r\n\t\t\titemPileConfig.emptyImages = [];\r\n\t\t}\r\n\t\tif (itemPileConfig.openedImage.includes(\"*\")) {\r\n\t\t\titemPileConfig.openedImage = Helpers.random_array_element(itemPileConfig.openedImages);\r\n\t\t\titemPileConfig.openedImages = [];\r\n\t\t}\r\n\t\tif (itemPileConfig.lockedImage.includes(\"*\")) {\r\n\t\t\titemPileConfig.lockedImage = Helpers.random_array_element(itemPileConfig.lockedImages);\r\n\t\t\titemPileConfig.lockedImages = [];\r\n\t\t}\r\n\t\tdocData[CONSTANTS.FLAGS.PILE] = PileUtilities.cleanFlagData(itemPileConfig);\r\n\t\tconst targetItems = PileUtilities.getActorItems(doc.actor, {\r\n\t\t\titemFilters: itemPileConfig?.overrideItemFilters\r\n\t\t});\r\n\t\tconst targetCurrencies = PileUtilities.getActorCurrencies(doc.actor, {\r\n\t\t\tcurrencyList: PileUtilities.getCurrencyList(doc.actor, itemPileConfig)\r\n\t\t});\r\n\t\tconst pileData = { data: itemPileConfig, items: targetItems, currencies: targetCurrencies };\r\n\t\tconst scale = PileUtilities.getItemPileTokenScale(doc, pileData);\r\n\t\tdocData[\"texture.src\"] = PileUtilities.getItemPileTokenImage(doc, pileData);\r\n\t\tdocData[\"texture.scaleX\"] = scale;\r\n\t\tdocData[\"texture.scaleY\"] = scale;\r\n\t\tdocData[\"name\"] = PileUtilities.getItemPileName(doc, pileData);\r\n\t\tdoc.updateSource(docData);\r\n\t}\r\n\r\n\tstatic _onPreUpdateToken(doc, changes) {\r\n\t\tif (!hasProperty(changes, \"actorLink\")) return;\r\n\t\tif (!PileUtilities.isValidItemPile(doc)) return;\r\n\t\tconst flagData = PileUtilities.getActorFlagData(doc);\r\n\t\tconst cleanFlagData = PileUtilities.cleanFlagData(flagData);\r\n\t\tchanges[CONSTANTS.FLAGS.PILE] = doc.actorLink ? cleanFlagData : null;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\tstatic _onCreateToken(doc) {\r\n\t\tif (!PileUtilities.isValidItemPile(doc)) return;\r\n\t\tconst itemPileConfig = PileUtilities.getActorFlagData(doc.actor)\r\n\t\tHelpers.hooks.callAll(CONSTANTS.HOOKS.PILE.CREATE, doc, itemPileConfig);\r\n\t\treturn this._preloadItemPileFiles(doc);\r\n\t}\r\n\r\n\tstatic async _addItems(targetUuid, items, userId, {\r\n\t\tremoveExistingActorItems = false, skipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst transaction = new Transaction(targetActor);\r\n\r\n\t\tif (removeExistingActorItems) {\r\n\t\t\tconst existingItems = PileUtilities.getActorItems(targetActor);\r\n\t\t\tawait transaction.appendItemChanges(existingItems, { remove: true });\r\n\t\t}\r\n\r\n\t\tawait transaction.appendItemChanges(items);\r\n\r\n\t\tconst { itemsToUpdate, itemsToCreate } = transaction.prepare(); // Prepare data\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ITEM.PRE_ADD, targetActor, itemsToCreate, itemsToUpdate, interactionId);\r\n\t\tif (hookResult === false) return false; // Call pre-hook to allow user to interrupt it\r\n\r\n\t\tconst { itemDeltas } = await transaction.commit(); // Actually add the items to the actor\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.ITEM.ADD, targetUuid, itemDeltas, userId, interactionId);\r\n\r\n\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\taction: \"addItems\", target: targetUuid, items: itemDeltas, userId: userId, interactionId: interactionId\r\n\t\t});\r\n\r\n\t\tif (!skipVaultLogging && PileUtilities.isItemPileVault(targetActor)) {\r\n\t\t\tawait PileUtilities.updateVaultLog(targetActor, {\r\n\t\t\t\tuserId, items: itemDeltas, withdrawal: false\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn itemDeltas;\r\n\r\n\t}\r\n\r\n\tstatic async _removeItems(targetUuid, items, userId, { skipVaultLogging = false, interactionId = false } = {}) {\r\n\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst transaction = new Transaction(targetActor);\r\n\r\n\t\tawait transaction.appendItemChanges(items, { remove: true });\r\n\r\n\t\tconst { itemsToUpdate, itemsToDelete } = transaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ITEM.PRE_REMOVE, targetActor, itemsToUpdate, itemsToDelete, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tconst { itemDeltas } = await transaction.commit();\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.ITEM.REMOVE, targetUuid, itemDeltas, userId, interactionId);\r\n\r\n\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\taction: \"removeItems\", target: targetUuid, items: itemDeltas, userId: userId, interactionId: interactionId\r\n\t\t});\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(targetUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(targetUuid);\r\n\t\t}\r\n\r\n\t\tif (!skipVaultLogging && PileUtilities.isItemPileVault(targetActor)) {\r\n\t\t\tawait PileUtilities.updateVaultLog(targetActor, {\r\n\t\t\t\tuserId, items: itemDeltas, withdrawal: true\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn itemDeltas;\r\n\r\n\t}\r\n\r\n\tstatic async _transferItems(sourceUuid, targetUuid, items, userId, {\r\n\t\tskipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(sourceUuid);\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst sourceTransaction = new Transaction(sourceActor);\r\n\t\tawait sourceTransaction.appendItemChanges(items, { remove: true });\r\n\t\tconst sourceUpdates = sourceTransaction.prepare();\r\n\r\n\t\tconst targetTransaction = new Transaction(targetActor);\r\n\t\tawait targetTransaction.appendItemChanges(sourceUpdates.itemDeltas);\r\n\t\tconst targetUpdates = targetTransaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ITEM.PRE_TRANSFER, sourceActor, sourceUpdates, targetActor, targetUpdates, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tawait sourceTransaction.commit();\r\n\t\tconst { itemDeltas } = await targetTransaction.commit();\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.ITEM.TRANSFER, sourceUuid, targetUuid, itemDeltas, userId, interactionId);\r\n\r\n\t\tconst macroData = {\r\n\t\t\taction: \"transferItems\",\r\n\t\t\tsource: sourceUuid,\r\n\t\t\ttarget: targetUuid,\r\n\t\t\titems: itemDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t};\r\n\r\n\t\tawait this._executeItemPileMacro(sourceUuid, macroData);\r\n\t\tawait this._executeItemPileMacro(targetUuid, macroData);\r\n\r\n\t\tconst sourceIsItemPile = PileUtilities.isValidItemPile(sourceActor);\r\n\r\n\t\tconst itemPileUuid = sourceIsItemPile ? sourceUuid : targetUuid;\r\n\t\tconst itemPile = sourceIsItemPile ? Utilities.getToken(sourceUuid) : Utilities.getToken(targetUuid);\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(itemPileUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(itemPileUuid);\r\n\t\t} else if (PileUtilities.isItemPileLootable(itemPile)) {\r\n\t\t\tif (PileUtilities.isItemPileEmpty(itemPile)) {\r\n\t\t\t\tawait SharingUtilities.clearItemPileSharingData(itemPile);\r\n\t\t\t} else {\r\n\t\t\t\tawait SharingUtilities.setItemPileSharingData(sourceUuid, targetUuid, {\r\n\t\t\t\t\titems: itemDeltas\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t} else if (!skipVaultLogging && (PileUtilities.isItemPileVault(sourceActor) || PileUtilities.isItemPileVault(targetActor))) {\r\n\t\t\tconst pileActor = sourceIsItemPile ? sourceActor : targetActor;\r\n\t\t\tconst actorToLog = sourceIsItemPile ? targetActor : sourceActor;\r\n\t\t\tawait PileUtilities.updateVaultLog(pileActor, {\r\n\t\t\t\tuserId, actor: actorToLog, items: itemDeltas, withdrawal: sourceIsItemPile\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn itemDeltas;\r\n\r\n\t}\r\n\r\n\tstatic async _transferAllItems(sourceUuid, targetUuid, userId, {\r\n\t\titemFilters = false, skipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(sourceUuid);\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst itemsToTransfer = PileUtilities.getActorItems(sourceActor, { itemFilters }).map(item => item.toObject());\r\n\r\n\t\tconst sourceTransaction = new Transaction(sourceActor);\r\n\t\tawait sourceTransaction.appendItemChanges(itemsToTransfer, { remove: true });\r\n\t\tconst sourceUpdates = sourceTransaction.prepare();\r\n\r\n\t\tconst targetTransaction = new Transaction(targetActor);\r\n\t\tawait targetTransaction.appendItemChanges(sourceUpdates.itemDeltas);\r\n\t\tconst targetUpdates = targetTransaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ITEM.PRE_TRANSFER_ALL, sourceActor, sourceUpdates, targetActor, targetUpdates, userId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tawait sourceTransaction.commit();\r\n\t\tconst { itemDeltas } = await targetTransaction.commit();\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.ITEM.TRANSFER_ALL, sourceUuid, targetUuid, itemDeltas, userId, interactionId);\r\n\r\n\t\tconst macroData = {\r\n\t\t\taction: \"transferAllItems\",\r\n\t\t\tsource: sourceUuid,\r\n\t\t\ttarget: targetUuid,\r\n\t\t\titems: itemDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t};\r\n\t\tawait this._executeItemPileMacro(sourceUuid, macroData);\r\n\t\tawait this._executeItemPileMacro(targetUuid, macroData);\r\n\r\n\t\tconst sourceIsItemPile = PileUtilities.isValidItemPile(sourceActor);\r\n\t\tconst itemPileUuid = sourceIsItemPile ? sourceUuid : targetUuid;\r\n\t\tconst itemPile = sourceIsItemPile ? Utilities.getToken(sourceUuid) : Utilities.getToken(targetUuid);\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(itemPileUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(itemPileUuid);\r\n\t\t} else if (!skipVaultLogging && (PileUtilities.isItemPileVault(itemPile) || PileUtilities.isItemPileVault(targetActor))) {\r\n\t\t\tconst pileActor = sourceIsItemPile ? sourceActor : targetActor;\r\n\t\t\tconst actorToLog = sourceIsItemPile ? targetActor : sourceActor;\r\n\t\t\tawait PileUtilities.updateVaultLog(pileActor, {\r\n\t\t\t\tuserId, actor: actorToLog, items: itemDeltas, withdrawal: sourceIsItemPile\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn itemDeltas;\r\n\t}\r\n\r\n\tstatic async _addCurrencies(targetUuid, currencies, userId, {\r\n\t\tskipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst transaction = new Transaction(targetActor);\r\n\r\n\t\tconst currenciesToAdd = PileUtilities.getPriceFromString(currencies).currencies\r\n\t\t\t.filter(currency => currency.quantity);\r\n\r\n\t\tconst itemsToAdd = currenciesToAdd.filter(currency => currency.type === \"item\")\r\n\t\t\t.map(currency => ({ item: currency.data.item, quantity: currency.quantity }));\r\n\r\n\t\tconst attributesToAdd = currenciesToAdd.filter(currency => currency.type === \"attribute\")\r\n\t\t\t.map(currency => ({ path: currency.data.path, quantity: currency.quantity }));\r\n\r\n\t\tawait transaction.appendItemChanges(itemsToAdd, { type: \"currency\" });\r\n\t\tawait transaction.appendActorChanges(attributesToAdd, { type: \"currency\" });\r\n\r\n\t\tconst { actorUpdates, itemsToCreate, itemsToUpdate } = transaction.prepare(); // Prepare data\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.CURRENCY.PRE_ADD, targetActor, actorUpdates, itemsToCreate, itemsToUpdate, interactionId);\r\n\t\tif (hookResult === false) return false; // Call pre-hook to allow user to interrupt it\r\n\r\n\t\tconst { itemDeltas, attributeDeltas } = await transaction.commit(); // Actually add the items to the actor\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.CURRENCY.ADD, targetUuid, itemDeltas, attributeDeltas, userId, interactionId);\r\n\r\n\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\taction: \"addCurrencies\",\r\n\t\t\ttarget: targetUuid,\r\n\t\t\titems: itemDeltas,\r\n\t\t\tattributes: attributeDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t});\r\n\r\n\t\tif (!skipVaultLogging && PileUtilities.isItemPileVault(targetActor)) {\r\n\t\t\tawait PileUtilities.updateVaultLog(targetActor, {\r\n\t\t\t\tuserId, items: itemDeltas, attributes: attributeDeltas, withdrawal: false\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn { itemDeltas, attributeDeltas };\r\n\r\n\t}\r\n\r\n\tstatic async _removeCurrencies(targetUuid, currencies, userId, {\r\n\t\tskipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst transaction = new Transaction(targetActor);\r\n\r\n\t\tconst priceData = PileUtilities.getPriceFromString(currencies)\r\n\t\tconst overallCost = priceData.overallCost;\r\n\r\n\t\tconst paymentData = PileUtilities.getPaymentData({\r\n\t\t\tpurchaseData: [{ cost: overallCost, quantity: 1 }], buyer: targetActor\r\n\t\t});\r\n\r\n\t\tconst itemsToRemove = paymentData.finalPrices.filter(currency => currency.type === \"item\")\r\n\t\t\t.map(currency => ({ item: currency.data.item, quantity: currency.quantity }));\r\n\r\n\t\tconst attributesToRemove = paymentData.finalPrices.filter(currency => currency.type === \"attribute\")\r\n\t\t\t.map(currency => ({ path: currency.data.path, quantity: currency.quantity }));\r\n\r\n\t\tconst itemsToAdd = paymentData.buyerChange.filter(currency => currency.type === \"item\")\r\n\t\t\t.map(currency => ({ item: currency.data.item, quantity: currency.quantity }));\r\n\r\n\t\tconst attributesToAdd = paymentData.buyerChange.filter(currency => currency.type === \"attribute\")\r\n\t\t\t.map(currency => ({ path: currency.data.path, quantity: currency.quantity }));\r\n\r\n\t\tawait transaction.appendItemChanges(itemsToRemove, { remove: true, type: \"currency\" });\r\n\t\tawait transaction.appendActorChanges(attributesToRemove, { remove: true, type: \"currency\" });\r\n\t\tawait transaction.appendItemChanges(itemsToAdd, { type: \"currency\" });\r\n\t\tawait transaction.appendActorChanges(attributesToAdd, { type: \"currency\" });\r\n\r\n\t\tconst { actorUpdates, itemsToUpdate } = transaction.prepare(); // Prepare data\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.CURRENCY.PRE_REMOVE, targetActor, actorUpdates, itemsToUpdate, interactionId);\r\n\t\tif (hookResult === false) return false; // Call pre-hook to allow user to interrupt it\r\n\r\n\t\tconst { itemDeltas, attributeDeltas } = await transaction.commit(); // Actually add the items to the actor\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.CURRENCY.REMOVE, targetUuid, itemDeltas, attributeDeltas, userId, interactionId);\r\n\r\n\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\taction: \"removeCurrencies\",\r\n\t\t\ttarget: targetUuid,\r\n\t\t\titems: itemDeltas,\r\n\t\t\tattributes: attributeDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t});\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(targetUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(targetUuid);\r\n\t\t}\r\n\r\n\t\tif (!skipVaultLogging && PileUtilities.isItemPileVault(targetActor)) {\r\n\t\t\tawait PileUtilities.updateVaultLog(targetActor, {\r\n\t\t\t\tuserId, items: itemDeltas, attributes: attributeDeltas, withdrawal: true\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn { itemDeltas, attributeDeltas };\r\n\r\n\t}\r\n\r\n\tstatic async _transferCurrencies(sourceUuid, targetUuid, currencies, userId, {\r\n\t\tskipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(sourceUuid);\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst priceData = PileUtilities.getPriceFromString(currencies);\r\n\t\tconst overallCost = priceData.overallCost;\r\n\r\n\t\tconst paymentData = PileUtilities.getPaymentData({\r\n\t\t\tpurchaseData: [{ cost: overallCost, quantity: 1 }], buyer: sourceActor\r\n\t\t});\r\n\r\n\t\tconst sourceItemsToRemove = paymentData.finalPrices.filter(currency => currency.type === \"item\")\r\n\t\t\t.map(currency => ({ item: currency.data.item, quantity: currency.quantity }));\r\n\r\n\t\tconst sourceAttributesToRemove = paymentData.finalPrices.filter(currency => currency.type === \"attribute\")\r\n\t\t\t.map(currency => ({ path: currency.data.path, quantity: currency.quantity }));\r\n\r\n\t\tconst sourceItemsToAdd = paymentData.buyerChange.filter(currency => currency.type === \"item\")\r\n\t\t\t.map(currency => ({ item: currency.data.item, quantity: currency.quantity }));\r\n\r\n\t\tconst sourceAttributesToAdd = paymentData.buyerChange.filter(currency => currency.type === \"attribute\")\r\n\t\t\t.map(currency => ({ path: currency.data.path, quantity: currency.quantity }));\r\n\r\n\t\tconst sourceTransaction = new Transaction(sourceActor);\r\n\t\tawait sourceTransaction.appendItemChanges(sourceItemsToRemove, { remove: true, type: \"currency\" });\r\n\t\tawait sourceTransaction.appendActorChanges(sourceAttributesToRemove, { remove: true, type: \"currency\" });\r\n\t\tawait sourceTransaction.appendItemChanges(sourceItemsToAdd, { type: \"currency\" });\r\n\t\tawait sourceTransaction.appendActorChanges(sourceAttributesToAdd, { type: \"currency\" });\r\n\t\tconst sourceUpdates = sourceTransaction.prepare();\r\n\r\n\t\tconst targetItemsToAdd = paymentData.sellerReceive.filter(currency => currency.type === \"item\")\r\n\t\t\t.map(currency => ({ item: currency.data.item, quantity: currency.quantity }));\r\n\r\n\t\tconst targetAttributesToAdd = paymentData.sellerReceive.filter(currency => currency.type === \"attribute\")\r\n\t\t\t.map(currency => ({ path: currency.data.path, quantity: currency.quantity }));\r\n\r\n\t\tconst targetTransaction = new Transaction(targetActor);\r\n\t\tawait targetTransaction.appendItemChanges(targetItemsToAdd, { type: \"currency\" });\r\n\t\tawait targetTransaction.appendActorChanges(targetAttributesToAdd, { type: \"currency\" });\r\n\t\tconst targetUpdates = targetTransaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.CURRENCY.PRE_TRANSFER, sourceActor, sourceUpdates, targetActor, targetUpdates, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tawait sourceTransaction.commit();\r\n\t\tconst { itemDeltas, attributeDeltas } = await targetTransaction.commit();\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.CURRENCY.TRANSFER, sourceUuid, targetUuid, itemDeltas, attributeDeltas, userId, interactionId);\r\n\r\n\t\tconst macroData = {\r\n\t\t\taction: \"transferCurrencies\",\r\n\t\t\tsource: sourceUuid,\r\n\t\t\ttarget: targetUuid,\r\n\t\t\titems: itemDeltas,\r\n\t\t\tattributes: attributeDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t};\r\n\r\n\t\tawait this._executeItemPileMacro(sourceUuid, macroData);\r\n\t\tawait this._executeItemPileMacro(targetUuid, macroData);\r\n\r\n\t\tconst sourceIsItemPile = PileUtilities.isValidItemPile(sourceActor);\r\n\r\n\t\tconst itemPileUuid = sourceIsItemPile ? sourceUuid : targetUuid;\r\n\t\tconst itemPile = sourceIsItemPile ? Utilities.getToken(sourceUuid) : Utilities.getToken(targetUuid);\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(itemPileUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(itemPileUuid);\r\n\t\t} else if (PileUtilities.isItemPileLootable(itemPile)) {\r\n\t\t\tif (PileUtilities.isItemPileEmpty(itemPile)) {\r\n\t\t\t\tawait SharingUtilities.clearItemPileSharingData(itemPile);\r\n\t\t\t} else {\r\n\t\t\t\tawait SharingUtilities.setItemPileSharingData(sourceUuid, targetUuid, {\r\n\t\t\t\t\titems: itemDeltas, attributes: attributeDeltas\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t} else if (!skipVaultLogging && (PileUtilities.isItemPileVault(sourceActor) || PileUtilities.isItemPileVault(targetActor))) {\r\n\t\t\tconst sourceIsItemPile = PileUtilities.isItemPileVault(sourceActor);\r\n\t\t\tconst pileActor = sourceIsItemPile ? sourceActor : targetActor;\r\n\t\t\tconst actorToLog = sourceIsItemPile ? targetActor : sourceActor;\r\n\t\t\tawait PileUtilities.updateVaultLog(pileActor, {\r\n\t\t\t\tuserId, actor: actorToLog, items: itemDeltas, attributes: attributeDeltas, withdrawal: sourceIsItemPile\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn { itemDeltas, attributeDeltas };\r\n\r\n\t}\r\n\r\n\tstatic async _transferAllCurrencies(sourceUuid, targetUuid, userId, {\r\n\t\tskipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(sourceUuid);\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst currencyList = PileUtilities.getCurrencyList();\r\n\t\tconst sourceCurrencyList = PileUtilities.getActorCurrencies(sourceActor, { currencyList });\r\n\r\n\t\tconst itemsToTransfer = sourceCurrencyList.filter(currency => currency.type === \"item\")\r\n\t\t\t.map(currency => ({ item: currency.data.item, quantity: currency.quantity }));\r\n\r\n\t\tconst attributesToTransfer = sourceCurrencyList.filter(currency => currency.type === \"attribute\")\r\n\t\t\t.map(currency => ({ path: currency.data.path, quantity: currency.quantity }));\r\n\r\n\t\tconst sourceTransaction = new Transaction(sourceActor);\r\n\t\tawait sourceTransaction.appendItemChanges(itemsToTransfer, { remove: true, type: \"currency\" });\r\n\t\tawait sourceTransaction.appendActorChanges(attributesToTransfer, { remove: true, type: \"currency\" });\r\n\t\tconst sourceUpdates = sourceTransaction.prepare();\r\n\r\n\t\tconst targetTransaction = new Transaction(targetActor);\r\n\t\tawait targetTransaction.appendItemChanges(sourceUpdates.itemDeltas);\r\n\t\tawait targetTransaction.appendActorChanges(sourceUpdates.attributeDeltas);\r\n\t\tconst targetUpdates = targetTransaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.CURRENCY.PRE_TRANSFER_ALL, sourceActor, sourceUpdates, targetActor, targetUpdates, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tawait sourceTransaction.commit();\r\n\t\tconst { itemDeltas, attributeDeltas } = await targetTransaction.commit();\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.CURRENCY.TRANSFER_ALL, sourceUuid, targetUuid, itemDeltas, attributeDeltas, userId, interactionId);\r\n\r\n\t\tconst macroData = {\r\n\t\t\taction: \"transferAllCurrencies\",\r\n\t\t\tsource: sourceUuid,\r\n\t\t\ttarget: targetUuid,\r\n\t\t\titems: itemDeltas,\r\n\t\t\tattributes: attributeDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t};\r\n\t\tawait this._executeItemPileMacro(sourceUuid, macroData);\r\n\t\tawait this._executeItemPileMacro(targetUuid, macroData);\r\n\r\n\t\tconst sourceIsItemPile = PileUtilities.isValidItemPile(sourceActor);\r\n\t\tconst itemPileUuid = sourceIsItemPile ? sourceUuid : targetUuid;\r\n\t\tconst itemPile = sourceIsItemPile ? Utilities.getToken(sourceUuid) : Utilities.getToken(targetUuid);\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(itemPileUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(itemPileUuid);\r\n\t\t} else if (!skipVaultLogging && PileUtilities.isItemPileVault(itemPile)) {\r\n\t\t\tconst pileActor = sourceIsItemPile ? sourceActor : targetActor;\r\n\t\t\tconst actorToLog = sourceIsItemPile ? targetActor : sourceActor;\r\n\t\t\tawait PileUtilities.updateVaultLog(pileActor, {\r\n\t\t\t\tuserId, actor: actorToLog, items: itemDeltas, attributes: attributeDeltas, withdrawal: sourceIsItemPile\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn { itemDeltas, attributeDeltas };\r\n\r\n\t}\r\n\r\n\tstatic async _setAttributes(targetUuid, attributes, userId, { interactionId = false } = {}) {\r\n\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst transaction = new Transaction(targetActor);\r\n\t\tawait transaction.appendActorChanges(attributes, { set: true });\r\n\t\tconst { actorUpdates } = transaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ATTRIBUTE.PRE_SET, targetActor, actorUpdates, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tconst { attributeDeltas } = await transaction.commit();\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.ATTRIBUTE.SET, targetUuid, attributeDeltas, userId, interactionId);\r\n\r\n\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\taction: \"setAttributes\",\r\n\t\t\ttarget: targetUuid,\r\n\t\t\tattributes: attributeDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t});\r\n\r\n\t\treturn attributeDeltas;\r\n\r\n\t}\r\n\r\n\tstatic async _addAttributes(targetUuid, attributes, userId, {\r\n\t\tskipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst transaction = new Transaction(targetActor);\r\n\t\tawait transaction.appendActorChanges(attributes);\r\n\t\tconst { actorUpdates } = transaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ATTRIBUTE.PRE_ADD, targetActor, actorUpdates, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tconst { attributeDeltas } = await transaction.commit();\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.ATTRIBUTE.ADD, targetUuid, attributeDeltas, userId, interactionId);\r\n\r\n\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\taction: \"addAttributes\",\r\n\t\t\ttarget: targetUuid,\r\n\t\t\tattributes: attributeDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t});\r\n\r\n\t\tif (!skipVaultLogging && PileUtilities.isItemPileVault(targetActor)) {\r\n\t\t\tawait PileUtilities.updateVaultLog(targetActor, {\r\n\t\t\t\tuserId, attributes: attributeDeltas, withdrawal: false\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn attributeDeltas;\r\n\r\n\t}\r\n\r\n\tstatic async _removeAttributes(targetUuid, attributes, userId, {\r\n\t\tskipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst transaction = new Transaction(targetActor);\r\n\t\tawait transaction.appendActorChanges(attributes, { remove: true });\r\n\t\tconst { actorUpdates } = transaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ATTRIBUTE.PRE_REMOVE, targetActor, actorUpdates, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tconst { attributeDeltas } = await transaction.commit();\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.ATTRIBUTE.REMOVE, targetUuid, attributeDeltas, userId, interactionId);\r\n\r\n\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\taction: \"removeAttributes\",\r\n\t\t\ttarget: targetUuid,\r\n\t\t\tattributes: attributeDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t});\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(targetUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(targetUuid);\r\n\t\t}\r\n\r\n\t\tif (!skipVaultLogging && PileUtilities.isItemPileVault(targetActor)) {\r\n\t\t\tawait PileUtilities.updateVaultLog(targetActor, {\r\n\t\t\t\tuserId, attributes: attributeDeltas, withdrawal: true\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn attributeDeltas;\r\n\r\n\t}\r\n\r\n\tstatic async _transferAttributes(sourceUuid, targetUuid, attributes, userId, {\r\n\t\tskipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(sourceUuid);\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst sourceTransaction = new Transaction(sourceActor);\r\n\t\tawait sourceTransaction.appendActorChanges(attributes, { remove: true });\r\n\t\tconst sourceUpdates = sourceTransaction.prepare();\r\n\r\n\t\tconst targetTransaction = new Transaction(targetActor);\r\n\t\tawait targetTransaction.appendActorChanges(sourceUpdates.attributeDeltas);\r\n\t\tconst targetUpdates = targetTransaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ATTRIBUTE.PRE_TRANSFER, sourceActor, sourceUpdates.actorUpdates, targetActor, targetUpdates.actorUpdates, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tawait sourceTransaction.commit();\r\n\t\tconst { attributeDeltas } = await targetTransaction.commit();\r\n\r\n\t\tawait ItemPileSocket.executeForEveryone(ItemPileSocket.HANDLERS.CALL_HOOK, CONSTANTS.HOOKS.ATTRIBUTE.TRANSFER, sourceUuid, targetUuid, attributeDeltas, userId, interactionId);\r\n\r\n\t\tconst macroData = {\r\n\t\t\taction: \"transferAttributes\",\r\n\t\t\tsource: sourceUuid,\r\n\t\t\ttarget: targetUuid,\r\n\t\t\tattributes: attributeDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t};\r\n\t\tawait this._executeItemPileMacro(sourceUuid, macroData);\r\n\t\tawait this._executeItemPileMacro(targetUuid, macroData);\r\n\r\n\t\tconst sourceIsItemPile = PileUtilities.isValidItemPile(sourceActor);\r\n\r\n\t\tconst itemPileUuid = sourceIsItemPile ? sourceUuid : targetUuid;\r\n\t\tconst itemPile = sourceIsItemPile ? Utilities.getToken(sourceUuid) : Utilities.getToken(targetUuid);\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(itemPileUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(itemPileUuid);\r\n\t\t} else if (PileUtilities.isItemPileLootable(itemPile)) {\r\n\t\t\tif (PileUtilities.isItemPileEmpty(itemPile)) {\r\n\t\t\t\tawait SharingUtilities.clearItemPileSharingData(itemPile);\r\n\t\t\t} else {\r\n\t\t\t\tawait SharingUtilities.setItemPileSharingData(sourceUuid, targetUuid, {\r\n\t\t\t\t\tattributes: attributeDeltas\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t} else if (!skipVaultLogging && (PileUtilities.isItemPileVault(sourceActor) || PileUtilities.isItemPileVault(targetActor))) {\r\n\t\t\tconst pileActor = sourceIsItemPile ? sourceActor : targetActor;\r\n\t\t\tconst actorToLog = sourceIsItemPile ? targetActor : sourceActor;\r\n\t\t\tawait PileUtilities.updateVaultLog(pileActor, {\r\n\t\t\t\tuserId, actor: actorToLog, attributes: attributeDeltas, withdrawal: sourceIsItemPile\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn attributeDeltas;\r\n\r\n\t}\r\n\r\n\tstatic async _transferAllAttributes(sourceUuid, targetUuid, userId, {\r\n\t\tskipVaultLogging = false, interactionId = false\r\n\t} = {}) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(sourceUuid);\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst sourceAttributes = PileUtilities.getActorCurrencies(sourceActor).filter(entry => entry.type === \"attribute\");\r\n\t\tconst attributesToTransfer = sourceAttributes.filter(attribute => {\r\n\t\t\treturn hasProperty(targetActor, attribute.data.path);\r\n\t\t}).map(attribute => attribute.data.path);\r\n\r\n\t\tconst sourceTransaction = new Transaction(sourceActor);\r\n\t\tawait sourceTransaction.appendActorChanges(attributesToTransfer, { remove: true });\r\n\t\tconst sourceUpdates = sourceTransaction.prepare();\r\n\r\n\t\tconst targetTransaction = new Transaction(targetActor);\r\n\t\tawait targetTransaction.appendActorChanges(sourceUpdates.attributeDeltas);\r\n\t\tconst targetUpdates = targetTransaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ATTRIBUTE.PRE_TRANSFER_ALL, sourceActor, sourceUpdates.actorUpdates, targetActor, targetUpdates.actorUpdates, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tawait sourceTransaction.commit();\r\n\t\tconst { attributeDeltas } = await targetTransaction.commit();\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.ATTRIBUTE.TRANSFER_ALL, sourceUuid, targetUuid, attributeDeltas, userId, interactionId);\r\n\r\n\t\tconst macroData = {\r\n\t\t\taction: \"transferAllAttributes\",\r\n\t\t\tsource: sourceUuid,\r\n\t\t\ttarget: targetUuid,\r\n\t\t\tattributes: attributeDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t};\r\n\t\tawait this._executeItemPileMacro(sourceUuid, macroData);\r\n\t\tawait this._executeItemPileMacro(targetUuid, macroData);\r\n\r\n\t\tconst sourceIsItemPile = PileUtilities.isValidItemPile(sourceActor);\r\n\r\n\t\tconst itemPileUuid = sourceIsItemPile ? sourceUuid : targetUuid;\r\n\t\tconst itemPile = sourceIsItemPile ? Utilities.getToken(sourceUuid) : Utilities.getToken(targetUuid);\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(itemPileUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(itemPileUuid);\r\n\t\t}\r\n\r\n\t\treturn attributeDeltas;\r\n\r\n\t}\r\n\r\n\tstatic async _transferEverything(sourceUuid, targetUuid, userId, { itemFilters = false, interactionId } = {}) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(sourceUuid);\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst itemsToTransfer = PileUtilities.getActorItems(sourceActor, { itemFilters }).map(item => item.toObject());\r\n\r\n\t\tconst sourceCurrencies = PileUtilities.getActorCurrencies(sourceActor);\r\n\r\n\t\tconst itemCurrenciesToTransfer = sourceCurrencies\r\n\t\t\t.filter(currency => currency.type === \"item\")\r\n\t\t\t.map(currency => ({ id: currency.id, quantity: currency.quantity }));\r\n\r\n\t\tconst attributesToTransfer = sourceCurrencies\r\n\t\t\t.filter(entry => entry.type === \"attribute\")\r\n\t\t\t.map(currency => ({ path: currency.data.path, quantity: currency.quantity }));\r\n\r\n\t\tconst sourceTransaction = new Transaction(sourceActor);\r\n\t\tawait sourceTransaction.appendItemChanges(itemsToTransfer, { remove: true });\r\n\t\tawait sourceTransaction.appendItemChanges(itemCurrenciesToTransfer, {\r\n\t\t\tremove: true, type: \"currency\"\r\n\t\t});\r\n\t\tawait sourceTransaction.appendActorChanges(attributesToTransfer, { remove: true, type: \"currency\" });\r\n\t\tconst sourceUpdates = sourceTransaction.prepare();\r\n\r\n\t\tconst targetTransaction = new Transaction(targetActor);\r\n\t\tawait targetTransaction.appendItemChanges(sourceUpdates.itemDeltas);\r\n\t\tawait targetTransaction.appendActorChanges(sourceUpdates.attributeDeltas);\r\n\t\tconst targetUpdates = targetTransaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PRE_TRANSFER_EVERYTHING, sourceActor, sourceUpdates, targetActor, targetUpdates, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tawait sourceTransaction.commit();\r\n\t\tconst { itemDeltas, attributeDeltas } = await targetTransaction.commit();\r\n\r\n\t\tawait ItemPileSocket.executeForEveryone(ItemPileSocket.HANDLERS.CALL_HOOK, CONSTANTS.HOOKS.TRANSFER_EVERYTHING, sourceUuid, targetUuid, itemDeltas, attributeDeltas, userId, interactionId);\r\n\r\n\t\tconst macroData = {\r\n\t\t\taction: \"transferEverything\",\r\n\t\t\tsource: sourceUuid,\r\n\t\t\ttarget: targetUuid,\r\n\t\t\titems: itemDeltas,\r\n\t\t\tattributes: attributeDeltas,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t};\r\n\t\tawait this._executeItemPileMacro(sourceUuid, macroData);\r\n\t\tawait this._executeItemPileMacro(targetUuid, macroData);\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(sourceUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(sourceUuid);\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\titemsTransferred: itemDeltas, attributesTransferred: attributeDeltas\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tstatic async _commitActorChanges(actorUuid, {\r\n\t\tactorUpdates = {}, itemsToUpdate = [], itemsToDelete = [], itemsToCreate = []\r\n\t} = {}) {\r\n\t\tconst actor = Utilities.getActor(actorUuid);\r\n\t\tif (!foundry.utils.isEmpty(actorUpdates)) {\r\n\t\t\tawait actor.update(actorUpdates);\r\n\t\t}\r\n\t\tconst createdItems = itemsToCreate.length ? await actor.createEmbeddedDocuments(\"Item\", itemsToCreate) : [];\r\n\t\tif (itemsToUpdate.length) await actor.updateEmbeddedDocuments(\"Item\", itemsToUpdate);\r\n\t\tif (itemsToDelete.length) await actor.deleteEmbeddedDocuments(\"Item\", itemsToDelete);\r\n\t\treturn createdItems.map(item => item.toObject());\r\n\t}\r\n\r\n\t/**\r\n\t * If not given an actor, this method creates an item pile at a location, then adds an item to it.\r\n\t *\r\n\t * If a target was provided, it will just add the item to that target actor.\r\n\t *\r\n\t * If an actor was provided, it will transfer the item from the actor to the target actor.\r\n\t *\r\n\t * @param {String} userId\r\n\t * @param {String} sceneId\r\n\t * @param {String/Boolean} [sourceUuid=false]\r\n\t * @param {String/Boolean} [targetUuid=false]\r\n\t * @param {Object/Boolean} [position=false]\r\n\t * @param {Number/Boolean} [elevation=false]\r\n\t * @param {Object} [itemData=false]\r\n\t *\r\n\t * @returns {sourceUuid: string/boolean, targetUuid: string/boolean, position: object/boolean, itemsDropped: array }\r\n\t */\r\n\tstatic async _dropItems({\r\n\t\tuserId, sceneId, sourceUuid = false, targetUuid = false, itemData = false, position = false, elevation = false\r\n\t} = {}) {\r\n\r\n\t\tlet itemsDropped;\r\n\r\n\t\t// If there's a source of the item (it wasn't dropped from the item bar)\r\n\t\tif (sourceUuid) {\r\n\r\n\t\t\tsetProperty(itemData.item, game.itempiles.API.ITEM_QUANTITY_ATTRIBUTE, itemData.quantity);\r\n\r\n\t\t\t// If there's a target token, add the item to it, otherwise create a new pile at the drop location\r\n\t\t\tif (targetUuid) {\r\n\t\t\t\titemsDropped = await this._transferItems(sourceUuid, targetUuid, [itemData.item], userId);\r\n\t\t\t} else {\r\n\t\t\t\titemsDropped = (await this._removeItems(sourceUuid, [itemData.item], userId)).map(item => {\r\n\t\t\t\t\titem.quantity = Math.abs(item.quantity)\r\n\t\t\t\t\tUtilities.setItemQuantity(item.item, Math.abs(item.quantity), true);\r\n\t\t\t\t\treturn item;\r\n\t\t\t\t});\r\n\t\t\t\ttargetUuid = await this._createItemPile({\r\n\t\t\t\t\tsceneId, position, items: itemsDropped, tokenOverrides: {\r\n\t\t\t\t\t\televation: elevation || fromUuidSync(sourceUuid)?.elevation || 0\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t}\r\n\r\n\t\t\t// If there's no source (it was dropped from the item bar)\r\n\t\t} else {\r\n\r\n\t\t\t// If there's a target token, add the item to it, otherwise create a new pile at the drop location\r\n\t\t\tif (targetUuid) {\r\n\t\t\t\titemsDropped = await this._addItems(targetUuid, [itemData], userId);\r\n\t\t\t} else {\r\n\t\t\t\ttargetUuid = await this._createItemPile({\r\n\t\t\t\t\tsceneId, position, items: [itemData], tokenOverrides: { elevation: elevation || 0 }\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.ITEM.DROP, sourceUuid, targetUuid, itemsDropped, position);\r\n\r\n\t\treturn { sourceUuid, targetUuid, position, itemsDropped };\r\n\r\n\t}\r\n\r\n\tstatic async _createItemPile({\r\n\t\tsceneId = null,\r\n\t\tposition = false,\r\n\t\tactor = false,\r\n\t\tcreateActor = false,\r\n\t\titems = false,\r\n\t\ttokenOverrides = {},\r\n\t\tactorOverrides = {},\r\n\t\titemPileFlags = {},\r\n\t\tfolders = false,\r\n\t} = {}) {\r\n\r\n\t\tlet returns = {};\r\n\r\n\t\tlet pileActor;\r\n\r\n\t\tif (createActor) {\r\n\r\n\t\t\tlet pileDataDefaults = foundry.utils.deepClone(CONSTANTS.PILE_DEFAULTS);\r\n\r\n\t\t\tpileDataDefaults.enabled = true;\r\n\t\t\tif (foundry.utils.isEmpty(itemPileFlags)) {\r\n\t\t\t\tpileDataDefaults.deleteWhenEmpty = true;\r\n\t\t\t\tpileDataDefaults.displayOne = true;\r\n\t\t\t\tpileDataDefaults.showItemName = true;\r\n\t\t\t\tpileDataDefaults.overrideSingleItemScale = true;\r\n\t\t\t\tpileDataDefaults.singleItemScale = 0.75;\r\n\t\t\t}\r\n\r\n\t\t\tpileDataDefaults = foundry.utils.mergeObject(pileDataDefaults, itemPileFlags);\r\n\r\n\t\t\tconst actorData = {\r\n\t\t\t\tname: actor || \"New Item Pile\", type: Helpers.getSetting(\"actorClassType\"), img: \"icons/svg/item-bag.svg\"\r\n\t\t\t};\r\n\r\n\t\t\tif (folders) {\r\n\t\t\t\tconst folder = await Utilities.createFoldersFromNames(folders);\r\n\t\t\t\tif (folder) {\r\n\t\t\t\t\tactorData.folder = folder.id;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tpileActor = await Actor.create(actorData);\r\n\r\n\t\t\tconst prototypeTokenData = foundry.utils.mergeObject({\r\n\t\t\t\tname: \"Item Pile\",\r\n\t\t\t\tactorLink: false,\r\n\t\t\t\tbar1: { attribute: \"\" },\r\n\t\t\t\tvision: false,\r\n\t\t\t\tdisplayName: 50,\r\n\t\t\t\t[CONSTANTS.FLAGS.PILE]: pileDataDefaults,\r\n\t\t\t\t[CONSTANTS.FLAGS.VERSION]: Helpers.getModuleVersion(), ...Helpers.getSetting(SETTINGS.TOKEN_FLAG_DEFAULTS)\r\n\t\t\t}, tokenOverrides)\r\n\r\n\t\t\tconst actorUpdate = foundry.utils.mergeObject({\r\n\t\t\t\t[CONSTANTS.FLAGS.PILE]: pileDataDefaults,\r\n\t\t\t\t[CONSTANTS.FLAGS.VERSION]: Helpers.getModuleVersion(),\r\n\t\t\t\tprototypeToken: prototypeTokenData,\r\n\t\t\t}, actorOverrides)\r\n\r\n\t\t\tawait pileActor.update(actorUpdate);\r\n\r\n\t\t} else if (!actor) {\r\n\r\n\t\t\tpileActor = game.actors.get(Helpers.getSetting(SETTINGS.DEFAULT_ITEM_PILE_ACTOR_ID));\r\n\r\n\t\t\tif (!pileActor) {\r\n\r\n\t\t\t\tHelpers.custom_notify(\"A Default Item Pile has been added to your Actors list. You can configure the default look and behavior on it, or duplicate it to create different styles.\")\r\n\r\n\t\t\t\tlet pileDataDefaults = foundry.utils.deepClone(CONSTANTS.PILE_DEFAULTS);\r\n\r\n\t\t\t\tpileDataDefaults.enabled = true;\r\n\t\t\t\tif (foundry.utils.isEmpty(itemPileFlags)) {\r\n\t\t\t\t\tpileDataDefaults.deleteWhenEmpty = true;\r\n\t\t\t\t\tpileDataDefaults.displayOne = true;\r\n\t\t\t\t\tpileDataDefaults.showItemName = true;\r\n\t\t\t\t\tpileDataDefaults.overrideSingleItemScale = true;\r\n\t\t\t\t\tpileDataDefaults.singleItemScale = 0.75;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tpileDataDefaults = foundry.utils.mergeObject(pileDataDefaults, itemPileFlags);\r\n\r\n\t\t\t\tconst actorData = {\r\n\t\t\t\t\tname: \"Default Item Pile\", type: Helpers.getSetting(\"actorClassType\"), img: \"icons/svg/item-bag.svg\"\r\n\t\t\t\t};\r\n\r\n\t\t\t\tif (folders) {\r\n\t\t\t\t\tconst folder = await Utilities.createFoldersFromNames(folders);\r\n\t\t\t\t\tif (folder) {\r\n\t\t\t\t\t\tactorData.folder = folder.id;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tpileActor = await Actor.create(actorData);\r\n\r\n\t\t\t\tawait pileActor.update({\r\n\t\t\t\t\t[CONSTANTS.FLAGS.PILE]: pileDataDefaults,\r\n\t\t\t\t\t[CONSTANTS.FLAGS.VERSION]: Helpers.getModuleVersion(),\r\n\t\t\t\t\tprototypeToken: {\r\n\t\t\t\t\t\tname: \"Item Pile\",\r\n\t\t\t\t\t\tactorLink: false,\r\n\t\t\t\t\t\tbar1: { attribute: \"\" },\r\n\t\t\t\t\t\tvision: false,\r\n\t\t\t\t\t\tdisplayName: 50,\r\n\t\t\t\t\t\t[CONSTANTS.FLAGS.PILE]: pileDataDefaults,\r\n\t\t\t\t\t\t[CONSTANTS.FLAGS.VERSION]: Helpers.getModuleVersion(), ...Helpers.getSetting(SETTINGS.TOKEN_FLAG_DEFAULTS)\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\r\n\t\t\t\tawait game.settings.set(CONSTANTS.MODULE_NAME, \"defaultItemPileActorID\", pileActor.id);\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tpileActor = await fromUuid(actor);\r\n\r\n\t\t\tif (!pileActor) {\r\n\t\t\t\tthrow Helpers.custom_error(\"Could not find actor with UUID \" + actor);\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif (items) {\r\n\t\t\tfor (let i = 0; i < items.length; i++) {\r\n\t\t\t\tlet itemData = items[i]?.item ?? items[i];\r\n\t\t\t\titemData = await Item.implementation.create(itemData, { temporary: true });\r\n\t\t\t\titemData = itemData.toObject();\r\n\t\t\t\tif (SYSTEMS.DATA.ITEM_TRANSFORMER) {\r\n\t\t\t\t\titemData = await SYSTEMS.DATA.ITEM_TRANSFORMER(itemData);\r\n\t\t\t\t}\r\n\t\t\t\titems[i] = itemData;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\titems = []\r\n\t\t}\r\n\r\n\t\titems = items ? items.map(item => {\r\n\t\t\treturn item.item ?? item;\r\n\t\t}) : [];\r\n\r\n\t\tif (position && sceneId) {\r\n\r\n\t\t\tlet overrideData = foundry.utils.mergeObject({\r\n\t\t\t\t...position, ...tokenOverrides, ...Helpers.getSetting(SETTINGS.TOKEN_FLAG_DEFAULTS)\r\n\t\t\t}, {});\r\n\r\n\t\t\tlet pileData = PileUtilities.getActorFlagData(pileActor);\r\n\t\t\tpileData.enabled = true;\r\n\t\t\tpileData = foundry.utils.mergeObject(pileData, itemPileFlags);\r\n\r\n\t\t\tif (!pileActor.prototypeToken.actorLink) {\r\n\r\n\t\t\t\toverrideData[CONSTANTS.ACTOR_DELTA_PROPERTY] = actorOverrides;\r\n\r\n\t\t\t\tconst data = { data: pileData, items: [...items] };\r\n\r\n\t\t\t\tfor (let index = 0; index < data.items.length; index++) {\r\n\t\t\t\t\tdata.items[index] = await Item.implementation.create(data.items[index], { temporary: true });\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst overrideImage = getProperty(overrideData, \"texture.src\") ?? getProperty(overrideData, \"img\");\r\n\t\t\t\tconst overrideScale = getProperty(overrideData, \"texture.scaleX\") ?? getProperty(overrideData, \"texture.scaleY\") ?? getProperty(overrideData, \"scale\");\r\n\r\n\t\t\t\tconst scale = PileUtilities.getItemPileTokenScale(pileActor, data, overrideScale);\r\n\r\n\t\t\t\toverrideData = foundry.utils.mergeObject(overrideData, {\r\n\t\t\t\t\t\"texture.src\": PileUtilities.getItemPileTokenImage(pileActor, data, overrideImage),\r\n\t\t\t\t\t\"texture.scaleX\": scale,\r\n\t\t\t\t\t\"texture.scaleY\": scale,\r\n\t\t\t\t\t\"name\": PileUtilities.getItemPileName(pileActor, data, overrideData?.name),\r\n\t\t\t\t});\r\n\r\n\t\t\t}\r\n\r\n\t\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_CREATE, overrideData, items);\r\n\t\t\tif (hookResult === false) return false;\r\n\r\n\t\t\tconst tokenData = await pileActor.getTokenDocument(overrideData);\r\n\r\n\t\t\tconst scene = game.scenes.get(sceneId);\r\n\r\n\t\t\tconst [tokenDocument] = await scene.createEmbeddedDocuments(\"Token\", [tokenData]);\r\n\r\n\t\t\tif (items.length && !pileActor.prototypeToken.actorLink) {\r\n\t\t\t\tnew Promise(async (resolve) => {\r\n\t\t\t\t\tawait Helpers.wait(250);\r\n\t\t\t\t\tawait Helpers.hooks.runWithout(async () => {\r\n\t\t\t\t\t\tawait tokenDocument.actor.createEmbeddedDocuments(\"Item\", items);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tresolve();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\treturns[\"tokenUuid\"] = Utilities.getUuid(tokenDocument);\r\n\r\n\t\t} else if (pileActor.prototypeToken.actorLink) {\r\n\r\n\t\t\tif (items.length && !pileActor.prototypeToken.actorLink) {\r\n\t\t\t\tawait Helpers.hooks.runWithout(async () => {\r\n\t\t\t\t\tawait pileActor.createEmbeddedDocuments(\"Item\", items);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturns[\"actorUuid\"] = pileActor.uuid;\r\n\r\n\t\treturn returns;\r\n\r\n\t}\r\n\r\n\tstatic async _turnTokensIntoItemPiles(targetUuids, pileSettings = {}, tokenSettings = {}) {\r\n\r\n\t\tconst tokenUpdateGroups = {};\r\n\t\tconst actorUpdateGroups = {};\r\n\r\n\t\tfor (const targetUuid of targetUuids) {\r\n\r\n\t\t\tconst target = fromUuidSync(targetUuid);\r\n\r\n\t\t\tlet targetItemPileSettings = PileUtilities.getActorFlagData(target);\r\n\r\n\t\t\tconst defaultItemPileId = Helpers.getSetting(SETTINGS.DEFAULT_ITEM_PILE_ACTOR_ID);\r\n\t\t\tconst defaultItemPileActor = game.actors.get(defaultItemPileId);\r\n\t\t\tif (defaultItemPileActor) {\r\n\t\t\t\tconst defaultItemPileSettings = PileUtilities.getActorFlagData(defaultItemPileActor);\r\n\t\t\t\ttargetItemPileSettings = foundry.utils.mergeObject(targetItemPileSettings, defaultItemPileSettings);\r\n\t\t\t}\r\n\r\n\t\t\tlet specificPileSettings = foundry.utils.mergeObject(targetItemPileSettings, pileSettings);\r\n\t\t\tspecificPileSettings.enabled = true;\r\n\r\n\t\t\tconst targetItems = PileUtilities.getActorItems(target, { itemFilters: specificPileSettings.overrideItemFilters });\r\n\t\t\tconst targetCurrencies = PileUtilities.getActorCurrencies(target, { currencyList: specificPileSettings.overrideCurrencies });\r\n\r\n\t\t\tconst data = { data: specificPileSettings, items: targetItems, currencies: targetCurrencies };\r\n\r\n\t\t\tlet specificTokenSettings = Helpers.isFunction(tokenSettings) ? await tokenSettings(target) : foundry.utils.deepClone(tokenSettings);\r\n\r\n\t\t\tconst overrideImage = getProperty(specificTokenSettings, \"texture.src\") ?? getProperty(specificTokenSettings, \"img\");\r\n\t\t\tconst overrideScale = getProperty(specificTokenSettings, \"texture.scaleX\") ?? getProperty(specificTokenSettings, \"texture.scaleY\") ?? getProperty(specificTokenSettings, \"scale\");\r\n\r\n\t\t\tconst scale = PileUtilities.getItemPileTokenScale(target, data, overrideScale);\r\n\r\n\t\t\tspecificTokenSettings = foundry.utils.mergeObject(specificTokenSettings, {\r\n\t\t\t\t\"texture.src\": PileUtilities.getItemPileTokenImage(target, data, overrideImage),\r\n\t\t\t\t\"texture.scaleX\": scale,\r\n\t\t\t\t\"texture.scaleY\": scale,\r\n\t\t\t\t\"name\": PileUtilities.getItemPileName(target, data, specificTokenSettings?.name)\r\n\t\t\t});\r\n\r\n\t\t\tconst sceneId = targetUuid.split('.')[1];\r\n\t\t\tconst tokenId = targetUuid.split('.')[3];\r\n\r\n\t\t\tif (!tokenUpdateGroups[sceneId]) {\r\n\t\t\t\ttokenUpdateGroups[sceneId] = []\r\n\t\t\t}\r\n\r\n\t\t\ttokenUpdateGroups[sceneId].push({\r\n\t\t\t\t\"_id\": tokenId, ...specificTokenSettings, [CONSTANTS.FLAGS.PILE]: specificPileSettings\r\n\t\t\t});\r\n\r\n\t\t\tif (target.isLinked) {\r\n\t\t\t\tif (actorUpdateGroups[target.actor.id]) continue;\r\n\t\t\t\tactorUpdateGroups[target.actor.id] = {\r\n\t\t\t\t\t\"_id\": target.actor.id, [CONSTANTS.FLAGS.PILE]: specificPileSettings\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_TURN_INTO, tokenUpdateGroups, actorUpdateGroups);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tawait Actor.updateDocuments(Object.values(actorUpdateGroups));\r\n\r\n\t\tfor (const [sceneId, updateData] of Object.entries(tokenUpdateGroups)) {\r\n\t\t\tconst scene = game.scenes.get(sceneId);\r\n\t\t\tawait scene.updateEmbeddedDocuments(\"Token\", updateData);\r\n\t\t}\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.PILE.TURN_INTO, tokenUpdateGroups, actorUpdateGroups);\r\n\r\n\t\treturn targetUuids;\r\n\r\n\t}\r\n\r\n\tstatic async _revertTokensFromItemPiles(targetUuids, tokenSettings) {\r\n\r\n\t\tconst actorUpdateGroups = {};\r\n\t\tconst tokenUpdateGroups = {};\r\n\r\n\t\tfor (const targetUuid of targetUuids) {\r\n\r\n\t\t\tlet target = fromUuidSync(targetUuid);\r\n\r\n\t\t\tlet specificPileSettings = PileUtilities.getActorFlagData(target);\r\n\t\t\tspecificPileSettings.enabled = false;\r\n\r\n\t\t\tconst sceneId = targetUuid.split('.')[1];\r\n\t\t\tconst tokenId = targetUuid.split('.')[3];\r\n\r\n\t\t\tif (!tokenUpdateGroups[sceneId]) {\r\n\t\t\t\ttokenUpdateGroups[sceneId] = [];\r\n\t\t\t}\r\n\r\n\t\t\tconst specificTokenSettings = Helpers.isFunction(tokenSettings) ? await tokenSettings(target) : foundry.utils.deepClone(tokenSettings);\r\n\r\n\t\t\ttokenUpdateGroups[sceneId].push({\r\n\t\t\t\t\"_id\": tokenId, ...specificTokenSettings, [CONSTANTS.FLAGS.PILE]: specificPileSettings\r\n\t\t\t});\r\n\r\n\t\t\tif (target.isLinked) {\r\n\t\t\t\tif (actorUpdateGroups[target.actor.id]) continue;\r\n\t\t\t\tactorUpdateGroups[target.actor.id] = {\r\n\t\t\t\t\t\"_id\": target.actor.id, [CONSTANTS.FLAGS.PILE]: specificPileSettings\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_REVERT_FROM, tokenUpdateGroups, actorUpdateGroups);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tawait Actor.updateDocuments(Object.values(actorUpdateGroups));\r\n\r\n\t\tfor (const [sceneId, updateData] of Object.entries(tokenUpdateGroups)) {\r\n\t\t\tconst scene = game.scenes.get(sceneId);\r\n\t\t\tawait scene.updateEmbeddedDocuments(\"Token\", updateData);\r\n\t\t}\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.PILE.REVERT_FROM, tokenUpdateGroups, actorUpdateGroups);\r\n\r\n\t\treturn targetUuids;\r\n\r\n\t}\r\n\r\n\tstatic async _updateItemPile(targetUuid, newData, { interactingTokenUuid = false, tokenSettings = false } = {}) {\r\n\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\t\tconst interactingToken = interactingTokenUuid ? Utilities.getToken(interactingTokenUuid) : false;\r\n\r\n\t\tconst oldData = PileUtilities.getActorFlagData(targetActor);\r\n\r\n\t\tconst data = foundry.utils.mergeObject(foundry.utils.deepClone(oldData), foundry.utils.deepClone(newData));\r\n\r\n\t\tconst diff = foundry.utils.diffObject(oldData, data);\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_UPDATE, targetActor, data, interactingToken, tokenSettings);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tawait Helpers.wait(15);\r\n\r\n\t\tawait PileUtilities.updateItemPileData(targetActor, data, tokenSettings);\r\n\r\n\t\tif (PileUtilities.isItemPileContainer(targetActor, data)) {\r\n\t\t\tif (diff?.closed === true) {\r\n\t\t\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\t\t\taction: \"closeItemPile\", source: interactingTokenUuid, target: targetUuid\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tif (diff?.locked === true) {\r\n\t\t\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\t\t\taction: \"lockItemPile\", source: interactingTokenUuid, target: targetUuid\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tif (diff?.locked === false) {\r\n\t\t\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\t\t\taction: \"unlockItemPile\", source: interactingTokenUuid, target: targetUuid\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tif (diff?.closed === false) {\r\n\t\t\t\tawait this._executeItemPileMacro(targetUuid, {\r\n\t\t\t\t\taction: \"openItemPile\", source: interactingTokenUuid, target: targetUuid\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn ItemPileSocket.executeForEveryone(ItemPileSocket.HANDLERS.UPDATED_PILE, targetUuid, diff, interactingTokenUuid);\r\n\t}\r\n\r\n\tstatic _updatedItemPile(targetUuid, diffData, interactingTokenUuid) {\r\n\r\n\t\tconst target = Utilities.getToken(targetUuid);\r\n\r\n\t\tconst interactingToken = interactingTokenUuid ? fromUuidSync(interactingTokenUuid) : false;\r\n\r\n\t\tif (foundry.utils.isEmpty(diffData)) return false;\r\n\r\n\t\tconst data = PileUtilities.getActorFlagData(target);\r\n\r\n\t\tHelpers.hooks.callAll(CONSTANTS.HOOKS.PILE.UPDATE, target, diffData, interactingToken)\r\n\r\n\t\tif (PileUtilities.isItemPileContainer(target, data)) {\r\n\t\t\tif (diffData?.closed === true) {\r\n\t\t\t\tHelpers.hooks.callAll(CONSTANTS.HOOKS.PILE.CLOSE, target, interactingToken)\r\n\t\t\t}\r\n\t\t\tif (diffData?.locked === true) {\r\n\t\t\t\tHelpers.hooks.callAll(CONSTANTS.HOOKS.PILE.LOCK, target, interactingToken)\r\n\t\t\t}\r\n\t\t\tif (diffData?.locked === false) {\r\n\t\t\t\tHelpers.hooks.callAll(CONSTANTS.HOOKS.PILE.UNLOCK, target, interactingToken)\r\n\t\t\t}\r\n\t\t\tif (diffData?.closed === false) {\r\n\t\t\t\tHelpers.hooks.callAll(CONSTANTS.HOOKS.PILE.OPEN, target, interactingToken)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tstatic async _deleteItemPile(targetUuid) {\r\n\t\tconst target = Utilities.getToken(targetUuid);\r\n\t\tif (!target) return false;\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_DELETE, target);\r\n\t\tif (hookResult === false) return false;\r\n\t\treturn target.document.delete();\r\n\t}\r\n\r\n\t/* -------- PRIVATE ITEM PILE METHODS -------- */\r\n\r\n\t/**\r\n\t * Checks whether a given item pile would need to update its images, text, and/or scale\r\n\t *\r\n\t * @param {foundry.abstract.Document} doc\r\n\t * @param {object} changes\r\n\t * @param {boolean} force\r\n\t * @returns {*}\r\n\t * @private\r\n\t */\r\n\tstatic async _evaluateItemPileChange(doc, changes = {}, force = false) {\r\n\t\tconst duplicatedChanges = foundry.utils.deepClone(changes);\r\n\t\tconst target = doc?.token ?? doc;\r\n\t\tif (!Helpers.isResponsibleGM()) return;\r\n\t\tif (!force && !PileUtilities.shouldEvaluateChange(target, duplicatedChanges)) return;\r\n\t\tconst targetUuid = target.uuid;\r\n\t\treturn Helpers.debounceManager.setDebounce(targetUuid, async (uuid) => {\r\n\t\t\tif (!Utilities.getDocument(uuid)) return;\r\n\t\t\tconst deleted = PileUtilities.shouldItemPileBeDeleted(uuid);\r\n\t\t\tif (deleted) return;\r\n\t\t\tawait Helpers.hooks.runWithout(async () => {\r\n\t\t\t\tawait PileUtilities.updateItemPileData(uuid);\r\n\t\t\t});\r\n\t\t})(targetUuid);\r\n\t}\r\n\r\n\t/**\r\n\t * Pre-loads all images and sounds related to a given token document on the client-side.\r\n\t *\r\n\t * @param {TokenDocument} tokenDocument\r\n\t * @return {Promise<boolean>}\r\n\t */\r\n\tstatic async _preloadItemPileFiles(tokenDocument) {\r\n\r\n\t\tif (!PileUtilities.isItemPileContainer(tokenDocument)) return false;\r\n\r\n\t\tconst pileData = PileUtilities.getActorFlagData(tokenDocument);\r\n\r\n\t\tif (Helpers.getSetting(\"preloadFiles\")) {\r\n\t\t\tawait Promise.allSettled(Object.entries(pileData).map(entry => {\r\n\t\t\t\treturn new Promise(async (resolve) => {\r\n\t\t\t\t\tconst [property, filePath] = entry;\r\n\t\t\t\t\tif (Array.isArray(filePath)) {\r\n\t\t\t\t\t\treturn resolve();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst isImage = property.toLowerCase().includes(\"image\");\r\n\t\t\t\t\tconst isSound = property.toLowerCase().includes(\"sound\");\r\n\t\t\t\t\tif ((!isImage && !isSound) || (!filePath || preloadedFiles.has(filePath))) return resolve();\r\n\t\t\t\t\tpreloadedFiles.add(filePath);\r\n\t\t\t\t\tif (isImage) {\r\n\t\t\t\t\t\tawait loadTexture(filePath);\r\n\t\t\t\t\t\tHelpers.debug(`Preloaded image: ${filePath}`);\r\n\t\t\t\t\t} else if (isSound) {\r\n\t\t\t\t\t\tHelpers.debug(`Preloaded sound: ${filePath}`);\r\n\t\t\t\t\t\tawait AudioHelper.preloadSound(filePath);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tresolve();\r\n\t\t\t\t});\r\n\t\t\t}));\r\n\t\t}\r\n\r\n\t\tHelpers.debug(`Initialized item pile with uuid ${tokenDocument.uuid}`);\r\n\t}\r\n\r\n\t/**\r\n\t * This executes any macro that is configured on the item pile, providing the macro with extra data relating to the\r\n\t * action that prompted the execution (if the advanced-macros module is installed)\r\n\t *\r\n\t * @param {String} targetUuid\r\n\t * @param {Object} macroData\r\n\t * @return {Promise/Boolean}\r\n\t */\r\n\tstatic async _executeItemPileMacro(targetUuid, macroData) {\r\n\r\n\t\tconst target = Utilities.getToken(targetUuid);\r\n\r\n\t\tif (!PileUtilities.isValidItemPile(target)) return false;\r\n\r\n\t\tconst pileData = PileUtilities.getActorFlagData(target);\r\n\r\n\t\tif (!pileData.macro) return false;\r\n\r\n\t\t// Reformat macro data to contain useful information\r\n\t\tif (macroData.source) {\r\n\t\t\tmacroData.source = fromUuidSync(macroData.source);\r\n\t\t}\r\n\r\n\t\tif (Array.isArray(macroData.target)) {\r\n\r\n\t\t\tmacroData.target = macroData.target.map(target => fromUuidSync(target));\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif (macroData.target) {\r\n\t\t\t\tmacroData.target = fromUuidSync(macroData.target);\r\n\t\t\t}\r\n\r\n\t\t\tconst sourceActor = macroData.source instanceof TokenDocument ? macroData.source.actor : macroData.source;\r\n\t\t\tconst targetActor = macroData.target instanceof TokenDocument ? macroData.target.actor : macroData.target;\r\n\r\n\t\t\tif (macroData.items) {\r\n\t\t\t\tmacroData.items = macroData.items.map(item => targetActor.items.get(item?.item?._id ?? item._id));\r\n\t\t\t}\r\n\r\n\t\t\tif (macroData.sourceItems) {\r\n\t\t\t\tmacroData.sourceItems = macroData.sourceItems.map(item => sourceActor.items.get(item?.item?._id ?? item._id));\r\n\t\t\t}\r\n\r\n\t\t\tif (macroData.targetItems) {\r\n\t\t\t\tmacroData.targetItems = macroData.targetItems.map(item => targetActor.items.get(item?.item?._id ?? item._id));\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn Utilities.runMacro(pileData.macro, macroData)\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * This handles any dropped data onto the canvas or a set item pile\r\n\t *\r\n\t * @param {canvas} canvas\r\n\t * @param {Object} data\r\n\t * @return {Promise}\r\n\t */\r\n\tstatic async _dropData(canvas, data) {\r\n\r\n\t\tif (data.type !== \"Item\") return;\r\n\r\n\t\tlet item = await Item.implementation.fromDropData(data);\r\n\t\tlet itemData = item ? item.toObject() : false;\r\n\r\n\t\tif (!itemData) {\r\n\t\t\tconsole.error(data);\r\n\t\t\tthrow Helpers.custom_error(\"Something went wrong when dropping this item!\")\r\n\t\t}\r\n\r\n\t\tconst dropData = {\r\n\t\t\tsource: false, target: data?.target ?? false, elevation: data?.elevation, itemData: {\r\n\t\t\t\titem: itemData, quantity: 1,\r\n\t\t\t}, position: false\r\n\t\t};\r\n\r\n\t\tdropData.source = Utilities.getSourceActorFromDropData(data);\r\n\r\n\t\tif (!dropData.source && !game.user.isGM) {\r\n\t\t\treturn Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Errors.NoSourceDrop\"), true)\r\n\t\t}\r\n\r\n\t\tconst pre_drop_determined_hook = Helpers.hooks.call(CONSTANTS.HOOKS.ITEM.PRE_DROP_DETERMINED, dropData.source, dropData.target, dropData.itemData, dropData.position);\r\n\t\tif (pre_drop_determined_hook === false) return;\r\n\r\n\t\tlet droppableDocuments = [];\r\n\t\tlet x, y;\r\n\r\n\t\tif (dropData.target) {\r\n\r\n\t\t\tdroppableDocuments.push(dropData.target);\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconst position = canvas.grid.getTopLeft(data.x, data.y);\r\n\t\t\tx = position[0];\r\n\t\t\ty = position[1];\r\n\r\n\t\t\tdroppableDocuments = Utilities.getTokensAtLocation({ x, y })\r\n\t\t\t\t.map(token => Utilities.getDocument(token));\r\n\r\n\t\t\tif (droppableDocuments.length && game.modules.get(\"midi-qol\")?.active && game.settings.get(\"midi-qol\", \"DragDropTarget\")) {\r\n\t\t\t\tHelpers.custom_warning(\"You have Drag & Drop Targetting enabled in MidiQOL, which disables drag & drop items\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (!droppableDocuments.length) {\r\n\t\t\t\tdropData.position = { x, y };\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst droppableItemPiles = droppableDocuments.filter(token => PileUtilities.isValidItemPile(token));\r\n\t\tconst droppableNormalTokens = droppableDocuments.filter(token => !PileUtilities.isValidItemPile(token));\r\n\r\n\t\tdropData.target = droppableItemPiles?.[0] ?? droppableNormalTokens[0];\r\n\r\n\t\tconst sourceIsVault = dropData.source ? PileUtilities.isItemPileVault(dropData.source) : false;\r\n\t\tconst targetIsVault = PileUtilities.isItemPileVault(dropData.target);\r\n\t\tconst targetIsItemPile = PileUtilities.isValidItemPile(droppableItemPiles[0]);\r\n\r\n\t\tconst canGiveItems = Helpers.getSetting(SETTINGS.ENABLE_GIVING_ITEMS);\r\n\t\tconst canDropItems = Helpers.getSetting(SETTINGS.ENABLE_DROPPING_ITEMS);\r\n\r\n\t\tconst givingItem = canGiveItems && dropData.target && !targetIsItemPile;\r\n\t\tconst droppingItem = canDropItems && (dropData.target || dropData.position);\r\n\r\n\t\tif ((sourceIsVault || targetIsVault) && dropData.target) {\r\n\t\t\treturn this._depositWithdrawItem(dropData, sourceIsVault, targetIsVault);\r\n\t\t} else if (givingItem && canGiveItems) {\r\n\t\t\treturn this._giveItem(dropData);\r\n\t\t} else if (droppingItem && canDropItems) {\r\n\t\t\treturn this._dropItem(dropData);\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tstatic async _depositWithdrawItem(dropData, sourceIsVault = false, targetIsVault = true) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(dropData.source);\r\n\t\tconst targetActor = Utilities.getActor(dropData.target);\r\n\t\tif (sourceActor && targetActor && sourceActor === targetActor) return;\r\n\r\n\t\tconst vaultActor = (!sourceIsVault && targetIsVault) || !sourceActor ? targetActor : sourceActor;\r\n\t\tconst localization = (!sourceIsVault && targetIsVault) || !sourceActor ? \"DepositItem\" : \"WithdrawItem\";\r\n\r\n\t\tconst validItem = await PileUtilities.checkItemType(vaultActor, dropData.itemData.item);\r\n\t\tif (!validItem) return;\r\n\t\tdropData.itemData.item = validItem;\r\n\r\n\t\tconst item = await Item.implementation.create(dropData.itemData.item, { temporary: true });\r\n\r\n\t\tlet itemQuantity = Utilities.getItemQuantity(dropData.itemData.item);\r\n\t\tif (itemQuantity > 1 && PileUtilities.canItemStack(dropData.itemData.item, vaultActor)) {\r\n\t\t\tconst quantity = await DropItemDialog.show(item, vaultActor, {\r\n\t\t\t\tlocalizationTitle: localization\r\n\t\t\t});\r\n\t\t\tUtilities.setItemQuantity(dropData.itemData.item, quantity);\r\n\t\t\tdropData.itemData.quantity = quantity;\r\n\t\t} else {\r\n\t\t\tdropData.itemData.quantity = 1;\r\n\t\t}\r\n\r\n\t\tlet flagData = PileUtilities.getItemFlagData(dropData.itemData.item);\r\n\t\tif (!sourceIsVault && targetIsVault) {\r\n\t\t\tsetProperty(flagData, \"x\", dropData.gridPosition.x);\r\n\t\t\tsetProperty(flagData, \"y\", dropData.gridPosition.y);\r\n\t\t}\r\n\t\tsetProperty(dropData.itemData, CONSTANTS.FLAGS.ITEM, flagData);\r\n\r\n\t\tif (sourceActor) {\r\n\t\t\treturn game.itempiles.API.transferItems(sourceActor, targetActor, [dropData.itemData], { interactionId: dropData.interactionId });\r\n\t\t}\r\n\r\n\t\tif (!game.user.isGM) return;\r\n\r\n\t\treturn game.itempiles.API.addItems(targetActor, [dropData.itemData], { interactionId: dropData.interactionId });\r\n\r\n\t}\r\n\r\n\tstatic async _giveItem(dropData) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(dropData.source);\r\n\t\tconst targetActor = Utilities.getActor(dropData.target);\r\n\t\tif (sourceActor === targetActor) return;\r\n\r\n\t\tconst sourceUuid = Utilities.getUuid(sourceActor);\r\n\t\tconst targetUuid = Utilities.getUuid(targetActor);\r\n\r\n\t\tconst validItem = await PileUtilities.checkItemType(dropData.target, dropData.itemData.item);\r\n\t\tif (!validItem) return;\r\n\t\tdropData.itemData.item = validItem;\r\n\r\n\t\tconst actorOwners = Object.entries(dropData.target?.actor?.ownership ?? dropData.target?.ownership)\r\n\t\t\t.filter(entry => {\r\n\t\t\t\treturn entry[0] !== \"default\" && entry[1] === CONST.DOCUMENT_PERMISSION_LEVELS.OWNER;\r\n\t\t\t})\r\n\t\t\t.map(entry => game.users.get(entry[0]))\r\n\t\t\t.sort(user => user.isGM ? 1 : -1);\r\n\r\n\t\tconst user = actorOwners?.[0];\r\n\r\n\t\tif (user && !user?.active && !game.user.isGM) {\r\n\t\t\treturn TJSDialog.prompt({\r\n\t\t\t\ttitle: game.i18n.localize(\"ITEM-PILES.Dialogs.GiveItemUserNotActive.Title\"), content: {\r\n\t\t\t\t\tclass: CustomDialog, props: {\r\n\t\t\t\t\t\tcontent: game.i18n.format(\"ITEM-PILES.Dialogs.GiveItemUserNotActive.Content\", {\r\n\t\t\t\t\t\t\tactor_name: dropData.target.actor.name, user_name: user.name\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tconst item = await Item.implementation.create(dropData.itemData.item, { temporary: true });\r\n\r\n\t\tif (!dropData.source && game.user.isGM) {\r\n\t\t\tHelpers.custom_notify(game.i18n.format(\"ITEM-PILES.Notifications.ItemAdded\", {\r\n\t\t\t\ttarget_actor_name: dropData.target.name, item_name: item.name\r\n\t\t\t}));\r\n\t\t\treturn this._addItems(targetUuid, [dropData.itemData.item], game.user.id)\r\n\t\t}\r\n\r\n\t\tconst gms = Helpers.getActiveGMs().map(user => user.id);\r\n\r\n\t\tif (user?.active || gms.length || game.user.isGM) {\r\n\r\n\t\t\tif (PileUtilities.canItemStack(dropData.itemData.item)) {\r\n\t\t\t\tconst quantity = await DropItemDialog.show(item, dropData.target.actor, {\r\n\t\t\t\t\tlocalizationTitle: \"GiveItem\"\r\n\t\t\t\t});\r\n\t\t\t\tUtilities.setItemQuantity(dropData.itemData.item, quantity);\r\n\t\t\t\tdropData.itemData.quantity = quantity;\r\n\t\t\t} else {\r\n\t\t\t\tdropData.itemData.quantity = 1;\r\n\t\t\t}\r\n\r\n\t\t\tif (Hooks.call(CONSTANTS.HOOKS.ITEM.PRE_GIVE, dropData.source, dropData.target, dropData.itemData, user.id) === false) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif ((!user || !user?.active || user === game.user) && game.user.isGM) {\r\n\t\t\t\tif (dropData.source) {\r\n\t\t\t\t\tHelpers.custom_notify(game.i18n.format(\"ITEM-PILES.Notifications.ItemTransferred\", {\r\n\t\t\t\t\t\tsource_actor_name: dropData.source.name, target_actor_name: dropData.target.name, item_name: item.name\r\n\t\t\t\t\t}));\r\n\t\t\t\t\tHooks.callAll(CONSTANTS.HOOKS.ITEM.GIVE, dropData.source, dropData.target, dropData.itemData, game.user.id);\r\n\t\t\t\t\treturn this._transferItems(sourceUuid, targetUuid, [dropData.itemData.item], game.user.id)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn ItemPileSocket.executeForUsers(ItemPileSocket.HANDLERS.GIVE_ITEMS, [user ? user.id : gms[0]], {\r\n\t\t\t\tuserId: game.user.id, sourceUuid, targetUuid, itemData: dropData.itemData\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tstatic async _dropItem(dropData) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(dropData.source);\r\n\t\tconst targetActor = Utilities.getActor(dropData.target);\r\n\t\tif (sourceActor && targetActor && sourceActor === targetActor) return;\r\n\r\n\t\tif (dropData.target && PileUtilities.isItemPileMerchant(dropData.target)) return;\r\n\r\n\t\tconst validItem = await PileUtilities.checkItemType(dropData.target, dropData.itemData.item);\r\n\t\tif (!validItem) return;\r\n\t\tdropData.itemData.item = validItem;\r\n\r\n\t\tif (dropData.target && !dropData.position && !game.user.isGM) {\r\n\r\n\t\t\tif (!(dropData.target instanceof Actor && dropData.source instanceof Actor)) {\r\n\r\n\t\t\t\tconst sourceToken = canvas.tokens.placeables.find(token => token.actor === dropData.source);\r\n\r\n\t\t\t\tif (sourceToken) {\r\n\r\n\t\t\t\t\tconst distance = Math.floor(Utilities.distance_between_rect(sourceToken, dropData.target.object) / canvas.grid.size) + 1\r\n\r\n\t\t\t\t\tconst pileData = PileUtilities.getActorFlagData(dropData.target);\r\n\r\n\t\t\t\t\tconst maxDistance = pileData?.distance ? pileData?.distance : Infinity;\r\n\r\n\t\t\t\t\tif (distance > maxDistance) {\r\n\t\t\t\t\t\tHelpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Errors.PileTooFar\"), true);\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (game.itempiles.API.isItemPileLocked(dropData.target)) {\r\n\t\t\t\tHelpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Errors.PileLocked\"), true);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (PileUtilities.canItemStack(dropData.itemData.item, targetActor)) {\r\n\t\t\tif (hotkeyActionState.forceDropOneItem) {\r\n\r\n\t\t\t\tUtilities.setItemQuantity(dropData.itemData.item, 1);\r\n\t\t\t\tdropData.itemData.quantity = 1;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlet quantity = Utilities.getItemQuantity(dropData.itemData.item) ?? 1;\r\n\r\n\t\t\t\tif (!dropData.skipCheck) {\r\n\t\t\t\t\tconst item = await Item.implementation.create(dropData.itemData.item, { temporary: true });\r\n\t\t\t\t\tquantity = await DropItemDialog.show(item, dropData.target, { unlimitedQuantity: !dropData.source && game.user.isGM });\r\n\t\t\t\t\tif (!quantity) return;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tUtilities.setItemQuantity(dropData.itemData.item, Number(quantity));\r\n\t\t\t\tdropData.itemData.quantity = Number(quantity);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ITEM.PRE_DROP, dropData.source, dropData.target, dropData.position, dropData.itemData);\r\n\t\tif (hookResult === false) return;\r\n\r\n\t\treturn ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.DROP_ITEMS, {\r\n\t\t\tuserId: game.user.id,\r\n\t\t\tsceneId: canvas?.scene?.id ?? \"\",\r\n\t\t\tsourceUuid: Utilities.getUuid(dropData.source),\r\n\t\t\ttargetUuid: Utilities.getUuid(dropData.target),\r\n\t\t\tposition: dropData.position,\r\n\t\t\televation: dropData.elevation,\r\n\t\t\titemData: dropData.itemData\r\n\t\t});\r\n\r\n\t}\r\n\r\n\tstatic async _giveItems({ userId, sourceUuid, targetUuid, itemData } = {}) {\r\n\r\n\t\tconst sourceActor = Utilities.getActor(sourceUuid);\r\n\t\tconst targetActor = Utilities.getActor(targetUuid);\r\n\r\n\t\tconst item = await Item.implementation.create(itemData.item, { temporary: true });\r\n\r\n\t\tconst accepted = await TJSDialog.confirm({\r\n\t\t\ttitle: \"Item Piles - \" + game.i18n.localize(\"ITEM-PILES.Dialogs.ReceiveItem.Title\"), content: {\r\n\t\t\t\tclass: GiveItemsShell, props: {\r\n\t\t\t\t\tsourceActor, targetActor, quantity: itemData.quantity, item\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif (accepted) {\r\n\t\t\tawait PrivateAPI._addItems(targetUuid, [itemData], game.user.id);\r\n\t\t}\r\n\r\n\t\treturn ItemPileSocket.executeForUsers(ItemPileSocket.HANDLERS.GIVE_ITEMS_RESPONSE, [userId], {\r\n\t\t\tuserId: game.user.id, accepted, sourceUuid, targetUuid, itemData\r\n\t\t});\r\n\r\n\t}\r\n\r\n\tstatic async _giveItemsResponse({ userId, accepted, sourceUuid, targetUuid, itemData } = {}) {\r\n\t\tconst user = game.users.get(userId);\r\n\t\tif (accepted) {\r\n\t\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.ITEM.GIVE, sourceUuid, targetUuid, itemData, game.user.id, userId)\r\n\t\t\tawait PrivateAPI._removeItems(sourceUuid, [itemData], game.user.id);\r\n\t\t\treturn Helpers.custom_notify(game.i18n.format(\"ITEM-PILES.Notifications.GiveItemAccepted\", { user_name: user.name }));\r\n\t\t}\r\n\t\treturn Helpers.custom_warning(game.i18n.format(\"ITEM-PILES.Warnings.GiveItemDeclined\", { user_name: user.name }), true);\r\n\t}\r\n\r\n\tstatic async _itemPileClicked(pileDocument) {\r\n\r\n\t\tif (!PileUtilities.isValidItemPile(pileDocument)) return;\r\n\r\n\t\tconst pileToken = pileDocument.object;\r\n\r\n\t\tif (!Helpers.isGMConnected()) {\r\n\t\t\tHelpers.custom_warning(`Item Piles requires a GM to be connected for players to be able to loot item piles.`, true)\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tHelpers.debug(`Clicked: ${pileDocument.uuid}`);\r\n\r\n\t\tconst pileData = PileUtilities.getActorFlagData(pileDocument);\r\n\r\n\t\tconst maxDistance = pileData.distance ? pileData.distance : Infinity;\r\n\r\n\t\tlet validTokens = [];\r\n\r\n\t\tlet playerToken = false;\r\n\t\tif (game.user.character) {\r\n\t\t\tplayerToken = canvas.tokens.placeables.find(token => token.actor === game.user.character && Utilities.tokens_close_enough(pileToken, token, maxDistance));\r\n\t\t}\r\n\r\n\t\tif (!playerToken && canvas.tokens.controlled.length > 0) {\r\n\t\t\tvalidTokens = [...canvas.tokens.controlled];\r\n\t\t\tvalidTokens = validTokens.filter(token => token.document !== pileDocument);\r\n\t\t} else if (game.user.character) {\r\n\t\t\tif (playerToken) {\r\n\t\t\t\tvalidTokens.push(playerToken);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!validTokens.length && !game.user.isGM) {\r\n\t\t\tvalidTokens.push(...canvas.tokens.placeables);\r\n\t\t\tif (_token) {\r\n\t\t\t\tvalidTokens.unshift(_token);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvalidTokens = validTokens.filter(token => token.owner && token.document !== pileDocument).filter(token => {\r\n\t\t\treturn Utilities.tokens_close_enough(pileToken, token, maxDistance) || game.user.isGM;\r\n\t\t});\r\n\r\n\t\tlet interactingActor;\r\n\r\n\t\tif (!validTokens.length && !game.user.isGM) {\r\n\t\t\tif (maxDistance === Infinity) {\r\n\t\t\t\tinteractingActor = Utilities.getUserCharacter();\r\n\t\t\t}\r\n\t\t\tif (!interactingActor) {\r\n\t\t\t\tHelpers.custom_warning(game.i18n.localize(maxDistance === Infinity ? \"ITEM-PILES.Errors.NoTokenFound\" : \"ITEM-PILES.Errors.PileTooFar\"), true);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!interactingActor && validTokens.length) {\r\n\t\t\tif (validTokens.includes(_token)) {\r\n\t\t\t\tinteractingActor = _token.actor;\r\n\t\t\t} else if (validTokens.includes(playerToken)) {\r\n\t\t\t\tinteractingActor = playerToken.actor;\r\n\t\t\t} else {\r\n\t\t\t\tvalidTokens.sort((potentialTargetA, potentialTargetB) => {\r\n\t\t\t\t\treturn Utilities.grids_between_tokens(pileToken, potentialTargetA) - Utilities.grids_between_tokens(pileToken, potentialTargetB);\r\n\t\t\t\t});\r\n\t\t\t\tinteractingActor = validTokens[0].actor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (PileUtilities.isItemPileContainer(pileDocument) && interactingActor) {\r\n\r\n\t\t\tif (pileData.locked && !game.user.isGM) {\r\n\t\t\t\tHelpers.debug(`Attempted to open locked item pile with UUID ${pileDocument.uuid}`);\r\n\t\t\t\treturn game.itempiles.API.rattleItemPile(pileDocument, interactingActor);\r\n\t\t\t}\r\n\r\n\t\t\tif (pileData.closed) {\r\n\t\t\t\tHelpers.debug(`Opened item pile with UUID ${pileDocument.uuid}`);\r\n\t\t\t\tawait game.itempiles.API.openItemPile(pileDocument, interactingActor);\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_CLICK, pileDocument, interactingActor);\r\n\t\tif (hookResult === false) return;\r\n\r\n\t\treturn this._renderItemPileInterface(pileDocument.uuid, { inspectingTargetUuid: interactingActor?.uuid });\r\n\r\n\t}\r\n\r\n\tstatic async _splitItemPileContents(itemPileUuid, actorUuids, userId, instigator) {\r\n\r\n\t\tconst itemPileActor = Utilities.getActor(itemPileUuid);\r\n\r\n\t\tconst items = PileUtilities.getActorItems(itemPileActor);\r\n\t\tconst currencies = PileUtilities.getActorCurrencies(itemPileActor);\r\n\r\n\t\tconst pileData = PileUtilities.getActorFlagData(itemPileActor);\r\n\t\tconst shareData = SharingUtilities.getItemPileSharingData(itemPileActor);\r\n\r\n\t\tconst tempPileTransaction = new Transaction(itemPileActor);\r\n\r\n\t\tconst numPlayers = actorUuids.length;\r\n\r\n\t\tif (pileData.shareItemsEnabled) {\r\n\t\t\tconst itemsToRemove = items.map(item => {\r\n\t\t\t\tconst itemData = item.toObject();\r\n\t\t\t\tconst quantity = Math.floor(Utilities.getItemQuantity(itemData) / numPlayers) * numPlayers;\r\n\t\t\t\treturn {\r\n\t\t\t\t\titem: itemData, quantity\r\n\t\t\t\t}\r\n\t\t\t}).filter(entry => entry.quantity);\r\n\t\t\tawait tempPileTransaction.appendItemChanges(itemsToRemove, { remove: true });\r\n\t\t}\r\n\r\n\t\tconst currencyItems = currencies.filter(entry => entry.type === \"item\").map(entry => {\r\n\t\t\tconst itemData = entry.item.toObject();\r\n\t\t\tconst quantity = Math.floor(Utilities.getItemQuantity(itemData) / numPlayers) * numPlayers;\r\n\t\t\treturn {\r\n\t\t\t\titem: itemData, quantity\r\n\t\t\t}\r\n\t\t}).filter(entry => entry.quantity);\r\n\t\tawait tempPileTransaction.appendItemChanges(currencyItems, { remove: true, type: \"currency\" });\r\n\r\n\t\tconst attributes = currencies.filter(entry => entry.type === \"attribute\").map(attribute => {\r\n\t\t\treturn {\r\n\t\t\t\t...attribute, quantity: Math.floor(attribute.quantity / numPlayers) * numPlayers\r\n\t\t\t}\r\n\t\t});\r\n\t\tawait tempPileTransaction.appendActorChanges(attributes, { remove: true, type: \"currency\" });\r\n\r\n\t\tconst preparedData = tempPileTransaction.prepare();\r\n\r\n\t\tconst transactionMap = actorUuids.map(uuid => {\r\n\t\t\treturn [uuid, new Transaction(Utilities.getActor(uuid))];\r\n\t\t});\r\n\r\n\t\tfor (const [uuid, transaction] of transactionMap) {\r\n\r\n\t\t\tif (pileData.shareItemsEnabled) {\r\n\t\t\t\tawait transaction.appendItemChanges(deepClone(preparedData).itemDeltas.filter(delta => delta.type === \"item\").map(delta => {\r\n\t\t\t\t\tdelta.quantity = SharingUtilities.getItemSharesLeftForActor(itemPileActor, delta.item, transaction.actor, {\r\n\t\t\t\t\t\tplayers: numPlayers, shareData: shareData, floor: true\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn delta;\r\n\t\t\t\t}));\r\n\t\t\t}\r\n\r\n\t\t\tif (pileData.shareCurrenciesEnabled || pileData.splitAllEnabled) {\r\n\t\t\t\tawait transaction.appendItemChanges(deepClone(preparedData).itemDeltas.filter(delta => delta.type === \"currency\").map(delta => {\r\n\t\t\t\t\tdelta.quantity = SharingUtilities.getItemSharesLeftForActor(itemPileActor, delta.item, transaction.actor, {\r\n\t\t\t\t\t\tplayers: numPlayers, shareData: shareData, floor: true\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn delta;\r\n\t\t\t\t}), { type: \"currency\" });\r\n\r\n\t\t\t\tawait transaction.appendActorChanges(Object.entries(deepClone(preparedData).attributeDeltas).map(entry => {\r\n\t\t\t\t\tlet [path] = entry;\r\n\t\t\t\t\tconst quantity = SharingUtilities.getAttributeSharesLeftForActor(itemPileActor, path, transaction.actor, {\r\n\t\t\t\t\t\tplayers: numPlayers, shareData: shareData, floor: true\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn { path, quantity };\r\n\t\t\t\t}));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst actorPreparedData = Object.fromEntries(transactionMap.map(entry => [entry[0], entry[1].prepare()]));\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_SPLIT_INVENTORY, itemPileActor, preparedData, actorPreparedData, userId, instigator);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tconst pileDeltas = await tempPileTransaction.commit();\r\n\t\tconst actorDeltas = {};\r\n\t\tfor (const [uuid, transaction] of transactionMap) {\r\n\t\t\tactorDeltas[uuid] = await transaction.commit();\r\n\t\t}\r\n\r\n\t\tawait SharingUtilities.clearItemPileSharingData(itemPileActor);\r\n\r\n\t\tawait ItemPileSocket.callHook(CONSTANTS.HOOKS.PILE.SPLIT_INVENTORY, itemPileUuid, pileDeltas, actorDeltas, userId, instigator);\r\n\r\n\t\tawait this._executeItemPileMacro(itemPileUuid, {\r\n\t\t\taction: \"splitInventory\", source: itemPileUuid, target: actorUuids, transfers: {\r\n\t\t\t\tpileDeltas, actorDeltas\r\n\t\t\t}, userId: userId, instigator: instigator\r\n\t\t});\r\n\r\n\t\tconst shouldBeDeleted = PileUtilities.shouldItemPileBeDeleted(itemPileUuid);\r\n\t\tif (shouldBeDeleted) {\r\n\t\t\tawait this._deleteItemPile(itemPileUuid);\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tpileDeltas, actorDeltas\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tstatic async _updateTokenHud() {\r\n\t\tif (!canvas.tokens.hud.rendered) return;\r\n\t\treturn canvas.tokens.hud.render(true);\r\n\t}\r\n\r\n\tstatic async _renderItemPileInterface(targetUuid, {\r\n\t\tinspectingTargetUuid = false, useDefaultCharacter = false, remote = false\r\n\t} = {}) {\r\n\r\n\t\tconst target = Utilities.getActor(targetUuid);\r\n\r\n\t\tlet inspectingTarget;\r\n\t\tif (useDefaultCharacter) {\r\n\t\t\tinspectingTarget = Utilities.getUserCharacter();\r\n\t\t} else {\r\n\t\t\tinspectingTarget = inspectingTargetUuid ? fromUuidSync(inspectingTargetUuid) : false;\r\n\t\t}\r\n\r\n\t\tconst hookResult = Hooks.call(CONSTANTS.HOOKS.PRE_RENDER_INTERFACE, target, inspectingTarget)\r\n\t\tif (hookResult === false) return;\r\n\r\n\t\tif (PileUtilities.isItemPileVault(target)) {\r\n\t\t\treturn BankVaultApp.show(target, inspectingTarget)\r\n\t\t}\r\n\r\n\t\tif (PileUtilities.isItemPileMerchant(target)) {\r\n\t\t\treturn MerchantApp.show(target, inspectingTarget)\r\n\t\t}\r\n\r\n\t\treturn ItemPileInventoryApp.show(target, inspectingTarget, { remote });\r\n\r\n\t}\r\n\r\n\tstatic async _unrenderItemPileInterface(targetUuid, { remote = false } = {}) {\r\n\r\n\t\tconst target = Utilities.getActor(targetUuid);\r\n\r\n\t\treturn Promise.allSettled(Object.values(ui.windows).filter(app => {\r\n\t\t\treturn app.id.includes(`-${target.id}-`) || app?.actor === target || app?.merchant === target;\r\n\t\t}).map(app => app.close()));\r\n\r\n\t}\r\n\r\n\tstatic async _tradeItems(sellerUuid, buyerUuid, items, userId, { interactionId = false } = {}) {\r\n\r\n\t\tconst sellingActor = Utilities.getActor(sellerUuid);\r\n\t\tconst buyingActor = Utilities.getActor(buyerUuid);\r\n\r\n\t\tconst itemPrices = PileUtilities.getPaymentData({\r\n\t\t\tpurchaseData: items.map(data => {\r\n\t\t\t\treturn {\r\n\t\t\t\t\t...data, item: sellingActor.items.get(data.id)\r\n\t\t\t\t}\r\n\t\t\t}), seller: sellingActor, buyer: buyingActor\r\n\t\t});\r\n\r\n\t\tconst preCalcHookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ITEM.PRE_CALC_TRADE, sellingActor, buyingActor, itemPrices, userId, interactionId);\r\n\t\tif (preCalcHookResult === false) return false;\r\n\r\n\t\tconst sellerTransaction = new Transaction(sellingActor);\r\n\t\tconst sellerFlagData = PileUtilities.getActorFlagData(sellerTransaction);\r\n\t\tconst sellerIsMerchant = PileUtilities.isItemPileMerchant(sellingActor, sellerFlagData);\r\n\t\tconst sellerInfiniteQuantity = sellerIsMerchant && sellerFlagData.infiniteQuantity;\r\n\t\tconst sellerInfiniteCurrencies = sellerIsMerchant && sellerFlagData.infiniteCurrencies;\r\n\t\tconst sellerKeepZeroQuantity = sellerIsMerchant && sellerFlagData.keepZeroQuantity;\r\n\r\n\t\tfor (const payment of itemPrices.sellerReceive) {\r\n\t\t\tif (!payment.quantity) continue;\r\n\t\t\tif (payment.type === \"attribute\") {\r\n\t\t\t\tawait sellerTransaction.appendActorChanges([{\r\n\t\t\t\t\tpath: payment.data.path, quantity: payment.quantity\r\n\t\t\t\t}], { type: payment.isCurrency ? \"currency\" : payment.type });\r\n\t\t\t} else {\r\n\t\t\t\tawait sellerTransaction.appendItemChanges([{\r\n\t\t\t\t\titem: payment.data.item, quantity: payment.quantity\r\n\t\t\t\t}], { type: payment.isCurrency ? \"currency\" : payment.type });\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (const entry of itemPrices.buyerReceive) {\r\n\t\t\tif (!entry.quantity) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tconst onlyDelta = (sellerInfiniteCurrencies && entry.isCurrency) || (sellerInfiniteQuantity && !entry.isCurrency);\r\n\t\t\tif (entry.type === \"attribute\") {\r\n\t\t\t\tawait sellerTransaction.appendActorChanges([{\r\n\t\t\t\t\tpath: entry.data.path, quantity: entry.quantity\r\n\t\t\t\t}], {\r\n\t\t\t\t\tremove: true, type: entry.isCurrency ? \"currency\" : entry.type, onlyDelta\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tconst itemFlagData = PileUtilities.getItemFlagData(entry.item);\r\n\t\t\t\tconst itemInfiniteQuantity = {\r\n\t\t\t\t\t\"default\": sellerFlagData?.infiniteQuantity ?? false, \"yes\": true, \"no\": false\r\n\t\t\t\t}[itemFlagData.infiniteQuantity ?? \"default\"];\r\n\t\t\t\tif (sellerIsMerchant && itemInfiniteQuantity) continue;\r\n\t\t\t\tawait sellerTransaction.appendItemChanges([{\r\n\t\t\t\t\titem: entry.item, quantity: entry.quantity\r\n\t\t\t\t}], {\r\n\t\t\t\t\tremove: true,\r\n\t\t\t\t\ttype: entry.isCurrency ? \"currency\" : entry.type,\r\n\t\t\t\t\tkeepIfZero: itemFlagData.isService || sellerKeepZeroQuantity || itemFlagData.keepZeroQuantity,\r\n\t\t\t\t\tonlyDelta\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst buyerTransaction = new Transaction(buyingActor);\r\n\t\tconst buyerFlagData = PileUtilities.getActorFlagData(buyingActor);\r\n\t\tconst buyerIsMerchant = PileUtilities.isItemPileMerchant(buyingActor, buyerFlagData);\r\n\t\tconst buyerInfiniteCurrencies = buyerIsMerchant && buyerFlagData.infiniteCurrencies;\r\n\t\tconst buyerInfiniteQuantity = buyerIsMerchant && buyerFlagData.infiniteQuantity;\r\n\t\tconst buyerHidesNewItems = buyerIsMerchant && buyerFlagData.hideNewItems;\r\n\r\n\t\tfor (const price of itemPrices.finalPrices) {\r\n\t\t\tif (!price.quantity) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tconst onlyDelta = (buyerInfiniteCurrencies && price.isCurrency) || (buyerInfiniteQuantity && !price.isCurrency);\r\n\t\t\tif (price.type === \"attribute\") {\r\n\t\t\t\tawait buyerTransaction.appendActorChanges([{\r\n\t\t\t\t\tpath: price.data.path, quantity: price.quantity\r\n\t\t\t\t}], { remove: true, type: price.isCurrency ? \"currency\" : price.type, onlyDelta });\r\n\t\t\t} else {\r\n\t\t\t\tawait buyerTransaction.appendItemChanges([{\r\n\t\t\t\t\titem: price.data.item, quantity: price.quantity\r\n\t\t\t\t}], { remove: true, type: price.isCurrency ? \"currency\" : price.type, onlyDelta });\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (const entry of itemPrices.buyerReceive) {\r\n\t\t\tif (!entry.quantity) continue;\r\n\t\t\tif (entry.type === \"attribute\") {\r\n\t\t\t\tawait buyerTransaction.appendActorChanges([{\r\n\t\t\t\t\tpath: entry.data.path, quantity: entry.quantity\r\n\t\t\t\t}], { type: entry.type });\r\n\t\t\t} else {\r\n\t\t\t\tconst itemFlagData = PileUtilities.getItemFlagData(entry.item);\r\n\t\t\t\tif (itemFlagData.isService) continue;\r\n\t\t\t\tconst item = entry.item.toObject();\r\n\t\t\t\tif (buyerHidesNewItems) {\r\n\t\t\t\t\tsetProperty(item, CONSTANTS.FLAGS.ITEM + '.hidden', true);\r\n\t\t\t\t}\r\n\t\t\t\tawait buyerTransaction.appendItemChanges([{\r\n\t\t\t\t\titem: item, quantity: entry.quantity\r\n\t\t\t\t}], { type: entry.type });\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (const change of itemPrices.buyerChange) {\r\n\t\t\tif (!change.quantity) continue;\r\n\t\t\tif (change.type === \"attribute\") {\r\n\t\t\t\tawait buyerTransaction.appendActorChanges([{\r\n\t\t\t\t\tpath: change.data.path, quantity: change.quantity\r\n\t\t\t\t}], { type: \"currency\" });\r\n\t\t\t} else {\r\n\t\t\t\tawait buyerTransaction.appendItemChanges([{\r\n\t\t\t\t\titem: change.data.item, quantity: change.quantity\r\n\t\t\t\t}], { type: \"currency\" });\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst sellerUpdates = sellerTransaction.prepare();\r\n\t\tconst buyerUpdates = buyerTransaction.prepare();\r\n\r\n\t\tconst hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.ITEM.PRE_TRADE, sellingActor, sellerUpdates, buyingActor, buyerUpdates, userId, interactionId);\r\n\t\tif (hookResult === false) return false;\r\n\r\n\t\tconst sellerTransactionData = await sellerTransaction.commit();\r\n\t\tconst buyerTransactionData = await buyerTransaction.commit();\r\n\r\n\t\tconst itemPileActorUuid = sellerIsMerchant ? sellerUuid : buyerUuid;\r\n\r\n\t\tawait this._executeItemPileMacro(itemPileActorUuid, {\r\n\t\t\taction: \"tradeItems\",\r\n\t\t\tsource: sellerUuid,\r\n\t\t\ttarget: buyerUuid,\r\n\t\t\tsourceIsMerchant: sellerIsMerchant,\r\n\t\t\tsourceItems: sellerTransactionData.itemDeltas,\r\n\t\t\tsourceAttributes: sellerTransactionData.attributeDeltas,\r\n\t\t\ttargetItems: buyerTransactionData.itemDeltas,\r\n\t\t\ttargetAttributes: buyerTransactionData.attributeDeltas,\r\n\t\t\tprices: itemPrices,\r\n\t\t\tuserId: userId,\r\n\t\t\tinteractionId: interactionId\r\n\t\t});\r\n\r\n\t\tif (sellerIsMerchant) {\r\n\t\t\tfor (let entry of itemPrices.buyerReceive) {\r\n\t\t\t\tconst itemFlagData = PileUtilities.getItemFlagData(entry.item);\r\n\t\t\t\tif (!itemFlagData.macro) continue;\r\n\t\t\t\tawait Utilities.runMacro(itemFlagData.macro, {\r\n\t\t\t\t\tseller: sellingActor, buyer: buyingActor, item: entry.item, quantity: entry.quantity, userId\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tawait ItemPileSocket.executeForEveryone(ItemPileSocket.HANDLERS.CALL_HOOK, CONSTANTS.HOOKS.ITEM.TRADE, sellerUuid, buyerUuid, itemPrices, userId, interactionId);\r\n\r\n\t\treturn {\r\n\t\t\titemDeltas: buyerTransactionData.itemDeltas, attributeDeltas: buyerTransactionData.attributeDeltas, itemPrices\r\n\t\t};\r\n\r\n\t}\r\n\r\n\tstatic async _rollItemTable({\r\n\t\ttable = \"\",\r\n\t\ttimesToRoll = \"1\",\r\n\t\tresetTable = true,\r\n\t\tnormalizeTable = false,\r\n\t\tdisplayChat = false,\r\n\t\trollData = {},\r\n\t\tcustomCategory = false,\r\n\t\ttargetActor = false,\r\n\t\tremoveExistingActorItems = false,\r\n\t\tuserId = false,\r\n\t} = {}) {\r\n\r\n\t\tlet items = await PileUtilities.rollTable({\r\n\t\t\ttableUuid: table,\r\n\t\t\tformula: timesToRoll,\r\n\t\t\tnormalize: normalizeTable,\r\n\t\t\tresetTable,\r\n\t\t\tdisplayChat,\r\n\t\t\trollData,\r\n\t\t\tcustomCategory\r\n\t\t});\r\n\r\n\t\tif (targetActor) {\r\n\t\t\tconst itemsToAdd = items.map((item) => {\r\n\t\t\t\tconst actualItem = item.item.toObject();\r\n\t\t\t\treturn Utilities.setItemQuantity(actualItem, item.quantity);\r\n\t\t\t});\r\n\t\t\titems = await this._addItems(targetActor, itemsToAdd, userId, { removeExistingActorItems });\r\n\t\t}\r\n\r\n\t\treturn items;\r\n\r\n\t}\r\n\r\n}\r\n","import CONSTANTS from \"./constants/constants.js\";\r\nimport * as Utilities from \"./helpers/utilities.js\";\r\nimport PrivateAPI from \"./API/private-api.js\";\r\nimport * as Helpers from \"./helpers/helpers.js\";\r\n\r\nconst HOTKEYS = {\r\n FORCE_DEFAULT_SHEET: \"force-open-item-pile-inventory\",\r\n DROP: \"force-drop-item\",\r\n DROP_ONE: \"force-drop-one-item\"\r\n}\r\n\r\nexport const hotkeyActionState = {\r\n get openPileInventory() {\r\n const down = game.keybindings.get(CONSTANTS.MODULE_NAME, HOTKEYS.FORCE_DEFAULT_SHEET).some(keybind => {\r\n return window.keyboard.downKeys.has(keybind?.key);\r\n });\r\n return (\r\n (!down && !game.settings.get(CONSTANTS.MODULE_NAME, \"invertSheetOpen\"))\r\n ||\r\n (down && game.settings.get(CONSTANTS.MODULE_NAME, \"invertSheetOpen\"))\r\n );\r\n },\r\n\r\n get forceDropItem() {\r\n return game.keybindings.get(CONSTANTS.MODULE_NAME, HOTKEYS.DROP).some(key => {\r\n return window.keyboard.downKeys.has(key);\r\n });\r\n },\r\n\r\n get forceDropOneItem() {\r\n return game.keybindings.get(CONSTANTS.MODULE_NAME, HOTKEYS.DROP).some(key => {\r\n return window.keyboard.downKeys.has(key);\r\n });\r\n }\r\n}\r\n\r\nexport function registerHotkeysPre() {\r\n\r\n game.keybindings.register(CONSTANTS.MODULE_NAME, HOTKEYS.FORCE_DEFAULT_SHEET, {\r\n name: \"Force open inventory modifier\",\r\n editable: [\r\n { key: \"ControlLeft\" },\r\n ]\r\n });\r\n\r\n game.keybindings.register(CONSTANTS.MODULE_NAME, HOTKEYS.DROP, {\r\n name: \"Force drop item (GM only) modifier\",\r\n editable: [\r\n { key: \"ShiftLeft\" },\r\n ]\r\n });\r\n\r\n game.keybindings.register(CONSTANTS.MODULE_NAME, HOTKEYS.DROP_ONE, {\r\n name: \"Force drop one item modifier\",\r\n editable: [\r\n { key: \"AltLeft\" },\r\n ]\r\n });\r\n\r\n}\r\n\r\nexport function registerHotkeysPost() {\r\n\r\n if (!game.user.isGM) {\r\n let clicked = false;\r\n window.addEventListener(\"mousedown\", (event) => {\r\n if (!canvas.ready) return;\r\n if (!(canvas.activeLayer instanceof TokenLayer)) return;\r\n if (game.activeTool !== \"select\") return;\r\n const hover = document.elementFromPoint(event.clientX, event.clientY);\r\n if (!hover || (hover.id !== \"board\")) return;\r\n if (event.button !== 0) return;\r\n\r\n const pos = Helpers.getCanvasMouse().getLocalPosition(canvas.app.stage);\r\n const tokens = Utilities.getTokensAtLocation(pos)\r\n .filter(token => {\r\n const canView = token._canView(game.user);\r\n const canSee = token.visible || game.user.isGM;\r\n return !canView && canSee;\r\n });\r\n if (!tokens.length) return;\r\n tokens.sort((a, b) => b.zIndex - a.zIndex);\r\n const token = Utilities.getDocument(tokens[0]);\r\n\r\n if (clicked === token) {\r\n clicked = false;\r\n return PrivateAPI._itemPileClicked(token);\r\n }\r\n\r\n clicked = token;\r\n setTimeout(() => {\r\n clicked = false;\r\n }, 500);\r\n });\r\n }\r\n}\r\n","const PACK_ID = `world.item-piles-item-backup-do-not-delete`;\r\n\r\nconst COMPENDIUM_CACHE = {};\r\n\r\nexport async function initializeCompendiumCache() {\r\n\r\n Hooks.on(\"updateItem\", async (item) => {\r\n if (!item?.pack || !item?.pack.startsWith(PACK_ID)) return;\r\n COMPENDIUM_CACHE[item.uuid] = item.toObject();\r\n });\r\n\r\n const pack = game.packs.get(PACK_ID);\r\n if (pack) {\r\n for (const index of pack.index) {\r\n const item = await pack.getDocument(index._id);\r\n COMPENDIUM_CACHE[item.uuid] = item.toObject();\r\n }\r\n }\r\n\r\n}\r\n\r\nexport async function getItemCompendium() {\r\n return game.packs.get(PACK_ID) || await CompendiumCollection.createCompendium({\r\n label: `Item Piles: Item Backup (DO NOT DELETE)`,\r\n id: PACK_ID,\r\n private: true,\r\n type: \"Item\"\r\n });\r\n}\r\n\r\nexport async function addItemsToCompendium(items) {\r\n return Item.createDocuments(items, { pack: PACK_ID });\r\n}\r\n\r\nexport async function findSimilarItemInCompendium(itemToFind) {\r\n const pack = await getItemCompendium();\r\n const item = game.packs.get(PACK_ID).index.find(compendiumItem => {\r\n return compendiumItem.name === itemToFind.name\r\n && compendiumItem.type === itemToFind.type\r\n && compendiumItem.img === itemToFind.img;\r\n });\r\n return (item?._id ? pack.getDocument(item._id) : false);\r\n}\r\n\r\nexport function getItemFromCache(uuid) {\r\n return COMPENDIUM_CACHE[uuid];\r\n}\r\n\r\nexport async function findOrCreateItemInCompendium(itemData) {\r\n let compendiumItem = await findSimilarItemInCompendium(itemData);\r\n if (!compendiumItem) {\r\n compendiumItem = (await addItemsToCompendium([itemData]))[0];\r\n }\r\n COMPENDIUM_CACHE[compendiumItem.uuid] = itemData;\r\n return compendiumItem;\r\n}\r\n","import CONSTANTS from \"../constants/constants.js\";\nimport { SYSTEMS } from \"../systems.js\";\nimport SETTINGS from \"../constants/settings.js\";\nimport { cachedActorCurrencies, cachedCurrencyList, cachedFilterList } from \"./caches.js\";\nimport { hotkeyActionState } from \"../hotkeys.js\";\nimport * as Utilities from \"./utilities.js\"\nimport * as Helpers from \"./helpers.js\";\nimport * as CompendiumUtilities from \"./compendium-utilities.js\";\n\n\nfunction getFlagData(inDocument, flag, defaults, existing = false) {\n\tconst defaultFlags = foundry.utils.duplicate(defaults);\n\tconst flags = existing || (getProperty(inDocument, flag) ?? {});\n\tlet data = { ...flags };\n\tif (flag === CONSTANTS.FLAGS.PILE) {\n\t\tdata = migrateFlagData(inDocument, data);\n\t}\n\treturn foundry.utils.mergeObject(defaultFlags, data);\n}\n\nexport function migrateFlagData(document, data = false) {\n\n\tlet flags = data || getProperty(document, CONSTANTS.FLAGS.PILE);\n\n\tif (flags.type) {\n\t\treturn flags;\n\t}\n\n\tif (flags.isMerchant) {\n\t\tflags.type = CONSTANTS.PILE_TYPES.MERCHANT;\n\t} else if (flags.isContainer) {\n\t\tflags.type = CONSTANTS.PILE_TYPES.CONTAINER;\n\t} else {\n\t\tflags.type = CONSTANTS.PILE_TYPES.PILE;\n\t}\n\n\treturn flags;\n\n}\n\nexport function canItemStack(item, targetActor) {\n\tconst itemData = item instanceof Item ? item.toObject() : item;\n\tconst unstackableType = Utilities.getItemTypesThatCanStack().has(itemData.type);\n\tif (!unstackableType || (targetActor && !isItemPileVault(targetActor))) return unstackableType;\n\tconst itemFlagData = getItemFlagData(itemData);\n\tconst actorFlagData = getActorFlagData(targetActor);\n\treturn {\n\t\t\"default\": actorFlagData.canStackItems,\n\t\t\"yes\": true,\n\t\t\"no\": false\n\t}[itemFlagData?.canStack ?? \"default\"] && !(actorFlagData.type === CONSTANTS.PILE_TYPES.VAULT && itemFlagData.vaultExpander);\n}\n\nexport function getItemFlagData(item, data = false) {\n\treturn getFlagData(Utilities.getDocument(item), CONSTANTS.FLAGS.ITEM, { ...CONSTANTS.ITEM_DEFAULTS }, data);\n}\n\nexport function getActorFlagData(target, data = false) {\n\tconst defaults = foundry.utils.mergeObject(\n\t\t{ ...CONSTANTS.PILE_DEFAULTS },\n\t\t{ ...(Helpers.getSetting(SETTINGS.PILE_DEFAULTS) ?? {}) }\n\t);\n\ttarget = Utilities.getActor(target);\n\tif (target?.token) {\n\t\ttarget = target.token;\n\t}\n\treturn getFlagData(target, CONSTANTS.FLAGS.PILE, defaults, data);\n}\n\nexport function isValidItemPile(target, data = false) {\n\tconst targetActor = Utilities.getActor(target);\n\tconst pileData = getActorFlagData(targetActor, data);\n\treturn targetActor && pileData?.enabled;\n}\n\nexport function isRegularItemPile(target, data = false) {\n\tconst targetActor = Utilities.getActor(target);\n\tconst pileData = getActorFlagData(targetActor, data);\n\treturn targetActor && pileData?.enabled && pileData?.type === CONSTANTS.PILE_TYPES.PILE;\n}\n\nexport function isItemPileContainer(target, data = false) {\n\tconst targetActor = Utilities.getActor(target);\n\tconst pileData = getActorFlagData(targetActor, data);\n\treturn pileData?.enabled && pileData?.type === CONSTANTS.PILE_TYPES.CONTAINER;\n}\n\nexport function isItemPileLootable(target, data = false) {\n\tconst targetActor = Utilities.getActor(target);\n\tconst pileData = getActorFlagData(targetActor, data);\n\treturn targetActor && pileData?.enabled && (pileData?.type === CONSTANTS.PILE_TYPES.PILE || pileData?.type === CONSTANTS.PILE_TYPES.CONTAINER);\n}\n\nexport function isItemPileVault(target, data = false) {\n\tconst targetActor = Utilities.getActor(target);\n\tconst pileData = getActorFlagData(targetActor, data);\n\treturn pileData?.enabled && pileData?.type === CONSTANTS.PILE_TYPES.VAULT;\n}\n\nexport function isItemPileMerchant(target, data = false) {\n\tconst targetActor = Utilities.getActor(target);\n\tconst pileData = getActorFlagData(targetActor, data);\n\treturn pileData?.enabled && pileData?.type === CONSTANTS.PILE_TYPES.MERCHANT;\n}\n\nexport function isItemPileClosed(target, data = false) {\n\tconst targetActor = Utilities.getActor(target);\n\tconst pileData = getActorFlagData(targetActor, data);\n\tif (!pileData?.enabled || pileData?.type !== CONSTANTS.PILE_TYPES.CONTAINER) return false;\n\treturn pileData.closed;\n}\n\nexport function isItemPileLocked(target, data = false) {\n\tconst targetActor = Utilities.getActor(target);\n\tconst pileData = getActorFlagData(targetActor, data);\n\tif (!pileData?.enabled || pileData?.type !== CONSTANTS.PILE_TYPES.CONTAINER) return false;\n\treturn pileData.locked;\n}\n\nexport function isItemPileEmpty(target) {\n\n\tconst targetActor = Utilities.getActor(target);\n\tif (!targetActor) return false;\n\n\tconst validItemPile = isValidItemPile(targetActor);\n\tif (!validItemPile) return false;\n\n\tconst hasNoItems = getActorItems(targetActor).length === 0;\n\tconst hasNoAttributes = getActorCurrencies(targetActor).length === 0;\n\n\treturn validItemPile && hasNoItems && hasNoAttributes;\n\n}\n\nexport function shouldItemPileBeDeleted(targetUuid) {\n\n\tconst target = Utilities.getToken(targetUuid);\n\n\tif (!(target instanceof Token)) return false;\n\n\tconst targetDocument = Utilities.getDocument(target);\n\n\tconst pileData = getActorFlagData(targetDocument);\n\n\tif (!isItemPileLootable(targetDocument, pileData) || !isItemPileEmpty(targetDocument)) {\n\t\treturn false;\n\t}\n\n\tif (typeof pileData?.deleteWhenEmpty === \"boolean\") {\n\t\treturn pileData?.deleteWhenEmpty;\n\t}\n\n\treturn {\n\t\t\"default\": Helpers.getSetting(\"deleteEmptyPiles\"), \"true\": true, \"false\": false\n\t}[pileData?.deleteWhenEmpty ?? \"default\"];\n\n}\n\nexport function getItemPileActors(filter = false) {\n\treturn Array.from(game.actors).filter((a) => {\n\t\treturn getProperty(a, CONSTANTS.FLAGS.PILE)?.enabled && (filter ? filter(a) : true);\n\t});\n}\n\nexport function getItemPileTokens(filter = false) {\n\n\tconst allTokensOnScenes = Array.from(game.scenes)\n\t\t.map(scene => ([\n\t\t\tscene.id,\n\t\t\tArray.from(scene.tokens).filter(t => {\n\t\t\t\treturn getProperty(t, CONSTANTS.FLAGS.PILE)?.enabled && !t.actorLink;\n\t\t\t})\n\t\t]))\n\t\t.filter(([_, tokens]) => tokens.length)\n\n\tconst validTokensOnScenes = allTokensOnScenes.map(([scene, tokens]) => [\n\t\tscene,\n\t\ttokens.filter((token) => {\n\t\t\treturn filter ? filter(token) : true;\n\t\t})\n\t]).filter(([_, tokens]) => tokens.length);\n\n\treturn { allTokensOnScenes, validTokensOnScenes };\n}\n\nexport function getActorItems(target, { itemFilters = false, getItemCurrencies = false } = {}) {\n\tconst actor = Utilities.getActor(target);\n\tconst actorItemFilters = itemFilters ? cleanItemFilters(itemFilters) : getActorItemFilters(actor);\n\tconst currencies = (actor\n\t\t? getActorCurrencies(actor, { getAll: true })\n\t\t: game.itempiles.API.CURRENCIES.concat(game.itempiles.API.SECONDARY_CURRENCIES))\n\t\t.map(entry => entry.id);\n\treturn actor.items.filter(item => (getItemCurrencies || currencies.indexOf(item.id) === -1) && !isItemInvalid(actor, item, actorItemFilters));\n}\n\n// Lots happening here, but in essence, it gets the actor's currencies, and creates an array of them\nexport function getActorCurrencies(target, {\n\tforActor = false,\n\tcurrencyList = false,\n\tgetAll = false,\n\tsecondary = true\n} = {}) {\n\tconst actor = Utilities.getActor(target);\n\tconst actorUuid = Utilities.getUuid(actor.uuid)\n\tconst actorItems = actor ? Array.from(actor.items) : [];\n\tconst cached = cachedActorCurrencies.get(actorUuid)\n\tcurrencyList = cached ? false : currencyList || getCurrencyList(forActor || actor);\n\t// Loop through each currency and match it against the actor's data\n\tlet currencies = cached || (currencyList.map((currency, index) => {\n\t\tif (currency.type === \"attribute\" || !currency.type) {\n\t\t\tconst path = currency?.data?.path ?? currency?.path;\n\t\t\treturn {\n\t\t\t\t...currency,\n\t\t\t\tquantity: 0,\n\t\t\t\tpath: path,\n\t\t\t\tid: path,\n\t\t\t\tindex\n\t\t\t}\n\t\t}\n\t\tconst item = Utilities.findSimilarItem(actorItems, currency.data.item);\n\t\t// If the item exists on the actor, use the item's ID, so that we can match it against the actual item on the actor\n\t\tcurrency.data.item._id = item?.id ?? currency.data.item._id;\n\t\treturn {\n\t\t\t...currency,\n\t\t\tquantity: 0,\n\t\t\tid: item?.id || null,\n\t\t\titem,\n\t\t\tindex\n\t\t}\n\t}))\n\n\tcachedActorCurrencies.set(actorUuid, currencies);\n\n\tcurrencies = currencies.map(currency => {\n\t\tcurrency.quantity = currency.type === \"attribute\"\n\t\t\t? getProperty(actor, currency.path)\n\t\t\t: Utilities.getItemQuantity(currency.item);\n\t\treturn currency;\n\t});\n\n\tif (!getAll) {\n\t\tcurrencies = currencies.filter(currency => currency.quantity > 0);\n\t}\n\n\tif (!secondary) {\n\t\tcurrencies = currencies.filter(currency => !currency.secondary);\n\t}\n\n\treturn currencies;\n}\n\nexport function getActorPrimaryCurrency(target) {\n\tconst actor = Utilities.getActor(target);\n\treturn getActorCurrencies(actor, { getAll: true }).find(currency => currency.primary);\n}\n\nexport function getCurrencyList(target = false, pileData = false) {\n\tlet targetUuid = false;\n\tif (target) {\n\t\ttargetUuid = Utilities.getUuid(target);\n\t\tif (cachedCurrencyList.has(targetUuid)) {\n\t\t\treturn cachedCurrencyList.get(targetUuid)\n\t\t}\n\t\tconst targetActor = Utilities.getActor(target);\n\t\tpileData = getActorFlagData(targetActor, pileData);\n\t}\n\n\tconst primaryCurrencies = (pileData?.overrideCurrencies || game.itempiles.API.CURRENCIES);\n\tconst secondaryCurrencies = (pileData?.overrideSecondaryCurrencies || game.itempiles.API.SECONDARY_CURRENCIES).map(currency => {\n\t\tcurrency.secondary = true;\n\t\treturn currency;\n\t});\n\n\tconst currencies = primaryCurrencies.concat(secondaryCurrencies);\n\n\tconst currencyList = currencies.map(currency => {\n\t\tcurrency.name = game.i18n.localize(currency.name);\n\t\treturn currency;\n\t});\n\tif (target) {\n\t\tcachedCurrencyList.set(targetUuid, currencyList);\n\t}\n\treturn currencyList;\n}\n\nexport function getActorItemFilters(target, pileData = false) {\n\tif (!target) return cleanItemFilters(game.itempiles.API.ITEM_FILTERS);\n\tconst targetUuid = Utilities.getUuid(target);\n\tif (cachedFilterList.has(targetUuid)) {\n\t\treturn cachedFilterList.get(targetUuid)\n\t}\n\tconst targetActor = Utilities.getActor(target);\n\tpileData = getActorFlagData(targetActor, pileData);\n\tconst itemFilters = isValidItemPile(targetActor, pileData) && pileData?.overrideItemFilters\n\t\t? cleanItemFilters(pileData.overrideItemFilters)\n\t\t: cleanItemFilters(game.itempiles.API.ITEM_FILTERS);\n\tcachedFilterList.set(targetUuid, itemFilters);\n\treturn itemFilters;\n}\n\nexport function cleanItemFilters(itemFilters) {\n\treturn itemFilters ? foundry.utils.duplicate(itemFilters).map(filter => {\n\t\tfilter.path = filter.path.trim();\n\t\tfilter.filters = (Array.isArray(filter.filters) ? filter.filters : filter.filters.split(','))\n\t\t\t.map(string => {\n\t\t\t\tif (typeof string === \"boolean\") return string;\n\t\t\t\tconst str = string.trim();\n\t\t\t\tif (str.toLowerCase() === \"true\" || str.toLowerCase() === \"false\") {\n\t\t\t\t\treturn str.toLowerCase() === \"true\";\n\t\t\t\t}\n\t\t\t\treturn str;\n\t\t\t});\n\t\tfilter.filters = new Set(filter.filters)\n\t\treturn filter;\n\t}) : [];\n}\n\nexport function isItemInvalid(targetActor, item, itemFilters = false) {\n\tconst pileItemFilters = itemFilters ? itemFilters : getActorItemFilters(targetActor)\n\tconst itemData = item instanceof Item ? item.toObject() : item;\n\tfor (const filter of pileItemFilters) {\n\t\tif (!hasProperty(itemData, filter.path)) continue;\n\t\tconst attributeValue = getProperty(itemData, filter.path);\n\t\tif (filter.filters.has(attributeValue)) {\n\t\t\treturn attributeValue;\n\t\t}\n\t}\n\treturn false;\n}\n\nexport async function checkItemType(targetActor, item, {\n\terrorText = \"ITEM-PILES.Errors.DisallowedItemDrop\",\n\twarningTitle = \"ITEM-PILES.Dialogs.TypeWarning.Title\",\n\twarningContent = \"ITEM-PILES.Dialogs.TypeWarning.DropContent\",\n\trunTransformer = true\n} = {}) {\n\n\tconst disallowedType = isItemInvalid(targetActor, item);\n\tif (disallowedType) {\n\t\tif (!game.user.isGM) {\n\t\t\treturn Helpers.custom_warning(game.i18n.format(errorText, { type: disallowedType }), true)\n\t\t}\n\n\t\tif (SYSTEMS.DATA.ITEM_TRANSFORMER && runTransformer) {\n\t\t\titem = await SYSTEMS.DATA.ITEM_TRANSFORMER(item);\n\t\t}\n\n\t\tconst newDisallowedType = isItemInvalid(targetActor, item);\n\n\t\tif (newDisallowedType && !hotkeyActionState.forceDropItem) {\n\t\t\tconst force = await Dialog.confirm({\n\t\t\t\ttitle: game.i18n.localize(warningTitle),\n\t\t\t\tcontent: `<p class=\"item-piles-dialog\">${game.i18n.format(warningContent, { type: newDisallowedType })}</p>`,\n\t\t\t\tdefaultYes: false\n\t\t\t});\n\t\t\tif (!force) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (SYSTEMS.DATA.ITEM_TRANSFORMER && runTransformer) {\n\t\t\titem = await SYSTEMS.DATA.ITEM_TRANSFORMER(item);\n\t\t}\n\t}\n\n\treturn item;\n\n}\n\nexport function isItemCurrency(item, { target = false, actorCurrencies = false } = {}) {\n\tconst currencies = (actorCurrencies || getActorCurrencies(item.parent || false, {\n\t\tforActor: target,\n\t\tgetAll: true\n\t}))\n\t\t.filter(currency => currency.type === \"item\")\n\t\t.map(item => item.data.item);\n\n\treturn !!Utilities.findSimilarItem(currencies, item);\n}\n\nexport function getItemCurrencyData(item, { target = false, actorCurrencies = false }) {\n\treturn (actorCurrencies || getActorCurrencies(item?.parent || false, {\n\t\tforActor: target,\n\t\tgetAll: true,\n\t\tcombine: true\n\t}))\n\t\t.filter(currency => currency.type === \"item\")\n\t\t.find(currency => {\n\t\t\treturn item.name === currency.data.item.name && item.type === currency.data.item.type;\n\t\t})\n}\n\nexport function getItemPileTokenImage(token, {\n\tdata = false,\n\titems = false,\n\tcurrencies = false\n} = {}, overrideImage = null) {\n\n\tconst pileDocument = Utilities.getDocument(token);\n\n\tconst itemPileData = getActorFlagData(pileDocument, data);\n\n\tconst originalImg = overrideImage ?? (pileDocument instanceof TokenDocument\n\t\t\t? pileDocument.texture.src\n\t\t\t: pileDocument.prototypeToken.texture.src\n\t);\n\n\tif (!isValidItemPile(pileDocument, itemPileData) || !isItemPileLootable(pileDocument, itemPileData)) return originalImg;\n\n\titems = items || getActorItems(pileDocument);\n\tcurrencies = currencies || getActorCurrencies(pileDocument);\n\n\tconst numItems = items.length + currencies.length;\n\n\tlet img = originalImg;\n\n\tif (itemPileData.type === CONSTANTS.PILE_TYPES.CONTAINER) {\n\n\t\timg = itemPileData.lockedImage || itemPileData.closedImage || itemPileData.openedImage || itemPileData.emptyImage;\n\n\t\tif (itemPileData.locked && itemPileData.lockedImage) {\n\t\t\timg = itemPileData.lockedImage;\n\t\t} else if (itemPileData.closed && itemPileData.closedImage) {\n\t\t\timg = itemPileData.closedImage;\n\t\t} else if (itemPileData.emptyImage && isItemPileEmpty(pileDocument)) {\n\t\t\timg = itemPileData.emptyImage;\n\t\t} else if (itemPileData.openedImage) {\n\t\t\timg = itemPileData.openedImage;\n\t\t}\n\n\t} else if (itemPileData.displayOne && numItems === 1) {\n\n\t\timg = items.length > 0 ? items[0].img : currencies[0].img;\n\n\t} else if (itemPileData.displayOne && numItems > 1) {\n\n\t\timg = originalImg;\n\n\t}\n\n\treturn img || originalImg;\n\n}\n\nexport function getItemPileTokenScale(target, {\n\tdata = false,\n\titems = false,\n\tcurrencies = false\n} = {}, overrideScale = null) {\n\n\tconst pileDocument = Utilities.getDocument(target);\n\n\tlet itemPileData = getActorFlagData(pileDocument, data);\n\n\tconst baseScale = overrideScale ?? (pileDocument instanceof TokenDocument\n\t\t\t? pileDocument.texture.scaleX\n\t\t\t: pileDocument.prototypeToken.texture.scaleX\n\t);\n\n\tif (!isValidItemPile(pileDocument, itemPileData) || !isItemPileLootable(pileDocument, itemPileData)) {\n\t\treturn baseScale;\n\t}\n\n\titems = items || getActorItems(pileDocument);\n\tcurrencies = currencies || getActorCurrencies(pileDocument);\n\n\tconst numItems = items.length + currencies.length;\n\n\tif (itemPileData?.type === CONSTANTS.PILE_TYPES.CONTAINER || !itemPileData.displayOne || !itemPileData.overrideSingleItemScale || numItems > 1 || numItems === 0) {\n\t\treturn baseScale;\n\t}\n\n\treturn itemPileData.singleItemScale;\n\n}\n\nexport function getItemPileName(target, { data = false, items = false, currencies = false } = {}, overrideName = null) {\n\n\tconst pileDocument = Utilities.getDocument(target);\n\n\tconst itemPileData = getActorFlagData(pileDocument, data);\n\n\tlet name = overrideName ?? (pileDocument instanceof TokenDocument ? pileDocument.name : pileDocument.prototypeToken.name);\n\n\tif (!isValidItemPile(pileDocument, itemPileData) || !isItemPileLootable(pileDocument, itemPileData)) {\n\t\treturn name;\n\t}\n\n\titems = items || getActorItems(pileDocument);\n\tcurrencies = currencies || getActorCurrencies(pileDocument);\n\n\tconst numItems = items.length + currencies.length;\n\n\tif (itemPileData?.type === CONSTANTS.PILE_TYPES.CONTAINER || !itemPileData.displayOne || !itemPileData.showItemName || numItems > 1 || numItems === 0) {\n\t\treturn name;\n\t}\n\n\tconst item = items.length > 0 ? items[0] : currencies[0];\n\tconst quantity = (items.length > 0 ? Utilities.getItemQuantity(item) : currencies[0]?.quantity) ?? 1\n\n\treturn item.name + (quantity > 1 ? \" x \" + quantity : \"\");\n\n}\n\nexport function shouldEvaluateChange(target, changes) {\n\tconst flags = getActorFlagData(target, getProperty(changes, CONSTANTS.FLAGS.PILE) ?? {});\n\tif (!isValidItemPile(target, flags)) return false;\n\treturn (flags.type === CONSTANTS.PILE_TYPES.CONTAINER && (flags.closedImage || flags.emptyImage || flags.openedImage || flags.lockedImage))\n\t\t|| flags.displayOne || flags.showItemName || flags.overrideSingleItemScale;\n}\n\nfunction getRelevantTokensAndActor(target) {\n\n\tconst relevantDocument = Utilities.getDocument(target);\n\n\tlet documentActor;\n\tlet documentTokens = [];\n\n\tif (relevantDocument instanceof Actor) {\n\t\tdocumentActor = relevantDocument;\n\t\tif (relevantDocument.token) {\n\t\t\tdocumentTokens.push(relevantDocument?.token);\n\t\t} else {\n\t\t\tdocumentTokens = canvas.tokens.placeables.filter(token => token.document.actor === documentActor).map(token => token.document);\n\t\t}\n\t} else {\n\t\tdocumentActor = relevantDocument.actor;\n\t\tif (relevantDocument.isLinked) {\n\t\t\tdocumentTokens = canvas.tokens.placeables.filter(token => token.document.actor === documentActor).map(token => token.document);\n\t\t} else {\n\t\t\tdocumentTokens.push(relevantDocument);\n\t\t}\n\t}\n\n\treturn [documentActor, documentTokens]\n\n}\n\nexport async function updateItemPileData(target, flagData, tokenData) {\n\n\tif (!target) return;\n\n\tif (!flagData) flagData = getActorFlagData(target);\n\tif (!tokenData) tokenData = {};\n\ttokenData = foundry.utils.mergeObject(tokenData, {});\n\n\tlet [documentActor, documentTokens] = getRelevantTokensAndActor(target);\n\n\tconst items = getActorItems(documentActor, { itemFilters: flagData.overrideItemFilters });\n\tconst actorCurrencies = (flagData.overrideCurrencies || []).concat(flagData.overrideSecondaryCurrencies || []);\n\tconst currencies = getActorCurrencies(documentActor, { currencyList: actorCurrencies });\n\n\tconst pileData = { data: flagData, items, currencies };\n\n\tflagData = cleanFlagData(flagData);\n\n\tconst updates = documentTokens.map(tokenDocument => {\n\t\tconst overrideImage = getProperty(tokenData, \"texture.src\") ?? getProperty(tokenData, \"img\");\n\t\tconst overrideScale = getProperty(tokenData, \"texture.scaleX\")\n\t\t\t?? getProperty(tokenData, \"texture.scaleY\")\n\t\t\t?? getProperty(tokenData, \"scale\");\n\t\tconst scale = getItemPileTokenScale(tokenDocument, pileData, overrideScale);\n\t\tconst newTokenData = foundry.utils.mergeObject(tokenData, {\n\t\t\t\"texture.src\": getItemPileTokenImage(tokenDocument, pileData, overrideImage),\n\t\t\t\"texture.scaleX\": scale,\n\t\t\t\"texture.scaleY\": scale,\n\t\t\t\"name\": getItemPileName(tokenDocument, pileData, tokenData?.name),\n\t\t});\n\t\tconst data = {\n\t\t\t\"_id\": tokenDocument.id, ...newTokenData\n\t\t};\n\t\tif (!tokenDocument.actorLink && (tokenDocument.actor === documentActor || !documentActor)) {\n\t\t\tdata[CONSTANTS.FLAGS.PILE] = flagData;\n\t\t\tdata[CONSTANTS.FLAGS.VERSION] = Helpers.getModuleVersion();\n\t\t\tdocumentActor = false;\n\t\t}\n\t\treturn data;\n\t});\n\n\tif (canvas.scene && !foundry.utils.isEmpty(updates)) {\n\t\tawait canvas.scene.updateEmbeddedDocuments(\"Token\", updates);\n\t}\n\n\tif (documentActor) {\n\t\tawait documentActor.update({\n\t\t\t[CONSTANTS.FLAGS.PILE]: flagData,\n\t\t\t[CONSTANTS.FLAGS.VERSION]: Helpers.getModuleVersion()\n\t\t});\n\t}\n\n\treturn true;\n}\n\nexport function cleanFlagData(flagData) {\n\tconst defaults = foundry.utils.mergeObject(\n\t\t{ ...CONSTANTS.PILE_DEFAULTS },\n\t\tHelpers.getSetting(SETTINGS.PILE_DEFAULTS) ?? {}\n\t);\n\tconst defaultKeys = Object.keys(defaults);\n\tconst difference = new Set(Object.keys(foundry.utils.diffObject(flagData, defaults)));\n\tconst toRemove = new Set(defaultKeys.filter(key => !difference.has(key)));\n\tif (flagData.enabled) {\n\t\ttoRemove.delete(\"type\")\n\t}\n\tif (!CONSTANTS.CUSTOM_PILE_TYPES[flagData.type]) {\n\t\tconst baseKeys = new Set(defaultKeys);\n\t\tfor (const key of Object.keys(flagData)) {\n\t\t\tif (!baseKeys.has(key)) {\n\t\t\t\tdelete flagData[key];\n\t\t\t\tflagData[\"-=\" + key] = null;\n\t\t\t}\n\t\t}\n\t}\n\tfor (const key of toRemove) {\n\t\tdelete flagData[key];\n\t\tflagData[\"-=\" + key] = null;\n\t}\n\treturn flagData;\n}\n\nexport function cleanItemFlagData(flagData, { addRemoveFlag = false } = {}) {\n\tconst defaults = Object.keys(CONSTANTS.ITEM_DEFAULTS);\n\tconst difference = new Set(Object.keys(foundry.utils.diffObject(flagData, CONSTANTS.ITEM_DEFAULTS)));\n\tconst toRemove = new Set(defaults.filter(key => !difference.has(key)));\n\tfor (const key of toRemove) {\n\t\tdelete flagData[key];\n\t\tif (!addRemoveFlag) {\n\t\t\tflagData[\"-=\" + key] = null;\n\t\t}\n\t}\n\treturn flagData;\n}\n\nexport function updateItemData(item, update, { returnUpdate = false, version = false } = {}) {\n\tconst flagData = cleanItemFlagData(foundry.utils.mergeObject(getItemFlagData(item), update.flags ?? {}));\n\tconst updates = foundry.utils.mergeObject(update?.data ?? {}, {});\n\tsetProperty(updates, CONSTANTS.FLAGS.ITEM, flagData)\n\tsetProperty(updates, CONSTANTS.FLAGS.VERSION, version || Helpers.getModuleVersion())\n\tif (returnUpdate) {\n\t\tupdates[\"_id\"] = item?.id ?? item?._id;\n\t\treturn updates;\n\t}\n\treturn item.update(updates);\n}\n\n/* -------------------------- Merchant Methods ------------------------- */\n\nexport function getMerchantModifiersForActor(merchant, {\n\titem = false,\n\tactor = false,\n\tpileFlagData = false,\n\titemFlagData = false,\n\tabsolute = false\n} = {}) {\n\n\tlet {\n\t\tbuyPriceModifier, sellPriceModifier, itemTypePriceModifiers, actorPriceModifiers\n\t} = getActorFlagData(merchant, pileFlagData);\n\n\tif (item) {\n\t\tif (!itemFlagData) {\n\t\t\titemFlagData = getItemFlagData(item);\n\t\t}\n\t\tconst itemTypePriceModifier = itemTypePriceModifiers\n\t\t\t.sort((a, b) => a.type === \"custom\" && b.type !== \"custom\" ? -1 : 0)\n\t\t\t.find(priceData => {\n\t\t\t\treturn priceData.type === \"custom\"\n\t\t\t\t\t? priceData.category.toLowerCase() === itemFlagData.customCategory.toLowerCase()\n\t\t\t\t\t: priceData.type === item.type;\n\t\t\t});\n\t\tif (itemTypePriceModifier) {\n\t\t\tbuyPriceModifier = itemTypePriceModifier.override ? itemTypePriceModifier.buyPriceModifier : buyPriceModifier * itemTypePriceModifier.buyPriceModifier;\n\t\t\tsellPriceModifier = itemTypePriceModifier.override ? itemTypePriceModifier.sellPriceModifier : sellPriceModifier * itemTypePriceModifier.sellPriceModifier;\n\t\t}\n\t}\n\n\tif (actor && actorPriceModifiers) {\n\t\tconst actorSpecificModifiers = actorPriceModifiers?.find(data => data.actorUuid === Utilities.getUuid(actor) || data.actor === actor.id);\n\t\tif (actorSpecificModifiers) {\n\t\t\tbuyPriceModifier = actorSpecificModifiers.override || absolute ? actorSpecificModifiers.buyPriceModifier ?? buyPriceModifier : buyPriceModifier * actorSpecificModifiers.buyPriceModifier;\n\t\t\tsellPriceModifier = actorSpecificModifiers.override || absolute ? actorSpecificModifiers.sellPriceModifier ?? sellPriceModifier : sellPriceModifier * actorSpecificModifiers.sellPriceModifier;\n\t\t}\n\t}\n\n\treturn {\n\t\tbuyPriceModifier: Helpers.roundToDecimals(buyPriceModifier, 2),\n\t\tsellPriceModifier: Helpers.roundToDecimals(sellPriceModifier, 2)\n\t}\n}\n\nfunction getSmallestExchangeRate(currencies) {\n\treturn currencies.length > 1 ? Math.min(...currencies.map(currency => currency.exchangeRate)) : (Helpers.getSetting(SETTINGS.CURRENCY_DECIMAL_DIGITS) ?? 0.00001);\n}\n\nfunction getExchangeRateDecimals(smallestExchangeRate) {\n\treturn smallestExchangeRate.toString().includes(\".\") ? smallestExchangeRate.toString().split(\".\")[1].length : 0;\n}\n\nexport function getPriceArray(totalCost, currencies) {\n\n\tconst primaryCurrency = currencies.find(currency => currency.primary);\n\n\tif (currencies.length === 1) {\n\t\treturn [{\n\t\t\t...primaryCurrency,\n\t\t\tcost: totalCost,\n\t\t\tbaseCost: totalCost,\n\t\t\tmaxCurrencyCost: totalCost,\n\t\t\tstring: primaryCurrency.abbreviation.replace('{#}', totalCost)\n\t\t}]\n\t}\n\n\tconst smallestExchangeRate = getSmallestExchangeRate(currencies);\n\n\tconst prices = [];\n\n\tif (primaryCurrency.exchangeRate === smallestExchangeRate) {\n\n\t\tlet cost = totalCost;\n\n\t\tfor (const currency of currencies) {\n\n\t\t\tconst numCurrency = Math.floor(cost / currency.exchangeRate);\n\n\t\t\tcost = cost - (numCurrency * currency.exchangeRate);\n\n\t\t\tprices.push({\n\t\t\t\t...currency,\n\t\t\t\tcost: Math.round(numCurrency),\n\t\t\t\tbaseCost: Math.round(numCurrency),\n\t\t\t\tmaxCurrencyCost: Math.ceil(totalCost / currency.exchangeRate),\n\t\t\t\tstring: currency.abbreviation.replace(\"{#}\", numCurrency)\n\t\t\t});\n\n\t\t}\n\n\t\treturn prices;\n\n\t}\n\n\tconst decimals = getExchangeRateDecimals(smallestExchangeRate);\n\n\tlet fraction = Helpers.roundToDecimals(totalCost % 1, decimals);\n\tlet cost = Math.round(totalCost - fraction);\n\n\tlet skipPrimary = false;\n\tif (cost) {\n\t\tskipPrimary = true;\n\t\tprices.push({\n\t\t\t...primaryCurrency,\n\t\t\tcost: cost,\n\t\t\tbaseCost: cost,\n\t\t\tmaxCurrencyCost: totalCost,\n\t\t\tstring: primaryCurrency.abbreviation.replace('{#}', cost)\n\t\t});\n\t}\n\n\tfor (const currency of currencies) {\n\n\t\tif (currency === primaryCurrency && skipPrimary) continue;\n\n\t\tconst numCurrency = Math.floor(Helpers.roundToDecimals(fraction / currency.exchangeRate, decimals));\n\n\t\tfraction = Helpers.roundToDecimals(fraction - (numCurrency * currency.exchangeRate), decimals);\n\n\t\tprices.push({\n\t\t\t...currency,\n\t\t\tcost: Math.round(numCurrency),\n\t\t\tbaseCost: Math.round(numCurrency),\n\t\t\tmaxCurrencyCost: Math.ceil(totalCost / currency.exchangeRate),\n\t\t\tstring: currency.abbreviation.replace(\"{#}\", numCurrency)\n\t\t});\n\t}\n\n\tprices.sort((a, b) => b.exchangeRate - a.exchangeRate);\n\n\treturn prices;\n}\n\nexport function getPriceFromString(str, currencyList = false) {\n\n\tif (!currencyList) {\n\t\tcurrencyList = getCurrencyList().filter(currency => !currency.secondary);\n\t}\n\n\tconst currencies = foundry.utils.duplicate(currencyList)\n\t\t.map(currency => {\n\t\t\tcurrency.quantity = 0\n\t\t\tcurrency.identifier = currency.abbreviation.toLowerCase().replace(\"{#}\", \"\")\n\t\t\treturn currency;\n\t\t});\n\n\tconst splitBy = new RegExp(\"(.*?) *(\" + currencies.map(currency => currency.identifier).join(\"|\") + \")\", \"g\");\n\n\tconst parts = [...str.split(\",\").join(\"\").split(\" \").join(\"\").trim().toLowerCase().matchAll(splitBy)];\n\n\tlet overallCost = 0;\n\tfor (const part of parts) {\n\t\tfor (const currency of currencies) {\n\n\t\t\tif (part[2] !== currency.identifier) continue;\n\n\t\t\ttry {\n\t\t\t\tconst roll = new Roll(part[1]).evaluate({ async: false })\n\t\t\t\tcurrency.quantity = roll.total;\n\t\t\t\tif (roll.total !== Number(part[1])) {\n\t\t\t\t\tcurrency.roll = roll;\n\t\t\t\t}\n\t\t\t\toverallCost += roll.total * currency.exchangeRate;\n\t\t\t} catch (err) {\n\n\t\t\t}\n\t\t}\n\t}\n\n\tif (overallCost === 0) {\n\t\ttry {\n\t\t\tconst roll = new Roll(str).evaluate({ async: false });\n\t\t\tif (roll.total) {\n\t\t\t\tconst primaryCurrency = currencies.find(currency => currency.primary);\n\t\t\t\tprimaryCurrency.quantity = roll.total;\n\t\t\t\tif (roll.total !== Number(str)) {\n\t\t\t\t\tprimaryCurrency.roll = roll;\n\t\t\t\t}\n\t\t\t\toverallCost = roll.total;\n\t\t\t}\n\t\t} catch (err) {\n\n\t\t}\n\t}\n\n\treturn { currencies, overallCost };\n\n}\n\nexport function getPriceData({\n\tcost = false,\n\titem = false,\n\tseller = false,\n\tbuyer = false,\n\tsellerFlagData = false,\n\tbuyerFlagData = false,\n\titemFlagData = false,\n\tquantity = 1\n} = {}) {\n\n\tlet priceData = [];\n\n\tbuyerFlagData = getActorFlagData(buyer, buyerFlagData);\n\tif (!isItemPileMerchant(buyer, buyerFlagData)) {\n\t\tbuyerFlagData = false;\n\t}\n\n\tsellerFlagData = getActorFlagData(seller, sellerFlagData);\n\tif (!isItemPileMerchant(seller, sellerFlagData)) {\n\t\tsellerFlagData = false;\n\t}\n\n\tif (cost && !item) {\n\t\titem = {};\n\t\tsetProperty(item, game.itempiles.API.ITEM_PRICE_ATTRIBUTE, cost);\n\t\tsetProperty(item, CONSTANTS.FLAGS.ITEM, CONSTANTS.ITEM_DEFAULTS);\n\t}\n\n\titemFlagData = itemFlagData || getItemFlagData(item);\n\n\tlet merchant = sellerFlagData ? seller : buyer;\n\n\tif (merchant === buyer && itemFlagData.cantBeSoldToMerchants) {\n\t\tpriceData.push({\n\t\t\tfree: false,\n\t\t\tbasePrices: [],\n\t\t\tbasePriceString: \"\",\n\t\t\tprices: [],\n\t\t\tpriceString: \"\",\n\t\t\ttotalCost: 0,\n\t\t\tbaseCost: 0,\n\t\t\tprimary: true,\n\t\t\tmaxQuantity: 0,\n\t\t\tquantity\n\t\t});\n\t\treturn priceData;\n\t}\n\n\t// Retrieve the item price modifiers\n\tlet modifier = 1;\n\tif (sellerFlagData) {\n\n\t\tmodifier = getMerchantModifiersForActor(seller, {\n\t\t\titem, actor: buyer, pileFlagData: sellerFlagData, itemFlagData\n\t\t}).buyPriceModifier;\n\n\t} else if (buyerFlagData) {\n\n\t\tmodifier = getMerchantModifiersForActor(buyer, {\n\t\t\titem, actor: seller, pileFlagData: buyerFlagData, itemFlagData\n\t\t}).sellPriceModifier;\n\n\t}\n\n\tconst disableNormalCost = itemFlagData.disableNormalCost && !sellerFlagData.onlyAcceptBasePrice;\n\tconst hasOtherPrices = itemFlagData.prices.filter(priceGroup => priceGroup.length).length > 0;\n\n\tconst currencyList = getCurrencyList(merchant).filter(currency => !currency.secondary);\n\tconst currencies = getActorCurrencies(merchant, { currencyList, getAll: true, secondary: false });\n\n\t// In order to easily calculate an item's total worth, we can use the smallest exchange rate and convert all prices\n\t// to it, in order have a stable form of exchange calculation\n\tconst smallestExchangeRate = getSmallestExchangeRate(currencyList);\n\tconst decimals = getExchangeRateDecimals(smallestExchangeRate);\n\n\tlet overallCost;\n\tlet itemCost = Utilities.getItemCost(item);\n\tif (SYSTEMS.DATA.ITEM_COST_TRANSFORMER) {\n\t\toverallCost = SYSTEMS.DATA.ITEM_COST_TRANSFORMER(item, currencyList);\n\t\tif (overallCost === false) {\n\t\t\tHelpers.debug(\"failed to find price for item:\", item)\n\t\t}\n\t} else if (typeof itemCost === \"string\" && isNaN(Number(itemCost))) {\n\t\toverallCost = getPriceFromString(itemCost, currencyList).overallCost;\n\t} else {\n\t\toverallCost = Number(itemCost);\n\t}\n\n\tif (itemFlagData?.free || (!disableNormalCost && (overallCost === 0 || overallCost < smallestExchangeRate) && !hasOtherPrices) || modifier <= 0) {\n\t\tpriceData.push({\n\t\t\tfree: true,\n\t\t\tbasePrices: [],\n\t\t\tbasePriceString: \"\",\n\t\t\tprices: [],\n\t\t\tpriceString: \"\",\n\t\t\ttotalCost: 0,\n\t\t\tbaseCost: 0,\n\t\t\tprimary: true,\n\t\t\tmaxQuantity: Infinity,\n\t\t\tquantity: quantity\n\t\t})\n\t\treturn priceData;\n\t}\n\n\t// If the item does include its normal cost, we calculate that here\n\tif (overallCost >= smallestExchangeRate && (!itemFlagData.disableNormalCost || (merchant === buyer && buyerFlagData.onlyAcceptBasePrice))) {\n\n\t\t// Base prices is the displayed price, without quantity taken into account\n\t\tconst baseCost = Helpers.roundToDecimals(overallCost * modifier, decimals);\n\t\tconst basePrices = getPriceArray(baseCost, currencies);\n\n\t\t// Prices is the cost with the amount of quantity taken into account, which may change the number of the different\n\t\t// types of currencies it costs (eg, an item wouldn't cost 1 gold and 100 silver, it would cost 11 gold\n\t\tlet totalCost = Helpers.roundToDecimals(overallCost * modifier * quantity, decimals);\n\t\tlet prices = getPriceArray(totalCost, currencies);\n\n\t\tif (baseCost) {\n\n\t\t\tpriceData.push({\n\t\t\t\tbasePrices,\n\t\t\t\tbasePriceString: basePrices.filter(price => price.cost).map(price => price.string).join(\" \"),\n\t\t\t\tprices,\n\t\t\t\tpriceString: prices.filter(price => price.cost).map(price => price.string).join(\" \"),\n\t\t\t\ttotalCost,\n\t\t\t\tbaseCost,\n\t\t\t\tprimary: true,\n\t\t\t\tmaxQuantity: 0,\n\t\t\t\tquantity: quantity\n\t\t\t});\n\n\t\t}\n\t}\n\n\t// If the item has custom prices, we include them here\n\tif (itemFlagData.prices.length && !(merchant === buyer && buyerFlagData.onlyAcceptBasePrice)) {\n\n\t\tpriceData = priceData.concat(itemFlagData.prices.map(priceGroup => {\n\t\t\tconst prices = priceGroup.map(price => {\n\t\t\t\tconst itemModifier = price.fixed ? 1 : modifier;\n\t\t\t\tconst cost = Math.round(price.quantity * itemModifier * quantity);\n\t\t\t\tconst baseCost = Math.round(price.quantity * itemModifier);\n\t\t\t\tprice.name = game.i18n.localize(price.name);\n\t\t\t\tif (!price.data?.item) {\n\t\t\t\t\tprice.data.item = CompendiumUtilities.getItemFromCache(price.data.uuid);\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\t...price,\n\t\t\t\t\tcost,\n\t\t\t\t\tbaseCost,\n\t\t\t\t\tmodifier: itemModifier,\n\t\t\t\t\tpriceString: cost ? price.abbreviation.replace(\"{#}\", cost) : \"\",\n\t\t\t\t\tbasePriceString: baseCost ? price.abbreviation.replace(\"{#}\", baseCost) : \"\"\n\t\t\t\t};\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tprices,\n\t\t\t\tpriceString: prices.filter(price => price.priceString).map(price => price.priceString).join(\" \"),\n\t\t\t\tbasePriceString: prices.filter(price => price.basePriceString).map(price => price.basePriceString).join(\" \"),\n\t\t\t\tmaxQuantity: 0,\n\t\t\t\tquantity: quantity\n\t\t\t}\n\t\t}));\n\t}\n\n\t// If there's a buyer, we also calculate how many of the item the buyer can afford\n\tif (!buyer) return priceData;\n\n\tconst buyerInfiniteCurrencies = buyerFlagData?.infiniteCurrencies;\n\tconst buyerInfiniteQuantity = buyerFlagData?.infiniteQuantity;\n\n\tconst recipientCurrencies = getActorCurrencies(buyer, { currencyList, secondary: false });\n\tconst totalCurrencies = recipientCurrencies.map(currency => currency.quantity * currency.exchangeRate).reduce((acc, num) => acc + num, 0);\n\n\t// For each price group, check for properties and items and make sure that the actor can afford it\n\tfor (const priceGroup of priceData) {\n\t\tpriceGroup.maxQuantity = Infinity;\n\t\tif (priceGroup.baseCost !== undefined) {\n\t\t\tpriceGroup.prices.forEach(price => {\n\t\t\t\tprice.maxQuantity = Infinity;\n\t\t\t});\n\t\t\tif (buyerInfiniteCurrencies) continue;\n\t\t\tpriceGroup.maxQuantity = Math.floor(totalCurrencies / priceGroup.baseCost);\n\t\t\tpriceGroup.prices.forEach(price => {\n\t\t\t\tprice.maxQuantity = priceGroup.maxQuantity;\n\t\t\t});\n\t\t} else {\n\t\t\tif (buyerInfiniteQuantity) continue;\n\t\t\tfor (const price of priceGroup.prices) {\n\t\t\t\tif (price.type === \"attribute\") {\n\t\t\t\t\tconst attributeQuantity = Number(getProperty(buyer, price.data.path));\n\t\t\t\t\tprice.buyerQuantity = attributeQuantity;\n\n\t\t\t\t\tif (price.percent) {\n\t\t\t\t\t\tconst percent = Math.min(1, price.baseCost / 100);\n\t\t\t\t\t\tconst percentQuantity = Math.max(0, Math.floor(attributeQuantity * percent));\n\t\t\t\t\t\tprice.maxQuantity = Math.floor(attributeQuantity / percentQuantity);\n\t\t\t\t\t\tprice.baseCost = !buyer ? price.baseCost : percentQuantity;\n\t\t\t\t\t\tprice.cost = !buyer ? price.cost : percentQuantity * quantity;\n\t\t\t\t\t\tprice.quantity = !buyer ? price.quantity : percentQuantity;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprice.maxQuantity = Math.floor(attributeQuantity / price.baseCost);\n\t\t\t\t\t}\n\n\t\t\t\t\tpriceGroup.maxQuantity = Math.min(priceGroup.maxQuantity, price.maxQuantity)\n\n\t\t\t\t} else {\n\t\t\t\t\tconst priceItem = CompendiumUtilities.getItemFromCache(price.data.uuid);\n\t\t\t\t\tconst foundItem = Utilities.findSimilarItem(buyer.items, priceItem);\n\t\t\t\t\tconst itemQuantity = foundItem ? Utilities.getItemQuantity(foundItem) : 0;\n\t\t\t\t\tprice.buyerQuantity = itemQuantity;\n\n\t\t\t\t\tif (price.percent) {\n\t\t\t\t\t\tconst percent = Math.min(1, price.baseCost / 100);\n\t\t\t\t\t\tconst percentQuantity = Math.max(0, Math.floor(itemQuantity * percent));\n\t\t\t\t\t\tprice.maxQuantity = Math.floor(itemQuantity / percentQuantity);\n\t\t\t\t\t\tprice.baseCost = !buyer ? price.baseCost : percentQuantity;\n\t\t\t\t\t\tprice.cost = !buyer ? price.cost : percentQuantity * quantity;\n\t\t\t\t\t\tprice.quantity = !buyer ? price.quantity : percentQuantity;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprice.maxQuantity = Math.floor(itemQuantity / price.baseCost);\n\t\t\t\t\t}\n\n\t\t\t\t\tpriceGroup.maxQuantity = Math.min(priceGroup.maxQuantity, price.maxQuantity);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn priceData;\n}\n\nexport function getPaymentData({\n\tpurchaseData = [],\n\tseller = false,\n\tbuyer = false,\n\tsellerFlagData = false,\n\tbuyerFlagData = false\n} = {}) {\n\n\tbuyerFlagData = getActorFlagData(buyer, buyerFlagData);\n\tif (!isItemPileMerchant(buyer, buyerFlagData)) {\n\t\tbuyerFlagData = false;\n\t}\n\n\tsellerFlagData = getActorFlagData(seller, sellerFlagData);\n\tif (!isItemPileMerchant(seller, sellerFlagData)) {\n\t\tsellerFlagData = false;\n\t}\n\n\tconst merchant = sellerFlagData ? seller : buyer;\n\tconst currencyList = getCurrencyList(merchant).filter(currency => !currency.secondary);\n\tconst currencies = getActorCurrencies(merchant, { currencyList, getAll: true, secondary: false });\n\tconst smallestExchangeRate = getSmallestExchangeRate(currencies)\n\tconst decimals = getExchangeRateDecimals(smallestExchangeRate);\n\n\tconst recipientCurrencies = getActorCurrencies(buyer, { currencyList, getAll: true, secondary: false });\n\n\tconst buyerInfiniteCurrencies = buyerFlagData?.infiniteCurrencies;\n\n\tconst paymentData = purchaseData.map(data => {\n\t\t\tconst prices = getPriceData({\n\t\t\t\tcost: data.cost,\n\t\t\t\titem: data.item,\n\t\t\t\tseller,\n\t\t\t\tbuyer,\n\t\t\t\tsellerFlagData,\n\t\t\t\tbuyerFlagData,\n\t\t\t\titemFlagData: data.itemFlagData,\n\t\t\t\tquantity: data.quantity || 1\n\t\t\t})[data.paymentIndex || 0];\n\t\t\treturn {\n\t\t\t\t...prices, item: data.item\n\t\t\t};\n\t\t})\n\t\t.reduce((priceData, priceGroup) => {\n\n\t\t\tif (!priceGroup.maxQuantity && (buyer || seller)) {\n\t\t\t\tpriceData.canBuy = false;\n\t\t\t\tpriceData.reason = [\"ITEM-PILES.Applications.TradeMerchantItem.\" + (buyer === merchant ? \"TheyCantAfford\" : \"YouCantAfford\")];\n\t\t\t\treturn priceData;\n\t\t\t}\n\n\t\t\tif (priceGroup.primary) {\n\n\t\t\t\tpriceData.totalCurrencyCost = Helpers.roundToDecimals(priceData.totalCurrencyCost + priceGroup.totalCost, decimals);\n\t\t\t\tpriceData.primary = true;\n\n\t\t\t} else {\n\n\t\t\t\tfor (const price of priceGroup.prices) {\n\n\t\t\t\t\tlet existingPrice = priceData.otherPrices.find(otherPrice => {\n\t\t\t\t\t\treturn otherPrice.id === price.id || (otherPrice.name === price.name && otherPrice.img === price.img && otherPrice.type === price.type);\n\t\t\t\t\t});\n\n\t\t\t\t\tif (existingPrice) {\n\t\t\t\t\t\texistingPrice.cost += price.cost;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst index = priceData.otherPrices.push(price);\n\t\t\t\t\t\texistingPrice = priceData.otherPrices[index - 1];\n\t\t\t\t\t\texistingPrice.quantity = 0;\n\t\t\t\t\t}\n\n\t\t\t\t\texistingPrice.quantity += price.cost;\n\t\t\t\t\texistingPrice.buyerQuantity -= price.cost;\n\n\t\t\t\t\tif (existingPrice.buyerQuantity < 0) {\n\t\t\t\t\t\tpriceData.canBuy = false;\n\t\t\t\t\t\tpriceData.reason = [\"ITEM-PILES.Applications.TradeMerchantItem.\" + (buyer === merchant ? \"TheyCantAfford\" : \"YouCantAfford\")];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (priceGroup.item) {\n\n\t\t\t\tconst itemQuantity = Utilities.getItemQuantity(priceGroup.item);\n\n\t\t\t\tconst quantityPerPrice = game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE\n\t\t\t\t\t? getProperty(priceGroup.item, game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE) ?? 1\n\t\t\t\t\t: 1;\n\n\t\t\t\tconst requiredQuantity = Math.floor(priceGroup.quantity * quantityPerPrice);\n\n\t\t\t\tif (requiredQuantity > itemQuantity && requiredQuantity > (priceGroup.maxQuantity * quantityPerPrice)) {\n\t\t\t\t\tpriceData.canBuy = false;\n\t\t\t\t\tpriceData.reason = [`ITEM-PILES.Applications.TradeMerchantItem.${buyer === merchant ? \"You\" : \"They\"}LackQuantity`, {\n\t\t\t\t\t\tquantity: itemQuantity,\n\t\t\t\t\t\trequiredQuantity\n\t\t\t\t\t}];\n\t\t\t\t}\n\n\t\t\t\tpriceData.buyerReceive.push({\n\t\t\t\t\ttype: \"item\",\n\t\t\t\t\tname: priceGroup.item.name,\n\t\t\t\t\timg: priceGroup.item.img,\n\t\t\t\t\tquantity: requiredQuantity,\n\t\t\t\t\titem: priceGroup.item,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn priceData;\n\n\t\t}, {\n\t\t\ttotalCurrencyCost: 0, canBuy: true, primary: false, finalPrices: [], otherPrices: [], reason: [],\n\n\t\t\tbuyerReceive: [], buyerChange: [], sellerReceive: []\n\t\t});\n\n\tif (paymentData.totalCurrencyCost && !seller && !buyer) {\n\n\t\tpaymentData.finalPrices = getPriceArray(paymentData.totalCurrencyCost, recipientCurrencies);\n\n\t} else if (paymentData.totalCurrencyCost) {\n\n\t\t// The price array that we need to fill\n\t\tconst prices = getPriceArray(paymentData.totalCurrencyCost, recipientCurrencies);\n\n\t\t// This is the target price amount we need to hit\n\t\tlet priceLeft = paymentData.totalCurrencyCost;\n\n\t\tconst inverse = prices[prices.length - 1].primary && prices[prices.length - 1].exchangeRate === 1;\n\n\t\t// Starting from the smallest currency increment in the price\n\t\tfor (let i = prices.length - 1, j = 0; i >= 0; i--, j++) {\n\n\t\t\tconst price = prices[inverse ? j : i];\n\n\t\t\tconst buyerPrice = {\n\t\t\t\t...price,\n\t\t\t\tbuyerQuantity: buyerInfiniteCurrencies ? Infinity : price.quantity,\n\t\t\t\tquantity: 0,\n\t\t\t\tisCurrency: true\n\t\t\t}\n\n\t\t\tif (price.type === \"item\") {\n\t\t\t\tbuyerPrice.item = price.data.item ?? CompendiumUtilities.getItemFromCache(price.data.uuid);\n\t\t\t}\n\n\t\t\t// If we have met the price target (or exceeded it, eg, we need change), populate empty entry\n\t\t\tif (priceLeft <= 0 || !price.cost || currencies.length === 1) {\n\t\t\t\tif (currencies.length === 1) {\n\t\t\t\t\tbuyerPrice.quantity = price.cost;\n\t\t\t\t\tpriceLeft = 0;\n\t\t\t\t}\n\t\t\t\tpaymentData.finalPrices.push(buyerPrice);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// If the buyer does not have enough to cover the cost, put what we can into it, otherwise all of it\n\t\t\tbuyerPrice.quantity = buyerPrice.buyerQuantity < price.cost ? buyerPrice.buyerQuantity : price.cost;\n\n\t\t\t// If it's the primary currency\n\t\t\tif (price.primary) {\n\t\t\t\t// And the buyer has enough of the primary currency to cover the rest of the price, use that\n\t\t\t\tconst totalCurrencyValue = Helpers.roundToDecimals(buyerPrice.buyerQuantity * price.exchangeRate, decimals);\n\t\t\t\tif (totalCurrencyValue > priceLeft) {\n\t\t\t\t\tbuyerPrice.quantity = Math.ceil(priceLeft);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpaymentData.finalPrices.push(buyerPrice);\n\n\t\t\t// Then adjust the remaining price - if this goes below zero, we will need change back\n\t\t\tpriceLeft = Helpers.roundToDecimals(priceLeft - (buyerPrice.quantity * price.exchangeRate), decimals);\n\n\t\t}\n\n\t\t// If there's STILL some remaining price (eg, we haven't been able to scrounge up enough currency to pay for it)\n\t\t// we can start using the larger currencies, such as platinum in D&D 5e\n\t\tif (currencies.length > 1) {\n\n\t\t\twhile (priceLeft > 0) {\n\n\t\t\t\t// We then need to loop through each price, and check if we have any more left over\n\t\t\t\tfor (const buyerPrice of paymentData.finalPrices) {\n\n\t\t\t\t\t// If we don't, look for the next one\n\t\t\t\t\tlet buyerCurrencyQuantity = buyerPrice.buyerQuantity - buyerPrice.quantity;\n\t\t\t\t\tif (!buyerCurrencyQuantity) continue;\n\n\t\t\t\t\t// Otherwise, add enough to cover the remaining cost\n\t\t\t\t\tconst newQuantity = Math.ceil(Math.min(buyerCurrencyQuantity, priceLeft / buyerPrice.exchangeRate));\n\t\t\t\t\tbuyerPrice.quantity += newQuantity;\n\t\t\t\t\tpriceLeft = Helpers.roundToDecimals(priceLeft - (newQuantity * buyerPrice.exchangeRate), decimals);\n\n\t\t\t\t\tif (priceLeft <= 0) break;\n\n\t\t\t\t}\n\n\t\t\t\tif (priceLeft > 0) {\n\t\t\t\t\tpaymentData.finalPrices = paymentData.finalPrices.sort((a, b) => b.exchangeRate - a.exchangeRate);\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpaymentData.finalPrices = paymentData.finalPrices.sort((a, b) => b.exchangeRate - a.exchangeRate);\n\n\t\t\t// Since the change will be negative, we'll need to flip it, since this is what we'll get back\n\t\t\tlet change = Math.abs(priceLeft);\n\n\t\t\tfor (const currency of currencies) {\n\n\t\t\t\tif (!change) break;\n\n\t\t\t\t// Get the remaining price, and normalize it to this currency\n\t\t\t\tlet numCurrency = Math.floor(Helpers.roundToDecimals(change / currency.exchangeRate, decimals));\n\t\t\t\tchange = Helpers.roundToDecimals(change - (numCurrency * currency.exchangeRate), decimals);\n\n\t\t\t\t// If there's some currencies to be gotten back\n\t\t\t\tif (numCurrency) {\n\t\t\t\t\t// We check if we've paid with this currency\n\t\t\t\t\tconst payment = paymentData.finalPrices.find(payment => {\n\t\t\t\t\t\treturn payment.id === currency.id || (payment.name === currency.name && payment.img === currency.img && payment.type === currency.type);\n\t\t\t\t\t});\n\t\t\t\t\tif (!payment) continue;\n\n\t\t\t\t\t// If we have paid with this currency, and we're getting some back, we can do one of two things:\n\t\t\t\t\tif ((payment.quantity - numCurrency) >= 0) {\n\t\t\t\t\t\t// Either just subtract it from the total paid if some of our payment will still remain\n\t\t\t\t\t\t// IE, the change we got back didn't cancel out the payment\n\t\t\t\t\t\tpayment.quantity -= numCurrency;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Or if it does cancel out our payment, we add that to the change we'll get back and remove the payment entirely\n\t\t\t\t\t\tpaymentData.buyerChange.push({\n\t\t\t\t\t\t\t...currency, isCurrency: true, quantity: numCurrency - payment.quantity\n\t\t\t\t\t\t});\n\t\t\t\t\t\tpayment.quantity = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Copy the final currencies that the seller will get\n\t\tpaymentData.sellerReceive = paymentData.finalPrices.map(price => {\n\t\t\treturn { ...price };\n\t\t});\n\n\t\t// But, we'll need to make sure they have enough change to _give_ to the buyer\n\t\t// We collate the total amount of change needed\n\t\tlet changeNeeded = paymentData.buyerChange.reduce((acc, change) => {\n\t\t\tconst currency = currencies.find(currency => {\n\t\t\t\treturn change.id === currency.id || (change.name === currency.name && change.img === currency.img && change.type === currency.type);\n\t\t\t});\n\t\t\treturn acc + currency.quantity >= change.quantity ? 0 : (change.quantity - currency.quantity) * change.exchangeRate;\n\t\t}, 0);\n\n\t\t// If the seller needs give the buyer some change, we'll modify the payment they'll get to cover for it\n\t\tif (changeNeeded) {\n\n\t\t\t// If the seller is being given enough of the primary currency to cover for the cost, we use that\n\t\t\tconst primaryCurrency = paymentData.sellerReceive.find(price => price.primary && (price.quantity * price.exchangeRate) > changeNeeded);\n\t\t\tif (primaryCurrency) {\n\t\t\t\tprimaryCurrency.quantity--;\n\t\t\t\tchangeNeeded -= 1 * primaryCurrency.exchangeRate;\n\t\t\t} else {\n\t\t\t\t// Otherwise, we'll use the biggest currency we can find to cover for it\n\t\t\t\tconst biggestCurrency = paymentData.sellerReceive.find(price => price.quantity && (price.quantity * price.exchangeRate) > changeNeeded);\n\t\t\t\tbiggestCurrency.quantity--;\n\t\t\t\tchangeNeeded -= 1 * biggestCurrency.exchangeRate;\n\t\t\t}\n\n\t\t\tchangeNeeded = Math.abs(changeNeeded);\n\n\t\t\t// Then loop through each currency and add enough currency so that the total adds up\n\t\t\tfor (const currency of paymentData.sellerReceive) {\n\t\t\t\tif (!changeNeeded) break;\n\t\t\t\tlet numCurrency = Math.floor(Helpers.roundToDecimals(changeNeeded / currency.exchangeRate, decimals));\n\t\t\t\tchangeNeeded = Helpers.roundToDecimals(changeNeeded - (numCurrency * currency.exchangeRate), decimals);\n\t\t\t\tcurrency.quantity += numCurrency;\n\t\t\t}\n\t\t}\n\t}\n\n\tpaymentData.finalPrices = paymentData.finalPrices.concat(paymentData.otherPrices);\n\tpaymentData.sellerReceive = paymentData.sellerReceive.concat(paymentData.otherPrices);\n\n\tpaymentData.basePriceString = paymentData.finalPrices\n\t\t.filter(price => price.cost)\n\t\t.map(price => {\n\t\t\tlet abbreviation = price.abbreviation;\n\t\t\tif (price.percent && abbreviation.includes(\"%\")) {\n\t\t\t\tabbreviation = abbreviation.replaceAll(\"%\", \"\")\n\t\t\t}\n\t\t\treturn abbreviation.replace(\"{#}\", price.cost)\n\t\t}).join(\" \");\n\n\tdelete paymentData.otherPrices;\n\n\treturn paymentData;\n\n}\n\n/* ---------------------- VAULT FUNCTIONS ---------------------- */\n\nexport function getVaultGridData(vaultActor, flagData = false) {\n\n\tconst vaultFlags = getActorFlagData(vaultActor, flagData);\n\n\tconst vaultItems = getActorItems(vaultActor);\n\tconst validVaultItems = vaultItems.filter(item => {\n\t\treturn !getItemFlagData(item).vaultExpander;\n\t});\n\n\tlet enabledCols = vaultFlags.cols;\n\tlet enabledRows = vaultFlags.rows;\n\n\tif (vaultFlags.vaultExpansion) {\n\n\t\tconst vaultExpanders = vaultItems.filter(item => {\n\t\t\treturn getItemFlagData(item).vaultExpander;\n\t\t}).map(item => ({\n\t\t\titemFlagData: getItemFlagData(item),\n\t\t\tquantity: Utilities.getItemQuantity(item)\n\t\t}))\n\n\t\tconst expansions = vaultExpanders.reduce((acc, item) => {\n\t\t\tacc.cols += (item.itemFlagData.addsCols ?? 0) * item.quantity;\n\t\t\tacc.rows += (item.itemFlagData.addsRows ?? 0) * item.quantity;\n\t\t\treturn acc;\n\t\t}, {\n\t\t\tcols: vaultFlags.baseExpansionCols ?? 0,\n\t\t\trows: vaultFlags.baseExpansionRows ?? 0\n\t\t});\n\n\t\tenabledCols = expansions.cols;\n\t\tenabledRows = expansions.rows;\n\n\t}\n\n\tenabledCols = Math.min(enabledCols, vaultFlags.cols);\n\tenabledRows = Math.min(enabledRows, vaultFlags.rows);\n\n\treturn {\n\t\ttotalSpaces: Math.max(0, (vaultFlags.cols * vaultFlags.rows)),\n\t\tenabledSpaces: Math.max(0, (enabledCols * enabledRows)),\n\t\tfreeSpaces: Math.max(0, (enabledCols * enabledRows) - validVaultItems.length),\n\t\tenabledCols: enabledCols,\n\t\tenabledRows: enabledRows,\n\t\tcols: vaultFlags.cols,\n\t\trows: vaultFlags.rows\n\t}\n\n}\n\nexport function getVaultAccess(vaultActor, { flagData = false, hasRecipient = false } = {}) {\n\n\tconst vaultFlags = getActorFlagData(vaultActor, flagData);\n\n\tconst vaultAccess = vaultFlags.vaultAccess.filter(access => {\n\t\treturn fromUuidSync(access.uuid)?.isOwner;\n\t});\n\n\treturn vaultAccess.reduce((acc, access) => {\n\t\tacc.canView = acc.canView || (access.view ?? true);\n\t\tacc.canOrganize = acc.canOrganize || access.organize;\n\t\tacc.canWithdrawItems = (acc.canWithdrawItems || access.items.withdraw) && hasRecipient;\n\t\tacc.canDepositItems = (acc.canDepositItems || access.items.deposit) && hasRecipient;\n\t\tacc.canWithdrawCurrencies = (acc.canWithdrawCurrencies || access.currencies.withdraw) && hasRecipient;\n\t\tacc.canDepositCurrencies = (acc.canDepositCurrencies || access.currencies.deposit) && hasRecipient;\n\t\treturn acc;\n\t}, {\n\t\tcanView: vaultActor.isOwner || !vaultFlags.restrictVaultAccess,\n\t\tcanOrganize: vaultActor.isOwner,\n\t\tcanWithdrawItems: vaultActor.isOwner && hasRecipient,\n\t\tcanDepositItems: vaultActor.isOwner && hasRecipient,\n\t\tcanWithdrawCurrencies: vaultActor.isOwner && hasRecipient,\n\t\tcanDepositCurrencies: vaultActor.isOwner && hasRecipient\n\t});\n\n}\n\nexport async function updateVaultLog(itemPile, {\n\tactor = false,\n\tuserId = false,\n\titems = [],\n\tattributes = [],\n\twithdrawal = true,\n\tvaultLogData = {},\n} = {}) {\n\n\tconst formattedItems = [];\n\tconst formattedCurrencies = [];\n\n\tconst currencies = getActorCurrencies(itemPile, { getAll: true });\n\n\tconst date = Date.now();\n\n\tfor (const itemData of items) {\n\t\tif (currencies.some(currency => currency.name === itemData.item.name)) {\n\t\t\tformattedCurrencies.push({\n\t\t\t\tactor: actor?.name ?? false,\n\t\t\t\tuser: userId,\n\t\t\t\tname: itemData.item.name,\n\t\t\t\tqty: itemData.quantity * (withdrawal ? -1 : 1),\n\t\t\t\taction: vaultLogData?.action ?? (withdrawal ? \"withdrew\" : \"deposited\"),\n\t\t\t\tdate\n\t\t\t});\n\t\t} else {\n\t\t\tconst item = await Item.implementation.create(itemData.item, { temporary: true });\n\t\t\tformattedItems.push({\n\t\t\t\tactor: actor?.name ?? false,\n\t\t\t\tuser: userId,\n\t\t\t\tname: item.name,\n\t\t\t\tqty: itemData.quantity * (withdrawal ? -1 : 1),\n\t\t\t\taction: vaultLogData?.action ?? (withdrawal ? \"withdrew\" : \"deposited\"),\n\t\t\t\tdate\n\t\t\t});\n\t\t}\n\t}\n\n\tfor (const [key, quantity] of Object.entries(attributes)) {\n\t\tconst currency = currencies.find(currency => currency.data.path === key);\n\t\tif (currency) {\n\t\t\tformattedCurrencies.push({\n\t\t\t\tactor: actor?.name ?? false,\n\t\t\t\tuser: userId,\n\t\t\t\tname: currency.name,\n\t\t\t\tqty: quantity * (withdrawal ? -1 : 1),\n\t\t\t\taction: vaultLogData?.action ?? (withdrawal ? \"withdrew\" : \"deposited\"),\n\t\t\t\tdate\n\t\t\t});\n\t\t}\n\t}\n\n\tconst vaultLog = getActorVaultLog(itemPile);\n\n\treturn itemPile.update({\n\t\t[CONSTANTS.FLAGS.LOG]: formattedItems.concat(formattedCurrencies).concat(vaultLog)\n\t});\n}\n\nexport function getActorVaultLog(actor) {\n\treturn getProperty(Utilities.getActor(actor), CONSTANTS.FLAGS.LOG) || [];\n}\n\nexport function clearVaultLog(actor) {\n\treturn actor.update({\n\t\t[CONSTANTS.FLAGS.LOG]: []\n\t});\n}\n\n/**\n *\n * @param tableUuid\n * @param formula\n * @param resetTable\n * @param normalize\n * @param displayChat\n * @param rollData\n * @param customCategory\n * @returns {Promise<[object]>}\n */\nexport async function rollTable({\n\ttableUuid,\n\tformula = \"1\",\n\tresetTable = true,\n\tnormalize = false,\n\tdisplayChat = false,\n\trollData = {},\n\tcustomCategory = false\n} = {}) {\n\n\tconst rolledItems = [];\n\n\tconst table = await fromUuid(tableUuid);\n\n\tif (!tableUuid.startsWith(\"Compendium\")) {\n\t\tif (resetTable) {\n\t\t\tawait table.reset();\n\t\t}\n\n\t\tif (normalize) {\n\t\t\tawait table.update({\n\t\t\t\tresults: table.results.map(result => ({\n\t\t\t\t\t_id: result.id, weight: result.range[1] - (result.range[0] - 1)\n\t\t\t\t}))\n\t\t\t});\n\t\t\tawait table.normalize();\n\t\t}\n\t}\n\n\tconst roll = new Roll(formula.toString(), rollData).evaluate({ async: false });\n\tif (roll.total <= 0) {\n\t\treturn [];\n\t}\n\n\tlet results;\n\tif (game.modules.get(\"better-rolltables\")?.active) {\n\t\tresults = (await game.betterTables.roll(table)).itemsData.map(result => {\n\t\t\treturn {\n\t\t\t\tdocumentCollection: result.compendiumName || result.documentName,\n\t\t\t\tdocumentId: result.item.id,\n\t\t\t\ttext: result.item.text || result.item.name,\n\t\t\t\timg: result.item.img,\n\t\t\t\tquantity: result.quantity\n\t\t\t}\n\t\t})\n\t} else {\n\t\tresults = (await table.drawMany(roll.total, { displayChat, recursive: true })).results;\n\t}\n\n\tfor (const rollData of results) {\n\n\t\tlet rolledQuantity = rollData?.quantity ?? 1;\n\n\t\tlet item;\n\t\tif (rollData.documentCollection === \"Item\") {\n\t\t\titem = game.items.get(rollData.documentId);\n\t\t} else {\n\t\t\tconst compendium = game.packs.get(rollData.documentCollection);\n\t\t\tif (compendium) {\n\t\t\t\titem = await compendium.getDocument(rollData.documentId);\n\t\t\t}\n\t\t}\n\n\t\tif (item instanceof RollTable) {\n\t\t\trolledItems.push(...(await rollTable({ tableUuid: item.uuid, resetTable, normalize, displayChat })))\n\t\t} else if (item instanceof Item) {\n\t\t\tconst quantity = Math.max(Utilities.getItemQuantity(item) * rolledQuantity, 1);\n\t\t\trolledItems.push({\n\t\t\t\t...rollData,\n\t\t\t\titem,\n\t\t\t\tquantity\n\t\t\t});\n\t\t}\n\n\t}\n\n\tconst items = [];\n\n\trolledItems.forEach(newItem => {\n\n\t\tconst existingItem = items.find(\n\t\t\t(item) => item.documentId === newItem.documentId\n\t\t);\n\t\tif (existingItem) {\n\t\t\texistingItem.quantity += Math.max(newItem.quantity, 1);\n\t\t} else {\n\t\t\tsetProperty(newItem, \"flags\", newItem.item.flags);\n\t\t\tif (game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE && !getProperty(newItem, game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE)) {\n\t\t\t\tsetProperty(newItem, game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE, Utilities.getItemQuantity(newItem.item));\n\t\t\t}\n\t\t\tif (customCategory) {\n\t\t\t\tsetProperty(newItem, CONSTANTS.FLAGS.CUSTOM_CATEGORY, customCategory);\n\t\t\t}\n\t\t\titems.push({\n\t\t\t\t...newItem\n\t\t\t});\n\t\t}\n\t})\n\n\treturn items;\n\n}\n\nexport async function rollMerchantTables({ tableData = false, actor = false } = {}) {\n\n\tif (tableData && !Array.isArray(tableData)) {\n\t\ttableData = [tableData]\n\t} else if (!tableData && actor) {\n\t\tconst flagData = getActorFlagData(actor);\n\t\ttableData = flagData.tablesForPopulate;\n\t} else if (!tableData && !actor) {\n\t\treturn [];\n\t}\n\n\tlet items = [];\n\n\tfor (const table of tableData) {\n\n\t\tconst rollableTable = await fromUuid(table.uuid);\n\n\t\tif (!rollableTable) continue;\n\n\t\tif (!table.uuid.startsWith(\"Compendium\")) {\n\t\t\tawait rollableTable.reset();\n\t\t}\n\n\t\tlet tableItems = [];\n\n\t\tif (table.addAll) {\n\n\t\t\tfor (const [itemId, formula] of Object.entries(table.items)) {\n\t\t\t\tconst roll = new Roll(formula).evaluate({ async: false });\n\t\t\t\tif (roll.total <= 0) continue;\n\t\t\t\tconst rollResult = rollableTable.results.get(itemId).toObject();\n\t\t\t\tconst potentialPack = game.packs.get(rollResult.documentCollection);\n\t\t\t\tif (rollResult.documentCollection === \"RollTable\" || potentialPack?.documentName === \"RollTable\") {\n\t\t\t\t\tconst subTable = await getTable(rollResult);\n\t\t\t\t\titems.push(...(await rollMerchantTables({\n\t\t\t\t\t\ttableData: [{\n\t\t\t\t\t\t\tuuid: subTable.uuid,\n\t\t\t\t\t\t\taddAll: false,\n\t\t\t\t\t\t\ttimesToRoll: roll.total,\n\t\t\t\t\t\t\tcustomCategory: table.customCategory\n\t\t\t\t\t\t}], actor\n\t\t\t\t\t})))\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst item = await getItem(rollResult);\n\t\t\t\tif (!item) continue;\n\t\t\t\tconst quantity = roll.total * Math.max(Utilities.getItemQuantity(item), 1);\n\t\t\t\ttableItems.push({\n\t\t\t\t\t...rollResult,\n\t\t\t\t\tcustomCategory: table.customCategory,\n\t\t\t\t\titem,\n\t\t\t\t\tquantity\n\t\t\t\t})\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst roll = new Roll((table.timesToRoll ?? \"1\").toString()).evaluate({ async: false });\n\n\t\t\tif (roll.total <= 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\ttableItems = await rollTable({\n\t\t\t\ttableUuid: table.uuid,\n\t\t\t\tformula: roll.total\n\t\t\t})\n\n\t\t\ttableItems.forEach(item => {\n\t\t\t\tif (table.customCategory) {\n\t\t\t\t\tsetProperty(item, CONSTANTS.FLAGS.CUSTOM_CATEGORY, table.customCategory);\n\t\t\t\t}\n\t\t\t});\n\n\t\t}\n\n\t\ttableItems.forEach(newItem => {\n\t\t\tconst existingItem = items.find(\n\t\t\t\t(item) => item.documentId === newItem.documentId\n\t\t\t);\n\t\t\tif (existingItem) {\n\t\t\t\texistingItem.quantity += Math.max(newItem.quantity, 1);\n\t\t\t} else {\n\t\t\t\tsetProperty(newItem, \"flags\", newItem.item.flags);\n\t\t\t\tif (game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE && !getProperty(newItem, game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE)) {\n\t\t\t\t\tsetProperty(newItem, game.itempiles.API.QUANTITY_FOR_PRICE_ATTRIBUTE, Utilities.getItemQuantity(newItem.item));\n\t\t\t\t}\n\t\t\t\tif (newItem.customCategory) {\n\t\t\t\t\tsetProperty(newItem, CONSTANTS.FLAGS.CUSTOM_CATEGORY, newItem.customCategory);\n\t\t\t\t}\n\t\t\t\titems.push({\n\t\t\t\t\t...newItem,\n\t\t\t\t\tquantity: newItem.quantity\n\t\t\t\t});\n\t\t\t}\n\t\t})\n\t}\n\n\treturn items;\n}\n\nasync function getTable(tableToGet) {\n\tlet table;\n\tif (tableToGet.documentCollection === \"RollTable\") {\n\t\ttable = game.tables.get(tableToGet.documentId);\n\t} else {\n\t\tconst compendium = game.packs.get(tableToGet.documentCollection);\n\t\tif (compendium) {\n\t\t\ttable = await compendium.getDocument(tableToGet.documentId);\n\t\t}\n\t}\n\treturn table;\n}\n\nasync function getItem(itemToGet) {\n\tlet item;\n\tif (itemToGet.documentCollection === \"Item\") {\n\t\titem = game.items.get(itemToGet.documentId);\n\t} else {\n\t\tconst compendium = game.packs.get(itemToGet.documentCollection);\n\t\tif (compendium) {\n\t\t\titem = await compendium.getDocument(itemToGet.documentId);\n\t\t}\n\t}\n\treturn item;\n}\n","<script>\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n import FilePicker from \"./FilePicker.svelte\";\n import { flip } from \"svelte/animate\";\n import { dndzone, SOURCES, TRIGGERS } from 'svelte-dnd-action';\n import DropZone from \"./DropZone.svelte\";\n import * as Helpers from \"../../helpers/helpers.js\";\n import { getSetting } from \"../../helpers/helpers.js\";\n import * as Utilities from \"../../helpers/utilities.js\";\n import CONSTANTS from \"../../constants/constants.js\";\n import SETTINGS from \"../../constants/settings.js\";\n import { getActorFlagData } from \"../../helpers/pile-utilities.js\";\n import * as CompendiumUtilities from \"../../helpers/compendium-utilities.js\";\n import { findOrCreateItemInCompendium } from \"../../helpers/compendium-utilities.js\";\n\n export let prices;\n export let item;\n export let remove = false;\n export let presets = true;\n\n let currencies = getSetting(SETTINGS.CURRENCIES);\n let secondaryCurrencies = getSetting(SETTINGS.SECONDARY_CURRENCIES);\n if (item?.parent) {\n const flags = getActorFlagData(item?.parent)\n if (flags.overrideCurrencies) {\n currencies = flags.overrideCurrencies;\n }\n if (flags.overrideSecondaryCurrencies) {\n secondaryCurrencies = flags.overrideSecondaryCurrencies;\n }\n }\n\n let presetPrices = currencies\n .concat(secondaryCurrencies)\n .map(currency => {\n return {\n id: randomID(),\n quantity: 1,\n fixed: true,\n percent: false,\n ...currency,\n }\n })\n .concat(getSetting(SETTINGS.PRICE_PRESETS));\n\n let isHovering = false;\n let flipDurationMs = 200;\n let dragDisabled = true;\n let selectedPreset = \"\";\n\n function removeEntry(index) {\n prices.splice(index, 1);\n prices = prices;\n }\n\n function addAttribute() {\n prices = [...prices, {\n id: randomID(),\n type: \"attribute\",\n name: \"New Attribute\",\n img: \"\",\n abbreviation: \"{#}N\",\n data: {\n path: \"\"\n },\n quantity: 1,\n fixed: true,\n percent: false\n }];\n }\n\n function addPreset(index) {\n const preset = foundry.utils.duplicate(presetPrices[index]);\n preset.id = randomID();\n prices = [...prices, preset];\n }\n\n async function dropData(data) {\n\n if (!data.type) {\n throw Helpers.custom_error(\"Something went wrong when dropping this item!\")\n }\n\n if (data.type !== \"Item\") {\n throw Helpers.custom_error(\"You must drop an item, not \" + data.type.toLowerCase() + \"!\")\n }\n\n let uuid = false;\n if (data.pack) {\n uuid = \"Compendium\" + data.pack + \".\" + data.id;\n }\n\n let item = await Item.implementation.fromDropData(data);\n let itemData = item.toObject();\n\n if (!itemData) {\n console.error(data);\n throw Helpers.custom_error(\"Something went wrong when dropping this item!\")\n }\n\n const itemCurrencies = prices.map(entry => entry.data?.item ?? {});\n const foundItem = Utilities.findSimilarItem(itemCurrencies, itemData);\n\n if (!uuid) {\n uuid = (await CompendiumUtilities.findOrCreateItemInCompendium(itemData)).uuid;\n }\n\n if (foundItem) {\n const index = itemCurrencies.indexOf(foundItem);\n prices[index].data = {\n uuid,\n }\n Helpers.custom_notify(`Updated item data for ${localize(prices[index].name)} (item name ${itemData.name})`)\n } else {\n prices = [...prices, {\n id: randomID(),\n type: \"item\",\n name: itemData.name,\n img: itemData.img,\n abbreviation: \"{#} \" + itemData.name,\n data: {\n uuid,\n },\n quantity: 1,\n fixed: true,\n percent: false\n }];\n }\n }\n\n async function editItem(index) {\n const data = prices[index].data;\n let item = await fromUuid(data.uuid);\n item.sheet.render(true);\n }\n\n function handleConsider(e) {\n const { items: newItems, info: { source, trigger } } = e.detail;\n prices = newItems;\n // Ensure dragging is stopped on drag finish via keyboard\n if (source === SOURCES.KEYBOARD && trigger === TRIGGERS.DRAG_STOPPED) {\n dragDisabled = true;\n }\n }\n\n function handleFinalize(e) {\n const { items: newItems, info: { source } } = e.detail;\n prices = newItems;\n // Ensure dragging is stopped on drag finish via pointer (mouse, touch)\n if (source === SOURCES.POINTER) {\n dragDisabled = true;\n }\n }\n\n function startDrag(e) {\n // preventing default to prevent lag on touch devices (because of the browser checking for screen scrolling)\n e.preventDefault();\n dragDisabled = false;\n }\n\n function handleKeyDown(e) {\n if ((e.key === \"Enter\" || e.key === \" \") && dragDisabled) dragDisabled = false;\n }\n\n</script>\n\n\n<DropZone bind:isHovering={isHovering} callback={dropData}>\n\t<div class=\"table-container item-piles-top-divider\">\n\t\t<div class=\"item-piles-sortable-list-columns header\">\n\t\t\t<div></div>\n\t\t\t<div>Name</div>\n\t\t\t<div>Cost</div>\n\t\t\t<div>Fixed</div>\n\t\t\t<div>%</div>\n\t\t\t<div>Short</div>\n\t\t\t<div>Icon</div>\n\t\t\t<div>Data</div>\n\t\t\t<div>\n\t\t\t\t{#if remove}\n\t\t\t\t\t<a class=\"item-piles-clickable-red\" on:click={() => remove()}><i class=\"fas fa-times\"></i></a>\n\t\t\t\t{/if}\n\t\t\t</div>\n\t\t</div>\n\t\t<section\n\t\t\ton:consider=\"{handleConsider}\"\n\t\t\ton:finalize=\"{handleFinalize}\"\n\t\t\tuse:dndzone=\"{{ items: prices, dragDisabled, flipDurationMs }}\"\n\t\t>\n\t\t\t{#if isHovering}\n\t\t\t\t<div class=\"drop-to-add\">Drop to add</div>\n\t\t\t{/if}\n\t\t\t{#each prices as price, index (price.id)}\n\t\t\t\t<div class=\"item-piles-sortable-list-columns item-piles-sortable-list-entry item-piles-even-color\"\n\t\t\t\t\t\t animate:flip=\"{{ duration: flipDurationMs }}\">\n\t\t\t\t\t<div tabIndex={dragDisabled? 0 : -1}\n\t\t\t\t\t\t\t aria-label=\"drag-handle\"\n\t\t\t\t\t\t\t style={dragDisabled ? 'cursor: grab' : 'cursor: grabbing'}\n\t\t\t\t\t\t\t on:mousedown={startDrag}\n\t\t\t\t\t\t\t on:touchstart={startDrag}\n\t\t\t\t\t\t\t on:keydown={handleKeyDown}\n\t\t\t\t\t><i class=\"fas fa-bars\"></i></div>\n\t\t\t\t\t<div><input type=\"text\" bind:value={price.name}/></div>\n\t\t\t\t\t<div><input type=\"number\" bind:value={price.quantity}/></div>\n\t\t\t\t\t<div><input type=\"checkbox\" bind:checked={price.fixed} min=\"0\"\n\t\t\t\t\t\t\t\t\t\t\tmax=\"{price.percent ? 100 : 1000000000000000}\"/></div>\n\t\t\t\t\t<div><input type=\"checkbox\" bind:checked={price.percent}/></div>\n\t\t\t\t\t<div><input type=\"text\" bind:value={price.abbreviation}/></div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<FilePicker type=\"imagevideo\" showImage={true} showInput={false} bind:value={price.img}/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{#if price.type === \"attribute\"}\n\t\t\t\t\t\t\t<input type=\"text\" bind:value={price.data.path} placeholder=\"system.attributes.hp.value\"/>\n\t\t\t\t\t\t{:else}\n\t\t\t\t\t\t\t<button type=\"button\" on:click={() => editItem(index)}>\n\t\t\t\t\t\t\t\t<i class=\"fas fa-eye\"></i> View item\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t{/if}\n\t\t\t\t\t</div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<button type=\"button\" on:click={() => removeEntry(index)}><i class=\"fas fa-times\"></i></button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t{/each}\n\t\t\t<div class=\"item-piles-sortable-list-columns\" style=\"margin-top: 0.5rem;\">\n\t\t\t\t<div class=\"full-span\">\n\t\t\t\t\t<a class:invisible={isHovering} on:click={() => addAttribute()}>\n\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.ItemEditor.DropMeClickMe\")}\n\t\t\t\t\t</a>\n\t\t\t\t</div>\n\t\t\t\t{#if presetPrices.length && presets}\n\t\t\t\t\t<div class=\"full-span\" style=\"margin-top:0.5rem;\">\n\t\t\t\t\t\t<span style=\"margin-right:0.25rem;\">{localize(\"ITEM-PILES.Applications.ItemEditor.PricePreset\")}</span>\n\t\t\t\t\t\t<select class=\"price-preset-selector\" bind:value={selectedPreset}\n\t\t\t\t\t\t\t\t\t\ton:change={() => { addPreset(selectedPreset); selectedPreset = \"\"; }}>\n\t\t\t\t\t\t\t<option value=\"\">{localize(\"ITEM-PILES.Applications.ItemEditor.SelectPreset\")}</option>\n\t\t\t\t\t\t\t{#each presetPrices as price, index (index)}\n\t\t\t\t\t\t\t\t<option value={index}>{price.name}</option>\n\t\t\t\t\t\t\t{/each}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>\n\t\t\t\t{/if}\n\t\t\t</div>\n\t\t</section>\n\t</div>\n</DropZone>\n\n<style lang=\"scss\">\n\n .price-preset-selector {\n height: 20px;\n font-size: 0.8rem;\n }\n\n .item-piles-sortable-list-columns {\n grid-template-columns: 28px 1.1fr 35px 28px 28px 0.5fr 60px 1fr 28px;\n min-height: 30px;\n }\n\n .item-piles-sortable-list-entry {\n border: 1px solid rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n }\n\n .item-piles-even-color {\n &:nth-child(even) {\n background-color: #e5e5d6;\n }\n\n &:nth-child(odd) {\n background-color: #f8f8e7;\n }\n }\n\n .invisible {\n opacity: 0;\n }\n\n .table-container {\n position: relative;\n }\n\n .drop-to-add {\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n border-radius: 5px;\n box-shadow: inset 0 0 15px 5px rgb(0, 0, 0, 0.5);\n background-color: rgba(255, 255, 255, 0.75);\n z-index: 100000;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 1.5rem;\n overflow: hidden;\n }\n\n .full-span {\n grid-column: 1/-1;\n }\n\n</style>\n","<script>\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import PriceList from \"../../components/PriceList.svelte\";\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let data;\r\n export let elementRoot;\r\n let form;\r\n\r\n let prices = foundry.utils.deepClone(data);\r\n\r\n async function updateSettings() {\r\n application.options.resolve(prices);\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<form autocomplete=off bind:this={form} class=\"item-piles-config-container\" on:submit|preventDefault={updateSettings}>\r\n\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.PricePresetEditor.Explanation\")}</p>\r\n\r\n\t\t<PriceList bind:prices presets={false}/>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"ITEM-PILES.Applications.PricePresetEditor.Update\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n\r\n</ApplicationShell>\r\n\r\n<style lang=\"scss\">\r\n\r\n p {\r\n font-size: 0.8rem;\r\n text-align: center;\r\n line-height: 1rem;\r\n }\r\n\r\n table {\r\n\r\n td {\r\n vertical-align: middle;\r\n }\r\n\r\n tr {\r\n\r\n &.is-active {\r\n background-color: #3273dc;\r\n color: #fff;\r\n }\r\n\r\n &.is-dragging {\r\n background-color: rgba(50, 220, 132, 0.55);\r\n color: #fff;\r\n }\r\n }\r\n\r\n .small {\r\n width: 26px;\r\n }\r\n\r\n button {\r\n padding: 0.25rem 0.25rem;\r\n line-height: 1rem;\r\n flex: 0;\r\n text-align: center;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n }\r\n\r\n a {\r\n text-align: center;\r\n }\r\n }\r\n\r\n</style>\r\n","import PricePresetEditorShell from \"./price-preset-editor-shell.svelte\";\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport default class PricePresetEditor extends Editor {\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n id: `item-pile-price-preset-editor-${randomID()}`,\r\n title: game.i18n.format(\"ITEM-PILES.Applications.PricePresetEditor.Title\"),\r\n width: 500,\r\n svelte: {\r\n class: PricePresetEditorShell,\r\n }\r\n })\r\n }\r\n}\r\n","<script>\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { get, writable } from \"svelte/store\";\r\n import SETTINGS from \"../../../constants/settings.js\";\r\n import { getSetting } from \"../../../helpers/helpers.js\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n let form;\r\n\r\n export let elementRoot;\r\n export let data;\r\n\r\n const itemFilters = (getSetting(SETTINGS.ITEM_FILTERS).find(filter => filter.path === \"type\")?.filters ?? \"\").split(',');\r\n\r\n const unstackableItemTypesStore = writable(data);\r\n let systemTypes = game.system.template.Item.types.filter(type => !itemFilters.includes(type));\r\n let unusedTypes = [];\r\n\r\n $: {\r\n unusedTypes = systemTypes.filter(systemType => !$unstackableItemTypesStore.some(type => type === systemType));\r\n }\r\n\r\n function add() {\r\n if (!unusedTypes.length) return;\r\n unstackableItemTypesStore.update(arr => {\r\n arr.push(unusedTypes[0]);\r\n return arr;\r\n })\r\n }\r\n\r\n function remove(index) {\r\n unstackableItemTypesStore.update(arr => {\r\n arr.splice(index, 1)\r\n return arr;\r\n })\r\n }\r\n\r\n async function updateSettings() {\r\n application.options.resolve(get(unstackableItemTypesStore));\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\t<form autocomplete=off bind:this={form} on:submit|preventDefault={updateSettings}>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.UnstackableItemTypesEditor.Explanation\")}</p>\r\n\r\n\t\t<table>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>{localize(\"ITEM-PILES.Applications.UnstackableItemTypesEditor.Type\")}</th>\r\n\t\t\t\t<th class=\"small\"><a class=\"item-piles-clickable\" on:click={add}><i class=\"fas fa-plus\"></i></a></th>\r\n\t\t\t</tr>\r\n\t\t\t{#each $unstackableItemTypesStore as type, index (index)}\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td>\r\n\t\t\t\t\t\t<select bind:value={type}>\r\n\t\t\t\t\t\t\t{#each systemTypes as systemType}\r\n\t\t\t\t\t\t\t\t<option value=\"{systemType}\" disabled=\"{systemType !== type && !unusedTypes.includes(systemType)}\">\r\n\t\t\t\t\t\t\t\t\t{systemType}\r\n\t\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t\t{/each}\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td class=\"small\">\r\n\t\t\t\t\t\t<button type=\"button\" on:click={remove(index)}><i class=\"fas fa-times\"></i></button>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t{/each}\r\n\t\t</table>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"Save\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n table {\r\n vertical-align: middle;\r\n\r\n tr {\r\n border-spacing: 15px;\r\n }\r\n\r\n .small {\r\n width: 26px;\r\n }\r\n\r\n select {\r\n width: 100%;\r\n }\r\n\r\n button {\r\n padding: 0.25rem 0.25rem;\r\n line-height: 1rem;\r\n flex: 0;\r\n text-align: center;\r\n }\r\n\r\n a {\r\n text-align: center;\r\n }\r\n }\r\n\r\n</style>\r\n","import UnstackableItemTypesEditorShell from './unstackable-item-types-editor.svelte';\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport default class UnstackableItemTypesEditor extends Editor {\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: game.i18n.localize(\"ITEM-PILES.Applications.UnstackableItemTypesEditor.Title\"),\r\n width: 300,\r\n svelte: {\r\n class: UnstackableItemTypesEditorShell,\r\n },\r\n })\r\n }\r\n}\r\n","<script>\r\n\r\n import { get, writable } from \"svelte/store\";\r\n import { getContext } from \"svelte\";\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let data;\r\n export let elementRoot;\r\n\r\n let form;\r\n\r\n const options = application.options;\r\n\r\n const styleValues = data?.subscribe ? data : writable(data);\r\n\r\n const styleStore = Object.entries(get(styleValues));\r\n let values = writable(styleStore.length ? styleStore : [[\"\", \"\"]])\r\n\r\n function add() {\r\n values.update(arr => {\r\n return [...arr, [\"\", \"\"]];\r\n })\r\n }\r\n\r\n function remove(index) {\r\n values.update(arr => {\r\n arr.splice(index, 1);\r\n return arr;\r\n })\r\n }\r\n\r\n $: {\r\n const data = Object.fromEntries($values\r\n .map(entry => [entry[0].trim(), entry[1].trim()])\r\n .filter(entry => entry[0].length && entry[1].length)\r\n );\r\n styleValues.set(data);\r\n if (options.onchange) {\r\n options.onchange(data);\r\n }\r\n }\r\n\r\n async function updateSettings() {\r\n application.options.resolve(Object.fromEntries(get(values)));\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<form autocomplete=off bind:this={form} on:submit|preventDefault={updateSettings}>\r\n\r\n\t\t<div class=\"item-piles-bottom-divider\"\r\n\t\t\t\t style=\"display: grid; grid-template-columns: 1.25fr 2fr {options.readOnly ? '' : 'auto'}; gap: 5px;\">\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.StylesEditor.\" + (options.variables ? \"Variable\" : \"Style\"))}</span>\r\n\t\t\t<span>{localize(\"ITEM-PILES.Applications.StylesEditor.Value\")}</span>\r\n\t\t\t{#if !options.readOnly}\r\n\t\t\t\t<a class=\"item-piles-flexrow align-center-row item-piles-clickable-green\" style=\"text-align: center;\"\r\n\t\t\t\t\t on:click={() => add()}>\r\n\t\t\t\t\t<i class=\"fas fa-plus\"></i>\r\n\t\t\t\t</a>\r\n\t\t\t{/if}\r\n\r\n\t\t\t{#each $values as [key, value], index (index)}\r\n\t\t\t\t<input disabled={options.readOnly} autocomplete=\"false\" type=\"text\" bind:value={key}/>\r\n\t\t\t\t<input autocomplete=\"false\" type=\"text\" bind:value={value}/>\r\n\t\t\t\t{#if !options.readOnly}\r\n\t\t\t\t\t<a class=\"item-piles-flexrow align-center-row\" style=\"text-align: center;\" on:click={() => remove(index)}>\r\n\t\t\t\t\t\t<i class=\"fas fa-times item-piles-clickable-red\"></i>\r\n\t\t\t\t\t</a>\r\n\t\t\t\t{/if}\r\n\t\t\t{/each}\r\n\r\n\t\t</div>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"Save\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.options.resolve(null); application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n\r\n</ApplicationShell>\r\n","import StylesEditorShell from './styles-editor.svelte';\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport default class StylesEditor extends Editor {\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: game.i18n.localize(\"ITEM-PILES.Applications.StylesEditor.Title\"),\r\n svelte: {\r\n class: StylesEditorShell,\r\n }\r\n })\r\n }\r\n}\r\n","<script>\r\n\r\n import * as Helpers from \"../../../helpers/helpers.js\";\r\n import { writable } from \"svelte/store\";\r\n import { getContext } from \"svelte\";\r\n import StylesEditor from \"../styles-editor/styles-editor.js\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let index;\r\n export let entry;\r\n export let image;\r\n export let remove;\r\n\r\n let style = writable(entry.styling);\r\n\r\n async function renderStyleEditor(event) {\r\n\r\n const oldStyle = entry.styling;\r\n\r\n const newStyles = await StylesEditor.show(style, {\r\n width: 400,\r\n left: application.position.left + 405,\r\n top: event.clientY - 75,\r\n readOnly: true\r\n });\r\n\r\n style.set(newStyles || oldStyle);\r\n entry.styling = newStyles || oldStyle;\r\n\r\n }\r\n\r\n</script>\r\n\r\n<div><input bind:value=\"{entry.path}\" placeholder=\"system.rarity\" required type=\"text\"/></div>\r\n<div><input bind:value=\"{entry.value}\" placeholder=\"rare\" required type=\"text\"/></div>\r\n<div>\r\n\t{#if image}\r\n\t\t<img class=\"item-piles-item-image-example\" src={image}/>\r\n\t{/if}\r\n\t<div class=\"img-div\" style={Helpers.styleFromObject($style)}></div>\r\n</div>\r\n<div>\r\n\t<a class=\"item-piles-clickable-green\" on:click={(evt) => renderStyleEditor(evt)}>\r\n\t\t<i class=\"fas fa-cog\"></i>\r\n\t</a>\r\n</div>\r\n<div>\r\n\t<a class=\"item-piles-clickable-red\" on:click={remove(index)}>\r\n\t\t<i class=\"fas fa-times\"></i>\r\n\t</a>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n div {\r\n display: flex;\r\n align-items: center;\r\n position: relative;\r\n justify-content: center;\r\n\r\n img, .img-div {\r\n position: absolute;\r\n border-radius: 4px;\r\n min-height: 24px;\r\n min-width: 24px;\r\n max-height: 24px;\r\n max-width: 24px;\r\n }\r\n\r\n a {\r\n padding: 0;\r\n line-height: inherit;\r\n text-align: center;\r\n\r\n > i {\r\n line-height: inherit;\r\n margin: 0;\r\n }\r\n }\r\n }\r\n\r\n</style>\r\n","<script>\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { get, writable } from \"svelte/store\";\r\n import StyleEntry from \"./StyleEntry.svelte\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n let form;\r\n\r\n export let elementRoot;\r\n export let data;\r\n\r\n const vaultStyleStore = writable(data);\r\n\r\n loadImages();\r\n\r\n function add() {\r\n vaultStyleStore.update(arr => {\r\n arr.push({ path: \"\", value: \"\", styling: {} })\r\n return arr;\r\n });\r\n }\r\n\r\n let images = [];\r\n\r\n async function loadImages() {\r\n const data = await FilePicker.browse(\"public\", \"icons/weapons/swords/*.webp\", { wildcard: true });\r\n images = data.files;\r\n }\r\n\r\n function remove(index) {\r\n vaultStyleStore.update(arr => {\r\n arr.splice(index, 1)\r\n return arr;\r\n });\r\n }\r\n\r\n async function updateSettings() {\r\n application.options.resolve(get(vaultStyleStore));\r\n application.close();\r\n }\r\n\r\n export function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\t<form autocomplete=off bind:this={form} on:submit|preventDefault={updateSettings}>\r\n\t\t<p>{localize(\"ITEM-PILES.Applications.VaultStylesEditor.Explanation\")}</p>\r\n\r\n\t\t<div class=\"item-piles-table\">\r\n\t\t\t<div>{localize(\"ITEM-PILES.Applications.VaultStylesEditor.Path\")}</div>\r\n\t\t\t<div>{localize(\"ITEM-PILES.Applications.VaultStylesEditor.Value\")}</div>\r\n\t\t\t<div></div>\r\n\t\t\t<div></div>\r\n\t\t\t<div style=\"text-align: right;\"><a class=\"item-piles-clickable\" on:click={add}><i class=\"fas fa-plus\"></i></a>\r\n\t\t\t</div>\r\n\r\n\t\t\t{#each $vaultStyleStore as entry, index (index)}\r\n\t\t\t\t<StyleEntry bind:entry image={images[index]} {index} {remove}/>\r\n\t\t\t{/each}\r\n\t\t</div>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"Save\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={() => { application.close(); }} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-times\"></i> { localize(\"Cancel\") }\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</form>\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-piles-table {\r\n display: grid;\r\n grid-template-columns: 1fr 1fr 26px 21px 21px;\r\n padding: 3px;\r\n gap: 3px;\r\n\r\n div > a {\r\n display: flex;\r\n align-items: center;\r\n position: relative;\r\n justify-content: center;\r\n\r\n a {\r\n padding: 0;\r\n line-height: inherit;\r\n text-align: center;\r\n\r\n\r\n > i {\r\n line-height: inherit;\r\n margin: 0;\r\n }\r\n }\r\n }\r\n }\r\n\r\n</style>\r\n","import VaultStylesEditorShell from './vault-styles-editor.svelte';\r\nimport Editor from \"../Editor.js\";\r\n\r\nexport default class VaultStylesEditor extends Editor {\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: game.i18n.localize(\"ITEM-PILES.Applications.VaultStylesEditor.Title\"),\r\n svelte: {\r\n class: VaultStylesEditorShell,\r\n }\r\n })\r\n }\r\n}\r\n","import { CurrenciesEditor, SecondaryCurrenciesEditor } from \"./currencies-editor/currencies-editor.js\";\r\nimport ItemFiltersEditor from \"./item-filters-editor/item-filters-editor.js\";\r\nimport StringListEditor from \"./string-list-editor/string-list-editor.js\";\r\nimport PriceModifiersEditor from \"./price-modifiers-editor/price-modifiers-editor.js\";\r\nimport PricePresetEditor from \"./price-preset-editor/price-preset-editor.js\";\r\nimport UnstackableItemTypesEditor from \"./unstackable-item-types-editor/unstackable-item-types-editor.js\";\r\nimport VaultStylesEditor from \"./vault-styles-editor/vault-styles-editor.js\";\r\nimport StylesEditor from \"./styles-editor/styles-editor.js\";\r\n\r\nexport default {\r\n \"currencies\": CurrenciesEditor,\r\n \"secondary-currencies\": SecondaryCurrenciesEditor,\r\n \"item-filters\": ItemFiltersEditor,\r\n \"item-similarities\": StringListEditor,\r\n \"item-categories\": StringListEditor,\r\n \"styles\": StylesEditor,\r\n \"vault-styles\": VaultStylesEditor,\r\n \"price-modifiers\": PriceModifiersEditor,\r\n \"unstackable-item-types\": UnstackableItemTypesEditor,\r\n \"price-presets\": PricePresetEditor\r\n}\r\n","<script>\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { getContext } from 'svelte';\r\n import editors from \"../editors/index.js\";\r\n import { openEditor } from \"../../helpers/helpers.js\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let key;\r\n export let data;\r\n export let callback = false;\r\n\r\n let editor = false;\r\n if (!callback) {\r\n editor = editors[data.application];\r\n callback = () => {\r\n showEditor();\r\n }\r\n }\r\n\r\n function showEditor() {\r\n if (editor) {\r\n const combinedData = data?.mergedDefaults\r\n ? foundry.utils.mergeObject(data.mergedDefaults, data.value)\r\n : data.value;\r\n openEditor(key, combinedData).then((result) => {\r\n if (!result) return;\r\n if (data?.mergedDefaults) {\r\n result = foundry.utils.diffObject(data?.mergedDefaults, result);\r\n }\r\n data.value = result;\r\n });\r\n application.options.zLevel = 100;\r\n }\r\n }\r\n\r\n function reset() {\r\n data.value = foundry.utils.deepClone(data.default);\r\n }\r\n\r\n</script>\r\n\r\n<div class=\"setting form-scope item-piles-flexrow\">\r\n\r\n\t<div class=\"label-side\">\r\n\t\t<label>\r\n\t\t\t{localize(data.name)}\r\n\t\t\t{#if !data.hideResetButton}\r\n\t\t\t\t<a on:click={() => reset()} data-fast-tooltip=\"Reset setting\">\r\n\t\t\t\t\t<i class=\"fas fa-undo reset-setting\"></i>\r\n\t\t\t\t</a>\r\n\t\t\t{/if}\r\n\t\t</label>\r\n\t\t<p class=\"notes\">{localize(data.hint)}</p>\r\n\t</div>\r\n\r\n\t<div class=\"form-fields input-side\">\r\n\t\t<div class=\"button-container\">\r\n\t\t\t<button on:click={() => { callback(); }} type=\"button\">\r\n\t\t\t\t<i class=\"{data.icon}\"></i>\r\n\t\t\t\t{localize(data.label)}\r\n\t\t\t</button>\r\n\t\t</div>\r\n\t</div>\r\n\r\n</div>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .setting:not(:last-child) {\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.25);\r\n margin-bottom: 0.5rem;\r\n padding-bottom: 0.5rem;\r\n }\r\n\r\n .reset-setting {\r\n font-size: 0.75rem;\r\n margin-left: 0.5rem;\r\n opacity: 0.5;\r\n transition: opacity 250ms;\r\n\r\n &:hover {\r\n opacity: 1.0;\r\n }\r\n }\r\n\r\n .invalid {\r\n border: 2px solid #d93131;\r\n }\r\n\r\n label {\r\n flex: 1 0 auto;\r\n }\r\n\r\n .form-fields {\r\n flex: 0 1 auto;\r\n }\r\n\r\n .setting-container {\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n\r\n .label-side {\r\n flex: 1;\r\n margin-right: 1rem;\r\n }\r\n\r\n .button-container {\r\n min-width: 220px;\r\n max-width: 220px;\r\n height: 100%;\r\n display: flex;\r\n align-items: center;\r\n }\r\n\r\n button {\r\n flex: 1;\r\n line-height: initial;\r\n padding: 0.5rem 0;\r\n }\r\n\r\n</style>\r\n","<script>\r\n import SETTINGS from \"../../constants/settings.js\";\r\n\r\n import { getContext } from 'svelte';\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { ApplicationShell } from '@typhonjs-fvtt/runtime/svelte/component/core';\r\n\r\n import * as helpers from \"../../helpers/helpers.js\"\r\n import { applyDefaultSettings } from \"../../settings.js\";\r\n\r\n import Setting from \"./Setting.svelte\";\r\n import SettingButton from \"./SettingButton.svelte\";\r\n import Tabs from \"../components/Tabs.svelte\";\r\n import { TJSDialog } from \"@typhonjs-fvtt/runtime/svelte/application\";\r\n import CustomDialog from \"../components/CustomDialog.svelte\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let elementRoot;\r\n let form;\r\n\r\n export let settings = {};\r\n let userCanChangeSettings = game.user.hasPermission(\"SETTINGS_MODIFY\");\r\n\r\n getSettings();\r\n\r\n function getSettings() {\r\n settings = Object.fromEntries(Object.entries(SETTINGS.GET_DEFAULT()).map(entry => {\r\n entry[1].value = helpers.getSetting(entry[0]);\r\n return entry;\r\n }));\r\n\r\n settings[SETTINGS.POPULATION_TABLES_FOLDER].choices = {\r\n \"root\": \"ITEM-PILES.Settings.PopulationTablesFolder.AllTables\",\r\n ...Object.fromEntries(\r\n game.folders\r\n .filter(f => f.type === \"RollTable\")\r\n .map(f => [f.id, f.name])\r\n )\r\n }\r\n }\r\n\r\n export function importSettings(incomingSettings) {\r\n for (const [key, value] of Object.entries(incomingSettings)) {\r\n if (settings[SETTINGS[key]] === undefined) continue;\r\n settings[SETTINGS[key]].value = value;\r\n }\r\n settings = settings;\r\n }\r\n\r\n function requestSubmit() {\r\n form.requestSubmit();\r\n }\r\n\r\n async function updateSettings() {\r\n let settingsToUpdate = Object.entries(settings).filter(entry => userCanChangeSettings || entry[1].scope === \"client\");\r\n for (let [key, setting] of settingsToUpdate) {\r\n await helpers.setSetting(key, setting.value);\r\n }\r\n application.close();\r\n }\r\n\r\n async function resetSettings() {\r\n\r\n const doThing = await TJSDialog.confirm({\r\n title: \"Item Piles - \" + game.i18n.localize(\"ITEM-PILES.Dialogs.ResetSettings.Title\"),\r\n content: {\r\n class: CustomDialog,\r\n props: {\r\n content: game.i18n.localize(\"ITEM-PILES.Dialogs.ResetSettings.Content\")\r\n }\r\n },\r\n buttons: {\r\n yes: {\r\n icon: '<i class=\"fas fa-check\"></i>',\r\n label: game.i18n.localize(\"ITEM-PILES.Dialogs.ResetSettings.Confirm\")\r\n },\r\n no: {\r\n icon: '<i class=\"fas fa-times\"></i>',\r\n label: game.i18n.localize(\"No\")\r\n }\r\n },\r\n modal: true,\r\n draggable: false,\r\n rejectClose: false,\r\n defaultYes: true,\r\n options: {\r\n height: \"auto\"\r\n }\r\n });\r\n\r\n if (!doThing) return;\r\n\r\n return applyDefaultSettings();\r\n }\r\n\r\n let tabs = [\r\n { value: \"local\", label: localize(\"ITEM-PILES.Applications.Settings.Local\") },\r\n { value: \"module\", label: localize(\"ITEM-PILES.Applications.Settings.Module\"), hidden: !userCanChangeSettings },\r\n { value: \"styles\", label: localize(\"ITEM-PILES.Applications.Settings.Styles\"), hidden: !userCanChangeSettings },\r\n { value: \"system\", label: localize(\"ITEM-PILES.Applications.Settings.System\"), hidden: !userCanChangeSettings },\r\n ];\r\n\r\n let activeTab = tabs[0].value;\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\t<form autocomplete=\"off\" bind:this={form} on:submit|once|preventDefault={updateSettings}>\r\n\r\n\t\t<h2 style=\"text-align: center; margin-bottom: 1rem;\">{localize(\"ITEM-PILES.Applications.Settings.Title\")}</h2>\r\n\r\n\t\t{#if userCanChangeSettings}\r\n\t\t\t<Tabs bind:activeTab {tabs}/>\r\n\t\t{/if}\r\n\r\n\t\t<section class=\"tab-body\">\r\n\r\n\t\t\t<div class=\"tab flex\" class:active={activeTab === 'local'} data-scope=\"primary\" data-tab=\"local\">\r\n\r\n\t\t\t\t<Setting bind:data=\"{settings[SETTINGS.INVERT_SHEET_OPEN]}\" key={SETTINGS.INVERT_SHEET_OPEN}/>\r\n\t\t\t\t<Setting bind:data=\"{settings[SETTINGS.HIDE_ACTOR_HEADER_TEXT]}\" key={SETTINGS.HIDE_ACTOR_HEADER_TEXT}/>\r\n\t\t\t\t<Setting bind:data=\"{settings[SETTINGS.HIDE_ACTOR_HEADER_BUTTON]}\" key={SETTINGS.HIDE_ACTOR_HEADER_BUTTON}/>\r\n\t\t\t\t<Setting bind:data=\"{settings[SETTINGS.PRELOAD_FILES]}\" key={SETTINGS.PRELOAD_FILES}/>\r\n\t\t\t\t<Setting bind:data=\"{settings[SETTINGS.DEBUG]}\" key={SETTINGS.DEBUG}/>\r\n\t\t\t\t<Setting bind:data=\"{settings[SETTINGS.DEBUG_HOOKS]}\" key={SETTINGS.DEBUG_HOOKS}/>\r\n\r\n\t\t\t\t<div style=\"text-align: center; font-size: 1rem; margin-top:3rem;\">\r\n\t\t\t\t\t<p>{localize(\"ITEM-PILES.Applications.Settings.MoreToCome\")}\r\n\t\t\t\t\t<p>\r\n\t\t\t\t\t<p style=\"margin-bottom:1rem;\">\r\n\t\t\t\t\t\t<a class=\"link-text\"\r\n\t\t\t\t\t\t\t href=\"https://github.com/fantasycalendar/FoundryVTT-ItemPiles/issues/new?assignees=&labels=&template=feature_request.md&title=\"\r\n\t\t\t\t\t\t\t target=\"_blank\"\r\n\t\t\t\t\t\t>{localize(\"ITEM-PILES.Applications.Settings.Request\")}</a>\r\n\t\t\t\t\t</p>\r\n\t\t\t\t\t<p>\r\n\t\t\t\t\t\t{localize(\"ITEM-PILES.Applications.Settings.Donate\")}\r\n\t\t\t\t\t</p>\r\n\t\t\t\t\t<p>\r\n\t\t\t\t\t\t<a href=\"https://ko-fi.com/fantasycomputerworks\" style=\"text-decoration: none !important;\" target=\"_blank\">\r\n\t\t\t\t\t\t\t<button class=\"donate-button\" type=\"button\">\r\n\t\t\t\t\t\t\t\t<img src=\"https://storage.ko-fi.com/cdn/cup-border.png\">\r\n\t\t\t\t\t\t\t\t<span>Donate</span>\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t</a>\r\n\t\t\t\t\t</p>\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t\t{#if userCanChangeSettings}\r\n\t\t\t\t<div class=\"tab flex\" class:active={activeTab === 'module'} data-scope=\"primary\" data-tab=\"module\">\r\n\t\t\t\t\t<Setting key={SETTINGS.ENABLE_DROPPING_ITEMS} bind:data=\"{settings[SETTINGS.ENABLE_DROPPING_ITEMS]}\"/>\r\n\t\t\t\t\t<Setting key={SETTINGS.ENABLE_GIVING_ITEMS} bind:data=\"{settings[SETTINGS.ENABLE_GIVING_ITEMS]}\"/>\r\n\t\t\t\t\t<Setting key={SETTINGS.ENABLE_TRADING} bind:data=\"{settings[SETTINGS.ENABLE_TRADING]}\"/>\r\n\t\t\t\t\t<Setting key={SETTINGS.SHOW_TRADE_BUTTON} bind:data=\"{settings[SETTINGS.SHOW_TRADE_BUTTON]}\"/>\r\n\t\t\t\t\t<Setting key={SETTINGS.INSPECT_ITEMS_IN_TRADE} bind:data=\"{settings[SETTINGS.INSPECT_ITEMS_IN_TRADE]}\"/>\r\n\t\t\t\t\t<Setting key={SETTINGS.OUTPUT_TO_CHAT} bind:data=\"{settings[SETTINGS.OUTPUT_TO_CHAT]}\"/>\r\n\t\t\t\t\t<Setting key={SETTINGS.DELETE_EMPTY_PILES} bind:data=\"{settings[SETTINGS.DELETE_EMPTY_PILES]}\"/>\r\n\t\t\t\t\t<Setting key={SETTINGS.POPULATION_TABLES_FOLDER} bind:data=\"{settings[SETTINGS.POPULATION_TABLES_FOLDER]}\"/>\r\n\t\t\t\t\t<Setting key={SETTINGS.HIDE_TOKEN_BORDER} bind:data=\"{settings[SETTINGS.HIDE_TOKEN_BORDER]}\"/>\r\n\t\t\t\t\t<SettingButton key={SETTINGS.PRICE_PRESETS} bind:data=\"{settings[SETTINGS.PRICE_PRESETS]}\"/>\r\n\t\t\t\t\t<SettingButton key={SETTINGS.CUSTOM_ITEM_CATEGORIES} bind:data=\"{settings[SETTINGS.CUSTOM_ITEM_CATEGORIES]}\"/>\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div class=\"tab flex\" class:active={activeTab === 'styles'} data-scope=\"primary\" data-tab=\"styles\">\r\n\t\t\t\t\t<SettingButton key={SETTINGS.CSS_VARIABLES} bind:data=\"{settings[SETTINGS.CSS_VARIABLES]}\"/>\r\n\t\t\t\t\t<SettingButton key={SETTINGS.VAULT_STYLES} bind:data=\"{settings[SETTINGS.VAULT_STYLES]}\"/>\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div class=\"tab flex\" class:active={activeTab === 'system'} data-scope=\"primary\" data-tab=\"system\">\r\n\t\t\t\t\t<SettingButton data={{\r\n name: \"ITEM-PILES.Settings.Reset.Title\",\r\n hint: \"ITEM-PILES.Settings.Reset.Hint\",\r\n label: \"ITEM-PILES.Settings.Reset.Label\",\r\n icon: \"fas fa-undo\",\r\n hideResetButton: true\r\n }} callback={async () => {\r\n await resetSettings()\r\n getSettings();\r\n }}/>\r\n\t\t\t\t\t<Setting key={SETTINGS.ACTOR_CLASS_TYPE} bind:data=\"{settings[SETTINGS.ACTOR_CLASS_TYPE]}\"\r\n\t\t\t\t\t\t\t\t\t options={game.system.template.Actor.types}/>\r\n\t\t\t\t\t<Setting key={SETTINGS.ITEM_QUANTITY_ATTRIBUTE} bind:data=\"{settings[SETTINGS.ITEM_QUANTITY_ATTRIBUTE]}\"/>\r\n\t\t\t\t\t<Setting key={SETTINGS.ITEM_PRICE_ATTRIBUTE} bind:data=\"{settings[SETTINGS.ITEM_PRICE_ATTRIBUTE]}\"/>\r\n\t\t\t\t\t<SettingButton key={SETTINGS.CURRENCIES} bind:data=\"{settings[SETTINGS.CURRENCIES]}\"/>\r\n\t\t\t\t\t<SettingButton key={SETTINGS.SECONDARY_CURRENCIES} bind:data=\"{settings[SETTINGS.SECONDARY_CURRENCIES]}\"/>\r\n\t\t\t\t\t<Setting key={SETTINGS.CURRENCY_DECIMAL_DIGITS} bind:data=\"{settings[SETTINGS.CURRENCY_DECIMAL_DIGITS]}\"\r\n\t\t\t\t\t\t\t\t\t disabled=\"{settings[SETTINGS.CURRENCIES].value.length !== 1}\"/>\r\n\t\t\t\t\t<SettingButton key={SETTINGS.ITEM_FILTERS} bind:data=\"{settings[SETTINGS.ITEM_FILTERS]}\"/>\r\n\t\t\t\t\t<SettingButton key={SETTINGS.ITEM_SIMILARITIES} bind:data=\"{settings[SETTINGS.ITEM_SIMILARITIES]}\"/>\r\n\t\t\t\t\t<SettingButton key={SETTINGS.UNSTACKABLE_ITEM_TYPES} bind:data=\"{settings[SETTINGS.UNSTACKABLE_ITEM_TYPES]}\"/>\r\n\t\t\t\t</div>\r\n\t\t\t{/if}\r\n\r\n\t\t</section>\r\n\r\n\t\t<footer>\r\n\t\t\t<button on:click|once={requestSubmit} type=\"button\">\r\n\t\t\t\t<i class=\"far fa-save\"></i> {localize(\"ITEM-PILES.Applications.Settings.Submit\")}\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\t</form>\r\n</ApplicationShell>\r\n\r\n<style lang=\"scss\">\r\n\r\n .link-text {\r\n color: var(--color-text-hyperlink);\r\n }\r\n\r\n .donate-button {\r\n border: 0;\r\n border-radius: 9999px;\r\n background-color: #00bfa5;\r\n align-items: center;\r\n font-family: nunito, quicksand, sans-serif;\r\n font-size: 16px;\r\n width: max-content;\r\n justify-content: space-between;\r\n padding: 5px 15px;\r\n font-weight: 700;\r\n cursor: pointer;\r\n -webkit-border-radius: 100px;\r\n display: flex;\r\n margin: 10px auto;\r\n\r\n img {\r\n border: 0;\r\n width: 39px;\r\n }\r\n\r\n span {\r\n margin-left: 8px;\r\n color: white !important;\r\n }\r\n }\r\n\r\n .preset-select {\r\n display: flex;\r\n flex-direction: row;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.25);\r\n margin-bottom: 0.5rem;\r\n padding-bottom: 0.5rem;\r\n\r\n align-items: center;\r\n\r\n label {\r\n flex: 0 1 auto;\r\n margin-right: 0.5rem;\r\n }\r\n\r\n select {\r\n flex: 1;\r\n }\r\n\r\n button {\r\n margin-left: 0.25rem;\r\n flex: 0 1 auto;\r\n width: auto;\r\n height: 27px;\r\n text-align: center;\r\n line-height: normal;\r\n }\r\n }\r\n\r\n .tab-body {\r\n max-height: 729px;\r\n min-height: 729px;\r\n overflow-y: scroll;\r\n padding: 5px;\r\n }\r\n\r\n footer {\r\n border-top: 1px solid rgba(0, 0, 0, 0.25);\r\n margin-top: 0.5rem;\r\n padding-top: 0.5rem;\r\n }\r\n\r\n</style>\r\n","import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport { getActiveApps } from '../../helpers/helpers';\r\nimport SettingsShell from './settings-shell.svelte';\r\nimport SETTINGS from \"../../constants/settings.js\";\r\n\r\nclass SettingsApp extends SvelteApplication {\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n id: `item-piles-application-system-settings-${randomID()}`,\r\n title: \"Item Piles Module Configuration\",\r\n width: 600,\r\n svelte: {\r\n class: SettingsShell,\r\n target: document.body\r\n },\r\n zIndex: 100,\r\n classes: [\"item-piles-app\"],\r\n });\r\n }\r\n\r\n static getActiveApp() {\r\n return getActiveApps(\"item-piles-application-system-settings\", true);\r\n }\r\n\r\n static async show(options = {}, dialogData = {}) {\r\n const app = this.getActiveApp()\r\n if (app) return app.render(false, { focus: true });\r\n return new Promise((resolve) => {\r\n options.resolve = resolve;\r\n new this(options, dialogData).render(true, { focus: true });\r\n })\r\n }\r\n\r\n\r\n /** @override */\r\n _getHeaderButtons() {\r\n let buttons = super._getHeaderButtons();\r\n if (game.user.isGM) {\r\n buttons = [\r\n {\r\n label: \"ITEM-PILES.Applications.Settings.Export\",\r\n class: \"item-piles-export-settings\",\r\n icon: \"fas fa-file-export\",\r\n onclick: () => {\r\n const settingKeys = Object.fromEntries(Object.entries(SETTINGS)\r\n .filter(([_, value]) => typeof value === \"string\")\r\n .map(([key, value]) => [value, key]));\r\n const settings = Object.entries(this.svelte.applicationShell.settings)\r\n .filter(([_, setting]) => {\r\n return setting.system && setting.name;\r\n }).map(([key, setting]) => {\r\n return [settingKeys[key], setting.value];\r\n });\r\n const a = document.createElement(\"a\");\r\n const file = new Blob([JSON.stringify(Object.fromEntries(settings), null, 4)], { type: \"text/json\" });\r\n a.href = URL.createObjectURL(file);\r\n a.download = `item-piles-${game.system.id}.json`;\r\n a.click();\r\n a.remove();\r\n }\r\n },\r\n {\r\n label: \"ITEM-PILES.Applications.Settings.Import\",\r\n class: \"item-piles-import-settings\",\r\n icon: \"fas fa-file-import\",\r\n onclick: () => {\r\n\r\n const input = document.createElement('input');\r\n input.type = 'file';\r\n\r\n input.onchange = e => {\r\n\r\n input.remove();\r\n\r\n // getting a hold of the file reference\r\n const file = e.target.files[0];\r\n\r\n const reader = new FileReader();\r\n reader.addEventListener('load', async () => {\r\n try {\r\n const incomingSettings = JSON.parse(reader.result);\r\n this.svelte.applicationShell.importSettings(incomingSettings)\r\n } catch (err) {\r\n console.error(err);\r\n }\r\n });\r\n\r\n reader.readAsText(file);\r\n\r\n }\r\n\r\n input.click();\r\n }\r\n },\r\n ].concat(buttons);\r\n }\r\n return buttons\r\n }\r\n}\r\n\r\nexport default class SettingsShim extends FormApplication {\r\n\r\n /**\r\n * @inheritDoc\r\n */\r\n constructor() {\r\n super({});\r\n SettingsApp.show();\r\n }\r\n\r\n async _updateObject(event, formData) {\r\n }\r\n\r\n render() {\r\n this.close();\r\n }\r\n\r\n}\r\n","import CONSTANTS from \"./constants/constants.js\";\r\nimport SETTINGS from \"./constants/settings.js\";\r\nimport * as Helpers from \"./helpers/helpers.js\";\r\nimport { SYSTEMS } from \"./systems.js\";\r\nimport SettingsShim from \"./applications/settings-app/settings-app.js\";\r\nimport { TJSDialog } from \"@typhonjs-fvtt/runtime/svelte/application\";\r\nimport CustomDialog from \"./applications/components/CustomDialog.svelte\";\r\n\r\nexport function registerSettings() {\r\n\r\n game.settings.registerMenu(CONSTANTS.MODULE_NAME, \"configure-settings\", {\r\n name: \"ITEM-PILES.Settings.Configure.Title\",\r\n label: \"ITEM-PILES.Settings.Configure.Label\",\r\n hint: \"ITEM-PILES.Settings.Configure.Hint\",\r\n icon: \"fas fa-cog\",\r\n type: SettingsShim,\r\n restricted: false\r\n });\r\n\r\n for (let [name, data] of Object.entries(SETTINGS.GET_DEFAULT())) {\r\n game.settings.register(CONSTANTS.MODULE_NAME, name, data);\r\n }\r\n\r\n}\r\n\r\nexport async function applyDefaultSettings() {\r\n const settings = SETTINGS.GET_SYSTEM_DEFAULTS();\r\n for (const [name, data] of Object.entries(settings)) {\r\n await Helpers.setSetting(name, data.default);\r\n }\r\n await Helpers.setSetting(SETTINGS.SYSTEM_VERSION, SYSTEMS.DATA.VERSION);\r\n await patchCurrencySettings();\r\n}\r\n\r\nexport async function patchCurrencySettings() {\r\n const currencies = Helpers.getSetting(SETTINGS.CURRENCIES);\r\n for (let currency of currencies) {\r\n if (currency.type !== \"item\" || !currency.data.uuid || currency.data.item) continue;\r\n const item = await fromUuid(currency.data.uuid);\r\n if (!item) continue;\r\n currency.data.item = item.toObject();\r\n }\r\n return Helpers.setSetting(SETTINGS.CURRENCIES, currencies);\r\n}\r\n\r\nexport function applySystemSpecificStyles(data = false) {\r\n const defaultCssVariables = foundry.utils.deepClone(SETTINGS.DEFAULT_CSS_VARIABLES);\r\n const cssVariables = data || Helpers.getSetting(SETTINGS.CSS_VARIABLES);\r\n const mergedCssVariables = foundry.utils.mergeObject(defaultCssVariables, cssVariables)\r\n const root = document.documentElement;\r\n for (const [style, val] of Object.entries(mergedCssVariables)) {\r\n if (!val) {\r\n root.style.removeProperty(`--item-piles-${style}`)\r\n } else {\r\n root.style.setProperty(`--item-piles-${style}`, val);\r\n }\r\n }\r\n}\r\n\r\nexport async function checkSystem() {\r\n\r\n if (!SYSTEMS.HAS_SYSTEM_SUPPORT) {\r\n\r\n if (Helpers.getSetting(SETTINGS.SYSTEM_NOT_FOUND_WARNING_SHOWN)) return;\r\n\r\n let settingsValid = true;\r\n for (const [name, data] of Object.entries(SETTINGS.GET_DEFAULT())) {\r\n settingsValid = settingsValid && Helpers.getSetting(name).length !== (new data.type).length\r\n }\r\n\r\n if (settingsValid) return;\r\n\r\n TJSDialog.prompt({\r\n title: game.i18n.localize(\"ITEM-PILES.Dialogs.NoSystemFound.Title\"),\r\n content: {\r\n class: CustomDialog,\r\n props: {\r\n content: game.i18n.localize(\"ITEM-PILES.Dialogs.NoSystemFound.Content\")\r\n }\r\n }\r\n });\r\n\r\n return Helpers.setSetting(SETTINGS.SYSTEM_NOT_FOUND_WARNING_SHOWN, true);\r\n\r\n }\r\n\r\n if (Helpers.getSetting(SETTINGS.SYSTEM_FOUND) || SYSTEMS.DATA.INTEGRATION) {\r\n const currentVersion = Helpers.getSetting(SETTINGS.SYSTEM_VERSION);\r\n const newVersion = SYSTEMS.DATA.VERSION;\r\n Helpers.debug(`Comparing system version - Current: ${currentVersion} - New: ${newVersion}`)\r\n if (isNewerVersion(newVersion, currentVersion)) {\r\n Helpers.debug(`Applying system settings for ${game.system.title}`)\r\n await applyDefaultSettings();\r\n }\r\n return;\r\n }\r\n\r\n await Helpers.setSetting(SETTINGS.SYSTEM_FOUND, true);\r\n\r\n if (Helpers.getSetting(SETTINGS.SYSTEM_NOT_FOUND_WARNING_SHOWN)) {\r\n Helpers.custom_notify(game.i18n.localize(\"ITEM-PILES.Notifications.SystemSupportFound\"));\r\n }\r\n\r\n return applyDefaultSettings();\r\n}\r\n\r\nexport function applyShims() {\r\n\r\n if (game.release.generation !== 11) return;\r\n\r\n CONSTANTS.ACTOR_DELTA_PROPERTY = \"delta\";\r\n\r\n Object.freeze(CONSTANTS);\r\n\r\n}\r\n","import { SYSTEMS } from \"../systems.js\";\r\nimport { refreshItemTypesThatCanStack } from \"../helpers/utilities.js\";\r\nimport { applySystemSpecificStyles } from \"../settings.js\";\r\n\r\nconst SETTINGS = {\r\n\r\n // Client settings\r\n OUTPUT_TO_CHAT: \"outputToChat\",\r\n INVERT_SHEET_OPEN: \"invertSheetOpen\",\r\n HIDE_ACTOR_HEADER_TEXT: \"hideActorHeaderText\",\r\n HIDE_ACTOR_HEADER_BUTTON: \"hideActorHeaderButton\",\r\n PRELOAD_FILES: \"preloadFiles\",\r\n DEBUG: \"debug\",\r\n DEBUG_HOOKS: \"debugHooks\",\r\n\r\n // Module Settings\r\n ENABLE_DROPPING_ITEMS: \"enableDroppingItems\",\r\n ENABLE_TRADING: \"enableTrading\",\r\n ENABLE_GIVING_ITEMS: \"enableGivingItems\",\r\n SHOW_TRADE_BUTTON: \"showTradeButton\",\r\n DELETE_EMPTY_PILES: \"deleteEmptyPiles\",\r\n INSPECT_ITEMS_IN_TRADE: \"inspectItemsInTrade\",\r\n POPULATION_TABLES_FOLDER: \"populationTablesFolder\",\r\n PRICE_PRESETS: \"pricePresets\",\r\n HIDE_TOKEN_BORDER: \"hideTokenBorder\",\r\n\r\n // Style settings\r\n CSS_VARIABLES: \"cssVariables\",\r\n VAULT_STYLES: \"vaultStyles\",\r\n\r\n // System Settings\r\n CURRENCIES: \"currencies\",\r\n SECONDARY_CURRENCIES: \"secondaryCurrencies\",\r\n CURRENCY_DECIMAL_DIGITS: \"currencyDecimalDigits\",\r\n ITEM_FILTERS: \"itemFilters\",\r\n ACTOR_CLASS_TYPE: \"actorClassType\",\r\n ITEM_QUANTITY_ATTRIBUTE: \"itemQuantityAttribute\",\r\n ITEM_PRICE_ATTRIBUTE: \"itemPriceAttribute\",\r\n QUANTITY_FOR_PRICE_ATTRIBUTE: \"quantityForPriceAttribute\",\r\n ITEM_SIMILARITIES: \"itemSimilarities\",\r\n UNSTACKABLE_ITEM_TYPES: \"unstackableItemTypes\",\r\n PILE_DEFAULTS: \"pileDefaults\",\r\n TOKEN_FLAG_DEFAULTS: \"tokenFlagDefaults\",\r\n\r\n // Hidden settings\r\n DEFAULT_ITEM_PILE_JOURNAL_ID: \"defaultItemPileJournalID\",\r\n DEFAULT_ITEM_PILE_ACTOR_ID: \"defaultItemPileActorID\",\r\n SYSTEM_FOUND: \"systemFound\",\r\n SYSTEM_NOT_FOUND_WARNING_SHOWN: \"systemNotFoundWarningShown\",\r\n SYSTEM_VERSION: \"systemVersion\",\r\n CUSTOM_ITEM_CATEGORIES: \"customItemCategories\",\r\n\r\n HIDE_TOKEN_BORDER_OPTIONS: {\r\n EVERYONE: \"everyone\",\r\n PLAYERS: \"players\",\r\n SHOW: \"show\"\r\n },\r\n\r\n DEFAULT_CSS_VARIABLES: {\r\n \"inactive\": \"rgba(31,143,255,1)\",\r\n \"minor-inactive\": \"rgba(201,200,185,1)\",\r\n \"shadow-primary\": \"rgba(255,0,0,1)\",\r\n \"even-color\": \"rgba(240,240,223,1)\",\r\n \"odd-color\": \"rgba(0,0,0,0)\",\r\n \"border-dark-primary\": \"rgba(25,24,19,1)\",\r\n \"border-light-primary\": \"rgba(181,179,164,1)\",\r\n \"text-light-highlight\": \"rgba(240,240,224,1)\",\r\n \"text-important\": \"rgba(255,100,0,1)\"\r\n },\r\n\r\n GET_DEFAULT() {\r\n return foundry.utils.deepClone(SETTINGS.DEFAULTS())\r\n },\r\n\r\n GET_SYSTEM_DEFAULTS() {\r\n return Object.fromEntries(Object.entries(SETTINGS.GET_DEFAULT()).filter(entry => {\r\n return entry[1].system;\r\n }));\r\n },\r\n\r\n DEFAULTS: () => ({\r\n\r\n [SETTINGS.CURRENCIES]: {\r\n name: \"ITEM-PILES.Settings.Currencies.Title\",\r\n label: \"ITEM-PILES.Settings.Currencies.Label\",\r\n hint: \"ITEM-PILES.Settings.Currencies.Hint\",\r\n icon: \"fa fa-money-bill-alt\",\r\n application: \"currencies\",\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.CURRENCIES,\r\n type: Array\r\n },\r\n\r\n [SETTINGS.SECONDARY_CURRENCIES]: {\r\n name: \"ITEM-PILES.Settings.SecondaryCurrencies.Title\",\r\n label: \"ITEM-PILES.Settings.SecondaryCurrencies.Label\",\r\n hint: \"ITEM-PILES.Settings.SecondaryCurrencies.Hint\",\r\n icon: \"fa fa-money-bill-alt\",\r\n application: \"secondary-currencies\",\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.SECONDARY_CURRENCIES,\r\n type: Array\r\n },\r\n\r\n [SETTINGS.CURRENCY_DECIMAL_DIGITS]: {\r\n name: \"ITEM-PILES.Settings.CurrencyDecimalDigits.Title\",\r\n hint: \"ITEM-PILES.Settings.CurrencyDecimalDigits.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.CURRENCY_DECIMAL_DIGITS,\r\n step: 0.00001,\r\n min: 0,\r\n max: 1,\r\n type: Number\r\n },\r\n\r\n [SETTINGS.ITEM_FILTERS]: {\r\n name: \"ITEM-PILES.Settings.ItemFilters.Title\",\r\n label: \"ITEM-PILES.Settings.ItemFilters.Label\",\r\n hint: \"ITEM-PILES.Settings.ItemFilters.Hint\",\r\n icon: \"fa fa-filter\",\r\n application: \"item-filters\",\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.ITEM_FILTERS,\r\n type: Array\r\n },\r\n\r\n [SETTINGS.ITEM_SIMILARITIES]: {\r\n name: \"ITEM-PILES.Settings.ItemSimilarities.Title\",\r\n label: \"ITEM-PILES.Settings.ItemSimilarities.Label\",\r\n hint: \"ITEM-PILES.Settings.ItemSimilarities.Hint\",\r\n icon: \"fa fa-equals\",\r\n application: \"item-similarities\",\r\n applicationOptions: {\r\n title: \"ITEM-PILES.Applications.SimilaritiesEditor.Title\",\r\n content: \"ITEM-PILES.Applications.SimilaritiesEditor.Explanation\",\r\n column: \"ITEM-PILES.Applications.SimilaritiesEditor.Path\",\r\n },\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.ITEM_SIMILARITIES,\r\n onChange: () => {\r\n refreshItemTypesThatCanStack();\r\n },\r\n type: Array\r\n },\r\n\r\n [SETTINGS.UNSTACKABLE_ITEM_TYPES]: {\r\n name: \"ITEM-PILES.Settings.UnstackableItemTypes.Title\",\r\n label: \"ITEM-PILES.Settings.UnstackableItemTypes.Label\",\r\n hint: \"ITEM-PILES.Settings.UnstackableItemTypes.Hint\",\r\n icon: \"fa fa-equals\",\r\n application: \"unstackable-item-types\",\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.UNSTACKABLE_ITEM_TYPES,\r\n onChange: () => {\r\n refreshItemTypesThatCanStack();\r\n },\r\n type: Array\r\n },\r\n\r\n [SETTINGS.CSS_VARIABLES]: {\r\n name: \"ITEM-PILES.Settings.CssVariables.Title\",\r\n label: \"ITEM-PILES.Settings.CssVariables.Label\",\r\n hint: \"ITEM-PILES.Settings.CssVariables.Hint\",\r\n icon: \"fa-solid fa-wand-magic-sparkles\",\r\n application: \"styles\",\r\n applicationOptions: {\r\n readOnly: true,\r\n variables: true\r\n },\r\n scope: \"world\",\r\n config: false,\r\n default: SYSTEMS.DATA.CSS_VARIABLES,\r\n mergedDefaults: SETTINGS.DEFAULT_CSS_VARIABLES,\r\n onchange: (data) => {\r\n applySystemSpecificStyles(data);\r\n },\r\n type: Object\r\n },\r\n\r\n [SETTINGS.VAULT_STYLES]: {\r\n name: \"ITEM-PILES.Settings.VaultStyles.Title\",\r\n label: \"ITEM-PILES.Settings.VaultStyles.Label\",\r\n hint: \"ITEM-PILES.Settings.VaultStyles.Hint\",\r\n icon: \"fa-solid fa-wand-magic-sparkles\",\r\n application: \"vault-styles\",\r\n scope: \"world\",\r\n config: false,\r\n default: SYSTEMS.DATA.VAULT_STYLES,\r\n type: Array\r\n },\r\n\r\n [SETTINGS.ACTOR_CLASS_TYPE]: {\r\n name: \"ITEM-PILES.Settings.ActorClass.Title\",\r\n hint: \"ITEM-PILES.Settings.ActorClass.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.ACTOR_CLASS_TYPE,\r\n type: String\r\n },\r\n\r\n [SETTINGS.ITEM_QUANTITY_ATTRIBUTE]: {\r\n name: \"ITEM-PILES.Settings.Quantity.Title\",\r\n hint: \"ITEM-PILES.Settings.Quantity.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.ITEM_QUANTITY_ATTRIBUTE,\r\n type: String\r\n },\r\n\r\n [SETTINGS.ITEM_PRICE_ATTRIBUTE]: {\r\n name: \"ITEM-PILES.Settings.Price.Title\",\r\n hint: \"ITEM-PILES.Settings.Price.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.ITEM_PRICE_ATTRIBUTE,\r\n type: String\r\n },\r\n\r\n [SETTINGS.QUANTITY_FOR_PRICE_ATTRIBUTE]: {\r\n name: \"ITEM-PILES.Settings.QuantityForPrice.Title\",\r\n hint: \"ITEM-PILES.Settings.QuantityForPrice.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.QUANTITY_FOR_PRICE_ATTRIBUTE,\r\n type: String\r\n },\r\n\r\n [SETTINGS.PILE_DEFAULTS]: {\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.PILE_DEFAULTS,\r\n type: Object\r\n },\r\n\r\n [SETTINGS.TOKEN_FLAG_DEFAULTS]: {\r\n scope: \"world\",\r\n config: false,\r\n system: true,\r\n default: SYSTEMS.DATA.TOKEN_FLAG_DEFAULTS,\r\n type: Object\r\n },\r\n\r\n [SETTINGS.CUSTOM_ITEM_CATEGORIES]: {\r\n name: \"ITEM-PILES.Settings.CustomItemCategories.Title\",\r\n label: \"ITEM-PILES.Settings.CustomItemCategories.Label\",\r\n hint: \"ITEM-PILES.Settings.CustomItemCategories.Hint\",\r\n application: \"item-categories\",\r\n applicationOptions: {\r\n title: \"ITEM-PILES.Applications.CustomItemCategoriesEditor.Title\",\r\n content: \"ITEM-PILES.Applications.CustomItemCategoriesEditor.Explanation\",\r\n column: \"ITEM-PILES.Applications.CustomItemCategoriesEditor.Category\",\r\n },\r\n scope: \"world\",\r\n config: false,\r\n default: [],\r\n type: Array\r\n },\r\n\r\n [SETTINGS.SYSTEM_VERSION]: {\r\n scope: \"world\",\r\n config: false,\r\n default: \"0.0.0\",\r\n type: String\r\n },\r\n\r\n [SETTINGS.DEFAULT_ITEM_PILE_ACTOR_ID]: {\r\n scope: \"world\",\r\n config: false,\r\n default: \"\",\r\n type: String\r\n },\r\n\r\n [SETTINGS.DEFAULT_ITEM_PILE_JOURNAL_ID]: {\r\n scope: \"world\",\r\n config: false,\r\n default: \"\",\r\n type: String\r\n },\r\n\r\n [SETTINGS.SYSTEM_FOUND]: {\r\n scope: \"world\",\r\n config: false,\r\n default: false,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.SYSTEM_NOT_FOUND_WARNING_SHOWN]: {\r\n scope: \"world\",\r\n config: false,\r\n default: false,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.OUTPUT_TO_CHAT]: {\r\n name: \"ITEM-PILES.Settings.OutputToChat.Title\",\r\n hint: \"ITEM-PILES.Settings.OutputToChat.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n default: 1,\r\n choices: [\r\n \"ITEM-PILES.Settings.OutputToChat.Off\",\r\n \"ITEM-PILES.Settings.OutputToChat.Public\",\r\n \"ITEM-PILES.Settings.OutputToChat.SelfGM\",\r\n \"ITEM-PILES.Settings.OutputToChat.Blind\",\r\n ],\r\n type: Number\r\n },\r\n\r\n [SETTINGS.INSPECT_ITEMS_IN_TRADE]: {\r\n name: \"ITEM-PILES.Settings.InspectItemsTrade.Title\",\r\n hint: \"ITEM-PILES.Settings.InspectItemsTrade.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n default: true,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.POPULATION_TABLES_FOLDER]: {\r\n name: \"ITEM-PILES.Settings.PopulationTablesFolder.Title\",\r\n hint: \"ITEM-PILES.Settings.PopulationTablesFolder.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n default: \"root\",\r\n type: String\r\n },\r\n\r\n [SETTINGS.DELETE_EMPTY_PILES]: {\r\n name: \"ITEM-PILES.Settings.DeleteEmptyPiles.Title\",\r\n hint: \"ITEM-PILES.Settings.DeleteEmptyPiles.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n default: false,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.ENABLE_DROPPING_ITEMS]: {\r\n name: \"ITEM-PILES.Settings.EnableDroppingItems.Title\",\r\n hint: \"ITEM-PILES.Settings.EnableDroppingItems.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n default: true,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.ENABLE_TRADING]: {\r\n name: \"ITEM-PILES.Settings.EnableTrading.Title\",\r\n hint: \"ITEM-PILES.Settings.EnableTrading.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n default: true,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.ENABLE_GIVING_ITEMS]: {\r\n name: \"ITEM-PILES.Settings.EnableGivingItems.Title\",\r\n hint: \"ITEM-PILES.Settings.EnableGivingItems.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n default: true,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.SHOW_TRADE_BUTTON]: {\r\n name: \"ITEM-PILES.Settings.ShowTradeButton.Title\",\r\n hint: \"ITEM-PILES.Settings.ShowTradeButton.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n default: true,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.PRICE_PRESETS]: {\r\n name: \"ITEM-PILES.Settings.PricePresets.Title\",\r\n label: \"ITEM-PILES.Settings.PricePresets.Label\",\r\n hint: \"ITEM-PILES.Settings.PricePresets.Hint\",\r\n scope: \"world\",\r\n icon: \"fa fa-tags\",\r\n application: \"price-presets\",\r\n config: false,\r\n default: [],\r\n type: Array\r\n },\r\n\r\n [SETTINGS.HIDE_TOKEN_BORDER]: {\r\n name: \"ITEM-PILES.Settings.HideTokenBorder.Title\",\r\n label: \"ITEM-PILES.Settings.HideTokenBorder.Label\",\r\n hint: \"ITEM-PILES.Settings.HideTokenBorder.Hint\",\r\n scope: \"world\",\r\n config: false,\r\n default: SETTINGS.HIDE_TOKEN_BORDER_OPTIONS.EVERYONE,\r\n choices: {\r\n [SETTINGS.HIDE_TOKEN_BORDER_OPTIONS.EVERYONE]: \"ITEM-PILES.Settings.HideTokenBorder.HideEveryone\",\r\n [SETTINGS.HIDE_TOKEN_BORDER_OPTIONS.PLAYERS]: \"ITEM-PILES.Settings.HideTokenBorder.HidePlayers\",\r\n [SETTINGS.HIDE_TOKEN_BORDER_OPTIONS.SHOW]: \"ITEM-PILES.Settings.HideTokenBorder.Show\"\r\n },\r\n type: String\r\n },\r\n\r\n [SETTINGS.INVERT_SHEET_OPEN]: {\r\n name: \"ITEM-PILES.Settings.InvertSheetOpen.Title\",\r\n hint: \"ITEM-PILES.Settings.InvertSheetOpen.Hint\",\r\n scope: \"client\",\r\n config: false,\r\n default: false,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.HIDE_ACTOR_HEADER_TEXT]: {\r\n name: \"ITEM-PILES.Settings.HideHeaderButtonText.Title\",\r\n hint: \"ITEM-PILES.Settings.HideHeaderButtonText.Hint\",\r\n scope: \"client\",\r\n config: false,\r\n default: false,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.HIDE_ACTOR_HEADER_BUTTON]: {\r\n name: \"ITEM-PILES.Settings.HideHeaderButton.Title\",\r\n hint: \"ITEM-PILES.Settings.HideHeaderButton.Hint\",\r\n scope: \"client\",\r\n config: false,\r\n default: false,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.PRELOAD_FILES]: {\r\n name: \"ITEM-PILES.Settings.PreloadFiles.Title\",\r\n hint: \"ITEM-PILES.Settings.PreloadFiles.Hint\",\r\n scope: \"client\",\r\n config: false,\r\n default: true,\r\n type: Boolean\r\n },\r\n\r\n [SETTINGS.DEBUG]: {\r\n name: \"ITEM-PILES.Settings.Debug.Title\",\r\n hint: \"ITEM-PILES.Settings.Debug.Hint\",\r\n scope: \"client\",\r\n config: false,\r\n default: false,\r\n type: Boolean\r\n },\r\n\r\n\r\n [SETTINGS.DEBUG_HOOKS]: {\r\n name: \"ITEM-PILES.Settings.DebugHooks.Title\",\r\n hint: \"ITEM-PILES.Settings.DebugHooks.Hint\",\r\n scope: \"client\",\r\n config: false,\r\n default: false,\r\n type: Boolean\r\n },\r\n\r\n })\r\n}\r\n\r\nexport default SETTINGS;\r\n","import * as Helpers from \"./helpers.js\";\r\nimport CONSTANTS from \"../constants/constants.js\";\r\nimport SETTINGS from \"../constants/settings.js\";\r\nimport { getItemFlagData } from \"./pile-utilities.js\";\r\nimport { deletedActorCache } from \"./caches.js\";\r\n\r\nexport function getActor(target) {\r\n if (target instanceof Actor) return target;\r\n let targetDoc = target;\r\n if (stringIsUuid(target)) {\r\n targetDoc = fromUuidSync(target);\r\n if (!targetDoc && deletedActorCache.has(target)) {\r\n return deletedActorCache.get(target);\r\n }\r\n }\r\n targetDoc = getDocument(targetDoc);\r\n return targetDoc?.character ?? targetDoc?.actor ?? targetDoc;\r\n}\r\n\r\n/**\r\n * @param documentUuid\r\n * @returns {PlaceableObject|foundry.abstract.Document}\r\n */\r\nexport function getToken(documentUuid) {\r\n let doc = fromUuidSync(documentUuid);\r\n doc = doc?.token ?? doc;\r\n return doc instanceof TokenDocument ? doc?.object ?? doc : doc;\r\n}\r\n\r\nexport function getDocument(target) {\r\n if (stringIsUuid(target)) {\r\n target = fromUuidSync(target);\r\n }\r\n return target?.document ?? target;\r\n}\r\n\r\nexport function stringIsUuid(inId) {\r\n return typeof inId === \"string\"\r\n && (inId.match(/\\./g) || []).length\r\n && !inId.endsWith(\".\");\r\n}\r\n\r\nexport function getUuid(target) {\r\n if (stringIsUuid(target)) return target;\r\n const document = getDocument(target);\r\n return document?.uuid ?? false;\r\n}\r\n\r\n/**\r\n * Find and retrieves an item in a list of items\r\n *\r\n * @param {Array<Item|Object>} items\r\n * @param {Item|Object} findItem\r\n * @param {boolean/object} actorFlagData\r\n * @param {boolean} ignoreVault\r\n * @returns {*}\r\n */\r\nexport function findSimilarItem(items, findItem, actorFlagData = false, ignoreVault = false) {\r\n\r\n const itemSimilarities = game.itempiles.API.ITEM_SIMILARITIES;\r\n\r\n let findItemData = findItem instanceof Item ? findItem.toObject() : findItem;\r\n findItemData = findItemData?.item ?? findItemData;\r\n const findItemId = findItemData?._id;\r\n\r\n let hasUniqueKey = false;\r\n for (let prop of CONSTANTS.ITEM_FORCED_UNIQUE_KEYS) {\r\n if (getProperty(findItemData, prop)) {\r\n hasUniqueKey = true;\r\n break;\r\n }\r\n }\r\n\r\n const actorIsVault = actorFlagData ? actorFlagData?.enabled && actorFlagData?.type === CONSTANTS.PILE_TYPES.VAULT : false;\r\n\r\n const filteredItems = items\r\n .filter(item => {\r\n for (let prop of CONSTANTS.ITEM_FORCED_UNIQUE_KEYS) {\r\n if (getProperty(item?.item ?? item, prop)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n })\r\n .filter(item => {\r\n const itemId = item instanceof Item ? item.id : item?.item?._id ?? item?._id ?? item?.id;\r\n if (itemId && findItemId && itemId === findItemId) {\r\n return true;\r\n }\r\n\r\n if (!itemSimilarities.some(path => hasProperty(findItem, path))) {\r\n return false;\r\n }\r\n\r\n if (hasUniqueKey) {\r\n return false;\r\n }\r\n\r\n let itemData = item instanceof Item ? item.toObject() : item;\r\n itemData = itemData?.item ?? itemData;\r\n if (areItemsDifferent(itemData, findItemData)) {\r\n return false;\r\n }\r\n\r\n return itemSimilarities.length > 0;\r\n })\r\n\r\n let sortedItems = filteredItems;\r\n if (actorIsVault && !ignoreVault) {\r\n\r\n let distanceItems = filteredItems.map(item => {\r\n const itemX = getProperty(item, CONSTANTS.FLAGS.ITEM + \".x\") ?? Infinity;\r\n const itemY = getProperty(item, CONSTANTS.FLAGS.ITEM + \".y\") ?? Infinity;\r\n const findX = getProperty(findItem, CONSTANTS.FLAGS.ITEM + \".x\") ?? Infinity;\r\n const findY = getProperty(findItem, CONSTANTS.FLAGS.ITEM + \".y\") ?? Infinity;\r\n const distance = new Ray({ x: itemX, y: itemY }, { x: findX, y: findY }).distance;\r\n return { distance, item };\r\n });\r\n\r\n distanceItems.sort((a, b) => a.distance - b.distance);\r\n distanceItems = distanceItems.filter(item => {\r\n return item.distance === 0 && {\r\n \"default\": actorFlagData?.canStackItems ?? true,\r\n \"yes\": true,\r\n \"no\": false\r\n }[getItemFlagData(item)?.canStack ?? \"default\"];\r\n }).map(item => item.item);\r\n\r\n sortedItems = distanceItems;\r\n\r\n }\r\n\r\n return sortedItems?.[0] ?? false;\r\n\r\n}\r\n\r\nexport function areItemsDifferent(itemA, itemB) {\r\n const itemSimilarities = game.itempiles.API.ITEM_SIMILARITIES;\r\n for (const path of itemSimilarities) {\r\n if (getProperty(itemA, path) !== getProperty(itemB, path) || (!hasProperty(itemA, path) ^ !hasProperty(itemB, path))) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nexport function setSimilarityProperties(obj, item) {\r\n const itemData = item instanceof Item ? item.toObject() : item;\r\n setProperty(obj, \"_id\", itemData._id);\r\n game.itempiles.API.ITEM_SIMILARITIES.forEach(prop => {\r\n setProperty(obj, prop, getProperty(itemData, prop));\r\n })\r\n return obj;\r\n}\r\n\r\nlet itemTypesWithQuantities = false;\r\n\r\nexport function refreshItemTypesThatCanStack() {\r\n itemTypesWithQuantities = false;\r\n getItemTypesThatCanStack();\r\n}\r\n\r\nexport function getItemTypesThatCanStack() {\r\n if (!itemTypesWithQuantities) {\r\n const unstackableItemTypes = Helpers.getSetting(SETTINGS.UNSTACKABLE_ITEM_TYPES);\r\n const types = new Set(Object.keys(CONFIG?.Item?.dataModels ?? {}).concat(game.system.template.Item.types));\r\n itemTypesWithQuantities = new Set(types.filter(type => {\r\n let itemTemplate = {};\r\n if (CONFIG?.Item?.dataModels?.[type]?.defineSchema !== undefined) {\r\n itemTemplate.system = Object.entries(CONFIG.Item.dataModels[type].defineSchema())\r\n .map(([key, schema]) => {\r\n return [key, schema.fields ?? true]\r\n })\r\n itemTemplate.system = Object.fromEntries(itemTemplate.system);\r\n } else if (game.system?.template?.Item?.[type]) {\r\n itemTemplate.system = foundry.utils.deepClone(game.system.template.Item[type]);\r\n if (itemTemplate.system?.templates?.length) {\r\n const templates = foundry.utils.duplicate(itemTemplate.system.templates);\r\n for (let template of templates) {\r\n itemTemplate.system = foundry.utils.mergeObject(\r\n itemTemplate.system,\r\n foundry.utils.duplicate(game.system.template.Item.templates[template])\r\n );\r\n }\r\n }\r\n }\r\n return hasItemQuantity(itemTemplate);\r\n })).filter(type => !unstackableItemTypes.includes(type));\r\n }\r\n return itemTypesWithQuantities;\r\n}\r\n\r\n/**\r\n * Returns a given item's quantity\r\n *\r\n * @param {Item/Object} item\r\n * @returns {number}\r\n */\r\nexport function getItemQuantity(item) {\r\n const itemData = item instanceof Item ? item.toObject() : item;\r\n return Number(getProperty(itemData, game.itempiles.API.ITEM_QUANTITY_ATTRIBUTE) ?? 0);\r\n}\r\n\r\n\r\n/**\r\n * Returns whether an item has the quantity property\r\n *\r\n * @param {Item/Object} item\r\n * @returns {number}\r\n */\r\nexport function hasItemQuantity(item) {\r\n const itemData = item instanceof Item ? item.toObject() : item;\r\n return hasProperty(itemData, game.itempiles.API.ITEM_QUANTITY_ATTRIBUTE);\r\n}\r\n\r\n/**\r\n * Returns a given item's quantity\r\n *\r\n * @param {Object} itemData\r\n * @param {Number} quantity\r\n * @param {Boolean} requiresExistingQuantity\r\n * @returns {Object}\r\n */\r\nexport function setItemQuantity(itemData, quantity, requiresExistingQuantity = false) {\r\n if (!requiresExistingQuantity || getItemTypesThatCanStack().has(itemData.type)) {\r\n setProperty(itemData, game.itempiles.API.ITEM_QUANTITY_ATTRIBUTE, quantity)\r\n }\r\n return itemData;\r\n}\r\n\r\n\r\nexport function getItemCost(item) {\r\n const itemData = item instanceof Item ? item.toObject() : item;\r\n return getProperty(itemData, game.itempiles.API.ITEM_PRICE_ATTRIBUTE) ?? 0;\r\n}\r\n\r\n/**\r\n * Retrieves all visible tokens on a given location\r\n *\r\n * @param position\r\n * @returns {Array<Token>}\r\n */\r\nexport function getTokensAtLocation(position) {\r\n const tokens = [...canvas.tokens.placeables].filter(token => token?.mesh?.visible);\r\n return tokens.filter(token => {\r\n return position.x >= token.x && position.x < (token.x + (token.document.width * canvas.grid.size))\r\n && position.y >= token.y && position.y < (token.y + (token.document.height * canvas.grid.size));\r\n });\r\n}\r\n\r\nexport function distance_between_rect(p1, p2) {\r\n\r\n const x1 = p1.x;\r\n const y1 = p1.y;\r\n const x1b = p1.x + p1.w;\r\n const y1b = p1.y + p1.h;\r\n\r\n const x2 = p2.x;\r\n const y2 = p2.y;\r\n const x2b = p2.x + p2.w;\r\n const y2b = p2.y + p2.h;\r\n\r\n const left = x2b < x1;\r\n const right = x1b < x2;\r\n const bottom = y2b < y1;\r\n const top = y1b < y2;\r\n\r\n if (top && left) {\r\n return distance_between({ x: x1, y: y1b }, { x: x2b, y: y2 });\r\n } else if (left && bottom) {\r\n return distance_between({ x: x1, y: y1 }, { x: x2b, y: y2b });\r\n } else if (bottom && right) {\r\n return distance_between({ x: x1b, y: y1 }, { x: x2, y: y2b });\r\n } else if (right && top) {\r\n return distance_between({ x: x1b, y: y1b }, { x: x2, y: y2 });\r\n } else if (left) {\r\n return x1 - x2b;\r\n } else if (right) {\r\n return x2 - x1b;\r\n } else if (bottom) {\r\n return y1 - y2b;\r\n } else if (top) {\r\n return y2 - y1b;\r\n }\r\n\r\n return 0;\r\n\r\n}\r\n\r\nexport function distance_between(a, b) {\r\n return new Ray(a, b).distance;\r\n}\r\n\r\nexport function grids_between_tokens(a, b) {\r\n return Math.floor(distance_between_rect(a, b) / canvas.grid.size) + 1\r\n}\r\n\r\nexport function tokens_close_enough(a, b, maxDistance) {\r\n const distance = grids_between_tokens(a, b);\r\n return maxDistance >= distance;\r\n}\r\n\r\nexport function refreshAppsWithDocument(doc, callback) {\r\n const apps = Object.values(ui.windows).filter(app => app.id.endsWith(doc.id));\r\n for (const app of apps) {\r\n if (app[callback]) {\r\n app[callback]();\r\n }\r\n }\r\n}\r\n\r\nexport async function runMacro(macroId, macroData) {\r\n\r\n // Credit to Otigon, Zhell, Gazkhan and MrVauxs for the code in this section\r\n let macro;\r\n if (macroId.startsWith(\"Compendium\")) {\r\n let packArray = macroId.split(\".\");\r\n let compendium = game.packs.get(`${packArray[1]}.${packArray[2]}`);\r\n if (!compendium) {\r\n throw Helpers.custom_error(`Compendium ${packArray[1]}.${packArray[2]} was not found`);\r\n }\r\n let findMacro = (await compendium.getDocuments()).find(m => m.name === packArray[3] || m.id === packArray[3])\r\n if (!findMacro) {\r\n throw Helpers.custom_error(`The \"${packArray[3]}\" macro was not found in Compendium ${packArray[1]}.${packArray[2]}`);\r\n }\r\n macro = new Macro(findMacro?.toObject());\r\n macro.ownership.default = CONST.DOCUMENT_PERMISSION_LEVELS.OWNER;\r\n } else {\r\n macro = game.macros.getName(macroId);\r\n if (!macro) {\r\n throw Helpers.custom_error(`Could not find macro with name \"${macroId}\"`);\r\n }\r\n }\r\n\r\n let result = false;\r\n try {\r\n result = await macro.execute(macroData);\r\n } catch (err) {\r\n Helpers.custom_warning(`Error when executing macro ${macroId}!\\n${err}`, true);\r\n }\r\n\r\n return result;\r\n\r\n}\r\n\r\nexport function getOwnedCharacters(user = false) {\r\n user = user || game.user;\r\n return game.actors.filter(actor => {\r\n return actor.ownership?.[user.id] === CONST.DOCUMENT_PERMISSION_LEVELS.OWNER\r\n && actor.prototypeToken.actorLink;\r\n })\r\n .sort((a, b) => {\r\n return b._stats.modifiedTime - a._stats.modifiedTime;\r\n });\r\n}\r\n\r\nexport function getUserCharacter(user = false) {\r\n user = user || game.user;\r\n return user.character\r\n || (user.isGM ? false : (getOwnedCharacters(user)?.[0] ?? false));\r\n}\r\n\r\nexport async function createFoldersFromNames(folders, type = \"Actor\") {\r\n let lastFolder = false;\r\n for (const folder of folders) {\r\n let actualFolder = game.folders.getName(folder);\r\n if (!actualFolder) {\r\n const folderData = { name: folder, type, sorting: 'a' };\r\n if (lastFolder) {\r\n folderData.parent = lastFolder.id;\r\n }\r\n actualFolder = await Folder.create(folderData);\r\n }\r\n lastFolder = actualFolder;\r\n }\r\n\r\n if (lastFolder) {\r\n return lastFolder;\r\n }\r\n}\r\n\r\n\r\nexport function getSourceActorFromDropData(dropData) {\r\n if (dropData.uuid) {\r\n const doc = fromUuidSync(dropData.uuid);\r\n return doc instanceof Actor ? doc : doc.parent;\r\n } else if (dropData.tokenId) {\r\n if (dropData.sceneId) {\r\n const uuid = `Scene.${dropData.sceneId}.Token.${dropData.tokenId}`;\r\n return fromUuidSync(uuid)?.actor;\r\n }\r\n return canvas.tokens.get(dropData.tokenId).actor;\r\n } else if (dropData.actorId) {\r\n return game.actors.get(dropData.actorId);\r\n }\r\n return false;\r\n}\r\n","<script>\r\n\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { getSourceActorFromDropData } from \"../../helpers/utilities.js\";\r\n\r\n export let actor;\r\n export let actors;\r\n\r\n let changingActor = false;\r\n let multipleActors = actors.length > 1 && !game.user.isGM;\r\n let hasUnlinkedTokenOwnership = actors.filter(a => !a.prototypeToken.actorLink).length > 0;\r\n\r\n function setActorFromSelectedToken() {\r\n if (canvas.tokens.controlled.length === 0) return;\r\n actor = canvas.tokens.controlled[0].actor;\r\n }\r\n\r\n async function dropData(event) {\r\n counter = 0;\r\n let data;\r\n try {\r\n data = JSON.parse(event.dataTransfer.getData('text/plain'));\r\n } catch (err) {\r\n return false;\r\n }\r\n if (data.type !== \"Actor\") return;\r\n actor = getSourceActorFromDropData(data);\r\n }\r\n\r\n let counter = 0;\r\n\r\n function dragEnter() {\r\n counter++;\r\n }\r\n\r\n function dragLeave() {\r\n counter--;\r\n }\r\n\r\n function preventDefault(event) {\r\n event.preventDefault();\r\n }\r\n\r\n</script>\r\n\r\n\r\n<div class=\"item-piles-bottom-divider\">\r\n\t<div class=\"form-group item-piles-actor-container align-center-row\"\r\n\t\t\t class:item-piles-box-highlight={counter > 0}\r\n\t\t\t on:dragenter={dragEnter}\r\n\t\t\t on:dragleave={dragLeave}\r\n\t\t\t on:dragover={preventDefault}\r\n\t\t\t on:dragstart={preventDefault}\r\n\t\t\t on:drop={dropData}\r\n\t>\r\n\t\t{#if actor}\r\n\t\t\t<div class=\"align-center-col\">\r\n\t\t\t\t{#if actor.img}\r\n\t\t\t\t\t<img src=\"{actor.img}\">\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t\t{#if multipleActors}\r\n <span>\r\n {#if changingActor}\r\n <select class=\"item-piles-change-actor-select\"\r\n\t\t\t\t\t\t\t\t\t\t\tbind:value={actor}\r\n\t\t\t\t\t\t\t\t\t\t\ton:change={() => { changingActor = false }}\r\n\t\t\t\t\t\t\t>\r\n {#each actors as potentialActor (potentialActor.id)}\r\n <option value=\"{potentialActor}\">{ potentialActor.name }</option>\r\n {/each}\r\n </select>\r\n {:else}\r\n <a class='item-piles-change-actor item-piles-highlight'\r\n\t\t\t\t\t\t\t\t on:click={() => { changingActor = true }}>{ actor.name }</a>\r\n {/if}\r\n </span>\r\n\t\t\t\t{:else}\r\n\t\t\t\t\t<span>{ actor.name }</span>\r\n\t\t\t\t{/if}\r\n\r\n\t\t\t</div>\r\n\t\t{:else}\r\n\t\t\t<p>{ localize(\"ITEM-PILES.Trade.Prompt.DropActor\") }</p>\r\n\t\t{/if}\r\n\t</div>\r\n\t{#if hasUnlinkedTokenOwnership}\r\n\t\t<div class=\"item-piles-flexrow\">\r\n\t\t\t<button type=\"button\" on:click={setActorFromSelectedToken}>\r\n\t\t\t\t<i class=\"fas fa-expand\"></i>\r\n\t\t\t\t{localize(\"ITEM-PILES.Trade.Prompt.PickToken\")}\r\n\t\t\t</button>\r\n\t\t</div>\r\n\t{/if}\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n .item-piles-actor-container {\r\n margin-bottom: 1rem;\r\n min-height: 150px;\r\n padding: 0.5rem;\r\n text-align: center;\r\n border: 1px solid gray;\r\n border-radius: 5px;\r\n\r\n img {\r\n border: 0;\r\n max-height: 80px;\r\n max-width: 80px;\r\n width: auto;\r\n height: auto;\r\n border-radius: 5px;\r\n filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));\r\n margin-bottom: 10px;\r\n }\r\n\r\n span {\r\n font-size: 1.5rem;\r\n text-align: center;\r\n }\r\n }\r\n\r\n .item-piles-box-highlight {\r\n box-shadow: 0 0 20px inset var(--color-shadow-highlight, #ff6400);\r\n }\r\n\r\n .item-piles-change-actor-select {\r\n height: 23px;\r\n }\r\n\r\n</style>\r\n","<script>\r\n\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { getContext } from \"svelte\";\r\n import ActorDropSelect from \"./ActorDropSelect.svelte\";\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let elementRoot;\r\n export let isPrivate;\r\n export let users;\r\n export let user;\r\n export let actors;\r\n export let actor;\r\n\r\n let isGM = game.user.isGM;\r\n\r\n users = game.users.filter(user => user.active && user !== game.user);\r\n user = user || users?.[0] || false;\r\n actors = actors || game.actors.filter(actor => actor.isOwner);\r\n actor = actor || game.user.character || (!isGM ? actors?.[0] : false);\r\n\r\n function requestTrade() {\r\n application.options.resolve({\r\n user,\r\n actor,\r\n isPrivate\r\n });\r\n application.close();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<div class=\"item-piles-flexcol trade-dialog\">\r\n\r\n\t\t<p><i class=\"item-piles-header-icon fas fa-handshake\"></i></p>\r\n\r\n\t\t<p style=\"margin-bottom: 1rem\">\r\n\t\t\t<strong style=\"font-size:1.2rem;\">\r\n\t\t\t\t{localize(\"ITEM-PILES.Trade.Prompt.Title\")}\r\n\t\t\t</strong>\r\n\t\t</p>\r\n\r\n\t\t<p>{localize(\"ITEM-PILES.Trade.Prompt.User\")}</p>\r\n\r\n\t\t<div class=\"item-piles-bottom-divider\">\r\n\t\t\t<div class=\"form-group align-center-row\">\r\n\t\t\t\t<select bind:value={user} name=\"user\" style=\"width: 66%;\">\r\n\t\t\t\t\t{#each users as potentialUser (potentialUser.id)}\r\n\t\t\t\t\t\t<option value=\"{potentialUser}\">{potentialUser.name}</option>\r\n\t\t\t\t\t{/each}\r\n\t\t\t\t</select>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div class=\"item-piles-bottom-divider\">\r\n\t\t\t<div class=\"form-group align-center-col\">\r\n\t\t\t\t<label class=\"align-center-row\">\r\n\t\t\t\t\t<input bind:checked={isPrivate} name=\"private\" type=\"checkbox\">\r\n\t\t\t\t\t<span>{localize(\"ITEM-PILES.Trade.Private\")}</span>\r\n\t\t\t\t</label>\r\n\t\t\t\t<small>{localize(\"ITEM-PILES.Trade.PrivateExplanation\")}</small>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\r\n\t\t{#if actor}\r\n\t\t\t<p>{localize(\"ITEM-PILES.Trade.Prompt.PickedActor\")}</p>\r\n\t\t{:else}\r\n\t\t\t<p>{localize(\"ITEM-PILES.Trade.Prompt.PickActor\")}</p>\r\n\t\t{/if}\r\n\r\n\t\t<ActorDropSelect {actors} bind:actor={actor}/>\r\n\r\n\t\t<footer class=\"sheet-footer item-piles-flexrow\">\r\n\t\t\t<button disabled={!actor} on:click|once={requestTrade} type=\"button\">\r\n\t\t\t\t<i class=\"fas fa-check\"></i> {localize(\"ITEM-PILES.Trade.Prompt.Label\")}\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t</div>\r\n\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .trade-dialog {\r\n text-align: center;\r\n }\r\n\r\n .item-piles-header-icon {\r\n font-size: 3rem;\r\n }\r\n\r\n .item-piles-actor-container {\r\n margin-bottom: 0.25rem;\r\n min-height: 150px;\r\n padding: 0.5rem;\r\n text-align: center;\r\n border: 1px solid gray;\r\n border-radius: 5px;\r\n\r\n img {\r\n border: 0;\r\n max-height: 80px;\r\n max-width: 80px;\r\n width: auto;\r\n height: auto;\r\n border-radius: 5px;\r\n filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));\r\n margin-bottom: 10px;\r\n }\r\n\r\n span {\r\n font-size: 1.5rem;\r\n text-align: center;\r\n }\r\n }\r\n\r\n .item-piles-box-highlight {\r\n box-shadow: 0 0 20px inset var(--color-shadow-highlight, #ff6400);\r\n }\r\n\r\n .item-piles-change-actor-select {\r\n height: 23px;\r\n }\r\n\r\n button:disabled {\r\n opacity: 0.75;\r\n }\r\n\r\n</style>\r\n","import { writable } from '../store/index.mjs';\nimport { now, loop, assign } from '../internal/index.mjs';\nimport { linear } from '../easing/index.mjs';\n\nfunction is_date(obj) {\n return Object.prototype.toString.call(obj) === '[object Date]';\n}\n\nfunction tick_spring(ctx, last_value, current_value, target_value) {\n if (typeof current_value === 'number' || is_date(current_value)) {\n // @ts-ignore\n const delta = target_value - current_value;\n // @ts-ignore\n const velocity = (current_value - last_value) / (ctx.dt || 1 / 60); // guard div by 0\n const spring = ctx.opts.stiffness * delta;\n const damper = ctx.opts.damping * velocity;\n const acceleration = (spring - damper) * ctx.inv_mass;\n const d = (velocity + acceleration) * ctx.dt;\n if (Math.abs(d) < ctx.opts.precision && Math.abs(delta) < ctx.opts.precision) {\n return target_value; // settled\n }\n else {\n ctx.settled = false; // signal loop to keep ticking\n // @ts-ignore\n return is_date(current_value) ?\n new Date(current_value.getTime() + d) : current_value + d;\n }\n }\n else if (Array.isArray(current_value)) {\n // @ts-ignore\n return current_value.map((_, i) => tick_spring(ctx, last_value[i], current_value[i], target_value[i]));\n }\n else if (typeof current_value === 'object') {\n const next_value = {};\n for (const k in current_value) {\n // @ts-ignore\n next_value[k] = tick_spring(ctx, last_value[k], current_value[k], target_value[k]);\n }\n // @ts-ignore\n return next_value;\n }\n else {\n throw new Error(`Cannot spring ${typeof current_value} values`);\n }\n}\nfunction spring(value, opts = {}) {\n const store = writable(value);\n const { stiffness = 0.15, damping = 0.8, precision = 0.01 } = opts;\n let last_time;\n let task;\n let current_token;\n let last_value = value;\n let target_value = value;\n let inv_mass = 1;\n let inv_mass_recovery_rate = 0;\n let cancel_task = false;\n function set(new_value, opts = {}) {\n target_value = new_value;\n const token = current_token = {};\n if (value == null || opts.hard || (spring.stiffness >= 1 && spring.damping >= 1)) {\n cancel_task = true; // cancel any running animation\n last_time = now();\n last_value = new_value;\n store.set(value = target_value);\n return Promise.resolve();\n }\n else if (opts.soft) {\n const rate = opts.soft === true ? .5 : +opts.soft;\n inv_mass_recovery_rate = 1 / (rate * 60);\n inv_mass = 0; // infinite mass, unaffected by spring forces\n }\n if (!task) {\n last_time = now();\n cancel_task = false;\n task = loop(now => {\n if (cancel_task) {\n cancel_task = false;\n task = null;\n return false;\n }\n inv_mass = Math.min(inv_mass + inv_mass_recovery_rate, 1);\n const ctx = {\n inv_mass,\n opts: spring,\n settled: true,\n dt: (now - last_time) * 60 / 1000\n };\n const next_value = tick_spring(ctx, last_value, value, target_value);\n last_time = now;\n last_value = value;\n store.set(value = next_value);\n if (ctx.settled) {\n task = null;\n }\n return !ctx.settled;\n });\n }\n return new Promise(fulfil => {\n task.promise.then(() => {\n if (token === current_token)\n fulfil();\n });\n });\n }\n const spring = {\n set,\n update: (fn, opts) => set(fn(target_value, value), opts),\n subscribe: store.subscribe,\n stiffness,\n damping,\n precision\n };\n return spring;\n}\n\nfunction get_interpolator(a, b) {\n if (a === b || a !== a)\n return () => a;\n const type = typeof a;\n if (type !== typeof b || Array.isArray(a) !== Array.isArray(b)) {\n throw new Error('Cannot interpolate values of different type');\n }\n if (Array.isArray(a)) {\n const arr = b.map((bi, i) => {\n return get_interpolator(a[i], bi);\n });\n return t => arr.map(fn => fn(t));\n }\n if (type === 'object') {\n if (!a || !b)\n throw new Error('Object cannot be null');\n if (is_date(a) && is_date(b)) {\n a = a.getTime();\n b = b.getTime();\n const delta = b - a;\n return t => new Date(a + t * delta);\n }\n const keys = Object.keys(b);\n const interpolators = {};\n keys.forEach(key => {\n interpolators[key] = get_interpolator(a[key], b[key]);\n });\n return t => {\n const result = {};\n keys.forEach(key => {\n result[key] = interpolators[key](t);\n });\n return result;\n };\n }\n if (type === 'number') {\n const delta = b - a;\n return t => a + t * delta;\n }\n throw new Error(`Cannot interpolate ${type} values`);\n}\nfunction tweened(value, defaults = {}) {\n const store = writable(value);\n let task;\n let target_value = value;\n function set(new_value, opts) {\n if (value == null) {\n store.set(value = new_value);\n return Promise.resolve();\n }\n target_value = new_value;\n let previous_task = task;\n let started = false;\n let { delay = 0, duration = 400, easing = linear, interpolate = get_interpolator } = assign(assign({}, defaults), opts);\n if (duration === 0) {\n if (previous_task) {\n previous_task.abort();\n previous_task = null;\n }\n store.set(value = target_value);\n return Promise.resolve();\n }\n const start = now() + delay;\n let fn;\n task = loop(now => {\n if (now < start)\n return true;\n if (!started) {\n fn = interpolate(value, new_value);\n if (typeof duration === 'function')\n duration = duration(value, new_value);\n started = true;\n }\n if (previous_task) {\n previous_task.abort();\n previous_task = null;\n }\n const elapsed = now - start;\n if (elapsed > duration) {\n store.set(value = new_value);\n return false;\n }\n // @ts-ignore\n store.set(value = fn(easing(elapsed / duration)));\n return true;\n });\n return task.promise;\n }\n return {\n set,\n update: (fn, opts) => set(fn(target_value, value), opts),\n subscribe: store.subscribe\n };\n}\n\nexport { spring, tweened };\n","<script>\r\n\r\n import { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\r\n import { getContext } from \"svelte\";\r\n import { tweened } from 'svelte/motion';\r\n import { linear } from 'svelte/easing';\r\n import * as Helpers from \"../../helpers/helpers.js\";\r\n import ActorDropSelect from \"./ActorDropSelect.svelte\";\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n\r\n const { application } = getContext('#external');\r\n\r\n export let elementRoot;\r\n export let isPrivate;\r\n export let tradingActor;\r\n export let tradingUser;\r\n export let users;\r\n export let user;\r\n export let actors;\r\n export let actor;\r\n\r\n let isGM = game.user.isGM;\r\n\r\n users = game.users.filter(user => user.active && user !== game.user);\r\n user = user || users?.[0] || false;\r\n actors = actors || game.actors.filter(actor => actor.isOwner);\r\n actor = actor || game.user.character || (!isGM ? actors?.[0] : false);\r\n\r\n let done = false;\r\n\r\n async function accept() {\r\n application.options.resolve(actor);\r\n close();\r\n }\r\n\r\n async function decline() {\r\n application.options.resolve(false);\r\n close();\r\n }\r\n\r\n async function mute() {\r\n application.options.resolve(\"mute\");\r\n close();\r\n }\r\n\r\n async function disconnected() {\r\n Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Trade.Disconnected\"), true)\r\n close();\r\n }\r\n\r\n const progress = tweened(0, {\r\n duration: 20000,\r\n easing: linear\r\n });\r\n\r\n $: actualProgress = $progress * 100;\r\n\r\n let timeout = setTimeout(() => {\r\n if (done) return;\r\n progress.set(1);\r\n timeout = setTimeout(() => {\r\n if (done) return;\r\n Helpers.custom_warning(localize(\"ITEM-PILES.Trade.AutoDecline\"), true)\r\n decline();\r\n }, 21000)\r\n }, 14000);\r\n\r\n const connection = setInterval(() => {\r\n const user = game.users.get(tradingUser.id)\r\n if (!user.active) {\r\n disconnected();\r\n }\r\n }, 100);\r\n\r\n function close() {\r\n clearInterval(connection);\r\n clearTimeout(timeout);\r\n done = true;\r\n application.close();\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t<div class=\"item-piles-flexcol trade-dialog\">\r\n\r\n\t\t<p><i class=\"item-piles-header-icon fas fa-handshake\"></i></p>\r\n\r\n\t\t<p style=\"margin-bottom: 1rem\">\r\n\t\t\t<strong style=\"font-size:1.2rem;\">\r\n\t\t\t\t{ localize(\"ITEM-PILES.Trade.Request.Title\") }\r\n\t\t\t</strong>\r\n\t\t</p>\r\n\r\n\t\t<div class=\"item-piles-bottom-divider\">\r\n\t\t\t{#if isPrivate}\r\n\t\t\t\t<p>{@html localize(\"ITEM-PILES.Trade.Request.PrivateContent\", {\r\n trading_user_name: tradingUser.name,\r\n trading_actor_name: tradingActor.name\r\n })}</p>\r\n\t\t\t{:else}\r\n\t\t\t\t<p>{localize(\"ITEM-PILES.Trade.Request.Content\", {\r\n trading_user_name: tradingUser.name,\r\n trading_actor_name: tradingActor.name\r\n })}</p>\r\n\t\t\t{/if}\r\n\t\t\t<p>{localize(\"ITEM-PILES.Trade.Request.AcceptQuery\")}</p>\r\n\t\t</div>\r\n\r\n\t\t{#if actor}\r\n\t\t\t<p>{localize(\"ITEM-PILES.Trade.Prompt.PickedActor\")}</p>\r\n\t\t{:else}\r\n\t\t\t<p>{localize(\"ITEM-PILES.Trade.Prompt.PickActor\")}</p>\r\n\t\t{/if}\r\n\r\n\t\t<ActorDropSelect {actors} bind:actor={actor}/>\r\n\r\n\t\t<footer class=\"sheet-footer item-piles-flexrow\">\r\n\t\t\t<button disabled={!actor} on:click|once={accept} type=\"button\">\r\n\t\t\t\t<i class=\"fas fa-check\"></i> {localize(\"ITEM-PILES.Trade.Accept\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={decline} type=\"button\">\r\n\t\t\t\t<i class=\"fas fa-times\"></i> {localize(\"ITEM-PILES.Trade.Decline\")}\r\n\t\t\t</button>\r\n\t\t\t<button on:click|once={mute} type=\"button\">\r\n\t\t\t\t<i class=\"fas fa-comment-slash\"></i> {localize(\"ITEM-PILES.Trade.Mute\")}\r\n\t\t\t</button>\r\n\t\t</footer>\r\n\r\n\t\t<div class=\"item-piles-progress\" class:active={actualProgress > 0} style=\"flex: 1 0 auto;\">\r\n\t\t\t<span class=\"progress-bar\" style=\"width: {actualProgress}%;\"></span>\r\n\t\t</div>\r\n\t</div>\r\n\r\n</ApplicationShell>\r\n\r\n<style lang=\"scss\">\r\n\r\n .trade-dialog {\r\n text-align: center;\r\n }\r\n\r\n .item-piles-header-icon {\r\n font-size: 3rem;\r\n }\r\n\r\n .item-piles-progress {\r\n width: calc(100% - 4px);\r\n background: #e1e4e8;\r\n border-radius: 3px;\r\n overflow: hidden;\r\n margin: 0.25rem 2px 0 2px;\r\n height: 6px;\r\n display: none;\r\n\r\n &.active {\r\n display: block;\r\n }\r\n\r\n .progress-bar {\r\n display: block;\r\n height: 100%;\r\n background-color: rgba(255, 20, 20, 0.65);\r\n }\r\n }\r\n\r\n button:disabled {\r\n opacity: 0.75;\r\n }\r\n\r\n</style>\r\n","import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport TradeDialogPrompt from './trade-dialog-prompt.svelte';\r\nimport TradeDialogRequest from './trade-dialog-request.svelte';\r\n\r\nexport class TradePromptDialog extends SvelteApplication {\r\n\r\n constructor(tradeOptions, options = {}) {\r\n super({\r\n svelte: {\r\n class: TradeDialogPrompt,\r\n target: document.body,\r\n props: {\r\n ...tradeOptions\r\n }\r\n },\r\n close: () => this.options.resolve?.(null),\r\n ...options\r\n });\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: game.i18n.localize(\"ITEM-PILES.Trade.Title\"),\r\n width: 400,\r\n height: \"auto\",\r\n classes: [\"dialog\", \"item-piles-app\"],\r\n })\r\n }\r\n\r\n static show(tradeOptions, options = {}, dialogData = {}) {\r\n return new Promise(resolve => {\r\n options.resolve = resolve;\r\n new this(tradeOptions, options, dialogData).render(true);\r\n })\r\n }\r\n}\r\n\r\nexport class TradeRequestDialog extends SvelteApplication {\r\n\r\n constructor(tradeOptions, options = {}) {\r\n\r\n super({\r\n svelte: {\r\n class: TradeDialogRequest,\r\n target: document.body,\r\n props: {\r\n ...tradeOptions\r\n }\r\n },\r\n close: () => this.options.resolve?.(null),\r\n ...options\r\n });\r\n this.tradeId = tradeOptions.tradeId;\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n title: game.i18n.localize(\"ITEM-PILES.Trade.Title\"),\r\n width: 400,\r\n height: \"auto\",\r\n classes: [\"dialog\"],\r\n })\r\n }\r\n\r\n static show(tradeOptions, options = {}) {\r\n return new Promise(resolve => {\r\n options.resolve = resolve;\r\n new this(tradeOptions, options).render(true);\r\n })\r\n }\r\n\r\n static cancel(tradeId) {\r\n for (const app of Object.values(ui.windows)) {\r\n if (app instanceof this && app.tradeId === tradeId) {\r\n app.options.resolve({ type: \"cancelled\" });\r\n return app.close();\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n}\r\n","import { get, writable } from 'svelte/store';\r\nimport * as Utilities from \"../../helpers/utilities.js\";\r\nimport * as PileUtilities from \"../../helpers/pile-utilities.js\";\r\n\r\nexport default class TradeStore {\r\n\r\n constructor(instigator, leftTrader, rightTrader, publicTradeId, privateTradeId = false, isPrivate = false) {\r\n\r\n this.instigator = instigator;\r\n this.publicTradeId = publicTradeId;\r\n this.privateTradeId = privateTradeId;\r\n this.isPrivate = isPrivate;\r\n\r\n this.leftTraderUser = leftTrader.user;\r\n this.leftTraderActor = leftTrader.actor;\r\n this.leftTraderItems = writable(leftTrader.items ?? []);\r\n this.leftTraderCurrencies = writable(leftTrader.currencies ?? []);\r\n this.leftTraderItemCurrencies = writable(leftTrader.itemCurrencies ?? []);\r\n this.leftTraderAccepted = writable(leftTrader.accepted ?? false);\r\n\r\n this.rightTraderUser = rightTrader.user;\r\n this.rightTraderActor = rightTrader.actor;\r\n this.rightTraderItems = writable(rightTrader.items ?? []);\r\n this.rightTraderCurrencies = writable(rightTrader.currencies ?? []);\r\n this.rightTraderItemCurrencies = writable(rightTrader.itemCurrencies ?? []);\r\n this.rightTraderAccepted = writable(rightTrader?.accepted ?? false);\r\n\r\n }\r\n\r\n get isUserParticipant() {\r\n return game.user === this.leftTraderUser || game.user === this.rightTraderUser;\r\n }\r\n\r\n get tradeIsAccepted() {\r\n return get(this.leftTraderAccepted) && get(this.rightTraderAccepted);\r\n }\r\n\r\n static import(tradeData) {\r\n\r\n const leftTrader = {\r\n user: game.users.get(tradeData.leftTraderData.user),\r\n actor: fromUuidSync(tradeData.leftTraderData.actor),\r\n items: tradeData.leftTraderData.items,\r\n currencies: tradeData.leftTraderData.currencies,\r\n itemCurrencies: tradeData.leftTraderData.itemCurrencies,\r\n accepted: tradeData.leftTraderData.accepted\r\n };\r\n\r\n const rightTrader = {\r\n user: game.users.get(tradeData.rightTraderData.user),\r\n actor: fromUuidSync(tradeData.rightTraderData.actor),\r\n items: tradeData.rightTraderData.items,\r\n currencies: tradeData.rightTraderData.currencies,\r\n itemCurrencies: tradeData.rightTraderData.itemCurrencies,\r\n accepted: tradeData.rightTraderData.accepted\r\n };\r\n\r\n return new this(tradeData.instigator, leftTrader, rightTrader, tradeData.publicTradeId);\r\n }\r\n\r\n export() {\r\n return {\r\n instigator: this.instigator,\r\n publicTradeId: this.publicTradeId,\r\n leftTraderData: {\r\n user: this.leftTraderUser.id,\r\n actor: Utilities.getUuid(this.leftTraderActor),\r\n items: get(this.leftTraderItems),\r\n currencies: get(this.leftTraderCurrencies),\r\n itemCurrencies: get(this.leftTraderItemCurrencies),\r\n accepted: get(this.leftTraderAccepted)\r\n },\r\n rightTraderData: {\r\n user: this.rightTraderUser.id,\r\n actor: Utilities.getUuid(this.rightTraderActor),\r\n items: get(this.rightTraderItems),\r\n currencies: get(this.rightTraderCurrencies),\r\n itemCurrencies: get(this.rightTraderItemCurrencies),\r\n accepted: get(this.rightTraderAccepted)\r\n }\r\n }\r\n }\r\n\r\n getTradeData() {\r\n return {\r\n sourceActor: this.leftTraderActor,\r\n targetActor: this.rightTraderActor,\r\n remove: {\r\n items: get(this.leftTraderItems).concat(get(this.leftTraderItemCurrencies)),\r\n attributes: get(this.leftTraderCurrencies)\r\n }, add: {\r\n items: get(this.rightTraderItems).concat(get(this.rightTraderItemCurrencies)),\r\n attributes: get(this.rightTraderCurrencies)\r\n }\r\n };\r\n }\r\n\r\n getExistingCurrencies() {\r\n return [...get(this.leftTraderCurrencies), ...get(this.leftTraderItemCurrencies)]\r\n }\r\n\r\n async toggleAccepted() {\r\n this.leftTraderAccepted.set(!get(this.leftTraderAccepted));\r\n }\r\n\r\n updateItems(userId, inItems) {\r\n if (userId === game.user.id) return;\r\n this.leftTraderAccepted.set(false);\r\n this.rightTraderAccepted.set(false);\r\n if (userId === this.leftTraderUser.id) {\r\n this.leftTraderItems.set(inItems)\r\n }\r\n if (userId === this.rightTraderUser.id) {\r\n this.rightTraderItems.set(inItems)\r\n }\r\n }\r\n\r\n updateItemCurrencies(userId, itemCurrencies) {\r\n if (userId === game.user.id) return;\r\n this.leftTraderAccepted.set(false);\r\n this.rightTraderAccepted.set(false);\r\n if (userId === this.leftTraderUser.id) {\r\n this.leftTraderItemCurrencies.set(itemCurrencies)\r\n }\r\n if (userId === this.rightTraderUser.id) {\r\n this.rightTraderItemCurrencies.set(itemCurrencies)\r\n }\r\n }\r\n\r\n updateCurrencies(userId, inCurrencies) {\r\n if (userId === game.user.id) return;\r\n this.leftTraderAccepted.set(false);\r\n this.rightTraderAccepted.set(false);\r\n if (userId === this.leftTraderUser.id) {\r\n this.leftTraderCurrencies.set(inCurrencies)\r\n }\r\n if (userId === this.rightTraderUser.id) {\r\n this.rightTraderCurrencies.set(inCurrencies)\r\n }\r\n }\r\n\r\n updateAcceptedState(userId, state) {\r\n if (userId === game.user.id) return;\r\n if (userId === this.leftTraderUser.id) {\r\n this.leftTraderAccepted.set(state);\r\n }\r\n if (userId === this.rightTraderUser.id) {\r\n this.rightTraderAccepted.set(state);\r\n }\r\n }\r\n\r\n addItem(newItem, { uuid = false, quantity = false, currency = false } = {}) {\r\n\r\n const items = !currency\r\n ? get(this.leftTraderItems)\r\n : get(this.leftTraderItemCurrencies);\r\n\r\n const item = Utilities.findSimilarItem(items, newItem)\r\n\r\n const maxQuantity = game.user.isGM ? Infinity : Utilities.getItemQuantity(newItem);\r\n\r\n if (item && PileUtilities.canItemStack(item)) {\r\n if (item.quantity >= maxQuantity) return;\r\n if (quantity) {\r\n item.quantity = Math.min(quantity ? quantity : item.quantity + 1, maxQuantity);\r\n item.newQuantity = item.quantity;\r\n item.maxQuantity = maxQuantity;\r\n } else {\r\n items.splice(items.indexOf(item));\r\n }\r\n } else if (!item && quantity) {\r\n items.push({\r\n id: newItem._id ?? newItem.id,\r\n uuid: uuid,\r\n name: newItem.name,\r\n img: newItem?.img ?? \"\",\r\n type: newItem?.type,\r\n currency: currency,\r\n quantity: quantity ? quantity : 1,\r\n newQuantity: quantity ? quantity : 1,\r\n maxQuantity: maxQuantity,\r\n data: newItem instanceof Item ? newItem.toObject() : newItem\r\n })\r\n }\r\n\r\n if (!currency) {\r\n this.leftTraderItems.set(items);\r\n } else {\r\n this.leftTraderItemCurrencies.set(items);\r\n }\r\n\r\n }\r\n\r\n addAttribute(newCurrency) {\r\n\r\n const currencies = get(this.leftTraderCurrencies);\r\n\r\n const existingCurrency = currencies.find(currency => currency.path === newCurrency.path);\r\n\r\n if (existingCurrency) {\r\n existingCurrency.quantity = newCurrency.quantity;\r\n existingCurrency.newQuantity = newCurrency.quantity;\r\n } else {\r\n currencies.push(newCurrency);\r\n }\r\n\r\n currencies.sort((a, b) => a.index - b.index);\r\n\r\n this.leftTraderCurrencies.set(currencies);\r\n\r\n }\r\n\r\n removeEntry(entry) {\r\n\r\n if (entry.id) {\r\n\r\n if (!entry.currency) {\r\n\r\n const items = get(this.leftTraderItems)\r\n .filter(item => item.id !== entry.id);\r\n\r\n this.leftTraderItems.set(items);\r\n\r\n } else {\r\n\r\n const items = get(this.leftTraderItemCurrencies)\r\n .filter(item => item.id !== entry.id);\r\n\r\n this.leftTraderItemCurrencies.set(items);\r\n\r\n }\r\n\r\n } else {\r\n\r\n const items = get(this.leftTraderCurrencies)\r\n .filter(currency => currency.path !== entry.path);\r\n\r\n this.leftTraderCurrencies.set(items);\r\n\r\n }\r\n\r\n }\r\n\r\n}\r\n","<script>\r\n\r\n import * as Helpers from \"../../helpers/helpers.js\";\r\n import SETTINGS from \"../../constants/settings.js\";\r\n\r\n export let store;\r\n export let data;\r\n export let editable = true;\r\n\r\n const canPreview = data.id && (Helpers.getSetting(SETTINGS.INSPECT_ITEMS_IN_TRADE) || editable)\r\n\r\n function previewItem() {\r\n if (!canPreview || !data.id) return;\r\n const item = store.leftTraderActor.items.get(data.id) ?? store.rightTraderActor.items.get(data.id);\r\n if (!item) return;\r\n if (game.user.isGM || item.ownership[game.user.id] === CONST.DOCUMENT_PERMISSION_LEVELS.OWNER) {\r\n return item.sheet.render(true);\r\n }\r\n const cls = item._getSheetClass()\r\n const sheet = new cls(item, { editable: false })\r\n return sheet._render(true);\r\n }\r\n\r\n function onKeyDown(e) {\r\n if (e.keyCode === 13) {\r\n updateQuantity();\r\n }\r\n }\r\n\r\n function updateQuantity() {\r\n data.quantity = Math.max(0, Math.min(data.maxQuantity, data.newQuantity));\r\n if (data.quantity === 0) {\r\n return store.removeEntry(data);\r\n }\r\n data.newQuantity = data.quantity;\r\n data.editing = false;\r\n }\r\n\r\n</script>\r\n\r\n<svelte:window on:click={() => {\r\n if(data.editing && editable) updateQuantity();\r\n}}/>\r\n\r\n<div class=\"item-piles-flexrow item-piles-item-row item-piles-even-color\">\r\n\r\n\t{#if editable}\r\n\t\t<div style=\"flex: 0 1 auto; margin: 0 6px;\">\r\n\t\t\t<a class=\"item-piles-clickable-red\" on:click={() => { store.removeEntry(data) }}>\r\n\t\t\t\t<i class=\"fas fa-times\"></i>\r\n\t\t\t</a>\r\n\t\t</div>\r\n\t{/if}\r\n\r\n\t<div class=\"item-piles-img-container\">\r\n\t\t<img class=\"item-piles-img\" src=\"{data.img}\"/>\r\n\t</div>\r\n\r\n\t<div class=\"item-piles-name item-piles-text\">\r\n\t\t<div class=\"item-piles-name-container\">\r\n\t\t\t<p class:item-piles-clickable-link=\"{canPreview}\" on:click={previewItem}>{data.name}</p>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t{#if editable}\r\n\t\t<div style=\"flex: 0 1 17px; margin: 0 5px;\">\r\n\t\t\t{#if data.editing}\r\n\t\t\t\t<a class=\"item-piles-clickable-green item-piles-confirm-quantity\" on:click=\"{updateQuantity}\">\r\n\t\t\t\t\t<i class=\"fas fa-check\"></i>\r\n\t\t\t\t</a>\r\n\t\t\t{/if}\r\n\t\t</div>\r\n\t{/if}\r\n\r\n\t<div class=\"item-piles-text-right\" class:item-piles-quantity-container={editable}\r\n\t\t\t on:click={(evt) => evt.stopPropagation()}>\r\n\t\t{#if editable}\r\n\t\t\t<div class=\"item-piles-quantity-container\">\r\n\t\t\t\t{#if data.editing}\r\n\t\t\t\t\t<div class=\"item-piles-quantity-input-container\">\r\n\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\tclass=\"item-piles-quantity\"\r\n\t\t\t\t\t\t\ttype=\"number\"\r\n\t\t\t\t\t\t\tbind:value={data.newQuantity}\r\n\t\t\t\t\t\t\ton:keydown={onKeyDown}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t{:else}\r\n <span class=\"item-piles-quantity-text\"\r\n\t\t\t\t\t\t\t\t\ton:click=\"{ () => { data.editing = true } }\">\r\n {data.quantity}\r\n </span>\r\n\t\t\t\t{/if}\r\n\t\t\t</div>\r\n\t\t{:else}\r\n\t\t\t<span class=\"item-piles-text\" style=\"padding-right:0.5rem;\">{data.quantity}</span>\r\n\t\t{/if}\r\n\t</div>\r\n</div>\r\n","<script>\r\n\r\n import { fade } from 'svelte/transition';\r\n import { localize } from \"@typhonjs-fvtt/runtime/svelte/helper\";\r\n import DropZone from \"../components/DropZone.svelte\";\r\n import { ApplicationShell } from \"@typhonjs-fvtt/runtime/svelte/component/core\";\r\n import * as Helpers from \"../../helpers/helpers.js\";\r\n import * as PileUtilities from \"../../helpers/pile-utilities.js\";\r\n import ItemPileSocket from \"../../socket.js\";\r\n import TradeEntry from \"./TradeEntry.svelte\";\r\n import DropCurrencyDialog from \"../dialogs/drop-currency-dialog/drop-currency-dialog.js\";\r\n import * as Utilities from \"../../helpers/utilities.js\";\r\n\r\n export let elementRoot;\r\n export let store;\r\n\r\n const leftItems = store.leftTraderItems;\r\n const leftCurrencies = store.leftTraderCurrencies;\r\n const leftItemCurrencies = store.leftTraderItemCurrencies;\r\n const leftTraderAccepted = store.leftTraderAccepted;\r\n\r\n const rightItems = store.rightTraderItems;\r\n const rightCurrencies = store.rightTraderCurrencies;\r\n const rightItemCurrencies = store.rightTraderItemCurrencies;\r\n const rightTraderAccepted = store.rightTraderAccepted;\r\n\r\n let isGM = game.user.isGM;\r\n let systemHasCurrencies = game.itempiles.API.CURRENCIES.length > 0;\r\n\r\n async function dropItem(data) {\r\n\r\n if (data.type !== \"Item\") return;\r\n\r\n let item = (await Item.implementation.fromDropData(data)).toObject();\r\n\r\n data.actorId = Utilities.getSourceActorFromDropData(data)?.id;\r\n\r\n if (!data.actorId && !game.user.isGM) {\r\n return Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Errors.NoSourceDrop\"), true)\r\n }\r\n\r\n if (!game.user.isGM && data.actorId && data.actorId !== store.leftTraderActor.id) {\r\n throw Helpers.custom_error(`You cannot drop items into the trade UI from a different actor than ${store.leftTraderActor.name}!`)\r\n }\r\n\r\n const validItem = await PileUtilities.checkItemType(store.rightTraderActor, item, {\r\n errorText: \"ITEM-PILES.Errors.DisallowedItemTrade\",\r\n warningTitle: \"ITEM-PILES.Dialogs.TypeWarning.Title\",\r\n warningContent: \"ITEM-PILES.Dialogs.TypeWarning.TradeContent\"\r\n });\r\n if (!validItem) return;\r\n\r\n const actorItemCurrencyList = PileUtilities.getCurrencyList(store.leftTraderActor).filter(entry => entry.type !== \"attribute\");\r\n const isCurrency = !!Utilities.findSimilarItem(actorItemCurrencyList.map(item => item.data), validItem);\r\n\r\n if (!validItem._id) {\r\n validItem._id = item._id;\r\n }\r\n\r\n const itemToSend = await Item.implementation.create(validItem, { temporary: true });\r\n\r\n return store.addItem(itemToSend, { uuid: data.uuid, quantity: 1, currency: isCurrency });\r\n\r\n }\r\n\r\n if (store.isUserParticipant) {\r\n const itemsUpdatedDebounce = debounce(async (items) => {\r\n await ItemPileSocket.executeForUsers(ItemPileSocket.HANDLERS.PRIVATE_TRADE_UPDATE_ITEMS, [store.leftTraderUser.id, store.rightTraderUser.id], store.privateTradeId, game.user.id, items);\r\n return executeSocketAction(ItemPileSocket.HANDLERS.PUBLIC_TRADE_UPDATE_ITEMS, store.publicTradeId, game.user.id, items);\r\n }, 20)\r\n leftItems.subscribe(itemsUpdatedDebounce)\r\n\r\n const itemCurrenciesUpdatedDebounce = debounce(async (items) => {\r\n await ItemPileSocket.executeForUsers(ItemPileSocket.HANDLERS.PRIVATE_TRADE_UPDATE_ITEM_CURRENCIES, [store.leftTraderUser.id, store.rightTraderUser.id], store.privateTradeId, game.user.id, items);\r\n return executeSocketAction(ItemPileSocket.HANDLERS.PUBLIC_TRADE_UPDATE_ITEM_CURRENCIES, store.publicTradeId, game.user.id, items);\r\n }, 20)\r\n leftItemCurrencies.subscribe(itemCurrenciesUpdatedDebounce)\r\n\r\n const attributesUpdatedDebounce = debounce(async (attributes) => {\r\n await ItemPileSocket.executeForUsers(ItemPileSocket.HANDLERS.PRIVATE_TRADE_UPDATE_CURRENCIES, [store.leftTraderUser.id, store.rightTraderUser.id], store.privateTradeId, game.user.id, attributes);\r\n return executeSocketAction(ItemPileSocket.HANDLERS.PUBLIC_TRADE_UPDATE_CURRENCIES, store.publicTradeId, game.user.id, attributes);\r\n }, 40)\r\n leftCurrencies.subscribe(attributesUpdatedDebounce)\r\n\r\n const acceptedDebounce = debounce(async (acceptedState) => {\r\n await ItemPileSocket.executeForUsers(ItemPileSocket.HANDLERS.PRIVATE_TRADE_STATE, [store.leftTraderUser.id, store.rightTraderUser.id], store.privateTradeId, game.user.id, acceptedState);\r\n return executeSocketAction(ItemPileSocket.HANDLERS.PUBLIC_TRADE_STATE, store.publicTradeId, game.user.id, acceptedState);\r\n }, 10)\r\n leftTraderAccepted.subscribe(acceptedDebounce)\r\n }\r\n\r\n async function executeSocketAction(socketHandler, ...args) {\r\n if (store.isPrivate) {\r\n return ItemPileSocket.executeForUsers(socketHandler, [store.leftTraderUser.id, store.rightTraderUser.id], ...args);\r\n }\r\n return ItemPileSocket.executeForEveryone(socketHandler, ...args);\r\n }\r\n\r\n async function addCurrency(asGM = false) {\r\n\r\n const currenciesToAdd = await DropCurrencyDialog.show(\r\n store.leftTraderActor,\r\n store.rightTraderActor,\r\n {\r\n existingCurrencies: store.getExistingCurrencies(),\r\n title: game.i18n.localize(\"ITEM-PILES.Trade.AddCurrency.Title\"),\r\n content: game.i18n.format(\"ITEM-PILES.Trade.AddCurrency.Content\", { trader_actor_name: store.rightTraderActor.name }),\r\n button: game.i18n.localize(\"ITEM-PILES.Trade.AddCurrency.Label\"),\r\n unlimitedCurrencies: asGM\r\n }\r\n );\r\n\r\n if (!currenciesToAdd || (foundry.utils.isEmpty(currenciesToAdd.attributes) && !currenciesToAdd.items.length)) return;\r\n\r\n currenciesToAdd.items.forEach(item => {\r\n const itemData = store.leftTraderActor.items.get(item._id).toObject();\r\n store.addItem(itemData, { quantity: item.quantity, currency: true })\r\n });\r\n\r\n const currencies = PileUtilities.getActorCurrencies(store.leftTraderActor, { getAll: asGM })\r\n .filter(currency => currency.type === \"attribute\");\r\n\r\n Object.entries(currenciesToAdd.attributes).forEach(([path, quantity]) => {\r\n const currency = currencies.find(currency => currency.path === path);\r\n store.addAttribute({\r\n path: path,\r\n quantity: quantity,\r\n newQuantity: quantity,\r\n name: currency.name,\r\n img: currency.img,\r\n maxQuantity: !game.user.isGM ? currency.quantity : Infinity,\r\n index: currency.index\r\n });\r\n });\r\n }\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<ApplicationShell bind:elementRoot>\r\n\r\n\t{#if $leftTraderAccepted && $rightTraderAccepted}\r\n\t\t<div class=\"lds-ellipsis\" transition:fade>\r\n\t\t\t<div></div>\r\n\t\t\t<div></div>\r\n\t\t\t<div></div>\r\n\t\t\t<div></div>\r\n\t\t</div>\r\n\t{/if}\r\n\r\n\t<DropZone callback={dropItem}>\r\n\r\n\t\t<div class=\"item-piles-flexcol\">\r\n\r\n\t\t\t<div class=\"item-piles-flexrow\">\r\n\r\n\t\t\t\t<div class=\"col item-piles-flexcol\">\r\n\r\n\t\t\t\t\t<div class=\"character-header item-piles-bottom-divider\">\r\n\t\t\t\t\t\t<img src=\"{store.leftTraderActor.img}\">\r\n\t\t\t\t\t\t<h2 class=\"character-name\">\r\n\t\t\t\t\t\t\t<div>{store.leftTraderActor.name}</div>\r\n\t\t\t\t\t\t</h2>\r\n\t\t\t\t\t\t<div>\r\n\t\t\t\t\t\t\t<i\r\n\t\t\t\t\t\t\t\tclass=\"fas accepted-icon\"\r\n\t\t\t\t\t\t\t\tclass:accepted={$leftTraderAccepted}\r\n\t\t\t\t\t\t\t\tclass:fa-user-check={$leftTraderAccepted}\r\n\t\t\t\t\t\t\t\tclass:fa-user-times={!$leftTraderAccepted}\r\n\t\t\t\t\t\t\t></i>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\r\n\t\t\t\t\t\t<div class=\"row item-piles-items-list\">\r\n\r\n\t\t\t\t\t\t\t{#if !$leftItems.length && store.isUserParticipant}\r\n\t\t\t\t\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\t\t\t\t\t\t\t\t\t<h3 class=\"item-piles-text-center\">{localize(\"ITEM-PILES.Trade.DragDrop\")}</h3>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t\t\t{#each $leftItems as item (item.id)}\r\n\t\t\t\t\t\t\t\t<TradeEntry bind:data={item} {store} editable={store.isUserParticipant}/>\r\n\t\t\t\t\t\t\t{/each}\r\n\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t{#if systemHasCurrencies}\r\n\r\n\t\t\t\t\t\t\t<div class=\"row item-piles-items-list item-piles-currency-list\"\r\n\t\t\t\t\t\t\t\t\t class:item-piles-top-divider={$leftCurrencies.length || $leftItemCurrencies.length}>\r\n\r\n\t\t\t\t\t\t\t\t{#if store.isUserParticipant}\r\n\t\t\t\t\t\t\t\t\t<div class=\"item-piles-flexrow\">\r\n\t\t\t\t\t\t\t\t\t\t{#if isGM}\r\n\t\t\t\t\t\t\t\t\t\t\t<a on:click={() => { addCurrency(true) }}\r\n\t\t\t\t\t\t\t\t\t\t\t\t class=\"item-piles-text-right item-piles-small-text item-piles-middle item-piles-gm-add-currency\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fas fa-plus\"></i>\r\n\t\t\t\t\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Trade.GMAddCurrency\")}\r\n\t\t\t\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t\t\t\t\t\t<a on:click={() => { addCurrency() }}\r\n\t\t\t\t\t\t\t\t\t\t\t class=\"item-piles-text-right item-piles-small-text item-piles-middle item-piles-add-currency\">\r\n\t\t\t\t\t\t\t\t\t\t\t<i class=\"fas fa-plus\"></i>\r\n\t\t\t\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Inspect.AddCurrency\")}\r\n\t\t\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t\t\t\t{#each $leftCurrencies as currency (currency.path)}\r\n\t\t\t\t\t\t\t\t\t<TradeEntry bind:data={currency} {store} editable={store.isUserParticipant}/>\r\n\t\t\t\t\t\t\t\t{/each}\r\n\r\n\t\t\t\t\t\t\t\t{#each $leftItemCurrencies as item (item.id)}\r\n\t\t\t\t\t\t\t\t\t<TradeEntry bind:data={item} {store} editable={store.isUserParticipant}/>\r\n\t\t\t\t\t\t\t\t{/each}\r\n\r\n\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t{#if store.isUserParticipant}\r\n\r\n\t\t\t\t\t\t<button type=\"button\" style=\"flex:0 1 auto; margin-top: 0.25rem;\"\r\n\t\t\t\t\t\t\t\t\t\ton:click={() => { store.toggleAccepted(store.leftTraderUser.id) }}>\r\n\t\t\t\t\t\t\t{#if $leftTraderAccepted}\r\n\t\t\t\t\t\t\t\t<i class=\"fas fa-times\"></i>\r\n\t\t\t\t\t\t\t\t{localize(\"Cancel\")}\r\n\t\t\t\t\t\t\t{:else}\r\n\t\t\t\t\t\t\t\t<i class=\"fas fa-check\"></i>\r\n\t\t\t\t\t\t\t\t{localize(\"ITEM-PILES.Trade.Accept\")}\r\n\t\t\t\t\t\t\t{/if}\r\n\t\t\t\t\t\t</button>\r\n\r\n\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div class=\"col item-piles-flexcol\">\r\n\r\n\t\t\t\t\t<div class=\"character-header trader item-piles-bottom-divider\">\r\n\t\t\t\t\t\t<div>\r\n\t\t\t\t\t\t\t<i\r\n\t\t\t\t\t\t\t\tclass=\"fas accepted-icon\"\r\n\t\t\t\t\t\t\t\tclass:accepted={$rightTraderAccepted}\r\n\t\t\t\t\t\t\t\tclass:fa-user-check={$rightTraderAccepted}\r\n\t\t\t\t\t\t\t\tclass:fa-user-times={!$rightTraderAccepted}\r\n\t\t\t\t\t\t\t></i>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<h2 class=\"character-name\">\r\n\t\t\t\t\t\t\t{store.rightTraderActor.name}\r\n\t\t\t\t\t\t</h2>\r\n\t\t\t\t\t\t<img src=\"{store.rightTraderActor.img}\">\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t<div class=\"item-piles-flexcol\">\r\n\r\n\t\t\t\t\t\t<div class=\"row item-piles-items-list\">\r\n\r\n\t\t\t\t\t\t\t{#each $rightItems as item (item.id)}\r\n\t\t\t\t\t\t\t\t<TradeEntry bind:data={item} {store} editable={false}/>\r\n\t\t\t\t\t\t\t{/each}\r\n\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t{#if systemHasCurrencies}\r\n\r\n\t\t\t\t\t\t\t<div class=\"row item-piles-items-list item-piles-currency-list\"\r\n\t\t\t\t\t\t\t\t\t class:item-piles-top-divider={$rightCurrencies.length || $rightItemCurrencies.length}>\r\n\r\n\t\t\t\t\t\t\t\t{#each $rightCurrencies as currency (currency.path)}\r\n\t\t\t\t\t\t\t\t\t<TradeEntry bind:data={currency} {store} editable={false}/>\r\n\t\t\t\t\t\t\t\t{/each}\r\n\r\n\t\t\t\t\t\t\t\t{#each $rightItemCurrencies as item (item.id)}\r\n\t\t\t\t\t\t\t\t\t<TradeEntry bind:data={item} {store} editable={false}/>\r\n\t\t\t\t\t\t\t\t{/each}\r\n\r\n\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t{/if}\r\n\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</DropZone>\r\n\r\n</ApplicationShell>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n .col {\r\n flex-direction: column;\r\n margin: 0 5px;\r\n }\r\n\r\n .col:not(:last-child) {\r\n padding-right: 10px;\r\n border-right: 1px solid rgba(0, 0, 0, 0.35);\r\n }\r\n\r\n .row {\r\n flex: 1;\r\n }\r\n\r\n .row:last-child {\r\n flex: 0 1 auto;\r\n }\r\n\r\n .trader {\r\n\r\n }\r\n\r\n .lds-ellipsis {\r\n position: absolute;\r\n left: calc(50% - 38px);\r\n top: calc(50% - 40px);\r\n display: inline-block;\r\n width: 80px;\r\n height: 80px;\r\n }\r\n\r\n .lds-ellipsis div {\r\n position: absolute;\r\n top: 33px;\r\n width: 13px;\r\n height: 13px;\r\n border-radius: 50%;\r\n background: #435068;\r\n animation-timing-function: cubic-bezier(0, 1, 1, 0);\r\n }\r\n\r\n .lds-ellipsis div:nth-child(1) {\r\n left: 8px;\r\n animation: lds-ellipsis1 0.6s infinite;\r\n }\r\n\r\n .lds-ellipsis div:nth-child(2) {\r\n left: 8px;\r\n animation: lds-ellipsis2 0.6s infinite;\r\n }\r\n\r\n .lds-ellipsis div:nth-child(3) {\r\n left: 32px;\r\n animation: lds-ellipsis2 0.6s infinite;\r\n }\r\n\r\n .lds-ellipsis div:nth-child(4) {\r\n left: 56px;\r\n animation: lds-ellipsis3 0.6s infinite;\r\n }\r\n\r\n @keyframes lds-ellipsis1 {\r\n 0% {\r\n transform: scale(0);\r\n }\r\n 100% {\r\n transform: scale(1);\r\n }\r\n }\r\n\r\n @keyframes lds-ellipsis3 {\r\n 0% {\r\n transform: scale(1);\r\n }\r\n 100% {\r\n transform: scale(0);\r\n }\r\n }\r\n\r\n @keyframes lds-ellipsis2 {\r\n 0% {\r\n transform: translate(0, 0);\r\n }\r\n 100% {\r\n transform: translate(24px, 0);\r\n }\r\n }\r\n\r\n\r\n</style>\r\n","import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport TradingAppShell from \"./trading-app-shell.svelte\";\r\nimport ItemPileSocket from \"../../socket.js\";\r\n\r\nexport default class TradingApp extends SvelteApplication {\r\n constructor(store, options = {}, dialogData = {}) {\r\n super({\r\n title: game.i18n.format(\"ITEM-PILES.Trade.Between\", {\r\n actor_1: store.leftTraderActor.name,\r\n actor_2: store.rightTraderActor.name\r\n }),\r\n svelte: {\r\n class: TradingAppShell,\r\n target: document.body,\r\n props: {\r\n store\r\n }\r\n },\r\n ...options\r\n }, dialogData);\r\n this.store = store;\r\n this.publicTradeId = store.publicTradeId;\r\n }\r\n\r\n static get defaultOptions() {\r\n return foundry.utils.mergeObject(super.defaultOptions, {\r\n zIndex: 100,\r\n classes: [\"dialog\", \"item-piles-trading-sheet\", \"item-piles\", \"item-piles-app\"],\r\n width: 800,\r\n height: \"auto\",\r\n closeOnSubmit: false\r\n });\r\n }\r\n\r\n static getActiveApp(publicTradeId) {\r\n for (const app of Object.values(ui.windows)) {\r\n if (app instanceof this && app?.publicTradeId === publicTradeId) {\r\n return app;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n async close(options = {}) {\r\n if (!options?.callback && this.store.isUserParticipant) {\r\n await ItemPileSocket.executeForEveryone(ItemPileSocket.HANDLERS.TRADE_CLOSED, this.publicTradeId, game.user.id);\r\n }\r\n return super.close(options)\r\n }\r\n}\r\n","import { TJSDialog } from \"@typhonjs-fvtt/runtime/svelte/application\";\r\nimport CustomDialog from \"../applications/components/CustomDialog.svelte\";\r\nimport { TradePromptDialog, TradeRequestDialog } from \"../applications/trade-dialogs/trade-dialogs.js\";\r\n\r\nimport CONSTANTS from \"../constants/constants.js\";\r\nimport ItemPileSocket from \"../socket.js\";\r\nimport * as Helpers from \"../helpers/helpers.js\";\r\nimport * as Utilities from \"../helpers/utilities.js\";\r\nimport TradeStore from \"../applications/trading-app/trade-store.js\";\r\nimport TradingApp from \"../applications/trading-app/trading-app.js\";\r\nimport Transaction from \"../helpers/transaction.js\";\r\n\r\nconst mutedUsers = new Set();\r\nconst ongoingTrades = new Map();\r\n\r\nexport default class TradeAPI {\r\n\r\n static initialize() {\r\n Hooks.on(\"renderPlayerList\", this._userDisconnected.bind(this));\r\n }\r\n\r\n static async _requestTrade(user = false) {\r\n\r\n // Grab all the active users (not self)\r\n const users = game.users.filter(user => user.active && user !== game.user);\r\n\r\n // No users!\r\n if (!users.length) {\r\n return TJSDialog.prompt({\r\n title: game.i18n.localize(\"ITEM-PILES.Trade.Title\"), content: {\r\n class: CustomDialog, props: {\r\n header: game.i18n.localize(\"ITEM-PILES.Trade.NoActiveUsers.Title\"),\r\n content: game.i18n.localize(\"ITEM-PILES.Trade.NoActiveUsers.Content\"),\r\n icon: \"fas fa-heart-broken\"\r\n }\r\n }, modal: true, draggable: false, options: {\r\n height: \"auto\"\r\n }\r\n });\r\n }\r\n\r\n let userId;\r\n let actor;\r\n let isPrivate;\r\n\r\n // Find actors you own\r\n const actors = game.actors.filter(actor => actor.isOwner);\r\n\r\n // If you only own one actor, and the user was already preselected (through the right click menu in the actors list)\r\n if (actors.length === 1 && user) {\r\n userId = user.id;\r\n actor = actors[0];\r\n isPrivate = false;\r\n } else {\r\n // If you have more than 1 owned actor, prompt to choose which one\r\n const result = await TradePromptDialog.show({ actors, users, user });\r\n if (!result) return;\r\n userId = result.user.id;\r\n actor = result.actor;\r\n isPrivate = result.private;\r\n }\r\n\r\n if (!actor) return false;\r\n\r\n actor = Utilities.getActor(actor);\r\n\r\n const actorOwner = game.users.find(user => user.character === actor && user !== game.user);\r\n if (actorOwner) {\r\n\r\n const doContinue = TJSDialog.confirm({\r\n title: game.i18n.localize(\"ITEM-PILES.Trade.Title\"), content: {\r\n class: CustomDialog, props: {\r\n header: game.i18n.localize(\"ITEM-PILES.Trade.Title\"),\r\n content: actorOwner.active ? game.i18n.format(\"ITEM-PILES.Trade.UserActiveCharacterWarning\", {\r\n actor_name: actor.name, player_name: actorOwner.name\r\n }) : game.i18n.format(\"ITEM-PILES.Trade.UserCharacterWarning\", {\r\n actor_name: actor.name, player_name: actorOwner.name\r\n }),\r\n icon: \"fas fa-exclamation-triangle\",\r\n }\r\n }, modal: true, draggable: false, rejectClose: false, defaultYes: true, options: {\r\n height: \"auto\"\r\n }\r\n });\r\n if (!doContinue) {\r\n return;\r\n }\r\n }\r\n\r\n const privateTradeId = randomID();\r\n const publicTradeId = randomID();\r\n\r\n // Spawn a cancel dialog\r\n const cancelDialog = new Dialog({\r\n title: game.i18n.localize(\"ITEM-PILES.Trade.Title\"),\r\n content: `<p style=\"text-align: center\">${game.i18n.format(\"ITEM-PILES.Trade.OngoingRequest.Content\", { user_name: game.users.get(userId).name })}</p>`,\r\n buttons: {\r\n confirm: {\r\n icon: '<i class=\"fas fa-times\"></i>',\r\n label: game.i18n.localize(\"ITEM-PILES.Trade.OngoingRequest.Label\"),\r\n callback: () => {\r\n ItemPileSocket.executeAsUser(ItemPileSocket.HANDLERS.TRADE_REQUEST_CANCELLED, userId, game.user.id, privateTradeId);\r\n }\r\n }\r\n }\r\n }, {\r\n top: 50, width: 300\r\n }).render(true);\r\n\r\n // Send out the request\r\n return ItemPileSocket.executeAsUser(ItemPileSocket.HANDLERS.TRADE_REQUEST_PROMPT, userId, game.user.id, actor.uuid, privateTradeId, publicTradeId, isPrivate)\r\n .then(async (data) => {\r\n\r\n if (data === \"cancelled\") return;\r\n cancelDialog.close();\r\n\r\n if (data === \"same-actor\") {\r\n return Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Trade.SameActor\"), true);\r\n }\r\n\r\n // If they declined, show warning\r\n if (!data || !data.fullPrivateTradeId.includes(privateTradeId)) {\r\n return Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Trade.Declined\"), true);\r\n }\r\n\r\n const traderActor = Utilities.getActor(data.actorUuid);\r\n\r\n if (traderActor === actor) {\r\n return Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Trade.SameActor\"), true);\r\n }\r\n\r\n const store = new TradeStore(game.user.id, {\r\n user: game.user, actor\r\n }, {\r\n user: game.users.get(userId), actor: traderActor\r\n }, data.fullPublicTradeId, data.fullPrivateTradeId, isPrivate);\r\n\r\n const [actorSheet, tradeApp] = Helpers.getApplicationPositions(actor.sheet);\r\n\r\n const app = new TradingApp(store, tradeApp).render(true);\r\n\r\n ongoingTrades.set(data.fullPublicTradeId, { app, store });\r\n\r\n actorSheet.byassItemPiles = true;\r\n actor.sheet.render(true, actorSheet);\r\n\r\n if (isPrivate) {\r\n return ItemPileSocket.callHookForUsers(CONSTANTS.HOOKS.TRADE.STARTED, [game.user.id, userId], {\r\n user: game.user.id, actor: actor.uuid\r\n }, { user: userId, actor: data.actorUuid }, data.fullPublicTradeId, isPrivate);\r\n }\r\n\r\n return ItemPileSocket.callHook(CONSTANTS.HOOKS.TRADE.STARTED, {\r\n user: game.user.id, actor: actor.uuid\r\n }, { user: userId, actor: data.actorUuid }, data.fullPublicTradeId, isPrivate);\r\n\r\n }).catch((err) => {\r\n console.error(err);\r\n // If the counterparty disconnected, show that and close dialog\r\n Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Trade.Disconnected\"), true);\r\n cancelDialog.close()\r\n });\r\n\r\n }\r\n\r\n static async _respondPrompt(tradingUserId, tradingActorUuid, privateTradeId, publicTradeId, isPrivate) {\r\n\r\n // If the user was previously muted, wait for a random amount of time and respond with false\r\n if (mutedUsers.has(tradingUserId)) {\r\n await Helpers.wait(Math.random() * 15000);\r\n return false;\r\n }\r\n\r\n // Complete the private and public trade IDs\r\n const fullPrivateTradeId = privateTradeId + randomID();\r\n const fullPublicTradeId = publicTradeId + randomID();\r\n\r\n const tradingUser = game.users.get(tradingUserId);\r\n const tradingActor = Utilities.getActor(tradingActorUuid);\r\n\r\n // Make em pick an actor (if more than one) and accept/decline/mute\r\n const result = await TradeRequestDialog.show({ tradeId: privateTradeId, tradingUser, tradingActor, isPrivate });\r\n\r\n if (!result) return false;\r\n\r\n if (result === \"cancelled\") {\r\n return \"cancelled\";\r\n }\r\n\r\n // If muted, add user to blacklist locally\r\n if (result === \"mute\") {\r\n mutedUsers.push(tradingUserId);\r\n return false;\r\n }\r\n\r\n const actor = result.actor ?? result;\r\n\r\n if (actor === tradingActor) {\r\n Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Trade.SameActor\"), true);\r\n return \"same-actor\";\r\n }\r\n\r\n const store = new TradeStore(tradingUserId, {\r\n user: game.user, actor\r\n }, {\r\n user: tradingUser, actor: tradingActor\r\n }, fullPublicTradeId, fullPrivateTradeId, isPrivate);\r\n\r\n const [actorSheet, tradeApp] = Helpers.getApplicationPositions(actor.sheet);\r\n\r\n const app = new TradingApp(store, tradeApp).render(true);\r\n\r\n ongoingTrades.set(fullPublicTradeId, { app, store });\r\n\r\n actorSheet.byassItemPiles = true;\r\n actor.sheet.render(true, actorSheet);\r\n\r\n return {\r\n fullPrivateTradeId, fullPublicTradeId, actorUuid: result.uuid\r\n };\r\n\r\n }\r\n\r\n static getAppOptions(actor) {\r\n const midPoint = (window.innerWidth / 2) - 200;\r\n return {\r\n actorSheet: { left: midPoint - actor.sheet.position.width - 25 }, tradeApp: { left: midPoint + 25 }\r\n }\r\n }\r\n\r\n static async _tradeCancelled(userId, privateTradeId) {\r\n\r\n TJSDialog.prompt({\r\n title: game.i18n.localize(\"ITEM-PILES.Trade.Title\"), content: {\r\n class: CustomDialog, props: {\r\n header: game.i18n.localize(\"ITEM-PILES.Trade.Title\"),\r\n content: game.i18n.format(\"ITEM-PILES.Trade.CancelledRequest.Content\", { user_name: game.users.get(userId).name }),\r\n icon: \"fas fa-exclamation-triangle\"\r\n }\r\n }, modal: true, draggable: false, options: {\r\n height: \"auto\"\r\n }\r\n });\r\n\r\n return TradeRequestDialog.cancel(privateTradeId);\r\n\r\n }\r\n\r\n static async _requestTradeData({ tradeId, tradeUser } = {}) {\r\n\r\n const ongoingTrade = this._getOngoingTrade(tradeId);\r\n if (ongoingTrade) {\r\n return ongoingTrade.store.export();\r\n }\r\n\r\n const user = game.users.get(tradeUser);\r\n if (!user?.active) {\r\n return false;\r\n }\r\n\r\n const ongoingTradeData = await ItemPileSocket.executeAsUser(ItemPileSocket.HANDLERS.REQUEST_TRADE_DATA, tradeUser, tradeId, game.user.id);\r\n if (!ongoingTradeData) {\r\n return false;\r\n }\r\n\r\n return ongoingTradeData;\r\n\r\n }\r\n\r\n static async _spectateTrade({ tradeId, tradeUser } = {}) {\r\n\r\n const existingApp = TradingApp.getActiveApp(tradeId);\r\n if (existingApp) {\r\n return existingApp.render(false, { focus: true });\r\n }\r\n\r\n const ongoingTradeData = await this._requestTradeData({ tradeId, tradeUser });\r\n if (!ongoingTradeData) {\r\n if (Helpers.isGMConnected()) {\r\n ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.DISABLE_CHAT_TRADE_BUTTON, tradeId);\r\n }\r\n return Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Trade.Over\"), true);\r\n }\r\n\r\n const store = TradeStore.import(ongoingTradeData);\r\n\r\n const app = new TradingApp(store).render(true);\r\n\r\n ongoingTrades.set(store.publicTradeId, { app, store });\r\n\r\n }\r\n\r\n static async _respondActiveTradeData(tradeId, requesterId) {\r\n const trade = this._getOngoingTrade(tradeId, requesterId);\r\n if (!trade) return;\r\n return trade.store.export();\r\n }\r\n\r\n static _getOngoingTrade(tradeId, requesterId = game.user.id) {\r\n if (!ongoingTrades.has(tradeId)) return false;\r\n const trade = ongoingTrades.get(tradeId);\r\n if (!trade.store.isPrivate) {\r\n return trade;\r\n }\r\n if (trade.store.leftTraderUser.id !== requesterId && trade.store.rightTraderUser.id !== requesterId) return false;\r\n return trade;\r\n }\r\n\r\n static async _updateItems(tradeId, userId, items) {\r\n const trade = this._getOngoingTrade(tradeId);\r\n if (!trade) return;\r\n trade.store.updateItems(userId, items);\r\n }\r\n\r\n static async _updateItemCurrencies(tradeId, userId, items) {\r\n const trade = this._getOngoingTrade(tradeId);\r\n if (!trade) return;\r\n trade.store.updateItemCurrencies(userId, items);\r\n }\r\n\r\n static async _updateCurrencies(tradeId, userId, currencies) {\r\n const trade = this._getOngoingTrade(tradeId);\r\n if (!trade) return;\r\n trade.store.updateCurrencies(userId, currencies);\r\n }\r\n\r\n static async _updateAcceptedState(tradeId, userId, status) {\r\n const trade = this._getOngoingTrade(tradeId);\r\n if (!trade) return;\r\n trade.store.updateAcceptedState(userId, status);\r\n if (userId === game.user.id && (trade.store.leftTraderUser.id === game.user.id || trade.store.rightTraderUser.id === game.user.id)) {\r\n if (trade.store.tradeIsAccepted) {\r\n setTimeout(async () => {\r\n if (trade.store.tradeIsAccepted) {\r\n ItemPileSocket.executeForUsers(\r\n ItemPileSocket.HANDLERS.EXECUTE_TRADE,\r\n [trade.store.leftTraderUser.id, trade.store.rightTraderUser.id],\r\n trade.store.publicTradeId,\r\n trade.store.privateTradeId,\r\n userId);\r\n }\r\n }, 2000);\r\n }\r\n }\r\n }\r\n\r\n static async _userDisconnected() {\r\n const tradesToDelete = [];\r\n const activeUsers = game.users.filter(user => user.active);\r\n for (let [tradeId, trade] of ongoingTrades) {\r\n const foundLeft = activeUsers.find(u => u === trade.store.leftTraderUser);\r\n const foundRight = activeUsers.find(u => u === trade.store.rightTraderUser);\r\n if (foundLeft && foundRight) continue;\r\n tradesToDelete.push(tradeId);\r\n Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Trade.Disconnected\"), true);\r\n await trade.app.close({ callback: true });\r\n if (foundLeft === game.user || foundRight === game.user) {\r\n if (Helpers.isGMConnected()) {\r\n await ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.DISABLE_CHAT_TRADE_BUTTON, tradeId);\r\n }\r\n }\r\n }\r\n tradesToDelete.forEach(tradeId => ongoingTrades.delete(tradeId));\r\n }\r\n\r\n static async _tradeClosed(tradeId, closeUserId) {\r\n const trade = this._getOngoingTrade(tradeId);\r\n if (!trade) return;\r\n\r\n if (trade.store.leftTraderUser.id === game.user.id || trade.store.rightTraderUser.id === game.user.id) {\r\n\r\n if (closeUserId === trade.store.rightTraderUser.id) {\r\n\r\n TJSDialog.prompt({\r\n title: game.i18n.localize(\"ITEM-PILES.Trade.Closed.Title\"), content: {\r\n class: CustomDialog, props: {\r\n header: game.i18n.localize(\"ITEM-PILES.Trade.Closed.Title\"),\r\n content: game.i18n.format(\"ITEM-PILES.Trade.Closed.Them\", {\r\n user_name: trade.store.rightTraderUser.name\r\n }),\r\n icon: \"fas fa-exclamation-triangle\",\r\n }\r\n }, modal: false, draggable: true, options: {\r\n height: \"auto\"\r\n }\r\n });\r\n\r\n } else {\r\n\r\n if (trade.store.isPrivate) {\r\n const otherUserId = trade.store.leftTraderUser.id === game.user.id ? trade.store.rightTraderUser.id : trade.store.leftTraderUser.id;\r\n ItemPileSocket.executeAsUser(ItemPileSocket.HANDLERS.TRADE_CLOSED, otherUserId, tradeId, game.user.id);\r\n } else {\r\n ItemPileSocket.executeForOthers(ItemPileSocket.HANDLERS.TRADE_CLOSED, tradeId, game.user.id);\r\n }\r\n\r\n TJSDialog.prompt({\r\n title: game.i18n.localize(\"ITEM-PILES.Trade.Closed.Title\"), content: {\r\n class: CustomDialog, props: {\r\n header: game.i18n.localize(\"ITEM-PILES.Trade.Closed.Title\"),\r\n content: game.i18n.format(\"ITEM-PILES.Trade.Closed.You\"),\r\n icon: \"fas fa-exclamation-triangle\",\r\n }\r\n }, modal: false, draggable: true, options: {\r\n height: \"auto\"\r\n }\r\n });\r\n\r\n if (Helpers.isGMConnected()) {\r\n await ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.DISABLE_CHAT_TRADE_BUTTON, tradeId);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Trade.Closed.Someone\"), true);\r\n\r\n }\r\n\r\n trade.app.close({ callback: true });\r\n ongoingTrades.delete(tradeId);\r\n }\r\n\r\n static async _executeTrade(tradeId, privateId, userId) {\r\n const trade = this._getOngoingTrade(tradeId);\r\n if (!trade) return;\r\n if (trade.store.privateTradeId !== privateId) return;\r\n const updates = trade.store.getTradeData();\r\n\r\n const itemsToAdd = [];\r\n for (const entry of updates.add.items) {\r\n let item = updates.targetActor.items.get(entry.id);\r\n if (!item) {\r\n item = await fromUuid(entry.uuid);\r\n if (!item) continue;\r\n }\r\n const itemData = item.toObject();\r\n itemsToAdd.push(Utilities.setItemQuantity(itemData, entry.quantity, true));\r\n }\r\n\r\n const itemsToRemove = []\r\n for (const entry of updates.remove.items) {\r\n const item = updates.sourceActor.items.get(entry.id);\r\n if (!item) continue;\r\n const itemData = item.toObject();\r\n itemsToRemove.push(Utilities.setItemQuantity(itemData, entry.quantity, true));\r\n }\r\n\r\n const transaction = new Transaction(updates.sourceActor);\r\n await transaction.appendItemChanges(itemsToAdd);\r\n await transaction.appendItemChanges(itemsToRemove, { remove: true });\r\n await transaction.appendActorChanges(updates.add.attributes);\r\n await transaction.appendActorChanges(updates.remove.attributes, { remove: true });\r\n await transaction.commit();\r\n\r\n if (trade.store.isPrivate) {\r\n Hooks.callAll(CONSTANTS.HOOKS.TRADE.COMPLETE, trade.store.instigator, data[0], data[1], tradeId);\r\n trade.app.close({ callback: true });\r\n ongoingTrades.delete(tradeId);\r\n } else if (userId === game.user.id) {\r\n if (Helpers.isGMConnected()) {\r\n await ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.DISABLE_CHAT_TRADE_BUTTON, tradeId);\r\n }\r\n return ItemPileSocket.executeForEveryone(ItemPileSocket.HANDLERS.TRADE_COMPLETED, tradeId, updates);\r\n }\r\n }\r\n\r\n static async _tradeCompleted(tradeId) {\r\n const trade = this._getOngoingTrade(tradeId);\r\n if (!trade) return;\r\n const data = trade.store.export();\r\n if (data.instigator === game.user.id) {\r\n if (trade.store.isPrivate) {\r\n Hooks.callAll(CONSTANTS.HOOKS.TRADE.COMPLETE, data.instigator, data.leftTraderData, data.rightTraderData, tradeId);\r\n } else {\r\n ItemPileSocket.executeForEveryone(\r\n ItemPileSocket.HANDLERS.CALL_HOOK,\r\n CONSTANTS.HOOKS.TRADE.COMPLETE,\r\n trade.store.instigator,\r\n data.leftTraderData,\r\n data.rightTraderData,\r\n tradeId,\r\n trade.store.isPrivate\r\n )\r\n }\r\n }\r\n trade.app.close({ callback: true });\r\n ongoingTrades.delete(tradeId);\r\n }\r\n\r\n}\r\n\r\n","import SETTINGS from \"../constants/settings.js\";\r\nimport * as Helpers from \"../helpers/helpers.js\";\r\nimport CONSTANTS from \"../constants/constants.js\";\r\nimport ItemPileSocket from \"../socket.js\";\r\nimport * as PileUtilities from \"../helpers/pile-utilities.js\";\r\nimport * as Utilities from \"../helpers/utilities.js\";\r\nimport TradeAPI from \"./trade-api.js\";\r\n\r\nexport default class ChatAPI {\r\n\r\n static initialize() {\r\n\r\n Helpers.hooks.on(\"preCreateChatMessage\", this._preCreateChatMessage.bind(this));\r\n Helpers.hooks.on(\"renderChatMessage\", this._renderChatMessage.bind(this));\r\n Helpers.hooks.on(CONSTANTS.HOOKS.ITEM.TRANSFER, this._outputTransferItem.bind(this));\r\n Helpers.hooks.on(CONSTANTS.HOOKS.ATTRIBUTE.TRANSFER, this._outputTransferCurrency.bind(this));\r\n Helpers.hooks.on(CONSTANTS.HOOKS.TRANSFER_EVERYTHING, this._outputTransferEverything.bind(this));\r\n Helpers.hooks.on(CONSTANTS.HOOKS.PILE.SPLIT_INVENTORY, this._outputSplitItemPileInventory.bind(this));\r\n Helpers.hooks.on(CONSTANTS.HOOKS.TRADE.STARTED, this._outputTradeStarted.bind(this));\r\n Helpers.hooks.on(CONSTANTS.HOOKS.TRADE.COMPLETE, this._outputTradeComplete.bind(this));\r\n Helpers.hooks.on(CONSTANTS.HOOKS.ITEM.TRADE, this._outputMerchantTradeComplete.bind(this));\r\n Helpers.hooks.on(CONSTANTS.HOOKS.ITEM.GIVE, this._outputGiveItem.bind(this));\r\n\r\n $(document).on(\"click\", \".item-piles-chat-card .item-piles-collapsible\", async function () {\r\n if ($(this).attr(\"open\")) return;\r\n await Helpers.wait(25);\r\n $(this).parent()[0].scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });\r\n });\r\n }\r\n\r\n static _preCreateChatMessage(chatMessage) {\r\n\r\n if (!Helpers.getSetting(SETTINGS.ENABLE_TRADING)) return;\r\n\r\n const content = chatMessage.content.toLowerCase();\r\n\r\n if (!(content.startsWith(\"!itempiles\") || content.startsWith(\"!ip\"))) return;\r\n\r\n const args = content.split(\" \").slice(1);\r\n\r\n if (args[0] === \"trade\") {\r\n setTimeout(() => {\r\n game.itempiles.API.requestTrade();\r\n });\r\n }\r\n\r\n return false;\r\n\r\n }\r\n\r\n static _renderChatMessage(app, html) {\r\n html.find(\".item-piles-specate-trade\").click(function () {\r\n game.itempiles.API.spectateTrade($(this).data());\r\n });\r\n }\r\n\r\n static _disableTradingButton(publicTradeId) {\r\n const message = Array.from(game.messages).find(message => {\r\n return getProperty(message, CONSTANTS.FLAGS.PUBLIC_TRADE_ID) === publicTradeId;\r\n });\r\n if (!message) return;\r\n const update = this._replaceChatContent(message);\r\n return message.update(update)\r\n }\r\n\r\n static async disablePastTradingButtons() {\r\n if (!game.user.isGM) return;\r\n\r\n const messages = Array.from(game.messages).filter(message => {\r\n return getProperty(message, CONSTANTS.FLAGS.PUBLIC_TRADE_ID);\r\n });\r\n\r\n if (!messages.length) return;\r\n const updates = [];\r\n for (let message of messages) {\r\n const update = this._replaceChatContent(message);\r\n const tradeId = getProperty(message, CONSTANTS.FLAGS.PUBLIC_TRADE_ID);\r\n const tradeUsers = getProperty(message, CONSTANTS.FLAGS.TRADE_USERS);\r\n const bothUsersActive = tradeUsers.filter(userId => game.users.get(userId).active).length === tradeUsers.length;\r\n if (!bothUsersActive) {\r\n updates.push(update);\r\n } else {\r\n const otherUsers = tradeUsers.filter(userId => userId !== game.user.id);\r\n const tradeData = await TradeAPI._requestTradeData({ tradeId, tradeUser: otherUsers[0] });\r\n if (!tradeData) {\r\n updates.push(update);\r\n }\r\n }\r\n }\r\n\r\n if (!updates.length) return;\r\n\r\n return ChatMessage.updateDocuments(updates);\r\n\r\n }\r\n\r\n static _replaceChatContent(message) {\r\n const tradeId = getProperty(message, CONSTANTS.FLAGS.PUBLIC_TRADE_ID);\r\n const stringToFind = `data-trade-id=\"${tradeId}\"`;\r\n let content = message.content;\r\n content = content.replace(stringToFind, \"\");\r\n content = content.replace(stringToFind, \"disabled\");\r\n content = content.replace(game.i18n.localize(\"ITEM-PILES.Chat.TradeSpectate\"), game.i18n.localize(\"ITEM-PILES.Chat.SpectateDisabled\"));\r\n return {\r\n _id: message.id,\r\n content,\r\n [`flags.-=${CONSTANTS.MODULE_NAME}`]: null\r\n };\r\n }\r\n\r\n\r\n /**\r\n * Outputs to chat based on transferring an item from or to an item pile\r\n *\r\n * @param source\r\n * @param target\r\n * @param items\r\n * @param userId\r\n * @param interactionId\r\n * @returns {Promise}\r\n */\r\n static async _outputTransferItem(source, target, items, userId, interactionId) {\r\n if (!PileUtilities.isItemPileLootable(source)) return;\r\n if (!interactionId || game.user.id !== userId || !Helpers.getSetting(SETTINGS.OUTPUT_TO_CHAT)) return;\r\n const [itemData, itemCurrencies] = await this._formatItemData(source, items);\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.PICKUP_CHAT_MESSAGE, source.uuid, target.uuid, itemData, itemCurrencies, userId, interactionId);\r\n }\r\n\r\n /**\r\n * Outputs to chat based on transferring a currency from or to an item pile\r\n *\r\n * @param source\r\n * @param target\r\n * @param currencies\r\n * @param userId\r\n * @param interactionId\r\n * @returns {Promise}\r\n */\r\n static async _outputTransferCurrency(source, target, currencies, userId, interactionId) {\r\n if (!PileUtilities.isItemPileLootable(source)) return;\r\n if (!interactionId || game.user.id !== userId || !Helpers.getSetting(SETTINGS.OUTPUT_TO_CHAT)) return;\r\n const currencyData = this._formatCurrencyData(source, currencies);\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.PICKUP_CHAT_MESSAGE, source.uuid, target.uuid, [], currencyData, userId, interactionId);\r\n }\r\n\r\n /**\r\n * Outputs to chat based on giving an item from one actor to another\r\n *\r\n * @param source\r\n * @param target\r\n * @param item\r\n * @param userId\r\n * @returns {Promise}\r\n */\r\n static async _outputGiveItem(source, target, item, userId) {\r\n if (game.user.id !== userId || !Helpers.getSetting(SETTINGS.OUTPUT_TO_CHAT)) return;\r\n const [itemData, itemCurrencies] = await this._formatItemData(source, [item]);\r\n return this._giveChatMessage(source, target, itemData.concat(itemCurrencies), userId);\r\n }\r\n\r\n /**\r\n * Outputs to chat based on transferring everything from or to an item pile\r\n *\r\n * @param source\r\n * @param target\r\n * @param items\r\n * @param currencies\r\n * @param userId\r\n * @param interactionId\r\n * @returns {Promise}\r\n */\r\n static async _outputTransferEverything(source, target, items, currencies, userId, interactionId) {\r\n if (!PileUtilities.isItemPileLootable(source)) return;\r\n if (!interactionId || game.user.id !== userId || !Helpers.getSetting(SETTINGS.OUTPUT_TO_CHAT)) return;\r\n const [itemData, itemCurrencies] = await this._formatItemData(source, items);\r\n const currencyData = this._formatCurrencyData(source, currencies).concat(itemCurrencies);\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.PICKUP_CHAT_MESSAGE, source.uuid, target.uuid, itemData, currencyData, userId, interactionId);\r\n }\r\n\r\n static _outputSplitItemPileInventory(source, pileDeltas, actorDeltas, userId) {\r\n if (!PileUtilities.isItemPileLootable(source)) return;\r\n if (game.user.id !== userId || !Helpers.getSetting(SETTINGS.OUTPUT_TO_CHAT)) return;\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.SPLIT_CHAT_MESSAGE, source.uuid, pileDeltas, actorDeltas, userId);\r\n }\r\n\r\n static async _outputTradeStarted(party_1, party_2, publicTradeId, isPrivate) {\r\n if (party_1.user !== game.user.id || !Helpers.getSetting(SETTINGS.OUTPUT_TO_CHAT) || isPrivate) return;\r\n return this._outputTradeStartedToChat(party_1, party_2, publicTradeId);\r\n }\r\n\r\n static async _outputTradeComplete(instigator, party_1, party_2, publicTradeId, isPrivate) {\r\n if (!Helpers.getSetting(SETTINGS.OUTPUT_TO_CHAT)) return;\r\n return this._outputTradeCompleteToChat(instigator, party_1, party_2, publicTradeId, isPrivate);\r\n }\r\n\r\n static async _outputMerchantTradeComplete(source, target, priceInformation, userId, interactionId) {\r\n if (!Helpers.getSetting(SETTINGS.OUTPUT_TO_CHAT)) return;\r\n if (!PileUtilities.isItemPileMerchant(source)) return;\r\n if (!interactionId || game.user.id !== userId || !Helpers.getSetting(SETTINGS.OUTPUT_TO_CHAT)) return;\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.MERCHANT_TRADE_CHAT_MESSAGE, source.uuid, target.uuid, priceInformation, userId, interactionId);\r\n }\r\n\r\n /**\r\n * Formats item data to a chat friendly structure\r\n *\r\n * @param itemPile\r\n * @param items\r\n * @param divideBy\r\n * @returns {Promise<Array>}\r\n */\r\n static async _formatItemData(itemPile, items, divideBy = 1) {\r\n const formattedItems = [];\r\n const formattedCurrencies = [];\r\n const currencyList = PileUtilities.getActorCurrencies(itemPile, { getAll: true });\r\n for (const itemData of items) {\r\n const tempItem = await Item.implementation.create(itemData.item, { temporary: true });\r\n const data = {\r\n name: game.i18n.localize(tempItem.name),\r\n img: tempItem.img ?? itemData?.item?.img ?? \"\",\r\n quantity: Math.abs(itemData.quantity) / divideBy\r\n };\r\n if (PileUtilities.isItemCurrency(tempItem, { actorCurrencies: currencyList })) {\r\n formattedCurrencies.push(data)\r\n } else {\r\n formattedItems.push(data);\r\n }\r\n }\r\n return [formattedItems, formattedCurrencies];\r\n }\r\n\r\n /**\r\n * Formats currency data to a chat friendly structure\r\n *\r\n * @param itemPile\r\n * @param currencies\r\n * @param divideBy\r\n * @returns {Array}\r\n */\r\n static _formatCurrencyData(itemPile, currencies, divideBy = 1) {\r\n const currencyList = PileUtilities.getActorCurrencies(itemPile, { getAll: true });\r\n return Object.entries(currencies).map(entry => {\r\n const currency = currencyList.find(currency => currency.id === entry[0]);\r\n return {\r\n name: game.i18n.localize(currency.name),\r\n img: currency.img ?? \"\",\r\n quantity: Math.abs(entry[1]) / divideBy,\r\n index: currencyList.indexOf(currency)\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Outputs the transferred data in chat\r\n *\r\n * @param sourceUuid\r\n * @param targetUuid\r\n * @param items\r\n * @param currencies\r\n * @param userId\r\n * @param interactionId\r\n * @returns {Promise}\r\n */\r\n static async _outputPickupToChat(sourceUuid, targetUuid, items, currencies, userId, interactionId) {\r\n\r\n const sourceActor = Utilities.getActor(sourceUuid);\r\n const targetActor = Utilities.getActor(targetUuid);\r\n\r\n const now = (+new Date());\r\n\r\n // Get all messages younger than 3 hours, and grab the last 10, then reverse them (latest to oldest)\r\n const messages = Array.from(game.messages).filter(message => (now - message.timestamp) <= (10800000)).slice(-10);\r\n messages.reverse()\r\n\r\n for (const message of messages) {\r\n const flags = getProperty(message, CONSTANTS.FLAGS.PILE);\r\n if (flags && flags.version && !foundry.utils.isNewerVersion(Helpers.getModuleVersion(), flags.version) && flags.source === sourceUuid && flags.target === targetUuid && flags.interactionId === interactionId) {\r\n return this._updateExistingPickupMessage(message, sourceActor, targetActor, items, currencies, interactionId)\r\n }\r\n }\r\n\r\n const chatCardHtml = await renderTemplate(CONSTANTS.PATH + \"templates/chat/looted.html\", {\r\n message: game.i18n.format(\"ITEM-PILES.Chat.Pickup\", { name: targetActor.name }),\r\n itemPile: sourceActor,\r\n actor: targetActor,\r\n items: items,\r\n currencies: currencies\r\n });\r\n\r\n return this._createNewChatMessage(userId, {\r\n user: game.user.id,\r\n type: CONST.CHAT_MESSAGE_TYPES.OTHER,\r\n content: chatCardHtml,\r\n flavor: \"Item Piles\",\r\n speaker: ChatMessage.getSpeaker({ alias: game.user.name }),\r\n [CONSTANTS.FLAGS.PILE]: {\r\n version: Helpers.getModuleVersion(),\r\n source: sourceUuid,\r\n target: targetUuid,\r\n items: items,\r\n currencies: currencies,\r\n interactionId: interactionId\r\n }\r\n })\r\n\r\n }\r\n\r\n static _matchEntries(existingEntries, incomingEntries) {\r\n\r\n const combinedEntries = existingEntries.map(existingEntry => {\r\n const foundEntry = incomingEntries.find(item => item.name === existingEntry.name && existingEntry.img === item.img);\r\n if (foundEntry) {\r\n existingEntry.quantity += foundEntry.quantity;\r\n incomingEntries.splice(incomingEntries.indexOf(foundEntry), 1)\r\n }\r\n return existingEntry;\r\n });\r\n\r\n incomingEntries.forEach(item => combinedEntries.push(item));\r\n\r\n return combinedEntries;\r\n\r\n }\r\n\r\n static async _updateExistingPickupMessage(message, sourceActor, targetActor, items, currencies, interactionId) {\r\n\r\n const flags = getProperty(message, CONSTANTS.FLAGS.PILE);\r\n\r\n const newItems = this._matchEntries(flags.items, items);\r\n const newCurrencies = this._matchEntries(flags.currencies, currencies);\r\n\r\n newCurrencies.sort((a, b) => {\r\n return a.index - b.index;\r\n })\r\n\r\n const chatCardHtml = await renderTemplate(CONSTANTS.PATH + \"templates/chat/looted.html\", {\r\n message: game.i18n.format(\"ITEM-PILES.Chat.Pickup\", { name: targetActor.name }),\r\n itemPile: sourceActor,\r\n actor: targetActor,\r\n items: newItems,\r\n currencies: newCurrencies\r\n });\r\n\r\n return message.update({\r\n content: chatCardHtml,\r\n [`${CONSTANTS.FLAGS.PILE}.interactionId`]: interactionId,\r\n [`${CONSTANTS.FLAGS.PILE}.items`]: newItems,\r\n [`${CONSTANTS.FLAGS.PILE}.currencies`]: newCurrencies,\r\n });\r\n\r\n }\r\n\r\n static async _outputSplitToChat(sourceUuid, pileDeltas, actorDeltas, userId) {\r\n\r\n const sourceActor = Utilities.getActor(sourceUuid);\r\n\r\n const divideBy = Object.values(actorDeltas).length;\r\n\r\n const [items, itemCurrencies] = await this._formatItemData(sourceActor, pileDeltas.itemDeltas, divideBy);\r\n const currencies = this._formatCurrencyData(sourceActor, pileDeltas.attributeDeltas, divideBy).concat(itemCurrencies);\r\n\r\n const chatCardHtml = await renderTemplate(CONSTANTS.PATH + \"templates/chat/looted.html\", {\r\n message: game.i18n.format(\"ITEM-PILES.Chat.Split\", { num_players: divideBy }),\r\n itemPile: sourceActor,\r\n items: items,\r\n currencies: currencies\r\n });\r\n\r\n return this._createNewChatMessage(userId, {\r\n user: game.user.id,\r\n type: CONST.CHAT_MESSAGE_TYPES.OTHER,\r\n content: chatCardHtml,\r\n flavor: \"Item Piles\",\r\n speaker: ChatMessage.getSpeaker({ alias: game.user.name })\r\n });\r\n\r\n }\r\n\r\n static async _outputTradeStartedToChat(party_1, party_2, publicTradeId) {\r\n\r\n const party_1_actor = Utilities.getActor(party_1.actor);\r\n const party_2_actor = Utilities.getActor(party_2.actor);\r\n\r\n const chatCardHtml = await renderTemplate(CONSTANTS.PATH + \"templates/chat/trade-started.html\", {\r\n party_1_actor,\r\n party_2_actor,\r\n publicTradeId,\r\n userId: game.user.id\r\n });\r\n\r\n return this._createNewChatMessage(game.user.id, {\r\n user: game.user.id,\r\n type: CONST.CHAT_MESSAGE_TYPES.OTHER,\r\n content: chatCardHtml,\r\n flavor: \"Item Piles\",\r\n speaker: ChatMessage.getSpeaker({ alias: game.user.name }),\r\n [CONSTANTS.FLAGS.PUBLIC_TRADE_ID]: publicTradeId,\r\n [CONSTANTS.FLAGS.TRADE_USERS]: [party_1.user, party_2.user]\r\n });\r\n }\r\n\r\n static async _outputTradeCompleteToChat(instigator, party_1, party_2, publicTradeId, isPrivate) {\r\n\r\n if (instigator !== game.user.id) return;\r\n\r\n const party_1_actor = Utilities.getActor(party_1.actor);\r\n const party_1_data = {\r\n actor: party_1_actor,\r\n items: party_2.items,\r\n currencies: party_2.currencies.concat(party_2.itemCurrencies)\r\n }\r\n party_1_data.got_nothing = !party_1_data.items.length && !party_1_data.currencies.length;\r\n\r\n const party_2_actor = Utilities.getActor(party_2.actor);\r\n const party_2_data = {\r\n actor: party_2_actor,\r\n items: party_1.items,\r\n currencies: party_1.currencies.concat(party_1.itemCurrencies)\r\n }\r\n party_2_data.got_nothing = !party_2_data.items.length && !party_2_data.currencies.length;\r\n\r\n if (party_1.got_nothing && party_2.got_nothing) return;\r\n\r\n const enableCollapse = (party_1_data.items.length + party_1_data.currencies.length + party_2_data.items.length + party_2_data.currencies.length) > 6;\r\n\r\n const chatCardHtml = await renderTemplate(CONSTANTS.PATH + \"templates/chat/trade-complete.html\", {\r\n party_1: party_1_data,\r\n party_2: party_2_data,\r\n publicTradeId,\r\n isPrivate,\r\n enableCollapse\r\n });\r\n\r\n return this._createNewChatMessage(game.user.id, {\r\n user: game.user.id,\r\n type: isPrivate ? CONST.CHAT_MESSAGE_TYPES.WHISPER : CONST.CHAT_MESSAGE_TYPES.OTHER,\r\n content: chatCardHtml,\r\n flavor: \"Item Piles\" + (isPrivate ? \": \" + game.i18n.localize(\"ITEM-PILES.Chat.PrivateTrade\") : \"\"),\r\n speaker: ChatMessage.getSpeaker({ alias: game.user.name }),\r\n whisper: isPrivate ? [party_2.user] : []\r\n });\r\n\r\n }\r\n\r\n static async _outputMerchantTradeToChat(sourceUuid, targetUuid, priceInformation, userId, interactionId) {\r\n\r\n const sourceActor = Utilities.getActor(sourceUuid);\r\n const targetActor = Utilities.getActor(targetUuid);\r\n\r\n const now = (+new Date());\r\n\r\n priceInformation.id = randomID();\r\n\r\n // Get all messages younger than 3 hours, and grab the last 10, then reverse them (latest to oldest)\r\n const messages = Array.from(game.messages).filter(message => (now - message.timestamp) <= (10800000)).slice(-10);\r\n messages.reverse();\r\n\r\n for (const message of messages) {\r\n const flags = getProperty(message, CONSTANTS.FLAGS.PILE);\r\n if (flags && flags.version && !foundry.utils.isNewerVersion(Helpers.getModuleVersion(), flags.version) && flags.source === sourceUuid && flags.target === targetUuid && flags.interactionId === interactionId) {\r\n return this._updateExistingMerchantMessage(message, sourceActor, targetActor, priceInformation, interactionId)\r\n }\r\n }\r\n\r\n const pileData = PileUtilities.getActorFlagData(sourceActor);\r\n\r\n const chatCardHtml = await renderTemplate(CONSTANTS.PATH + \"templates/chat/merchant-traded.html\", {\r\n message: game.i18n.format(\"ITEM-PILES.Chat.MerchantTraded\", {\r\n name: targetActor.name,\r\n merchant: sourceActor.name\r\n }),\r\n merchant: {\r\n name: sourceActor.name,\r\n img: pileData.merchantImage || sourceActor.img\r\n },\r\n actor: targetActor,\r\n priceInformation: [priceInformation]\r\n });\r\n\r\n return this._createNewChatMessage(userId, {\r\n user: game.user.id,\r\n type: CONST.CHAT_MESSAGE_TYPES.OTHER,\r\n content: chatCardHtml,\r\n flavor: \"Item Piles\",\r\n speaker: ChatMessage.getSpeaker({ alias: game.user.name }),\r\n [CONSTANTS.FLAGS.PILE]: {\r\n version: Helpers.getModuleVersion(),\r\n source: sourceUuid,\r\n target: targetUuid,\r\n priceInformation: [priceInformation],\r\n interactionId: interactionId\r\n }\r\n });\r\n\r\n }\r\n\r\n static async _giveChatMessage(source, target, items) {\r\n\r\n const now = (+new Date());\r\n\r\n const sourceActor = Utilities.getActor(source);\r\n const targetActor = Utilities.getActor(target);\r\n\r\n // Get all messages younger than 1 minute, and grab the last 5, then reverse them (latest to oldest)\r\n const messages = Array.from(game.messages)\r\n .filter(message => (now - message.timestamp) <= (60000))\r\n .slice(-5)\r\n .reverse();\r\n\r\n for (const message of messages) {\r\n const flags = getProperty(message, CONSTANTS.FLAGS.PILE);\r\n if (flags && flags.version && !foundry.utils.isNewerVersion(Helpers.getModuleVersion(), flags.version) && flags.source === sourceActor.uuid && flags.target === targetActor.uuid && message.isAuthor) {\r\n return this._updateExistingGiveMessage(message, sourceActor, targetActor, items)\r\n }\r\n }\r\n\r\n const chatCardHtml = await renderTemplate(CONSTANTS.PATH + \"templates/chat/gave-items.html\", {\r\n message: game.i18n.format(\"ITEM-PILES.Chat.GaveItems\", { source: sourceActor.name, target: targetActor.name }),\r\n source: sourceActor,\r\n target: targetActor,\r\n items: items\r\n });\r\n\r\n return this._createNewChatMessage(game.user.id, {\r\n user: game.user.id,\r\n type: CONST.CHAT_MESSAGE_TYPES.OTHER,\r\n content: chatCardHtml,\r\n flavor: \"Item Piles\",\r\n speaker: ChatMessage.getSpeaker({ alias: game.user.name }),\r\n [CONSTANTS.FLAGS.PILE]: {\r\n version: Helpers.getModuleVersion(),\r\n source: sourceActor.uuid,\r\n target: targetActor.uuid,\r\n items: items\r\n }\r\n })\r\n\r\n }\r\n\r\n static async _updateExistingGiveMessage(message, sourceActor, targetActor, items) {\r\n\r\n const flags = getProperty(message, CONSTANTS.FLAGS.PILE);\r\n\r\n const newItems = this._matchEntries(flags.items, items);\r\n\r\n const chatCardHtml = await renderTemplate(CONSTANTS.PATH + \"templates/chat/gave-items.html\", {\r\n message: game.i18n.format(\"ITEM-PILES.Chat.GaveItems\", { source: sourceActor.name, target: targetActor.name }),\r\n source: sourceActor,\r\n target: targetActor,\r\n items: newItems\r\n });\r\n\r\n return message.update({\r\n content: chatCardHtml,\r\n [`${CONSTANTS.FLAGS.PILE}.items`]: newItems\r\n });\r\n\r\n }\r\n\r\n static async _updateExistingMerchantMessage(message, sourceActor, targetActor, incomingPriceInformation, interactionId) {\r\n\r\n const flags = getProperty(message, CONSTANTS.FLAGS.PILE);\r\n\r\n const newPriceInformation = flags.priceInformation\r\n .map(priceInformation => {\r\n const boughtItem = incomingPriceInformation.buyerReceive[0];\r\n const foundEntry = Utilities.findSimilarItem(priceInformation.buyerReceive, boughtItem);\r\n if (foundEntry) {\r\n if (incomingPriceInformation.primary && priceInformation.primary) {\r\n foundEntry.quantity += boughtItem.quantity;\r\n incomingPriceInformation.buyerReceive.splice(0, 1);\r\n priceInformation.totalCurrencyCost += incomingPriceInformation.totalCurrencyCost;\r\n priceInformation.basePriceString = PileUtilities.getPriceArray(priceInformation.totalCurrencyCost, priceInformation.finalPrices)\r\n .filter(price => price.cost).map(price => price.string).join(\" \");\r\n } else {\r\n const sameTypePrice = incomingPriceInformation.finalPrices\r\n .map(price => {\r\n const foundItem = Utilities.findSimilarItem(priceInformation.buyerReceive, price);\r\n if (foundItem) {\r\n return { foundItem, price }\r\n }\r\n return false;\r\n })\r\n .filter(Boolean);\r\n if (sameTypePrice.length) {\r\n incomingPriceInformation.buyerReceive.splice(0, 1);\r\n sameTypePrice.forEach(match => {\r\n match.price.quantity += match.foundItem.quantity;\r\n });\r\n }\r\n }\r\n }\r\n return priceInformation;\r\n })\r\n .concat([incomingPriceInformation].filter(priceInformation => priceInformation.buyerReceive.length));\r\n\r\n const pileData = PileUtilities.getActorFlagData(sourceActor);\r\n\r\n const chatCardHtml = await renderTemplate(CONSTANTS.PATH + \"templates/chat/merchant-traded.html\", {\r\n message: game.i18n.format(\"ITEM-PILES.Chat.MerchantTraded\", {\r\n name: targetActor.name,\r\n merchant: sourceActor.name\r\n }),\r\n merchant: {\r\n name: sourceActor.name,\r\n img: pileData.merchantImage || sourceActor.img\r\n },\r\n actor: targetActor,\r\n priceInformation: newPriceInformation\r\n });\r\n\r\n return message.update({\r\n content: chatCardHtml,\r\n [`${CONSTANTS.FLAGS.PILE}.interactionId`]: interactionId,\r\n [`${CONSTANTS.FLAGS.PILE}.priceInformation`]: newPriceInformation\r\n });\r\n\r\n }\r\n\r\n static _createNewChatMessage(userId, chatData) {\r\n\r\n if (!chatData.whisper) {\r\n\r\n const mode = Helpers.getSetting(SETTINGS.OUTPUT_TO_CHAT);\r\n\r\n if (mode > 1) {\r\n chatData.whisper = Array.from(game.users)\r\n .filter(user => user.isGM)\r\n .map(user => user.id);\r\n if (mode === 2) {\r\n chatData.whisper.push(userId);\r\n }\r\n chatData.type = CONST.CHAT_MESSAGE_TYPES.WHISPER;\r\n }\r\n\r\n }\r\n\r\n return ChatMessage.create(chatData);\r\n\r\n }\r\n\r\n}\r\n","import CONSTANTS from \"./constants/constants.js\";\r\nimport * as Helpers from \"./helpers/helpers.js\";\r\nimport { debug } from \"./helpers/helpers.js\";\r\nimport { stringIsUuid } from \"./helpers/utilities.js\";\r\nimport PrivateAPI from \"./API/private-api.js\";\r\nimport TradeAPI from \"./API/trade-api.js\";\r\nimport ChatAPI from \"./API/chat-api.js\";\r\n\r\nexport default class ItemPileSocket {\r\n\r\n static ready = false;\r\n\r\n static HANDLERS = {\r\n /**\r\n * Generic sockets\r\n */\r\n CALL_HOOK: \"callHook\",\r\n TOGGLE_HOOKS: \"toggleHooks\",\r\n\r\n /**\r\n * Chat messages\r\n */\r\n PICKUP_CHAT_MESSAGE: \"pickupChatMessage\",\r\n SPLIT_CHAT_MESSAGE: \"splitChatMessage\",\r\n MERCHANT_TRADE_CHAT_MESSAGE: \"merchantTradeChatMessage\",\r\n DISABLE_CHAT_TRADE_BUTTON: \"disableChatTradeButton\",\r\n\r\n /**\r\n * Item pile sockets\r\n */\r\n CREATE_PILE: \"createItemPile\",\r\n UPDATE_PILE: \"updateItemPile\",\r\n UPDATED_PILE: \"updatedPile\",\r\n DELETE_PILE: \"deleteItemPile\",\r\n TURN_INTO_PILE: \"turnIntoPiles\",\r\n REVERT_FROM_PILE: \"revertFromPiles\",\r\n REFRESH_PILE: \"refreshItemPile\",\r\n SPLIT_PILE: \"splitItemPileContent\",\r\n\r\n /**\r\n * UI sockets\r\n */\r\n RENDER_INTERFACE: \"renderItemPileApplication\",\r\n UNRENDER_INTERFACE: \"unrenderItemPileApplication\",\r\n RERENDER_TOKEN_HUD: \"rerenderTokenHud\",\r\n USER_OPENED_INTERFACE: \"userOpenedInterface\",\r\n USER_CLOSED_INTERFACE: \"userClosedInterface\",\r\n\r\n /**\r\n * Item & attribute sockets\r\n */\r\n GIVE_ITEMS: \"giveItems\",\r\n GIVE_ITEMS_RESPONSE: \"giveItemsResponse\",\r\n DROP_ITEMS: \"dropItems\",\r\n ADD_ITEMS: \"addItems\",\r\n REMOVE_ITEMS: \"removeItems\",\r\n TRANSFER_ITEMS: \"transferItems\",\r\n TRANSFER_ALL_ITEMS: \"transferAllItems\",\r\n ADD_CURRENCIES: \"addCurrencies\",\r\n REMOVE_CURRENCIES: \"removeCurrencies\",\r\n TRANSFER_CURRENCIES: \"transferCurrencies\",\r\n TRANSFER_ALL_CURRENCIES: \"transferAllCurrencies\",\r\n SET_ATTRIBUTES: \"setAttributes\",\r\n ADD_ATTRIBUTES: \"addAttributes\",\r\n REMOVE_ATTRIBUTES: \"removeAttributes\",\r\n TRANSFER_ATTRIBUTES: \"transferAttributes\",\r\n TRANSFER_ALL_ATTRIBUTES: \"transferAllAttributes\",\r\n TRANSFER_EVERYTHING: \"transferEverything\",\r\n COMMIT_ACTOR_CHANGES: \"commitActorChanges\",\r\n ROLL_ITEM_TABLE: \"rollItemTable\",\r\n\r\n /**\r\n * Trading sockets\r\n */\r\n TRADE_REQUEST_PROMPT: \"tradePrompt\",\r\n TRADE_REQUEST_CANCELLED: \"tradeCancelled\",\r\n REQUEST_TRADE_DATA: \"requestTradeData\",\r\n TRADE_CLOSED: \"publicTradeClosed\",\r\n PUBLIC_TRADE_UPDATE_ITEMS: \"publicTradeUpdateItems\",\r\n PUBLIC_TRADE_UPDATE_ITEM_CURRENCIES: \"publicTradeUpdateItemCurrencies\",\r\n PUBLIC_TRADE_UPDATE_CURRENCIES: \"publicTradeUpdateCurrencies\",\r\n PUBLIC_TRADE_STATE: \"publicTradeAcceptedState\",\r\n PRIVATE_TRADE_UPDATE_ITEMS: \"privateTradeUpdateItems\",\r\n PRIVATE_TRADE_UPDATE_ITEM_CURRENCIES: \"privateTradeUpdateItemCurrencies\",\r\n PRIVATE_TRADE_UPDATE_CURRENCIES: \"privateTradeUpdateCurrencies\",\r\n PRIVATE_TRADE_STATE: \"privateTradeAcceptedState\",\r\n EXECUTE_TRADE: \"executeTrade\",\r\n TRADE_COMPLETED: \"tradeCompleted\",\r\n\r\n /**\r\n * Merchant sockets\r\n */\r\n TRADE_ITEMS: \"tradeItems\"\r\n }\r\n\r\n static BINDINGS = {\r\n [this.HANDLERS.CALL_HOOK]: (hook, response, ...args) => callHook(hook, response, ...args),\r\n\r\n [this.HANDLERS.TOGGLE_HOOKS]: (toggle) => {\r\n Helpers.hooks.run = toggle;\r\n },\r\n\r\n [this.HANDLERS.DROP_ITEMS]: (args) => PrivateAPI._dropItems(args),\r\n [this.HANDLERS.GIVE_ITEMS]: (...args) => PrivateAPI._giveItems(...args),\r\n [this.HANDLERS.GIVE_ITEMS_RESPONSE]: (...args) => PrivateAPI._giveItemsResponse(...args),\r\n [this.HANDLERS.ADD_ITEMS]: (...args) => PrivateAPI._addItems(...args),\r\n [this.HANDLERS.REMOVE_ITEMS]: (...args) => PrivateAPI._removeItems(...args),\r\n [this.HANDLERS.TRANSFER_ITEMS]: (...args) => PrivateAPI._transferItems(...args),\r\n [this.HANDLERS.TRANSFER_ALL_ITEMS]: (...args) => PrivateAPI._transferAllItems(...args),\r\n [this.HANDLERS.ADD_CURRENCIES]: (...args) => PrivateAPI._addCurrencies(...args),\r\n [this.HANDLERS.REMOVE_CURRENCIES]: (...args) => PrivateAPI._removeCurrencies(...args),\r\n [this.HANDLERS.TRANSFER_CURRENCIES]: (...args) => PrivateAPI._transferCurrencies(...args),\r\n [this.HANDLERS.TRANSFER_ALL_CURRENCIES]: (...args) => PrivateAPI._transferAllCurrencies(...args),\r\n [this.HANDLERS.SET_ATTRIBUTES]: (...args) => PrivateAPI._setAttributes(...args),\r\n [this.HANDLERS.ADD_ATTRIBUTES]: (...args) => PrivateAPI._addAttributes(...args),\r\n [this.HANDLERS.REMOVE_ATTRIBUTES]: (...args) => PrivateAPI._removeAttributes(...args),\r\n [this.HANDLERS.TRANSFER_ATTRIBUTES]: (...args) => PrivateAPI._transferAttributes(...args),\r\n [this.HANDLERS.TRANSFER_ALL_ATTRIBUTES]: (...args) => PrivateAPI._transferAllAttributes(...args),\r\n [this.HANDLERS.TRANSFER_EVERYTHING]: (...args) => PrivateAPI._transferEverything(...args),\r\n [this.HANDLERS.COMMIT_ACTOR_CHANGES]: (...args) => PrivateAPI._commitActorChanges(...args),\r\n [this.HANDLERS.ROLL_ITEM_TABLE]: (...args) => PrivateAPI._rollItemTable(...args),\r\n\r\n [this.HANDLERS.CREATE_PILE]: (...args) => PrivateAPI._createItemPile(...args),\r\n [this.HANDLERS.UPDATE_PILE]: (...args) => PrivateAPI._updateItemPile(...args),\r\n [this.HANDLERS.UPDATED_PILE]: (...args) => PrivateAPI._updatedItemPile(...args),\r\n [this.HANDLERS.DELETE_PILE]: (...args) => PrivateAPI._deleteItemPile(...args),\r\n [this.HANDLERS.TURN_INTO_PILE]: (...args) => PrivateAPI._turnTokensIntoItemPiles(...args),\r\n [this.HANDLERS.REVERT_FROM_PILE]: (...args) => PrivateAPI._revertTokensFromItemPiles(...args),\r\n [this.HANDLERS.SPLIT_PILE]: (...args) => PrivateAPI._splitItemPileContents(...args),\r\n\r\n [this.HANDLERS.TRADE_REQUEST_PROMPT]: (...args) => TradeAPI._respondPrompt(...args),\r\n [this.HANDLERS.TRADE_REQUEST_CANCELLED]: (...args) => TradeAPI._tradeCancelled(...args),\r\n [this.HANDLERS.EXECUTE_TRADE]: (...args) => TradeAPI._executeTrade(...args),\r\n [this.HANDLERS.TRADE_COMPLETED]: (...args) => TradeAPI._tradeCompleted(...args),\r\n [this.HANDLERS.REQUEST_TRADE_DATA]: (...args) => TradeAPI._respondActiveTradeData(...args),\r\n [this.HANDLERS.TRADE_CLOSED]: (...args) => TradeAPI._tradeClosed(...args),\r\n\r\n [this.HANDLERS.PUBLIC_TRADE_UPDATE_ITEMS]: (...args) => TradeAPI._updateItems(...args),\r\n [this.HANDLERS.PUBLIC_TRADE_UPDATE_ITEM_CURRENCIES]: (...args) => TradeAPI._updateItemCurrencies(...args),\r\n [this.HANDLERS.PUBLIC_TRADE_UPDATE_CURRENCIES]: (...args) => TradeAPI._updateCurrencies(...args),\r\n [this.HANDLERS.PUBLIC_TRADE_STATE]: (...args) => TradeAPI._updateAcceptedState(...args),\r\n\r\n [this.HANDLERS.PRIVATE_TRADE_UPDATE_ITEMS]: (...args) => TradeAPI._updateItems(...args),\r\n [this.HANDLERS.PRIVATE_TRADE_UPDATE_ITEM_CURRENCIES]: (...args) => TradeAPI._updateItemCurrencies(...args),\r\n [this.HANDLERS.PRIVATE_TRADE_UPDATE_CURRENCIES]: (...args) => TradeAPI._updateCurrencies(...args),\r\n [this.HANDLERS.PRIVATE_TRADE_STATE]: (...args) => TradeAPI._updateAcceptedState(...args),\r\n\r\n [this.HANDLERS.PICKUP_CHAT_MESSAGE]: (...args) => ChatAPI._outputPickupToChat(...args),\r\n [this.HANDLERS.SPLIT_CHAT_MESSAGE]: (...args) => ChatAPI._outputSplitToChat(...args),\r\n [this.HANDLERS.MERCHANT_TRADE_CHAT_MESSAGE]: (...args) => ChatAPI._outputMerchantTradeToChat(...args),\r\n [this.HANDLERS.DISABLE_CHAT_TRADE_BUTTON]: (...args) => ChatAPI._disableTradingButton(...args),\r\n\r\n [this.HANDLERS.RENDER_INTERFACE]: (...args) => PrivateAPI._renderItemPileInterface(...args),\r\n [this.HANDLERS.UNRENDER_INTERFACE]: (...args) => PrivateAPI._unrenderItemPileInterface(...args),\r\n [this.HANDLERS.RERENDER_TOKEN_HUD]: (...args) => PrivateAPI._updateTokenHud(...args),\r\n [this.HANDLERS.USER_OPENED_INTERFACE]: (...args) => InterfaceTracker.userOpened(...args),\r\n [this.HANDLERS.USER_CLOSED_INTERFACE]: (...args) => InterfaceTracker.userClosed(...args),\r\n\r\n [this.HANDLERS.TRADE_ITEMS]: (...args) => PrivateAPI._tradeItems(...args),\r\n\r\n }\r\n\r\n static _socket;\r\n\r\n static initialize() {\r\n InterfaceTracker.initialize();\r\n this._socket = socketlib.registerModule(CONSTANTS.MODULE_NAME);\r\n for (let [key, callback] of Object.entries(this.BINDINGS)) {\r\n this._socket.register(key, callback);\r\n debug(`Registered itemPileSocket: ${key}`);\r\n }\r\n debug(\"Registered all Item Piles sockets\")\r\n this.ready = true;\r\n }\r\n\r\n static executeAsGM(handler, ...args) {\r\n if (!Helpers.isGMConnected()) {\r\n Helpers.custom_warning(game.i18n.format(\"ITEM-PILES.Warnings.NoGMsConnectedAction\", { action: handler }), true);\r\n return false;\r\n }\r\n return this._socket.executeAsGM(handler, ...args);\r\n }\r\n\r\n static executeAsUser(handler, userId, ...args) {\r\n return this._socket.executeAsUser(handler, userId, ...args);\r\n }\r\n\r\n static executeForAllGMs(handler, ...args) {\r\n return this._socket.executeForAllGMs(handler, ...args);\r\n }\r\n\r\n static executeForOtherGMs(handler, ...args) {\r\n return this._socket.executeForOtherGMs(handler, ...args);\r\n }\r\n\r\n static executeForEveryone(handler, ...args) {\r\n return this._socket.executeForEveryone(handler, ...args);\r\n }\r\n\r\n static executeForOthers(handler, ...args) {\r\n return this._socket.executeForOthers(handler, ...args);\r\n }\r\n\r\n static executeForUsers(handler, userIds, ...args) {\r\n return this._socket.executeForUsers(handler, userIds, ...args);\r\n }\r\n\r\n static callHook(hook, ...args) {\r\n if (!Helpers.hooks.run) return;\r\n return this._socket.executeForEveryone(this.HANDLERS.CALL_HOOK, hook, ...args);\r\n }\r\n\r\n static callHookForUsers(hook, users, ...args) {\r\n if (!Helpers.hooks.run) return;\r\n return this._socket.executeForUsers(this.HANDLERS.CALL_HOOK, users, hook, ...args);\r\n }\r\n\r\n}\r\n\r\nasync function callHook(hook, ...args) {\r\n const newArgs = [];\r\n for (let arg of args) {\r\n if (stringIsUuid(arg)) {\r\n const testArg = fromUuidSync(arg);\r\n if (testArg) {\r\n arg = testArg;\r\n }\r\n }\r\n newArgs.push(arg);\r\n }\r\n return Hooks.callAll(hook, ...newArgs);\r\n}\r\n\r\nexport const InterfaceTracker = {\r\n\r\n users: {},\r\n\r\n initialize() {\r\n this.users = {};\r\n Array.from(game.users).forEach(user => {\r\n this.users[user.id] = new Set();\r\n });\r\n Hooks.on(CONSTANTS.HOOKS.OPEN_INTERFACE, (app) => {\r\n ItemPileSocket.executeForOthers(ItemPileSocket.HANDLERS.USER_OPENED_INTERFACE, game.user.id, app.id);\r\n });\r\n Hooks.on(CONSTANTS.HOOKS.CLOSE_INTERFACE, (app) => {\r\n ItemPileSocket.executeForOthers(ItemPileSocket.HANDLERS.USER_CLOSED_INTERFACE, game.user.id, app.id);\r\n });\r\n },\r\n\r\n userOpened(userId, id) {\r\n if (!this.users[userId]) return;\r\n this.users[userId].add(id);\r\n },\r\n\r\n userClosed(userId, id) {\r\n if (!this.users[userId]) return;\r\n this.users[userId].delete(id);\r\n },\r\n\r\n isOpened(id) {\r\n return Object.values(this.users).some(interfaceList => interfaceList.has(id))\r\n }\r\n\r\n}\r\n","import CONSTANTS from \"../constants/constants.js\";\r\nimport ItemPileSocket from \"../socket.js\";\r\nimport SETTINGS from \"../constants/settings.js\";\r\nimport editors from \"../applications/editors/index.js\";\r\n\r\n\r\nexport const debounceManager = {\r\n\r\n debounces: {},\r\n\r\n setDebounce(id, method) {\r\n if (this.debounces[id]) {\r\n return this.debounces[id];\r\n }\r\n this.debounces[id] = debounce(function (...args) {\r\n delete debounceManager.debounces[id];\r\n return method(...args);\r\n }, 250);\r\n return this.debounces[id];\r\n }\r\n};\r\n\r\nexport const hooks = {\r\n run: true,\r\n _hooks: {},\r\n\r\n async runWithout(callback) {\r\n await ItemPileSocket.executeForEveryone(ItemPileSocket.HANDLERS.TOGGLE_HOOKS, false);\r\n await callback();\r\n await ItemPileSocket.executeForEveryone(ItemPileSocket.HANDLERS.TOGGLE_HOOKS, true);\r\n },\r\n\r\n call(hook, ...args) {\r\n if (!this.run) return;\r\n return Hooks.call(hook, ...args);\r\n },\r\n\r\n callAll(hook, ...args) {\r\n if (!this.run) return;\r\n return Hooks.callAll(hook, ...args);\r\n },\r\n\r\n on(hook, callback) {\r\n Hooks.on(hook, (...args) => {\r\n if (!this.run) return;\r\n callback(...args);\r\n });\r\n }\r\n}\r\n\r\nexport function getModuleVersion() {\r\n return game.modules.get(CONSTANTS.MODULE_NAME).version;\r\n}\r\n\r\n/**\r\n * This function determines if the given parameter is a callable function\r\n *\r\n * @param {function} inFunc The function object to be tested\r\n * @return {boolean} A boolean whether the function is actually a function\r\n */\r\nexport function isFunction(inFunc) {\r\n return inFunc && (\r\n {}.toString.call(inFunc) === '[object Function]'\r\n ||\r\n {}.toString.call(inFunc) === '[object AsyncFunction]'\r\n );\r\n}\r\n\r\nexport function wait(ms) {\r\n return new Promise(resolve => setTimeout(resolve, ms));\r\n}\r\n\r\n/**\r\n * @param key\r\n * @returns {*}\r\n */\r\nexport function getSetting(key) {\r\n return game.settings.get(CONSTANTS.MODULE_NAME, key);\r\n}\r\n\r\nexport function setSetting(key, value) {\r\n if (value === undefined) {\r\n throw new Error(\"setSetting | value must not be undefined!\");\r\n }\r\n return game.settings.set(CONSTANTS.MODULE_NAME, key, value);\r\n}\r\n\r\nexport function debug(msg, args = \"\") {\r\n if (game.settings.get(CONSTANTS.MODULE_NAME, \"debug\")) {\r\n console.log(`DEBUG | Item Piles | ${msg}`, args)\r\n }\r\n}\r\n\r\nexport function custom_notify(message) {\r\n message = `Item Piles | ${message}`;\r\n ui.notifications.notify(message, { console: false });\r\n console.log(message.replace(\"<br>\", \"\\n\"));\r\n}\r\n\r\nexport function custom_warning(warning, notify = false) {\r\n warning = `Item Piles | ${warning}`;\r\n if (notify) {\r\n ui.notifications.warn(warning, { console: false });\r\n }\r\n console.warn(warning.replace(\"<br>\", \"\\n\"));\r\n}\r\n\r\nexport function custom_error(error, notify = true) {\r\n error = `Item Piles | ${error}`;\r\n if (notify) {\r\n ui.notifications.error(error, { console: false });\r\n }\r\n return new Error(error.replace(\"<br>\", \"\\n\"));\r\n}\r\n\r\nexport function capitalizeFirstLetter(str) {\r\n return str.slice(0, 1).toUpperCase() + str.slice(1);\r\n}\r\n\r\nexport function isRealNumber(inNumber) {\r\n return !isNaN(inNumber)\r\n && typeof inNumber === \"number\"\r\n && isFinite(inNumber);\r\n}\r\n\r\nexport function isActiveGM(user) {\r\n return user.active && user.isGM;\r\n}\r\n\r\nexport function getActiveGMs() {\r\n return game.users.filter(isActiveGM);\r\n}\r\n\r\nexport function isResponsibleGM() {\r\n if (!game.user.isGM) {\r\n return false;\r\n }\r\n return !getActiveGMs().some(other => other.id < game.user.id);\r\n}\r\n\r\nexport function isGMConnected() {\r\n return !!Array.from(game.users).find(user => user.isGM && user.active);\r\n}\r\n\r\nexport function roundToDecimals(num, decimals) {\r\n if (!decimals) return Math.floor(num);\r\n return Number(Math.round(num + 'e' + decimals) + 'e-' + decimals);\r\n}\r\n\r\nexport function clamp(num, min, max) {\r\n return Math.max(Math.min(num, max), min);\r\n}\r\n\r\nexport function getActiveApps(id, single = false) {\r\n const apps = Object.values(ui.windows).filter(app => app.id.startsWith(id) && app._state > Application.RENDER_STATES.CLOSED);\r\n if (single) {\r\n return apps?.[0] ?? false;\r\n }\r\n return apps;\r\n}\r\n\r\n/**\r\n * This function linearly interpolates between p1 and p2 based on a normalized value of t\r\n *\r\n * @param {string} inFile The start value\r\n * @param {object} inOptions The end value\r\n * @return {array|boolean} Interpolated value\r\n */\r\nexport async function getFiles(inFile, { applyWildCard = false, softFail = false } = {}) {\r\n\r\n let source = 'data';\r\n const browseOptions = { wildcard: applyWildCard };\r\n\r\n if (/\\.s3\\./.test(inFile)) {\r\n source = 's3'\r\n const { bucket, keyPrefix } = FilePicker.parseS3URL(inFile);\r\n if (bucket) {\r\n browseOptions.bucket = bucket;\r\n inFile = keyPrefix;\r\n }\r\n }\r\n\r\n try {\r\n return (await FilePicker.browse(source, inFile, browseOptions)).files;\r\n } catch (err) {\r\n if (softFail) return false;\r\n throw custom_error(`Could not get files! | ${err}`);\r\n }\r\n}\r\n\r\n/**\r\n * Returns a floating point number between a minimum and maximum value\r\n *\r\n * @param {number} min The minimum value\r\n * @param {number} max The maximum value\r\n * @return {number} A random value between the range given\r\n */\r\nexport function random_float_between(min, max) {\r\n const random = Math.random();\r\n const _max = Math.max(max, min);\r\n const _min = Math.min(max, min);\r\n return random * (_max - _min) + _min;\r\n}\r\n\r\n/**\r\n * Returns an integer between a minimum and maximum value\r\n *\r\n * @param {number} min The minimum value\r\n * @param {number} max The maximum value\r\n * @return {int} A random integer between the range given\r\n */\r\nexport function random_int_between(min, max) {\r\n return Math.floor(random_float_between(min, max));\r\n}\r\n\r\n/**\r\n * Returns a random element in the given array\r\n *\r\n * @param {array} inArray An array\r\n * @param {boolean} recurse Whether to recurse if the randomly chosen element is also an array\r\n * @return {object} A random element from the array\r\n */\r\nexport function random_array_element(inArray, { recurse = false } = {}) {\r\n let choice = inArray[random_int_between(0, inArray.length)];\r\n if (recurse && Array.isArray(choice)) {\r\n return random_array_element(choice, { recurse: true });\r\n }\r\n return choice;\r\n}\r\n\r\n\r\nexport function styleFromObject(obj, vars = false) {\r\n return Object.entries(obj).map(entry => (vars ? \"--\" : \"\") + entry[0] + ': ' + entry[1] + \";\").join(\"\");\r\n}\r\n\r\n\r\nexport function abbreviateNumbers(number, decPlaces = 2) {\r\n\r\n // 2 decimal places => 100, 3 => 1000, etc\r\n decPlaces = Math.pow(10, decPlaces)\r\n\r\n // Enumerate number abbreviations\r\n let abbrev = ['k', 'm', 'b', 't']\r\n\r\n // Go through the array backwards, so we do the largest first\r\n for (let i = abbrev.length - 1; i >= 0; i--) {\r\n\r\n // Convert array index to \"1000\", \"1000000\", etc\r\n let size = Math.pow(10, (i + 1) * 3)\r\n\r\n // If the number is bigger or equal do the abbreviation\r\n if (size <= number) {\r\n // Here, we multiply by decPlaces, round, and then divide by decPlaces.\r\n // This gives us nice rounding to a particular decimal place.\r\n number = Math.round((number * decPlaces) / size) / decPlaces\r\n\r\n // Handle special case where we round up to the next abbreviation\r\n if (number === 1000 && i < abbrev.length - 1) {\r\n number = 1\r\n i++\r\n }\r\n\r\n // Add the letter for the abbreviation\r\n number += abbrev[i]\r\n\r\n // We are done... stop\r\n break;\r\n }\r\n }\r\n\r\n return number\r\n}\r\n\r\n\r\nexport function timeSince(date) {\r\n const seconds = Math.floor((new Date() - date) / 1000);\r\n const intervals = {\r\n \"d\": 86400,\r\n \"h\": 3600,\r\n \"m\": 60\r\n }\r\n\r\n for (const [key, value] of Object.entries(intervals)) {\r\n const interval = seconds / value;\r\n if (interval > 1) {\r\n return Math.floor(interval) + key;\r\n }\r\n }\r\n\r\n return Math.ceil(seconds) + \"s\";\r\n}\r\n\r\n\r\nexport function getApplicationPositions(application_1, application_2 = false) {\r\n\r\n let midPoint = (window.innerWidth / 2);\r\n\r\n if (!application_2) {\r\n if (((midPoint - 200) - application_1.position.width - 25) > 0) {\r\n midPoint -= 200\r\n }\r\n return [\r\n { left: midPoint - application_1.position.width - 25 },\r\n { left: midPoint + 25 }\r\n ]\r\n }\r\n\r\n const application_1_position = {\r\n left: application_1.position.left,\r\n top: application_1.position.top,\r\n width: application_1.position.width\r\n };\r\n const application_2_position = {\r\n left: application_2.position.left,\r\n top: application_1.position.top,\r\n width: application_2.position.width\r\n };\r\n\r\n application_2_position.left = application_1_position.left - application_2_position.width - 25;\r\n if (application_2_position.left < 0) {\r\n application_2_position.left = application_1_position.left + application_1_position.width + 25\r\n }\r\n if ((application_2_position.left + application_2_position.width) > window.innerWidth) {\r\n application_2_position.left = midPoint - application_2_position.width - 25;\r\n application_1_position.left = midPoint + 25;\r\n }\r\n\r\n return [\r\n application_1_position,\r\n application_2_position\r\n ]\r\n\r\n}\r\n\r\nexport async function openEditor(key, data = false) {\r\n\r\n const setting = SETTINGS.DEFAULTS()[key];\r\n\r\n const editor = editors[setting.application];\r\n\r\n if (!data) {\r\n data = getSetting(key);\r\n }\r\n\r\n const result = await editor.show(data, { ...setting.applicationOptions, onchange: setting.onchange } ?? {});\r\n\r\n if (setting.onchange && result) setting.onchange(result);\r\n\r\n return result;\r\n\r\n}\r\n\r\nexport function isCoordinateWithinPosition(x, y, position) {\r\n return x >= position.left && x < position.left + position.width\r\n && y >= position.top && y < position.top + position.height;\r\n}\r\n\r\n\r\nexport function getCanvasMouse() {\r\n return game.release.generation === 11\r\n ? canvas.app.renderer.plugins.interaction.pointer\r\n : canvas.app.renderer.plugins.interaction.mouse;\r\n}\r\n","import * as Helpers from \"./helpers/helpers.js\";\r\nimport * as PileUtilities from \"./helpers/pile-utilities.js\";\r\nimport { isValidItemPile } from \"./helpers/pile-utilities.js\";\r\nimport ItemPileConfig from \"./applications/item-pile-config/item-pile-config.js\";\r\nimport ItemEditor from \"./applications/item-editor/item-editor.js\";\r\nimport SETTINGS from \"./constants/settings.js\";\r\nimport CONSTANTS from \"./constants/constants.js\";\r\nimport UserSelectDialog from \"./applications/dialogs/user-select-dialog/user-select-dialog.js\";\r\n\r\nexport let fastToolTip = null;\r\n\r\nexport default function registerUIOverrides() {\r\n Hooks.on(\"renderPlayerList\", addTradeButton);\r\n Hooks.on(\"getActorDirectoryEntryContext\", insertActorContextMenuItems);\r\n Hooks.on(\"getActorSheetHeaderButtons\", insertActorHeaderButtons);\r\n Hooks.on(\"getItemSheetHeaderButtons\", insertItemHeaderButtons);\r\n Hooks.on(\"renderSidebarTab\", hideTemporaryItems);\r\n Hooks.on(\"renderTokenHUD\", renderPileHUD);\r\n Hooks.on(\"hoverToken\", handleTokenBorders);\r\n Hooks.on(\"controlToken\", handleTokenBorders);\r\n fastToolTip = new FastTooltipManager();\r\n fastToolTip.activateEventListeners();\r\n}\r\n\r\nfunction handleTokenBorders(token) {\r\n if (!isValidItemPile(token)) return;\r\n const setting = Helpers.getSetting(SETTINGS.HIDE_TOKEN_BORDER);\r\n token.border.renderable = token.controlled ||\r\n (setting !== SETTINGS.HIDE_TOKEN_BORDER_OPTIONS.EVERYONE && (\r\n setting === SETTINGS.HIDE_TOKEN_BORDER_OPTIONS.SHOW\r\n ||\r\n (setting === SETTINGS.HIDE_TOKEN_BORDER_OPTIONS.PLAYERS && game.user.isGM)\r\n ));\r\n}\r\n\r\nfunction hideTemporaryItems(sidebar) {\r\n if (sidebar.tabName !== \"items\") return;\r\n Array.from(game.items).filter(item => {\r\n return getProperty(item.toObject(), CONSTANTS.FLAGS.TEMPORARY_ITEM);\r\n })\r\n .forEach(item => {\r\n const element = sidebar.element.find(`.directory-item[data-document-id=\"${item.id}\"]`);\r\n if (!element.length) return;\r\n if (element.parent().children().length === 1) {\r\n return element.parent().empty();\r\n }\r\n element.find(`.directory-item[data-document-id=\"${item.id}\"]`).remove();\r\n });\r\n}\r\n\r\nfunction addTradeButton(app, html) {\r\n if (!Helpers.getSetting(SETTINGS.ENABLE_TRADING) || !Helpers.getSetting(SETTINGS.SHOW_TRADE_BUTTON)) return;\r\n\r\n const minimalUI = game.modules.get('minimal-ui')?.active;\r\n const classes = \"item-piles-player-list-trade-button\" + (minimalUI ? \" item-piles-minimal-ui\" : \"\")\r\n const text = !minimalUI ? \" Request Trade\" : \"\"\r\n const button = $(`<button type=\"button\" class=\"${classes}\"><i class=\"fas fa-handshake\"></i>${text}</button>`)\r\n\r\n button.click(() => {\r\n game.itempiles.API.requestTrade();\r\n });\r\n html.append(button);\r\n}\r\n\r\nfunction insertActorContextMenuItems(html, menuItems) {\r\n\r\n menuItems.push({\r\n name: \"Item Piles: \" + game.i18n.localize(\"ITEM-PILES.ContextMenu.ShowToPlayers\"),\r\n icon: `<i class=\"fas fa-eye\"></i>`,\r\n callback: async (html) => {\r\n const actorId = html[0].dataset.documentId;\r\n const actor = game.actors.get(actorId);\r\n const activeUsers = Array.from(game.users).filter(u => u.active && u !== game.user).map(u => u.id);\r\n if (!activeUsers.length) {\r\n return Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Warnings.NoPlayersActive\"), true);\r\n }\r\n const users = await UserSelectDialog.show();\r\n if (!users || !users.length) return;\r\n Helpers.custom_notify(game.i18n.format(\"ITEM-PILES.Notifications.ShownToPlayers\", { actor_name: actor.name }))\r\n return game.itempiles.API.renderItemPileInterface(actor, { userIds: users, useDefaultCharacter: true });\r\n },\r\n condition: (html) => {\r\n const actorId = html[0].dataset.documentId;\r\n const actor = game.actors.get(actorId);\r\n return game.user.isGM && PileUtilities.isValidItemPile(actor);\r\n }\r\n }, {\r\n name: \"Item Piles: \" + game.i18n.localize(\"ITEM-PILES.ContextMenu.RequestTrade\"),\r\n icon: `<i class=\"fas fa-handshake\"></i>`,\r\n callback: (html) => {\r\n const actorId = html[0].dataset.documentId;\r\n const actor = game.actors.get(actorId);\r\n const user = Array.from(game.users).find(u => u.character === actor && u.active);\r\n return game.itempiles.API.requestTrade(user);\r\n },\r\n condition: (html) => {\r\n const actorId = html[0].dataset.documentId;\r\n const actor = game.actors.get(actorId);\r\n return Helpers.getSetting(SETTINGS.ENABLE_TRADING)\r\n && (game.user?.character !== actor || Array.from(game.users).find(u => u.character === actor && u.active));\r\n }\r\n });\r\n}\r\n\r\nfunction insertActorHeaderButtons(actorSheet, buttons) {\r\n\r\n if (!game.user.isGM || Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_BUTTON)) return;\r\n\r\n let obj = actorSheet?.object ?? actorSheet?.actor;\r\n\r\n buttons.unshift({\r\n label: Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"\" : \"Configure\",\r\n icon: \"fas fa-box-open\",\r\n class: \"item-piles-config-button\",\r\n onclick: () => {\r\n ItemPileConfig.show(obj);\r\n }\r\n })\r\n}\r\n\r\nfunction insertItemHeaderButtons(itemSheet, buttons) {\r\n\r\n if (!game.user.isGM || Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_BUTTON)) return;\r\n\r\n let obj = itemSheet?.object ?? itemSheet?.item;\r\n\r\n buttons.unshift({\r\n label: Helpers.getSetting(SETTINGS.HIDE_ACTOR_HEADER_TEXT) ? \"\" : \"Configure\",\r\n icon: \"fas fa-box-open\",\r\n class: \"item-piles-config-button\",\r\n onclick: () => {\r\n ItemEditor.show(obj);\r\n }\r\n })\r\n}\r\n\r\nfunction renderPileHUD(app, html) {\r\n\r\n const document = app?.object?.document;\r\n\r\n if (!document) return;\r\n\r\n if (!PileUtilities.isValidItemPile(document)) return;\r\n\r\n if (PileUtilities.isItemPileContainer(document)) {\r\n\r\n const pileData = PileUtilities.getActorFlagData(document);\r\n\r\n const container = $(`<div class=\"col right\" style=\"right:-130px;\"></div>`);\r\n\r\n const lock_button = $(`<div class=\"control-icon item-piles\" data-fast-tooltip=\"${game.i18n.localize(\"ITEM-PILES.HUD.ToggleLocked\")}\"><i class=\"fas fa-lock${pileData.locked ? \"\" : \"-open\"}\"></i></div>`);\r\n lock_button.click(async function () {\r\n $(this).find('.fas').toggleClass('fa-lock').toggleClass('fa-lock-open');\r\n await game.itempiles.API.toggleItemPileLocked(document);\r\n });\r\n container.append(lock_button);\r\n\r\n const open_button = $(`<div class=\"control-icon item-piles\" data-fast-tooltip=\"${game.i18n.localize(\"ITEM-PILES.HUD.ToggleClosed\")}\"><i class=\"fas fa-box${pileData.closed ? \"\" : \"-open\"}\"></i></div>`);\r\n open_button.click(async function () {\r\n $(this).find('.fas').toggleClass('fa-box').toggleClass('fa-box-open');\r\n await game.itempiles.API.toggleItemPileClosed(document);\r\n });\r\n container.append(open_button);\r\n\r\n const configure_button = $(`<div class=\"control-icon item-piles\" data-fast-tooltip=\"${game.i18n.localize(\"ITEM-PILES.HUD.Configure\")}\"><i class=\"fas fa-toolbox\"></i></div>`);\r\n configure_button.click(async function () {\r\n ItemPileConfig.show(document);\r\n });\r\n container.append(configure_button);\r\n\r\n html.append(container)\r\n\r\n }\r\n\r\n}\r\n\r\nclass FastTooltipManager extends TooltipManager {\r\n\r\n /**\r\n * An amount of margin which is used to offset tooltips from their anchored element.\r\n * @type {number}\r\n */\r\n static TOOLTIP_MARGIN_PX = 5;\r\n /**\r\n * The number of milliseconds delay which activates a tooltip on a \"long hover\".\r\n * @type {number}\r\n */\r\n static TOOLTIP_ACTIVATION_MS = 500;\r\n /**\r\n * The number of milliseconds delay which activates a tooltip on a \"long hover\".\r\n * @type {number}\r\n */\r\n static TOOLTIP_DEACTIVATION_MS = 500;\r\n /**\r\n * The directions in which a tooltip can extend, relative to its tool-tipped element.\r\n * @enum {string}\r\n */\r\n static TOOLTIP_DIRECTIONS = {\r\n UP: \"UP\",\r\n DOWN: \"DOWN\",\r\n LEFT: \"LEFT\",\r\n RIGHT: \"RIGHT\",\r\n CENTER: \"CENTER\"\r\n };\r\n /**\r\n * A reference to the HTML element which is currently tool-tipped, if any.\r\n * @type {HTMLElement|null}\r\n */\r\n element = null;\r\n /**\r\n * Is the tooltip currently active?\r\n * @type {boolean}\r\n */\r\n #active = false;\r\n /**\r\n * A reference to a window timeout function when an element is activated.\r\n * @private\r\n */\r\n #activationTimeout;\r\n /**\r\n * A reference to a window timeout function when an element is deactivated.\r\n * @private\r\n */\r\n #deactivationTimeout;\r\n /**\r\n * An element which is pending tooltip activation if hover is sustained\r\n * @type {HTMLElement|null}\r\n */\r\n #pending;\r\n\r\n constructor() {\r\n super();\r\n const tooltipElem = $(`<aside id=\"fast-tooltip\" role=\"tooltip\"></aside>`);\r\n $(\"body\").append(tooltipElem);\r\n this.tooltip = document.getElementById(\"fast-tooltip\");\r\n }\r\n\r\n /* -------------------------------------------- */\r\n\r\n /**\r\n * Activate interactivity by listening for hover events on HTML elements which have a data-fast-tooltip defined.\r\n */\r\n activateEventListeners() {\r\n document.body.addEventListener(\"pointerenter\", this.#onActivate.bind(this), true);\r\n document.body.addEventListener(\"pointerleave\", this.#onDeactivate.bind(this), true);\r\n }\r\n\r\n /* -------------------------------------------- */\r\n\r\n /**\r\n * Handle hover events which activate a tooltipped element.\r\n * @param {PointerEvent} event The initiating pointerenter event\r\n */\r\n #onActivate(event) {\r\n if (Tour.tourInProgress) return; // Don't activate tooltips during a tour\r\n const element = event.target;\r\n if (!element.dataset.fastTooltip) {\r\n // Check if the element has moved out from underneath the cursor and pointerenter has fired on a non-child of the\r\n // tooltipped element.\r\n if (this.#active && this.element && !this.element.contains(element)) this.#startDeactivation();\r\n return;\r\n }\r\n\r\n // Don't activate tooltips if the element contains an active context menu\r\n if (element.matches(\"#context-menu\") || element.querySelector(\"#context-menu\")) return;\r\n\r\n // If the tooltip is currently active, we can move it to a new element immediately\r\n if (this.#active) this.activate(element);\r\n else this.#clearDeactivation();\r\n\r\n // Otherwise, delay activation to determine user intent\r\n this.#pending = element;\r\n this.#activationTimeout = window.setTimeout(() => {\r\n this.activate(element);\r\n }, Number(element?.dataset?.tooltipActivationSpeed) ?? this.constructor.TOOLTIP_ACTIVATION_MS);\r\n }\r\n\r\n activate(element, { text, direction, cssClass } = {}) {\r\n\r\n // Check if the element still exists in the DOM.\r\n if (!document.body.contains(element)) return;\r\n this.#clearDeactivation();\r\n\r\n // Mark the element as active\r\n this.#active = true;\r\n this.element = element;\r\n element.setAttribute(\"aria-describedby\", \"fast-tooltip\");\r\n this.tooltip.innerHTML = text || game.i18n.localize(element.dataset.fastTooltip);\r\n\r\n // Activate display of the tooltip\r\n this.tooltip.removeAttribute(\"class\");\r\n this.tooltip.classList.add(\"active\");\r\n if (cssClass) this.tooltip.classList.add(cssClass);\r\n\r\n // Set tooltip position\r\n direction = direction || element.closest(\"[data-tooltip-direction]\")?.dataset.tooltipDirection;\r\n if (!direction) direction = this._determineDirection();\r\n this._setAnchor(direction);\r\n }\r\n\r\n /* -------------------------------------------- */\r\n\r\n /**\r\n * Handle hover events which deactivate a tooltipped element.\r\n * @param {PointerEvent} event The initiating pointerleave event\r\n */\r\n #onDeactivate(event) {\r\n if (event.target !== (this.element ?? this.#pending)) return;\r\n this.#startDeactivation();\r\n }\r\n\r\n /* -------------------------------------------- */\r\n\r\n /**\r\n * Start the deactivation process.\r\n */\r\n #startDeactivation() {\r\n // Clear any existing activation workflow\r\n window.clearTimeout(this.#activationTimeout);\r\n this.#pending = this.#activationTimeout = null;\r\n\r\n // Delay deactivation to confirm whether some new element is now pending\r\n window.clearTimeout(this.#deactivationTimeout);\r\n this.#deactivationTimeout = window.setTimeout(() => {\r\n if (!this.#pending) this.deactivate();\r\n }, Number(this.element?.dataset?.tooltipDeactivationSpeed) ?? this.constructor.TOOLTIP_DEACTIVATION_MS);\r\n }\r\n\r\n /* -------------------------------------------- */\r\n\r\n /**\r\n * Clear any existing deactivation workflow.\r\n */\r\n #clearDeactivation() {\r\n window.clearTimeout(this.#deactivationTimeout);\r\n this.#pending = this.#deactivationTimeout = null;\r\n }\r\n}\r\n","import CONSTANTS from \"./constants/constants.js\";\r\nimport PrivateAPI from \"./API/private-api.js\";\r\nimport * as PileUtilities from \"./helpers/pile-utilities.js\";\r\nimport * as Helpers from \"./helpers/helpers.js\";\r\nimport { hotkeyActionState } from \"./hotkeys.js\";\r\nimport { SYSTEMS } from \"./systems.js\";\r\n\r\nexport default function registerLibwrappers() {\r\n\r\n libWrapper.register(CONSTANTS.MODULE_NAME, 'Token.prototype._onClickLeft2', function (wrapped, ...args) {\r\n if (PileUtilities.isValidItemPile(this.document) && hotkeyActionState.openPileInventory) {\r\n return PrivateAPI._itemPileClicked(this.document);\r\n }\r\n return wrapped(...args);\r\n }, \"MIXED\");\r\n\r\n const versionIsEleven = foundry.utils.isNewerVersion(game.version, \"10.999\");\r\n\r\n const overrideMethod = versionIsEleven\r\n ? `DocumentDirectory.prototype._onClickEntryName`\r\n : `SidebarDirectory.prototype._onClickDocumentName`;\r\n\r\n libWrapper.register(CONSTANTS.MODULE_NAME, overrideMethod, function (wrapped, event) {\r\n event.preventDefault();\r\n const element = event.currentTarget;\r\n if (!(this instanceof Compendium)) {\r\n const documentId = element.parentElement.dataset.documentId;\r\n const document = this.constructor.collection.get(documentId);\r\n if (PileUtilities.isValidItemPile(document)) {\r\n const hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_DIRECTORY_CLICK, document);\r\n if (hookResult === false) return false;\r\n }\r\n }\r\n return wrapped(event);\r\n }, \"MIXED\");\r\n\r\n Hooks.on(CONSTANTS.HOOKS.PRE_RENDER_SHEET, (doc, forced, options) => {\r\n const renderItemPileInterface = forced && !options?.bypassItemPiles && PileUtilities.isValidItemPile(doc) && hotkeyActionState.openPileInventory;\r\n if (!renderItemPileInterface) return;\r\n game.itempiles.API.renderItemPileInterface(doc, { useDefaultCharacter: true });\r\n return false;\r\n })\r\n\r\n libWrapper.register(CONSTANTS.MODULE_NAME, `ActorSheet.prototype.render`, function (wrapped, forced, options, ...args) {\r\n const renderItemPileInterface = Hooks.call(CONSTANTS.HOOKS.PRE_RENDER_SHEET, this.document, forced, options) === false;\r\n if (this._state > Application.RENDER_STATES.NONE) {\r\n if (renderItemPileInterface) {\r\n wrapped(forced, options, ...args)\r\n } else {\r\n return wrapped(forced, options, ...args)\r\n }\r\n }\r\n if (renderItemPileInterface) return;\r\n return wrapped(forced, options, ...args);\r\n }, \"MIXED\");\r\n\r\n if (SYSTEMS.DATA.SHEET_OVERRIDES) {\r\n SYSTEMS.DATA.SHEET_OVERRIDES();\r\n }\r\n\r\n}\r\n","import * as Helpers from \"../helpers/helpers.js\";\r\nimport * as Utilities from \"../helpers/utilities.js\";\r\nimport * as PileUtilities from \"../helpers/pile-utilities.js\";\r\nimport * as SharingUtilities from \"../helpers/sharing-utilities.js\";\r\nimport CONSTANTS from \"../constants/constants.js\";\r\nimport SETTINGS from \"../constants/settings.js\";\r\nimport ItemPileSocket from \"../socket.js\";\r\nimport TradeAPI from \"./trade-api.js\";\r\nimport PrivateAPI from \"./private-api.js\";\r\nimport { SYSTEMS } from \"../systems.js\";\r\nimport { getMerchantModifiersForActor } from \"../helpers/pile-utilities.js\";\r\n\r\nclass API {\r\n /**\r\n * @class API\r\n */\r\n\r\n /**\r\n * The actor class type used for the original item pile actor in this system\r\n *\r\n * @returns {string}\r\n */\r\n static get ACTOR_CLASS_TYPE() {\r\n return Helpers.getSetting(SETTINGS.ACTOR_CLASS_TYPE);\r\n }\r\n\r\n /**\r\n * The currencies used in this system\r\n *\r\n * @returns {Array<{primary: boolean, name: string, data: Object, img: string, abbreviation: string, exchange: number}>}\r\n */\r\n static get CURRENCIES() {\r\n return Helpers.getSetting(SETTINGS.CURRENCIES);\r\n }\r\n\r\n /**\r\n * The secondary currencies used in this system\r\n *\r\n * @returns {Array<{name: string, data: Object, img: string, abbreviation: string}>}\r\n */\r\n static get SECONDARY_CURRENCIES() {\r\n return Helpers.getSetting(SETTINGS.SECONDARY_CURRENCIES);\r\n }\r\n\r\n /**\r\n * The smallest decimal digits shown for any fractional currency amounts. Only used when there is only one currency.\r\n *\r\n * @returns {Number}\r\n */\r\n static get CURRENCY_DECIMAL_DIGITS() {\r\n return Helpers.getSetting(SETTINGS.CURRENCY_DECIMAL_DIGITS);\r\n }\r\n\r\n /**\r\n * The attribute used to track the price of items in this system\r\n *\r\n * @returns {string}\r\n */\r\n static get ITEM_PRICE_ATTRIBUTE() {\r\n return Helpers.getSetting(SETTINGS.ITEM_PRICE_ATTRIBUTE);\r\n }\r\n\r\n /**\r\n * The attribute used to track the quantity of items you would get for the price of an item\r\n *\r\n * @returns {string}\r\n */\r\n static get QUANTITY_FOR_PRICE_ATTRIBUTE() {\r\n return Helpers.getSetting(SETTINGS.QUANTITY_FOR_PRICE_ATTRIBUTE);\r\n }\r\n\r\n /**\r\n * The attribute used to track the quantity of items in this system\r\n *\r\n * @returns {string}\r\n */\r\n static get ITEM_QUANTITY_ATTRIBUTE() {\r\n return Helpers.getSetting(SETTINGS.ITEM_QUANTITY_ATTRIBUTE);\r\n }\r\n\r\n /**\r\n * The filters for item types eligible for interaction within this system\r\n *\r\n * @returns {Array<{name: string, filters: string}>}\r\n */\r\n static get ITEM_FILTERS() {\r\n return Helpers.getSetting(SETTINGS.ITEM_FILTERS);\r\n }\r\n\r\n /**\r\n * The attributes for detecting item similarities\r\n *\r\n * @returns {Array<string>}\r\n */\r\n static get ITEM_SIMILARITIES() {\r\n return Helpers.getSetting(SETTINGS.ITEM_SIMILARITIES);\r\n }\r\n\r\n /**\r\n * The types of items that will always be considered unique when transferring between actors\r\n *\r\n * @returns {Array<string>}\r\n */\r\n static get UNSTACKABLE_ITEM_TYPES() {\r\n return Helpers.getSetting(SETTINGS.UNSTACKABLE_ITEM_TYPES);\r\n }\r\n\r\n /**\r\n * The system specific default values for item pile actors created in this system\r\n *\r\n * @returns {Object}\r\n */\r\n static get PILE_DEFAULTS() {\r\n return Helpers.getSetting(SETTINGS.PILE_DEFAULTS);\r\n }\r\n\r\n /**\r\n * The system specific default values for item pile tokens created in this system\r\n *\r\n * @returns {Object}\r\n */\r\n static get TOKEN_FLAG_DEFAULTS() {\r\n return Helpers.getSetting(SETTINGS.TOKEN_FLAG_DEFAULTS);\r\n }\r\n\r\n /**\r\n * Sets the actor class type used for the original item pile actor in this system\r\n *\r\n * @param {string} inClassType\r\n * @returns {Promise}\r\n */\r\n static async setActorClassType(inClassType) {\r\n if (typeof inClassType !== \"string\") {\r\n throw Helpers.custom_error(\"setActorTypeClass | inClassType must be of type string\");\r\n }\r\n return Helpers.setSetting(SETTINGS.ACTOR_CLASS_TYPE, inClassType);\r\n }\r\n\r\n /**\r\n * Sets the currencies used in this system\r\n *\r\n * @param {Array<Object>} inCurrencies\r\n * @returns {Promise}\r\n */\r\n static async setCurrencies(inCurrencies) {\r\n if (!Array.isArray(inCurrencies)) {\r\n throw Helpers.custom_error(\"setCurrencies | inCurrencies must be an array\");\r\n }\r\n inCurrencies.forEach(currency => {\r\n if (typeof currency !== \"object\") {\r\n throw Helpers.custom_error(\"setCurrencies | each entry in inCurrencies must be of type object\");\r\n }\r\n if (typeof currency.primary !== \"boolean\") {\r\n throw Helpers.custom_error(\"setCurrencies | currency.primary must be of type boolean\");\r\n }\r\n if (typeof currency.name !== \"string\") {\r\n throw Helpers.custom_error(\"setCurrencies | currency.name must be of type string\");\r\n }\r\n if (typeof currency.abbreviation !== \"string\") {\r\n throw Helpers.custom_error(\"setCurrencies | currency.abbreviation must be of type string\");\r\n }\r\n if (typeof currency.exchangeRate !== \"number\") {\r\n throw Helpers.custom_error(\"setCurrencies | currency.exchangeRate must be of type number\");\r\n }\r\n if (typeof currency.data !== \"object\") {\r\n throw Helpers.custom_error(\"setCurrencies | currency.data must be of type object\");\r\n }\r\n if (typeof currency.data.path !== \"string\" && typeof currency.data.uuid !== \"string\" && typeof currency.data.item !== \"object\") {\r\n throw Helpers.custom_error(\"setCurrencies | currency.data must contain either \\\"path\\\" (string), \\\"uuid\\\" (string), or \\\"item\\\" (object)\");\r\n }\r\n if (currency.img && typeof currency.img !== \"string\") {\r\n throw Helpers.custom_error(\"setCurrencies | currency.img must be of type string\");\r\n }\r\n });\r\n return Helpers.setSetting(SETTINGS.CURRENCIES, inCurrencies);\r\n }\r\n\r\n /**\r\n * Sets the secondary currencies used in this system\r\n *\r\n * @param {Array<Object>} inSecondaryCurrencies\r\n * @returns {Promise}\r\n */\r\n static async setSecondaryCurrencies(inSecondaryCurrencies) {\r\n if (!Array.isArray(inSecondaryCurrencies)) {\r\n throw Helpers.custom_error(\"setSecondaryCurrencies | inSecondaryCurrencies must be an array\");\r\n }\r\n inSecondaryCurrencies.forEach(currency => {\r\n if (typeof currency !== \"object\") {\r\n throw Helpers.custom_error(\"setSecondaryCurrencies | each entry in inSecondaryCurrencies must be of type object\");\r\n }\r\n if (typeof currency.name !== \"string\") {\r\n throw Helpers.custom_error(\"setSecondaryCurrencies | currency.name must be of type string\");\r\n }\r\n if (typeof currency.abbreviation !== \"string\") {\r\n throw Helpers.custom_error(\"setSecondaryCurrencies | currency.abbreviation must be of type string\");\r\n }\r\n if (typeof currency.data !== \"object\") {\r\n throw Helpers.custom_error(\"setSecondaryCurrencies | currency.data must be of type object\");\r\n }\r\n if (typeof currency.data.path !== \"string\" && typeof currency.data.uuid !== \"string\" && typeof currency.data.item !== \"object\") {\r\n throw Helpers.custom_error(\"setSecondaryCurrencies | currency.data must contain either \\\"path\\\" (string), \\\"uuid\\\" (string), or \\\"item\\\" (object)\");\r\n }\r\n if (currency.img && typeof currency.img !== \"string\") {\r\n throw Helpers.custom_error(\"setSecondaryCurrencies | currency.img must be of type string\");\r\n }\r\n });\r\n return Helpers.setSetting(SETTINGS.SECONDARY_CURRENCIES, inSecondaryCurrencies);\r\n }\r\n\r\n /**\r\n * Set the smallest decimal digits shown for any fractional currency amounts. Only used when there is only one currency.\r\n *\r\n * @param {Number} inDecimalDigits\r\n * @returns {Promise}\r\n */\r\n static setCurrencyDecimalDigits(inDecimalDigits) {\r\n if (typeof inDecimalDigits !== \"number\") {\r\n throw Helpers.custom_error(\"setCurrencyDecimalDigits | inDecimalDigits must be of type string\");\r\n }\r\n return Helpers.setSetting(SETTINGS.CURRENCY_DECIMAL_DIGITS, inDecimalDigits);\r\n }\r\n\r\n /**\r\n * Sets the attribute used to track the quantity of items in this system\r\n *\r\n * @param {string} inAttribute\r\n * @returns {Promise}\r\n */\r\n static async setItemQuantityAttribute(inAttribute) {\r\n if (typeof inAttribute !== \"string\") {\r\n throw Helpers.custom_error(\"setItemQuantityAttribute | inAttribute must be of type string\");\r\n }\r\n return Helpers.setSetting(SETTINGS.ITEM_QUANTITY_ATTRIBUTE, inAttribute);\r\n }\r\n\r\n /**\r\n * Sets the attribute used to track the price of items in this system\r\n *\r\n * @param {string} inAttribute\r\n * @returns {Promise}\r\n */\r\n static async setItemPriceAttribute(inAttribute) {\r\n if (typeof inAttribute !== \"string\") {\r\n throw Helpers.custom_error(\"setItemPriceAttribute | inAttribute must be of type string\");\r\n }\r\n return Helpers.setSetting(SETTINGS.ITEM_PRICE_ATTRIBUTE, inAttribute);\r\n }\r\n\r\n /**\r\n * Sets the attribute used to track the price of items in this system\r\n *\r\n * @param {string} inAttribute\r\n * @returns {Promise}\r\n */\r\n static async setQuantityForPriceAttribute(inAttribute) {\r\n if (typeof inAttribute !== \"string\") {\r\n throw Helpers.custom_error(\"setQuantityForPriceAttribute | inAttribute must be of type string\");\r\n }\r\n return Helpers.setSetting(SETTINGS.QUANTITY_FOR_PRICE_ATTRIBUTE, inAttribute);\r\n }\r\n\r\n /**\r\n * Sets the items filters for interaction within this system\r\n *\r\n * @param {Array<{path: string, filters: string}>} inFilters\r\n * @returns {Promise}\r\n */\r\n static async setItemFilters(inFilters) {\r\n if (!Array.isArray(inFilters)) {\r\n throw Helpers.custom_error(\"setItemFilters | inFilters must be of type array\");\r\n }\r\n inFilters.forEach(filter => {\r\n if (typeof filter?.path !== \"string\") {\r\n throw Helpers.custom_error(\"setItemFilters | each entry in inFilters must have a \\\"path\\\" property with a value that is of type string\");\r\n }\r\n if (typeof filter?.filters !== \"string\") {\r\n throw Helpers.custom_error(\"setItemFilters | each entry in inFilters must have a \\\"filters\\\" property with a value that is of type string\");\r\n }\r\n });\r\n return Helpers.setSetting(SETTINGS.ITEM_FILTERS, inFilters);\r\n }\r\n\r\n /**\r\n * Sets the attributes for detecting item similarities\r\n *\r\n * @param {Array<string>} inPaths\r\n * @returns {Promise}\r\n */\r\n static async setItemSimilarities(inPaths) {\r\n if (!Array.isArray(inPaths)) {\r\n throw Helpers.custom_error(\"setItemSimilarities | inPaths must be of type array\");\r\n }\r\n inPaths.forEach(path => {\r\n if (typeof path !== \"string\") {\r\n throw Helpers.custom_error(\"setItemSimilarities | each entry in inPaths must be of type string\");\r\n }\r\n });\r\n return Helpers.setSetting(SETTINGS.ITEM_SIMILARITIES, inPaths);\r\n }\r\n\r\n /**\r\n * Sets the types of items that will always be considered unique when transferring between actors\r\n *\r\n * @param {Array<string>} inTypes\r\n * @returns {Promise}\r\n */\r\n static async setUnstackableItemTypes(inTypes) {\r\n if (!Array.isArray(inTypes)) {\r\n throw Helpers.custom_error(\"setUnstackableItemTypes | inTypes must be of type array\");\r\n }\r\n inTypes.forEach(path => {\r\n if (typeof path !== \"string\") {\r\n throw Helpers.custom_error(\"setUnstackableItemTypes | each entry in inTypes must be of type string\");\r\n }\r\n });\r\n return Helpers.setSetting(SETTINGS.UNSTACKABLE_ITEM_TYPES, inTypes);\r\n }\r\n\r\n /**\r\n * Sets the types of items that will always be considered unique when transferring between actors\r\n *\r\n * @param {Object} inDefaults\r\n * @returns {Promise}\r\n */\r\n static async setPileDefaults(inDefaults) {\r\n if (typeof inDefaults !== \"object\") {\r\n throw Helpers.custom_error(\"setPileDefaults | inDefaults must be of type object\");\r\n }\r\n const validKeys = new Set(Object.keys(CONSTANTS.PILE_DEFAULTS));\r\n for (const key of Object.keys(inDefaults)) {\r\n if (!validKeys.has(key)) {\r\n throw Helpers.custom_error(`setPileDefaults | ${key} is not a valid pile setting`);\r\n }\r\n }\r\n return Helpers.setSetting(SETTINGS.PILE_DEFAULTS, inDefaults);\r\n }\r\n\r\n /**\r\n * Set the flags that will be applied to any tokens created through item piles\r\n *\r\n * @param {Object} inDefaults\r\n * @returns {Promise}\r\n */\r\n static async setTokenFlagDefaults(inDefaults) {\r\n if (typeof inDefaults !== \"object\") {\r\n throw Helpers.custom_error(\"setTokenFlagDefaults | inDefaults must be of type object\");\r\n }\r\n return Helpers.setSetting(SETTINGS.TOKEN_FLAG_DEFAULTS, inDefaults);\r\n }\r\n\r\n /**\r\n * A combination of all the methods above, but this integrates a system's specific\r\n * settings more readily into item piles, allowing users to also change the settings\r\n * afterwards.\r\n *\r\n * @param {Object<{\r\n * VERSION: string,\r\n * ACTOR_CLASS_TYPE: string,\r\n * ITEM_QUANTITY_ATTRIBUTE: string,\r\n * ITEM_PRICE_ATTRIBUTE: string,\r\n * QUANTITY_FOR_PRICE_ATTRIBUTE: string,\r\n * ITEM_FILTERS: Array<{path: string, filters: string}>,\r\n * ITEM_SIMILARITIES: Array<string>,\r\n * UNSTACKABLE_ITEM_TYPES: Array<string>,\r\n * PILE_DEFAULTS: Object,\r\n * TOKEN_FLAG_DEFAULTS: Object,\r\n * ITEM_TRANSFORMER: undefined/Function,\r\n * SHEET_OVERRIDES: undefined/Function,\r\n * CURRENCIES: Array<{\r\n * primary: boolean,\r\n * type: string [\"attribute\"/\"item\"],\r\n * img: string,\r\n * abbreviation: string,\r\n * data: Object<{ path: string }|{ uuid: string }|{ item: object }>,\r\n * exchangeRate: number\r\n * }>,\r\n * SECONDARY_CURRENCIES: Array<{\r\n * type: string [\"attribute\"/\"item\"],\r\n * img: string,\r\n * abbreviation: string,\r\n * data: Object<{ path: string }|{ uuid: string }|{ item: object }>\r\n * }>,\r\n * CURRENCY_DECIMAL_DIGITS: undefined/number\r\n * }>} inData\r\n */\r\n static addSystemIntegration(inData) {\r\n\r\n const data = foundry.utils.mergeObject({\r\n VERSION: \"\",\r\n ACTOR_CLASS_TYPE: \"\",\r\n ITEM_QUANTITY_ATTRIBUTE: \"\",\r\n ITEM_PRICE_ATTRIBUTE: \"\",\r\n QUANTITY_FOR_PRICE_ATTRIBUTE: \"flags.item-piles.system.quantityForPrice\",\r\n ITEM_FILTERS: [],\r\n ITEM_SIMILARITIES: [],\r\n UNSTACKABLE_ITEM_TYPES: [],\r\n PILE_DEFAULTS: {},\r\n TOKEN_FLAG_DEFAULTS: {},\r\n ITEM_TRANSFORMER: null,\r\n SHEET_OVERRIDES: null,\r\n CURRENCIES: [],\r\n SECONDARY_CURRENCIES: [],\r\n CURRENCY_DECIMAL_DIGITS: 0.00001\r\n }, inData)\r\n\r\n if (typeof data[\"VERSION\"] !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.VERSION must be of type string\");\r\n }\r\n\r\n if (typeof data[\"ACTOR_CLASS_TYPE\"] !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.ACTOR_CLASS_TYPE must be of type string\");\r\n }\r\n\r\n if (typeof data[\"ITEM_QUANTITY_ATTRIBUTE\"] !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.ITEM_QUANTITY_ATTRIBUTE must be of type string\");\r\n }\r\n\r\n if (typeof data[\"ITEM_PRICE_ATTRIBUTE\"] !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.ITEM_PRICE_ATTRIBUTE must be of type string\");\r\n }\r\n\r\n if (data[\"QUANTITY_FOR_PRICE_ATTRIBUTE\"] && typeof data[\"QUANTITY_FOR_PRICE_ATTRIBUTE\"] !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.QUANTITY_FOR_PRICE_ATTRIBUTE must be of type string\");\r\n }\r\n\r\n if (!Array.isArray(data[\"ITEM_FILTERS\"])) {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.ITEM_FILTERS must be of type array\");\r\n }\r\n\r\n data[\"ITEM_FILTERS\"].forEach(filter => {\r\n if (typeof filter?.path !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | each entry in data.ITEM_FILTERS must have a \\\"path\\\" property with a value that is of type string\");\r\n }\r\n if (typeof filter?.filters !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | each entry in data.ITEM_FILTERS must have a \\\"filters\\\" property with a value that is of type string\");\r\n }\r\n });\r\n\r\n if (data['ITEM_TRANSFORMER']) {\r\n if (!Helpers.isFunction(data['ITEM_TRANSFORMER'])) {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.ITEM_TRANSFORMER must be of type function\");\r\n }\r\n if (typeof data['ITEM_TRANSFORMER']({}) !== \"object\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.ITEM_TRANSFORMER's return value must be of type object\");\r\n }\r\n }\r\n\r\n if (data['SHEET_OVERRIDES']) {\r\n if (!Helpers.isFunction(data['SHEET_OVERRIDES'])) {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.SHEET_OVERRIDES must be of type function\");\r\n }\r\n }\r\n\r\n if (typeof data['PILE_DEFAULTS'] !== \"object\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.PILE_DEFAULTS must be of type object\");\r\n }\r\n const validKeys = new Set(Object.keys(CONSTANTS.PILE_DEFAULTS));\r\n for (const key of Object.keys(data['PILE_DEFAULTS'])) {\r\n if (!validKeys.has(key)) {\r\n throw Helpers.custom_error(`addSystemIntegration | data.PILE_DEFAULTS contains illegal key \"${key}\" that is not a valid pile default`);\r\n }\r\n }\r\n\r\n if (typeof data['TOKEN_FLAG_DEFAULTS'] !== \"object\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.TOKEN_FLAG_DEFAULTS must be of type object\");\r\n }\r\n\r\n if (!Array.isArray(data['ITEM_SIMILARITIES'])) {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.ITEM_SIMILARITIES must be of type array\");\r\n }\r\n data['ITEM_SIMILARITIES'].forEach(path => {\r\n if (typeof path !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | each entry in data.ITEM_SIMILARITIES must be of type string\");\r\n }\r\n });\r\n\r\n if (data['UNSTACKABLE_ITEM_TYPES']) {\r\n if (!Array.isArray(data['UNSTACKABLE_ITEM_TYPES'])) {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.UNSTACKABLE_ITEM_TYPES must be of type array\");\r\n }\r\n data['UNSTACKABLE_ITEM_TYPES'].forEach(path => {\r\n if (typeof path !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | each entry in data.UNSTACKABLE_ITEM_TYPES must be of type string\");\r\n }\r\n });\r\n }\r\n\r\n if (!Array.isArray(data['CURRENCIES'])) {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.CURRENCIES must be an array\");\r\n }\r\n data['CURRENCIES'].forEach(currency => {\r\n if (typeof currency !== \"object\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | CURRENCIES | each entry in data.CURRENCIES must be of type object\");\r\n }\r\n if (typeof currency.primary !== \"boolean\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | CURRENCIES | currency.primary must be of type boolean\");\r\n }\r\n if (typeof currency.name !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | CURRENCIES | currency.name must be of type string\");\r\n }\r\n if (typeof currency.abbreviation !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | CURRENCIES | currency.abbreviation must be of type string\");\r\n }\r\n if (typeof currency.exchangeRate !== \"number\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | CURRENCIES | currency.exchangeRate must be of type number\");\r\n }\r\n if (typeof currency.data !== \"object\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | CURRENCIES | currency.data must be of type object\");\r\n }\r\n if (typeof currency.data.path !== \"string\" && typeof currency.data.uuid !== \"string\" && typeof currency.data.item !== \"object\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | CURRENCIES | currency.data must contain either \\\"path\\\" (string), \\\"uuid\\\" (string), or \\\"item\\\" (object)\");\r\n }\r\n if (currency.img && typeof currency.img !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | CURRENCIES | currency.img must be of type string\");\r\n }\r\n });\r\n\r\n if (!Array.isArray(data['SECONDARY_CURRENCIES'])) {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.SECONDARY_CURRENCIES must be an array\");\r\n }\r\n data['SECONDARY_CURRENCIES'].forEach(currency => {\r\n if (typeof currency !== \"object\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | SECONDARY_CURRENCIES | each entry in data.SECONDARY_CURRENCIES must be of type object\");\r\n }\r\n if (typeof currency.name !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | SECONDARY_CURRENCIES | currency.name must be of type string\");\r\n }\r\n if (typeof currency.abbreviation !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | SECONDARY_CURRENCIES | currency.abbreviation must be of type string\");\r\n }\r\n if (typeof currency.data !== \"object\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | SECONDARY_CURRENCIES | currency.data must be of type object\");\r\n }\r\n if (typeof currency.data.path !== \"string\" && typeof currency.data.uuid !== \"string\" && typeof currency.data.item !== \"object\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | SECONDARY_CURRENCIES | currency.data must contain either \\\"path\\\" (string), \\\"uuid\\\" (string), or \\\"item\\\" (object)\");\r\n }\r\n if (currency.img && typeof currency.img !== \"string\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | SECONDARY_CURRENCIES | currency.img must be of type string\");\r\n }\r\n });\r\n\r\n if (data[\"CURRENCY_DECIMAL_DIGITS\"] && typeof data['CURRENCY_DECIMAL_DIGITS'] !== \"number\") {\r\n throw Helpers.custom_error(\"addSystemIntegration | data.CURRENCY_DECIMAL_DIGITS must be of type number\");\r\n }\r\n\r\n data['INTEGRATION'] = true;\r\n\r\n SYSTEMS.addSystem(data);\r\n\r\n Helpers.debug(`Registered system settings for ${game.system.id}`, data)\r\n\r\n }\r\n\r\n static async getPrimaryCurrency(actor = false) {\r\n if (actor && actor instanceof Actor) {\r\n return PileUtilities.getActorPrimaryCurrency(actor);\r\n }\r\n return this.CURRENCIES.find(currency => currency.primary);\r\n }\r\n\r\n /* ================= ITEM PILE METHODS ================= */\r\n\r\n /**\r\n * Creates an item pile token at a location, or an item pile actor, or both at the same time.\r\n *\r\n * @param {object} options Options to pass to the function\r\n * @param {object/boolean} [options.position=false] Where to create the item pile, with x and y coordinates\r\n * @param {string/boolean} [options.sceneId=game.user.viewedScene] Which scene to create the item pile on\r\n * @param {object} [options.tokenOverrides={}] Token data to apply to the newly created token\r\n * @param {object} [options.actorOverrides={}] Actor data to apply to the newly created actor (if unlinked)\r\n * @param {object} [options.itemPileFlags={}] Item pile specific flags to apply to the token and actor\r\n * @param {Array/boolean} [options.items=false] Any items to create on the item pile\r\n * @param {boolean} [options.createActor=false] Whether to create a new item pile actor\r\n * @param {string/boolean} [options.actor=false] The UUID, ID, or name of the actor to use when creating this item pile\r\n * @param {Array<string>/>string/boolean} [options.folders=false] The folder to create the actor in, this can be an array of folder names, which will be traversed and created\r\n *\r\n * @returns {Promise<string>}\r\n */\r\n static async createItemPile({\r\n position = false,\r\n sceneId = game.user.viewedScene,\r\n tokenOverrides = {},\r\n actorOverrides = {},\r\n itemPileFlags = {},\r\n items = false,\r\n createActor = false,\r\n actor = false,\r\n folders = false\r\n } = {}) {\r\n\r\n if (position) {\r\n if (typeof position !== \"object\") {\r\n throw Helpers.custom_error(`createItemPile | position must be of type object`);\r\n } else if (!Helpers.isRealNumber(position.x) || !Helpers.isRealNumber(position.y)) {\r\n throw Helpers.custom_error(`createItemPile | position.x and position.y must be of type numbers`);\r\n }\r\n }\r\n\r\n if (folders) {\r\n if (!Array.isArray(folders)) {\r\n folders = [folders];\r\n }\r\n folders.forEach(f => {\r\n if (typeof f !== 'string') {\r\n throw Helpers.custom_error(`createItemPile | folder must be of type string or array of strings`);\r\n }\r\n });\r\n }\r\n\r\n if (actor && !createActor) {\r\n if (typeof actor !== \"string\") {\r\n throw Helpers.custom_error(`createItemPile | actor must be of type string`);\r\n }\r\n let pileActor = await fromUuid(actor);\r\n if (!pileActor) {\r\n pileActor = game.actors.getName(actor);\r\n }\r\n if (!pileActor) {\r\n pileActor = game.actors.get(actor);\r\n }\r\n if (!pileActor) {\r\n throw Helpers.custom_error(`createItemPile | Could not find actor with the identifier of \"${actor}\"`);\r\n }\r\n actor = pileActor.uuid;\r\n }\r\n\r\n if (typeof sceneId !== \"string\") {\r\n throw Helpers.custom_error(`createItemPile | sceneId must be of type string`);\r\n }\r\n\r\n if (typeof tokenOverrides !== \"object\") {\r\n throw Helpers.custom_error(`createItemPile | tokenOverrides must be of type object`);\r\n }\r\n\r\n if (typeof actorOverrides !== \"object\") {\r\n throw Helpers.custom_error(`createItemPile | tokenOverrides must be of type object`);\r\n }\r\n\r\n if (typeof itemPileFlags !== \"object\") {\r\n throw Helpers.custom_error(`createItemPile | tokenOverrides must be of type object`);\r\n }\r\n\r\n if (items) {\r\n if (!Array.isArray(items)) items = [items]\r\n items = items.map(item => {\r\n return item instanceof Item ? item.toObject() : item;\r\n })\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.CREATE_PILE, {\r\n sceneId, position, actor, createActor, items, tokenOverrides, actorOverrides, itemPileFlags, folders\r\n });\r\n }\r\n\r\n /**\r\n * Turns tokens and its actors into item piles\r\n *\r\n * @param {Token/TokenDocument/Array<Token/TokenDocument>} targets The targets to be turned into item piles\r\n * @param {object} options Options to pass to the function\r\n * @param {object} options.pileSettings Overriding settings to be put on the item piles' settings\r\n * @param {object/Function} options.tokenSettings Overriding settings that will update the tokens' settings\r\n *\r\n * @return {Promise<Array>} The uuids of the targets after they were turned into item piles\r\n */\r\n static turnTokensIntoItemPiles(targets, { pileSettings = {}, tokenSettings = {} } = {}) {\r\n\r\n if (!Array.isArray(targets)) targets = [targets];\r\n\r\n const targetUuids = targets.map(target => {\r\n if (!(target instanceof Token || target instanceof TokenDocument)) {\r\n throw Helpers.custom_error(`turnTokensIntoItemPiles | Target must be of type Token or TokenDocument`)\r\n }\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`turnTokensIntoItemPiles | Could not determine the UUID, please provide a valid target`)\r\n return targetUuid;\r\n })\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.TURN_INTO_PILE, targetUuids, pileSettings, tokenSettings);\r\n }\r\n\r\n /**\r\n * Reverts tokens from an item pile into a normal token and actor\r\n *\r\n * @param {Token/TokenDocument/Array<Token/TokenDocument>} targets The targets to be reverted from item piles\r\n * @param {object} options Options to pass to the function\r\n * @param {object/Function} options.tokenSettings Overriding settings that will update the tokens\r\n *\r\n * @return {Promise<Array>} The uuids of the targets after they were reverted from being item piles\r\n */\r\n static revertTokensFromItemPiles(targets, { tokenSettings = {} } = {}) {\r\n\r\n if (!Array.isArray(targets)) targets = [targets];\r\n\r\n const targetUuids = targets.map(target => {\r\n if (!(target instanceof Token || target instanceof TokenDocument)) {\r\n throw Helpers.custom_error(`revertTokensFromItemPiles | Target must be of type Token or TokenDocument`)\r\n }\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`revertTokensFromItemPiles | Could not determine the UUID, please provide a valid target`)\r\n return targetUuid;\r\n })\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.REVERT_FROM_PILE, targetUuids, tokenSettings);\r\n }\r\n\r\n /**\r\n * Opens a pile if it is enabled and a container\r\n *\r\n * @param {Token/TokenDocument} target\r\n * @param {Token/TokenDocument/boolean} [interactingToken=false]\r\n *\r\n * @return {Promise/boolean}\r\n */\r\n static openItemPile(target, interactingToken = false) {\r\n const targetActor = Utilities.getActor(target);\r\n if (!PileUtilities.isItemPileContainer(target)) return false;\r\n const interactingTokenDocument = interactingToken ? Utilities.getActor(interactingToken) : false;\r\n const pileData = PileUtilities.getActorFlagData(targetActor);\r\n const wasLocked = pileData.locked;\r\n const wasClosed = pileData.closed;\r\n pileData.closed = false;\r\n pileData.locked = false;\r\n if (wasLocked) {\r\n const hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_UNLOCK, targetActor, pileData, interactingTokenDocument);\r\n if (hookResult === false) return false;\r\n }\r\n const hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_OPEN, targetActor, pileData, interactingTokenDocument);\r\n if (hookResult === false) return false;\r\n if (wasClosed && pileData.openSound) {\r\n let sound = pileData.openSound;\r\n if (pileData.openSound.includes(\"*\")) {\r\n sound = Helpers.random_array_element(pileData.openSounds)\r\n }\r\n AudioHelper.play({ src: sound }, true)\r\n }\r\n return this.updateItemPile(targetActor, pileData, { interactingToken: interactingTokenDocument });\r\n }\r\n\r\n /**\r\n * Closes a pile if it is enabled and a container\r\n *\r\n * @param {Token/TokenDocument} target Target pile to close\r\n * @param {Token/TokenDocument/boolean} [interactingToken=false]\r\n *\r\n * @return {Promise/boolean}\r\n */\r\n static closeItemPile(target, interactingToken = false) {\r\n const targetActor = Utilities.getActor(target);\r\n if (!PileUtilities.isItemPileContainer(target)) return false;\r\n const interactingTokenDocument = interactingToken ? Utilities.getActor(interactingToken) : false;\r\n const pileData = PileUtilities.getActorFlagData(targetActor);\r\n\r\n const wasOpen = !pileData.closed;\r\n pileData.closed = true;\r\n\r\n const hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_CLOSE, targetActor, pileData, interactingTokenDocument);\r\n if (hookResult === false) return false;\r\n\r\n if (wasOpen && pileData.closeSound) {\r\n let sound = pileData.closeSound;\r\n if (pileData.closeSound.includes(\"*\")) {\r\n sound = Helpers.random_array_element(pileData.closeSounds)\r\n }\r\n AudioHelper.play({ src: sound }, true)\r\n }\r\n\r\n return this.updateItemPile(targetActor, pileData, { interactingToken: interactingTokenDocument });\r\n }\r\n\r\n /**\r\n * Toggles a pile's closed state if it is enabled and a container\r\n *\r\n * @param {Token/TokenDocument} target Target pile to open or close\r\n * @param {Token/TokenDocument/boolean} [interactingToken=false]\r\n *\r\n * @return {Promise/boolean}\r\n */\r\n static async toggleItemPileClosed(target, interactingToken = false) {\r\n const targetActor = Utilities.getActor(target);\r\n if (!PileUtilities.isItemPileContainer(target)) return false;\r\n const interactingTokenDocument = interactingToken ? Utilities.getActor(interactingToken) : false;\r\n const pileData = PileUtilities.getActorFlagData(targetActor);\r\n if (pileData.closed) {\r\n await this.openItemPile(targetActor, interactingTokenDocument);\r\n } else {\r\n await this.closeItemPile(targetActor, interactingTokenDocument);\r\n }\r\n return !pileData.closed;\r\n }\r\n\r\n /**\r\n * Locks a pile if it is enabled and a container\r\n *\r\n * @param {Token/TokenDocument} target Target pile to lock\r\n * @param {Token/TokenDocument/boolean} [interactingToken=false]\r\n *\r\n * @return {Promise/boolean}\r\n */\r\n static lockItemPile(target, interactingToken = false) {\r\n const targetActor = Utilities.getActor(target);\r\n if (!PileUtilities.isItemPileContainer(target)) return false;\r\n const interactingTokenDocument = interactingToken ? Utilities.getActor(interactingToken) : false;\r\n const pileData = PileUtilities.getActorFlagData(targetActor);\r\n const wasClosed = pileData.closed;\r\n pileData.closed = true;\r\n pileData.locked = true;\r\n if (!wasClosed) {\r\n const hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_CLOSE, targetActor, pileData, interactingTokenDocument);\r\n if (hookResult === false) return false;\r\n }\r\n const hookResult = Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_LOCK, targetActor, pileData, interactingTokenDocument);\r\n if (hookResult === false) return false;\r\n if (!wasClosed && pileData.closeSound) {\r\n let sound = pileData.closeSound;\r\n if (pileData.closeSound.includes(\"*\")) {\r\n sound = Helpers.random_array_element(pileData.closeSounds)\r\n }\r\n AudioHelper.play({ src: sound }, true)\r\n }\r\n return this.updateItemPile(targetActor, pileData, { interactingToken: interactingTokenDocument });\r\n }\r\n\r\n /**\r\n * Unlocks a pile if it is enabled and a container\r\n *\r\n * @param {Token/TokenDocument} target Target pile to unlock\r\n * @param {Token/TokenDocument/boolean} [interactingToken=false]\r\n *\r\n * @return {Promise/boolean}\r\n */\r\n static unlockItemPile(target, interactingToken = false) {\r\n const targetActor = Utilities.getActor(target);\r\n if (!PileUtilities.isItemPileContainer(target)) return false;\r\n const interactingTokenDocument = interactingToken ? Utilities.getActor(interactingToken) : false;\r\n const pileData = PileUtilities.getActorFlagData(targetActor);\r\n pileData.locked = false;\r\n Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_UNLOCK, targetActor, pileData, interactingTokenDocument);\r\n return this.updateItemPile(targetActor, pileData, { interactingToken: interactingTokenDocument });\r\n }\r\n\r\n /**\r\n * Toggles a pile's locked state if it is enabled and a container\r\n *\r\n * @param {Token/TokenDocument} target Target pile to lock or unlock\r\n * @param {Token/TokenDocument/boolean} [interactingToken=false]\r\n *\r\n * @return {Promise/boolean}\r\n */\r\n static toggleItemPileLocked(target, interactingToken = false) {\r\n const targetActor = Utilities.getActor(target);\r\n if (!PileUtilities.isItemPileContainer(target)) return false;\r\n const interactingTokenDocument = interactingToken ? Utilities.getActor(interactingToken) : false;\r\n const pileData = PileUtilities.getActorFlagData(targetActor);\r\n if (pileData.locked) {\r\n return this.unlockItemPile(targetActor, interactingTokenDocument);\r\n }\r\n return this.lockItemPile(targetActor, interactingTokenDocument);\r\n }\r\n\r\n /**\r\n * Causes the item pile to play a sound as it was attempted to be opened, but was locked\r\n *\r\n * @param {Token/TokenDocument} target\r\n * @param {Token/TokenDocument/boolean} [interactingToken=false]\r\n *\r\n * @return {Promise<boolean>}\r\n */\r\n static rattleItemPile(target, interactingToken = false) {\r\n const targetActor = Utilities.getActor(target);\r\n if (!PileUtilities.isItemPileContainer(target)) return false;\r\n const interactingTokenDocument = interactingToken ? Utilities.getActor(interactingToken) : false;\r\n const pileData = PileUtilities.getActorFlagData(targetActor);\r\n\r\n Helpers.hooks.call(CONSTANTS.HOOKS.PILE.PRE_RATTLE, targetActor, pileData, interactingTokenDocument);\r\n\r\n if (pileData.lockedSound) {\r\n let sound = pileData.lockedSound;\r\n if (pileData.lockedSound.includes(\"*\")) {\r\n sound = Helpers.random_array_element(pileData.lockedSounds)\r\n }\r\n AudioHelper.play({ src: sound }, true);\r\n }\r\n\r\n return ItemPileSocket.executeForEveryone(ItemPileSocket.HANDLERS.CALL_HOOK, CONSTANTS.HOOKS.PILE.RATTLE, Utilities.getUuid(targetActor), pileData, Utilities.getUuid(interactingTokenDocument));\r\n }\r\n\r\n /**\r\n * Whether an item pile is locked. If it is not enabled or not a container, it is always false.\r\n *\r\n * @param {Token/TokenDocument} target\r\n *\r\n * @return {boolean}\r\n */\r\n static isItemPileLocked(target) {\r\n return PileUtilities.isItemPileLocked(target);\r\n }\r\n\r\n /**\r\n * Whether an item pile is closed. If it is not enabled or not a container, it is always false.\r\n *\r\n * @param {Token/TokenDocument} target\r\n *\r\n * @return {boolean}\r\n */\r\n static isItemPileClosed(target) {\r\n return PileUtilities.isItemPileClosed(target);\r\n }\r\n\r\n /**\r\n * Whether an item pile is a container. If it is not enabled, it is always false.\r\n *\r\n * @param {Token/TokenDocument} target\r\n *\r\n * @return {boolean}\r\n */\r\n static isItemPileContainer(target) {\r\n return PileUtilities.isItemPileContainer(target);\r\n }\r\n\r\n /**\r\n * Updates a pile with new data.\r\n *\r\n * @param {Actor/TokenDocument} target Target token or actor to update\r\n * @param {object} newData New data to update the actor with\r\n * @param {object} options Options to pass to the function\r\n * @param {Token/TokenDocument/boolean} [options.interactingToken=false] If an actor caused this update, you can pass one here to pass it along to macros that the item pile may run\r\n * @param {Object/boolean} [options.tokenSettings=false] Updates to make to the target token\r\n *\r\n * @return {Promise}\r\n */\r\n static updateItemPile(target, newData, { interactingToken = false, tokenSettings = false } = {}) {\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`updateItemPile | Could not determine the UUID, please provide a valid target`);\r\n\r\n const interactingTokenUuid = interactingToken ? Utilities.getUuid(interactingToken) : false;\r\n if (interactingToken && !interactingTokenUuid) throw Helpers.custom_error(`updateItemPile | Could not determine the UUID, please provide a valid target`);\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.UPDATE_PILE, targetUuid, newData, {\r\n interactingTokenUuid, tokenSettings\r\n });\r\n }\r\n\r\n /**\r\n * Deletes a pile, calling the relevant hooks.\r\n *\r\n * @param {Token/TokenDocument} target\r\n *\r\n * @return {Promise}\r\n */\r\n static deleteItemPile(target) {\r\n if (!PileUtilities.isValidItemPile(target)) {\r\n throw Helpers.custom_error(`deleteItemPile | This is not an item pile, please provide a valid target`);\r\n }\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`deleteItemPile | Could not determine the UUID, please provide a valid target`);\r\n if (!targetUuid.includes(\"Token\")) {\r\n throw Helpers.custom_error(`deleteItemPile | Please provide a Token or TokenDocument`);\r\n }\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.DELETE_PILE, targetUuid);\r\n }\r\n\r\n /**\r\n * Splits an item pile's content between all players (or a specified set of target actors).\r\n *\r\n * @param target {Token/TokenDocument/Actor} The item pile to split\r\n * @param {object} options Options to pass to the function\r\n * @param {boolean/TokenDocument/Actor/Array<TokenDocument/Actor>} [options.targets=false] The targets to receive the split contents\r\n * @param {boolean/TokenDocument/Actor} [options.instigator=false] Whether this was triggered by a specific actor\r\n *\r\n * @returns {Promise<object/boolean>}\r\n */\r\n static async splitItemPileContents(target, { targets = false, instigator = false } = {}) {\r\n\r\n if (!PileUtilities.isItemPileLootable(target)) return false;\r\n\r\n const itemPileUuid = Utilities.getUuid(target);\r\n if (!itemPileUuid) throw Helpers.custom_error(`SplitItemPileContents | Could not determine the UUID, please provide a valid item pile`)\r\n\r\n const itemPileActor = Utilities.getActor(target);\r\n\r\n if (targets) {\r\n if (!Array.isArray(targets)) {\r\n targets = [targets]\r\n }\r\n targets.forEach(actor => {\r\n if (!(actor instanceof TokenDocument || actor instanceof Actor)) {\r\n throw Helpers.custom_error(\"SplitItemPileContents | Each of the entries in targets must be of type TokenDocument or Actor\")\r\n }\r\n })\r\n targets = targets.map(target => Utilities.getActor(target));\r\n }\r\n\r\n if (instigator && !(instigator instanceof TokenDocument || instigator instanceof Actor)) {\r\n throw Helpers.custom_error(\"SplitItemPileContents | instigator must be of type TokenDocument or Actor\")\r\n }\r\n\r\n const actorUuids = (targets || SharingUtilities.getPlayersForItemPile(itemPileActor)\r\n .map(u => u.character))\r\n .map(actor => Utilities.getUuid(actor));\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.SPLIT_PILE, itemPileUuid, actorUuids, game.user.id, instigator);\r\n\r\n }\r\n\r\n /**\r\n * Retrieves the price modifiers for a given item piles merchant\r\n *\r\n * @param {Actor/TokenDocument} target Target token or actor to retrieve the modifiers from\r\n * @param {object} options Options to pass to the function\r\n * @param {Token/TokenDocument/Actor/string/boolean} [options.actor=false] The actor whose price modifiers to consider\r\n * @param {boolean} [options.absolute=false] Whether to only consider the actor's modifiers (true means not considering the merchant's base modifiers)\r\n *\r\n * @return {Object}\r\n */\r\n static getMerchantPriceModifiers(target, { actor = false, absolute = false } = {}) {\r\n\r\n const merchantActor = Utilities.getActor(target);\r\n\r\n if (!(merchantActor instanceof Actor)) {\r\n throw Helpers.custom_error(`getMerchantPriceModifiers | target must be of type Actor`);\r\n }\r\n\r\n if (!PileUtilities.isItemPileMerchant(merchantActor)) {\r\n throw Helpers.custom_error(`getMerchantPriceModifiers | target is not an item pile merchant`);\r\n }\r\n\r\n if (actor) {\r\n if (!(actor instanceof Actor) && typeof actor !== \"string\") {\r\n throw Helpers.custom_error(`getMerchantPriceModifiers | actor must be of type Actor or string (UUID)`);\r\n }\r\n if (typeof actor === \"string\") {\r\n actor = fromUuidSync(actor) || false;\r\n }\r\n }\r\n\r\n if (typeof absolute !== \"boolean\") {\r\n throw Helpers.custom_error(`getMerchantPriceModifiers | absolute must be of type boolean`);\r\n }\r\n\r\n return PileUtilities.getMerchantModifiersForActor(target, { actor, absolute });\r\n\r\n }\r\n\r\n /**\r\n * Updates the price modifiers for a given item piles merchant\r\n *\r\n * @param {Actor/TokenDocument} target Target token or actor to update modifiers on\r\n * @param {Array<{\r\n * actor?: Actor,\r\n * actorUuid?: string,\r\n * relative?: boolean,\r\n * override?: boolean,\r\n * buyPriceModifier?: number,\r\n * sellPriceModifier?: number\r\n * }>} priceModifierData The price modifier data to update on the merchant\r\n *\r\n * @return {Promise}\r\n */\r\n static updateMerchantPriceModifiers(target, priceModifierData = []) {\r\n\r\n const merchantActor = Utilities.getActor(target);\r\n\r\n const targetUuid = Utilities.getUuid(merchantActor);\r\n if (!targetUuid) throw Helpers.custom_error(`updateMerchantPriceModifiers | Could not determine the UUID, please provide a valid target`);\r\n\r\n if (!PileUtilities.isItemPileMerchant(merchantActor)) {\r\n throw Helpers.custom_error(`updateMerchantPriceModifiers | Target is not an item pile merchant`);\r\n }\r\n\r\n const flagData = PileUtilities.getActorFlagData(merchantActor);\r\n\r\n const actorPriceModifiers = flagData?.actorPriceModifiers ?? [];\r\n\r\n for (const priceModifier of priceModifierData) {\r\n if (priceModifier.actor && !(priceModifier.actor instanceof Actor)) {\r\n throw Helpers.custom_error(`updateMerchantPriceModifiers | priceModifierData.actor must be of type Actor`);\r\n }\r\n if (priceModifier.actor) {\r\n priceModifier.actorUuid = priceModifier.actor.uuid;\r\n }\r\n if (priceModifier.actorUuid && typeof priceModifier.actorUuid !== \"string\") {\r\n throw Helpers.custom_error(`updateMerchantPriceModifiers | if priceModifierData.actor if not provided, priceModifierData.actorUuid must be of type string `);\r\n }\r\n if (!priceModifier.actorUuid) {\r\n throw Helpers.custom_error(`updateMerchantPriceModifiers | Could not find the UUID for the given actor`);\r\n }\r\n if (priceModifier.relative !== undefined && typeof priceModifier.relative !== \"boolean\") {\r\n throw Helpers.custom_error(`updateMerchantPriceModifiers | priceModifierData.relative must be of type boolean`);\r\n }\r\n if (priceModifier.override !== undefined && typeof priceModifier.override !== \"boolean\") {\r\n throw Helpers.custom_error(`updateMerchantPriceModifiers | priceModifierData.override must be of type boolean`);\r\n }\r\n if (priceModifier.buyPriceModifier !== undefined && typeof priceModifier.buyPriceModifier !== \"number\") {\r\n throw Helpers.custom_error(`updateMerchantPriceModifiers | priceModifierData.buyPriceModifier must be of type number`);\r\n }\r\n if (priceModifier.sellPriceModifier !== undefined && typeof priceModifier.sellPriceModifier !== \"number\") {\r\n throw Helpers.custom_error(`updateMerchantPriceModifiers | priceModifierData.sellPriceModifier must be of type number`);\r\n }\r\n\r\n let actorPriceModifierIndex = actorPriceModifiers.findIndex(existingPriceModifier => existingPriceModifier.actorUuid === priceModifier.actorUuid);\r\n if (actorPriceModifierIndex === -1) {\r\n actorPriceModifierIndex = actorPriceModifiers.push({}) - 1;\r\n }\r\n\r\n const oldBuyPriceModifier = actorPriceModifiers[actorPriceModifierIndex]?.buyPriceModifier ?? flagData?.buyPriceModifier ?? 1;\r\n const newBuyPriceModifier = Math.max(0, priceModifier.relative ? oldBuyPriceModifier + priceModifier.buyPriceModifier : priceModifier.buyPriceModifier ?? oldBuyPriceModifier);\r\n\r\n const oldSellPriceModifier = actorPriceModifiers[actorPriceModifierIndex]?.sellPriceModifier ?? flagData?.sellPriceModifier ?? 0.5;\r\n const newSellPriceModifier = Math.max(0, priceModifier.relative ? oldSellPriceModifier + priceModifier.sellPriceModifier : priceModifier.sellPriceModifier ?? oldSellPriceModifier);\r\n\r\n actorPriceModifiers[actorPriceModifierIndex] = foundry.utils.mergeObject(actorPriceModifiers[actorPriceModifierIndex], {\r\n actorUuid: priceModifier.actorUuid,\r\n buyPriceModifier: newBuyPriceModifier,\r\n sellPriceModifier: newSellPriceModifier,\r\n override: priceModifier.override ?? false,\r\n });\r\n\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.UPDATE_PILE, targetUuid, { actorPriceModifiers });\r\n\r\n }\r\n\r\n /* ================= ITEM AND ATTRIBUTE METHODS ================= */\r\n\r\n /**\r\n * Adds item to an actor, increasing item quantities if matches were found\r\n *\r\n * @param {Actor/TokenDocument/Token} target The target to add an item to\r\n * @param {Array} items An array of objects, with the key \"item\" being an item object or an Item class (the foundry class), with an optional key of \"quantity\" being the amount of the item to add\r\n * @param {object} options Options to pass to the function\r\n * @param {boolean} [options.mergeSimilarItems=true] Whether to merge similar items based on their name and type\r\n * @param {boolean} [options.removeExistingActorItems=false] Whether to remove the actor's existing items before adding the new ones\r\n * @param {boolean} [options.skipVaultLogging=false] Whether to skip logging this action to the target actor if it is a vault\r\n * @param {string/boolean} [options.interactionId=false] The interaction ID of this action\r\n *\r\n * @returns {Promise<array>} An array of objects, each containing the item that was added or updated, and the quantity that was added\r\n */\r\n static addItems(target, items, {\r\n mergeSimilarItems = true, removeExistingActorItems = false, skipVaultLogging = false, interactionId = false\r\n } = {}) {\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`addItems | Could not determine the UUID, please provide a valid target`)\r\n\r\n const itemsToAdd = []\r\n items.forEach(itemData => {\r\n\r\n let item = itemData;\r\n if (itemData instanceof Item) {\r\n item = itemData.toObject();\r\n } else if (itemData.item) {\r\n item = itemData.item instanceof Item ? itemData.item.toObject() : itemData.item;\r\n if (itemData.flags) {\r\n setProperty(item, \"flags\", foundry.utils.mergeObject(getProperty(item, \"flags\") ?? {}, getProperty(itemData, \"flags\")));\r\n }\r\n } else if (itemData.id) {\r\n item = target.items.get(itemData.id);\r\n if (item) {\r\n item = item.toObject();\r\n } else {\r\n throw Helpers.custom_error(`addItems | Could not find item with id ${itemData.id} on actor with UUID ${targetUuid}!`)\r\n }\r\n }\r\n\r\n if (itemData?.quantity !== undefined) {\r\n Utilities.setItemQuantity(item, itemData.quantity, true);\r\n }\r\n\r\n const existingItems = mergeSimilarItems ? Utilities.findSimilarItem(itemsToAdd, item) : false;\r\n if (existingItems && PileUtilities.canItemStack(item, target)) {\r\n Utilities.setItemQuantity(existingItems, Utilities.getItemQuantity(existingItems) + Utilities.getItemQuantity(item));\r\n } else {\r\n itemsToAdd.push(item);\r\n }\r\n\r\n });\r\n\r\n if (interactionId && typeof interactionId !== \"string\") throw Helpers.custom_error(`addItems | interactionId must be of type string`);\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.ADD_ITEMS, targetUuid, itemsToAdd, game.user.id, {\r\n removeExistingActorItems, interactionId, skipVaultLogging\r\n });\r\n }\r\n\r\n /**\r\n * Subtracts the quantity of items on an actor. If the quantity of an item reaches 0, the item is removed from the actor.\r\n *\r\n * @param {Actor/Token/TokenDocument} target The target to remove a items from\r\n * @param {Array} items An array of objects each containing the item id (key \"_id\") and the quantity to remove (key \"quantity\"), or Items (the foundry class) or strings of IDs to remove all quantities of\r\n * @param {object} options Options to pass to the function\r\n * @param {boolean} [options.skipVaultLogging=false] Whether to skip logging this action to the target actor if it is a vault\r\n * @param {string/boolean} [options.interactionId=false] The interaction ID of this action\r\n *\r\n * @returns {Promise<array>} An array of objects, each containing the item that was removed or updated, the quantity that was removed, and whether the item was deleted\r\n */\r\n static removeItems(target, items, { skipVaultLogging = false, interactionId = false } = {}) {\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`removeItems | Could not determine the UUID, please provide a valid target`);\r\n\r\n const targetActorItems = PileUtilities.getActorItems(target, { getItemCurrencies: true });\r\n\r\n items = items.map(itemData => {\r\n\r\n let item;\r\n if (typeof itemData === \"string\" || itemData._id) {\r\n const itemId = typeof itemData === \"string\" ? itemData : itemData._id;\r\n item = targetActorItems.find(actorItem => actorItem.id === itemId);\r\n if (!item) {\r\n throw Helpers.custom_error(`removeItems | Could not find item with id \"${itemId}\" on target \"${targetUuid}\"`)\r\n }\r\n item = item.toObject();\r\n } else {\r\n if (itemData.item instanceof Item) {\r\n item = itemData.item.toObject();\r\n } else if (itemData instanceof Item) {\r\n item = itemData.toObject();\r\n } else {\r\n item = itemData.item;\r\n }\r\n let foundActorItem = targetActorItems.find(actorItem => actorItem.id === item._id);\r\n if (!foundActorItem) {\r\n throw Helpers.custom_error(`removeItems | Could not find item with id \"${item._id}\" on target \"${targetUuid}\"`)\r\n }\r\n }\r\n\r\n return {\r\n _id: item._id, quantity: itemData?.quantity ?? Utilities.getItemQuantity(item)\r\n }\r\n });\r\n\r\n if (interactionId) {\r\n if (typeof interactionId !== \"string\") throw Helpers.custom_error(`removeItems | interactionId must be of type string`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.REMOVE_ITEMS, targetUuid, items, game.user.id, {\r\n interactionId,\r\n skipVaultLogging\r\n });\r\n }\r\n\r\n /**\r\n * Transfers items from the source to the target, subtracting a number of quantity from the source's item and adding it to the target's item, deleting items from the source if their quantity reaches 0\r\n *\r\n * @param {Actor/Token/TokenDocument} source The source to transfer the items from\r\n * @param {Actor/Token/TokenDocument} target The target to transfer the items to\r\n * @param {Array} items An array of objects each containing the item id (key \"_id\") and the quantity to transfer (key \"quantity\"), or Items (the foundry class) or strings of IDs to transfer all quantities of\r\n * @param {object} options Options to pass to the function\r\n * @param {boolean} [options.skipVaultLogging=false] Whether to skip logging this action to the target actor if it is a vault\r\n * @param {string/boolean} [options.interactionId=false] The interaction ID of this action\r\n *\r\n * @returns {Promise<object>} An array of objects, each containing the item that was added or updated, and the quantity that was transferred\r\n */\r\n static transferItems(source, target, items, { skipVaultLogging = false, interactionId = false } = {}) {\r\n\r\n const sourceUuid = Utilities.getUuid(source);\r\n if (!sourceUuid) throw Helpers.custom_error(`transferItems | Could not determine the UUID, please provide a valid source`)\r\n\r\n const sourceActorItems = PileUtilities.getActorItems(source, { getItemCurrencies: true });\r\n\r\n items = items.map(itemData => {\r\n\r\n let item;\r\n if (typeof itemData === \"string\" || itemData._id) {\r\n const itemId = typeof itemData === \"string\" ? itemData : itemData._id;\r\n item = sourceActorItems.find(actorItem => actorItem.id === itemId);\r\n if (!item) {\r\n throw Helpers.custom_error(`transferItems | Could not find item with id \"${itemId}\" on target \"${sourceUuid}\"`)\r\n }\r\n item = item.toObject();\r\n } else if (itemData instanceof Item) {\r\n item = itemData.toObject();\r\n } else if (itemData.item instanceof Item) {\r\n item = itemData.item.toObject();\r\n } else {\r\n item = itemData.item;\r\n }\r\n\r\n let foundActorItem = sourceActorItems.find(actorItem => actorItem.id === item._id);\r\n if (!foundActorItem) {\r\n throw Helpers.custom_error(`transferItems | Could not find item with id \"${item._id}\" on target \"${sourceUuid}\"`)\r\n }\r\n\r\n return {\r\n _id: item._id,\r\n quantity: Math.max(itemData?.quantity ?? Utilities.getItemQuantity(itemData), 0),\r\n flags: getProperty(itemData, \"flags\")\r\n }\r\n });\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`transferItems | Could not determine the UUID, please provide a valid target`)\r\n\r\n if (interactionId) {\r\n if (typeof interactionId !== \"string\") throw Helpers.custom_error(`transferItems | interactionId must be of type string`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.TRANSFER_ITEMS, sourceUuid, targetUuid, items, game.user.id, {\r\n interactionId, skipVaultLogging\r\n });\r\n\r\n }\r\n\r\n /**\r\n * Transfers all items between the source and the target.\r\n *\r\n * @param {Actor/Token/TokenDocument} source The actor to transfer all items from\r\n * @param {Actor/Token/TokenDocument} target The actor to receive all the items\r\n * @param {object} options Options to pass to the function\r\n * @param {Array/boolean} [options.itemFilters=false] Array of item types disallowed - will default to module settings if none provided\r\n * @param {boolean} [options.skipVaultLogging=false] Whether to skip logging this action to the target actor if it is a vault\r\n * @param {string/boolean} [options.interactionId=false] The interaction ID of this action\r\n *\r\n * @returns {Promise<array>} An array containing all the items that were transferred to the target\r\n */\r\n static transferAllItems(source, target, {\r\n itemFilters = false,\r\n skipVaultLogging = false,\r\n interactionId = false\r\n } = {}) {\r\n\r\n const sourceUuid = Utilities.getUuid(source);\r\n if (!sourceUuid) throw Helpers.custom_error(`transferAllItems | Could not determine the UUID, please provide a valid source`)\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`transferAllItems | Could not determine the UUID, please provide a valid target`)\r\n\r\n if (itemFilters) {\r\n if (!Array.isArray(itemFilters)) throw Helpers.custom_error(`transferAllItems | itemFilters must be of type array`);\r\n itemFilters.forEach(entry => {\r\n if (typeof entry?.path !== \"string\") throw Helpers.custom_error(`transferAllItems | each entry in the itemFilters must have a \"path\" property that is of type string`);\r\n if (typeof entry?.filter !== \"string\") throw Helpers.custom_error(`transferAllItems | each entry in the itemFilters must have a \"filter\" property that is of type string`);\r\n })\r\n }\r\n\r\n if (interactionId) {\r\n if (typeof interactionId !== \"string\") throw Helpers.custom_error(`transferAllItems | interactionId must be of type string`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.TRANSFER_ALL_ITEMS, sourceUuid, targetUuid, game.user.id, {\r\n itemFilters, skipVaultLogging, interactionId\r\n });\r\n }\r\n\r\n /**\r\n * Sets attributes on an actor\r\n *\r\n * @param {Actor/Token/TokenDocument} target The target whose attribute will have their quantity set\r\n * @param {object} attributes An object with each key being an attribute path, and its value being the quantity to set\r\n * @param {object} options Options to pass to the function\r\n * @param {string/boolean} [options.interactionId=false] The interaction ID of this action\r\n *\r\n * @returns {Promise<object>} An array containing a key value pair of the attribute path and the quantity of that attribute that was set\r\n *\r\n */\r\n static setAttributes(target, attributes, { interactionId = false } = {}) {\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`setAttributes | Could not determine the UUID, please provide a valid target`);\r\n\r\n const targetActor = Utilities.getActor(target);\r\n\r\n Object.entries(attributes).forEach(entry => {\r\n const [attribute, quantity] = entry;\r\n if (!hasProperty(targetActor, attribute)) {\r\n throw Helpers.custom_error(`setAttributes | Could not find attribute ${attribute} on target's actor with UUID \"${targetUuid}\"`);\r\n }\r\n if (!Helpers.isRealNumber(quantity)) {\r\n throw Helpers.custom_error(`setAttributes | Attribute \"${attribute}\" must be of type number`);\r\n }\r\n });\r\n\r\n if (interactionId) {\r\n if (typeof interactionId !== \"string\") throw Helpers.custom_error(`setAttributes | interactionId must be of type string`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.SET_ATTRIBUTES, targetUuid, attributes, game.user.id, {\r\n interactionId\r\n });\r\n\r\n }\r\n\r\n /**\r\n * Adds attributes on an actor\r\n *\r\n * @param {Actor/Token/TokenDocument} target The target whose attribute will have a set quantity added to it\r\n * @param {object} attributes An object with each key being an attribute path, and its value being the quantity to add\r\n * @param {object} options Options to pass to the function\r\n * @param {boolean} [options.skipVaultLogging=false] Whether to skip logging this action to the target actor if it is a vault\r\n * @param {string/boolean} [options.interactionId=false] The interaction ID of this action\r\n *\r\n * @returns {Promise<object>} An array containing a key value pair of the attribute path and the quantity of that attribute that was added\r\n *\r\n */\r\n static addAttributes(target, attributes, { skipVaultLogging = false, interactionId = false } = {}) {\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`addAttributes | Could not determine the UUID, please provide a valid target`);\r\n\r\n const targetActor = Utilities.getActor(target);\r\n\r\n Object.entries(attributes).forEach(entry => {\r\n const [attribute, quantity] = entry;\r\n if (!hasProperty(targetActor, attribute)) {\r\n throw Helpers.custom_error(`addAttributes | Could not find attribute ${attribute} on target's actor with UUID \"${targetUuid}\"`);\r\n }\r\n if (!Helpers.isRealNumber(quantity) && quantity > 0) {\r\n throw Helpers.custom_error(`addAttributes | Attribute \"${attribute}\" must be of type number and greater than 0`);\r\n }\r\n });\r\n\r\n if (interactionId) {\r\n if (typeof interactionId !== \"string\") throw Helpers.custom_error(`addAttributes | interactionId must be of type string`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.ADD_ATTRIBUTES, targetUuid, attributes, game.user.id, {\r\n skipVaultLogging,\r\n interactionId\r\n });\r\n\r\n }\r\n\r\n /**\r\n * Subtracts attributes on the target\r\n *\r\n * @param {Token/TokenDocument} target The target whose attributes will be subtracted from\r\n * @param {Array/object} attributes This can be either an array of attributes to subtract (to zero out a given attribute), or an object with each key being an attribute path, and its value being the quantity to subtract\r\n * @param {object} options Options to pass to the function\r\n * @param {boolean} [options.skipVaultLogging=false] Whether to skip logging this action to the target actor if it is a vault\r\n * @param {string/boolean} [options.interactionId=false] The interaction ID of this action\r\n *\r\n * @returns {Promise<object>} An array containing a key value pair of the attribute path and the quantity of that attribute that was removed\r\n */\r\n static removeAttributes(target, attributes, { skipVaultLogging = false, interactionId = false } = {}) {\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`removeAttributes | Could not determine the UUID, please provide a valid target`);\r\n\r\n const targetActor = Utilities.getActor(target);\r\n\r\n let attributesToSend = {};\r\n if (Array.isArray(attributes)) {\r\n attributes.forEach(attribute => {\r\n if (typeof attribute !== \"string\") {\r\n throw Helpers.custom_error(`removeAttributes | Each attribute in the array must be of type string`);\r\n }\r\n if (!hasProperty(targetActor, attribute)) {\r\n throw Helpers.custom_error(`removeAttributes | Could not find attribute ${attribute} on target's actor with UUID \"${targetUuid}\"`);\r\n }\r\n attributesToSend[attribute] = Number(getProperty(targetActor, attribute));\r\n });\r\n } else {\r\n Object.entries(attributes).forEach(entry => {\r\n const [attribute, quantity] = entry;\r\n if (!hasProperty(targetActor, attribute)) {\r\n throw Helpers.custom_error(`removeAttributes | Could not find attribute ${attribute} on target's actor with UUID \"${targetUuid}\"`);\r\n }\r\n if (!Helpers.isRealNumber(quantity) && quantity > 0) {\r\n throw Helpers.custom_error(`removeAttributes | Attribute \"${attribute}\" must be of type number and greater than 0`);\r\n }\r\n });\r\n attributesToSend = attributes;\r\n }\r\n\r\n if (interactionId) {\r\n if (typeof interactionId !== \"string\") throw Helpers.custom_error(`removeAttributes | interactionId must be of type string`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.REMOVE_ATTRIBUTES, targetUuid, attributesToSend, game.user.id, {\r\n skipVaultLogging,\r\n interactionId\r\n });\r\n\r\n }\r\n\r\n /**\r\n * Transfers a set quantity of an attribute from a source to a target, removing it or subtracting from the source and adds it the target\r\n *\r\n * @param {Actor/Token/TokenDocument} source The source to transfer the attribute from\r\n * @param {Actor/Token/TokenDocument} target The target to transfer the attribute to\r\n * @param {Array/object} attributes This can be either an array of attributes to transfer (to transfer all of a given attribute), or an object with each key being an attribute path, and its value being the quantity to transfer\r\n * @param {object} options Options to pass to the function\r\n * @param {boolean} [options.skipVaultLogging=false] Whether to skip logging this action to the target actor if it is a vault\r\n * @param {string/boolean} [options.interactionId=false] The interaction ID of this action\r\n *\r\n * @returns {Promise<object>} An object containing a key value pair of each attribute transferred, the key being the attribute path and its value being the quantity that was transferred\r\n */\r\n static transferAttributes(source, target, attributes, { skipVaultLogging = false, interactionId = false } = {}) {\r\n\r\n const sourceUuid = Utilities.getUuid(source);\r\n if (!sourceUuid) throw Helpers.custom_error(`transferAttributes | Could not determine the UUID, please provide a valid source`);\r\n const sourceActor = Utilities.getActor(source);\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`transferAttributes | Could not determine the UUID, please provide a valid target`);\r\n const targetActor = Utilities.getActor(target);\r\n\r\n if (Array.isArray(attributes)) {\r\n attributes.forEach(attribute => {\r\n if (typeof attribute !== \"string\") {\r\n throw Helpers.custom_error(`transferAttributes | Each attribute in the array must be of type string`);\r\n }\r\n if (!hasProperty(sourceActor, attribute)) {\r\n throw Helpers.custom_error(`transferAttributes | Could not find attribute ${attribute} on source's actor with UUID \"${targetUuid}\"`);\r\n }\r\n if (!hasProperty(targetActor, attribute)) {\r\n throw Helpers.custom_error(`transferAttributes | Could not find attribute ${attribute} on target's actor with UUID \"${targetUuid}\"`);\r\n }\r\n });\r\n } else {\r\n Object.entries(attributes).forEach(entry => {\r\n const [attribute, quantity] = entry;\r\n if (!hasProperty(sourceActor, attribute)) {\r\n throw Helpers.custom_error(`transferAttributes | Could not find attribute ${attribute} on source's actor with UUID \"${targetUuid}\"`);\r\n }\r\n if (!hasProperty(targetActor, attribute)) {\r\n throw Helpers.custom_error(`transferAttributes | Could not find attribute ${attribute} on target's actor with UUID \"${targetUuid}\"`);\r\n }\r\n if (!Helpers.isRealNumber(quantity) && quantity > 0) {\r\n throw Helpers.custom_error(`transferAttributes | Attribute \"${attribute}\" must be of type number and greater than 0`);\r\n }\r\n });\r\n }\r\n\r\n if (interactionId) {\r\n if (typeof interactionId !== \"string\") throw Helpers.custom_error(`transferAttributes | interactionId must be of type string`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.TRANSFER_ATTRIBUTES, sourceUuid, targetUuid, attributes, game.user.id, {\r\n skipVaultLogging,\r\n interactionId\r\n });\r\n\r\n }\r\n\r\n /**\r\n * Transfers all dynamic attributes from a source to a target, removing it or subtracting from the source and adding them to the target\r\n *\r\n * @param {Actor/Token/TokenDocument} source The source to transfer the attributes from\r\n * @param {Actor/Token/TokenDocument} target The target to transfer the attributes to\r\n * @param {object} options Options to pass to the function\r\n * @param {boolean} [options.skipVaultLogging=false] Whether to skip logging this action to the target actor if it is a vault\r\n * @param {string/boolean} [options.interactionId=false] The interaction ID of this action\r\n *\r\n * @returns {Promise<object>} An object containing a key value pair of each attribute transferred, the key being the attribute path and its value being the quantity that was transferred\r\n */\r\n static transferAllAttributes(source, target, { skipVaultLogging = false, interactionId = false } = {}) {\r\n\r\n const sourceUuid = Utilities.getUuid(source);\r\n if (!sourceUuid) throw Helpers.custom_error(`transferAllAttributes | Could not determine the UUID, please provide a valid source`);\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`transferAllAttributes | Could not determine the UUID, please provide a valid target`);\r\n\r\n if (interactionId) {\r\n if (typeof interactionId !== \"string\") throw Helpers.custom_error(`transferAllAttributes | interactionId must be of type string`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.TRANSFER_ALL_ATTRIBUTES, sourceUuid, targetUuid, game.user.id, {\r\n skipVaultLogging,\r\n interactionId\r\n });\r\n\r\n }\r\n\r\n /**\r\n * Transfers all items and attributes between the source and the target.\r\n *\r\n * @param {Actor/Token/TokenDocument} source The actor to transfer all items and attributes from\r\n * @param {Actor/Token/TokenDocument} target The actor to receive all the items and attributes\r\n * @param {object} options Options to pass to the function\r\n * @param {Array/boolean} [options.itemFilters=false] Array of item types disallowed - will default to module settings if none provided\r\n * @param {boolean} [options.skipVaultLogging=false] Whether to skip logging this action to the target actor if it is a vault\r\n * @param {string/boolean} [options.interactionId=false] The ID of this interaction\r\n *\r\n * @returns {Promise<object>} An object containing all items and attributes transferred to the target\r\n */\r\n static transferEverything(source, target, {\r\n itemFilters = false,\r\n skipVaultLogging = false,\r\n interactionId = false\r\n } = {}) {\r\n\r\n const sourceUuid = Utilities.getUuid(source);\r\n if (!sourceUuid) throw Helpers.custom_error(`transferEverything | Could not determine the UUID, please provide a valid source`);\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`transferEverything | Could not determine the UUID, please provide a valid target`);\r\n\r\n if (itemFilters) {\r\n if (!Array.isArray(itemFilters)) throw Helpers.custom_error(`transferEverything | itemFilters must be of type array`);\r\n itemFilters.forEach(entry => {\r\n if (typeof entry?.path !== \"string\") throw Helpers.custom_error(`transferEverything | each entry in the itemFilters must have a \"path\" property that is of type string`);\r\n if (typeof entry?.filter !== \"string\") throw Helpers.custom_error(`transferEverything | each entry in the itemFilters must have a \"filter\" property that is of type string`);\r\n })\r\n }\r\n\r\n if (interactionId) {\r\n if (typeof interactionId !== \"string\") throw Helpers.custom_error(`transferEverything | interactionId must be of type string`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.TRANSFER_EVERYTHING, sourceUuid, targetUuid, game.user.id, {\r\n itemFilters, skipVaultLogging, interactionId\r\n });\r\n\r\n }\r\n\r\n /**\r\n * Turns a string of currencies into an array containing the data and quantities for each currency\r\n *\r\n * @param {string} currencies A string of currencies to convert (eg, \"5gp 25sp\")\r\n *\r\n * @returns {Array<object>} An array of object containing the data and quantity for each currency\r\n */\r\n static getCurrenciesFromString(currencies) {\r\n if (typeof currencies !== \"string\") {\r\n throw Helpers.custom_error(`getCurrenciesFromString | currencies must be of type string`)\r\n }\r\n return PileUtilities.getPriceFromString(currencies).currencies;\r\n }\r\n\r\n /**\r\n * Turns a string of currencies into an object containing payment data, and the change an optional target would receive back\r\n *\r\n * @param {string} price A string of currencies to convert (eg, \"5gp 25sp\")\r\n * @param {object} options Options to pass to the function\r\n * @param {string/boolean} [options.target=false] The target whose currencies to check against\r\n *\r\n * @returns {object} An object containing the price data\r\n */\r\n static getPaymentDataFromString(price, { target = false } = {}) {\r\n\r\n let targetActor = false;\r\n if (target) {\r\n targetActor = Utilities.getActor(target);\r\n if (!targetActor) throw Helpers.custom_error(`removeCurrencies | Could not determine target actor`);\r\n }\r\n\r\n const priceData = PileUtilities.getPriceFromString(price)\r\n const currenciesToRemove = priceData.currencies.filter(currency => currency.quantity);\r\n const overallCost = priceData.overallCost;\r\n\r\n if (!currenciesToRemove.length) {\r\n throw Helpers.custom_error(`removeCurrencies | Could not determine currencies to remove with string \"${price}\"`);\r\n }\r\n\r\n return PileUtilities.getPaymentData({\r\n purchaseData: [{ cost: overallCost, quantity: 1 }], buyer: targetActor\r\n });\r\n\r\n }\r\n\r\n /**\r\n * Adds currencies to the target\r\n *\r\n * @param {Actor/Token/TokenDocument} target The actor to add the currencies to\r\n * @param {string} currencies A string of currencies to add (eg, \"5gp 25sp\")\r\n * @param {object} options Options to pass to the function\r\n * @param {string/boolean} [options.interactionId=false] The ID of this interaction\r\n *\r\n * @returns {Promise<object>} An object containing the items and attributes added to the target\r\n */\r\n static addCurrencies(target, currencies, { interactionId = false } = {}) {\r\n\r\n const targetActor = Utilities.getActor(target);\r\n const targetUuid = Utilities.getUuid(targetActor);\r\n if (!targetUuid) throw Helpers.custom_error(`addCurrency | Could not determine the UUID, please provide a valid target`);\r\n\r\n if (typeof currencies !== \"string\") {\r\n throw Helpers.custom_error(`addCurrency | currencies must be of type string`)\r\n }\r\n\r\n const currenciesToAdd = PileUtilities.getPriceFromString(currencies).currencies\r\n .filter(currency => currency.quantity);\r\n\r\n if (!currenciesToAdd.length) {\r\n throw Helpers.custom_error(`addCurrency | Could not determine currencies to add with string \"${currencies}\"`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.ADD_CURRENCIES, targetUuid, currencies, game.user.id, { interactionId });\r\n\r\n }\r\n\r\n /**\r\n * Removes currencies from the target\r\n *\r\n * @param {Actor/Token/TokenDocument} target The actor to remove currencies from\r\n * @param {string} currencies A string of currencies to remove (eg, \"5gp 25sp\")\r\n * @param {object} options Options to pass to the function\r\n * @param {boolean} [options.change=true] Whether the actor can get change back\r\n * @param {string/boolean} [options.interactionId=false] The ID of this interaction\r\n *\r\n * @returns {Promise<object>} An object containing the items and attributes removed from the target\r\n */\r\n static removeCurrencies(target, currencies, { change = true, interactionId = false } = {}) {\r\n\r\n const targetActor = Utilities.getActor(target);\r\n const targetUuid = Utilities.getUuid(targetActor);\r\n if (!targetUuid) throw Helpers.custom_error(`removeCurrencies | Could not determine the UUID, please provide a valid target`);\r\n\r\n if (typeof currencies !== \"string\") {\r\n throw Helpers.custom_error(`removeCurrencies | currencies must be of type string`)\r\n }\r\n\r\n const priceData = PileUtilities.getPriceFromString(currencies)\r\n const currenciesToRemove = priceData.currencies.filter(currency => currency.quantity);\r\n const overallCost = priceData.overallCost;\r\n\r\n if (!currenciesToRemove.length) {\r\n throw Helpers.custom_error(`removeCurrencies | Could not determine currencies to remove with string \"${currencies}\"`);\r\n }\r\n\r\n const paymentData = PileUtilities.getPaymentData({\r\n purchaseData: [{ cost: overallCost, quantity: 1 }], buyer: targetActor\r\n });\r\n\r\n if (!paymentData.canBuy) {\r\n throw Helpers.custom_error(`removeCurrencies | ${targetActor.name} cannot afford \"${currencies}\"`);\r\n }\r\n\r\n if (!change && paymentData.buyerChange.length) {\r\n throw Helpers.custom_error(`removeCurrencies | ${targetActor.name} cannot afford \"${currencies}\" without receiving change!`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.REMOVE_CURRENCIES, targetUuid, currencies, game.user.id, { interactionId });\r\n\r\n }\r\n\r\n /**\r\n * Transfers currencies between the source and the target.\r\n *\r\n * @param {Actor/Token/TokenDocument} source The actor to transfer currencies from\r\n * @param {Actor/Token/TokenDocument} target The actor to receive the currencies\r\n * @param {string} currencies A string of currencies to transfer (eg, \"5gp 25sp\")\r\n * @param {object} options Options to pass to the function\r\n * @param {boolean} [options.change=true] Whether the source actor can get change back\r\n * @param {string/boolean} [options.interactionId=false] The ID of this interaction\r\n *\r\n * @returns {Promise<object>} An object containing the items and attributes transferred to the target\r\n */\r\n static transferCurrencies(source, target, currencies, { change = true, interactionId = false } = {}) {\r\n\r\n const sourceActor = Utilities.getActor(source);\r\n const sourceUuid = Utilities.getUuid(sourceActor);\r\n if (!sourceUuid) throw Helpers.custom_error(`transferCurrencies | Could not determine the UUID, please provide a valid source`);\r\n\r\n const targetActor = Utilities.getActor(target);\r\n const targetUuid = Utilities.getUuid(targetActor);\r\n if (!targetUuid) throw Helpers.custom_error(`transferCurrencies | Could not determine the UUID, please provide a valid target`);\r\n\r\n if (typeof currencies !== \"string\") {\r\n throw Helpers.custom_error(`transferCurrencies | currencies must be of type string`)\r\n }\r\n\r\n const priceData = PileUtilities.getPriceFromString(currencies)\r\n const currenciesToTransfer = priceData.currencies.filter(currency => currency.quantity);\r\n const overallCost = priceData.overallCost;\r\n\r\n if (!currenciesToTransfer.length) {\r\n throw Helpers.custom_error(`transferCurrencies | Could not determine currencies to remove with string \"${currencies}\"`);\r\n }\r\n\r\n const paymentData = PileUtilities.getPaymentData({\r\n purchaseData: [{ cost: overallCost, quantity: 1 }], buyer: sourceActor\r\n });\r\n\r\n if (!paymentData.canBuy) {\r\n throw Helpers.custom_error(`transferCurrencies | ${sourceActor.name} cannot afford to transfer \"${currencies}\"`);\r\n }\r\n\r\n if (!change && paymentData.buyerChange.length) {\r\n throw Helpers.custom_error(`transferCurrencies | ${sourceActor.name} cannot afford to transfer \"${currencies}\" without receiving change!`);\r\n }\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.TRANSFER_CURRENCIES, sourceUuid, targetUuid, currencies, game.user.id, { interactionId });\r\n\r\n }\r\n\r\n /**\r\n * Transfers all currencies between the source and the target.\r\n *\r\n * @param {Actor/Token/TokenDocument} source The actor to transfer all currencies from\r\n * @param {Actor/Token/TokenDocument} target The actor to receive all the currencies\r\n * @param {object} options Options to pass to the function\r\n * @param {string/boolean} [options.interactionId=false] The ID of this interaction\r\n *\r\n * @returns {Promise<object>} An object containing all items and attributes transferred to the target\r\n */\r\n static transferAllCurrencies(source, target, { interactionId = false } = {}) {\r\n\r\n const sourceUuid = Utilities.getUuid(source);\r\n if (!sourceUuid) throw Helpers.custom_error(`transferCurrencies | Could not determine the UUID, please provide a valid source`);\r\n\r\n const targetUuid = Utilities.getUuid(target);\r\n if (!targetUuid) throw Helpers.custom_error(`transferCurrencies | Could not determine the UUID, please provide a valid target`);\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.TRANSFER_ALL_CURRENCIES, sourceUuid, targetUuid, game.user.id, { interactionId });\r\n\r\n }\r\n\r\n /**\r\n * Rolls on a table of items and collates them to be able to be added to actors and such\r\n *\r\n * @param {string/RollTable} table The name, ID, UUID, or the table itself, or an array of such\r\n * @param {object} options Options to pass to the function\r\n * @param {string/number} [options.timesToRoll=\"1\"] The number of times to roll on the tables, which can be a roll formula\r\n * @param {boolean} [options.resetTable=true] Whether to reset the table before rolling it\r\n * @param {boolean} [options.normalizeTable=true] Whether to normalize the table before rolling it\r\n * @param {boolean} [options.displayChat=false] Whether to display the rolls to the chat\r\n * @param {object} [options.rollData={}] Data to inject into the roll formula\r\n * @param {Actor/string/boolean} [options.targetActor=false] The target actor to add the items to, or the UUID of an actor\r\n * @param {boolean} [options.removeExistingActorItems=false] Whether to clear the target actor's items before adding the ones rolled\r\n * @param {boolean/string} [options.customCategory=false] Whether to apply a custom category to the items rolled\r\n *\r\n * @returns {Promise<Array<Item>>} An array of object containing the item data and their quantity\r\n */\r\n static async rollItemTable(table, {\r\n timesToRoll = \"1\",\r\n resetTable = true,\r\n normalizeTable = false,\r\n displayChat = false,\r\n rollData = {},\r\n targetActor = false,\r\n removeExistingActorItems = false,\r\n customCategory = false\r\n } = {}) {\r\n\r\n let rollTable = table;\r\n if (typeof table === \"string\") {\r\n let potentialTable = await fromUuid(table);\r\n if (!potentialTable) {\r\n potentialTable = game.tables.get(table)\r\n }\r\n if (!potentialTable) {\r\n potentialTable = game.tables.getName(table)\r\n }\r\n if (!potentialTable) {\r\n throw Helpers.custom_error(`rollItemTable | could not find table with string \"${table}\"`);\r\n }\r\n if (resetTable && table.startsWith(\"Compendium\")) {\r\n resetTable = false;\r\n }\r\n rollTable = potentialTable;\r\n }\r\n\r\n if (!(rollTable instanceof RollTable)) {\r\n throw Helpers.custom_error(`rollItemTable | table must be of type RollTable`);\r\n }\r\n\r\n table = rollTable.uuid;\r\n\r\n if (!(typeof timesToRoll === \"string\" || typeof timesToRoll === \"number\")) {\r\n throw Helpers.custom_error(`rollItemTable | timesToRoll must be of type string or number`);\r\n }\r\n\r\n if (typeof rollData !== \"object\") {\r\n throw Helpers.custom_error(`rollItemTable | rollData must be of type object`);\r\n }\r\n\r\n if (typeof removeExistingActorItems !== \"boolean\") {\r\n throw Helpers.custom_error(`rollItemTable | removeExistingActorItems of type boolean`);\r\n }\r\n\r\n if (targetActor) {\r\n targetActor = Utilities.getActor(targetActor);\r\n if (!(targetActor instanceof Actor)) {\r\n throw Helpers.custom_error(`rollItemTable | could not find the actor of the target actor`);\r\n }\r\n }\r\n\r\n const items = await ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.ROLL_ITEM_TABLE, {\r\n table,\r\n timesToRoll,\r\n resetTable,\r\n normalizeTable,\r\n displayChat,\r\n rollData,\r\n customCategory,\r\n targetActor: Utilities.getUuid(targetActor),\r\n removeExistingActorItems,\r\n userId: game.user.id\r\n });\r\n\r\n if (items) {\r\n for (const entry of items) {\r\n entry.item = targetActor ? targetActor.items.get(entry.item._id) : await Item.implementation.create(entry.item, { temporary: true });\r\n }\r\n }\r\n\r\n return items;\r\n\r\n }\r\n\r\n /**\r\n * Gets all the valid items from a given actor or token, excluding items based on its item type filters\r\n *\r\n * @param {Actor/TokenDocument/Token} target The target to get the items from\r\n *\r\n * @returns {Array<Item>} Array containing the target's valid items\r\n */\r\n static getActorItems(target) {\r\n return PileUtilities.getActorItems(target);\r\n }\r\n\r\n static findSimilarItem(itemsToSearch, itemToFind) {\r\n return Utilities.findSimilarItem(itemsToSearch, itemToFind);\r\n }\r\n\r\n /**\r\n * Gets the valid currencies from a given actor or token\r\n *\r\n * @param {Actor/TokenDocument/Token} target The target to get the currencies from\r\n * @param {object} [options] Object containing optional parameters\r\n * @param {Boolean} [options.getAll] Whether to get all the currencies, regardless of quantity\r\n *\r\n * @returns {Array<object>} An array of objects containing the data about each currency\r\n */\r\n static getActorCurrencies(target, { getAll = false } = {}) {\r\n return PileUtilities.getActorCurrencies(target, { getAll });\r\n }\r\n\r\n static updateTokenHud() {\r\n return ItemPileSocket.executeForEveryone(ItemPileSocket.HANDLERS.RERENDER_TOKEN_HUD);\r\n }\r\n\r\n static requestTrade(user) {\r\n return TradeAPI._requestTrade(user);\r\n }\r\n\r\n static spectateTrade(tradeId) {\r\n return TradeAPI._spectateTrade(tradeId);\r\n }\r\n\r\n /**\r\n * Renders the appropriate interface for a given actor\r\n *\r\n * @param {Actor/TokenDocument} target The actor whose interface to render\r\n * @param {object} options An object containing the options for this method\r\n * @param {Array<string/User>} [options.userIds] An array of users or user ids for each user to render the interface for (defaults to only self)\r\n * @param {Actor/TokenDocument} [options.inspectingTarget] Sets what actor should be viewing the interface\r\n * @param {boolean} [options.useDefaultCharacter] Whether other users should use their assigned character when rendering the interface\r\n *\r\n * @returns {Promise}\r\n */\r\n static renderItemPileInterface(target, {\r\n userIds = null, inspectingTarget = null, useDefaultCharacter = false\r\n } = {}) {\r\n\r\n const targetDocument = Utilities.getDocument(target);\r\n const targetUuid = Utilities.getUuid(targetDocument);\r\n if (!targetUuid) throw Helpers.custom_error(`renderItemPileInterface | Could not determine the UUID, please provide a valid target item pile`);\r\n\r\n if (!PileUtilities.isValidItemPile(targetDocument)) {\r\n throw Helpers.custom_error(\"renderItemPileInterface | This target is not a valid item pile\")\r\n }\r\n\r\n if (!inspectingTarget && !useDefaultCharacter) {\r\n useDefaultCharacter = true;\r\n }\r\n\r\n if (inspectingTarget && useDefaultCharacter) {\r\n throw Helpers.custom_error(\"renderItemPileInterface | You cannot force users to use both their default character and a specific character to inspect the pile\")\r\n }\r\n\r\n const inspectingTargetUuid = inspectingTarget ? Utilities.getUuid(inspectingTarget) : false;\r\n if (inspectingTarget && !inspectingTargetUuid) throw Helpers.custom_error(`renderItemPileInterface | Could not determine the UUID, please provide a valid inspecting target`);\r\n\r\n if (!Array.isArray(userIds)) {\r\n if (userIds === null) {\r\n userIds = [game.user.id];\r\n } else {\r\n userIds = [userIds]\r\n }\r\n } else {\r\n userIds = userIds.map(user => {\r\n return user instanceof User ? user.id : user;\r\n })\r\n }\r\n\r\n if (!game.user.isGM) {\r\n if (userIds.length > 1 || !userIds.includes(game.user.id)) {\r\n throw Helpers.custom_error(`renderItemPileInterface | You are not a GM, so you cannot force others to render an item pile's interface`);\r\n }\r\n userIds = [game.user.id];\r\n }\r\n\r\n if (userIds.length === 1 && userIds[0] === game.user.id) {\r\n return PrivateAPI._renderItemPileInterface(targetUuid, {\r\n inspectingTargetUuid, useDefaultCharacter, remote: true\r\n })\r\n }\r\n\r\n for (const userId of userIds) {\r\n const user = game.users.get(userId);\r\n if (!user) throw Helpers.custom_error(`renderItemPileInterface | No user with ID \"${userId}\" exists`);\r\n if (user.isGM) continue;\r\n if (useDefaultCharacter) {\r\n if (!user.character) {\r\n Helpers.custom_warning(`renderItemPileInterface | User \"${user.name}\" has no default character`, true);\r\n return;\r\n }\r\n }\r\n }\r\n\r\n return ItemPileSocket.executeForUsers(ItemPileSocket.HANDLERS.RENDER_INTERFACE, userIds, targetUuid, {\r\n inspectingTargetUuid, useDefaultCharacter, remote: true\r\n });\r\n\r\n }\r\n\r\n /**\r\n * Closes any open interfaces from a given item pile actor\r\n *\r\n * @param {Actor/TokenDocument} target The actor whose interface to potentially close\r\n * @param {object} options An object containing the options for this method\r\n * @param {Array<string/User>} [options.userIds] An array of users or user ids for each user to close the interface for (defaults to only self)\r\n *\r\n * @returns {Promise}\r\n */\r\n static unrenderItemPileInterface(target, { userIds = null } = {}) {\r\n\r\n const targetDocument = Utilities.getDocument(target);\r\n const targetUuid = Utilities.getUuid(targetDocument);\r\n if (!targetUuid) throw Helpers.custom_error(`unrenderItemPileInterface | Could not determine the UUID, please provide a valid target item pile`);\r\n\r\n if (!PileUtilities.isValidItemPile(targetDocument)) {\r\n throw Helpers.custom_error(\"unrenderItemPileInterface | This target is not a valid item pile\")\r\n }\r\n\r\n if (!Array.isArray(userIds)) {\r\n if (userIds === null) {\r\n userIds = [game.user.id];\r\n } else {\r\n userIds = [userIds]\r\n }\r\n } else {\r\n userIds = userIds.map(user => {\r\n return user instanceof User ? user.id : user;\r\n })\r\n }\r\n\r\n if (!game.user.isGM) {\r\n if (userIds.length > 1 || !userIds.includes(game.user.id)) {\r\n throw Helpers.custom_error(`unrenderItemPileInterface | You are not a GM, so you cannot force others to close an item pile's interface`);\r\n }\r\n userIds = [game.user.id];\r\n }\r\n\r\n if (userIds.length === 1 && userIds[0] === game.user.id) {\r\n return PrivateAPI._unrenderItemPileInterface(targetUuid, { remote: true });\r\n }\r\n\r\n for (const userId of userIds) {\r\n const user = game.users.get(userId);\r\n if (!user) throw Helpers.custom_error(`unrenderItemPileInterface | No user with ID \"${userId}\" exists`);\r\n }\r\n\r\n return ItemPileSocket.executeForUsers(ItemPileSocket.HANDLERS.UNRENDER_INTERFACE, userIds, targetUuid, { remote: true });\r\n\r\n }\r\n\r\n /**\r\n * Get the prices array for a given item\r\n *\r\n * @param {Item} item Item to get the price for\r\n * @param {object} options Options to pass to the function\r\n * @param {Actor/boolean} [options.seller=false] Actor that is selling the item\r\n * @param {Actor/boolean} [options.buyer=false] Actor that is buying the item\r\n * @param {number} [options.quantity=1] Quantity of item to buy\r\n *\r\n * @returns {Array} Array containing all the different purchase options for this item\r\n */\r\n static getPricesForItem(item, { seller = false, buyer = false, quantity = 1 } = {}) {\r\n\r\n if (!(item instanceof Item)) {\r\n throw Helpers.custom_error(\"getPricesForItem | The given item must be of type Item\");\r\n }\r\n\r\n if (seller) {\r\n seller = Utilities.getActor(seller);\r\n if (!seller) {\r\n throw Helpers.custom_error(\"getPricesForItem | Could not determine actor for the seller\");\r\n }\r\n } else {\r\n if (!item.parent) {\r\n throw Helpers.custom_error(\"getPricesForItem | If no seller was given, the item must belong to an actor\");\r\n }\r\n seller = Utilities.getActor(item.parent);\r\n }\r\n\r\n if (buyer) {\r\n buyer = Utilities.getActor(buyer);\r\n if (!buyer) {\r\n throw Helpers.custom_error(`getPricesForItem | Could not determine the actor for the buyer`);\r\n }\r\n }\r\n\r\n return PileUtilities.getPriceData({ item, seller, buyer, quantity });\r\n\r\n }\r\n\r\n /**\r\n * Trades multiple items between one actor to another, and currencies and/or change is exchanged between them\r\n *\r\n * @param {Actor/Token/TokenDocument} seller The actor that is selling the item\r\n * @param {Actor/Token/TokenDocument} buyer The actor that is buying the item\r\n * @param {Array<Object<{ item: Item/string, quantity: number, paymentIndex: number }>>} items An array of objects containing the item or the id of the\r\n * item to be sold, the quantity to be sold, and the payment\r\n * index to be used\r\n * @param {string/boolean} [interactionId=false] The ID of this interaction\r\n *\r\n * @returns {Promise<Object>} The items that were created and the attributes that were changed\r\n */\r\n static tradeItems(seller, buyer, items, { interactionId = false } = {}) {\r\n\r\n const sellerActor = Utilities.getActor(seller);\r\n const sellerUuid = Utilities.getUuid(sellerActor);\r\n if (!sellerUuid) {\r\n throw Helpers.custom_error(`tradeItems | Could not determine the UUID of the seller, please provide a valid actor or token`, true);\r\n }\r\n\r\n const buyerActor = Utilities.getActor(buyer);\r\n const buyerUuid = Utilities.getUuid(buyer);\r\n if (!buyerUuid) {\r\n throw Helpers.custom_error(`tradeItems | Could not determine the UUID of the buyer, please provide a valid actor or token`, true);\r\n }\r\n\r\n const itemsToSell = items.map(data => {\r\n\r\n data = foundry.utils.mergeObject({\r\n item: \"\", quantity: 1, paymentIndex: 0\r\n }, data);\r\n\r\n if (!data.item) {\r\n throw Helpers.custom_error(`tradeItems | You must provide an item!`, true);\r\n }\r\n\r\n let actorItem;\r\n if (typeof data.item === \"string\") {\r\n actorItem = sellerActor.items.get(data.item) || sellerActor.items.getName(data.item);\r\n if (!actorItem) {\r\n throw Helpers.custom_error(`tradeItems | Could not find item on seller with identifier \"${data.item}\"`);\r\n }\r\n } else {\r\n actorItem = sellerActor.items.get(data.item instanceof Item ? data.item.id : data.item._id) || sellerActor.items.getName(data.item.name);\r\n if (!actorItem) {\r\n throw Helpers.custom_error(`tradeItems | Could not find provided item on seller`);\r\n }\r\n }\r\n\r\n const itemPrices = PileUtilities.getPriceData({\r\n item: actorItem, seller: sellerActor, buyer: buyerActor, quantity: data.quantity\r\n });\r\n if (itemPrices.length) {\r\n if (data.paymentIndex >= itemPrices.length || data.paymentIndex < 0) {\r\n throw Helpers.custom_error(`tradeItems | That payment index does not exist on ${actorItem.name}`, true);\r\n }\r\n\r\n const selectedPrice = itemPrices[data.paymentIndex];\r\n if (data.quantity > selectedPrice.maxQuantity) {\r\n throw Helpers.custom_error(`tradeItems | The buyer actor cannot afford ${data.quantity} of ${actorItem.name} (max ${selectedPrice.maxQuantity})`, true);\r\n }\r\n }\r\n\r\n return {\r\n id: actorItem.id, quantity: data.quantity, paymentIndex: data.paymentIndex\r\n };\r\n\r\n });\r\n\r\n return ItemPileSocket.executeAsGM(ItemPileSocket.HANDLERS.TRADE_ITEMS, sellerUuid, buyerUuid, itemsToSell, game.user.id, { interactionId });\r\n\r\n }\r\n\r\n static async registerItemPileType(type, label, flags = []) {\r\n game.i18n.translations['ITEM-PILES'].Types[type] = \"Custom: \" + label;\r\n CONSTANTS.CUSTOM_PILE_TYPES[type] = flags;\r\n }\r\n\r\n static isItemInvalid(item) {\r\n return PileUtilities.isItemInvalid(item);\r\n }\r\n\r\n static canItemStack(item) {\r\n return PileUtilities.canItemStack(item);\r\n }\r\n\r\n static getVaultGridData(vaultActor) {\r\n return PileUtilities.getVaultGridData(vaultActor);\r\n }\r\n\r\n static getActorFlagData(actor) {\r\n return PileUtilities.getActorFlagData(actor);\r\n }\r\n\r\n}\r\n\r\nexport default API;\r\n","import CONSTANTS from \"./constants/constants.js\";\r\nimport { custom_warning, getSetting } from \"./helpers/helpers.js\";\r\nimport * as PileUtilities from \"./helpers/pile-utilities.js\";\r\nimport SETTINGS from \"./constants/settings.js\";\r\nimport { findOrCreateItemInCompendium } from \"./helpers/compendium-utilities.js\";\r\n\r\nconst sortedMigrations = [\"2.7.5\", \"2.4.0\", \"2.4.17\", \"2.6.1\"];\r\n\r\nexport default async function runMigrations() {\r\n\r\n for (const version of sortedMigrations) {\r\n try {\r\n await migrations[version](version);\r\n } catch (err) {\r\n console.error(err);\r\n custom_warning(`Something went wrong when migrating to version ${version}. Please check the console for the error!`, true)\r\n }\r\n }\r\n}\r\n\r\nfunction getItemPileActorsOfLowerVersion(version) {\r\n return PileUtilities.getItemPileActors((a) => {\r\n const actorFlagVersion = getProperty(a, CONSTANTS.FLAGS.VERSION) || \"1.0.0\";\r\n return getProperty(a, CONSTANTS.FLAGS.PILE)?.enabled && isNewerVersion(version, actorFlagVersion);\r\n })\r\n}\r\n\r\nfunction getItemPileTokensOfLowerVersion(version) {\r\n return PileUtilities.getItemPileTokens((token) => {\r\n try {\r\n const actorFlagVersion = getProperty(token, CONSTANTS.FLAGS.VERSION) || \"1.0.0\";\r\n return token.actor && isNewerVersion(version, actorFlagVersion);\r\n } catch (err) {\r\n return false;\r\n }\r\n })\r\n}\r\n\r\nfunction filterValidItems(items, version) {\r\n return items.filter(item => {\r\n const itemFlagVersion = getProperty(item, CONSTANTS.FLAGS.VERSION);\r\n return (itemFlagVersion && isNewerVersion(version, itemFlagVersion))\r\n || (!itemFlagVersion && hasProperty(item, CONSTANTS.FLAGS.ITEM));\r\n });\r\n}\r\n\r\nfunction getActorValidItems(actor, version) {\r\n return filterValidItems(actor.items, version);\r\n}\r\n\r\nconst migrations = {\r\n\r\n \"2.4.0\": async (version) => {\r\n\r\n const actors = getItemPileActorsOfLowerVersion(version);\r\n\r\n const actorUpdates = actors.map(a => {\r\n const flagData = {\r\n [CONSTANTS.FLAGS.PILE]: PileUtilities.cleanFlagData(PileUtilities.migrateFlagData(a)),\r\n [CONSTANTS.FLAGS.VERSION]: version\r\n }\r\n if (a.actorLink) {\r\n flagData[\"token\"] = foundry.utils.deepClone(flagData);\r\n }\r\n return {\r\n _id: a.id,\r\n ...flagData\r\n };\r\n });\r\n\r\n if (actorUpdates.length) {\r\n console.log(`Item Piles | Migrating ${actorUpdates.length} actors to version ${version}...`)\r\n }\r\n\r\n await Actor.updateDocuments(actorUpdates);\r\n\r\n const { allTokensOnScenes, validTokensOnScenes } = getItemPileTokensOfLowerVersion(version);\r\n\r\n for (const [sceneId, tokens] of validTokensOnScenes) {\r\n const scene = game.scenes.get(sceneId)\r\n const updates = [];\r\n for (const token of tokens) {\r\n const flagData = {\r\n [CONSTANTS.FLAGS.PILE]: PileUtilities.cleanFlagData(PileUtilities.migrateFlagData(token.actor)),\r\n [CONSTANTS.FLAGS.VERSION]: version,\r\n }\r\n updates.push({\r\n _id: token.id,\r\n ...flagData\r\n });\r\n }\r\n console.log(`Item Piles | Migrating ${updates.length} tokens on scene \"${sceneId}\" to version ${version}...`);\r\n await scene.updateEmbeddedDocuments(\"Token\", updates);\r\n }\r\n\r\n const invalidTokensOnScenes = allTokensOnScenes.map(([scene, tokens]) => [\r\n scene,\r\n tokens.filter(token => {\r\n try {\r\n const actorFlagVersion = getProperty(token, CONSTANTS.FLAGS.VERSION) || \"1.0.0\";\r\n return !token.actor || isNewerVersion(version, actorFlagVersion);\r\n } catch (err) {\r\n return true;\r\n }\r\n })\r\n ]).filter(([_, tokens]) => tokens.length);\r\n\r\n for (const [sceneId, tokens] of invalidTokensOnScenes) {\r\n\r\n const scene = game.scenes.get(sceneId);\r\n\r\n let deletions = [];\r\n let updates = [];\r\n for (const token of tokens) {\r\n\r\n const flagData = {\r\n [CONSTANTS.FLAGS.PILE]: PileUtilities.cleanFlagData(PileUtilities.migrateFlagData(token)),\r\n [CONSTANTS.FLAGS.VERSION]: version,\r\n }\r\n\r\n let tokenActor = game.actors.get(token.actorId);\r\n if (!tokenActor) {\r\n tokenActor = game.actors.get(getSetting(SETTINGS.DEFAULT_ITEM_PILE_ACTOR_ID));\r\n }\r\n if (!tokenActor) {\r\n deletions.push(token.id);\r\n continue;\r\n }\r\n\r\n const update = {\r\n _id: token.id,\r\n actorLink: false,\r\n actorId: tokenActor.id,\r\n [CONSTANTS.ACTOR_DELTA_PROPERTY]: {\r\n items: []\r\n },\r\n ...flagData\r\n }\r\n\r\n for (let itemData of token[CONSTANTS.ACTOR_DELTA_PROPERTY]?.items ?? []) {\r\n const item = await Item.implementation.create(itemData, { temporary: true });\r\n update[CONSTANTS.ACTOR_DELTA_PROPERTY].items.push(item.toObject());\r\n }\r\n\r\n updates.push(update);\r\n\r\n await token.update({\r\n actorLink: true\r\n });\r\n }\r\n\r\n await scene.updateEmbeddedDocuments(\"Token\", updates);\r\n await scene.deleteEmbeddedDocuments(\"Token\", deletions);\r\n\r\n console.log(`Item Piles | Fixing ${updates.length} tokens on scene \"${sceneId}\" to version ${version}...`);\r\n\r\n }\r\n\r\n if (invalidTokensOnScenes.length && invalidTokensOnScenes.some(([sceneId]) => sceneId === game.user.viewedScene)) {\r\n ui.notifications.notify(\"Item Piles | Attempted to fix some broken tokens on various scenes. If the current scene fails to load, please refresh.\")\r\n }\r\n },\r\n\r\n \"2.4.17\": async (version) => {\r\n\r\n const items = filterValidItems(game.items, version);\r\n\r\n const itemUpdates = items.map(item => {\r\n const flags = getProperty(item, CONSTANTS.FLAGS.ITEM);\r\n flags.infiniteQuantity = \"default\";\r\n return PileUtilities.updateItemData(item, { flags }, { version, returnUpdate: true });\r\n });\r\n\r\n if (itemUpdates.length) {\r\n console.log(`Item Piles | Migrating ${itemUpdates.length} items to version ${version}...`);\r\n await Item.updateDocuments(itemUpdates);\r\n }\r\n\r\n const actors = getItemPileActorsOfLowerVersion(version);\r\n\r\n const actorItemUpdates = actors.map(actor => {\r\n\r\n const itemPileItems = getActorValidItems(actor, version)\r\n\r\n return {\r\n actor,\r\n items: itemPileItems.map(item => {\r\n const flags = getProperty(item, CONSTANTS.FLAGS.ITEM);\r\n flags.infiniteQuantity = \"default\";\r\n return PileUtilities.updateItemData(item, { flags }, { version, returnUpdate: true });\r\n })\r\n }\r\n\r\n }).filter(update => update.items.length);\r\n\r\n if (actorItemUpdates.length) {\r\n console.log(`Item Piles | Migrating ${actorItemUpdates.length} item pile actors' items to version ${version}...`)\r\n }\r\n\r\n for (const { actor, items } of actorItemUpdates) {\r\n await actor.updateEmbeddedDocuments(\"Item\", items);\r\n }\r\n\r\n const { validTokensOnScenes } = getItemPileTokensOfLowerVersion(version);\r\n\r\n for (const [sceneId, tokens] of validTokensOnScenes) {\r\n\r\n const updates = tokens.map(token => {\r\n const itemPileItems = getActorValidItems(token.actor, version);\r\n return {\r\n token,\r\n update: {\r\n [CONSTANTS.FLAGS.VERSION]: version\r\n },\r\n items: itemPileItems.map(item => {\r\n const flags = PileUtilities.getItemFlagData(item);\r\n flags.infiniteQuantity = \"default\";\r\n return PileUtilities.updateItemData(item, { flags }, { version, returnUpdate: true });\r\n })\r\n }\r\n });\r\n\r\n console.log(`Item Piles | Migrating ${updates.length} tokens on scene \"${sceneId}\" to version ${version}...`);\r\n\r\n for (const { token, update, items } of updates) {\r\n await token.update(update);\r\n await token.actor.updateEmbeddedDocuments(\"Item\", items)\r\n }\r\n\r\n }\r\n\r\n },\r\n\r\n \"2.6.1\": async (version) => {\r\n\r\n const actors = getItemPileActorsOfLowerVersion(version);\r\n\r\n const actorUpdates = actors.map(a => {\r\n const flags = getProperty(a, CONSTANTS.FLAGS.PILE);\r\n if (flags?.itemTypePriceModifiers) {\r\n flags.itemTypePriceModifiers = flags.itemTypePriceModifiers.map(priceModifier => {\r\n const custom = Object.keys(CONFIG.Item.typeLabels).indexOf(priceModifier.type) === -1;\r\n priceModifier.category = custom ? priceModifier.type : \"\";\r\n priceModifier.type = custom ? \"custom\" : priceModifier.type;\r\n return priceModifier;\r\n })\r\n }\r\n const flagData = {\r\n [CONSTANTS.FLAGS.PILE]: flags,\r\n [CONSTANTS.FLAGS.VERSION]: version\r\n }\r\n if (a.actorLink) {\r\n flagData[\"token\"] = foundry.utils.deepClone(flagData);\r\n }\r\n return {\r\n _id: a.id,\r\n ...flagData\r\n };\r\n });\r\n\r\n if (actorUpdates.length) {\r\n console.log(`Item Piles | Migrating ${actorUpdates.length} actors to version ${version}...`)\r\n }\r\n\r\n await Actor.updateDocuments(actorUpdates);\r\n\r\n const { validTokensOnScenes } = getItemPileTokensOfLowerVersion(version);\r\n\r\n for (const [sceneId, tokens] of validTokensOnScenes) {\r\n const scene = game.scenes.get(sceneId)\r\n const updates = [];\r\n for (const token of tokens) {\r\n const flags = getProperty(token, CONSTANTS.FLAGS.PILE);\r\n if (flags?.itemTypePriceModifiers) {\r\n flags.itemTypePriceModifiers = flags.itemTypePriceModifiers.map(priceModifier => {\r\n const custom = Object.keys(CONFIG.Item.typeLabels).indexOf(priceModifier.type) === -1;\r\n priceModifier.category = custom ? priceModifier.type : \"\";\r\n priceModifier.type = custom ? \"custom\" : priceModifier.type;\r\n return priceModifier;\r\n })\r\n }\r\n const flagData = {\r\n [CONSTANTS.FLAGS.PILE]: flags,\r\n [CONSTANTS.FLAGS.VERSION]: version,\r\n }\r\n updates.push({\r\n _id: token.id,\r\n ...flagData\r\n });\r\n }\r\n console.log(`Item Piles | Migrating ${updates.length} tokens on scene \"${sceneId}\" to version ${version}...`);\r\n await scene.updateEmbeddedDocuments(\"Token\", updates);\r\n }\r\n\r\n },\r\n\r\n \"2.7.5\": async (version) => {\r\n\r\n const actors = getItemPileActorsOfLowerVersion(version);\r\n\r\n const recursivelyAddItemsToCompendium = async (itemData) => {\r\n const flagData = PileUtilities.getItemFlagData(itemData);\r\n for (const priceGroup of flagData?.prices ?? []) {\r\n for (const price of priceGroup) {\r\n if (price.type !== \"item\" || !price.data.item) continue;\r\n const compendiumItemUuid = (await recursivelyAddItemsToCompendium(price.data.item).uuid);\r\n price.data = { uuid: compendiumItemUuid };\r\n }\r\n }\r\n setProperty(itemData, CONSTANTS.FLAGS.ITEM, PileUtilities.cleanItemFlagData(flagData, { addRemoveFlag: true }));\r\n return findOrCreateItemInCompendium(itemData);\r\n }\r\n\r\n const getActorItemUpdates = async (actorItems) => {\r\n const items = actorItems.filter(item => PileUtilities.getItemFlagData(item).prices.length);\r\n const updates = [];\r\n for (const item of items) {\r\n const flagData = PileUtilities.getItemFlagData(item);\r\n let update = false;\r\n if (!flagData.prices.length) continue;\r\n for (const priceGroup of flagData.prices) {\r\n for (const price of priceGroup) {\r\n if (price.type !== \"item\" || !price.data.item) continue;\r\n const compendiumItem = await recursivelyAddItemsToCompendium(price.data.item);\r\n price.data = { uuid: compendiumItem.uuid };\r\n update = true;\r\n }\r\n }\r\n if (update) {\r\n updates.push({\r\n _id: item.id,\r\n [CONSTANTS.FLAGS.VERSION]: version,\r\n [CONSTANTS.FLAGS.ITEM]: PileUtilities.cleanItemFlagData(flagData)\r\n })\r\n }\r\n }\r\n return updates;\r\n }\r\n\r\n const updates = await getActorItemUpdates(filterValidItems(game.items, version));\r\n if (updates.length) {\r\n console.log(`Item Piles | Migrating ${updates.length} items to version ${version}...`);\r\n await Item.updateDocuments(updates);\r\n }\r\n\r\n let updatedActors = 0;\r\n for (const actor of actors) {\r\n const items = getActorValidItems(actor, version);\r\n const updates = await getActorItemUpdates(items);\r\n if (updates.length) {\r\n await actor.updateEmbeddedDocuments(\"Item\", updates);\r\n updatedActors++;\r\n }\r\n }\r\n if (updatedActors) {\r\n console.log(`Item Piles | Migrating ${updatedActors} actors with out of date items to version ${version}...`);\r\n }\r\n\r\n const { validTokensOnScenes } = getItemPileTokensOfLowerVersion(version);\r\n\r\n for (const [sceneId, tokens] of validTokensOnScenes) {\r\n let updatedTokens = 0;\r\n for (const token of tokens) {\r\n const items = getActorValidItems(token.actor, version);\r\n const updates = await getActorItemUpdates(items);\r\n if (updates.length) {\r\n updatedTokens++;\r\n await token.actor.updateEmbeddedDocuments(\"Item\", updates);\r\n }\r\n }\r\n console.log(`Item Piles | Migrating ${updatedTokens} tokens on scene \"${sceneId}\" to version ${version}...`);\r\n }\r\n\r\n }\r\n\r\n};\r\n","import \"./styles/styles.scss\";\n\nimport CONSTANTS from \"./constants/constants.js\";\nimport registerUIOverrides from \"./foundry-ui-overrides.js\";\nimport registerLibwrappers from \"./libwrapper.js\";\nimport {\n applyShims,\n applySystemSpecificStyles,\n checkSystem,\n patchCurrencySettings,\n registerSettings\n} from \"./settings.js\";\nimport { registerHotkeysPost, registerHotkeysPre } from \"./hotkeys.js\";\nimport Socket from \"./socket.js\";\nimport API from \"./API/api.js\";\nimport TradeAPI from \"./API/trade-api.js\";\nimport ChatAPI from \"./API/chat-api.js\";\nimport PrivateAPI from \"./API/private-api.js\";\nimport * as Helpers from \"./helpers/helpers.js\";\nimport runMigrations from \"./migrations.js\"\n\nimport ItemPileConfig from \"./applications/item-pile-config/item-pile-config.js\";\nimport ItemEditor from \"./applications/item-editor/item-editor.js\";\nimport { setupPlugins } from \"./plugins/main.js\";\nimport { setupCaches } from \"./helpers/caches.js\";\nimport { initializeCompendiumCache } from \"./helpers/compendium-utilities.js\";\n\nHooks.once(\"init\", async () => {\n registerSettings();\n registerHotkeysPre();\n registerLibwrappers();\n registerUIOverrides();\n setupCaches();\n applyShims();\n setupPlugins(\"init\");\n});\n\nHooks.once(\"ready\", () => {\n\n setTimeout(() => {\n\n game.itempiles = {\n API,\n hooks: CONSTANTS.HOOKS,\n flags: CONSTANTS.FLAGS,\n pile_types: CONSTANTS.PILE_TYPES,\n pile_flag_defaults: CONSTANTS.PILE_DEFAULTS,\n item_flag_defaults: CONSTANTS.ITEM_DEFAULTS,\n apps: {\n ItemPileConfig,\n ItemEditor\n }\n };\n window.ItemPiles = {\n API: API\n };\n\n if (game.user.isGM) {\n if (!game.modules.get('lib-wrapper')?.active) {\n let word = \"install and activate\";\n if (game.modules.get('lib-wrapper')) word = \"activate\";\n throw Helpers.custom_error(`Item Piles requires the 'libWrapper' module. Please ${word} it.`)\n }\n\n if (!game.modules.get('socketlib')?.active) {\n let word = \"install and activate\";\n if (game.modules.get('socketlib')) word = \"activate\";\n throw Helpers.custom_error(`Item Piles requires the 'socketlib' module. Please ${word} it.`)\n }\n }\n\n if (!Helpers.isGMConnected()) {\n Helpers.custom_warning(game.i18n.localize(\"ITEM-PILES.Warnings.NoGMsConnected\"), true)\n }\n\n Socket.initialize();\n PrivateAPI.initialize();\n TradeAPI.initialize();\n ChatAPI.initialize();\n\n registerHotkeysPost();\n initializeCompendiumCache();\n setupPlugins(\"ready\");\n\n ChatAPI.disablePastTradingButtons();\n\n Hooks.callAll(CONSTANTS.HOOKS.READY);\n\n }, 100);\n\n});\n\nHooks.once(CONSTANTS.HOOKS.READY, async () => {\n setTimeout(async () => {\n if (game.user.isGM) {\n await checkSystem();\n await patchCurrencySettings();\n await runMigrations();\n }\n // game.itempiles.API.renderItemPileInterface(game.actors.getName(\"Merchant\"));\n // new SettingsShim().render(true);\n applySystemSpecificStyles();\n }, 500);\n});\n\nHooks.on(CONSTANTS.HOOKS.RESET_SETTINGS, async () => {\n for (let setting of game.settings.storage.get(\"world\").filter(setting => setting.key.includes('item-piles'))) {\n await setting.delete();\n }\n checkSystem();\n})\n"],"names":["now","loop","data","element","text","hash","next","tick","wait","detach","init","create_each_block","insert","update","index","instance","create_fragment","debug","promise","document","children","writable","subscribe","run","storage","readable","writable$2","get","derived","constants.animateKeys","constants.relativeRegex","lerp","duration","ease","interpolate","options","linear","constants.transformOriginDefault","constants.transformKeysBitwise","constants.transformKeys","s_VALIDATION_DATA","constants.transformOrigins","parent","constants.numericDefaults","constants.setNumericDefaults","draggable","s_STYLE_KEY","cssVariables","styles","active","ctx","create_if_block","s_REGEX_HTML","booleanStore","dragDefault","storeResizing","create_if_block_1","preventDefault","autoClose","version","create_if_block_4","create_if_block_2","create_if_block_3","create_if_block_6","create_if_block_5","Helpers.custom_error","Utilities.findSimilarItem","Helpers.custom_notify","SETTINGS","CurrenciesEditorShell","ItemFiltersShell","StringListEditorShell","PriceModifiersEditorShell","draggedEl","resetScrolling","scrollIfNeeded","INTERVAL_MS","DEFAULT_DROP_ZONE_TYPE","DEFAULT_DROP_TARGET_STYLE","typeToDropZones","dzToConfig","registerDropZone","unregisterDropZone","handleDrop","dndzone","INSTRUCTION_IDs","pointerDndZone","keyboardDndZone","flipDurationMs","Utilities.getUuid","Utilities.getActor","PileUtilities.isValidItemPile","PileUtilities.getActorFlagData","Utilities.getUserCharacter","PileUtilities.getActorItems","PileUtilities.getActorCurrencies","Utilities.setItemQuantity","PileUtilities.isItemPileEmpty","sharingData","Utilities.setSimilarityProperties","Utilities.getItemQuantity","canItemStack","PileUtilities.canItemStack","DropItemDialogShell","PileUtilities.isItemCurrency","item","PileUtilities.getItemPileActors","PileUtilities.getItemPileTokens","PileUtilities.rollMerchantTables","PileUtilities.getItemFlagData","previousState","SharingUtilities.getItemSharesLeftForActor","Utilities.hasItemQuantity","PileUtilities.getItemCurrencyData","Helpers.getModuleVersion","SharingUtilities.getAttributeSharesLeftForActor","func","func_2","PileUtilities.getCurrencyList","existingCurrency","DropCurrencyDialogShell","SharingUtilities.getItemPileSharingData","PileUtilities.isItemPileMerchant","PileUtilities.isItemInvalid","pileItem","SharingUtilities.updateItemPileSharingData","create_if_block_10","create_if_block_9","create_if_block_8","SharingUtilities.getPlayersForItemPile","Helpers.custom_warning","PileUtilities.isItemPileContainer","SharingUtilities.canItemPileBeSplit","dispatch","Plugins","content","click_handler_3","i","PileUtilities.getPaymentData","TradeMerchantItemDialogShell","quantityForPriceProp","Helpers.setSetting","Helpers.getSetting","PileUtilities.updateItemData","ItemEditorShell","PileUtilities.updateItemPileData","PileUtilities.getPriceData","TextEditorDialogShell","create_if_block_7","tables","Helpers.abbreviateNumbers","PileUtilities.checkItemType","UserSelectDialogShell","MerchantAppShell","Helpers.hooks","Helpers.getActiveApps","Helpers.styleFromObject","PileUtilities.getActorVaultLog","PileUtilities.getVaultAccess","PileUtilities.getVaultGridData","helpers.debug","_","Utilities.areItemsDifferent","VaultAccessEditorShell","clearVaultLog","PileUtilities.clearVaultLog","Helpers.timeSince","Helpers.getCanvasMouse","Helpers.getApplicationPositions","func_1","VaultShell","ItemTypePriceModifiersShell","MerchantColumnsEditorShell","SharingUtilities.clearItemPileSharingData","Helpers.getFiles","ItemPileConfigShell","ItemPileInventoryShell","canvas","Helpers.random_array_element","PileUtilities.cleanFlagData","PileUtilities.getItemPileTokenScale","PileUtilities.getItemPileTokenImage","PileUtilities.getItemPileName","cleanFlagData","PileUtilities.isItemPileVault","PileUtilities.updateVaultLog","PileUtilities.shouldItemPileBeDeleted","Utilities.getToken","PileUtilities.isItemPileLootable","SharingUtilities.setItemPileSharingData","PileUtilities.getPriceFromString","sourceIsItemPile","Utilities.createFoldersFromNames","Helpers.wait","Helpers.isFunction","Helpers.isResponsibleGM","PileUtilities.shouldEvaluateChange","Helpers.debounceManager","Utilities.getDocument","Helpers.debug","target","Utilities.runMacro","Utilities.getSourceActorFromDropData","Utilities.getTokensAtLocation","user","Helpers.getActiveGMs","Utilities.distance_between_rect","GiveItemsShell","Helpers.isGMConnected","Utilities.tokens_close_enough","Utilities.grids_between_tokens","BankVaultApp","PileUtilities.rollTable","token","Utilities.getItemTypesThatCanStack","Helpers.roundToDecimals","cost","Utilities.getItemCost","CompendiumUtilities.getItemFromCache","payment","currency","rollData","CompendiumUtilities.findOrCreateItemInCompendium","PricePresetEditorShell","UnstackableItemTypesEditorShell","StylesEditorShell","VaultStylesEditorShell","helpers.getSetting","helpers.setSetting","SettingsShell","actor","TradeDialogPrompt","TradeDialogRequest","previewItem","TradingAppShell","message","PileUtilities.getPriceArray","html","PileUtilities.getActorPrimaryCurrency","Helpers.isRealNumber","hookResult","PileUtilities.isItemPileLocked","PileUtilities.isItemPileClosed","PileUtilities.getMerchantModifiersForActor","rollTable","PileUtilities.migrateFlagData","items","PileUtilities.cleanItemFlagData","updates","Socket","setting"],"mappings":";;;AAAA,MAAM,cAAc;AACpB,MAAM,cAAc,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AU;AAAA,MAC7F;AAED,UAAI,CAAC,KAAK,QAAQ,IAAI,WAAW,GAAG,QAAQ;AAC1C,YAAI,OAAO;AACX,YAAI,KAAK,QAAQ,IAAI,WAAW;AAAG,iBAAO;AAC1C,cAAMA,aAAqB,sDAAsD,UAAU;AAAA,MAC5F;AAAA,IACF;AAED,QAAI,CAAC+I,cAAqB,GAAI;AAC5B9E,qBAAuB,KAAK,KAAK,SAAS,oCAAoC,GAAG,IAAI;AAAA,IACtF;AAEDuH,mBAAO,WAAU;AACjB,eAAW,WAAU;AACrB,aAAS,WAAU;AACnB,YAAQ,WAAU;AAElB;AACA;AACA,iBAAa,OAAO;AAEpB,YAAQ,0BAAyB;AAEjC,UAAM,QAAQ,UAAU,MAAM,KAAK;AAAA,EAEpC,GAAE,GAAG;AAER,CAAC;AAED,MAAM,KAAK,UAAU,MAAM,OAAO,YAAY;AAC5C,aAAW,YAAY;AACrB,QAAI,KAAK,KAAK,MAAM;AAClB,YAAM,YAAW;AACjB,YAAM,sBAAqB;AAC3B,YAAM,cAAa;AAAA,IACpB;AAGD;EACD,GAAE,GAAG;AACR,CAAC;AAED,MAAM,GAAG,UAAU,MAAM,gBAAgB,YAAY;AACnD,WAAS,WAAW,KAAK,SAAS,QAAQ,IAAI,OAAO,EAAE,OAAO,CAAAC,aAAWA,SAAQ,IAAI,SAAS,YAAY,CAAC,GAAG;AAC5G,UAAM,QAAQ;EACf;AACD;AACF,CAAC;","x_google_ignoreList":[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,141,142,143,144,145,146,147,148,179,231]}
|