import{s as wl,o as jl,n as Jl}from"../chunks/scheduler.5c93273d.js";import{S as yl,i as ol,g as w,s as M,r as y,A as ml,h as j,f as t,c as T,j as il,u as o,x as V,k as cl,y as Il,a as e,v as m,d as I,t as r,w as C}from"../chunks/index.e43dd92b.js";import{C as _}from"../chunks/CodeBlock.6896320e.js";import{H as rl,E as Cl}from"../chunks/getInferenceSnippets.d410b42d.js";import{H as hl,a as sl}from"../chunks/HfOption.d50154c3.js";function ul(h){let J,n;return J=new _({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzLm1vZHVsYXJfcGlwZWxpbmVzJTIwaW1wb3J0JTIwTW9kdWxhclBpcGVsaW5lQmxvY2tzJTJDJTIwSW5wdXRQYXJhbSUyQyUyME91dHB1dFBhcmFtJTBBJTBBY2xhc3MlMjBUZXh0VG9JbWFnZUJsb2NrKE1vZHVsYXJQaXBlbGluZUJsb2NrcyklM0ElMEElMjAlMjAlMjAlMjBtb2RlbF9uYW1lJTIwJTNEJTIwJTIydGV4dDJpbWclMjIlMEElMEElMjAlMjAlMjAlMjAlNDBwcm9wZXJ0eSUwQSUyMCUyMCUyMCUyMGRlZiUyMGlucHV0cyhzZWxmKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCU1QklucHV0UGFyYW0obmFtZSUzRCUyMnByb21wdCUyMiklNUQlMEElMEElMjAlMjAlMjAlMjAlNDBwcm9wZXJ0eSUwQSUyMCUyMCUyMCUyMGRlZiUyMGludGVybWVkaWF0ZV9vdXRwdXRzKHNlbGYpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTVCJTVEJTBBJTBBJTIwJTIwJTIwJTIwJTQwcHJvcGVydHklMEElMjAlMjAlMjAlMjBkZWYlMjBkZXNjcmlwdGlvbihzZWxmKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCUyMiVFNiU4O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MjAlMjAlMjAlMjByZXR1cm4lMjBjb21wb25lbnRzJTJDJTIwc3RhdGU=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> ModularPipelineBlocks, InputParam, OutputParam

<span class="hljs-keyword">class</span> <span class="hljs-title class_">TextToImageBlock</span>(<span class="hljs-title class_ inherited__">ModularPipelineBlocks</span>):
    model_name = <span class="hljs-string">&quot;text2img&quot;</span>

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">inputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> [InputParam(name=<span class="hljs-string">&quot;prompt&quot;</span>)]

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">intermediate_outputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> []

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">description</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;我是一个文本到图像的工作流程！&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, components, state</span>):
        block_state = self.get_block_state(state)
        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;运行文本到图像工作流程&quot;</span>)
        <span class="hljs-comment"># 在这里添加你的文本到图像逻辑</span>
        <span class="hljs-comment"># 例如：根据提示生成图像</span>
        self.set_block_state(state, block_state)
        <span class="hljs-keyword">return</span> components, state`,wrap:!1}}),{c(){y(J.$$.fragment)},l(s){o(J.$$.fragment,s)},m(s,i){m(J,s,i),n=!0},p:Jl,i(s){n||(I(J.$$.fragment,s),n=!0)},o(s){r(J.$$.fragment,s),n=!1},d(s){C(J,s)}}}function dl(h){let J,n;return J=new _({props:{code:"Y2xhc3MlMjBJbWFnZVRvSW1hZ2VCbG9jayhNb2R1bGFyUGlwZWxpbmVCbG9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RTUlOUIlQkUlRTUlODMlOEYlRTUlODglQjAlRTUlOUIlQkUlRTUlODMlOEYlRTUlQjclQTUlRTQlQkQlOUMlRTYlQjUlODElRTclQTglOEIlMjIpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwJUU1JTlDJUE4JUU4JUJGJTk5JUU5JTg3JThDJUU2JUI3JUJCJUU1JThBJUEwJUU0JUJEJUEwJUU3JTlBJTg0JUU1JTlCJUJFJUU1JTgzJThGJUU1JTg4JUIwJUU1JTlCJUJFJUU1JTgzJThGJUU5JTgwJUJCJUU4JUJFJTkxJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwJUU0JUJFJThCJUU1JUE2JTgyJUVGJUJDJTlBJUU2JUEwJUI5JUU2JThEJUFFJUU2JThGJTkwJUU3JUE0JUJBJUU4JUJEJUFDJUU2JThEJUEyJUU4JUJFJTkzJUU1JTg1JUE1JUU1JTlCJUJFJUU1JTgzJThGJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2VsZi5zZXRfYmxvY2tfc3RhdGUoc3RhdGUlMkMlMjBibG9ja19zdGF0ZSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBjb21wb25lbnRzJTJDJTIwc3RhdGU=",highlighted:`<span class="hljs-keyword">class</span> <span class="hljs-title class_">ImageToImageBlock</span>(<span class="hljs-title class_ inherited__">ModularPipelineBlocks</span>):
    model_name = <span class="hljs-string">&quot;img2img&quot;</span>

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">inputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> [InputParam(name=<span class="hljs-string">&quot;prompt&quot;</span>), InputParam(name=<span class="hljs-string">&quot;image&quot;</span>)]

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">intermediate_outputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> []

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">description</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;我是一个图像到图像的工作流程！&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, components, state</span>):
        block_state = self.get_block_state(state)
        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;运行图像到图像工作流程&quot;</span>)
        <span class="hljs-comment"># 在这里添加你的图像到图像逻辑</span>
        <span class="hljs-comment"># 例如：根据提示转换输入图像</span>
        self.set_block_state(state, block_state)
        <span class="hljs-keyword">return</span> components, state`,wrap:!1}}),{c(){y(J.$$.fragment)},l(s){o(J.$$.fragment,s)},m(s,i){m(J,s,i),n=!0},p:Jl,i(s){n||(I(J.$$.fragment,s),n=!0)},o(s){r(J.$$.fragment,s),n=!1},d(s){C(J,s)}}}function Vl(h){let J,n;return J=new _({props:{code:"Y2xhc3MlMjBJbnBhaW50QmxvY2soTW9kdWxhclBpcGVsaW5lQmxvY2tzKSUzQSUwQSUyMCUyMCUyMCUyMG1vZGVsX25hbWUlMjAlM0QlMjAlMjJpbnBhaW50JTIyJTBBJTBBJTIwJTIwJTIwJTIwJTQwcHJvcGVydHklMEElMjAlMjAlMjAlMjBkZWYlMjBpbnB1dHMoc2VsZiklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAlNUJJbnB1dFBhcmFtKG5hbWUlM0QlMjJwcm9tcHQlMjIpJTJDJTIwSW5wdXRQYXJhbShuYW1lJTNEJTIyaW1hZ2UlMjIpJTJDJTIwSW5wdXRQYXJhbShuYW1lJTNEJTIybWFzayUyMiklNUQlMEElMEElMjAlMjAlMjAlMjAlNDBwcm9wZXJ0eSUwQSUwQSUyMCUyMCUyMCUyMGRlZiUyMGludGVybWVkaWF0ZV9vdXRwdXRzKHNlbGYpJTNBJTBBJTIwJTIwJTIwJTIwJT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IwJTIwJTIwJTIwc2VsZi5zZXRfYmxvY2tfc3RhdGUoc3RhdGUlMkMlMjBibG9ja19zdGF0ZSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBjb21wb25lbnRzJTJDJTIwc3RhdGU=",highlighted:`<span class="hljs-keyword">class</span> <span class="hljs-title class_">InpaintBlock</span>(<span class="hljs-title class_ inherited__">ModularPipelineBlocks</span>):
    model_name = <span class="hljs-string">&quot;inpaint&quot;</span>

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">inputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> [InputParam(name=<span class="hljs-string">&quot;prompt&quot;</span>), InputParam(name=<span class="hljs-string">&quot;image&quot;</span>), InputParam(name=<span class="hljs-string">&quot;mask&quot;</span>)]

<span class="hljs-meta">    @property</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">intermediate_outputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> []

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">description</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;我是一个修复工作流！&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, components, state</span>):
        block_state = self.get_block_state(state)
        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;运行修复工作流&quot;</span>)
        <span class="hljs-comment"># 在这里添加你的修复逻辑</span>
        <span class="hljs-comment"># 例如：根据提示填充被遮罩的区域</span>
        self.set_block_state(state, block_state)
        <span class="hljs-keyword">return</span> components, state`,wrap:!1}}),{c(){y(J.$$.fragment)},l(s){o(J.$$.fragment,s)},m(s,i){m(J,s,i),n=!0},p:Jl,i(s){n||(I(J.$$.fragment,s),n=!0)},o(s){r(J.$$.fragment,s),n=!1},d(s){C(J,s)}}}function Bl(h){let J,n,s,i,p,d;return J=new sl({props:{id:"auto",option:"text-to-image",$$slots:{default:[ul]},$$scope:{ctx:h}}}),s=new sl({props:{id:"auto",option:"image-to-image",$$slots:{default:[dl]},$$scope:{ctx:h}}}),p=new sl({props:{id:"auto",option:"inpaint",$$slots:{default:[Vl]},$$scope:{ctx:h}}}),{c(){y(J.$$.fragment),n=M(),y(s.$$.fragment),i=M(),y(p.$$.fragment)},l(a){o(J.$$.fragment,a),n=T(a),o(s.$$.fragment,a),i=T(a),o(p.$$.fragment,a)},m(a,c){m(J,a,c),e(a,n,c),m(s,a,c),e(a,i,c),m(p,a,c),d=!0},p(a,c){const f={};c&2&&(f.$$scope={dirty:c,ctx:a}),J.$set(f);const u={};c&2&&(u.$$scope={dirty:c,ctx:a}),s.$set(u);const $={};c&2&&($.$$scope={dirty:c,ctx:a}),p.$set($)},i(a){d||(I(J.$$.fragment,a),I(s.$$.fragment,a),I(p.$$.fragment,a),d=!0)},o(a){r(J.$$.fragment,a),r(s.$$.fragment,a),r(p.$$.fragment,a),d=!1},d(a){a&&(t(n),t(i)),C(J,a),C(s,a),C(p,a)}}}function fl(h){let J,n,s,i,p,d,a,c="<code>AutoPipelineBlocks</code> 是一种包含支持不同工作流程的块的多块类型。它根据运行时提供的输入自动选择要运行的子块。这通常用于将多个工作流程（文本到图像、图像到图像、修复）打包到一个管道中以便利。",f,u,$="本指南展示如何创建 <code>AutoPipelineBlocks</code>。",Y,k,Ul="创建三个 <code>ModularPipelineBlocks</code> 用于文本到图像、图像到图像和修复。这些代表了管道中可用的不同工作流程。",O,B,W,Q,al="创建一个包含子块类及其对应块名称列表的<code>AutoPipelineBlocks</code>类。",z,b,tl="你还需要包括<code>block_trigger_inputs</code>，一个触发相应块的输入名称列表。如果在运行时提供了触发输入，则选择该块运行。使用<code>None</code>来指定如果未检测到触发输入时运行的默认块。",H,g,el="最后，重要的是包括一个<code>description</code>，清楚地解释哪些输入触发哪些工作流。这有助于用户理解如何运行特定的工作流。",v,E,x,A,nl="包含<code>description</code>以避免任何关于如何运行块和需要什么输入的混淆<strong>非常</strong>重要。虽然<code>AutoPipelineBlocks</code>很方便，但如果它没有正确解释，其条件逻辑可能难以理解。",X,R,Ml="创建<code>AutoImageBlocks</code>的一个实例。",D,F,q,N,Tl="对于更复杂的组合，例如在更大的管道中作为子块使用的嵌套<code>AutoPipelineBlocks</code>块，使用<code>get_execution_blocks()</code>方法根据你的输入提取实际运行的块。",P,S,L,G,K,Z,ll;return p=new rl({props:{title:"AutoPipelineBlocks",local:"autopipelineblocks",headingTag:"h1"}}),B=new hl({props:{id:"auto",options:["text-to-image","image-to-image","inpaint"],$$slots:{default:[Bl]},$$scope:{ctx:h}}}),E=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy5tb2R1bGFyX3BpcGVsaW5lcyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUJsb2NrcyUwQSUwQWNsYXNzJTIwQXV0b0ltYWdlQmxvY2tzKEF1dG9QaXBlbGluZUJsb2NrcyklM0ElMEElMjAlMjAlMjAlMjAlMjMlMjAlRTklODAlODklRTYlOEIlQTklRTUlQUQlOTAlRTUlOUQlOTclRTclQjElQkIlRTclOUElODQlRTUlODglOTclRTglQTElQTglMEElMjAlMjAlMjAlMjBibG9ja19jbGFzc2VzJTIwJTNEJTIwJTVCYmxvY2tfaW5wYWludF9jbHMlMkMlMjBibG9ja19pMmlfY2xzJTJDJTIwYmxvY2tfdDJpX2NscyU1RCUwQSUyMCUyMCUyMCUyMCUyMyUyMCVFNiVBRiU4RiVFNCVCOCVBQSVFNSU5RCU5NyVFNyU5QSU4NCVFNSU5MCU4RCVFNyVBNyVCMCVFRiVCQyU4QyVFOSVBMSVCQSVFNSVCQSU4RiVFNyU5QiVCOCVFNSU5MCU4QyUwQSUyMCUyMCUyMCUyMGJsb2NrX25hbWVzJTIwJTNEJTIwJTVCJTIyaW5wYWludCUyMiUyQyUyMCUyMmltZzJpbWclMjIlMkMlMjAlMjJ0ZXh0MmltZyUyMiU1RCUwQSUyMC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MjBuZWl0aGVyJTIwJTYwaW1hZ2UlNjAlMjBub3IlMjAlNjBtYXNrJTYwJTIwaXMlMjBwcm92aWRlZC4lNUNuJTIyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> AutoPipelineBlocks

<span class="hljs-keyword">class</span> <span class="hljs-title class_">AutoImageBlocks</span>(<span class="hljs-title class_ inherited__">AutoPipelineBlocks</span>):
    <span class="hljs-comment"># 选择子块类的列表</span>
    block_classes = [block_inpaint_cls, block_i2i_cls, block_t2i_cls]
    <span class="hljs-comment"># 每个块的名称，顺序相同</span>
    block_names = [<span class="hljs-string">&quot;inpaint&quot;</span>, <span class="hljs-string">&quot;img2img&quot;</span>, <span class="hljs-string">&quot;text2img&quot;</span>]
    <span class="hljs-comment"># 决定运行哪个块的触发输入</span>
    <span class="hljs-comment"># - &quot;mask&quot; 触发修复工作流</span>
    <span class="hljs-comment"># - &quot;image&quot; 触发img2img工作流（但仅在未提供mask时）</span>
    <span class="hljs-comment"># - 如果以上都没有，运行text2img工作流（默认）</span>
    block_trigger_inputs = [<span class="hljs-string">&quot;mask&quot;</span>, <span class="hljs-string">&quot;image&quot;</span>, <span class="hljs-literal">None</span>]
    <span class="hljs-comment"># 对于AutoPipelineBlocks来说，描述极其重要</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">description</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> (
            <span class="hljs-string">&quot;Pipeline generates images given different types of conditions!\\n&quot;</span>
            + <span class="hljs-string">&quot;This is an auto pipeline block that works for text2img, img2img and inpainting tasks.\\n&quot;</span>
            + <span class="hljs-string">&quot; - inpaint workflow is run when \`mask\` is provided.\\n&quot;</span>
            + <span class="hljs-string">&quot; - img2img workflow is run when \`image\` is provided (but only when \`mask\` is not provided).\\n&quot;</span>
            + <span class="hljs-string">&quot; - text2img workflow is run when neither \`image\` nor \`mask\` is provided.\\n&quot;</span>
        )`,wrap:!1}}),F=new _({props:{code:"YXV0b19ibG9ja3MlMjAlM0QlMjBBdXRvSW1hZ2VCbG9ja3MoKQ==",highlighted:"auto_blocks = AutoImageBlocks()",wrap:!1}}),S=new _({props:{code:"YXV0b19ibG9ja3MuZ2V0X2V4ZWN1dGlvbl9ibG9ja3MoJTIybWFzayUyMik=",highlighted:'auto_blocks.get_execution_blocks(<span class="hljs-string">&quot;mask&quot;</span>)',wrap:!1}}),G=new Cl({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/zh/modular_diffusers/auto_pipeline_blocks.md"}}),{c(){J=w("meta"),n=M(),s=w("p"),i=M(),y(p.$$.fragment),d=M(),a=w("p"),a.innerHTML=c,f=M(),u=w("p"),u.innerHTML=$,Y=M(),k=w("p"),k.innerHTML=Ul,O=M(),y(B.$$.fragment),W=M(),Q=w("p"),Q.innerHTML=al,z=M(),b=w("p"),b.innerHTML=tl,H=M(),g=w("p"),g.innerHTML=el,v=M(),y(E.$$.fragment),x=M(),A=w("p"),A.innerHTML=nl,X=M(),R=w("p"),R.innerHTML=Ml,D=M(),y(F.$$.fragment),q=M(),N=w("p"),N.innerHTML=Tl,P=M(),y(S.$$.fragment),L=M(),y(G.$$.fragment),K=M(),Z=w("p"),this.h()},l(l){const U=ml("svelte-u9bgzb",document.head);J=j(U,"META",{name:!0,content:!0}),U.forEach(t),n=T(l),s=j(l,"P",{}),il(s).forEach(t),i=T(l),o(p.$$.fragment,l),d=T(l),a=j(l,"P",{"data-svelte-h":!0}),V(a)!=="svelte-t8sy4p"&&(a.innerHTML=c),f=T(l),u=j(l,"P",{"data-svelte-h":!0}),V(u)!=="svelte-1dx0tz3"&&(u.innerHTML=$),Y=T(l),k=j(l,"P",{"data-svelte-h":!0}),V(k)!=="svelte-1u6c0ae"&&(k.innerHTML=Ul),O=T(l),o(B.$$.fragment,l),W=T(l),Q=j(l,"P",{"data-svelte-h":!0}),V(Q)!=="svelte-15zzyvs"&&(Q.innerHTML=al),z=T(l),b=j(l,"P",{"data-svelte-h":!0}),V(b)!=="svelte-t2lfhl"&&(b.innerHTML=tl),H=T(l),g=j(l,"P",{"data-svelte-h":!0}),V(g)!=="svelte-1h835av"&&(g.innerHTML=el),v=T(l),o(E.$$.fragment,l),x=T(l),A=j(l,"P",{"data-svelte-h":!0}),V(A)!=="svelte-e0psh3"&&(A.innerHTML=nl),X=T(l),R=j(l,"P",{"data-svelte-h":!0}),V(R)!=="svelte-1hrujnn"&&(R.innerHTML=Ml),D=T(l),o(F.$$.fragment,l),q=T(l),N=j(l,"P",{"data-svelte-h":!0}),V(N)!=="svelte-1ul4yal"&&(N.innerHTML=Tl),P=T(l),o(S.$$.fragment,l),L=T(l),o(G.$$.fragment,l),K=T(l),Z=j(l,"P",{}),il(Z).forEach(t),this.h()},h(){cl(J,"name","hf:doc:metadata"),cl(J,"content",kl)},m(l,U){Il(document.head,J),e(l,n,U),e(l,s,U),e(l,i,U),m(p,l,U),e(l,d,U),e(l,a,U),e(l,f,U),e(l,u,U),e(l,Y,U),e(l,k,U),e(l,O,U),m(B,l,U),e(l,W,U),e(l,Q,U),e(l,z,U),e(l,b,U),e(l,H,U),e(l,g,U),e(l,v,U),m(E,l,U),e(l,x,U),e(l,A,U),e(l,X,U),e(l,R,U),e(l,D,U),m(F,l,U),e(l,q,U),e(l,N,U),e(l,P,U),m(S,l,U),e(l,L,U),m(G,l,U),e(l,K,U),e(l,Z,U),ll=!0},p(l,[U]){const pl={};U&2&&(pl.$$scope={dirty:U,ctx:l}),B.$set(pl)},i(l){ll||(I(p.$$.fragment,l),I(B.$$.fragment,l),I(E.$$.fragment,l),I(F.$$.fragment,l),I(S.$$.fragment,l),I(G.$$.fragment,l),ll=!0)},o(l){r(p.$$.fragment,l),r(B.$$.fragment,l),r(E.$$.fragment,l),r(F.$$.fragment,l),r(S.$$.fragment,l),r(G.$$.fragment,l),ll=!1},d(l){l&&(t(n),t(s),t(i),t(d),t(a),t(f),t(u),t(Y),t(k),t(O),t(W),t(Q),t(z),t(b),t(H),t(g),t(v),t(x),t(A),t(X),t(R),t(D),t(q),t(N),t(P),t(L),t(K),t(Z)),t(J),C(p,l),C(B,l),C(E,l),C(F,l),C(S,l),C(G,l)}}}const kl='{"title":"AutoPipelineBlocks","local":"autopipelineblocks","sections":[],"depth":1}';function Ql(h){return jl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Fl extends yl{constructor(J){super(),ol(this,J,Ql,fl,wl,{})}}export{Fl as component};
