{"version":3,"file":"LabelDictionary.js","names":["defineDs","LabelsDictionary","labels","getLabel","labelKey","replacementKeys","arguments","length","undefined","console","warn","DS","Config","ENV","concat","labelKeyParts","split","label","forEach","part","Object","keys","key","includes","replace"],"sources":["Shared/Framework/Mithril/Scripts/Helpers/LabelDictionary.js"],"sourcesContent":["defineDs('Shared/Framework/Mithril/Scripts/Helpers/LabelDictionary',\r\n [],\r\n function () {\r\n\r\n // Variables:\r\n const LabelsDictionary = function (labels) {\r\n const getLabel = (labelKey, replacementKeys = {}) => {\r\n if (!labels) {\r\n console.warn('Labels not found in settings');\r\n if (DS.Config.ENV === 'dev') {\r\n return `!${labelKey}!`;\r\n }\r\n return '';\r\n }\r\n const labelKeyParts = labelKey.split('/');\r\n let label = labels;\r\n labelKeyParts.forEach((part) => {\r\n label = label[`${part}`];\r\n });\r\n if (!label) {\r\n console.warn(`Label not found: ${labelKey}`);\r\n return '';\r\n }\r\n Object.keys(replacementKeys).forEach((key) => {\r\n // Trigger a warning if the replacement key is not found in the label and the key is a required key (indicated by a '!' at the beginning of the key)\r\n if (!label.includes(`{${key}}`) && key.includes('!')) {\r\n console.warn(`Replacement key not found in label: ${key} in ${labelKey}`);\r\n }\r\n label = label.replace(`{${key}}`, replacementKeys[key]);\r\n });\r\n return label;\r\n };\r\n\r\n return { getLabel };\r\n };\r\n\r\n return LabelsDictionary;\r\n });\r\n"],"mappings":"AAAAA,QAAQ,CAAC,0DAA0D,EACjE,EAAE,EACF,YAAY;EAEV;EACA,IAAMC,gBAAgB,GAAG,SAAAA,CAAUC,MAAM,EAAE;IACzC,IAAMC,QAAQ,GAAG,SAAAA,CAACC,QAAQ,EAA2B;MAAA,IAAzBC,eAAe,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;MAC9C,IAAI,CAACJ,MAAM,EAAE;QACXO,OAAO,CAACC,IAAI,CAAC,8BAA8B,CAAC;QAC5C,IAAIC,EAA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