-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchunk-LOCUSBCX.js
More file actions
47 lines (44 loc) · 15.4 KB
/
chunk-LOCUSBCX.js
File metadata and controls
47 lines (44 loc) · 15.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import{a as te,b as ne,c as oe}from"./chunk-MZKNBOGM.js";import{a as K,b as Y}from"./chunk-LURJS6YS.js";import{b as ee}from"./chunk-GWKXUGLE.js";import{b as pe,d as fe}from"./chunk-JDINLGKI.js";import"./chunk-73XO7DPG.js";import{b as H,c as L,d as Z,e as O,h as j,i as $,m as J,n as G}from"./chunk-2VB5JCDE.js";import"./chunk-TNXZVDJM.js";import"./chunk-EJLLX3NW.js";import{Ba as R,Qa as M,Za as q,_a as Q,ab as U,bb as V,mc as W}from"./chunk-GU7FRFWB.js";import{Ab as d,Ba as b,Gb as p,Ob as le,Pb as ue,Rb as se,Sb as ce,Tb as de,Ub as s,Uc as P,Vb as e,Wb as t,Xb as m,Yc as B,_c as X,cc as N,cd as I,gc as c,ib as u,jc as E,nc as v,oc as w,pc as F,qa as g,ra as z,rb as f,rc as y,sa as _,sc as T,ta as D,uc as k,yc as n,zc as A}from"./chunk-GUHHCQYK.js";import{h as C}from"./chunk-OW75ZOQB.js";var ze=["thoughtChainCard"];function _e(a,i){if(a&1&&(e(0,"pre"),n(1," "),e(2,"code"),n(3),t(),n(4,`
`),t()),a&2){let o=E();u(3),A(o.content())}}var De=[`INVITE sip:[email protected] SIP/2.0
`,`Via: SIP/2.0/UDP [host];branch=123456
`,`Content-Type: application/sdp
`],be=[`v=0
`,`o=alice 2890844526 2890844526 IN IP4 [host]
`,`s=
`,`c=IN IP4 [host]
`,`t=0 0
`,`m=audio 49170 RTP/AVP 0
`,`a=rtpmap:0 PCMU/8000
`,`m=video 51372 RTP/AVP 31
`,`a=rtpmap:31 H261/90000
`,`m=video 53000 RTP/AVP 32
`,`a=rtpmap:32 MPV/90000
`];function Ne(){return new ReadableStream({start(i){return C(this,null,function*(){for(let o of De.concat(be))yield new Promise(r=>setTimeout(r,100)),i.enqueue(new TextEncoder().encode(o));i.close()})}})}var S=class a{thoughtChainCard=I("thoughtChainCard",{read:f});lines=b([]);content=X({source:this.lines,computation:i=>i.join("")});items=B(()=>this.lines().length?[{title:"Mock Custom Protocol - Log",status:"success",icon:"tags",content:this.thoughtChainCard()}]:[]);readStream(){ee({readableStream:Ne(),transformStream:new TransformStream({transform(i,o){o.enqueue(i)}})}).subscribe(i=>{console.log(i),this.lines.update(o=>[...o,i])})}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=d({type:a,selectors:[["nx-demo-x-stream-custom-protocol"]],viewQuery:function(o,r){o&1&&y(r.thoughtChainCard,ze,5,f),o&2&&T()},decls:8,vars:3,consts:[["thoughtChainCard",""],["nz-button","","nzType","primary",3,"click"],[3,"items"]],template:function(o,r){if(o&1){let l=N();e(0,"nz-splitter")(1,"nz-splitter-panel")(2,"button",1),c("click",function(){return _(l),D(r.readStream())}),n(3,"Mock Default Protocol - SSE"),t()(),e(4,"nz-splitter-panel"),m(5,"nx-thought-chain",2),t()(),p(6,_e,5,1,"ng-template",null,0,P)}o&2&&(u(5),k("margin-inline-start",16,"px"),s("items",r.items()))},dependencies:[V,U,q,Q,oe,ne,te,Y,K],encapsulation:2})};var ve=["thoughtChainCard"];function we(a,i){if(a&1&&m(0,"br")(1,"br")(2,"nx-bubble",3),a&2){let o=E();u(2),s("content",o.content())("typing",!0)}}function Fe(a,i){if(a&1&&(n(0,`
`),e(1,"code"),n(2),t(),n(3,`
`)),a&2){let o=i.$implicit;u(2),A(o.data)}}function ye(a,i){if(a&1&&(e(0,"pre"),n(1," "),ce(2,Fe,4,1,null,null,se),t()),a&2){let o=E();u(2),de(o.lines())}}var Se=["He","llo",", w","or","ld!"];function Te(){let a=[];for(let o=0;o<Se.length;o++){let r=`event: message
data: {"id":"${o}","content":"${Se[o]}"}
`;a.push(r)}return new ReadableStream({start(o){return C(this,null,function*(){for(let r of a)yield new Promise(l=>setTimeout(l,100)),o.enqueue(new TextEncoder().encode(r));o.close()})}})}var h=class a{thoughtChainCard=I("thoughtChainCard",{read:f});lines=b([]);content=X({source:this.lines,computation:i=>i.map(o=>JSON.parse(o.data).content).join("")});items=B(()=>this.lines().length?[{title:"Mock Default Protocol - Log",status:"success",icon:"tags",content:this.thoughtChainCard()}]:[]);readStream(){ee({readableStream:Te()}).subscribe(i=>{console.log(i),this.lines.update(o=>[...o,i])})}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=d({type:a,selectors:[["nx-demo-x-stream-default"]],viewQuery:function(o,r){o&1&&y(r.thoughtChainCard,ve,5,f),o&2&&T()},decls:9,vars:4,consts:[["thoughtChainCard",""],["nz-button","","nzType","primary",3,"click"],[3,"items"],[3,"content","typing"]],template:function(o,r){if(o&1){let l=N();e(0,"nz-splitter")(1,"nz-splitter-panel")(2,"button",1),c("click",function(){return _(l),D(r.readStream())}),n(3,"Mock Default Protocol - SSE"),t(),le(4,we,3,2),t(),e(5,"nz-splitter-panel"),m(6,"nx-thought-chain",2),t()(),p(7,ye,4,0,"ng-template",null,0,P)}o&2&&(u(4),ue(r.lines().length?4:-1),u(2),k("margin-inline-start",16,"px"),s("items",r.items()))},dependencies:[V,U,q,Q,oe,ne,te,fe,pe,Y,K],encapsulation:2})};function Re(a,i){a&1&&m(0,"nx-demo-x-stream-default",23)}function Me(a,i){a&1&&m(0,"nx-demo-x-stream-custom-protocol",24)}var ie=class a{expanded=!1;codeBoxes;goLink(i){window&&(window.location.hash=i)}expandAllCode(){this.expanded=!this.expanded,this.codeBoxes.forEach(i=>i.expandCode(this.expanded))}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=d({type:a,selectors:[["nz-demo-x-stream"]],viewQuery:function(o,r){if(o&1&&v(H,5),o&2){let l;w(l=F())&&(r.codeBoxes=l)}},decls:79,vars:2,consts:[[1,"toc-affix",3,"nzOffsetTop"],["nzShowInkInFixed","",3,"nzClick","nzAffix"],["nzHref","#\u4F55\u65F6\u4F7F\u7528","nzTitle","\u4F55\u65F6\u4F7F\u7528",1,"toc-indent-1"],["nzHref","#\u4EE3\u7801\u6F14\u793A","nzTitle","\u4EE3\u7801\u6F14\u793A",1,"toc-indent-1"],["nzHref","#components-x-stream-demo-default","nzTitle","\u9ED8\u8BA4\u534F\u8BAE - SSE",1,"toc-indent-2"],["nzHref","#components-x-stream-demo-custom-protocol","nzTitle","\u81EA\u5B9A\u4E49\u534F\u8BAE",1,"toc-indent-2"],["nzHref","#api","nzTitle","API",1,"toc-indent-1"],[1,"markdown"],[1,"subtitle"],["name","x-stream","description","\u8F6C\u6362\u53EF\u8BFB\u6570\u636E\u6D41","language","zh"],["id","\u4F55\u65F6\u4F7F\u7528"],["onclick","window.location.hash = '\u4F55\u65F6\u4F7F\u7528'",1,"anchor"],["id","\u4EE3\u7801\u6F14\u793A"],["nzType","appstore","nz-tooltip","","nzTooltipTitle","\u5C55\u5F00\u5168\u90E8\u4EE3\u7801",1,"code-box-expand-trigger",3,"click"],["onclick","window.location.hash = '\u4EE3\u7801\u6F14\u793A'",1,"anchor"],["cols","1"],["showcase","","component","x-stream","key","default","doc",`<blockquote>
<p>SSE - <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent%5C_events" target="_blank" rel="noopener">https://developer.mozilla.org/en-US/docs/Web/API/Server-sent\\_events</a></p>
</blockquote>
<p>XStream \u9ED8\u8BA4\u7684 <code>transformStream</code> \u662F\u7528\u4E8E SSE \u534F\u8BAE\u7684\u6D41\u8F6C\u6362\u5668\u3002<code>readableStream</code> \u63A5\u6536\u4E00\u4E2A <code>new ReadableStream(...)</code> \u5B9E\u4F8B\uFF0C\u5E38\u89C1\u7684\u5982 <code>await fetch(...).body</code></p>`,"title","\u9ED8\u8BA4\u534F\u8BAE - SSE",4,"templateRef"],["showcase","","component","x-stream","key","custom-protocol","doc",`<blockquote>
<p>\u5728\u672C\u793A\u4F8B\u4E2D\uFF0C\u6211\u4EEC\u5C06\u6F14\u793A\u5982\u4F55\u89E3\u6790 SIP \u534F\u8BAE, \u8BE5\u534F\u8BAE\u5E38\u7528\u4E8E P2P \u97F3\u89C6\u9891\u4F1A\u8BDD\u534F\u5546\u3002</p>
</blockquote>
<p>\u4F20\u5165 transformStream \u6D41\u8F6C\u6362\u5668\uFF0C\u8BE5\u53C2\u6570\u9700\u63A5\u6536\u4E00\u4E2A new TransformStream(...) \u5B9E\u4F8B\u3002</p>`,"title","\u81EA\u5B9A\u4E49\u534F\u8BAE",4,"templateRef"],[1,"markdown","api-container"],["id","api"],["onclick","window.location.hash = 'api'",1,"anchor"],["id","xstreamoptions"],["onclick","window.location.hash = 'xstreamoptions'",1,"anchor"],["showcase","","component","x-stream","key","default","doc",`<blockquote>
<p>SSE - <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent%5C_events" target="_blank" rel="noopener">https://developer.mozilla.org/en-US/docs/Web/API/Server-sent\\_events</a></p>
</blockquote>
<p>XStream \u9ED8\u8BA4\u7684 <code>transformStream</code> \u662F\u7528\u4E8E SSE \u534F\u8BAE\u7684\u6D41\u8F6C\u6362\u5668\u3002<code>readableStream</code> \u63A5\u6536\u4E00\u4E2A <code>new ReadableStream(...)</code> \u5B9E\u4F8B\uFF0C\u5E38\u89C1\u7684\u5982 <code>await fetch(...).body</code></p>`,"title","\u9ED8\u8BA4\u534F\u8BAE - SSE"],["showcase","","component","x-stream","key","custom-protocol","doc",`<blockquote>
<p>\u5728\u672C\u793A\u4F8B\u4E2D\uFF0C\u6211\u4EEC\u5C06\u6F14\u793A\u5982\u4F55\u89E3\u6790 SIP \u534F\u8BAE, \u8BE5\u534F\u8BAE\u5E38\u7528\u4E8E P2P \u97F3\u89C6\u9891\u4F1A\u8BDD\u534F\u5546\u3002</p>
</blockquote>
<p>\u4F20\u5165 transformStream \u6D41\u8F6C\u6362\u5668\uFF0C\u8BE5\u53C2\u6570\u9700\u63A5\u6536\u4E00\u4E2A new TransformStream(...) \u5B9E\u4F8B\u3002</p>`,"title","\u81EA\u5B9A\u4E49\u534F\u8BAE"]],template:function(o,r){o&1&&(e(0,"article")(1,"nz-affix",0)(2,"nz-anchor",1),c("nzClick",function(x){return r.goLink(x)}),m(3,"nz-link",2)(4,"nz-link",3)(5,"nz-link",4)(6,"nz-link",5)(7,"nz-link",6),t()(),e(8,"section",7)(9,"h1"),n(10," XStream "),e(11,"span",8),n(12,"\u6D41"),t()(),m(13,"component-meta",9),e(14,"section",7)(15,"h2",10)(16,"span"),n(17,"\u4F55\u65F6\u4F7F\u7528"),t(),e(18,"a",11),n(19,"#"),t()(),e(20,"ul")(21,"li"),n(22,"\u5C06 SSE \u534F\u8BAE\u7684 ReadableStream \u8F6C\u6362\u4E3A Record"),t(),e(23,"li"),n(24,"\u5C06\u4EFB\u4F55\u534F\u8BAE\u7684 ReadableStream \u89E3\u7801\u5E76\u8BFB\u53D6"),t()()(),e(25,"h2",12)(26,"span"),n(27,"\u4EE3\u7801\u6F14\u793A"),t(),e(28,"nz-icon",13),c("click",function(){return r.expandAllCode()}),t(),e(29,"a",14),n(30,"#"),t()()(),e(31,"demo-wrapper",15),p(32,Re,1,0,"nx-demo-x-stream-default",16)(33,Me,1,0,"nx-demo-x-stream-custom-protocol",17),t(),e(34,"section",18),z(),e(35,"h2",19)(36,"span"),n(37,"API"),t(),e(38,"a",20),n(39,"#"),t()(),e(40,"h3",21)(41,"span"),n(42,"XStreamOptions"),t(),e(43,"a",22),n(44,"#"),t()(),e(45,"table")(46,"thead")(47,"tr")(48,"th"),n(49,"\u5C5E\u6027"),t(),e(50,"th"),n(51,"\u8BF4\u660E"),t(),e(52,"th"),n(53,"\u7C7B\u578B"),t(),e(54,"th"),n(55,"\u9ED8\u8BA4\u503C"),t()()(),e(56,"tbody")(57,"tr")(58,"td")(59,"code"),n(60,"readableStream"),t()(),e(61,"td"),n(62,"ReadableStream \u5B9E\u4F8B"),t(),e(63,"td")(64,"code"),n(65,"ReadableStream<Uint8Array>"),t()(),e(66,"td"),n(67,"-"),t()(),e(68,"tr")(69,"td")(70,"code"),n(71,"transformStream"),t()(),e(72,"td"),n(73,"\u81EA\u5B9A\u4E49\u7684 transformStream \u7528\u4E8E\u8F6C\u6362\u6D41\u7684\u5904\u7406"),t(),e(74,"td")(75,"code"),n(76,"TransformStream<string, T>"),t()(),e(77,"td"),n(78,"sseTransformStream"),t()()()(),g(),t()()),o&2&&(u(),s("nzOffsetTop",16),u(),s("nzAffix",!1))},dependencies:[G,J,Z,L,O,j,$,R,W,M,S,h],encapsulation:2})};function qe(a,i){a&1&&m(0,"nx-demo-x-stream-default",23)}function Qe(a,i){a&1&&m(0,"nx-demo-x-stream-custom-protocol",24)}var ae=class a{expanded=!1;codeBoxes;goLink(i){window&&(window.location.hash=i)}expandAllCode(){this.expanded=!this.expanded,this.codeBoxes.forEach(i=>i.expandCode(this.expanded))}static \u0275fac=function(o){return new(o||a)};static \u0275cmp=d({type:a,selectors:[["nz-demo-x-stream"]],viewQuery:function(o,r){if(o&1&&v(H,5),o&2){let l;w(l=F())&&(r.codeBoxes=l)}},decls:78,vars:2,consts:[[1,"toc-affix",3,"nzOffsetTop"],["nzShowInkInFixed","",3,"nzClick","nzAffix"],["nzHref","#when_to_use","nzTitle","When To Use",1,"toc-indent-1"],["nzHref","#examples","nzTitle","Examples",1,"toc-indent-1"],["nzHref","#components-x-stream-demo-default","nzTitle","Default Protocol - SSE",1,"toc-indent-2"],["nzHref","#components-x-stream-demo-custom-protocol","nzTitle","Custom Protocol",1,"toc-indent-2"],["nzHref","#api","nzTitle","API",1,"toc-indent-1"],[1,"markdown"],[1,"subtitle"],["name","x-stream","description","Transform binary stream.","language","en"],["id","when_to_use"],["onclick","window.location.hash = 'when_to_use'",1,"anchor"],["id","examples"],["nzType","appstore","nz-tooltip","","nzTooltipTitle","Expand All Code",1,"code-box-expand-trigger",3,"click"],["onclick","window.location.hash = 'Examples'",1,"anchor"],["cols","1"],["showcase","","component","x-stream","key","default","doc",`<blockquote>
<p>SSE - <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent%5C_events" target="_blank" rel="noopener">https://developer.mozilla.org/en-US/docs/Web/API/Server-sent\\_events</a></p>
</blockquote>
<p>The default <code>transformStream</code> in XStream is an SSE protocol stream transformer and is optional. The <code>readableStream</code> accepts a <code>new ReadableStream(...)</code> instance, such as <code>await fetch(...).body</code></p>`,"title","Default Protocol - SSE",4,"templateRef"],["showcase","","component","x-stream","key","custom-protocol","doc",`<blockquote>
<p>In this example, we will demonstrate parsing the SIP protocol, which is commonly used for P2P audio and video session initiation.</p>
</blockquote>
<p>Pass in a transformStream stream transformer; this parameter accepts a new TransformStream(...) instance.</p>`,"title","Custom Protocol",4,"templateRef"],[1,"markdown","api-container"],["id","api"],["onclick","window.location.hash = 'api'",1,"anchor"],["id","xstreamoptions"],["onclick","window.location.hash = 'xstreamoptions'",1,"anchor"],["showcase","","component","x-stream","key","default","doc",`<blockquote>
<p>SSE - <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent%5C_events" target="_blank" rel="noopener">https://developer.mozilla.org/en-US/docs/Web/API/Server-sent\\_events</a></p>
</blockquote>
<p>The default <code>transformStream</code> in XStream is an SSE protocol stream transformer and is optional. The <code>readableStream</code> accepts a <code>new ReadableStream(...)</code> instance, such as <code>await fetch(...).body</code></p>`,"title","Default Protocol - SSE"],["showcase","","component","x-stream","key","custom-protocol","doc",`<blockquote>
<p>In this example, we will demonstrate parsing the SIP protocol, which is commonly used for P2P audio and video session initiation.</p>
</blockquote>
<p>Pass in a transformStream stream transformer; this parameter accepts a new TransformStream(...) instance.</p>`,"title","Custom Protocol"]],template:function(o,r){o&1&&(e(0,"article")(1,"nz-affix",0)(2,"nz-anchor",1),c("nzClick",function(x){return r.goLink(x)}),m(3,"nz-link",2)(4,"nz-link",3)(5,"nz-link",4)(6,"nz-link",5)(7,"nz-link",6),t()(),e(8,"section",7)(9,"h1"),n(10," XStream "),m(11,"span",8),t(),m(12,"component-meta",9),e(13,"section",7)(14,"h2",10)(15,"span"),n(16,"When To Use"),t(),e(17,"a",11),n(18,"#"),t()(),e(19,"ul")(20,"li"),n(21,"Transform SSE protocol ReadableStream to Record"),t(),e(22,"li"),n(23,"Decode and read any protocol ReadableStream"),t()()(),e(24,"h2",12)(25,"span"),n(26,"Examples"),t(),e(27,"nz-icon",13),c("click",function(){return r.expandAllCode()}),t(),e(28,"a",14),n(29,"#"),t()()(),e(30,"demo-wrapper",15),p(31,qe,1,0,"nx-demo-x-stream-default",16)(32,Qe,1,0,"nx-demo-x-stream-custom-protocol",17),t(),e(33,"section",18),z(),e(34,"h2",19)(35,"span"),n(36,"API"),t(),e(37,"a",20),n(38,"#"),t()(),e(39,"h3",21)(40,"span"),n(41,"XStreamOptions"),t(),e(42,"a",22),n(43,"#"),t()(),e(44,"table")(45,"thead")(46,"tr")(47,"th"),n(48,"Property"),t(),e(49,"th"),n(50,"Description"),t(),e(51,"th"),n(52,"Type"),t(),e(53,"th"),n(54,"Default"),t()()(),e(55,"tbody")(56,"tr")(57,"td")(58,"code"),n(59,"readableStream"),t()(),e(60,"td"),n(61,"Readable stream of binary data"),t(),e(62,"td")(63,"code"),n(64,"ReadableStream<Uint8Array>"),t()(),e(65,"td"),n(66,"-"),t()(),e(67,"tr")(68,"td")(69,"code"),n(70,"transformStream"),t()(),e(71,"td"),n(72,"Support customizable transformStream to transform streams"),t(),e(73,"td")(74,"code"),n(75,"TransformStream<string, T>"),t()(),e(76,"td"),n(77,"sseTransformStream"),t()()()(),g(),t()()),o&2&&(u(),s("nzOffsetTop",16),u(),s("nzAffix",!1))},dependencies:[G,J,Z,L,O,j,$,R,W,M,S,h],encapsulation:2})};var Ue=[{path:"en",component:ae},{path:"zh",component:ie}],gt=Ue;export{gt as default};