ssml-builder-js 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/{chunk-NPZ44CHU.mjs → chunk-I3BR2WCQ.mjs} +1 -1
- package/dist/chunk-I3BR2WCQ.mjs.map +1 -0
- package/dist/{chunk-PSN6XAFF.mjs → chunk-RUIEMCWP.mjs} +455 -2
- package/dist/chunk-RUIEMCWP.mjs.map +1 -0
- package/dist/core.d.mts +22 -1
- package/dist/core.d.ts +22 -1
- package/dist/core.js +456 -0
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +7 -1
- package/dist/elements.js.map +1 -1
- package/dist/elements.mjs +1 -1
- package/dist/index.d.mts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +460 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -4
- package/dist/index.mjs.map +1 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -1
- package/package.json +10 -1
- package/dist/chunk-NPZ44CHU.mjs.map +0 -1
- package/dist/chunk-PSN6XAFF.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../packages/ssml-editor-react/src/locales.ts","../packages/ssml-editor-react/src/ssmlContext.ts","../packages/ssml-editor-react/src/constants/ssmlPresets.ts","../packages/ssml-editor-react/src/constants/ui.ts","../packages/ssml-core/src/constants/ssml.ts","../packages/ssml-core/src/builder.ts","../packages/ssml-core/src/parser.ts","../packages/ssml-core/src/partial.ts","../packages/ssml-core/src/validation.ts","../packages/ssml-core/src/textNodes.ts","../packages/ssml-core/src/azureValidation.ts","../packages/ssml-editor-react/src/clearSsmlDocument.ts","../packages/ssml-editor-react/src/formatXml.ts","../packages/ssml-editor-react/src/editableSsml.ts","../packages/ssml-editor-react/src/ssmlInsertion.ts","../packages/ssml-editor-react/src/ssmlCompletion.ts","../packages/ssml-editor-react/src/ssmlHover.ts"],"sourcesContent":["export type SsmlEditorLocale = \"ja\" | \"en\";\nexport type SsmlEditorLanguage = SsmlEditorLocale;\nexport type SsmlEditorLocalizedText = Readonly<Record<SsmlEditorLocale, string>>;\n\nexport interface EditorCopy {\n editorAriaLabel: string;\n toolbarAriaLabel: string;\n undo: string;\n undoTitle: string;\n redo: string;\n redoTitle: string;\n clearAll: string;\n clearAllTitle: string;\n help: string;\n helpTitle: string;\n helpHeading: string;\n helpDescription: string;\n parameters: string;\n format: string;\n formatTitle: string;\n decorations: string;\n decorationsShowTitle: string;\n decorationsHideTitle: string;\n syntaxError: string;\n selectionActions: string;\n selectionCountSuffix: string;\n previewSelection: string;\n previewSelectionTitle: string;\n noAvailableOptions: string;\n styleNotSupported: string;\n categoryEmotions: string;\n categoryScenarios: string;\n categoryMedia: string;\n categoryOther: string;\n}\n\nexport interface InlineBadgeCopy {\n pause: string;\n pitch: string;\n prosody: string;\n}\n\nexport interface SsmlHoverParameterCopy {\n title: string;\n description: string;\n}\n\nexport interface SsmlHoverTagCopy {\n title: string;\n description: string;\n parameters: Readonly<Record<string, SsmlHoverParameterCopy>>;\n}\n\nexport interface SsmlHoverLocale {\n parameterHeading: string;\n parametersHeading: string;\n allowedValues: string;\n example: string;\n noParameters: string;\n tags: Readonly<Record<string, SsmlHoverTagCopy>>;\n}\n\nexport const EDITOR_COPY: Readonly<Record<SsmlEditorLocale, EditorCopy>> = {\n ja: {\n editorAriaLabel: \"SSMLエディター\",\n toolbarAriaLabel: \"SSMLツールバー\",\n clearAll: \"全てクリア\",\n clearAllTitle: \"音声設定を保持してXML要素を削除し本文を残す\",\n undo: \"元に戻す\",\n undoTitle: \"直前の変更を元に戻す\",\n redo: \"やり直す\",\n redoTitle: \"元に戻した変更をやり直す\",\n help: \"説明\",\n helpTitle: \"ボタンとパラメータの説明を表示\",\n helpHeading: \"ボタンとパラメータの説明\",\n helpDescription: \"各コントロールの機能とパラメータを確認できます。\",\n parameters: \"パラメータ\",\n format: \"フォーマット\",\n formatTitle: \"本文のXMLを改行して見やすく表示\",\n decorations: \"装飾\",\n decorationsShowTitle: \"インライン装飾を表示\",\n decorationsHideTitle: \"インライン装飾を非表示\",\n syntaxError: \"構文エラー\",\n selectionActions: \"選択範囲の操作\",\n selectionCountSuffix: \"文字\",\n previewSelection: \"選択部分を試聴\",\n previewSelectionTitle: \"選択部分のSSMLを試聴\",\n noAvailableOptions: \"利用可能な選択肢がありません。\",\n styleNotSupported: \"この音声はスタイル指定に対応していません\",\n categoryEmotions: \"感情・トーン\",\n categoryScenarios: \"会話・シナリオ\",\n categoryMedia: \"メディア・ナレーション\",\n categoryOther: \"その他\",\n },\n en: {\n editorAriaLabel: \"SSML editor\",\n toolbarAriaLabel: \"SSML toolbar\",\n clearAll: \"Clear all\",\n clearAllTitle: \"Remove non-voice XML elements and keep the text and voice settings\",\n undo: \"Undo\",\n undoTitle: \"Undo the last change\",\n redo: \"Redo\",\n redoTitle: \"Redo the last undone change\",\n help: \"Help\",\n helpTitle: \"Show button and parameter descriptions\",\n helpHeading: \"Button and parameter descriptions\",\n helpDescription: \"Review what each control does and its parameters.\",\n parameters: \"Parameters\",\n format: \"Format\",\n formatTitle: \"Format the XML in the editor\",\n decorations: \"Decorations\",\n decorationsShowTitle: \"Show inline decorations\",\n decorationsHideTitle: \"Hide inline decorations\",\n syntaxError: \"Syntax error\",\n selectionActions: \"Selection actions\",\n selectionCountSuffix: \" characters\",\n previewSelection: \"Preview selection\",\n previewSelectionTitle: \"Preview the selected SSML\",\n noAvailableOptions: \"No options are available.\",\n styleNotSupported: \"This voice does not support style selection.\",\n categoryEmotions: \"Emotions / Tone\",\n categoryScenarios: \"Conversations / Scenarios\",\n categoryMedia: \"Media / Broadcast\",\n categoryOther: \"Other\",\n },\n};\n\nexport const INLINE_BADGE_COPY: Readonly<Record<SsmlEditorLocale, InlineBadgeCopy>> = {\n ja: {\n pause: \"間\",\n pitch: \"ピッチ変化\",\n prosody: \"声の調整\",\n },\n en: {\n pause: \"Pause\",\n pitch: \"Pitch change\",\n prosody: \"Prosody\",\n },\n};\n\nexport const SSML_HOVER_COPY: Readonly<Record<SsmlEditorLocale, SsmlHoverLocale>> = {\n ja: {\n parameterHeading: \"パラメータ\",\n parametersHeading: \"パラメータ\",\n allowedValues: \"使用できる値\",\n example: \"例\",\n noParameters: \"この要素にパラメータはありません。\",\n tags: {\n voice: {\n title: \"音声\",\n description: \"囲まれたテキストの合成に使用する音声と、任意の音声効果を選択します。\",\n parameters: {\n name: { title: \"name\", description: \"音声名。例: `en-US-JennyNeural`。\" },\n effect: { title: \"effect\", description: \"任意の音声効果。例: `eq_car`。\" },\n },\n },\n prosody: {\n title: \"韻律\",\n description: \"囲まれたテキストの速度、ピッチ、音量、またはピッチ曲線を変更します。\",\n parameters: {\n rate: { title: \"rate\", description: \"発話速度を指定します。\" },\n pitch: { title: \"pitch\", description: \"名前付きの値、割合、周波数、または半音でピッチを調整します。\" },\n volume: { title: \"volume\", description: \"名前付きの値、割合、またはデシベル値で音量を指定します。\" },\n contour: { title: \"contour\", description: \"テキスト内の位置ごとの相対的なピッチ変化を定義します。\" },\n range: { title: \"range\", description: \"音声のピッチ範囲を調整します。\" },\n },\n },\n break: {\n title: \"間\",\n description: \"単語やその他の音声コンテンツの間にポーズを挿入します。\",\n parameters: {\n time: { title: \"time\", description: \"ポーズの長さ。例: `500ms` または `1s`。\" },\n strength: { title: \"strength\", description: \"相対的なポーズの強さ。\" },\n },\n },\n \"mstts:express-as\": {\n title: \"表現\",\n description: \"囲まれたテキストに音声スタイル、スタイルの強さ、または役割を適用します。\",\n parameters: {\n style: { title: \"style\", description: \"選択した音声が対応する音声スタイル。例: `cheerful`。\" },\n styledegree: { title: \"styledegree\", description: \"選択した音声スタイルの強さを指定します。\" },\n role: { title: \"role\", description: \"対応している場合に音声の役割を変更します。\" },\n },\n },\n \"say-as\": {\n title: \"読み上げ方\",\n description: \"囲まれたテキストの解釈方法と読み上げ方を指定します。\",\n parameters: {\n \"interpret-as\": { title: \"interpret-as\", description: \"文字、数字、日付、時刻などの解釈を指定します。\" },\n format: { title: \"format\", description: \"選択した解釈の形式を補足します。\" },\n detail: { title: \"detail\", description: \"選択した解釈の詳細を補足します。\" },\n },\n },\n phoneme: {\n title: \"音素\",\n description: \"指定した音素表記で通常の発音を置き換えます。\",\n parameters: {\n alphabet: { title: \"alphabet\", description: \"`ph` 値に使用する音素アルファベット。\" },\n ph: { title: \"ph\", description: \"囲まれたテキストの音素表記。\" },\n },\n },\n emphasis: {\n title: \"強調\",\n description: \"囲まれたテキストを強調します。\",\n parameters: {\n level: { title: \"level\", description: \"強調の度合いを指定します。\" },\n },\n },\n audio: {\n title: \"音声ファイル\",\n description: \"合成結果の一部として音声ファイルを再生します。\",\n parameters: {\n src: { title: \"src\", description: \"音声ファイルの URI。\" },\n desc: { title: \"desc\", description: \"音声を再生できない場合に使用する代替テキスト。\" },\n clipBegin: { title: \"clipBegin\", description: \"音声ファイル内の開始位置。例: `0s`。\" },\n clipEnd: { title: \"clipEnd\", description: \"音声ファイル内の終了位置。例: `5s`。\" },\n speed: { title: \"speed\", description: \"音声ファイルの再生速度。例: `1.0`。\" },\n repeatCount: { title: \"repeatCount\", description: \"音声を繰り返す回数。例: `2`。\" },\n repeatDuration: { title: \"repeatDuration\", description: \"音声を繰り返す合計時間。例: `10s`。\" },\n soundLevel: { title: \"soundLevel\", description: \"デシベル単位の音量調整。例: `-3dB`。\" },\n },\n },\n sub: {\n title: \"置換\",\n description: \"囲まれたテキストの代わりに別名テキストを読み上げます。\",\n parameters: {\n alias: { title: \"alias\", description: \"元のテキストの代わりに読み上げるテキスト。例: `World Wide Web`。\" },\n },\n },\n lang: {\n title: \"言語\",\n description: \"囲まれたテキストの読み上げ言語を変更します。\",\n parameters: {\n \"xml:lang\": { title: \"xml:lang\", description: \"BCP-47 言語タグ。例: `ja-JP`。\" },\n },\n },\n mark: {\n title: \"マーカー\",\n description: \"合成音声ストリームにカスタムマーカーを挿入します。\",\n parameters: {\n name: { title: \"name\", description: \"アプリケーションで定義したマーカー名。例: `chapter-1`。\" },\n },\n },\n bookmark: {\n title: \"ブックマーク\",\n description: \"合成音声ストリームにブックマークマーカーを挿入します。\",\n parameters: {\n mark: { title: \"mark\", description: \"アプリケーションで定義したブックマーク名。例: `chapter-1`。\" },\n },\n },\n lexicon: {\n title: \"発音辞書\",\n description: \"合成文書に発音辞書を関連付けます。\",\n parameters: {\n uri: { title: \"uri\", description: \"発音辞書の URI。\" },\n },\n },\n p: { title: \"段落\", description: \"テキストを段落としてまとめます。\", parameters: {} },\n s: { title: \"文\", description: \"テキストを文としてまとめます。\", parameters: {} },\n w: { title: \"単語\", description: \"テキストを単語としてまとめます。\", parameters: {} },\n \"mstts:silence\": {\n title: \"無音\",\n description: \"テキストの前後、または句読点の境界に指定した無音を追加します。\",\n parameters: {\n type: { title: \"type\", description: \"無音の位置または句読点の境界。\" },\n value: { title: \"value\", description: \"無音の長さ。例: `300ms`。\" },\n },\n },\n \"mstts:viseme\": {\n title: \"ビゼーム\",\n description: \"合成音声のビゼームイベントを要求します。\",\n parameters: {\n type: { title: \"type\", description: \"ビゼームイベントの形式。\" },\n },\n },\n },\n },\n en: {\n parameterHeading: \"Parameter\",\n parametersHeading: \"Parameters\",\n allowedValues: \"Allowed values\",\n example: \"Example\",\n noParameters: \"This element has no parameters.\",\n tags: {\n voice: {\n title: \"Voice\",\n description: \"Selects the voice and optional voice effect used to synthesize the enclosed text.\",\n parameters: {\n name: { title: \"name\", description: \"The voice name, such as `en-US-JennyNeural`.\" },\n effect: { title: \"effect\", description: \"An optional voice effect, such as `eq_car`.\" },\n },\n },\n prosody: {\n title: \"Prosody\",\n description: \"Changes the speaking rate, pitch, volume, or pitch contour of the enclosed text.\",\n parameters: {\n rate: { title: \"rate\", description: \"Controls speaking speed.\" },\n pitch: {\n title: \"pitch\",\n description: \"Adjusts pitch using a named value, percentage, frequency, or semitone value.\",\n },\n volume: {\n title: \"volume\",\n description: \"Controls loudness using a named value, percentage, or decibel value.\",\n },\n contour: {\n title: \"contour\",\n description: \"Defines a sequence of relative pitch changes at positions in the text.\",\n },\n range: { title: \"range\", description: \"Adjusts the pitch range of the voice.\" },\n },\n },\n break: {\n title: \"Break\",\n description: \"Inserts a pause between words or other spoken content.\",\n parameters: {\n time: { title: \"time\", description: \"The pause duration, for example `500ms` or `1s`.\" },\n strength: { title: \"strength\", description: \"The relative pause strength.\" },\n },\n },\n \"mstts:express-as\": {\n title: \"Express-as\",\n description: \"Applies a speaking style, style degree, or role to the enclosed text.\",\n parameters: {\n style: {\n title: \"style\",\n description: \"The speaking style supported by the selected voice, such as `cheerful`.\",\n },\n styledegree: { title: \"styledegree\", description: \"Controls the intensity of the selected speaking style.\" },\n role: { title: \"role\", description: \"Changes the speaking role when supported by the selected voice.\" },\n },\n },\n \"say-as\": {\n title: \"Say-as\",\n description: \"Controls how the enclosed text is interpreted and spoken.\",\n parameters: {\n \"interpret-as\": {\n title: \"interpret-as\",\n description: \"Specifies the interpretation, such as characters, digits, date, or time.\",\n },\n format: { title: \"format\", description: \"Provides a format hint for the selected interpretation.\" },\n detail: {\n title: \"detail\",\n description: \"Provides an additional detail hint for the selected interpretation.\",\n },\n },\n },\n phoneme: {\n title: \"Phoneme\",\n description: \"Replaces normal pronunciation with the supplied phonetic pronunciation.\",\n parameters: {\n alphabet: { title: \"alphabet\", description: \"The phonetic alphabet used by the `ph` value.\" },\n ph: { title: \"ph\", description: \"The phonetic pronunciation for the enclosed text.\" },\n },\n },\n emphasis: {\n title: \"Emphasis\",\n description: \"Adds emphasis to the enclosed text.\",\n parameters: {\n level: { title: \"level\", description: \"Controls the amount of emphasis.\" },\n },\n },\n audio: {\n title: \"Audio\",\n description: \"Plays an audio file as part of the synthesized output.\",\n parameters: {\n src: { title: \"src\", description: \"The URI of the audio file.\" },\n desc: { title: \"desc\", description: \"Alternative text to use if the audio cannot be played.\" },\n clipBegin: { title: \"clipBegin\", description: \"The starting offset within the audio file.\" },\n clipEnd: { title: \"clipEnd\", description: \"The ending offset within the audio file.\" },\n speed: { title: \"speed\", description: \"The playback speed of the audio file.\" },\n repeatCount: { title: \"repeatCount\", description: \"The number of times to repeat the audio.\" },\n repeatDuration: {\n title: \"repeatDuration\",\n description: \"The total duration for which the audio may repeat.\",\n },\n soundLevel: { title: \"soundLevel\", description: \"The audio volume adjustment in decibels.\" },\n },\n },\n sub: {\n title: \"Substitution\",\n description: \"Substitutes the alias text when speaking the enclosed text.\",\n parameters: {\n alias: { title: \"alias\", description: \"The text to speak instead of the enclosed text.\" },\n },\n },\n lang: {\n title: \"Language\",\n description: \"Changes the language used for the enclosed text.\",\n parameters: {\n \"xml:lang\": { title: \"xml:lang\", description: \"The BCP-47 language tag.\" },\n },\n },\n mark: {\n title: \"Mark\",\n description: \"Inserts a custom marker into the synthesized audio stream.\",\n parameters: {\n name: { title: \"name\", description: \"The application-defined marker name.\" },\n },\n },\n bookmark: {\n title: \"Bookmark\",\n description: \"Inserts a bookmark marker into the synthesized audio stream.\",\n parameters: {\n mark: { title: \"mark\", description: \"The application-defined bookmark name.\" },\n },\n },\n lexicon: {\n title: \"Lexicon\",\n description: \"Associates a pronunciation lexicon with the synthesized document.\",\n parameters: {\n uri: { title: \"uri\", description: \"The URI of the pronunciation lexicon.\" },\n },\n },\n p: { title: \"Paragraph\", description: \"Groups text into a paragraph.\", parameters: {} },\n s: { title: \"Sentence\", description: \"Groups text into a sentence.\", parameters: {} },\n w: { title: \"Word\", description: \"Groups text into a word.\", parameters: {} },\n \"mstts:silence\": {\n title: \"Silence\",\n description: \"Adds a specified silence before or after text or at a punctuation boundary.\",\n parameters: {\n type: { title: \"type\", description: \"The silence position or punctuation boundary.\" },\n value: { title: \"value\", description: \"The silence duration, for example `300ms`.\" },\n },\n },\n \"mstts:viseme\": {\n title: \"Viseme\",\n description: \"Requests viseme events for the synthesized audio.\",\n parameters: {\n type: { title: \"type\", description: \"The viseme event format.\" },\n },\n },\n },\n },\n};\n","export interface SsmlVoiceContext {\n voiceName?: string;\n}\n\nexport interface SsmlTagRange {\n start: number;\n end: number;\n}\n\ninterface OpenElement {\n name: string;\n voiceName?: string;\n}\n\nfunction findTagEnd(source: string, start: number, limit: number): number {\n let quote: string | undefined;\n for (let index = start + 1; index < limit; index += 1) {\n const character = source[index];\n if (quote !== undefined) {\n if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n if (character === \">\") {\n return index;\n }\n }\n return -1;\n}\n\nfunction getVoiceName(tag: string): string | undefined {\n return tag.match(/\\bname\\s*=\\s*([\"'])([\\s\\S]*?)\\1/i)?.[2];\n}\n\nfunction escapeXmlAttribute(value: string): string {\n return value\n .replace(/&/g, \"&\")\n .replace(/\"/g, \""\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/'/g, \"'\");\n}\n\nexport function updateTagAttribute(\n text: string,\n tagRange: SsmlTagRange,\n attributeName: string,\n newValue: string,\n): string {\n const start = Math.max(0, Math.min(tagRange.start, text.length));\n const end = Math.max(start, Math.min(tagRange.end, text.length));\n const tag = text.slice(start, end);\n const escapedAttributeName = attributeName.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const attributePattern = new RegExp(`(\\\\b${escapedAttributeName}\\\\s*=\\\\s*)([\"'])([\\\\s\\\\S]*?)\\\\2`, \"i\");\n const escapedValue = escapeXmlAttribute(newValue);\n const match = tag.match(attributePattern);\n\n if (match?.index !== undefined) {\n const valueStart = match.index + match[0].indexOf(match[2]) + 1;\n const valueEnd = valueStart + (match[3]?.length ?? 0);\n return `${text.slice(0, start)}${tag.slice(0, valueStart)}${escapedValue}${tag.slice(valueEnd)}${text.slice(end)}`;\n }\n\n const insertionIndex = tag.endsWith(\"/>\") ? tag.length - 2 : tag.length - 1;\n const attribute = ` ${attributeName}=\"${escapedValue}\"`;\n return `${text.slice(0, start)}${tag.slice(0, insertionIndex)}${attribute}${tag.slice(insertionIndex)}${text.slice(end)}`;\n}\n\nfunction closeElement(stack: OpenElement[], name: string): void {\n for (let index = stack.length - 1; index >= 0; index -= 1) {\n if (stack[index]?.name === name) {\n stack.splice(index);\n return;\n }\n }\n}\n\nexport function findActiveSsmlTags(source: string, offset: number): Set<string> {\n const limit = Math.max(0, Math.min(offset, source.length));\n const stack: OpenElement[] = [];\n let index = 0;\n\n while (index < source.length) {\n const tagStart = source.indexOf(\"<\", index);\n if (tagStart === -1 || tagStart > limit) {\n break;\n }\n\n const nonContentEnd = source.startsWith(\"<!--\", tagStart)\n ? source.indexOf(\"-->\", tagStart + 4)\n : source.startsWith(\"<![CDATA[\", tagStart)\n ? source.indexOf(\"]]>\", tagStart + 9)\n : source.startsWith(\"<?\", tagStart)\n ? source.indexOf(\"?>\", tagStart + 2)\n : undefined;\n if (nonContentEnd !== undefined) {\n const delimiterLength = source.startsWith(\"<?\", tagStart) ? 2 : 3;\n const end = nonContentEnd === -1 ? source.length : nonContentEnd + delimiterLength;\n if (limit < end) {\n break;\n }\n index = end;\n continue;\n }\n\n const tagEnd = findTagEnd(source, tagStart, source.length);\n const tag = source.slice(tagStart, tagEnd === -1 ? source.length : tagEnd + 1);\n const closingMatch = tag.match(/^<\\s*\\/\\s*([A-Za-z_][A-Za-z0-9_.:-]*)/);\n const openingMatch = tag.match(/^<\\s*([A-Za-z_][A-Za-z0-9_.:-]*)/);\n\n if (tagEnd === -1 || limit <= tagEnd) {\n if (openingMatch?.[1]) {\n stack.push({ name: openingMatch[1].toLowerCase() });\n }\n break;\n }\n\n if (closingMatch?.[1]) {\n closeElement(stack, closingMatch[1].toLowerCase());\n } else if (openingMatch?.[1] && !/\\/\\s*>$/.test(tag)) {\n stack.push({ name: openingMatch[1].toLowerCase() });\n }\n index = tagEnd + 1;\n }\n\n return new Set(stack.map(({ name }) => name));\n}\n\nexport function findSsmlVoiceContext(source: string, offset: number): SsmlVoiceContext | undefined {\n const limit = Math.max(0, Math.min(offset, source.length));\n const stack: OpenElement[] = [];\n let index = 0;\n\n while (index < limit) {\n const tagStart = source.indexOf(\"<\", index);\n if (tagStart === -1 || tagStart >= limit) {\n break;\n }\n\n if (source.startsWith(\"<!--\", tagStart)) {\n const end = source.indexOf(\"-->\", tagStart + 4);\n index = end === -1 || end + 3 > limit ? limit : end + 3;\n continue;\n }\n if (source.startsWith(\"<![CDATA[\", tagStart)) {\n const end = source.indexOf(\"]]>\", tagStart + 9);\n index = end === -1 || end + 3 > limit ? limit : end + 3;\n continue;\n }\n if (source.startsWith(\"<?\", tagStart)) {\n const end = source.indexOf(\"?>\", tagStart + 2);\n index = end === -1 || end + 2 > limit ? limit : end + 2;\n continue;\n }\n\n const tagEnd = findTagEnd(source, tagStart, limit);\n if (tagEnd === -1) {\n break;\n }\n const tag = source.slice(tagStart, tagEnd + 1);\n if (tag.startsWith(\"<!\")) {\n index = tagEnd + 1;\n continue;\n }\n\n const closingMatch = tag.match(/^<\\s*\\/\\s*([A-Za-z_][A-Za-z0-9_.:-]*)/);\n if (closingMatch?.[1]) {\n closeElement(stack, closingMatch[1].toLowerCase());\n index = tagEnd + 1;\n continue;\n }\n\n const openingMatch = tag.match(/^<\\s*([A-Za-z_][A-Za-z0-9_.:-]*)/);\n if (openingMatch?.[1] && !/\\/\\s*>$/.test(tag)) {\n const name = openingMatch[1].toLowerCase();\n stack.push({\n name,\n ...(name === \"voice\" ? { voiceName: getVoiceName(tag) } : {}),\n });\n }\n index = tagEnd + 1;\n }\n\n for (let stackIndex = stack.length - 1; stackIndex >= 0; stackIndex -= 1) {\n const element = stack[stackIndex];\n if (element?.name === \"voice\") {\n return element.voiceName === undefined ? {} : { voiceName: element.voiceName };\n }\n }\n return undefined;\n}\n","type SsmlPresetDescription = Readonly<Record<\"ja\" | \"en\", string>>;\n\nexport interface SsmlPreset {\n id: string;\n label: string;\n ssml: string;\n description?: string;\n}\n\nexport const SSML_PRESETS: readonly SsmlPreset[] = [\n {\n id: \"basic\",\n label: \"Basic speech\",\n ssml: '<speak version=\"1.0\" xml:lang=\"en-US\">Hello, world!</speak>',\n description: \"A minimal SSML document.\",\n },\n {\n id: \"voice\",\n label: \"Voice selection\",\n ssml: '<speak version=\"1.0\" xml:lang=\"en-US\"><voice name=\"en-US-JennyNeural\">Hello, world!</voice></speak>',\n description: \"Speaks text with a selected voice.\",\n },\n {\n id: \"prosody\",\n label: \"Prosody\",\n ssml: '<speak version=\"1.0\" xml:lang=\"en-US\"><prosody rate=\"fast\" pitch=\"+2st\">Hello, world!</prosody></speak>',\n description: \"Adjusts the speech rate and pitch.\",\n },\n] as const;\n\nexport const BREAK_TIME_PRESETS = [\"500ms\", \"1s\", \"2s\", \"3s\"] as const;\nexport const BREAK_STRENGTH_PRESETS = [\"none\", \"x-weak\", \"weak\", \"medium\", \"strong\", \"x-strong\"] as const;\n\nexport const PROSODY_RATE_PRESETS = [\"x-slow\", \"slow\", \"medium\", \"fast\", \"x-fast\"] as const;\nexport const PROSODY_RATE_VALUES = [...PROSODY_RATE_PRESETS, \"percentage\"] as const;\nexport const PROSODY_PITCH_PRESETS = [\"+2st\", \"-2st\", \"0st\", \"+4st\", \"-4st\", \"+8st\", \"-8st\", \"+12st\", \"-12st\"] as const;\nexport const PROSODY_VOLUME_PRESETS = [\"silent\", \"x-soft\", \"soft\", \"medium\", \"loud\", \"x-loud\"] as const;\n\nexport const EXPRESS_AS_STYLE_PRESETS = [\n \"cheerful\",\n \"friendly\",\n \"calm\",\n \"sad\",\n \"angry\",\n \"excited\",\n \"serious\",\n \"assistant\",\n \"chat\",\n \"customerservice\",\n \"hopeful\",\n \"newscast\",\n \"shouting\",\n \"terrified\",\n \"unfriendly\",\n \"whispering\",\n \"empathetic\",\n \"relieved\",\n \"fearful\",\n \"depressed\",\n \"disgruntled\",\n \"embarrassed\",\n \"narration-relaxed\",\n \"poetry-reading\",\n \"sports_commentary\",\n \"sports_commentary_excited\",\n \"story\",\n] as const;\nexport type ExpressAsStyle = (typeof EXPRESS_AS_STYLE_PRESETS)[number];\n\nexport const EXPRESS_AS_STYLE_CATEGORIES = {\n emotions: [\n \"cheerful\",\n \"sad\",\n \"angry\",\n \"calm\",\n \"fearful\",\n \"depressed\",\n \"disgruntled\",\n \"embarrassed\",\n \"empathetic\",\n \"envious\",\n \"excited\",\n \"friendly\",\n \"gentle\",\n \"hopeful\",\n \"relieved\",\n \"serious\",\n \"shouting\",\n \"terrified\",\n \"unfriendly\",\n \"whispering\",\n ],\n scenarios: [\"chat\", \"customerservice\", \"assistant\", \"livecommercial\", \"poetry-reading\", \"story\"],\n media: [\n \"newscast\",\n \"newscast-casual\",\n \"newscast-formal\",\n \"narration-professional\",\n \"narration-relaxed\",\n \"documentary-narration\",\n \"advertisement_upbeat\",\n \"sports_commentary\",\n \"sports_commentary_excited\",\n ],\n} as const;\n\nexport type ExpressAsStyleCategory = keyof typeof EXPRESS_AS_STYLE_CATEGORIES | \"other\";\n\nexport function getExpressAsStyleCategory(style: string): ExpressAsStyleCategory {\n for (const [category, styles] of Object.entries(EXPRESS_AS_STYLE_CATEGORIES) as [\n keyof typeof EXPRESS_AS_STYLE_CATEGORIES,\n readonly string[],\n ][]) {\n if (styles.includes(style)) {\n return category;\n }\n }\n\n return \"other\";\n}\n\nexport const VOICE_STYLE_MAP = {\n \"ja-JP-MayuNeural\": [\"calm\", \"cheerful\", \"sad\"],\n \"ja-JP-KeitaNeural\": [\"chat\"],\n \"ja-JP-NanamiNeural\": [\"chat\", \"customerservice\", \"cheerful\", \"whispering\", \"sad\"],\n \"en-US-JennyMultilingualNeural\": [\n \"cheerful\",\n \"empathetic\",\n \"excited\",\n \"friendly\",\n \"hopeful\",\n \"sad\",\n \"shouting\",\n \"terrified\",\n \"unfriendly\",\n \"whispering\",\n ],\n \"en-US-AndrewNeural\": [\"empathetic\", \"relieved\"],\n \"en-US-JennyNeural\": [\n \"assistant\",\n \"chat\",\n \"customerservice\",\n \"newscast\",\n \"cheerful\",\n \"empathetic\",\n \"excited\",\n \"friendly\",\n \"hopeful\",\n \"sad\",\n \"shouting\",\n \"terrified\",\n \"unfriendly\",\n \"whispering\",\n ],\n \"en-US-GuyNeural\": [\n \"angry\",\n \"cheerful\",\n \"excited\",\n \"friendly\",\n \"hopeful\",\n \"newscast\",\n \"sad\",\n \"shouting\",\n \"terrified\",\n \"unfriendly\",\n \"whispering\",\n ],\n \"ko-KR-SunHiNeural\": [\"cheerful\", \"sad\"],\n \"zh-CN-XiaoxiaoNeural\": [\n \"assistant\",\n \"chat\",\n \"customerservice\",\n \"newscast\",\n \"cheerful\",\n \"empathetic\",\n \"excited\",\n \"friendly\",\n \"hopeful\",\n \"sad\",\n \"terrified\",\n \"whispering\",\n \"poetry-reading\",\n \"sports_commentary\",\n \"sports_commentary_excited\",\n \"story\",\n ],\n \"zh-CN-YunxiNeural\": [\n \"narration-relaxed\",\n \"embarrassed\",\n \"fearful\",\n \"sad\",\n \"disgruntled\",\n \"serious\",\n \"angry\",\n \"depressed\",\n \"chat\",\n \"cheerful\",\n \"assistant\",\n ],\n \"fr-FR-DeniseNeural\": [\"cheerful\", \"sad\"],\n \"fr-FR-HenriNeural\": [\"cheerful\", \"sad\"],\n \"pt-BR-FranciscaNeural\": [\"calm\"],\n \"it-IT-ElsaNeural\": [\"cheerful\", \"sad\"],\n \"de-DE-KatjaNeural\": [\"cheerful\", \"sad\"],\n \"de-DE-ConradNeural\": [\"cheerful\", \"sad\"],\n \"ru-RU-SvetlanaNeural\": [\"cheerful\", \"sad\", \"angry\", \"disgruntled\", \"embarrassed\", \"fearful\"],\n} as const satisfies Readonly<Record<string, readonly ExpressAsStyle[]>>;\n\nconst VOICE_STYLE_MAP_BY_NORMALIZED_NAME = new Map<string, readonly ExpressAsStyle[]>(\n Object.entries(VOICE_STYLE_MAP).map(([voiceName, styles]) => [voiceName.toLowerCase(), styles]),\n);\n\nexport function resolveExpressAsStyles(\n voiceName: string | null | undefined,\n candidates: readonly string[] = EXPRESS_AS_STYLE_PRESETS,\n): readonly string[] {\n const normalizedVoiceName = voiceName?.trim().toLowerCase();\n if (!normalizedVoiceName) {\n return candidates;\n }\n\n const supportedStyles = VOICE_STYLE_MAP_BY_NORMALIZED_NAME.get(normalizedVoiceName);\n if (supportedStyles === undefined) {\n return [];\n }\n\n const supportedStyleSet = new Set<string>(supportedStyles);\n return candidates.filter((style) => supportedStyleSet.has(style));\n}\nexport const EXPRESS_AS_ROLE_PRESETS = [\n \"Girl\",\n \"Boy\",\n \"YoungAdultFemale\",\n \"YoungAdultMale\",\n \"OlderAdultFemale\",\n \"OlderAdultMale\",\n \"SeniorFemale\",\n \"SeniorMale\",\n] as const;\nexport const EMPHASIS_LEVEL_PRESETS = [\"strong\", \"moderate\", \"reduced\", \"none\"] as const;\nexport const SAY_AS_PRESETS = [\n \"characters\",\n \"spell-out\",\n \"cardinal\",\n \"ordinal\",\n \"number\",\n \"date\",\n \"time\",\n \"telephone\",\n \"fraction\",\n \"address\",\n \"name\",\n \"currency\",\n] as const;\nexport const LANGUAGE_PRESETS = [\"ja-JP\", \"en-US\", \"de-DE\", \"fr-FR\"] as const;\nexport const SILENCE_VALUE_PRESETS = [\"300ms\", \"500ms\", \"1s\"] as const;\nexport const SILENCE_TYPE_PRESETS = [\n \"Leading\",\n \"Tailing\",\n \"Sentenceboundary\",\n \"Comma\",\n \"Semicolon\",\n \"Enumerationcomma\",\n] as const;\nexport const PHONEME_ALPHABET_PRESETS = [\"ipa\", \"sapi\", \"ups\", \"x-sampa\"] as const;\nexport const VISEME_TYPE_PRESETS = [\"redlips_front\", \"FacialExpression\"] as const;\n\nexport const SSML_ATTRIBUTE_PRESETS = {\n break: {\n strength: BREAK_STRENGTH_PRESETS,\n time: BREAK_TIME_PRESETS,\n },\n prosody: {\n rate: PROSODY_RATE_PRESETS,\n pitch: PROSODY_PITCH_PRESETS,\n volume: PROSODY_VOLUME_PRESETS,\n },\n \"mstts:express-as\": {\n style: EXPRESS_AS_STYLE_PRESETS,\n role: EXPRESS_AS_ROLE_PRESETS,\n },\n \"express-as\": {\n style: EXPRESS_AS_STYLE_PRESETS,\n role: EXPRESS_AS_ROLE_PRESETS,\n },\n expressAs: {\n style: EXPRESS_AS_STYLE_PRESETS,\n role: EXPRESS_AS_ROLE_PRESETS,\n },\n \"say-as\": {\n \"interpret-as\": SAY_AS_PRESETS,\n },\n sayAs: {\n \"interpret-as\": SAY_AS_PRESETS,\n },\n emphasis: {\n level: EMPHASIS_LEVEL_PRESETS,\n },\n lang: {\n \"xml:lang\": LANGUAGE_PRESETS,\n },\n phoneme: {\n alphabet: PHONEME_ALPHABET_PRESETS,\n },\n \"mstts:silence\": {\n type: SILENCE_TYPE_PRESETS,\n value: SILENCE_VALUE_PRESETS,\n },\n silence: {\n type: SILENCE_TYPE_PRESETS,\n value: SILENCE_VALUE_PRESETS,\n },\n \"mstts:viseme\": {\n type: VISEME_TYPE_PRESETS,\n },\n viseme: {\n type: VISEME_TYPE_PRESETS,\n },\n} as const satisfies Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>;\n\nexport const SSML_PRESET_EXAMPLES = {\n breakTime: \"500ms\",\n prosodyRate: \"fast\",\n prosodyPitch: \"+2st\",\n prosodyVolume: \"loud\",\n expressAsStyle: \"cheerful\",\n phonemeAlphabet: \"ipa\",\n silenceValue: \"300ms\",\n} as const satisfies {\n breakTime: (typeof BREAK_TIME_PRESETS)[number];\n prosodyRate: (typeof PROSODY_RATE_PRESETS)[number];\n prosodyPitch: (typeof PROSODY_PITCH_PRESETS)[number];\n prosodyVolume: (typeof PROSODY_VOLUME_PRESETS)[number];\n expressAsStyle: (typeof EXPRESS_AS_STYLE_PRESETS)[number];\n phonemeAlphabet: (typeof PHONEME_ALPHABET_PRESETS)[number];\n silenceValue: (typeof SILENCE_VALUE_PRESETS)[number];\n};\n\nexport const BREAK_TIME_DESCRIPTIONS = {\n \"500ms\": {\n ja: \"500ミリ秒の無音\",\n en: \"Inserts 500 milliseconds of silence.\",\n },\n \"1s\": {\n ja: \"1秒の無音\",\n en: \"Inserts one second of silence.\",\n },\n \"2s\": {\n ja: \"2秒の無音\",\n en: \"Inserts two seconds of silence.\",\n },\n \"3s\": {\n ja: \"3秒の無音\",\n en: \"Inserts three seconds of silence.\",\n },\n} as const satisfies Readonly<Record<(typeof BREAK_TIME_PRESETS)[number], SsmlPresetDescription>>;\n\nexport const EMPHASIS_LEVEL_DESCRIPTIONS = {\n strong: {\n ja: \"強い強調\",\n en: \"Applies strong emphasis.\",\n },\n moderate: {\n ja: \"中程度の強調\",\n en: \"Applies moderate emphasis.\",\n },\n reduced: {\n ja: \"弱めの強調\",\n en: \"Applies reduced emphasis.\",\n },\n none: {\n ja: \"強調なし\",\n en: \"Applies no emphasis.\",\n },\n} as const satisfies Readonly<Record<(typeof EMPHASIS_LEVEL_PRESETS)[number], SsmlPresetDescription>>;\n\nexport const PROSODY_RATE_DESCRIPTIONS = {\n \"x-slow\": {\n ja: \"最も遅い速度\",\n en: \"Uses the slowest speech rate.\",\n },\n slow: {\n ja: \"遅い速度\",\n en: \"Uses a slow speech rate.\",\n },\n medium: {\n ja: \"標準的な速度\",\n en: \"Uses the standard speech rate.\",\n },\n fast: {\n ja: \"速い速度\",\n en: \"Uses a fast speech rate.\",\n },\n \"x-fast\": {\n ja: \"最も速い速度\",\n en: \"Uses the fastest speech rate.\",\n },\n} as const satisfies Readonly<Record<(typeof PROSODY_RATE_PRESETS)[number], SsmlPresetDescription>>;\n\nexport const PROSODY_PITCH_DESCRIPTIONS = {\n \"+2st\": {\n ja: \"基準の声の高さより2半音上\",\n en: \"Raises the pitch by two semitones.\",\n },\n \"-2st\": {\n ja: \"基準の声の高さより2半音下\",\n en: \"Lowers the pitch by two semitones.\",\n },\n \"0st\": {\n ja: \"基準の声の高さ\",\n en: \"Keeps the baseline pitch.\",\n },\n \"+4st\": {\n ja: \"基準の声の高さより4半音上\",\n en: \"Raises the pitch by four semitones.\",\n },\n \"-4st\": {\n ja: \"基準の声の高さより4半音下\",\n en: \"Lowers the pitch by four semitones.\",\n },\n \"+8st\": {\n ja: \"基準の声の高さより8半音上\",\n en: \"Raises the pitch by eight semitones.\",\n },\n \"-8st\": {\n ja: \"基準の声の高さより8半音下\",\n en: \"Lowers the pitch by eight semitones.\",\n },\n \"+12st\": {\n ja: \"基準の声の高さより12半音上\",\n en: \"Raises the pitch by twelve semitones.\",\n },\n \"-12st\": {\n ja: \"基準の声の高さより12半音下\",\n en: \"Lowers the pitch by twelve semitones.\",\n },\n} as const satisfies Readonly<Record<(typeof PROSODY_PITCH_PRESETS)[number], SsmlPresetDescription>>;\n\nexport const PROSODY_VOLUME_DESCRIPTIONS = {\n silent: {\n ja: \"無音\",\n en: \"Makes the selected text silent.\",\n },\n \"x-soft\": {\n ja: \"最も小さい音量\",\n en: \"Uses the quietest volume.\",\n },\n soft: {\n ja: \"小さい音量\",\n en: \"Uses a soft volume.\",\n },\n medium: {\n ja: \"標準的な音量\",\n en: \"Uses the standard volume.\",\n },\n loud: {\n ja: \"大きい音量\",\n en: \"Uses a loud volume.\",\n },\n \"x-loud\": {\n ja: \"最も大きい音量\",\n en: \"Uses the loudest volume.\",\n },\n} as const satisfies Readonly<Record<(typeof PROSODY_VOLUME_PRESETS)[number], SsmlPresetDescription>>;\n\nexport const EXPRESS_AS_STYLE_DESCRIPTIONS = {\n cheerful: {\n ja: \"明るく元気なスタイル\",\n en: \"Uses a cheerful style.\",\n },\n friendly: {\n ja: \"親しみやすいスタイル\",\n en: \"Uses a friendly style.\",\n },\n calm: {\n ja: \"穏やかなスタイル\",\n en: \"Uses a calm style.\",\n },\n sad: {\n ja: \"悲しげなスタイル\",\n en: \"Uses a sad style.\",\n },\n angry: {\n ja: \"怒ったようなスタイル\",\n en: \"Uses an angry style.\",\n },\n excited: {\n ja: \"興奮したスタイル\",\n en: \"Uses an excited style.\",\n },\n empathetic: {\n ja: \"共感を示すスタイル\",\n en: \"Uses an empathetic style.\",\n },\n relieved: {\n ja: \"安心したスタイル\",\n en: \"Uses a relieved style.\",\n },\n fearful: {\n ja: \"恐れを感じさせるスタイル\",\n en: \"Uses a fearful style.\",\n },\n depressed: {\n ja: \"落ち込んだスタイル\",\n en: \"Uses a depressed style.\",\n },\n disgruntled: {\n ja: \"不満を感じさせるスタイル\",\n en: \"Uses a disgruntled style.\",\n },\n embarrassed: {\n ja: \"恥ずかしそうなスタイル\",\n en: \"Uses an embarrassed style.\",\n },\n serious: {\n ja: \"真剣なスタイル\",\n en: \"Uses a serious style.\",\n },\n assistant: {\n ja: \"デジタルアシスタント向けのスタイル\",\n en: \"Uses a digital assistant style.\",\n },\n chat: {\n ja: \"会話向けのスタイル\",\n en: \"Uses a conversational style.\",\n },\n customerservice: {\n ja: \"カスタマーサービス向けのスタイル\",\n en: \"Uses a customer service style.\",\n },\n hopeful: {\n ja: \"希望に満ちたスタイル\",\n en: \"Uses a hopeful style.\",\n },\n newscast: {\n ja: \"ニュース読み上げ向けのスタイル\",\n en: \"Uses a newscast style.\",\n },\n shouting: {\n ja: \"叫ぶようなスタイル\",\n en: \"Uses a shouting style.\",\n },\n terrified: {\n ja: \"恐怖に満ちたスタイル\",\n en: \"Uses a terrified style.\",\n },\n unfriendly: {\n ja: \"無愛想なスタイル\",\n en: \"Uses an unfriendly style.\",\n },\n whispering: {\n ja: \"ささやくようなスタイル\",\n en: \"Uses a whispering style.\",\n },\n \"narration-relaxed\": {\n ja: \"リラックスしたナレーション向けのスタイル\",\n en: \"Uses a relaxed narration style.\",\n },\n \"poetry-reading\": {\n ja: \"詩の朗読向けのスタイル\",\n en: \"Uses a poetry-reading style.\",\n },\n sports_commentary: {\n ja: \"スポーツ実況向けのスタイル\",\n en: \"Uses a sports commentary style.\",\n },\n sports_commentary_excited: {\n ja: \"興奮したスポーツ実況向けのスタイル\",\n en: \"Uses an excited sports commentary style.\",\n },\n story: {\n ja: \"物語の朗読向けのスタイル\",\n en: \"Uses a storytelling style.\",\n },\n} as const satisfies Readonly<Record<(typeof EXPRESS_AS_STYLE_PRESETS)[number], SsmlPresetDescription>>;\n\nexport const SAY_AS_DESCRIPTIONS = {\n characters: {\n ja: \"1文字ずつの読み上げ\",\n en: \"Speaks the characters one by one.\",\n },\n \"spell-out\": {\n ja: \"綴りの読み上げ(1文字ずつ)\",\n en: \"Spells out the text character by character.\",\n },\n cardinal: {\n ja: \"基数としての読み上げ\",\n en: \"Speaks the value as a cardinal number.\",\n },\n ordinal: {\n ja: \"序数としての読み上げ\",\n en: \"Speaks the value as an ordinal number.\",\n },\n number: {\n ja: \"数値としての読み上げ\",\n en: \"Speaks the value as a number.\",\n },\n date: {\n ja: \"日付としての読み上げ\",\n en: \"Speaks the value as a date.\",\n },\n time: {\n ja: \"時刻としての読み上げ\",\n en: \"Speaks the value as a time.\",\n },\n telephone: {\n ja: \"電話番号としての読み上げ\",\n en: \"Speaks the value as a telephone number.\",\n },\n fraction: {\n ja: \"分数としての読み上げ\",\n en: \"Speaks the value as a fraction.\",\n },\n address: {\n ja: \"住所としての読み上げ\",\n en: \"Speaks the value as an address.\",\n },\n name: {\n ja: \"名前としての読み上げ\",\n en: \"Speaks the value as a name.\",\n },\n currency: {\n ja: \"通貨としての読み上げ\",\n en: \"Speaks the value as currency.\",\n },\n} as const satisfies Readonly<Record<(typeof SAY_AS_PRESETS)[number], SsmlPresetDescription>>;\n\nexport const LANGUAGE_DESCRIPTIONS = {\n \"ja-JP\": {\n ja: \"日本語(日本)で読み上げます。\",\n en: \"Speaks the text in Japanese (Japan).\",\n },\n \"en-US\": {\n ja: \"英語(米国)で読み上げます。\",\n en: \"Speaks the text in English (United States).\",\n },\n \"de-DE\": {\n ja: \"ドイツ語(ドイツ)で読み上げます。\",\n en: \"Speaks the text in German (Germany).\",\n },\n \"fr-FR\": {\n ja: \"フランス語(フランス)で読み上げます。\",\n en: \"Speaks the text in French (France).\",\n },\n} as const satisfies Readonly<Record<(typeof LANGUAGE_PRESETS)[number], SsmlPresetDescription>>;\n\nexport const SILENCE_VALUE_DESCRIPTIONS = {\n \"300ms\": {\n ja: \"先頭に300ミリ秒の無音を挿入します。\",\n en: \"Inserts 300 milliseconds of leading silence.\",\n },\n \"500ms\": {\n ja: \"先頭に500ミリ秒の無音を挿入します。\",\n en: \"Inserts 500 milliseconds of leading silence.\",\n },\n \"1s\": {\n ja: \"先頭に1秒の無音を挿入します。\",\n en: \"Inserts one second of leading silence.\",\n },\n} as const satisfies Readonly<Record<(typeof SILENCE_VALUE_PRESETS)[number], SsmlPresetDescription>>;\n","import type { SsmlEditorLocale } from \"../locales.ts\";\n\n// Keep the editor's existing Japanese default for backward compatibility.\nexport const DEFAULT_LOCALE: SsmlEditorLocale = \"ja\";\nexport const OVERLAY_Z_INDEX = 9999;\nexport const SELECTION_OVERLAY_ABOVE_THRESHOLD_LINES = 4;\n\nexport const SSML_INSERTION_MODES = {\n insert: \"insert\",\n wrap: \"wrap\",\n} as const;\n","export const SYNTHESIS_NAMESPACE = \"http://www.w3.org/2001/10/synthesis\" as const;\nexport const MSTTS_NAMESPACE = \"http://www.w3.org/2001/mstts\" as const;\nexport const DEFAULT_SSML_VERSION = \"1.0\" as const;\nexport const DEFAULT_SSML_LANGUAGE = \"en-US\" as const;\nexport const MAX_NESTING_DEPTH = 1000;\nexport const XML_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_.:-]*$/;\nexport const MSTTS_TAG_PREFIX = \"mstts:\" as const;\n\nexport const SSML_TAGS = {\n SPEAK: \"speak\",\n VOICE: \"voice\",\n PROSODY: \"prosody\",\n BREAK: \"break\",\n EXPRESS_AS: \"express-as\",\n EXPRESS_AS_CAMEL: \"expressAs\",\n MSTTS_EXPRESS_AS: \"mstts:express-as\",\n SAY_AS: \"say-as\",\n SAY_AS_CAMEL: \"sayAs\",\n PHONEME: \"phoneme\",\n EMPHASIS: \"emphasis\",\n AUDIO: \"audio\",\n SUB: \"sub\",\n LANG: \"lang\",\n MARK: \"mark\",\n BOOKMARK: \"bookmark\",\n LEXICON: \"lexicon\",\n PARAGRAPH: \"p\",\n SENTENCE: \"s\",\n WORD: \"w\",\n MSTTS_SILENCE: \"mstts:silence\",\n SILENCE: \"silence\",\n MSTTS_VISEME: \"mstts:viseme\",\n VISEME: \"viseme\",\n} as const;\n\nexport const SSML_ATTRS = {\n VERSION: \"version\",\n XMLNS: \"xmlns\",\n XML_LANG: \"xml:lang\",\n LANG: \"lang\",\n MSTTS_XMLNS: \"xmlns:mstts\",\n NAME: \"name\",\n EFFECT: \"effect\",\n RATE: \"rate\",\n PITCH: \"pitch\",\n VOLUME: \"volume\",\n CONTOUR: \"contour\",\n RANGE: \"range\",\n TIME: \"time\",\n STRENGTH: \"strength\",\n STYLE: \"style\",\n STYLE_DEGREE: \"styledegree\",\n STYLE_DEGREE_CAMEL: \"styleDegree\",\n STYLE_DEGREE_HYPHEN: \"style-degree\",\n ROLE: \"role\",\n INTERPRET_AS: \"interpret-as\",\n FORMAT: \"format\",\n DETAIL: \"detail\",\n ALPHABET: \"alphabet\",\n PH: \"ph\",\n LEVEL: \"level\",\n SRC: \"src\",\n DESC: \"desc\",\n CLIP_BEGIN: \"clipBegin\",\n CLIP_END: \"clipEnd\",\n SPEED: \"speed\",\n REPEAT_COUNT: \"repeatCount\",\n REPEAT_DURATION: \"repeatDuration\",\n SOUND_LEVEL: \"soundLevel\",\n ALIAS: \"alias\",\n MARK: \"mark\",\n URI: \"uri\",\n TYPE: \"type\",\n VALUE: \"value\",\n} as const;\n","import type {\n SsmlAttributeValue,\n SsmlAttributes,\n SsmlDocument,\n SsmlElement,\n SsmlElementBase,\n SsmlNode,\n} from \"./types.ts\";\nimport {\n DEFAULT_SSML_LANGUAGE,\n DEFAULT_SSML_VERSION,\n MSTTS_NAMESPACE,\n MSTTS_TAG_PREFIX,\n SSML_ATTRS,\n SSML_TAGS,\n SYNTHESIS_NAMESPACE,\n XML_NAME_PATTERN,\n} from \"./constants/ssml.ts\";\n\nfunction escapeText(value: string): string {\n return value.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n}\n\nfunction escapeAttribute(value: string): string {\n return escapeText(value).replace(/\"/g, \""\").replace(/'/g, \"'\");\n}\n\nfunction addAttribute(attributes: SsmlAttributes, name: string, value: SsmlAttributeValue | undefined): void {\n if (value !== undefined) {\n attributes[name] = value;\n }\n}\n\nfunction getAttributes(element: SsmlElement): SsmlAttributes {\n const attributes: SsmlAttributes = {\n ...(element.attributes ?? {}),\n };\n\n switch (element.type) {\n case SSML_TAGS.VOICE:\n addAttribute(attributes, SSML_ATTRS.NAME, element.name);\n addAttribute(attributes, SSML_ATTRS.EFFECT, element.effect);\n break;\n case SSML_TAGS.PROSODY:\n addAttribute(attributes, SSML_ATTRS.RATE, element.rate);\n addAttribute(attributes, SSML_ATTRS.PITCH, element.pitch);\n addAttribute(attributes, SSML_ATTRS.VOLUME, element.volume);\n addAttribute(attributes, SSML_ATTRS.CONTOUR, element.contour);\n addAttribute(attributes, SSML_ATTRS.RANGE, element.range);\n break;\n case SSML_TAGS.BREAK:\n addAttribute(attributes, SSML_ATTRS.TIME, element.time);\n addAttribute(attributes, SSML_ATTRS.STRENGTH, element.strength);\n break;\n case SSML_TAGS.EXPRESS_AS:\n case SSML_TAGS.EXPRESS_AS_CAMEL:\n case SSML_TAGS.MSTTS_EXPRESS_AS:\n addAttribute(attributes, SSML_ATTRS.STYLE, element.style);\n addAttribute(attributes, SSML_ATTRS.STYLE_DEGREE, element.styleDegree);\n addAttribute(attributes, SSML_ATTRS.ROLE, element.role);\n break;\n case SSML_TAGS.SAY_AS:\n case SSML_TAGS.SAY_AS_CAMEL:\n addAttribute(attributes, SSML_ATTRS.INTERPRET_AS, element.interpretAs);\n addAttribute(attributes, SSML_ATTRS.FORMAT, element.format);\n addAttribute(attributes, SSML_ATTRS.DETAIL, element.detail);\n break;\n case SSML_TAGS.PHONEME:\n addAttribute(attributes, SSML_ATTRS.ALPHABET, element.alphabet);\n addAttribute(attributes, SSML_ATTRS.PH, element.ph);\n break;\n case SSML_TAGS.EMPHASIS:\n addAttribute(attributes, SSML_ATTRS.LEVEL, element.level);\n break;\n case SSML_TAGS.AUDIO:\n addAttribute(attributes, SSML_ATTRS.SRC, element.src);\n addAttribute(attributes, SSML_ATTRS.DESC, element.desc);\n addAttribute(attributes, SSML_ATTRS.CLIP_BEGIN, element.clipBegin);\n addAttribute(attributes, SSML_ATTRS.CLIP_END, element.clipEnd);\n addAttribute(attributes, SSML_ATTRS.SPEED, element.speed);\n addAttribute(attributes, SSML_ATTRS.REPEAT_COUNT, element.repeatCount);\n addAttribute(attributes, SSML_ATTRS.REPEAT_DURATION, element.repeatDuration);\n addAttribute(attributes, SSML_ATTRS.SOUND_LEVEL, element.soundLevel);\n break;\n case SSML_TAGS.SUB:\n addAttribute(attributes, SSML_ATTRS.ALIAS, element.alias);\n break;\n case SSML_TAGS.LANG:\n addAttribute(attributes, SSML_ATTRS.XML_LANG, element.lang);\n break;\n case SSML_TAGS.MARK:\n addAttribute(attributes, SSML_ATTRS.NAME, element.name);\n break;\n case SSML_TAGS.BOOKMARK:\n addAttribute(attributes, SSML_ATTRS.MARK, element.mark);\n break;\n case SSML_TAGS.LEXICON:\n addAttribute(attributes, SSML_ATTRS.URI, element.uri);\n break;\n case SSML_TAGS.MSTTS_SILENCE:\n case SSML_TAGS.SILENCE:\n addAttribute(attributes, SSML_ATTRS.TYPE, element.typeValue ?? element.silenceType);\n addAttribute(attributes, SSML_ATTRS.VALUE, element.value);\n break;\n case SSML_TAGS.MSTTS_VISEME:\n case SSML_TAGS.VISEME:\n addAttribute(attributes, SSML_ATTRS.TYPE, element.typeValue ?? element.visemeType);\n break;\n case SSML_TAGS.PARAGRAPH:\n case SSML_TAGS.SENTENCE:\n case SSML_TAGS.WORD:\n case \"element\":\n case \"custom\":\n break;\n }\n\n return attributes;\n}\n\nfunction getTagName(element: SsmlElement): string {\n switch (element.type) {\n case SSML_TAGS.EXPRESS_AS:\n case SSML_TAGS.EXPRESS_AS_CAMEL:\n case SSML_TAGS.MSTTS_EXPRESS_AS:\n return SSML_TAGS.MSTTS_EXPRESS_AS;\n case SSML_TAGS.SAY_AS:\n case SSML_TAGS.SAY_AS_CAMEL:\n return SSML_TAGS.SAY_AS;\n case SSML_TAGS.SILENCE:\n case SSML_TAGS.MSTTS_SILENCE:\n return SSML_TAGS.MSTTS_SILENCE;\n case SSML_TAGS.VISEME:\n case SSML_TAGS.MSTTS_VISEME:\n return SSML_TAGS.MSTTS_VISEME;\n case \"element\":\n case \"custom\":\n return element.name;\n default:\n return element.type;\n }\n}\n\nfunction getChildren(element: SsmlElementBase): SsmlNode[] {\n return element.children ?? [];\n}\n\nfunction validateName(name: string, kind: \"element\" | \"attribute\"): void {\n if (!XML_NAME_PATTERN.test(name)) {\n throw new Error(`Invalid XML ${kind} name: ${name}`);\n }\n}\n\nfunction serializeAttributes(attributes: SsmlAttributes): string {\n return Object.entries(attributes)\n .map(([name, value]) => {\n validateName(name, \"attribute\");\n return ` ${name}=\"${escapeAttribute(String(value))}\"`;\n })\n .join(\"\");\n}\n\nfunction serializeNode(node: SsmlNode): string {\n if (typeof node === \"string\") {\n return escapeText(node);\n }\n\n if (node.type === \"text\") {\n return escapeText(node.value);\n }\n\n const tagName = getTagName(node);\n validateName(tagName, \"element\");\n\n const attributes = serializeAttributes(getAttributes(node));\n const children = getChildren(node);\n if (children.length === 0) {\n return `<${tagName}${attributes}/>`;\n }\n\n return `<${tagName}${attributes}>${children.map(serializeNode).join(\"\")}</${tagName}>`;\n}\n\nfunction usesMsttsNamespace(nodes: SsmlNode[]): boolean {\n return nodes.some((node) => {\n if (typeof node === \"string\" || node.type === \"text\") {\n return false;\n }\n\n const tagName = getTagName(node);\n return tagName.startsWith(MSTTS_TAG_PREFIX) || usesMsttsNamespace(getChildren(node));\n });\n}\n\nfunction serializeDocument(document: SsmlDocument): string {\n const children = document.children ?? (document.content === undefined ? [] : [document.content]);\n const attributes: SsmlAttributes = {\n ...(document.attributes ?? {}),\n [SSML_ATTRS.VERSION]: document.version,\n [SSML_ATTRS.XMLNS]: SYNTHESIS_NAMESPACE,\n [SSML_ATTRS.XML_LANG]: document.lang,\n };\n\n if (usesMsttsNamespace(children) && attributes[SSML_ATTRS.MSTTS_XMLNS] === undefined) {\n attributes[SSML_ATTRS.MSTTS_XMLNS] = MSTTS_NAMESPACE;\n }\n\n return `<${SSML_TAGS.SPEAK}${serializeAttributes(attributes)}>${children.map(serializeNode).join(\"\")}</${SSML_TAGS.SPEAK}>`;\n}\n\nexport function buildSsml(document: SsmlDocument): string;\nexport function buildSsml(content: string, lang?: string): SsmlDocument;\nexport function buildSsml(\n documentOrContent: SsmlDocument | string,\n lang: string = DEFAULT_SSML_LANGUAGE,\n): string | SsmlDocument {\n if (typeof documentOrContent === \"string\") {\n return {\n version: DEFAULT_SSML_VERSION,\n lang,\n content: documentOrContent,\n };\n }\n\n return serializeDocument(documentOrContent);\n}\n","import type {\n AudioElement,\n BookmarkElement,\n BreakElement,\n CustomElement,\n EmphasisElement,\n ExpressAsElement,\n LangElement,\n LexiconElement,\n MarkElement,\n MsttsSilenceElement,\n MsttsVisemeElement,\n ParagraphElement,\n PhonemeElement,\n ProsodyElement,\n SayAsElement,\n SentenceElement,\n SsmlAttributes,\n SsmlDocument,\n SsmlElement,\n SsmlNode,\n SubElement,\n VoiceElement,\n WordElement,\n} from \"./types.ts\";\nimport { MAX_NESTING_DEPTH, MSTTS_NAMESPACE, SSML_ATTRS, SSML_TAGS, SYNTHESIS_NAMESPACE } from \"./constants/ssml.ts\";\n\ninterface XmlElementNode {\n name: string;\n attributes: SsmlAttributes;\n children: XmlNode[];\n}\n\ntype XmlNode = string | XmlElementNode;\n\nconst XML_ENTITIES: Record<string, string> = {\n amp: \"&\",\n apos: \"'\",\n gt: \">\",\n lt: \"<\",\n quot: '\"',\n};\n\nfunction hasOwn(object: object, property: PropertyKey): boolean {\n return Object.getOwnPropertyDescriptor(object, property) !== undefined;\n}\n\nfunction setAttribute(attributes: SsmlAttributes, name: string, value: string): void {\n Object.defineProperty(attributes, name, {\n configurable: true,\n enumerable: true,\n value,\n writable: true,\n });\n}\n\nfunction decodeEntity(entity: string): string {\n const namedValue = hasOwn(XML_ENTITIES, entity) ? XML_ENTITIES[entity] : undefined;\n if (namedValue !== undefined) {\n return namedValue;\n }\n\n const isHexadecimal = entity.startsWith(\"#x\") || entity.startsWith(\"#X\");\n const isDecimal = entity.startsWith(\"#\");\n if (!isHexadecimal && !isDecimal) {\n throw new Error(`Unknown XML entity: &${entity};`);\n }\n\n const digits = entity.slice(isHexadecimal ? 2 : 1);\n const codePoint = Number.parseInt(digits, isHexadecimal ? 16 : 10);\n if (\n !digits ||\n !Number.isInteger(codePoint) ||\n codePoint < 0 ||\n codePoint > 0x10ffff ||\n (codePoint >= 0xd800 && codePoint <= 0xdfff) ||\n (codePoint < 0x20 && ![9, 10, 13].includes(codePoint))\n ) {\n throw new Error(`Invalid XML character reference: &${entity};`);\n }\n\n return String.fromCodePoint(codePoint);\n}\n\nfunction decodeXmlEntities(value: string): string {\n let result = \"\";\n let start = 0;\n\n while (true) {\n const ampersand = value.indexOf(\"&\", start);\n if (ampersand === -1) {\n return result + value.slice(start);\n }\n\n result += value.slice(start, ampersand);\n const semicolon = value.indexOf(\";\", ampersand + 1);\n if (semicolon === -1) {\n throw new Error(\"Unterminated XML entity reference\");\n }\n\n result += decodeEntity(value.slice(ampersand + 1, semicolon));\n start = semicolon + 1;\n }\n}\n\nfunction isXmlNameStart(value: string | undefined): boolean {\n return value !== undefined && /[A-Za-z_]/.test(value);\n}\n\nfunction isXmlNameCharacter(value: string | undefined): boolean {\n return value !== undefined && /[A-Za-z0-9_.:-]/.test(value);\n}\n\nfunction isXmlWhitespace(value: string | undefined): boolean {\n return value === \" \" || value === \"\\t\" || value === \"\\r\" || value === \"\\n\";\n}\n\nfunction removeStandardNamespaceAttributes(attributes: SsmlAttributes): void {\n if (attributes[SSML_ATTRS.XMLNS] === SYNTHESIS_NAMESPACE) {\n delete attributes[SSML_ATTRS.XMLNS];\n }\n if (attributes[SSML_ATTRS.MSTTS_XMLNS] === MSTTS_NAMESPACE) {\n delete attributes[SSML_ATTRS.MSTTS_XMLNS];\n }\n}\n\nclass XmlParser {\n #index = 0;\n private readonly source: string;\n\n constructor(source: string) {\n this.source = source;\n }\n\n parse(): XmlElementNode {\n if (this.source.charCodeAt(0) === 0xfeff) {\n this.#index += 1;\n }\n\n this.skipMisc();\n if (this.#index >= this.source.length) {\n this.fail(\"SSML input is empty\");\n }\n if (this.source[this.#index] !== \"<\") {\n this.fail(\"SSML input must start with an XML element\");\n }\n\n const root = this.parseElement(0);\n this.skipMisc();\n if (this.#index !== this.source.length) {\n this.fail(\"Unexpected content after the root XML element\");\n }\n return root;\n }\n\n private parseElement(depth: number): XmlElementNode {\n if (depth > MAX_NESTING_DEPTH) {\n this.fail(\"XML nesting depth exceeds the supported limit\");\n }\n\n this.expect(\"<\");\n if (this.source[this.#index] === \"/\") {\n this.fail(\"Unexpected closing XML element\");\n }\n\n const name = this.parseName();\n const { attributes, selfClosing } = this.parseStartTag();\n if (selfClosing) {\n return { name, attributes, children: [] };\n }\n\n const children: XmlNode[] = [];\n while (this.#index < this.source.length) {\n if (this.source.startsWith(\"</\", this.#index)) {\n this.#index += 2;\n const closingName = this.parseName();\n this.skipWhitespace();\n this.expect(\">\");\n if (closingName !== name) {\n this.fail(`Mismatched closing element: expected </${name}> but found </${closingName}>`);\n }\n return { name, attributes, children };\n }\n\n if (this.source.startsWith(\"<!--\", this.#index)) {\n this.skipComment();\n continue;\n }\n\n if (this.source.startsWith(\"<![CDATA[\", this.#index)) {\n this.appendText(children, this.parseCdata());\n continue;\n }\n\n if (this.source.startsWith(\"<?\", this.#index)) {\n this.skipProcessingInstruction();\n continue;\n }\n\n if (this.source.startsWith(\"<!\", this.#index)) {\n this.fail(\"Unsupported XML declaration inside an element\");\n }\n\n if (this.source[this.#index] === \"<\") {\n children.push(this.parseElement(depth + 1));\n } else {\n this.appendText(children, this.parseText());\n }\n }\n\n this.fail(`Unclosed XML element: <${name}>`);\n }\n\n private parseStartTag(): {\n attributes: SsmlAttributes;\n selfClosing: boolean;\n } {\n const attributes: SsmlAttributes = {};\n\n while (this.#index < this.source.length) {\n this.skipWhitespace();\n\n if (this.source.startsWith(\"/>\", this.#index)) {\n this.#index += 2;\n return { attributes, selfClosing: true };\n }\n if (this.source[this.#index] === \">\") {\n this.#index += 1;\n return { attributes, selfClosing: false };\n }\n\n const name = this.parseName();\n this.skipWhitespace();\n this.expect(\"=\");\n this.skipWhitespace();\n\n const quote = this.source[this.#index];\n if (quote !== '\"' && quote !== \"'\") {\n this.fail(`XML attribute ${name} must use a quoted value`);\n }\n this.#index += 1;\n\n const valueStart = this.#index;\n while (this.#index < this.source.length && this.source[this.#index] !== quote) {\n if (this.source[this.#index] === \"<\") {\n this.fail(`Invalid \"<\" in XML attribute ${name}`);\n }\n this.#index += 1;\n }\n if (this.#index >= this.source.length) {\n this.fail(`Unclosed XML attribute ${name}`);\n }\n\n const value = decodeXmlEntities(this.source.slice(valueStart, this.#index));\n this.#index += 1;\n\n if (hasOwn(attributes, name)) {\n this.fail(`Duplicate XML attribute: ${name}`);\n }\n setAttribute(attributes, name, value);\n }\n\n this.fail(\"Unclosed XML start tag\");\n }\n\n private parseText(): string {\n const start = this.#index;\n while (this.#index < this.source.length && this.source[this.#index] !== \"<\") {\n this.#index += 1;\n }\n\n const value = this.source.slice(start, this.#index);\n if (value.includes(\"]]>\")) {\n this.fail(\"CDATA termination is not valid in ordinary XML text\");\n }\n return decodeXmlEntities(value);\n }\n\n private parseCdata(): string {\n this.#index += \"<![CDATA[\".length;\n const end = this.source.indexOf(\"]]>\", this.#index);\n if (end === -1) {\n this.fail(\"Unclosed XML CDATA section\");\n }\n\n const value = this.source.slice(this.#index, end);\n this.#index = end + 3;\n return value;\n }\n\n private skipComment(): void {\n this.#index += \"<!--\".length;\n const end = this.source.indexOf(\"-->\", this.#index);\n if (end === -1) {\n this.fail(\"Unclosed XML comment\");\n }\n if (this.source.slice(this.#index, end).includes(\"--\")) {\n this.fail(\"XML comments cannot contain consecutive hyphens\");\n }\n this.#index = end + 3;\n }\n\n private skipProcessingInstruction(): void {\n this.#index += \"<?\".length;\n this.parseName();\n const end = this.source.indexOf(\"?>\", this.#index);\n if (end === -1) {\n this.fail(\"Unclosed XML processing instruction\");\n }\n this.#index = end + 2;\n }\n\n private skipMisc(): void {\n while (this.#index < this.source.length) {\n this.skipWhitespace();\n if (this.source.startsWith(\"<!--\", this.#index)) {\n this.skipComment();\n continue;\n }\n if (this.source.startsWith(\"<?\", this.#index)) {\n this.skipProcessingInstruction();\n continue;\n }\n if (this.source.startsWith(\"<!DOCTYPE\", this.#index)) {\n this.fail(\"DOCTYPE declarations are not supported\");\n }\n break;\n }\n }\n\n private parseName(): string {\n const first = this.source[this.#index];\n if (!isXmlNameStart(first)) {\n this.fail(\"Invalid XML name\");\n }\n\n const start = this.#index;\n this.#index += 1;\n while (isXmlNameCharacter(this.source[this.#index])) {\n this.#index += 1;\n }\n return this.source.slice(start, this.#index);\n }\n\n private appendText(children: XmlNode[], value: string): void {\n if (!value) {\n return;\n }\n\n const previous = children[children.length - 1];\n if (typeof previous === \"string\") {\n children[children.length - 1] = previous + value;\n } else {\n children.push(value);\n }\n }\n\n private skipWhitespace(): void {\n while (isXmlWhitespace(this.source[this.#index])) {\n this.#index += 1;\n }\n }\n\n private expect(value: string): void {\n if (!this.source.startsWith(value, this.#index)) {\n this.fail(`Expected \"${value}\"`);\n }\n this.#index += value.length;\n }\n\n private fail(message: string): never {\n throw new Error(`${message} at position ${this.#index}`);\n }\n}\n\nfunction readAttribute(attributes: SsmlAttributes, ...names: string[]): string | undefined {\n let found = false;\n let value: string | undefined;\n\n for (const name of names) {\n if (hasOwn(attributes, name)) {\n if (!found) {\n value = String(attributes[name]);\n found = true;\n }\n delete attributes[name];\n }\n }\n\n return value;\n}\n\nfunction getElementAttributes(node: XmlElementNode): SsmlAttributes {\n const attributes: SsmlAttributes = { ...node.attributes };\n removeStandardNamespaceAttributes(attributes);\n return attributes;\n}\n\nfunction finishElement<T extends SsmlElement>(element: T, node: XmlElementNode, attributes: SsmlAttributes): T {\n if (node.children.length > 0) {\n element.children = node.children.map(convertNode);\n }\n if (Object.keys(attributes).length > 0) {\n element.attributes = attributes;\n }\n return element;\n}\n\nfunction convertElement(node: XmlElementNode): SsmlElement {\n const attributes = getElementAttributes(node);\n\n switch (node.name) {\n case SSML_TAGS.VOICE: {\n const element: VoiceElement = { type: SSML_TAGS.VOICE };\n const name = readAttribute(attributes, SSML_ATTRS.NAME);\n const effect = readAttribute(attributes, SSML_ATTRS.EFFECT);\n if (name !== undefined) element.name = name;\n if (effect !== undefined) element.effect = effect;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.PROSODY: {\n const element: ProsodyElement = { type: SSML_TAGS.PROSODY };\n const rate = readAttribute(attributes, SSML_ATTRS.RATE);\n const pitch = readAttribute(attributes, SSML_ATTRS.PITCH);\n const volume = readAttribute(attributes, SSML_ATTRS.VOLUME);\n const contour = readAttribute(attributes, SSML_ATTRS.CONTOUR);\n const range = readAttribute(attributes, SSML_ATTRS.RANGE);\n if (rate !== undefined) element.rate = rate;\n if (pitch !== undefined) element.pitch = pitch;\n if (volume !== undefined) element.volume = volume;\n if (contour !== undefined) element.contour = contour;\n if (range !== undefined) element.range = range;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.BREAK: {\n const element: BreakElement = { type: SSML_TAGS.BREAK };\n const time = readAttribute(attributes, SSML_ATTRS.TIME);\n const strength = readAttribute(attributes, SSML_ATTRS.STRENGTH);\n if (time !== undefined) element.time = time;\n if (strength !== undefined) element.strength = strength;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.EXPRESS_AS:\n case SSML_TAGS.EXPRESS_AS_CAMEL:\n case SSML_TAGS.MSTTS_EXPRESS_AS: {\n const element: ExpressAsElement = { type: node.name };\n const style = readAttribute(attributes, SSML_ATTRS.STYLE);\n const styleDegree = readAttribute(\n attributes,\n SSML_ATTRS.STYLE_DEGREE,\n SSML_ATTRS.STYLE_DEGREE_CAMEL,\n SSML_ATTRS.STYLE_DEGREE_HYPHEN,\n );\n const role = readAttribute(attributes, SSML_ATTRS.ROLE);\n if (style !== undefined) element.style = style;\n if (styleDegree !== undefined) element.styleDegree = styleDegree;\n if (role !== undefined) element.role = role;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.SAY_AS:\n case SSML_TAGS.SAY_AS_CAMEL: {\n const element: SayAsElement = { type: node.name };\n const interpretAs = readAttribute(attributes, SSML_ATTRS.INTERPRET_AS);\n const format = readAttribute(attributes, SSML_ATTRS.FORMAT);\n const detail = readAttribute(attributes, SSML_ATTRS.DETAIL);\n if (interpretAs !== undefined) element.interpretAs = interpretAs;\n if (format !== undefined) element.format = format;\n if (detail !== undefined) element.detail = detail;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.PHONEME: {\n const element: PhonemeElement = { type: SSML_TAGS.PHONEME };\n const alphabet = readAttribute(attributes, SSML_ATTRS.ALPHABET);\n const ph = readAttribute(attributes, SSML_ATTRS.PH);\n if (alphabet !== undefined) element.alphabet = alphabet;\n if (ph !== undefined) element.ph = ph;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.EMPHASIS: {\n const element: EmphasisElement = { type: SSML_TAGS.EMPHASIS };\n const level = readAttribute(attributes, SSML_ATTRS.LEVEL);\n if (level !== undefined) element.level = level;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.AUDIO: {\n const element: AudioElement = { type: SSML_TAGS.AUDIO };\n const src = readAttribute(attributes, SSML_ATTRS.SRC);\n const desc = readAttribute(attributes, SSML_ATTRS.DESC);\n const clipBegin = readAttribute(attributes, SSML_ATTRS.CLIP_BEGIN);\n const clipEnd = readAttribute(attributes, SSML_ATTRS.CLIP_END);\n const speed = readAttribute(attributes, SSML_ATTRS.SPEED);\n const repeatCount = readAttribute(attributes, SSML_ATTRS.REPEAT_COUNT);\n const repeatDuration = readAttribute(attributes, SSML_ATTRS.REPEAT_DURATION);\n const soundLevel = readAttribute(attributes, SSML_ATTRS.SOUND_LEVEL);\n if (src !== undefined) element.src = src;\n if (desc !== undefined) element.desc = desc;\n if (clipBegin !== undefined) element.clipBegin = clipBegin;\n if (clipEnd !== undefined) element.clipEnd = clipEnd;\n if (speed !== undefined) element.speed = speed;\n if (repeatCount !== undefined) element.repeatCount = repeatCount;\n if (repeatDuration !== undefined) element.repeatDuration = repeatDuration;\n if (soundLevel !== undefined) element.soundLevel = soundLevel;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.SUB: {\n const element: SubElement = { type: SSML_TAGS.SUB };\n const alias = readAttribute(attributes, SSML_ATTRS.ALIAS);\n if (alias !== undefined) element.alias = alias;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.LANG: {\n const element: LangElement = { type: SSML_TAGS.LANG };\n const lang = readAttribute(attributes, SSML_ATTRS.XML_LANG, SSML_ATTRS.LANG);\n if (lang !== undefined) element.lang = lang;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.MARK: {\n const element: MarkElement = { type: SSML_TAGS.MARK };\n const name = readAttribute(attributes, SSML_ATTRS.NAME);\n if (name !== undefined) element.name = name;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.BOOKMARK: {\n const element: BookmarkElement = { type: SSML_TAGS.BOOKMARK };\n const mark = readAttribute(attributes, SSML_ATTRS.MARK);\n if (mark !== undefined) element.mark = mark;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.LEXICON: {\n const element: LexiconElement = { type: SSML_TAGS.LEXICON };\n const uri = readAttribute(attributes, SSML_ATTRS.URI);\n if (uri !== undefined) element.uri = uri;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.PARAGRAPH: {\n const element: ParagraphElement = { type: SSML_TAGS.PARAGRAPH };\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.SENTENCE: {\n const element: SentenceElement = { type: SSML_TAGS.SENTENCE };\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.WORD: {\n const element: WordElement = { type: SSML_TAGS.WORD };\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.MSTTS_SILENCE:\n case SSML_TAGS.SILENCE: {\n const element: MsttsSilenceElement = {\n type: node.name === SSML_TAGS.MSTTS_SILENCE ? SSML_TAGS.MSTTS_SILENCE : SSML_TAGS.SILENCE,\n };\n const typeValue = readAttribute(attributes, SSML_ATTRS.TYPE);\n const value = readAttribute(attributes, SSML_ATTRS.VALUE);\n if (typeValue !== undefined) element.typeValue = typeValue;\n if (value !== undefined) element.value = value;\n return finishElement(element, node, attributes);\n }\n case SSML_TAGS.MSTTS_VISEME:\n case SSML_TAGS.VISEME: {\n const element: MsttsVisemeElement = {\n type: node.name === SSML_TAGS.MSTTS_VISEME ? SSML_TAGS.MSTTS_VISEME : SSML_TAGS.VISEME,\n };\n const typeValue = readAttribute(attributes, SSML_ATTRS.TYPE);\n if (typeValue !== undefined) element.typeValue = typeValue;\n return finishElement(element, node, attributes);\n }\n default: {\n const element: CustomElement = {\n name: node.name,\n type: \"custom\",\n };\n return finishElement(element, node, attributes);\n }\n }\n}\n\nfunction convertNode(node: XmlNode): SsmlNode {\n return typeof node === \"string\" ? node : convertElement(node);\n}\n\nexport function parseSsml(xmlString: string): SsmlDocument {\n if (typeof xmlString !== \"string\") {\n throw new TypeError(\"SSML input must be a string\");\n }\n\n const root = new XmlParser(xmlString).parse();\n if (root.name !== SSML_TAGS.SPEAK) {\n throw new Error(`SSML root element must be <${SSML_TAGS.SPEAK}>, found <${root.name}>`);\n }\n\n const attributes: SsmlAttributes = { ...root.attributes };\n const version = readAttribute(attributes, SSML_ATTRS.VERSION);\n const lang = readAttribute(attributes, SSML_ATTRS.XML_LANG, SSML_ATTRS.LANG);\n if (version === undefined) {\n throw new Error(`SSML <${SSML_TAGS.SPEAK}> element is missing the \"${SSML_ATTRS.VERSION}\" attribute`);\n }\n if (lang === undefined) {\n throw new Error(`SSML <${SSML_TAGS.SPEAK}> element is missing the \"${SSML_ATTRS.XML_LANG}\" attribute`);\n }\n\n removeStandardNamespaceAttributes(attributes);\n const document: SsmlDocument = {\n children: root.children.map(convertNode),\n lang,\n type: SSML_TAGS.SPEAK,\n version,\n };\n if (Object.keys(attributes).length > 0) {\n document.attributes = attributes;\n }\n return document;\n}\n","import { buildSsml } from \"./builder.ts\";\nimport {\n DEFAULT_SSML_LANGUAGE,\n DEFAULT_SSML_VERSION,\n SSML_ATTRS,\n SSML_TAGS,\n SYNTHESIS_NAMESPACE,\n} from \"./constants/ssml.ts\";\nimport { parseSsml } from \"./parser.ts\";\nimport type { ProsodyElement, SsmlAttributes, SsmlDocument, SsmlNode, VoiceElement } from \"./types.ts\";\n\nexport type SsmlPartialVoice = Pick<VoiceElement, \"name\" | \"effect\" | \"attributes\">;\n\nexport type SsmlPartialProsody = Pick<ProsodyElement, \"rate\" | \"pitch\" | \"volume\" | \"contour\" | \"range\" | \"attributes\">;\n\nexport interface SsmlPartialContext {\n /** SSML version used for the generated document. */\n version?: string;\n /** BCP-47 language tag used for the generated document. */\n lang?: string;\n /** Preferred voice name; a voice object takes precedence, while this overrides a string `voice` shorthand. */\n voiceName?: string;\n /** Optional Azure voice effect used with `voiceName` or a string `voice` shorthand. */\n voiceEffect?: string;\n /** A voice name shorthand or a voice object whose attributes are preserved. */\n voice?: string | SsmlPartialVoice;\n /** Optional prosody values applied around the partial text. */\n prosody?: SsmlPartialProsody;\n /** Additional attributes added to the generated `speak` element. */\n attributes?: SsmlAttributes;\n}\n\nexport interface BuildPartialSsmlOptions extends SsmlPartialContext {\n text: string;\n}\n\nfunction escapeAttribute(value: string): string {\n return value\n .replace(/&/g, \"&\")\n .replace(/\"/g, \""\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/'/g, \"'\");\n}\n\nfunction getPartialTextNodes(text: string, version: string, lang: string): SsmlNode[] {\n if (!text.includes(\"<\")) {\n return [text];\n }\n\n try {\n const openingTag = `<${SSML_TAGS.SPEAK} ${SSML_ATTRS.VERSION}=\"${escapeAttribute(version)}\" ${SSML_ATTRS.XMLNS}=\"${SYNTHESIS_NAMESPACE}\" ${SSML_ATTRS.XML_LANG}=\"${escapeAttribute(lang)}\">`;\n return parseSsml(`${openingTag}${text}</${SSML_TAGS.SPEAK}>`).children ?? [];\n } catch {\n return [{ type: \"text\", value: text }];\n }\n}\n\nfunction getVoiceContext(context: SsmlPartialContext): SsmlPartialVoice | undefined {\n const voice = context.voice;\n if (typeof voice === \"object\" && voice !== null) {\n return voice;\n }\n\n if (context.voiceName === undefined && context.voiceEffect === undefined && typeof voice !== \"string\") {\n return undefined;\n }\n\n return {\n name: context.voiceName ?? voice,\n effect: context.voiceEffect,\n };\n}\n\nfunction serializePartialSsml(text: string, context: SsmlPartialContext): string {\n const version = context.version ?? DEFAULT_SSML_VERSION;\n const lang = context.lang ?? DEFAULT_SSML_LANGUAGE;\n let children = getPartialTextNodes(text, version, lang);\n\n if (context.prosody) {\n children = [\n {\n type: SSML_TAGS.PROSODY,\n ...context.prosody,\n children,\n },\n ];\n }\n\n const voice = getVoiceContext(context);\n if (voice) {\n children = [\n {\n type: SSML_TAGS.VOICE,\n ...voice,\n children,\n },\n ];\n }\n\n const document: SsmlDocument = {\n type: SSML_TAGS.SPEAK,\n version,\n lang,\n attributes: context.attributes,\n children,\n };\n return buildSsml(document);\n}\n\nexport function buildPartialSsml(text: string, context?: SsmlPartialContext): string;\nexport function buildPartialSsml(options: BuildPartialSsmlOptions): string;\nexport function buildPartialSsml(\n textOrOptions: string | BuildPartialSsmlOptions,\n context?: SsmlPartialContext,\n): string {\n if (typeof textOrOptions === \"string\") {\n return serializePartialSsml(textOrOptions, context ?? {});\n }\n\n return serializePartialSsml(textOrOptions.text, textOrOptions);\n}\n","import { parseSsml } from \"./parser.ts\";\n\nconst PARSER_POSITION_SUFFIX = / at position (\\d+)$/;\n\nexport interface SsmlValidationError {\n message: string;\n position: number;\n}\n\nexport function validateSsml(xmlString: string): SsmlValidationError | null {\n try {\n parseSsml(xmlString);\n return null;\n } catch (error) {\n const rawMessage = error instanceof Error ? error.message : String(error);\n const positionMatch = PARSER_POSITION_SUFFIX.exec(rawMessage);\n\n return {\n message: positionMatch ? rawMessage.slice(0, positionMatch.index) : rawMessage,\n position: positionMatch ? Number.parseInt(positionMatch[1], 10) : 0,\n };\n }\n}\n","import { parseSsml } from \"./parser.ts\";\n\nexport interface SsmlTextNodeContext {\n parentTag: string;\n path: string[];\n}\n\ninterface TextNodeRecord {\n context: SsmlTextNodeContext;\n decodedText: string;\n end: number;\n sourceEnd: number;\n sourceStart: number;\n start: number;\n}\n\nfunction decodeXmlText(value: string): string {\n return value.replace(/&(?:amp|apos|gt|lt|quot);|&#(?:x[\\da-f]+|\\d+);/gi, (entity) => {\n if (entity === \"&\") return \"&\";\n if (entity === \"'\") return \"'\";\n if (entity === \">\") return \">\";\n if (entity === \"<\") return \"<\";\n if (entity === \""\") return '\"';\n const hexadecimal = entity.toLowerCase().startsWith(\"&#x\");\n const digits = entity.slice(hexadecimal ? 3 : 2, -1);\n return String.fromCodePoint(Number.parseInt(digits, hexadecimal ? 16 : 10));\n });\n}\n\nfunction encodeXmlText(value: string): string {\n return value.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n}\n\nfunction findTagEnd(source: string, start: number): number {\n let quote = \"\";\n for (let index = start; index < source.length; index += 1) {\n const character = source[index];\n if (quote) {\n if (character === quote) quote = \"\";\n } else if (character === '\"' || character === \"'\") {\n quote = character;\n } else if (character === \">\") {\n return index;\n }\n }\n return source.length - 1;\n}\n\nfunction readTagName(tag: string): string | undefined {\n const match = /^<\\s*([A-Za-z_][A-Za-z0-9_.:-]*)/.exec(tag);\n return match?.[1];\n}\n\nfunction collectTextNodes(source: string): TextNodeRecord[] {\n const nodes: TextNodeRecord[] = [];\n const path: string[] = [];\n let index = 0;\n\n const addText = (start: number, end: number, rawText: string, sourceStart = start, sourceEnd = end): void => {\n if (!rawText) return;\n nodes.push({\n context: { parentTag: path[path.length - 1] ?? \"\", path: [...path] },\n decodedText: decodeXmlText(rawText),\n end,\n sourceEnd,\n sourceStart,\n start,\n });\n };\n\n while (index < source.length) {\n if (source[index] !== \"<\") {\n const nextTag = source.indexOf(\"<\", index);\n const end = nextTag === -1 ? source.length : nextTag;\n addText(index, end, source.slice(index, end));\n index = end;\n continue;\n }\n\n if (source.startsWith(\"<!--\", index)) {\n const end = source.indexOf(\"-->\", index + 4);\n index = end === -1 ? source.length : end + 3;\n continue;\n }\n if (source.startsWith(\"<![CDATA[\", index)) {\n const contentStart = index + 9;\n const end = source.indexOf(\"]]>\", contentStart);\n const contentEnd = end === -1 ? source.length : end;\n addText(\n contentStart,\n contentEnd,\n source.slice(contentStart, contentEnd),\n index,\n end === -1 ? source.length : end + 3,\n );\n index = end === -1 ? source.length : end + 3;\n continue;\n }\n if (source.startsWith(\"<?\", index)) {\n const end = source.indexOf(\"?>\", index + 2);\n index = end === -1 ? source.length : end + 2;\n continue;\n }\n if (source.startsWith(\"</\", index)) {\n const end = findTagEnd(source, index + 2);\n path.pop();\n index = end + 1;\n continue;\n }\n\n const end = findTagEnd(source, index + 1);\n const tag = source.slice(index, end + 1);\n const name = readTagName(tag);\n if (name && !/\\/\\s*>$/.test(tag)) path.push(name);\n index = end + 1;\n }\n\n return nodes;\n}\n\nexport function extractSsmlText(ssml: string): string[] {\n parseSsml(ssml);\n return collectTextNodes(ssml).map((node) => node.decodedText);\n}\n\nexport async function mapSsmlTextNodes(\n ssml: string,\n transform: (text: string, context: SsmlTextNodeContext) => string | Promise<string>,\n): Promise<string> {\n parseSsml(ssml);\n const nodes = collectTextNodes(ssml);\n const replacements = await Promise.all(\n nodes.map(async (node) => {\n const transformed = await transform(node.decodedText, {\n parentTag: node.context.parentTag,\n path: [...node.context.path],\n });\n if (typeof transformed !== \"string\") {\n throw new TypeError(\"SSML text node transform must return a string\");\n }\n return transformed === node.decodedText\n ? ssml.slice(node.sourceStart, node.sourceEnd)\n : encodeXmlText(transformed);\n }),\n );\n\n let result = \"\";\n let cursor = 0;\n nodes.forEach((node, nodeIndex) => {\n result += ssml.slice(cursor, node.sourceStart) + replacements[nodeIndex];\n cursor = node.sourceEnd;\n });\n return result + ssml.slice(cursor);\n}\n","import { parseSsml } from \"./parser.ts\";\n\nexport type SsmlDiagnosticSeverity = \"error\" | \"warning\";\n\nexport interface SsmlDiagnostic {\n line: number;\n column: number;\n message: string;\n severity: SsmlDiagnosticSeverity;\n}\n\nexport interface AzureSsmlValidationOptions {\n allowedAudioOrigins?: readonly string[];\n allowHttpAudio?: boolean;\n maxLength?: number;\n}\n\ninterface ElementToken {\n attributes: Map<string, string>;\n end: number;\n name: string;\n start: number;\n selfClosing: boolean;\n}\n\nconst EXPRESS_AS_STYLES: Readonly<Record<string, readonly string[]>> = {\n \"en-us-jennyneural\": [\n \"assistant\",\n \"chat\",\n \"customerservice\",\n \"newscast\",\n \"cheerful\",\n \"empathetic\",\n \"excited\",\n \"friendly\",\n \"hopeful\",\n \"sad\",\n \"shouting\",\n \"terrified\",\n \"unfriendly\",\n \"whispering\",\n ],\n \"en-us-guyneural\": [\n \"angry\",\n \"cheerful\",\n \"excited\",\n \"friendly\",\n \"hopeful\",\n \"newscast\",\n \"sad\",\n \"shouting\",\n \"terrified\",\n \"unfriendly\",\n \"whispering\",\n ],\n \"en-us-jennymultilingualneural\": [\n \"cheerful\",\n \"empathetic\",\n \"excited\",\n \"friendly\",\n \"hopeful\",\n \"sad\",\n \"shouting\",\n \"terrified\",\n \"unfriendly\",\n \"whispering\",\n ],\n \"en-us-andrewneural\": [\"empathetic\", \"relieved\"],\n \"ja-jp-mayuneural\": [\"calm\", \"cheerful\", \"sad\"],\n \"ja-jp-nanamineural\": [\"chat\", \"customerservice\", \"cheerful\", \"whispering\", \"sad\"],\n \"ja-jp-keitaneural\": [\"chat\"],\n \"ko-kr-sunhineural\": [\"cheerful\", \"sad\"],\n \"zh-cn-yunxineural\": [\n \"narration-relaxed\",\n \"embarrassed\",\n \"fearful\",\n \"sad\",\n \"disgruntled\",\n \"serious\",\n \"angry\",\n \"depressed\",\n \"chat\",\n \"cheerful\",\n \"assistant\",\n ],\n \"zh-cn-xiaoxiaoneural\": [\n \"assistant\",\n \"chat\",\n \"customerservice\",\n \"newscast\",\n \"cheerful\",\n \"empathetic\",\n \"excited\",\n \"friendly\",\n \"hopeful\",\n \"sad\",\n \"terrified\",\n \"whispering\",\n \"poetry-reading\",\n \"sports_commentary\",\n \"sports_commentary_excited\",\n \"story\",\n ],\n \"fr-fr-deniseneural\": [\"cheerful\", \"sad\"],\n \"fr-fr-henrineural\": [\"cheerful\", \"sad\"],\n \"pt-br-franciscaneural\": [\"calm\"],\n \"it-it-elsaneural\": [\"cheerful\", \"sad\"],\n \"de-de-katjaneural\": [\"cheerful\", \"sad\"],\n \"de-de-conradneural\": [\"cheerful\", \"sad\"],\n \"ru-ru-svetlananeural\": [\"cheerful\", \"sad\", \"angry\", \"disgruntled\", \"embarrassed\", \"fearful\"],\n};\n\nconst ALLOWED_BREAK_STRENGTHS = new Set([\"none\", \"x-weak\", \"weak\", \"medium\", \"strong\", \"x-strong\"]);\nconst ALLOWED_SAY_AS = new Set([\n \"characters\",\n \"spell-out\",\n \"cardinal\",\n \"ordinal\",\n \"number\",\n \"date\",\n \"time\",\n \"telephone\",\n \"fraction\",\n \"address\",\n \"name\",\n \"currency\",\n]);\nconst ALLOWED_ROLES = new Set([\n \"Girl\",\n \"Boy\",\n \"YoungAdultFemale\",\n \"YoungAdultMale\",\n \"OlderAdultFemale\",\n \"OlderAdultMale\",\n \"SeniorFemale\",\n \"SeniorMale\",\n]);\nconst ALLOWED_EMPHASIS_LEVELS = new Set([\"strong\", \"moderate\", \"reduced\", \"none\"]);\nconst ALLOWED_SILENCE_TYPES = new Set([\n \"Leading\",\n \"Tailing\",\n \"Sentenceboundary\",\n \"Comma\",\n \"Semicolon\",\n \"Enumerationcomma\",\n]);\nconst ALLOWED_VISEME_TYPES = new Set([\"redlips_front\", \"FacialExpression\"]);\n\nfunction decodeAttribute(value: string): string {\n return value.replace(\n /&(?:amp|apos|gt|lt|quot);/gi,\n (entity) =>\n ({ \"&\": \"&\", \"'\": \"'\", \">\": \">\", \"<\": \"<\", \""\": '\"' })[entity.toLowerCase()] ?? entity,\n );\n}\n\nfunction findTagEnd(source: string, start: number): number {\n let quote = \"\";\n for (let index = start; index < source.length; index += 1) {\n const character = source[index];\n if (quote) {\n if (character === quote) quote = \"\";\n } else if (character === '\"' || character === \"'\") quote = character;\n else if (character === \">\") return index;\n }\n return source.length - 1;\n}\n\nfunction tokenizeElements(source: string): ElementToken[] {\n const tokens: ElementToken[] = [];\n let index = 0;\n while (index < source.length) {\n const start = source.indexOf(\"<\", index);\n if (start === -1) break;\n if (source.startsWith(\"<!--\", start)) {\n const end = source.indexOf(\"-->\", start + 4);\n index = end === -1 ? source.length : end + 3;\n continue;\n }\n if (source.startsWith(\"<![CDATA[\", start)) {\n const end = source.indexOf(\"]]>\", start + 9);\n index = end === -1 ? source.length : end + 3;\n continue;\n }\n if (source.startsWith(\"<?\", start)) {\n const end = source.indexOf(\"?>\", start + 2);\n index = end === -1 ? source.length : end + 2;\n continue;\n }\n const end = findTagEnd(source, start + 1);\n const raw = source.slice(start, end + 1);\n const nameMatch = /^<\\s*([A-Za-z_][A-Za-z0-9_.:-]*)/.exec(raw);\n if (!nameMatch?.[1] || raw.startsWith(\"</\")) {\n index = end + 1;\n continue;\n }\n const attributes = new Map<string, string>();\n const attributeSource = raw.slice(nameMatch[0].length, raw.length - 1).replace(/\\/\\s*$/, \"\");\n const attributePattern = /([A-Za-z_][A-Za-z0-9_.:-]*)\\s*=\\s*([\"'])([\\s\\S]*?)\\2/g;\n for (const match of attributeSource.matchAll(attributePattern)) {\n attributes.set(match[1].toLowerCase(), decodeAttribute(match[3]));\n }\n tokens.push({ attributes, end, name: nameMatch[1], selfClosing: /\\/\\s*>$/.test(raw), start });\n index = end + 1;\n }\n return tokens;\n}\n\nfunction location(source: string, offset: number): { column: number; line: number } {\n const before = source.slice(0, Math.max(0, offset));\n const line = before.split(\"\\n\").length;\n return { line, column: before.length - (before.lastIndexOf(\"\\n\") + 1) + 1 };\n}\n\nfunction addDiagnostic(\n diagnostics: SsmlDiagnostic[],\n source: string,\n offset: number,\n message: string,\n severity: SsmlDiagnosticSeverity = \"error\",\n): void {\n diagnostics.push({ ...location(source, offset), message, severity });\n}\n\nfunction attr(token: ElementToken, name: string): string | undefined {\n return token.attributes.get(name.toLowerCase());\n}\n\nfunction validateElement(\n token: ElementToken,\n source: string,\n diagnostics: SsmlDiagnostic[],\n voiceName: string | undefined,\n options: AzureSsmlValidationOptions,\n): void {\n const name = token.name.toLowerCase();\n if (name === \"voice\" && !attr(token, \"name\")?.trim())\n addDiagnostic(diagnostics, source, token.start, '<voice> requires a non-empty \"name\" attribute.');\n if (name === \"break\") {\n const time = attr(token, \"time\");\n const strength = attr(token, \"strength\");\n if (!time && !strength)\n addDiagnostic(diagnostics, source, token.start, '<break> requires either \"time\" or \"strength\".');\n if (time && strength)\n addDiagnostic(diagnostics, source, token.start, '<break> must not specify both \"time\" and \"strength\".');\n if (time && !/^\\d+(?:\\.\\d+)?(?:ms|s)$/.test(time.trim()))\n addDiagnostic(diagnostics, source, token.start, '<break time> must use a numeric value followed by \"ms\" or \"s\".');\n if (strength && !ALLOWED_BREAK_STRENGTHS.has(strength))\n addDiagnostic(diagnostics, source, token.start, `Unsupported <break strength> value \"${strength}\".`);\n }\n if (name === \"prosody\") {\n const rate = attr(token, \"rate\");\n const pitch = attr(token, \"pitch\");\n const volume = attr(token, \"volume\");\n if (rate && !/^(x-slow|slow|medium|fast|x-fast|[+-]?\\d+(?:\\.\\d+)?%)$/.test(rate.trim()))\n addDiagnostic(diagnostics, source, token.start, `Unsupported <prosody rate> value \"${rate}\".`);\n if (pitch && !/^(x-low|low|medium|high|x-high|[+-]?\\d+(?:\\.\\d+)?(?:st|Hz|%)?)$/.test(pitch.trim()))\n addDiagnostic(diagnostics, source, token.start, `Unsupported <prosody pitch> value \"${pitch}\".`);\n if (volume && !/^(silent|x-soft|soft|medium|loud|x-loud|[+-]?\\d+(?:\\.\\d+)?(?:dB|%)?)$/.test(volume.trim()))\n addDiagnostic(diagnostics, source, token.start, `Unsupported <prosody volume> value \"${volume}\".`);\n }\n if (name === \"mstts:express-as\" || name === \"express-as\" || name === \"expressas\") {\n const style = attr(token, \"style\");\n if (!style?.trim())\n addDiagnostic(diagnostics, source, token.start, '<mstts:express-as> requires a non-empty \"style\" attribute.');\n const degree = attr(token, \"styledegree\") ?? attr(token, \"style-degree\");\n if (degree && (!/^\\d+(?:\\.\\d+)?$/.test(degree) || Number(degree) < 0.01 || Number(degree) > 2))\n addDiagnostic(\n diagnostics,\n source,\n token.start,\n \"<mstts:express-as styledegree> must be a number between 0.01 and 2.\",\n );\n const role = attr(token, \"role\");\n if (role && !ALLOWED_ROLES.has(role))\n addDiagnostic(diagnostics, source, token.start, `Unsupported <mstts:express-as role> value \"${role}\".`);\n const supportedStyles = voiceName ? EXPRESS_AS_STYLES[voiceName.toLowerCase()] : undefined;\n if (style && supportedStyles && !supportedStyles.includes(style.toLowerCase()))\n addDiagnostic(diagnostics, source, token.start, `Style \"${style}\" is not supported by voice \"${voiceName}\".`);\n }\n if (name === \"say-as\" || name === \"sayas\") {\n const interpretAs = attr(token, \"interpret-as\");\n if (!interpretAs || !ALLOWED_SAY_AS.has(interpretAs))\n addDiagnostic(diagnostics, source, token.start, `<say-as> requires a supported \"interpret-as\" value.`);\n }\n if (name === \"phoneme\" && (!attr(token, \"alphabet\") || !attr(token, \"ph\")))\n addDiagnostic(diagnostics, source, token.start, '<phoneme> requires both \"alphabet\" and \"ph\" attributes.');\n if (name === \"emphasis\" && attr(token, \"level\") && !ALLOWED_EMPHASIS_LEVELS.has(attr(token, \"level\") ?? \"\"))\n addDiagnostic(diagnostics, source, token.start, `Unsupported <emphasis level> value \"${attr(token, \"level\")}\".`);\n if (name === \"sub\" && !attr(token, \"alias\")?.trim())\n addDiagnostic(diagnostics, source, token.start, '<sub> requires a non-empty \"alias\" attribute.');\n if (name === \"lang\" && !attr(token, \"xml:lang\")?.trim() && !attr(token, \"lang\")?.trim())\n addDiagnostic(diagnostics, source, token.start, '<lang> requires an \"xml:lang\" attribute.');\n if (name === \"mark\" && !attr(token, \"name\")?.trim())\n addDiagnostic(diagnostics, source, token.start, '<mark> requires a non-empty \"name\" attribute.');\n if (name === \"bookmark\" && !attr(token, \"mark\")?.trim())\n addDiagnostic(diagnostics, source, token.start, '<bookmark> requires a non-empty \"mark\" attribute.');\n if (name === \"lexicon\") {\n const uri = attr(token, \"uri\");\n if (!uri) addDiagnostic(diagnostics, source, token.start, '<lexicon> requires a \"uri\" attribute.');\n else {\n try {\n const parsed = new URL(uri);\n if (parsed.protocol !== \"https:\")\n addDiagnostic(diagnostics, source, token.start, \"<lexicon uri> must use HTTPS.\");\n } catch {\n addDiagnostic(diagnostics, source, token.start, \"<lexicon uri> must be an absolute HTTPS URL.\");\n }\n }\n }\n if (name === \"mstts:silence\") {\n const type = attr(token, \"type\");\n const value = attr(token, \"value\");\n if (!type || !ALLOWED_SILENCE_TYPES.has(type))\n addDiagnostic(diagnostics, source, token.start, '<mstts:silence> requires a supported \"type\" attribute.');\n if (!value || !/^\\d+(?:\\.\\d+)?(?:ms|s)$/.test(value.trim()))\n addDiagnostic(diagnostics, source, token.start, '<mstts:silence> requires a time-valued \"value\" attribute.');\n }\n if (name === \"mstts:viseme\") {\n const type = attr(token, \"type\");\n if (!type || !ALLOWED_VISEME_TYPES.has(type))\n addDiagnostic(diagnostics, source, token.start, '<mstts:viseme> requires a supported \"type\" attribute.');\n }\n if (name === \"audio\") {\n const src = attr(token, \"src\");\n if (!src) addDiagnostic(diagnostics, source, token.start, '<audio> requires a \"src\" attribute.');\n else {\n let parsed: URL;\n try {\n parsed = new URL(src);\n } catch {\n addDiagnostic(diagnostics, source, token.start, \"<audio src> must be an absolute HTTP(S) URL.\");\n return;\n }\n if (parsed.protocol !== \"https:\" && !(options.allowHttpAudio && parsed.protocol === \"http:\"))\n addDiagnostic(diagnostics, source, token.start, \"<audio src> must use HTTPS.\");\n if (options.allowedAudioOrigins && !options.allowedAudioOrigins.includes(parsed.origin))\n addDiagnostic(diagnostics, source, token.start, `<audio src> origin \"${parsed.origin}\" is not allowed.`);\n }\n }\n}\n\nexport function validateAzureSsml(ssml: string, options: AzureSsmlValidationOptions = {}): SsmlDiagnostic[] {\n const diagnostics: SsmlDiagnostic[] = [];\n if (typeof ssml !== \"string\") {\n return [{ line: 1, column: 1, message: \"SSML input must be a string\", severity: \"error\" }];\n }\n const maxLength = options.maxLength ?? 10_000;\n if (ssml.length > maxLength)\n addDiagnostic(diagnostics, ssml, maxLength, `SSML exceeds the maximum length of ${maxLength} characters.`);\n try {\n parseSsml(ssml);\n } catch (error) {\n const message = error instanceof Error ? error.message.replace(/ at position \\d+$/, \"\") : String(error);\n const match = / at position (\\d+)$/.exec(error instanceof Error ? error.message : \"\");\n addDiagnostic(diagnostics, ssml, match ? Number(match[1]) : 0, message);\n return diagnostics;\n }\n const tokens = tokenizeElements(ssml);\n const speak = tokens.find((token) => token.name.toLowerCase() === \"speak\");\n const voices = tokens.filter((token) => token.name.toLowerCase() === \"voice\");\n if (!speak || voices.length === 0)\n addDiagnostic(\n diagnostics,\n ssml,\n speak?.start ?? 0,\n \"Azure SSML requires at least one <voice> element under <speak>.\",\n );\n const voiceName = voices[0] ? attr(voices[0], \"name\") : undefined;\n for (const token of tokens) validateElement(token, ssml, diagnostics, voiceName, options);\n return diagnostics;\n}\n","import type { SsmlDocument, SsmlNode } from \"@ssml-builder-js/ssml-core\";\n\nfunction getDocumentChildren(document: SsmlDocument): SsmlNode[] {\n return document.children ?? (document.content === undefined ? [] : [document.content]);\n}\n\nfunction appendNode(nodes: SsmlNode[], node: SsmlNode): void {\n if (typeof node === \"string\") {\n const lastNode = nodes[nodes.length - 1];\n if (typeof lastNode === \"string\") {\n nodes[nodes.length - 1] = lastNode + node;\n } else if (node !== \"\") {\n nodes.push(node);\n }\n return;\n }\n\n nodes.push(node);\n}\n\nfunction clearNodes(nodes: SsmlNode[]): SsmlNode[] {\n const clearedNodes: SsmlNode[] = [];\n for (const node of nodes) {\n if (typeof node === \"string\") {\n appendNode(clearedNodes, node);\n continue;\n }\n\n if (node.type === \"text\") {\n appendNode(clearedNodes, node.value);\n continue;\n }\n\n const children = clearNodes(node.children ?? []);\n if (node.type === \"voice\") {\n appendNode(clearedNodes, { ...node, children });\n continue;\n }\n\n for (const child of children) {\n appendNode(clearedNodes, child);\n }\n }\n\n return clearedNodes;\n}\n\nexport function clearSsmlDocument(document: SsmlDocument): SsmlDocument {\n const nextDocument: SsmlDocument = {\n ...document,\n children: clearNodes(getDocumentChildren(document)),\n };\n if (nextDocument.content !== undefined) {\n delete nextDocument.content;\n }\n return nextDocument;\n}\n","const INDENT = \" \";\nconst FRAGMENT_ROOT = \"ssml-builder-fragment\";\nconst XML_ENTITY_NAMES = new Set([\"amp\", \"apos\", \"gt\", \"lt\", \"quot\"]);\nexport const INTRINSICALLY_EMPTY_ELEMENTS = new Set([\n \"break\",\n \"bookmark\",\n \"lexicon\",\n \"mark\",\n \"mstts:silence\",\n \"mstts:viseme\",\n \"silence\",\n \"viseme\",\n]);\n\ntype XmlNode = XmlElementNode | XmlTextNode | XmlMarkupNode;\n\ninterface XmlElementNode {\n kind: \"element\";\n name: string;\n open: string;\n close?: string;\n selfClosing: boolean;\n children: XmlNode[];\n}\n\ninterface XmlTextNode {\n kind: \"text\";\n value: string;\n}\n\ninterface XmlMarkupNode {\n kind: \"comment\" | \"cdata\" | \"declaration\" | \"processing-instruction\";\n raw: string;\n}\n\ninterface XmlDocument {\n children: XmlNode[];\n root: XmlElementNode;\n}\n\nfunction isXmlNameStart(value: string | undefined): boolean {\n return value !== undefined && /[A-Za-z_]/.test(value);\n}\n\nfunction isXmlNameCharacter(value: string | undefined): boolean {\n return value !== undefined && /[A-Za-z0-9_.:-]/.test(value);\n}\n\nfunction isXmlWhitespace(value: string | undefined): boolean {\n return value === \" \" || value === \"\\t\" || value === \"\\r\" || value === \"\\n\";\n}\n\nfunction fail(message: string): never {\n throw new Error(message);\n}\n\nfunction skipWhitespace(source: string, index: number): number {\n while (isXmlWhitespace(source[index])) {\n index += 1;\n }\n return index;\n}\n\nfunction readName(source: string, start: number, end: number): { name: string; index: number } {\n if (!isXmlNameStart(source[start])) {\n fail(\"Invalid XML name\");\n }\n\n let index = start + 1;\n while (index < end && isXmlNameCharacter(source[index])) {\n index += 1;\n }\n\n return { name: source.slice(start, index), index };\n}\n\nfunction validateCharacterReference(entity: string): void {\n const isHexadecimal = entity.startsWith(\"#x\") || entity.startsWith(\"#X\");\n const isDecimal = entity.startsWith(\"#\");\n if (!isHexadecimal && !isDecimal) {\n if (!XML_ENTITY_NAMES.has(entity)) {\n fail(`Unknown XML entity: &${entity};`);\n }\n return;\n }\n\n const digits = entity.slice(isHexadecimal ? 2 : 1);\n const validDigits = isHexadecimal ? /^[0-9A-Fa-f]+$/.test(digits) : /^[0-9]+$/.test(digits);\n const codePoint = Number.parseInt(digits, isHexadecimal ? 16 : 10);\n if (\n !validDigits ||\n !Number.isInteger(codePoint) ||\n codePoint < 0 ||\n codePoint > 0x10ffff ||\n (codePoint >= 0xd800 && codePoint <= 0xdfff) ||\n (codePoint < 0x20 && ![9, 10, 13].includes(codePoint))\n ) {\n fail(`Invalid XML character reference: &${entity};`);\n }\n}\n\nfunction validateEntityReferences(value: string): void {\n let index = 0;\n\n while (true) {\n const ampersand = value.indexOf(\"&\", index);\n if (ampersand === -1) {\n return;\n }\n\n const semicolon = value.indexOf(\";\", ampersand + 1);\n if (semicolon === -1) {\n fail(\"Unterminated XML entity reference\");\n }\n\n validateCharacterReference(value.slice(ampersand + 1, semicolon));\n index = semicolon + 1;\n }\n}\n\nfunction findTagEnd(source: string, start: number, hasInternalSubset = false): number {\n let quote: string | undefined;\n let subsetDepth = 0;\n\n for (let index = start + 1; index < source.length; index += 1) {\n const character = source[index];\n\n if (quote !== undefined) {\n if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n\n if (hasInternalSubset) {\n if (character === \"[\") {\n subsetDepth += 1;\n continue;\n }\n if (character === \"]\" && subsetDepth > 0) {\n subsetDepth -= 1;\n continue;\n }\n }\n\n if (character === \">\" && subsetDepth === 0) {\n return index;\n }\n }\n\n fail(\"Unclosed XML markup\");\n}\n\nfunction parseStartTag(\n source: string,\n start: number,\n end: number,\n): {\n name: string;\n selfClosing: boolean;\n} {\n const nameResult = readName(source, start + 1, end);\n let index = nameResult.index;\n let hasAttribute = false;\n const attributeNames = new Set<string>();\n\n while (index < end) {\n const beforeWhitespace = index;\n index = skipWhitespace(source, index);\n if (index === end) {\n break;\n }\n\n if (source[index] === \"/\") {\n if (index + 1 !== end) {\n fail(\"Invalid XML self-closing tag\");\n }\n return { name: nameResult.name, selfClosing: true };\n }\n\n if (hasAttribute && beforeWhitespace === index) {\n fail(\"XML attributes must be separated by whitespace\");\n }\n\n const attribute = readName(source, index, end);\n index = skipWhitespace(source, attribute.index);\n if (source[index] !== \"=\") {\n fail(`XML attribute ${attribute.name} must have a value`);\n }\n index = skipWhitespace(source, index + 1);\n\n const quote = source[index];\n if (quote !== '\"' && quote !== \"'\") {\n fail(`XML attribute ${attribute.name} must use a quoted value`);\n }\n index += 1;\n\n const valueStart = index;\n while (index < end && source[index] !== quote) {\n if (source[index] === \"<\") {\n fail(`Invalid \"<\" in XML attribute ${attribute.name}`);\n }\n index += 1;\n }\n if (index === end) {\n fail(`Unclosed XML attribute ${attribute.name}`);\n }\n\n if (attributeNames.has(attribute.name)) {\n fail(`Duplicate XML attribute: ${attribute.name}`);\n }\n attributeNames.add(attribute.name);\n validateEntityReferences(source.slice(valueStart, index));\n index += 1;\n hasAttribute = true;\n }\n\n return { name: nameResult.name, selfClosing: false };\n}\n\nfunction parseClosingTag(source: string, start: number, end: number): string {\n const nameResult = readName(source, start + 2, end);\n if (skipWhitespace(source, nameResult.index) !== end) {\n fail(\"Invalid XML closing tag\");\n }\n return nameResult.name;\n}\n\nfunction parseProcessingInstruction(source: string, start: number, end: number): void {\n readName(source, start + 2, end);\n}\n\nfunction parseDeclaration(source: string, start: number, end: number): void {\n readName(source, start + 2, end);\n}\n\nfunction appendNode(nodes: XmlNode[], node: XmlNode): void {\n const previous = nodes[nodes.length - 1];\n if (node.kind === \"text\" && previous?.kind === \"text\") {\n previous.value += node.value;\n return;\n }\n nodes.push(node);\n}\n\nfunction currentElement(stack: XmlElementNode[]): XmlElementNode | undefined {\n return stack[stack.length - 1];\n}\n\nfunction parseXml(source: string): XmlDocument {\n const children: XmlNode[] = [];\n const stack: XmlElementNode[] = [];\n let root: XmlElementNode | undefined;\n let index = 0;\n\n while (index < source.length) {\n if (source[index] !== \"<\") {\n const textStart = index;\n while (index < source.length && source[index] !== \"<\") {\n index += 1;\n }\n\n const value = source.slice(textStart, index);\n if (value.includes(\"]]>\")) {\n fail(\"CDATA termination is not valid in ordinary XML text\");\n }\n validateEntityReferences(value);\n if (stack.length === 0 && value.trim() !== \"\") {\n fail(\"Unexpected text outside the root XML element\");\n }\n appendNode(currentElement(stack)?.children ?? children, { kind: \"text\", value });\n continue;\n }\n\n if (source.startsWith(\"<!--\", index)) {\n const end = source.indexOf(\"-->\", index + 4);\n if (end === -1) {\n fail(\"Unclosed XML comment\");\n }\n const content = source.slice(index + 4, end);\n if (content.includes(\"--\") || content.endsWith(\"-\")) {\n fail(\"Invalid XML comment\");\n }\n appendNode(currentElement(stack)?.children ?? children, {\n kind: \"comment\",\n raw: source.slice(index, end + 3),\n });\n index = end + 3;\n continue;\n }\n\n if (source.startsWith(\"<![CDATA[\", index)) {\n const end = source.indexOf(\"]]>\", index + \"<![CDATA[\".length);\n if (end === -1) {\n fail(\"Unclosed XML CDATA section\");\n }\n if (stack.length === 0) {\n fail(\"CDATA is not allowed outside the root XML element\");\n }\n appendNode(currentElement(stack)?.children ?? children, {\n kind: \"cdata\",\n raw: source.slice(index, end + 3),\n });\n index = end + 3;\n continue;\n }\n\n if (source.startsWith(\"<?\", index)) {\n const end = source.indexOf(\"?>\", index + 2);\n if (end === -1) {\n fail(\"Unclosed XML processing instruction\");\n }\n parseProcessingInstruction(source, index, end);\n appendNode(currentElement(stack)?.children ?? children, {\n kind: \"processing-instruction\",\n raw: source.slice(index, end + 2),\n });\n index = end + 2;\n continue;\n }\n\n if (source.startsWith(\"</\", index)) {\n const end = findTagEnd(source, index);\n const name = parseClosingTag(source, index, end);\n const element = currentElement(stack);\n if (element === undefined || element.name !== name) {\n fail(`Mismatched closing XML element: </${name}>`);\n }\n element.close = source.slice(index, end + 1);\n stack.pop();\n index = end + 1;\n continue;\n }\n\n if (source.startsWith(\"<!\", index)) {\n const end = findTagEnd(source, index, true);\n parseDeclaration(source, index, end);\n appendNode(currentElement(stack)?.children ?? children, {\n kind: \"declaration\",\n raw: source.slice(index, end + 1),\n });\n index = end + 1;\n continue;\n }\n\n const end = findTagEnd(source, index);\n const { name, selfClosing } = parseStartTag(source, index, end);\n if (stack.length === 0) {\n if (root !== undefined) {\n fail(\"Multiple root XML elements are not allowed\");\n }\n root = {\n kind: \"element\",\n name,\n open: source.slice(index, end + 1),\n selfClosing,\n children: [],\n };\n children.push(root);\n } else {\n const element: XmlElementNode = {\n kind: \"element\",\n name,\n open: source.slice(index, end + 1),\n selfClosing,\n children: [],\n };\n currentElement(stack)?.children.push(element);\n if (!selfClosing) {\n stack.push(element);\n }\n index = end + 1;\n continue;\n }\n\n if (!selfClosing) {\n stack.push(root);\n }\n index = end + 1;\n }\n\n if (stack.length > 0) {\n fail(`Unclosed XML element: <${currentElement(stack)?.name}>`);\n }\n if (root === undefined) {\n fail(\"XML input does not contain a root element\");\n }\n\n return { children, root };\n}\n\nfunction indentation(depth: number): string {\n return INDENT.repeat(depth);\n}\n\nfunction renderInline(node: XmlElementNode): string {\n const content = node.children\n .map((child) => {\n if (child.kind === \"element\") {\n return renderInline(child);\n }\n return child.kind === \"text\" ? child.value : child.raw;\n })\n .join(\"\");\n\n return `${node.open}${content}${node.close ?? \"\"}`;\n}\n\nfunction hasOnlyTextChildren(node: XmlElementNode): boolean {\n return node.children.every((child) => child.kind === \"text\");\n}\n\nfunction hasSignificantText(node: XmlElementNode): boolean {\n return node.children.some((child) => child.kind === \"text\" && child.value.trim() !== \"\");\n}\n\nfunction hasOnlyWhitespaceText(node: XmlElementNode): boolean {\n return node.children.every((child) => child.kind === \"text\" && child.value.trim() === \"\");\n}\n\nfunction toSelfClosingTag(open: string): string {\n return `${open.slice(0, -1).trimEnd()}/>`;\n}\n\nfunction formatElement(node: XmlElementNode, depth: number, isRoot: boolean): string[] {\n const prefix = indentation(depth);\n\n if (node.selfClosing) {\n return [`${prefix}${node.open}`];\n }\n if (node.close === undefined) {\n fail(`Unclosed XML element: <${node.name}>`);\n }\n if (INTRINSICALLY_EMPTY_ELEMENTS.has(node.name) && hasOnlyWhitespaceText(node)) {\n return [`${prefix}${toSelfClosingTag(node.open)}`];\n }\n\n if (isRoot && hasOnlyTextChildren(node)) {\n const text = node.children\n .filter((child): child is XmlTextNode => child.kind === \"text\")\n .map((child) => child.value)\n .join(\"\");\n const trimmedText = text.trim();\n\n if (trimmedText === \"\") {\n return [`${prefix}${node.open}`, `${prefix}${node.close}`];\n }\n if (text.includes(\"\\n\") || text.includes(\"\\r\") || text !== trimmedText) {\n return [`${prefix}${renderInline(node)}`];\n }\n return [`${prefix}${node.open}`, `${indentation(depth + 1)}${trimmedText}`, `${prefix}${node.close}`];\n }\n\n if (hasSignificantText(node)) {\n return [`${prefix}${renderInline(node)}`];\n }\n\n const lines = [`${prefix}${node.open}`];\n for (const child of node.children) {\n if (child.kind === \"text\") {\n continue;\n }\n if (child.kind === \"element\") {\n lines.push(...formatElement(child, depth + 1, false));\n } else {\n lines.push(`${indentation(depth + 1)}${child.raw}`);\n }\n }\n lines.push(`${prefix}${node.close}`);\n return lines;\n}\n\nfunction stripTrailingWhitespace(value: string): string {\n return value.replace(/[ \\t]+$/gm, \"\");\n}\n\nfunction getTrailingLineBreaks(value: string): string {\n let start = value.length;\n while (start > 0) {\n if (value[start - 1] === \"\\n\") {\n start -= 1;\n if (start > 0 && value[start - 1] === \"\\r\") {\n start -= 1;\n }\n continue;\n }\n if (value[start - 1] === \"\\r\") {\n start -= 1;\n continue;\n }\n break;\n }\n return value.slice(start);\n}\n\nfunction stripTrailingLineBreaks(value: string): string {\n let end = value.length;\n while (end > 0) {\n if (value[end - 1] === \"\\n\") {\n end -= 1;\n if (end > 0 && value[end - 1] === \"\\r\") {\n end -= 1;\n }\n continue;\n }\n if (value[end - 1] === \"\\r\") {\n end -= 1;\n continue;\n }\n break;\n }\n return value.slice(0, end);\n}\n\nfunction preserveTrailingLineBreak(formatted: string, trailingLineBreaks: string): string {\n if (trailingLineBreaks === \"\") {\n return formatted;\n }\n\n return `${stripTrailingLineBreaks(formatted)}${trailingLineBreaks}`;\n}\n\nfunction renderDocument(document: XmlDocument): string {\n const lines: string[] = [];\n\n for (const child of document.children) {\n if (child.kind === \"text\") {\n continue;\n }\n if (child.kind === \"element\") {\n lines.push(...formatElement(child, 0, child === document.root));\n } else {\n lines.push(child.raw);\n }\n }\n\n return stripTrailingWhitespace(lines.join(\"\\n\")).trim();\n}\n\nexport function formatXml(xml: string): string {\n const trailingLineBreaks = getTrailingLineBreaks(xml);\n const source = xml.trim();\n if (source === \"\") {\n return \"\";\n }\n\n try {\n return preserveTrailingLineBreak(renderDocument(parseXml(source)), trailingLineBreaks);\n } catch {\n return xml;\n }\n}\n\nfunction unwrapFormattedFragment(formatted: string): string | undefined {\n const opening = `<${FRAGMENT_ROOT}>`;\n const closing = `</${FRAGMENT_ROOT}>`;\n\n if (!formatted.startsWith(opening) || !formatted.endsWith(closing)) {\n return undefined;\n }\n\n if (formatted === `${opening}${closing}`) {\n return \"\";\n }\n\n const multilineOpening = `${opening}\\n`;\n const multilineClosing = `\\n${closing}`;\n if (formatted.startsWith(multilineOpening) && formatted.endsWith(multilineClosing)) {\n const content = formatted.slice(multilineOpening.length, -multilineClosing.length);\n return content\n .split(\"\\n\")\n .map((line) => (line.startsWith(INDENT) ? line.slice(INDENT.length) : line))\n .join(\"\\n\");\n }\n\n return formatted.slice(opening.length, -closing.length);\n}\n\nexport function formatXmlFragment(xml: string): string {\n const trailingLineBreaks = getTrailingLineBreaks(xml);\n const source = xml.trim();\n if (source === \"\") {\n return \"\";\n }\n\n const wrapped = `<${FRAGMENT_ROOT}>${source}</${FRAGMENT_ROOT}>`;\n let formatted: string;\n try {\n formatted = renderDocument(parseXml(wrapped));\n } catch {\n return xml;\n }\n\n return preserveTrailingLineBreak(unwrapFormattedFragment(formatted) ?? xml, trailingLineBreaks);\n}\n","import { buildSsml, parseSsml } from \"@ssml-builder-js/ssml-core\";\nimport type { ProsodyElement, SsmlDocument, SsmlElement, SsmlNode, VoiceElement } from \"@ssml-builder-js/ssml-core\";\nimport { INTRINSICALLY_EMPTY_ELEMENTS } from \"./formatXml\";\n\ninterface EditableStartTag {\n name: string;\n selfClosing: boolean;\n}\n\nfunction isSsmlElement(node: SsmlNode): node is SsmlElement {\n return typeof node !== \"string\" && node.type !== \"text\";\n}\n\nfunction isVoice(element: SsmlElement): element is VoiceElement {\n return element.type === \"voice\";\n}\n\nfunction isProsody(element: SsmlElement): element is ProsodyElement {\n return element.type === \"prosody\";\n}\n\nfunction getSsmlElementName(element: SsmlElement): string {\n return element.type === \"custom\" || element.type === \"element\" ? element.name : element.type;\n}\n\nfunction findEditableTagEnd(source: string, start: number): number {\n let quote: string | undefined;\n for (let index = start + 1; index < source.length; index += 1) {\n const character = source[index];\n if (quote !== undefined) {\n if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n if (character === \">\") {\n return index;\n }\n }\n return source.length;\n}\n\nfunction collectEditableStartTags(source: string): EditableStartTag[] {\n const tags: EditableStartTag[] = [];\n let index = 0;\n\n while (index < source.length) {\n if (source[index] !== \"<\") {\n index += 1;\n continue;\n }\n if (source.startsWith(\"<!--\", index)) {\n const end = source.indexOf(\"-->\", index + 4);\n index = end === -1 ? source.length : end + 3;\n continue;\n }\n if (source.startsWith(\"<![CDATA[\", index)) {\n const end = source.indexOf(\"]]>\", index + 9);\n index = end === -1 ? source.length : end + 3;\n continue;\n }\n if (source.startsWith(\"<?\", index)) {\n const end = source.indexOf(\"?>\", index + 2);\n index = end === -1 ? source.length : end + 2;\n continue;\n }\n if (source.startsWith(\"</\", index) || source.startsWith(\"<!\", index)) {\n const end = findEditableTagEnd(source, index);\n index = end === source.length ? source.length : end + 1;\n continue;\n }\n\n const end = findEditableTagEnd(source, index);\n if (end === source.length) {\n break;\n }\n const raw = source.slice(index, end + 1);\n const match = raw.match(/^<([A-Za-z_][A-Za-z0-9_.:-]*)/);\n if (match) {\n tags.push({ name: match[1], selfClosing: /\\/\\s*>$/.test(raw) });\n }\n index = end + 1;\n }\n\n return tags;\n}\n\nfunction preserveEmptyPairElements(\n nodes: SsmlNode[],\n startTags: readonly EditableStartTag[],\n startTagIndex: { value: number },\n): SsmlNode[] {\n return nodes.map((node) => {\n if (!isSsmlElement(node)) {\n return node;\n }\n\n const elementName = getSsmlElementName(node);\n const startTag = startTags[startTagIndex.value];\n startTagIndex.value += 1;\n if (node.children === undefined || node.children.length === 0) {\n return startTag?.name === elementName && !startTag.selfClosing && !INTRINSICALLY_EMPTY_ELEMENTS.has(elementName)\n ? { ...node, children: [\"\"] }\n : node;\n }\n\n const children = preserveEmptyPairElements(node.children, startTags, startTagIndex);\n if (children.every((child, index) => child === node.children?.[index])) {\n return node;\n }\n return { ...node, children };\n });\n}\n\nfunction getDocumentChildren(document: SsmlDocument): SsmlNode[] {\n return document.children ?? (document.content === undefined ? [] : [document.content]);\n}\n\nfunction findFirstElementPath(\n nodes: SsmlNode[],\n predicate: (element: SsmlElement) => boolean,\n ancestors: readonly SsmlElement[] = [],\n): SsmlElement[] | undefined {\n for (const node of nodes) {\n if (!isSsmlElement(node)) {\n continue;\n }\n\n const path = [...ancestors, node];\n if (predicate(node)) {\n return path;\n }\n\n const childPath = findFirstElementPath(node.children ?? [], predicate, path);\n if (childPath) {\n return childPath;\n }\n }\n return undefined;\n}\n\nfunction updateFirstElement<T extends SsmlElement>(\n nodes: SsmlNode[],\n predicate: (element: SsmlElement) => element is T,\n update: (element: T) => SsmlElement,\n): { nodes: SsmlNode[]; updated: boolean } {\n let updated = false;\n const nextNodes = nodes.map((node) => {\n if (updated || !isSsmlElement(node)) {\n return node;\n }\n\n if (predicate(node)) {\n updated = true;\n return update(node);\n }\n\n if (node.children) {\n const result = updateFirstElement(node.children, predicate, update);\n if (result.updated) {\n updated = true;\n return { ...node, children: result.nodes };\n }\n }\n\n return node;\n });\n\n return { nodes: nextNodes, updated };\n}\n\nfunction withChildren(document: SsmlDocument, children: SsmlNode[]): SsmlDocument {\n const nextDocument: SsmlDocument = { ...document, children };\n if (nextDocument.content !== undefined) {\n delete nextDocument.content;\n }\n return nextDocument;\n}\n\nfunction parseEditableText(value: string, lang: string): SsmlNode[] {\n try {\n const wrapper = buildSsml({\n version: \"1.0\",\n lang,\n children: [],\n });\n const openingTagEnd = wrapper.indexOf(\">\") + 1;\n const children = parseSsml(`${wrapper.slice(0, openingTagEnd)}${value}</speak>`).children ?? [];\n return children.some(isSsmlElement)\n ? preserveEmptyPairElements(children, collectEditableStartTags(value), { value: 0 })\n : [value];\n } catch {\n return [value];\n }\n}\n\nfunction serializeEditableText(nodes: SsmlNode[], lang: string): string {\n if (nodes.length === 1 && typeof nodes[0] === \"string\") {\n return nodes[0];\n }\n\n const xml = buildSsml({\n version: \"1.0\",\n lang,\n children: nodes,\n });\n const contentStart = xml.indexOf(\">\") + 1;\n return xml.slice(contentStart, -\"</speak>\".length);\n}\n\nexport function getEditableRegion(document: SsmlDocument): { children: SsmlNode[]; voiceName?: string } {\n const children = getDocumentChildren(document);\n const path = findFirstElementPath(children, isProsody) ?? findFirstElementPath(children, isVoice);\n const element = path ? path[path.length - 1] : undefined;\n const voice = path ? [...path].reverse().find(isVoice) : undefined;\n return {\n children: element?.children ?? children,\n ...(voice ? { voiceName: voice.name } : {}),\n };\n}\n\nexport function getEditableText(document: SsmlDocument): string {\n return serializeEditableText(getEditableRegion(document).children, document.lang);\n}\n\nexport function updateEditableText(document: SsmlDocument, value: string): SsmlDocument {\n const nextChildren = parseEditableText(value, document.lang);\n const editableChildren = nextChildren.length > 0 ? nextChildren : [value];\n const children = getDocumentChildren(document);\n const prosodyResult = updateFirstElement(children, isProsody, (prosody) => ({\n ...prosody,\n children: editableChildren,\n }));\n if (prosodyResult.updated) {\n return withChildren(document, prosodyResult.nodes);\n }\n\n const voiceResult = updateFirstElement(children, isVoice, (voice) => ({\n ...voice,\n children: editableChildren,\n }));\n if (voiceResult.updated) {\n return withChildren(document, voiceResult.nodes);\n }\n\n return withChildren(document, editableChildren);\n}\n","// @ts-expect-error The Node strip-types test runner requires the explicit TypeScript extension.\nimport { SSML_INSERTION_MODES } from \"./constants/ui.ts\";\n\nexport type SsmlInsertionMode = (typeof SSML_INSERTION_MODES)[keyof typeof SSML_INSERTION_MODES];\n\nexport interface SsmlInsertionTemplate {\n prefix: string;\n suffix: string;\n mode: SsmlInsertionMode;\n}\n\nexport interface SsmlInsertionEdit {\n replacement: string;\n selectionOffset: number;\n}\n\nfunction isLineStart(value: string, offset: number): boolean {\n return offset === 0 || value[offset - 1] === \"\\n\" || value[offset - 1] === \"\\r\";\n}\n\nfunction isLineEnd(value: string, offset: number): boolean {\n return offset === value.length || value[offset] === \"\\n\" || value[offset] === \"\\r\";\n}\n\nfunction getLineBreakAt(value: string, offset: number): string {\n if (value.startsWith(\"\\r\\n\", offset)) {\n return \"\\r\\n\";\n }\n if (value[offset] === \"\\n\" || value[offset] === \"\\r\") {\n return value[offset];\n }\n return \"\";\n}\n\nfunction startsWithLineBreak(value: string): boolean {\n return value.startsWith(\"\\n\") || value.startsWith(\"\\r\");\n}\n\nfunction endsWithLineBreak(value: string): boolean {\n return value.endsWith(\"\\n\") || value.endsWith(\"\\r\");\n}\n\nexport function createSsmlInsertionEdit(\n source: string,\n startOffset: number,\n endOffset: number,\n template: SsmlInsertionTemplate,\n eol = \"\\n\",\n selectedText = startOffset === endOffset ? \"\" : source.slice(startOffset, endOffset),\n): SsmlInsertionEdit {\n if (template.mode === SSML_INSERTION_MODES.wrap) {\n const trailingLineBreak = getLineBreakAt(source, endOffset) === \"\" ? eol : \"\";\n return {\n replacement: `${template.prefix}${selectedText}${template.suffix}${trailingLineBreak}`,\n selectionOffset: template.prefix.length,\n };\n }\n\n const followingLineBreak = getLineBreakAt(source, endOffset);\n const leadingLineBreak = !isLineStart(source, startOffset) && !startsWithLineBreak(template.prefix) ? eol : \"\";\n const needsTrailingLineBreak =\n selectedText.length > 0\n ? !selectedText.startsWith(\"\\n\") && !selectedText.startsWith(\"\\r\")\n : !isLineEnd(source, endOffset) || followingLineBreak === \"\";\n const trailingLineBreak = needsTrailingLineBreak && !endsWithLineBreak(template.prefix) ? eol : \"\";\n const insertionPrefix = `${leadingLineBreak}${template.prefix}`;\n\n return {\n replacement: `${insertionPrefix}${trailingLineBreak}${selectedText}`,\n selectionOffset:\n insertionPrefix.length +\n trailingLineBreak.length +\n (selectedText.length === 0 && trailingLineBreak === \"\" ? followingLineBreak.length : 0),\n };\n}\n","import type * as monaco from \"monaco-editor\";\n// @ts-expect-error The Node strip-types test runner requires the explicit TypeScript extension.\nimport { resolveExpressAsStyles, SSML_ATTRIBUTE_PRESETS } from \"./constants/ssmlPresets.ts\";\n// @ts-expect-error The Node strip-types test runner requires the explicit TypeScript extension.\nimport { findSsmlVoiceContext } from \"./ssmlContext.ts\";\n\ntype Monaco = typeof monaco;\ntype MonacoLanguages = Monaco[\"languages\"];\ntype MonacoCompletionProvider = Parameters<MonacoLanguages[\"registerCompletionItemProvider\"]>[1];\ntype MonacoCompletionMethod = NonNullable<MonacoCompletionProvider[\"provideCompletionItems\"]>;\ntype MonacoCompletionModel = Parameters<MonacoCompletionMethod>[0];\ntype MonacoCompletionPosition = Parameters<MonacoCompletionMethod>[1];\n\nconst SSML_ATTRIBUTE_VALUE_PATTERN = /<([\\w:-]+)\\s+[^>]*?\\b([\\w:-]+)=[\"']([^\"']*)$/i;\nconst EXPRESS_AS_TAG_NAMES = new Set([\"mstts:express-as\", \"express-as\", \"expressas\"]);\n\nexport interface SsmlCompletionProviderOptions {\n getOuterVoiceName?: () => string | undefined;\n model?: MonacoCompletionModel | null;\n}\n\nfunction findSsmlAttributePresets(tagName: string, attributeName: string): readonly string[] | undefined {\n const tagPresets = Object.entries(SSML_ATTRIBUTE_PRESETS).find(\n ([presetTagName]) => presetTagName.toLowerCase() === tagName.toLowerCase(),\n )?.[1];\n\n return Object.entries(tagPresets ?? {}).find(\n ([presetAttributeName]) => presetAttributeName.toLowerCase() === attributeName.toLowerCase(),\n )?.[1];\n}\n\nconst SSML_COMPLETION_SNIPPETS = [\n {\n label: \"break\",\n insertText: '<break time=\"500ms\" />',\n },\n {\n label: \"prosody\",\n insertText: `<prosody rate=\"medium\" pitch=\"medium\">\\${1:text}</prosody>`,\n },\n {\n label: \"mstts:express-as\",\n insertText: `<mstts:express-as style=\"cheerful\">\\${1:text}</mstts:express-as>`,\n },\n {\n label: \"sub\",\n insertText: `<sub alias=\"\\${1:読み}\">\\${2:漢字}</sub>`,\n },\n] as const;\n\nexport function registerSsmlCompletionProvider(\n monaco: Monaco,\n options: SsmlCompletionProviderOptions = {},\n): ReturnType<MonacoLanguages[\"registerCompletionItemProvider\"]> {\n const provider: MonacoCompletionProvider = {\n provideCompletionItems(model: MonacoCompletionModel, position: MonacoCompletionPosition) {\n if (options.model && options.model !== model) {\n return { suggestions: [] };\n }\n\n const value = model.getValue();\n const offset = model.getOffsetAt(position);\n const textUntilPosition = value.slice(0, offset);\n const isClosingTag = /<\\/[a-zA-Z0-9:-]*$/.test(textUntilPosition);\n if (isClosingTag) {\n return { suggestions: [] };\n }\n\n const attributeMatch = SSML_ATTRIBUTE_VALUE_PATTERN.exec(textUntilPosition);\n let attributeValues = attributeMatch ? findSsmlAttributePresets(attributeMatch[1], attributeMatch[2]) : undefined;\n if (\n attributeMatch &&\n attributeValues &&\n EXPRESS_AS_TAG_NAMES.has(attributeMatch[1].toLowerCase()) &&\n attributeMatch[2].toLowerCase() === \"style\"\n ) {\n const voiceContext = findSsmlVoiceContext(value, offset);\n const voiceName = voiceContext === undefined ? options.getOuterVoiceName?.() : voiceContext.voiceName;\n attributeValues = resolveExpressAsStyles(voiceName, attributeValues);\n }\n const openTagMatch = textUntilPosition.match(/<(?!\\/)[a-zA-Z0-9:-]*$/);\n const openTagLength = openTagMatch?.[0].length ?? 0;\n const isAfterBracket =\n model.getValueInRange({\n startLineNumber: position.lineNumber,\n startColumn: position.column - 1,\n endLineNumber: position.lineNumber,\n endColumn: position.column,\n }) === \"<\";\n const hasClosingBracket =\n isAfterBracket &&\n model.getValueInRange({\n startLineNumber: position.lineNumber,\n startColumn: position.column,\n endLineNumber: position.lineNumber,\n endColumn: position.column + 1,\n }) === \">\";\n const range = {\n startLineNumber: position.lineNumber,\n startColumn: openTagLength > 0 ? position.column - openTagLength : position.column,\n endLineNumber: position.lineNumber,\n endColumn: hasClosingBracket ? position.column + 1 : position.column,\n };\n\n return {\n suggestions: [\n ...(attributeMatch\n ? []\n : SSML_COMPLETION_SNIPPETS.map(({ label, insertText }) => ({\n label,\n kind: monaco.languages.CompletionItemKind.Snippet,\n insertText,\n insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,\n range,\n }))),\n ...(attributeValues?.map((value) => ({\n label: value,\n kind: monaco.languages.CompletionItemKind.Value,\n insertText: value,\n range,\n })) ?? []),\n ],\n };\n },\n triggerCharacters: [\"<\", '\"', \"'\"],\n };\n\n return monaco.languages.registerCompletionItemProvider(\"xml\", provider);\n}\n","// @ts-expect-error The Node strip-types test runner requires the explicit TypeScript extension.\nimport * as SSML_PRESETS from \"./constants/ssmlPresets.ts\";\n// @ts-expect-error The Node strip-types test runner requires the explicit TypeScript extension.\nimport { SSML_HOVER_COPY, type SsmlEditorLocale } from \"./locales.ts\";\n\nconst {\n BREAK_STRENGTH_PRESETS,\n EMPHASIS_LEVEL_PRESETS,\n PHONEME_ALPHABET_PRESETS,\n PROSODY_RATE_VALUES,\n PROSODY_VOLUME_PRESETS,\n SILENCE_TYPE_PRESETS,\n SSML_PRESET_EXAMPLES,\n VISEME_TYPE_PRESETS,\n} = SSML_PRESETS;\n\nexport interface SsmlParameterDefinition {\n name: string;\n description: string;\n aliases?: readonly string[];\n values?: readonly string[];\n example?: string;\n}\n\nexport interface SsmlTagDefinition {\n name: string;\n description: string;\n aliases?: readonly string[];\n parameters: readonly SsmlParameterDefinition[];\n}\n\nexport interface SsmlHoverRange {\n startLineNumber: number;\n startColumn: number;\n endLineNumber: number;\n endColumn: number;\n}\n\nexport type SsmlHoverTargetKind = \"tag\" | \"parameter\" | \"parameter-value\";\n\nexport interface SsmlHoverTarget {\n kind: SsmlHoverTargetKind;\n tagName: string;\n isClosingTag: boolean;\n definition: SsmlTagDefinition;\n parameter?: SsmlParameterDefinition;\n range: SsmlHoverRange;\n}\n\nconst SSML_TAG_DEFINITIONS: readonly SsmlTagDefinition[] = [\n {\n name: \"voice\",\n description: \"Selects the voice and optional voice effect used to synthesize the enclosed text.\",\n parameters: [\n {\n name: \"name\",\n description: \"The voice name, such as `en-US-JennyNeural`.\",\n example: \"en-US-JennyNeural\",\n },\n {\n name: \"effect\",\n description: \"An optional voice effect, such as `eq_car`.\",\n },\n ],\n },\n {\n name: \"prosody\",\n description: \"Changes the speaking rate, pitch, volume, or pitch contour of the enclosed text.\",\n parameters: [\n {\n name: \"rate\",\n description: \"Controls speaking speed.\",\n values: PROSODY_RATE_VALUES,\n example: SSML_PRESET_EXAMPLES.prosodyRate,\n },\n {\n name: \"pitch\",\n description: \"Adjusts pitch using a named value, percentage, frequency, or semitone value.\",\n example: SSML_PRESET_EXAMPLES.prosodyPitch,\n },\n {\n name: \"volume\",\n description: \"Controls loudness using a named value, percentage, or decibel value.\",\n values: PROSODY_VOLUME_PRESETS,\n example: SSML_PRESET_EXAMPLES.prosodyVolume,\n },\n {\n name: \"contour\",\n description: \"Defines a sequence of relative pitch changes at positions in the text.\",\n example: \"(0%,+0st) (100%,+2st)\",\n },\n {\n name: \"range\",\n description: \"Adjusts the pitch range of the voice.\",\n example: \"+2st\",\n },\n ],\n },\n {\n name: \"break\",\n description: \"Inserts a pause between words or other spoken content.\",\n parameters: [\n {\n name: \"time\",\n description: \"The pause duration, for example `500ms` or `1s`.\",\n example: SSML_PRESET_EXAMPLES.breakTime,\n },\n {\n name: \"strength\",\n description: \"The relative pause strength.\",\n values: BREAK_STRENGTH_PRESETS,\n },\n ],\n },\n {\n name: \"mstts:express-as\",\n aliases: [\"express-as\", \"expressAs\"],\n description: \"Applies a speaking style, style degree, or role to the enclosed text.\",\n parameters: [\n {\n name: \"style\",\n description: \"The speaking style supported by the selected voice, such as `cheerful`.\",\n example: SSML_PRESET_EXAMPLES.expressAsStyle,\n },\n {\n name: \"styledegree\",\n aliases: [\"style-degree\", \"styleDegree\"],\n description: \"Controls the intensity of the selected speaking style.\",\n example: \"1.5\",\n },\n {\n name: \"role\",\n description: \"Changes the speaking role when supported by the selected voice.\",\n example: \"YoungAdultFemale\",\n },\n ],\n },\n {\n name: \"say-as\",\n aliases: [\"sayAs\"],\n description: \"Controls how the enclosed text is interpreted and spoken.\",\n parameters: [\n {\n name: \"interpret-as\",\n description: \"Specifies the interpretation, such as characters, digits, date, or time.\",\n example: \"characters\",\n },\n {\n name: \"format\",\n description: \"Provides a format hint for the selected interpretation.\",\n },\n {\n name: \"detail\",\n description: \"Provides an additional detail hint for the selected interpretation.\",\n },\n ],\n },\n {\n name: \"phoneme\",\n description: \"Replaces normal pronunciation with the supplied phonetic pronunciation.\",\n parameters: [\n {\n name: \"alphabet\",\n description: \"The phonetic alphabet used by the `ph` value.\",\n values: PHONEME_ALPHABET_PRESETS,\n example: SSML_PRESET_EXAMPLES.phonemeAlphabet,\n },\n {\n name: \"ph\",\n description: \"The phonetic pronunciation for the enclosed text.\",\n example: \"həˈloʊ\",\n },\n ],\n },\n {\n name: \"emphasis\",\n description: \"Adds emphasis to the enclosed text.\",\n parameters: [\n {\n name: \"level\",\n description: \"Controls the amount of emphasis.\",\n values: EMPHASIS_LEVEL_PRESETS,\n },\n ],\n },\n {\n name: \"audio\",\n description: \"Plays an audio file as part of the synthesized output.\",\n parameters: [\n {\n name: \"src\",\n description: \"The URI of the audio file.\",\n example: \"https://example.com/intro.wav\",\n },\n {\n name: \"desc\",\n description: \"Alternative text to use if the audio cannot be played.\",\n },\n {\n name: \"clipBegin\",\n description: \"The starting offset within the audio file.\",\n example: \"0s\",\n },\n {\n name: \"clipEnd\",\n description: \"The ending offset within the audio file.\",\n example: \"5s\",\n },\n {\n name: \"speed\",\n description: \"The playback speed of the audio file.\",\n example: \"1.0\",\n },\n {\n name: \"repeatCount\",\n description: \"The number of times to repeat the audio.\",\n example: \"2\",\n },\n {\n name: \"repeatDuration\",\n description: \"The total duration for which the audio may repeat.\",\n example: \"10s\",\n },\n {\n name: \"soundLevel\",\n description: \"The audio volume adjustment in decibels.\",\n example: \"-3dB\",\n },\n ],\n },\n {\n name: \"sub\",\n description: \"Substitutes the alias text when speaking the enclosed text.\",\n parameters: [\n {\n name: \"alias\",\n description: \"The text to speak instead of the enclosed text.\",\n example: \"World Wide Web\",\n },\n ],\n },\n {\n name: \"lang\",\n description: \"Changes the language used for the enclosed text.\",\n parameters: [\n {\n name: \"xml:lang\",\n aliases: [\"lang\"],\n description: \"The BCP-47 language tag.\",\n example: \"ja-JP\",\n },\n ],\n },\n {\n name: \"mark\",\n description: \"Inserts a custom marker into the synthesized audio stream.\",\n parameters: [\n {\n name: \"name\",\n description: \"The application-defined marker name.\",\n example: \"chapter-1\",\n },\n ],\n },\n {\n name: \"bookmark\",\n description: \"Inserts a bookmark marker into the synthesized audio stream.\",\n parameters: [\n {\n name: \"mark\",\n description: \"The application-defined bookmark name.\",\n example: \"chapter-1\",\n },\n ],\n },\n {\n name: \"lexicon\",\n description: \"Associates a pronunciation lexicon with the synthesized document.\",\n parameters: [\n {\n name: \"uri\",\n description: \"The URI of the pronunciation lexicon.\",\n example: \"https://example.com/lexicon.pls\",\n },\n ],\n },\n {\n name: \"p\",\n description: \"Groups text into a paragraph.\",\n parameters: [],\n },\n {\n name: \"s\",\n description: \"Groups text into a sentence.\",\n parameters: [],\n },\n {\n name: \"w\",\n description: \"Groups text into a word.\",\n parameters: [],\n },\n {\n name: \"mstts:silence\",\n aliases: [\"silence\"],\n description: \"Adds a specified silence before or after text or at a punctuation boundary.\",\n parameters: [\n {\n name: \"type\",\n description: \"The silence position or punctuation boundary.\",\n values: SILENCE_TYPE_PRESETS,\n },\n {\n name: \"value\",\n description: \"The silence duration, for example `300ms`.\",\n example: SSML_PRESET_EXAMPLES.silenceValue,\n },\n ],\n },\n {\n name: \"mstts:viseme\",\n aliases: [\"viseme\"],\n description: \"Requests viseme events for the synthesized audio.\",\n parameters: [\n {\n name: \"type\",\n description: \"The viseme event format.\",\n values: VISEME_TYPE_PRESETS,\n },\n ],\n },\n] as const;\n\nexport { SSML_TAG_DEFINITIONS };\n\nconst definitionsByName = new Map<string, SsmlTagDefinition>();\nfor (const definition of SSML_TAG_DEFINITIONS) {\n definitionsByName.set(definition.name, definition);\n for (const alias of definition.aliases ?? []) {\n definitionsByName.set(alias, definition);\n }\n}\n\ninterface TokenRange {\n start: number;\n end: number;\n}\n\ninterface AttributeToken {\n name: TokenRange;\n value?: TokenRange;\n}\n\ninterface TagToken {\n name: string;\n nameRange: TokenRange;\n start: number;\n end: number;\n closing: boolean;\n attributes: AttributeToken[];\n}\n\nfunction isXmlNameStart(value: string | undefined): boolean {\n return value !== undefined && /[A-Za-z_]/.test(value);\n}\n\nfunction isXmlNameCharacter(value: string | undefined): boolean {\n return value !== undefined && /[A-Za-z0-9_.:-]/.test(value);\n}\n\nfunction isXmlWhitespace(value: string | undefined): boolean {\n return value === \" \" || value === \"\\t\" || value === \"\\r\" || value === \"\\n\";\n}\n\nfunction positionToOffset(source: string, lineNumber: number, column: number): number | undefined {\n if (!Number.isInteger(lineNumber) || !Number.isInteger(column) || lineNumber < 1 || column < 1) {\n return undefined;\n }\n\n let lineStart = 0;\n for (let line = 1; line < lineNumber; line += 1) {\n const newline = source.indexOf(\"\\n\", lineStart);\n if (newline === -1) {\n return undefined;\n }\n lineStart = newline + 1;\n }\n\n const lineEnd = source.indexOf(\"\\n\", lineStart);\n const lineLength = lineEnd === -1 ? source.length - lineStart : lineEnd - lineStart;\n if (column > lineLength + 1) {\n return undefined;\n }\n\n return lineStart + column - 1;\n}\n\nfunction offsetToPosition(\n source: string,\n offset: number,\n): {\n lineNumber: number;\n column: number;\n} {\n const lastNewline = source.lastIndexOf(\"\\n\", offset - 1);\n const lineNumber = source.slice(0, offset).split(\"\\n\").length;\n return {\n lineNumber,\n column: offset - lastNewline,\n };\n}\n\nfunction toRange(source: string, token: TokenRange): SsmlHoverRange {\n const start = offsetToPosition(source, token.start);\n const end = offsetToPosition(source, token.end);\n return {\n startLineNumber: start.lineNumber,\n startColumn: start.column,\n endLineNumber: end.lineNumber,\n endColumn: end.column,\n };\n}\n\nfunction containsOffset(token: TokenRange, offset: number): boolean {\n return offset >= token.start && offset < token.end;\n}\n\nfunction findTagEnd(source: string, start: number): number | undefined {\n let quote: string | undefined;\n for (let index = start; index < source.length; index += 1) {\n const character = source[index];\n if (quote !== undefined) {\n if (character === quote) {\n quote = undefined;\n }\n } else if (character === '\"' || character === \"'\") {\n quote = character;\n } else if (character === \">\") {\n return index;\n }\n }\n return undefined;\n}\n\nfunction parseTag(source: string, start: number, contentEnd: number, tokenEnd: number): TagToken | undefined {\n let index = start + 1;\n let closing = false;\n if (source[index] === \"/\") {\n closing = true;\n index += 1;\n }\n\n while (index < contentEnd && isXmlWhitespace(source[index])) {\n index += 1;\n }\n if (!isXmlNameStart(source[index])) {\n return undefined;\n }\n\n const nameStart = index;\n index += 1;\n while (index < contentEnd && isXmlNameCharacter(source[index])) {\n index += 1;\n }\n const nameEnd = index;\n const attributes: AttributeToken[] = [];\n\n if (!closing) {\n while (index < contentEnd) {\n while (index < contentEnd && isXmlWhitespace(source[index])) {\n index += 1;\n }\n if (index >= contentEnd || source[index] === \"/\") {\n break;\n }\n if (!isXmlNameStart(source[index])) {\n index += 1;\n continue;\n }\n\n const attributeStart = index;\n index += 1;\n while (index < contentEnd && isXmlNameCharacter(source[index])) {\n index += 1;\n }\n const attributeEnd = index;\n while (index < contentEnd && isXmlWhitespace(source[index])) {\n index += 1;\n }\n\n let value: TokenRange | undefined;\n if (source[index] === \"=\") {\n index += 1;\n while (index < contentEnd && isXmlWhitespace(source[index])) {\n index += 1;\n }\n\n const quote = source[index];\n if (quote === '\"' || quote === \"'\") {\n index += 1;\n const valueStart = index;\n while (index < contentEnd && source[index] !== quote) {\n index += 1;\n }\n value = { start: valueStart, end: index };\n if (index < contentEnd) {\n index += 1;\n }\n } else {\n const valueStart = index;\n while (index < contentEnd && !isXmlWhitespace(source[index]) && source[index] !== \"/\") {\n index += 1;\n }\n value = { start: valueStart, end: index };\n }\n }\n\n attributes.push({\n name: { start: attributeStart, end: attributeEnd },\n value,\n });\n }\n }\n\n return {\n name: source.slice(nameStart, nameEnd),\n nameRange: { start: nameStart, end: nameEnd },\n start,\n end: tokenEnd,\n closing,\n attributes,\n };\n}\n\nfunction findTagAtOffset(source: string, offset: number): TagToken | undefined {\n let searchStart = 0;\n while (searchStart < source.length) {\n const start = source.indexOf(\"<\", searchStart);\n if (start === -1 || start > offset) {\n return undefined;\n }\n\n if (source.startsWith(\"<!--\", start)) {\n const commentEnd = source.indexOf(\"-->\", start + 4);\n const tokenEnd = commentEnd === -1 ? source.length : commentEnd + 3;\n if (offset < tokenEnd) {\n return undefined;\n }\n searchStart = tokenEnd;\n continue;\n }\n\n if (source.startsWith(\"<![CDATA[\", start)) {\n const cdataEnd = source.indexOf(\"]]>\", start + 9);\n const tokenEnd = cdataEnd === -1 ? source.length : cdataEnd + 3;\n if (offset < tokenEnd) {\n return undefined;\n }\n searchStart = tokenEnd;\n continue;\n }\n\n if (source.startsWith(\"<?\", start)) {\n const processingEnd = source.indexOf(\"?>\", start + 2);\n const tokenEnd = processingEnd === -1 ? source.length : processingEnd + 2;\n if (offset < tokenEnd) {\n return undefined;\n }\n searchStart = tokenEnd;\n continue;\n }\n\n const tagEnd = findTagEnd(source, start + 1);\n const contentEnd = tagEnd ?? source.length;\n const tokenEnd = tagEnd === undefined ? source.length : tagEnd + 1;\n if (offset < tokenEnd) {\n return parseTag(source, start, contentEnd, tokenEnd);\n }\n\n if (tagEnd === undefined) {\n return undefined;\n }\n searchStart = tokenEnd;\n }\n return undefined;\n}\n\nfunction findParameter(definition: SsmlTagDefinition, name: string): SsmlParameterDefinition | undefined {\n return definition.parameters.find(\n (parameter) => parameter.name === name || parameter.aliases?.includes(name) === true,\n );\n}\n\nexport function getSsmlTagDefinition(name: string): SsmlTagDefinition | undefined {\n return definitionsByName.get(name);\n}\n\nexport function findSsmlHoverTarget(source: string, lineNumber: number, column: number): SsmlHoverTarget | undefined {\n const offset = positionToOffset(source, lineNumber, column);\n if (offset === undefined) {\n return undefined;\n }\n\n const tag = findTagAtOffset(source, offset);\n if (!tag) {\n return undefined;\n }\n\n const definition = getSsmlTagDefinition(tag.name);\n if (!definition) {\n return undefined;\n }\n\n if (containsOffset(tag.nameRange, offset)) {\n return {\n kind: \"tag\",\n tagName: tag.name,\n isClosingTag: tag.closing,\n definition,\n range: toRange(source, tag.nameRange),\n };\n }\n\n for (const attribute of tag.attributes) {\n if (containsOffset(attribute.name, offset)) {\n const parameter = findParameter(definition, source.slice(attribute.name.start, attribute.name.end));\n if (!parameter) {\n return undefined;\n }\n return {\n kind: \"parameter\",\n tagName: tag.name,\n isClosingTag: tag.closing,\n definition,\n parameter,\n range: toRange(source, attribute.name),\n };\n }\n\n if (attribute.value && containsOffset(attribute.value, offset)) {\n const parameter = findParameter(definition, source.slice(attribute.name.start, attribute.name.end));\n if (!parameter) {\n return undefined;\n }\n return {\n kind: \"parameter-value\",\n tagName: tag.name,\n isClosingTag: tag.closing,\n definition,\n parameter,\n range: toRange(source, attribute.value),\n };\n }\n }\n\n return undefined;\n}\n\nfunction code(value: string): string {\n return `\\`${value.replace(/\\\\/g, \"\\\\\\\\\").replace(/`/g, \"\\\\`\")}\\``;\n}\n\nfunction formatParameter(parameter: SsmlParameterDefinition, tagName: string, locale: SsmlEditorLocale): string {\n const localizedParameter = SSML_HOVER_COPY[locale].tags[tagName]?.parameters[parameter.name];\n const description = localizedParameter?.description ?? parameter.description;\n const values =\n parameter.values && parameter.values.length > 0\n ? ` ${SSML_HOVER_COPY[locale].allowedValues}: ${parameter.values.map(code).join(\", \")}.`\n : \"\";\n const example = parameter.example ? ` ${SSML_HOVER_COPY[locale].example}: ${code(parameter.example)}.` : \"\";\n return `- ${code(parameter.name)}: ${description}${values}${example}`;\n}\n\nexport function formatSsmlHover(target: SsmlHoverTarget, locale: SsmlEditorLocale = \"en\"): string {\n const localizedTag = SSML_HOVER_COPY[locale].tags[target.definition.name];\n const tagTitle = localizedTag?.title ?? target.definition.name;\n const tagDescription = localizedTag?.description ?? target.definition.description;\n const tagSyntax = target.isClosingTag ? `</${target.tagName}>` : `<${target.tagName}>`;\n const lines = [`### ${code(tagSyntax)}`, \"\", `**${tagTitle}**`, \"\", tagDescription];\n\n if (target.parameter) {\n const localizedParameter = localizedTag?.parameters[target.parameter.name];\n const parameterTitle = localizedParameter?.title ?? target.parameter.name;\n const parameterDescription = localizedParameter?.description ?? target.parameter.description;\n lines.push(\"\", `**${SSML_HOVER_COPY[locale].parameterHeading} ${code(parameterTitle)}**`, \"\", parameterDescription);\n if (target.parameter.values && target.parameter.values.length > 0) {\n lines.push(\"\", `${SSML_HOVER_COPY[locale].allowedValues}: ${target.parameter.values.map(code).join(\", \")}.`);\n }\n if (target.parameter.example) {\n lines.push(\"\", `${SSML_HOVER_COPY[locale].example}: ${code(target.parameter.example)}.`);\n }\n } else if (target.definition.parameters.length > 0) {\n lines.push(\n \"\",\n `**${SSML_HOVER_COPY[locale].parametersHeading}**`,\n \"\",\n ...target.definition.parameters.map((parameter) => formatParameter(parameter, target.definition.name, locale)),\n );\n } else {\n lines.push(\"\", SSML_HOVER_COPY[locale].noParameters);\n }\n\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;AA8DO,IAAM,cAA8D;AAAA,EACzE,IAAI;AAAA,IACF,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,UAAU;AAAA,IACV,eAAe;AAAA,IACf,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,WAAW;AAAA,IACX,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,sBAAsB;AAAA,IACtB,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,sBAAsB;AAAA,IACtB,kBAAkB;AAAA,IAClB,uBAAuB;AAAA,IACvB,oBAAoB;AAAA,IACpB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,eAAe;AAAA,EACjB;AAAA,EACA,IAAI;AAAA,IACF,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,UAAU;AAAA,IACV,eAAe;AAAA,IACf,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,WAAW;AAAA,IACX,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,sBAAsB;AAAA,IACtB,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,sBAAsB;AAAA,IACtB,kBAAkB;AAAA,IAClB,uBAAuB;AAA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gB,MAAM,EAAE,OAAO,KAAK,KAAK,OAAO,UAAU,OAAO,CAAC,GAAG;AAAA,IACzF;AAAA,EACF,WAAW,OAAO,WAAW,WAAW,SAAS,GAAG;AAClD,UAAM;AAAA,MACJ;AAAA,MACA,KAAK,gBAAgB,MAAM,EAAE,iBAAiB;AAAA,MAC9C;AAAA,MACA,GAAG,OAAO,WAAW,WAAW,IAAI,CAAC,cAAc,gBAAgB,WAAW,OAAO,WAAW,MAAM,MAAM,CAAC;AAAA,IAC/G;AAAA,EACF,OAAO;AACL,UAAM,KAAK,IAAI,gBAAgB,MAAM,EAAE,YAAY;AAAA,EACrD;AAEA,SAAO,MAAM,KAAK,IAAI;AACxB;","names":["escapeAttribute","isXmlNameStart","isXmlNameCharacter","isXmlWhitespace","findTagEnd","appendNode","end","name","end","getDocumentChildren","trailingLineBreak","value","BREAK_STRENGTH_PRESETS","EMPHASIS_LEVEL_PRESETS","PHONEME_ALPHABET_PRESETS","PROSODY_RATE_VALUES","PROSODY_VOLUME_PRESETS","SILENCE_TYPE_PRESETS","SSML_PRESET_EXAMPLES","VISEME_TYPE_PRESETS","isXmlNameStart","isXmlNameCharacter","isXmlWhitespace","findTagEnd","tokenEnd"]}
|