import BaseAmbientLight from"../../../common/documents/ambient-light.mjs";import ServerDocumentMixin from"../backend/server-document.mjs";import{getType}from"../../../common/utils/helpers.mjs";export default class AmbientLight extends(ServerDocumentMixin(BaseAmbientLight)){static _migrationRegistry=[...super._migrationRegistry,{fn:migrateFieldNameChanges,version:12},{fn:migrateNegativeRadius,version:12},{fn:migrateGradualToAttenuation,version:12},{fn:migrateZeroAngle,version:12},{fn:migrateSourceTypeFlags,version:12},{fn:migrateNegativeLuminosity,version:"12.319"}]}function migrateFieldNameChanges(i){let e=!1;const t={darknessThreshold:"darkness.min",dim:"config.dim",bright:"config.bright",angle:"config.angle",tintColor:"config.color",tintAlpha:"config.alpha",lightAnimation:"config.animation",darkness:"config.darkness"};for(const[n,o]of Object.entries(t)){const t=AmbientLight._addDataFieldMigration(i,n,o);e||=t}return e}function migrateSourceTypeFlags(i){return"t"in i&&("walls"in i||(i.walls="u"!==i.t),"vision"in i||(i.vision="l"!==i.t),delete i.t,!0)}function migrateNegativeRadius(i){const e=i.config;if("Object"!==getType(e))return!1;let t=!1;return e.dim<0&&(e.dim=Math.abs(e.dim),t=!0),e.bright<0&&(e.bright=Math.abs(e.bright),t=!0),!!t&&(e.luminosity=-1*Math.abs(e.luminosity??.5),!0)}function migrateGradualToAttenuation(i){const e=i.config;return"Object"===getType(e)&&("gradual"in e&&(e.attenuation=e.gradual?.5:.3,delete e.gradual,!0))}function migrateZeroAngle(i){return"Object"===getType(i.config)&&(0===i.config.angle&&(i.config.angle=360,!0))}function migrateNegativeLuminosity(i){const e=i.config;return"Object"===getType(e)&&(e.luminosity<0&&(e.luminosity=.5,e.negative=!0,!0))}