@noego/forge 0.1.13 → 0.1.15

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.
package/dist/client.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./page.svelte-Dvj7306U.cjs"),Ie=require("svelte/internal/client"),Ae=require("svelte"),xe=require("../src/components/RecursiveRender.svelte");function Re(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const te=Re(Ie);function Te(e){const r=new b.path_to_regex(e);return t=>{const n=r.match(t);if(!n)return null;const o={};for(const[i,a]of Object.entries(n))o[i]=decodeURIComponent(a);return o}}function je(e){return e.map(r=>{const t=r.path,n=Te(t);return{pattern:t,parser:n}})}var $=function(e,r){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},$(e,r)};function x(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");$(e,r);function t(){this.constructor=e}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}function Ue(e,r,t,n){function o(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(f){try{c(n.next(f))}catch(d){a(d)}}function s(f){try{c(n.throw(f))}catch(d){a(d)}}function c(f){f.done?i(f.value):o(f.value).then(u,s)}c((n=n.apply(e,r||[])).next())})}function re(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(f){return s([c,f])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,o=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=r.call(e,t)}catch(f){c=[6,f],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function P(e){var r=typeof Symbol=="function"&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var n=t.call(e),o,i=[],a;try{for(;(r===void 0||r-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(a)throw a.error}}return i}function G(e,r,t){if(t||arguments.length===2)for(var n=0,o=r.length,i;n<o;n++)(i||!(n in r))&&(i||(i=Array.prototype.slice.call(r,0,n)),i[n]=r[n]);return e.concat(i||Array.prototype.slice.call(r))}function O(e){return this instanceof O?(this.v=e,this):new O(e)}function Ne(e,r,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(e,r||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(l){return function(v){return Promise.resolve(v).then(l,d)}}function u(l,v){n[l]&&(o[l]=function(p){return new Promise(function(g,I){i.push([l,p,g,I])>1||s(l,p)})},v&&(o[l]=v(o[l])))}function s(l,v){try{c(n[l](v))}catch(p){h(i[0][3],p)}}function c(l){l.value instanceof O?Promise.resolve(l.value.v).then(f,d):h(i[0][2],l)}function f(l){s("next",l)}function d(l){s("throw",l)}function h(l,v){l(v),i.shift(),i.length&&s(i[0][0],i[0][1])}}function ke(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e[Symbol.asyncIterator],t;return r?r.call(e):(e=typeof P=="function"?P(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(a){return new Promise(function(u,s){a=e[i](a),o(u,s,a.done,a.value)})}}function o(i,a,u,s){Promise.resolve(s).then(function(c){i({value:c,done:u})},a)}}function m(e){return typeof e=="function"}function ne(e){var r=function(n){Error.call(n),n.stack=new Error().stack},t=e(r);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var M=ne(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./page.svelte-Dvj7306U.cjs"),Ae=require("svelte/internal/client"),Pe=require("svelte"),Ie=require("../src/components/RecursiveRender.svelte");function Te(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const te=Te(Ae);function xe(e){const r=new b.path_to_regex(e);return t=>{const n=r.match(t);if(!n)return null;const o={};for(const[i,a]of Object.entries(n))o[i]=decodeURIComponent(a);return o}}function Re(e){return e.map(r=>{const t=r.path,n=xe(t);return{pattern:t,parser:n}})}var $=function(e,r){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},$(e,r)};function R(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");$(e,r);function t(){this.constructor=e}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}function je(e,r,t,n){function o(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function u(f){try{c(n.next(f))}catch(d){a(d)}}function s(f){try{c(n.throw(f))}catch(d){a(d)}}function c(f){f.done?i(f.value):o(f.value).then(u,s)}c((n=n.apply(e,r||[])).next())})}function re(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(f){return s([c,f])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,o=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=r.call(e,t)}catch(f){c=[6,f],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function I(e){var r=typeof Symbol=="function"&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function D(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var n=t.call(e),o,i=[],a;try{for(;(r===void 0||r-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(a)throw a.error}}return i}function W(e,r,t){if(t||arguments.length===2)for(var n=0,o=r.length,i;n<o;n++)(i||!(n in r))&&(i||(i=Array.prototype.slice.call(r,0,n)),i[n]=r[n]);return e.concat(i||Array.prototype.slice.call(r))}function P(e){return this instanceof P?(this.v=e,this):new P(e)}function Ne(e,r,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(e,r||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(l){return function(p){return Promise.resolve(p).then(l,d)}}function u(l,p){n[l]&&(o[l]=function(v){return new Promise(function(A,E){i.push([l,v,A,E])>1||s(l,v)})},p&&(o[l]=p(o[l])))}function s(l,p){try{c(n[l](p))}catch(v){h(i[0][3],v)}}function c(l){l.value instanceof P?Promise.resolve(l.value.v).then(f,d):h(i[0][2],l)}function f(l){s("next",l)}function d(l){s("throw",l)}function h(l,p){l(p),i.shift(),i.length&&s(i[0][0],i[0][1])}}function Ue(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e[Symbol.asyncIterator],t;return r?r.call(e):(e=typeof I=="function"?I(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(a){return new Promise(function(u,s){a=e[i](a),o(u,s,a.done,a.value)})}}function o(i,a,u,s){Promise.resolve(s).then(function(c){i({value:c,done:u})},a)}}function m(e){return typeof e=="function"}function ne(e){var r=function(n){Error.call(n),n.stack=new Error().stack},t=e(r);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var F=ne(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
2
2
  `+t.map(function(n,o){return o+1+") "+n.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=t}});function z(e,r){if(e){var t=e.indexOf(r);0<=t&&e.splice(t,1)}}var F=(function(){function e(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var r,t,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var u=P(a),s=u.next();!s.done;s=u.next()){var c=s.value;c.remove(this)}}catch(p){r={error:p}}finally{try{s&&!s.done&&(t=u.return)&&t.call(u)}finally{if(r)throw r.error}}else a.remove(this);var f=this.initialTeardown;if(m(f))try{f()}catch(p){i=p instanceof M?p.errors:[p]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var h=P(d),l=h.next();!l.done;l=h.next()){var v=l.value;try{K(v)}catch(p){i=i??[],p instanceof M?i=G(G([],W(i)),W(p.errors)):i.push(p)}}}catch(p){n={error:p}}finally{try{l&&!l.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}}if(i)throw new M(i)}},e.prototype.add=function(r){var t;if(r&&r!==this)if(this.closed)K(r);else{if(r instanceof e){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(r)}},e.prototype._hasParent=function(r){var t=this._parentage;return t===r||Array.isArray(t)&&t.includes(r)},e.prototype._addParent=function(r){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(r),t):t?[t,r]:r},e.prototype._removeParent=function(r){var t=this._parentage;t===r?this._parentage=null:Array.isArray(t)&&z(t,r)},e.prototype.remove=function(r){var t=this._finalizers;t&&z(t,r),r instanceof e&&r._removeParent(this)},e.EMPTY=(function(){var r=new e;return r.closed=!0,r})(),e})(),oe=F.EMPTY;function ie(e){return e instanceof F||e&&"closed"in e&&m(e.remove)&&m(e.add)&&m(e.unsubscribe)}function K(e){m(e)?e():e.unsubscribe()}var Ce={Promise:void 0},Le={setTimeout:function(e,r){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return setTimeout.apply(void 0,G([e,r],W(t)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function ae(e){Le.setTimeout(function(){throw e})}function Q(){}function j(e){e()}var X=(function(e){x(r,e);function r(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,ie(t)&&t.add(n)):n.destination=Me,n}return r.create=function(t,n,o){return new H(t,n,o)},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r})(F),Fe=(function(){function e(r){this.partialObserver=r}return e.prototype.next=function(r){var t=this.partialObserver;if(t.next)try{t.next(r)}catch(n){T(n)}},e.prototype.error=function(r){var t=this.partialObserver;if(t.error)try{t.error(r)}catch(n){T(n)}else T(r)},e.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(t){T(t)}},e})(),H=(function(e){x(r,e);function r(t,n,o){var i=e.call(this)||this,a;return m(t)||!t?a={next:t??void 0,error:n??void 0,complete:o??void 0}:a=t,i.destination=new Fe(a),i}return r})(X);function T(e){ae(e)}function qe(e){throw e}var Me={closed:!0,next:Q,error:qe,complete:Q},B=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Ve(e){return e}function De(e){return e.length===0?Ve:e.length===1?e[0]:function(t){return e.reduce(function(n,o){return o(n)},t)}}var S=(function(){function e(r){r&&(this._subscribe=r)}return e.prototype.lift=function(r){var t=new e;return t.source=this,t.operator=r,t},e.prototype.subscribe=function(r,t,n){var o=this,i=We(r)?r:new H(r,t,n);return j(function(){var a=o,u=a.operator,s=a.source;i.add(u?u.call(i,s):s?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){r.error(t)}},e.prototype.forEach=function(r,t){var n=this;return t=Z(t),new t(function(o,i){var a=new H({next:function(u){try{r(u)}catch(s){i(s),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(r){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(r)},e.prototype[B]=function(){return this},e.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return De(r)(this)},e.prototype.toPromise=function(r){var t=this;return r=Z(r),new r(function(n,o){var i;t.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(r){return new e(r)},e})();function Z(e){var r;return(r=e??Ce.Promise)!==null&&r!==void 0?r:Promise}function $e(e){return e&&m(e.next)&&m(e.error)&&m(e.complete)}function We(e){return e&&e instanceof X||$e(e)&&ie(e)}function Ge(e){return m(e==null?void 0:e.lift)}function J(e){return function(r){if(Ge(r))return r.lift(function(t){try{return e(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Y(e,r,t,n,o){return new ze(e,r,t,n,o)}var ze=(function(e){x(r,e);function r(t,n,o,i,a,u){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=u,s._next=n?function(c){try{n(c)}catch(f){t.error(f)}}:e.prototype._next,s._error=i?function(c){try{i(c)}catch(f){t.error(f)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=o?function(){try{o()}catch(c){t.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,s}return r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},r})(X),He=ne(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),se=(function(e){x(r,e);function r(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return r.prototype.lift=function(t){var n=new ee(this,this);return n.operator=t,n},r.prototype._throwIfClosed=function(){if(this.closed)throw new He},r.prototype.next=function(t){var n=this;j(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=P(n.currentObservers),u=a.next();!u.done;u=a.next()){var s=u.value;s.next(t)}}catch(c){o={error:c}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},r.prototype.error=function(t){var n=this;j(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var o=n.observers;o.length;)o.shift().error(t)}})},r.prototype.complete=function(){var t=this;j(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},r.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},r.prototype._innerSubscribe=function(t){var n=this,o=this,i=o.hasError,a=o.isStopped,u=o.observers;return i||a?oe:(this.currentObservers=null,u.push(t),new F(function(){n.currentObservers=null,z(u,t)}))},r.prototype._checkFinalizedStatuses=function(t){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?t.error(i):a&&t.complete()},r.prototype.asObservable=function(){var t=new S;return t.source=this,t},r.create=function(t,n){return new ee(t,n)},r})(S),ee=(function(e){x(r,e);function r(t,n){var o=e.call(this)||this;return o.destination=t,o.source=n,o}return r.prototype.next=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,t)},r.prototype.error=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,t)},r.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},r.prototype._subscribe=function(t){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&o!==void 0?o:oe},r})(se),ce=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function ue(e){return m(e==null?void 0:e.then)}function le(e){return m(e[B])}function fe(e){return Symbol.asyncIterator&&m(e==null?void 0:e[Symbol.asyncIterator])}function de(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Ye(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var he=Ye();function pe(e){return m(e==null?void 0:e[he])}function ve(e){return Ne(this,arguments,function(){var t,n,o,i;return re(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,O(t.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,O(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,O(o)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ye(e){return m(e==null?void 0:e.getReader)}function q(e){if(e instanceof S)return e;if(e!=null){if(le(e))return Xe(e);if(ce(e))return Be(e);if(ue(e))return Je(e);if(fe(e))return me(e);if(pe(e))return Ke(e);if(ye(e))return Qe(e)}throw de(e)}function Xe(e){return new S(function(r){var t=e[B]();if(m(t.subscribe))return t.subscribe(r);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Be(e){return new S(function(r){for(var t=0;t<e.length&&!r.closed;t++)r.next(e[t]);r.complete()})}function Je(e){return new S(function(r){e.then(function(t){r.closed||(r.next(t),r.complete())},function(t){return r.error(t)}).then(null,ae)})}function Ke(e){return new S(function(r){var t,n;try{for(var o=P(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(r.next(a),r.closed)return}}catch(u){t={error:u}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}r.complete()})}function me(e){return new S(function(r){Ze(e,r).catch(function(t){return r.error(t)})})}function Qe(e){return me(ve(e))}function Ze(e,r){var t,n,o,i;return Ue(this,void 0,void 0,function(){var a,u;return re(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),t=ke(e),s.label=1;case 1:return[4,t.next()];case 2:if(n=s.sent(),!!n.done)return[3,4];if(a=n.value,r.next(a),r.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=s.sent(),o={error:u},[3,11];case 6:return s.trys.push([6,,9,10]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return r.complete(),[2]}})})}function E(e,r,t,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=r.schedule(function(){t(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function be(e,r){return r===void 0&&(r=0),J(function(t,n){t.subscribe(Y(n,function(o){return E(n,e,function(){return n.next(o)},r)},function(){return E(n,e,function(){return n.complete()},r)},function(o){return E(n,e,function(){return n.error(o)},r)}))})}function we(e,r){return r===void 0&&(r=0),J(function(t,n){n.add(e.schedule(function(){return t.subscribe(n)},r))})}function et(e,r){return q(e).pipe(we(r),be(r))}function tt(e,r){return q(e).pipe(we(r),be(r))}function rt(e,r){return new S(function(t){var n=0;return r.schedule(function(){n===e.length?t.complete():(t.next(e[n++]),t.closed||this.schedule())})})}function nt(e,r){return new S(function(t){var n;return E(t,r,function(){n=e[he](),E(t,r,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(u){t.error(u);return}a?t.complete():t.next(i)},0,!0)}),function(){return m(n==null?void 0:n.return)&&n.return()}})}function ge(e,r){if(!e)throw new Error("Iterable cannot be null");return new S(function(t){E(t,r,function(){var n=e[Symbol.asyncIterator]();E(t,r,function(){n.next().then(function(o){o.done?t.complete():t.next(o.value)})},0,!0)})})}function ot(e,r){return ge(ve(e),r)}function it(e,r){if(e!=null){if(le(e))return et(e,r);if(ce(e))return rt(e,r);if(ue(e))return tt(e,r);if(fe(e))return ge(e,r);if(pe(e))return nt(e,r);if(ye(e))return ot(e,r)}throw de(e)}function at(e,r){return r?it(e,r):q(e)}function st(e,r){return J(function(t,n){var o=null,i=0,a=!1,u=function(){return a&&!o&&n.complete()};t.subscribe(Y(n,function(s){o==null||o.unsubscribe();var c=0,f=i++;q(e(s,f)).subscribe(o=Y(n,function(d){return n.next(r?r(s,d,f,c++):d)},function(){o=null,u()}))},function(){a=!0,u()}))})}const ct=1e4;function ut(e,r,t){return Promise.race([e,new Promise((n,o)=>{setTimeout(()=>{t(),o(new Error(`Navigation timed out after ${r}ms`))},r)})])}const Se=new se;let U=0,N=null;function lt(e){e&&e.redirectPath&&(console.log("[NAV] Handling redirect to",e.redirectPath),setTimeout(()=>{window.dispatchEvent(new CustomEvent("forge-redirect",{detail:{path:e.redirectPath}}))},0))}Se.pipe(st(e=>at(ut(dt(e),ct,()=>{console.error("[NAV] Navigation timed out"),U++,N&&(N.abort(),N=null)}).catch(r=>{console.error("[NAV] Navigation failed:",r)})))).subscribe({next:lt,error:e=>{console.error("[NAV] Stream error:",e)}});function ft(e){Se.next(e)}const w=te.proxy({layouts:[],view:null,data:null,params:null,urlParams:null,query:null,page:b.page});function L(...e){let r=e.map((t,n)=>n===0?t.replace(/\/+$/,""):t.replace(/^\/+|\/+$/g,"")).join("/");return r.startsWith("/")||(r="/"+r),r.split("?")[0]}async function _e(e,r,t,n,o,i){try{const a=typeof r=="string"&&r.indexOf("assets")!==-1,u=(t.layout||[]).map(d=>{let h=L(r,d).toString();return a&&(h=h.endsWith(".svelte")?h.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(h)?h:h+".js"),h});let s=L(r,t.view).toString();a&&(s=s.endsWith(".svelte")?s.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(s)?s:s+".js");const c=await Promise.all(u.map(d=>import(d).then(h=>h.default)));s.startsWith("/")||(s="/"+s);const f=await import(s).then(d=>d.default);w.layouts=c,w.view=f,w.params=n,w.data=window.__INITIAL_DATA__,w.urlParams=o,w.query=i,Ae.hydrate(xe,{target:e,props:w})}catch(a){console.error("Client-side route loading failed:",a)}}function k(e,r,t,n,o,i,a=!1,u=!0){ft({url:e,base_path:r,route:t,params:n,urlParams:o,query:i,server_loading:a,updateUrl:u})}async function dt(e){const{url:r,base_path:t,route:n,params:o,urlParams:i,query:a,server_loading:u,updateUrl:s}=e,c=++U,f=new AbortController;N=f,console.log("[NAV] Starting navigation",{navigationId:c,url:r,updateUrl:s});try{let d=null,h=!1,l=null;if(u){const _={method:n.method,headers:{"Content-Type":"application/json",Accept:"application/json"},signal:f.signal};if(_[Pe]=!0,await fetch(r,_).then(y=>{if(console.log("[NAV] Fetch response",{url:r,ok:y.ok,status:y.status,redirected:y.redirected}),y.redirected||y.headers.get("X-Forge-Redirect")==="true")return console.log("[NAV] Redirect detected"),h=!0,l=y.headers.get("X-Forge-Redirect-Path"),null;if(y.ok)return y.json();throw new Error("Network response was not ok")}).then(y=>{d=y}),h)return{redirectPath:l||void 0}}const v=typeof t=="string"&&t.indexOf("assets")!==-1,p=(n.layout||[]).map(_=>{let y=L(t,_).toString();return v&&(y=y.endsWith(".svelte")?y.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(y)?y:y+".js"),y});let g=L(t,n.view).toString();v&&(g=g.endsWith(".svelte")?g.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(g)?g:g+".js");const I=await Promise.all(p.map(_=>import(_).then(y=>y.default))),R=await import(g).then(_=>_.default);if(c!==U){console.log("[NAV] Stale navigation, skipping update",{navigationId:c,currentNavigationId:U});return}u?w.data=d:w.data={layout:[],view:{}},w.params=o,w.layouts=I,w.view=R,w.urlParams=i,w.query=a,window&&window.scroll(0,0),s&&window.history.pushState({},"",r),console.log("[NAV] Navigation complete",{url:r})}catch(d){throw console.error("[NAV] Navigation failed for URL:",r,d),d}}const A=te.proxy({});async function Ee(){Object.assign(A,window.__MANIFEST__)}function Oe(e,r,t){if(!document){console.error("Document not found");return}document.addEventListener("click",n=>{var a,u;const o=window.location.pathname,i=((a=n.target)==null?void 0:a.tagName)==="A"?n.target:(u=n.target)==null?void 0:u.closest("A");if(i){let s=i.getAttribute("href");if(o===s){n.preventDefault();return}if(s&&s.startsWith("/")||s.startsWith(".")){const c=s.split("?")[0],f=i.getAttribute("method")||"get",d=r.find(h=>h.method.toLowerCase()===f&&t.find(l=>l.parser(c)&&l.pattern===h.path));if(d){n.preventDefault();const h=t.find(R=>R.parser(c)&&R.pattern===d.path),l=(h==null?void 0:h.parser(c))||{},v=new URLSearchParams(s.split("?")[1]||""),p=Object.fromEntries(v.entries())||{},g={...l,...p},I=A[h==null?void 0:h.pattern];b.page.url=s,b.page.pathname=c,b.page.params=l,b.page.query=p,console.log("[EVENTS] Click navigation to",s),k(s,e,d,g,l,p,I,!0)}else console.log("No matching route found for URL:",s,"- using fallback navigation")}}}),window.addEventListener("popstate",n=>{const o=window.location.pathname,i=window.location.pathname+window.location.search;b.page.url=i,b.page.pathname=window.location.pathname;const a="get",u=r.find(s=>s.method.toLowerCase()===a&&t.find(c=>c.parser(o)&&c.pattern===s.path));if(u){const s=t.find(v=>v.parser(o)&&v.pattern===u.path),c=(s==null?void 0:s.parser(o))||{},f=new URLSearchParams(window.location.search),d=Object.fromEntries(f.entries())||{};b.page.params=c,b.page.query=d;const h={...c,...d},l=A[s==null?void 0:s.pattern];console.log("[EVENTS] Popstate navigation to",i),k(i,e,u,h,c,d,l,!1)}else console.log("No matching route found for popstate navigation to:",o,"- using fallback navigation"),window.location.href=o}),window.addEventListener("forge-redirect",(n=>{const o=n.detail.path,i=o.split("?")[0];console.log("[EVENTS] Handling forge-redirect to:",o);const a="get",u=r.find(s=>s.method.toLowerCase()===a&&t.find(c=>c.parser(i)&&c.pattern===s.path));if(u){const s=t.find(v=>v.parser(i)&&v.pattern===u.path),c=(s==null?void 0:s.parser(i))||{},f=new URLSearchParams(o.split("?")[1]||""),d=Object.fromEntries(f.entries())||{},h={...c,...d},l=A[s==null?void 0:s.pattern];b.page.url=o,b.page.pathname=i,b.page.params=c,b.page.query=d,k(o,e,u,h,c,d,l,!0)}else console.log("No matching route found for redirect to:",i,"- using fallback navigation"),window.location.href=i}))}const Pe=Symbol("forge-load-function");let C=[],V=null;function ht(e){try{const r=new URL(e,window.location.origin);return r.origin===window.location.origin&&!r.pathname.startsWith("/api/")}catch{return!e.startsWith("/api/")}}function pt(){typeof window<"u"&&!V&&(V=window.fetch,window.fetch=async function(e,r={}){let t={...r};for(const i of C)try{if(i.length===2){const a=new Headers(t.headers),u=Object.fromEntries(a.entries());await new Promise((s,c)=>{try{i(u,f=>{if(f)c(f);else{const d=new Headers;Object.entries(u).forEach(([h,l])=>{l!==void 0&&d.set(h,l)}),t.headers=d,s()}})}catch(f){c(f)}})}else{const a=await i(t,e);a&&typeof a=="object"&&(t=a)}}catch(a){throw console.error("🔴 Middleware error:",a),a}const n=t==null?void 0:t[Pe];console.log("[FETCH OVERRIDE] Request",{url:e,hasForgeSymbol:n,headers:t==null?void 0:t.headers});const o=await V(e,t);if(console.log("[FETCH OVERRIDE] Response",{url:e,responseUrl:o.url,redirected:o.redirected,status:o.status,type:o.type,hasForgeSymbol:n}),n&&o.redirected){const i=typeof e=="string"?e:e.url,a=o.url;if(console.log("[FORGE REDIRECT] Detected redirect",{requested:i,final:a,redirected:o.redirected}),ht(a)){const u=new URL(a),s=u.pathname+u.search;return console.log("[FORGE REDIRECT] Detected redirect to:",s,"- will navigate after current request completes"),new Response(JSON.stringify({layout:[],view:{}}),{status:200,headers:{"Content-Type":"application/json","X-Forge-Redirect":"true","X-Forge-Redirect-Path":s}})}}return o})}pt();const vt={configUpdate(e){if(typeof e!="function")throw new Error("Middleware must be a function");C.push(e)},reset(){C.length=0},getMiddlewareCount(){return C.length}};let D;async function yt(e,r){let t=window.__COMPONENT_DIR__||r.component_dir;if(!t&&typeof t!="string")throw new Error("No component directory provided");let n=window.__ROUTING__;if(D=je(n),window&&window.location){const o=(window.location.pathname||"/").split("?")[0],i=D.find(u=>u.parser(o));let a=i?n.find(u=>u.path===i.pattern):null;if(i&&a){const u=i.parser(o)||{},s=new URLSearchParams(window.location.search),c=Object.fromEntries(s.entries())||{},f={...u,...c};Ee(),_e(e,t,a,f,u,c),Oe(t,n,D)}else console.warn("No matching route found for:",o)}}exports.page=b.page;exports.shadowUrl=b.shadowUrl;exports.MANIFEST_STORE=A;exports.bootstrap_events=Oe;exports.createApp=yt;exports.fetch=vt;exports.loadRoute=_e;exports.updateManifestStore=Ee;exports.updateRoute=k;
3
+ `):"",this.name="UnsubscriptionError",this.errors=t}});function G(e,r){if(e){var t=e.indexOf(r);0<=t&&e.splice(t,1)}}var L=(function(){function e(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var r,t,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var u=I(a),s=u.next();!s.done;s=u.next()){var c=s.value;c.remove(this)}}catch(v){r={error:v}}finally{try{s&&!s.done&&(t=u.return)&&t.call(u)}finally{if(r)throw r.error}}else a.remove(this);var f=this.initialTeardown;if(m(f))try{f()}catch(v){i=v instanceof F?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var h=I(d),l=h.next();!l.done;l=h.next()){var p=l.value;try{J(p)}catch(v){i=i??[],v instanceof F?i=W(W([],D(i)),D(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{l&&!l.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}}if(i)throw new F(i)}},e.prototype.add=function(r){var t;if(r&&r!==this)if(this.closed)J(r);else{if(r instanceof e){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(r)}},e.prototype._hasParent=function(r){var t=this._parentage;return t===r||Array.isArray(t)&&t.includes(r)},e.prototype._addParent=function(r){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(r),t):t?[t,r]:r},e.prototype._removeParent=function(r){var t=this._parentage;t===r?this._parentage=null:Array.isArray(t)&&G(t,r)},e.prototype.remove=function(r){var t=this._finalizers;t&&G(t,r),r instanceof e&&r._removeParent(this)},e.EMPTY=(function(){var r=new e;return r.closed=!0,r})(),e})(),oe=L.EMPTY;function ie(e){return e instanceof L||e&&"closed"in e&&m(e.remove)&&m(e.add)&&m(e.unsubscribe)}function J(e){m(e)?e():e.unsubscribe()}var Ce={Promise:void 0},ke={setTimeout:function(e,r){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return setTimeout.apply(void 0,W([e,r],D(t)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function ae(e){ke.setTimeout(function(){throw e})}function Q(){}function N(e){e()}var B=(function(e){R(r,e);function r(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,ie(t)&&t.add(n)):n.destination=Fe,n}return r.create=function(t,n,o){return new z(t,n,o)},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r})(L),Le=(function(){function e(r){this.partialObserver=r}return e.prototype.next=function(r){var t=this.partialObserver;if(t.next)try{t.next(r)}catch(n){j(n)}},e.prototype.error=function(r){var t=this.partialObserver;if(t.error)try{t.error(r)}catch(n){j(n)}else j(r)},e.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(t){j(t)}},e})(),z=(function(e){R(r,e);function r(t,n,o){var i=e.call(this)||this,a;return m(t)||!t?a={next:t??void 0,error:n??void 0,complete:o??void 0}:a=t,i.destination=new Le(a),i}return r})(B);function j(e){ae(e)}function Ve(e){throw e}var Fe={closed:!0,next:Q,error:Ve,complete:Q},X=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Me(e){return e}function qe(e){return e.length===0?Me:e.length===1?e[0]:function(t){return e.reduce(function(n,o){return o(n)},t)}}var _=(function(){function e(r){r&&(this._subscribe=r)}return e.prototype.lift=function(r){var t=new e;return t.source=this,t.operator=r,t},e.prototype.subscribe=function(r,t,n){var o=this,i=De(r)?r:new z(r,t,n);return N(function(){var a=o,u=a.operator,s=a.source;i.add(u?u.call(i,s):s?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){r.error(t)}},e.prototype.forEach=function(r,t){var n=this;return t=Z(t),new t(function(o,i){var a=new z({next:function(u){try{r(u)}catch(s){i(s),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(r){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(r)},e.prototype[X]=function(){return this},e.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return qe(r)(this)},e.prototype.toPromise=function(r){var t=this;return r=Z(r),new r(function(n,o){var i;t.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(r){return new e(r)},e})();function Z(e){var r;return(r=e??Ce.Promise)!==null&&r!==void 0?r:Promise}function $e(e){return e&&m(e.next)&&m(e.error)&&m(e.complete)}function De(e){return e&&e instanceof B||$e(e)&&ie(e)}function We(e){return m(e==null?void 0:e.lift)}function K(e){return function(r){if(We(r))return r.lift(function(t){try{return e(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function H(e,r,t,n,o){return new Ge(e,r,t,n,o)}var Ge=(function(e){R(r,e);function r(t,n,o,i,a,u){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=u,s._next=n?function(c){try{n(c)}catch(f){t.error(f)}}:e.prototype._next,s._error=i?function(c){try{i(c)}catch(f){t.error(f)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=o?function(){try{o()}catch(c){t.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,s}return r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},r})(B),ze=ne(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),se=(function(e){R(r,e);function r(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return r.prototype.lift=function(t){var n=new ee(this,this);return n.operator=t,n},r.prototype._throwIfClosed=function(){if(this.closed)throw new ze},r.prototype.next=function(t){var n=this;N(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=I(n.currentObservers),u=a.next();!u.done;u=a.next()){var s=u.value;s.next(t)}}catch(c){o={error:c}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},r.prototype.error=function(t){var n=this;N(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var o=n.observers;o.length;)o.shift().error(t)}})},r.prototype.complete=function(){var t=this;N(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},r.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},r.prototype._innerSubscribe=function(t){var n=this,o=this,i=o.hasError,a=o.isStopped,u=o.observers;return i||a?oe:(this.currentObservers=null,u.push(t),new L(function(){n.currentObservers=null,G(u,t)}))},r.prototype._checkFinalizedStatuses=function(t){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?t.error(i):a&&t.complete()},r.prototype.asObservable=function(){var t=new _;return t.source=this,t},r.create=function(t,n){return new ee(t,n)},r})(_),ee=(function(e){R(r,e);function r(t,n){var o=e.call(this)||this;return o.destination=t,o.source=n,o}return r.prototype.next=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,t)},r.prototype.error=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,t)},r.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},r.prototype._subscribe=function(t){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&o!==void 0?o:oe},r})(se),ce=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function ue(e){return m(e==null?void 0:e.then)}function le(e){return m(e[X])}function fe(e){return Symbol.asyncIterator&&m(e==null?void 0:e[Symbol.asyncIterator])}function de(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function He(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var pe=He();function he(e){return m(e==null?void 0:e[pe])}function ve(e){return Ne(this,arguments,function(){var t,n,o,i;return re(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,P(t.read())];case 3:return n=a.sent(),o=n.value,i=n.done,i?[4,P(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,P(o)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ye(e){return m(e==null?void 0:e.getReader)}function V(e){if(e instanceof _)return e;if(e!=null){if(le(e))return Ye(e);if(ce(e))return Be(e);if(ue(e))return Xe(e);if(fe(e))return me(e);if(he(e))return Ke(e);if(ye(e))return Je(e)}throw de(e)}function Ye(e){return new _(function(r){var t=e[X]();if(m(t.subscribe))return t.subscribe(r);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Be(e){return new _(function(r){for(var t=0;t<e.length&&!r.closed;t++)r.next(e[t]);r.complete()})}function Xe(e){return new _(function(r){e.then(function(t){r.closed||(r.next(t),r.complete())},function(t){return r.error(t)}).then(null,ae)})}function Ke(e){return new _(function(r){var t,n;try{for(var o=I(e),i=o.next();!i.done;i=o.next()){var a=i.value;if(r.next(a),r.closed)return}}catch(u){t={error:u}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}r.complete()})}function me(e){return new _(function(r){Qe(e,r).catch(function(t){return r.error(t)})})}function Je(e){return me(ve(e))}function Qe(e,r){var t,n,o,i;return je(this,void 0,void 0,function(){var a,u;return re(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),t=Ue(e),s.label=1;case 1:return[4,t.next()];case 2:if(n=s.sent(),!!n.done)return[3,4];if(a=n.value,r.next(a),r.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=s.sent(),o={error:u},[3,11];case 6:return s.trys.push([6,,9,10]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return r.complete(),[2]}})})}function O(e,r,t,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=r.schedule(function(){t(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function be(e,r){return r===void 0&&(r=0),K(function(t,n){t.subscribe(H(n,function(o){return O(n,e,function(){return n.next(o)},r)},function(){return O(n,e,function(){return n.complete()},r)},function(o){return O(n,e,function(){return n.error(o)},r)}))})}function we(e,r){return r===void 0&&(r=0),K(function(t,n){n.add(e.schedule(function(){return t.subscribe(n)},r))})}function Ze(e,r){return V(e).pipe(we(r),be(r))}function et(e,r){return V(e).pipe(we(r),be(r))}function tt(e,r){return new _(function(t){var n=0;return r.schedule(function(){n===e.length?t.complete():(t.next(e[n++]),t.closed||this.schedule())})})}function rt(e,r){return new _(function(t){var n;return O(t,r,function(){n=e[pe](),O(t,r,function(){var o,i,a;try{o=n.next(),i=o.value,a=o.done}catch(u){t.error(u);return}a?t.complete():t.next(i)},0,!0)}),function(){return m(n==null?void 0:n.return)&&n.return()}})}function ge(e,r){if(!e)throw new Error("Iterable cannot be null");return new _(function(t){O(t,r,function(){var n=e[Symbol.asyncIterator]();O(t,r,function(){n.next().then(function(o){o.done?t.complete():t.next(o.value)})},0,!0)})})}function nt(e,r){return ge(ve(e),r)}function ot(e,r){if(e!=null){if(le(e))return Ze(e,r);if(ce(e))return tt(e,r);if(ue(e))return et(e,r);if(fe(e))return ge(e,r);if(he(e))return rt(e,r);if(ye(e))return nt(e,r)}throw de(e)}function it(e,r){return r?ot(e,r):V(e)}function at(e,r){return K(function(t,n){var o=null,i=0,a=!1,u=function(){return a&&!o&&n.complete()};t.subscribe(H(n,function(s){o==null||o.unsubscribe();var c=0,f=i++;V(e(s,f)).subscribe(o=H(n,function(d){return n.next(r?r(s,d,f,c++):d)},function(){o=null,u()}))},function(){a=!0,u()}))})}const st=1e4;function ct(e,r,t){let n=null,o=!1;const i=new Promise((a,u)=>{n=setTimeout(()=>{o=!0,console.error("[TIMEOUT] Timeout fired after",r,"ms"),t(),u(new Error(`Navigation timed out after ${r}ms`))},r),console.log("[TIMEOUT] Timeout scheduled for",r,"ms, timeoutId:",n)});return Promise.race([e.finally(()=>{n!==null&&(o?console.warn("[TIMEOUT] Promise settled AFTER timeout already fired"):(console.log("[TIMEOUT] Clearing timeout",n,"- promise settled successfully"),clearTimeout(n)))}),i])}const Y=new se;let g=0,T=null;function ut(e){e&&e.redirectPath&&(console.log("[NAV] Handling redirect to",e.redirectPath),setTimeout(()=>{window.dispatchEvent(new CustomEvent("forge-redirect",{detail:{path:e.redirectPath}}))},0))}Y.pipe(at(e=>it(ct(ft(e),st,()=>{console.error("[NAV] Navigation timed out"),g++,T&&(T.abort(),T=null)}).catch(r=>{console.error("[NAV] Navigation failed:",r)})))).subscribe({next:ut,error:e=>{console.error("[NAV] Stream error:",e)}});function lt(e){var r;console.log("[NAV STREAM] Pushing navigation event to stream",{url:e.url,currentNavigationId:g,subscriberCount:((r=Y.observers)==null?void 0:r.length)||0}),Y.next(e)}const w=te.proxy({active:{layouts:[],view:null,data:{layout:[],view:{}},params:{},urlParams:{},query:{}},phase:"idle",navigationId:0,page:b.page});function k(...e){let r=e.map((t,n)=>n===0?t.replace(/\/+$/,""):t.replace(/^\/+|\/+$/g,"")).join("/");return r.startsWith("/")||(r="/"+r),r.split("?")[0]}async function Se(e,r,t,n,o,i){try{const a=typeof r=="string"&&r.indexOf("assets")!==-1,u=(t.layout||[]).map(l=>{let p=k(r,l).toString();return a&&(p=p.endsWith(".svelte")?p.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(p)?p:p+".js"),p});let s=k(r,t.view).toString();a&&(s=s.endsWith(".svelte")?s.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(s)?s:s+".js");const c=await Promise.all(u.map(l=>import(l).then(p=>p.default)));s.startsWith("/")||(s="/"+s);const f=await import(s).then(l=>l.default),d=window.__INITIAL_DATA__||{layout:[],view:{}},h={layouts:c,view:f,data:d,params:n,urlParams:o,query:i};w.active=h,w.phase="idle",Pe.hydrate(Ie,{target:e,props:{root:w}})}catch(a){console.error("Client-side route loading failed:",a)}}function U(e,r,t,n,o,i,a=!1,u=!0){lt({url:e,base_path:r,route:t,params:n,urlParams:o,query:i,server_loading:a,updateUrl:u})}async function ft(e){const{url:r,base_path:t,route:n,params:o,urlParams:i,query:a,server_loading:u,updateUrl:s}=e,c=++g,f=new AbortController;T=f,console.log("[NAV] Starting navigation",{navigationId:c,url:r,updateUrl:s,server_loading:u,currentNavigationId:g,hasAbortController:!!T}),w.phase="loading",w.navigationId=c;try{let d={layout:[],view:{}};if(u){console.log("[NAV] Fetching server data",{navigationId:c,url:r});const S={method:n.method,headers:{"Content-Type":"application/json",Accept:"application/json"},signal:f.signal};S[Oe]=!0;const y=await fetch(r,S);if(console.log("[NAV] Fetch response received",{navigationId:c,url:r,ok:y.ok,status:y.status,redirected:y.redirected,currentNavigationId:g}),y.redirected||y.headers.get("X-Forge-Redirect")==="true")return console.log("[NAV] Redirect detected"),w.phase="idle",{redirectPath:y.headers.get("X-Forge-Redirect-Path")||void 0};if(!y.ok)throw new Error(`Network response was not ok: ${y.status}`);d=await y.json(),console.log("[NAV] Server data received:",d)}if(c!==g){console.log("[NAV] Stale navigation after fetch, aborting",{navigationId:c,currentNavigationId:g});return}console.log("[NAV] Loading components",{navigationId:c,view:n.view,layouts:n.layout});const h=typeof t=="string"&&t.indexOf("assets")!==-1,l=(n.layout||[]).map(S=>{let y=k(t,S).toString();return h&&(y=y.endsWith(".svelte")?y.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(y)?y:y+".js"),y});let p=k(t,n.view).toString();h&&(p=p.endsWith(".svelte")?p.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(p)?p:p+".js"),p.startsWith("/")||(p="/"+p);const v=await Promise.all(l.map(S=>import(S).then(y=>y.default))),A=await import(p).then(S=>S.default);if(console.log("[NAV] Components loaded",{navigationId:c,currentNavigationId:g,layoutsCount:v.length,viewLoaded:!!A}),c!==g){console.log("[NAV] Stale navigation after component load, aborting",{navigationId:c,currentNavigationId:g});return}const E={layouts:v,view:A,data:d,params:o,urlParams:i,query:a};console.log("[NAV] Built complete state, performing atomic swap",{navigationId:c,currentNavigationId:g,layoutsCount:E.layouts.length,viewSet:!!E.view,dataKeys:Object.keys(E.data||{})}),w.active=E,w.phase="idle",console.log("[NAV] ROOT.active updated atomically",{navigationId:c,layoutsCount:w.active.layouts.length,viewSet:!!w.active.view,dataKeys:Object.keys(w.active.data||{}),paramsKeys:Object.keys(w.active.params||{})}),typeof window<"u"&&window.scroll(0,0),s&&(console.log("[NAV] Updating browser URL",{url:r}),window.history.pushState({},"",r)),console.log("[NAV] Navigation complete",{navigationId:c,url:r})}catch(d){if(console.error("[NAV] Navigation failed",{navigationId:c,currentNavigationId:g,url:r,error:d instanceof Error?d.message:String(d)}),w.phase="idle",d.name==="AbortError"){console.log("[NAV] Navigation aborted");return}throw d}}const x=te.proxy({});async function _e(){Object.assign(x,window.__MANIFEST__)}function Ee(e,r,t){if(!document){console.error("Document not found");return}document.addEventListener("click",n=>{var a,u;const o=window.location.pathname,i=((a=n.target)==null?void 0:a.tagName)==="A"?n.target:(u=n.target)==null?void 0:u.closest("A");if(i){let s=i.getAttribute("href");if(o===s){n.preventDefault();return}if(s&&s.startsWith("/")||s.startsWith(".")){const c=s.split("?")[0],f=i.getAttribute("method")||"get",d=r.find(h=>h.method.toLowerCase()===f&&t.find(l=>l.parser(c)&&l.pattern===h.path));if(d){n.preventDefault();const h=t.find(S=>S.parser(c)&&S.pattern===d.path),l=(h==null?void 0:h.parser(c))||{},p=new URLSearchParams(s.split("?")[1]||""),v=Object.fromEntries(p.entries())||{},A={...l,...v},E=x[h==null?void 0:h.pattern];b.page.url=s,b.page.pathname=c,b.page.params=l,b.page.query=v,console.log("[EVENTS] Click navigation to",s),U(s,e,d,A,l,v,E,!0)}else console.log("No matching route found for URL:",s,"- using fallback navigation")}}}),window.addEventListener("popstate",n=>{const o=window.location.pathname,i=window.location.pathname+window.location.search;b.page.url=i,b.page.pathname=window.location.pathname;const a="get",u=r.find(s=>s.method.toLowerCase()===a&&t.find(c=>c.parser(o)&&c.pattern===s.path));if(u){const s=t.find(p=>p.parser(o)&&p.pattern===u.path),c=(s==null?void 0:s.parser(o))||{},f=new URLSearchParams(window.location.search),d=Object.fromEntries(f.entries())||{};b.page.params=c,b.page.query=d;const h={...c,...d},l=x[s==null?void 0:s.pattern];console.log("[EVENTS] Popstate navigation to",i),U(i,e,u,h,c,d,l,!1)}else console.log("No matching route found for popstate navigation to:",o,"- using fallback navigation"),window.location.href=o}),window.addEventListener("forge-redirect",(n=>{const o=n.detail.path,i=o.split("?")[0];console.log("[EVENTS] Handling forge-redirect to:",o);const a="get",u=r.find(s=>s.method.toLowerCase()===a&&t.find(c=>c.parser(i)&&c.pattern===s.path));if(u){const s=t.find(p=>p.parser(i)&&p.pattern===u.path),c=(s==null?void 0:s.parser(i))||{},f=new URLSearchParams(o.split("?")[1]||""),d=Object.fromEntries(f.entries())||{},h={...c,...d},l=x[s==null?void 0:s.pattern];b.page.url=o,b.page.pathname=i,b.page.params=c,b.page.query=d,U(o,e,u,h,c,d,l,!0)}else console.log("No matching route found for redirect to:",i,"- using fallback navigation"),window.location.href=i}))}const Oe=Symbol("forge-load-function");let C=[],M=null;function dt(e){try{const r=new URL(e,window.location.origin);return r.origin===window.location.origin&&!r.pathname.startsWith("/api/")}catch{return!e.startsWith("/api/")}}function pt(){typeof window<"u"&&!M&&(M=window.fetch,window.fetch=async function(e,r={}){let t={...r};for(const i of C)try{if(i.length===2){const a=new Headers(t.headers),u=Object.fromEntries(a.entries());await new Promise((s,c)=>{try{i(u,f=>{if(f)c(f);else{const d=new Headers;Object.entries(u).forEach(([h,l])=>{l!==void 0&&d.set(h,l)}),t.headers=d,s()}})}catch(f){c(f)}})}else{const a=await i(t,e);a&&typeof a=="object"&&(t=a)}}catch(a){throw console.error("🔴 Middleware error:",a),a}const n=t==null?void 0:t[Oe];console.log("[FETCH OVERRIDE] Request",{url:e,hasForgeSymbol:n,headers:t==null?void 0:t.headers});const o=await M(e,t);if(console.log("[FETCH OVERRIDE] Response",{url:e,responseUrl:o.url,redirected:o.redirected,status:o.status,type:o.type,hasForgeSymbol:n}),n&&o.redirected){const i=typeof e=="string"?e:e.url,a=o.url;if(console.log("[FORGE REDIRECT] Detected redirect",{requested:i,final:a,redirected:o.redirected}),dt(a)){const u=new URL(a),s=u.pathname+u.search;return console.log("[FORGE REDIRECT] Detected redirect to:",s,"- will navigate after current request completes"),new Response(JSON.stringify({layout:[],view:{}}),{status:200,headers:{"Content-Type":"application/json","X-Forge-Redirect":"true","X-Forge-Redirect-Path":s}})}}return o})}pt();const ht={configUpdate(e){if(typeof e!="function")throw new Error("Middleware must be a function");C.push(e)},reset(){C.length=0},getMiddlewareCount(){return C.length}};let q;async function vt(e,r){let t=window.__COMPONENT_DIR__||r.component_dir;if(!t&&typeof t!="string")throw new Error("No component directory provided");let n=window.__ROUTING__;if(q=Re(n),window&&window.location){const o=(window.location.pathname||"/").split("?")[0],i=q.find(u=>u.parser(o));let a=i?n.find(u=>u.path===i.pattern):null;if(i&&a){const u=i.parser(o)||{},s=new URLSearchParams(window.location.search),c=Object.fromEntries(s.entries())||{},f={...u,...c};_e(),Se(e,t,a,f,u,c),Ee(t,n,q)}else console.warn("No matching route found for:",o)}}exports.page=b.page;exports.shadowUrl=b.shadowUrl;exports.MANIFEST_STORE=x;exports.bootstrap_events=Ee;exports.createApp=vt;exports.fetch=ht;exports.loadRoute=Se;exports.updateManifestStore=_e;exports.updateRoute=U;
4
4
  //# sourceMappingURL=client.cjs.map