"use strict";(self.webpackChunk_1js_people_in_taskbar=self.webpackChunk_1js_people_in_taskbar||[]).push([[1429],{12695:(e,n,t)=>{t.r(n),t.d(n,{default:()=>Rt});t(31033);var a=t(96206),r=t(76992),o=t(84957),i=t(71124);const l=i.createContext({});function c(){const e=i.useContext(l);return{getOrDefault:(n,t)=>e[n]??t}}const s=function(e){let{children:n,settings:t}=e;return i.createElement(l.Provider,{value:t},n)};var d=t(43830),u=t(18226);const m=(0,d.Os)("6cf0a583-59f0-4e65-b284-fe4198a54be0"),p=e=>(0,u.PY)({...e,id:b}),g=e=>(0,u.PY)({...e,id:L}),h=e=>(0,u.PY)({...e,id:x}),b={name:"Dialog",dataContractId:m},v={name:"Add",dataContractId:m},f={name:"Edit",dataContractId:m},E={name:"Delete",dataContractId:m},L={name:"Info",dataContractId:m},x={name:"Audio",dataContractId:m};var P=t(46120),w=t(11388),R=t(14106),C=t(10330),A=t(33494),S=t(16605),y=t(55648);const N=(0,d.Os)("6cf0a583-59f0-4e65-b284-fe4198a54be0"),M=e=>(0,y.X)({id:D,...e}),_=e=>(0,y.X)({id:O,...e}),D={name:"Cancel",type:"InteractiveElement",aggregation:"Multi",checkpoints:[],expectedPaths:["/Dialog/Add","/Dialog/Edit","/Dialog/Delete"],dataContractId:N},O={name:"Show",type:"InteractiveElement",aggregation:"Multi",checkpoints:[],expectedPaths:["/Dialog/Add/LearnMore","/Dialog/Add/Info","/Dialog/Edit/LearnMore","/Dialog/Edit/Info"],dataContractId:N},k={name:"Save",type:"InteractiveElement",aggregation:"Multi",checkpoints:[],expectedPaths:["/Dialog/Add/Audio"],dataContractId:N},T={name:"Retake",type:"InteractiveElement",aggregation:"Multi",checkpoints:[],expectedPaths:["/Dialog/Add/Audio"],dataContractId:N},B={name:"Record",type:"InteractiveElement",aggregation:"Multi",checkpoints:[],expectedPaths:["/Dialog/Add/Audio"],dataContractId:N},I={name:"Play",type:"InteractiveElement",aggregation:"Multi",checkpoints:[],expectedPaths:["/Dialog/Add/Audio","/Dialog/Edit/Audio"],dataContractId:N},F={name:"RequestDelete",type:"InteractiveElement",aggregation:"Multi",checkpoints:[],expectedPaths:["/Dialog/Edit/Audio"],dataContractId:N},G={name:"Delete",type:"InteractiveElement",aggregation:"Multi",checkpoints:[],expectedPaths:["/Dialog/Delete/Audio"],dataContractId:N};var Q=t(63871),J=t(30675),U=t(80254),V=t(93878),W=t(54804);const H={start:"START",introduction:"INTRODUCTION",listening:"LISTENING",prepare:"PREPARE",play:"PLAY",stopped:"STOPPED",playing:"PLAYING",recording:"RECORDING",loading:"LOADING",error:"ERROR",microphoneAccess:"MICROPHONE_ACCESS",preview:"PREVIEW",remove:"DELETE"},$=MediaRecorder.isTypeSupported(W.Ru)?W.Ru:MediaRecorder.isTypeSupported(W.vw)?W.vw:W.qg;var z=t(86720),q=t(53928);const j=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?"310px":"256px",X="18px",K=q.L.colorPaletteRedBackground3,Y=(0,z.n)({footerContainer:{gridColumnStart:"3",gridRowStart:"3"},spinner:{paddingLeft:X}}),Z=R.U`
  fragment NamePronunciationFooter_viewDataFragment on OneGQL_NamePronunciationFooterModel {
    saveLabel
    cancelLabel
    cancelAndCloseDialogAriaLabel
    deleteLabel
    yesDeleteLabel
    noKeepLabel
    savingAriaLabel
    deletingAriaLabel
  }
`,ee=R.U`
  mutation NamePronunciationFooter_postNamePronunciationMutation(
    $audioBlob: String!
    $id: ID
  ) {
    postNamePronunciation(audioBlob: $audioBlob, id: $id) {
      ... on OneGQL_PersonNamePronunciationAudioClipPostSuccess {
        audioBlob
        id
      }
      ... on OneGQL_PersonNamePronunciationAudioClipError {
        # TODO: Handle errors, PBI: https://msfast.visualstudio.com/FAST%20Experiences/_workitems/edit/616441
        errorMessage
        failureCode
      }
    }
  }
`,ne=R.U`
  mutation NamePronunciationFooter_deleteNamePronunciationMutation($id: ID!) {
    deleteNamePronunciation(id: $id) {
      ... on OneGQL_PersonNamePronunciationAudioClipError {
        # TODO: Handle errors, PBI: https://msfast.visualstudio.com/FAST%20Experiences/_workitems/edit/616441
        failureCode
        errorMessage
      }
    }
  }
`,te=(e,n,t,a,r,o)=>{const{useMutation:l}=(0,V.l)();if(!l)throw new Error("useMutation must be provided");const[c]=l(ee),[s]=l(ne);return i.useCallback((async()=>{let i;if(!a){if(!(null==e?void 0:e.size))return null;await async function(e){return new Promise((n=>{const t=new FileReader;t.readAsDataURL(e),t.onload=()=>{const e=t.result,a="string"==typeof e?e.split(",")[1]:"";n(a)}}))}(e).then((e=>i=e))}let l={audioBlob:i};return n&&(l={...l,id:n}),r(!0),a&&n?await s({variables:{id:n}}).then((e=>{var n;return ae(null==e||null===(n=e.data)||void 0===n?void 0:n.state,t,o)})):await c({variables:l}).then((e=>{var n;return ae(null==e||null===(n=e.data)||void 0===n?void 0:n.state,t,o)}))}),[c,s,r,e,n,a,t,o])},ae=(e,n,t)=>{"success"===e?n():t()},re=e=>{var n;const{closeModal:t,scene:a,viewData:r,namePronunciation:o,setScene:l,setShouldFocusOnDeleteButton:c}=e,{play:s,remove:d,error:u}=H,m=i.useRef(null),[p,g]=i.useState(!1),b=Y(),{saveLabel:v,cancelLabel:f,cancelAndCloseDialogAriaLabel:E,yesDeleteLabel:L,noKeepLabel:x,savingAriaLabel:P,deletingAriaLabel:w}=(0,C.I3)(Z,r),R=a===d,A=i.useCallback((()=>{l(u),g(!1)}),[u,l,g]),S=te(null==o?void 0:o.audioBlob,null==o?void 0:o.id,t,R,g,A);i.useLayoutEffect((()=>{m.current&&a===d&&m.current.focus()}),[null===(n=m.current)||void 0===n?void 0:n.className,a,d]);const N=p,_=!(null==o?void 0:o.audioBlob)||a!==s||p||a===u;return i.createElement("div",{className:b.footerContainer},a===d?i.createElement(Q.i,null,i.createElement(M,{callback:()=>{l(s),c(!0)}},(e=>i.createElement(J.$,{onClick:e},x))),i.createElement(h,null,i.createElement(y.X,{id:N?void 0:G,callback:S},(e=>i.createElement(J.$,{ref:m,onClick:e,appearance:"primary",disabled:N},p?w:L,p&&i.createElement(U.y,{"aria-busy":"true",role:"status",className:b.spinner,size:"extra-tiny"})))))):i.createElement(Q.i,null,i.createElement(M,{callback:t},(e=>i.createElement(J.$,{onClick:e,"aria-label":E},f))),i.createElement(h,null,i.createElement(y.X,{id:_?void 0:k,callback:S},(e=>i.createElement(J.$,{onClick:e,appearance:"primary",disabled:_},p?P:v,p&&i.createElement(U.y,{"aria-busy":"true",role:"status",className:b.spinner,size:"extra-tiny"})))))))};var oe=t(68518),ie=t(87814),le=t(50959),ce=t(45375),se=t(49996),de=t(59453),ue=t(23993);const me=de.sl.select({Teams:{fontSize:"18px",fontWeight:"bold",lineHeight:"24px"},Default:{fontSize:"20px",fontWeight:"600",lineHeight:"28px"}}),pe=de.sl.select({Teams:{fontSize:"14px",fontWeight:"normal",lineHeight:"normal"},Default:{fontSize:"12px",fontWeight:"normal",lineHeight:"normal"}}),ge=(0,z.n)({headerContainer:{gridColumnStart:"1",gridColumnEnd:"4",gridRowStart:"1",gridRowEnd:"1"},headerTitle:{color:q.L.colorNeutralForeground1,...me,margin:"0px 20px 0px 0px",paddingBottom:"10px"},headerSubtitleContainer:{color:q.L.colorNeutralForeground1,display:"block",...pe},headerSubtitle:{display:"inline",padding:0,margin:0},tooltipButton:{...ue.Pt.padding("0px"),bottom:"1px",position:"relative",minWidth:"25px"},tooltipContainer:{display:"flex",width:"330px",height:"58px",flexDirection:"column",justifyContent:"center"},closeButton:{position:"absolute",top:0,right:0,margin:"15px"}}),he=R.U`
  fragment NamePronunciationHeader_viewDataFragment on OneGQL_NamePronunciationHeaderModel {
    manageTitle
    recordAndDisplayTitle
    recordAndDisplayLabel
    deleteRecordingTitle
    deleteRecordingLabel
    tooltipLabel
    errorTitle
    errorLabel
    cancelAndCloseDialogAriaLabel
  }
`,be=e=>{var n;const t=ge(),{remove:a,introduction:r,error:o,microphoneAccess:l}=H,{scene:c,viewData:s,isEditScenario:d,shouldFocusOnDeleteButton:u,closeModal:m}=e,p=i.useRef(null),{manageTitle:h,recordAndDisplayTitle:b,recordAndDisplayLabel:v,deleteRecordingTitle:f,deleteRecordingLabel:E,tooltipLabel:L,errorTitle:x,errorLabel:P,cancelAndCloseDialogAriaLabel:w}=(0,C.I3)(he,s),R={children:L,className:t.tooltipContainer};i.useLayoutEffect((()=>{var e;!p.current||u||c!==r&&c!==l&&!d||(null===(e=p.current)||void 0===e||e.focus())}),[null===(n=p.current)||void 0===n?void 0:n.className,c,r,l,d,u]);const A=i.createElement(oe.z,{action:"close"},i.createElement(M,{callback:m},(e=>i.createElement(J.$,{className:t.closeButton,appearance:"transparent",onClick:e,"aria-label":w,icon:i.createElement(ce.LMj,null)})))),S=e=>{let{title:n,label:a,closeDialogTrigger:r}=e;return i.createElement(i.Fragment,null,i.createElement(ie.L,{"aria-live":"polite",className:t.headerTitle,action:{children:r}},n),i.createElement("div",{className:t.headerSubtitleContainer},i.createElement("p",{className:t.headerSubtitle},a)))};return i.createElement("div",{className:t.headerContainer},c===a?i.createElement(S,{title:f,label:E,closeDialogTrigger:A}):c===o?i.createElement(S,{title:x,label:P,closeDialogTrigger:A}):i.createElement(i.Fragment,null,i.createElement(ie.L,{"aria-live":"polite",className:t.headerTitle,action:A},d?h:b),i.createElement("div",{className:t.headerSubtitleContainer},i.createElement("p",{className:t.headerSubtitle},v),i.createElement(g,null,i.createElement(_,{callback:()=>{}},(n=>i.createElement(le.m,{"aria-hidden":!0,withArrow:!0,positioning:"below",content:R,relationship:"label",onVisibleChange:(e,t)=>t.visible&&n(),...e,autofocus:!1},i.createElement(J.$,{ref:p,role:"button","aria-label":L,className:t.tooltipButton,appearance:"transparent",icon:i.createElement(se.g0L,null)}))))))))};let ve=null;const fe=async()=>{if(!ve)try{ve=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1})}catch(e){throw new Error("Error getting user media")}return ve};async function Ee(){ve&&await fe().then((e=>{null==e||e.getTracks().forEach((n=>{n.stop(),e.removeTrack(n)})),ve=null}))}t(18439),t(94515),t(6675),t(87038),t(96243),t(50132),t(20582),t(53750),t(69425),t(15102),t(4589),t(94760);function Le(e,n,t){const a=t.length;for(let r=0;r<a;++r)e.setUint8(n+r,t.charCodeAt(r))}class xe{encode(e){const n=e[0].length,t=this.numChannels,a=new DataView(new ArrayBuffer(n*t*2));let r=0;for(let o=0;o<n;++o)for(let n=0;n<t;++n){const t=32767*e[n][o];a.setInt16(r,t<0?Math.max(t,-32768):Math.min(t,32767),!0),r+=2}if(!this.dataViews)throw new Error("dataViews is undefined");this.dataViews.push(a),this.numSamples+=n}finish(){if(!this.dataViews)throw new Error("dataViews is undefined");const e=this.numChannels*this.numSamples*2,n=new DataView(new ArrayBuffer(44));Le(n,0,"RIFF"),n.setUint32(4,36+e,!0),Le(n,8,"WAVE"),Le(n,12,"fmt "),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,this.numChannels,!0),n.setUint32(24,this.sampleRate,!0),n.setUint32(28,this.sampleRate*this.numChannels*2,!0),n.setUint16(32,2*this.numChannels,!0),n.setUint16(34,16,!0),Le(n,36,"data"),n.setUint32(40,e,!0),this.dataViews.unshift(n);const t=new Blob(this.dataViews,{type:"audio/wav"});return this.cleanup(),t}cleanup(){delete this.dataViews}constructor(e,n){this.sampleRate=e,this.numChannels=n,this.numSamples=0,this.dataViews=[],this.cancel=this.cleanup.bind(this)}}const Pe=16e3;function we(e,n,t){const a=Math.round(n/t),r=Math.round(e.length/a),o=new Float32Array(r);let i=0,l=0;for(;i<o.length;){const n=Math.round((i+1)*a);let t=0,r=0;for(let a=l;a<n&&a<e.length;a++)t+=e[a],r++;o[i]=t/r,i++,l=n}return o}class Re{cleanup(){this.recBuffers=[],this.encoder=void 0,this.bufferCount=0}start(e){this.maxBuffers=Math.ceil(this.options.timeLimit*Pe/e),this.options.encodeAfterRecord?this.recBuffers=[]:this.encoder=new xe(Pe,this.numChannels)}finish(){var e;if(this.recBuffers)for(this.encoder=new xe(Pe,this.numChannels);this.recBuffers.length>0;){const e=this.recBuffers.shift();e&&this.encoder.encode(e)}const n=null===(e=this.encoder)||void 0===e?void 0:e.finish();return this.cleanup(),n}record(e){if(this.bufferCount++<this.maxBuffers){const n=e;if(Pe!==this.contextSampleRate)for(let t=0;t<n.length;t++)n[t]=we(e[t],this.contextSampleRate,Pe);if(this.encoder)this.encoder.encode(n);else{const e=n.map((e=>e.slice(0)));this.recBuffers.push(e)}}else this.timeoutCallback()}constructor(e){this.listeners=new Map,this.maxBuffers=938,this.bufferCount=0,this.recBuffers=[],this.contextSampleRate=e.config.sampleRate,this.numChannels=e.config.numChannels,this.options=e.options,this.timeoutCallback=e.timeoutCallback}}class Ce{initWavAudioProcessor(){this.wavAudioProcessor=new Re({config:{sampleRate:this.context.sampleRate,numChannels:this.numChannels},options:this.options,timeoutCallback:()=>this.finishRecording()})}isRecording(){return null!=this.processor}startRecording(){if(this.isRecording())this.onError("startRecording: previous recording is running");else{var e;const n=this.wavAudioProcessor;this.state="recording",this.processor=this.context.createScriptProcessor(this.options.bufferSize,this.numChannels,this.numChannels),this.input.connect(this.processor),this.processor.connect(this.context.destination),this.processor.onaudioprocess=function(e){null==n||n.record([e.inputBuffer.getChannelData(0)])},null===(e=this.wavAudioProcessor)||void 0===e||e.start(this.processor.bufferSize),this.startTime=Date.now()}}finishRecording(){if(this.isRecording()){var e,n;this.input.disconnect(),null===(e=this.processor)||void 0===e||e.disconnect(),delete this.processor,this.state="inactive";const t=null===(n=this.wavAudioProcessor)||void 0===n?void 0:n.finish();return Promise.resolve(t)}return Promise.reject("finishRecording: no recording is running")}onError(e){throw new Error("WebAudioRecorder.ts: "+e)}constructor(e){this.numChannels=1,this.encoding="wav",this.buffer=[],this.startTime=0,this.state="inactive",this.options={timeLimit:60,encodeAfterRecord:!0,bufferSize:void 0},this.context=e.context,this.stream=e.mediaStream,this.input=this.context.createGain(),e.connect(this.input),this.buffer=[],this.initWavAudioProcessor()}}const Ae=async()=>{const e=await fe(),n=(new(window.AudioContext||window.webkitAudioContext)).createMediaStreamSource(e);return new Ce(n)};var Se=t(59501),ye=t(96079),Ne=t(18357);function Me(){const{theme:e}=(0,ye.I)({},i.createRef());if(!e||!e.colorNeutralBackground1||!e.colorNeutralForeground1)return!1;const n=Ne.hex.hsl(e.colorNeutralBackground1),t=Ne.hex.hsl(e.colorNeutralForeground1);return n[2]<t[2]}const _e=(0,z.n)({errorAnddeleteRecordingContainer:{display:"flex",height:"100%",justifyContent:"center"},imageContainer:{alignItems:"center",display:"flex"}}),De=e=>{const n=_e(),a=t(59418),r=t(1507),{changeSceneToPlay:o}=e,l=Me(),c=i.useCallback((e=>{"Escape"!==e.key&&"Esc"!==e.key||(e.stopImmediatePropagation(),o())}),[o]);return i.useEffect((()=>(document.addEventListener("keydown",c,{capture:!0}),()=>{document.removeEventListener("keydown",c,{capture:!0})})),[c]),i.createElement("div",{className:n.errorAnddeleteRecordingContainer},i.createElement("div",{className:n.imageContainer},i.createElement(Se._,{alt:"",src:l?r:a,width:128,height:128})))},Oe=()=>{const e=_e(),n=t(59142),a=t(36615),r=Me();return i.createElement("div",{className:e.errorAnddeleteRecordingContainer},i.createElement("div",{className:e.imageContainer},i.createElement(Se._,{alt:"",src:r?a:n,width:128,height:128})))};var ke=t(17483),Te=t(19768);const Be={alignItems:"center",display:"flex",justifyContent:"center"},Ie=(0,z.n)({buttonContainer:{...Be,flexDirection:"row"},icon:{color:q.L.colorNeutralForegroundOnBrand},button:{...Be,...ue.Pt.borderRadius("24px"),boxShadow:`0px 0.6px 1.8px ${q.L.colorNeutralShadowKey}, 0px 3.2px 7.2px rgba(0, 0, 0, 0.13)`,height:"48px",maxWidth:"48px",minWidth:"48px",width:"48px"},screenReaderOnly:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"}}),Fe=e=>{var n;const t=Ie(),{appearance:a,disabled:r,icon:o,microphoneAction:l,ariaLabel:c,title:s,shouldSkipButtonFocus:d}=e,u=i.useRef(null);return i.useLayoutEffect((()=>{!u.current||d||r||u.current.focus()}),[null===(n=u.current)||void 0===n?void 0:n.className,d,r]),i.createElement("div",{className:t.buttonContainer},s&&i.createElement("p",{className:t.screenReaderOnly},s," "),i.createElement(J.$,{ref:u,"aria-label":c,className:t.button,appearance:a,icon:o,onClick:l,disabled:r}))};var Ge=t(40897);const Qe=(0,z.n)({titleContainer:{alignItems:"start",display:"flex",flexDirection:"column",marginTop:"12px",marginBottom:"12px",width:"100%"},title:{...ue.Pt.margin("0px"),alignItems:"center",color:q.L.colorNeutralForeground2,display:"flex",flexDirection:"column",fontSize:"14px",fontStyle:"normal",fontWeight:"400",lineHeight:"19px",paddingRight:"16px"},errorMessageContainer:{...ue.Pt.margin("0px"),alignItems:"center",color:K,display:"flex",fontSize:"12px",paddingTop:"6px"},errorIcon:{paddingRight:"4px"}}),Je=e=>{const{title:n}=e,t=Qe();return i.createElement("p",{"aria-hidden":!0,className:t.title},n)},Ue=e=>{const{errorMessage:n}=e,t=Qe();return i.createElement("p",{className:t.errorMessageContainer},i.createElement(Ge.KDG,{className:t.errorIcon}),i.createElement("span",null,n))},Ve=e=>{const{title:n,errorMessage:t}=e,a=Qe();return i.createElement("div",{className:a.titleContainer},i.createElement(Je,{title:n}),t&&i.createElement(Ue,{errorMessage:t}))};var We=t(90870),He=t(6929),$e=t(20565);const ze=(0,z.n)({titleAndProgressContainer:{alignItems:"start",display:"flex",flexDirection:"column",marginTop:"12px",marginBottom:"12px",width:"100%"},progressBarContainer:{width:"100%"},progressBar:{marginTop:"12px",backgroundColor:q.L.colorNeutralStencil1},progressContainer:{alignItems:"center",display:"flex",flexDirection:"row",marginBottom:"0px",marginTop:"12px"},redDot:{marginRight:"8px"}}),qe=e=>{const{title:n,durationAriaLabel:t,currentRecordingSecond:a,maxRecordingSeconds:r,progressBarValue:o,progressBarMax:l,progressAriaLabel:c,shouldRedDotBeVisible:s}=e,d=ze(),u=o&&l?Math.round(o/l*100):0,m=`0:${a}/0:${r}`;return i.createElement("div",{className:d.titleAndProgressContainer},i.createElement(Je,{title:n}),i.createElement(We.D,{className:d.progressBarContainer,validationState:"none"},i.createElement(He.z,{"aria-label":`${c}`,"data-testid":"name-pronunciation-progress-bar",className:d.progressBar,thickness:"large",value:o,max:l,"aria-valuenow":o,"aria-valuetext":`${u}%`,"aria-valuemin":0,"aria-valuemax":l}),i.createElement("div",{className:d.progressContainer,role:"timer","aria-label":`${t} ${m}`},i.createElement("div",{"aria-hidden":"true"},s&&i.createElement($e.E,{className:d.redDot,appearance:"filled",color:"danger",size:"extra-small"}),i.createElement("span",null,m)))))},je=R.U`
  fragment NamePronunciationRecording_viewDataFragment on OneGQL_NamePronunciationRecorderModel {
    durationAriaLabel
    stopRecordingLabel
    recordingProgressLabel
  }
`,Xe=e=>{const{onRecordFinish:n,setShouldReadAnnouncement:t}=e,[a,r]=i.useState(0),{stopRecordingLabel:o,recordingProgressLabel:l,durationAriaLabel:c}=(0,C.I3)(je,e.viewData),s=a/10,d=String(Math.floor(s)).padStart(2,"0");return i.useEffect((()=>{const e=setInterval((()=>{a<100?r((e=>e+1)):(clearInterval(e),n(),t(!0))}),100);return()=>{clearInterval(e)}}),[a,10,n,t]),i.createElement(i.Fragment,null,i.createElement(qe,{title:o,durationAriaLabel:c,progressAriaLabel:l,currentRecordingSecond:d,maxRecordingSeconds:10,progressBarValue:s,progressBarMax:10,shouldRedDotBeVisible:!0}))},Ke=R.U`
  fragment NamePronunciationIntroductionAndRecording_viewDataFragment on OneGQL_NamePronunciationRecorderModel {
    recordInstructionsLabel
    recordAriaLabel
    stopAriaLabel
    ...NamePronunciationRecording_viewDataFragment
  }
`,Ye=e=>{const{changeScene:n,scene:t,onRecordFinish:a,setShouldReadAnnouncement:r}=e,{recording:o}=H,l=(0,C.I3)(Ke,e.viewData),{recordInstructionsLabel:c,recordAriaLabel:s,stopAriaLabel:d}=l;let u=!0,m=s,p=i.createElement(ke.OPg,null),g=n;const h=t===o;return h&&(u=!1,p=i.createElement(Te.F3P,null),g=a,m=d),i.createElement(i.Fragment,null,i.createElement(y.X,{id:h?void 0:B,callback:g},(e=>i.createElement(i.Fragment,null,i.createElement(Fe,{shouldSkipButtonFocus:u,ariaLabel:m,title:c,appearance:"primary",icon:p,microphoneAction:e}),h?i.createElement(Xe,{viewData:l,onRecordFinish:g,setShouldReadAnnouncement:r}):i.createElement(Ve,{title:c})))))};var Ze=t(47333),en=t(6878),nn=t(19199);const tn=(0,z.n)({buttonContainer:{...Be},ghostingButtonContainer:{"& div":{"border-width":"24px"}},ghostingTextContainer:{"& div::before":{width:"60ex"}}}),an=R.U`
  fragment NamePronunciationMicrophoneRequest_viewDataFragment on OneGQL_NamePronunciationMicrophoneRequestModel {
    microphoneAccessTitleLabel
    microphoneAccessBlockedTitleLabel
    microphoneAccessBlockedTextLabel
  }
`,rn=e=>{const{changeSceneToIntroduction:n,changeSceneToPlay:t,viewData:a,isExistingRecording:r,permissionState:o}=e,l=tn(),[c,s]=i.useState(!1),{microphoneAccessBlockedTitleLabel:d,microphoneAccessBlockedTextLabel:u}=(0,C.I3)(an,a),m=(0,nn.A)(ke.OPg,ke.AQv),p=i.useCallback((()=>{"granted"===o&&n()}),[n,o]),g=i.useCallback((async()=>{if(!c){s(!0);try{await fe(),p()}finally{s(!1)}}}),[p,c]);return i.useEffect((()=>{r?t():g()}),[g,t,r]),"denied"===o||"prompt"===o?i.createElement(i.Fragment,null,i.createElement(Fe,{ariaLabel:d,appearance:"transparent",icon:i.createElement(m,null),microphoneAction:g,disabled:!0}),i.createElement(Ve,{title:d,errorMessage:u})):i.createElement("div",{className:l.buttonContainer,"aria-label":d},i.createElement("div",{className:l.ghostingButtonContainer},i.createElement(Ze.W,null)),i.createElement("div",{className:l.ghostingTextContainer},i.createElement(en.c,null)))};t(48419),t(72803),t(80111),t(83734),t(32909),t(57184);var on=t(60621),ln=t(36036),cn=t(69556);const sn=(0,z.n)({iconColor:{color:q.L.colorNeutralForegroundOnBrand},retakeContainer:{...ue.Pt.padding("0px"),color:q.L.colorBrandForegroundLink,display:"block",minWidth:"42px","& > span:first-child":{margin:"0px"}},retakeText:{fontWeight:"normal",maxWidth:"50px",overflowWrap:"break-word"},screenReaderOnly:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"}}),dn=R.U`
  fragment NamePronunciationPlayback_viewDataFragment on OneGQL_NamePronunciationRecorderModel {
    playToPreviewRecordingLabel
    durationAriaLabel
    retakeLabel
    retakeAriaLabel
    deleteLabel
    deleteAriaLabel
    limitReachedLabel
    playAriaLabel
    pauseAriaLabel
    playbackProgressLabel
  }
`,un=e=>{var n;const{audio:t,audioBlobIdString:a,changeSceneToMicrophoneAccess:r,changeSceneToDelete:o,shouldReadAnnouncement:l,isEditScenario:c,shouldFocusOnDeleteButton:s}=e,d=sn(),[u,m]=i.useState({isPlaying:!1,audioDuration:0}),p=i.useRef(new Audio),g=u.audioDuration,h=p.current.currentTime,{playToPreviewRecordingLabel:b,durationAriaLabel:v,retakeLabel:f,deleteAriaLabel:E,retakeAriaLabel:L,deleteLabel:x,limitReachedLabel:P,playAriaLabel:w,pauseAriaLabel:R,playbackProgressLabel:A}=(0,C.I3)(dn,e.viewData),S=String(Math.floor(g)).padStart(2,"0"),N=String(Math.floor(h)).padStart(2,"0"),M=Math.floor(100*u.audioDuration),_=Math.floor(100*p.current.currentTime);p.current.ontimeupdate=()=>{Math.floor(h)>=Math.floor(g)||m((e=>({...e})))},p.current.onended=()=>{m((e=>({...e,isPlaying:!1})))};const D=()=>{p.current.pause(),m((e=>({...e,isPlaying:!1})))};i.useEffect((()=>{if(t){const e=URL.createObjectURL(t);return p.current.src=e,O((e=>{m((n=>({...n,audioDuration:e})))}),e),()=>{URL.revokeObjectURL(e)}}}),[t]);const O=(e,n)=>{const t=new Audio(n);t.addEventListener("durationchange",(function(){if(this.duration!==1/0){const n=this.duration;t.remove(),e(n)}}),!1),t.load(),t.currentTime=86400,t.volume=0,t.play()};let k=i.createElement(on.NwQ,null),B=()=>{t&&(p.current.play(),m((e=>({...e,isPlaying:!0}))))},G=w;u.isPlaying&&(k=i.createElement(ln.TUy,{className:d.iconColor}),B=D,G=R);const Q=a?F:T,U=a?o:r,V=0===h||h===g,W=i.useRef(null);return i.useLayoutEffect((()=>{var e;W.current&&s&&(null===(e=W.current)||void 0===e||e.focus())}),[null===(n=W.current)||void 0===n?void 0:n.className,s]),i.createElement(i.Fragment,null,i.createElement(y.X,{id:V?I:void 0,callback:B},(e=>i.createElement(Fe,{ariaLabel:G,title:b,appearance:"primary",icon:k,microphoneAction:V?e:B,disabled:g<=0,shouldSkipButtonFocus:c||s}))),i.createElement(qe,{title:b,durationAriaLabel:v,progressAriaLabel:A,currentRecordingSecond:N,maxRecordingSeconds:S,progressBarValue:_,progressBarMax:M}),i.createElement(y.X,{id:Q,callback:U},(e=>a?i.createElement(J.$,{ref:W,"aria-label":E,className:d.retakeContainer,appearance:"transparent",icon:i.createElement(ce.va_,null),onClick:e},i.createElement("span",{className:d.retakeText},x)):i.createElement(i.Fragment,null,i.createElement(J.$,{"aria-label":L,className:d.retakeContainer,appearance:"transparent",icon:i.createElement(cn.rZY,null),onClick:e},i.createElement("span",{className:d.retakeText},f)),l&&i.createElement("p",{role:"status",className:d.screenReaderOnly},P)))))},mn=(0,z.n)({recorderContainer:{...ue.Pt.borderRadius(q.L.borderRadiusMedium),...ue.Pt.gap(X),...ue.Pt.padding("0px","26px"),alignItems:"center",boxShadow:`0px 1px ${q.L.spacingVerticalXS} ${q.L.colorNeutralShadowKey}`,display:"flex",flexDirection:"row",minHeight:"96px",justifyContent:"flex-start",marginTop:"22px"}}),pn=R.U`
  fragment NamePronunciationRecorderScreens_viewDataFragment on OneGQL_NamePronunciationMainViewModel {
    microphoneRequestModel {
      ...NamePronunciationMicrophoneRequest_viewDataFragment
    }
    recorderModel {
      ...NamePronunciationPlayback_viewDataFragment
      ...NamePronunciationIntroductionAndRecording_viewDataFragment
    }
    isNamePronunciationWebmMp4Enabled
  }
`,gn=R.U`
  fragment NamePronunciationRecorderScreens_dataFragment on OneGQL_Me {
    defaultName {
      pronunciationAudioClip {
        audioBlob
        id
      }
    }
  }
`,hn=e=>{var n,t;const{data:a,viewData:r,scene:o,setNamePronunciation:l,setScene:c,isEditScenario:s,setIsEditScenario:d,setTelemetryComponentName:u,shouldFocusOnDeleteButton:m}=e,{recording:p,microphoneAccess:g,introduction:b,play:v,remove:L,error:x}=H,P=mn(),[w,R]=i.useState(!1),[A,S]=i.useState(""),{microphoneRequestModel:y,recorderModel:N,isNamePronunciationWebmMp4Enabled:M}=(0,C.I3)(pn,r),{defaultName:_}=(0,C.I3)(gn,a),D=i.useMemo((()=>!(e=>!!e&&(MediaRecorder.isTypeSupported(W.vw)||MediaRecorder.isTypeSupported(W.Ru)))(M)),[M]),O=null==_||null===(n=_.pronunciationAudioClip)||void 0===n?void 0:n.audioBlob,k=null==_||null===(t=_.pronunciationAudioClip)||void 0===t?void 0:t.id,T=(0,W.B9)(O),[B,I]=i.useState(T);i.useEffect((()=>{const e=(0,W.B9)(O);I(e)}),[O,I]),i.useEffect((()=>{"denied"!==A&&"prompt"!==A||O?(null==B?void 0:B.size)&&o!==L&&o!==x?c(v):(null==B?void 0:B.size)||O||o!==v||c(b):(async()=>{await Ee(),c(g)})(),o===L&&k&&l({audioBlob:null,id:k})}),[A,O,g,null==B?void 0:B.size,k,b,v,L,x,o,l,c]),i.useEffect((()=>{O&&o===v?(u(f),d(!0)):o===L&&u(E)}),[O,o,v,L,u,d]),i.useEffect((()=>{(async()=>{await navigator.permissions.query({name:"microphone"}).then((e=>{S(e.state),e.onchange=()=>{S(e.state)}}))})()}),[]);const F=(0,i.useCallback)((async e=>{I(e),c(v);let n={audioBlob:e};k&&(n={...n,id:k}),l(n),await Ee()}),[v,k,I,c,l]);let G;const Q=(e=>{const{onStop:n}=e,[t,a]=i.useState(null),r=i.useCallback((()=>{null==t||t.stop()}),[t]),o=async()=>{const e=await fe(),n=new MediaRecorder(e,{mimeType:$});return n.ondataavailable=e=>{l(e)},n},l=async e=>{const t=e.data;t&&await n(t)};return{initialize:()=>{},startRecording:()=>{o().then((e=>{a(e),null==e||e.start()}))},stopRecording:r}})({onStop:async e=>{await F(e)}}),J=(e=>{const{onStop:n}=e,[,t]=i.useState(null),[a,r]=i.useState({audioStream:null,recorderState:"notStarted",isRecording:!1,mediaRecorder:null}),{mediaRecorder:o,recorderState:l,isRecording:c}=a,s=i.useCallback((()=>{r((e=>({...e,recorderState:"started",isRecording:!0})))}),[]),d=i.useCallback((async e=>{e&&(t(e),await n(e),r((e=>({...e,mediaRecorder:null,audioStream:null}))))}),[t,r,n]);return i.useEffect((()=>{c&&o?null==o||o.startRecording():"inactive"!==(null==o?void 0:o.state)&&(null==o||o.finishRecording().then(d))}),[o,c,d]),{startRecording:s,stopRecording:()=>{r((e=>({...e,recorderState:"stopped",isRecording:!1})))},audio:a.audioStream,state:l,initialize:()=>{Ae().then((e=>{r((n=>({...n,mediaRecorder:e,audioStream:e.stream})))}))}}})({onStop:async e=>{await F(e)}});G=D?J:Q;const U=(0,i.useCallback)((()=>{null==G||G.stopRecording()}),[G]),V=(0,i.useCallback)((()=>{null==G||G.initialize(),null==G||G.startRecording()}),[G]),z=(0,i.useCallback)((()=>{c(b)}),[c,b]),q=(0,i.useCallback)((()=>{I(null),c(g)}),[c,g]),j=(0,i.useCallback)((()=>{c(L)}),[c,L]),X=(0,i.useCallback)((()=>{c(v)}),[c,v]),K=(0,i.useCallback)((()=>{V(),c(p)}),[V,c,p]);let Y=null;switch(o){case g:Y=i.createElement(rn,{permissionState:A,viewData:y,changeSceneToIntroduction:z,changeSceneToPlay:X,isExistingRecording:O});break;case v:Y=i.createElement(un,{viewData:N,audio:B,audioBlobIdString:k,changeSceneToMicrophoneAccess:q,changeSceneToDelete:j,shouldReadAnnouncement:w,isEditScenario:s,shouldFocusOnDeleteButton:m});break;case L:return i.createElement(De,{changeSceneToPlay:X});case x:return i.createElement(Oe,null);default:Y=i.createElement(Ye,{viewData:N,changeScene:K,scene:o,onRecordFinish:U,setShouldReadAnnouncement:R})}return i.createElement(h,null,i.createElement("section",{className:P.recorderContainer},Y))},bn=(0,z.n)({dialogBody:{"row-gap":"0px !important",height:"100%"},dialogContent:{minHeight:"155px"}}),vn=R.U`
  fragment NamePronunciationContent_viewDataFragment on OneGQL_NamePronunciationViewData {
    navigationModel {
      headerModel {
        ...NamePronunciationHeader_viewDataFragment
      }
      footerModel {
        ...NamePronunciationFooter_viewDataFragment
      }
    }
    mainViewModel {
      ...NamePronunciationRecorderScreens_viewDataFragment
    }
  }
`,fn=R.U`
  fragment NamePronunciationContent_dataFragment on OneGQL_Me {
    ...NamePronunciationRecorderScreens_dataFragment
  }
`,En=e=>{const{closeModal:n,data:t,viewData:a}=e,{microphoneAccess:r}=H,[o,l]=i.useState(r),[c,s]=i.useState(v),d=bn(),[m,p]=i.useState(null),[g,h]=i.useState(!1),[b,f]=i.useState(!1),{navigationModel:E,mainViewModel:L}=(0,C.I3)(vn,a),{headerModel:x,footerModel:P}=E,w=(0,C.I3)(fn,t);return i.createElement(A.R,{className:d.dialogBody,"data-log-name":"NamePronunciationContent",role:"document"},i.createElement(u.PY,{id:c},i.createElement(be,{viewData:x,scene:o,isEditScenario:g,shouldFocusOnDeleteButton:b,closeModal:n}),i.createElement(S.C,{className:d.dialogContent},i.createElement(hn,{data:w,scene:o,viewData:L,setScene:l,setNamePronunciation:p,setTelemetryComponentName:s,isEditScenario:g,setIsEditScenario:h,shouldFocusOnDeleteButton:b})),i.createElement(re,{viewData:P,closeModal:n,scene:o,namePronunciation:m,setScene:l,setShouldFocusOnDeleteButton:f})))},Ln=(0,z.n)({dialogSurface:{minHeight:j,maxHeight:"600px",width:"600px"}}),xn=R.U`
  fragment NamePronunciationContainer_viewDataFragment on OneGQL_NamePronunciationViewData {
    ...NamePronunciationContent_viewDataFragment
  }
`,Pn=R.U`
  fragment NamePronunciationContainer_dataFragment on OneGQL_Me {
    ...NamePronunciationContent_dataFragment
  }
`,wn=e=>{const{setShouldShowNamePronunciationEditor:n,viewData:t,data:a}=e,r=Ln(),o=(0,C.I3)(Pn,a),l=(0,C.I3)(xn,t);const c=i.useCallback((()=>{n(!1),Ee()}),[n]);return i.createElement(p,null,i.createElement(P.l,{open:!0,onOpenChange:function(e,t){n(t.open),t.open||Ee()}},i.createElement(w.E,{className:r.dialogSurface},i.createElement(En,{data:o,viewData:l,closeModal:c}))))};var Rn=t(91087),Cn=t.n(Rn);var An=t(81642);const Sn=(e,n)=>e(null,null,n);var yn=t(51634),Nn=t(87266);const Mn=(e,n,t)=>t.OneJSResolverContext.settingProvider.getOrDefault("OneGQL_NamePronunciationMainViewModel_isNamePronunciationWebmMp4Enabled",!1),_n=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationFooterModel_cancelAndCloseDialogAriaLabel")),Dn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationFooterModel_cancelLabel")),On=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationFooterModel_deleteLabel")),kn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationFooterModel_deletingAriaLabel")),Tn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationFooterModel_noKeepLabel")),Bn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationFooterModel_saveLabel")),In=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationFooterModel_savingAriaLabel")),Fn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationFooterModel_yesDeleteLabel")),Gn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationHeaderModel_cancelAndCloseDialogAriaLabel")),Qn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationHeaderModel_deleteRecordingLabel")),Jn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationHeaderModel_deleteRecordingTitle")),Un=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationHeaderModel_errorLabel")),Vn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationHeaderModel_errorTitle")),Wn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationHeaderModel_manageTitle")),Hn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationHeaderModel_recordAndDisplayLabel")),$n=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationHeaderModel_recordAndDisplayTitle")),zn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationHeaderModel_tooltipLabel")),qn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationMicrophoneRequestModel_microphoneAccessBlockedTextLabel")),jn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationMicrophoneRequestModel_microphoneAccessBlockedTitleLabel")),Xn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationMicrophoneRequestModel_microphoneAccessTitleLabel")),Kn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_deleteAriaLabel")),Yn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_deleteLabel")),Zn=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_durationAriaLabel")),et=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_limitReachedLabel")),nt=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_pauseAriaLabel")),tt=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_playAriaLabel")),at=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_playToPreviewRecordingLabel")),rt=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_playbackProgressLabel")),ot=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_recordAriaLabel")),it=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_recordInstructionsLabel")),lt=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_recordingProgressLabel")),ct=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_retakeAriaLabel")),st=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_retakeLabel")),dt=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_stopAriaLabel")),ut=(e,n,t)=>(0,Nn.A)(t.OneJSResolverContext.stringProvider,(0,yn.Ex)("name-pronunciation-web-hybrid.OneGQL_NamePronunciationRecorderModel_stopRecordingLabel")),mt=()=>{const e={OneJSResolverContext:{stringProvider:(0,An.eO)()}},n={OneJSResolverContext:{settingProvider:c()}};var t,a;return{navigationModel:{headerModel:{manageTitle:Sn(Wn,e),recordAndDisplayTitle:Sn($n,e),recordAndDisplayLabel:Sn(Hn,e),deleteRecordingTitle:Sn(Jn,e),deleteRecordingLabel:Sn(Qn,e),tooltipLabel:Sn(zn,e),errorTitle:Sn(Vn,e),errorLabel:Sn(Un,e),cancelAndCloseDialogAriaLabel:Sn(Gn,e)},footerModel:{saveLabel:Sn(Bn,e),cancelLabel:Sn(Dn,e),cancelAndCloseDialogAriaLabel:Sn(_n,e),deleteLabel:Sn(On,e),yesDeleteLabel:Sn(Fn,e),noKeepLabel:Sn(Tn,e),savingAriaLabel:Sn(In,e),deletingAriaLabel:Sn(kn,e)}},mainViewModel:{isNamePronunciationWebmMp4Enabled:(t=Mn,a=n,t(null,null,a)),microphoneRequestModel:{microphoneAccessTitleLabel:Sn(Xn,e),microphoneAccessBlockedTitleLabel:Sn(jn,e),microphoneAccessBlockedTextLabel:Sn(qn,e)},recorderModel:{playToPreviewRecordingLabel:Sn(at,e),durationAriaLabel:Sn(Zn,e),retakeLabel:Sn(st,e),retakeAriaLabel:Sn(ct,e),deleteLabel:Sn(Yn,e),deleteAriaLabel:Sn(Kn,e),limitReachedLabel:Sn(et,e),playAriaLabel:Sn(tt,e),pauseAriaLabel:Sn(nt,e),playbackProgressLabel:Sn(rt,e),recordInstructionsLabel:Sn(it,e),recordAriaLabel:Sn(ot,e),stopAriaLabel:Sn(dt,e),stopRecordingLabel:Sn(ut,e),recordingProgressLabel:Sn(lt,e)}}}};function pt(e){let{data:n,...t}=e;const a=mt(),r=function(e){const n=i.useRef(e);return Cn()(typeof n.current==typeof e,`The data prop was changed from a ${typeof n.current} to a ${typeof e}. This is not supported, make sure you pass either an object or a function/hook and don't change during runtime.`),"function"==typeof n.current?(Cn()(n.current===e,"The data prop was changed from a function to a different function or a data object When you provide a hook make sure you pass the same function/hook and don't change during runtime."),n.current()):e}(n);return i.createElement(wn,{...t,viewData:a,data:r})}var gt=t(76799),ht=t(20243),bt=t(49363),vt=t(90838),ft=t(41893);const Et={scenario:"NamePronunciationPost"},Lt={scenario:"NamePronunciationDelete"};function xt(e){const n=(e=>{const n=(0,vt.H5)(Et);return t=>n((n=>(0,bt.Ew)(e,{namePronunciationAudio:t},n)))().then((0,gt.Wm)((e=>e)))})((0,ft.BB)()),[t]=(0,ht.e)(n,{onSettled:(n,t)=>{if("success"===(null==t?void 0:t.state)&&t.data){var a,r;const o=null===(a=t.data)||void 0===a?void 0:a.audioBlob,i=null===(r=t.data)||void 0===r?void 0:r.id;o&&i&&n.setQueryData(e,{data:{defaultName:{pronunciationAudioClip:{audioBlob:o,id:i},sources:["PROFILE"]}},state:"success"})}}});return async e=>{const n=await t(e);switch(null==n?void 0:n.state){case"error":return{state:"error",errorCode:n.errorCode};case"success":return{state:"success",data:n.data};default:return{state:"no_data"}}}}function Pt(e){const n=(e=>{const n=(0,vt.H5)(Lt);return t=>n((n=>(0,bt.MY)(e,{pronunciationId:t.id},n)))().then((0,gt.Wm)((e=>e)))})((0,ft.BB)()),[t]=(0,ht.e)(n,{onSettled:(n,t)=>{"error"!==(null==t?void 0:t.state)&&n.setQueryData(e,{data:{defaultName:null},state:"no_data"})}});return async e=>{const n=await t(e);switch(null==n?void 0:n.state){case"error":return{state:"error",errorCode:n.errorCode};case"success":return{state:"success",data:n.data};default:return{state:"no_data"}}}}const wt=e=>({useMutation:n=>{const t=Pt(e),a=xt(e);return[e=>{var n;return(!(null===(n=e.variables)||void 0===n?void 0:n.audioBlob)?t:a)(e.variables).then((e=>({data:e,errors:"error"===e.state?[new Error(e.errorCode)]:void 0})))},!1]}}),Rt=e=>{const{audioData:n,cacheKey:t,setShouldShowNamePronunciationEditor:l}=e,{isNamePronunciationWebmMp4Enabled:c}=(0,r.U)(),d=i.useMemo((()=>c),[c]),[,u]=(0,o.l)(),{trapFocus:m,untrapFocus:p}=(0,a.X)(),g=i.useMemo((()=>wt(t)),[t[0],t[1]]);return i.useEffect((()=>(u("Sticky"),p(),()=>{u("NonSticky"),m()})),[u,p,m]),i.createElement(s,{settings:{OneGQL_NamePronunciationMainViewModel_isNamePronunciationWebmMp4Enabled:d}},i.createElement(V.X,{graphql:g},i.createElement(pt,{data:n,setShouldShowNamePronunciationEditor:l})))}},59142:(e,n,t)=>{e.exports=t.p+"assets/images/error.png"},36615:(e,n,t)=>{e.exports=t.p+"assets/images/error_dark.png"},59418:(e,n,t)=>{e.exports=t.p+"assets/images/trash.png"},1507:(e,n,t)=>{e.exports=t.p+"assets/images/trash_dark.png"}}]);