small-websocket-prebuilt 0.2.6__tar.gz → 0.2.8__tar.gz
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.
- {small_websocket_prebuilt-0.2.6/small_websocket_prebuilt.egg-info → small_websocket_prebuilt-0.2.8}/PKG-INFO +1 -1
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/pyproject.toml +1 -1
- small_websocket_prebuilt-0.2.6/small_websocket_prebuilt/client/dist/assets/index-CMhGe_Yt.js → small_websocket_prebuilt-0.2.8/small_websocket_prebuilt/client/dist/assets/index-CW4RG3Y1.js +1 -1
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/index.html +1 -1
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8/small_websocket_prebuilt.egg-info}/PKG-INFO +1 -1
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt.egg-info/SOURCES.txt +1 -1
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/MANIFEST.in +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/README.md +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/setup.cfg +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/__init__.py +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/assets/geist-mono-cyrillic-wght-normal-BZdD_g9V.woff2 +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/assets/geist-mono-latin-ext-wght-normal-b6lpi8_2.woff2 +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/assets/geist-mono-latin-wght-normal-Cjtb1TV-.woff2 +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/assets/index-MrVEiU1O.css +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/assets/voice-ui-kit_false-BPs6efg0.js +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/assets/voice-ui-kit_false-b2I56sea.js +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/favicon.svg +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/client/dist/pipecat-logo.svg +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt/frontend.py +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt.egg-info/dependency_links.txt +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt.egg-info/requires.txt +0 -0
- {small_websocket_prebuilt-0.2.6 → small_websocket_prebuilt-0.2.8}/small_websocket_prebuilt.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: small-websocket-prebuilt
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: A simple, ready-to-use client for testing the WebSocket transport with Pipecat.
|
|
5
5
|
License: BSD 2-Clause License
|
|
6
6
|
Project-URL: homepage, https://github.com/Qiliang/small-websocket-prebuilt
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "small-websocket-prebuilt"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.8"
|
|
8
8
|
description = "A simple, ready-to-use client for testing the WebSocket transport with Pipecat."
|
|
9
9
|
license = { text = "BSD 2-Clause License" }
|
|
10
10
|
readme = "README.md"
|
|
@@ -94,7 +94,7 @@ Error generating stack: `+p.message+`
|
|
|
94
94
|
"t": "ping",
|
|
95
95
|
"d": { "hello": "world" }
|
|
96
96
|
}
|
|
97
|
-
}`;function iM({collapsed:t=!1}){const e=Qi(),n=Zs(),r=n==="ready"||n==="connected",[i,a]=k.useState(rM),[l,c]=k.useState(null),[u,f]=k.useState(null),h=k.useCallback(()=>{if(c(null),f(null),!e){c("Client not ready");return}if(!r){c(`Cannot send while transport is "${n}"`);return}let m;try{m=JSON.parse(i)}catch(S){c(`Invalid JSON: ${S.message}`);return}if(!m||typeof m!="object"||Array.isArray(m)){c("Message must be a JSON object");return}const g=m;if(typeof g.type!="string"||!g.type){c('Missing required string field "type"');return}const y=typeof g.id=="string"&&g.id.trim()?g.id.trim():crypto.randomUUID();try{const S=new Gt(g.type,g.data??{},y);e.transport.sendMessage(S),f(`Sent ${S.type} (${S.id})`),a(JSON.stringify({label:S.label,type:S.type,id:S.id,data:S.data},null,2))}catch(S){c(S.message||String(S))}},[r,e,i,n]);return t?w.jsx(Qh,{collapsed:!0}):w.jsxs("div",{className:"flex h-full min-h-0 gap-0",children:[w.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:w.jsx(Qh,{collapsed:!1})}),w.jsxs(Dl,{className:ue("w-[min(420px,40%)] shrink-0 h-full rounded-none! border-l","bg-background flex flex-col"),children:[w.jsxs(Vs,{className:"gap-4 justify-between items-center bg-background shrink-0",children:[w.jsx(Ua,{children:"Send Message"}),w.jsxs(en,{type:"button",size:"sm",disabled:!r,onClick:h,children:[w.jsx(tK,{className:"w-3.5 h-3.5"}),"Send"]})]}),w.jsxs(Hs,{className:"flex flex-col gap-2 flex-1 min-h-0 overflow-hidden",children:[w.jsx(KO,{value:i,onChange:m=>{a(m.target.value),c(null),f(null)},spellCheck:!1,className:"flex-1 min-h-0 font-mono text-xs resize-none",placeholder:rM}),l?w.jsx("p",{className:"text-destructive text-xs leading-snug shrink-0",children:l}):null,u?w.jsx("p",{className:"text-muted-foreground text-xs leading-snug shrink-0",children:u}):null,r?null:w.jsxs("p",{className:"text-muted-foreground text-xs leading-snug shrink-0",children:["Connect first to send messages (state: ",n,")"]})]})]})]})}function rK(t){const{className:e="h-6 w-auto"}=t;return w.jsxs("svg",{className:e,role:"img","aria-label":"HollyCRM",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 526 116",preserveAspectRatio:"xMidYMid meet",children:[w.jsx("path",{d:"M0 0 C61.38 0 122.76 0 186 0 C186 38.28 186 76.56 186 116 C124.62 116 63.24 116 0 116 C0 77.72 0 39.44 0 0 Z ",fill:"#FEFDFD",transform:"translate(0,0)"}),w.jsx("path",{d:"M0 0 C25.41 0 50.82 0 77 0 C77 38.28 77 76.56 77 116 C57.86 116 38.72 116 19 116 C21.25 109.25 21.25 109.25 22.9453125 106.1328125 C23.47705078 105.14667969 23.47705078 105.14667969 24.01953125 104.140625 C24.56673828 103.14289063 24.56673828 103.14289063 25.125 102.125 C25.68380859 101.09246094 25.68380859 101.09246094 26.25390625 100.0390625 C27.16499526 98.35705202 28.08190315 96.67819564 29 95 C28.39671875 94.81824219 27.7934375 94.63648437 27.171875 94.44921875 C19.23374341 91.95254833 19.23374341 91.95254833 16 89 C17.70926202 83.69964422 19.70193844 78.52231065 21.7890625 73.36132812 C24.0763084 67.45260955 24.81174104 62.53542427 26 56 C17.42 56 8.84 56 0 56 C-0.66 58.97 -1.32 61.94 -2 65 C-2.88555756 67.7338543 -3.93144343 70.32860857 -5 73 C-10.03779302 69.06515575 -14.97209729 64.72615472 -18 59 C-16.8158974 55.44769221 -15.70412814 54.75853234 -12.75 52.5625 C-11.98171875 51.98628906 -11.2134375 51.41007812 -10.421875 50.81640625 C-8.76518841 49.57389131 -7.10208972 48.33989245 -5.43359375 47.11328125 C-2.79250671 44.81981722 -1.15903622 42.58775699 0.6875 39.625 C1.26886719 38.70976563 1.85023437 37.79453125 2.44921875 36.8515625 C5.41753883 31.39344245 6.41458473 26.42529471 6.4375 20.25 C6.44064209 19.54987793 6.44378418 18.84975586 6.44702148 18.12841797 C6.30329577 11.85504341 4.43595256 7.24968489 1 2 C0.67 1.34 0.34 0.68 0 0 Z ",fill:"#E82B34",transform:"translate(109,0)"}),w.jsx("path",{d:"M0 0 C16.17 0 32.34 0 49 0 C49 38.28 49 76.56 49 116 C32.83 116 16.66 116 0 116 C0 77.72 0 39.44 0 0 Z ",fill:"#E82C35",transform:"translate(0,0)"}),w.jsx("path",{d:"M0 0 C3.96 0 7.92 0 12 0 C12 4.95 12 9.9 12 15 C18.6 15.33 25.2 15.66 32 16 C32 14.35 32 12.7 32 11 C26.39 11 20.78 11 15 11 C15 9.68 15 8.36 15 7 C20.61 7 26.22 7 32 7 C32 4.69 32 2.38 32 0 C35.96 0 39.92 0 44 0 C44 2.31 44 4.62 44 7 C49.61 7 55.22 7 61 7 C61 8.32 61 9.64 61 11 C55.39 11 49.78 11 44 11 C44 12.65 44 14.3 44 16 C45.24716797 15.94779297 45.24716797 15.94779297 46.51953125 15.89453125 C48.14955078 15.85392578 48.14955078 15.85392578 49.8125 15.8125 C50.89144531 15.77769531 51.97039063 15.74289063 53.08203125 15.70703125 C56 16 56 16 57.875 17.28125 C59.69066581 20.05518388 59.18182749 22.78771435 59 26 C59.66 26 60.32 26 61 26 C61 26.99 61 27.98 61 29 C60.34 29 59.68 29 59 29 C59.04125 30.27875 59.0825 31.5575 59.125 32.875 C59.1953125 35.0546875 59.1953125 35.0546875 59 37 C57 39 57 39 53.9609375 39.1953125 C52.77757812 39.17210937 51.59421875 39.14890625 50.375 39.125 C48.59222656 39.09792969 48.59222656 39.09792969 46.7734375 39.0703125 C45.40058594 39.03550781 45.40058594 39.03550781 44 39 C44 41.64 44 44.28 44 47 C48.95 47 53.9 47 59 47 C59 47.99 59 48.98 59 50 C54.05 50 49.1 50 44 50 C44 53.3 44 56.6 44 60 C49.61 60 55.22 60 61 60 C61 61.65 61 63.3 61 65 C57.31265225 65.08776185 53.62557653 65.14064603 49.9375 65.1875 C48.37999023 65.22520508 48.37999023 65.22520508 46.79101562 65.26367188 C40.72152554 65.32147654 36.32428264 65.00937714 31 62 C29.0625 59.8125 29.0625 59.8125 28 58 C27.62875 58.763125 27.2575 59.52625 26.875 60.3125 C24.55218596 63.64186679 22.79790039 64.61230563 19 66 C15.125 66.1875 15.125 66.1875 12 66 C12.28875 65.360625 12.5775 64.72125 12.875 64.0625 C15.63839235 56.53993194 16.39580494 48.95523495 17 41 C20.96 41 24.92 41 29 41 C29.22786458 43.5390625 29.45572917 46.078125 29.68359375 48.6171875 C29.86989285 51.01110861 29.86989285 51.01110861 31 53 C31.33 48.38 31.66 43.76 32 39 C26.72 39 21.44 39 16 39 C16 38.01 16 37.02 16 36 C21.28 36 26.56 36 32 36 C32 33.69 32 31.38 32 29 C27.05 29 22.1 29 17 29 C16.67 30.32 16.34 31.64 16 33 C15.49275391 33.45705322 14.98550781 33.91410645 14.46289062 34.38500977 C12.30334777 36.76908453 12.61518958 38.67044075 12.59375 41.83984375 C12.57183594 42.98517578 12.54992187 44.13050781 12.52734375 45.31054688 C12.51832031 46.50744141 12.50929688 47.70433594 12.5 48.9375 C12.48212432 51.30092025 12.4514124 53.66428743 12.40625 56.02734375 C12.39916016 57.07656006 12.39207031 58.12577637 12.38476562 59.20678711 C11.94628237 62.38996409 11.3119194 63.78287979 9 66 C0.45348837 66.81395349 0.45348837 66.81395349 -3 64 C-4.75 60.875 -4.75 60.875 -6 58 C-4.35 58 -2.7 58 -1 58 C-0.67 51.73 -0.34 45.46 0 39 C-1.98 39 -3.96 39 -6 39 C-6 38.01 -6 37.02 -6 36 C-3.03 35.505 -3.03 35.505 0 35 C0 29.39 0 23.78 0 18 C-1.98 18 -3.96 18 -6 18 C-6 17.01 -6 16.02 -6 15 C-4.02 15 -2.04 15 0 15 C0 10.05 0 5.1 0 0 Z M12 18 C12 22.62 12 27.24 12 32 C13.32 31.34 14.64 30.68 16 30 C15.67 28.68 15.34 27.36 15 26 C20.61 26 26.22 26 32 26 C32 23.69 32 21.38 32 19 C25.4 18.67 18.8 18.34 12 18 Z M44 19 C44 21.31 44 23.62 44 26 C45.65 26 47.3 26 49 26 C48.67 24.02 48.34 22.04 48 20 C46.68 19.67 45.36 19.34 44 19 Z M44 29 C44 31.31 44 33.62 44 36 C45.65 35.34 47.3 34.68 49 34 C49 32.35 49 30.7 49 29 C47.35 29 45.7 29 44 29 Z ",fill:"#000000",transform:"translate(465,2)"}),w.jsx("path",{d:"M0 0 C4.29 0 8.58 0 13 0 C12.34 4.95 11.68 9.9 11 15 C13.51173828 14.94779297 13.51173828 14.94779297 16.07421875 14.89453125 C18.27863579 14.86638976 20.4830637 14.83908998 22.6875 14.8125 C23.79029297 14.78736328 24.89308594 14.76222656 26.02929688 14.73632812 C27.09599609 14.72666016 28.16269531 14.71699219 29.26171875 14.70703125 C30.24100342 14.6913208 31.22028809 14.67561035 32.22924805 14.65942383 C35.4966933 15.06105271 37.35539654 16.07199121 40 18 C42.47437208 22.94874416 41.31287565 30.60623594 41.35009766 36.11157227 C41.36665091 37.90695158 41.3939329 39.70226516 41.43212891 41.49731445 C41.48696923 44.08840041 41.50878148 46.67794268 41.5234375 49.26953125 C41.54610687 50.06865433 41.56877625 50.8677774 41.59213257 51.69111633 C41.57607664 55.938589 41.37320789 57.52527304 38.65478516 60.9831543 C33.32562614 65.03172729 27.43058204 64.45873153 21 64 C15.87094899 62.82632526 12.33597354 60.02279162 9 56 C8.3671875 53.83984375 8.3671875 53.83984375 8 52 C8.71285156 52.30035156 9.42570312 52.60070313 10.16015625 52.91015625 C15.93377694 55.20250902 19.93528351 56.71394162 26 55 C27.67195977 53.32804023 27.12785168 51.29109371 27.13894653 49.05909729 C27.1369223 48.37057175 27.13489807 47.6820462 27.1328125 46.97265625 C27.13376923 46.26854111 27.13472595 45.56442596 27.13571167 44.838974 C27.13639341 43.34683137 27.13453952 41.85468579 27.13037109 40.36254883 C27.12503063 38.07561582 27.1303121 35.78887992 27.13671875 33.50195312 C27.13605781 32.05468707 27.13477632 30.60742113 27.1328125 29.16015625 C27.13483673 28.47365494 27.13686096 27.78715363 27.13894653 27.07984924 C27.16653259 23.41663176 27.16653259 23.41663176 26 20 C23.28553021 19.68758545 20.66090639 19.48663408 17.9375 19.375 C17.17888672 19.33632813 16.42027344 19.29765625 15.63867188 19.2578125 C13.75952805 19.16326438 11.87979664 19.08053244 10 19 C9.92652344 20.14662109 9.92652344 20.14662109 9.8515625 21.31640625 C7.7074607 52.03620962 7.7074607 52.03620962 -0.4375 59.4375 C-5.11511295 63.24687853 -9.32668174 64.25655645 -15.3125 64.125 C-16.38113281 64.10695313 -17.44976562 64.08890625 -18.55078125 64.0703125 C-19.35902344 64.04710938 -20.16726563 64.02390625 -21 64 C-20.29875 63.34 -19.5975 62.68 -18.875 62 C-6.67068949 49.6228239 -5.03812453 35.62924331 -3 19 C-8.61 19 -14.22 19 -20 19 C-20 17.68 -20 16.36 -20 15 C-14.06 15 -8.12 15 -2 15 C-1.855625 13.2675 -1.71125 11.535 -1.5625 9.75 C-1.27688169 6.32258026 -0.83944178 3.35776713 0 0 Z ",fill:"#000000",transform:"translate(329,2)"}),w.jsx("path",{d:"M0 0 C4.6081187 -0.07436755 9.21588514 -0.12870394 13.82446289 -0.16479492 C15.39093107 -0.17984622 16.95735736 -0.20029207 18.52368164 -0.22631836 C20.78021606 -0.26286433 23.03619153 -0.27976261 25.29296875 -0.29296875 C25.98899704 -0.30845261 26.68502533 -0.32393646 27.40214539 -0.33988953 C31.75045765 -0.34138171 34.64436639 0.15198802 38 3 C39.03223851 6.05900482 38.69260904 8.87407701 38 12 C36.53979162 14.6831329 34.63410231 16.70688683 32.5 18.875 C31.39026966 20.08453093 30.28351323 21.29679684 29.1796875 22.51171875 C28.63538086 23.10130371 28.09107422 23.69088867 27.53027344 24.29833984 C20.14292059 32.51305735 12.41767664 42.83783331 11 54 C19.19169092 55.4246419 27.71774496 56.66064322 35 52 C37.95605594 47.80221523 39.534603 42.88465666 41 38 C41.33 38 41.66 38 42 38 C42.3738613 44.75719691 42.00847323 49.87560807 39 56 C33.78904654 61.21095346 26.55685793 60.21567466 19.6875 60.25 C18.66720703 60.270625 17.64691406 60.29125 16.59570312 60.3125 C10.620734 60.34339835 6.21936374 60.01469323 1 57 C-1.26295148 53.60557278 -1.34554012 51.82711829 -0.7890625 47.84765625 C3.20393109 33.4372982 14.16690462 21.29832359 23.46875 10.05859375 C25.17933484 7.98277859 25.17933484 7.98277859 26 5 C13.13 4.505 13.13 4.505 0 4 C0 2.68 0 1.36 0 0 Z ",fill:"#000000",transform:"translate(408,7)"}),w.jsx("path",{d:"M0 0 C2.31243792 -0.02685412 4.6249627 -0.04632841 6.9375 -0.0625 C8.22527344 -0.07410156 9.51304687 -0.08570313 10.83984375 -0.09765625 C14 0 14 0 15 1 C18.43887116 0.88980413 21.87130922 0.77577482 25.30273438 0.52148438 C30.76095702 0.3447965 34.00467164 1.58440281 38.1940918 5.09936523 C41.33147752 8.40131844 43.33554855 12.14466457 45.375 16.1875 C46.21550998 17.78549086 47.05663087 19.38316058 47.8984375 20.98046875 C48.25599121 21.68067139 48.61354492 22.38087402 48.98193359 23.10229492 C50.08498659 25.23089378 50.08498659 25.23089378 52 28 C51 29 51 29 48.8203125 29.1328125 C47.93085938 29.13023438 47.04140625 29.12765625 46.125 29.125 C45.24070312 29.12757812 44.35640625 29.13015625 43.4453125 29.1328125 C41 29 41 29 38 28 C35.14655181 27.90276297 32.3182297 27.86005186 29.46484375 27.8671875 C28.63038223 27.86623077 27.79592072 27.86527405 26.93617249 27.86428833 C25.17351201 27.8636082 23.41084902 27.86545085 21.64819336 27.86962891 C18.94444178 27.87498625 16.24085582 27.86967483 13.53710938 27.86328125 C11.82552047 27.86394193 10.11393166 27.86522288 8.40234375 27.8671875 C7.59087387 27.86516327 6.77940399 27.86313904 5.94334412 27.86105347 C1.83982358 27.77581022 1.83982358 27.77581022 -2 29 C-4.2072923 29.07092842 -6.41667452 29.08415025 -8.625 29.0625 C-9.81351563 29.05347656 -11.00203125 29.04445313 -12.2265625 29.03515625 C-13.14179688 29.02355469 -14.05703125 29.01195313 -15 29 C-14.50371094 28.16339844 -14.00742188 27.32679687 -13.49609375 26.46484375 C-8.45610956 17.86443509 -4.07582659 9.09418809 0 0 Z M11 7 C9.76678376 9.51841817 8.75559823 11.8789218 7.8125 14.5 C7.29850318 15.8647062 6.78419415 17.22929486 6.26953125 18.59375 C5.85058594 19.7178125 5.43164062 20.841875 5 22 C4.67 22.66 4.34 23.32 4 24 C13.57 24 23.14 24 33 24 C31.5529655 19.65889649 30.39834857 16.61123013 28.125 12.8125 C27.63257813 11.97332031 27.14015625 11.13414063 26.6328125 10.26953125 C24.94105913 7.91807501 23.46393485 6.50734838 21 5 C17.06014377 4.58959831 14.23804038 4.66735343 11 7 Z ",fill:"#000000",transform:"translate(246,3)"}),w.jsx("path",{d:"M0 0 C4.29 0 8.58 0 13 0 C13.33 0.33 13.66 0.66 14 1 C14.55131592 0.85908936 15.10263184 0.71817871 15.6706543 0.57299805 C20.87219457 -0.70653398 26.48473695 -0.18479692 31.8125 -0.1875 C33.7006543 -0.20586914 33.7006543 -0.20586914 35.62695312 -0.22460938 C47.77435981 -0.24381982 47.77435981 -0.24381982 53 2 C55.78095904 6.17143856 55.33070347 9.59962668 55.3125 14.5 C55.32861328 15.36753906 55.34472656 16.23507813 55.36132812 17.12890625 C55.36197266 17.96292969 55.36261719 18.79695313 55.36328125 19.65625 C55.36626221 20.41744141 55.36924316 21.17863281 55.37231445 21.96289062 C54.89395506 24.58022226 54.11606925 25.41840647 52 27 C48.3778608 28.42486124 44.55718225 28.11312748 40.71484375 28.09765625 C39.66859581 28.09553383 39.66859581 28.09553383 38.60121155 28.09336853 C36.37993001 28.08779019 34.15875079 28.07525336 31.9375 28.0625 C30.4394546 28.05748115 28.9414076 28.05291892 27.44335938 28.04882812 C23.62887775 28.03748241 19.81445213 28.01883036 16 28 C15.01 28 14.02 28 13 28 C8.71 28 4.42 28 0 28 C0 18.76 0 9.52 0 0 Z M13 6 C12.91925797 8.62561109 12.8596377 11.24875676 12.8125 13.875 C12.78736328 14.62136719 12.76222656 15.36773437 12.73632812 16.13671875 C12.6701236 18.56221828 12.6701236 18.56221828 13 22 C16.3081665 24.20544434 17.36771832 24.25627135 21.21875 24.265625 C22.74048828 24.26949219 22.74048828 24.26949219 24.29296875 24.2734375 C25.35128906 24.26570313 26.40960938 24.25796875 27.5 24.25 C28.55832031 24.25773437 29.61664063 24.26546875 30.70703125 24.2734375 C31.72152344 24.27085938 32.73601562 24.26828125 33.78125 24.265625 C35.1744043 24.26224121 35.1744043 24.26224121 36.59570312 24.25878906 C39.26213233 24.15925145 39.26213233 24.15925145 42 22 C42.22107787 19.2114711 42.28107535 16.65346819 42.1875 13.875 C42.17396484 13.12089844 42.16042969 12.36679687 42.14648438 11.58984375 C42.11109985 9.72625873 42.05729167 7.86304022 42 6 C37.22881567 3.5361917 32.73427243 3.70190561 27.5 3.75 C26.65824219 3.74226563 25.81648438 3.73453125 24.94921875 3.7265625 C20.52519923 3.74049642 17.02061122 3.92378273 13 6 Z ",fill:"#000000",transform:"translate(237,39)"}),w.jsx("path",{d:"M0 0 C4.29 0 8.58 0 13 0 C12.57992676 1.62772339 12.57992676 1.62772339 12.15136719 3.28833008 C8.877926 16.79011028 8.34160461 29.84135639 8.25 43.6875 C8.22175749 45.86525716 8.19181898 48.04299301 8.16015625 50.22070312 C8.08729079 55.48042912 8.0371218 60.73990534 8 66 C4.04 66 0.08 66 -4 66 C-4 54.12 -4 42.24 -4 30 C-5.98 30 -7.96 30 -10 30 C-9.69707031 29.42636719 -9.39414062 28.85273438 -9.08203125 28.26171875 C-4.62432066 19.22285328 -2.37231434 9.74163121 0 0 Z ",fill:"#000000",transform:"translate(393,2)"}),w.jsx("path",{d:"M0 0 C7.65144439 0 8.23758077 0.31255274 13.19921875 5.04296875 C15.50737738 7.55140145 17.27945062 10.06072815 19 13 C19.969375 12.13375 20.93875 11.2675 21.9375 10.375 C24.70855578 8.01820306 27.5311337 5.79065915 30.5 3.6875 C31.53640625 2.95080078 31.53640625 2.95080078 32.59375 2.19921875 C35 1 35 1 42 0 C42 9.57 42 19.14 42 29 C39.69 29 37.38 29 35 29 C34.67 22.73 34.34 16.46 34 10 C27.83568721 15.02781732 27.83568721 15.02781732 24.0625 20.875 C21.61414946 24.8361525 21.61414946 24.8361525 18.84765625 25.57421875 C16.625 25.5625 16.625 25.5625 13 25 C13.28875 24.154375 13.5775 23.30875 13.875 22.4375 C14.01881011 18.48272205 13.55129369 17.98682131 11.0625 15.125 C10.051875 14.09375 9.04125 13.0625 8 12 C7.67 17.61 7.34 23.22 7 29 C4.69 29 2.38 29 0 29 C0 19.43 0 9.86 0 0 Z ",fill:"#000000",transform:"translate(484,85)"}),w.jsx("path",{d:"M0 0 C3.10666155 2.23903535 4.76233198 4.54836104 5.3984375 8.43359375 C5.54164675 12.14051007 5.22767735 15.26817995 4.125 18.8125 C-1.49235597 24.59507232 -7.67773114 26.34042063 -15.625 26.5625 C-23.34954352 26.27438699 -28.50083821 24.76608863 -34 19.3125 C-36.59230897 15.01898827 -36.93124347 11.89342089 -36 7 C-33.43427208 1.5606568 -30.23802637 -0.474523 -25 -3 C-16.45879825 -5.63617338 -7.68066485 -4.42052653 0 0 Z M-27 6 C-29.18038095 9.27057143 -29.63246755 10.20519469 -29 14 C-26.09313654 17.5712894 -23.48045429 19.85383727 -19 21 C-12.54992125 21.62420117 -9.30657968 20.71460578 -4 17 C-1.67250655 13.50875983 -1.49700684 12.10777749 -2 8 C-4.85937632 4.32365902 -7.95419825 2.26576881 -12.5859375 1.6640625 C-18.57882342 1.58012852 -22.33404282 1.81260253 -27 6 Z ",fill:"#000000",transform:"translate(311,88)"}),w.jsx("path",{d:"M0 0 C0.6909375 -0.01611328 1.381875 -0.03222656 2.09375 -0.04882812 C7.8726238 -0.0542594 12.82997188 1.04860273 17.1875 5.125 C18.67743192 8.1925069 18.86892084 9.94281988 18.25 13.3125 C16.40899583 15.35628144 14.51953464 16.70491296 12.25 18.3125 C13.91751148 22.25389078 16.47710649 25.1017812 19.25 28.3125 C15.17925308 29.28947926 13.00740362 29.6834732 9.1875 27.8125 C2.30102224 21.95166786 2.30102224 21.95166786 0.25 18.3125 C0.3359375 16.203125 0.3359375 16.203125 1.25 14.3125 C3.09765625 13.265625 3.09765625 13.265625 5.3125 12.5625 C6.04597656 12.32015625 6.77945312 12.0778125 7.53515625 11.828125 C8.10105469 11.65796875 8.66695313 11.4878125 9.25 11.3125 C8.92 9.9925 8.59 8.6725 8.25 7.3125 C2.31 6.3225 2.31 6.3225 -3.75 5.3125 C-3.75 13.2325 -3.75 21.1525 -3.75 29.3125 C-6.06 29.3125 -8.37 29.3125 -10.75 29.3125 C-10.83674429 24.85428834 -10.89030513 20.39629196 -10.9375 15.9375 C-10.96263672 14.66648437 -10.98777344 13.39546875 -11.01367188 12.0859375 C-11.02333984 10.87421875 -11.03300781 9.6625 -11.04296875 8.4140625 C-11.0586792 7.29338379 -11.07438965 6.17270508 -11.09057617 5.01806641 C-10.97818604 4.12522949 -10.8657959 3.23239258 -10.75 2.3125 C-7.07491251 -0.13755833 -4.2514806 -0.01939544 0 0 Z ",fill:"#000000",transform:"translate(458.75,84.6875)"}),w.jsx("path",{d:"M0 0 C2.5 1.5 2.5 1.5 4 3 C4 3.99 4 4.98 4 6 C1.375 7.25 1.375 7.25 -2 8 C-2.886875 7.38125 -3.77375 6.7625 -4.6875 6.125 C-9.41460662 3.09251651 -13.52508753 3.21206749 -19 4 C-22.68675314 5.31580851 -22.68675314 5.31580851 -25 8 C-26.41349769 11.39418221 -26.41349769 11.39418221 -26 15 C-23.11275174 18.68926166 -20.78773141 20.65853089 -16.0546875 21.23828125 C-10.52765905 21.42647756 -6.93873059 20.27951089 -2.01953125 17.82421875 C0.61510436 16.74896127 2.36965329 16.98180127 5 18 C3.26998534 21.91133748 1.47039476 23.83534456 -2.18359375 26.015625 C-6.02594326 27.35858211 -9.57802728 27.48092891 -13.625 27.5 C-14.35340088 27.50612305 -15.08180176 27.51224609 -15.83227539 27.51855469 C-22.03499045 27.37448616 -26.15892899 25.67742025 -30.8125 21.4375 C-34.33762808 17.50950014 -34.41718313 14.68959105 -34.328125 9.5390625 C-33.93375058 6.48735567 -32.94068917 4.43152412 -30.734375 2.25 C-21.31180281 -4.54104302 -10.28373737 -4.87124402 0 0 Z ",fill:"#000000",transform:"translate(437,87)"}),w.jsx("path",{d:"M0 0 C1.98 0 3.96 0 6 0 C7 1 7 1 7.09765625 3.28515625 C7.06510417 5.85677083 7.03255208 8.42838542 7 11 C12.28 11 17.56 11 23 11 C23 7.37 23 3.74 23 0 C24.65 0 26.3 0 28 0 C30 2 30 2 30.22705078 4.70556641 C30.21657715 5.82624512 30.20610352 6.94692383 30.1953125 8.1015625 C30.18886719 9.31328125 30.18242187 10.525 30.17578125 11.7734375 C30.15902344 13.04445313 30.14226562 14.31546875 30.125 15.625 C30.11597656 16.90375 30.10695313 18.1825 30.09765625 19.5 C30.07402303 22.66685167 30.04107629 25.83333424 30 29 C27.69 29 25.38 29 23 29 C23 25.04 23 21.08 23 17 C17.72 17 12.44 17 7 17 C7 20.96 7 24.92 7 29 C4.69 29 2.38 29 0 29 C0 19.43 0 9.86 0 0 Z ",fill:"#000000",transform:"translate(238,85)"}),w.jsx("path",{d:"M0 0 C3.38597563 1.48741072 5.09205483 4.34933902 7.1875 7.2734375 C8.03886082 8.4382539 8.89297928 9.60106033 9.75 10.76171875 C10.15734375 11.31424316 10.5646875 11.86676758 10.984375 12.43603516 C12.29381236 14.15910658 12.29381236 14.15910658 14.5 16.25390625 C16.1875 17.9609375 16.1875 17.9609375 16.1875 19.9609375 C9.10015849 22.34584139 2.55728651 24.09499438 -4.8125 21.9609375 C-7.9375 19.8984375 -7.9375 19.8984375 -9.8125 16.9609375 C-10.5144661 12.04717481 -10.37907507 10.03338318 -8.0625 5.6484375 C-3.27449291 -0.07057097 -3.27449291 -0.07057097 0 0 Z ",fill:"#E82E36",transform:"translate(66.8125,72.0390625)"}),w.jsx("path",{d:"M0 0 C2.5970079 2.46689728 4.81701861 5.16470761 7 8 C10.24759446 6.60005228 12.11620667 4.9554506 14.4375 2.3125 C16.2578125 0.42578125 16.2578125 0.42578125 18 -1 C21.01632404 -1 22.35717988 -0.32141006 25 1 C23.46731146 4.86237511 21.06053569 6.77280912 17.9375 9.4375 C13.6632086 13.55188985 12.28263101 16.19170412 11.875 22.125 C11.87047628 24.08377132 11.8957617 26.04399899 12 28 C9.36 28 6.72 28 4 28 C4.04833984 26.76636719 4.04833984 26.76636719 4.09765625 25.5078125 C4.02603608 18.6163604 3.38119381 14.61213991 -1.4375 9.5 C-2.24058594 8.7471875 -3.04367187 7.994375 -3.87109375 7.21875 C-6.1013069 4.89441776 -7.02068556 3.03962077 -8 0 C-4.86183337 -1.56908332 -3.33903504 -1.07101124 0 0 Z ",fill:"#000000",transform:"translate(377,86)"}),w.jsx("path",{d:"M0 0 C1.20029908 2.40059817 1.11459743 3.89360649 1.09765625 6.5703125 C1.09443359 7.46621094 1.09121094 8.36210938 1.08789062 9.28515625 C1.07951172 10.22230469 1.07113281 11.15945312 1.0625 12.125 C1.05798828 13.06988281 1.05347656 14.01476562 1.04882812 14.98828125 C1.03702375 17.3255477 1.01908799 19.66278169 1 22 C5.62 22 10.24 22 15 22 C15 23.98 15 25.96 15 28 C7.74 28 0.48 28 -7 28 C-7 18.76 -7 9.52 -7 0 C-4.30234372 -1.34882814 -2.84835666 -0.80338265 0 0 Z ",fill:"#000000",transform:"translate(358,86)"}),w.jsx("path",{d:"M0 0 C3.25696479 0.41755959 4.63443291 0.63443291 7 3 C7.22705078 5.06298828 7.22705078 5.06298828 7.1953125 7.5703125 C7.18564453 8.91416016 7.18564453 8.91416016 7.17578125 10.28515625 C7.15902344 11.22230469 7.14226562 12.15945312 7.125 13.125 C7.11597656 14.06988281 7.10695313 15.01476562 7.09765625 15.98828125 C7.07404668 18.32562827 7.03817494 20.66284549 7 23 C11.29 23 15.58 23 20 23 C20 24.98 20 26.96 20 29 C13.07 29 6.14 29 -1 29 C-1.02291487 25.0306345 -1.04284015 21.0614368 -1.05493164 17.09204102 C-1.05997057 15.74079614 -1.06680177 14.38955674 -1.07543945 13.03833008 C-1.08752419 11.09979566 -1.09269828 9.161222 -1.09765625 7.22265625 C-1.10289307 6.05484619 -1.10812988 4.88703613 -1.11352539 3.68383789 C-1 1 -1 1 0 0 Z ",fill:"#000000",transform:"translate(324,85)"}),w.jsx("path",{d:"M0 0 C2 2 2 2 2.375 5.25 C1.92859154 9.71408464 0.8794023 11.59018148 -2 15 C-7.26315789 19 -7.26315789 19 -10 19 C-11.54509605 14.36471184 -11.62122958 9.83570756 -11 5 C-7.94002351 0.41003527 -5.4735156 -0.85143576 0 0 Z ",fill:"#E82F38",transform:"translate(87,14)"}),w.jsx("path",{d:"M0 0 C0.67289063 0.4434375 1.34578125 0.886875 2.0390625 1.34375 C2.72742188 1.7871875 3.41578125 2.230625 4.125 2.6875 C4.63289063 3.0690625 5.14078125 3.450625 5.6640625 3.84375 C5.6640625 4.17375 5.6640625 4.50375 5.6640625 4.84375 C-4.2359375 4.84375 -14.1359375 4.84375 -24.3359375 4.84375 C-22.94695269 2.06578039 -21.02546942 1.81619399 -18.20898438 0.84179688 C-17.52900391 0.61556641 -16.84902344 0.38933594 -16.1484375 0.15625 C-15.1574707 -0.20049805 -15.1574707 -0.20049805 -14.14648438 -0.56445312 C-8.81538957 -2.35902699 -5.05843559 -2.50384103 0 0 Z ",fill:"#EB474F",transform:"translate(112.3359375,111.15625)"})]})}function iK(t){if(typeof window>"u")return t;try{return new URL(t,window.location.origin).toString()}catch{return t}}function sK(t){return t.client?w.jsx(aK,{...t,client:t.client}):w.jsx("div",{className:"flex items-center justify-center h-full w-full",children:w.jsx(Gp,{})})}function aK(t){const{error:e,handleConnect:n,handleDisconnect:r,connectionUrl:i,settingsContent:a,titleText:l="WebSocket Playground",noThemeSwitch:c=!1,noLogo:u=!1,noSessionInfo:f=!1,noStatusInfo:h=!1,noUserAudio:m=!1,noUserVideo:g=!0,noScreenControl:y=!1,noTextInput:S=!1,noBotAudio:x=!0,noBotVideo:C=!0,noConversation:A=!1,noMetrics:R=!1,collapseInfoPanel:j=!1,collapseMediaPanel:N=!1,assistantLabelText:O,userLabelText:B,systemLabelText:P,conversationElementProps:L,logoComponent:G}=t,[U,te]=k.useState(!1),[ce,be]=k.useState(!1),[ee,Q]=k.useState(""),[$,H]=k.useState("");xe(oe.ParticipantConnected,E=>{E.local&&Q(E.id||"")}),xe(oe.TrackStarted,(E,D)=>{D?.id&&D?.local&&Q(D.id)}),xe(oe.BotStarted,E=>{const D=E;D?.sessionId&&H(D.sessionId)});const{injectMessage:q}=v_();k.useEffect(()=>{t.onInjectMessage?.(q)},[t.onInjectMessage,q]);const Z=x&&C,fe=A&&R,F=h&&m&&g&&y&&f,X=i?iK(i):void 0,b=j?70:Z?50:37,M=j?4:Z?50:37;return w.jsx(k.Fragment,{children:w.jsxs("div",{className:"flex flex-col h-full w-full overflow-auto",children:[w.jsxs("div",{className:"h-min grid grid-cols-2 sm:grid-cols-[150px_1fr_150px] gap-2 items-center justify-center p-2 bg-background sm:relative top-0 w-full z-10",children:[u?w.jsx("span",{className:"h-6"}):G??w.jsx(rK,{}),w.jsx("strong",{className:"hidden sm:block text-center",children:l}),w.jsxs("div",{className:"flex items-center justify-end gap-2 sm:gap-3 xl:gap-6",children:[c?null:w.jsx(l7,{}),w.jsxs(h_,{children:[w.jsx(p_,{asChild:!0,children:w.jsx("span",{children:w.jsx(i_,{onConnect:()=>void n?.(),onDisconnect:()=>void r?.()})})}),X?w.jsx(m_,{align:"end",side:"bottom",children:X}):null]})]})]}),e?w.jsxs(HO,{variant:"destructive",className:"h-min animate-in fade-in duration-300",children:[w.jsx(qO,{icon:YX}),w.jsx(GO,{children:"Unable to connect. Please check web console for errors."}),w.jsx(WO,{variant:"destructive"})]}):null,w.jsx("div",{className:"hidden sm:block h-full",children:w.jsxs(Wh,{direction:"vertical",className:"h-full",children:[w.jsx(oi,{defaultSize:70,minSize:50,children:w.jsxs(Wh,{direction:"horizontal",children:[Z?null:w.jsxs(k.Fragment,{children:[w.jsxs(oi,{className:"flex flex-col gap-2 p-2 xl:gap-4",defaultSize:N?8:26,maxSize:30,minSize:10,collapsible:!0,collapsedSize:8,onCollapse:()=>te(!0),onExpand:()=>te(!1),children:[x?null:w.jsx(Kh,{className:ue({"mb-auto":C}),collapsed:U}),C?null:w.jsx(Jh,{className:ue({"mt-auto":x}),collapsed:U})]}),!fe||!F?w.jsx(ll,{withHandle:!0}):null]}),fe?null:w.jsxs(k.Fragment,{children:[w.jsx(oi,{className:"h-full p-2",defaultSize:b,minSize:30,children:w.jsx(Ey,{noConversation:A,noMetrics:R,noTextInput:S,conversationElementProps:{...L,assistantLabel:O,clientLabel:B,systemLabel:P}})}),F?null:w.jsx(ll,{withHandle:!0})]}),F?null:w.jsx(oi,{id:"info-panel",collapsible:!0,collapsedSize:4,defaultSize:M,minSize:15,className:"p-2",children:w.jsxs(Yh,{defaultValue:"info",className:"h-full flex flex-col gap-1",children:[w.jsxs(Xh,{className:"w-full shrink-0",children:[w.jsxs(Kn,{value:"info",className:"flex-1",children:[w.jsx(tM,{className:"w-3.5 h-3.5 mr-1"}),"Info"]}),w.jsxs(Kn,{value:"settings",className:"flex-1",children:[w.jsx(nM,{className:"w-3.5 h-3.5 mr-1"}),"Settings"]})]}),w.jsx(Jn,{value:"info",className:"flex-1 overflow-auto mt-0",children:w.jsx(Zh,{noSessionInfo:f,noStatusInfo:h,noUserAudio:m,noUserVideo:g,noScreenControl:y,participantId:ee,sessionId:$})}),w.jsx(Jn,{value:"settings",className:"flex-1 overflow-auto mt-0",children:a})]})})]})}),w.jsx(ll,{withHandle:!0}),w.jsx(oi,{collapsible:!0,collapsedSize:4,minSize:7,onCollapse:()=>be(!0),onExpand:()=>be(!1),children:w.jsx(iM,{collapsed:ce})})]})}),w.jsxs(Yh,{defaultValue:Z?fe?"info":"conversation":"bot",className:"flex flex-col gap-0 h-full sm:hidden overflow-hidden",children:[w.jsxs("div",{className:"flex flex-col overflow-hidden flex-1",children:[Z?null:w.jsxs(Jn,{value:"bot",className:"flex-1 overflow-auto flex flex-col gap-4 p-2",children:[x?null:w.jsx(Kh,{}),C?null:w.jsx(Jh,{})]}),fe?null:w.jsx(Jn,{value:"conversation",className:"flex-1 overflow-auto",children:w.jsx(Ey,{noConversation:A,noMetrics:R,noTextInput:S,conversationElementProps:{...L,assistantLabel:O,clientLabel:B,systemLabel:P}})}),w.jsx(Jn,{value:"info",className:"flex-1 overflow-auto p-2",children:w.jsx(Zh,{noUserAudio:m,noUserVideo:g,noScreenControl:y,participantId:ee,sessionId:$})}),w.jsx(Jn,{value:"events",className:"flex-1 overflow-auto",children:w.jsx(iM,{})}),a?w.jsx(Jn,{value:"settings",className:"flex-1 overflow-auto",children:a}):null]}),w.jsxs(Xh,{className:"w-full h-12 rounded-none z-10 mt-auto shrink-0",children:[Z?null:w.jsx(Kn,{value:"bot",children:w.jsx(HX,{})}),fe?null:w.jsx(Kn,{value:"conversation",children:w.jsx(JX,{})}),w.jsx(Kn,{value:"info",children:w.jsx(tM,{})}),w.jsx(Kn,{value:"events",children:w.jsx(GX,{})}),a?w.jsx(Kn,{value:"settings",children:w.jsx(nM,{})}):null]})]})]})})}const Kf={vueJs:"https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.min.js",elUiJs:"https://cdn.jsdelivr.net/npm/element-ui@2.15.14/lib/index.js",elUiCss:"https://cdn.jsdelivr.net/npm/element-ui@2.15.14/lib/theme-chalk/index.css",vjsfJs:"https://cdn.jsdelivr.net/npm/@lljj/vue-json-schema-form@1.19.0/dist/vueJsonSchemaForm.umd.min.js"};let Jf=null;function oK(t){if(document.querySelector(`link[data-vue-island="${t}"]`))return;const e=document.createElement("link");e.rel="stylesheet",e.href=t,e.setAttribute("data-vue-island",t),document.head.appendChild(e)}function fb(t){return new Promise((e,n)=>{const r=document.querySelector(`script[data-vue-island="${t}"]`);if(r){if(r.dataset.loaded==="true"){e();return}r.addEventListener("load",()=>e()),r.addEventListener("error",()=>n(new Error(`Failed to load ${t}`)));return}const i=document.createElement("script");i.src=t,i.async=!1,i.setAttribute("data-vue-island",t),i.addEventListener("load",()=>{i.dataset.loaded="true",e()}),i.addEventListener("error",()=>n(new Error(`Failed to load ${t}`))),document.head.appendChild(i)})}function lK(){return Jf||(Jf=(async()=>{if(oK(Kf.elUiCss),await fb(Kf.vueJs),await fb(Kf.elUiJs),await fb(Kf.vjsfJs),!window.Vue||!window.ELEMENT||!window.vueJsonSchemaForm)throw new Error("Vue / ElementUI / vueJsonSchemaForm failed to load");window.Vue._elementInstalled||(window.Vue.use(window.ELEMENT),window.Vue._elementInstalled=!0)})(),Jf)}const cK=["account_id","agent_id"];function hh(t,e){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(r=>hh(r,e));const n={};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&!(r==="ui:widget"&&t[r]==="HiddenWidget"&&cK.indexOf(e)!==-1))if(r==="properties"){const i={};for(const a in t[r])Object.prototype.hasOwnProperty.call(t[r],a)&&(i[a]=hh(t[r][a],a));n[r]=i}else n[r]=hh(t[r],e);return n}function sM(t){try{return JSON.parse(t)}catch{return null}}function uK({endpoint:t,onEndpointChange:e,settingsJson:n,onSettingsChange:r,jsonError:i,schemaUrl:a="/bot/settings/_schema",defaultsUrl:l="/client/_settings"}){const c=k.useRef(null),u=k.useRef(null),f=k.useRef({onSettingsChange:r}),h=k.useRef(null),m=k.useRef(null),[g,y]=k.useState("loading"),[S,x]=k.useState(null);k.useEffect(()=>{f.current.onSettingsChange=r},[r]),k.useEffect(()=>{let A=!1;return(async()=>{try{if(await lK(),A)return;const[R,j]=await Promise.all([fetch(a).then(te=>{if(!te.ok)throw new Error(`schema HTTP ${te.status}`);return te.json()}),fetch(l).then(te=>{if(!te.ok)throw new Error(`defaults HTTP ${te.status}`);return te.json()})]);if(A)return;if(!j||typeof j!="object")throw new Error("invalid defaults from server");const N=hh(R,""),O=JSON.stringify(j,null,2);m.current=O;let B=sM(n);if(B===null&&(B=j,h.current=O,f.current.onSettingsChange(O)),!c.current)return;const P=window.Vue,L=window.vueJsonSchemaForm.default,G=document.createElement("div");c.current.innerHTML="",c.current.appendChild(G);const U=new P({el:G,data:{formData:B,schema:N},render(te){return te(L,{props:{value:this.formData,schema:this.schema,formProps:{labelPosition:"right",labelWidth:"140px",labelSuffix:":"},formFooter:{show:!1}},on:{input:ce=>{this.formData=ce;const be=JSON.stringify(ce,null,2);h.current=be,f.current.onSettingsChange(be)}}})}});u.current=U,y("ready")}catch(R){if(A)return;x(R.message||String(R)),y("error")}})(),()=>{if(A=!0,u.current){try{u.current.$destroy()}catch{}u.current=null}c.current&&(c.current.innerHTML="")}},[a,l]),k.useEffect(()=>{const A=u.current;if(!A||h.current===n)return;const R=sM(n);R===null||typeof R!="object"||(h.current=n,A.formData=R)},[n]);const C=()=>{m.current&&r(m.current)};return w.jsxs("div",{className:"flex flex-col gap-3 p-2 h-full overflow-auto text-xs",children:[w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsx("label",{className:"font-medium text-muted-foreground uppercase tracking-wide",children:"Connect Endpoint"}),w.jsx("input",{type:"text",value:t,onChange:A=>e(A.target.value),className:"w-full font-mono border rounded px-2 py-1.5 bg-background text-foreground focus:outline-none focus:ring-1 focus:ring-ring",placeholder:new URL("/bot/connect",window.location.origin).href,spellCheck:!1})]}),w.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-h-0",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("label",{className:"font-medium text-muted-foreground uppercase tracking-wide",children:"Client Settings"}),w.jsxs("button",{type:"button",title:"Reset to defaults",onClick:C,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:[w.jsx(ZX,{className:"w-3 h-3"}),"Reset"]})]}),g==="loading"?w.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-muted-foreground min-h-[200px]",children:[w.jsx(Gp,{}),w.jsx("div",{children:"正在加载配置…"})]}):null,g==="error"?w.jsxs("div",{className:ue("flex-1 border rounded p-3 text-destructive bg-destructive/5","min-h-[100px]"),children:["加载设置失败:",S]}):null,w.jsx("div",{ref:c,className:ue("vue-island flex-1 min-h-0 overflow-auto",g!=="ready"&&"hidden")}),i?w.jsx("p",{className:"text-destructive leading-snug",children:i}):null]})]})}function u7(t){let e=typeof t;if(e=="object"){if(Array.isArray(t))return"array";if(t===null)return"null"}return e}function dK(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}let Hi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Wp=[];for(let t=0;t<Hi.length;t++)Wp[Hi[t].charCodeAt(0)]=t;Wp[45]=Hi.indexOf("+");Wp[95]=Hi.indexOf("/");function fK(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n=new Uint8Array(e),r=0,i=0,a,l=0;for(let c=0;c<t.length;c++){if(a=Wp[t.charCodeAt(c)],a===void 0)switch(t[c]){case"=":i=0;case`
|
|
97
|
+
}`;function iM({collapsed:t=!1}){const e=Qi(),n=Zs(),r=n==="ready"||n==="connected",[i,a]=k.useState(rM),[l,c]=k.useState(null),[u,f]=k.useState(null),h=k.useCallback(()=>{if(c(null),f(null),!e){c("Client not ready");return}if(!r){c(`Cannot send while transport is "${n}"`);return}let m;try{m=JSON.parse(i)}catch(S){c(`Invalid JSON: ${S.message}`);return}if(!m||typeof m!="object"||Array.isArray(m)){c("Message must be a JSON object");return}const g=m;if(typeof g.type!="string"||!g.type){c('Missing required string field "type"');return}const y=typeof g.id=="string"&&g.id.trim()?g.id.trim():crypto.randomUUID();try{const S=new Gt(g.type,g.data??{},y);e.transport.sendMessage(S),f(`Sent ${S.type} (${S.id})`),a(JSON.stringify({label:S.label,type:S.type,id:S.id,data:S.data},null,2))}catch(S){c(S.message||String(S))}},[r,e,i,n]);return t?w.jsx(Qh,{collapsed:!0}):w.jsxs("div",{className:"h-full min-h-0",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(280px, 38%)",height:"100%",minHeight:0},children:[w.jsx("div",{className:"min-w-0 min-h-0 overflow-hidden",children:w.jsx(Qh,{collapsed:!1})}),w.jsxs(Dl,{className:ue("h-full min-h-0 min-w-0 overflow-hidden rounded-none! border-l","bg-background flex flex-col"),children:[w.jsxs(Vs,{className:"gap-4 justify-between items-center bg-background shrink-0",children:[w.jsx(Ua,{children:"Send Message"}),w.jsxs(en,{type:"button",size:"sm",disabled:!r,onClick:h,children:[w.jsx(tK,{className:"w-3.5 h-3.5"}),"Send"]})]}),w.jsxs(Hs,{className:"flex flex-col gap-2 flex-1 min-h-0 overflow-hidden",children:[w.jsx(KO,{value:i,onChange:m=>{a(m.target.value),c(null),f(null)},spellCheck:!1,className:"flex-1 min-h-0 font-mono text-xs resize-none",style:{minHeight:0,height:"100%"},placeholder:rM}),l?w.jsx("p",{className:"text-destructive text-xs leading-snug shrink-0",children:l}):null,u?w.jsx("p",{className:"text-muted-foreground text-xs leading-snug shrink-0",children:u}):null,r?null:w.jsxs("p",{className:"text-muted-foreground text-xs leading-snug shrink-0",children:["Connect first to send messages (state: ",n,")"]})]})]})]})}function rK(t){const{className:e="h-6 w-auto"}=t;return w.jsxs("svg",{className:e,role:"img","aria-label":"HollyCRM",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 526 116",preserveAspectRatio:"xMidYMid meet",children:[w.jsx("path",{d:"M0 0 C61.38 0 122.76 0 186 0 C186 38.28 186 76.56 186 116 C124.62 116 63.24 116 0 116 C0 77.72 0 39.44 0 0 Z ",fill:"#FEFDFD",transform:"translate(0,0)"}),w.jsx("path",{d:"M0 0 C25.41 0 50.82 0 77 0 C77 38.28 77 76.56 77 116 C57.86 116 38.72 116 19 116 C21.25 109.25 21.25 109.25 22.9453125 106.1328125 C23.47705078 105.14667969 23.47705078 105.14667969 24.01953125 104.140625 C24.56673828 103.14289063 24.56673828 103.14289063 25.125 102.125 C25.68380859 101.09246094 25.68380859 101.09246094 26.25390625 100.0390625 C27.16499526 98.35705202 28.08190315 96.67819564 29 95 C28.39671875 94.81824219 27.7934375 94.63648437 27.171875 94.44921875 C19.23374341 91.95254833 19.23374341 91.95254833 16 89 C17.70926202 83.69964422 19.70193844 78.52231065 21.7890625 73.36132812 C24.0763084 67.45260955 24.81174104 62.53542427 26 56 C17.42 56 8.84 56 0 56 C-0.66 58.97 -1.32 61.94 -2 65 C-2.88555756 67.7338543 -3.93144343 70.32860857 -5 73 C-10.03779302 69.06515575 -14.97209729 64.72615472 -18 59 C-16.8158974 55.44769221 -15.70412814 54.75853234 -12.75 52.5625 C-11.98171875 51.98628906 -11.2134375 51.41007812 -10.421875 50.81640625 C-8.76518841 49.57389131 -7.10208972 48.33989245 -5.43359375 47.11328125 C-2.79250671 44.81981722 -1.15903622 42.58775699 0.6875 39.625 C1.26886719 38.70976563 1.85023437 37.79453125 2.44921875 36.8515625 C5.41753883 31.39344245 6.41458473 26.42529471 6.4375 20.25 C6.44064209 19.54987793 6.44378418 18.84975586 6.44702148 18.12841797 C6.30329577 11.85504341 4.43595256 7.24968489 1 2 C0.67 1.34 0.34 0.68 0 0 Z ",fill:"#E82B34",transform:"translate(109,0)"}),w.jsx("path",{d:"M0 0 C16.17 0 32.34 0 49 0 C49 38.28 49 76.56 49 116 C32.83 116 16.66 116 0 116 C0 77.72 0 39.44 0 0 Z ",fill:"#E82C35",transform:"translate(0,0)"}),w.jsx("path",{d:"M0 0 C3.96 0 7.92 0 12 0 C12 4.95 12 9.9 12 15 C18.6 15.33 25.2 15.66 32 16 C32 14.35 32 12.7 32 11 C26.39 11 20.78 11 15 11 C15 9.68 15 8.36 15 7 C20.61 7 26.22 7 32 7 C32 4.69 32 2.38 32 0 C35.96 0 39.92 0 44 0 C44 2.31 44 4.62 44 7 C49.61 7 55.22 7 61 7 C61 8.32 61 9.64 61 11 C55.39 11 49.78 11 44 11 C44 12.65 44 14.3 44 16 C45.24716797 15.94779297 45.24716797 15.94779297 46.51953125 15.89453125 C48.14955078 15.85392578 48.14955078 15.85392578 49.8125 15.8125 C50.89144531 15.77769531 51.97039063 15.74289063 53.08203125 15.70703125 C56 16 56 16 57.875 17.28125 C59.69066581 20.05518388 59.18182749 22.78771435 59 26 C59.66 26 60.32 26 61 26 C61 26.99 61 27.98 61 29 C60.34 29 59.68 29 59 29 C59.04125 30.27875 59.0825 31.5575 59.125 32.875 C59.1953125 35.0546875 59.1953125 35.0546875 59 37 C57 39 57 39 53.9609375 39.1953125 C52.77757812 39.17210937 51.59421875 39.14890625 50.375 39.125 C48.59222656 39.09792969 48.59222656 39.09792969 46.7734375 39.0703125 C45.40058594 39.03550781 45.40058594 39.03550781 44 39 C44 41.64 44 44.28 44 47 C48.95 47 53.9 47 59 47 C59 47.99 59 48.98 59 50 C54.05 50 49.1 50 44 50 C44 53.3 44 56.6 44 60 C49.61 60 55.22 60 61 60 C61 61.65 61 63.3 61 65 C57.31265225 65.08776185 53.62557653 65.14064603 49.9375 65.1875 C48.37999023 65.22520508 48.37999023 65.22520508 46.79101562 65.26367188 C40.72152554 65.32147654 36.32428264 65.00937714 31 62 C29.0625 59.8125 29.0625 59.8125 28 58 C27.62875 58.763125 27.2575 59.52625 26.875 60.3125 C24.55218596 63.64186679 22.79790039 64.61230563 19 66 C15.125 66.1875 15.125 66.1875 12 66 C12.28875 65.360625 12.5775 64.72125 12.875 64.0625 C15.63839235 56.53993194 16.39580494 48.95523495 17 41 C20.96 41 24.92 41 29 41 C29.22786458 43.5390625 29.45572917 46.078125 29.68359375 48.6171875 C29.86989285 51.01110861 29.86989285 51.01110861 31 53 C31.33 48.38 31.66 43.76 32 39 C26.72 39 21.44 39 16 39 C16 38.01 16 37.02 16 36 C21.28 36 26.56 36 32 36 C32 33.69 32 31.38 32 29 C27.05 29 22.1 29 17 29 C16.67 30.32 16.34 31.64 16 33 C15.49275391 33.45705322 14.98550781 33.91410645 14.46289062 34.38500977 C12.30334777 36.76908453 12.61518958 38.67044075 12.59375 41.83984375 C12.57183594 42.98517578 12.54992187 44.13050781 12.52734375 45.31054688 C12.51832031 46.50744141 12.50929688 47.70433594 12.5 48.9375 C12.48212432 51.30092025 12.4514124 53.66428743 12.40625 56.02734375 C12.39916016 57.07656006 12.39207031 58.12577637 12.38476562 59.20678711 C11.94628237 62.38996409 11.3119194 63.78287979 9 66 C0.45348837 66.81395349 0.45348837 66.81395349 -3 64 C-4.75 60.875 -4.75 60.875 -6 58 C-4.35 58 -2.7 58 -1 58 C-0.67 51.73 -0.34 45.46 0 39 C-1.98 39 -3.96 39 -6 39 C-6 38.01 -6 37.02 -6 36 C-3.03 35.505 -3.03 35.505 0 35 C0 29.39 0 23.78 0 18 C-1.98 18 -3.96 18 -6 18 C-6 17.01 -6 16.02 -6 15 C-4.02 15 -2.04 15 0 15 C0 10.05 0 5.1 0 0 Z M12 18 C12 22.62 12 27.24 12 32 C13.32 31.34 14.64 30.68 16 30 C15.67 28.68 15.34 27.36 15 26 C20.61 26 26.22 26 32 26 C32 23.69 32 21.38 32 19 C25.4 18.67 18.8 18.34 12 18 Z M44 19 C44 21.31 44 23.62 44 26 C45.65 26 47.3 26 49 26 C48.67 24.02 48.34 22.04 48 20 C46.68 19.67 45.36 19.34 44 19 Z M44 29 C44 31.31 44 33.62 44 36 C45.65 35.34 47.3 34.68 49 34 C49 32.35 49 30.7 49 29 C47.35 29 45.7 29 44 29 Z ",fill:"#000000",transform:"translate(465,2)"}),w.jsx("path",{d:"M0 0 C4.29 0 8.58 0 13 0 C12.34 4.95 11.68 9.9 11 15 C13.51173828 14.94779297 13.51173828 14.94779297 16.07421875 14.89453125 C18.27863579 14.86638976 20.4830637 14.83908998 22.6875 14.8125 C23.79029297 14.78736328 24.89308594 14.76222656 26.02929688 14.73632812 C27.09599609 14.72666016 28.16269531 14.71699219 29.26171875 14.70703125 C30.24100342 14.6913208 31.22028809 14.67561035 32.22924805 14.65942383 C35.4966933 15.06105271 37.35539654 16.07199121 40 18 C42.47437208 22.94874416 41.31287565 30.60623594 41.35009766 36.11157227 C41.36665091 37.90695158 41.3939329 39.70226516 41.43212891 41.49731445 C41.48696923 44.08840041 41.50878148 46.67794268 41.5234375 49.26953125 C41.54610687 50.06865433 41.56877625 50.8677774 41.59213257 51.69111633 C41.57607664 55.938589 41.37320789 57.52527304 38.65478516 60.9831543 C33.32562614 65.03172729 27.43058204 64.45873153 21 64 C15.87094899 62.82632526 12.33597354 60.02279162 9 56 C8.3671875 53.83984375 8.3671875 53.83984375 8 52 C8.71285156 52.30035156 9.42570312 52.60070313 10.16015625 52.91015625 C15.93377694 55.20250902 19.93528351 56.71394162 26 55 C27.67195977 53.32804023 27.12785168 51.29109371 27.13894653 49.05909729 C27.1369223 48.37057175 27.13489807 47.6820462 27.1328125 46.97265625 C27.13376923 46.26854111 27.13472595 45.56442596 27.13571167 44.838974 C27.13639341 43.34683137 27.13453952 41.85468579 27.13037109 40.36254883 C27.12503063 38.07561582 27.1303121 35.78887992 27.13671875 33.50195312 C27.13605781 32.05468707 27.13477632 30.60742113 27.1328125 29.16015625 C27.13483673 28.47365494 27.13686096 27.78715363 27.13894653 27.07984924 C27.16653259 23.41663176 27.16653259 23.41663176 26 20 C23.28553021 19.68758545 20.66090639 19.48663408 17.9375 19.375 C17.17888672 19.33632813 16.42027344 19.29765625 15.63867188 19.2578125 C13.75952805 19.16326438 11.87979664 19.08053244 10 19 C9.92652344 20.14662109 9.92652344 20.14662109 9.8515625 21.31640625 C7.7074607 52.03620962 7.7074607 52.03620962 -0.4375 59.4375 C-5.11511295 63.24687853 -9.32668174 64.25655645 -15.3125 64.125 C-16.38113281 64.10695313 -17.44976562 64.08890625 -18.55078125 64.0703125 C-19.35902344 64.04710938 -20.16726563 64.02390625 -21 64 C-20.29875 63.34 -19.5975 62.68 -18.875 62 C-6.67068949 49.6228239 -5.03812453 35.62924331 -3 19 C-8.61 19 -14.22 19 -20 19 C-20 17.68 -20 16.36 -20 15 C-14.06 15 -8.12 15 -2 15 C-1.855625 13.2675 -1.71125 11.535 -1.5625 9.75 C-1.27688169 6.32258026 -0.83944178 3.35776713 0 0 Z ",fill:"#000000",transform:"translate(329,2)"}),w.jsx("path",{d:"M0 0 C4.6081187 -0.07436755 9.21588514 -0.12870394 13.82446289 -0.16479492 C15.39093107 -0.17984622 16.95735736 -0.20029207 18.52368164 -0.22631836 C20.78021606 -0.26286433 23.03619153 -0.27976261 25.29296875 -0.29296875 C25.98899704 -0.30845261 26.68502533 -0.32393646 27.40214539 -0.33988953 C31.75045765 -0.34138171 34.64436639 0.15198802 38 3 C39.03223851 6.05900482 38.69260904 8.87407701 38 12 C36.53979162 14.6831329 34.63410231 16.70688683 32.5 18.875 C31.39026966 20.08453093 30.28351323 21.29679684 29.1796875 22.51171875 C28.63538086 23.10130371 28.09107422 23.69088867 27.53027344 24.29833984 C20.14292059 32.51305735 12.41767664 42.83783331 11 54 C19.19169092 55.4246419 27.71774496 56.66064322 35 52 C37.95605594 47.80221523 39.534603 42.88465666 41 38 C41.33 38 41.66 38 42 38 C42.3738613 44.75719691 42.00847323 49.87560807 39 56 C33.78904654 61.21095346 26.55685793 60.21567466 19.6875 60.25 C18.66720703 60.270625 17.64691406 60.29125 16.59570312 60.3125 C10.620734 60.34339835 6.21936374 60.01469323 1 57 C-1.26295148 53.60557278 -1.34554012 51.82711829 -0.7890625 47.84765625 C3.20393109 33.4372982 14.16690462 21.29832359 23.46875 10.05859375 C25.17933484 7.98277859 25.17933484 7.98277859 26 5 C13.13 4.505 13.13 4.505 0 4 C0 2.68 0 1.36 0 0 Z ",fill:"#000000",transform:"translate(408,7)"}),w.jsx("path",{d:"M0 0 C2.31243792 -0.02685412 4.6249627 -0.04632841 6.9375 -0.0625 C8.22527344 -0.07410156 9.51304687 -0.08570313 10.83984375 -0.09765625 C14 0 14 0 15 1 C18.43887116 0.88980413 21.87130922 0.77577482 25.30273438 0.52148438 C30.76095702 0.3447965 34.00467164 1.58440281 38.1940918 5.09936523 C41.33147752 8.40131844 43.33554855 12.14466457 45.375 16.1875 C46.21550998 17.78549086 47.05663087 19.38316058 47.8984375 20.98046875 C48.25599121 21.68067139 48.61354492 22.38087402 48.98193359 23.10229492 C50.08498659 25.23089378 50.08498659 25.23089378 52 28 C51 29 51 29 48.8203125 29.1328125 C47.93085938 29.13023438 47.04140625 29.12765625 46.125 29.125 C45.24070312 29.12757812 44.35640625 29.13015625 43.4453125 29.1328125 C41 29 41 29 38 28 C35.14655181 27.90276297 32.3182297 27.86005186 29.46484375 27.8671875 C28.63038223 27.86623077 27.79592072 27.86527405 26.93617249 27.86428833 C25.17351201 27.8636082 23.41084902 27.86545085 21.64819336 27.86962891 C18.94444178 27.87498625 16.24085582 27.86967483 13.53710938 27.86328125 C11.82552047 27.86394193 10.11393166 27.86522288 8.40234375 27.8671875 C7.59087387 27.86516327 6.77940399 27.86313904 5.94334412 27.86105347 C1.83982358 27.77581022 1.83982358 27.77581022 -2 29 C-4.2072923 29.07092842 -6.41667452 29.08415025 -8.625 29.0625 C-9.81351563 29.05347656 -11.00203125 29.04445313 -12.2265625 29.03515625 C-13.14179688 29.02355469 -14.05703125 29.01195313 -15 29 C-14.50371094 28.16339844 -14.00742188 27.32679687 -13.49609375 26.46484375 C-8.45610956 17.86443509 -4.07582659 9.09418809 0 0 Z M11 7 C9.76678376 9.51841817 8.75559823 11.8789218 7.8125 14.5 C7.29850318 15.8647062 6.78419415 17.22929486 6.26953125 18.59375 C5.85058594 19.7178125 5.43164062 20.841875 5 22 C4.67 22.66 4.34 23.32 4 24 C13.57 24 23.14 24 33 24 C31.5529655 19.65889649 30.39834857 16.61123013 28.125 12.8125 C27.63257813 11.97332031 27.14015625 11.13414063 26.6328125 10.26953125 C24.94105913 7.91807501 23.46393485 6.50734838 21 5 C17.06014377 4.58959831 14.23804038 4.66735343 11 7 Z ",fill:"#000000",transform:"translate(246,3)"}),w.jsx("path",{d:"M0 0 C4.29 0 8.58 0 13 0 C13.33 0.33 13.66 0.66 14 1 C14.55131592 0.85908936 15.10263184 0.71817871 15.6706543 0.57299805 C20.87219457 -0.70653398 26.48473695 -0.18479692 31.8125 -0.1875 C33.7006543 -0.20586914 33.7006543 -0.20586914 35.62695312 -0.22460938 C47.77435981 -0.24381982 47.77435981 -0.24381982 53 2 C55.78095904 6.17143856 55.33070347 9.59962668 55.3125 14.5 C55.32861328 15.36753906 55.34472656 16.23507813 55.36132812 17.12890625 C55.36197266 17.96292969 55.36261719 18.79695313 55.36328125 19.65625 C55.36626221 20.41744141 55.36924316 21.17863281 55.37231445 21.96289062 C54.89395506 24.58022226 54.11606925 25.41840647 52 27 C48.3778608 28.42486124 44.55718225 28.11312748 40.71484375 28.09765625 C39.66859581 28.09553383 39.66859581 28.09553383 38.60121155 28.09336853 C36.37993001 28.08779019 34.15875079 28.07525336 31.9375 28.0625 C30.4394546 28.05748115 28.9414076 28.05291892 27.44335938 28.04882812 C23.62887775 28.03748241 19.81445213 28.01883036 16 28 C15.01 28 14.02 28 13 28 C8.71 28 4.42 28 0 28 C0 18.76 0 9.52 0 0 Z M13 6 C12.91925797 8.62561109 12.8596377 11.24875676 12.8125 13.875 C12.78736328 14.62136719 12.76222656 15.36773437 12.73632812 16.13671875 C12.6701236 18.56221828 12.6701236 18.56221828 13 22 C16.3081665 24.20544434 17.36771832 24.25627135 21.21875 24.265625 C22.74048828 24.26949219 22.74048828 24.26949219 24.29296875 24.2734375 C25.35128906 24.26570313 26.40960938 24.25796875 27.5 24.25 C28.55832031 24.25773437 29.61664063 24.26546875 30.70703125 24.2734375 C31.72152344 24.27085938 32.73601562 24.26828125 33.78125 24.265625 C35.1744043 24.26224121 35.1744043 24.26224121 36.59570312 24.25878906 C39.26213233 24.15925145 39.26213233 24.15925145 42 22 C42.22107787 19.2114711 42.28107535 16.65346819 42.1875 13.875 C42.17396484 13.12089844 42.16042969 12.36679687 42.14648438 11.58984375 C42.11109985 9.72625873 42.05729167 7.86304022 42 6 C37.22881567 3.5361917 32.73427243 3.70190561 27.5 3.75 C26.65824219 3.74226563 25.81648438 3.73453125 24.94921875 3.7265625 C20.52519923 3.74049642 17.02061122 3.92378273 13 6 Z ",fill:"#000000",transform:"translate(237,39)"}),w.jsx("path",{d:"M0 0 C4.29 0 8.58 0 13 0 C12.57992676 1.62772339 12.57992676 1.62772339 12.15136719 3.28833008 C8.877926 16.79011028 8.34160461 29.84135639 8.25 43.6875 C8.22175749 45.86525716 8.19181898 48.04299301 8.16015625 50.22070312 C8.08729079 55.48042912 8.0371218 60.73990534 8 66 C4.04 66 0.08 66 -4 66 C-4 54.12 -4 42.24 -4 30 C-5.98 30 -7.96 30 -10 30 C-9.69707031 29.42636719 -9.39414062 28.85273438 -9.08203125 28.26171875 C-4.62432066 19.22285328 -2.37231434 9.74163121 0 0 Z ",fill:"#000000",transform:"translate(393,2)"}),w.jsx("path",{d:"M0 0 C7.65144439 0 8.23758077 0.31255274 13.19921875 5.04296875 C15.50737738 7.55140145 17.27945062 10.06072815 19 13 C19.969375 12.13375 20.93875 11.2675 21.9375 10.375 C24.70855578 8.01820306 27.5311337 5.79065915 30.5 3.6875 C31.53640625 2.95080078 31.53640625 2.95080078 32.59375 2.19921875 C35 1 35 1 42 0 C42 9.57 42 19.14 42 29 C39.69 29 37.38 29 35 29 C34.67 22.73 34.34 16.46 34 10 C27.83568721 15.02781732 27.83568721 15.02781732 24.0625 20.875 C21.61414946 24.8361525 21.61414946 24.8361525 18.84765625 25.57421875 C16.625 25.5625 16.625 25.5625 13 25 C13.28875 24.154375 13.5775 23.30875 13.875 22.4375 C14.01881011 18.48272205 13.55129369 17.98682131 11.0625 15.125 C10.051875 14.09375 9.04125 13.0625 8 12 C7.67 17.61 7.34 23.22 7 29 C4.69 29 2.38 29 0 29 C0 19.43 0 9.86 0 0 Z ",fill:"#000000",transform:"translate(484,85)"}),w.jsx("path",{d:"M0 0 C3.10666155 2.23903535 4.76233198 4.54836104 5.3984375 8.43359375 C5.54164675 12.14051007 5.22767735 15.26817995 4.125 18.8125 C-1.49235597 24.59507232 -7.67773114 26.34042063 -15.625 26.5625 C-23.34954352 26.27438699 -28.50083821 24.76608863 -34 19.3125 C-36.59230897 15.01898827 -36.93124347 11.89342089 -36 7 C-33.43427208 1.5606568 -30.23802637 -0.474523 -25 -3 C-16.45879825 -5.63617338 -7.68066485 -4.42052653 0 0 Z M-27 6 C-29.18038095 9.27057143 -29.63246755 10.20519469 -29 14 C-26.09313654 17.5712894 -23.48045429 19.85383727 -19 21 C-12.54992125 21.62420117 -9.30657968 20.71460578 -4 17 C-1.67250655 13.50875983 -1.49700684 12.10777749 -2 8 C-4.85937632 4.32365902 -7.95419825 2.26576881 -12.5859375 1.6640625 C-18.57882342 1.58012852 -22.33404282 1.81260253 -27 6 Z ",fill:"#000000",transform:"translate(311,88)"}),w.jsx("path",{d:"M0 0 C0.6909375 -0.01611328 1.381875 -0.03222656 2.09375 -0.04882812 C7.8726238 -0.0542594 12.82997188 1.04860273 17.1875 5.125 C18.67743192 8.1925069 18.86892084 9.94281988 18.25 13.3125 C16.40899583 15.35628144 14.51953464 16.70491296 12.25 18.3125 C13.91751148 22.25389078 16.47710649 25.1017812 19.25 28.3125 C15.17925308 29.28947926 13.00740362 29.6834732 9.1875 27.8125 C2.30102224 21.95166786 2.30102224 21.95166786 0.25 18.3125 C0.3359375 16.203125 0.3359375 16.203125 1.25 14.3125 C3.09765625 13.265625 3.09765625 13.265625 5.3125 12.5625 C6.04597656 12.32015625 6.77945312 12.0778125 7.53515625 11.828125 C8.10105469 11.65796875 8.66695313 11.4878125 9.25 11.3125 C8.92 9.9925 8.59 8.6725 8.25 7.3125 C2.31 6.3225 2.31 6.3225 -3.75 5.3125 C-3.75 13.2325 -3.75 21.1525 -3.75 29.3125 C-6.06 29.3125 -8.37 29.3125 -10.75 29.3125 C-10.83674429 24.85428834 -10.89030513 20.39629196 -10.9375 15.9375 C-10.96263672 14.66648437 -10.98777344 13.39546875 -11.01367188 12.0859375 C-11.02333984 10.87421875 -11.03300781 9.6625 -11.04296875 8.4140625 C-11.0586792 7.29338379 -11.07438965 6.17270508 -11.09057617 5.01806641 C-10.97818604 4.12522949 -10.8657959 3.23239258 -10.75 2.3125 C-7.07491251 -0.13755833 -4.2514806 -0.01939544 0 0 Z ",fill:"#000000",transform:"translate(458.75,84.6875)"}),w.jsx("path",{d:"M0 0 C2.5 1.5 2.5 1.5 4 3 C4 3.99 4 4.98 4 6 C1.375 7.25 1.375 7.25 -2 8 C-2.886875 7.38125 -3.77375 6.7625 -4.6875 6.125 C-9.41460662 3.09251651 -13.52508753 3.21206749 -19 4 C-22.68675314 5.31580851 -22.68675314 5.31580851 -25 8 C-26.41349769 11.39418221 -26.41349769 11.39418221 -26 15 C-23.11275174 18.68926166 -20.78773141 20.65853089 -16.0546875 21.23828125 C-10.52765905 21.42647756 -6.93873059 20.27951089 -2.01953125 17.82421875 C0.61510436 16.74896127 2.36965329 16.98180127 5 18 C3.26998534 21.91133748 1.47039476 23.83534456 -2.18359375 26.015625 C-6.02594326 27.35858211 -9.57802728 27.48092891 -13.625 27.5 C-14.35340088 27.50612305 -15.08180176 27.51224609 -15.83227539 27.51855469 C-22.03499045 27.37448616 -26.15892899 25.67742025 -30.8125 21.4375 C-34.33762808 17.50950014 -34.41718313 14.68959105 -34.328125 9.5390625 C-33.93375058 6.48735567 -32.94068917 4.43152412 -30.734375 2.25 C-21.31180281 -4.54104302 -10.28373737 -4.87124402 0 0 Z ",fill:"#000000",transform:"translate(437,87)"}),w.jsx("path",{d:"M0 0 C1.98 0 3.96 0 6 0 C7 1 7 1 7.09765625 3.28515625 C7.06510417 5.85677083 7.03255208 8.42838542 7 11 C12.28 11 17.56 11 23 11 C23 7.37 23 3.74 23 0 C24.65 0 26.3 0 28 0 C30 2 30 2 30.22705078 4.70556641 C30.21657715 5.82624512 30.20610352 6.94692383 30.1953125 8.1015625 C30.18886719 9.31328125 30.18242187 10.525 30.17578125 11.7734375 C30.15902344 13.04445313 30.14226562 14.31546875 30.125 15.625 C30.11597656 16.90375 30.10695313 18.1825 30.09765625 19.5 C30.07402303 22.66685167 30.04107629 25.83333424 30 29 C27.69 29 25.38 29 23 29 C23 25.04 23 21.08 23 17 C17.72 17 12.44 17 7 17 C7 20.96 7 24.92 7 29 C4.69 29 2.38 29 0 29 C0 19.43 0 9.86 0 0 Z ",fill:"#000000",transform:"translate(238,85)"}),w.jsx("path",{d:"M0 0 C3.38597563 1.48741072 5.09205483 4.34933902 7.1875 7.2734375 C8.03886082 8.4382539 8.89297928 9.60106033 9.75 10.76171875 C10.15734375 11.31424316 10.5646875 11.86676758 10.984375 12.43603516 C12.29381236 14.15910658 12.29381236 14.15910658 14.5 16.25390625 C16.1875 17.9609375 16.1875 17.9609375 16.1875 19.9609375 C9.10015849 22.34584139 2.55728651 24.09499438 -4.8125 21.9609375 C-7.9375 19.8984375 -7.9375 19.8984375 -9.8125 16.9609375 C-10.5144661 12.04717481 -10.37907507 10.03338318 -8.0625 5.6484375 C-3.27449291 -0.07057097 -3.27449291 -0.07057097 0 0 Z ",fill:"#E82E36",transform:"translate(66.8125,72.0390625)"}),w.jsx("path",{d:"M0 0 C2.5970079 2.46689728 4.81701861 5.16470761 7 8 C10.24759446 6.60005228 12.11620667 4.9554506 14.4375 2.3125 C16.2578125 0.42578125 16.2578125 0.42578125 18 -1 C21.01632404 -1 22.35717988 -0.32141006 25 1 C23.46731146 4.86237511 21.06053569 6.77280912 17.9375 9.4375 C13.6632086 13.55188985 12.28263101 16.19170412 11.875 22.125 C11.87047628 24.08377132 11.8957617 26.04399899 12 28 C9.36 28 6.72 28 4 28 C4.04833984 26.76636719 4.04833984 26.76636719 4.09765625 25.5078125 C4.02603608 18.6163604 3.38119381 14.61213991 -1.4375 9.5 C-2.24058594 8.7471875 -3.04367187 7.994375 -3.87109375 7.21875 C-6.1013069 4.89441776 -7.02068556 3.03962077 -8 0 C-4.86183337 -1.56908332 -3.33903504 -1.07101124 0 0 Z ",fill:"#000000",transform:"translate(377,86)"}),w.jsx("path",{d:"M0 0 C1.20029908 2.40059817 1.11459743 3.89360649 1.09765625 6.5703125 C1.09443359 7.46621094 1.09121094 8.36210938 1.08789062 9.28515625 C1.07951172 10.22230469 1.07113281 11.15945312 1.0625 12.125 C1.05798828 13.06988281 1.05347656 14.01476562 1.04882812 14.98828125 C1.03702375 17.3255477 1.01908799 19.66278169 1 22 C5.62 22 10.24 22 15 22 C15 23.98 15 25.96 15 28 C7.74 28 0.48 28 -7 28 C-7 18.76 -7 9.52 -7 0 C-4.30234372 -1.34882814 -2.84835666 -0.80338265 0 0 Z ",fill:"#000000",transform:"translate(358,86)"}),w.jsx("path",{d:"M0 0 C3.25696479 0.41755959 4.63443291 0.63443291 7 3 C7.22705078 5.06298828 7.22705078 5.06298828 7.1953125 7.5703125 C7.18564453 8.91416016 7.18564453 8.91416016 7.17578125 10.28515625 C7.15902344 11.22230469 7.14226562 12.15945312 7.125 13.125 C7.11597656 14.06988281 7.10695313 15.01476562 7.09765625 15.98828125 C7.07404668 18.32562827 7.03817494 20.66284549 7 23 C11.29 23 15.58 23 20 23 C20 24.98 20 26.96 20 29 C13.07 29 6.14 29 -1 29 C-1.02291487 25.0306345 -1.04284015 21.0614368 -1.05493164 17.09204102 C-1.05997057 15.74079614 -1.06680177 14.38955674 -1.07543945 13.03833008 C-1.08752419 11.09979566 -1.09269828 9.161222 -1.09765625 7.22265625 C-1.10289307 6.05484619 -1.10812988 4.88703613 -1.11352539 3.68383789 C-1 1 -1 1 0 0 Z ",fill:"#000000",transform:"translate(324,85)"}),w.jsx("path",{d:"M0 0 C2 2 2 2 2.375 5.25 C1.92859154 9.71408464 0.8794023 11.59018148 -2 15 C-7.26315789 19 -7.26315789 19 -10 19 C-11.54509605 14.36471184 -11.62122958 9.83570756 -11 5 C-7.94002351 0.41003527 -5.4735156 -0.85143576 0 0 Z ",fill:"#E82F38",transform:"translate(87,14)"}),w.jsx("path",{d:"M0 0 C0.67289063 0.4434375 1.34578125 0.886875 2.0390625 1.34375 C2.72742188 1.7871875 3.41578125 2.230625 4.125 2.6875 C4.63289063 3.0690625 5.14078125 3.450625 5.6640625 3.84375 C5.6640625 4.17375 5.6640625 4.50375 5.6640625 4.84375 C-4.2359375 4.84375 -14.1359375 4.84375 -24.3359375 4.84375 C-22.94695269 2.06578039 -21.02546942 1.81619399 -18.20898438 0.84179688 C-17.52900391 0.61556641 -16.84902344 0.38933594 -16.1484375 0.15625 C-15.1574707 -0.20049805 -15.1574707 -0.20049805 -14.14648438 -0.56445312 C-8.81538957 -2.35902699 -5.05843559 -2.50384103 0 0 Z ",fill:"#EB474F",transform:"translate(112.3359375,111.15625)"})]})}function iK(t){if(typeof window>"u")return t;try{return new URL(t,window.location.origin).toString()}catch{return t}}function sK(t){return t.client?w.jsx(aK,{...t,client:t.client}):w.jsx("div",{className:"flex items-center justify-center h-full w-full",children:w.jsx(Gp,{})})}function aK(t){const{error:e,handleConnect:n,handleDisconnect:r,connectionUrl:i,settingsContent:a,titleText:l="WebSocket Playground",noThemeSwitch:c=!1,noLogo:u=!1,noSessionInfo:f=!1,noStatusInfo:h=!1,noUserAudio:m=!1,noUserVideo:g=!0,noScreenControl:y=!1,noTextInput:S=!1,noBotAudio:x=!0,noBotVideo:C=!0,noConversation:A=!1,noMetrics:R=!1,collapseInfoPanel:j=!1,collapseMediaPanel:N=!1,assistantLabelText:O,userLabelText:B,systemLabelText:P,conversationElementProps:L,logoComponent:G}=t,[U,te]=k.useState(!1),[ce,be]=k.useState(!1),[ee,Q]=k.useState(""),[$,H]=k.useState("");xe(oe.ParticipantConnected,E=>{E.local&&Q(E.id||"")}),xe(oe.TrackStarted,(E,D)=>{D?.id&&D?.local&&Q(D.id)}),xe(oe.BotStarted,E=>{const D=E;D?.sessionId&&H(D.sessionId)});const{injectMessage:q}=v_();k.useEffect(()=>{t.onInjectMessage?.(q)},[t.onInjectMessage,q]);const Z=x&&C,fe=A&&R,F=h&&m&&g&&y&&f,X=i?iK(i):void 0,b=j?70:Z?50:37,M=j?4:Z?50:37;return w.jsx(k.Fragment,{children:w.jsxs("div",{className:"flex flex-col h-full w-full overflow-auto",children:[w.jsxs("div",{className:"h-min grid grid-cols-2 sm:grid-cols-[150px_1fr_150px] gap-2 items-center justify-center p-2 bg-background sm:relative top-0 w-full z-10",children:[u?w.jsx("span",{className:"h-6"}):G??w.jsx(rK,{}),w.jsx("strong",{className:"hidden sm:block text-center",children:l}),w.jsxs("div",{className:"flex items-center justify-end gap-2 sm:gap-3 xl:gap-6",children:[c?null:w.jsx(l7,{}),w.jsxs(h_,{children:[w.jsx(p_,{asChild:!0,children:w.jsx("span",{children:w.jsx(i_,{onConnect:()=>void n?.(),onDisconnect:()=>void r?.()})})}),X?w.jsx(m_,{align:"end",side:"bottom",children:X}):null]})]})]}),e?w.jsxs(HO,{variant:"destructive",className:"h-min animate-in fade-in duration-300",children:[w.jsx(qO,{icon:YX}),w.jsx(GO,{children:"Unable to connect. Please check web console for errors."}),w.jsx(WO,{variant:"destructive"})]}):null,w.jsx("div",{className:"hidden sm:block h-full",children:w.jsxs(Wh,{direction:"vertical",className:"h-full",children:[w.jsx(oi,{defaultSize:70,minSize:50,children:w.jsxs(Wh,{direction:"horizontal",children:[Z?null:w.jsxs(k.Fragment,{children:[w.jsxs(oi,{className:"flex flex-col gap-2 p-2 xl:gap-4",defaultSize:N?8:26,maxSize:30,minSize:10,collapsible:!0,collapsedSize:8,onCollapse:()=>te(!0),onExpand:()=>te(!1),children:[x?null:w.jsx(Kh,{className:ue({"mb-auto":C}),collapsed:U}),C?null:w.jsx(Jh,{className:ue({"mt-auto":x}),collapsed:U})]}),!fe||!F?w.jsx(ll,{withHandle:!0}):null]}),fe?null:w.jsxs(k.Fragment,{children:[w.jsx(oi,{className:"h-full p-2",defaultSize:b,minSize:30,children:w.jsx(Ey,{noConversation:A,noMetrics:R,noTextInput:S,conversationElementProps:{...L,assistantLabel:O,clientLabel:B,systemLabel:P}})}),F?null:w.jsx(ll,{withHandle:!0})]}),F?null:w.jsx(oi,{id:"info-panel",collapsible:!0,collapsedSize:4,defaultSize:M,minSize:15,className:"p-2",children:w.jsxs(Yh,{defaultValue:"info",className:"h-full flex flex-col gap-1",children:[w.jsxs(Xh,{className:"w-full shrink-0",children:[w.jsxs(Kn,{value:"info",className:"flex-1",children:[w.jsx(tM,{className:"w-3.5 h-3.5 mr-1"}),"Info"]}),w.jsxs(Kn,{value:"settings",className:"flex-1",children:[w.jsx(nM,{className:"w-3.5 h-3.5 mr-1"}),"Settings"]})]}),w.jsx(Jn,{value:"info",className:"flex-1 overflow-auto mt-0",children:w.jsx(Zh,{noSessionInfo:f,noStatusInfo:h,noUserAudio:m,noUserVideo:g,noScreenControl:y,participantId:ee,sessionId:$})}),w.jsx(Jn,{value:"settings",className:"flex-1 overflow-auto mt-0",children:a})]})})]})}),w.jsx(ll,{withHandle:!0}),w.jsx(oi,{collapsible:!0,collapsedSize:4,minSize:7,onCollapse:()=>be(!0),onExpand:()=>be(!1),children:w.jsx(iM,{collapsed:ce})})]})}),w.jsxs(Yh,{defaultValue:Z?fe?"info":"conversation":"bot",className:"flex flex-col gap-0 h-full sm:hidden overflow-hidden",children:[w.jsxs("div",{className:"flex flex-col overflow-hidden flex-1",children:[Z?null:w.jsxs(Jn,{value:"bot",className:"flex-1 overflow-auto flex flex-col gap-4 p-2",children:[x?null:w.jsx(Kh,{}),C?null:w.jsx(Jh,{})]}),fe?null:w.jsx(Jn,{value:"conversation",className:"flex-1 overflow-auto",children:w.jsx(Ey,{noConversation:A,noMetrics:R,noTextInput:S,conversationElementProps:{...L,assistantLabel:O,clientLabel:B,systemLabel:P}})}),w.jsx(Jn,{value:"info",className:"flex-1 overflow-auto p-2",children:w.jsx(Zh,{noUserAudio:m,noUserVideo:g,noScreenControl:y,participantId:ee,sessionId:$})}),w.jsx(Jn,{value:"events",className:"flex-1 overflow-auto",children:w.jsx(iM,{})}),a?w.jsx(Jn,{value:"settings",className:"flex-1 overflow-auto",children:a}):null]}),w.jsxs(Xh,{className:"w-full h-12 rounded-none z-10 mt-auto shrink-0",children:[Z?null:w.jsx(Kn,{value:"bot",children:w.jsx(HX,{})}),fe?null:w.jsx(Kn,{value:"conversation",children:w.jsx(JX,{})}),w.jsx(Kn,{value:"info",children:w.jsx(tM,{})}),w.jsx(Kn,{value:"events",children:w.jsx(GX,{})}),a?w.jsx(Kn,{value:"settings",children:w.jsx(nM,{})}):null]})]})]})})}const Kf={vueJs:"https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.min.js",elUiJs:"https://cdn.jsdelivr.net/npm/element-ui@2.15.14/lib/index.js",elUiCss:"https://cdn.jsdelivr.net/npm/element-ui@2.15.14/lib/theme-chalk/index.css",vjsfJs:"https://cdn.jsdelivr.net/npm/@lljj/vue-json-schema-form@1.19.0/dist/vueJsonSchemaForm.umd.min.js"};let Jf=null;function oK(t){if(document.querySelector(`link[data-vue-island="${t}"]`))return;const e=document.createElement("link");e.rel="stylesheet",e.href=t,e.setAttribute("data-vue-island",t),document.head.appendChild(e)}function fb(t){return new Promise((e,n)=>{const r=document.querySelector(`script[data-vue-island="${t}"]`);if(r){if(r.dataset.loaded==="true"){e();return}r.addEventListener("load",()=>e()),r.addEventListener("error",()=>n(new Error(`Failed to load ${t}`)));return}const i=document.createElement("script");i.src=t,i.async=!1,i.setAttribute("data-vue-island",t),i.addEventListener("load",()=>{i.dataset.loaded="true",e()}),i.addEventListener("error",()=>n(new Error(`Failed to load ${t}`))),document.head.appendChild(i)})}function lK(){return Jf||(Jf=(async()=>{if(oK(Kf.elUiCss),await fb(Kf.vueJs),await fb(Kf.elUiJs),await fb(Kf.vjsfJs),!window.Vue||!window.ELEMENT||!window.vueJsonSchemaForm)throw new Error("Vue / ElementUI / vueJsonSchemaForm failed to load");window.Vue._elementInstalled||(window.Vue.use(window.ELEMENT),window.Vue._elementInstalled=!0)})(),Jf)}const cK=["account_id","agent_id"];function hh(t,e){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(r=>hh(r,e));const n={};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&!(r==="ui:widget"&&t[r]==="HiddenWidget"&&cK.indexOf(e)!==-1))if(r==="properties"){const i={};for(const a in t[r])Object.prototype.hasOwnProperty.call(t[r],a)&&(i[a]=hh(t[r][a],a));n[r]=i}else n[r]=hh(t[r],e);return n}function sM(t){try{return JSON.parse(t)}catch{return null}}function uK({endpoint:t,onEndpointChange:e,settingsJson:n,onSettingsChange:r,jsonError:i,schemaUrl:a="/bot/settings/_schema",defaultsUrl:l="/client/_settings"}){const c=k.useRef(null),u=k.useRef(null),f=k.useRef({onSettingsChange:r}),h=k.useRef(null),m=k.useRef(null),[g,y]=k.useState("loading"),[S,x]=k.useState(null);k.useEffect(()=>{f.current.onSettingsChange=r},[r]),k.useEffect(()=>{let A=!1;return(async()=>{try{if(await lK(),A)return;const[R,j]=await Promise.all([fetch(a).then(te=>{if(!te.ok)throw new Error(`schema HTTP ${te.status}`);return te.json()}),fetch(l).then(te=>{if(!te.ok)throw new Error(`defaults HTTP ${te.status}`);return te.json()})]);if(A)return;if(!j||typeof j!="object")throw new Error("invalid defaults from server");const N=hh(R,""),O=JSON.stringify(j,null,2);m.current=O;let B=sM(n);if(B===null&&(B=j,h.current=O,f.current.onSettingsChange(O)),!c.current)return;const P=window.Vue,L=window.vueJsonSchemaForm.default,G=document.createElement("div");c.current.innerHTML="",c.current.appendChild(G);const U=new P({el:G,data:{formData:B,schema:N},render(te){return te(L,{props:{value:this.formData,schema:this.schema,formProps:{labelPosition:"right",labelWidth:"140px",labelSuffix:":"},formFooter:{show:!1}},on:{input:ce=>{this.formData=ce;const be=JSON.stringify(ce,null,2);h.current=be,f.current.onSettingsChange(be)}}})}});u.current=U,y("ready")}catch(R){if(A)return;x(R.message||String(R)),y("error")}})(),()=>{if(A=!0,u.current){try{u.current.$destroy()}catch{}u.current=null}c.current&&(c.current.innerHTML="")}},[a,l]),k.useEffect(()=>{const A=u.current;if(!A||h.current===n)return;const R=sM(n);R===null||typeof R!="object"||(h.current=n,A.formData=R)},[n]);const C=()=>{m.current&&r(m.current)};return w.jsxs("div",{className:"flex flex-col gap-3 p-2 h-full overflow-auto text-xs",children:[w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsx("label",{className:"font-medium text-muted-foreground uppercase tracking-wide",children:"Connect Endpoint"}),w.jsx("input",{type:"text",value:t,onChange:A=>e(A.target.value),className:"w-full font-mono border rounded px-2 py-1.5 bg-background text-foreground focus:outline-none focus:ring-1 focus:ring-ring",placeholder:new URL("/bot/connect",window.location.origin).href,spellCheck:!1})]}),w.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-h-0",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("label",{className:"font-medium text-muted-foreground uppercase tracking-wide",children:"Client Settings"}),w.jsxs("button",{type:"button",title:"Reset to defaults",onClick:C,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:[w.jsx(ZX,{className:"w-3 h-3"}),"Reset"]})]}),g==="loading"?w.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-muted-foreground min-h-[200px]",children:[w.jsx(Gp,{}),w.jsx("div",{children:"正在加载配置…"})]}):null,g==="error"?w.jsxs("div",{className:ue("flex-1 border rounded p-3 text-destructive bg-destructive/5","min-h-[100px]"),children:["加载设置失败:",S]}):null,w.jsx("div",{ref:c,className:ue("vue-island flex-1 min-h-0 overflow-auto",g!=="ready"&&"hidden")}),i?w.jsx("p",{className:"text-destructive leading-snug",children:i}):null]})]})}function u7(t){let e=typeof t;if(e=="object"){if(Array.isArray(t))return"array";if(t===null)return"null"}return e}function dK(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}let Hi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Wp=[];for(let t=0;t<Hi.length;t++)Wp[Hi[t].charCodeAt(0)]=t;Wp[45]=Hi.indexOf("+");Wp[95]=Hi.indexOf("/");function fK(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n=new Uint8Array(e),r=0,i=0,a,l=0;for(let c=0;c<t.length;c++){if(a=Wp[t.charCodeAt(c)],a===void 0)switch(t[c]){case"=":i=0;case`
|
|
98
98
|
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:l=a,i=1;break;case 1:n[r++]=l<<2|(a&48)>>4,l=a,i=2;break;case 2:n[r++]=(l&15)<<4|(a&60)>>2,l=a,i=3;break;case 3:n[r++]=(l&3)<<6|a,i=0;break}}if(i==1)throw Error("invalid base64 string.");return n.subarray(0,r)}function hK(t){let e="",n=0,r,i=0;for(let a=0;a<t.length;a++)switch(r=t[a],n){case 0:e+=Hi[r>>2],i=(r&3)<<4,n=1;break;case 1:e+=Hi[i|r>>4],i=(r&15)<<2,n=2;break;case 2:e+=Hi[i|r>>6],e+=Hi[r&63],n=0;break}return n&&(e+=Hi[i],e+="=",n==1&&(e+="=")),e}var zn;(function(t){t.symbol=Symbol.for("protobuf-ts/unknown"),t.onRead=(n,r,i,a,l)=>{(e(r)?r[t.symbol]:r[t.symbol]=[]).push({no:i,wireType:a,data:l})},t.onWrite=(n,r,i)=>{for(let{no:a,wireType:l,data:c}of t.list(r))i.tag(a,l).raw(c)},t.list=(n,r)=>{if(e(n)){let i=n[t.symbol];return r?i.filter(a=>a.no==r):i}return[]},t.last=(n,r)=>t.list(n,r).slice(-1)[0];const e=n=>n&&Array.isArray(n[t.symbol])})(zn||(zn={}));var Fe;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(Fe||(Fe={}));function pK(){let t=0,e=0;for(let r=0;r<28;r+=7){let i=this.buf[this.pos++];if(t|=(i&127)<<r,(i&128)==0)return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(n&15)<<28,e=(n&112)>>4,(n&128)==0)return this.assertBounds(),[t,e];for(let r=3;r<=31;r+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<r,(i&128)==0)return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function hb(t,e,n){for(let a=0;a<28;a=a+7){const l=t>>>a,c=!(!(l>>>7)&&e==0),u=(c?l|128:l)&255;if(n.push(u),!c)return}const r=t>>>28&15|(e&7)<<4,i=e>>3!=0;if(n.push((i?r|128:r)&255),!!i){for(let a=3;a<31;a=a+7){const l=e>>>a,c=!!(l>>>7),u=(c?l|128:l)&255;if(n.push(u),!c)return}n.push(e>>>31&1)}}const ph=65536*65536;function d7(t){let e=t[0]=="-";e&&(t=t.slice(1));const n=1e6;let r=0,i=0;function a(l,c){const u=Number(t.slice(l,c));i*=n,r=r*n+u,r>=ph&&(i=i+(r/ph|0),r=r%ph)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),[e,r,i]}function My(t,e){if(e>>>0<=2097151)return""+(ph*e+(t>>>0));let n=t&16777215,r=(t>>>24|e<<8)>>>0&16777215,i=e>>16&65535,a=n+r*6777216+i*6710656,l=r+i*8147497,c=i*2,u=1e7;a>=u&&(l+=Math.floor(a/u),a%=u),l>=u&&(c+=Math.floor(l/u),l%=u);function f(h,m){let g=h?String(h):"";return m?"0000000".slice(g.length)+g:g}return f(c,0)+f(l,c)+f(a,1)}function aM(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function mK(){let t=this.buf[this.pos++],e=t&127;if((t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,(t&128)==0)return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;(t&128)!==0&&n<10;n++)t=this.buf[this.pos++];if((t&128)!=0)throw new Error("invalid varint");return this.assertBounds(),e>>>0}let bt;function gK(){const t=new DataView(new ArrayBuffer(8));bt=globalThis.BigInt!==void 0&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:t}:void 0}gK();function f7(t){if(!t)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}const h7=/^-?[0-9]+$/,ep=4294967296,Qf=2147483648;class p7{constructor(e,n){this.lo=e|0,this.hi=n|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*ep+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class yn extends p7{static from(e){if(bt)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=bt.C(e);case"number":if(e===0)return this.ZERO;e=bt.C(e);case"bigint":if(!e)return this.ZERO;if(e<bt.UMIN)throw new Error("signed value for ulong");if(e>bt.UMAX)throw new Error("ulong too large");return bt.V.setBigUint64(0,e,!0),new yn(bt.V.getInt32(0,!0),bt.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!h7.test(e))throw new Error("string is no integer");let[n,r,i]=d7(e);if(n)throw new Error("signed value for ulong");return new yn(r,i);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new yn(e,e/ep)}throw new Error("unknown value "+typeof e)}toString(){return bt?this.toBigInt().toString():My(this.lo,this.hi)}toBigInt(){return f7(bt),bt.V.setInt32(0,this.lo,!0),bt.V.setInt32(4,this.hi,!0),bt.V.getBigUint64(0,!0)}}yn.ZERO=new yn(0,0);class Pt extends p7{static from(e){if(bt)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=bt.C(e);case"number":if(e===0)return this.ZERO;e=bt.C(e);case"bigint":if(!e)return this.ZERO;if(e<bt.MIN)throw new Error("signed long too small");if(e>bt.MAX)throw new Error("signed long too large");return bt.V.setBigInt64(0,e,!0),new Pt(bt.V.getInt32(0,!0),bt.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!h7.test(e))throw new Error("string is no integer");let[n,r,i]=d7(e);if(n){if(i>Qf||i==Qf&&r!=0)throw new Error("signed long too small")}else if(i>=Qf)throw new Error("signed long too large");let a=new Pt(r,i);return n?a.negate():a;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new Pt(e,e/ep):new Pt(-e,-e/ep).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&Qf)!==0}negate(){let e=~this.hi,n=this.lo;return n?n=~n+1:e+=1,new Pt(n,e)}toString(){if(bt)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+My(e.lo,e.hi)}return My(this.lo,this.hi)}toBigInt(){return f7(bt),bt.V.setInt32(0,this.lo,!0),bt.V.setInt32(4,this.hi,!0),bt.V.getBigInt64(0,!0)}}Pt.ZERO=new Pt(0,0);const oM={readUnknownField:!0,readerFactory:t=>new bK(t)};function vK(t){return t?Object.assign(Object.assign({},oM),t):oM}class bK{constructor(e,n){this.varint64=pK,this.uint32=mK,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),n=e>>>3,r=e&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(e){let n=this.pos;switch(e){case Fe.Varint:for(;this.buf[this.pos++]&128;);break;case Fe.Bit64:this.pos+=4;case Fe.Bit32:this.pos+=4;break;case Fe.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Fe.StartGroup:let i;for(;(i=this.tag()[1])!==Fe.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new Pt(...this.varint64())}uint64(){return new yn(...this.varint64())}sint64(){let[e,n]=this.varint64(),r=-(e&1);return e=(e>>>1|(n&1)<<31)^r,n=n>>>1^r,new Pt(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new yn(this.sfixed32(),this.sfixed32())}sfixed64(){return new Pt(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function nt(t,e){if(!t)throw new Error(e)}const yK=34028234663852886e22,_K=-34028234663852886e22,xK=4294967295,wK=2147483647,SK=-2147483648;function lu(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>wK||t<SK)throw new Error("invalid int 32: "+t)}function tp(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>xK||t<0)throw new Error("invalid uint 32: "+t)}function x_(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>yK||t<_K))throw new Error("invalid float 32: "+t)}const lM={writeUnknownFields:!0,writerFactory:()=>new kK};function CK(t){return t?Object.assign(Object.assign({},lM),t):lM}class kK{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let n=new Uint8Array(e),r=0;for(let i=0;i<this.chunks.length;i++)n.set(this.chunks[i],r),r+=this.chunks[i].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(tp(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return lu(e),aM(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){x_(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){tp(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){lu(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return lu(e),e=(e<<1^e>>31)>>>0,aM(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),i=Pt.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),i=yn.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}int64(e){let n=Pt.from(e);return hb(n.lo,n.hi,this.buf),this}sint64(e){let n=Pt.from(e),r=n.hi>>31,i=n.lo<<1^r,a=(n.hi<<1|n.lo>>>31)^r;return hb(i,a,this.buf),this}uint64(e){let n=yn.from(e);return hb(n.lo,n.hi,this.buf),this}}const cM={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},uM={ignoreUnknownFields:!1};function EK(t){return t?Object.assign(Object.assign({},uM),t):uM}function MK(t){return t?Object.assign(Object.assign({},cM),t):cM}const m7=Symbol.for("protobuf-ts/message-type");function dM(t){let e=!1;const n=[];for(let r=0;r<t.length;r++){let i=t.charAt(r);i=="_"?e=!0:/\d/.test(i)?(n.push(i),e=!0):e?(n.push(i.toUpperCase()),e=!1):r==0?n.push(i.toLowerCase()):n.push(i)}return n.join("")}var me;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(me||(me={}));var di;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER"})(di||(di={}));var np;(function(t){t[t.NO=0]="NO",t[t.PACKED=1]="PACKED",t[t.UNPACKED=2]="UNPACKED"})(np||(np={}));function AK(t){var e,n,r,i;return t.localName=(e=t.localName)!==null&&e!==void 0?e:dM(t.name),t.jsonName=(n=t.jsonName)!==null&&n!==void 0?n:dM(t.name),t.repeat=(r=t.repeat)!==null&&r!==void 0?r:np.NO,t.opt=(i=t.opt)!==null&&i!==void 0?i:t.repeat||t.oneof?!1:t.kind=="message",t}function TK(t){if(typeof t!="object"||t===null||!t.hasOwnProperty("oneofKind"))return!1;switch(typeof t.oneofKind){case"string":return t[t.oneofKind]===void 0?!1:Object.keys(t).length==2;case"undefined":return Object.keys(t).length==1;default:return!1}}class OK{constructor(e){var n;this.fields=(n=e.fields)!==null&&n!==void 0?n:[]}prepare(){if(this.data)return;const e=[],n=[],r=[];for(let i of this.fields)if(i.oneof)r.includes(i.oneof)||(r.push(i.oneof),e.push(i.oneof),n.push(i.oneof));else switch(n.push(i.localName),i.kind){case"scalar":case"enum":(!i.opt||i.repeat)&&e.push(i.localName);break;case"message":i.repeat&&e.push(i.localName);break;case"map":e.push(i.localName);break}this.data={req:e,known:n,oneofs:Object.values(r)}}is(e,n,r=!1){if(n<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let i=Object.keys(e),a=this.data;if(i.length<a.req.length||a.req.some(l=>!i.includes(l))||!r&&i.some(l=>!a.known.includes(l)))return!1;if(n<1)return!0;for(const l of a.oneofs){const c=e[l];if(!TK(c))return!1;if(c.oneofKind===void 0)continue;const u=this.fields.find(f=>f.localName===c.oneofKind);if(!u||!this.field(c[c.oneofKind],u,r,n))return!1}for(const l of this.fields)if(l.oneof===void 0&&!this.field(e[l.localName],l,r,n))return!1;return!0}field(e,n,r,i){let a=n.repeat;switch(n.kind){case"scalar":return e===void 0?n.opt:a?this.scalars(e,n.T,i,n.L):this.scalar(e,n.T,n.L);case"enum":return e===void 0?n.opt:a?this.scalars(e,me.INT32,i):this.scalar(e,me.INT32);case"message":return e===void 0?!0:a?this.messages(e,n.T(),r,i):this.message(e,n.T(),r,i);case"map":if(typeof e!="object"||e===null)return!1;if(i<2)return!0;if(!this.mapKeys(e,n.K,i))return!1;switch(n.V.kind){case"scalar":return this.scalars(Object.values(e),n.V.T,i,n.V.L);case"enum":return this.scalars(Object.values(e),me.INT32,i);case"message":return this.messages(Object.values(e),n.V.T(),r,i)}break}return!0}message(e,n,r,i){return r?n.isAssignable(e,i):n.is(e,i)}messages(e,n,r,i){if(!Array.isArray(e))return!1;if(i<2)return!0;if(r){for(let a=0;a<e.length&&a<i;a++)if(!n.isAssignable(e[a],i-1))return!1}else for(let a=0;a<e.length&&a<i;a++)if(!n.is(e[a],i-1))return!1;return!0}scalar(e,n,r){let i=typeof e;switch(n){case me.UINT64:case me.FIXED64:case me.INT64:case me.SFIXED64:case me.SINT64:switch(r){case di.BIGINT:return i=="bigint";case di.NUMBER:return i=="number"&&!isNaN(e);default:return i=="string"}case me.BOOL:return i=="boolean";case me.STRING:return i=="string";case me.BYTES:return e instanceof Uint8Array;case me.DOUBLE:case me.FLOAT:return i=="number"&&!isNaN(e);default:return i=="number"&&Number.isInteger(e)}}scalars(e,n,r,i){if(!Array.isArray(e))return!1;if(r<2)return!0;if(Array.isArray(e)){for(let a=0;a<e.length&&a<r;a++)if(!this.scalar(e[a],n,i))return!1}return!0}mapKeys(e,n,r){let i=Object.keys(e);switch(n){case me.INT32:case me.FIXED32:case me.SFIXED32:case me.SINT32:case me.UINT32:return this.scalars(i.slice(0,r).map(a=>parseInt(a)),n,r);case me.BOOL:return this.scalars(i.slice(0,r).map(a=>a=="true"?!0:a=="false"?!1:a),n,r);default:return this.scalars(i,n,r,di.STRING)}}}function jr(t,e){switch(e){case di.BIGINT:return t.toBigInt();case di.NUMBER:return t.toNumber();default:return t.toString()}}class RK{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};const n=(e=this.info.fields)!==null&&e!==void 0?e:[];for(const r of n)this.fMap[r.name]=r,this.fMap[r.jsonName]=r,this.fMap[r.localName]=r}}assert(e,n,r){if(!e){let i=u7(r);throw(i=="number"||i=="boolean")&&(i=r.toString()),new Error(`Cannot parse JSON ${i} for ${this.info.typeName}#${n}`)}}read(e,n,r){this.prepare();const i=[];for(const[a,l]of Object.entries(e)){const c=this.fMap[a];if(!c){if(!r.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${a}`);continue}const u=c.localName;let f;if(c.oneof){if(l===null&&(c.kind!=="enum"||c.T()[0]!=="google.protobuf.NullValue"))continue;if(i.includes(c.oneof))throw new Error(`Multiple members of the oneof group "${c.oneof}" of ${this.info.typeName} are present in JSON.`);i.push(c.oneof),f=n[c.oneof]={oneofKind:u}}else f=n;if(c.kind=="map"){if(l===null)continue;this.assert(dK(l),c.name,l);const h=f[u];for(const[m,g]of Object.entries(l)){this.assert(g!==null,c.name+" map value",null);let y;switch(c.V.kind){case"message":y=c.V.T().internalJsonRead(g,r);break;case"enum":if(y=this.enum(c.V.T(),g,c.name,r.ignoreUnknownFields),y===!1)continue;break;case"scalar":y=this.scalar(g,c.V.T,c.V.L,c.name);break}this.assert(y!==void 0,c.name+" map value",g);let S=m;c.K==me.BOOL&&(S=S=="true"?!0:S=="false"?!1:S),S=this.scalar(S,c.K,di.STRING,c.name).toString(),h[S]=y}}else if(c.repeat){if(l===null)continue;this.assert(Array.isArray(l),c.name,l);const h=f[u];for(const m of l){this.assert(m!==null,c.name,null);let g;switch(c.kind){case"message":g=c.T().internalJsonRead(m,r);break;case"enum":if(g=this.enum(c.T(),m,c.name,r.ignoreUnknownFields),g===!1)continue;break;case"scalar":g=this.scalar(m,c.T,c.L,c.name);break}this.assert(g!==void 0,c.name,l),h.push(g)}}else switch(c.kind){case"message":if(l===null&&c.T().typeName!="google.protobuf.Value"){this.assert(c.oneof===void 0,c.name+" (oneof member)",null);continue}f[u]=c.T().internalJsonRead(l,r,f[u]);break;case"enum":if(l===null)continue;let h=this.enum(c.T(),l,c.name,r.ignoreUnknownFields);if(h===!1)continue;f[u]=h;break;case"scalar":if(l===null)continue;f[u]=this.scalar(l,c.T,c.L,c.name);break}}}enum(e,n,r,i){if(e[0]=="google.protobuf.NullValue"&&nt(n===null||n==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} only accepts null.`),n===null)return 0;switch(typeof n){case"number":return nt(Number.isInteger(n),`Unable to parse field ${this.info.typeName}#${r}, enum can only be integral number, got ${n}.`),n;case"string":let a=n;e[2]&&n.substring(0,e[2].length)===e[2]&&(a=n.substring(e[2].length));let l=e[1][a];return typeof l>"u"&&i?!1:(nt(typeof l=="number",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} has no value for "${n}".`),l)}nt(!1,`Unable to parse field ${this.info.typeName}#${r}, cannot parse enum value from ${typeof n}".`)}scalar(e,n,r,i){let a;try{switch(n){case me.DOUBLE:case me.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){a="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){a="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let l=Number(e);if(Number.isNaN(l)){a="not a number";break}if(!Number.isFinite(l)){a="too large or small";break}return n==me.FLOAT&&x_(l),l;case me.INT32:case me.FIXED32:case me.SFIXED32:case me.SINT32:case me.UINT32:if(e===null)return 0;let c;if(typeof e=="number"?c=e:e===""?a="empty string":typeof e=="string"&&(e.trim().length!==e.length?a="extra whitespace":c=Number(e)),c===void 0)break;return n==me.UINT32?tp(c):lu(c),c;case me.INT64:case me.SFIXED64:case me.SINT64:if(e===null)return jr(Pt.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return jr(Pt.from(e),r);case me.FIXED64:case me.UINT64:if(e===null)return jr(yn.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return jr(yn.from(e),r);case me.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case me.STRING:if(e===null)return"";if(typeof e!="string"){a="extra whitespace";break}try{encodeURIComponent(e)}catch(u){u="invalid UTF8";break}return e;case me.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return fK(e)}}catch(l){a=l.message}this.assert(!1,i+(a?" - "+a:""),e)}}class NK{constructor(e){var n;this.fields=(n=e.fields)!==null&&n!==void 0?n:[]}write(e,n){const r={},i=e;for(const a of this.fields){if(!a.oneof){let f=this.field(a,i[a.localName],n);f!==void 0&&(r[n.useProtoFieldName?a.name:a.jsonName]=f);continue}const l=i[a.oneof];if(l.oneofKind!==a.localName)continue;const c=a.kind=="scalar"||a.kind=="enum"?Object.assign(Object.assign({},n),{emitDefaultValues:!0}):n;let u=this.field(a,l[a.localName],c);nt(u!==void 0),r[n.useProtoFieldName?a.name:a.jsonName]=u}return r}field(e,n,r){let i;if(e.kind=="map"){nt(typeof n=="object"&&n!==null);const a={};switch(e.V.kind){case"scalar":for(const[u,f]of Object.entries(n)){const h=this.scalar(e.V.T,f,e.name,!1,!0);nt(h!==void 0),a[u.toString()]=h}break;case"message":const l=e.V.T();for(const[u,f]of Object.entries(n)){const h=this.message(l,f,e.name,r);nt(h!==void 0),a[u.toString()]=h}break;case"enum":const c=e.V.T();for(const[u,f]of Object.entries(n)){nt(f===void 0||typeof f=="number");const h=this.enum(c,f,e.name,!1,!0,r.enumAsInteger);nt(h!==void 0),a[u.toString()]=h}break}(r.emitDefaultValues||Object.keys(a).length>0)&&(i=a)}else if(e.repeat){nt(Array.isArray(n));const a=[];switch(e.kind){case"scalar":for(let u=0;u<n.length;u++){const f=this.scalar(e.T,n[u],e.name,e.opt,!0);nt(f!==void 0),a.push(f)}break;case"enum":const l=e.T();for(let u=0;u<n.length;u++){nt(n[u]===void 0||typeof n[u]=="number");const f=this.enum(l,n[u],e.name,e.opt,!0,r.enumAsInteger);nt(f!==void 0),a.push(f)}break;case"message":const c=e.T();for(let u=0;u<n.length;u++){const f=this.message(c,n[u],e.name,r);nt(f!==void 0),a.push(f)}break}(r.emitDefaultValues||a.length>0||r.emitDefaultValues)&&(i=a)}else switch(e.kind){case"scalar":i=this.scalar(e.T,n,e.name,e.opt,r.emitDefaultValues);break;case"enum":i=this.enum(e.T(),n,e.name,e.opt,r.emitDefaultValues,r.enumAsInteger);break;case"message":i=this.message(e.T(),n,e.name,r);break}return i}enum(e,n,r,i,a,l){if(e[0]=="google.protobuf.NullValue")return!a&&!i?void 0:null;if(n===void 0){nt(i);return}if(!(n===0&&!a&&!i))return nt(typeof n=="number"),nt(Number.isInteger(n)),l||!e[1].hasOwnProperty(n)?n:e[2]?e[2]+e[1][n]:e[1][n]}message(e,n,r,i){return n===void 0?i.emitDefaultValues?null:void 0:e.internalJsonWrite(n,i)}scalar(e,n,r,i,a){if(n===void 0){nt(i);return}const l=a||i;switch(e){case me.INT32:case me.SFIXED32:case me.SINT32:return n===0?l?0:void 0:(lu(n),n);case me.FIXED32:case me.UINT32:return n===0?l?0:void 0:(tp(n),n);case me.FLOAT:x_(n);case me.DOUBLE:return n===0?l?0:void 0:(nt(typeof n=="number"),Number.isNaN(n)?"NaN":n===Number.POSITIVE_INFINITY?"Infinity":n===Number.NEGATIVE_INFINITY?"-Infinity":n);case me.STRING:return n===""?l?"":void 0:(nt(typeof n=="string"),n);case me.BOOL:return n===!1?l?!1:void 0:(nt(typeof n=="boolean"),n);case me.UINT64:case me.FIXED64:nt(typeof n=="number"||typeof n=="string"||typeof n=="bigint");let c=yn.from(n);return c.isZero()&&!l?void 0:c.toString();case me.INT64:case me.SFIXED64:case me.SINT64:nt(typeof n=="number"||typeof n=="string"||typeof n=="bigint");let u=Pt.from(n);return u.isZero()&&!l?void 0:u.toString();case me.BYTES:return nt(n instanceof Uint8Array),n.byteLength?hK(n):l?"":void 0}}}function Ay(t,e=di.STRING){switch(t){case me.BOOL:return!1;case me.UINT64:case me.FIXED64:return jr(yn.ZERO,e);case me.INT64:case me.SFIXED64:case me.SINT64:return jr(Pt.ZERO,e);case me.DOUBLE:case me.FLOAT:return 0;case me.BYTES:return new Uint8Array(0);case me.STRING:return"";default:return 0}}class DK{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){const n=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(n.map(r=>[r.no,r]))}}read(e,n,r,i){this.prepare();const a=i===void 0?e.len:e.pos+i;for(;e.pos<a;){const[l,c]=e.tag(),u=this.fieldNoToField.get(l);if(!u){let g=r.readUnknownField;if(g=="throw")throw new Error(`Unknown field ${l} (wire type ${c}) for ${this.info.typeName}`);let y=e.skip(c);g!==!1&&(g===!0?zn.onRead:g)(this.info.typeName,n,l,c,y);continue}let f=n,h=u.repeat,m=u.localName;switch(u.oneof&&(f=f[u.oneof],f.oneofKind!==m&&(f=n[u.oneof]={oneofKind:m})),u.kind){case"scalar":case"enum":let g=u.kind=="enum"?me.INT32:u.T,y=u.kind=="scalar"?u.L:void 0;if(h){let C=f[m];if(c==Fe.LengthDelimited&&g!=me.STRING&&g!=me.BYTES){let A=e.uint32()+e.pos;for(;e.pos<A;)C.push(this.scalar(e,g,y))}else C.push(this.scalar(e,g,y))}else f[m]=this.scalar(e,g,y);break;case"message":if(h){let C=f[m],A=u.T().internalBinaryRead(e,e.uint32(),r);C.push(A)}else f[m]=u.T().internalBinaryRead(e,e.uint32(),r,f[m]);break;case"map":let[S,x]=this.mapEntry(u,e,r);f[m][S]=x;break}}}mapEntry(e,n,r){let i=n.uint32(),a=n.pos+i,l,c;for(;n.pos<a;){let[u,f]=n.tag();switch(u){case 1:e.K==me.BOOL?l=n.bool().toString():l=this.scalar(n,e.K,di.STRING);break;case 2:switch(e.V.kind){case"scalar":c=this.scalar(n,e.V.T,e.V.L);break;case"enum":c=n.int32();break;case"message":c=e.V.T().internalBinaryRead(n,n.uint32(),r);break}break;default:throw new Error(`Unknown field ${u} (wire type ${f}) in map entry for ${this.info.typeName}#${e.name}`)}}if(l===void 0){let u=Ay(e.K);l=e.K==me.BOOL?u.toString():u}if(c===void 0)switch(e.V.kind){case"scalar":c=Ay(e.V.T,e.V.L);break;case"enum":c=0;break;case"message":c=e.V.T().create();break}return[l,c]}scalar(e,n,r){switch(n){case me.INT32:return e.int32();case me.STRING:return e.string();case me.BOOL:return e.bool();case me.DOUBLE:return e.double();case me.FLOAT:return e.float();case me.INT64:return jr(e.int64(),r);case me.UINT64:return jr(e.uint64(),r);case me.FIXED64:return jr(e.fixed64(),r);case me.FIXED32:return e.fixed32();case me.BYTES:return e.bytes();case me.UINT32:return e.uint32();case me.SFIXED32:return e.sfixed32();case me.SFIXED64:return jr(e.sfixed64(),r);case me.SINT32:return e.sint32();case me.SINT64:return jr(e.sint64(),r)}}}class jK{constructor(e){this.info=e}prepare(){if(!this.fields){const e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((n,r)=>n.no-r.no)}}write(e,n,r){this.prepare();for(const a of this.fields){let l,c,u=a.repeat,f=a.localName;if(a.oneof){const h=e[a.oneof];if(h.oneofKind!==f)continue;l=h[f],c=!0}else l=e[f],c=!1;switch(a.kind){case"scalar":case"enum":let h=a.kind=="enum"?me.INT32:a.T;if(u)if(nt(Array.isArray(l)),u==np.PACKED)this.packed(n,h,a.no,l);else for(const m of l)this.scalar(n,h,a.no,m,!0);else l===void 0?nt(a.opt):this.scalar(n,h,a.no,l,c||a.opt);break;case"message":if(u){nt(Array.isArray(l));for(const m of l)this.message(n,r,a.T(),a.no,m)}else this.message(n,r,a.T(),a.no,l);break;case"map":nt(typeof l=="object"&&l!==null);for(const[m,g]of Object.entries(l))this.mapEntry(n,r,a,m,g);break}}let i=r.writeUnknownFields;i!==!1&&(i===!0?zn.onWrite:i)(this.info.typeName,e,n)}mapEntry(e,n,r,i,a){e.tag(r.no,Fe.LengthDelimited),e.fork();let l=i;switch(r.K){case me.INT32:case me.FIXED32:case me.UINT32:case me.SFIXED32:case me.SINT32:l=Number.parseInt(i);break;case me.BOOL:nt(i=="true"||i=="false"),l=i=="true";break}switch(this.scalar(e,r.K,1,l,!0),r.V.kind){case"scalar":this.scalar(e,r.V.T,2,a,!0);break;case"enum":this.scalar(e,me.INT32,2,a,!0);break;case"message":this.message(e,n,r.V.T(),2,a);break}e.join()}message(e,n,r,i,a){a!==void 0&&(r.internalBinaryWrite(a,e.tag(i,Fe.LengthDelimited).fork(),n),e.join())}scalar(e,n,r,i,a){let[l,c,u]=this.scalarInfo(n,i);(!u||a)&&(e.tag(r,l),e[c](i))}packed(e,n,r,i){if(!i.length)return;nt(n!==me.BYTES&&n!==me.STRING),e.tag(r,Fe.LengthDelimited),e.fork();let[,a]=this.scalarInfo(n);for(let l=0;l<i.length;l++)e[a](i[l]);e.join()}scalarInfo(e,n){let r=Fe.Varint,i,a=n===void 0,l=n===0;switch(e){case me.INT32:i="int32";break;case me.STRING:l=a||!n.length,r=Fe.LengthDelimited,i="string";break;case me.BOOL:l=n===!1,i="bool";break;case me.UINT32:i="uint32";break;case me.DOUBLE:r=Fe.Bit64,i="double";break;case me.FLOAT:r=Fe.Bit32,i="float";break;case me.INT64:l=a||Pt.from(n).isZero(),i="int64";break;case me.UINT64:l=a||yn.from(n).isZero(),i="uint64";break;case me.FIXED64:l=a||yn.from(n).isZero(),r=Fe.Bit64,i="fixed64";break;case me.BYTES:l=a||!n.byteLength,r=Fe.LengthDelimited,i="bytes";break;case me.FIXED32:r=Fe.Bit32,i="fixed32";break;case me.SFIXED32:r=Fe.Bit32,i="sfixed32";break;case me.SFIXED64:l=a||Pt.from(n).isZero(),r=Fe.Bit64,i="sfixed64";break;case me.SINT32:i="sint32";break;case me.SINT64:l=a||Pt.from(n).isZero(),i="sint64";break}return[r,i,a||l]}}function LK(t){const e=t.messagePrototype?Object.create(t.messagePrototype):Object.defineProperty({},m7,{value:t});for(let n of t.fields){let r=n.localName;if(!n.opt)if(n.oneof)e[n.oneof]={oneofKind:void 0};else if(n.repeat)e[r]=[];else switch(n.kind){case"scalar":e[r]=Ay(n.T,n.L);break;case"enum":e[r]=0;break;case"map":e[r]={};break}}return e}function qs(t,e,n){let r,i=n,a;for(let l of t.fields){let c=l.localName;if(l.oneof){const u=i[l.oneof];if(u?.oneofKind==null)continue;if(r=u[c],a=e[l.oneof],a.oneofKind=u.oneofKind,r==null){delete a[c];continue}}else if(r=i[c],a=e,r==null)continue;switch(l.repeat&&(a[c].length=r.length),l.kind){case"scalar":case"enum":if(l.repeat)for(let f=0;f<r.length;f++)a[c][f]=r[f];else a[c]=r;break;case"message":let u=l.T();if(l.repeat)for(let f=0;f<r.length;f++)a[c][f]=u.create(r[f]);else a[c]===void 0?a[c]=u.create(r):u.mergePartial(a[c],r);break;case"map":switch(l.V.kind){case"scalar":case"enum":Object.assign(a[c],r);break;case"message":let f=l.V.T();for(let h of Object.keys(r))a[c][h]=f.create(r[h]);break}break}}}function PK(t,e,n){if(e===n)return!0;if(!e||!n)return!1;for(let r of t.fields){let i=r.localName,a=r.oneof?e[r.oneof][i]:e[i],l=r.oneof?n[r.oneof][i]:n[i];switch(r.kind){case"enum":case"scalar":let c=r.kind=="enum"?me.INT32:r.T;if(!(r.repeat?fM(c,a,l):g7(c,a,l)))return!1;break;case"map":if(!(r.V.kind=="message"?hM(r.V.T(),Zf(a),Zf(l)):fM(r.V.kind=="enum"?me.INT32:r.V.T,Zf(a),Zf(l))))return!1;break;case"message":let u=r.T();if(!(r.repeat?hM(u,a,l):u.equals(a,l)))return!1;break}}return!0}const Zf=Object.values;function g7(t,e,n){if(e===n)return!0;if(t!==me.BYTES)return!1;let r=e,i=n;if(r.length!==i.length)return!1;for(let a=0;a<r.length;a++)if(r[a]!=i[a])return!1;return!0}function fM(t,e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!g7(t,e[r],n[r]))return!1;return!0}function hM(t,e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!t.equals(e[r],n[r]))return!1;return!0}const v7=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),IK=v7[m7]={};class $u{constructor(e,n,r){this.defaultCheckDepth=16,this.typeName=e,this.fields=n.map(AK),this.options=r??{},IK.value=this,this.messagePrototype=Object.create(null,v7),this.refTypeCheck=new OK(this),this.refJsonReader=new RK(this),this.refJsonWriter=new NK(this),this.refBinReader=new DK(this),this.refBinWriter=new jK(this)}create(e){let n=LK(this);return e!==void 0&&qs(this,n,e),n}clone(e){let n=this.create();return qs(this,n,e),n}equals(e,n){return PK(this,e,n)}is(e,n=this.defaultCheckDepth){return this.refTypeCheck.is(e,n,!1)}isAssignable(e,n=this.defaultCheckDepth){return this.refTypeCheck.is(e,n,!0)}mergePartial(e,n){qs(this,e,n)}fromBinary(e,n){let r=vK(n);return this.internalBinaryRead(r.readerFactory(e),e.byteLength,r)}fromJson(e,n){return this.internalJsonRead(e,EK(n))}fromJsonString(e,n){let r=JSON.parse(e);return this.fromJson(r,n)}toJson(e,n){return this.internalJsonWrite(e,MK(n))}toJsonString(e,n){var r;let i=this.toJson(e,n);return JSON.stringify(i,null,(r=n?.prettySpaces)!==null&&r!==void 0?r:0)}toBinary(e,n){let r=CK(n);return this.internalBinaryWrite(e,r.writerFactory(),r).finish()}internalJsonRead(e,n,r){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let i=r??this.create();return this.refJsonReader.read(e,i,n),i}throw new Error(`Unable to parse message ${this.typeName} from JSON ${u7(e)}.`)}internalJsonWrite(e,n){return this.refJsonWriter.write(e,n)}internalBinaryWrite(e,n,r){return this.refBinWriter.write(e,n,r),n}internalBinaryRead(e,n,r,i){let a=i??this.create();return this.refBinReader.read(e,a,r,n),a}}var b7=Object.defineProperty,Mn=(t,e)=>b7(t,"name",{value:e,configurable:!0}),w_=(t,e)=>{for(var n in e)b7(t,n,{get:e[n],enumerable:!0})},zK={};w_(zK,{decode:()=>E_,decodeBuffer:()=>_7,decodeSample:()=>C_,encode:()=>k_,encodeBuffer:()=>y7,encodeSample:()=>S_});var BK=[1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];function S_(t){let e;t=t==-32768?-32767:t;let n=~t>>8&128;if(n||(t=t*-1),t>32635&&(t=32635),t>=256){let r=BK[t>>8&127],i=t>>r+3&15;e=r<<4|i}else e=t>>4;return e^(n^85)}Mn(S_,"encodeSample");function C_(t){let e=0;t^=85,t&128&&(t&=-129,e=-1);let n=((t&240)>>4)+4,r=0;return n!=4?r=1<<n|(t&15)<<n-4|1<<n-5:r=t<<1|1,r=e===0?r:-r,r*8*-1}Mn(C_,"decodeSample");function k_(t){let e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=S_(t[n]);return e}Mn(k_,"encode");function E_(t){let e=new Int16Array(t.length);for(let n=0;n<t.length;n++)e[n]=C_(t[n]);return e}Mn(E_,"decode");function y7(t){const e=Math.floor(t.length/2),n=new Int16Array(e);for(let r=0;r<e;r++)n[r]=t.readInt16LE(r*2);return Buffer.from(k_(n).buffer)}Mn(y7,"encodeBuffer");function _7(t){const e=E_(new Uint8Array(t));return Buffer.from(e.buffer)}Mn(_7,"decodeBuffer");var $K={};w_($K,{decode:()=>O_,decodeBuffer:()=>w7,decodeSample:()=>A_,encode:()=>T_,encodeBuffer:()=>x7,encodeSample:()=>M_});var FK=132,pM=32635,UK=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],VK=[0,132,396,924,1980,4092,8316,16764];function M_(t){const e=t<0?128:0;t=Math.abs(t),t+=FK,t>pM&&(t=pM);const n=UK[t>>7&255],r=t>>n+3&15;return~(e|n<<4|r)&255}Mn(M_,"encodeSample");function A_(t){t=~t&255;const e=t&128?-1:1,n=t>>4&7,r=t&15,i=VK[n]+(r<<n+3);return e*i}Mn(A_,"decodeSample");function T_(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=M_(t[n]);return e}Mn(T_,"encode");function O_(t){const e=new Int16Array(t.length);for(let n=0;n<t.length;n++)e[n]=A_(t[n]);return e}Mn(O_,"decode");function x7(t){const e=Math.floor(t.length/2),n=new Int16Array(e);for(let r=0;r<e;r++)n[r]=t.readInt16LE(r*2);return Buffer.from(T_(n).buffer)}Mn(x7,"encodeBuffer");function w7(t){const e=O_(new Uint8Array(t));return Buffer.from(e.buffer)}Mn(w7,"decodeBuffer");var HK={};w_(HK,{calculateLoudness:()=>S7,createWavHeader:()=>C7,resample:()=>qK});var Ty=[8,16,24,32,48];function S7(t,e){if(!(t instanceof Buffer)||t.length===0)throw new Error("Invalid buffer, must be a non-empty Buffer.");if(!Ty.includes(e))throw new Error("Invalid bit depth, supported values are 8, 16, 24, 32, and 48.");if(e===48)throw new Error("48-bit audio is not yet implemented.");const n=Math.ceil(e/8);if(t.length%n!==0)throw new Error(`Invalid buffer length ${t.length}. Must be a multiple of ${n} bytes for ${e}-bit audio.`);const r=Math.pow(2,e-1)-1,i=t.length/n;let a=0;for(let c=0;c<i;c++){const u=c*n;let f;switch(e){case 8:f=t[u],f&128&&(f=f-256);break;case 16:f=t[u]|t[u+1]<<8,f&32768&&(f=f-65536);break;case 24:f=t[u]|t[u+1]<<8|t[u+2]<<16,f&8388608&&(f=f|-16777216);break;case 32:f=t[u]|t[u+1]<<8|t[u+2]<<16|t[u+3]<<24;break;default:throw new Error(`Unsupported bit depth: ${e}`)}const h=f/r;a+=h*h}const l=Math.sqrt(a/i);return l<=1e-10?-100:20*Math.log10(l)}Mn(S7,"calculateLoudness");function C7(t,e,n,r){const i=[{value:"RIFF",type:"string"},{value:36+t,type:"uint32"},{value:"WAVE",type:"string"},{value:"fmt ",type:"string"},{value:16,type:"uint32"},{value:1,type:"uint16"},{value:n,type:"uint16"},{value:e,type:"uint32"},{value:e*n*r/8,type:"uint32"},{value:n*r/8,type:"uint16"},{value:r,type:"uint16"},{value:"data",type:"string"},{value:t,type:"uint32"}],a=Buffer.alloc(44);let l=0;return i.forEach(({value:c,type:u})=>{u==="string"?(a.write(c,l),l+=4):u==="uint32"?(a.writeUInt32LE(c,l),l+=4):u==="uint16"&&(a.writeUInt16LE(c,l),l+=2)}),a}Mn(C7,"createWavHeader");var qK=Mn((t,e,n,r)=>{if(e<=0||n<=0)throw new Error("Sample rates must be positive.");if(!Ty.includes(r))throw new Error(`Invalid bit depth. Allowed values are: ${Ty.join(", ")}`);const i=n/e,a=Math.round(t.length*i),l=new Array(a),c=(1<<r-1)-1,u=-1<<r-1;for(let f=0;f<a;f++){const h=f/i,m=Math.floor(h),g=Math.min(m+1,t.length-1),y=h-m,S=t[m]*(1-y)+t[g]*y,x=Math.round(S);l[f]=Math.max(u,Math.min(c,x))}return l},"resample");class Dr{static floatTo16BitPCM(e){const n=new ArrayBuffer(e.length*2),r=new DataView(n);let i=0;for(let a=0;a<e.length;a++,i+=2){let l=Math.max(-1,Math.min(1,e[a]));r.setInt16(i,l<0?l*32768:l*32767,!0)}return n}static mergeBuffers(e,n){const r=new Uint8Array(e.byteLength+n.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(n),e.byteLength),r.buffer}_packData(e,n){return[new Uint8Array([n,n>>8]),new Uint8Array([n,n>>8,n>>16,n>>24])][e]}pack(e,n){if(n?.bitsPerSample)if(n?.channels){if(!n?.data)throw new Error('Missing "data"')}else throw new Error('Missing "channels"');else throw new Error('Missing "bitsPerSample"');const{bitsPerSample:r,channels:i,data:a}=n,l=["RIFF",this._packData(1,52),"WAVE","fmt ",this._packData(1,16),this._packData(0,1),this._packData(0,i.length),this._packData(1,e),this._packData(1,e*i.length*r/8),this._packData(0,i.length*r/8),this._packData(0,r),"data",this._packData(1,i[0].length*i.length*r/8),a],c=new Blob(l,{type:"audio/mpeg"}),u=URL.createObjectURL(c);return{blob:c,url:u,channelCount:i.length,sampleRate:e,duration:a.byteLength/(i.length*e*2)}}}globalThis.WavPacker=Dr;const mM=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],GK=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Gs=[],R_=[];for(let t=1;t<=8;t++)for(let e=0;e<mM.length;e++){const n=mM[e];Gs.push(n/Math.pow(2,8-t)),R_.push(GK[e]+t)}const rp=[32,2e3],gM=Gs.filter((t,e)=>Gs[e]>rp[0]&&Gs[e]<rp[1]),WK=R_.filter((t,e)=>Gs[e]>rp[0]&&Gs[e]<rp[1]);class jl{static getFrequencies(e,n,r,i="frequency",a=-100,l=-30){r||(r=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(r));const c=n/2,u=1/r.length*c;let f,h,m;if(i==="music"||i==="voice"){const S=i==="voice"?gM:Gs,x=Array(S.length).fill(a);for(let C=0;C<r.length;C++){const A=C*u,R=r[C];for(let j=S.length-1;j>=0;j--)if(A>S[j]){x[j]=Math.max(x[j],R);break}}f=x,h=i==="voice"?gM:Gs,m=i==="voice"?WK:R_}else f=Array.from(r),h=f.map((S,x)=>u*x),m=h.map(S=>`${S.toFixed(2)} Hz`);const g=f.map(S=>Math.max(0,Math.min((S-a)/(l-a),1)));return{values:new Float32Array(g),frequencies:h,labels:m}}constructor(e,n=null){if(this.fftResults=[],n){const{length:r,sampleRate:i}=n,a=new OfflineAudioContext({length:r,sampleRate:i}),l=a.createBufferSource();l.buffer=n;const c=a.createAnalyser();c.fftSize=8192,c.smoothingTimeConstant=.1,l.connect(c);const u=1/60,f=r/i,h=m=>{const g=u*m;g<f&&a.suspend(g).then(()=>{const y=new Float32Array(c.frequencyBinCount);c.getFloatFrequencyData(y),this.fftResults.push(y),h(m+1)}),m===1?a.startRendering():a.resume()};l.start(0),h(1),this.audio=e,this.context=a,this.analyser=c,this.sampleRate=i,this.audioBuffer=n}else{const r=new AudioContext,i=r.createMediaElementSource(e),a=r.createAnalyser();a.fftSize=8192,a.smoothingTimeConstant=.1,i.connect(a),a.connect(r.destination),this.audio=e,this.context=r,this.analyser=a,this.sampleRate=this.context.sampleRate,this.audioBuffer=null}}getFrequencies(e="frequency",n=-100,r=-30){let i=null;if(this.audioBuffer&&this.fftResults.length){const a=this.audio.currentTime/this.audio.duration,l=Math.min(a*this.fftResults.length|0,this.fftResults.length-1);i=this.fftResults[l]}return jl.getFrequencies(this.analyser,this.sampleRate,i,e,n,r)}async resumeIfSuspended(){return this.context.state==="suspended"&&await this.context.resume(),!0}}globalThis.AudioAnalysis=jl;const YK=`
|
|
99
99
|
class StreamProcessor extends AudioWorkletProcessor {
|
|
100
100
|
constructor() {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Pipecat UI</title>
|
|
8
8
|
<link rel="icon" href="./favicon.svg" type="image/svg+xml">
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-CW4RG3Y1.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="./assets/index-MrVEiU1O.css">
|
|
11
11
|
</head>
|
|
12
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: small-websocket-prebuilt
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: A simple, ready-to-use client for testing the WebSocket transport with Pipecat.
|
|
5
5
|
License: BSD 2-Clause License
|
|
6
6
|
Project-URL: homepage, https://github.com/Qiliang/small-websocket-prebuilt
|
|
@@ -17,7 +17,7 @@ small_websocket_prebuilt/client/dist/assets/geist-latin-wght-normal-Dm3htQBi.wof
|
|
|
17
17
|
small_websocket_prebuilt/client/dist/assets/geist-mono-cyrillic-wght-normal-BZdD_g9V.woff2
|
|
18
18
|
small_websocket_prebuilt/client/dist/assets/geist-mono-latin-ext-wght-normal-b6lpi8_2.woff2
|
|
19
19
|
small_websocket_prebuilt/client/dist/assets/geist-mono-latin-wght-normal-Cjtb1TV-.woff2
|
|
20
|
-
small_websocket_prebuilt/client/dist/assets/index-
|
|
20
|
+
small_websocket_prebuilt/client/dist/assets/index-CW4RG3Y1.js
|
|
21
21
|
small_websocket_prebuilt/client/dist/assets/index-MrVEiU1O.css
|
|
22
22
|
small_websocket_prebuilt/client/dist/assets/voice-ui-kit_false-BPs6efg0.js
|
|
23
23
|
small_websocket_prebuilt/client/dist/assets/voice-ui-kit_false-b2I56sea.js
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|