1import{R as A,T as f,U as P}from"./i18n-BlwlR3g4.js";import{E as K,I as N,V as O,W as Q,H as Z,X as tt,D as st,A as it,Y as et,y as rt}from"./i18n-BlwlR3g4.js";import{u as R,w as U,x as L,M as u}from"./index-B5CnGmTK.js";import{d as W}from"./index-tFQomdd2.js";import{b as k}from"./utils.svelte-Cn7aBojF.js";import{I as nt}from"./utils.svelte-Cn7aBojF.js";import"./clone-CePNcxlk.js";const D={walkthrough:"tabs",walkthroughstep:"tabitem"};function g(t){const s=new URL(t.root),i=s.pathname.endsWith("/")?s.pathname:s.pathname+"/",e=t.api_prefix.startsWith("/")?t.api_prefix:"/"+t.api_prefix;return new URL(i.slice(0,-1)+e,s.origin).toString()}class F{#p;#i;#e;reactive_formatter=s=>s;#t;client;#a=R();get root(){return U(this.#a)}set root(s){L(this.#a,s,!0)}root_untracked;#l=new Set;#c=new Set;#u=[];#h=new Map;#s=new Map;#r=new Map;#n;component_ids;initial_tabs={};components_to_register=new Set;ready;ready_resolve;resolved=!1;#o=new Set;constructor(s,i,e,r,o,n,p){this.ready=new Promise(l=>{this.ready_resolve=l}),this.reactive_formatter=n;const a=g(r);this.#t={...r,api_url:a},this.#p=s,this.#i=i,this.#e=e,this.#n=p,this.root=this.create_node({id:i.id,children:[]},new Map,!0);for(const l of s)l.props.visible!=!1&&this.components_to_register.add(l.id);this.client=o,this.prepare();const c=s.reduce((l,_)=>(l.set(_.id,_),l),new Map);this.root.children=this.#i.children.map(l=>this.traverse(l,_=>this.create_node(_,c,!1,this.reactive_formatter))),this.component_ids=s.map(l=>l.id),this.initial_tabs={},m(this.root,this.initial_tabs),this.postprocess(this.root),this.root_untracked=this.root}reload(s,i,e,r){this.#i=i,this.#p=s;const o=g(r);this.#t={...r,api_url:o},this.#e=e,this.root=this.create_node({id:i.id,children:[]},new Map,!0);for(const p of s)p.props.visible!=!1&&this.components_to_register.add(p.id);this.prepare();const n=s.reduce((p,a)=>(p.set(a.id,a),p),new Map);this.root.children=this.#i.children.map(p=>this.traverse(p,a=>this.create_node(a,n,!1,this.reactive_formatter))),this.component_ids=s.map(p=>p.id),this.initial_tabs={},m(this.root,this.initial_tabs),this.postprocess(this.root)}register_component(s,i,e){this.#s.set(s,i),this.#h.set(s,e),this.components_to_register.delete(s);const r=this.#r.get(s);r&&(this.#r.delete(s),u().then(()=>{const o=this.#s.get(s);o&&o(r)})),this.components_to_register.size===0&&!this.resolved&&(this.resolved=!0,this.ready_resolve())}prepare(){const[s,i]=A(this.#e);this.#l=s,this.#c=i}process(){}postprocess(s){this.root=this.traverse(s,[i=>v(i,this.#t.api_url),i=>B(i,this.components_to_register),i=>w(i,this.initial_tabs),i=>this.find_attached_events(i,this.#e),i=>C(i,this.components_to_register,this.#o)])}find_attached_events(s,i){const e=i.filter(r=>r.targets.find(([o])=>o===s.id)).map(r=>{const o=r.targets.find(([n])=>n===s.id);return o?o[1]:null}).filter(Boolean);return s.props.shared_props.attached_events=e,s}traverse(s,i){function e(r,o,n){const p=o(r);return"children"in r&&r.children.length>0&&(p.children=r.children?.map(a=>n(a,o))||[]),p}if(Array.isArray(i)){let r=s;for(const o of i)r=e(r,o,this.traverse.bind(this));return r}else return e(s,i,this.traverse.bind(this))}create_node(s,i,e=!1,r){let o;if(e?o={type:"column",id:s.id,props:{visible:!0,root:"",theme_mode:"light",scale:this.#t.fill_height?1:null},component_class_id:"column",key:null}:o=i.get(s.id),!o)throw new Error(`Component with ID ${s.id} not found`);r&&(o.props.i18n=r);const n=q(s.id,o.props,[this.#l,this.#c],this.client,this.#t.api_url,{...this.#t,register_component:this.register_component.bind(this),dispatcher:this.#n.bind(this)}),p=D[o.type]||o.type,a=n.shared_props.visible!==!1?f(o.type,o.component_class_id,this.#t.api_url||""):null;return{id:s.id,type:p,props:n,children:[],show_progress_on:null,component_class_id:o.component_class_id||o.type,component:n.shared_props.visible!==!1&&a?.component||null,runtime:a?.runtime||!1,key:o.key,rendered_in:o.rendered_in,documentation:o.documentation,original_visibility:n.shared_props.visible}}rerender(s,i){const e=s.reduce((p,a)=>(p.set(a.id,a),p),new Map),r=this.traverse(i,p=>this.create_node(p,e,!1,this.reactive_formatter));m(r,this.initial_tabs);const o=this.traverse(r,p=>
1w(p,this.initial_tabs)),n=h(this.root,o.id);if(!n)throw new Error("Rerender failed: root node not found in current tree");n.children=o.children}async update_state(s,i,e=!0){const r=h(this.root,s);let o=!1;e&&!r?.component&&(await u(),this.root=this.traverse(this.root,[p=>z(p,s,i.visible),p=>v(p,this.#t.api_url)]),await u(),o=!0);const n=this.#s.get(s);if(n)n&&n(i);else{const p=r?.props.props.value,a=M(i);for(const l in a.shared_props)r.props.shared_props[l]=a.shared_props[l];for(const l in a.props)r.props.props[l]=a.props[l];const c=this.#r.get(s)||{};this.#r.set(s,{...c,...i}),"value"in i&&!W(p,i.value)&&this.#n(s,"change",null),r?.type==="tabitem"&&this.#_(s,r)}!e||o||(await u(),await this.update_visibility(r,i))}async update_visibility(s,i){s.children.forEach(e=>{const r=this.#s.get(e.id);r&&r(i),this.update_visibility(e,i)})}#_(s,i){const e=S(this.root,s);if(!e||e.type!=="tabs")return;const r=e.props.props.initial_tabs;if(!r)return;const o=r.findIndex(l=>l.component_id===i.id);if(o===-1)return;const n=i.props.props.i18n,p=i.props.shared_props.label,a="original_visibility"in i?i.original_visibility:i.props.shared_props.visible;r[o]={label:n?n(p):p,id:i.props.props.id,elem_id:i.props.shared_props.elem_id,visible:a,interactive:i.props.shared_props.interactive,scale:i.props.shared_props.scale||null,component_id:i.id},e.props.props.initial_tabs=[...r];const c=this.#s.get(e.id);c&&c({initial_tabs:e.props.props.initial_tabs})}async get_state(s){const i=this.#h.get(s),e=h(this.root,s);return!i&&!e?null:i?await i():e?Promise.resolve({value:e.props.props.value}):null}async render_previously_invisible_children(s){const i=h(this.root,s);i&&(!this.#o.has(i.id)&&!E(i,this.#o)||(b(i,this.#o,!0),x(i,this.#t.api_url)))}}function b(t,s,i=!1){if(t.props.shared_props.visible=s.has(t.id)?!0:t.props.shared_props.visible,t.type==="tabs"){const e=t.props.props.selected??t.props.props.initial_tabs?.[0]?.id;t.children.forEach(r=>{r.type==="tabitem"&&(r.props.props.id===e||r.id===e)&&b(r,s,!1)})}else t.type==="accordion"&&t.props.props.open===!1&&!i||t.children.forEach(e=>{b(e,s,!1)})}function E(t,s){for(const i of t.children)if(s.has(i.id)||E(i,s))return!0;return!1}function x(t,s){t.props.shared_props.visible&&!t.component&&(t.component=f(t.type,t.component_class_id,s)),t.children.forEach(i=>x(i,s))}function T(t,s,i){return s?s.reduce((e,r)=>(e[r]=async(...o)=>(o.length===1&&(o=o[0]),await i.component_server(t,r,o)),e),{}):{}}function M(t){const s={},i={};for(const e in t)if(e==="id"||e==="autoscroll")i[e]=t[e];else if(k.includes(e)){const r=e;s[r]=t[e]}else i[e]=t[e];return{shared_props:s,props:i}}function q(t,s,i,e,r,o={}){const{shared_props:n,props:p}=M(s);n.server=T(t,s.server_fns,e);for(const a in o)if(k.includes(a)){const c=a;n[c]=o[a]}else p[a]=o[a];return n.client=e,n.id=t,n.interactive=P(t,n.interactive,p.value,i),n.load_component=(a,c,l)=>f(a,l||"",r,c),n.visible=n.visible===void 0?!0:n.visible,n.loading_status={},{shared_props:n,props:p}}function v(t,s){if(t.props.shared_props.visible&&!t.component){const i=f(t.type,t.component_class_id,s),e={...t,component:i.component,children:[]};return t.children&&(e.children=t.children.map(r=>v(r,s))),e}else return t}function z(t,s,i){return t.id==s&&(t.props.shared_props.visible=i),t}function d(t,s){s.delete(t.id),t.children&&t.children.forEach(i=>d(i,s))}function B(t,s){return t.props.shared_props.visible!==!0&&d(t,s),t}function y(t,s){return t.props.shared_props.visible===!0&&(s.add(t.id),t.props.shared_props.visible=!1),t.children.forEach(i=>{y(i,s)}),t}function C(t,s,i){return t.type==="accordion"&&t.props.props.open===!1&&(d(t,s),t.children&&t.children.forEach(e=>{y(e,i)})),t.type==="tabs"&&t.children.forEach(e=>{e.type==="tabitem"&&e.props.props.id!==(t.props.props.selected||t.props.props.initial_tabs[0].id)&&(d(e,s),y(e,i))}),t}function w(t,s){if(t.type==="tabs"&&t.id in s){const i=s[t.id].sort((e,r)=>e.order-r.order);t.props.props.initial_tabs=i}else t.type==="tabitem"&&(t.props.props.component_id=t.id);return t}function I(t,s,i,e){if(i!==null&&t.type==="tabitem"){i in s||(s[i]=[]),"id"in t.props.props||(t.props.props.id=t.id);const r=t.props.props.i18n,o=t.props.shared_props.label;s[i].push({label:r?r(o):o,id:t.props.props.id,elem_id:t.props.shared_props.elem_id,visible:t.props.shared_props.visible,interactive:t.props.shared_props.interactive,scale:t.props.shared_props.scale||null,component_id:t.id}),t.props.props.order=e}
1t.children&&t.children.forEach((r,o)=>{I(r,s,t.type==="tabs"?t.id:null,t.type==="tabs"?o:null)})}function m(t,s){function i(e){"children"in e&&e.children.length>0&&e.children?.forEach(r=>I(r,s,e.type==="tabs"?e.id:null,null))}return i(t)}function h(t,s){if(t.id===s)return t;if(t.children)for(const i of t.children){const e=h(i,s);if(e)return e}return null}function S(t,s){if(t.children)for(const i of t.children){if(i.id===s)return t;const e=S(i,s);if(e)return e}return null}export{F as AppTree,K as Embed,N as changeLocale,O as get_initial_locale,nt as i18n_marker,Q as is_translation_metadata,Z as language_choices,tt as load_translations,st as mount_css,it as prefix_css,et as process_langs,rt as setupi18n};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.