@stlite/desktop 0.83.1 → 0.84.1

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 (73) hide show
  1. package/build/assets/{ErrorOutline.esm-Cdc3NAX8.js → ErrorOutline.esm-7fPCAua1.js} +1 -1
  2. package/build/assets/{FileDownload.esm-CbXaPbiH.js → FileDownload.esm-5XDRJbc8.js} +1 -1
  3. package/build/assets/{FileHelper-WDsMYNBw.js → FileHelper-BarQJiLz.js} +1 -1
  4. package/build/assets/{FormClearHelper-CT0Jwp4X.js → FormClearHelper-BZaxoxQN.js} +1 -1
  5. package/build/assets/{Hooks-BKPTn6xf.js → Hooks-BxizdPoJ.js} +1 -1
  6. package/build/assets/{InputInstructions-Cyg7opie.js → InputInstructions-Dmr8j4xE.js} +1 -1
  7. package/build/assets/{ProgressBar-CA-bplbU.js → ProgressBar-C_yUO6k-.js} +1 -1
  8. package/build/assets/{RenderInPortalIfExists-BozYGWdi.js → RenderInPortalIfExists-eTRglO06.js} +1 -1
  9. package/build/assets/{Toolbar-DlGOP7h4.js → Toolbar-bneC7vhq.js} +1 -1
  10. package/build/assets/{base-input-BnIlcFzX.js → base-input-DrVuxJmE.js} +1 -1
  11. package/build/assets/{checkbox-CGvNPQQ1.js → checkbox-Ce7VH5yR.js} +1 -1
  12. package/build/assets/{createSuper-B8yCxQGq.js → createSuper-Ce1x_8d5.js} +1 -1
  13. package/build/assets/{data-grid-overlay-editor-CltKX1-_.js → data-grid-overlay-editor-Bd6FIb0g.js} +1 -1
  14. package/build/assets/{downloader-Cof1FiXt.js → downloader-DTdoFA0u.js} +1 -1
  15. package/build/assets/{es6-Ca0BcWDW.js → es6-eSFIFIhE.js} +2 -2
  16. package/build/assets/{iframeResizer.contentWindow-3AhBUVoO.js → iframeResizer.contentWindow-BbhpUGmG.js} +1 -1
  17. package/build/assets/{index-BUOOlidY.js → index-2zFaDmrI.js} +1 -1
  18. package/build/assets/{index-XyUVDWZe.js → index-B6AypoKB.js} +1 -1
  19. package/build/assets/{index-BafYTuwa.js → index-BF3Fet0V.js} +1 -1
  20. package/build/assets/{index-Dw5G4t9P.js → index-BU5lMh9f.js} +1 -1
  21. package/build/assets/{index-TkDz3vqu.js → index-BU9sb5h3.js} +1 -1
  22. package/build/assets/{index-Zd66ep5J.js → index-BWKeW-zA.js} +1 -1
  23. package/build/assets/{index-Dx-GFi6o.js → index-BcIT8Wnk.js} +1 -1
  24. package/build/assets/{index-Do3iUH-x.js → index-Bf7iW3kb.js} +1 -1
  25. package/build/assets/{index-PRsYLT-9.js → index-Bj66FfmM.js} +1 -1
  26. package/build/assets/{index-bQj3l0zc.js → index-BlaLvghR.js} +1 -1
  27. package/build/assets/{index-Bc7AX3-A.js → index-BrFIUJra.js} +1 -1
  28. package/build/assets/{index-J-18FLnE.js → index-BwAJEr7A.js} +1 -1
  29. package/build/assets/{index-ChbiMLbp.js → index-BxnhSwtv.js} +1 -1
  30. package/build/assets/{index-DCoy2PDE.js → index-C-8qP7Ru.js} +1 -1
  31. package/build/assets/{index-DfeaHlsl.js → index-CGpWCLFI.js} +1 -1
  32. package/build/assets/{index-ocHxXLCt.js → index-CQr0CfvQ.js} +1 -1
  33. package/build/assets/{index-BMvzOjlv.js → index-CfZojTNf.js} +1 -1
  34. package/build/assets/{index-CVrdwKzt.js → index-D1bJoe6r.js} +1 -1
  35. package/build/assets/{index-wCYAC2ZH.js → index-DAb-Jtr2.js} +1 -1
  36. package/build/assets/{index-ax2rbmoZ.js → index-DBHyG99F.js} +1 -1
  37. package/build/assets/{index-CN5CjLsc.js → index-DFxMAoHY.js} +1 -1
  38. package/build/assets/{index-CS3tnJiL.js → index-DGjwMTQq.js} +1 -1
  39. package/build/assets/{index-COAtiAK0.js → index-DMAr4hNX.js} +1 -1
  40. package/build/assets/{index-Cbvbjd8C.js → index-DPBNUFWE.js} +4 -4
  41. package/build/assets/{index-bfhlF0Xi.js → index-DW2AfAPF.js} +1 -1
  42. package/build/assets/{index--NPqZQqZ.js → index-DcKJu6C9.js} +1 -1
  43. package/build/assets/{index-C_kIyk9w.js → index-Dk8gL3aI.js} +1 -1
  44. package/build/assets/{index-BBjBAKoV.js → index-DluRIgvs.js} +1 -1
  45. package/build/assets/{index-dalh9Y65.js → index-Dwbjahn_.js} +1 -1
  46. package/build/assets/{index-CLBVu_mK.js → index-DyGi5YBc.js} +1 -1
  47. package/build/assets/{index-DIBxvKdk.js → index-DzT-BaTB.js} +1 -1
  48. package/build/assets/{index-DSVyX96W.js → index-_GH5VSbG.js} +1 -1
  49. package/build/assets/{index-C8-4FAc1.js → index-_iQJZ8n8.js} +1 -1
  50. package/build/assets/{index-uxEQ8qdA.js → index-atxzdN1F.js} +1 -1
  51. package/build/assets/{index-Bcsdrj2S.js → index-c-NQS3qn.js} +5 -5
  52. package/build/assets/{index-2MeZae5n.js → index-rc6TuZ_x.js} +1 -1
  53. package/build/assets/{index-CWEVeVJ6.js → index-wWTCE5QI.js} +1 -1
  54. package/build/assets/{inherits-BaopKHev.js → inherits-83mK7fR9.js} +1 -1
  55. package/build/assets/{input-BH9uqfZf.js → input-CXi1-D16.js} +1 -1
  56. package/build/assets/{memory-DWTwf9Ch.js → memory-BtIreI5V.js} +1 -1
  57. package/build/assets/{mergeWith-Bt-C9xRx.js → mergeWith-DZ-wgSc6.js} +1 -1
  58. package/build/assets/{number-overlay-editor-Dm8-09pg.js → number-overlay-editor-BxuviOUl.js} +1 -1
  59. package/build/assets/{sandbox-DGYybjEz.js → sandbox-DHLnmH8d.js} +1 -1
  60. package/build/assets/{slicedToArray-CEuyIGI5.js → slicedToArray-Bj-RN7K3.js} +1 -1
  61. package/build/assets/{textarea-BKB-3cBX.js → textarea-BKD-emFb.js} +1 -1
  62. package/build/assets/{timepicker-B1BEcpbo.js → timepicker-CWkzEpyz.js} +1 -1
  63. package/build/assets/{uniqueId-BSuwhGjw.js → uniqueId-BGMRjdMp.js} +1 -1
  64. package/build/assets/{useBasicWidgetState-D3a9XYx3.js → useBasicWidgetState-uJo0naOA.js} +1 -1
  65. package/build/assets/{useOnInputChange-BlFu2GNS.js → useOnInputChange-DI3AnwSZ.js} +1 -1
  66. package/build/assets/{withFullScreenWrapper-D8NJOCKn.js → withFullScreenWrapper-DbD5_ijt.js} +1 -1
  67. package/build/assets/worker-DEam9hTF.js +105 -0
  68. package/build/electron/worker.js +9 -17
  69. package/build/index.html +1 -1
  70. package/package.json +5 -5
  71. package/wheels/stlite_lib-0.1.0-py3-none-any.whl +0 -0
  72. package/wheels/streamlit-1.45.1-cp312-none-any.whl +0 -0
  73. package/build/assets/worker-Cy9Gj5BL.js +0 -113
@@ -1 +1 @@
1
- import{r,b as J}from"./index-Cbvbjd8C.js";import{s as Q,i as P,a as U,b as Z,T as _,C as ee,m as te}from"./index-Bcsdrj2S.js";import"./FormClearHelper-CT0Jwp4X.js";import"./withFullScreenWrapper-D8NJOCKn.js";import"./Toolbar-DlGOP7h4.js";import"./checkbox-CGvNPQQ1.js";import"./mergeWith-Bt-C9xRx.js";import"./sprintf-D7DtBTRn.js";import"./createDownloadLinkElement-DZMwyjvU.js";import"./slicedToArray-CEuyIGI5.js";import"./inherits-BaopKHev.js";import"./createSuper-B8yCxQGq.js";import"./FileDownload.esm-CbXaPbiH.js";const re=()=>t=>t.targetX,ie=()=>t=>t.targetY,oe=()=>t=>t.targetWidth,ne=()=>t=>t.targetHeight,ae=()=>t=>t.targetY+10,se=()=>t=>Math.max(0,(t.targetHeight-28)/2),de=Q("div")({name:"DataGridOverlayEditorStyle",class:"gdg-d19meir1",propsAsIs:!1,vars:{"d19meir1-0":[ie(),"px"],"d19meir1-1":[re(),"px"],"d19meir1-2":[oe(),"px"],"d19meir1-3":[ne(),"px"],"d19meir1-4":[ae(),"px"],"d19meir1-5":[se(),"px"]}});function le(){const[t,n]=r.useState();return[t??void 0,n]}function ce(){const[t,n]=le(),[o,p]=r.useState(0),[g,b]=r.useState(!0);r.useLayoutEffect(()=>{if(t===void 0||!("IntersectionObserver"in window))return;const a=new IntersectionObserver(s=>{s.length!==0&&b(s[0].isIntersecting)},{threshold:1});return a.observe(t),()=>a.disconnect()},[t]),r.useEffect(()=>{if(g||t===void 0)return;let a;const s=()=>{const{right:k}=t.getBoundingClientRect();p(v=>Math.min(v+window.innerWidth-k-10,0)),a=requestAnimationFrame(s)};return a=requestAnimationFrame(s),()=>{a!==void 0&&cancelAnimationFrame(a)}},[t,g]);const C=r.useMemo(()=>({transform:`translateX(${o}px)`}),[o]);return{ref:n,style:C}}const ue=t=>{const{target:n,content:o,onFinishEditing:p,forceEditMode:g,initialValue:b,imageEditorOverride:C,markdownDivCreateNode:a,highlight:s,className:k,theme:v,id:V,cell:w,bloom:f,validateCell:c,getCellRenderer:M,provideEditor:x,isOutsideClick:W,customEventTarget:X}=t,[d,Y]=r.useState(g?o:void 0),O=r.useRef(d??o);O.current=d??o;const[h,N]=r.useState(()=>c===void 0?!0:!(P(o)&&(c==null?void 0:c(w,o,O.current))===!1)),u=r.useCallback((e,i)=>{p(h?e:void 0,i)},[h,p]),q=r.useCallback(e=>{if(c!==void 0&&e!==void 0&&P(e)){const i=c(w,e,O.current);i===!1?N(!1):(typeof i=="object"&&(e=i),N(!0))}Y(e)},[w,c]),y=r.useRef(!1),m=r.useRef(void 0),B=r.useCallback(()=>{u(d,[0,0]),y.current=!0},[d,u]),G=r.useCallback((e,i)=>{u(e,i??m.current??[0,0]),y.current=!0},[u]),j=r.useCallback(async e=>{let i=!1;e.key==="Escape"?(e.stopPropagation(),e.preventDefault(),m.current=[0,0]):e.key==="Enter"&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),m.current=[0,1],i=!0):e.key==="Tab"&&(e.stopPropagation(),e.preventDefault(),m.current=[e.shiftKey?-1:1,0],i=!0),window.setTimeout(()=>{!y.current&&m.current!==void 0&&(u(i?d:void 0,m.current),y.current=!0)},0)},[u,d]),S=d??o,[l,L]=r.useMemo(()=>{var e,i;if(U(o))return[];const K=x==null?void 0:x(o);return K!==void 0?[K,!1]:[(i=(e=M(o))==null?void 0:e.provideEditor)==null?void 0:i.call(e,o),!1]},[o,M,x]),{ref:$,style:z}=ce();let R=!0,F,I=!0,E;if(l!==void 0){R=l.disablePadding!==!0,I=l.disableStyling!==!0;const e=Z(l);e&&(E=l.styleOverride);const i=e?l.editor:l;F=r.createElement(i,{isHighlighted:s,onChange:q,value:S,initialValue:b,onFinishedEditing:G,validatedSelection:P(S)?S.selectionRange:void 0,forceEditMode:g,target:n,imageEditorOverride:C,markdownDivCreateNode:a,isValid:h,theme:v})}E={...E,...z};const T=document.getElementById("portal");if(T===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `<div id="portal" />` as the last child of your `<body>`.'),null;let D=I?"gdg-style":"gdg-unstyle";h||(D+=" gdg-invalid"),R&&(D+=" gdg-pad");const A=(f==null?void 0:f[0])??1,H=(f==null?void 0:f[1])??1;return J.createPortal(r.createElement(_.Provider,{value:v},r.createElement(ee,{style:te(v),className:k,onClickOutside:B,isOutsideClick:W,customEventTarget:X},r.createElement(de,{ref:$,id:V,className:D,style:E,as:L===!0?"label":void 0,targetX:n.x-A,targetY:n.y-H,targetWidth:n.width+A*2,targetHeight:n.height+H*2},r.createElement("div",{className:"gdg-clip-region",onKeyDown:j},F)))),T)};export{ue as default};
1
+ import{r,b as J}from"./index-DPBNUFWE.js";import{s as Q,i as P,a as U,b as Z,T as _,C as ee,m as te}from"./index-c-NQS3qn.js";import"./FormClearHelper-BZaxoxQN.js";import"./withFullScreenWrapper-DbD5_ijt.js";import"./Toolbar-bneC7vhq.js";import"./checkbox-Ce7VH5yR.js";import"./mergeWith-DZ-wgSc6.js";import"./sprintf-D7DtBTRn.js";import"./createDownloadLinkElement-DZMwyjvU.js";import"./slicedToArray-Bj-RN7K3.js";import"./inherits-83mK7fR9.js";import"./createSuper-Ce1x_8d5.js";import"./FileDownload.esm-5XDRJbc8.js";const re=()=>t=>t.targetX,ie=()=>t=>t.targetY,oe=()=>t=>t.targetWidth,ne=()=>t=>t.targetHeight,ae=()=>t=>t.targetY+10,se=()=>t=>Math.max(0,(t.targetHeight-28)/2),de=Q("div")({name:"DataGridOverlayEditorStyle",class:"gdg-d19meir1",propsAsIs:!1,vars:{"d19meir1-0":[ie(),"px"],"d19meir1-1":[re(),"px"],"d19meir1-2":[oe(),"px"],"d19meir1-3":[ne(),"px"],"d19meir1-4":[ae(),"px"],"d19meir1-5":[se(),"px"]}});function le(){const[t,n]=r.useState();return[t??void 0,n]}function ce(){const[t,n]=le(),[o,p]=r.useState(0),[g,b]=r.useState(!0);r.useLayoutEffect(()=>{if(t===void 0||!("IntersectionObserver"in window))return;const a=new IntersectionObserver(s=>{s.length!==0&&b(s[0].isIntersecting)},{threshold:1});return a.observe(t),()=>a.disconnect()},[t]),r.useEffect(()=>{if(g||t===void 0)return;let a;const s=()=>{const{right:k}=t.getBoundingClientRect();p(v=>Math.min(v+window.innerWidth-k-10,0)),a=requestAnimationFrame(s)};return a=requestAnimationFrame(s),()=>{a!==void 0&&cancelAnimationFrame(a)}},[t,g]);const C=r.useMemo(()=>({transform:`translateX(${o}px)`}),[o]);return{ref:n,style:C}}const ue=t=>{const{target:n,content:o,onFinishEditing:p,forceEditMode:g,initialValue:b,imageEditorOverride:C,markdownDivCreateNode:a,highlight:s,className:k,theme:v,id:V,cell:w,bloom:f,validateCell:c,getCellRenderer:M,provideEditor:x,isOutsideClick:W,customEventTarget:X}=t,[d,Y]=r.useState(g?o:void 0),O=r.useRef(d??o);O.current=d??o;const[h,N]=r.useState(()=>c===void 0?!0:!(P(o)&&(c==null?void 0:c(w,o,O.current))===!1)),u=r.useCallback((e,i)=>{p(h?e:void 0,i)},[h,p]),q=r.useCallback(e=>{if(c!==void 0&&e!==void 0&&P(e)){const i=c(w,e,O.current);i===!1?N(!1):(typeof i=="object"&&(e=i),N(!0))}Y(e)},[w,c]),y=r.useRef(!1),m=r.useRef(void 0),B=r.useCallback(()=>{u(d,[0,0]),y.current=!0},[d,u]),G=r.useCallback((e,i)=>{u(e,i??m.current??[0,0]),y.current=!0},[u]),j=r.useCallback(async e=>{let i=!1;e.key==="Escape"?(e.stopPropagation(),e.preventDefault(),m.current=[0,0]):e.key==="Enter"&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),m.current=[0,1],i=!0):e.key==="Tab"&&(e.stopPropagation(),e.preventDefault(),m.current=[e.shiftKey?-1:1,0],i=!0),window.setTimeout(()=>{!y.current&&m.current!==void 0&&(u(i?d:void 0,m.current),y.current=!0)},0)},[u,d]),S=d??o,[l,L]=r.useMemo(()=>{var e,i;if(U(o))return[];const K=x==null?void 0:x(o);return K!==void 0?[K,!1]:[(i=(e=M(o))==null?void 0:e.provideEditor)==null?void 0:i.call(e,o),!1]},[o,M,x]),{ref:$,style:z}=ce();let R=!0,F,I=!0,E;if(l!==void 0){R=l.disablePadding!==!0,I=l.disableStyling!==!0;const e=Z(l);e&&(E=l.styleOverride);const i=e?l.editor:l;F=r.createElement(i,{isHighlighted:s,onChange:q,value:S,initialValue:b,onFinishedEditing:G,validatedSelection:P(S)?S.selectionRange:void 0,forceEditMode:g,target:n,imageEditorOverride:C,markdownDivCreateNode:a,isValid:h,theme:v})}E={...E,...z};const T=document.getElementById("portal");if(T===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `<div id="portal" />` as the last child of your `<body>`.'),null;let D=I?"gdg-style":"gdg-unstyle";h||(D+=" gdg-invalid"),R&&(D+=" gdg-pad");const A=(f==null?void 0:f[0])??1,H=(f==null?void 0:f[1])??1;return J.createPortal(r.createElement(_.Provider,{value:v},r.createElement(ee,{style:te(v),className:k,onClickOutside:B,isOutsideClick:W,customEventTarget:X},r.createElement(de,{ref:$,id:V,className:D,style:E,as:L===!0?"label":void 0,targetX:n.x-A,targetY:n.y-H,targetWidth:n.width+A*2,targetHeight:n.height+H*2},r.createElement("div",{className:"gdg-clip-region",onKeyDown:j},F)))),T)};export{ue as default};
@@ -1 +1 @@
1
- import{c as f,e as v}from"./es6-Ca0BcWDW.js";import"./index-Cbvbjd8C.js";const{WritableStream:_,TransformStream:m,DOMException:P,Blob:u}=f,{GONE:M}=v,E=/constructor/i.test(window.HTMLElement);class T{constructor(e="unkown"){this.name=e,this.kind="file"}async getFile(){throw new P(...M)}async isSameEntry(e){return this===e}async createWritable(e={}){var t;const s=await((t=navigator.serviceWorker)==null?void 0:t.getRegistration()),o=document.createElement("a"),n=new m,g=n.writable;if(o.download=this.name,E||!s){let a=[];n.readable.pipeTo(new _({write(r){a.push(new u([r]))},close(){const r=new u(a,{type:"application/octet-stream; charset=utf-8"});a=[],o.href=URL.createObjectURL(r),o.click(),setTimeout(()=>URL.revokeObjectURL(o.href),1e4)}}))}else{const{writable:a,readablePort:r}=new F(_),i=encodeURIComponent(this.name).replace(/['()]/g,escape).replace(/\*/g,"%2A"),w={"content-disposition":"attachment; filename*=UTF-8''"+i,"content-type":"application/octet-stream; charset=utf-8",...e.size?{"content-length":e.size}:{}},R=setTimeout(()=>s.active.postMessage(0),1e4);n.readable.pipeThrough(new m({transform(l,h){if(l instanceof Uint8Array)return h.enqueue(l);const b=new Response(l).body.getReader(),p=S=>b.read().then(y=>y.done?0:p(h.enqueue(y.value)));return p()}})).pipeTo(a).finally(()=>{clearInterval(R)}),s.active.postMessage({url:s.scope+i,headers:w,readablePort:r},[r]);const c=document.createElement("iframe");c.hidden=!0,c.src=s.scope+i,document.body.appendChild(c)}return g.getWriter()}}const U=0,j=0,k=1,L=1,O=2;class W{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:U,chunk:e};return this._port.postMessage(t,[e.buffer]),this._resetReady(),this._readyPromise}close(){this._port.postMessage({type:O}),this._port.close()}abort(e){this._port.postMessage({type:L,reason:e}),this._port.close()}_onMessage(e){e.type===j&&this._resolveReady(),e.type===k&&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 F{constructor(e){const t=new MessageChannel;this.readablePort=t.port1,this.writable=new e(new W(t.port2))}}export{T as FileHandle};
1
+ import{c as f,e as v}from"./es6-eSFIFIhE.js";import"./index-DPBNUFWE.js";const{WritableStream:_,TransformStream:m,DOMException:P,Blob:u}=f,{GONE:M}=v,E=/constructor/i.test(window.HTMLElement);class T{constructor(e="unkown"){this.name=e,this.kind="file"}async getFile(){throw new P(...M)}async isSameEntry(e){return this===e}async createWritable(e={}){var t;const s=await((t=navigator.serviceWorker)==null?void 0:t.getRegistration()),o=document.createElement("a"),n=new m,g=n.writable;if(o.download=this.name,E||!s){let a=[];n.readable.pipeTo(new _({write(r){a.push(new u([r]))},close(){const r=new u(a,{type:"application/octet-stream; charset=utf-8"});a=[],o.href=URL.createObjectURL(r),o.click(),setTimeout(()=>URL.revokeObjectURL(o.href),1e4)}}))}else{const{writable:a,readablePort:r}=new F(_),i=encodeURIComponent(this.name).replace(/['()]/g,escape).replace(/\*/g,"%2A"),w={"content-disposition":"attachment; filename*=UTF-8''"+i,"content-type":"application/octet-stream; charset=utf-8",...e.size?{"content-length":e.size}:{}},R=setTimeout(()=>s.active.postMessage(0),1e4);n.readable.pipeThrough(new m({transform(l,h){if(l instanceof Uint8Array)return h.enqueue(l);const b=new Response(l).body.getReader(),p=S=>b.read().then(y=>y.done?0:p(h.enqueue(y.value)));return p()}})).pipeTo(a).finally(()=>{clearInterval(R)}),s.active.postMessage({url:s.scope+i,headers:w,readablePort:r},[r]);const c=document.createElement("iframe");c.hidden=!0,c.src=s.scope+i,document.body.appendChild(c)}return g.getWriter()}}const U=0,j=0,k=1,L=1,O=2;class W{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:U,chunk:e};return this._port.postMessage(t,[e.buffer]),this._resetReady(),this._readyPromise}close(){this._port.postMessage({type:O}),this._port.close()}abort(e){this._port.postMessage({type:L,reason:e}),this._port.close()}_onMessage(e){e.type===j&&this._resolveReady(),e.type===k&&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 F{constructor(e){const t=new MessageChannel;this.readablePort=t.port1,this.writable=new e(new W(t.port2))}}export{T as FileHandle};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/downloader-Cof1FiXt.js","assets/index-Cbvbjd8C.js","assets/index.Bqb_jNud.css","assets/sandbox-DGYybjEz.js","assets/memory-DWTwf9Ch.js"])))=>i.map(i=>d[i]);
2
- import{z as c,__tla as me}from"./index-Cbvbjd8C.js";let B,A,H,pe=Promise.all([(()=>{try{return me}catch{}})()]).then(async()=>{var $=Object.defineProperty,L=r=>{throw TypeError(r)},Y=(r,e,t)=>e in r?$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e,t)=>Y(r,typeof e!="symbol"?e+"":e,t),X=(r,e,t)=>e.has(r)||L("Cannot "+t),J=(r,e,t)=>e.has(r)?L("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),K=(r,e,t,n)=>(X(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);const x=globalThis.showDirectoryPicker;async function Q(r={}){if(x&&!r._preferPolyfill)return x(r);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=c(()=>Promise.resolve().then(()=>q),void 0);return await new Promise(n=>{e.addEventListener("change",n),e.click()}),t.then(n=>n.getDirHandlesFromInput(e))}const Z={accepts:[]},R=globalThis.showOpenFilePicker;async function ee(r={}){const e={...Z,...r};if(R&&!r._preferPolyfill)return R(e);const t=document.createElement("input");t.type="file",t.multiple=e.multiple,t.accept=(e.accepts||[]).map(s=>[...(s.extensions||[]).map(i=>"."+i),...s.mimeTypes||[]]).flat().join(","),Object.assign(t.style,{position:"fixed",top:"-100000px",left:"-100000px"}),document.body.appendChild(t);const n=c(()=>Promise.resolve().then(()=>q),void 0);return await new Promise(s=>{t.addEventListener("change",s,{once:!0}),t.click()}),t.remove(),n.then(s=>s.getFileHandlesFromInput(t))}const M=globalThis.showSaveFilePicker;async function te(r={}){if(M&&!r._preferPolyfill)return M(r);r._name&&(console.warn("deprecated _name, spec now have `suggestedName`"),r.suggestedName=r._name);const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:n}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:n}},void 0),{FileHandle:t}=await c(async()=>{const{FileHandle:n}=await import("./downloader-Cof1FiXt.js");return{FileHandle:n}},__vite__mapDeps([0,1,2]));return new e(new t(r.suggestedName))}globalThis.DataTransferItem&&!DataTransferItem.prototype.getAsFileSystemHandle&&(DataTransferItem.prototype.getAsFileSystemHandle=async function(){const r=this.webkitGetAsEntry(),[{FileHandle:e,FolderHandle:t},{FileSystemDirectoryHandle:n},{FileSystemFileHandle:s}]=await Promise.all([c(()=>import("./sandbox-DGYybjEz.js"),__vite__mapDeps([3,1,2])),c(()=>Promise.resolve().then(()=>T),void 0),c(()=>Promise.resolve().then(()=>u),void 0)]);return r.isFile?new s(new e(r,!1)):new n(new t(r,!1))});async function re(r,e={}){var t,n;if(!r)return((n=(t=globalThis.navigator)==null?void 0:t.storage)==null?void 0:n.getDirectory())||globalThis.getOriginPrivateDirectory();const{FileSystemDirectoryHandle:s}=await c(async()=>{const{FileSystemDirectoryHandle:y}=await Promise.resolve().then(()=>T);return{FileSystemDirectoryHandle:y}},void 0),i=await r,l=await(i.default?i.default(e):i(e));return new s(l)}let j;A={WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,DOMException:globalThis.DOMException,Blob:globalThis.Blob,File:globalThis.File},{WritableStream:j}=A;var O;const ae=class G extends j{constructor(e){super(e),J(this,O),K(this,O,e),Object.setPrototypeOf(this,G.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(),n=t.write(e);return t.releaseLock(),n}};O=new WeakMap;let b=ae;Object.defineProperty(b.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(b.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}}),globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable&&!globalThis.FileSystemWritableFileStream&&(globalThis.FileSystemWritableFileStream=b);const m=Symbol("adapter");var W;W=m;class v{constructor(e){g(this,W),g(this,"name"),g(this,"kind"),this.kind=e.kind,this.name=e.name,this[m]=e}async queryPermission(e={}){const{mode:t="read"}=e,n=this[m];if(n.queryPermission)return n.queryPermission({mode:t});if(t==="read")return"granted";if(t==="readwrite")return n.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(v.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});var N;globalThis.FileSystemHandle&&((N=globalThis.FileSystemHandle.prototype).queryPermission??(N.queryPermission=function(r){return"granted"}));let V;H={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:r=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${r}`,"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"]},V={writable:globalThis.WritableStream};async function ne(r){console.warn("deprecated fromDataTransfer - use `dt.items[0].getAsFileSystemHandle()` instead");const[e,t,n]=await Promise.all([c(()=>import("./memory-DWTwf9Ch.js"),__vite__mapDeps([4,1,2])),c(()=>import("./sandbox-DGYybjEz.js"),__vite__mapDeps([3,1,2])),c(()=>Promise.resolve().then(()=>T),void 0)]),s=new e.FolderHandle("",!1);return s._entries=r.map(i=>i.isFile?new t.FileHandle(i,!1):new t.FolderHandle(i,!1)),new n.FileSystemDirectoryHandle(s)}async function ie(r){const{FolderHandle:e,FileHandle:t}=await c(async()=>{const{FolderHandle:y,FileHandle:o}=await import("./memory-DWTwf9Ch.js");return{FolderHandle:y,FileHandle:o}},__vite__mapDeps([4,1,2])),{FileSystemDirectoryHandle:n}=await c(async()=>{const{FileSystemDirectoryHandle:y}=await Promise.resolve().then(()=>T);return{FileSystemDirectoryHandle:y}},void 0),s=Array.from(r.files),i=s[0].webkitRelativePath.split("/",1)[0],l=new e(i,!1);return s.forEach(y=>{const o=y.webkitRelativePath.split("/");o.shift();const d=o.pop(),w=o.reduce((h,f)=>(h._entries[f]||(h._entries[f]=new e(f,!1)),h._entries[f]),l);w._entries[d]=new t(y.name,y,!1)}),new n(l)}async function se(r){const{FileHandle:e}=await c(async()=>{const{FileHandle:n}=await import("./memory-DWTwf9Ch.js");return{FileHandle:n}},__vite__mapDeps([4,1,2])),{FileSystemFileHandle:t}=await c(async()=>{const{FileSystemFileHandle:n}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:n}},void 0);return Array.from(r.files).map(n=>new t(new e(n.name,n,!1)))}const q=Object.freeze(Object.defineProperty({__proto__:null,config:V,errors:H,fromDataTransfer:ne,getDirHandlesFromInput:ie,getFileHandlesFromInput:se},Symbol.toStringTag,{value:"Module"})),{GONE:oe,MOD_ERR:le}=H,p=Symbol("adapter");var z;let _=class D extends v{constructor(e){super(e),g(this,z),this[p]=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 n=await this[p].getDirectoryHandle(e,t);return new D(n)}async*entries(){const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:t}},void 0);for await(const[t,n]of this[p].entries())yield[n.name,n.kind==="file"?new e(n):new D(n)]}async*getEntries(){const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:t}},void 0);console.warn("deprecated, use .entries() instead");for await(let t of this[p].entries())yield t.kind==="file"?new e(t):new D(t)}async getFileHandle(e,t={}){const{FileSystemFileHandle:n}=await c(async()=>{const{FileSystemFileHandle:i}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:i}},void 0);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 s=await this[p].getFileHandle(e,t);return new n(s)}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[p].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:n,path:s}=t.pop();for await(const i of n.values()){if(await i.isSameEntry(e))return[...s,i.name];i.kind==="directory"&&t.push({handle:i,path:[...s,i.name]})}}return null}async*keys(){for await(const[e]of this[p].entries())yield e}async*values(){for await(const[e,t]of this)yield t}[(z=p,Symbol.asyncIterator)](){return this.entries()}};if(Object.defineProperty(_.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(_.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}}),globalThis.FileSystemDirectoryHandle){const r=globalThis.FileSystemDirectoryHandle.prototype;r.resolve=async function(s){if(await s.isSameEntry(this))return[];const i=[{handle:this,path:[]}];for(;i.length;){let{handle:l,path:y}=i.pop();for await(const o of l.values()){if(await o.isSameEntry(s))return[...y,o.name];o.kind==="directory"&&i.push({handle:o,path:[...y,o.name]})}}return null};async function e(s){if(await(await navigator.storage.getDirectory()).resolve(s)===null)throw new DOMException(...oe)}const t=r.entries;r.entries=async function*(){await e(this),yield*t.call(this)},r[Symbol.asyncIterator]=async function*(){yield*this.entries()};const n=r.removeEntry;r.removeEntry=async function(s,i={}){return n.call(this,s,i).catch(async l=>{throw l instanceof DOMException&&l.name==="UnknownError"&&!i.recursive&&!(await t.call(this).next()).done?new DOMException(...le):l})}}const T=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:_,default:_},Symbol.toStringTag,{value:"Module"})),{INVALID:ce,SYNTAX:k,GONE:ye}=H,P=Symbol("adapter");var U,C;class F extends(C=v,U=P,C){constructor(e){super(e),g(this,U),this[P]=e}async createWritable(e={}){return new b(await this[P].createWritable(e))}async getFile(){return this[P].getFile()}}if(Object.defineProperty(F.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(F.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}}),globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable){const r=new WeakMap;let e;const t=()=>{let s,i;onmessage=async l=>{const y=l.ports[0],o=l.data;switch(o.type){case"open":const d=o.name;let w=await navigator.storage.getDirectory();for(const h of o.path)w=await w.getDirectoryHandle(h);s=await w.getFileHandle(d),i=await s.createSyncAccessHandle();break;case"write":i.write(o.data,{at:o.position}),i.flush();break;case"truncate":i.truncate(o.size);break;case"abort":case"close":i.close();break}y.postMessage(0)}};globalThis.FileSystemFileHandle.prototype.createWritable=async function(s){if(!e){const a=`(${t.toString()})()`,S=new Blob([a],{type:"text/javascript"});e=URL.createObjectURL(S)}const i=new Worker(e,{type:"module"});let l=0;const y=new TextEncoder;let o=await this.getFile().then(a=>a.size);const d=a=>new Promise((S,de)=>{const E=new MessageChannel;E.port1.onmessage=I=>{I.data instanceof Error?de(I.data):S(I.data),E.port1.close(),E.port2.close(),E.port1.onmessage=null},i.postMessage(a,[E.port2])}),w=await navigator.storage.getDirectory(),h=await r.get(this),f=await w.resolve(h);if(f===null)throw new DOMException(...ye);return await d({type:"open",path:f,name:this.name}),(s==null?void 0:s.keepExistingData)===!1&&(await d({type:"truncate",size:0}),o=0),new b({start:a=>{},async write(a){if((a==null?void 0:a.constructor)===Object?a={...a}:a={type:"write",data:a,position:l},a.type==="write"){if(!("data"in a))throw await d({type:"close"}),new DOMException(...k("write requires a data argument"));if(a.position??(a.position=l),typeof a.data=="string")a.data=y.encode(a.data);else if(a.data instanceof ArrayBuffer)a.data=new Uint8Array(a.data);else if(!(a.data instanceof Uint8Array)&&ArrayBuffer.isView(a.data))a.data=new Uint8Array(a.data.buffer,a.data.byteOffset,a.data.byteLength);else if(!(a.data instanceof Uint8Array)){const S=await new Response(a.data).arrayBuffer();a.data=new Uint8Array(S)}Number.isInteger(a.position)&&a.position>=0&&(l=a.position),l+=a.data.byteLength,o+=a.data.byteLength}else if(a.type==="seek")if(Number.isInteger(a.position)&&a.position>=0){if(o<a.position)throw new DOMException(...ce);console.log("seeking",a),l=a.position;return}else throw await d({type:"close"}),new DOMException(...k("seek requires a position argument"));else if(a.type==="truncate")if(Number.isInteger(a.size)&&a.size>=0)o=a.size,l>o&&(l=o);else throw await d({type:"close"}),new DOMException(...k("truncate requires a size argument"));await d(a)},async close(){await d({type:"close"}),i.terminate()},async abort(a){await d({type:"abort",reason:a}),i.terminate()}})};const n=FileSystemDirectoryHandle.prototype.getFileHandle;FileSystemDirectoryHandle.prototype.getFileHandle=async function(...s){const i=await n.call(this,...s);return r.set(i,this),i}}let u;u=Object.freeze(Object.defineProperty({__proto__:null,FileSystemFileHandle:F,default:F},Symbol.toStringTag,{value:"Module"})),B=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:_,FileSystemFileHandle:F,FileSystemHandle:v,FileSystemWritableFileStream:b,getOriginPrivateDirectory:re,showDirectoryPicker:Q,showOpenFilePicker:ee,showSaveFilePicker:te},Symbol.toStringTag,{value:"Module"}))});export{pe as __tla,B as a,A as c,H as e};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/downloader-DTdoFA0u.js","assets/index-DPBNUFWE.js","assets/index.Bqb_jNud.css","assets/sandbox-DHLnmH8d.js","assets/memory-BtIreI5V.js"])))=>i.map(i=>d[i]);
2
+ import{z as c,__tla as me}from"./index-DPBNUFWE.js";let B,A,H,pe=Promise.all([(()=>{try{return me}catch{}})()]).then(async()=>{var $=Object.defineProperty,L=r=>{throw TypeError(r)},Y=(r,e,t)=>e in r?$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e,t)=>Y(r,typeof e!="symbol"?e+"":e,t),X=(r,e,t)=>e.has(r)||L("Cannot "+t),J=(r,e,t)=>e.has(r)?L("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),K=(r,e,t,n)=>(X(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);const x=globalThis.showDirectoryPicker;async function Q(r={}){if(x&&!r._preferPolyfill)return x(r);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=c(()=>Promise.resolve().then(()=>q),void 0);return await new Promise(n=>{e.addEventListener("change",n),e.click()}),t.then(n=>n.getDirHandlesFromInput(e))}const Z={accepts:[]},R=globalThis.showOpenFilePicker;async function ee(r={}){const e={...Z,...r};if(R&&!r._preferPolyfill)return R(e);const t=document.createElement("input");t.type="file",t.multiple=e.multiple,t.accept=(e.accepts||[]).map(s=>[...(s.extensions||[]).map(i=>"."+i),...s.mimeTypes||[]]).flat().join(","),Object.assign(t.style,{position:"fixed",top:"-100000px",left:"-100000px"}),document.body.appendChild(t);const n=c(()=>Promise.resolve().then(()=>q),void 0);return await new Promise(s=>{t.addEventListener("change",s,{once:!0}),t.click()}),t.remove(),n.then(s=>s.getFileHandlesFromInput(t))}const M=globalThis.showSaveFilePicker;async function te(r={}){if(M&&!r._preferPolyfill)return M(r);r._name&&(console.warn("deprecated _name, spec now have `suggestedName`"),r.suggestedName=r._name);const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:n}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:n}},void 0),{FileHandle:t}=await c(async()=>{const{FileHandle:n}=await import("./downloader-DTdoFA0u.js");return{FileHandle:n}},__vite__mapDeps([0,1,2]));return new e(new t(r.suggestedName))}globalThis.DataTransferItem&&!DataTransferItem.prototype.getAsFileSystemHandle&&(DataTransferItem.prototype.getAsFileSystemHandle=async function(){const r=this.webkitGetAsEntry(),[{FileHandle:e,FolderHandle:t},{FileSystemDirectoryHandle:n},{FileSystemFileHandle:s}]=await Promise.all([c(()=>import("./sandbox-DHLnmH8d.js"),__vite__mapDeps([3,1,2])),c(()=>Promise.resolve().then(()=>T),void 0),c(()=>Promise.resolve().then(()=>u),void 0)]);return r.isFile?new s(new e(r,!1)):new n(new t(r,!1))});async function re(r,e={}){var t,n;if(!r)return((n=(t=globalThis.navigator)==null?void 0:t.storage)==null?void 0:n.getDirectory())||globalThis.getOriginPrivateDirectory();const{FileSystemDirectoryHandle:s}=await c(async()=>{const{FileSystemDirectoryHandle:y}=await Promise.resolve().then(()=>T);return{FileSystemDirectoryHandle:y}},void 0),i=await r,l=await(i.default?i.default(e):i(e));return new s(l)}let j;A={WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,DOMException:globalThis.DOMException,Blob:globalThis.Blob,File:globalThis.File},{WritableStream:j}=A;var O;const ae=class G extends j{constructor(e){super(e),J(this,O),K(this,O,e),Object.setPrototypeOf(this,G.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(),n=t.write(e);return t.releaseLock(),n}};O=new WeakMap;let b=ae;Object.defineProperty(b.prototype,Symbol.toStringTag,{value:"FileSystemWritableFileStream",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(b.prototype,{close:{enumerable:!0},seek:{enumerable:!0},truncate:{enumerable:!0},write:{enumerable:!0}}),globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable&&!globalThis.FileSystemWritableFileStream&&(globalThis.FileSystemWritableFileStream=b);const m=Symbol("adapter");var W;W=m;class v{constructor(e){g(this,W),g(this,"name"),g(this,"kind"),this.kind=e.kind,this.name=e.name,this[m]=e}async queryPermission(e={}){const{mode:t="read"}=e,n=this[m];if(n.queryPermission)return n.queryPermission({mode:t});if(t==="read")return"granted";if(t==="readwrite")return n.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(v.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});var N;globalThis.FileSystemHandle&&((N=globalThis.FileSystemHandle.prototype).queryPermission??(N.queryPermission=function(r){return"granted"}));let V;H={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:r=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${r}`,"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"]},V={writable:globalThis.WritableStream};async function ne(r){console.warn("deprecated fromDataTransfer - use `dt.items[0].getAsFileSystemHandle()` instead");const[e,t,n]=await Promise.all([c(()=>import("./memory-BtIreI5V.js"),__vite__mapDeps([4,1,2])),c(()=>import("./sandbox-DHLnmH8d.js"),__vite__mapDeps([3,1,2])),c(()=>Promise.resolve().then(()=>T),void 0)]),s=new e.FolderHandle("",!1);return s._entries=r.map(i=>i.isFile?new t.FileHandle(i,!1):new t.FolderHandle(i,!1)),new n.FileSystemDirectoryHandle(s)}async function ie(r){const{FolderHandle:e,FileHandle:t}=await c(async()=>{const{FolderHandle:y,FileHandle:o}=await import("./memory-BtIreI5V.js");return{FolderHandle:y,FileHandle:o}},__vite__mapDeps([4,1,2])),{FileSystemDirectoryHandle:n}=await c(async()=>{const{FileSystemDirectoryHandle:y}=await Promise.resolve().then(()=>T);return{FileSystemDirectoryHandle:y}},void 0),s=Array.from(r.files),i=s[0].webkitRelativePath.split("/",1)[0],l=new e(i,!1);return s.forEach(y=>{const o=y.webkitRelativePath.split("/");o.shift();const d=o.pop(),w=o.reduce((h,f)=>(h._entries[f]||(h._entries[f]=new e(f,!1)),h._entries[f]),l);w._entries[d]=new t(y.name,y,!1)}),new n(l)}async function se(r){const{FileHandle:e}=await c(async()=>{const{FileHandle:n}=await import("./memory-BtIreI5V.js");return{FileHandle:n}},__vite__mapDeps([4,1,2])),{FileSystemFileHandle:t}=await c(async()=>{const{FileSystemFileHandle:n}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:n}},void 0);return Array.from(r.files).map(n=>new t(new e(n.name,n,!1)))}const q=Object.freeze(Object.defineProperty({__proto__:null,config:V,errors:H,fromDataTransfer:ne,getDirHandlesFromInput:ie,getFileHandlesFromInput:se},Symbol.toStringTag,{value:"Module"})),{GONE:oe,MOD_ERR:le}=H,p=Symbol("adapter");var z;let _=class D extends v{constructor(e){super(e),g(this,z),this[p]=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 n=await this[p].getDirectoryHandle(e,t);return new D(n)}async*entries(){const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:t}},void 0);for await(const[t,n]of this[p].entries())yield[n.name,n.kind==="file"?new e(n):new D(n)]}async*getEntries(){const{FileSystemFileHandle:e}=await c(async()=>{const{FileSystemFileHandle:t}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:t}},void 0);console.warn("deprecated, use .entries() instead");for await(let t of this[p].entries())yield t.kind==="file"?new e(t):new D(t)}async getFileHandle(e,t={}){const{FileSystemFileHandle:n}=await c(async()=>{const{FileSystemFileHandle:i}=await Promise.resolve().then(()=>u);return{FileSystemFileHandle:i}},void 0);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 s=await this[p].getFileHandle(e,t);return new n(s)}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[p].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:n,path:s}=t.pop();for await(const i of n.values()){if(await i.isSameEntry(e))return[...s,i.name];i.kind==="directory"&&t.push({handle:i,path:[...s,i.name]})}}return null}async*keys(){for await(const[e]of this[p].entries())yield e}async*values(){for await(const[e,t]of this)yield t}[(z=p,Symbol.asyncIterator)](){return this.entries()}};if(Object.defineProperty(_.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(_.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}}),globalThis.FileSystemDirectoryHandle){const r=globalThis.FileSystemDirectoryHandle.prototype;r.resolve=async function(s){if(await s.isSameEntry(this))return[];const i=[{handle:this,path:[]}];for(;i.length;){let{handle:l,path:y}=i.pop();for await(const o of l.values()){if(await o.isSameEntry(s))return[...y,o.name];o.kind==="directory"&&i.push({handle:o,path:[...y,o.name]})}}return null};async function e(s){if(await(await navigator.storage.getDirectory()).resolve(s)===null)throw new DOMException(...oe)}const t=r.entries;r.entries=async function*(){await e(this),yield*t.call(this)},r[Symbol.asyncIterator]=async function*(){yield*this.entries()};const n=r.removeEntry;r.removeEntry=async function(s,i={}){return n.call(this,s,i).catch(async l=>{throw l instanceof DOMException&&l.name==="UnknownError"&&!i.recursive&&!(await t.call(this).next()).done?new DOMException(...le):l})}}const T=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:_,default:_},Symbol.toStringTag,{value:"Module"})),{INVALID:ce,SYNTAX:k,GONE:ye}=H,P=Symbol("adapter");var U,C;class F extends(C=v,U=P,C){constructor(e){super(e),g(this,U),this[P]=e}async createWritable(e={}){return new b(await this[P].createWritable(e))}async getFile(){return this[P].getFile()}}if(Object.defineProperty(F.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(F.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}}),globalThis.FileSystemFileHandle&&!globalThis.FileSystemFileHandle.prototype.createWritable){const r=new WeakMap;let e;const t=()=>{let s,i;onmessage=async l=>{const y=l.ports[0],o=l.data;switch(o.type){case"open":const d=o.name;let w=await navigator.storage.getDirectory();for(const h of o.path)w=await w.getDirectoryHandle(h);s=await w.getFileHandle(d),i=await s.createSyncAccessHandle();break;case"write":i.write(o.data,{at:o.position}),i.flush();break;case"truncate":i.truncate(o.size);break;case"abort":case"close":i.close();break}y.postMessage(0)}};globalThis.FileSystemFileHandle.prototype.createWritable=async function(s){if(!e){const a=`(${t.toString()})()`,S=new Blob([a],{type:"text/javascript"});e=URL.createObjectURL(S)}const i=new Worker(e,{type:"module"});let l=0;const y=new TextEncoder;let o=await this.getFile().then(a=>a.size);const d=a=>new Promise((S,de)=>{const E=new MessageChannel;E.port1.onmessage=I=>{I.data instanceof Error?de(I.data):S(I.data),E.port1.close(),E.port2.close(),E.port1.onmessage=null},i.postMessage(a,[E.port2])}),w=await navigator.storage.getDirectory(),h=await r.get(this),f=await w.resolve(h);if(f===null)throw new DOMException(...ye);return await d({type:"open",path:f,name:this.name}),(s==null?void 0:s.keepExistingData)===!1&&(await d({type:"truncate",size:0}),o=0),new b({start:a=>{},async write(a){if((a==null?void 0:a.constructor)===Object?a={...a}:a={type:"write",data:a,position:l},a.type==="write"){if(!("data"in a))throw await d({type:"close"}),new DOMException(...k("write requires a data argument"));if(a.position??(a.position=l),typeof a.data=="string")a.data=y.encode(a.data);else if(a.data instanceof ArrayBuffer)a.data=new Uint8Array(a.data);else if(!(a.data instanceof Uint8Array)&&ArrayBuffer.isView(a.data))a.data=new Uint8Array(a.data.buffer,a.data.byteOffset,a.data.byteLength);else if(!(a.data instanceof Uint8Array)){const S=await new Response(a.data).arrayBuffer();a.data=new Uint8Array(S)}Number.isInteger(a.position)&&a.position>=0&&(l=a.position),l+=a.data.byteLength,o+=a.data.byteLength}else if(a.type==="seek")if(Number.isInteger(a.position)&&a.position>=0){if(o<a.position)throw new DOMException(...ce);console.log("seeking",a),l=a.position;return}else throw await d({type:"close"}),new DOMException(...k("seek requires a position argument"));else if(a.type==="truncate")if(Number.isInteger(a.size)&&a.size>=0)o=a.size,l>o&&(l=o);else throw await d({type:"close"}),new DOMException(...k("truncate requires a size argument"));await d(a)},async close(){await d({type:"close"}),i.terminate()},async abort(a){await d({type:"abort",reason:a}),i.terminate()}})};const n=FileSystemDirectoryHandle.prototype.getFileHandle;FileSystemDirectoryHandle.prototype.getFileHandle=async function(...s){const i=await n.call(this,...s);return r.set(i,this),i}}let u;u=Object.freeze(Object.defineProperty({__proto__:null,FileSystemFileHandle:F,default:F},Symbol.toStringTag,{value:"Module"})),B=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:_,FileSystemFileHandle:F,FileSystemHandle:v,FileSystemWritableFileStream:b,getOriginPrivateDirectory:re,showDirectoryPicker:Q,showOpenFilePicker:ee,showSaveFilePicker:te},Symbol.toStringTag,{value:"Module"}))});export{pe as __tla,B as a,A as c,H as e};
@@ -1 +1 @@
1
- import{g as it}from"./index-Cbvbjd8C.js";function rt(x,u){for(var p=0;p<u.length;p++){const S=u[p];if(typeof S!="string"&&!Array.isArray(S)){for(const O in S)if(O!=="default"&&!(O in x)){const M=Object.getOwnPropertyDescriptor(S,O);M&&Object.defineProperty(x,O,M.get?M:{enumerable:!0,get:()=>S[O]})}}}return Object.freeze(Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}))}var ke={exports:{}},Le;function at(){return Le||(Le=1,function(x){(function(u){if(typeof window>"u")return;var p=!0,S=10,O="",M=0,j="",J=null,ie="",D=!1,Fe={resize:1,click:1},U=128,re=!0,R=1,_="bodyOffset",h=_,ae=!0,ce="",k={},I=32,ue=null,V=!1,X=!1,q="[iFrameSizer]",se=q.length,H="",de={max:1,min:1,bodyScroll:1,documentElementScroll:1},Y="child",le=window.parent,L="*",K=0,W=!1,fe=null,P=16,F=1,me="scroll",v=me,je=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={},ge=!1;function he(){}try{var pe=Object.create({},{passive:{get:function(){ge=!0}}});window.addEventListener("test",he,pe),window.removeEventListener("test",he,pe)}catch{}function z(e,t,n,o){e.addEventListener(t,n,ge?o||{}:!1)}function De(e,t,n){e.removeEventListener(t,n,!1)}function ve(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qe(e){var t,n,o,a=null,d=0,m=function(){d=Date.now(),a=null,o=e.apply(t,n),a||(t=n=null)};return function(){var f=Date.now();d||(d=f);var c=P-(f-d);return t=this,n=arguments,c<=0||c>P?(a&&(clearTimeout(a),a=null),d=f,o=e.apply(t,n),a||(t=n=null)):a||(a=setTimeout(m,c)),o}}function ye(e){return q+"["+H+"] "+e}function i(e){V&&typeof window.console=="object"&&console.log(ye(e))}function T(e){typeof window.console=="object"&&console.warn(ye(e))}function He(){We(),i("Initialising iFrame ("+window.location.href+")"),Je(),_e(),te("background",O),te("padding",ie),Ke(),Te(),Ee(),Ve(),Ze(),Ge(),Oe(),k=Qe(),A("init","Init message from host page"),G()}function We(){function e(n){return n==="true"}var t=ce.slice(se).split(":");H=t[0],M=u===t[1]?M:Number(t[1]),D=u===t[2]?D:e(t[2]),V=u===t[3]?V:e(t[3]),I=u===t[4]?I:Number(t[4]),p=u===t[6]?p:e(t[6]),j=t[7],h=u===t[8]?h:t[8],O=t[9],ie=t[10],K=u===t[11]?K:Number(t[11]),k.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 Be(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 Je(){function e(){var n=window.iFrameResizer;i("Reading data from page: "+JSON.stringify(n)),Object.keys(n).forEach(Be,n),Q="onMessage"in n?n.onMessage:Q,G="onReady"in n?n.onReady:G,L="targetOrigin"in n?n.targetOrigin:L,h="heightCalculationMethod"in n?n.heightCalculationMethod:h,v="widthCalculationMethod"in n?n.widthCalculationMethod:v}function t(n,o){return typeof n=="function"&&(i("Setup custom "+o+"CalcMethod"),$[o]=n,n="custom"),n}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),h=t(h,"height"),v=t(v,"width")),i("TargetOrigin for parent set to: "+L)}function Ue(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,i("Body "+e+' set to "'+t+'"'))}function _e(){u===j&&(j=M+"px"),te("margin",Ue("margin",j))}function Ve(){document.documentElement.style.height="",document.body.style.height="",i('HTML & body height set to "auto"')}function g(e){var t={add:function(n){function o(){A(e.eventName,e.eventType)}ee[n]=o,z(window,n,o,{passive:!0})},remove:function(n){var o=ee[n];delete ee[n],De(window,n,o)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),i(ve(e.method)+" event listener: "+e.eventType)}function we(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 be(e,t,n,o){return t!==e&&(e in n||(T(e+" is not a valid option for "+o+"CalculationMethod."),e=t),i(o+' calculation method set to "'+e+'"')),e}function Te(){h=be(h,_,E,"height")}function Ee(){v=be(v,me,N,"width")}function Oe(){p===!0?(we("add"),et()):i("Auto Resize disabled")}function Xe(){J!==null&&J.disconnect()}function Ye(){we("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(c){var s=c.getBoundingClientRect(),l=e();return{x:parseInt(s.left,10)+parseInt(l.x,10),y:parseInt(s.top,10)+parseInt(l.y,10)}}function n(c){function s(b){var C=t(b);i("Moving to in page link (#"+l+") at x: "+C.x+" y: "+C.y),y(C.y,C.x,"scrollToOffset")}var l=c.split("#")[1]||c,r=decodeURIComponent(l),w=document.getElementById(r)||document.getElementsByName(r)[0];u===w?(i("In page link (#"+l+") not found in iFrame, so sending to parent"),y(0,0,"inPageLink","#"+l)):s(w)}function o(){var c=window.location.hash,s=window.location.href;c!==""&&c!=="#"&&n(s)}function a(){function c(s){function l(r){r.preventDefault(),n(this.getAttribute("href"))}s.getAttribute("href")!=="#"&&z(s,"click",l)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),c)}function d(){z(window,"hashchange",o)}function m(){setTimeout(o,U)}function f(){Array.prototype.forEach&&document.querySelectorAll?(i("Setting up location.hash handlers"),a(),d(),m()):T("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return k.enable?f():i("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,o){i("Add event listener: "+o),z(window.document,n,e)}t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave")}function Ze(){i("Enable public methods"),je.parentIFrame={autoResize:function(e){return e===!0&&p===!1?(p=!0,Oe()):e===!1&&p===!0&&(p=!1,Ye()),y(0,0,"autoResize",JSON.stringify(p)),p},close:function(){y(0,0,"close")},getId:function(){return H},getPageInfo:function(e){typeof e=="function"?(Z=e,y(0,0,"pageInfo")):(Z=function(){},y(0,0,"pageInfoStop"))},moveToAnchor:function(e){k.findTarget(e)},reset:function(){Ce("parentIFrame.reset")},scrollTo:function(e,t){y(t,e,"scrollTo")},scrollToOffset:function(e,t){y(t,e,"scrollToOffset")},sendMessage:function(e,t){y(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod:function(e){h=e,Te()},setWidthCalculationMethod:function(e){v=e,Ee()},setTargetOrigin:function(e){i("Set targetOrigin: "+e),L=e},size:function(e,t){var n=""+(e||"")+(t?","+t:"");A("size","parentIFrame.size("+n+")",e,t)}}}function Se(){I!==0&&(i("setInterval: "+I+"ms"),ue=setInterval(function(){A("interval","setInterval: "+I)},Math.abs(I)))}function $e(){function e(r){function w(b){b.complete===!1&&(i("Attach listeners to "+b.src),b.addEventListener("load",a,!1),b.addEventListener("error",d,!1),c.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){c.splice(c.indexOf(r),1)}function n(r){i("Remove listeners from "+r.src),r.removeEventListener("load",a,!1),r.removeEventListener("error",d,!1),t(r)}function o(r,w,b){n(r.target),A(w,b+": "+r.target.src)}function a(r){o(r,"imageLoad","Image loaded")}function d(r){o(r,"imageLoadFailed","Image load failed")}function m(r){A("mutationObserver","mutationObserver: "+r[0].target+" "+r[0].type),r.forEach(e)}function f(){var r=document.querySelector("body"),w={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return l=new s(m),i("Create body MutationObserver"),l.observe(r,w),l}var c=[],s=window.MutationObserver||window.WebKitMutationObserver,l=f();return{disconnect:function(){"disconnect"in l&&(i("Disconnect body MutationObserver"),l.disconnect(),c.forEach(n))}}}function et(){var e=0>I;window.MutationObserver||window.WebKitMutationObserver?e?Se():J=$e():(i("MutationObserver not supported in this browser!"),Se())}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,S)}function tt(e){e>P/2&&(P=2*e,i("Event throttle increased to "+P+"ms"))}function oe(e,t){for(var n=t.length,o=0,a=0,d=ve(e),m=Date.now(),f=0;f<n;f++)o=t[f].getBoundingClientRect()[e]+ne("margin"+d,t[f]),o>a&&(a=o);return m=Date.now()-m,i("Parsed "+n+" HTML elements"),i("Element position calculated in "+m+"ms"),tt(m),a}function B(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function Me(e,t){function n(){return T("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")}var o=document.querySelectorAll("["+t+"]");return o.length===0&&n(),oe(e,o)}function Ie(){return document.querySelectorAll("body *")}var E={bodyOffset:function(){return document.body.offsetHeight+ne("marginTop")+ne("marginBottom")},offset:function(){return E.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,B(E))},min:function(){return Math.min.apply(null,B(E))},grow:function(){return E.max()},lowestElement:function(){return Math.max(E.bodyOffset()||E.documentElementOffset(),oe("bottom",Ie()))},taggedElement:function(){return Me("bottom","data-iframe-height")}},N={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(N.bodyScroll(),N.documentElementScroll())},max:function(){return Math.max.apply(null,B(N))},min:function(){return Math.min.apply(null,B(N))},rightMostElement:function(){return oe("right",Ie())},taggedElement:function(){return Me("right","data-iframe-width")}};function Ne(e,t,n,o){function a(){R=l,F=r,y(R,F,e)}function d(){function w(b,C){var ot=Math.abs(b-C)<=K;return!ot}return l=u===n?E[h]():n,r=u===o?N[v]():o,w(R,l)||D&&w(F,r)}function m(){return!(e in{init:1,interval:1,size:1})}function f(){return h in de||D&&v in de}function c(){i("No change in size detected")}function s(){m()&&f()?Ce(t):e in{interval:1}||c()}var l,r;d()||e==="init"?(Ae(),a()):s()}var nt=qe(Ne);function A(e,t,n,o){function a(){e in{reset:1,resetPage:1,init:1}||i("Trigger event: "+t)}function d(){return W&&e in Fe}d()?i("Trigger event cancelled: "+e):(a(),e==="init"?Ne(e,t,n,o):nt(e,t,n,o))}function Ae(){W||(W=!0,i("Trigger event lock on")),clearTimeout(fe),fe=setTimeout(function(){W=!1,i("Trigger event lock off"),i("--")},U)}function ze(e){R=E[h](),F=N[v](),y(R,F,e)}function Ce(e){var t=h;h=_,i("Reset trigger event: "+e),Ae(),ze("reset"),h=t}function y(e,t,n,o,a){function d(){u===a?a=L:i("Message targetOrigin: "+a)}function m(){var f=e+":"+t,c=H+":"+f+":"+n+(u===o?"":":"+o);i("Sending message to host page ("+c+")"),le.postMessage(q+c,a)}d(),m()}function xe(e){var t={init:function(){ce=e.data,le=e.source,He(),re=!1,setTimeout(function(){ae=!1},U)},reset:function(){ae?i("Page reset ignored by init"):(i("Page size reset by host page"),ze("resetPage"))},resize:function(){A("resizeParent","Parent window requested size check")},moveToAnchor:function(){k.findTarget(a())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var s=a();i("PageInfoFromParent called from parent: "+s),Z(JSON.parse(s)),i(" --")},message:function(){var s=a();i("onMessage called from parent: "+s),Q(JSON.parse(s)),i(" --")}};function n(){return q===(""+e.data).slice(0,se)}function o(){return e.data.split("]")[1].split(":")[0]}function a(){return e.data.slice(e.data.indexOf(":")+1)}function d(){return!x.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 f(){var s=o();s in t?t[s]():!d()&&!m()&&T("Unexpected message ("+e.data+")")}function c(){re===!1?f():m()?t.init():i('Ignored message of type "'+o()+'". Received before initialization.')}n()&&c()}function Re(){document.readyState!=="loading"&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeResizer"in window||(window.iframeChildListener=function(e){xe({data:e})},z(window,"message",xe),z(window,"readystatechange",Re),Re())})()}(ke)),ke.exports}var Pe=at();const ct=it(Pe),ut=rt({__proto__:null,default:ct},[Pe]);export{ut as i};
1
+ import{g as it}from"./index-DPBNUFWE.js";function rt(x,u){for(var p=0;p<u.length;p++){const S=u[p];if(typeof S!="string"&&!Array.isArray(S)){for(const O in S)if(O!=="default"&&!(O in x)){const M=Object.getOwnPropertyDescriptor(S,O);M&&Object.defineProperty(x,O,M.get?M:{enumerable:!0,get:()=>S[O]})}}}return Object.freeze(Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}))}var ke={exports:{}},Le;function at(){return Le||(Le=1,function(x){(function(u){if(typeof window>"u")return;var p=!0,S=10,O="",M=0,j="",J=null,ie="",D=!1,Fe={resize:1,click:1},U=128,re=!0,R=1,_="bodyOffset",h=_,ae=!0,ce="",k={},I=32,ue=null,V=!1,X=!1,q="[iFrameSizer]",se=q.length,H="",de={max:1,min:1,bodyScroll:1,documentElementScroll:1},Y="child",le=window.parent,L="*",K=0,W=!1,fe=null,P=16,F=1,me="scroll",v=me,je=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={},ge=!1;function he(){}try{var pe=Object.create({},{passive:{get:function(){ge=!0}}});window.addEventListener("test",he,pe),window.removeEventListener("test",he,pe)}catch{}function z(e,t,n,o){e.addEventListener(t,n,ge?o||{}:!1)}function De(e,t,n){e.removeEventListener(t,n,!1)}function ve(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qe(e){var t,n,o,a=null,d=0,m=function(){d=Date.now(),a=null,o=e.apply(t,n),a||(t=n=null)};return function(){var f=Date.now();d||(d=f);var c=P-(f-d);return t=this,n=arguments,c<=0||c>P?(a&&(clearTimeout(a),a=null),d=f,o=e.apply(t,n),a||(t=n=null)):a||(a=setTimeout(m,c)),o}}function ye(e){return q+"["+H+"] "+e}function i(e){V&&typeof window.console=="object"&&console.log(ye(e))}function T(e){typeof window.console=="object"&&console.warn(ye(e))}function He(){We(),i("Initialising iFrame ("+window.location.href+")"),Je(),_e(),te("background",O),te("padding",ie),Ke(),Te(),Ee(),Ve(),Ze(),Ge(),Oe(),k=Qe(),A("init","Init message from host page"),G()}function We(){function e(n){return n==="true"}var t=ce.slice(se).split(":");H=t[0],M=u===t[1]?M:Number(t[1]),D=u===t[2]?D:e(t[2]),V=u===t[3]?V:e(t[3]),I=u===t[4]?I:Number(t[4]),p=u===t[6]?p:e(t[6]),j=t[7],h=u===t[8]?h:t[8],O=t[9],ie=t[10],K=u===t[11]?K:Number(t[11]),k.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 Be(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 Je(){function e(){var n=window.iFrameResizer;i("Reading data from page: "+JSON.stringify(n)),Object.keys(n).forEach(Be,n),Q="onMessage"in n?n.onMessage:Q,G="onReady"in n?n.onReady:G,L="targetOrigin"in n?n.targetOrigin:L,h="heightCalculationMethod"in n?n.heightCalculationMethod:h,v="widthCalculationMethod"in n?n.widthCalculationMethod:v}function t(n,o){return typeof n=="function"&&(i("Setup custom "+o+"CalcMethod"),$[o]=n,n="custom"),n}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),h=t(h,"height"),v=t(v,"width")),i("TargetOrigin for parent set to: "+L)}function Ue(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,i("Body "+e+' set to "'+t+'"'))}function _e(){u===j&&(j=M+"px"),te("margin",Ue("margin",j))}function Ve(){document.documentElement.style.height="",document.body.style.height="",i('HTML & body height set to "auto"')}function g(e){var t={add:function(n){function o(){A(e.eventName,e.eventType)}ee[n]=o,z(window,n,o,{passive:!0})},remove:function(n){var o=ee[n];delete ee[n],De(window,n,o)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),i(ve(e.method)+" event listener: "+e.eventType)}function we(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 be(e,t,n,o){return t!==e&&(e in n||(T(e+" is not a valid option for "+o+"CalculationMethod."),e=t),i(o+' calculation method set to "'+e+'"')),e}function Te(){h=be(h,_,E,"height")}function Ee(){v=be(v,me,N,"width")}function Oe(){p===!0?(we("add"),et()):i("Auto Resize disabled")}function Xe(){J!==null&&J.disconnect()}function Ye(){we("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(c){var s=c.getBoundingClientRect(),l=e();return{x:parseInt(s.left,10)+parseInt(l.x,10),y:parseInt(s.top,10)+parseInt(l.y,10)}}function n(c){function s(b){var C=t(b);i("Moving to in page link (#"+l+") at x: "+C.x+" y: "+C.y),y(C.y,C.x,"scrollToOffset")}var l=c.split("#")[1]||c,r=decodeURIComponent(l),w=document.getElementById(r)||document.getElementsByName(r)[0];u===w?(i("In page link (#"+l+") not found in iFrame, so sending to parent"),y(0,0,"inPageLink","#"+l)):s(w)}function o(){var c=window.location.hash,s=window.location.href;c!==""&&c!=="#"&&n(s)}function a(){function c(s){function l(r){r.preventDefault(),n(this.getAttribute("href"))}s.getAttribute("href")!=="#"&&z(s,"click",l)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),c)}function d(){z(window,"hashchange",o)}function m(){setTimeout(o,U)}function f(){Array.prototype.forEach&&document.querySelectorAll?(i("Setting up location.hash handlers"),a(),d(),m()):T("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return k.enable?f():i("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,o){i("Add event listener: "+o),z(window.document,n,e)}t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave")}function Ze(){i("Enable public methods"),je.parentIFrame={autoResize:function(e){return e===!0&&p===!1?(p=!0,Oe()):e===!1&&p===!0&&(p=!1,Ye()),y(0,0,"autoResize",JSON.stringify(p)),p},close:function(){y(0,0,"close")},getId:function(){return H},getPageInfo:function(e){typeof e=="function"?(Z=e,y(0,0,"pageInfo")):(Z=function(){},y(0,0,"pageInfoStop"))},moveToAnchor:function(e){k.findTarget(e)},reset:function(){Ce("parentIFrame.reset")},scrollTo:function(e,t){y(t,e,"scrollTo")},scrollToOffset:function(e,t){y(t,e,"scrollToOffset")},sendMessage:function(e,t){y(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod:function(e){h=e,Te()},setWidthCalculationMethod:function(e){v=e,Ee()},setTargetOrigin:function(e){i("Set targetOrigin: "+e),L=e},size:function(e,t){var n=""+(e||"")+(t?","+t:"");A("size","parentIFrame.size("+n+")",e,t)}}}function Se(){I!==0&&(i("setInterval: "+I+"ms"),ue=setInterval(function(){A("interval","setInterval: "+I)},Math.abs(I)))}function $e(){function e(r){function w(b){b.complete===!1&&(i("Attach listeners to "+b.src),b.addEventListener("load",a,!1),b.addEventListener("error",d,!1),c.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){c.splice(c.indexOf(r),1)}function n(r){i("Remove listeners from "+r.src),r.removeEventListener("load",a,!1),r.removeEventListener("error",d,!1),t(r)}function o(r,w,b){n(r.target),A(w,b+": "+r.target.src)}function a(r){o(r,"imageLoad","Image loaded")}function d(r){o(r,"imageLoadFailed","Image load failed")}function m(r){A("mutationObserver","mutationObserver: "+r[0].target+" "+r[0].type),r.forEach(e)}function f(){var r=document.querySelector("body"),w={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return l=new s(m),i("Create body MutationObserver"),l.observe(r,w),l}var c=[],s=window.MutationObserver||window.WebKitMutationObserver,l=f();return{disconnect:function(){"disconnect"in l&&(i("Disconnect body MutationObserver"),l.disconnect(),c.forEach(n))}}}function et(){var e=0>I;window.MutationObserver||window.WebKitMutationObserver?e?Se():J=$e():(i("MutationObserver not supported in this browser!"),Se())}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,S)}function tt(e){e>P/2&&(P=2*e,i("Event throttle increased to "+P+"ms"))}function oe(e,t){for(var n=t.length,o=0,a=0,d=ve(e),m=Date.now(),f=0;f<n;f++)o=t[f].getBoundingClientRect()[e]+ne("margin"+d,t[f]),o>a&&(a=o);return m=Date.now()-m,i("Parsed "+n+" HTML elements"),i("Element position calculated in "+m+"ms"),tt(m),a}function B(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function Me(e,t){function n(){return T("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")}var o=document.querySelectorAll("["+t+"]");return o.length===0&&n(),oe(e,o)}function Ie(){return document.querySelectorAll("body *")}var E={bodyOffset:function(){return document.body.offsetHeight+ne("marginTop")+ne("marginBottom")},offset:function(){return E.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,B(E))},min:function(){return Math.min.apply(null,B(E))},grow:function(){return E.max()},lowestElement:function(){return Math.max(E.bodyOffset()||E.documentElementOffset(),oe("bottom",Ie()))},taggedElement:function(){return Me("bottom","data-iframe-height")}},N={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(N.bodyScroll(),N.documentElementScroll())},max:function(){return Math.max.apply(null,B(N))},min:function(){return Math.min.apply(null,B(N))},rightMostElement:function(){return oe("right",Ie())},taggedElement:function(){return Me("right","data-iframe-width")}};function Ne(e,t,n,o){function a(){R=l,F=r,y(R,F,e)}function d(){function w(b,C){var ot=Math.abs(b-C)<=K;return!ot}return l=u===n?E[h]():n,r=u===o?N[v]():o,w(R,l)||D&&w(F,r)}function m(){return!(e in{init:1,interval:1,size:1})}function f(){return h in de||D&&v in de}function c(){i("No change in size detected")}function s(){m()&&f()?Ce(t):e in{interval:1}||c()}var l,r;d()||e==="init"?(Ae(),a()):s()}var nt=qe(Ne);function A(e,t,n,o){function a(){e in{reset:1,resetPage:1,init:1}||i("Trigger event: "+t)}function d(){return W&&e in Fe}d()?i("Trigger event cancelled: "+e):(a(),e==="init"?Ne(e,t,n,o):nt(e,t,n,o))}function Ae(){W||(W=!0,i("Trigger event lock on")),clearTimeout(fe),fe=setTimeout(function(){W=!1,i("Trigger event lock off"),i("--")},U)}function ze(e){R=E[h](),F=N[v](),y(R,F,e)}function Ce(e){var t=h;h=_,i("Reset trigger event: "+e),Ae(),ze("reset"),h=t}function y(e,t,n,o,a){function d(){u===a?a=L:i("Message targetOrigin: "+a)}function m(){var f=e+":"+t,c=H+":"+f+":"+n+(u===o?"":":"+o);i("Sending message to host page ("+c+")"),le.postMessage(q+c,a)}d(),m()}function xe(e){var t={init:function(){ce=e.data,le=e.source,He(),re=!1,setTimeout(function(){ae=!1},U)},reset:function(){ae?i("Page reset ignored by init"):(i("Page size reset by host page"),ze("resetPage"))},resize:function(){A("resizeParent","Parent window requested size check")},moveToAnchor:function(){k.findTarget(a())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var s=a();i("PageInfoFromParent called from parent: "+s),Z(JSON.parse(s)),i(" --")},message:function(){var s=a();i("onMessage called from parent: "+s),Q(JSON.parse(s)),i(" --")}};function n(){return q===(""+e.data).slice(0,se)}function o(){return e.data.split("]")[1].split(":")[0]}function a(){return e.data.slice(e.data.indexOf(":")+1)}function d(){return!x.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 f(){var s=o();s in t?t[s]():!d()&&!m()&&T("Unexpected message ("+e.data+")")}function c(){re===!1?f():m()?t.init():i('Ignored message of type "'+o()+'". Received before initialization.')}n()&&c()}function Re(){document.readyState!=="loading"&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeResizer"in window||(window.iframeChildListener=function(e){xe({data:e})},z(window,"message",xe),z(window,"readystatechange",Re),Re())})()}(ke)),ke.exports}var Pe=at();const ct=it(Pe),ut=rt({__proto__:null,default:ct},[Pe]);export{ut as i};
@@ -1 +1 @@
1
- import{r,bP as w,A as H,c_ as x,j as s,bZ as _,b_ as A,cc as D,b$ as E,bI as P}from"./index-Cbvbjd8C.js";import{u as U}from"./uniqueId-BSuwhGjw.js";import{u as B,a as L,b as M}from"./useOnInputChange-BlFu2GNS.js";import{I as $}from"./InputInstructions-Cyg7opie.js";import{a as G}from"./useBasicWidgetState-D3a9XYx3.js";import{T as K}from"./textarea-BKB-3cBX.js";import"./inputUtils-CQWz5UKz.js";import"./FormClearHelper-CT0Jwp4X.js";import"./base-input-BnIlcFzX.js";const W=(a,e)=>a.getStringValue(e)??e.default??null,N=a=>a.default??null,O=a=>a.value??null,Z=(a,e,i,d)=>{e.setStringValue(a,i.value,{fromUi:i.fromUi},d)},q=({disabled:a,element:e,widgetMgr:i,fragmentId:d})=>{var h;const b=r.useRef(U("text_area_")).current,[I,S]=w(),[l,m]=r.useState(!1),[v,c]=r.useState(!1),[o,n]=r.useState(()=>W(i,e)??null),C=r.useCallback(()=>{n(e.default??null),m(!0)},[e]),[T,u]=G({getStateFromWidgetMgr:W,getDefaultStateFromProto:N,getCurrStateFromProto:O,updateWidgetMgrState:Z,element:e,widgetMgr:i,fragmentId:d,onFormCleared:C});B(T,o,n,l);const t=H(),g=r.useCallback(()=>{m(!1),u({value:o,fromUi:!0})},[o,u]),y=r.useCallback(()=>{l&&g(),c(!1)},[l,g]),F=r.useCallback(()=>{c(!0)},[]),j=L({formId:e.formId,maxChars:e.maxChars,setDirty:m,setUiValue:n,setValueWithSource:u}),z=M(e.formId,g,l,i,d,!0),{height:f,placeholder:R,formId:p}=e,V=x({formId:p})?i.allowFormEnterToSubmit(p):l,k=v&&I>t.breakpoints.hideWidgetDetails;return s.jsxs("div",{className:"stTextArea","data-testid":"stTextArea",ref:S,children:[s.jsx(_,{label:e.label,disabled:a,labelVisibility:A((h=e.labelVisibility)==null?void 0:h.value),htmlFor:b,children:e.help&&s.jsx(D,{children:s.jsx(E,{content:e.help,placement:P.TOP_RIGHT})})}),s.jsx(K,{value:o??"",placeholder:R,onBlur:y,onFocus:F,onChange:j,onKeyDown:z,"aria-label":e.label,disabled:a,id:b,overrides:{Input:{style:{lineHeight:t.lineHeights.inputWidget,height:f?`${f}px`:"",minHeight:t.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:t.spacing.md,paddingLeft:t.spacing.md,paddingBottom:t.spacing.md,paddingTop:t.spacing.md}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:t.sizes.borderWidth,borderRightWidth:t.sizes.borderWidth,borderTopWidth:t.sizes.borderWidth,borderBottomWidth:t.sizes.borderWidth}}}}),k&&s.jsx($,{dirty:l,value:o??"",maxLength:e.maxChars,type:"multiline",inForm:x({formId:p}),allowEnterToSubmit:V})]})},J=r.memo(q);export{J as default};
1
+ import{r,bP as w,A as H,c_ as x,j as s,bZ as _,b_ as A,cc as D,b$ as E,bI as P}from"./index-DPBNUFWE.js";import{u as U}from"./uniqueId-BGMRjdMp.js";import{u as B,a as L,b as M}from"./useOnInputChange-DI3AnwSZ.js";import{I as $}from"./InputInstructions-Dmr8j4xE.js";import{a as G}from"./useBasicWidgetState-uJo0naOA.js";import{T as K}from"./textarea-BKD-emFb.js";import"./inputUtils-CQWz5UKz.js";import"./FormClearHelper-BZaxoxQN.js";import"./base-input-DrVuxJmE.js";const W=(a,e)=>a.getStringValue(e)??e.default??null,N=a=>a.default??null,O=a=>a.value??null,Z=(a,e,i,d)=>{e.setStringValue(a,i.value,{fromUi:i.fromUi},d)},q=({disabled:a,element:e,widgetMgr:i,fragmentId:d})=>{var h;const b=r.useRef(U("text_area_")).current,[I,S]=w(),[l,m]=r.useState(!1),[v,c]=r.useState(!1),[o,n]=r.useState(()=>W(i,e)??null),C=r.useCallback(()=>{n(e.default??null),m(!0)},[e]),[T,u]=G({getStateFromWidgetMgr:W,getDefaultStateFromProto:N,getCurrStateFromProto:O,updateWidgetMgrState:Z,element:e,widgetMgr:i,fragmentId:d,onFormCleared:C});B(T,o,n,l);const t=H(),g=r.useCallback(()=>{m(!1),u({value:o,fromUi:!0})},[o,u]),y=r.useCallback(()=>{l&&g(),c(!1)},[l,g]),F=r.useCallback(()=>{c(!0)},[]),j=L({formId:e.formId,maxChars:e.maxChars,setDirty:m,setUiValue:n,setValueWithSource:u}),z=M(e.formId,g,l,i,d,!0),{height:f,placeholder:R,formId:p}=e,V=x({formId:p})?i.allowFormEnterToSubmit(p):l,k=v&&I>t.breakpoints.hideWidgetDetails;return s.jsxs("div",{className:"stTextArea","data-testid":"stTextArea",ref:S,children:[s.jsx(_,{label:e.label,disabled:a,labelVisibility:A((h=e.labelVisibility)==null?void 0:h.value),htmlFor:b,children:e.help&&s.jsx(D,{children:s.jsx(E,{content:e.help,placement:P.TOP_RIGHT})})}),s.jsx(K,{value:o??"",placeholder:R,onBlur:y,onFocus:F,onChange:j,onKeyDown:z,"aria-label":e.label,disabled:a,id:b,overrides:{Input:{style:{lineHeight:t.lineHeights.inputWidget,height:f?`${f}px`:"",minHeight:t.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:t.spacing.md,paddingLeft:t.spacing.md,paddingBottom:t.spacing.md,paddingTop:t.spacing.md}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:t.sizes.borderWidth,borderRightWidth:t.sizes.borderWidth,borderTopWidth:t.sizes.borderWidth,borderBottomWidth:t.sizes.borderWidth}}}}),k&&s.jsx($,{dirty:l,value:o??"",maxLength:e.maxChars,type:"multiline",inForm:x({formId:p}),allowEnterToSubmit:V})]})},J=r.memo(q);export{J as default};
@@ -1,4 +1,4 @@
1
- import{I as gN,c as yN,G as se,b9 as vN,ba as qA,bb as bN,bc as xN,bd as Xs,be as dd,M as _N,A as wN,b6 as WA,r as Ee,L as gg,aq as AN,an as EN,aj as HA,ak as GA,W as kN,bf as DN,N as XA,b3 as VA,l as YA,j as hd,bg as FN}from"./index-Cbvbjd8C.js";import{S as JA,T as CN}from"./Toolbar-DlGOP7h4.js";import{E as QA,w as SN}from"./withFullScreenWrapper-D8NJOCKn.js";import{m as $N}from"./mergeWith-Bt-C9xRx.js";import{a as Cl,n as MN,b as ON,c as pd,t as Aa,p as TN,d as NN,e as BN,i as Co,f as md,g as ZA,l as Vs,h as yg,j as gd,k as KA,m as So,o as Ys,q as zN,r as $o,s as RN,u as PN,v as LN,w as jN}from"./threshold-CqET7LYC.js";import{f as IN,a as vg,b as tE,c as UN,R as yd,r as eE,d as bg,e as xg,C as _g,g as nE,h as rE,i as vd,j as wg,n as Ve,k as Sl,l as qN,m as WN,o as HN,p as GN,q as XN,s as VN,t as YN,u as JN,v as QN,w as ZN,x as KN,y as bd}from"./value-CgPGBV_l.js";import{P as tB,i as eB,a as nB,b as rB,p as Ag,T as iB,n as oB,t as aB,d as sB}from"./timer-C0yLShpu.js";import{u as uB}from"./FormClearHelper-CT0Jwp4X.js";const lB=t=>({"#vg-tooltip-element":{visibility:"hidden",position:"fixed",fontFamily:t.genericFonts.bodyFont,color:t.colors.bodyText,border:`${t.sizes.borderWidth} solid ${t.colors.borderColor}`,backgroundColor:gN(t.colors.bgColor,.05),fontSize:t.fontSizes.twoSm,boxShadow:"rgb(0 0 0 / 16%) 0px 1px 4px",maxWidth:t.sizes.maxChartTooltipWidth,padding:`${t.spacing.xs} ${t.spacing.md}`,borderRadius:t.radii.default,zIndex:t.zIndices.popup,"&.visible":{visibility:"visible"},h2:{marginTop:t.spacing.none,marginBottom:t.spacing.sm,fontSize:t.fontSizes.sm},td:{border:"none"},table:{borderSpacing:0,tr:{border:"none",td:{overflow:"hidden",textOverflow:"ellipsis",paddingTop:t.spacing.threeXS,paddingBottom:t.spacing.threeXS},"td.key":{maxWidth:`calc((${t.sizes.maxChartTooltipWidth} - 2 * ${t.spacing.md}) * 0.4)`,textAlign:"right",color:t.colors.fadedText60,whiteSpace:"nowrap",paddingRight:t.spacing.twoXS},"td.value":{maxWidth:`calc((${t.sizes.maxChartTooltipWidth} - 2 * ${t.spacing.md}) * 0.6)`,textAlign:"left",display:"-webkit-box",WebkitLineClamp:"5",WebkitBoxOrient:"vertical",lineClamp:"5",wordWrap:"break-word"}}}}}),cB=yN("div",{target:"egd2k5h0"})(({theme:t,useContainerWidth:e,isFullScreen:n})=>({width:e||n?"100%":"auto",height:n?"100%":"auto","&.vega-embed":{position:"relative",display:"inline-block",boxSizing:"border-box","details:not([open]) > :not(summary)":{display:"none !important"},"details[open] summary":{opacity:.7},"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&:hover summary, &:focus-within summary":{opacity:"1 !important",transition:"opacity 0.2s ease"},"&.has-actions":{paddingRight:0},".vega-actions":{position:"absolute",display:"flex",flexDirection:"column",paddingBottom:t.spacing.sm,paddingTop:t.spacing.sm,zIndex:t.zIndices.popup,top:`calc(${t.iconSizes.md} + 2 * ${t.spacing.xs} + ${t.spacing.xs})`,right:0,backgroundColor:t.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:`${t.sizes.borderWidth} solid ${t.colors.fadedText10}`,animationDuration:"0.15s",animationName:"scale-in",animationTimingFunction:"cubic-bezier(0.2, 0, 0.13, 1.5)",textAlign:"left",borderRadius:t.radii.default,a:{fontFamily:t.genericFonts.bodyFont,fontWeight:t.fontWeights.normal,fontSize:t.fontSizes.md,margin:0,padding:`${t.spacing.twoXS} ${t.spacing.twoXL}`,color:t.colors.bodyText,whiteSpace:"nowrap",textDecoration:"none"},"a:hover, a:focus":{backgroundColor:t.colors.darkenedBgMix15,color:t.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},"@keyframes scale-in":{from:{opacity:0,transform:"scale(0.6)"},to:{opacity:1,transform:"scale(1)"}},".chart-wrapper":{"&.fit-x":{width:"100%"},"&.fit-y":{height:"100%"}},summary:{position:"absolute",top:0,right:0,opacity:0,listStyle:"none",cursor:"pointer",display:"list-item",padding:t.spacing.xs,height:"auto",zIndex:t.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:t.radii.default,color:t.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms",lineHeight:0,"&::-webkit-details-marker":{display:"none"},"&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:t.colors.bodyText,opacity:"1 !important",background:t.colors.darkenedBgMix15},svg:{width:t.iconSizes.md,height:t.iconSizes.md}}}}),"");function iE(t,e){const n={font:e.genericFonts.bodyFont,background:e.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:e.colors.headingColor,titleFontStyle:"normal",fontWeight:e.fontWeights.bold,fontSize:se(e.fontSizes.md),orient:"top",offset:26},header:{titleFontWeight:e.fontWeights.normal,titleFontSize:se(e.fontSizes.md),titleColor:Xs(e),titleFontStyle:"normal",labelFontSize:se(e.fontSizes.twoSm),labelFontWeight:e.fontWeights.normal,labelColor:Xs(e),labelFontStyle:"normal"},axis:{labelFontSize:se(e.fontSizes.twoSm),labelFontWeight:e.fontWeights.normal,labelColor:Xs(e),labelFontStyle:"normal",titleFontWeight:e.fontWeights.normal,titleFontSize:se(e.fontSizes.sm),titleColor:Xs(e),titleFontStyle:"normal",ticks:!1,gridColor:dd(e),domain:!1,domainWidth:1,domainColor:dd(e),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:se(e.spacing.lg),labelPadding:se(e.spacing.lg),labelSeparation:se(e.spacing.twoXS),labelOverlap:!0},legend:{labelFontSize:se(e.fontSizes.sm),labelFontWeight:e.fontWeights.normal,labelColor:Xs(e),titleFontSize:se(e.fontSizes.sm),titleFontWeight:e.fontWeights.normal,titleFontStyle:"normal",titleColor:Xs(e),titlePadding:5,labelPadding:se(e.spacing.lg),columnPadding:se(e.spacing.sm),rowPadding:se(e.spacing.twoXS),padding:7,symbolStrokeWidth:se(e.spacing.twoXS)},range:{category:xN(e),diverging:bN(e),ramp:qA(e),heatmap:qA(e)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:se(e.sizes.defaultChartHeight),continuousWidth:se(e.sizes.defaultChartWidth)},concat:{columns:1},facet:{columns:1},mark:{tooltip:{content:"encoding"},color:vN(e)},bar:{binSpacing:se(e.spacing.twoXS),discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return t?$N({},n,t,(r,i)=>Array.isArray(i)?i:void 0):n}function fB(t,e){const{colors:n,fontSizes:r,genericFonts:i}=e,o={labelFont:i.bodyFont,titleFont:i.bodyFont,labelFontSize:se(r.twoSm),titleFontSize:se(r.twoSm)},a={background:n.bgColor,axis:{labelColor:n.bodyText,titleColor:n.bodyText,gridColor:dd(e),...o},legend:{labelColor:n.bodyText,titleColor:n.bodyText,...o},title:{color:n.bodyText,subtitleColor:n.bodyText,...o},header:{labelColor:n.bodyText,titleColor:n.bodyText,...o},view:{stroke:dd(e),continuousHeight:se(e.sizes.defaultChartHeight),continuousWidth:se(e.sizes.defaultChartWidth)},mark:{tooltip:!0}};return t?_N({},a,t):a}const dB=20;function hB(t){"params"in t&&"encoding"in t&&t.params.forEach(e=>{"select"in e&&(["interval","point"].includes(e.select)&&(e.select={type:e.select}),"type"in e.select&&e.select.type==="point"&&!("encodings"in e.select)&&gg(e.select.encodings)&&(e.select.encodings=Object.keys(t.encoding)))})}const pB=(t,e,n,r,i,o,a,s)=>{var u,l;const c=JSON.parse(t);if(n==="streamlit"?c.config=iE(c.config,i):((l=(u=c.usermeta)==null?void 0:u.embedOptions)==null?void 0:l.theme)==="streamlit"?(c.config=iE(c.config,i),c.usermeta.embedOptions.theme=void 0):c.config=fB(c.config,i),o?(c.width=a,c.height=s,"vconcat"in c&&c.vconcat.forEach(f=>{f.width=a})):e&&(c.width=a,"vconcat"in c&&c.vconcat.forEach(f=>{f.width=a})),c.padding||(c.padding={}),gg(c.padding.bottom)&&(c.padding.bottom=dB),c.datasets)throw new Error("Datasets should not be passed as part of the spec");return r.length>0&&hB(c),c},mB=t=>{const e=wN(),{expanded:n,width:r,height:i}=WA(QA),{id:o,formId:a,spec:s,data:u,datasets:l,useContainerWidth:c,vegaLiteTheme:f,selectionMode:d}=t,h=Ee.useMemo(()=>d,[JSON.stringify(d)]),p=Ee.useMemo(()=>pB(s,c,f,h,e,n,r||0,i),[s,c,f,h,e,n,r,i]);return{id:o,formId:a,vegaLiteTheme:f,spec:p,selectionMode:h,data:u,datasets:l,useContainerWidth:c}};function Pi(t,e,n){return t.fields=e||[],t.fname=n,t}function gB(t){return t==null?null:t.fname}function oE(t){return t==null?null:t.fields}function aE(t){return t.length===1?yB(t[0]):vB(t)}const yB=t=>function(e){return e[t]},vB=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function xd(t){throw Error(t)}function Eg(t){const e=[],n=t.length;let r=null,i=0,o="",a,s,u;t=t+"";function l(){e.push(o+t.substring(a,s)),o="",a=s+1}for(a=s=0;s<n;++s)if(u=t[s],u==="\\")o+=t.substring(a,s++),a=s;else if(u===r)l(),r=null,i=-1;else{if(r)continue;a===i&&u==='"'||a===i&&u==="'"?(a=s+1,r=u):u==="."&&!i?s>a?l():a=s+1:u==="["?(s>a&&l(),i=a=s+1):u==="]"&&(i||xd("Access path missing open bracket: "+t),i>0&&l(),i=0,a=s+1)}return i&&xd("Access path missing closing bracket: "+t),r&&xd("Access path missing closing quote: "+t),s>a&&(s++,l()),e}function kg(t,e,n){const r=Eg(t);return t=r.length===1?r[0]:t,Pi((n&&n.get||aE)(r),[t],e||t)}const bB=kg("id"),Dg=Pi(t=>t,[],"identity"),xB=Pi(()=>0,[],"zero"),_B=Pi(()=>1,[],"one"),sE=Pi(()=>!0,[],"true"),wB=Pi(()=>!1,[],"false");function AB(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const uE=0,lE=1,cE=2,fE=3,dE=4;function EB(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:AB,r=t||uE;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=lE&&n(e||"error","ERROR",arguments),this},warn(){return r>=cE&&n(e||"warn","WARN",arguments),this},info(){return r>=fE&&n(e||"log","INFO",arguments),this},debug(){return r>=dE&&n(e||"log","DEBUG",arguments),this}}}var _d=Array.isArray;function Ea(t){return t===Object(t)}const hE=t=>t!=="__proto__";function Fg(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((r,i)=>{for(const o in i)if(o==="signals")r.signals=kB(r.signals,i.signals);else{const a=o==="legend"?{layout:1}:o==="style"?!0:null;wd(r,o,i[o],a)}return r},{})}function wd(t,e,n,r){if(!hE(e))return;let i,o;if(Ea(n)&&!_d(n)){o=Ea(t[e])?t[e]:t[e]={};for(i in n)r&&(r===!0||r[i])?wd(o,i,n[i]):hE(i)&&(o[i]=n[i])}else t[e]=n}function kB(t,e){if(t==null)return e;const n={},r=[];function i(o){n[o.name]||(n[o.name]=1,r.push(o))}return e.forEach(i),t.forEach(i),r}function Js(t){return t[t.length-1]}function Cg(t){return t==null||t===""?null:+t}const pE=t=>e=>t*Math.exp(e),mE=t=>e=>Math.log(t*e),gE=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),yE=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,Ad=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function Ed(t,e,n,r){const i=n(t[0]),o=n(Js(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function DB(t,e){return Ed(t,e,Cg,Dg)}function FB(t,e){var n=Math.sign(t[0]);return Ed(t,e,mE(n),pE(n))}function CB(t,e,n){return Ed(t,e,Ad(n),Ad(1/n))}function SB(t,e,n){return Ed(t,e,gE(n),yE(n))}function kd(t,e,n,r,i){const o=r(t[0]),a=r(Js(t)),s=e!=null?r(e):(o+a)/2;return[i(s+(o-s)*n),i(s+(a-s)*n)]}function $B(t,e,n){return kd(t,e,n,Cg,Dg)}function MB(t,e,n){const r=Math.sign(t[0]);return kd(t,e,n,mE(r),pE(r))}function OB(t,e,n,r){return kd(t,e,n,Ad(r),Ad(1/r))}function TB(t,e,n,r){return kd(t,e,n,gE(r),yE(r))}function NB(t){return 1+~~(new Date(t).getMonth()/3)}function BB(t){return 1+~~(new Date(t).getUTCMonth()/3)}function $l(t){return t!=null?_d(t)?t:[t]:[]}function zB(t,e,n){let r=t[0],i=t[1],o;return i<r&&(o=i,i=r,r=o),o=i-r,o>=n-e?[e,n]:[r=Math.min(Math.max(r,e),n-o),r+o]}function Dd(t){return typeof t=="function"}const RB="descending";function PB(t,e,n){n=n||{},e=$l(e)||[];const r=[],i=[],o={},a=n.comparator||LB;return $l(t).forEach((s,u)=>{s!=null&&(r.push(e[u]===RB?-1:1),i.push(s=Dd(s)?s:kg(s,null,n)),(oE(s)||[]).forEach(l=>o[l]=1))}),i.length===0?null:Pi(a(i,r),Object.keys(o))}const Sg=(t,e)=>(t<e||t==null)&&e!=null?-1:(t>e||e==null)&&t!=null?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e===e?-1:e!==e&&t===t?1:0),LB=(t,e)=>t.length===1?jB(t[0],e[0]):IB(t,e,t.length),jB=(t,e)=>function(n,r){return Sg(t(n),t(r))*e},IB=(t,e,n)=>(e.push(0),function(r,i){let o,a=0,s=-1;for(;a===0&&++s<n;)o=t[s],a=Sg(o(r),o(i));return a*e[s]});function UB(t){return Dd(t)?t:()=>t}function qB(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(e(r),n=null),t)}}function $g(t){for(let e,n,r=1,i=arguments.length;r<i;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t}function WB(t,e){let n=0,r,i,o,a;if(t&&(r=t.length))if(e==null){for(i=t[n];n<r&&(i==null||i!==i);i=t[++n]);for(o=a=i;n<r;++n)i=t[n],i!=null&&(i<o&&(o=i),i>a&&(a=i))}else{for(i=e(t[n]);n<r&&(i==null||i!==i);i=e(t[++n]));for(o=a=i;n<r;++n)i=e(t[n]),i!=null&&(i<o&&(o=i),i>a&&(a=i))}return[o,a]}function HB(t,e){const n=t.length;let r=-1,i,o,a,s,u;if(e==null){for(;++r<n;)if(o=t[r],o!=null&&o>=o){i=a=o;break}if(r===n)return[-1,-1];for(s=u=r;++r<n;)o=t[r],o!=null&&(i>o&&(i=o,s=r),a<o&&(a=o,u=r))}else{for(;++r<n;)if(o=e(t[r],r,t),o!=null&&o>=o){i=a=o;break}if(r===n)return[-1,-1];for(s=u=r;++r<n;)o=e(t[r],r,t),o!=null&&(i>o&&(i=o,s=r),a<o&&(a=o,u=r))}return[s,u]}const GB=Object.prototype.hasOwnProperty;function Li(t,e){return GB.call(t,e)}const Fd={};function XB(t){let e={},n;function r(o){return Li(e,o)&&e[o]!==Fd}const i={size:0,empty:0,object:e,has:r,get(o){return r(o)?e[o]:void 0},set(o,a){return r(o)||(++i.size,e[o]===Fd&&--i.empty),e[o]=a,this},delete(o){return r(o)&&(--i.size,++i.empty,e[o]=Fd),this},clear(){i.size=i.empty=0,i.object=e={}},test(o){return arguments.length?(n=o,i):n},clean(){const o={};let a=0;for(const s in e){const u=e[s];u!==Fd&&(!n||!n(u))&&(o[s]=u,++a)}i.size=a,i.empty=0,i.object=e=o}};return t&&Object.keys(t).forEach(o=>{i.set(o,t[o])}),i}function VB(t,e,n,r,i,o){if(!n&&n!==0)return o;const a=+n;let s=t[0],u=Js(t),l;u<s&&(l=s,s=u,u=l),l=Math.abs(e-s);const c=Math.abs(u-e);return l<c&&l<=a?r:c<=a?i:o}function YB(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),$g(r,n)}function JB(t,e,n,r){let i=e[0],o=e[e.length-1],a;return i>o&&(a=i,i=o,o=a),n=n===void 0||n,r=r===void 0||r,(n?i<=t:i<t)&&(r?t<=o:t<o)}function vE(t){return typeof t=="boolean"}function bE(t){return Object.prototype.toString.call(t)==="[object Date]"}function QB(t){return t&&Dd(t[Symbol.iterator])}function xE(t){return typeof t=="number"}function ZB(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ji(t){return typeof t=="string"}function KB(t,e,n){t&&(t=e?$l(t).map(s=>s.replace(/\\(.)/g,"$1")):$l(t));const r=t&&t.length,i=n&&n.get||aE,o=s=>i(e?[s]:Eg(s));let a;if(!r)a=function(){return""};else if(r===1){const s=o(t[0]);a=function(u){return""+s(u)}}else{const s=t.map(o);a=function(u){let l=""+s[0](u),c=0;for(;++c<r;)l+="|"+s[c](u);return l}}return Pi(a,t,"key")}function tz(t,e){const n=t[0],r=Js(t),i=+e;return i?i===1?r:n+i*(r-n):n}const ez=1e4;function nz(t){t=+t||ez;let e,n,r;const i=()=>{e={},n={},r=0},o=(a,s)=>(++r>t&&(n=e,e={},r=1),e[a]=s);return i(),{clear:i,has:a=>Li(e,a)||Li(n,a),get:a=>Li(e,a)?e[a]:Li(n,a)?o(a,n[a]):void 0,set:(a,s)=>Li(e,a)?e[a]=s:o(a,s)}}function rz(t,e,n,r){const i=e.length,o=n.length;if(!o)return e;if(!i)return n;const a=r||new e.constructor(i+o);let s=0,u=0,l=0;for(;s<i&&u<o;++l)a[l]=t(e[s],n[u])>0?n[u++]:e[s++];for(;s<i;++s,++l)a[l]=e[s];for(;u<o;++u,++l)a[l]=n[u];return a}function Ml(t,e){let n="";for(;--e>=0;)n+=t;return n}function iz(t,e,n,r){const i=n||" ",o=t+"",a=e-o.length;return a<=0?o:r==="left"?Ml(i,a)+o:r==="center"?Ml(i,~~(a/2))+o+Ml(i,Math.ceil(a/2)):o+Ml(i,a)}function oz(t){return t&&Js(t)-t[0]||0}function Qs(t){return _d(t)?"["+t.map(Qs)+"]":Ea(t)||ji(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function az(t){return t==null||t===""?null:!t||t==="false"||t==="0"?!1:!!t}const sz=t=>xE(t)||bE(t)?t:Date.parse(t);function uz(t,e){return e=e||sz,t==null||t===""?null:e(t)}function lz(t){return t==null||t===""?null:t+""}function cz(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function fz(t,e,n,r){const i=r??"\u2026",o=t+"",a=o.length,s=Math.max(0,e-i.length);return a<=e?o:n==="left"?i+o.slice(a-s):n==="center"?o.slice(0,Math.ceil(s/2))+i+o.slice(a-~~(s/2)):o.slice(0,s)+i}function dz(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const o=e(t[i]);o&&n(o,i,t)}}else t.forEach(n)}function Wn(t,e,n){return t.fields=e||[],t.fname=n,t}function ue(t){return t==null?null:t.fname}function un(t){return t==null?null:t.fields}function _E(t){return t.length===1?hz(t[0]):pz(t)}const hz=t=>function(e){return e[t]},pz=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function R(t){throw Error(t)}function Mg(t){const e=[],n=t.length;let r=null,i=0,o="",a,s,u;t=t+"";function l(){e.push(o+t.substring(a,s)),o="",a=s+1}for(a=s=0;s<n;++s)if(u=t[s],u==="\\")o+=t.substring(a,s++),a=s;else if(u===r)l(),r=null,i=-1;else{if(r)continue;a===i&&u==='"'||a===i&&u==="'"?(a=s+1,r=u):u==="."&&!i?s>a?l():a=s+1:u==="["?(s>a&&l(),i=a=s+1):u==="]"&&(i||R("Access path missing open bracket: "+t),i>0&&l(),i=0,a=s+1)}return i&&R("Access path missing closing bracket: "+t),r&&R("Access path missing closing quote: "+t),s>a&&(s++,l()),e}function wr(t,e,n){const r=Mg(t);return t=r.length===1?r[0]:t,Wn((n&&n.get||_E)(r),[t],e||t)}const Cd=wr("id"),Cn=Wn(t=>t,[],"identity"),ka=Wn(()=>0,[],"zero"),Ol=Wn(()=>1,[],"one"),Ar=Wn(()=>!0,[],"true"),Da=Wn(()=>!1,[],"false");function mz(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const gz=0,wE=1,yz=2,vz=3,bz=4;function xz(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mz,r=t||gz;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=wE&&n("error","ERROR",arguments),this},warn(){return r>=yz&&n("warn","WARN",arguments),this},info(){return r>=vz&&n("log","INFO",arguments),this},debug(){return r>=bz&&n("log","DEBUG",arguments),this}}}var K=Array.isArray;function mt(t){return t===Object(t)}const AE=t=>t!=="__proto__";function _z(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((r,i)=>{for(const o in i)if(o==="signals")r.signals=wz(r.signals,i.signals);else{const a=o==="legend"?{layout:1}:o==="style"?!0:null;EE(r,o,i[o],a)}return r},{})}function EE(t,e,n,r){if(!AE(e))return;let i,o;if(mt(n)&&!K(n)){o=mt(t[e])?t[e]:t[e]={};for(i in n)r&&(r===!0||r[i])?EE(o,i,n[i]):AE(i)&&(o[i]=n[i])}else t[e]=n}function wz(t,e){if(t==null)return e;const n={},r=[];function i(o){n[o.name]||(n[o.name]=1,r.push(o))}return e.forEach(i),t.forEach(i),r}function kt(t){return t[t.length-1]}function ln(t){return t==null||t===""?null:+t}const kE=t=>e=>t*Math.exp(e),DE=t=>e=>Math.log(t*e),FE=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),CE=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,Sd=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function $d(t,e,n,r){const i=n(t[0]),o=n(kt(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function Az(t,e){return $d(t,e,ln,Cn)}function Ez(t,e){var n=Math.sign(t[0]);return $d(t,e,DE(n),kE(n))}function kz(t,e,n){return $d(t,e,Sd(n),Sd(1/n))}function Dz(t,e,n){return $d(t,e,FE(n),CE(n))}function Md(t,e,n,r,i){const o=r(t[0]),a=r(kt(t)),s=e!=null?r(e):(o+a)/2;return[i(s+(o-s)*n),i(s+(a-s)*n)]}function SE(t,e,n){return Md(t,e,n,ln,Cn)}function $E(t,e,n){const r=Math.sign(t[0]);return Md(t,e,n,DE(r),kE(r))}function Og(t,e,n,r){return Md(t,e,n,Sd(r),Sd(1/r))}function ME(t,e,n,r){return Md(t,e,n,FE(r),CE(r))}function Fz(t){return 1+~~(new Date(t).getMonth()/3)}function Cz(t){return 1+~~(new Date(t).getUTCMonth()/3)}function rt(t){return t!=null?K(t)?t:[t]:[]}function Sz(t,e,n){let r=t[0],i=t[1],o;return i<r&&(o=i,i=r,r=o),o=i-r,o>=n-e?[e,n]:[r=Math.min(Math.max(r,e),n-o),r+o]}function gt(t){return typeof t=="function"}const $z="descending";function OE(t,e,n){n=n||{},e=rt(e)||[];const r=[],i=[],o={},a=n.comparator||Mz;return rt(t).forEach((s,u)=>{s!=null&&(r.push(e[u]===$z?-1:1),i.push(s=gt(s)?s:wr(s,null,n)),(un(s)||[]).forEach(l=>o[l]=1))}),i.length===0?null:Wn(a(i,r),Object.keys(o))}const Tl=(t,e)=>(t<e||t==null)&&e!=null?-1:(t>e||e==null)&&t!=null?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e===e?-1:e!==e&&t===t?1:0),Mz=(t,e)=>t.length===1?Oz(t[0],e[0]):Tz(t,e,t.length),Oz=(t,e)=>function(n,r){return Tl(t(n),t(r))*e},Tz=(t,e,n)=>(e.push(0),function(r,i){let o,a=0,s=-1;for(;a===0&&++s<n;)o=t[s],a=Tl(o(r),o(i));return a*e[s]});function cn(t){return gt(t)?t:()=>t}function TE(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(e(r),n=null),t)}}function yt(t){for(let e,n,r=1,i=arguments.length;r<i;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t}function Ii(t,e){let n=0,r,i,o,a;if(t&&(r=t.length))if(e==null){for(i=t[n];n<r&&(i==null||i!==i);i=t[++n]);for(o=a=i;n<r;++n)i=t[n],i!=null&&(i<o&&(o=i),i>a&&(a=i))}else{for(i=e(t[n]);n<r&&(i==null||i!==i);i=e(t[++n]));for(o=a=i;n<r;++n)i=e(t[n]),i!=null&&(i<o&&(o=i),i>a&&(a=i))}return[o,a]}function Nz(t,e){const n=t.length;let r=-1,i,o,a,s,u;if(e==null){for(;++r<n;)if(o=t[r],o!=null&&o>=o){i=a=o;break}if(r===n)return[-1,-1];for(s=u=r;++r<n;)o=t[r],o!=null&&(i>o&&(i=o,s=r),a<o&&(a=o,u=r))}else{for(;++r<n;)if(o=e(t[r],r,t),o!=null&&o>=o){i=a=o;break}if(r===n)return[-1,-1];for(s=u=r;++r<n;)o=e(t[r],r,t),o!=null&&(i>o&&(i=o,s=r),a<o&&(a=o,u=r))}return[s,u]}function lt(t,e){return Object.hasOwn(t,e)}const Od={};function Nl(t){let e={},n;function r(o){return lt(e,o)&&e[o]!==Od}const i={size:0,empty:0,object:e,has:r,get(o){return r(o)?e[o]:void 0},set(o,a){return r(o)||(++i.size,e[o]===Od&&--i.empty),e[o]=a,this},delete(o){return r(o)&&(--i.size,++i.empty,e[o]=Od),this},clear(){i.size=i.empty=0,i.object=e={}},test(o){return arguments.length?(n=o,i):n},clean(){const o={};let a=0;for(const s in e){const u=e[s];u!==Od&&(!n||!n(u))&&(o[s]=u,++a)}i.size=a,i.empty=0,i.object=e=o}};return t&&Object.keys(t).forEach(o=>{i.set(o,t[o])}),i}function Bz(t,e,n,r,i,o){if(!n&&n!==0)return o;const a=+n;let s=t[0],u=kt(t),l;u<s&&(l=s,s=u,u=l),l=Math.abs(e-s);const c=Math.abs(u-e);return l<c&&l<=a?r:c<=a?i:o}function H(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),yt(r,n)}function Bl(t,e,n,r){let i=e[0],o=e[e.length-1],a;return i>o&&(a=i,i=o,o=a),n=n===void 0||n,r=r===void 0||r,(n?i<=t:i<t)&&(r?t<=o:t<o)}function zz(t){return typeof t=="boolean"}function Fa(t){return Object.prototype.toString.call(t)==="[object Date]"}function Rz(t){return t&&gt(t[Symbol.iterator])}function Ca(t){return typeof t=="number"}function NE(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Xt(t){return typeof t=="string"}function BE(t,e,n){t&&(t=e?rt(t).map(s=>s.replace(/\\(.)/g,"$1")):rt(t));const r=t&&t.length,i=n&&n.get||_E,o=s=>i(e?[s]:Mg(s));let a;if(!r)a=function(){return""};else if(r===1){const s=o(t[0]);a=function(u){return""+s(u)}}else{const s=t.map(o);a=function(u){let l=""+s[0](u),c=0;for(;++c<r;)l+="|"+s[c](u);return l}}return Wn(a,t,"key")}function Pz(t,e){const n=t[0],r=kt(t),i=+e;return i?i===1?r:n+i*(r-n):n}const Lz=1e4;function jz(t){t=+t||Lz;let e,n,r;const i=()=>{e={},n={},r=0},o=(a,s)=>(++r>t&&(n=e,e={},r=1),e[a]=s);return i(),{clear:i,has:a=>lt(e,a)||lt(n,a),get:a=>lt(e,a)?e[a]:lt(n,a)?o(a,n[a]):void 0,set:(a,s)=>lt(e,a)?e[a]=s:o(a,s)}}function Iz(t,e,n,r){const i=e.length,o=n.length;if(!o)return e;if(!i)return n;const a=r||new e.constructor(i+o);let s=0,u=0,l=0;for(;s<i&&u<o;++l)a[l]=t(e[s],n[u])>0?n[u++]:e[s++];for(;s<i;++s,++l)a[l]=e[s];for(;u<o;++u,++l)a[l]=n[u];return a}function Td(t,e){let n="";for(;--e>=0;)n+=t;return n}function Uz(t,e,n,r){const i=n||" ",o=t+"",a=e-o.length;return a<=0?o:r==="left"?Td(i,a)+o:r==="center"?Td(i,~~(a/2))+o+Td(i,Math.ceil(a/2)):o+Td(i,a)}function Nd(t){return t&&kt(t)-t[0]||0}function it(t){return K(t)?"["+t.map(it)+"]":mt(t)||Xt(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function zE(t){return t==null||t===""?null:!t||t==="false"||t==="0"?!1:!!t}const qz=t=>Ca(t)||Fa(t)?t:Date.parse(t);function RE(t,e){return e=e||qz,t==null||t===""?null:e(t)}function PE(t){return t==null||t===""?null:t+""}function ti(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function Wz(t,e,n,r){const i=r??"\u2026",o=t+"",a=o.length,s=Math.max(0,e-i.length);return a<=e?o:n==="left"?i+o.slice(a-s):n==="center"?o.slice(0,Math.ceil(s/2))+i+o.slice(a-~~(s/2)):o.slice(0,s)+i}function Sa(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const o=e(t[i]);o&&n(o,i,t)}}else t.forEach(n)}var LE={},Tg={},Ng=34,zl=10,Bg=13;function jE(t){return new Function("d","return {"+t.map(function(e,n){return JSON.stringify(e)+": d["+n+'] || ""'}).join(",")+"}")}function Hz(t,e){var n=jE(t);return function(r,i){return e(n(r),i,t)}}function IE(t){var e=Object.create(null),n=[];return t.forEach(function(r){for(var i in r)i in e||n.push(e[i]=i)}),n}function Sn(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Gz(t){return t<0?"-"+Sn(-t,6):t>9999?"+"+Sn(t,6):Sn(t,4)}function Xz(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":Gz(t.getUTCFullYear())+"-"+Sn(t.getUTCMonth()+1,2)+"-"+Sn(t.getUTCDate(),2)+(i?"T"+Sn(e,2)+":"+Sn(n,2)+":"+Sn(r,2)+"."+Sn(i,3)+"Z":r?"T"+Sn(e,2)+":"+Sn(n,2)+":"+Sn(r,2)+"Z":n||e?"T"+Sn(e,2)+":"+Sn(n,2)+"Z":"")}function Vz(t){var e=new RegExp('["'+t+`
1
+ import{I as gN,c as yN,G as se,b9 as vN,ba as qA,bb as bN,bc as xN,bd as Xs,be as dd,M as _N,A as wN,b6 as WA,r as Ee,L as gg,aq as AN,an as EN,aj as HA,ak as GA,W as kN,bf as DN,N as XA,b3 as VA,l as YA,j as hd,bg as FN}from"./index-DPBNUFWE.js";import{S as JA,T as CN}from"./Toolbar-bneC7vhq.js";import{E as QA,w as SN}from"./withFullScreenWrapper-DbD5_ijt.js";import{m as $N}from"./mergeWith-DZ-wgSc6.js";import{a as Cl,n as MN,b as ON,c as pd,t as Aa,p as TN,d as NN,e as BN,i as Co,f as md,g as ZA,l as Vs,h as yg,j as gd,k as KA,m as So,o as Ys,q as zN,r as $o,s as RN,u as PN,v as LN,w as jN}from"./threshold-CqET7LYC.js";import{f as IN,a as vg,b as tE,c as UN,R as yd,r as eE,d as bg,e as xg,C as _g,g as nE,h as rE,i as vd,j as wg,n as Ve,k as Sl,l as qN,m as WN,o as HN,p as GN,q as XN,s as VN,t as YN,u as JN,v as QN,w as ZN,x as KN,y as bd}from"./value-CgPGBV_l.js";import{P as tB,i as eB,a as nB,b as rB,p as Ag,T as iB,n as oB,t as aB,d as sB}from"./timer-C0yLShpu.js";import{u as uB}from"./FormClearHelper-BZaxoxQN.js";const lB=t=>({"#vg-tooltip-element":{visibility:"hidden",position:"fixed",fontFamily:t.genericFonts.bodyFont,color:t.colors.bodyText,border:`${t.sizes.borderWidth} solid ${t.colors.borderColor}`,backgroundColor:gN(t.colors.bgColor,.05),fontSize:t.fontSizes.twoSm,boxShadow:"rgb(0 0 0 / 16%) 0px 1px 4px",maxWidth:t.sizes.maxChartTooltipWidth,padding:`${t.spacing.xs} ${t.spacing.md}`,borderRadius:t.radii.default,zIndex:t.zIndices.popup,"&.visible":{visibility:"visible"},h2:{marginTop:t.spacing.none,marginBottom:t.spacing.sm,fontSize:t.fontSizes.sm},td:{border:"none"},table:{borderSpacing:0,tr:{border:"none",td:{overflow:"hidden",textOverflow:"ellipsis",paddingTop:t.spacing.threeXS,paddingBottom:t.spacing.threeXS},"td.key":{maxWidth:`calc((${t.sizes.maxChartTooltipWidth} - 2 * ${t.spacing.md}) * 0.4)`,textAlign:"right",color:t.colors.fadedText60,whiteSpace:"nowrap",paddingRight:t.spacing.twoXS},"td.value":{maxWidth:`calc((${t.sizes.maxChartTooltipWidth} - 2 * ${t.spacing.md}) * 0.6)`,textAlign:"left",display:"-webkit-box",WebkitLineClamp:"5",WebkitBoxOrient:"vertical",lineClamp:"5",wordWrap:"break-word"}}}}}),cB=yN("div",{target:"egd2k5h0"})(({theme:t,useContainerWidth:e,isFullScreen:n})=>({width:e||n?"100%":"auto",height:n?"100%":"auto","&.vega-embed":{position:"relative",display:"inline-block",boxSizing:"border-box","details:not([open]) > :not(summary)":{display:"none !important"},"details[open] summary":{opacity:.7},"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&:hover summary, &:focus-within summary":{opacity:"1 !important",transition:"opacity 0.2s ease"},"&.has-actions":{paddingRight:0},".vega-actions":{position:"absolute",display:"flex",flexDirection:"column",paddingBottom:t.spacing.sm,paddingTop:t.spacing.sm,zIndex:t.zIndices.popup,top:`calc(${t.iconSizes.md} + 2 * ${t.spacing.xs} + ${t.spacing.xs})`,right:0,backgroundColor:t.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:`${t.sizes.borderWidth} solid ${t.colors.fadedText10}`,animationDuration:"0.15s",animationName:"scale-in",animationTimingFunction:"cubic-bezier(0.2, 0, 0.13, 1.5)",textAlign:"left",borderRadius:t.radii.default,a:{fontFamily:t.genericFonts.bodyFont,fontWeight:t.fontWeights.normal,fontSize:t.fontSizes.md,margin:0,padding:`${t.spacing.twoXS} ${t.spacing.twoXL}`,color:t.colors.bodyText,whiteSpace:"nowrap",textDecoration:"none"},"a:hover, a:focus":{backgroundColor:t.colors.darkenedBgMix15,color:t.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},"@keyframes scale-in":{from:{opacity:0,transform:"scale(0.6)"},to:{opacity:1,transform:"scale(1)"}},".chart-wrapper":{"&.fit-x":{width:"100%"},"&.fit-y":{height:"100%"}},summary:{position:"absolute",top:0,right:0,opacity:0,listStyle:"none",cursor:"pointer",display:"list-item",padding:t.spacing.xs,height:"auto",zIndex:t.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:t.radii.default,color:t.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms",lineHeight:0,"&::-webkit-details-marker":{display:"none"},"&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:t.colors.bodyText,opacity:"1 !important",background:t.colors.darkenedBgMix15},svg:{width:t.iconSizes.md,height:t.iconSizes.md}}}}),"");function iE(t,e){const n={font:e.genericFonts.bodyFont,background:e.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:e.colors.headingColor,titleFontStyle:"normal",fontWeight:e.fontWeights.bold,fontSize:se(e.fontSizes.md),orient:"top",offset:26},header:{titleFontWeight:e.fontWeights.normal,titleFontSize:se(e.fontSizes.md),titleColor:Xs(e),titleFontStyle:"normal",labelFontSize:se(e.fontSizes.twoSm),labelFontWeight:e.fontWeights.normal,labelColor:Xs(e),labelFontStyle:"normal"},axis:{labelFontSize:se(e.fontSizes.twoSm),labelFontWeight:e.fontWeights.normal,labelColor:Xs(e),labelFontStyle:"normal",titleFontWeight:e.fontWeights.normal,titleFontSize:se(e.fontSizes.sm),titleColor:Xs(e),titleFontStyle:"normal",ticks:!1,gridColor:dd(e),domain:!1,domainWidth:1,domainColor:dd(e),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:se(e.spacing.lg),labelPadding:se(e.spacing.lg),labelSeparation:se(e.spacing.twoXS),labelOverlap:!0},legend:{labelFontSize:se(e.fontSizes.sm),labelFontWeight:e.fontWeights.normal,labelColor:Xs(e),titleFontSize:se(e.fontSizes.sm),titleFontWeight:e.fontWeights.normal,titleFontStyle:"normal",titleColor:Xs(e),titlePadding:5,labelPadding:se(e.spacing.lg),columnPadding:se(e.spacing.sm),rowPadding:se(e.spacing.twoXS),padding:7,symbolStrokeWidth:se(e.spacing.twoXS)},range:{category:xN(e),diverging:bN(e),ramp:qA(e),heatmap:qA(e)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:se(e.sizes.defaultChartHeight),continuousWidth:se(e.sizes.defaultChartWidth)},concat:{columns:1},facet:{columns:1},mark:{tooltip:{content:"encoding"},color:vN(e)},bar:{binSpacing:se(e.spacing.twoXS),discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return t?$N({},n,t,(r,i)=>Array.isArray(i)?i:void 0):n}function fB(t,e){const{colors:n,fontSizes:r,genericFonts:i}=e,o={labelFont:i.bodyFont,titleFont:i.bodyFont,labelFontSize:se(r.twoSm),titleFontSize:se(r.twoSm)},a={background:n.bgColor,axis:{labelColor:n.bodyText,titleColor:n.bodyText,gridColor:dd(e),...o},legend:{labelColor:n.bodyText,titleColor:n.bodyText,...o},title:{color:n.bodyText,subtitleColor:n.bodyText,...o},header:{labelColor:n.bodyText,titleColor:n.bodyText,...o},view:{stroke:dd(e),continuousHeight:se(e.sizes.defaultChartHeight),continuousWidth:se(e.sizes.defaultChartWidth)},mark:{tooltip:!0}};return t?_N({},a,t):a}const dB=20;function hB(t){"params"in t&&"encoding"in t&&t.params.forEach(e=>{"select"in e&&(["interval","point"].includes(e.select)&&(e.select={type:e.select}),"type"in e.select&&e.select.type==="point"&&!("encodings"in e.select)&&gg(e.select.encodings)&&(e.select.encodings=Object.keys(t.encoding)))})}const pB=(t,e,n,r,i,o,a,s)=>{var u,l;const c=JSON.parse(t);if(n==="streamlit"?c.config=iE(c.config,i):((l=(u=c.usermeta)==null?void 0:u.embedOptions)==null?void 0:l.theme)==="streamlit"?(c.config=iE(c.config,i),c.usermeta.embedOptions.theme=void 0):c.config=fB(c.config,i),o?(c.width=a,c.height=s,"vconcat"in c&&c.vconcat.forEach(f=>{f.width=a})):e&&(c.width=a,"vconcat"in c&&c.vconcat.forEach(f=>{f.width=a})),c.padding||(c.padding={}),gg(c.padding.bottom)&&(c.padding.bottom=dB),c.datasets)throw new Error("Datasets should not be passed as part of the spec");return r.length>0&&hB(c),c},mB=t=>{const e=wN(),{expanded:n,width:r,height:i}=WA(QA),{id:o,formId:a,spec:s,data:u,datasets:l,useContainerWidth:c,vegaLiteTheme:f,selectionMode:d}=t,h=Ee.useMemo(()=>d,[JSON.stringify(d)]),p=Ee.useMemo(()=>pB(s,c,f,h,e,n,r||0,i),[s,c,f,h,e,n,r,i]);return{id:o,formId:a,vegaLiteTheme:f,spec:p,selectionMode:h,data:u,datasets:l,useContainerWidth:c}};function Pi(t,e,n){return t.fields=e||[],t.fname=n,t}function gB(t){return t==null?null:t.fname}function oE(t){return t==null?null:t.fields}function aE(t){return t.length===1?yB(t[0]):vB(t)}const yB=t=>function(e){return e[t]},vB=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function xd(t){throw Error(t)}function Eg(t){const e=[],n=t.length;let r=null,i=0,o="",a,s,u;t=t+"";function l(){e.push(o+t.substring(a,s)),o="",a=s+1}for(a=s=0;s<n;++s)if(u=t[s],u==="\\")o+=t.substring(a,s++),a=s;else if(u===r)l(),r=null,i=-1;else{if(r)continue;a===i&&u==='"'||a===i&&u==="'"?(a=s+1,r=u):u==="."&&!i?s>a?l():a=s+1:u==="["?(s>a&&l(),i=a=s+1):u==="]"&&(i||xd("Access path missing open bracket: "+t),i>0&&l(),i=0,a=s+1)}return i&&xd("Access path missing closing bracket: "+t),r&&xd("Access path missing closing quote: "+t),s>a&&(s++,l()),e}function kg(t,e,n){const r=Eg(t);return t=r.length===1?r[0]:t,Pi((n&&n.get||aE)(r),[t],e||t)}const bB=kg("id"),Dg=Pi(t=>t,[],"identity"),xB=Pi(()=>0,[],"zero"),_B=Pi(()=>1,[],"one"),sE=Pi(()=>!0,[],"true"),wB=Pi(()=>!1,[],"false");function AB(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const uE=0,lE=1,cE=2,fE=3,dE=4;function EB(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:AB,r=t||uE;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=lE&&n(e||"error","ERROR",arguments),this},warn(){return r>=cE&&n(e||"warn","WARN",arguments),this},info(){return r>=fE&&n(e||"log","INFO",arguments),this},debug(){return r>=dE&&n(e||"log","DEBUG",arguments),this}}}var _d=Array.isArray;function Ea(t){return t===Object(t)}const hE=t=>t!=="__proto__";function Fg(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((r,i)=>{for(const o in i)if(o==="signals")r.signals=kB(r.signals,i.signals);else{const a=o==="legend"?{layout:1}:o==="style"?!0:null;wd(r,o,i[o],a)}return r},{})}function wd(t,e,n,r){if(!hE(e))return;let i,o;if(Ea(n)&&!_d(n)){o=Ea(t[e])?t[e]:t[e]={};for(i in n)r&&(r===!0||r[i])?wd(o,i,n[i]):hE(i)&&(o[i]=n[i])}else t[e]=n}function kB(t,e){if(t==null)return e;const n={},r=[];function i(o){n[o.name]||(n[o.name]=1,r.push(o))}return e.forEach(i),t.forEach(i),r}function Js(t){return t[t.length-1]}function Cg(t){return t==null||t===""?null:+t}const pE=t=>e=>t*Math.exp(e),mE=t=>e=>Math.log(t*e),gE=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),yE=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,Ad=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function Ed(t,e,n,r){const i=n(t[0]),o=n(Js(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function DB(t,e){return Ed(t,e,Cg,Dg)}function FB(t,e){var n=Math.sign(t[0]);return Ed(t,e,mE(n),pE(n))}function CB(t,e,n){return Ed(t,e,Ad(n),Ad(1/n))}function SB(t,e,n){return Ed(t,e,gE(n),yE(n))}function kd(t,e,n,r,i){const o=r(t[0]),a=r(Js(t)),s=e!=null?r(e):(o+a)/2;return[i(s+(o-s)*n),i(s+(a-s)*n)]}function $B(t,e,n){return kd(t,e,n,Cg,Dg)}function MB(t,e,n){const r=Math.sign(t[0]);return kd(t,e,n,mE(r),pE(r))}function OB(t,e,n,r){return kd(t,e,n,Ad(r),Ad(1/r))}function TB(t,e,n,r){return kd(t,e,n,gE(r),yE(r))}function NB(t){return 1+~~(new Date(t).getMonth()/3)}function BB(t){return 1+~~(new Date(t).getUTCMonth()/3)}function $l(t){return t!=null?_d(t)?t:[t]:[]}function zB(t,e,n){let r=t[0],i=t[1],o;return i<r&&(o=i,i=r,r=o),o=i-r,o>=n-e?[e,n]:[r=Math.min(Math.max(r,e),n-o),r+o]}function Dd(t){return typeof t=="function"}const RB="descending";function PB(t,e,n){n=n||{},e=$l(e)||[];const r=[],i=[],o={},a=n.comparator||LB;return $l(t).forEach((s,u)=>{s!=null&&(r.push(e[u]===RB?-1:1),i.push(s=Dd(s)?s:kg(s,null,n)),(oE(s)||[]).forEach(l=>o[l]=1))}),i.length===0?null:Pi(a(i,r),Object.keys(o))}const Sg=(t,e)=>(t<e||t==null)&&e!=null?-1:(t>e||e==null)&&t!=null?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e===e?-1:e!==e&&t===t?1:0),LB=(t,e)=>t.length===1?jB(t[0],e[0]):IB(t,e,t.length),jB=(t,e)=>function(n,r){return Sg(t(n),t(r))*e},IB=(t,e,n)=>(e.push(0),function(r,i){let o,a=0,s=-1;for(;a===0&&++s<n;)o=t[s],a=Sg(o(r),o(i));return a*e[s]});function UB(t){return Dd(t)?t:()=>t}function qB(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(e(r),n=null),t)}}function $g(t){for(let e,n,r=1,i=arguments.length;r<i;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t}function WB(t,e){let n=0,r,i,o,a;if(t&&(r=t.length))if(e==null){for(i=t[n];n<r&&(i==null||i!==i);i=t[++n]);for(o=a=i;n<r;++n)i=t[n],i!=null&&(i<o&&(o=i),i>a&&(a=i))}else{for(i=e(t[n]);n<r&&(i==null||i!==i);i=e(t[++n]));for(o=a=i;n<r;++n)i=e(t[n]),i!=null&&(i<o&&(o=i),i>a&&(a=i))}return[o,a]}function HB(t,e){const n=t.length;let r=-1,i,o,a,s,u;if(e==null){for(;++r<n;)if(o=t[r],o!=null&&o>=o){i=a=o;break}if(r===n)return[-1,-1];for(s=u=r;++r<n;)o=t[r],o!=null&&(i>o&&(i=o,s=r),a<o&&(a=o,u=r))}else{for(;++r<n;)if(o=e(t[r],r,t),o!=null&&o>=o){i=a=o;break}if(r===n)return[-1,-1];for(s=u=r;++r<n;)o=e(t[r],r,t),o!=null&&(i>o&&(i=o,s=r),a<o&&(a=o,u=r))}return[s,u]}const GB=Object.prototype.hasOwnProperty;function Li(t,e){return GB.call(t,e)}const Fd={};function XB(t){let e={},n;function r(o){return Li(e,o)&&e[o]!==Fd}const i={size:0,empty:0,object:e,has:r,get(o){return r(o)?e[o]:void 0},set(o,a){return r(o)||(++i.size,e[o]===Fd&&--i.empty),e[o]=a,this},delete(o){return r(o)&&(--i.size,++i.empty,e[o]=Fd),this},clear(){i.size=i.empty=0,i.object=e={}},test(o){return arguments.length?(n=o,i):n},clean(){const o={};let a=0;for(const s in e){const u=e[s];u!==Fd&&(!n||!n(u))&&(o[s]=u,++a)}i.size=a,i.empty=0,i.object=e=o}};return t&&Object.keys(t).forEach(o=>{i.set(o,t[o])}),i}function VB(t,e,n,r,i,o){if(!n&&n!==0)return o;const a=+n;let s=t[0],u=Js(t),l;u<s&&(l=s,s=u,u=l),l=Math.abs(e-s);const c=Math.abs(u-e);return l<c&&l<=a?r:c<=a?i:o}function YB(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),$g(r,n)}function JB(t,e,n,r){let i=e[0],o=e[e.length-1],a;return i>o&&(a=i,i=o,o=a),n=n===void 0||n,r=r===void 0||r,(n?i<=t:i<t)&&(r?t<=o:t<o)}function vE(t){return typeof t=="boolean"}function bE(t){return Object.prototype.toString.call(t)==="[object Date]"}function QB(t){return t&&Dd(t[Symbol.iterator])}function xE(t){return typeof t=="number"}function ZB(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ji(t){return typeof t=="string"}function KB(t,e,n){t&&(t=e?$l(t).map(s=>s.replace(/\\(.)/g,"$1")):$l(t));const r=t&&t.length,i=n&&n.get||aE,o=s=>i(e?[s]:Eg(s));let a;if(!r)a=function(){return""};else if(r===1){const s=o(t[0]);a=function(u){return""+s(u)}}else{const s=t.map(o);a=function(u){let l=""+s[0](u),c=0;for(;++c<r;)l+="|"+s[c](u);return l}}return Pi(a,t,"key")}function tz(t,e){const n=t[0],r=Js(t),i=+e;return i?i===1?r:n+i*(r-n):n}const ez=1e4;function nz(t){t=+t||ez;let e,n,r;const i=()=>{e={},n={},r=0},o=(a,s)=>(++r>t&&(n=e,e={},r=1),e[a]=s);return i(),{clear:i,has:a=>Li(e,a)||Li(n,a),get:a=>Li(e,a)?e[a]:Li(n,a)?o(a,n[a]):void 0,set:(a,s)=>Li(e,a)?e[a]=s:o(a,s)}}function rz(t,e,n,r){const i=e.length,o=n.length;if(!o)return e;if(!i)return n;const a=r||new e.constructor(i+o);let s=0,u=0,l=0;for(;s<i&&u<o;++l)a[l]=t(e[s],n[u])>0?n[u++]:e[s++];for(;s<i;++s,++l)a[l]=e[s];for(;u<o;++u,++l)a[l]=n[u];return a}function Ml(t,e){let n="";for(;--e>=0;)n+=t;return n}function iz(t,e,n,r){const i=n||" ",o=t+"",a=e-o.length;return a<=0?o:r==="left"?Ml(i,a)+o:r==="center"?Ml(i,~~(a/2))+o+Ml(i,Math.ceil(a/2)):o+Ml(i,a)}function oz(t){return t&&Js(t)-t[0]||0}function Qs(t){return _d(t)?"["+t.map(Qs)+"]":Ea(t)||ji(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function az(t){return t==null||t===""?null:!t||t==="false"||t==="0"?!1:!!t}const sz=t=>xE(t)||bE(t)?t:Date.parse(t);function uz(t,e){return e=e||sz,t==null||t===""?null:e(t)}function lz(t){return t==null||t===""?null:t+""}function cz(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function fz(t,e,n,r){const i=r??"\u2026",o=t+"",a=o.length,s=Math.max(0,e-i.length);return a<=e?o:n==="left"?i+o.slice(a-s):n==="center"?o.slice(0,Math.ceil(s/2))+i+o.slice(a-~~(s/2)):o.slice(0,s)+i}function dz(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const o=e(t[i]);o&&n(o,i,t)}}else t.forEach(n)}function Wn(t,e,n){return t.fields=e||[],t.fname=n,t}function ue(t){return t==null?null:t.fname}function un(t){return t==null?null:t.fields}function _E(t){return t.length===1?hz(t[0]):pz(t)}const hz=t=>function(e){return e[t]},pz=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function R(t){throw Error(t)}function Mg(t){const e=[],n=t.length;let r=null,i=0,o="",a,s,u;t=t+"";function l(){e.push(o+t.substring(a,s)),o="",a=s+1}for(a=s=0;s<n;++s)if(u=t[s],u==="\\")o+=t.substring(a,s++),a=s;else if(u===r)l(),r=null,i=-1;else{if(r)continue;a===i&&u==='"'||a===i&&u==="'"?(a=s+1,r=u):u==="."&&!i?s>a?l():a=s+1:u==="["?(s>a&&l(),i=a=s+1):u==="]"&&(i||R("Access path missing open bracket: "+t),i>0&&l(),i=0,a=s+1)}return i&&R("Access path missing closing bracket: "+t),r&&R("Access path missing closing quote: "+t),s>a&&(s++,l()),e}function wr(t,e,n){const r=Mg(t);return t=r.length===1?r[0]:t,Wn((n&&n.get||_E)(r),[t],e||t)}const Cd=wr("id"),Cn=Wn(t=>t,[],"identity"),ka=Wn(()=>0,[],"zero"),Ol=Wn(()=>1,[],"one"),Ar=Wn(()=>!0,[],"true"),Da=Wn(()=>!1,[],"false");function mz(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const gz=0,wE=1,yz=2,vz=3,bz=4;function xz(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mz,r=t||gz;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=wE&&n("error","ERROR",arguments),this},warn(){return r>=yz&&n("warn","WARN",arguments),this},info(){return r>=vz&&n("log","INFO",arguments),this},debug(){return r>=bz&&n("log","DEBUG",arguments),this}}}var K=Array.isArray;function mt(t){return t===Object(t)}const AE=t=>t!=="__proto__";function _z(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((r,i)=>{for(const o in i)if(o==="signals")r.signals=wz(r.signals,i.signals);else{const a=o==="legend"?{layout:1}:o==="style"?!0:null;EE(r,o,i[o],a)}return r},{})}function EE(t,e,n,r){if(!AE(e))return;let i,o;if(mt(n)&&!K(n)){o=mt(t[e])?t[e]:t[e]={};for(i in n)r&&(r===!0||r[i])?EE(o,i,n[i]):AE(i)&&(o[i]=n[i])}else t[e]=n}function wz(t,e){if(t==null)return e;const n={},r=[];function i(o){n[o.name]||(n[o.name]=1,r.push(o))}return e.forEach(i),t.forEach(i),r}function kt(t){return t[t.length-1]}function ln(t){return t==null||t===""?null:+t}const kE=t=>e=>t*Math.exp(e),DE=t=>e=>Math.log(t*e),FE=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),CE=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,Sd=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function $d(t,e,n,r){const i=n(t[0]),o=n(kt(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function Az(t,e){return $d(t,e,ln,Cn)}function Ez(t,e){var n=Math.sign(t[0]);return $d(t,e,DE(n),kE(n))}function kz(t,e,n){return $d(t,e,Sd(n),Sd(1/n))}function Dz(t,e,n){return $d(t,e,FE(n),CE(n))}function Md(t,e,n,r,i){const o=r(t[0]),a=r(kt(t)),s=e!=null?r(e):(o+a)/2;return[i(s+(o-s)*n),i(s+(a-s)*n)]}function SE(t,e,n){return Md(t,e,n,ln,Cn)}function $E(t,e,n){const r=Math.sign(t[0]);return Md(t,e,n,DE(r),kE(r))}function Og(t,e,n,r){return Md(t,e,n,Sd(r),Sd(1/r))}function ME(t,e,n,r){return Md(t,e,n,FE(r),CE(r))}function Fz(t){return 1+~~(new Date(t).getMonth()/3)}function Cz(t){return 1+~~(new Date(t).getUTCMonth()/3)}function rt(t){return t!=null?K(t)?t:[t]:[]}function Sz(t,e,n){let r=t[0],i=t[1],o;return i<r&&(o=i,i=r,r=o),o=i-r,o>=n-e?[e,n]:[r=Math.min(Math.max(r,e),n-o),r+o]}function gt(t){return typeof t=="function"}const $z="descending";function OE(t,e,n){n=n||{},e=rt(e)||[];const r=[],i=[],o={},a=n.comparator||Mz;return rt(t).forEach((s,u)=>{s!=null&&(r.push(e[u]===$z?-1:1),i.push(s=gt(s)?s:wr(s,null,n)),(un(s)||[]).forEach(l=>o[l]=1))}),i.length===0?null:Wn(a(i,r),Object.keys(o))}const Tl=(t,e)=>(t<e||t==null)&&e!=null?-1:(t>e||e==null)&&t!=null?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e===e?-1:e!==e&&t===t?1:0),Mz=(t,e)=>t.length===1?Oz(t[0],e[0]):Tz(t,e,t.length),Oz=(t,e)=>function(n,r){return Tl(t(n),t(r))*e},Tz=(t,e,n)=>(e.push(0),function(r,i){let o,a=0,s=-1;for(;a===0&&++s<n;)o=t[s],a=Tl(o(r),o(i));return a*e[s]});function cn(t){return gt(t)?t:()=>t}function TE(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(e(r),n=null),t)}}function yt(t){for(let e,n,r=1,i=arguments.length;r<i;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t}function Ii(t,e){let n=0,r,i,o,a;if(t&&(r=t.length))if(e==null){for(i=t[n];n<r&&(i==null||i!==i);i=t[++n]);for(o=a=i;n<r;++n)i=t[n],i!=null&&(i<o&&(o=i),i>a&&(a=i))}else{for(i=e(t[n]);n<r&&(i==null||i!==i);i=e(t[++n]));for(o=a=i;n<r;++n)i=e(t[n]),i!=null&&(i<o&&(o=i),i>a&&(a=i))}return[o,a]}function Nz(t,e){const n=t.length;let r=-1,i,o,a,s,u;if(e==null){for(;++r<n;)if(o=t[r],o!=null&&o>=o){i=a=o;break}if(r===n)return[-1,-1];for(s=u=r;++r<n;)o=t[r],o!=null&&(i>o&&(i=o,s=r),a<o&&(a=o,u=r))}else{for(;++r<n;)if(o=e(t[r],r,t),o!=null&&o>=o){i=a=o;break}if(r===n)return[-1,-1];for(s=u=r;++r<n;)o=e(t[r],r,t),o!=null&&(i>o&&(i=o,s=r),a<o&&(a=o,u=r))}return[s,u]}function lt(t,e){return Object.hasOwn(t,e)}const Od={};function Nl(t){let e={},n;function r(o){return lt(e,o)&&e[o]!==Od}const i={size:0,empty:0,object:e,has:r,get(o){return r(o)?e[o]:void 0},set(o,a){return r(o)||(++i.size,e[o]===Od&&--i.empty),e[o]=a,this},delete(o){return r(o)&&(--i.size,++i.empty,e[o]=Od),this},clear(){i.size=i.empty=0,i.object=e={}},test(o){return arguments.length?(n=o,i):n},clean(){const o={};let a=0;for(const s in e){const u=e[s];u!==Od&&(!n||!n(u))&&(o[s]=u,++a)}i.size=a,i.empty=0,i.object=e=o}};return t&&Object.keys(t).forEach(o=>{i.set(o,t[o])}),i}function Bz(t,e,n,r,i,o){if(!n&&n!==0)return o;const a=+n;let s=t[0],u=kt(t),l;u<s&&(l=s,s=u,u=l),l=Math.abs(e-s);const c=Math.abs(u-e);return l<c&&l<=a?r:c<=a?i:o}function H(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),yt(r,n)}function Bl(t,e,n,r){let i=e[0],o=e[e.length-1],a;return i>o&&(a=i,i=o,o=a),n=n===void 0||n,r=r===void 0||r,(n?i<=t:i<t)&&(r?t<=o:t<o)}function zz(t){return typeof t=="boolean"}function Fa(t){return Object.prototype.toString.call(t)==="[object Date]"}function Rz(t){return t&&gt(t[Symbol.iterator])}function Ca(t){return typeof t=="number"}function NE(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Xt(t){return typeof t=="string"}function BE(t,e,n){t&&(t=e?rt(t).map(s=>s.replace(/\\(.)/g,"$1")):rt(t));const r=t&&t.length,i=n&&n.get||_E,o=s=>i(e?[s]:Mg(s));let a;if(!r)a=function(){return""};else if(r===1){const s=o(t[0]);a=function(u){return""+s(u)}}else{const s=t.map(o);a=function(u){let l=""+s[0](u),c=0;for(;++c<r;)l+="|"+s[c](u);return l}}return Wn(a,t,"key")}function Pz(t,e){const n=t[0],r=kt(t),i=+e;return i?i===1?r:n+i*(r-n):n}const Lz=1e4;function jz(t){t=+t||Lz;let e,n,r;const i=()=>{e={},n={},r=0},o=(a,s)=>(++r>t&&(n=e,e={},r=1),e[a]=s);return i(),{clear:i,has:a=>lt(e,a)||lt(n,a),get:a=>lt(e,a)?e[a]:lt(n,a)?o(a,n[a]):void 0,set:(a,s)=>lt(e,a)?e[a]=s:o(a,s)}}function Iz(t,e,n,r){const i=e.length,o=n.length;if(!o)return e;if(!i)return n;const a=r||new e.constructor(i+o);let s=0,u=0,l=0;for(;s<i&&u<o;++l)a[l]=t(e[s],n[u])>0?n[u++]:e[s++];for(;s<i;++s,++l)a[l]=e[s];for(;u<o;++u,++l)a[l]=n[u];return a}function Td(t,e){let n="";for(;--e>=0;)n+=t;return n}function Uz(t,e,n,r){const i=n||" ",o=t+"",a=e-o.length;return a<=0?o:r==="left"?Td(i,a)+o:r==="center"?Td(i,~~(a/2))+o+Td(i,Math.ceil(a/2)):o+Td(i,a)}function Nd(t){return t&&kt(t)-t[0]||0}function it(t){return K(t)?"["+t.map(it)+"]":mt(t)||Xt(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function zE(t){return t==null||t===""?null:!t||t==="false"||t==="0"?!1:!!t}const qz=t=>Ca(t)||Fa(t)?t:Date.parse(t);function RE(t,e){return e=e||qz,t==null||t===""?null:e(t)}function PE(t){return t==null||t===""?null:t+""}function ti(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function Wz(t,e,n,r){const i=r??"\u2026",o=t+"",a=o.length,s=Math.max(0,e-i.length);return a<=e?o:n==="left"?i+o.slice(a-s):n==="center"?o.slice(0,Math.ceil(s/2))+i+o.slice(a-~~(s/2)):o.slice(0,s)+i}function Sa(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const o=e(t[i]);o&&n(o,i,t)}}else t.forEach(n)}var LE={},Tg={},Ng=34,zl=10,Bg=13;function jE(t){return new Function("d","return {"+t.map(function(e,n){return JSON.stringify(e)+": d["+n+'] || ""'}).join(",")+"}")}function Hz(t,e){var n=jE(t);return function(r,i){return e(n(r),i,t)}}function IE(t){var e=Object.create(null),n=[];return t.forEach(function(r){for(var i in r)i in e||n.push(e[i]=i)}),n}function Sn(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Gz(t){return t<0?"-"+Sn(-t,6):t>9999?"+"+Sn(t,6):Sn(t,4)}function Xz(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":Gz(t.getUTCFullYear())+"-"+Sn(t.getUTCMonth()+1,2)+"-"+Sn(t.getUTCDate(),2)+(i?"T"+Sn(e,2)+":"+Sn(n,2)+":"+Sn(r,2)+"."+Sn(i,3)+"Z":r?"T"+Sn(e,2)+":"+Sn(n,2)+":"+Sn(r,2)+"Z":n||e?"T"+Sn(e,2)+":"+Sn(n,2)+"Z":"")}function Vz(t){var e=new RegExp('["'+t+`
2
2
  \r]`),n=t.charCodeAt(0);function r(f,d){var h,p,m=i(f,function(g,y){if(h)return h(g,y-1);p=g,h=d?Hz(g,d):jE(g)});return m.columns=p||[],m}function i(f,d){var h=[],p=f.length,m=0,g=0,y,v=p<=0,b=!1;f.charCodeAt(p-1)===zl&&--p,f.charCodeAt(p-1)===Bg&&--p;function x(){if(v)return Tg;if(b)return b=!1,LE;var A,_=m,E;if(f.charCodeAt(_)===Ng){for(;m++<p&&f.charCodeAt(m)!==Ng||f.charCodeAt(++m)===Ng;);return(A=m)>=p?v=!0:(E=f.charCodeAt(m++))===zl?b=!0:E===Bg&&(b=!0,f.charCodeAt(m)===zl&&++m),f.slice(_+1,A-1).replace(/""/g,'"')}for(;m<p;){if((E=f.charCodeAt(A=m++))===zl)b=!0;else if(E===Bg)b=!0,f.charCodeAt(m)===zl&&++m;else if(E!==n)continue;return f.slice(_,A)}return v=!0,f.slice(_,p)}for(;(y=x())!==Tg;){for(var w=[];y!==LE&&y!==Tg;)w.push(y),y=x();d&&(w=d(w,g++))==null||h.push(w)}return h}function o(f,d){return f.map(function(h){return d.map(function(p){return c(h[p])}).join(t)})}function a(f,d){return d==null&&(d=IE(f)),[d.map(c).join(t)].concat(o(f,d)).join(`
3
3
  `)}function s(f,d){return d==null&&(d=IE(f)),o(f,d).join(`
4
4
  `)}function u(f){return f.map(l).join(`
@@ -1 +1 @@
1
- import{r as S,E as R,_ as E,c as x,I as q,j as h,c0 as Q,bI as z,bW as J,bD as Z,bX as O,c8 as _,e as K,g as Y,bf as ee,A as te,c9 as re,ca as ie,cb as se,R as oe,l as ae,b3 as ne,L as P,bT as le,bS as de,bZ as ce,b_ as ue,cc as he,b$ as pe}from"./index-Cbvbjd8C.js";import{a as V}from"./index-xsH4HHeE.js";import{F as ge}from"./FormClearHelper-CT0Jwp4X.js";import{U as L}from"./UploadFileInfo-C-jY39rj.js";import{P as fe,S as me}from"./ProgressBar-CA-bplbU.js";var D=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),S.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});D.displayName="Video";var W=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),S.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});W.displayName="X";var $=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),S.createElement("rect",{width:24,height:24,fill:"none"}),S.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});$.displayName="SwitchCamera";function ve(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const H=x("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),T=x("div",{target:"etz5kuj8"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),ye=x("p",{target:"etz5kuj7"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"}),""),Se=x("img",{target:"etz5kuj6"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),be=x("a",{target:"etz5kuj5"})(({theme:i})=>({color:i.colors.primary,display:"block",textDecoration:"none"}),""),we=x("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),Me=x("div",{target:"etz5kuj3"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),Ue=x("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),Ce=x("button",{target:"etz5kuj0"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40,borderColor:i.colors.borderColor,backgroundColor:i.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,margin:i.spacing.none,lineHeight:i.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${q(i.colors.primary,.5)}`},...ve("medium",i)}),"");function xe({disabled:i,onClick:l,children:e,progress:o}){return h.jsxs(Ce,{disabled:i||!1,onClick:l||(()=>{}),progress:o||null,"data-testid":"stCameraInputButton",children:[e,o?h.jsx(Ue,{children:h.jsx(fe,{value:o,size:me.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const A=S.memo(xe);var F=(i=>(i.USER="user",i.ENVIRONMENT="environment",i))(F||{});const Ie=({switchFacingMode:i})=>h.jsx(Me,{"data-testid":"stCameraInputSwitchButton",children:h.jsx(Q,{content:"Switch camera",placement:z.TOP_RIGHT,children:h.jsx(J,{kind:Z.MINIMAL,onClick:i,children:h.jsx(O,{content:$,size:"twoXL",color:_.white})})})}),je=S.memo(Ie);var k={exports:{}},Pe=k.exports,N;function Fe(){return N||(N=1,function(i,l){(function(e,o){i.exports=o(K())})(Pe,function(e){return function(o){var a={};function s(n){if(a[n])return a[n].exports;var p=a[n]={i:n,l:!1,exports:{}};return o[n].call(p.exports,p,p.exports,s),p.l=!0,p.exports}return s.m=o,s.c=a,s.d=function(n,p,y){s.o(n,p)||Object.defineProperty(n,p,{enumerable:!0,get:y})},s.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},s.t=function(n,p){if(p&1&&(n=s(n)),p&8||p&4&&typeof n=="object"&&n&&n.__esModule)return n;var y=Object.create(null);if(s.r(y),Object.defineProperty(y,"default",{enumerable:!0,value:n}),p&2&&typeof n!="string")for(var C in n)s.d(y,C,(function(U){return n[U]}).bind(null,C));return y},s.n=function(n){var p=n&&n.__esModule?function(){return n.default}:function(){return n};return s.d(p,"a",p),p},s.o=function(n,p){return Object.prototype.hasOwnProperty.call(n,p)},s.p="",s(s.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(o,a,s){s.r(a);var n=s("react"),p=function(){var g=function(u,t){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,c){r.__proto__=c}||function(r,c){for(var d in c)c.hasOwnProperty(d)&&(r[d]=c[d])},g(u,t)};return function(u,t){g(u,t);function r(){this.constructor=u}u.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),y=function(){return y=Object.assign||function(g){for(var u,t=1,r=arguments.length;t<r;t++){u=arguments[t];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(g[c]=u[c])}return g},y.apply(this,arguments)},C=function(g,u){var t={};for(var r in g)Object.prototype.hasOwnProperty.call(g,r)&&u.indexOf(r)<0&&(t[r]=g[r]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,r=Object.getOwnPropertySymbols(g);c<r.length;c++)u.indexOf(r[c])<0&&Object.prototype.propertyIsEnumerable.call(g,r[c])&&(t[r[c]]=g[r[c]]);return t};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(g){var u=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return u?new Promise(function(t,r){u.call(navigator,g,t,r)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=function(g){p(u,g);function u(t){var r=g.call(this,t)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return u.prototype.componentDidMount=function(){var t=this,r=t.state,c=t.props;if(this.unmounted=!1,!U()){c.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),c.children&&typeof c.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(t){var r=this.props;if(!U()){r.onUserMediaError("getUserMedia not supported");return}var c=JSON.stringify(t.audioConstraints)!==JSON.stringify(r.audioConstraints),d=JSON.stringify(t.videoConstraints)!==JSON.stringify(r.videoConstraints),w=t.minScreenshotWidth!==r.minScreenshotWidth,v=t.minScreenshotHeight!==r.minScreenshotHeight;(d||w||v)&&(this.canvas=null,this.ctx=null),(c||d)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.stopMediaStream=function(t){t&&(t.getVideoTracks&&t.getAudioTracks?(t.getVideoTracks().map(function(r){t.removeTrack(r),r.stop()}),t.getAudioTracks().map(function(r){t.removeTrack(r),r.stop()})):t.stop())},u.prototype.stopAndCleanup=function(){var t=this.state;t.hasUserMedia&&(u.stopMediaStream(this.stream),t.src&&window.URL.revokeObjectURL(t.src))},u.prototype.getScreenshot=function(t){var r=this,c=r.state,d=r.props;if(!c.hasUserMedia)return null;var w=this.getCanvas(t);return w&&w.toDataURL(d.screenshotFormat,d.screenshotQuality)},u.prototype.getCanvas=function(t){var r=this,c=r.state,d=r.props;if(!this.video||!c.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var w=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var m=w/v;w=d.minScreenshotWidth||this.video.clientWidth,v=w/m,d.minScreenshotHeight&&v<d.minScreenshotHeight&&(v=d.minScreenshotHeight,w=v*m)}this.canvas=document.createElement("canvas"),this.canvas.width=(t==null?void 0:t.width)||w,this.canvas.height=(t==null?void 0:t.height)||v,this.ctx=this.canvas.getContext("2d")}var M=this,b=M.ctx,f=M.canvas;return b&&f&&(f.width=(t==null?void 0:t.width)||f.width,f.height=(t==null?void 0:t.height)||f.height,d.mirrored&&(b.translate(f.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=d.imageSmoothing,b.drawImage(this.video,0,0,(t==null?void 0:t.width)||f.width,(t==null?void 0:t.height)||f.height),d.mirrored&&(b.scale(-1,1),b.translate(-f.width,0))),f},u.prototype.requestUserMedia=function(){var t=this,r=this.props,c=function(v,m){var M={video:typeof m<"u"?m:!0};r.audio&&(M.audio=typeof v<"u"?v:!0),t.requestUserMediaId++;var b=t.requestUserMediaId;navigator.mediaDevices.getUserMedia(M).then(function(f){t.unmounted||b!==t.requestUserMediaId?u.stopMediaStream(f):t.handleUserMedia(null,f)}).catch(function(f){t.handleUserMedia(f)})};if("mediaDevices"in navigator)c(r.audioConstraints,r.videoConstraints);else{var d=function(v){return{optional:[{sourceId:v}]}},w=function(v){var m=v.deviceId;return typeof m=="string"?m:Array.isArray(m)&&m.length>0?m[0]:typeof m=="object"&&m.ideal?m.ideal:null};MediaStreamTrack.getSources(function(v){var m=null,M=null;v.forEach(function(j){j.kind==="audio"?m=j.id:j.kind==="video"&&(M=j.id)});var b=w(r.audioConstraints);b&&(m=b);var f=w(r.videoConstraints);f&&(M=f),c(d(m),d(M))})}},u.prototype.handleUserMedia=function(t,r){var c=this.props;if(t||!r){this.setState({hasUserMedia:!1}),c.onUserMediaError(t);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}c.onUserMedia(r)},u.prototype.render=function(){var t=this,r=this,c=r.state,d=r.props,w=d.audio;d.forceScreenshotSourceSize;var v=d.disablePictureInPicture;d.onUserMedia,d.onUserMediaError,d.screenshotFormat,d.screenshotQuality,d.minScreenshotWidth,d.minScreenshotHeight,d.audioConstraints,d.videoConstraints,d.imageSmoothing;var m=d.mirrored,M=d.style,b=M===void 0?{}:M,f=d.children,j=C(d,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),B=m?y(y({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,G={getScreenshot:this.getScreenshot.bind(this)};return n.createElement(n.Fragment,null,n.createElement("video",y({autoPlay:!0,disablePictureInPicture:v,src:c.src,muted:!w,playsInline:!0,ref:function(X){t.video=X},style:B},j)),f&&f(G))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(n.Component);a.default=I},react:function(o,a){o.exports=e}}).default})}(k)),k.exports}var Re=Fe();const Ee=Y(Re),Oe=({width:i})=>h.jsxs(T,{width:i,children:[h.jsx(O,{size:"threeXL",color:_.gray60,content:D}),h.jsxs(ye,{children:["This app would like to use your camera.",h.jsx(be,{href:ie,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Te=({handleCapture:i,width:l,disabled:e,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:s,setFacingMode:n,testOverride:p})=>{const[y,C]=S.useState(p||"pending"),U=S.useRef(null),[I,g]=S.useState(l),u=S.useCallback(ee(1e3,g),[]);S.useEffect(()=>{u(l)},[l,u]);function t(){if(U.current!==null){const c=U.current.getScreenshot();i(c)}}const r=te();return h.jsxs(H,{"data-testid":"stCameraInputWebcamComponent",children:[y!=="success"&&!e&&!o?h.jsx(Oe,{width:I}):re.isMobile&&h.jsx(je,{switchFacingMode:n}),h.jsx(T,{"data-testid":"stCameraInputWebcamStyledBox",hidden:y!=="success"&&!e&&!o,width:I,children:!e&&h.jsx(Ee,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{C("error")},onUserMedia:()=>{C("success"),a(!1)},videoConstraints:{width:{ideal:I},facingMode:s}})}),h.jsx(A,{onClick:t,disabled:y!=="success"||e||o,children:"Take Photo"})]})},ke=S.memo(Te),ze=150,_e=ae.getLogger("CameraInput");class Ve extends oe.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new ge,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState(e=>({facingMode:e.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=e=>{if(e===null)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});const o=a=>new Promise(s=>setTimeout(s,a));return Le(e,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(a=>this.props.uploadClient.fetchFileURLs([a]).then(s=>({file:a,fileUrls:s[0]}))).then(({file:a,fileUrls:s})=>this.uploadFile(s,a)).then(()=>o(ze)).then(()=>{this.setState((a,s)=>({imgSrc:e,shutter:a.shutter,minShutterEffectPassed:!0}))}).catch(a=>{_e.error(a)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(e=>this.deleteFile(e.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:o,widgetMgr:a,fragmentId:s}=this.props,n=a.getFileUploaderStateValue(o);ne(e,n)||a.setFileUploaderStateValue(o,e,{fromUi:!0},s)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(P(e))return;this.setState({imgSrc:null});const{widgetMgr:o,element:a,fragmentId:s}=this.props;o.setFileUploaderStateValue(a,e,{fromUi:!0},s)})},this.deleteFile=e=>{const o=this.getFile(e);P(o)||(o.status.type==="uploading"&&o.status.cancelToken.cancel(),o.status.type==="uploaded"&&o.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(o.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(o=>({files:[...o.files,e]}))},this.removeFile=e=>{this.setState(o=>({files:o.files.filter(a=>a.id!==e)}))},this.getFile=e=>this.state.files.find(o=>o.id===e),this.updateFile=(e,o)=>{this.setState(a=>({files:a.files.map(s=>s.id===e?o:s)}))},this.onUploadComplete=(e,o)=>{this.setState(()=>({shutter:!1}));const a=this.getFile(e);P(a)||a.status.type!=="uploading"||this.updateFile(a.id,a.setStatus({type:"uploaded",fileId:o.fileId,fileUrls:o}))},this.onUploadProgress=(e,o)=>{const a=this.getFile(o);if(P(a)||a.status.type!=="uploading")return;const s=Math.round(e.loaded*100/e.total);a.status.progress!==s&&this.updateFile(o,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:s}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,o)=>{const a=V.CancelToken.source(),s=new L(o.name,o.size,this.nextLocalFileId(),{type:"uploading",cancelToken:a,progress:1});this.addFile(s),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,o,n=>this.onUploadProgress(n,s.id),a.token).then(()=>this.onUploadComplete(s.id,e)).catch(n=>{V.isCancel(n)||this.updateFile(s.id,s.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:e,element:o}=this.props,a=e.getFileUploaderStateValue(o);if(P(a))return l;const{uploadedFileInfo:s}=a;return P(s)||s.length===0?l:{files:s.map(n=>{const p=n.name,y=n.size,C=n.fileId,U=n.fileUrls;return new L(p,y,this.nextLocalFileId(),{type:"uploaded",fileId:C,fileUrls:U})}),imgSrc:s.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=e=>e.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:e,widgetMgr:o,fragmentId:a}=this.props;o.getFileUploaderStateValue(e)===void 0&&o.setFileUploaderStateValue(e,l,{fromUi:!1},a)}createWidgetValue(){const l=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:o,size:a,status:s}=e;return new le({fileId:s.fileId,fileUrls:s.fileUrls,name:o,size:a})});return new de({uploadedFileInfo:l})}render(){var l;const{element:e,widgetMgr:o,disabled:a,width:s}=this.props;return this.formClearHelper.manageFormClearListener(o,e.formId,this.onFormCleared),h.jsxs(H,{className:"stCameraInput","data-testid":"stCameraInput",children:[h.jsx(ce,{label:e.label,disabled:a,labelVisibility:ue((l=e.labelVisibility)==null?void 0:l.value),children:e.help&&h.jsx(he,{children:h.jsx(pe,{content:e.help,placement:z.TOP_RIGHT})})}),this.state.imgSrc?h.jsxs(h.Fragment,{children:[h.jsx(T,{width:s,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h.jsx(Se,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:s,height:s*9/16})}),h.jsx(A,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||a,children:this.getProgress()?"Uploading...":h.jsxs(we,{children:[h.jsx(O,{content:W,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h.jsx(ke,{handleCapture:this.handleCapture,width:s,disabled:a,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Le(i,l){return fetch(i).then(e=>e.arrayBuffer()).then(e=>new File([e],l,{type:"image/jpeg"}))}const De=se(Ve);export{De as default};
1
+ import{r as S,E as R,_ as E,c as x,I as q,j as h,c0 as Q,bI as z,bW as J,bD as Z,bX as O,c8 as _,e as K,g as Y,bf as ee,A as te,c9 as re,ca as ie,cb as se,R as oe,l as ae,b3 as ne,L as P,bT as le,bS as de,bZ as ce,b_ as ue,cc as he,b$ as pe}from"./index-DPBNUFWE.js";import{a as V}from"./index-xsH4HHeE.js";import{F as ge}from"./FormClearHelper-BZaxoxQN.js";import{U as L}from"./UploadFileInfo-C-jY39rj.js";import{P as fe,S as me}from"./ProgressBar-C_yUO6k-.js";var D=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),S.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});D.displayName="Video";var W=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),S.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});W.displayName="X";var $=S.forwardRef(function(i,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(R,E({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),S.createElement("rect",{width:24,height:24,fill:"none"}),S.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});$.displayName="SwitchCamera";function ve(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const H=x("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),T=x("div",{target:"etz5kuj8"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),ye=x("p",{target:"etz5kuj7"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"}),""),Se=x("img",{target:"etz5kuj6"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),be=x("a",{target:"etz5kuj5"})(({theme:i})=>({color:i.colors.primary,display:"block",textDecoration:"none"}),""),we=x("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),Me=x("div",{target:"etz5kuj3"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),Ue=x("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),Ce=x("button",{target:"etz5kuj0"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40,borderColor:i.colors.borderColor,backgroundColor:i.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,margin:i.spacing.none,lineHeight:i.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${q(i.colors.primary,.5)}`},...ve("medium",i)}),"");function xe({disabled:i,onClick:l,children:e,progress:o}){return h.jsxs(Ce,{disabled:i||!1,onClick:l||(()=>{}),progress:o||null,"data-testid":"stCameraInputButton",children:[e,o?h.jsx(Ue,{children:h.jsx(fe,{value:o,size:me.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const A=S.memo(xe);var F=(i=>(i.USER="user",i.ENVIRONMENT="environment",i))(F||{});const Ie=({switchFacingMode:i})=>h.jsx(Me,{"data-testid":"stCameraInputSwitchButton",children:h.jsx(Q,{content:"Switch camera",placement:z.TOP_RIGHT,children:h.jsx(J,{kind:Z.MINIMAL,onClick:i,children:h.jsx(O,{content:$,size:"twoXL",color:_.white})})})}),je=S.memo(Ie);var k={exports:{}},Pe=k.exports,N;function Fe(){return N||(N=1,function(i,l){(function(e,o){i.exports=o(K())})(Pe,function(e){return function(o){var a={};function s(n){if(a[n])return a[n].exports;var p=a[n]={i:n,l:!1,exports:{}};return o[n].call(p.exports,p,p.exports,s),p.l=!0,p.exports}return s.m=o,s.c=a,s.d=function(n,p,y){s.o(n,p)||Object.defineProperty(n,p,{enumerable:!0,get:y})},s.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},s.t=function(n,p){if(p&1&&(n=s(n)),p&8||p&4&&typeof n=="object"&&n&&n.__esModule)return n;var y=Object.create(null);if(s.r(y),Object.defineProperty(y,"default",{enumerable:!0,value:n}),p&2&&typeof n!="string")for(var C in n)s.d(y,C,(function(U){return n[U]}).bind(null,C));return y},s.n=function(n){var p=n&&n.__esModule?function(){return n.default}:function(){return n};return s.d(p,"a",p),p},s.o=function(n,p){return Object.prototype.hasOwnProperty.call(n,p)},s.p="",s(s.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(o,a,s){s.r(a);var n=s("react"),p=function(){var g=function(u,t){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,c){r.__proto__=c}||function(r,c){for(var d in c)c.hasOwnProperty(d)&&(r[d]=c[d])},g(u,t)};return function(u,t){g(u,t);function r(){this.constructor=u}u.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),y=function(){return y=Object.assign||function(g){for(var u,t=1,r=arguments.length;t<r;t++){u=arguments[t];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(g[c]=u[c])}return g},y.apply(this,arguments)},C=function(g,u){var t={};for(var r in g)Object.prototype.hasOwnProperty.call(g,r)&&u.indexOf(r)<0&&(t[r]=g[r]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,r=Object.getOwnPropertySymbols(g);c<r.length;c++)u.indexOf(r[c])<0&&Object.prototype.propertyIsEnumerable.call(g,r[c])&&(t[r[c]]=g[r[c]]);return t};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(g){var u=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return u?new Promise(function(t,r){u.call(navigator,g,t,r)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=function(g){p(u,g);function u(t){var r=g.call(this,t)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return u.prototype.componentDidMount=function(){var t=this,r=t.state,c=t.props;if(this.unmounted=!1,!U()){c.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),c.children&&typeof c.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(t){var r=this.props;if(!U()){r.onUserMediaError("getUserMedia not supported");return}var c=JSON.stringify(t.audioConstraints)!==JSON.stringify(r.audioConstraints),d=JSON.stringify(t.videoConstraints)!==JSON.stringify(r.videoConstraints),w=t.minScreenshotWidth!==r.minScreenshotWidth,v=t.minScreenshotHeight!==r.minScreenshotHeight;(d||w||v)&&(this.canvas=null,this.ctx=null),(c||d)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.stopMediaStream=function(t){t&&(t.getVideoTracks&&t.getAudioTracks?(t.getVideoTracks().map(function(r){t.removeTrack(r),r.stop()}),t.getAudioTracks().map(function(r){t.removeTrack(r),r.stop()})):t.stop())},u.prototype.stopAndCleanup=function(){var t=this.state;t.hasUserMedia&&(u.stopMediaStream(this.stream),t.src&&window.URL.revokeObjectURL(t.src))},u.prototype.getScreenshot=function(t){var r=this,c=r.state,d=r.props;if(!c.hasUserMedia)return null;var w=this.getCanvas(t);return w&&w.toDataURL(d.screenshotFormat,d.screenshotQuality)},u.prototype.getCanvas=function(t){var r=this,c=r.state,d=r.props;if(!this.video||!c.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var w=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var m=w/v;w=d.minScreenshotWidth||this.video.clientWidth,v=w/m,d.minScreenshotHeight&&v<d.minScreenshotHeight&&(v=d.minScreenshotHeight,w=v*m)}this.canvas=document.createElement("canvas"),this.canvas.width=(t==null?void 0:t.width)||w,this.canvas.height=(t==null?void 0:t.height)||v,this.ctx=this.canvas.getContext("2d")}var M=this,b=M.ctx,f=M.canvas;return b&&f&&(f.width=(t==null?void 0:t.width)||f.width,f.height=(t==null?void 0:t.height)||f.height,d.mirrored&&(b.translate(f.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=d.imageSmoothing,b.drawImage(this.video,0,0,(t==null?void 0:t.width)||f.width,(t==null?void 0:t.height)||f.height),d.mirrored&&(b.scale(-1,1),b.translate(-f.width,0))),f},u.prototype.requestUserMedia=function(){var t=this,r=this.props,c=function(v,m){var M={video:typeof m<"u"?m:!0};r.audio&&(M.audio=typeof v<"u"?v:!0),t.requestUserMediaId++;var b=t.requestUserMediaId;navigator.mediaDevices.getUserMedia(M).then(function(f){t.unmounted||b!==t.requestUserMediaId?u.stopMediaStream(f):t.handleUserMedia(null,f)}).catch(function(f){t.handleUserMedia(f)})};if("mediaDevices"in navigator)c(r.audioConstraints,r.videoConstraints);else{var d=function(v){return{optional:[{sourceId:v}]}},w=function(v){var m=v.deviceId;return typeof m=="string"?m:Array.isArray(m)&&m.length>0?m[0]:typeof m=="object"&&m.ideal?m.ideal:null};MediaStreamTrack.getSources(function(v){var m=null,M=null;v.forEach(function(j){j.kind==="audio"?m=j.id:j.kind==="video"&&(M=j.id)});var b=w(r.audioConstraints);b&&(m=b);var f=w(r.videoConstraints);f&&(M=f),c(d(m),d(M))})}},u.prototype.handleUserMedia=function(t,r){var c=this.props;if(t||!r){this.setState({hasUserMedia:!1}),c.onUserMediaError(t);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}c.onUserMedia(r)},u.prototype.render=function(){var t=this,r=this,c=r.state,d=r.props,w=d.audio;d.forceScreenshotSourceSize;var v=d.disablePictureInPicture;d.onUserMedia,d.onUserMediaError,d.screenshotFormat,d.screenshotQuality,d.minScreenshotWidth,d.minScreenshotHeight,d.audioConstraints,d.videoConstraints,d.imageSmoothing;var m=d.mirrored,M=d.style,b=M===void 0?{}:M,f=d.children,j=C(d,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),B=m?y(y({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,G={getScreenshot:this.getScreenshot.bind(this)};return n.createElement(n.Fragment,null,n.createElement("video",y({autoPlay:!0,disablePictureInPicture:v,src:c.src,muted:!w,playsInline:!0,ref:function(X){t.video=X},style:B},j)),f&&f(G))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(n.Component);a.default=I},react:function(o,a){o.exports=e}}).default})}(k)),k.exports}var Re=Fe();const Ee=Y(Re),Oe=({width:i})=>h.jsxs(T,{width:i,children:[h.jsx(O,{size:"threeXL",color:_.gray60,content:D}),h.jsxs(ye,{children:["This app would like to use your camera.",h.jsx(be,{href:ie,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Te=({handleCapture:i,width:l,disabled:e,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:s,setFacingMode:n,testOverride:p})=>{const[y,C]=S.useState(p||"pending"),U=S.useRef(null),[I,g]=S.useState(l),u=S.useCallback(ee(1e3,g),[]);S.useEffect(()=>{u(l)},[l,u]);function t(){if(U.current!==null){const c=U.current.getScreenshot();i(c)}}const r=te();return h.jsxs(H,{"data-testid":"stCameraInputWebcamComponent",children:[y!=="success"&&!e&&!o?h.jsx(Oe,{width:I}):re.isMobile&&h.jsx(je,{switchFacingMode:n}),h.jsx(T,{"data-testid":"stCameraInputWebcamStyledBox",hidden:y!=="success"&&!e&&!o,width:I,children:!e&&h.jsx(Ee,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{C("error")},onUserMedia:()=>{C("success"),a(!1)},videoConstraints:{width:{ideal:I},facingMode:s}})}),h.jsx(A,{onClick:t,disabled:y!=="success"||e||o,children:"Take Photo"})]})},ke=S.memo(Te),ze=150,_e=ae.getLogger("CameraInput");class Ve extends oe.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new ge,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState(e=>({facingMode:e.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=e=>{if(e===null)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});const o=a=>new Promise(s=>setTimeout(s,a));return Le(e,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(a=>this.props.uploadClient.fetchFileURLs([a]).then(s=>({file:a,fileUrls:s[0]}))).then(({file:a,fileUrls:s})=>this.uploadFile(s,a)).then(()=>o(ze)).then(()=>{this.setState((a,s)=>({imgSrc:e,shutter:a.shutter,minShutterEffectPassed:!0}))}).catch(a=>{_e.error(a)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(e=>this.deleteFile(e.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:o,widgetMgr:a,fragmentId:s}=this.props,n=a.getFileUploaderStateValue(o);ne(e,n)||a.setFileUploaderStateValue(o,e,{fromUi:!0},s)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(P(e))return;this.setState({imgSrc:null});const{widgetMgr:o,element:a,fragmentId:s}=this.props;o.setFileUploaderStateValue(a,e,{fromUi:!0},s)})},this.deleteFile=e=>{const o=this.getFile(e);P(o)||(o.status.type==="uploading"&&o.status.cancelToken.cancel(),o.status.type==="uploaded"&&o.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(o.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(o=>({files:[...o.files,e]}))},this.removeFile=e=>{this.setState(o=>({files:o.files.filter(a=>a.id!==e)}))},this.getFile=e=>this.state.files.find(o=>o.id===e),this.updateFile=(e,o)=>{this.setState(a=>({files:a.files.map(s=>s.id===e?o:s)}))},this.onUploadComplete=(e,o)=>{this.setState(()=>({shutter:!1}));const a=this.getFile(e);P(a)||a.status.type!=="uploading"||this.updateFile(a.id,a.setStatus({type:"uploaded",fileId:o.fileId,fileUrls:o}))},this.onUploadProgress=(e,o)=>{const a=this.getFile(o);if(P(a)||a.status.type!=="uploading")return;const s=Math.round(e.loaded*100/e.total);a.status.progress!==s&&this.updateFile(o,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:s}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,o)=>{const a=V.CancelToken.source(),s=new L(o.name,o.size,this.nextLocalFileId(),{type:"uploading",cancelToken:a,progress:1});this.addFile(s),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,o,n=>this.onUploadProgress(n,s.id),a.token).then(()=>this.onUploadComplete(s.id,e)).catch(n=>{V.isCancel(n)||this.updateFile(s.id,s.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:e,element:o}=this.props,a=e.getFileUploaderStateValue(o);if(P(a))return l;const{uploadedFileInfo:s}=a;return P(s)||s.length===0?l:{files:s.map(n=>{const p=n.name,y=n.size,C=n.fileId,U=n.fileUrls;return new L(p,y,this.nextLocalFileId(),{type:"uploaded",fileId:C,fileUrls:U})}),imgSrc:s.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=e=>e.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:e,widgetMgr:o,fragmentId:a}=this.props;o.getFileUploaderStateValue(e)===void 0&&o.setFileUploaderStateValue(e,l,{fromUi:!1},a)}createWidgetValue(){const l=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:o,size:a,status:s}=e;return new le({fileId:s.fileId,fileUrls:s.fileUrls,name:o,size:a})});return new de({uploadedFileInfo:l})}render(){var l;const{element:e,widgetMgr:o,disabled:a,width:s}=this.props;return this.formClearHelper.manageFormClearListener(o,e.formId,this.onFormCleared),h.jsxs(H,{className:"stCameraInput","data-testid":"stCameraInput",children:[h.jsx(ce,{label:e.label,disabled:a,labelVisibility:ue((l=e.labelVisibility)==null?void 0:l.value),children:e.help&&h.jsx(he,{children:h.jsx(pe,{content:e.help,placement:z.TOP_RIGHT})})}),this.state.imgSrc?h.jsxs(h.Fragment,{children:[h.jsx(T,{width:s,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h.jsx(Se,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:s,height:s*9/16})}),h.jsx(A,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||a,children:this.getProgress()?"Uploading...":h.jsxs(we,{children:[h.jsx(O,{content:W,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h.jsx(ke,{handleCapture:this.handleCapture,width:s,disabled:a,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Le(i,l){return fetch(i).then(e=>e.arrayBuffer()).then(e=>new File([e],l,{type:"image/jpeg"}))}const De=se(Ve);export{De as default};
@@ -1 +1 @@
1
- import{r as n,E as _,_ as q,c as g,D as ue,A as U,j as i,c0 as ge,bI as J,bW as Q,bD as Z,bX as R,bv as he,cd as me,bR as fe,b$ as xe,ce as y,bP as be,cf as ve,L as k,bT as ye,bS as je}from"./index-Cbvbjd8C.js";import{g as we,C as Ie,I as Ce,F as $,E as ze,a as Fe,s as Ee,u as Re,b as Te}from"./FileHelper-WDsMYNBw.js";import{I as He}from"./InputInstructions-Cyg7opie.js";import{i as Le}from"./inputUtils-CQWz5UKz.js";import{E as Se}from"./ErrorOutline.esm-Cdc3NAX8.js";import{a as ee}from"./index-xsH4HHeE.js";import{U as te}from"./UploadFileInfo-C-jY39rj.js";import{T as Me}from"./textarea-BKB-3cBX.js";import"./base-input-BnIlcFzX.js";var ie=n.forwardRef(function(e,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(_,q({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),n.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});ie.displayName="AttachFile";var oe=n.forwardRef(function(e,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(_,q({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});oe.displayName="Send";const Ue=g("div",{target:"e1d2x3se4"})({name:"1nibcdy",styles:"border:none;position:relative;display:flex"}),ke=g("div",{target:"e1d2x3se3"})(({theme:e,extended:t})=>({border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.widgetBorderColor??e.colors.transparent,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:e.spacing.lg,maxHeight:t?"none":e.sizes.minElementHeight,gap:e.spacing.sm,overflow:"hidden",":focus-within":{borderColor:e.colors.primary}}),""),$e=g("button",{target:"e1d2x3se2"})(({theme:e,disabled:t,extended:a})=>{const p=ue(e),[m,u]=p?[e.colors.gray60,e.colors.gray80]:[e.colors.gray80,e.colors.gray40];return{border:"none",backgroundColor:e.colors.transparent,borderTopRightRadius:a?"0":e.radii.chatInput,borderTopLeftRadius:a?e.radii.default:"0",borderBottomRightRadius:e.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.sm,color:t?m:u,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:p?e.colors.gray10:e.colors.gray90},"&:hover":{color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:e.colors.transparent,borderColor:e.colors.transparent,color:e.colors.gray,cursor:"not-allowed"}}},""),Pe=g("div",{target:"e1d2x3se1"})(({theme:e})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${e.sizes.borderWidth}`,pointerEvents:"none"}),""),Be=g("div",{target:"e1d2x3se0"})(({theme:e})=>({position:"absolute",bottom:"0px",right:`calc(${e.iconSizes.xl} + 2 * ${e.spacing.sm} + ${e.spacing.sm})`}),""),De=g("div",{target:"e3id6jz12"})(({theme:e,height:t})=>({backgroundColor:e.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${e.sizes.emptyDropdownHeight}, ${t})`,width:"100%",zIndex:e.zIndices.priority}),""),Ne=g("div",{target:"e3id6jz11"})(({theme:e,height:t})=>({border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.primary,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,color:e.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:t,width:"100%",fontWeight:e.fontWeights.bold}),""),We=g("div",{target:"e3id6jz10"})(({theme:e,disabled:t})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${e.sizes.borderWidth}`,cursor:t?"not-allowed":"auto"}),""),Ve=g("div",{target:"e3id6jz9"})(({disabled:e})=>({pointerEvents:e?"none":"auto"}),""),Ae=g("div",{target:"e3id6jz8"})(({theme:e})=>({marginTop:"0.625em",marginLeft:e.spacing.sm,height:e.spacing.xl,width:e.sizes.borderWidth,backgroundColor:e.colors.fadedText20}),""),Xe=g("div",{target:"e3id6jz7"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,overflowX:"auto"}),""),Ke=g("div",{target:"e3id6jz6"})({name:"zjik7",styles:"display:flex"}),Oe=g("div",{target:"e3id6jz5"})({name:"ou8xsw",styles:"flex:0 0 auto"}),Ye=g("div",{target:"e3id6jz4"})(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing.sm,gap:e.spacing.twoXS}),""),Ge=g("div",{target:"e3id6jz3"})(({theme:e})=>({color:e.colors.fadedText60}),""),_e=g("div",{target:"e3id6jz2"})(({theme:e,fileStatus:t})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t.type==="uploaded"?e.colors.bodyText:e.colors.fadedText60}),""),qe=g("div",{target:"e3id6jz1"})(({theme:e})=>({marginRight:e.spacing.md,color:e.colors.fadedText60}),""),Je=g("small",{target:"e3id6jz0"})(({theme:e})=>({display:"flex",alignItems:"center",maxHeight:e.sizes.smallElementHeight,color:e.colors.fadedText60,"& :hover":{color:e.colors.bodyText}}),"");function Qe({children:e,content:t}){const a=U();return i.jsx(ge,{content:t,placement:J.TOP,overrides:{Body:{style:{top:`-${a.sizes.minElementHeight}`}}},children:e})}const Ze=({fileInfo:e})=>{const t=U(),{type:a}=e.status;switch(a){case"uploading":return i.jsx(me,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return i.jsx(Qe,{content:e.status.errorMessage,children:i.jsx(R,{color:t.colors.red,content:Se,size:"lg"})});case"uploaded":return i.jsx(R,{content:Ce,size:"lg"});default:return he(a),null}},et=({fileInfo:e,onDelete:t})=>i.jsxs(Ye,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[i.jsx(Ge,{children:i.jsx(Ze,{fileInfo:e})}),i.jsx(_e,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:e.name,fileStatus:e.status,children:e.name}),i.jsx(qe,{children:we(e.size,$.Byte)}),i.jsx(Je,{"data-testid":"stChatInputDeleteBtn",children:i.jsx(Q,{onClick:()=>t(e.id),kind:Z.MINIMAL,children:i.jsx(R,{content:Ie,size:"lg"})})})]}),tt=n.memo(et),it=({items:e,onDelete:t})=>i.jsx(Xe,{"data-testid":"stChatUploadedFiles",children:i.jsx(Ke,{children:e.map(a=>i.jsx(Oe,{children:i.jsx(tt,{fileInfo:a,onDelete:t})},a.id))})}),ot=n.memo(it),st=({getNextLocalFileId:e,addFiles:t,updateFile:a,uploadClient:p,element:m,onUploadProgress:u,onUploadComplete:x})=>(j,d)=>{const f=ee.CancelToken.source(),c=new te(d.name,d.size,e(),{type:"uploading",cancelToken:f,progress:1});t([c]),p.uploadFile({formId:"",...m},j.uploadUrl,d,h=>u(h,c.id),f.token).then(()=>x(c.id,j)).catch(h=>{ee.isCancel(h)||a(c.id,c.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},rt=({acceptMultipleFiles:e,maxFileSize:t,uploadClient:a,uploadFile:p,addFiles:m,getNextLocalFileId:u,deleteExistingFiles:x,onUploadComplete:j})=>(d,f)=>{if(!e&&d.length===0&&f.length>1){const c=f.findIndex(h=>{var w;return((w=h.errors)==null?void 0:w[0].code)===ze.TooManyFiles});c>=0&&(d.push(f[c].file),f.splice(c,1))}if(!e&&d.length>0&&x(),a.fetchFileURLs(d).then(c=>{fe(c,d).forEach(([h,w])=>{p(h,w)})}).catch(c=>{m(d.map(h=>new te(h.name,h.size,u(),{type:"error",errorMessage:c})))}),f.length>0){const c=f.map(h=>Fe(h,u(),t));m(c)}j()},nt=({getRootProps:e,getInputProps:t,acceptFile:a,disabled:p,theme:m})=>i.jsxs(We,{disabled:p,children:[i.jsxs(Ve,{"data-testid":"stChatInputFileUploadButton",disabled:p,...e(),children:[i.jsx("input",{...t()}),i.jsx(xe,{content:`Upload or drag and drop ${a===y.Multiple?"files":"a file"}`,placement:J.TOP,onMouseEnterDelay:500,children:i.jsx(Q,{kind:Z.MINIMAL,disabled:p,children:i.jsx(R,{content:ie,size:"lg",color:p?m.colors.fadedText40:m.colors.fadedText60})})})]}),i.jsx(Ae,{})]}),at=n.memo(nt),lt=({getRootProps:e,getInputProps:t,acceptFile:a,inputHeight:p})=>i.jsxs(i.Fragment,{children:[i.jsx(De,{height:p,...e(),children:i.jsx("input",{...t()})}),i.jsx(Ne,{height:p,children:`Drag and drop ${a===y.Multiple?"files":"a file"} here`})]}),dt=n.memo(lt),ct=6.5,P=1,B=(e,t,a)=>a.map(p=>p.id===e?t:p),D=(e,t)=>t.find(a=>a.id===e);function pt({disabled:e,element:t,widgetMgr:a,fragmentId:p,uploadClient:m}){const u=U(),{placeholder:x,maxChars:j}=t,d=n.useRef(null),f=n.useRef(0),c=n.useRef({minHeight:0,maxHeight:0}),[h,w]=be(),[z,H]=n.useState(t.default),[F,L]=n.useState(0),[T,se]=n.useState(!1),[I,C]=n.useState([]),[E,S]=n.useState(!1),M=n.useMemo(()=>I.some(o=>o.status.type==="uploading")?!1:z!==""||I.length>0,[I,z]),b=ve(t.acceptFile),N=Ee(t.maxUploadSizeMb,$.Megabyte,$.Byte),W=n.useCallback(o=>C(s=>[...s,...o]),[]),V=n.useCallback(o=>{C(s=>{const l=D(o,s);return k(l)?s:(l.status.type==="uploading"&&l.status.cancelToken.cancel(),l.status.type==="uploaded"&&l.status.fileUrls.deleteUrl&&m.deleteFile(l.status.fileUrls.deleteUrl),s.filter(r=>r.id!==o))})},[m]),re=()=>{const o=I.filter(s=>s.status.type==="uploaded").map(s=>{const{name:l,size:r,status:v}=s,{fileId:ce,fileUrls:pe}=v;return new ye({fileId:ce,fileUrls:pe,name:l,size:r})});return new je({uploadedFileInfo:o})},A=()=>f.current++,ne=rt({acceptMultipleFiles:b===y.Multiple,maxFileSize:N,uploadClient:m,uploadFile:st({getNextLocalFileId:A,addFiles:W,updateFile:(o,s)=>{C(l=>B(o,s,l))},uploadClient:m,element:t,onUploadProgress:(o,s)=>{C(l=>{const r=D(s,l);if(k(r)||r.status.type!=="uploading")return l;const v=Math.round(o.loaded*100/o.total);return r.status.progress===v?l:B(s,r.setStatus({type:"uploading",cancelToken:r.status.cancelToken,progress:v}),l)})},onUploadComplete:(o,s)=>{C(l=>{const r=D(o,l);return k(r)||r.status.type!=="uploading"?l:B(r.id,r.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}),l)})}}),addFiles:W,getNextLocalFileId:A,deleteExistingFiles:()=>I.forEach(o=>V(o.id)),onUploadComplete:()=>{d.current&&d.current.focus()}}),{getRootProps:X,getInputProps:K}=Re({onDrop:ne,multiple:b===y.Multiple,accept:Te(t.fileType),maxSize:N}),O=()=>{let o=0;const{current:s}=d;return s&&(s.style.height="auto",o=s.scrollHeight,s.style.height=""),o},Y=()=>{if(d.current&&d.current.focus(),!M||e)return;const o={data:z,fileUploaderState:re()};a.setChatInputValue(t,o,{fromUi:!0},p),C([]),H(""),L(0)},ae=o=>{const{metaKey:s,ctrlKey:l,shiftKey:r}=o;Le(o)&&!r&&!l&&!s&&(o.preventDefault(),Y())},le=o=>{const{value:s}=o.target,{maxChars:l}=t;l!==0&&s.length>l||(H(s),L(O()))};n.useEffect(()=>{if(t.setValue){t.setValue=!1;const o=t.value||"";H(o)}},[t]),n.useLayoutEffect(()=>{if(d.current){const{offsetHeight:o}=d.current;c.current.minHeight=o,c.current.maxHeight=o*ct}},[d]),n.useEffect(()=>{const o=r=>{var v;r.preventDefault(),r.stopPropagation(),!E&&(v=r.dataTransfer)!=null&&v.types.includes("Files")&&S(!0)},s=r=>{r.preventDefault(),r.stopPropagation(),E&&(r.clientX<=0&&r.clientY<=0||r.clientX>=window.innerWidth&&r.clientY>=window.innerHeight)&&S(!1)},l=r=>{r.preventDefault(),r.stopPropagation(),E&&S(!1)};return window.addEventListener("dragover",o),window.addEventListener("drop",l),window.addEventListener("dragleave",s),()=>{window.removeEventListener("dragover",o),window.removeEventListener("drop",l),window.removeEventListener("dragleave",s)}},[E]),n.useLayoutEffect(()=>{const{minHeight:o}=c.current;se(F>0&&d.current?Math.abs(F-o)>P:!1)},[F]),n.useLayoutEffect(()=>{L(O())},[x]);const{maxHeight:G}=c.current,de=b!==y.None&&E;return i.jsxs(i.Fragment,{children:[b===y.None?null:i.jsx(ot,{items:[...I],onDelete:V}),i.jsx(Ue,{className:"stChatInput","data-testid":"stChatInput",ref:w,children:de?i.jsx(dt,{getRootProps:X,getInputProps:K,acceptFile:b,inputHeight:T?`${F+P}px`:u.sizes.minElementHeight}):i.jsxs(ke,{extended:T,children:[b===y.None?null:i.jsx(at,{getRootProps:X,getInputProps:K,acceptFile:b,disabled:e,theme:u}),i.jsx(Me,{inputRef:d,value:z,placeholder:x,onChange:le,onKeyDown:ae,"aria-label":x,disabled:e,rows:1,overrides:{Root:{style:{minHeight:u.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:u.lineHeights.inputWidget,"::placeholder":{opacity:"0.7"},height:T?`${F+P}px`:"auto",maxHeight:G?`${G}px`:"none",paddingLeft:u.spacing.none,paddingBottom:u.spacing.sm,paddingTop:u.spacing.sm,paddingRight:`calc(${u.iconSizes.xl} + 2 * ${u.spacing.sm} + ${u.spacing.sm})`}}}}),h>u.breakpoints.hideWidgetDetails&&i.jsx(Be,{children:i.jsx(He,{dirty:M,value:z,maxLength:j,type:"chat",inForm:!1})}),i.jsx(Pe,{children:i.jsx($e,{onClick:Y,disabled:!M||e,extended:T,"data-testid":"stChatInputSubmitButton",children:i.jsx(R,{content:oe,size:"xl",color:"inherit"})})})]})})]})}const ut=n.memo(pt);export{ut as default};
1
+ import{r as n,E as _,_ as q,c as g,D as ue,A as U,j as i,c0 as ge,bI as J,bW as Q,bD as Z,bX as R,bv as he,cd as me,bR as fe,b$ as xe,ce as y,bP as be,cf as ve,L as k,bT as ye,bS as je}from"./index-DPBNUFWE.js";import{g as we,C as Ie,I as Ce,F as $,E as ze,a as Fe,s as Ee,u as Re,b as Te}from"./FileHelper-BarQJiLz.js";import{I as He}from"./InputInstructions-Dmr8j4xE.js";import{i as Le}from"./inputUtils-CQWz5UKz.js";import{E as Se}from"./ErrorOutline.esm-7fPCAua1.js";import{a as ee}from"./index-xsH4HHeE.js";import{U as te}from"./UploadFileInfo-C-jY39rj.js";import{T as Me}from"./textarea-BKD-emFb.js";import"./base-input-DrVuxJmE.js";var ie=n.forwardRef(function(e,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(_,q({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),n.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});ie.displayName="AttachFile";var oe=n.forwardRef(function(e,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(_,q({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});oe.displayName="Send";const Ue=g("div",{target:"e1d2x3se4"})({name:"1nibcdy",styles:"border:none;position:relative;display:flex"}),ke=g("div",{target:"e1d2x3se3"})(({theme:e,extended:t})=>({border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.widgetBorderColor??e.colors.transparent,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:e.spacing.lg,maxHeight:t?"none":e.sizes.minElementHeight,gap:e.spacing.sm,overflow:"hidden",":focus-within":{borderColor:e.colors.primary}}),""),$e=g("button",{target:"e1d2x3se2"})(({theme:e,disabled:t,extended:a})=>{const p=ue(e),[m,u]=p?[e.colors.gray60,e.colors.gray80]:[e.colors.gray80,e.colors.gray40];return{border:"none",backgroundColor:e.colors.transparent,borderTopRightRadius:a?"0":e.radii.chatInput,borderTopLeftRadius:a?e.radii.default:"0",borderBottomRightRadius:e.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.sm,color:t?m:u,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:p?e.colors.gray10:e.colors.gray90},"&:hover":{color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:e.colors.transparent,borderColor:e.colors.transparent,color:e.colors.gray,cursor:"not-allowed"}}},""),Pe=g("div",{target:"e1d2x3se1"})(({theme:e})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${e.sizes.borderWidth}`,pointerEvents:"none"}),""),Be=g("div",{target:"e1d2x3se0"})(({theme:e})=>({position:"absolute",bottom:"0px",right:`calc(${e.iconSizes.xl} + 2 * ${e.spacing.sm} + ${e.spacing.sm})`}),""),De=g("div",{target:"e3id6jz12"})(({theme:e,height:t})=>({backgroundColor:e.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${e.sizes.emptyDropdownHeight}, ${t})`,width:"100%",zIndex:e.zIndices.priority}),""),Ne=g("div",{target:"e3id6jz11"})(({theme:e,height:t})=>({border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.primary,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,color:e.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:t,width:"100%",fontWeight:e.fontWeights.bold}),""),We=g("div",{target:"e3id6jz10"})(({theme:e,disabled:t})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${e.sizes.borderWidth}`,cursor:t?"not-allowed":"auto"}),""),Ve=g("div",{target:"e3id6jz9"})(({disabled:e})=>({pointerEvents:e?"none":"auto"}),""),Ae=g("div",{target:"e3id6jz8"})(({theme:e})=>({marginTop:"0.625em",marginLeft:e.spacing.sm,height:e.spacing.xl,width:e.sizes.borderWidth,backgroundColor:e.colors.fadedText20}),""),Xe=g("div",{target:"e3id6jz7"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,overflowX:"auto"}),""),Ke=g("div",{target:"e3id6jz6"})({name:"zjik7",styles:"display:flex"}),Oe=g("div",{target:"e3id6jz5"})({name:"ou8xsw",styles:"flex:0 0 auto"}),Ye=g("div",{target:"e3id6jz4"})(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing.sm,gap:e.spacing.twoXS}),""),Ge=g("div",{target:"e3id6jz3"})(({theme:e})=>({color:e.colors.fadedText60}),""),_e=g("div",{target:"e3id6jz2"})(({theme:e,fileStatus:t})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t.type==="uploaded"?e.colors.bodyText:e.colors.fadedText60}),""),qe=g("div",{target:"e3id6jz1"})(({theme:e})=>({marginRight:e.spacing.md,color:e.colors.fadedText60}),""),Je=g("small",{target:"e3id6jz0"})(({theme:e})=>({display:"flex",alignItems:"center",maxHeight:e.sizes.smallElementHeight,color:e.colors.fadedText60,"& :hover":{color:e.colors.bodyText}}),"");function Qe({children:e,content:t}){const a=U();return i.jsx(ge,{content:t,placement:J.TOP,overrides:{Body:{style:{top:`-${a.sizes.minElementHeight}`}}},children:e})}const Ze=({fileInfo:e})=>{const t=U(),{type:a}=e.status;switch(a){case"uploading":return i.jsx(me,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return i.jsx(Qe,{content:e.status.errorMessage,children:i.jsx(R,{color:t.colors.red,content:Se,size:"lg"})});case"uploaded":return i.jsx(R,{content:Ce,size:"lg"});default:return he(a),null}},et=({fileInfo:e,onDelete:t})=>i.jsxs(Ye,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[i.jsx(Ge,{children:i.jsx(Ze,{fileInfo:e})}),i.jsx(_e,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:e.name,fileStatus:e.status,children:e.name}),i.jsx(qe,{children:we(e.size,$.Byte)}),i.jsx(Je,{"data-testid":"stChatInputDeleteBtn",children:i.jsx(Q,{onClick:()=>t(e.id),kind:Z.MINIMAL,children:i.jsx(R,{content:Ie,size:"lg"})})})]}),tt=n.memo(et),it=({items:e,onDelete:t})=>i.jsx(Xe,{"data-testid":"stChatUploadedFiles",children:i.jsx(Ke,{children:e.map(a=>i.jsx(Oe,{children:i.jsx(tt,{fileInfo:a,onDelete:t})},a.id))})}),ot=n.memo(it),st=({getNextLocalFileId:e,addFiles:t,updateFile:a,uploadClient:p,element:m,onUploadProgress:u,onUploadComplete:x})=>(j,d)=>{const f=ee.CancelToken.source(),c=new te(d.name,d.size,e(),{type:"uploading",cancelToken:f,progress:1});t([c]),p.uploadFile({formId:"",...m},j.uploadUrl,d,h=>u(h,c.id),f.token).then(()=>x(c.id,j)).catch(h=>{ee.isCancel(h)||a(c.id,c.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},rt=({acceptMultipleFiles:e,maxFileSize:t,uploadClient:a,uploadFile:p,addFiles:m,getNextLocalFileId:u,deleteExistingFiles:x,onUploadComplete:j})=>(d,f)=>{if(!e&&d.length===0&&f.length>1){const c=f.findIndex(h=>{var w;return((w=h.errors)==null?void 0:w[0].code)===ze.TooManyFiles});c>=0&&(d.push(f[c].file),f.splice(c,1))}if(!e&&d.length>0&&x(),a.fetchFileURLs(d).then(c=>{fe(c,d).forEach(([h,w])=>{p(h,w)})}).catch(c=>{m(d.map(h=>new te(h.name,h.size,u(),{type:"error",errorMessage:c})))}),f.length>0){const c=f.map(h=>Fe(h,u(),t));m(c)}j()},nt=({getRootProps:e,getInputProps:t,acceptFile:a,disabled:p,theme:m})=>i.jsxs(We,{disabled:p,children:[i.jsxs(Ve,{"data-testid":"stChatInputFileUploadButton",disabled:p,...e(),children:[i.jsx("input",{...t()}),i.jsx(xe,{content:`Upload or drag and drop ${a===y.Multiple?"files":"a file"}`,placement:J.TOP,onMouseEnterDelay:500,children:i.jsx(Q,{kind:Z.MINIMAL,disabled:p,children:i.jsx(R,{content:ie,size:"lg",color:p?m.colors.fadedText40:m.colors.fadedText60})})})]}),i.jsx(Ae,{})]}),at=n.memo(nt),lt=({getRootProps:e,getInputProps:t,acceptFile:a,inputHeight:p})=>i.jsxs(i.Fragment,{children:[i.jsx(De,{height:p,...e(),children:i.jsx("input",{...t()})}),i.jsx(Ne,{height:p,children:`Drag and drop ${a===y.Multiple?"files":"a file"} here`})]}),dt=n.memo(lt),ct=6.5,P=1,B=(e,t,a)=>a.map(p=>p.id===e?t:p),D=(e,t)=>t.find(a=>a.id===e);function pt({disabled:e,element:t,widgetMgr:a,fragmentId:p,uploadClient:m}){const u=U(),{placeholder:x,maxChars:j}=t,d=n.useRef(null),f=n.useRef(0),c=n.useRef({minHeight:0,maxHeight:0}),[h,w]=be(),[z,H]=n.useState(t.default),[F,L]=n.useState(0),[T,se]=n.useState(!1),[I,C]=n.useState([]),[E,S]=n.useState(!1),M=n.useMemo(()=>I.some(o=>o.status.type==="uploading")?!1:z!==""||I.length>0,[I,z]),b=ve(t.acceptFile),N=Ee(t.maxUploadSizeMb,$.Megabyte,$.Byte),W=n.useCallback(o=>C(s=>[...s,...o]),[]),V=n.useCallback(o=>{C(s=>{const l=D(o,s);return k(l)?s:(l.status.type==="uploading"&&l.status.cancelToken.cancel(),l.status.type==="uploaded"&&l.status.fileUrls.deleteUrl&&m.deleteFile(l.status.fileUrls.deleteUrl),s.filter(r=>r.id!==o))})},[m]),re=()=>{const o=I.filter(s=>s.status.type==="uploaded").map(s=>{const{name:l,size:r,status:v}=s,{fileId:ce,fileUrls:pe}=v;return new ye({fileId:ce,fileUrls:pe,name:l,size:r})});return new je({uploadedFileInfo:o})},A=()=>f.current++,ne=rt({acceptMultipleFiles:b===y.Multiple,maxFileSize:N,uploadClient:m,uploadFile:st({getNextLocalFileId:A,addFiles:W,updateFile:(o,s)=>{C(l=>B(o,s,l))},uploadClient:m,element:t,onUploadProgress:(o,s)=>{C(l=>{const r=D(s,l);if(k(r)||r.status.type!=="uploading")return l;const v=Math.round(o.loaded*100/o.total);return r.status.progress===v?l:B(s,r.setStatus({type:"uploading",cancelToken:r.status.cancelToken,progress:v}),l)})},onUploadComplete:(o,s)=>{C(l=>{const r=D(o,l);return k(r)||r.status.type!=="uploading"?l:B(r.id,r.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}),l)})}}),addFiles:W,getNextLocalFileId:A,deleteExistingFiles:()=>I.forEach(o=>V(o.id)),onUploadComplete:()=>{d.current&&d.current.focus()}}),{getRootProps:X,getInputProps:K}=Re({onDrop:ne,multiple:b===y.Multiple,accept:Te(t.fileType),maxSize:N}),O=()=>{let o=0;const{current:s}=d;return s&&(s.style.height="auto",o=s.scrollHeight,s.style.height=""),o},Y=()=>{if(d.current&&d.current.focus(),!M||e)return;const o={data:z,fileUploaderState:re()};a.setChatInputValue(t,o,{fromUi:!0},p),C([]),H(""),L(0)},ae=o=>{const{metaKey:s,ctrlKey:l,shiftKey:r}=o;Le(o)&&!r&&!l&&!s&&(o.preventDefault(),Y())},le=o=>{const{value:s}=o.target,{maxChars:l}=t;l!==0&&s.length>l||(H(s),L(O()))};n.useEffect(()=>{if(t.setValue){t.setValue=!1;const o=t.value||"";H(o)}},[t]),n.useLayoutEffect(()=>{if(d.current){const{offsetHeight:o}=d.current;c.current.minHeight=o,c.current.maxHeight=o*ct}},[d]),n.useEffect(()=>{const o=r=>{var v;r.preventDefault(),r.stopPropagation(),!E&&(v=r.dataTransfer)!=null&&v.types.includes("Files")&&S(!0)},s=r=>{r.preventDefault(),r.stopPropagation(),E&&(r.clientX<=0&&r.clientY<=0||r.clientX>=window.innerWidth&&r.clientY>=window.innerHeight)&&S(!1)},l=r=>{r.preventDefault(),r.stopPropagation(),E&&S(!1)};return window.addEventListener("dragover",o),window.addEventListener("drop",l),window.addEventListener("dragleave",s),()=>{window.removeEventListener("dragover",o),window.removeEventListener("drop",l),window.removeEventListener("dragleave",s)}},[E]),n.useLayoutEffect(()=>{const{minHeight:o}=c.current;se(F>0&&d.current?Math.abs(F-o)>P:!1)},[F]),n.useLayoutEffect(()=>{L(O())},[x]);const{maxHeight:G}=c.current,de=b!==y.None&&E;return i.jsxs(i.Fragment,{children:[b===y.None?null:i.jsx(ot,{items:[...I],onDelete:V}),i.jsx(Ue,{className:"stChatInput","data-testid":"stChatInput",ref:w,children:de?i.jsx(dt,{getRootProps:X,getInputProps:K,acceptFile:b,inputHeight:T?`${F+P}px`:u.sizes.minElementHeight}):i.jsxs(ke,{extended:T,children:[b===y.None?null:i.jsx(at,{getRootProps:X,getInputProps:K,acceptFile:b,disabled:e,theme:u}),i.jsx(Me,{inputRef:d,value:z,placeholder:x,onChange:le,onKeyDown:ae,"aria-label":x,disabled:e,rows:1,overrides:{Root:{style:{minHeight:u.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:u.lineHeights.inputWidget,"::placeholder":{opacity:"0.7"},height:T?`${F+P}px`:"auto",maxHeight:G?`${G}px`:"none",paddingLeft:u.spacing.none,paddingBottom:u.spacing.sm,paddingTop:u.spacing.sm,paddingRight:`calc(${u.iconSizes.xl} + 2 * ${u.spacing.sm} + ${u.spacing.sm})`}}}}),h>u.breakpoints.hideWidgetDetails&&i.jsx(Be,{children:i.jsx(He,{dirty:M,value:z,maxLength:j,type:"chat",inForm:!1})}),i.jsx(Pe,{children:i.jsx($e,{onClick:Y,disabled:!M||e,extended:T,"data-testid":"stChatInputSubmitButton",children:i.jsx(R,{content:oe,size:"xl",color:"inherit"})})})]})})]})}const ut=n.memo(pt);export{ut as default};
@@ -1 +1 @@
1
- import{c as T,r,A as C,cA as I,cB as M,j as l,bZ as W,b_ as j,cc as A,b$ as k,bI as L,cz as V,cC as $,cv as B,cD as N,c9 as O}from"./index-Cbvbjd8C.js";import{a as P}from"./useBasicWidgetState-D3a9XYx3.js";import"./FormClearHelper-CT0Jwp4X.js";const H=T("div",{target:"e6zijwc0"})(({theme:i})=>({"span[aria-disabled='true']":{background:i.colors.fadedText05}}),""),D=(i,s)=>i.getStringArrayValue(s),E=i=>i.default.map(s=>i.options[s])??null,F=i=>i.rawValues??null,G=(i,s,t,p)=>{s.setStringArrayValue(i,t.value,{fromUi:t.fromUi},p)},U=i=>{var s;const{element:t,widgetMgr:p,fragmentId:f}=i,e=C(),[a,u]=P({getStateFromWidgetMgr:D,getDefaultStateFromProto:E,getCurrStateFromProto:F,updateWidgetMgrState:G,element:t,widgetMgr:p,fragmentId:f}),h=t.maxSelections>0&&a.length>=t.maxSelections,S=r.useMemo(()=>{if(t.maxSelections===0)return"No results";if(a.length===t.maxSelections){const o=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${o}. Remove an option first.`}return"No results"},[t.maxSelections,a.length]),v=r.useMemo(()=>a.map(o=>({value:o,label:o})),[a]),b=r.useCallback(o=>{var d,c;switch(o.type){case"remove":return I(a,(d=o.option)==null?void 0:d.value);case"clear":return[];case"select":return a.concat([(c=o.option)==null?void 0:c.value]);default:throw new Error(`State transition is unknown: ${o.type}`)}},[a]),y=r.useCallback(o=>{t.maxSelections&&o.type==="select"&&a.length>=t.maxSelections||u({value:b(o),fromUi:!0})},[t.maxSelections,b,u,a.length]),x=r.useCallback((o,d)=>{if(h)return[];const c=o.filter(R=>!a.includes(R.value));return M(c,d)},[h,a]),{options:g}=t;let n=i.disabled,m=t.placeholder;g.length===0&&(t.acceptNewOptions?m="Add options":(m="No options to select",n=!0));const z=g.map(o=>({label:o,value:o})),w=g.length>10;return l.jsxs("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[l.jsx(W,{label:t.label,disabled:n,labelVisibility:j((s=t.labelVisibility)==null?void 0:s.value),children:t.help&&l.jsx(A,{children:l.jsx(k,{content:t.help,placement:L.TOP_RIGHT})})}),l.jsx(H,{children:l.jsx(V,{creatable:t.acceptNewOptions??!1,options:z,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:m,type:N.select,multi:!0,onChange:y,value:v,disabled:n,size:"compact",noResultsMsg:S,filterOptions:x,closeOnSelect:!1,overrides:{Popover:{props:{overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:B,props:{overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:{minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}},Placeholder:{style:()=>({flex:"inherit",color:n?e.colors.fadedText40:e.colors.fadedText60})},ValueContainer:{style:()=>({paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.darkGray,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:e.radii.md,borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md,borderBottomLeftRadius:e.radii.md,fontSize:e.fontSizes.md,paddingLeft:e.spacing.sm,marginLeft:e.spacing.none,marginRight:e.spacing.sm,height:`calc(${e.sizes.minElementHeight} - 2 * ${e.spacing.xs})`,maxWidth:`calc(100% - ${e.spacing.lg})`,cursor:"default !important"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"0.625em",height:"0.625em"}}}}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:e.fontSizes.sm}}}}},Input:{props:{readOnly:O.isMobile&&w===!1?"readonly":null}},Dropdown:{component:$}}})})]})},K=r.memo(U);export{K as default};
1
+ import{c as T,r,A as C,cA as I,cB as M,j as l,bZ as W,b_ as j,cc as A,b$ as k,bI as L,cz as V,cC as $,cv as B,cD as N,c9 as O}from"./index-DPBNUFWE.js";import{a as P}from"./useBasicWidgetState-uJo0naOA.js";import"./FormClearHelper-BZaxoxQN.js";const H=T("div",{target:"e6zijwc0"})(({theme:i})=>({"span[aria-disabled='true']":{background:i.colors.fadedText05}}),""),D=(i,s)=>i.getStringArrayValue(s),E=i=>i.default.map(s=>i.options[s])??null,F=i=>i.rawValues??null,G=(i,s,t,p)=>{s.setStringArrayValue(i,t.value,{fromUi:t.fromUi},p)},U=i=>{var s;const{element:t,widgetMgr:p,fragmentId:f}=i,e=C(),[a,u]=P({getStateFromWidgetMgr:D,getDefaultStateFromProto:E,getCurrStateFromProto:F,updateWidgetMgrState:G,element:t,widgetMgr:p,fragmentId:f}),h=t.maxSelections>0&&a.length>=t.maxSelections,S=r.useMemo(()=>{if(t.maxSelections===0)return"No results";if(a.length===t.maxSelections){const o=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${o}. Remove an option first.`}return"No results"},[t.maxSelections,a.length]),v=r.useMemo(()=>a.map(o=>({value:o,label:o})),[a]),b=r.useCallback(o=>{var d,c;switch(o.type){case"remove":return I(a,(d=o.option)==null?void 0:d.value);case"clear":return[];case"select":return a.concat([(c=o.option)==null?void 0:c.value]);default:throw new Error(`State transition is unknown: ${o.type}`)}},[a]),y=r.useCallback(o=>{t.maxSelections&&o.type==="select"&&a.length>=t.maxSelections||u({value:b(o),fromUi:!0})},[t.maxSelections,b,u,a.length]),x=r.useCallback((o,d)=>{if(h)return[];const c=o.filter(R=>!a.includes(R.value));return M(c,d)},[h,a]),{options:g}=t;let n=i.disabled,m=t.placeholder;g.length===0&&(t.acceptNewOptions?m="Add options":(m="No options to select",n=!0));const z=g.map(o=>({label:o,value:o})),w=g.length>10;return l.jsxs("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[l.jsx(W,{label:t.label,disabled:n,labelVisibility:j((s=t.labelVisibility)==null?void 0:s.value),children:t.help&&l.jsx(A,{children:l.jsx(k,{content:t.help,placement:L.TOP_RIGHT})})}),l.jsx(H,{children:l.jsx(V,{creatable:t.acceptNewOptions??!1,options:z,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:m,type:N.select,multi:!0,onChange:y,value:v,disabled:n,size:"compact",noResultsMsg:S,filterOptions:x,closeOnSelect:!1,overrides:{Popover:{props:{overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:B,props:{overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:{minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}},Placeholder:{style:()=>({flex:"inherit",color:n?e.colors.fadedText40:e.colors.fadedText60})},ValueContainer:{style:()=>({paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.darkGray,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:e.radii.md,borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md,borderBottomLeftRadius:e.radii.md,fontSize:e.fontSizes.md,paddingLeft:e.spacing.sm,marginLeft:e.spacing.none,marginRight:e.spacing.sm,height:`calc(${e.sizes.minElementHeight} - 2 * ${e.spacing.xs})`,maxWidth:`calc(100% - ${e.spacing.lg})`,cursor:"default !important"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"0.625em",height:"0.625em"}}}}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:e.fontSizes.sm}}}}},Input:{props:{readOnly:O.isMobile&&w===!1?"readonly":null}},Dropdown:{component:$}}})})]})},K=r.memo(U);export{K as default};
@@ -1,4 +1,4 @@
1
- import{c as r,k as m,r as p,j as n}from"./index-Cbvbjd8C.js";import{R as l,P as c}from"./RenderInPortalIfExists-BozYGWdi.js";const d="/assets/flake-0.DgWaVvm5.png",f="/assets/flake-1.B2r5AHMK.png",g="/assets/flake-2.BnWSExPC.png",o=150,x=150,u=10,$=90,h=4e3,a=(t,e=0)=>Math.random()*(t-e)+e,k=()=>m`
1
+ import{c as r,k as m,r as p,j as n}from"./index-DPBNUFWE.js";import{R as l,P as c}from"./RenderInPortalIfExists-eTRglO06.js";const d="/assets/flake-0.DgWaVvm5.png",f="/assets/flake-1.B2r5AHMK.png",g="/assets/flake-2.BnWSExPC.png",o=150,x=150,u=10,$=90,h=4e3,a=(t,e=0)=>Math.random()*(t-e)+e,k=()=>m`
2
2
  from {
3
3
  transform:
4
4
  translateY(0)