var de=Object.defineProperty,_e=Object.defineProperties;var pe=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var Z=(a,e,t)=>e in a?de(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,b=(a,e)=>{for(var t in e||(e={}))ee.call(e,t)&&Z(a,t,e[t]);if(B)for(var t of B(e))te.call(e,t)&&Z(a,t,e[t]);return a},W=(a,e)=>_e(a,pe(e));var se=(a,e)=>{var t={};for(var r in a)ee.call(a,r)&&e.indexOf(r)<0&&(t[r]=a[r]);if(a!=null&&B)for(var r of B(a))e.indexOf(r)<0&&te.call(a,r)&&(t[r]=a[r]);return t};import{S as ge,i as me,s as we,e as be,c as ve,a as ye,d as R,b as G,f as U,g as x,t as ke,h as $e,j as Ee,k as Re,l as v,m as Le,n as I,o as y,p as D,q as k,r as Se,u as xe,v as F,w as O,x as C,y as A,z as j,A as q,B as P,C as z,D as Y,E as re}from"./chunks/vendor-hf-doc-builder.js";import{s as Oe,b as Ae}from"./chunks/paths-hf-doc-builder.js";function Pe(a){let e,t,r;const o=[a[1]||{}];var i=a[0][0];function l(s){let n={};for(let c=0;c<o.length;c+=1)n=z(n,o[c]);return{props:n}}return i&&(e=new i(l())),{c(){e&&O(e.$$.fragment),t=v()},l(s){e&&C(e.$$.fragment,s),t=v()},m(s,n){e&&A(e,s,n),x(s,t,n),r=!0},p(s,n){const c=n&2?j(o,[q(s[1]||{})]):{};if(i!==(i=s[0][0])){if(e){I();const f=e;y(f.$$.fragment,1,0,()=>{P(f,1)}),D()}i?(e=new i(l()),O(e.$$.fragment),k(e.$$.fragment,1),A(e,t.parentNode,t)):e=null}else i&&e.$set(c)},i(s){r||(e&&k(e.$$.fragment,s),r=!0)},o(s){e&&y(e.$$.fragment,s),r=!1},d(s){s&&R(t),e&&P(e,s)}}}function Te(a){let e,t,r;const o=[a[1]||{}];var i=a[0][0];function l(s){let n={$$slots:{default:[De]},$$scope:{ctx:s}};for(let c=0;c<o.length;c+=1)n=z(n,o[c]);return{props:n}}return i&&(e=new i(l(a))),{c(){e&&O(e.$$.fragment),t=v()},l(s){e&&C(e.$$.fragment,s),t=v()},m(s,n){e&&A(e,s,n),x(s,t,n),r=!0},p(s,n){const c=n&2?j(o,[q(s[1]||{})]):{};if(n&525&&(c.$$scope={dirty:n,ctx:s}),i!==(i=s[0][0])){if(e){I();const f=e;y(f.$$.fragment,1,0,()=>{P(f,1)}),D()}i?(e=new i(l(s)),O(e.$$.fragment),k(e.$$.fragment,1),A(e,t.parentNode,t)):e=null}else i&&e.$set(c)},i(s){r||(e&&k(e.$$.fragment,s),r=!0)},o(s){e&&y(e.$$.fragment,s),r=!1},d(s){s&&R(t),e&&P(e,s)}}}function Ue(a){let e,t,r;const o=[a[2]||{}];var i=a[0][1];function l(s){let n={};for(let c=0;c<o.length;c+=1)n=z(n,o[c]);return{props:n}}return i&&(e=new i(l())),{c(){e&&O(e.$$.fragment),t=v()},l(s){e&&C(e.$$.fragment,s),t=v()},m(s,n){e&&A(e,s,n),x(s,t,n),r=!0},p(s,n){const c=n&4?j(o,[q(s[2]||{})]):{};if(i!==(i=s[0][1])){if(e){I();const f=e;y(f.$$.fragment,1,0,()=>{P(f,1)}),D()}i?(e=new i(l()),O(e.$$.fragment),k(e.$$.fragment,1),A(e,t.parentNode,t)):e=null}else i&&e.$set(c)},i(s){r||(e&&k(e.$$.fragment,s),r=!0)},o(s){e&&y(e.$$.fragment,s),r=!1},d(s){s&&R(t),e&&P(e,s)}}}function Ve(a){let e,t,r;const o=[a[2]||{}];var i=a[0][1];function l(s){let n={$$slots:{default:[Ie]},$$scope:{ctx:s}};for(let c=0;c<o.length;c+=1)n=z(n,o[c]);return{props:n}}return i&&(e=new i(l(a))),{c(){e&&O(e.$$.fragment),t=v()},l(s){e&&C(e.$$.fragment,s),t=v()},m(s,n){e&&A(e,s,n),x(s,t,n),r=!0},p(s,n){const c=n&4?j(o,[q(s[2]||{})]):{};if(n&521&&(c.$$scope={dirty:n,ctx:s}),i!==(i=s[0][1])){if(e){I();const f=e;y(f.$$.fragment,1,0,()=>{P(f,1)}),D()}i?(e=new i(l(s)),O(e.$$.fragment),k(e.$$.fragment,1),A(e,t.parentNode,t)):e=null}else i&&e.$set(c)},i(s){r||(e&&k(e.$$.fragment,s),r=!0)},o(s){e&&y(e.$$.fragment,s),r=!1},d(s){s&&R(t),e&&P(e,s)}}}function Ie(a){let e,t,r;const o=[a[3]||{}];var i=a[0][2];function l(s){let n={};for(let c=0;c<o.length;c+=1)n=z(n,o[c]);return{props:n}}return i&&(e=new i(l())),{c(){e&&O(e.$$.fragment),t=v()},l(s){e&&C(e.$$.fragment,s),t=v()},m(s,n){e&&A(e,s,n),x(s,t,n),r=!0},p(s,n){const c=n&8?j(o,[q(s[3]||{})]):{};if(i!==(i=s[0][2])){if(e){I();const f=e;y(f.$$.fragment,1,0,()=>{P(f,1)}),D()}i?(e=new i(l()),O(e.$$.fragment),k(e.$$.fragment,1),A(e,t.parentNode,t)):e=null}else i&&e.$set(c)},i(s){r||(e&&k(e.$$.fragment,s),r=!0)},o(s){e&&y(e.$$.fragment,s),r=!1},d(s){s&&R(t),e&&P(e,s)}}}function De(a){let e,t,r,o;const i=[Ve,Ue],l=[];function s(n,c){return n[0][2]?0:1}return e=s(a),t=l[e]=i[e](a),{c(){t.c(),r=v()},l(n){t.l(n),r=v()},m(n,c){l[e].m(n,c),x(n,r,c),o=!0},p(n,c){let f=e;e=s(n),e===f?l[e].p(n,c):(I(),y(l[f],1,1,()=>{l[f]=null}),D(),t=l[e],t?t.p(n,c):(t=l[e]=i[e](n),t.c()),k(t,1),t.m(r.parentNode,r))},i(n){o||(k(t),o=!0)},o(n){y(t),o=!1},d(n){l[e].d(n),n&&R(r)}}}function ie(a){let e,t=a[5]&&ne(a);return{c(){e=be("div"),t&&t.c(),this.h()},l(r){e=ve(r,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var o=ye(e);t&&t.l(o),o.forEach(R),this.h()},h(){G(e,"id","svelte-announcer"),G(e,"aria-live","assertive"),G(e,"aria-atomic","true"),U(e,"position","absolute"),U(e,"left","0"),U(e,"top","0"),U(e,"clip","rect(0 0 0 0)"),U(e,"clip-path","inset(50%)"),U(e,"overflow","hidden"),U(e,"white-space","nowrap"),U(e,"width","1px"),U(e,"height","1px")},m(r,o){x(r,e,o),t&&t.m(e,null)},p(r,o){r[5]?t?t.p(r,o):(t=ne(r),t.c(),t.m(e,null)):t&&(t.d(1),t=null)},d(r){r&&R(e),t&&t.d()}}}function ne(a){let e;return{c(){e=ke(a[6])},l(t){e=$e(t,a[6])},m(t,r){x(t,e,r)},p(t,r){r&64&&Ee(e,t[6])},d(t){t&&R(e)}}}function Ne(a){let e,t,r,o,i;const l=[Te,Pe],s=[];function n(f,h){return f[0][1]?0:1}e=n(a),t=s[e]=l[e](a);let c=a[4]&&ie(a);return{c(){t.c(),r=Re(),c&&c.c(),o=v()},l(f){t.l(f),r=Le(f),c&&c.l(f),o=v()},m(f,h){s[e].m(f,h),x(f,r,h),c&&c.m(f,h),x(f,o,h),i=!0},p(f,[h]){let u=e;e=n(f),e===u?s[e].p(f,h):(I(),y(s[u],1,1,()=>{s[u]=null}),D(),t=s[e],t?t.p(f,h):(t=s[e]=l[e](f),t.c()),k(t,1),t.m(r.parentNode,r)),f[4]?c?c.p(f,h):(c=ie(f),c.c(),c.m(o.parentNode,o)):c&&(c.d(1),c=null)},i(f){i||(k(t),i=!0)},o(f){y(t),i=!1},d(f){s[e].d(f),f&&R(r),c&&c.d(f),f&&R(o)}}}function Ce(a,e,t){let{stores:r}=e,{page:o}=e,{components:i}=e,{props_0:l=null}=e,{props_1:s=null}=e,{props_2:n=null}=e;Se("__svelte__",r),xe(r.page.notify);let c=!1,f=!1,h=null;return F(()=>{const u=r.page.subscribe(()=>{c&&(t(5,f=!0),t(6,h=document.title||"untitled page"))});return t(4,c=!0),u}),a.$$set=u=>{"stores"in u&&t(7,r=u.stores),"page"in u&&t(8,o=u.page),"components"in u&&t(0,i=u.components),"props_0"in u&&t(1,l=u.props_0),"props_1"in u&&t(2,s=u.props_1),"props_2"in u&&t(3,n=u.props_2)},a.$$.update=()=>{a.$$.dirty&384&&r.page.set(o)},[i,l,s,n,c,f,h,r,o]}class je extends ge{constructor(e){super();me(this,e,Ce,Ne,we,{stores:7,page:8,components:0,props_0:1,props_1:2,props_2:3})}}const qe="modulepreload",ae={},ze="/docs/optimum/pr_360/en/_app/",$=function(e,t){return!t||t.length===0?e():Promise.all(t.map(r=>{if(r=`${ze}${r}`,r in ae)return;ae[r]=!0;const o=r.endsWith(".css"),i=o?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${i}`))return;const l=document.createElement("link");if(l.rel=o?"stylesheet":qe,o||(l.as="script",l.crossOrigin=""),l.href=r,document.head.appendChild(l),o)return new Promise((s,n)=>{l.addEventListener("load",s),l.addEventListener("error",n)})})).then(()=>e())},d=[()=>$(()=>import("./pages/__layout.svelte-hf-doc-builder.js"),["pages/__layout.svelte-hf-doc-builder.js","assets/pages/__layout.svelte-hf-doc-builder.css","chunks/vendor-hf-doc-builder.js","chunks/paths-hf-doc-builder.js"]),()=>$(()=>import("./error.svelte-hf-doc-builder.js"),["error.svelte-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js"]),()=>$(()=>import("./pages/index.mdx-hf-doc-builder.js"),["pages/index.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js","chunks/CodeBlock-hf-doc-builder.js"]),()=>$(()=>import("./pages/modeling_base.mdx-hf-doc-builder.js"),["pages/modeling_base.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/Docstring-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js"]),()=>$(()=>import("./pages/onnxruntime/configuration.mdx-hf-doc-builder.js"),["pages/onnxruntime/configuration.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/Docstring-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js"]),()=>$(()=>import("./pages/onnxruntime/modeling_ort.mdx-hf-doc-builder.js"),["pages/onnxruntime/modeling_ort.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/Tip-hf-doc-builder.js","chunks/Docstring-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js","chunks/CodeBlock-hf-doc-builder.js","chunks/ExampleCodeBlock-hf-doc-builder.js"]),()=>$(()=>import("./pages/onnxruntime/optimization.mdx-hf-doc-builder.js"),["pages/onnxruntime/optimization.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/Docstring-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js","chunks/CodeBlock-hf-doc-builder.js"]),()=>$(()=>import("./pages/onnxruntime/quantization.mdx-hf-doc-builder.js"),["pages/onnxruntime/quantization.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/Docstring-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js","chunks/CodeBlock-hf-doc-builder.js"]),()=>$(()=>import("./pages/onnxruntime/trainer.mdx-hf-doc-builder.js"),["pages/onnxruntime/trainer.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/Tip-hf-doc-builder.js","chunks/Docstring-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js"]),()=>$(()=>import("./pages/quickstart.mdx-hf-doc-builder.js"),["pages/quickstart.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js","chunks/CodeBlock-hf-doc-builder.js"]),()=>$(()=>import("./pages/benchmark.mdx-hf-doc-builder.js"),["pages/benchmark.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/Docstring-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js"]),()=>$(()=>import("./pages/pipelines.mdx-hf-doc-builder.js"),["pages/pipelines.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/Tip-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js","chunks/CodeBlock-hf-doc-builder.js"]),()=>$(()=>import("./pages/fx/optimization.mdx-hf-doc-builder.js"),["pages/fx/optimization.mdx-hf-doc-builder.js","chunks/vendor-hf-doc-builder.js","chunks/Docstring-hf-doc-builder.js","chunks/IconCopyLink-hf-doc-builder.js","chunks/CodeBlock-hf-doc-builder.js","chunks/ExampleCodeBlock-hf-doc-builder.js"])],Je=[[/^\/$/,[d[0],d[2]],[d[1]]],[/^\/modeling_base\/?$/,[d[0],d[3]],[d[1]]],[/^\/onnxruntime\/configuration\/?$/,[d[0],d[4]],[d[1]]],[/^\/onnxruntime\/modeling_ort\/?$/,[d[0],d[5]],[d[1]]],[/^\/onnxruntime\/optimization\/?$/,[d[0],d[6]],[d[1]]],[/^\/onnxruntime\/quantization\/?$/,[d[0],d[7]],[d[1]]],[/^\/onnxruntime\/trainer\/?$/,[d[0],d[8]],[d[1]]],[/^\/quickstart\/?$/,[d[0],d[9]],[d[1]]],[/^\/benchmark\/?$/,[d[0],d[10]],[d[1]]],[/^\/pipelines\/?$/,[d[0],d[11]],[d[1]]],[/^\/fx\/optimization\/?$/,[d[0],d[12]],[d[1]]]],Ke=[d[0](),d[1]()];function Be(a){let e=a.baseURI;if(!e){const t=a.getElementsByTagName("base");e=t.length?t[0].href:a.URL}return e}function We(a,e){return a==="/"||e==="ignore"?a:e==="never"?a.endsWith("/")?a.slice(0,-1):a:e==="always"&&/\/[^./]+$/.test(a)?a+"/":a}const he="sveltekit:scroll";let N={};try{N=JSON.parse(sessionStorage[he])}catch{}function M(a){N[a]=X()}function X(){return{x:pageXOffset,y:pageYOffset}}function oe(a){return a.composedPath().find(t=>t instanceof Node&&t.nodeName.toUpperCase()==="A")}function le(a){return a instanceof SVGAElement?new URL(a.href.baseVal,document.baseURI):new URL(a.href)}class Ye{constructor({base:e,routes:t,trailing_slash:r,renderer:o}){var l,s;this.base=e,this.routes=t,this.trailing_slash=r,this.navigating=0,this.renderer=o,o.router=this,this.enabled=!0,this.initialized=!1,document.body.setAttribute("tabindex","-1"),this.current_history_index=(s=(l=history.state)==null?void 0:l["sveltekit:index"])!=null?s:0,this.current_history_index===0&&history.replaceState(W(b({},history.state),{"sveltekit:index":0}),"",location.href);const i=N[this.current_history_index];i&&scrollTo(i.x,i.y),this.hash_navigating=!1,this.callbacks={before_navigate:[],after_navigate:[]}}init_listeners(){history.scrollRestoration="manual",addEventListener("beforeunload",o=>{let i=!1;const l={from:this.renderer.current.url,to:null,cancel:()=>i=!0};this.callbacks.before_navigate.forEach(s=>s(l)),i?(o.preventDefault(),o.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){M(this.current_history_index);try{sessionStorage[he]=JSON.stringify(N)}catch{}}});const e=o=>{const i=oe(o);i&&i.href&&i.hasAttribute("sveltekit:prefetch")&&this.prefetch(le(i))};let t;const r=o=>{clearTimeout(t),t=setTimeout(()=>{var i;(i=o.target)==null||i.dispatchEvent(new CustomEvent("sveltekit:trigger_prefetch",{bubbles:!0}))},20)};addEventListener("touchstart",e),addEventListener("mousemove",r),addEventListener("sveltekit:trigger_prefetch",e),addEventListener("click",o=>{if(!this.enabled||o.button||o.which!==1||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey||o.defaultPrevented)return;const i=oe(o);if(!i||!i.href)return;const l=i instanceof SVGAElement,s=le(i);if(s.toString()===location.href){location.hash||o.preventDefault();return}if(!l&&s.origin==="null")return;const c=(i.getAttribute("rel")||"").split(/\s+/);if(i.hasAttribute("download")||c&&c.includes("external")||(l?i.target.baseVal:i.target))return;const[f,h]=s.href.split("#");if(h!==void 0&&f===location.href.split("#")[0]){this.hash_navigating=!0,M(this.current_history_index),this.renderer.update_page_store(new URL(s.href));return}this._navigate({url:s,scroll:i.hasAttribute("sveltekit:noscroll")?X():null,keepfocus:!1,chain:[],details:{state:{},replaceState:!1},accepted:()=>o.preventDefault(),blocked:()=>o.preventDefault()})}),addEventListener("popstate",o=>{if(o.state&&this.enabled){if(o.state["sveltekit:index"]===this.current_history_index)return;this._navigate({url:new URL(location.href),scroll:N[o.state["sveltekit:index"]],keepfocus:!1,chain:[],details:null,accepted:()=>{this.current_history_index=o.state["sveltekit:index"]},blocked:()=>{const i=this.current_history_index-o.state["sveltekit:index"];history.go(i)}})}}),addEventListener("hashchange",()=>{this.hash_navigating&&(this.hash_navigating=!1,history.replaceState(W(b({},history.state),{"sveltekit:index":++this.current_history_index}),"",location.href))}),this.initialized=!0}owns(e){return e.origin===location.origin&&e.pathname.startsWith(this.base)}parse(e){if(this.owns(e)){const t=decodeURI(e.pathname.slice(this.base.length)||"/");return{id:e.pathname+e.search,routes:this.routes.filter(([r])=>r.test(t)),url:e,path:t,initial:!this.initialized}}}async goto(e,{noscroll:t=!1,replaceState:r=!1,keepfocus:o=!1,state:i={}}={},l){const s=new URL(e,Be(document));return this.enabled?this._navigate({url:s,scroll:t?X():null,keepfocus:o,chain:l,details:{state:i,replaceState:r},accepted:()=>{},blocked:()=>{}}):(location.href=s.href,new Promise(()=>{}))}enable(){this.enabled=!0}disable(){this.enabled=!1}async prefetch(e){const t=this.parse(e);if(!t)throw new Error("Attempted to prefetch a URL that does not belong to this app");return this.renderer.load(t)}after_navigate(e){F(()=>(this.callbacks.after_navigate.push(e),()=>{const t=this.callbacks.after_navigate.indexOf(e);this.callbacks.after_navigate.splice(t,1)}))}before_navigate(e){F(()=>(this.callbacks.before_navigate.push(e),()=>{const t=this.callbacks.before_navigate.indexOf(e);this.callbacks.before_navigate.splice(t,1)}))}async _navigate({url:e,scroll:t,keepfocus:r,chain:o,details:i,accepted:l,blocked:s}){const n=this.renderer.current.url;let c=!1;const f={from:n,to:e,cancel:()=>c=!0};if(this.callbacks.before_navigate.forEach(p=>p(f)),c){s();return}const h=this.parse(e);if(!h)return location.href=e.href,new Promise(()=>{});M(this.current_history_index),l(),this.navigating++;const u=We(e.pathname,this.trailing_slash);h.url=new URL(e.origin+u+e.search+e.hash);const _=this.navigating_token={};if(await this.renderer.handle_navigation(h,o,!1,{scroll:t,keepfocus:r}),this.navigating--,this.navigating_token===_){if(!this.navigating){const p={from:n,to:e};this.callbacks.after_navigate.forEach(T=>T(p))}if(i){const p=i.replaceState?0:1;i.state["sveltekit:index"]=this.current_history_index+=p,history[i.replaceState?"replaceState":"pushState"](i.state,"",h.url)}}}}function ce(a){return a instanceof Error||a&&a.name&&a.message?a:new Error(JSON.stringify(a))}function Ge(a){let e=5381,t=a.length;if(typeof a=="string")for(;t;)e=e*33^a.charCodeAt(--t);else for(;t;)e=e*33^a[--t];return(e>>>0).toString(36)}function fe(a){const e=a.status&&a.status>=400&&a.status<=599&&!a.redirect;if(a.error||e){const t=a.status;if(!a.error&&e)return{status:t||500,error:new Error};const r=typeof a.error=="string"?new Error(a.error):a.error;return r instanceof Error?!t||t<400||t>599?(console.warn('"error" returned from load() without a valid status code \u2014 defaulting to 500'),{status:500,error:r}):{status:t,error:r}:{status:500,error:new Error(`"error" property returned from load() must be a string or instance of Error, received type "${typeof r}"`)}}if(a.redirect){if(!a.status||Math.floor(a.status/100)!==3)return{status:500,error:new Error('"redirect" property returned from load() must be accompanied by a 3xx status code')};if(typeof a.redirect!="string")return{status:500,error:new Error('"redirect" property returned from load() must be a string')}}if(a.context)throw new Error('You are returning "context" from a load function. "context" was renamed to "stuff", please adjust your code accordingly.');return a}function ue(a){const e=Y(a);let t=!0;function r(){t=!0,e.update(l=>l)}function o(l){t=!1,e.set(l)}function i(l){let s;return e.subscribe(n=>{(s===void 0||t&&n!==s)&&l(s=n)})}return{notify:r,set:o,subscribe:i}}function Me(){const{set:a,subscribe:e}=Y(!1),t="1661413387256";let r;async function o(){clearTimeout(r);const l=await fetch(`${Ae}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(l.ok){const{version:s}=await l.json(),n=s!==t;return n&&(a(!0),clearTimeout(r)),n}else throw new Error(`Version check failed: ${l.status}`)}return{subscribe:e,check:o}}function Fe(a,e){const t=typeof a=="string"?a:a.url;let r=`script[data-type="svelte-data"][data-url=${JSON.stringify(t)}]`;e&&typeof e.body=="string"&&(r+=`[data-body="${Ge(e.body)}"]`);const o=document.querySelector(r);if(o&&o.textContent){const i=JSON.parse(o.textContent),{body:l}=i,s=se(i,["body"]);return Promise.resolve(new Response(l,s))}return fetch(a,e)}class Xe{constructor({Root:e,fallback:t,target:r,session:o}){this.Root=e,this.fallback=t,this.router,this.target=r,this.started=!1,this.session_id=1,this.invalid=new Set,this.invalidating=null,this.autoscroll=!0,this.updating=!1,this.current={url:null,session_id:0,branch:[]},this.cache=new Map,this.loading={id:null,promise:null},this.stores={url:ue({}),page:ue({}),navigating:Y(null),session:Y(o),updated:Me()},this.$session=null,this.root=null;let i=!1;this.stores.session.subscribe(async l=>{if(this.$session=l,!i||!this.router)return;this.session_id+=1;const s=this.router.parse(new URL(location.href));s&&this.update(s,[],!0)}),i=!0}disable_scroll_handling(){(this.updating||!this.started)&&(this.autoscroll=!1)}async start({status:e,error:t,nodes:r,params:o}){const i=new URL(location.href),l=[];let s={},n,c;try{for(let f=0;f<r.length;f+=1){const h=f===r.length-1;let u;if(h){const p=document.querySelector('[data-type="svelte-props"]');p&&(u=JSON.parse(p.textContent))}const _=await this._load_node({module:await r[f],url:i,params:o,stuff:s,status:h?e:void 0,error:h?t:void 0,props:u});if(u&&(_.uses.dependencies.add(i.href),_.uses.url=!0),l.push(_),_&&_.loaded)if(_.loaded.error){if(t)throw _.loaded.error;c={status:_.loaded.status,error:_.loaded.error,url:i}}else _.loaded.stuff&&(s=b(b({},s),_.loaded.stuff))}n=c?await this._load_error(c):await this._get_navigation_result_from_branch({url:i,params:o,stuff:s,branch:l,status:e,error:t})}catch(f){if(t)throw f;n=await this._load_error({status:500,error:ce(f),url:i})}if(n.redirect){location.href=new URL(n.redirect,location.href).href;return}this._init(n)}async handle_navigation(e,t,r,o){this.started&&this.stores.navigating.set({from:this.current.url,to:e.url}),await this.update(e,t,r,o)}async update(e,t,r,o){var n,c,f;const i=this.token={};let l=await this._get_navigation_result(e,r);if(!l){location.href=e.url.href;return}if(i!==this.token)return;if(this.invalid.clear(),l.redirect)if(t.length>10||t.includes(e.url.pathname))l=await this._load_error({status:500,error:new Error("Redirect loop"),url:e.url});else{this.router?this.router.goto(new URL(l.redirect,e.url).href,{},[...t,e.url.pathname]):location.href=new URL(l.redirect,location.href).href;return}else if(((c=(n=l.props)==null?void 0:n.page)==null?void 0:c.status)>=400&&await this.stores.updated.check()){location.href=e.url.href;return}if(this.updating=!0,this.started?(this.current=l.state,this.root.$set(l.props),this.stores.navigating.set(null)):this._init(l),o){const{scroll:h,keepfocus:u}=o;if(u||((f=getSelection())==null||f.removeAllRanges(),document.body.focus()),await re(),this.autoscroll){const _=e.url.hash&&document.getElementById(e.url.hash.slice(1));h?scrollTo(h.x,h.y):_?_.scrollIntoView():scrollTo(0,0)}}else await re();if(this.loading.promise=null,this.loading.id=null,this.autoscroll=!0,this.updating=!1,l.props.page&&(this.page=l.props.page),!this.router)return;const s=l.state.branch[l.state.branch.length-1];s&&s.module.router===!1?this.router.disable():this.router.enable()}load(e){return this.loading.promise=this._get_navigation_result(e,!1),this.loading.id=e.id,this.loading.promise}invalidate(e){return this.invalid.add(e),this.invalidating||(this.invalidating=Promise.resolve().then(async()=>{const t=this.router&&this.router.parse(new URL(location.href));t&&await this.update(t,[],!0),this.invalidating=null})),this.invalidating}update_page_store(e){this.stores.page.set(W(b({},this.page),{url:e})),this.stores.page.notify()}_init(e){this.current=e.state;const t=document.querySelector("style[data-svelte]");if(t&&t.remove(),this.page=e.props.page,this.root=new this.Root({target:this.target,props:b({stores:this.stores},e.props),hydrate:!0}),this.started=!0,this.router){const r={from:null,to:new URL(location.href)};this.router.callbacks.after_navigate.forEach(o=>o(r))}}async _get_navigation_result(e,t){if(this.loading.id===e.id&&this.loading.promise)return this.loading.promise;for(let r=0;r<e.routes.length;r+=1){const o=e.routes[r];let i=r+1;for(;i<e.routes.length;){const s=e.routes[i];if(s[0].toString()===o[0].toString())s[1].forEach(n=>n()),i+=1;else break}const l=await this._load({route:o,info:e},t);if(l)return l}if(e.initial)return await this._load_error({status:404,error:new Error(`Not found: ${e.url.pathname}`),url:e.url})}async _get_navigation_result_from_branch({url:e,params:t,stuff:r,branch:o,status:i,error:l}){const s=o.filter(Boolean),n=s.find(u=>u.loaded&&u.loaded.redirect),c={redirect:n&&n.loaded?n.loaded.redirect:void 0,state:{url:e,params:t,branch:o,session_id:this.session_id},props:{components:s.map(u=>u.module.default)}};for(let u=0;u<s.length;u+=1){const _=s[u].loaded;c.props[`props_${u}`]=_?await _.props:null}if(!this.current.url||e.href!==this.current.url.href){c.props.page={url:e,params:t,status:i,error:l,stuff:r};const u=(_,p)=>{Object.defineProperty(c.props.page,_,{get:()=>{throw new Error(`$page.${_} has been replaced by $page.url.${p}`)}})};u("origin","origin"),u("path","pathname"),u("query","searchParams")}const f=s[s.length-1],h=f.loaded&&f.loaded.maxage;if(h){const u=e.pathname+e.search;let _=!1;const p=()=>{this.cache.get(u)===c&&this.cache.delete(u),L(),clearTimeout(T)},T=setTimeout(p,h*1e3),L=this.stores.session.subscribe(()=>{_&&p()});_=!0,this.cache.set(u,c)}return c}async _load_node({status:e,error:t,module:r,url:o,params:i,stuff:l,props:s}){const n={module:r,uses:{params:new Set,url:!1,session:!1,stuff:!1,dependencies:new Set},loaded:null,stuff:l};s&&n.uses.dependencies.add(o.href);const c={};for(const h in i)Object.defineProperty(c,h,{get(){return n.uses.params.add(h),i[h]},enumerable:!0});const f=this.$session;if(r.load){const{started:h}=this,u={params:c,props:s||{},get url(){return n.uses.url=!0,o},get session(){return n.uses.session=!0,f},get stuff(){return n.uses.stuff=!0,b({},l)},fetch(p,T){const L=typeof p=="string"?p:p.url,{href:S}=new URL(L,o);return n.uses.dependencies.add(S),h?fetch(p,T):Fe(p,T)}};t&&(u.status=e,u.error=t);const _=await r.load.call(null,u);if(!_)throw new Error("load function must return a value");n.loaded=fe(_),n.loaded.stuff&&(n.stuff=n.loaded.stuff)}else s&&(n.loaded=fe({props:s}));return n}async _load({route:e,info:{url:t,path:r}},o){const i=t.pathname+t.search;if(!o){const g=this.cache.get(i);if(g)return g}const[l,s,n,c,f]=e,h=c?c(l.exec(r)):{},u=this.current.url&&{url:i!==this.current.url.pathname+this.current.url.search,params:Object.keys(h).filter(g=>this.current.params[g]!==h[g]),session:this.session_id!==this.current.session_id};let _=[],p={},T=!1,L=200,S;s.forEach(g=>g());e:for(let g=0;g<s.length;g+=1){let m;try{if(!s[g])continue;const w=await s[g](),E=this.current.branch[g];if(!E||w!==E.module||u.url&&E.uses.url||u.params.some(V=>E.uses.params.has(V))||u.session&&E.uses.session||Array.from(E.uses.dependencies).some(V=>this.invalid.has(V))||T&&E.uses.stuff){let V={};const H=f&&g===s.length-1;if(H){const K=await fetch(`${t.pathname}${t.pathname.endsWith("/")?"":"/"}__data.json${t.search}`,{headers:{"x-sveltekit-load":"true"}});if(K.ok){const Q=K.headers.get("x-sveltekit-location");if(Q)return{redirect:Q,props:{},state:this.current};V=await K.json()}else L=K.status,S=new Error("Failed to load data")}if(S||(m=await this._load_node({module:w,url:t,params:h,props:V,stuff:p})),m&&(H&&(m.uses.url=!0),m.loaded)){if(m.loaded.fallthrough)return;if(m.loaded.error&&(L=m.loaded.status,S=m.loaded.error),m.loaded.redirect)return{redirect:m.loaded.redirect,props:{},state:this.current};m.loaded.stuff&&(T=!0)}}else m=E}catch(w){L=500,S=ce(w)}if(S){for(;g--;)if(n[g]){let w,E,J=g;for(;!(E=_[J]);)J-=1;try{if(w=await this._load_node({status:L,error:S,module:await n[g](),url:t,params:h,stuff:E.stuff}),w&&w.loaded&&w.loaded.error)continue;w&&w.loaded&&w.loaded.stuff&&(p=b(b({},p),w.loaded.stuff)),_=_.slice(0,J+1).concat(w);break e}catch{continue}}return await this._load_error({status:L,error:S,url:t})}else m&&m.loaded&&m.loaded.stuff&&(p=b(b({},p),m.loaded.stuff)),_.push(m)}return await this._get_navigation_result_from_branch({url:t,params:h,stuff:p,branch:_,status:L,error:S})}async _load_error({status:e,error:t,url:r}){var c,f;const o={},i=await this._load_node({module:await this.fallback[0],url:r,params:o,stuff:{}}),l=await this._load_node({status:e,error:t,module:await this.fallback[1],url:r,params:o,stuff:i&&i.loaded&&i.loaded.stuff||{}}),s=[i,l],n=b(b({},(c=i==null?void 0:i.loaded)==null?void 0:c.stuff),(f=l==null?void 0:l.loaded)==null?void 0:f.stuff);return await this._get_navigation_result_from_branch({url:r,params:o,stuff:n,branch:s,status:e,error:t})}}async function et({paths:a,target:e,session:t,route:r,spa:o,trailing_slash:i,hydrate:l}){const s=new Xe({Root:je,fallback:Ke,target:e,session:t}),n=r?new Ye({base:a.base,routes:Je,trailing_slash:i,renderer:s}):null;Oe(a),l&&await s.start(l),n&&(o&&n.goto(location.href,{replaceState:!0},[]),n.init_listeners()),dispatchEvent(new CustomEvent("sveltekit:start"))}export{et as start};
