streamlit-nightly 1.46.2.dev20250715__py3-none-any.whl → 1.47.1.dev20250716__py3-none-any.whl

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.
Files changed (82) hide show
  1. streamlit/connections/snowflake_connection.py +2 -2
  2. streamlit/elements/graphviz_chart.py +7 -0
  3. streamlit/elements/lib/file_uploader_utils.py +21 -2
  4. streamlit/elements/plotly_chart.py +6 -2
  5. streamlit/elements/pyplot.py +5 -1
  6. streamlit/elements/widgets/chat.py +6 -0
  7. streamlit/elements/widgets/file_uploader.py +6 -0
  8. streamlit/static/index.html +1 -1
  9. streamlit/static/manifest.json +218 -218
  10. streamlit/static/static/js/{ErrorOutline.esm.CaUhmcG6.js → ErrorOutline.esm.DNK5J9Fz.js} +1 -1
  11. streamlit/static/static/js/{FileDownload.esm.ZEl-HfEg.js → FileDownload.esm.Cb2Z--zt.js} +1 -1
  12. streamlit/static/static/js/{FileHelper.BKIVKQnB.js → FileHelper.QQBwcr1S.js} +1 -1
  13. streamlit/static/static/js/{FormClearHelper.C4W8xjEX.js → FormClearHelper.Fo17GZrr.js} +1 -1
  14. streamlit/static/static/js/{Hooks.Bcs7Dqad.js → Hooks.Blc9M7kn.js} +1 -1
  15. streamlit/static/static/js/{InputInstructions.CAp9mFM6.js → InputInstructions.DQ5Ej_7M.js} +1 -1
  16. streamlit/static/static/js/{ProgressBar.DBmbQ5U6.js → ProgressBar.DbvwXQwC.js} +1 -1
  17. streamlit/static/static/js/{RenderInPortalIfExists.BGENGpwt.js → RenderInPortalIfExists.DUUcjeaK.js} +1 -1
  18. streamlit/static/static/js/{Toolbar.CA92Moni.js → Toolbar.oggLWFZy.js} +1 -1
  19. streamlit/static/static/js/{base-input.C-H36mFE.js → base-input.DiS6HF4j.js} +1 -1
  20. streamlit/static/static/js/{checkbox.B6I7DbdE.js → checkbox.D60kv6TD.js} +1 -1
  21. streamlit/static/static/js/{createSuper.DEaMobJa.js → createSuper.C67qUZn1.js} +1 -1
  22. streamlit/static/static/js/{data-grid-overlay-editor.CxvB719M.js → data-grid-overlay-editor.Cov081px.js} +1 -1
  23. streamlit/static/static/js/{downloader.CDDSxxak.js → downloader.C82YfVzs.js} +1 -1
  24. streamlit/static/static/js/{es6.BMYexa9t.js → es6.BhqRltzl.js} +2 -2
  25. streamlit/static/static/js/{iframeResizer.contentWindow.D-l9cCws.js → iframeResizer.contentWindow.BZvCz8C4.js} +1 -1
  26. streamlit/static/static/js/{index.BjJqANY4.js → index.6RK7jQPW.js} +1 -1
  27. streamlit/static/static/js/{index.DygxY7Lg.js → index.B3AxymZr.js} +2 -2
  28. streamlit/static/static/js/{index.CEUhSvrW.js → index.B4lVqTBW.js} +1 -1
  29. streamlit/static/static/js/{index.Ch30W6NP.js → index.B5O7nWCz.js} +1 -1
  30. streamlit/static/static/js/{index.DJ6SMXzt.js → index.B5wDHoKR.js} +1 -1
  31. streamlit/static/static/js/{index.DBVPN8iJ.js → index.B6y7HgHo.js} +1 -1
  32. streamlit/static/static/js/{index.DFjvmFUl.js → index.BHolK_CI.js} +1 -1
  33. streamlit/static/static/js/{index.DMzpbFDn.js → index.BM85-T91.js} +1 -1
  34. streamlit/static/static/js/{index.Bb5Sxtkx.js → index.BNqR53-k.js} +1 -1
  35. streamlit/static/static/js/{index.DHv7KxuP.js → index.BOKlrlFj.js} +1 -1
  36. streamlit/static/static/js/{index.CZbA_QY0.js → index.BSlzPv51.js} +1 -1
  37. streamlit/static/static/js/{index.BdazK8za.js → index.BZF4FCAE.js} +1 -1
  38. streamlit/static/static/js/{index.1ZtAvXND.js → index.B_k2kuGW.js} +1 -1
  39. streamlit/static/static/js/{index.DNoDZbuV.js → index.By0Eif-W.js} +1 -1
  40. streamlit/static/static/js/{index.aLRZj3JI.js → index.C70-m6Fw.js} +1 -1
  41. streamlit/static/static/js/{index.Buz-cCdK.js → index.CA0u5BJL.js} +1 -1
  42. streamlit/static/static/js/{index.Br2RYgMU.js → index.C_X5F5TG.js} +1 -1
  43. streamlit/static/static/js/{index.Ce906Q5W.js → index.CaTOVCTS.js} +1 -1
  44. streamlit/static/static/js/{index.D9XZpDDt.js → index.Cb-_n28x.js} +1 -1
  45. streamlit/static/static/js/{index.Ou3kxN43.js → index.Cn9KSkdV.js} +1 -1
  46. streamlit/static/static/js/{index.B-g_Erog.js → index.CtapdFs_.js} +5 -5
  47. streamlit/static/static/js/{index.vRRu8CJW.js → index.CvFk5Vuj.js} +1 -1
  48. streamlit/static/static/js/{index.EAQB8Tuq.js → index.D1AeFlAQ.js} +3 -3
  49. streamlit/static/static/js/{index.CS9yBABI.js → index.D6Zkg3M-.js} +1 -1
  50. streamlit/static/static/js/{index.BoTBd6Jn.js → index.DFLdlD8F.js} +1 -1
  51. streamlit/static/static/js/{index.DYvo87DK.js → index.DGw6KzzW.js} +1 -1
  52. streamlit/static/static/js/{index.CphcnmQO.js → index.DJhDzJzB.js} +1 -1
  53. streamlit/static/static/js/{index.Dm8vdcs9.js → index.DbQYY96m.js} +1 -1
  54. streamlit/static/static/js/{index.phUFaJLn.js → index.KCUN3mSA.js} +1 -1
  55. streamlit/static/static/js/{index.DzH3Qe6P.js → index.KU83amIK.js} +1 -1
  56. streamlit/static/static/js/{index.Ct2v9YN2.js → index.LqU8bU6z.js} +1 -1
  57. streamlit/static/static/js/{index.BQQ5JTaz.js → index.RvGvTgvL.js} +1 -1
  58. streamlit/static/static/js/{index.kIS8fJE1.js → index.X5bDcXsg.js} +1 -1
  59. streamlit/static/static/js/{index.CqALE_Sz.js → index.dfF-LVn5.js} +1 -1
  60. streamlit/static/static/js/{index.C_f3O5DO.js → index.kt6H3rVc.js} +1 -1
  61. streamlit/static/static/js/{index.CfoE7jon.js → index.rrZNiSCJ.js} +1 -1
  62. streamlit/static/static/js/{index.C9PLrvrw.js → index.uTlWTJyJ.js} +1 -1
  63. streamlit/static/static/js/{input.DjnwsrgF.js → input.C5ChshDH.js} +1 -1
  64. streamlit/static/static/js/{memory.C-fF2BpE.js → memory.YFW_wmkS.js} +1 -1
  65. streamlit/static/static/js/{mergeWith.Cjweouij.js → mergeWith.CRLNQNLL.js} +1 -1
  66. streamlit/static/static/js/{number-overlay-editor.BFTlQD7x.js → number-overlay-editor.Coke5m2c.js} +1 -1
  67. streamlit/static/static/js/{possibleConstructorReturn.Cy1PJuxU.js → possibleConstructorReturn.DG2YBhZN.js} +1 -1
  68. streamlit/static/static/js/{sandbox.DvSXZ4R-.js → sandbox.Bk17Upg8.js} +1 -1
  69. streamlit/static/static/js/{timepicker.bPCY7gSF.js → timepicker.DGOKu1Dm.js} +1 -1
  70. streamlit/static/static/js/{toConsumableArray.DaNXH4b3.js → toConsumableArray.FS1y1Ph9.js} +1 -1
  71. streamlit/static/static/js/{uniqueId.CDZNs_pn.js → uniqueId.xlR2febd.js} +1 -1
  72. streamlit/static/static/js/{useBasicWidgetState.YAhDGDM8.js → useBasicWidgetState.WEzLnfWp.js} +1 -1
  73. streamlit/static/static/js/{useOnInputChange.HiDk3WIa.js → useOnInputChange.xCSX6R9u.js} +1 -1
  74. streamlit/static/static/js/{useTextInputAutoExpand.CwuIWHHK.js → useTextInputAutoExpand.Qpzi9U5B.js} +1 -1
  75. streamlit/static/static/js/{withFullScreenWrapper.C4lh8vGd.js → withFullScreenWrapper.BPdpC8z2.js} +1 -1
  76. streamlit/user_info.py +5 -1
  77. {streamlit_nightly-1.46.2.dev20250715.dist-info → streamlit_nightly-1.47.1.dev20250716.dist-info}/METADATA +13 -1
  78. {streamlit_nightly-1.46.2.dev20250715.dist-info → streamlit_nightly-1.47.1.dev20250716.dist-info}/RECORD +82 -82
  79. {streamlit_nightly-1.46.2.dev20250715.data → streamlit_nightly-1.47.1.dev20250716.data}/scripts/streamlit.cmd +0 -0
  80. {streamlit_nightly-1.46.2.dev20250715.dist-info → streamlit_nightly-1.47.1.dev20250716.dist-info}/WHEEL +0 -0
  81. {streamlit_nightly-1.46.2.dev20250715.dist-info → streamlit_nightly-1.47.1.dev20250716.dist-info}/entry_points.txt +0 -0
  82. {streamlit_nightly-1.46.2.dev20250715.dist-info → streamlit_nightly-1.47.1.dev20250716.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{r,b as z}from"./index.EAQB8Tuq.js";import{s as J,i as D,a as Q,b as U,T as Z,C as ee,m as te}from"./index.B-g_Erog.js";import"./FormClearHelper.C4W8xjEX.js";import"./withFullScreenWrapper.C4lh8vGd.js";import"./Toolbar.CA92Moni.js";import"./checkbox.B6I7DbdE.js";import"./mergeWith.Cjweouij.js";import"./sprintf.D7DtBTRn.js";import"./createDownloadLinkElement.DZMwyjvU.js";import"./toConsumableArray.DaNXH4b3.js";import"./possibleConstructorReturn.Cy1PJuxU.js";import"./createSuper.DEaMobJa.js";import"./FileDownload.esm.ZEl-HfEg.js";const re=()=>t=>t.targetX,ie=()=>t=>t.targetY,ne=()=>t=>t.targetWidth,se=()=>t=>t.targetHeight,ae=()=>t=>t.targetY+10,oe=()=>t=>Math.max(0,(t.targetHeight-28)/2),le=J("div")({name:"DataGridOverlayEditorStyle",class:"gdg-d19meir1",propsAsIs:!1,vars:{"d19meir1-0":[ie(),"px"],"d19meir1-1":[re(),"px"],"d19meir1-2":[ne(),"px"],"d19meir1-3":[se(),"px"],"d19meir1-4":[ae(),"px"],"d19meir1-5":[oe(),"px"]}});function de(){const[t,s]=r.useState();return[t??void 0,s]}function ue(){const[t,s]=de(),[n,h]=r.useState(0),[f,v]=r.useState(!0);r.useLayoutEffect(()=>{if(t===void 0||!("IntersectionObserver"in window))return;const a=new IntersectionObserver(o=>{o.length!==0&&v(o[0].isIntersecting)},{threshold:1});return a.observe(t),()=>a.disconnect()},[t]),r.useEffect(()=>{if(f||t===void 0)return;let a;const o=()=>{const{right:x}=t.getBoundingClientRect();h(m=>Math.min(m+window.innerWidth-x-10,0)),a=requestAnimationFrame(o)};return a=requestAnimationFrame(o),()=>{a!==void 0&&cancelAnimationFrame(a)}},[t,f]);const C=r.useMemo(()=>({transform:`translateX(${n}px)`}),[n]);return{ref:s,style:C}}const Se=t=>{const{target:s,content:n,onFinishEditing:h,forceEditMode:f,initialValue:v,imageEditorOverride:C,markdownDivCreateNode:a,highlight:o,className:x,theme:m,id:H,cell:p,bloom:I,portalElementRef:w,validateCell:g,getCellRenderer:F,provideEditor:P,isOutsideClick:W,customEventTarget:X}=t,[l,A]=r.useState(f?n:void 0),O=r.useRef(l??n);O.current=l??n;const[y,S]=r.useState(()=>g===void 0?!0:!(D(n)&&g?.(p,n,O.current)===!1)),u=r.useCallback((e,i)=>{h(y?e:void 0,i)},[y,h]),K=r.useCallback(e=>{if(g!==void 0&&e!==void 0&&D(e)){const i=g(p,e,O.current);i===!1?S(!1):(typeof i=="object"&&(e=i),S(!0))}A(e)},[p,g]),E=r.useRef(!1),c=r.useRef(void 0),Y=r.useCallback(()=>{u(l,[0,0]),E.current=!0},[l,u]),j=r.useCallback((e,i)=>{u(e,i??c.current??[0,0]),E.current=!0},[u]),L=r.useCallback(async e=>{let i=!1;e.key==="Escape"?(e.stopPropagation(),e.preventDefault(),c.current=[0,0]):e.key==="Enter"&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),c.current=[0,1],i=!0):e.key==="Tab"&&(e.stopPropagation(),e.preventDefault(),c.current=[e.shiftKey?-1:1,0],i=!0),window.setTimeout(()=>{!E.current&&c.current!==void 0&&(u(i?l:void 0,c.current),E.current=!0)},0)},[u,l]),k=l??n,[d,q]=r.useMemo(()=>{if(Q(n))return[];const e={...n,location:p},i=P?.(e);return i!==void 0?[i,!1]:[F(n)?.provideEditor?.(e),!1]},[p,n,F,P]),{ref:B,style:$}=ue();let T=!0,M,_=!0,b;if(d!==void 0){T=d.disablePadding!==!0,_=d.disableStyling!==!0;const e=U(d);e&&(b=d.styleOverride);const i=e?d.editor:d;M=r.createElement(i,{portalElementRef:w,isHighlighted:o,onChange:K,value:k,initialValue:v,onFinishedEditing:j,validatedSelection:D(k)?k.selectionRange:void 0,forceEditMode:f,target:s,imageEditorOverride:C,markdownDivCreateNode:a,isValid:y,theme:m})}b={...b,...$};const N=w?.current??document.getElementById("portal");if(N===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please, either provide a portalElementRef or add `<div id="portal" />` as the last child of your `<body>`.'),null;let R=_?"gdg-style":"gdg-unstyle";y||(R+=" gdg-invalid"),T&&(R+=" gdg-pad");const V=I?.[0]??1,G=I?.[1]??1;return z.createPortal(r.createElement(Z.Provider,{value:m},r.createElement(ee,{style:te(m),className:x,onClickOutside:Y,isOutsideClick:W,customEventTarget:X},r.createElement(le,{ref:B,id:H,className:R,style:b,as:q===!0?"label":void 0,targetX:s.x-V,targetY:s.y-G,targetWidth:s.width+V*2,targetHeight:s.height+G*2},r.createElement("div",{className:"gdg-clip-region",onKeyDown:L},M)))),N)};export{Se as default};
1
+ import{r,b as z}from"./index.D1AeFlAQ.js";import{s as J,i as D,a as Q,b as U,T as Z,C as ee,m as te}from"./index.CtapdFs_.js";import"./FormClearHelper.Fo17GZrr.js";import"./withFullScreenWrapper.BPdpC8z2.js";import"./Toolbar.oggLWFZy.js";import"./checkbox.D60kv6TD.js";import"./mergeWith.CRLNQNLL.js";import"./sprintf.D7DtBTRn.js";import"./createDownloadLinkElement.DZMwyjvU.js";import"./toConsumableArray.FS1y1Ph9.js";import"./possibleConstructorReturn.DG2YBhZN.js";import"./createSuper.C67qUZn1.js";import"./FileDownload.esm.Cb2Z--zt.js";const re=()=>t=>t.targetX,ie=()=>t=>t.targetY,ne=()=>t=>t.targetWidth,se=()=>t=>t.targetHeight,ae=()=>t=>t.targetY+10,oe=()=>t=>Math.max(0,(t.targetHeight-28)/2),le=J("div")({name:"DataGridOverlayEditorStyle",class:"gdg-d19meir1",propsAsIs:!1,vars:{"d19meir1-0":[ie(),"px"],"d19meir1-1":[re(),"px"],"d19meir1-2":[ne(),"px"],"d19meir1-3":[se(),"px"],"d19meir1-4":[ae(),"px"],"d19meir1-5":[oe(),"px"]}});function de(){const[t,s]=r.useState();return[t??void 0,s]}function ue(){const[t,s]=de(),[n,h]=r.useState(0),[f,v]=r.useState(!0);r.useLayoutEffect(()=>{if(t===void 0||!("IntersectionObserver"in window))return;const a=new IntersectionObserver(o=>{o.length!==0&&v(o[0].isIntersecting)},{threshold:1});return a.observe(t),()=>a.disconnect()},[t]),r.useEffect(()=>{if(f||t===void 0)return;let a;const o=()=>{const{right:x}=t.getBoundingClientRect();h(m=>Math.min(m+window.innerWidth-x-10,0)),a=requestAnimationFrame(o)};return a=requestAnimationFrame(o),()=>{a!==void 0&&cancelAnimationFrame(a)}},[t,f]);const C=r.useMemo(()=>({transform:`translateX(${n}px)`}),[n]);return{ref:s,style:C}}const Se=t=>{const{target:s,content:n,onFinishEditing:h,forceEditMode:f,initialValue:v,imageEditorOverride:C,markdownDivCreateNode:a,highlight:o,className:x,theme:m,id:H,cell:p,bloom:I,portalElementRef:w,validateCell:g,getCellRenderer:F,provideEditor:P,isOutsideClick:W,customEventTarget:X}=t,[l,A]=r.useState(f?n:void 0),O=r.useRef(l??n);O.current=l??n;const[y,S]=r.useState(()=>g===void 0?!0:!(D(n)&&g?.(p,n,O.current)===!1)),u=r.useCallback((e,i)=>{h(y?e:void 0,i)},[y,h]),K=r.useCallback(e=>{if(g!==void 0&&e!==void 0&&D(e)){const i=g(p,e,O.current);i===!1?S(!1):(typeof i=="object"&&(e=i),S(!0))}A(e)},[p,g]),E=r.useRef(!1),c=r.useRef(void 0),Y=r.useCallback(()=>{u(l,[0,0]),E.current=!0},[l,u]),j=r.useCallback((e,i)=>{u(e,i??c.current??[0,0]),E.current=!0},[u]),L=r.useCallback(async e=>{let i=!1;e.key==="Escape"?(e.stopPropagation(),e.preventDefault(),c.current=[0,0]):e.key==="Enter"&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),c.current=[0,1],i=!0):e.key==="Tab"&&(e.stopPropagation(),e.preventDefault(),c.current=[e.shiftKey?-1:1,0],i=!0),window.setTimeout(()=>{!E.current&&c.current!==void 0&&(u(i?l:void 0,c.current),E.current=!0)},0)},[u,l]),k=l??n,[d,q]=r.useMemo(()=>{if(Q(n))return[];const e={...n,location:p},i=P?.(e);return i!==void 0?[i,!1]:[F(n)?.provideEditor?.(e),!1]},[p,n,F,P]),{ref:B,style:$}=ue();let T=!0,M,_=!0,b;if(d!==void 0){T=d.disablePadding!==!0,_=d.disableStyling!==!0;const e=U(d);e&&(b=d.styleOverride);const i=e?d.editor:d;M=r.createElement(i,{portalElementRef:w,isHighlighted:o,onChange:K,value:k,initialValue:v,onFinishedEditing:j,validatedSelection:D(k)?k.selectionRange:void 0,forceEditMode:f,target:s,imageEditorOverride:C,markdownDivCreateNode:a,isValid:y,theme:m})}b={...b,...$};const N=w?.current??document.getElementById("portal");if(N===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please, either provide a portalElementRef or add `<div id="portal" />` as the last child of your `<body>`.'),null;let R=_?"gdg-style":"gdg-unstyle";y||(R+=" gdg-invalid"),T&&(R+=" gdg-pad");const V=I?.[0]??1,G=I?.[1]??1;return z.createPortal(r.createElement(Z.Provider,{value:m},r.createElement(ee,{style:te(m),className:x,onClickOutside:Y,isOutsideClick:W,customEventTarget:X},r.createElement(le,{ref:B,id:H,className:R,style:b,as:q===!0?"label":void 0,targetX:s.x-V,targetY:s.y-G,targetWidth:s.width+V*2,targetHeight:s.height+G*2},r.createElement("div",{className:"gdg-clip-region",onKeyDown:L},M)))),N)};export{Se as default};
@@ -1 +1 @@
1
- import{c as w,e as b}from"./es6.BMYexa9t.js";import"./index.EAQB8Tuq.js";const{WritableStream:m,TransformStream:y,DOMException:P,Blob:_}=w,{GONE:v}=b,E=/constructor/i.test(window.HTMLElement);class C{constructor(e="unkown"){this.name=e,this.kind="file"}async getFile(){throw new P(...v)}async isSameEntry(e){return this===e}async createWritable(e={}){const t=await navigator.serviceWorker?.getRegistration(),o=document.createElement("a"),n=new y,u=n.writable;if(o.download=this.name,E||!t){let r=[];n.readable.pipeTo(new m({write(s){r.push(new _([s]))},close(){const s=new _(r,{type:"application/octet-stream; charset=utf-8"});r=[],o.href=URL.createObjectURL(s),o.click(),setTimeout(()=>URL.revokeObjectURL(o.href),1e4)}}))}else{const{writable:r,readablePort:s}=new S(m),a=encodeURIComponent(this.name).replace(/['()]/g,escape).replace(/\*/g,"%2A"),R={"content-disposition":"attachment; filename*=UTF-8''"+a,"content-type":"application/octet-stream; charset=utf-8",...e.size?{"content-length":e.size}:{}},f=setTimeout(()=>t.active.postMessage(0),1e4);n.readable.pipeThrough(new y({transform(c,d){if(c instanceof Uint8Array)return d.enqueue(c);const g=new Response(c).body.getReader(),h=j=>g.read().then(p=>p.done?0:h(d.enqueue(p.value)));return h()}})).pipeTo(r).finally(()=>{clearInterval(f)}),t.active.postMessage({url:t.scope+a,headers:R,readablePort:s},[s]);const i=document.createElement("iframe");i.hidden=!0,i.src=t.scope+a,document.body.appendChild(i)}return u.getWriter()}}const M=0,T=0,L=1,O=1,U=2;class k{constructor(e){e.onmessage=t=>this._onMessage(t.data),this._port=e,this._resetReady()}start(e){return this._controller=e,this._readyPromise}write(e){const t={type:M,chunk:e};return this._port.postMessage(t,[e.buffer]),this._resetReady(),this._readyPromise}close(){this._port.postMessage({type:U}),this._port.close()}abort(e){this._port.postMessage({type:O,reason:e}),this._port.close()}_onMessage(e){e.type===T&&this._resolveReady(),e.type===L&&this._onError(e.reason)}_onError(e){this._controller.error(e),this._rejectReady(e),this._port.close()}_resetReady(){this._readyPromise=new Promise((e,t)=>{this._readyResolve=e,this._readyReject=t}),this._readyPending=!0}_resolveReady(){this._readyResolve(),this._readyPending=!1}_rejectReady(e){this._readyPending||this._resetReady(),this._readyPromise.catch(()=>{}),this._readyReject(e),this._readyPending=!1}}class S{constructor(e){const t=new MessageChannel;this.readablePort=t.port1,this.writable=new e(new k(t.port2))}}export{C as FileHandle};
1
+ import{c as w,e as b}from"./es6.BhqRltzl.js";import"./index.D1AeFlAQ.js";const{WritableStream:m,TransformStream:y,DOMException:P,Blob:_}=w,{GONE:v}=b,E=/constructor/i.test(window.HTMLElement);class C{constructor(e="unkown"){this.name=e,this.kind="file"}async getFile(){throw new P(...v)}async isSameEntry(e){return this===e}async createWritable(e={}){const t=await navigator.serviceWorker?.getRegistration(),o=document.createElement("a"),n=new y,u=n.writable;if(o.download=this.name,E||!t){let r=[];n.readable.pipeTo(new m({write(s){r.push(new _([s]))},close(){const s=new _(r,{type:"application/octet-stream; charset=utf-8"});r=[],o.href=URL.createObjectURL(s),o.click(),setTimeout(()=>URL.revokeObjectURL(o.href),1e4)}}))}else{const{writable:r,readablePort:s}=new S(m),a=encodeURIComponent(this.name).replace(/['()]/g,escape).replace(/\*/g,"%2A"),R={"content-disposition":"attachment; filename*=UTF-8''"+a,"content-type":"application/octet-stream; charset=utf-8",...e.size?{"content-length":e.size}:{}},f=setTimeout(()=>t.active.postMessage(0),1e4);n.readable.pipeThrough(new y({transform(c,d){if(c instanceof Uint8Array)return d.enqueue(c);const g=new Response(c).body.getReader(),h=j=>g.read().then(p=>p.done?0:h(d.enqueue(p.value)));return h()}})).pipeTo(r).finally(()=>{clearInterval(f)}),t.active.postMessage({url:t.scope+a,headers:R,readablePort:s},[s]);const i=document.createElement("iframe");i.hidden=!0,i.src=t.scope+a,document.body.appendChild(i)}return u.getWriter()}}const M=0,T=0,L=1,O=1,U=2;class k{constructor(e){e.onmessage=t=>this._onMessage(t.data),this._port=e,this._resetReady()}start(e){return this._controller=e,this._readyPromise}write(e){const t={type:M,chunk:e};return this._port.postMessage(t,[e.buffer]),this._resetReady(),this._readyPromise}close(){this._port.postMessage({type:U}),this._port.close()}abort(e){this._port.postMessage({type:O,reason:e}),this._port.close()}_onMessage(e){e.type===T&&this._resolveReady(),e.type===L&&this._onError(e.reason)}_onError(e){this._controller.error(e),this._rejectReady(e),this._port.close()}_resetReady(){this._readyPromise=new Promise((e,t)=>{this._readyResolve=e,this._readyReject=t}),this._readyPending=!0}_resolveReady(){this._readyResolve(),this._readyPending=!1}_rejectReady(e){this._readyPending||this._resetReady(),this._readyPromise.catch(()=>{}),this._readyReject(e),this._readyPending=!1}}class S{constructor(e){const t=new MessageChannel;this.readablePort=t.port1,this.writable=new e(new k(t.port2))}}export{C as FileHandle};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./downloader.CDDSxxak.js","./index.EAQB8Tuq.js","../css/index.CJVRHjQZ.css","./sandbox.DvSXZ4R-.js","./memory.C-fF2BpE.js"])))=>i.map(i=>d[i]);
2
- import{y as d}from"./index.EAQB8Tuq.js";const I=globalThis.showDirectoryPicker;async function j(i={}){if(I&&!i._preferPolyfill)return I(i);const e=document.createElement("input");e.type="file",e.webkitdirectory=!0,e.multiple=!0,e.style.position="fixed",e.style.top="-100000px",e.style.left="-100000px",document.body.appendChild(e);const t=d(()=>Promise.resolve().then(()=>R),void 0,import.meta.url);return await new Promise(a=>{e.addEventListener("change",a),e.click()}),t.then(a=>a.getDirHandlesFromInput(e))}const M={accepts:[]},x=globalThis.showOpenFilePicker;async function N(i={}){const e={...M,...i};if(x&&!i._preferPolyfill)return x(e);const t=document.createElement("input");t.type="file",t.multiple=e.multiple,t.accept=(e.accepts||[]).map(o=>[...(o.extensions||[]).map(n=>"."+n),...o.mimeTypes||[]]).flat().join(","),Object.assign(t.style,{position:"fixed",top:"-100000px",left:"-100000px"}),document.body.appendChild(t);const a=d(()=>Promise.resolve().then(()=>R),void 0,import.meta.url);return await new Promise(o=>{t.addEventListener("change",o,{once:!0}),t.click()}),t.remove(),a.then(o=>o.getFileHandlesFromInput(t))}const L=globalThis.showSaveFilePicker;async function V(i={}){if(L&&!i._preferPolyfill)return L(i);i._name&&(console.warn("deprecated _name, spec now have `suggestedName`"),i.suggestedName=i._name);const{FileSystemFileHandle:e}=await d(async()=>{const{FileSystemFileHandle:a}=await Promise.resolve().then(()=>g);return{FileSystemFileHandle:a}},void 0,import.meta.url),{FileHandle:t}=await d(async()=>{const{FileHandle:a}=await import("./downloader.CDDSxxak.js");return{FileHandle:a}},__vite__mapDeps([0,1,2]),import.meta.url);return new e(new t(i.suggestedName))}globalThis.DataTransferItem&&!DataTransferItem.prototype.getAsFileSystemHandle&&(DataTransferItem.prototype.getAsFileSystemHandle=async function(){const i=this.webkitGetAsEntry(),[{FileHandle:e,FolderHandle:t},{FileSystemDirectoryHandle:a},{FileSystemFileHandle:o}]=await Promise.all([d(()=>import("./sandbox.DvSXZ4R-.js"),__vite__mapDeps([3,1,2]),import.meta.url),d(()=>Promise.resolve().then(()=>H),void 0,import.meta.url),d(()=>Promise.resolve().then(()=>g),void 0,import.meta.url)]);return i.isFile?new o(new e(i,!1)):new a(new t(i,!1))});async function W(i,e={}){if(!i)return globalThis.navigator?.storage?.getDirectory()||globalThis.getOriginPrivateDirectory();const{FileSystemDirectoryHandle:t}=await d(async()=>{const{FileSystemDirectoryHandle:n}=await Promise.resolve().then(()=>H);return{FileSystemDirectoryHandle:n}},void 0,import.meta.url),a=await i,o=await(a.default?a.default(e):a(e));return new t(o)}const q={WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,DOMException:globalThis.DOMException,Blob:globalThis.Blob,File:globalThis.File},{WritableStream:$}=q;class p extends ${#e;constructor(e){super(e),this.#e=e,Object.setPrototypeOf(this,p.prototype),this._closed=!1}async close(){this._closed=!0;const e=this.getWriter(),t=e.close();return e.releaseLock(),t}seek(e){return this.write({type:"seek",position:e})}truncate(e){return this.write({type:"truncate",size:e})}write(e){if(this._closed)return Promise.reject(new TypeError("Cannot write to a CLOSED writable stream"));const t=this.getWriter(),a=t.write(e);return t.releaseLock(),a}}Object.defineProperty(p.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(p.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}});globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable&&!globalThis.FileSystemWritableFileStream&&(globalThis.FileSystemWritableFileStream=p);const m=Symbol("adapter");class T{[m];name;kind;constructor(e){this.kind=e.kind,this.name=e.name,this[m]=e}async queryPermission(e={}){const{mode:t="read"}=e,a=this[m];if(a.queryPermission)return a.queryPermission({mode:t});if(t==="read")return"granted";if(t==="readwrite")return a.writable?"granted":"denied";throw new TypeError(`Mode ${t} must be 'read' or 'readwrite'`)}async requestPermission({mode:e="read"}={}){const t=this[m];if(t.requestPermission)return t.requestPermission({mode:e});if(e==="read")return"granted";if(e==="readwrite")return t.writable?"granted":"denied";throw new TypeError(`Mode ${e} must be 'read' or 'readwrite'`)}async remove(e={}){await this[m].remove(e)}async isSameEntry(e){return this===e?!0:!e||typeof e!="object"||this.kind!==e.kind||!e[m]?!1:this[m].isSameEntry(e[m])}}Object.defineProperty(T.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});globalThis.FileSystemHandle&&(globalThis.FileSystemHandle.prototype.queryPermission??=function(i){return"granted"});const A={INVALID:["seeking position failed.","InvalidStateError"],GONE:["A requested file or directory could not be found at the time an operation was processed.","NotFoundError"],MISMATCH:["The path supplied exists, but was not an entry of requested type.","TypeMismatchError"],MOD_ERR:["The object can not be modified in this way.","InvalidModificationError"],SYNTAX:i=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${i}`,"SyntaxError"],SECURITY:["It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.","SecurityError"],DISALLOWED:["The request is not allowed by the user agent or the platform in the current context.","NotAllowedError"]},z={writable:globalThis.WritableStream};async function U(i){console.warn("deprecated fromDataTransfer - use `dt.items[0].getAsFileSystemHandle()` instead");const[e,t,a]=await Promise.all([d(()=>import("./memory.C-fF2BpE.js"),__vite__mapDeps([4,1,2]),import.meta.url),d(()=>import("./sandbox.DvSXZ4R-.js"),__vite__mapDeps([3,1,2]),import.meta.url),d(()=>Promise.resolve().then(()=>H),void 0,import.meta.url)]),o=new e.FolderHandle("",!1);return o._entries=i.map(n=>n.isFile?new t.FileHandle(n,!1):new t.FolderHandle(n,!1)),new a.FileSystemDirectoryHandle(o)}async function k(i){const{FolderHandle:e,FileHandle:t}=await d(async()=>{const{FolderHandle:y,FileHandle:s}=await import("./memory.C-fF2BpE.js");return{FolderHandle:y,FileHandle:s}},__vite__mapDeps([4,1,2]),import.meta.url),{FileSystemDirectoryHandle:a}=await d(async()=>{const{FileSystemDirectoryHandle:y}=await Promise.resolve().then(()=>H);return{FileSystemDirectoryHandle:y}},void 0,import.meta.url),o=Array.from(i.files),n=o[0].webkitRelativePath.split("/",1)[0],l=new e(n,!1);return o.forEach(y=>{const s=y.webkitRelativePath.split("/");s.shift();const c=s.pop(),f=s.reduce((w,b)=>(w._entries[b]||(w._entries[b]=new e(b,!1)),w._entries[b]),l);f._entries[c]=new t(y.name,y,!1)}),new a(l)}async function C(i){const{FileHandle:e}=await d(async()=>{const{FileHandle:a}=await import("./memory.C-fF2BpE.js");return{FileHandle:a}},__vite__mapDeps([4,1,2]),import.meta.url),{FileSystemFileHandle:t}=await d(async()=>{const{FileSystemFileHandle:a}=await Promise.resolve().then(()=>g);return{FileSystemFileHandle:a}},void 0,import.meta.url);return Array.from(i.files).map(a=>new t(new e(a.name,a,!1)))}const R=Object.freeze(Object.defineProperty({__proto__:null,config:z,errors:A,fromDataTransfer:U,getDirHandlesFromInput:k,getFileHandlesFromInput:C},Symbol.toStringTag,{value:"Module"})),{GONE:B,MOD_ERR:G}=A,u=Symbol("adapter");let h=class v extends T{[u];constructor(e){super(e),this[u]=e}async getDirectoryHandle(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");t.create=!!t.create;const a=await this[u].getDirectoryHandle(e,t);return new v(a)}async*entries(){const{FileSystemFileHandle:e}=await d(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>g);return{FileSystemFileHandle:t}},void 0,import.meta.url);for await(const[t,a]of this[u].entries())yield[a.name,a.kind==="file"?new e(a):new v(a)]}async*getEntries(){const{FileSystemFileHandle:e}=await d(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>g);return{FileSystemFileHandle:t}},void 0,import.meta.url);console.warn("deprecated, use .entries() instead");for await(let t of this[u].entries())yield t.kind==="file"?new e(t):new v(t)}async getFileHandle(e,t={}){const{FileSystemFileHandle:a}=await d(async()=>{const{FileSystemFileHandle:n}=await Promise.resolve().then(()=>g);return{FileSystemFileHandle:n}},void 0,import.meta.url);if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");t.create=!!t.create;const o=await this[u].getFileHandle(e,t);return new a(o)}async removeEntry(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");return t.recursive=!!t.recursive,this[u].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:a,path:o}=t.pop();for await(const n of a.values()){if(await n.isSameEntry(e))return[...o,n.name];n.kind==="directory"&&t.push({handle:n,path:[...o,n.name]})}}return null}async*keys(){for await(const[e]of this[u].entries())yield e}async*values(){for await(const[e,t]of this)yield t}[Symbol.asyncIterator](){return this.entries()}};Object.defineProperty(h.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(h.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}});if(globalThis.FileSystemDirectoryHandle){const i=globalThis.FileSystemDirectoryHandle.prototype;i.resolve=async function(n){if(await n.isSameEntry(this))return[];const l=[{handle:this,path:[]}];for(;l.length;){let{handle:y,path:s}=l.pop();for await(const c of y.values()){if(await c.isSameEntry(n))return[...s,c.name];c.kind==="directory"&&l.push({handle:c,path:[...s,c.name]})}}return null};async function e(o){if(await(await navigator.storage.getDirectory()).resolve(o)===null)throw new DOMException(...B)}const t=i.entries;i.entries=async function*(){await e(this),yield*t.call(this)},i[Symbol.asyncIterator]=async function*(){yield*this.entries()};const a=i.removeEntry;i.removeEntry=async function(o,n={}){return a.call(this,o,n).catch(async l=>{throw l instanceof DOMException&&l.name==="UnknownError"&&!n.recursive&&!(await t.call(this).next()).done?new DOMException(...G):l})}}const H=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:h,default:h},Symbol.toStringTag,{value:"Module"})),{INVALID:Y,SYNTAX:O,GONE:X}=A,E=Symbol("adapter");class F extends T{[E];constructor(e){super(e),this[E]=e}async createWritable(e={}){return new p(await this[E].createWritable(e))}async getFile(){return this[E].getFile()}}Object.defineProperty(F.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(F.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}});if(globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable){const i=new WeakMap;let e;const t=()=>{let o,n;onmessage=async l=>{const y=l.ports[0],s=l.data;switch(s.type){case"open":const c=s.name;let f=await navigator.storage.getDirectory();for(const w of s.path)f=await f.getDirectoryHandle(w);o=await f.getFileHandle(c),n=await o.createSyncAccessHandle();break;case"write":n.write(s.data,{at:s.position}),n.flush();break;case"truncate":n.truncate(s.size);break;case"abort":case"close":n.close();break}y.postMessage(0)}};globalThis.FileSystemFileHandle.prototype.createWritable=async function(o){if(!e){const r=`(${t.toString()})()`,S=new Blob([r],{type:"text/javascript"});e=URL.createObjectURL(S)}const n=new Worker(e,{type:"module"});let l=0;const y=new TextEncoder;let s=await this.getFile().then(r=>r.size);const c=r=>new Promise((S,P)=>{const _=new MessageChannel;_.port1.onmessage=D=>{D.data instanceof Error?P(D.data):S(D.data),_.port1.close(),_.port2.close(),_.port1.onmessage=null},n.postMessage(r,[_.port2])}),f=await navigator.storage.getDirectory(),w=await i.get(this),b=await f.resolve(w);if(b===null)throw new DOMException(...X);return await c({type:"open",path:b,name:this.name}),o?.keepExistingData===!1&&(await c({type:"truncate",size:0}),s=0),new p({start:r=>{},async write(r){if(r?.constructor===Object?r={...r}:r={type:"write",data:r,position:l},r.type==="write"){if(!("data"in r))throw await c({type:"close"}),new DOMException(...O("write requires a data argument"));if(r.position??=l,typeof r.data=="string")r.data=y.encode(r.data);else if(r.data instanceof ArrayBuffer)r.data=new Uint8Array(r.data);else if(!(r.data instanceof Uint8Array)&&ArrayBuffer.isView(r.data))r.data=new Uint8Array(r.data.buffer,r.data.byteOffset,r.data.byteLength);else if(!(r.data instanceof Uint8Array)){const P=await new Response(r.data).arrayBuffer();r.data=new Uint8Array(P)}Number.isInteger(r.position)&&r.position>=0&&(l=r.position),l+=r.data.byteLength,s+=r.data.byteLength}else if(r.type==="seek")if(Number.isInteger(r.position)&&r.position>=0){if(s<r.position)throw new DOMException(...Y);console.log("seeking",r),l=r.position;return}else throw await c({type:"close"}),new DOMException(...O("seek requires a position argument"));else if(r.type==="truncate")if(Number.isInteger(r.size)&&r.size>=0)s=r.size,l>s&&(l=s);else throw await c({type:"close"}),new DOMException(...O("truncate requires a size argument"));await c(r)},async close(){await c({type:"close"}),n.terminate()},async abort(r){await c({type:"abort",reason:r}),n.terminate()}})};const a=FileSystemDirectoryHandle.prototype.getFileHandle;FileSystemDirectoryHandle.prototype.getFileHandle=async function(...o){const n=await a.call(this,...o);return i.set(n,this),n}}const g=Object.freeze(Object.defineProperty({__proto__:null,FileSystemFileHandle:F,default:F},Symbol.toStringTag,{value:"Module"})),Q=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:h,FileSystemFileHandle:F,FileSystemHandle:T,FileSystemWritableFileStream:p,getOriginPrivateDirectory:W,showDirectoryPicker:j,showOpenFilePicker:N,showSaveFilePicker:V},Symbol.toStringTag,{value:"Module"}));export{Q as a,q as c,A as e};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./downloader.C82YfVzs.js","./index.D1AeFlAQ.js","../css/index.CJVRHjQZ.css","./sandbox.Bk17Upg8.js","./memory.YFW_wmkS.js"])))=>i.map(i=>d[i]);
2
+ import{y as d}from"./index.D1AeFlAQ.js";const I=globalThis.showDirectoryPicker;async function j(i={}){if(I&&!i._preferPolyfill)return I(i);const e=document.createElement("input");e.type="file",e.webkitdirectory=!0,e.multiple=!0,e.style.position="fixed",e.style.top="-100000px",e.style.left="-100000px",document.body.appendChild(e);const t=d(()=>Promise.resolve().then(()=>R),void 0,import.meta.url);return await new Promise(a=>{e.addEventListener("change",a),e.click()}),t.then(a=>a.getDirHandlesFromInput(e))}const M={accepts:[]},x=globalThis.showOpenFilePicker;async function N(i={}){const e={...M,...i};if(x&&!i._preferPolyfill)return x(e);const t=document.createElement("input");t.type="file",t.multiple=e.multiple,t.accept=(e.accepts||[]).map(o=>[...(o.extensions||[]).map(n=>"."+n),...o.mimeTypes||[]]).flat().join(","),Object.assign(t.style,{position:"fixed",top:"-100000px",left:"-100000px"}),document.body.appendChild(t);const a=d(()=>Promise.resolve().then(()=>R),void 0,import.meta.url);return await new Promise(o=>{t.addEventListener("change",o,{once:!0}),t.click()}),t.remove(),a.then(o=>o.getFileHandlesFromInput(t))}const L=globalThis.showSaveFilePicker;async function V(i={}){if(L&&!i._preferPolyfill)return L(i);i._name&&(console.warn("deprecated _name, spec now have `suggestedName`"),i.suggestedName=i._name);const{FileSystemFileHandle:e}=await d(async()=>{const{FileSystemFileHandle:a}=await Promise.resolve().then(()=>g);return{FileSystemFileHandle:a}},void 0,import.meta.url),{FileHandle:t}=await d(async()=>{const{FileHandle:a}=await import("./downloader.C82YfVzs.js");return{FileHandle:a}},__vite__mapDeps([0,1,2]),import.meta.url);return new e(new t(i.suggestedName))}globalThis.DataTransferItem&&!DataTransferItem.prototype.getAsFileSystemHandle&&(DataTransferItem.prototype.getAsFileSystemHandle=async function(){const i=this.webkitGetAsEntry(),[{FileHandle:e,FolderHandle:t},{FileSystemDirectoryHandle:a},{FileSystemFileHandle:o}]=await Promise.all([d(()=>import("./sandbox.Bk17Upg8.js"),__vite__mapDeps([3,1,2]),import.meta.url),d(()=>Promise.resolve().then(()=>H),void 0,import.meta.url),d(()=>Promise.resolve().then(()=>g),void 0,import.meta.url)]);return i.isFile?new o(new e(i,!1)):new a(new t(i,!1))});async function W(i,e={}){if(!i)return globalThis.navigator?.storage?.getDirectory()||globalThis.getOriginPrivateDirectory();const{FileSystemDirectoryHandle:t}=await d(async()=>{const{FileSystemDirectoryHandle:n}=await Promise.resolve().then(()=>H);return{FileSystemDirectoryHandle:n}},void 0,import.meta.url),a=await i,o=await(a.default?a.default(e):a(e));return new t(o)}const q={WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,DOMException:globalThis.DOMException,Blob:globalThis.Blob,File:globalThis.File},{WritableStream:$}=q;class p extends ${#e;constructor(e){super(e),this.#e=e,Object.setPrototypeOf(this,p.prototype),this._closed=!1}async close(){this._closed=!0;const e=this.getWriter(),t=e.close();return e.releaseLock(),t}seek(e){return this.write({type:"seek",position:e})}truncate(e){return this.write({type:"truncate",size:e})}write(e){if(this._closed)return Promise.reject(new TypeError("Cannot write to a CLOSED writable stream"));const t=this.getWriter(),a=t.write(e);return t.releaseLock(),a}}Object.defineProperty(p.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(p.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}});globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable&&!globalThis.FileSystemWritableFileStream&&(globalThis.FileSystemWritableFileStream=p);const m=Symbol("adapter");class T{[m];name;kind;constructor(e){this.kind=e.kind,this.name=e.name,this[m]=e}async queryPermission(e={}){const{mode:t="read"}=e,a=this[m];if(a.queryPermission)return a.queryPermission({mode:t});if(t==="read")return"granted";if(t==="readwrite")return a.writable?"granted":"denied";throw new TypeError(`Mode ${t} must be 'read' or 'readwrite'`)}async requestPermission({mode:e="read"}={}){const t=this[m];if(t.requestPermission)return t.requestPermission({mode:e});if(e==="read")return"granted";if(e==="readwrite")return t.writable?"granted":"denied";throw new TypeError(`Mode ${e} must be 'read' or 'readwrite'`)}async remove(e={}){await this[m].remove(e)}async isSameEntry(e){return this===e?!0:!e||typeof e!="object"||this.kind!==e.kind||!e[m]?!1:this[m].isSameEntry(e[m])}}Object.defineProperty(T.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});globalThis.FileSystemHandle&&(globalThis.FileSystemHandle.prototype.queryPermission??=function(i){return"granted"});const A={INVALID:["seeking position failed.","InvalidStateError"],GONE:["A requested file or directory could not be found at the time an operation was processed.","NotFoundError"],MISMATCH:["The path supplied exists, but was not an entry of requested type.","TypeMismatchError"],MOD_ERR:["The object can not be modified in this way.","InvalidModificationError"],SYNTAX:i=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${i}`,"SyntaxError"],SECURITY:["It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.","SecurityError"],DISALLOWED:["The request is not allowed by the user agent or the platform in the current context.","NotAllowedError"]},z={writable:globalThis.WritableStream};async function U(i){console.warn("deprecated fromDataTransfer - use `dt.items[0].getAsFileSystemHandle()` instead");const[e,t,a]=await Promise.all([d(()=>import("./memory.YFW_wmkS.js"),__vite__mapDeps([4,1,2]),import.meta.url),d(()=>import("./sandbox.Bk17Upg8.js"),__vite__mapDeps([3,1,2]),import.meta.url),d(()=>Promise.resolve().then(()=>H),void 0,import.meta.url)]),o=new e.FolderHandle("",!1);return o._entries=i.map(n=>n.isFile?new t.FileHandle(n,!1):new t.FolderHandle(n,!1)),new a.FileSystemDirectoryHandle(o)}async function k(i){const{FolderHandle:e,FileHandle:t}=await d(async()=>{const{FolderHandle:y,FileHandle:s}=await import("./memory.YFW_wmkS.js");return{FolderHandle:y,FileHandle:s}},__vite__mapDeps([4,1,2]),import.meta.url),{FileSystemDirectoryHandle:a}=await d(async()=>{const{FileSystemDirectoryHandle:y}=await Promise.resolve().then(()=>H);return{FileSystemDirectoryHandle:y}},void 0,import.meta.url),o=Array.from(i.files),n=o[0].webkitRelativePath.split("/",1)[0],l=new e(n,!1);return o.forEach(y=>{const s=y.webkitRelativePath.split("/");s.shift();const c=s.pop(),f=s.reduce((w,b)=>(w._entries[b]||(w._entries[b]=new e(b,!1)),w._entries[b]),l);f._entries[c]=new t(y.name,y,!1)}),new a(l)}async function C(i){const{FileHandle:e}=await d(async()=>{const{FileHandle:a}=await import("./memory.YFW_wmkS.js");return{FileHandle:a}},__vite__mapDeps([4,1,2]),import.meta.url),{FileSystemFileHandle:t}=await d(async()=>{const{FileSystemFileHandle:a}=await Promise.resolve().then(()=>g);return{FileSystemFileHandle:a}},void 0,import.meta.url);return Array.from(i.files).map(a=>new t(new e(a.name,a,!1)))}const R=Object.freeze(Object.defineProperty({__proto__:null,config:z,errors:A,fromDataTransfer:U,getDirHandlesFromInput:k,getFileHandlesFromInput:C},Symbol.toStringTag,{value:"Module"})),{GONE:B,MOD_ERR:G}=A,u=Symbol("adapter");let h=class v extends T{[u];constructor(e){super(e),this[u]=e}async getDirectoryHandle(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");t.create=!!t.create;const a=await this[u].getDirectoryHandle(e,t);return new v(a)}async*entries(){const{FileSystemFileHandle:e}=await d(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>g);return{FileSystemFileHandle:t}},void 0,import.meta.url);for await(const[t,a]of this[u].entries())yield[a.name,a.kind==="file"?new e(a):new v(a)]}async*getEntries(){const{FileSystemFileHandle:e}=await d(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>g);return{FileSystemFileHandle:t}},void 0,import.meta.url);console.warn("deprecated, use .entries() instead");for await(let t of this[u].entries())yield t.kind==="file"?new e(t):new v(t)}async getFileHandle(e,t={}){const{FileSystemFileHandle:a}=await d(async()=>{const{FileSystemFileHandle:n}=await Promise.resolve().then(()=>g);return{FileSystemFileHandle:n}},void 0,import.meta.url);if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");t.create=!!t.create;const o=await this[u].getFileHandle(e,t);return new a(o)}async removeEntry(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");return t.recursive=!!t.recursive,this[u].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:a,path:o}=t.pop();for await(const n of a.values()){if(await n.isSameEntry(e))return[...o,n.name];n.kind==="directory"&&t.push({handle:n,path:[...o,n.name]})}}return null}async*keys(){for await(const[e]of this[u].entries())yield e}async*values(){for await(const[e,t]of this)yield t}[Symbol.asyncIterator](){return this.entries()}};Object.defineProperty(h.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(h.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}});if(globalThis.FileSystemDirectoryHandle){const i=globalThis.FileSystemDirectoryHandle.prototype;i.resolve=async function(n){if(await n.isSameEntry(this))return[];const l=[{handle:this,path:[]}];for(;l.length;){let{handle:y,path:s}=l.pop();for await(const c of y.values()){if(await c.isSameEntry(n))return[...s,c.name];c.kind==="directory"&&l.push({handle:c,path:[...s,c.name]})}}return null};async function e(o){if(await(await navigator.storage.getDirectory()).resolve(o)===null)throw new DOMException(...B)}const t=i.entries;i.entries=async function*(){await e(this),yield*t.call(this)},i[Symbol.asyncIterator]=async function*(){yield*this.entries()};const a=i.removeEntry;i.removeEntry=async function(o,n={}){return a.call(this,o,n).catch(async l=>{throw l instanceof DOMException&&l.name==="UnknownError"&&!n.recursive&&!(await t.call(this).next()).done?new DOMException(...G):l})}}const H=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:h,default:h},Symbol.toStringTag,{value:"Module"})),{INVALID:Y,SYNTAX:O,GONE:X}=A,E=Symbol("adapter");class F extends T{[E];constructor(e){super(e),this[E]=e}async createWritable(e={}){return new p(await this[E].createWritable(e))}async getFile(){return this[E].getFile()}}Object.defineProperty(F.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(F.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}});if(globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable){const i=new WeakMap;let e;const t=()=>{let o,n;onmessage=async l=>{const y=l.ports[0],s=l.data;switch(s.type){case"open":const c=s.name;let f=await navigator.storage.getDirectory();for(const w of s.path)f=await f.getDirectoryHandle(w);o=await f.getFileHandle(c),n=await o.createSyncAccessHandle();break;case"write":n.write(s.data,{at:s.position}),n.flush();break;case"truncate":n.truncate(s.size);break;case"abort":case"close":n.close();break}y.postMessage(0)}};globalThis.FileSystemFileHandle.prototype.createWritable=async function(o){if(!e){const r=`(${t.toString()})()`,S=new Blob([r],{type:"text/javascript"});e=URL.createObjectURL(S)}const n=new Worker(e,{type:"module"});let l=0;const y=new TextEncoder;let s=await this.getFile().then(r=>r.size);const c=r=>new Promise((S,P)=>{const _=new MessageChannel;_.port1.onmessage=D=>{D.data instanceof Error?P(D.data):S(D.data),_.port1.close(),_.port2.close(),_.port1.onmessage=null},n.postMessage(r,[_.port2])}),f=await navigator.storage.getDirectory(),w=await i.get(this),b=await f.resolve(w);if(b===null)throw new DOMException(...X);return await c({type:"open",path:b,name:this.name}),o?.keepExistingData===!1&&(await c({type:"truncate",size:0}),s=0),new p({start:r=>{},async write(r){if(r?.constructor===Object?r={...r}:r={type:"write",data:r,position:l},r.type==="write"){if(!("data"in r))throw await c({type:"close"}),new DOMException(...O("write requires a data argument"));if(r.position??=l,typeof r.data=="string")r.data=y.encode(r.data);else if(r.data instanceof ArrayBuffer)r.data=new Uint8Array(r.data);else if(!(r.data instanceof Uint8Array)&&ArrayBuffer.isView(r.data))r.data=new Uint8Array(r.data.buffer,r.data.byteOffset,r.data.byteLength);else if(!(r.data instanceof Uint8Array)){const P=await new Response(r.data).arrayBuffer();r.data=new Uint8Array(P)}Number.isInteger(r.position)&&r.position>=0&&(l=r.position),l+=r.data.byteLength,s+=r.data.byteLength}else if(r.type==="seek")if(Number.isInteger(r.position)&&r.position>=0){if(s<r.position)throw new DOMException(...Y);console.log("seeking",r),l=r.position;return}else throw await c({type:"close"}),new DOMException(...O("seek requires a position argument"));else if(r.type==="truncate")if(Number.isInteger(r.size)&&r.size>=0)s=r.size,l>s&&(l=s);else throw await c({type:"close"}),new DOMException(...O("truncate requires a size argument"));await c(r)},async close(){await c({type:"close"}),n.terminate()},async abort(r){await c({type:"abort",reason:r}),n.terminate()}})};const a=FileSystemDirectoryHandle.prototype.getFileHandle;FileSystemDirectoryHandle.prototype.getFileHandle=async function(...o){const n=await a.call(this,...o);return i.set(n,this),n}}const g=Object.freeze(Object.defineProperty({__proto__:null,FileSystemFileHandle:F,default:F},Symbol.toStringTag,{value:"Module"})),Q=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:h,FileSystemFileHandle:F,FileSystemHandle:T,FileSystemWritableFileStream:p,getOriginPrivateDirectory:W,showDirectoryPicker:j,showOpenFilePicker:N,showSaveFilePicker:V},Symbol.toStringTag,{value:"Module"}));export{Q as a,q as c,A as e};
@@ -1 +1 @@
1
- import{g as ot}from"./index.EAQB8Tuq.js";function rt(k,u){for(var p=0;p<u.length;p++){const I=u[p];if(typeof I!="string"&&!Array.isArray(I)){for(const E in I)if(E!=="default"&&!(E in k)){const O=Object.getOwnPropertyDescriptor(I,E);O&&Object.defineProperty(k,E,O.get?O:{enumerable:!0,get:()=>I[E]})}}}return Object.freeze(Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}))}var oe={exports:{}},xe;function at(){return xe||(xe=1,function(k){(function(u){if(typeof window>"u")return;var p=!0,I=10,E="",O=0,D="",_=null,re="",W=!1,Ne={resize:1,click:1},V=128,ae=!0,P=1,U="bodyOffset",h=U,se=!0,ce="",R={},S=32,ue=null,J=!1,X=!1,H="[iFrameSizer]",le=H.length,B="",fe={max:1,min:1,bodyScroll:1,documentElementScroll:1},Y="child",de=window.parent,x="*",K=0,j=!1,me=null,A=16,N=1,ge="scroll",v=ge,De=window,Q=function(){T("onMessage function not defined")},G=function(){},Z=function(){},$={height:function(){return T("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return T("Custom width calculation function not defined"),document.body.scrollWidth}},ee={},he=!1;function pe(){}try{var ve=Object.create({},{passive:{get:function(){he=!0}}});window.addEventListener("test",pe,ve),window.removeEventListener("test",pe,ve)}catch{}function z(e,t,n,i){e.addEventListener(t,n,he?i||{}:!1)}function We(e,t,n){e.removeEventListener(t,n,!1)}function ye(e){return e.charAt(0).toUpperCase()+e.slice(1)}function He(e){var t,n,i,a=null,f=0,m=function(){f=Date.now(),a=null,i=e.apply(t,n),a||(t=n=null)};return function(){var d=Date.now();f||(f=d);var s=A-(d-f);return t=this,n=arguments,s<=0||s>A?(a&&(clearTimeout(a),a=null),f=d,i=e.apply(t,n),a||(t=n=null)):a||(a=setTimeout(m,s)),i}}function we(e){return H+"["+B+"] "+e}function o(e){J&&typeof window.console=="object"&&console.log(we(e))}function T(e){typeof window.console=="object"&&console.warn(we(e))}function Be(){je(),o("Initialising iFrame ("+window.location.href+")"),_e(),Ue(),te("background",E),te("padding",re),Ke(),Me(),Ee(),Je(),Ze(),Ge(),Ie(),R=Qe(),L("init","Init message from host page"),G()}function je(){function e(n){return n==="true"}var t=ce.slice(le).split(":");B=t[0],O=u===t[1]?O:Number(t[1]),W=u===t[2]?W:e(t[2]),J=u===t[3]?J:e(t[3]),S=u===t[4]?S:Number(t[4]),p=u===t[6]?p:e(t[6]),D=t[7],h=u===t[8]?h:t[8],E=t[9],re=t[10],K=u===t[11]?K:Number(t[11]),R.enable=u===t[12]?!1:e(t[12]),Y=u===t[13]?Y:t[13],v=u===t[14]?v:t[14],X=u===t[15]?X:e(t[15])}function qe(e){var t=e.split("Callback");if(t.length===2){var n="on"+t[0].charAt(0).toUpperCase()+t[0].slice(1);this[n]=this[e],delete this[e],T("Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version.")}}function _e(){function e(){var n=window.iFrameResizer;o("Reading data from page: "+JSON.stringify(n)),Object.keys(n).forEach(qe,n),Q="onMessage"in n?n.onMessage:Q,G="onReady"in n?n.onReady:G,x="targetOrigin"in n?n.targetOrigin:x,h="heightCalculationMethod"in n?n.heightCalculationMethod:h,v="widthCalculationMethod"in n?n.widthCalculationMethod:v}function t(n,i){return typeof n=="function"&&(o("Setup custom "+i+"CalcMethod"),$[i]=n,n="custom"),n}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),h=t(h,"height"),v=t(v,"width")),o("TargetOrigin for parent set to: "+x)}function Ve(e,t){return t.indexOf("-")!==-1&&(T("Negative CSS value ignored for "+e),t=""),t}function te(e,t){u!==t&&t!==""&&t!=="null"&&(document.body.style[e]=t,o("Body "+e+' set to "'+t+'"'))}function Ue(){u===D&&(D=O+"px"),te("margin",Ve("margin",D))}function Je(){document.documentElement.style.height="",document.body.style.height="",o('HTML & body height set to "auto"')}function g(e){var t={add:function(n){function i(){L(e.eventName,e.eventType)}ee[n]=i,z(window,n,i,{passive:!0})},remove:function(n){var i=ee[n];delete ee[n],We(window,n,i)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),o(ye(e.method)+" event listener: "+e.eventType)}function be(e){g({method:e,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),g({method:e,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),g({method:e,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),g({method:e,eventType:"Input",eventName:"input"}),g({method:e,eventType:"Mouse Up",eventName:"mouseup"}),g({method:e,eventType:"Mouse Down",eventName:"mousedown"}),g({method:e,eventType:"Orientation Change",eventName:"orientationchange"}),g({method:e,eventType:"Print",eventNames:["afterprint","beforeprint"]}),g({method:e,eventType:"Ready State Change",eventName:"readystatechange"}),g({method:e,eventType:"Touch Start",eventName:"touchstart"}),g({method:e,eventType:"Touch End",eventName:"touchend"}),g({method:e,eventType:"Touch Cancel",eventName:"touchcancel"}),g({method:e,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),g({method:e,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),g({method:e,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),Y==="child"&&g({method:e,eventType:"IFrame Resized",eventName:"resize"})}function Te(e,t,n,i){return t!==e&&(e in n||(T(e+" is not a valid option for "+i+"CalculationMethod."),e=t),o(i+' calculation method set to "'+e+'"')),e}function Me(){h=Te(h,U,M,"height")}function Ee(){v=Te(v,ge,F,"width")}function Ie(){p===!0?(be("add"),et()):o("Auto Resize disabled")}function Xe(){_!==null&&_.disconnect()}function Ye(){be("remove"),Xe(),clearInterval(ue)}function Ke(){var e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.appendChild(e)}function Qe(){function e(){return{x:window.pageXOffset===u?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===u?document.documentElement.scrollTop:window.pageYOffset}}function t(s){var l=s.getBoundingClientRect(),c=e();return{x:parseInt(l.left,10)+parseInt(c.x,10),y:parseInt(l.top,10)+parseInt(c.y,10)}}function n(s){function l(b){var C=t(b);o("Moving to in page link (#"+c+") at x: "+C.x+" y: "+C.y),y(C.y,C.x,"scrollToOffset")}var c=s.split("#")[1]||s,r=decodeURIComponent(c),w=document.getElementById(r)||document.getElementsByName(r)[0];u===w?(o("In page link (#"+c+") not found in iFrame, so sending to parent"),y(0,0,"inPageLink","#"+c)):l(w)}function i(){var s=window.location.hash,l=window.location.href;s!==""&&s!=="#"&&n(l)}function a(){function s(l){function c(r){r.preventDefault(),n(this.getAttribute("href"))}l.getAttribute("href")!=="#"&&z(l,"click",c)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),s)}function f(){z(window,"hashchange",i)}function m(){setTimeout(i,V)}function d(){Array.prototype.forEach&&document.querySelectorAll?(o("Setting up location.hash handlers"),a(),f(),m()):T("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return R.enable?d():o("In page linking not enabled"),{findTarget:n}}function Ge(){if(X!==!0)return;function e(n){y(0,0,n.type,n.screenY+":"+n.screenX)}function t(n,i){o("Add event listener: "+i),z(window.document,n,e)}t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave")}function Ze(){o("Enable public methods"),De.parentIFrame={autoResize:function(t){return t===!0&&p===!1?(p=!0,Ie()):t===!1&&p===!0&&(p=!1,Ye()),y(0,0,"autoResize",JSON.stringify(p)),p},close:function(){y(0,0,"close")},getId:function(){return B},getPageInfo:function(t){typeof t=="function"?(Z=t,y(0,0,"pageInfo")):(Z=function(){},y(0,0,"pageInfoStop"))},moveToAnchor:function(t){R.findTarget(t)},reset:function(){ke("parentIFrame.reset")},scrollTo:function(t,n){y(n,t,"scrollTo")},scrollToOffset:function(t,n){y(n,t,"scrollToOffset")},sendMessage:function(t,n){y(0,0,"message",JSON.stringify(t),n)},setHeightCalculationMethod:function(t){h=t,Me()},setWidthCalculationMethod:function(t){v=t,Ee()},setTargetOrigin:function(t){o("Set targetOrigin: "+t),x=t},size:function(t,n){var i=""+(t||"")+(n?","+n:"");L("size","parentIFrame.size("+i+")",t,n)}}}function Oe(){S!==0&&(o("setInterval: "+S+"ms"),ue=setInterval(function(){L("interval","setInterval: "+S)},Math.abs(S)))}function $e(){function e(r){function w(b){b.complete===!1&&(o("Attach listeners to "+b.src),b.addEventListener("load",a,!1),b.addEventListener("error",f,!1),s.push(b))}r.type==="attributes"&&r.attributeName==="src"?w(r.target):r.type==="childList"&&Array.prototype.forEach.call(r.target.querySelectorAll("img"),w)}function t(r){s.splice(s.indexOf(r),1)}function n(r){o("Remove listeners from "+r.src),r.removeEventListener("load",a,!1),r.removeEventListener("error",f,!1),t(r)}function i(r,w,b){n(r.target),L(w,b+": "+r.target.src)}function a(r){i(r,"imageLoad","Image loaded")}function f(r){i(r,"imageLoadFailed","Image load failed")}function m(r){L("mutationObserver","mutationObserver: "+r[0].target+" "+r[0].type),r.forEach(e)}function d(){var r=document.querySelector("body"),w={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return c=new l(m),o("Create body MutationObserver"),c.observe(r,w),c}var s=[],l=window.MutationObserver||window.WebKitMutationObserver,c=d();return{disconnect:function(){"disconnect"in c&&(o("Disconnect body MutationObserver"),c.disconnect(),s.forEach(n))}}}function et(){var e=0>S;window.MutationObserver||window.WebKitMutationObserver?e?Oe():_=$e():(o("MutationObserver not supported in this browser!"),Oe())}function ne(e,t){var n=0;return t=t||document.body,n=document.defaultView.getComputedStyle(t,null),n=n===null?0:n[e],parseInt(n,I)}function tt(e){e>A/2&&(A=2*e,o("Event throttle increased to "+A+"ms"))}function ie(e,t){for(var n=t.length,i=0,a=0,f=ye(e),m=Date.now(),d=0;d<n;d++)i=t[d].getBoundingClientRect()[e]+ne("margin"+f,t[d]),i>a&&(a=i);return m=Date.now()-m,o("Parsed "+n+" HTML elements"),o("Element position calculated in "+m+"ms"),tt(m),a}function q(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function Se(e,t){function n(){return T("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")}var i=document.querySelectorAll("["+t+"]");return i.length===0&&n(),ie(e,i)}function Fe(){return document.querySelectorAll("body *")}var M={bodyOffset:function(){return document.body.offsetHeight+ne("marginTop")+ne("marginBottom")},offset:function(){return M.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return $.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,q(M))},min:function(){return Math.min.apply(null,q(M))},grow:function(){return M.max()},lowestElement:function(){return Math.max(M.bodyOffset()||M.documentElementOffset(),ie("bottom",Fe()))},taggedElement:function(){return Se("bottom","data-iframe-height")}},F={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return $.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(F.bodyScroll(),F.documentElementScroll())},max:function(){return Math.max.apply(null,q(F))},min:function(){return Math.min.apply(null,q(F))},rightMostElement:function(){return ie("right",Fe())},taggedElement:function(){return Se("right","data-iframe-width")}};function Le(e,t,n,i){function a(){P=c,N=r,y(P,N,e)}function f(){function w(b,C){var it=Math.abs(b-C)<=K;return!it}return c=u===n?M[h]():n,r=u===i?F[v]():i,w(P,c)||W&&w(N,r)}function m(){return!(e in{init:1,interval:1,size:1})}function d(){return h in fe||W&&v in fe}function s(){o("No change in size detected")}function l(){m()&&d()?ke(t):e in{interval:1}||s()}var c,r;f()||e==="init"?(ze(),a()):l()}var nt=He(Le);function L(e,t,n,i){function a(){e in{reset:1,resetPage:1,init:1}||o("Trigger event: "+t)}function f(){return j&&e in Ne}f()?o("Trigger event cancelled: "+e):(a(),e==="init"?Le(e,t,n,i):nt(e,t,n,i))}function ze(){j||(j=!0,o("Trigger event lock on")),clearTimeout(me),me=setTimeout(function(){j=!1,o("Trigger event lock off"),o("--")},V)}function Ce(e){P=M[h](),N=F[v](),y(P,N,e)}function ke(e){var t=h;h=U,o("Reset trigger event: "+e),ze(),Ce("reset"),h=t}function y(e,t,n,i,a){function f(){u===a?a=x:o("Message targetOrigin: "+a)}function m(){var d=e+":"+t,s=B+":"+d+":"+n+(u===i?"":":"+i);o("Sending message to host page ("+s+")"),de.postMessage(H+s,a)}f(),m()}function Pe(e){var t={init:function(){ce=e.data,de=e.source,Be(),ae=!1,setTimeout(function(){se=!1},V)},reset:function(){se?o("Page reset ignored by init"):(o("Page size reset by host page"),Ce("resetPage"))},resize:function(){L("resizeParent","Parent window requested size check")},moveToAnchor:function(){R.findTarget(a())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var c=a();o("PageInfoFromParent called from parent: "+c),Z(JSON.parse(c)),o(" --")},message:function(){var c=a();o("onMessage called from parent: "+c),Q(JSON.parse(c)),o(" --")}};function n(){return H===(""+e.data).slice(0,le)}function i(){return e.data.split("]")[1].split(":")[0]}function a(){return e.data.slice(e.data.indexOf(":")+1)}function f(){return!k.exports&&"iFrameResize"in window||window.jQuery!==u&&"iFrameResize"in window.jQuery.prototype}function m(){return e.data.split(":")[2]in{true:1,false:1}}function d(){var l=i();l in t?t[l]():!f()&&!m()&&T("Unexpected message ("+e.data+")")}function s(){ae===!1?d():m()?t.init():o('Ignored message of type "'+i()+'". Received before initialization.')}n()&&s()}function Re(){document.readyState!=="loading"&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeResizer"in window||(window.iframeChildListener=function(e){Pe({data:e})},z(window,"message",Pe),z(window,"readystatechange",Re),Re())})()}(oe)),oe.exports}var Ae=at();const st=ot(Ae),ut=rt({__proto__:null,default:st},[Ae]);export{ut as i};
1
+ import{g as ot}from"./index.D1AeFlAQ.js";function rt(k,u){for(var p=0;p<u.length;p++){const I=u[p];if(typeof I!="string"&&!Array.isArray(I)){for(const E in I)if(E!=="default"&&!(E in k)){const O=Object.getOwnPropertyDescriptor(I,E);O&&Object.defineProperty(k,E,O.get?O:{enumerable:!0,get:()=>I[E]})}}}return Object.freeze(Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}))}var oe={exports:{}},xe;function at(){return xe||(xe=1,function(k){(function(u){if(typeof window>"u")return;var p=!0,I=10,E="",O=0,D="",_=null,re="",W=!1,Ne={resize:1,click:1},V=128,ae=!0,P=1,U="bodyOffset",h=U,se=!0,ce="",R={},S=32,ue=null,J=!1,X=!1,H="[iFrameSizer]",le=H.length,B="",fe={max:1,min:1,bodyScroll:1,documentElementScroll:1},Y="child",de=window.parent,x="*",K=0,j=!1,me=null,A=16,N=1,ge="scroll",v=ge,De=window,Q=function(){T("onMessage function not defined")},G=function(){},Z=function(){},$={height:function(){return T("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return T("Custom width calculation function not defined"),document.body.scrollWidth}},ee={},he=!1;function pe(){}try{var ve=Object.create({},{passive:{get:function(){he=!0}}});window.addEventListener("test",pe,ve),window.removeEventListener("test",pe,ve)}catch{}function z(e,t,n,i){e.addEventListener(t,n,he?i||{}:!1)}function We(e,t,n){e.removeEventListener(t,n,!1)}function ye(e){return e.charAt(0).toUpperCase()+e.slice(1)}function He(e){var t,n,i,a=null,f=0,m=function(){f=Date.now(),a=null,i=e.apply(t,n),a||(t=n=null)};return function(){var d=Date.now();f||(f=d);var s=A-(d-f);return t=this,n=arguments,s<=0||s>A?(a&&(clearTimeout(a),a=null),f=d,i=e.apply(t,n),a||(t=n=null)):a||(a=setTimeout(m,s)),i}}function we(e){return H+"["+B+"] "+e}function o(e){J&&typeof window.console=="object"&&console.log(we(e))}function T(e){typeof window.console=="object"&&console.warn(we(e))}function Be(){je(),o("Initialising iFrame ("+window.location.href+")"),_e(),Ue(),te("background",E),te("padding",re),Ke(),Me(),Ee(),Je(),Ze(),Ge(),Ie(),R=Qe(),L("init","Init message from host page"),G()}function je(){function e(n){return n==="true"}var t=ce.slice(le).split(":");B=t[0],O=u===t[1]?O:Number(t[1]),W=u===t[2]?W:e(t[2]),J=u===t[3]?J:e(t[3]),S=u===t[4]?S:Number(t[4]),p=u===t[6]?p:e(t[6]),D=t[7],h=u===t[8]?h:t[8],E=t[9],re=t[10],K=u===t[11]?K:Number(t[11]),R.enable=u===t[12]?!1:e(t[12]),Y=u===t[13]?Y:t[13],v=u===t[14]?v:t[14],X=u===t[15]?X:e(t[15])}function qe(e){var t=e.split("Callback");if(t.length===2){var n="on"+t[0].charAt(0).toUpperCase()+t[0].slice(1);this[n]=this[e],delete this[e],T("Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version.")}}function _e(){function e(){var n=window.iFrameResizer;o("Reading data from page: "+JSON.stringify(n)),Object.keys(n).forEach(qe,n),Q="onMessage"in n?n.onMessage:Q,G="onReady"in n?n.onReady:G,x="targetOrigin"in n?n.targetOrigin:x,h="heightCalculationMethod"in n?n.heightCalculationMethod:h,v="widthCalculationMethod"in n?n.widthCalculationMethod:v}function t(n,i){return typeof n=="function"&&(o("Setup custom "+i+"CalcMethod"),$[i]=n,n="custom"),n}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),h=t(h,"height"),v=t(v,"width")),o("TargetOrigin for parent set to: "+x)}function Ve(e,t){return t.indexOf("-")!==-1&&(T("Negative CSS value ignored for "+e),t=""),t}function te(e,t){u!==t&&t!==""&&t!=="null"&&(document.body.style[e]=t,o("Body "+e+' set to "'+t+'"'))}function Ue(){u===D&&(D=O+"px"),te("margin",Ve("margin",D))}function Je(){document.documentElement.style.height="",document.body.style.height="",o('HTML & body height set to "auto"')}function g(e){var t={add:function(n){function i(){L(e.eventName,e.eventType)}ee[n]=i,z(window,n,i,{passive:!0})},remove:function(n){var i=ee[n];delete ee[n],We(window,n,i)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),o(ye(e.method)+" event listener: "+e.eventType)}function be(e){g({method:e,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),g({method:e,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),g({method:e,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),g({method:e,eventType:"Input",eventName:"input"}),g({method:e,eventType:"Mouse Up",eventName:"mouseup"}),g({method:e,eventType:"Mouse Down",eventName:"mousedown"}),g({method:e,eventType:"Orientation Change",eventName:"orientationchange"}),g({method:e,eventType:"Print",eventNames:["afterprint","beforeprint"]}),g({method:e,eventType:"Ready State Change",eventName:"readystatechange"}),g({method:e,eventType:"Touch Start",eventName:"touchstart"}),g({method:e,eventType:"Touch End",eventName:"touchend"}),g({method:e,eventType:"Touch Cancel",eventName:"touchcancel"}),g({method:e,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),g({method:e,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),g({method:e,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),Y==="child"&&g({method:e,eventType:"IFrame Resized",eventName:"resize"})}function Te(e,t,n,i){return t!==e&&(e in n||(T(e+" is not a valid option for "+i+"CalculationMethod."),e=t),o(i+' calculation method set to "'+e+'"')),e}function Me(){h=Te(h,U,M,"height")}function Ee(){v=Te(v,ge,F,"width")}function Ie(){p===!0?(be("add"),et()):o("Auto Resize disabled")}function Xe(){_!==null&&_.disconnect()}function Ye(){be("remove"),Xe(),clearInterval(ue)}function Ke(){var e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.appendChild(e)}function Qe(){function e(){return{x:window.pageXOffset===u?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===u?document.documentElement.scrollTop:window.pageYOffset}}function t(s){var l=s.getBoundingClientRect(),c=e();return{x:parseInt(l.left,10)+parseInt(c.x,10),y:parseInt(l.top,10)+parseInt(c.y,10)}}function n(s){function l(b){var C=t(b);o("Moving to in page link (#"+c+") at x: "+C.x+" y: "+C.y),y(C.y,C.x,"scrollToOffset")}var c=s.split("#")[1]||s,r=decodeURIComponent(c),w=document.getElementById(r)||document.getElementsByName(r)[0];u===w?(o("In page link (#"+c+") not found in iFrame, so sending to parent"),y(0,0,"inPageLink","#"+c)):l(w)}function i(){var s=window.location.hash,l=window.location.href;s!==""&&s!=="#"&&n(l)}function a(){function s(l){function c(r){r.preventDefault(),n(this.getAttribute("href"))}l.getAttribute("href")!=="#"&&z(l,"click",c)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),s)}function f(){z(window,"hashchange",i)}function m(){setTimeout(i,V)}function d(){Array.prototype.forEach&&document.querySelectorAll?(o("Setting up location.hash handlers"),a(),f(),m()):T("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return R.enable?d():o("In page linking not enabled"),{findTarget:n}}function Ge(){if(X!==!0)return;function e(n){y(0,0,n.type,n.screenY+":"+n.screenX)}function t(n,i){o("Add event listener: "+i),z(window.document,n,e)}t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave")}function Ze(){o("Enable public methods"),De.parentIFrame={autoResize:function(t){return t===!0&&p===!1?(p=!0,Ie()):t===!1&&p===!0&&(p=!1,Ye()),y(0,0,"autoResize",JSON.stringify(p)),p},close:function(){y(0,0,"close")},getId:function(){return B},getPageInfo:function(t){typeof t=="function"?(Z=t,y(0,0,"pageInfo")):(Z=function(){},y(0,0,"pageInfoStop"))},moveToAnchor:function(t){R.findTarget(t)},reset:function(){ke("parentIFrame.reset")},scrollTo:function(t,n){y(n,t,"scrollTo")},scrollToOffset:function(t,n){y(n,t,"scrollToOffset")},sendMessage:function(t,n){y(0,0,"message",JSON.stringify(t),n)},setHeightCalculationMethod:function(t){h=t,Me()},setWidthCalculationMethod:function(t){v=t,Ee()},setTargetOrigin:function(t){o("Set targetOrigin: "+t),x=t},size:function(t,n){var i=""+(t||"")+(n?","+n:"");L("size","parentIFrame.size("+i+")",t,n)}}}function Oe(){S!==0&&(o("setInterval: "+S+"ms"),ue=setInterval(function(){L("interval","setInterval: "+S)},Math.abs(S)))}function $e(){function e(r){function w(b){b.complete===!1&&(o("Attach listeners to "+b.src),b.addEventListener("load",a,!1),b.addEventListener("error",f,!1),s.push(b))}r.type==="attributes"&&r.attributeName==="src"?w(r.target):r.type==="childList"&&Array.prototype.forEach.call(r.target.querySelectorAll("img"),w)}function t(r){s.splice(s.indexOf(r),1)}function n(r){o("Remove listeners from "+r.src),r.removeEventListener("load",a,!1),r.removeEventListener("error",f,!1),t(r)}function i(r,w,b){n(r.target),L(w,b+": "+r.target.src)}function a(r){i(r,"imageLoad","Image loaded")}function f(r){i(r,"imageLoadFailed","Image load failed")}function m(r){L("mutationObserver","mutationObserver: "+r[0].target+" "+r[0].type),r.forEach(e)}function d(){var r=document.querySelector("body"),w={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return c=new l(m),o("Create body MutationObserver"),c.observe(r,w),c}var s=[],l=window.MutationObserver||window.WebKitMutationObserver,c=d();return{disconnect:function(){"disconnect"in c&&(o("Disconnect body MutationObserver"),c.disconnect(),s.forEach(n))}}}function et(){var e=0>S;window.MutationObserver||window.WebKitMutationObserver?e?Oe():_=$e():(o("MutationObserver not supported in this browser!"),Oe())}function ne(e,t){var n=0;return t=t||document.body,n=document.defaultView.getComputedStyle(t,null),n=n===null?0:n[e],parseInt(n,I)}function tt(e){e>A/2&&(A=2*e,o("Event throttle increased to "+A+"ms"))}function ie(e,t){for(var n=t.length,i=0,a=0,f=ye(e),m=Date.now(),d=0;d<n;d++)i=t[d].getBoundingClientRect()[e]+ne("margin"+f,t[d]),i>a&&(a=i);return m=Date.now()-m,o("Parsed "+n+" HTML elements"),o("Element position calculated in "+m+"ms"),tt(m),a}function q(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function Se(e,t){function n(){return T("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")}var i=document.querySelectorAll("["+t+"]");return i.length===0&&n(),ie(e,i)}function Fe(){return document.querySelectorAll("body *")}var M={bodyOffset:function(){return document.body.offsetHeight+ne("marginTop")+ne("marginBottom")},offset:function(){return M.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return $.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,q(M))},min:function(){return Math.min.apply(null,q(M))},grow:function(){return M.max()},lowestElement:function(){return Math.max(M.bodyOffset()||M.documentElementOffset(),ie("bottom",Fe()))},taggedElement:function(){return Se("bottom","data-iframe-height")}},F={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return $.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(F.bodyScroll(),F.documentElementScroll())},max:function(){return Math.max.apply(null,q(F))},min:function(){return Math.min.apply(null,q(F))},rightMostElement:function(){return ie("right",Fe())},taggedElement:function(){return Se("right","data-iframe-width")}};function Le(e,t,n,i){function a(){P=c,N=r,y(P,N,e)}function f(){function w(b,C){var it=Math.abs(b-C)<=K;return!it}return c=u===n?M[h]():n,r=u===i?F[v]():i,w(P,c)||W&&w(N,r)}function m(){return!(e in{init:1,interval:1,size:1})}function d(){return h in fe||W&&v in fe}function s(){o("No change in size detected")}function l(){m()&&d()?ke(t):e in{interval:1}||s()}var c,r;f()||e==="init"?(ze(),a()):l()}var nt=He(Le);function L(e,t,n,i){function a(){e in{reset:1,resetPage:1,init:1}||o("Trigger event: "+t)}function f(){return j&&e in Ne}f()?o("Trigger event cancelled: "+e):(a(),e==="init"?Le(e,t,n,i):nt(e,t,n,i))}function ze(){j||(j=!0,o("Trigger event lock on")),clearTimeout(me),me=setTimeout(function(){j=!1,o("Trigger event lock off"),o("--")},V)}function Ce(e){P=M[h](),N=F[v](),y(P,N,e)}function ke(e){var t=h;h=U,o("Reset trigger event: "+e),ze(),Ce("reset"),h=t}function y(e,t,n,i,a){function f(){u===a?a=x:o("Message targetOrigin: "+a)}function m(){var d=e+":"+t,s=B+":"+d+":"+n+(u===i?"":":"+i);o("Sending message to host page ("+s+")"),de.postMessage(H+s,a)}f(),m()}function Pe(e){var t={init:function(){ce=e.data,de=e.source,Be(),ae=!1,setTimeout(function(){se=!1},V)},reset:function(){se?o("Page reset ignored by init"):(o("Page size reset by host page"),Ce("resetPage"))},resize:function(){L("resizeParent","Parent window requested size check")},moveToAnchor:function(){R.findTarget(a())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var c=a();o("PageInfoFromParent called from parent: "+c),Z(JSON.parse(c)),o(" --")},message:function(){var c=a();o("onMessage called from parent: "+c),Q(JSON.parse(c)),o(" --")}};function n(){return H===(""+e.data).slice(0,le)}function i(){return e.data.split("]")[1].split(":")[0]}function a(){return e.data.slice(e.data.indexOf(":")+1)}function f(){return!k.exports&&"iFrameResize"in window||window.jQuery!==u&&"iFrameResize"in window.jQuery.prototype}function m(){return e.data.split(":")[2]in{true:1,false:1}}function d(){var l=i();l in t?t[l]():!f()&&!m()&&T("Unexpected message ("+e.data+")")}function s(){ae===!1?d():m()?t.init():o('Ignored message of type "'+i()+'". Received before initialization.')}n()&&s()}function Re(){document.readyState!=="loading"&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeResizer"in window||(window.iframeChildListener=function(e){Pe({data:e})},z(window,"message",Pe),z(window,"readystatechange",Re),Re())})()}(oe)),oe.exports}var Ae=at();const st=ot(Ae),ut=rt({__proto__:null,default:st},[Ae]);export{ut as i};
@@ -1 +1 @@
1
- import{s as a,r as t,O as i,j as d,b0 as c,b1 as e,M as l}from"./index.EAQB8Tuq.js";const g=a("iframe",{target:"e3tg43n0"})(({theme:o,disableScrolling:r})=>({width:"100%",colorScheme:"normal",border:"none",padding:o.spacing.none,margin:o.spacing.none,overflow:r?"hidden":void 0}));function s(o){return l(o)||o===""?void 0:o}function I({element:o}){const r=s(o.src),n=i(r)?void 0:s(o.srcdoc);return d(g,{className:"stIFrame","data-testid":"stIFrame",allow:e,disableScrolling:!o.scrolling,src:r,srcDoc:n,height:o.height,scrolling:o.scrolling?"auto":"no",sandbox:c,title:"st.iframe",tabIndex:o.tabIndex??void 0})}const m=t.memo(I);export{m as default};
1
+ import{s as a,r as t,O as i,j as d,b0 as c,b1 as e,M as l}from"./index.D1AeFlAQ.js";const g=a("iframe",{target:"e3tg43n0"})(({theme:o,disableScrolling:r})=>({width:"100%",colorScheme:"normal",border:"none",padding:o.spacing.none,margin:o.spacing.none,overflow:r?"hidden":void 0}));function s(o){return l(o)||o===""?void 0:o}function I({element:o}){const r=s(o.src),n=i(r)?void 0:s(o.srcdoc);return d(g,{className:"stIFrame","data-testid":"stIFrame",allow:e,disableScrolling:!o.scrolling,src:r,srcDoc:n,height:o.height,scrolling:o.scrolling?"auto":"no",sandbox:c,title:"st.iframe",tabIndex:o.tabIndex??void 0})}const m=t.memo(I);export{m as default};
@@ -1,4 +1,4 @@
1
- import{r as h,E as $,_ as H,ba as ut,bj as zt,bk as _t,bl as $t,M as X,O as q,aI as Ht,s as x,bm as Vt,C as N,j as v,bn as jt,b4 as Gt,bo as Xt,bp as qt,l as Yt,z as Kt,bq as tt,H as Jt,aE as Qt,br as Zt,bs as te,b9 as ee,bt as ie}from"./index.EAQB8Tuq.js";import{u as se,F as ne}from"./FormClearHelper.C4W8xjEX.js";import{T as re,a as pt}from"./Toolbar.CA92Moni.js";import{u as oe}from"./Hooks.Bcs7Dqad.js";import{c as ae}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as le,D as ce}from"./FileDownload.esm.ZEl-HfEg.js";var vt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),h.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});vt.displayName="Mic";var bt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});bt.displayName="Pause";var yt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});yt.displayName="PlayArrow";var wt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),h.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});wt.displayName="Refresh";var St=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});St.displayName="StopCircle";function P(s,t,e,i){return new(e||(e=Promise))(function(n,r){function o(c){try{d(i.next(c))}catch(l){r(l)}}function a(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(o,a)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i?.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const j={decode:function(s,t){return P(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(n=>n>1||n<-1)){const n=i.length;let r=0;for(let o=0;o<n;o++){const a=Math.abs(i[o]);a>r&&(r=a)}for(const o of e)for(let a=0;a<n;a++)o[a]/=r}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s?.[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Ct(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,n]of Object.entries(t))if(i==="children"&&n)for(const[r,o]of Object.entries(n))o instanceof Node?e.appendChild(o):typeof o=="string"?e.appendChild(document.createTextNode(o)):e.appendChild(Ct(r,o));else i==="style"?Object.assign(e.style,n):i==="textContent"?e.textContent=n:e.setAttribute(i,n.toString());return e}function mt(s,t,e){const i=Ct(s,t||{});return e?.appendChild(i),i}var de=Object.freeze({__proto__:null,createElement:mt,default:mt});const he={fetchBlob:function(s,t,e){return P(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(n,r){P(this,void 0,void 0,function*(){if(!n.body||!n.headers)return;const o=n.body.getReader(),a=Number(n.headers.get("Content-Length"))||0;let d=0;const c=p=>P(this,void 0,void 0,function*(){d+=p?.length||0;const u=Math.round(d/a*100);r(u)}),l=()=>P(this,void 0,void 0,function*(){let p;try{p=yield o.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class ue extends V{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const n=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(i&&this.media.removeAttribute("src"),n||t)try{this.media.src=n}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load())}setMediaElement(t){this.media=t}play(){return P(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class U extends V{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[n,r]=this.initHtml();i.appendChild(n),this.container=n,this.scrollContainer=r.querySelector(".scroll"),this.wrapper=r.querySelector(".wrapper"),this.canvasWrapper=r.querySelector(".canvases"),this.progressWrapper=r.querySelector(".progress"),this.cursor=r.querySelector(".cursor"),e&&r.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),n=e.clientX-i.left,r=e.clientY-i.top;return[n/i.width,r/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,n]=t(e);this.emit("click",i,n)}),this.wrapper.addEventListener("dblclick",e=>{const[i,n]=t(e);this.emit("dblclick",i,n)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:n}=this.scrollContainer,r=e/i,o=(e+n)/i;this.emit("scroll",r,o,e,e+n)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,i,n,r=3,o=0,a=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==o)return;p.preventDefault(),p.stopPropagation();let u=p.clientX,m=p.clientY,f=!1;const y=Date.now(),g=w=>{if(w.preventDefault(),w.stopPropagation(),d&&Date.now()-y<a)return;const T=w.clientX,D=w.clientY,k=T-u,W=D-m;if(f||Math.abs(k)>r||Math.abs(W)>r){const O=t.getBoundingClientRect(),{left:F,top:L}=O;f||(i?.(u-F,m-L),f=!0),e(k,W,T-F,D-L),u=T,m=D}},S=w=>{if(f){const T=w.clientX,D=w.clientY,k=t.getBoundingClientRect(),{left:W,top:O}=k;n?.(T-W,D-O)}c()},b=w=>{w.relatedTarget&&w.relatedTarget!==document.documentElement||S(w)},A=w=>{f&&(w.stopPropagation(),w.preventDefault())},R=w=>{f&&w.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",S),document.addEventListener("pointerout",b),document.addEventListener("pointercancel",b),document.addEventListener("touchmove",R,{passive:!1}),document.addEventListener("click",A,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",S),document.removeEventListener("pointerout",b),document.removeEventListener("pointercancel",b),document.removeEventListener("touchmove",R),setTimeout(()=>{document.removeEventListener("click",A,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const n=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const r=this.parent.clientHeight||128;return e?.every(o=>!o.overlay)?r/n:r}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
1
+ import{r as h,E as $,_ as H,ba as ut,bj as zt,bk as _t,bl as $t,M as X,O as q,aI as Ht,s as D,bm as Vt,C as N,j as v,bn as jt,b4 as Gt,bo as Xt,bp as qt,l as Yt,z as Kt,bq as tt,H as Jt,aE as Qt,br as Zt,bs as te,b9 as ee,bt as ie}from"./index.D1AeFlAQ.js";import{u as se,F as ne}from"./FormClearHelper.Fo17GZrr.js";import{T as re,a as pt}from"./Toolbar.oggLWFZy.js";import{u as oe}from"./Hooks.Blc9M7kn.js";import{c as ae}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as le,D as ce}from"./FileDownload.esm.Cb2Z--zt.js";var vt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),h.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});vt.displayName="Mic";var yt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});yt.displayName="Pause";var bt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});bt.displayName="PlayArrow";var wt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),h.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});wt.displayName="Refresh";var St=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});St.displayName="StopCircle";function P(s,t,e,i){return new(e||(e=Promise))(function(n,r){function o(c){try{d(i.next(c))}catch(l){r(l)}}function a(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(o,a)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i?.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const j={decode:function(s,t){return P(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(n=>n>1||n<-1)){const n=i.length;let r=0;for(let o=0;o<n;o++){const a=Math.abs(i[o]);a>r&&(r=a)}for(const o of e)for(let a=0;a<n;a++)o[a]/=r}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s?.[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Ct(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,n]of Object.entries(t))if(i==="children"&&n)for(const[r,o]of Object.entries(n))o instanceof Node?e.appendChild(o):typeof o=="string"?e.appendChild(document.createTextNode(o)):e.appendChild(Ct(r,o));else i==="style"?Object.assign(e.style,n):i==="textContent"?e.textContent=n:e.setAttribute(i,n.toString());return e}function mt(s,t,e){const i=Ct(s,t||{});return e?.appendChild(i),i}var de=Object.freeze({__proto__:null,createElement:mt,default:mt});const he={fetchBlob:function(s,t,e){return P(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(n,r){P(this,void 0,void 0,function*(){if(!n.body||!n.headers)return;const o=n.body.getReader(),a=Number(n.headers.get("Content-Length"))||0;let d=0;const c=p=>P(this,void 0,void 0,function*(){d+=p?.length||0;const u=Math.round(d/a*100);r(u)}),l=()=>P(this,void 0,void 0,function*(){let p;try{p=yield o.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class ue extends V{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const n=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(i&&this.media.removeAttribute("src"),n||t)try{this.media.src=n}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load())}setMediaElement(t){this.media=t}play(){return P(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class U extends V{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[n,r]=this.initHtml();i.appendChild(n),this.container=n,this.scrollContainer=r.querySelector(".scroll"),this.wrapper=r.querySelector(".wrapper"),this.canvasWrapper=r.querySelector(".canvases"),this.progressWrapper=r.querySelector(".progress"),this.cursor=r.querySelector(".cursor"),e&&r.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),n=e.clientX-i.left,r=e.clientY-i.top;return[n/i.width,r/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,n]=t(e);this.emit("click",i,n)}),this.wrapper.addEventListener("dblclick",e=>{const[i,n]=t(e);this.emit("dblclick",i,n)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:n}=this.scrollContainer,r=e/i,o=(e+n)/i;this.emit("scroll",r,o,e,e+n)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,i,n,r=3,o=0,a=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==o)return;p.preventDefault(),p.stopPropagation();let u=p.clientX,m=p.clientY,f=!1;const b=Date.now(),g=w=>{if(w.preventDefault(),w.stopPropagation(),d&&Date.now()-b<a)return;const A=w.clientX,T=w.clientY,k=A-u,W=T-m;if(f||Math.abs(k)>r||Math.abs(W)>r){const O=t.getBoundingClientRect(),{left:F,top:L}=O;f||(i?.(u-F,m-L),f=!0),e(k,W,A-F,T-L),u=A,m=T}},S=w=>{if(f){const A=w.clientX,T=w.clientY,k=t.getBoundingClientRect(),{left:W,top:O}=k;n?.(A-W,T-O)}c()},y=w=>{w.relatedTarget&&w.relatedTarget!==document.documentElement||S(w)},x=w=>{f&&(w.stopPropagation(),w.preventDefault())},R=w=>{f&&w.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",S),document.addEventListener("pointerout",y),document.addEventListener("pointercancel",y),document.addEventListener("touchmove",R,{passive:!1}),document.addEventListener("click",x,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",S),document.removeEventListener("pointerout",y),document.removeEventListener("pointercancel",y),document.removeEventListener("touchmove",R),setTimeout(()=>{document.removeEventListener("click",x,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const n=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const r=this.parent.clientHeight||128;return e?.every(o=>!o.overlay)?r/n:r}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
2
2
  <style${i?` nonce="${i}"`:""}>
3
3
  :host {
4
4
  user-select: none;
@@ -70,4 +70,4 @@ import{r as h,E as $,_ as H,ba as ut,bj as zt,bk as _t,bl as $t,M as X,O as q,aI
70
70
  <div class="cursor" part="cursor"></div>
71
71
  </div>
72
72
  </div>
73
- `,[t,e]}setOptions(t){if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,i=e*t;this.setScroll(i)}destroy(){var t,e;this.subscriptions.forEach(i=>i()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.unsubscribeOnScroll)===null||e===void 0||e.forEach(i=>i()),this.unsubscribeOnScroll=[]}createDelay(t=10){let e,i;const n=()=>{e&&clearTimeout(e),i&&i()};return this.timeouts.push(n),()=>new Promise((r,o)=>{n(),i=o,e=setTimeout(()=>{e=void 0,i=void 0,r()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const e=document.createElement("canvas"),i=e.getContext("2d"),n=e.height*(window.devicePixelRatio||1),r=i.createLinearGradient(0,0,0,n),o=1/(t.length-1);return t.forEach((a,d)=>{const c=d*o;r.addColorStop(c,a)}),r}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,e,i,n){const r=t[0],o=t[1]||t[0],a=r.length,{width:d,height:c}=i.canvas,l=c/2,p=this.getPixelRatio(),u=e.barWidth?e.barWidth*p:1,m=e.barGap?e.barGap*p:e.barWidth?u/2:0,f=e.barRadius||0,y=d/(u+m)/a,g=f&&"roundRect"in i?"roundRect":"rect";i.beginPath();let S=0,b=0,A=0;for(let R=0;R<=a;R++){const w=Math.round(R*y);if(w>S){const k=Math.round(b*l*n),W=k+Math.round(A*l*n)||1;let O=l-k;e.barAlign==="top"?O=0:e.barAlign==="bottom"&&(O=c-W),i[g](S*(u+m),O,u,W,f),S=w,b=0,A=0}const T=Math.abs(r[R]||0),D=Math.abs(o[R]||0);T>b&&(b=T),D>A&&(A=D)}i.fill(),i.closePath()}renderLineWaveform(t,e,i,n){const r=o=>{const a=t[o]||t[0],d=a.length,{height:c}=i.canvas,l=c/2,p=i.canvas.width/d;i.moveTo(0,l);let u=0,m=0;for(let f=0;f<=d;f++){const y=Math.round(f*p);if(y>u){const S=l+(Math.round(m*l*n)||1)*(o===0?-1:1);i.lineTo(u,S),u=y,m=0}const g=Math.abs(a[f]||0);g>m&&(m=g)}i.lineTo(u,l)};i.beginPath(),r(0),r(1),i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor),e.renderFunction)return void e.renderFunction(t,i);let n=e.barHeight||1;if(e.normalize){const r=Array.from(t[0]).reduce((o,a)=>Math.max(o,Math.abs(a)),0);n=r?1/r:1}e.barWidth||e.barGap||e.barAlign?this.renderBarWaveform(t,e,i,n):this.renderLineWaveform(t,e,i,n)}renderSingleCanvas(t,e,i,n,r,o,a){const d=this.getPixelRatio(),c=document.createElement("canvas");c.width=Math.round(i*d),c.height=Math.round(n*d),c.style.width=`${i}px`,c.style.height=`${n}px`,c.style.left=`${Math.round(r)}px`,o.appendChild(c);const l=c.getContext("2d");if(this.renderWaveform(t,e,l),c.width>0&&c.height>0){const p=c.cloneNode(),u=p.getContext("2d");u.drawImage(c,0,0),u.globalCompositeOperation="source-in",u.fillStyle=this.convertColorValues(e.progressColor),u.fillRect(0,0,c.width,c.height),a.appendChild(p)}}renderMultiCanvas(t,e,i,n,r,o){const a=this.getPixelRatio(),{clientWidth:d}=this.scrollContainer,c=i/a;let l=Math.min(U.MAX_CANVAS_WIDTH,d,c),p={};if(e.barWidth||e.barGap){const g=e.barWidth||.5,S=g+(e.barGap||g/2);l%S!=0&&(l=Math.floor(l/S)*S)}if(l===0)return;const u=g=>{if(g<0||g>=m||p[g])return;p[g]=!0;const S=g*l;let b=Math.min(c-S,l);if(e.barWidth||e.barGap){const R=e.barWidth||.5,w=R+(e.barGap||R/2);b=Math.floor(b/w)*w}if(b<=0)return;const A=t.map(R=>{const w=Math.floor(S/c*R.length),T=Math.floor((S+b)/c*R.length);return R.slice(w,T)});this.renderSingleCanvas(A,e,b,n,S,r,o)},m=Math.ceil(c/l);if(!this.isScrollable){for(let g=0;g<m;g++)u(g);return}const f=this.scrollContainer.scrollLeft/c,y=Math.floor(f*m);if(u(y-1),u(y),u(y+1),m>1){const g=this.on("scroll",()=>{const{scrollLeft:S}=this.scrollContainer,b=Math.floor(S/c*m);Object.keys(p).length>U.MAX_NODES&&(r.innerHTML="",o.innerHTML="",p={}),u(b-1),u(b),u(b+1)});this.unsubscribeOnScroll.push(g)}}renderChannel(t,e,i,n){var{overlay:r}=e,o=function(l,p){var u={};for(var m in l)Object.prototype.hasOwnProperty.call(l,m)&&p.indexOf(m)<0&&(u[m]=l[m]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(m=Object.getOwnPropertySymbols(l);f<m.length;f++)p.indexOf(m[f])<0&&Object.prototype.propertyIsEnumerable.call(l,m[f])&&(u[m[f]]=l[m[f]])}return u}(e,["overlay"]);const a=document.createElement("div"),d=this.getHeight(o.height,o.splitChannels);a.style.height=`${d}px`,r&&n>0&&(a.style.marginTop=`-${d}px`),this.canvasWrapper.style.minHeight=`${d}px`,this.canvasWrapper.appendChild(a);const c=a.cloneNode();this.progressWrapper.appendChild(c),this.renderMultiCanvas(t,o,i,d,a,c)}render(t){return P(this,void 0,void 0,function*(){var e;this.timeouts.forEach(d=>d()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const i=this.getPixelRatio(),n=this.scrollContainer.clientWidth,r=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=r>n;const o=this.options.fillParent&&!this.isScrollable,a=(o?n:r)*i;if(this.wrapper.style.width=o?"100%":`${r}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let d=0;d<t.numberOfChannels;d++){const c=Object.assign(Object.assign({},this.options),(e=this.options.splitChannels)===null||e===void 0?void 0:e[d]);this.renderChannel([t.getChannelData(d)],c,a,d)}else{const d=[t.getChannelData(0)];t.numberOfChannels>1&&d.push(t.getChannelData(1)),this.renderChannel(d,this.options,a,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(i=>i()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:e}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:i}=this.progressWrapper.getBoundingClientRect();let n=i-e;n*=2,n=n<0?Math.floor(n):Math.ceil(n),n/=2,this.scrollContainer.scrollLeft+=n}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:i,scrollWidth:n,clientWidth:r}=this.scrollContainer,o=t*n,a=i,d=i+r,c=r/2;if(this.isDragging)o+30>d?this.scrollContainer.scrollLeft+=30:o-30<a&&(this.scrollContainer.scrollLeft-=30);else{(o<a||o>d)&&(this.scrollContainer.scrollLeft=o-(this.options.autoCenter?c:0));const l=o-i-c;e&&this.options.autoCenter&&l>0&&(this.scrollContainer.scrollLeft+=Math.min(l,10))}{const l=this.scrollContainer.scrollLeft,p=l/n,u=(l+r)/n;this.emit("scroll",p,u,l,l+r)}}renderProgress(t,e){if(isNaN(t))return;const i=100*t;this.canvasWrapper.style.clipPath=`polygon(${i}% 0%, 100% 0%, 100% 100%, ${i}% 100%)`,this.progressWrapper.style.width=`${i}%`,this.cursor.style.left=`${i}%`,this.cursor.style.transform=`translateX(-${Math.round(i)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,e)}exportImage(t,e,i){return P(this,void 0,void 0,function*(){const n=this.canvasWrapper.querySelectorAll("canvas");if(!n.length)throw new Error("No waveform data");if(i==="dataURL"){const r=Array.from(n).map(o=>o.toDataURL(t,e));return Promise.resolve(r)}return Promise.all(Array.from(n).map(r=>new Promise((o,a)=>{r.toBlob(d=>{d?o(d):a(new Error("Could not export image"))},t,e)})))})}}U.MAX_CANVAS_WIDTH=8e3,U.MAX_NODES=10;class pe extends V{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class et extends V{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return P(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()}).then(e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e)).then(e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let e=this.playedDuration*this._playbackRate;(e>=this.duration||e<0)&&(e=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,e),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return P(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const e=t-this.currentTime,i=this.bufferNode;i?.stop(this.audioContext.currentTime+e),i?.addEventListener("ended",()=>{i===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return P(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playedDuration=t/this._playbackRate,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return(t=this._duration)!==null&&t!==void 0?t:((e=this.buffer)===null||e===void 0?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const e=this.buffer.numberOfChannels;for(let i=0;i<e;i++)t.push(this.buffer.getChannelData(i));return t}}const me={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class z extends ue{static create(t){return new z(t)}constructor(t){const e=t.media||(t.backend==="WebAudio"?new et:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},me,t),this.timer=new pe;const i=e?void 0:this.getMediaElement();this.renderer=new U(this.options,i),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const n=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:r,duration:o}=this.options;(n||r&&o)&&this.load(n,r,o).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))}),this.renderer.on("dblclick",(t,e)=>{this.emit("dblclick",t,e)}),this.renderer.on("scroll",(t,e,i,n)=>{const r=this.getDuration();this.emit("scroll",t*r,e*r,i,n)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",e=>{if(!this.options.interact)return;let i;this.renderer.renderProgress(e),clearTimeout(t),this.isPlaying()?i=0:this.options.dragToSeek===!0?i=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(i=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(e)},i),this.emit("interaction",e*this.getDuration()),this.emit("drag",e)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(e=>{this.registerPlugin(e)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=j.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=j.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){t._init(this),this.plugins.push(t);const e=t.once("destroy",()=>{this.plugins=this.plugins.filter(i=>i!==t),this.subscriptions=this.subscriptions.filter(i=>i!==e)});return this.subscriptions.push(e),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,i,n){return P(this,void 0,void 0,function*(){var r;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!e&&!i){const a=this.options.fetchParams||{};window.AbortController&&!a.signal&&(this.abortController=new AbortController,a.signal=(r=this.abortController)===null||r===void 0?void 0:r.signal);const d=l=>this.emit("loading",l);e=yield he.fetchBlob(t,d,a);const c=this.options.blobMimeType;c&&(e=new Blob([e],{type:c}))}this.setSrc(t,e);const o=yield new Promise(a=>{const d=n||this.getDuration();d?a(d):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>a(this.getDuration()),{once:!0}))});if(!t&&!e){const a=this.getMediaElement();a instanceof et&&(a.duration=o)}if(i)this.decodedData=j.createBuffer(i,o||0);else if(e){const a=yield e.arrayBuffer();this.decodedData=yield j.decode(a,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,e,i){return P(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,e,i)}catch(n){throw this.emit("error",n),n}})}loadBlob(t,e,i){return P(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,e,i)}catch(n){throw this.emit("error",n),n}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:i=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const n=Math.min(t,this.decodedData.numberOfChannels),r=[];for(let o=0;o<n;o++){const a=this.decodedData.getChannelData(o),d=[],c=a.length/e;for(let l=0;l<e;l++){const p=a.slice(Math.floor(l*c),Math.ceil((l+1)*c));let u=0;for(let m=0;m<p.length;m++){const f=p[m];Math.abs(f)>Math.abs(u)&&(u=f)}d.push(Math.round(u*i)/i)}r.push(d)}return r}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}play(t,e){const i=Object.create(null,{play:{get:()=>super.play}});return P(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const n=yield i.play.call(this);return e!=null&&(this.media instanceof et?this.media.stopAt(e):this.stopAtPosition=e),n})}playPause(){return P(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return P(this,arguments,void 0,function*(t="image/png",e=1,i="dataURL"){return this.renderer.exportImage(t,e,i)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(e=>e.destroy()),this.subscriptions.forEach(e=>e()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}z.BasePlugin=class extends V{constructor(s){super(),this.subscriptions=[],this.options=s}onInit(){}_init(s){this.wavesurfer=s,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(s=>s())}},z.dom=de;function it(s,t,e,i){return new(e||(e=Promise))(function(n,r){function o(c){try{d(i.next(c))}catch(l){r(l)}}function a(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(o,a)}d((i=i.apply(s,[])).next())})}class Et{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i?.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}}class fe extends Et{constructor(t){super(),this.subscriptions=[],this.options=t}onInit(){}_init(t){this.wavesurfer=t,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(t=>t())}}class ge extends Et{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}const ve=["audio/webm","audio/wav","audio/mpeg","audio/mp4","audio/mp3"];class Y extends fe{constructor(t){var e,i,n,r,o,a;super(Object.assign(Object.assign({},t),{audioBitsPerSecond:(e=t.audioBitsPerSecond)!==null&&e!==void 0?e:128e3,scrollingWaveform:(i=t.scrollingWaveform)!==null&&i!==void 0&&i,scrollingWaveformWindow:(n=t.scrollingWaveformWindow)!==null&&n!==void 0?n:5,continuousWaveform:(r=t.continuousWaveform)!==null&&r!==void 0&&r,renderRecordedAudio:(o=t.renderRecordedAudio)===null||o===void 0||o,mediaRecorderTimeslice:(a=t.mediaRecorderTimeslice)!==null&&a!==void 0?a:void 0})),this.stream=null,this.mediaRecorder=null,this.dataWindow=null,this.isWaveformPaused=!1,this.lastStartTime=0,this.lastDuration=0,this.duration=0,this.timer=new ge,this.subscriptions.push(this.timer.on("tick",()=>{const d=performance.now()-this.lastStartTime;this.duration=this.isPaused()?this.duration:this.lastDuration+d,this.emit("record-progress",this.duration)}))}static create(t){return new Y(t||{})}renderMicStream(t){var e;const i=new AudioContext,n=i.createMediaStreamSource(t),r=i.createAnalyser();n.connect(r),this.options.continuousWaveform&&(r.fftSize=32);const o=r.frequencyBinCount,a=new Float32Array(o);let d=0;this.wavesurfer&&((e=this.originalOptions)!==null&&e!==void 0||(this.originalOptions=Object.assign({},this.wavesurfer.options)),this.wavesurfer.options.interact=!1,this.options.scrollingWaveform&&(this.wavesurfer.options.cursorWidth=0));const c=setInterval(()=>{var l,p,u,m;if(!this.isWaveformPaused){if(r.getFloatTimeDomainData(a),this.options.scrollingWaveform){const f=Math.floor((this.options.scrollingWaveformWindow||0)*i.sampleRate),y=Math.min(f,this.dataWindow?this.dataWindow.length+o:o),g=new Float32Array(f);if(this.dataWindow){const S=Math.max(0,f-this.dataWindow.length);g.set(this.dataWindow.slice(-y+o),S)}g.set(a,f-o),this.dataWindow=g}else if(this.options.continuousWaveform){if(!this.dataWindow){const y=this.options.continuousWaveformDuration?Math.round(100*this.options.continuousWaveformDuration):((p=(l=this.wavesurfer)===null||l===void 0?void 0:l.getWidth())!==null&&p!==void 0?p:0)*window.devicePixelRatio;this.dataWindow=new Float32Array(y)}let f=0;for(let y=0;y<o;y++){const g=Math.abs(a[y]);g>f&&(f=g)}if(d+1>this.dataWindow.length){const y=new Float32Array(2*this.dataWindow.length);y.set(this.dataWindow,0),this.dataWindow=y}this.dataWindow[d]=f,d++}else this.dataWindow=a;if(this.wavesurfer){const f=((m=(u=this.dataWindow)===null||u===void 0?void 0:u.length)!==null&&m!==void 0?m:0)/100;this.wavesurfer.load("",[this.dataWindow],this.options.scrollingWaveform?this.options.scrollingWaveformWindow:f).then(()=>{this.wavesurfer&&this.options.continuousWaveform&&(this.wavesurfer.setTime(this.getDuration()/1e3),this.wavesurfer.options.minPxPerSec||this.wavesurfer.setOptions({minPxPerSec:this.wavesurfer.getWidth()/this.wavesurfer.getDuration()}))}).catch(y=>{console.error("Error rendering real-time recording data:",y)})}}},10);return{onDestroy:()=>{clearInterval(c),n?.disconnect(),i?.close()},onEnd:()=>{this.isWaveformPaused=!0,clearInterval(c),this.stopMic()}}}startMic(t){return it(this,void 0,void 0,function*(){let e;try{e=yield navigator.mediaDevices.getUserMedia({audio:t==null||t})}catch(r){throw new Error("Error accessing the microphone: "+r.message)}const{onDestroy:i,onEnd:n}=this.renderMicStream(e);return this.subscriptions.push(this.once("destroy",i)),this.subscriptions.push(this.once("record-end",n)),this.stream=e,e})}stopMic(){this.stream&&(this.stream.getTracks().forEach(t=>t.stop()),this.stream=null,this.mediaRecorder=null)}startRecording(t){return it(this,void 0,void 0,function*(){const e=this.stream||(yield this.startMic(t));this.dataWindow=null;const i=this.mediaRecorder||new MediaRecorder(e,{mimeType:this.options.mimeType||ve.find(o=>MediaRecorder.isTypeSupported(o)),audioBitsPerSecond:this.options.audioBitsPerSecond});this.mediaRecorder=i,this.stopRecording();const n=[];i.ondataavailable=o=>{o.data.size>0&&n.push(o.data),this.emit("record-data-available",o.data)};const r=o=>{var a;const d=new Blob(n,{type:i.mimeType});this.emit(o,d),this.options.renderRecordedAudio&&(this.applyOriginalOptionsIfNeeded(),(a=this.wavesurfer)===null||a===void 0||a.load(URL.createObjectURL(d)))};i.onpause=()=>r("record-pause"),i.onstop=()=>r("record-end"),i.start(this.options.mediaRecorderTimeslice),this.lastStartTime=performance.now(),this.lastDuration=0,this.duration=0,this.isWaveformPaused=!1,this.timer.start(),this.emit("record-start")})}getDuration(){return this.duration}isRecording(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)==="recording"}isPaused(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)==="paused"}isActive(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)!=="inactive"}stopRecording(){var t;this.isActive()&&((t=this.mediaRecorder)===null||t===void 0||t.stop(),this.timer.stop())}pauseRecording(){var t,e;this.isRecording()&&(this.isWaveformPaused=!0,(t=this.mediaRecorder)===null||t===void 0||t.requestData(),(e=this.mediaRecorder)===null||e===void 0||e.pause(),this.timer.stop(),this.lastDuration=this.duration)}resumeRecording(){var t;this.isPaused()&&(this.isWaveformPaused=!1,(t=this.mediaRecorder)===null||t===void 0||t.resume(),this.timer.start(),this.lastStartTime=performance.now(),this.emit("record-resume"))}static getAvailableAudioDevices(){return it(this,void 0,void 0,function*(){return navigator.mediaDevices.enumerateDevices().then(t=>t.filter(e=>e.kind==="audioinput"))})}destroy(){this.applyOriginalOptionsIfNeeded(),super.destroy(),this.stopRecording(),this.stopMic()}applyOriginalOptionsIfNeeded(){this.wavesurfer&&this.originalOptions&&(this.wavesurfer.setOptions(this.originalOptions),delete this.originalOptions)}}const be=async({files:s,uploadClient:t,widgetMgr:e,widgetInfo:i,fragmentId:n})=>{let r=[];try{r=await t.fetchFileURLs(s)}catch(c){return{successfulUploads:[],failedUploads:s.map(l=>({file:l,error:ut(c)}))}}const o=zt(s,r),a=[],d=[];return await Promise.all(o.map(async([c,l])=>{if(!c||!l||!l.uploadUrl||!l.fileId)return{file:c,fileUrl:l,error:new Error("No upload URL found")};try{await t.uploadFile({id:l.fileId,formId:i.formId||""},l.uploadUrl,c),a.push({fileUrl:l,file:c})}catch(p){const u=ut(p);d.push({file:c,error:u})}})),e.setFileUploaderStateValue(i,new _t({uploadedFileInfo:a.map(({file:c,fileUrl:l})=>new $t({fileId:l.fileId,fileUrls:l,name:c.name,size:c.size}))}),{fromUi:!0},n),{successfulUploads:a,failedUploads:d}},st=({widgetMgr:s,id:t,formId:e,key:i,defaultValue:n})=>{h.useEffect(()=>{const l=s.getElementState(t,i);X(l)&&q(n)&&s.setElementState(t,i,n)},[s,t,i,n]);const[r,o]=h.useState(s.getElementState(t,i)??n),a=h.useCallback(l=>{s.setElementState(t,i,l),o(l)},[s,t,i]),d=h.useMemo(()=>({formId:e||""}),[e]),c=h.useCallback(()=>a(n),[n,a]);return se({element:d,widgetMgr:s,onFormCleared:c}),[r,a]},ye=(s,t)=>{const{libConfig:{enforceDownloadInNewTab:e=!1}}=h.useContext(Ht);return h.useCallback(()=>{if(!s)return;const n=ae({enforceDownloadInNewTab:e,url:s,filename:t});n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)},[s,e,t])},we=x("div",{target:"e45nyo0"})(),ft=x("div",{target:"e45nyo1"})(({theme:s})=>({height:s.sizes.largestElementHeight,width:"100%",background:s.colors.secondaryBg,borderRadius:s.radii.default,marginBottom:s.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:s.spacing.xs,paddingRight:s.spacing.sm,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0})),Se=x("div",{target:"e45nyo2"})({flex:1}),Ce=x("div",{target:"e45nyo3"})(({show:s})=>({display:s?"block":"none"})),Ee=x("span",{target:"e45nyo4"})(({theme:s,isPlayingOrRecording:t})=>({margin:s.spacing.sm,fontFamily:s.fonts.monospace,color:t?s.colors.bodyText:s.colors.fadedText60,backgroundColor:s.colors.secondaryBg,fontSize:s.fontSizes.sm})),Rt=x("div",{target:"e45nyo5"})({width:"100%",textAlign:"center",overflow:"hidden"}),Pt=x("span",{target:"e45nyo6"})(({theme:s})=>({color:s.colors.bodyText})),Re=x("a",{target:"e45nyo7"})(({theme:s})=>({color:s.colors.link,textDecoration:s.linkUnderline?"underline":"none"})),Pe=x("div",{target:"e45nyo8"})(({theme:s})=>({height:s.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),xe=x("div",{target:"e45nyo9"})(({theme:s})=>{const t="0.625em";return{opacity:.2,width:"100%",height:t,backgroundSize:t,backgroundImage:`radial-gradient(${s.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),Ae=x("span",{target:"e45nyo10"})(({theme:s})=>({"& > button":{color:s.colors.primary,padding:s.spacing.threeXS},"& > button:hover, & > button:focus":{color:s.colors.red}})),Te=x("span",{target:"e45nyo11"})(({theme:s})=>({"& > button":{padding:s.spacing.threeXS,color:s.colors.fadedText60},"& > button:hover, & > button:focus":{color:s.colors.bodyText}})),xt=x("span",{target:"e45nyo12"})(({theme:s})=>({"& > button":{padding:s.spacing.threeXS,color:s.colors.fadedText60},"& > button:hover, & > button:focus":{color:s.colors.bodyText}})),nt=x("div",{target:"e45nyo13"})(({theme:s})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:s.spacing.xs,gap:s.spacing.twoXS,marginRight:s.spacing.twoXS})),De=x("div",{target:"e45nyo14"})(({theme:s})=>({marginLeft:s.spacing.sm})),We=x(Vt,{target:"e45nyo15"})(({theme:s})=>({fontSize:s.fontSizes.sm,width:s.sizes.spinnerSize,height:s.sizes.spinnerSize,borderWidth:s.sizes.spinnerThickness,justifyContents:"center",padding:s.spacing.none,margin:s.spacing.none,borderColor:s.colors.borderColor,borderTopColor:s.colors.secondary,flexGrow:0,flexShrink:0})),Me=()=>N(Rt,{children:[v(Pt,{children:"This app would like to use your microphone."})," ",v(Re,{href:jt,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),ke=h.memo(Me),Oe=()=>v(Pe,{children:v(xe,{})}),Ie=h.memo(Oe),Le=4,Be=4,Ne=4,Ue=8,Fe=0,G="00:00",gt=s=>{const t=Math.floor(s/1e3),e=Math.floor(t/60),i=Math.floor(e/60),n=t%60,r=e%60,o=n.toString().padStart(2,"0"),a=r.toString().padStart(2,"0"),d=i.toString().padStart(2,"0");return e<60?`${a}:${o}`:`${d}:${a}:${o}`},_=({onClick:s,disabled:t,ariaLabel:e,iconContent:i})=>v(qt,{kind:Gt.BORDERLESS_ICON,onClick:s,disabled:t,"aria-label":e,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:v(Xt,{content:i,size:"lg",color:"inherit"})}),ze=({disabled:s,stopRecording:t})=>v(Ae,{children:v(_,{onClick:t,disabled:s,ariaLabel:"Stop recording",iconContent:St})}),_e=({disabled:s,isPlaying:t,onClickPlayPause:e})=>v(xt,{children:t?v(_,{onClick:e,disabled:s,ariaLabel:"Pause",iconContent:bt}):v(_,{onClick:e,disabled:s,ariaLabel:"Play",iconContent:yt})}),$e=({disabled:s,startRecording:t})=>v(Te,{children:v(_,{onClick:t,disabled:s,ariaLabel:"Record",iconContent:vt})}),He=({onClick:s})=>v(xt,{children:v(_,{disabled:!1,onClick:s,ariaLabel:"Reset",iconContent:wt})}),Ve=({disabled:s,isRecording:t,isPlaying:e,isUploading:i,isError:n,recordingUrlExists:r,startRecording:o,stopRecording:a,onClickPlayPause:d,onClear:c})=>n?v(nt,{children:v(He,{onClick:c})}):i?v(nt,{children:v(We,{"aria-label":"Uploading"})}):N(nt,{children:[t?v(ze,{disabled:s,stopRecording:a}):v($e,{disabled:s,startRecording:o}),r&&v(_e,{disabled:s,isPlaying:e,onClickPlayPause:d})]}),je=h.memo(Ve),Ge=Yt.getLogger("convertAudioToWav");async function Xe(s){const t=new window.AudioContext,e=await s.arrayBuffer();let i;try{i=await t.decodeAudioData(e)}catch(m){Ge.error(m);return}const n=44,r=i.numberOfChannels,o=i.sampleRate,a=i.length*r*2+n,d=new ArrayBuffer(a),c=new DataView(d),l={0:{type:"string",value:"RIFF"},4:{type:"uint32",value:a-8},8:{type:"string",value:"WAVE"},12:{type:"string",value:"fmt "},16:{type:"uint32",value:16},20:{type:"uint16",value:1},22:{type:"uint16",value:r},24:{type:"uint32",value:o},28:{type:"uint32",value:o*r*2},32:{type:"uint16",value:r*2},34:{type:"uint16",value:16},36:{type:"string",value:"data"},40:{type:"uint32",value:i.length*r*2}};Object.entries(l).forEach(([m,{type:f,value:y}])=>{const g=parseInt(m,10);f==="string"?qe(c,g,y):f==="uint32"?c.setUint32(g,y,!0):f==="uint16"&&c.setUint16(g,y,!0)});let p=n;for(let m=0;m<i.length;m++)for(let f=0;f<r;f++){const y=Math.max(-1,Math.min(1,i.getChannelData(f)[m]));c.setInt16(p,y*32767,!0),p+=2}const u=new Uint8Array(d);return new Blob([u],{type:"audio/wav"})}function qe(s,t,e){for(let i=0;i<e.length;i++)s.setUint8(t+i,e.charCodeAt(i))}const Ye=()=>v(Rt,{children:v(Pt,{children:"An error has occurred, please try again."})}),Ke=h.memo(Ye),Je=({element:s,uploadClient:t,widgetMgr:e,fragmentId:i,disabled:n})=>{const r=Kt(),o=oe(r),[a,d]=h.useState(null),c=h.useRef(null),[l,p]=st({widgetMgr:e,id:s.id,key:"deleteFileUrl",defaultValue:null}),[u,m]=h.useState(null),[f,y]=h.useState([]),[g,S]=h.useState(null),[b,A]=st({widgetMgr:e,id:s.id,key:"recordingUrl",defaultValue:null}),[,R]=h.useState(0),w=()=>{R(C=>C+1)},[T,D]=h.useState(G),[k,W]=st({widgetMgr:e,id:s.id,formId:s.formId,key:"recordingTime",defaultValue:G}),[O,F]=h.useState(!1),[L,At]=h.useState(!1),[rt,Tt]=h.useState(!1),[Dt,ot]=h.useState(!1),[K,J]=h.useState(!1),at=s.id,I=s.formId,lt=h.useCallback(async C=>{ot(!0),q(I)&&e.setFormsWithUploadsInProgress(new Set([I]));let E;if(C.type==="audio/wav"?E=C:E=await Xe(C),!E){J(!0);return}const M=URL.createObjectURL(E),Bt=new Date().toISOString().slice(0,16).replace(":","-"),Nt=new File([E],`${Bt}_audio.wav`,{type:E.type});A(M),be({files:[Nt],uploadClient:t,widgetMgr:e,widgetInfo:{id:at,formId:I},fragmentId:i}).then(({successfulUploads:Ut,failedUploads:Ft})=>{if(Ft.length>0){J(!0);return}const Z=Ut[0];Z&&Z.fileUrl.deleteUrl&&p(Z.fileUrl.deleteUrl)}).finally(()=>{q(I)&&e.setFormsWithUploadsInProgress(new Set),ot(!1)})},[A,t,e,at,I,i,p]),B=h.useCallback(({updateWidgetManager:C,deleteFile:E})=>{X(a)||X(l)||(A(null),a.empty(),E&&t.deleteFile(l),p(null),D(G),W(G),C&&e.setFileUploaderStateValue(s,{},{fromUi:!0},i),F(!1),q(b)&&URL.revokeObjectURL(b))},[l,b,t,a,s,e,i,W,A,p]);h.useEffect(()=>{if(X(I))return;const C=new ne;return C.manageFormClearListener(e,I,()=>B({updateWidgetManager:!0,deleteFile:!1})),()=>C.disconnect()},[I,B,e]);const ct=h.useCallback(()=>{if(c.current===null)return;const C=z.create({container:c.current,waveColor:b?tt(r.colors.fadedText40,r.colors.secondaryBg):r.colors.primary,progressColor:r.colors.bodyText,height:Jt(r.sizes.largestElementHeight)-2*Le,barWidth:Be,barGap:Ne,barRadius:Ue,cursorWidth:Fe,url:b??void 0});C.on("timeupdate",M=>{D(gt(M*1e3))}),C.on("pause",()=>{w()});const E=C.registerPlugin(Y.create({scrollingWaveform:!1,renderRecordedAudio:!0}));return E.on("record-end",M=>{lt(M)}),E.on("record-progress",M=>{W(gt(M))}),d(C),m(E),()=>{C&&C.destroy(),E&&E.destroy()}},[lt]);h.useEffect(()=>ct(),[ct]),h.useEffect(()=>{Qt(o,r)||a?.setOptions({waveColor:b?tt(r.colors.fadedText40,r.colors.secondaryBg):r.colors.primary,progressColor:r.colors.bodyText})},[r,o,b,a]);const Wt=h.useCallback(()=>{a&&(a.playPause(),F(!0),w())},[a]),Mt=h.useCallback(async()=>{let C=g;rt||(await navigator.mediaDevices.getUserMedia({audio:!0}).then(()=>Y.getAvailableAudioDevices().then(E=>{if(y(E),E.length>0){const{deviceId:M}=E[0];S(M),C=M}})).catch(E=>{At(!0)}),Tt(!0)),!(!u||!C||!a)&&(a.setOptions({waveColor:r.colors.primary}),b&&B({updateWidgetManager:!1,deleteFile:!0}),u.startRecording({deviceId:C}).then(()=>{w()}))},[g,u,r,a,b,B,rt]),kt=h.useCallback(()=>{u&&(u.stopRecording(),a?.setOptions({waveColor:tt(r.colors.fadedText40,r.colors.secondaryBg)}))},[u,a,r]),Ot=ye(b,"recording.wav"),Q=!!u?.isRecording(),dt=!!a?.isPlaying(),It=Q||dt,ht=!Q&&!b&&!L,Lt=L||ht||K;return N(we,{className:"stAudioInput","data-testid":"stAudioInput",children:[v(ie,{label:s.label,disabled:n,labelVisibility:Zt(s.labelVisibility?.value),children:s.help&&v(De,{children:v(te,{content:s.help,placement:ee.TOP})})}),N(ft,{children:[N(re,{isFullScreen:!1,disableFullscreenMode:!0,target:ft,children:[b&&v(pt,{label:"Download as WAV",icon:le,onClick:()=>Ot()}),l&&v(pt,{label:"Clear recording",icon:ce,onClick:()=>B({updateWidgetManager:!0,deleteFile:!0})})]}),v(je,{isRecording:Q,isPlaying:dt,isUploading:Dt,isError:K,recordingUrlExists:!!b,startRecording:Mt,stopRecording:kt,onClickPlayPause:Wt,onClear:()=>{B({updateWidgetManager:!1,deleteFile:!0}),J(!1)},disabled:n||L}),N(Se,{children:[K&&v(Ke,{}),ht&&v(Ie,{}),L&&v(ke,{}),v(Ce,{"data-testid":"stAudioInputWaveSurfer",ref:c,show:!Lt})]}),v(Ee,{isPlayingOrRecording:It,"data-testid":"stAudioInputWaveformTimeCode",children:O?T:k})]})]})},ri=h.memo(Je);export{ri as default};
73
+ `,[t,e]}setOptions(t){if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,i=e*t;this.setScroll(i)}destroy(){var t,e;this.subscriptions.forEach(i=>i()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.unsubscribeOnScroll)===null||e===void 0||e.forEach(i=>i()),this.unsubscribeOnScroll=[]}createDelay(t=10){let e,i;const n=()=>{e&&clearTimeout(e),i&&i()};return this.timeouts.push(n),()=>new Promise((r,o)=>{n(),i=o,e=setTimeout(()=>{e=void 0,i=void 0,r()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const e=document.createElement("canvas"),i=e.getContext("2d"),n=e.height*(window.devicePixelRatio||1),r=i.createLinearGradient(0,0,0,n),o=1/(t.length-1);return t.forEach((a,d)=>{const c=d*o;r.addColorStop(c,a)}),r}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,e,i,n){const r=t[0],o=t[1]||t[0],a=r.length,{width:d,height:c}=i.canvas,l=c/2,p=this.getPixelRatio(),u=e.barWidth?e.barWidth*p:1,m=e.barGap?e.barGap*p:e.barWidth?u/2:0,f=e.barRadius||0,b=d/(u+m)/a,g=f&&"roundRect"in i?"roundRect":"rect";i.beginPath();let S=0,y=0,x=0;for(let R=0;R<=a;R++){const w=Math.round(R*b);if(w>S){const k=Math.round(y*l*n),W=k+Math.round(x*l*n)||1;let O=l-k;e.barAlign==="top"?O=0:e.barAlign==="bottom"&&(O=c-W),i[g](S*(u+m),O,u,W,f),S=w,y=0,x=0}const A=Math.abs(r[R]||0),T=Math.abs(o[R]||0);A>y&&(y=A),T>x&&(x=T)}i.fill(),i.closePath()}renderLineWaveform(t,e,i,n){const r=o=>{const a=t[o]||t[0],d=a.length,{height:c}=i.canvas,l=c/2,p=i.canvas.width/d;i.moveTo(0,l);let u=0,m=0;for(let f=0;f<=d;f++){const b=Math.round(f*p);if(b>u){const S=l+(Math.round(m*l*n)||1)*(o===0?-1:1);i.lineTo(u,S),u=b,m=0}const g=Math.abs(a[f]||0);g>m&&(m=g)}i.lineTo(u,l)};i.beginPath(),r(0),r(1),i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor),e.renderFunction)return void e.renderFunction(t,i);let n=e.barHeight||1;if(e.normalize){const r=Array.from(t[0]).reduce((o,a)=>Math.max(o,Math.abs(a)),0);n=r?1/r:1}e.barWidth||e.barGap||e.barAlign?this.renderBarWaveform(t,e,i,n):this.renderLineWaveform(t,e,i,n)}renderSingleCanvas(t,e,i,n,r,o,a){const d=this.getPixelRatio(),c=document.createElement("canvas");c.width=Math.round(i*d),c.height=Math.round(n*d),c.style.width=`${i}px`,c.style.height=`${n}px`,c.style.left=`${Math.round(r)}px`,o.appendChild(c);const l=c.getContext("2d");if(this.renderWaveform(t,e,l),c.width>0&&c.height>0){const p=c.cloneNode(),u=p.getContext("2d");u.drawImage(c,0,0),u.globalCompositeOperation="source-in",u.fillStyle=this.convertColorValues(e.progressColor),u.fillRect(0,0,c.width,c.height),a.appendChild(p)}}renderMultiCanvas(t,e,i,n,r,o){const a=this.getPixelRatio(),{clientWidth:d}=this.scrollContainer,c=i/a;let l=Math.min(U.MAX_CANVAS_WIDTH,d,c),p={};if(e.barWidth||e.barGap){const g=e.barWidth||.5,S=g+(e.barGap||g/2);l%S!=0&&(l=Math.floor(l/S)*S)}if(l===0)return;const u=g=>{if(g<0||g>=m||p[g])return;p[g]=!0;const S=g*l;let y=Math.min(c-S,l);if(e.barWidth||e.barGap){const R=e.barWidth||.5,w=R+(e.barGap||R/2);y=Math.floor(y/w)*w}if(y<=0)return;const x=t.map(R=>{const w=Math.floor(S/c*R.length),A=Math.floor((S+y)/c*R.length);return R.slice(w,A)});this.renderSingleCanvas(x,e,y,n,S,r,o)},m=Math.ceil(c/l);if(!this.isScrollable){for(let g=0;g<m;g++)u(g);return}const f=this.scrollContainer.scrollLeft/c,b=Math.floor(f*m);if(u(b-1),u(b),u(b+1),m>1){const g=this.on("scroll",()=>{const{scrollLeft:S}=this.scrollContainer,y=Math.floor(S/c*m);Object.keys(p).length>U.MAX_NODES&&(r.innerHTML="",o.innerHTML="",p={}),u(y-1),u(y),u(y+1)});this.unsubscribeOnScroll.push(g)}}renderChannel(t,e,i,n){var{overlay:r}=e,o=function(l,p){var u={};for(var m in l)Object.prototype.hasOwnProperty.call(l,m)&&p.indexOf(m)<0&&(u[m]=l[m]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(m=Object.getOwnPropertySymbols(l);f<m.length;f++)p.indexOf(m[f])<0&&Object.prototype.propertyIsEnumerable.call(l,m[f])&&(u[m[f]]=l[m[f]])}return u}(e,["overlay"]);const a=document.createElement("div"),d=this.getHeight(o.height,o.splitChannels);a.style.height=`${d}px`,r&&n>0&&(a.style.marginTop=`-${d}px`),this.canvasWrapper.style.minHeight=`${d}px`,this.canvasWrapper.appendChild(a);const c=a.cloneNode();this.progressWrapper.appendChild(c),this.renderMultiCanvas(t,o,i,d,a,c)}render(t){return P(this,void 0,void 0,function*(){var e;this.timeouts.forEach(d=>d()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const i=this.getPixelRatio(),n=this.scrollContainer.clientWidth,r=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=r>n;const o=this.options.fillParent&&!this.isScrollable,a=(o?n:r)*i;if(this.wrapper.style.width=o?"100%":`${r}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let d=0;d<t.numberOfChannels;d++){const c=Object.assign(Object.assign({},this.options),(e=this.options.splitChannels)===null||e===void 0?void 0:e[d]);this.renderChannel([t.getChannelData(d)],c,a,d)}else{const d=[t.getChannelData(0)];t.numberOfChannels>1&&d.push(t.getChannelData(1)),this.renderChannel(d,this.options,a,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(i=>i()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:e}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:i}=this.progressWrapper.getBoundingClientRect();let n=i-e;n*=2,n=n<0?Math.floor(n):Math.ceil(n),n/=2,this.scrollContainer.scrollLeft+=n}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:i,scrollWidth:n,clientWidth:r}=this.scrollContainer,o=t*n,a=i,d=i+r,c=r/2;if(this.isDragging)o+30>d?this.scrollContainer.scrollLeft+=30:o-30<a&&(this.scrollContainer.scrollLeft-=30);else{(o<a||o>d)&&(this.scrollContainer.scrollLeft=o-(this.options.autoCenter?c:0));const l=o-i-c;e&&this.options.autoCenter&&l>0&&(this.scrollContainer.scrollLeft+=Math.min(l,10))}{const l=this.scrollContainer.scrollLeft,p=l/n,u=(l+r)/n;this.emit("scroll",p,u,l,l+r)}}renderProgress(t,e){if(isNaN(t))return;const i=100*t;this.canvasWrapper.style.clipPath=`polygon(${i}% 0%, 100% 0%, 100% 100%, ${i}% 100%)`,this.progressWrapper.style.width=`${i}%`,this.cursor.style.left=`${i}%`,this.cursor.style.transform=`translateX(-${Math.round(i)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,e)}exportImage(t,e,i){return P(this,void 0,void 0,function*(){const n=this.canvasWrapper.querySelectorAll("canvas");if(!n.length)throw new Error("No waveform data");if(i==="dataURL"){const r=Array.from(n).map(o=>o.toDataURL(t,e));return Promise.resolve(r)}return Promise.all(Array.from(n).map(r=>new Promise((o,a)=>{r.toBlob(d=>{d?o(d):a(new Error("Could not export image"))},t,e)})))})}}U.MAX_CANVAS_WIDTH=8e3,U.MAX_NODES=10;class pe extends V{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class et extends V{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return P(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()}).then(e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e)).then(e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let e=this.playedDuration*this._playbackRate;(e>=this.duration||e<0)&&(e=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,e),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return P(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const e=t-this.currentTime,i=this.bufferNode;i?.stop(this.audioContext.currentTime+e),i?.addEventListener("ended",()=>{i===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return P(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playedDuration=t/this._playbackRate,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return(t=this._duration)!==null&&t!==void 0?t:((e=this.buffer)===null||e===void 0?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const e=this.buffer.numberOfChannels;for(let i=0;i<e;i++)t.push(this.buffer.getChannelData(i));return t}}const me={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class z extends ue{static create(t){return new z(t)}constructor(t){const e=t.media||(t.backend==="WebAudio"?new et:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},me,t),this.timer=new pe;const i=e?void 0:this.getMediaElement();this.renderer=new U(this.options,i),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const n=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:r,duration:o}=this.options;(n||r&&o)&&this.load(n,r,o).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))}),this.renderer.on("dblclick",(t,e)=>{this.emit("dblclick",t,e)}),this.renderer.on("scroll",(t,e,i,n)=>{const r=this.getDuration();this.emit("scroll",t*r,e*r,i,n)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",e=>{if(!this.options.interact)return;let i;this.renderer.renderProgress(e),clearTimeout(t),this.isPlaying()?i=0:this.options.dragToSeek===!0?i=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(i=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(e)},i),this.emit("interaction",e*this.getDuration()),this.emit("drag",e)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(e=>{this.registerPlugin(e)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=j.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=j.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){if(this.plugins.includes(t))return t;t._init(this),this.plugins.push(t);const e=t.once("destroy",()=>{this.plugins=this.plugins.filter(i=>i!==t),this.subscriptions=this.subscriptions.filter(i=>i!==e)});return this.subscriptions.push(e),t}unregisterPlugin(t){this.plugins=this.plugins.filter(e=>e!==t),t.destroy()}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,i,n){return P(this,void 0,void 0,function*(){var r;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!e&&!i){const a=this.options.fetchParams||{};window.AbortController&&!a.signal&&(this.abortController=new AbortController,a.signal=(r=this.abortController)===null||r===void 0?void 0:r.signal);const d=l=>this.emit("loading",l);e=yield he.fetchBlob(t,d,a);const c=this.options.blobMimeType;c&&(e=new Blob([e],{type:c}))}this.setSrc(t,e);const o=yield new Promise(a=>{const d=n||this.getDuration();d?a(d):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>a(this.getDuration()),{once:!0}))});if(!t&&!e){const a=this.getMediaElement();a instanceof et&&(a.duration=o)}if(i)this.decodedData=j.createBuffer(i,o||0);else if(e){const a=yield e.arrayBuffer();this.decodedData=yield j.decode(a,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,e,i){return P(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,e,i)}catch(n){throw this.emit("error",n),n}})}loadBlob(t,e,i){return P(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,e,i)}catch(n){throw this.emit("error",n),n}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:i=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const n=Math.min(t,this.decodedData.numberOfChannels),r=[];for(let o=0;o<n;o++){const a=this.decodedData.getChannelData(o),d=[],c=a.length/e;for(let l=0;l<e;l++){const p=a.slice(Math.floor(l*c),Math.ceil((l+1)*c));let u=0;for(let m=0;m<p.length;m++){const f=p[m];Math.abs(f)>Math.abs(u)&&(u=f)}d.push(Math.round(u*i)/i)}r.push(d)}return r}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}play(t,e){const i=Object.create(null,{play:{get:()=>super.play}});return P(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const n=yield i.play.call(this);return e!=null&&(this.media instanceof et?this.media.stopAt(e):this.stopAtPosition=e),n})}playPause(){return P(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return P(this,arguments,void 0,function*(t="image/png",e=1,i="dataURL"){return this.renderer.exportImage(t,e,i)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(e=>e.destroy()),this.subscriptions.forEach(e=>e()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}z.BasePlugin=class extends V{constructor(s){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=s}onInit(){}_init(s){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=s,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(s=>s()),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}},z.dom=de;function it(s,t,e,i){return new(e||(e=Promise))(function(n,r){function o(c){try{d(i.next(c))}catch(l){r(l)}}function a(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(o,a)}d((i=i.apply(s,[])).next())})}class Et{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i?.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}}class fe extends Et{constructor(t){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=t}onInit(){}_init(t){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=t,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(t=>t()),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}}class ge extends Et{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}const ve=["audio/webm","audio/wav","audio/mpeg","audio/mp4","audio/mp3"];class Y extends fe{constructor(t){var e,i,n,r,o,a;super(Object.assign(Object.assign({},t),{audioBitsPerSecond:(e=t.audioBitsPerSecond)!==null&&e!==void 0?e:128e3,scrollingWaveform:(i=t.scrollingWaveform)!==null&&i!==void 0&&i,scrollingWaveformWindow:(n=t.scrollingWaveformWindow)!==null&&n!==void 0?n:5,continuousWaveform:(r=t.continuousWaveform)!==null&&r!==void 0&&r,renderRecordedAudio:(o=t.renderRecordedAudio)===null||o===void 0||o,mediaRecorderTimeslice:(a=t.mediaRecorderTimeslice)!==null&&a!==void 0?a:void 0})),this.stream=null,this.mediaRecorder=null,this.dataWindow=null,this.isWaveformPaused=!1,this.lastStartTime=0,this.lastDuration=0,this.duration=0,this.timer=new ge,this.subscriptions.push(this.timer.on("tick",()=>{const d=performance.now()-this.lastStartTime;this.duration=this.isPaused()?this.duration:this.lastDuration+d,this.emit("record-progress",this.duration)}))}static create(t){return new Y(t||{})}renderMicStream(t){var e;const i=new AudioContext,n=i.createMediaStreamSource(t),r=i.createAnalyser();n.connect(r),this.options.continuousWaveform&&(r.fftSize=32);const o=r.frequencyBinCount,a=new Float32Array(o);let d=0;this.wavesurfer&&((e=this.originalOptions)!==null&&e!==void 0||(this.originalOptions=Object.assign({},this.wavesurfer.options)),this.wavesurfer.options.interact=!1,this.options.scrollingWaveform&&(this.wavesurfer.options.cursorWidth=0));const c=setInterval(()=>{var l,p,u,m;if(!this.isWaveformPaused){if(r.getFloatTimeDomainData(a),this.options.scrollingWaveform){const f=Math.floor((this.options.scrollingWaveformWindow||0)*i.sampleRate),b=Math.min(f,this.dataWindow?this.dataWindow.length+o:o),g=new Float32Array(f);if(this.dataWindow){const S=Math.max(0,f-this.dataWindow.length);g.set(this.dataWindow.slice(-b+o),S)}g.set(a,f-o),this.dataWindow=g}else if(this.options.continuousWaveform){if(!this.dataWindow){const b=this.options.continuousWaveformDuration?Math.round(100*this.options.continuousWaveformDuration):((p=(l=this.wavesurfer)===null||l===void 0?void 0:l.getWidth())!==null&&p!==void 0?p:0)*window.devicePixelRatio;this.dataWindow=new Float32Array(b)}let f=0;for(let b=0;b<o;b++){const g=Math.abs(a[b]);g>f&&(f=g)}if(d+1>this.dataWindow.length){const b=new Float32Array(2*this.dataWindow.length);b.set(this.dataWindow,0),this.dataWindow=b}this.dataWindow[d]=f,d++}else this.dataWindow=a;if(this.wavesurfer){const f=((m=(u=this.dataWindow)===null||u===void 0?void 0:u.length)!==null&&m!==void 0?m:0)/100;this.wavesurfer.load("",[this.dataWindow],this.options.scrollingWaveform?this.options.scrollingWaveformWindow:f).then(()=>{this.wavesurfer&&this.options.continuousWaveform&&(this.wavesurfer.setTime(this.getDuration()/1e3),this.wavesurfer.options.minPxPerSec||this.wavesurfer.setOptions({minPxPerSec:this.wavesurfer.getWidth()/this.wavesurfer.getDuration()}))}).catch(b=>{console.error("Error rendering real-time recording data:",b)})}}},10);return{onDestroy:()=>{clearInterval(c),n?.disconnect(),i?.close()},onEnd:()=>{this.isWaveformPaused=!0,clearInterval(c),this.stopMic()}}}startMic(t){return it(this,void 0,void 0,function*(){let e;try{e=yield navigator.mediaDevices.getUserMedia({audio:t==null||t})}catch(r){throw new Error("Error accessing the microphone: "+r.message)}const{onDestroy:i,onEnd:n}=this.renderMicStream(e);return this.subscriptions.push(this.once("destroy",i)),this.subscriptions.push(this.once("record-end",n)),this.stream=e,e})}stopMic(){this.stream&&(this.stream.getTracks().forEach(t=>t.stop()),this.stream=null,this.mediaRecorder=null)}startRecording(t){return it(this,void 0,void 0,function*(){const e=this.stream||(yield this.startMic(t));this.dataWindow=null;const i=this.mediaRecorder||new MediaRecorder(e,{mimeType:this.options.mimeType||ve.find(o=>MediaRecorder.isTypeSupported(o)),audioBitsPerSecond:this.options.audioBitsPerSecond});this.mediaRecorder=i,this.stopRecording();const n=[];i.ondataavailable=o=>{o.data.size>0&&n.push(o.data),this.emit("record-data-available",o.data)};const r=o=>{var a;const d=new Blob(n,{type:i.mimeType});this.emit(o,d),this.options.renderRecordedAudio&&(this.applyOriginalOptionsIfNeeded(),(a=this.wavesurfer)===null||a===void 0||a.load(URL.createObjectURL(d)))};i.onpause=()=>r("record-pause"),i.onstop=()=>r("record-end"),i.start(this.options.mediaRecorderTimeslice),this.lastStartTime=performance.now(),this.lastDuration=0,this.duration=0,this.isWaveformPaused=!1,this.timer.start(),this.emit("record-start")})}getDuration(){return this.duration}isRecording(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)==="recording"}isPaused(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)==="paused"}isActive(){var t;return((t=this.mediaRecorder)===null||t===void 0?void 0:t.state)!=="inactive"}stopRecording(){var t;this.isActive()&&((t=this.mediaRecorder)===null||t===void 0||t.stop(),this.timer.stop())}pauseRecording(){var t,e;this.isRecording()&&(this.isWaveformPaused=!0,(t=this.mediaRecorder)===null||t===void 0||t.requestData(),(e=this.mediaRecorder)===null||e===void 0||e.pause(),this.timer.stop(),this.lastDuration=this.duration)}resumeRecording(){var t;this.isPaused()&&(this.isWaveformPaused=!1,(t=this.mediaRecorder)===null||t===void 0||t.resume(),this.timer.start(),this.lastStartTime=performance.now(),this.emit("record-resume"))}static getAvailableAudioDevices(){return it(this,void 0,void 0,function*(){return navigator.mediaDevices.enumerateDevices().then(t=>t.filter(e=>e.kind==="audioinput"))})}destroy(){this.applyOriginalOptionsIfNeeded(),super.destroy(),this.stopRecording(),this.stopMic()}applyOriginalOptionsIfNeeded(){this.wavesurfer&&this.originalOptions&&(this.wavesurfer.setOptions(this.originalOptions),delete this.originalOptions)}}const ye=async({files:s,uploadClient:t,widgetMgr:e,widgetInfo:i,fragmentId:n})=>{let r=[];try{r=await t.fetchFileURLs(s)}catch(c){return{successfulUploads:[],failedUploads:s.map(l=>({file:l,error:ut(c)}))}}const o=zt(s,r),a=[],d=[];return await Promise.all(o.map(async([c,l])=>{if(!c||!l||!l.uploadUrl||!l.fileId)return{file:c,fileUrl:l,error:new Error("No upload URL found")};try{await t.uploadFile({id:l.fileId,formId:i.formId||""},l.uploadUrl,c),a.push({fileUrl:l,file:c})}catch(p){const u=ut(p);d.push({file:c,error:u})}})),e.setFileUploaderStateValue(i,new _t({uploadedFileInfo:a.map(({file:c,fileUrl:l})=>new $t({fileId:l.fileId,fileUrls:l,name:c.name,size:c.size}))}),{fromUi:!0},n),{successfulUploads:a,failedUploads:d}},st=({widgetMgr:s,id:t,formId:e,key:i,defaultValue:n})=>{h.useEffect(()=>{const l=s.getElementState(t,i);X(l)&&q(n)&&s.setElementState(t,i,n)},[s,t,i,n]);const[r,o]=h.useState(s.getElementState(t,i)??n),a=h.useCallback(l=>{s.setElementState(t,i,l),o(l)},[s,t,i]),d=h.useMemo(()=>({formId:e||""}),[e]),c=h.useCallback(()=>a(n),[n,a]);return se({element:d,widgetMgr:s,onFormCleared:c}),[r,a]},be=(s,t)=>{const{libConfig:{enforceDownloadInNewTab:e=!1}}=h.useContext(Ht);return h.useCallback(()=>{if(!s)return;const n=ae({enforceDownloadInNewTab:e,url:s,filename:t});n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)},[s,e,t])},we=D("div",{target:"e45nyo0"})(),ft=D("div",{target:"e45nyo1"})(({theme:s})=>({height:s.sizes.largestElementHeight,width:"100%",background:s.colors.secondaryBg,borderRadius:s.radii.default,marginBottom:s.spacing.twoXS,display:"flex",alignItems:"center",position:"relative",paddingLeft:s.spacing.xs,paddingRight:s.spacing.sm,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0})),Se=D("div",{target:"e45nyo2"})({flex:1}),Ce=D("div",{target:"e45nyo3"})(({show:s})=>({display:s?"block":"none"})),Ee=D("span",{target:"e45nyo4"})(({theme:s,isPlayingOrRecording:t})=>({margin:s.spacing.sm,fontFamily:s.fonts.monospace,color:t?s.colors.bodyText:s.colors.fadedText60,backgroundColor:s.colors.secondaryBg,fontSize:s.fontSizes.sm})),Rt=D("div",{target:"e45nyo5"})({width:"100%",textAlign:"center",overflow:"hidden"}),Pt=D("span",{target:"e45nyo6"})(({theme:s})=>({color:s.colors.bodyText})),Re=D("a",{target:"e45nyo7"})(({theme:s})=>({color:s.colors.link,textDecoration:s.linkUnderline?"underline":"none"})),Pe=D("div",{target:"e45nyo8"})(({theme:s})=>({height:s.sizes.largestElementHeight,display:"flex",justifyContent:"center",alignItems:"center"})),De=D("div",{target:"e45nyo9"})(({theme:s})=>{const t="0.625em";return{opacity:.2,width:"100%",height:t,backgroundSize:t,backgroundImage:`radial-gradient(${s.colors.fadedText10} 40%, transparent 40%)`,backgroundRepeat:"repeat"}}),xe=D("span",{target:"e45nyo10"})(({theme:s})=>({"& > button":{color:s.colors.primary,padding:s.spacing.threeXS},"& > button:hover, & > button:focus":{color:s.colors.red}})),Ae=D("span",{target:"e45nyo11"})(({theme:s})=>({"& > button":{padding:s.spacing.threeXS,color:s.colors.fadedText60},"& > button:hover, & > button:focus":{color:s.colors.bodyText}})),Dt=D("span",{target:"e45nyo12"})(({theme:s})=>({"& > button":{padding:s.spacing.threeXS,color:s.colors.fadedText60},"& > button:hover, & > button:focus":{color:s.colors.bodyText}})),nt=D("div",{target:"e45nyo13"})(({theme:s})=>({display:"flex",justifyContent:"center",alignItems:"center",flexGrow:0,flexShrink:1,padding:s.spacing.xs,gap:s.spacing.twoXS,marginRight:s.spacing.twoXS})),Te=D("div",{target:"e45nyo14"})(({theme:s})=>({marginLeft:s.spacing.sm})),We=D(Vt,{target:"e45nyo15"})(({theme:s})=>({fontSize:s.fontSizes.sm,width:s.sizes.spinnerSize,height:s.sizes.spinnerSize,borderWidth:s.sizes.spinnerThickness,justifyContents:"center",padding:s.spacing.none,margin:s.spacing.none,borderColor:s.colors.borderColor,borderTopColor:s.colors.secondary,flexGrow:0,flexShrink:0})),Me=()=>N(Rt,{children:[v(Pt,{children:"This app would like to use your microphone."})," ",v(Re,{href:jt,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]}),ke=h.memo(Me),Oe=()=>v(Pe,{children:v(De,{})}),Ie=h.memo(Oe),Le=4,Be=4,Ne=4,Ue=8,Fe=0,G="00:00",gt=s=>{const t=Math.floor(s/1e3),e=Math.floor(t/60),i=Math.floor(e/60),n=t%60,r=e%60,o=n.toString().padStart(2,"0"),a=r.toString().padStart(2,"0"),d=i.toString().padStart(2,"0");return e<60?`${a}:${o}`:`${d}:${a}:${o}`},_=({onClick:s,disabled:t,ariaLabel:e,iconContent:i})=>v(qt,{kind:Gt.BORDERLESS_ICON,onClick:s,disabled:t,"aria-label":e,containerWidth:!0,"data-testid":"stAudioInputActionButton",children:v(Xt,{content:i,size:"lg",color:"inherit"})}),ze=({disabled:s,stopRecording:t})=>v(xe,{children:v(_,{onClick:t,disabled:s,ariaLabel:"Stop recording",iconContent:St})}),_e=({disabled:s,isPlaying:t,onClickPlayPause:e})=>v(Dt,{children:t?v(_,{onClick:e,disabled:s,ariaLabel:"Pause",iconContent:yt}):v(_,{onClick:e,disabled:s,ariaLabel:"Play",iconContent:bt})}),$e=({disabled:s,startRecording:t})=>v(Ae,{children:v(_,{onClick:t,disabled:s,ariaLabel:"Record",iconContent:vt})}),He=({onClick:s})=>v(Dt,{children:v(_,{disabled:!1,onClick:s,ariaLabel:"Reset",iconContent:wt})}),Ve=({disabled:s,isRecording:t,isPlaying:e,isUploading:i,isError:n,recordingUrlExists:r,startRecording:o,stopRecording:a,onClickPlayPause:d,onClear:c})=>n?v(nt,{children:v(He,{onClick:c})}):i?v(nt,{children:v(We,{"aria-label":"Uploading"})}):N(nt,{children:[t?v(ze,{disabled:s,stopRecording:a}):v($e,{disabled:s,startRecording:o}),r&&v(_e,{disabled:s,isPlaying:e,onClickPlayPause:d})]}),je=h.memo(Ve),Ge=Yt.getLogger("convertAudioToWav");async function Xe(s){const t=new window.AudioContext,e=await s.arrayBuffer();let i;try{i=await t.decodeAudioData(e)}catch(m){Ge.error(m);return}const n=44,r=i.numberOfChannels,o=i.sampleRate,a=i.length*r*2+n,d=new ArrayBuffer(a),c=new DataView(d),l={0:{type:"string",value:"RIFF"},4:{type:"uint32",value:a-8},8:{type:"string",value:"WAVE"},12:{type:"string",value:"fmt "},16:{type:"uint32",value:16},20:{type:"uint16",value:1},22:{type:"uint16",value:r},24:{type:"uint32",value:o},28:{type:"uint32",value:o*r*2},32:{type:"uint16",value:r*2},34:{type:"uint16",value:16},36:{type:"string",value:"data"},40:{type:"uint32",value:i.length*r*2}};Object.entries(l).forEach(([m,{type:f,value:b}])=>{const g=parseInt(m,10);f==="string"?qe(c,g,b):f==="uint32"?c.setUint32(g,b,!0):f==="uint16"&&c.setUint16(g,b,!0)});let p=n;for(let m=0;m<i.length;m++)for(let f=0;f<r;f++){const b=Math.max(-1,Math.min(1,i.getChannelData(f)[m]));c.setInt16(p,b*32767,!0),p+=2}const u=new Uint8Array(d);return new Blob([u],{type:"audio/wav"})}function qe(s,t,e){for(let i=0;i<e.length;i++)s.setUint8(t+i,e.charCodeAt(i))}const Ye=()=>v(Rt,{children:v(Pt,{children:"An error has occurred, please try again."})}),Ke=h.memo(Ye),Je=({element:s,uploadClient:t,widgetMgr:e,fragmentId:i,disabled:n})=>{const r=Kt(),o=oe(r),[a,d]=h.useState(null),c=h.useRef(null),[l,p]=st({widgetMgr:e,id:s.id,key:"deleteFileUrl",defaultValue:null}),[u,m]=h.useState(null),[f,b]=h.useState([]),[g,S]=h.useState(null),[y,x]=st({widgetMgr:e,id:s.id,key:"recordingUrl",defaultValue:null}),[,R]=h.useState(0),w=()=>{R(C=>C+1)},[A,T]=h.useState(G),[k,W]=st({widgetMgr:e,id:s.id,formId:s.formId,key:"recordingTime",defaultValue:G}),[O,F]=h.useState(!1),[L,xt]=h.useState(!1),[rt,At]=h.useState(!1),[Tt,ot]=h.useState(!1),[K,J]=h.useState(!1),at=s.id,I=s.formId,lt=h.useCallback(async C=>{ot(!0),q(I)&&e.setFormsWithUploadsInProgress(new Set([I]));let E;if(C.type==="audio/wav"?E=C:E=await Xe(C),!E){J(!0);return}const M=URL.createObjectURL(E),Bt=new Date().toISOString().slice(0,16).replace(":","-"),Nt=new File([E],`${Bt}_audio.wav`,{type:E.type});x(M),ye({files:[Nt],uploadClient:t,widgetMgr:e,widgetInfo:{id:at,formId:I},fragmentId:i}).then(({successfulUploads:Ut,failedUploads:Ft})=>{if(Ft.length>0){J(!0);return}const Z=Ut[0];Z&&Z.fileUrl.deleteUrl&&p(Z.fileUrl.deleteUrl)}).finally(()=>{q(I)&&e.setFormsWithUploadsInProgress(new Set),ot(!1)})},[x,t,e,at,I,i,p]),B=h.useCallback(({updateWidgetManager:C,deleteFile:E})=>{X(a)||X(l)||(x(null),a.empty(),E&&t.deleteFile(l),p(null),T(G),W(G),C&&e.setFileUploaderStateValue(s,{},{fromUi:!0},i),F(!1),q(y)&&URL.revokeObjectURL(y))},[l,y,t,a,s,e,i,W,x,p]);h.useEffect(()=>{if(X(I))return;const C=new ne;return C.manageFormClearListener(e,I,()=>B({updateWidgetManager:!0,deleteFile:!1})),()=>C.disconnect()},[I,B,e]);const ct=h.useCallback(()=>{if(c.current===null)return;const C=z.create({container:c.current,waveColor:y?tt(r.colors.fadedText40,r.colors.secondaryBg):r.colors.primary,progressColor:r.colors.bodyText,height:Jt(r.sizes.largestElementHeight)-2*Le,barWidth:Be,barGap:Ne,barRadius:Ue,cursorWidth:Fe,url:y??void 0});C.on("timeupdate",M=>{T(gt(M*1e3))}),C.on("pause",()=>{w()});const E=C.registerPlugin(Y.create({scrollingWaveform:!1,renderRecordedAudio:!0}));return E.on("record-end",M=>{lt(M)}),E.on("record-progress",M=>{W(gt(M))}),d(C),m(E),()=>{C&&C.destroy(),E&&E.destroy()}},[lt]);h.useEffect(()=>ct(),[ct]),h.useEffect(()=>{Qt(o,r)||a?.setOptions({waveColor:y?tt(r.colors.fadedText40,r.colors.secondaryBg):r.colors.primary,progressColor:r.colors.bodyText})},[r,o,y,a]);const Wt=h.useCallback(()=>{a&&(a.playPause(),F(!0),w())},[a]),Mt=h.useCallback(async()=>{let C=g;rt||(await navigator.mediaDevices.getUserMedia({audio:!0}).then(()=>Y.getAvailableAudioDevices().then(E=>{if(b(E),E.length>0){const{deviceId:M}=E[0];S(M),C=M}})).catch(E=>{xt(!0)}),At(!0)),!(!u||!C||!a)&&(a.setOptions({waveColor:r.colors.primary}),y&&B({updateWidgetManager:!1,deleteFile:!0}),u.startRecording({deviceId:C}).then(()=>{w()}))},[g,u,r,a,y,B,rt]),kt=h.useCallback(()=>{u&&(u.stopRecording(),a?.setOptions({waveColor:tt(r.colors.fadedText40,r.colors.secondaryBg)}))},[u,a,r]),Ot=be(y,"recording.wav"),Q=!!u?.isRecording(),dt=!!a?.isPlaying(),It=Q||dt,ht=!Q&&!y&&!L,Lt=L||ht||K;return N(we,{className:"stAudioInput","data-testid":"stAudioInput",children:[v(ie,{label:s.label,disabled:n,labelVisibility:Zt(s.labelVisibility?.value),children:s.help&&v(Te,{children:v(te,{content:s.help,placement:ee.TOP})})}),N(ft,{children:[N(re,{isFullScreen:!1,disableFullscreenMode:!0,target:ft,children:[y&&v(pt,{label:"Download as WAV",icon:le,onClick:()=>Ot()}),l&&v(pt,{label:"Clear recording",icon:ce,onClick:()=>B({updateWidgetManager:!0,deleteFile:!0})})]}),v(je,{isRecording:Q,isPlaying:dt,isUploading:Tt,isError:K,recordingUrlExists:!!y,startRecording:Mt,stopRecording:kt,onClickPlayPause:Wt,onClear:()=>{B({updateWidgetManager:!1,deleteFile:!0}),J(!1)},disabled:n||L}),N(Se,{children:[K&&v(Ke,{}),ht&&v(Ie,{}),L&&v(ke,{}),v(Ce,{"data-testid":"stAudioInputWaveSurfer",ref:c,show:!Lt})]}),v(Ee,{isPlayingOrRecording:It,"data-testid":"stAudioInputWaveformTimeCode",children:O?A:k})]})]})},ri=h.memo(Je);export{ri as default};
@@ -1 +1 @@
1
- import{r as l,M as s,j as m,br as V,ca as x}from"./index.EAQB8Tuq.js";import{a as U}from"./useBasicWidgetState.YAhDGDM8.js";import"./FormClearHelper.C4W8xjEX.js";const h=(t,e)=>t.getStringValue(e),v=t=>t.options.length===0||s(t.default)?null:t.options[t.default],w=t=>t.rawValue??null,y=(t,e,o,a)=>{e.setStringValue(t,o.value,{fromUi:o.fromUi},a)},C=({disabled:t,element:e,widgetMgr:o,fragmentId:a})=>{const{options:i,help:u,label:n,labelVisibility:c,placeholder:p,acceptNewOptions:f}=e,[g,r]=U({getStateFromWidgetMgr:h,getDefaultStateFromProto:v,getCurrStateFromProto:w,updateWidgetMgrState:y,element:e,widgetMgr:o,fragmentId:a}),b=l.useCallback(d=>{r({value:d,fromUi:!0})},[r]),S=s(e.default)&&!t;return m(x,{label:n,labelVisibility:V(c?.value),options:i,disabled:t,onChange:b,value:g,help:u,placeholder:p,clearable:S,acceptNewOptions:f??!1})},O=l.memo(C);export{O as default};
1
+ import{r as l,M as s,j as m,br as V,ca as x}from"./index.D1AeFlAQ.js";import{a as U}from"./useBasicWidgetState.WEzLnfWp.js";import"./FormClearHelper.Fo17GZrr.js";const h=(t,e)=>t.getStringValue(e),v=t=>t.options.length===0||s(t.default)?null:t.options[t.default],w=t=>t.rawValue??null,y=(t,e,o,a)=>{e.setStringValue(t,o.value,{fromUi:o.fromUi},a)},C=({disabled:t,element:e,widgetMgr:o,fragmentId:a})=>{const{options:i,help:u,label:n,labelVisibility:c,placeholder:p,acceptNewOptions:f}=e,[g,r]=U({getStateFromWidgetMgr:h,getDefaultStateFromProto:v,getCurrStateFromProto:w,updateWidgetMgrState:y,element:e,widgetMgr:o,fragmentId:a}),b=l.useCallback(d=>{r({value:d,fromUi:!0})},[r]),S=s(e.default)&&!t;return m(x,{label:n,labelVisibility:V(c?.value),options:i,disabled:t,onChange:b,value:g,help:u,placeholder:p,clearable:S,acceptNewOptions:f??!1})},O=l.memo(C);export{O as default};
@@ -1 +1 @@
1
- import{s as a,r as e,C as t,j as r,aG as o}from"./index.EAQB8Tuq.js";import{P as i}from"./ProgressBar.DBmbQ5U6.js";const l=a("div",{target:"e1675qd10"})(({theme:s})=>({paddingBottom:s.spacing.sm,lineHeight:"normal"}));function d({element:s}){return t("div",{className:"stProgress","data-testid":"stProgress",children:[r(l,{children:r(o,{source:s.text,allowHTML:!1,isLabel:!0})}),r(i,{value:s.value})]})}const m=e.memo(d);export{m as default};
1
+ import{s as a,r as e,C as t,j as r,aG as o}from"./index.D1AeFlAQ.js";import{P as i}from"./ProgressBar.DbvwXQwC.js";const l=a("div",{target:"e1675qd10"})(({theme:s})=>({paddingBottom:s.spacing.sm,lineHeight:"normal"}));function d({element:s}){return t("div",{className:"stProgress","data-testid":"stProgress",children:[r(l,{children:r(o,{source:s.text,allowHTML:!1,isLabel:!0})}),r(i,{value:s.value})]})}const m=e.memo(d);export{m as default};