diff --git a/CHANGELOG.md b/CHANGELOG.md index 66fe7e26..bd60469c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ Breaking changes are marked with ⚠️. ## [Unreleased] +## [v1.4.0] - 2021-08-25 + +**Added** + +- Add support for parameters inside single route segments ([#444](https://github.com/tighten/ziggy/pull/444)) + ## [v1.3.6] - 2021-08-25 **Fixed** @@ -183,7 +189,8 @@ Breaking changes are marked with ⚠️. For previous changes see the [Releases](https://github.com/tighten/ziggy/releases) page. -[Unreleased]: https://github.com/tighten/ziggy/compare/v1.3.6...HEAD +[Unreleased]: https://github.com/tighten/ziggy/compare/v1.4.0...HEAD +[v1.4.0]: https://github.com/tighten/ziggy/compare/v1.3.6...v1.4.0 [v1.3.6]: https://github.com/tighten/ziggy/compare/v1.3.5...v1.3.6 [v1.3.5]: https://github.com/tighten/ziggy/compare/v1.3.4...v1.3.5 [v1.3.4]: https://github.com/tighten/ziggy/compare/v1.3.3...v1.3.4 diff --git a/dist/index.es.js b/dist/index.es.js index 3a4cb88d..5bda2922 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -1 +1 @@ -function t(){return(t=Object.assign||function(t){for(var r=1;r1&&"boolean"!=typeof r)throw new y('"allowMissing" argument must be a boolean');var e=R(t),n=e.length>0?e[0]:"",o=I("%"+n+"%",r),i=o.name,f=o.value,c=!1,l=o.alias;l&&(n=l[0],O(e,A([0,1],l)));for(var s=1,d=!0;s=e.length){var m=p(f,b);f=(d=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:f[b]}else d=a(f,b),f=f[b];d&&!c&&(g[i]=f)}}return f},M=(function(t){var r=k("%Function.prototype.apply%"),e=k("%Function.prototype.call%"),n=k("%Reflect.apply%",!0)||i.call(e,r),o=k("%Object.getOwnPropertyDescriptor%",!0),a=k("%Object.defineProperty%",!0),u=k("%Math.max%");if(a)try{a({},"a",{value:1})}catch(t){a=null}t.exports=function(t){var r=n(i,e,arguments);if(o&&a){var f=o(r,"length");f.configurable&&a(r,"length",{value:1+u(0,t.length-(arguments.length-1))})}return r};var f=function(){return n(i,r,arguments)};a?a(t.exports,"apply",{value:f}):t.exports.apply=f}(l={exports:{}}),l.exports),x=M(k("String.prototype.indexOf")),U=function(t,r){var e=k(t,!!r);return"function"==typeof e&&x(t,".prototype.")>-1?M(e):e},$="function"==typeof Map&&Map.prototype,W=Object.getOwnPropertyDescriptor&&$?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,N=$&&W&&"function"==typeof W.get?W.get:null,B=$&&Map.prototype.forEach,T="function"==typeof Set&&Set.prototype,C=Object.getOwnPropertyDescriptor&&T?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,_=T&&C&&"function"==typeof C.get?C.get:null,D=T&&Set.prototype.forEach,G="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,q="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,V="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,z=Boolean.prototype.valueOf,J=Object.prototype.toString,L=Function.prototype.toString,H=String.prototype.match,Q="function"==typeof BigInt?BigInt.prototype.valueOf:null,Z=Object.getOwnPropertySymbols,K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,X="function"==typeof Symbol&&"object"==typeof Symbol.iterator,Y=Object.prototype.propertyIsEnumerable,tt=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),rt={__proto__:null,default:{}}.custom,et=rt&&ft(rt)?rt:null,nt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,ot=function t(r,e,n,o){var i=e||{};if(ct(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ct(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=!ct(i,"customInspect")||i.customInspect;if("boolean"!=typeof a&&"symbol"!==a)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ct(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return st(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var u=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=u&&u>0&&"object"==typeof r)return ut(r)?"[Array]":"[Object]";var f,y=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(lt(o,r)>=0)return"[Circular]";function c(r,e,a){if(e&&(o=o.slice()).push(e),a){var u={depth:i.depth};return ct(i,"quoteStyle")&&(u.quoteStyle=i.quoteStyle),t(r,u,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=H.call(L.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),l=gt(r,c);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(ft(r)){var s=X?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):K.call(r);return"object"!=typeof r||X?s:bt(s)}if((f=r)&&"object"==typeof f&&("undefined"!=typeof HTMLElement&&f instanceof HTMLElement||"string"==typeof f.nodeName&&"function"==typeof f.getAttribute)){for(var d="<"+String(r.nodeName).toLowerCase(),b=r.attributes||[],v=0;v"}if(ut(r)){if(0===r.length)return"[]";var h=gt(r,c);return y&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+mt(h,y)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)){var m=gt(r,c);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&a){if(et&&"function"==typeof r[et])return r[et]();if("symbol"!==a&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!N||!t||"object"!=typeof t)return!1;try{N.call(t);try{_.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return B.call(r,function(t,e){g.push(c(e,r,!0)+" => "+c(t,r))}),ht("Map",N.call(r),g,y)}if(function(t){if(!_||!t||"object"!=typeof t)return!1;try{_.call(t);try{N.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return D.call(r,function(t){j.push(c(t,r))}),ht("Set",_.call(r),j,y)}if(function(t){if(!G||!t||"object"!=typeof t)return!1;try{G.call(t,G);try{q.call(t,q)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return vt("WeakMap");if(function(t){if(!q||!t||"object"!=typeof t)return!1;try{q.call(t,q);try{G.call(t,G)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return vt("WeakSet");if(function(t){if(!V||!t||"object"!=typeof t)return!1;try{return V.call(t),!0}catch(t){}return!1}(r))return vt("WeakRef");if(function(t){return!("[object Number]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(c(Number(r)));if(function(t){if(!t||"object"!=typeof t||!Q)return!1;try{return Q.call(t),!0}catch(t){}return!1}(r))return bt(c(Q.call(r)));if(function(t){return!("[object Boolean]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(z.call(r));if(function(t){return!("[object String]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(c(String(r)));if(!function(t){return!("[object Date]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)&&!function(t){return!("[object RegExp]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)){var S=gt(r,c),A=tt?tt(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&&nt&&Object(r)===r&&nt in r?pt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":y?P+"{"+mt(S,y)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function it(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function at(t){return String(t).replace(/"/g,""")}function ut(t){return!("[object Array]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}function ft(t){if(X)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!K)return!1;try{return K.call(t),!0}catch(t){}return!1}var yt=Object.prototype.hasOwnProperty||function(t){return t in this};function ct(t,r){return yt.call(t,r)}function pt(t){return J.call(t)}function lt(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return st(t.slice(0,r.maxStringLength),r)+n}return it(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,dt),"single",r)}function dt(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function bt(t){return"Object("+t+")"}function vt(t){return t+" { ? }"}function ht(t,r,e,n){return t+" ("+r+") {"+(n?mt(e,n):e.join(", "))+"}"}function mt(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function gt(t,r){var e=ut(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if(Wt(e)){for(var n=[],o=0;o=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||o===Ut.RFC1738&&(40===f||41===f)?a+=i.charAt(u):f<128?a+=Nt[f]:f<2048?a+=Nt[192|f>>6]+Nt[128|63&f]:f<55296||f>=57344?a+=Nt[224|f>>12]+Nt[128|f>>6&63]+Nt[128|63&f]:(f=65536+((1023&f)<<10|1023&i.charCodeAt(u+=1)),a+=Nt[240|f>>18]+Nt[128|f>>12&63]+Nt[128|f>>6&63]+Nt[128|63&f])}return a},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if(Wt(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Dt(u))m=u;else{var j=Object.keys(h);m=f?j.sort(f):j}for(var S=0;S-1?t.split(","):t},Yt=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,a=e.depth>0&&/(\[[^[\]]*])/.exec(o),u=a?o.slice(0,a.index):o,f=[];if(u){if(!e.plainObjects&&Ht.call(Object.prototype,u)&&!e.allowPrototypes)return;f.push(u)}for(var y=0;e.depth>0&&null!==(a=i.exec(o))&&y=0;--i){var a,u=t[i];if("[]"===u&&e.parseArrays)a=[].concat(o);else{a=e.plainObjects?Object.create(null):{};var f="["===u.charAt(0)&&"]"===u.charAt(u.length-1)?u.slice(1,-1):u,y=parseInt(f,10);e.parseArrays||""!==f?!isNaN(y)&&u!==f&&String(y)===f&&y>=0&&e.parseArrays&&y<=e.arrayLimit?(a=[])[y]=o:a[f]=o:a={0:o}}o=a}return o}(f,r,e,n)}};class tr{constructor(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}get template(){return`${this.config.absolute?this.definition.domain?`${this.config.url.match(/^\w+:\/\//)[0]}${this.definition.domain}${this.config.port?`:${this.config.port}`:""}`:this.config.url:""}/${this.definition.uri}`.replace(/\/+$/,"")}get parameterSegments(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))?t:[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${r}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(r,e)=>{var n;if([null,void 0].includes(t[e])&&this.parameterSegments.find(({name:t})=>t===e).required)throw new Error(`Ziggy error: '${e}' parameter is required for route '${this.name}'.`);return encodeURIComponent(null!=(n=t[e])?n:"")}).replace(/\/+$/,""):this.template}}class rr extends String{constructor(r,e,n=!0,o){var i;if(super(),this.t=null!=(i=null!=o?o:Ziggy)?i:null==globalThis?void 0:globalThis.Ziggy,this.t=t({},this.t,{absolute:n}),r){if(!this.t.routes[r])throw new Error(`Ziggy error: route '${r}' is not in the route list.`);this.i=new tr(r,this.t.routes[r],this.t),this.u=this.p(e)}}toString(){const r=Object.keys(this.u).filter(t=>!this.i.parameterSegments.some(({name:r})=>r===t)).filter(t=>"_query"!==t).reduce((r,e)=>t({},r,{[e]:this.u[e]}),{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return Jt;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||Jt.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=Ut.default;if(void 0!==t.format){if(!Ct.call(Ut.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=Ut.formatters[e],o=Jt.filter;return("function"==typeof t.filter||Dt(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:Jt.addQueryPrefix,allowDots:void 0===t.allowDots?Jt.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Jt.charsetSentinel,delimiter:void 0===t.delimiter?Jt.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:Jt.encode,encoder:"function"==typeof t.encoder?t.encoder:Jt.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:Jt.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:Jt.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:Jt.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Jt.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Dt(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var a=_t[r&&r.arrayFormat in _t?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var u=kt(),f=0;f0?p+c:""}(t({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,r)=>"boolean"==typeof t?Number(t):r(t)})}current(t,r){const e=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[n,o]=Object.entries(this.t.routes).find(([r,n])=>new tr(t,n,this.t).matchesUrl(e))||[void 0,void 0];if(!t)return n;const i=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(n);if([null,void 0].includes(r)||!i)return i;const a=new tr(n,o,this.t);r=this.p(r,a);const u=this.v(o);return!(!Object.values(r).every(t=>!t)||Object.values(u).length)||Object.entries(r).every(([t,r])=>u[t]==r)}l(){var t,r,e,n,o,i;const{host:a="",pathname:u="",search:f=""}="undefined"!=typeof window?window.location:{};return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:a,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:u,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:f}}get params(){return this.v(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}p(r={},e=this.i){r=["string","number"].includes(typeof r)?[r]:r;const n=e.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(r)?r=r.reduce((r,e,o)=>t({},r,n[o]?{[n[o].name]:e}:{[e]:""}),{}):1!==n.length||r[n[0].name]||!r.hasOwnProperty(Object.values(e.bindings)[0])&&!r.hasOwnProperty("id")||(r={[n[0].name]:r}),t({},this.h(e),this.m(r,e))}h(r){return r.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((r,{name:e},n)=>t({},r,{[e]:this.t.defaults[e]}),{})}m(r,{bindings:e,parameterSegments:n}){return Object.entries(r).reduce((r,[o,i])=>{if(!i||"object"!=typeof i||Array.isArray(i)||!n.some(({name:t})=>t===o))return t({},r,{[o]:i});if(!i.hasOwnProperty(e[o])){if(!i.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${o}' parameter is missing route model binding key '${e[o]}'.`);e[o]="id"}return t({},r,{[o]:i[e[o]]})},{})}v(r){var e;let n=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const o=(r,e="",n)=>{const[o,i]=[r,e].map(t=>t.split(n));return i.reduce((r,e,n)=>/^{[^}?]+\??}$/.test(e)&&o[n]?t({},r,{[e.replace(/^{|\??}$/g,"")]:o[n]}):r,{})};return t({},o(this.l().host,r.domain,"."),o(n,r.uri,"/"),function(t,r){var e=Zt;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,a=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(f=Qt(f)?[f]:f),n[u]=Ht.call(n,u)?Tt.combine(n[u],f):f}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a1&&"boolean"!=typeof r)throw new y('"allowMissing" argument must be a boolean');var e=R(t),n=e.length>0?e[0]:"",o=I("%"+n+"%",r),i=o.name,f=o.value,c=!1,l=o.alias;l&&(n=l[0],O(e,A([0,1],l)));for(var s=1,d=!0;s=e.length){var m=p(f,b);f=(d=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:f[b]}else d=a(f,b),f=f[b];d&&!c&&(g[i]=f)}}return f},M=(function(t){var r=k("%Function.prototype.apply%"),e=k("%Function.prototype.call%"),n=k("%Reflect.apply%",!0)||i.call(e,r),o=k("%Object.getOwnPropertyDescriptor%",!0),a=k("%Object.defineProperty%",!0),u=k("%Math.max%");if(a)try{a({},"a",{value:1})}catch(t){a=null}t.exports=function(t){var r=n(i,e,arguments);if(o&&a){var f=o(r,"length");f.configurable&&a(r,"length",{value:1+u(0,t.length-(arguments.length-1))})}return r};var f=function(){return n(i,r,arguments)};a?a(t.exports,"apply",{value:f}):t.exports.apply=f}(l={exports:{}}),l.exports),x=M(k("String.prototype.indexOf")),U=function(t,r){var e=k(t,!!r);return"function"==typeof e&&x(t,".prototype.")>-1?M(e):e},W="function"==typeof Map&&Map.prototype,$=Object.getOwnPropertyDescriptor&&W?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,N=W&&$&&"function"==typeof $.get?$.get:null,B=W&&Map.prototype.forEach,T="function"==typeof Set&&Set.prototype,C=Object.getOwnPropertyDescriptor&&T?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,_=T&&C&&"function"==typeof C.get?C.get:null,D=T&&Set.prototype.forEach,G="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,q="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,V="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,z=Boolean.prototype.valueOf,J=Object.prototype.toString,L=Function.prototype.toString,H=String.prototype.match,Q="function"==typeof BigInt?BigInt.prototype.valueOf:null,Z=Object.getOwnPropertySymbols,K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,X="function"==typeof Symbol&&"object"==typeof Symbol.iterator,Y=Object.prototype.propertyIsEnumerable,tt=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),rt={__proto__:null,default:{}}.custom,et=rt&&ft(rt)?rt:null,nt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,ot=function t(r,e,n,o){var i=e||{};if(ct(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ct(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=!ct(i,"customInspect")||i.customInspect;if("boolean"!=typeof a&&"symbol"!==a)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ct(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return st(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var u=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=u&&u>0&&"object"==typeof r)return ut(r)?"[Array]":"[Object]";var f,y=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(lt(o,r)>=0)return"[Circular]";function c(r,e,a){if(e&&(o=o.slice()).push(e),a){var u={depth:i.depth};return ct(i,"quoteStyle")&&(u.quoteStyle=i.quoteStyle),t(r,u,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=H.call(L.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),l=gt(r,c);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(ft(r)){var s=X?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):K.call(r);return"object"!=typeof r||X?s:bt(s)}if((f=r)&&"object"==typeof f&&("undefined"!=typeof HTMLElement&&f instanceof HTMLElement||"string"==typeof f.nodeName&&"function"==typeof f.getAttribute)){for(var d="<"+String(r.nodeName).toLowerCase(),b=r.attributes||[],v=0;v"}if(ut(r)){if(0===r.length)return"[]";var h=gt(r,c);return y&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+mt(h,y)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)){var m=gt(r,c);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&a){if(et&&"function"==typeof r[et])return r[et]();if("symbol"!==a&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!N||!t||"object"!=typeof t)return!1;try{N.call(t);try{_.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return B.call(r,function(t,e){g.push(c(e,r,!0)+" => "+c(t,r))}),ht("Map",N.call(r),g,y)}if(function(t){if(!_||!t||"object"!=typeof t)return!1;try{_.call(t);try{N.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return D.call(r,function(t){j.push(c(t,r))}),ht("Set",_.call(r),j,y)}if(function(t){if(!G||!t||"object"!=typeof t)return!1;try{G.call(t,G);try{q.call(t,q)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return vt("WeakMap");if(function(t){if(!q||!t||"object"!=typeof t)return!1;try{q.call(t,q);try{G.call(t,G)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return vt("WeakSet");if(function(t){if(!V||!t||"object"!=typeof t)return!1;try{return V.call(t),!0}catch(t){}return!1}(r))return vt("WeakRef");if(function(t){return!("[object Number]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(c(Number(r)));if(function(t){if(!t||"object"!=typeof t||!Q)return!1;try{return Q.call(t),!0}catch(t){}return!1}(r))return bt(c(Q.call(r)));if(function(t){return!("[object Boolean]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(z.call(r));if(function(t){return!("[object String]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(c(String(r)));if(!function(t){return!("[object Date]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)&&!function(t){return!("[object RegExp]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)){var S=gt(r,c),A=tt?tt(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&&nt&&Object(r)===r&&nt in r?pt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":y?P+"{"+mt(S,y)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function it(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function at(t){return String(t).replace(/"/g,""")}function ut(t){return!("[object Array]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}function ft(t){if(X)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!K)return!1;try{return K.call(t),!0}catch(t){}return!1}var yt=Object.prototype.hasOwnProperty||function(t){return t in this};function ct(t,r){return yt.call(t,r)}function pt(t){return J.call(t)}function lt(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return st(t.slice(0,r.maxStringLength),r)+n}return it(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,dt),"single",r)}function dt(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function bt(t){return"Object("+t+")"}function vt(t){return t+" { ? }"}function ht(t,r,e,n){return t+" ("+r+") {"+(n?mt(e,n):e.join(", "))+"}"}function mt(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function gt(t,r){var e=ut(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if($t(e)){for(var n=[],o=0;o=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||o===Ut.RFC1738&&(40===f||41===f)?a+=i.charAt(u):f<128?a+=Nt[f]:f<2048?a+=Nt[192|f>>6]+Nt[128|63&f]:f<55296||f>=57344?a+=Nt[224|f>>12]+Nt[128|f>>6&63]+Nt[128|63&f]:(f=65536+((1023&f)<<10|1023&i.charCodeAt(u+=1)),a+=Nt[240|f>>18]+Nt[128|f>>12&63]+Nt[128|f>>6&63]+Nt[128|63&f])}return a},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if($t(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Dt(u))m=u;else{var j=Object.keys(h);m=f?j.sort(f):j}for(var S=0;S-1?t.split(","):t},Yt=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,a=e.depth>0&&/(\[[^[\]]*])/.exec(o),u=a?o.slice(0,a.index):o,f=[];if(u){if(!e.plainObjects&&Ht.call(Object.prototype,u)&&!e.allowPrototypes)return;f.push(u)}for(var y=0;e.depth>0&&null!==(a=i.exec(o))&&y=0;--i){var a,u=t[i];if("[]"===u&&e.parseArrays)a=[].concat(o);else{a=e.plainObjects?Object.create(null):{};var f="["===u.charAt(0)&&"]"===u.charAt(u.length-1)?u.slice(1,-1):u,y=parseInt(f,10);e.parseArrays||""!==f?!isNaN(y)&&u!==f&&String(y)===f&&y>=0&&e.parseArrays&&y<=e.arrayLimit?(a=[])[y]=o:a[f]=o:a={0:o}}o=a}return o}(f,r,e,n)}};class tr{constructor(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}get template(){return`${this.config.absolute?this.definition.domain?`${this.config.url.match(/^\w+:\/\//)[0]}${this.definition.domain}${this.config.port?`:${this.config.port}`:""}`:this.config.url:""}/${this.definition.uri}`.replace(/\/+$/,"")}get parameterSegments(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))?t:[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}?]*\?}/g,"([^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${r}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(r,e)=>{var n;if([null,void 0].includes(t[e])&&this.parameterSegments.find(({name:t})=>t===e).required)throw new Error(`Ziggy error: '${e}' parameter is required for route '${this.name}'.`);return encodeURIComponent(null!=(n=t[e])?n:"")}).replace(/\/+$/,""):this.template}}class rr extends String{constructor(r,e,n=!0,o){var i;if(super(),this.t=null!=(i=null!=o?o:Ziggy)?i:null==globalThis?void 0:globalThis.Ziggy,this.t=t({},this.t,{absolute:n}),r){if(!this.t.routes[r])throw new Error(`Ziggy error: route '${r}' is not in the route list.`);this.i=new tr(r,this.t.routes[r],this.t),this.u=this.p(e)}}toString(){const r=Object.keys(this.u).filter(t=>!this.i.parameterSegments.some(({name:r})=>r===t)).filter(t=>"_query"!==t).reduce((r,e)=>t({},r,{[e]:this.u[e]}),{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return Jt;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||Jt.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=Ut.default;if(void 0!==t.format){if(!Ct.call(Ut.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=Ut.formatters[e],o=Jt.filter;return("function"==typeof t.filter||Dt(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:Jt.addQueryPrefix,allowDots:void 0===t.allowDots?Jt.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Jt.charsetSentinel,delimiter:void 0===t.delimiter?Jt.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:Jt.encode,encoder:"function"==typeof t.encoder?t.encoder:Jt.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:Jt.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:Jt.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:Jt.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Jt.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Dt(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var a=_t[r&&r.arrayFormat in _t?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var u=kt(),f=0;f0?p+c:""}(t({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,r)=>"boolean"==typeof t?Number(t):r(t)})}current(t,r){const e=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[n,o]=Object.entries(this.t.routes).find(([r,n])=>new tr(t,n,this.t).matchesUrl(e))||[void 0,void 0];if(!t)return n;const i=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(n);if([null,void 0].includes(r)||!i)return i;const a=new tr(n,o,this.t);r=this.p(r,a);const u=this.v(o);return!(!Object.values(r).every(t=>!t)||Object.values(u).length)||Object.entries(r).every(([t,r])=>u[t]==r)}l(){var t,r,e,n,o,i;const{host:a="",pathname:u="",search:f=""}="undefined"!=typeof window?window.location:{};return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:a,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:u,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:f}}get params(){return this.v(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}p(r={},e=this.i){r=["string","number"].includes(typeof r)?[r]:r;const n=e.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(r)?r=r.reduce((r,e,o)=>t({},r,n[o]?{[n[o].name]:e}:{[e]:""}),{}):1!==n.length||r[n[0].name]||!r.hasOwnProperty(Object.values(e.bindings)[0])&&!r.hasOwnProperty("id")||(r={[n[0].name]:r}),t({},this.h(e),this.m(r,e))}h(r){return r.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((r,{name:e},n)=>t({},r,{[e]:this.t.defaults[e]}),{})}m(r,{bindings:e,parameterSegments:n}){return Object.entries(r).reduce((r,[o,i])=>{if(!i||"object"!=typeof i||Array.isArray(i)||!n.some(({name:t})=>t===o))return t({},r,{[o]:i});if(!i.hasOwnProperty(e[o])){if(!i.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${o}' parameter is missing route model binding key '${e[o]}'.`);e[o]="id"}return t({},r,{[o]:i[e[o]]})},{})}v(r){var e;let n=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const o=(r,e="",n)=>{const[o,i]=[r,e].map(t=>t.split(n));return i.reduce((r,e,n)=>/{[^}?]+\??}/.test(e)&&o[n]?t({},r,{[e.replace(/.*{|\??}.*/g,"")]:o[n].replace(e.match(/^[^{]*/g),"").replace(e.match(/[^}]*$/g),"")}):r,{})};return t({},o(this.l().host,r.domain,"."),o(n,r.uri,"/"),function(t,r){var e=Zt;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,a=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(f=Qt(f)?[f]:f),n[u]=Ht.call(n,u)?Tt.combine(n[u],f):f}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a1&&"boolean"!=typeof r)throw new m('"allowMissing" argument must be a boolean');var e=T(t),n=e.length>0?e[0]:"",o=B("%"+n+"%",r),i=o.name,u=o.value,f=!1,a=o.alias;a&&(n=a[0],M(e,k([0,1],a)));for(var c=1,y=!0;c=e.length){var b=j(u,p);u=(y=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:u[p]}else y=d(u,p),u=u[p];y&&!f&&(R[i]=u)}}return u},D=function(t){var r={exports:{}};return function(t){var r=C("%Function.prototype.apply%"),e=C("%Function.prototype.call%"),n=C("%Reflect.apply%",!0)||b.call(e,r),o=C("%Object.getOwnPropertyDescriptor%",!0),i=C("%Object.defineProperty%",!0),u=C("%Math.max%");if(i)try{i({},"a",{value:1})}catch(t){i=null}t.exports=function(t){var r=n(b,e,arguments);return o&&i&&o(r,"length").configurable&&i(r,"length",{value:1+u(0,t.length-(arguments.length-1))}),r};var f=function(){return n(b,r,arguments)};i?i(t.exports,"apply",{value:f}):t.exports.apply=f}(r),r.exports}(),$=D(C("String.prototype.indexOf")),G=function(t,r){var e=C(t,!!r);return"function"==typeof e&&$(t,".prototype.")>-1?D(e):e},_="function"==typeof Map&&Map.prototype,q=Object.getOwnPropertyDescriptor&&_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,V=_&&q&&"function"==typeof q.get?q.get:null,z=_&&Map.prototype.forEach,J="function"==typeof Set&&Set.prototype,L=Object.getOwnPropertyDescriptor&&J?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,H=J&&L&&"function"==typeof L.get?L.get:null,Q=J&&Set.prototype.forEach,Z="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,K="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,X="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,Y=Boolean.prototype.valueOf,tt=Object.prototype.toString,rt=Function.prototype.toString,et=String.prototype.match,nt="function"==typeof BigInt?BigInt.prototype.valueOf:null,ot=Object.getOwnPropertySymbols,it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,ut="function"==typeof Symbol&&"object"==typeof Symbol.iterator,ft=Object.prototype.propertyIsEnumerable,at=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),ct={__proto__:null,default:{}}.custom,yt=ct&&vt(ct)?ct:null,pt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,lt=function t(r,e,n,o){var i=e||{};if(mt(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(mt(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!mt(i,"customInspect")||i.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(mt(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return St(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var f=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=f&&f>0&&"object"==typeof r)return dt(r)?"[Array]":"[Object]";var a,c=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(jt(o,r)>=0)return"[Circular]";function y(r,e,u){if(e&&(o=o.slice()).push(e),u){var f={depth:i.depth};return mt(i,"quoteStyle")&&(f.quoteStyle=i.quoteStyle),t(r,f,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=et.call(rt.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),l=Rt(r,y);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(vt(r)){var s=ut?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):it.call(r);return"object"!=typeof r||ut?s:Ot(s)}if((a=r)&&"object"==typeof a&&("undefined"!=typeof HTMLElement&&a instanceof HTMLElement||"string"==typeof a.nodeName&&"function"==typeof a.getAttribute)){for(var b="<"+String(r.nodeName).toLowerCase(),d=r.attributes||[],v=0;v"}if(dt(r)){if(0===r.length)return"[]";var h=Rt(r,y);return c&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+Et(h,c)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r)){var m=Rt(r,y);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&u){if(yt&&"function"==typeof r[yt])return r[yt]();if("symbol"!==u&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!V||!t||"object"!=typeof t)return!1;try{V.call(t);try{H.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return z.call(r,function(t,e){g.push(y(e,r,!0)+" => "+y(t,r))}),Pt("Map",V.call(r),g,c)}if(function(t){if(!H||!t||"object"!=typeof t)return!1;try{H.call(t);try{V.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return Q.call(r,function(t){j.push(y(t,r))}),Pt("Set",H.call(r),j,c)}if(function(t){if(!Z||!t||"object"!=typeof t)return!1;try{Z.call(t,Z);try{K.call(t,K)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return wt("WeakMap");if(function(t){if(!K||!t||"object"!=typeof t)return!1;try{K.call(t,K);try{Z.call(t,Z)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return wt("WeakSet");if(function(t){if(!X||!t||"object"!=typeof t)return!1;try{return X.call(t),!0}catch(t){}return!1}(r))return wt("WeakRef");if(function(t){return!("[object Number]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r))return Ot(y(Number(r)));if(function(t){if(!t||"object"!=typeof t||!nt)return!1;try{return nt.call(t),!0}catch(t){}return!1}(r))return Ot(y(nt.call(r)));if(function(t){return!("[object Boolean]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r))return Ot(Y.call(r));if(function(t){return!("[object String]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r))return Ot(y(String(r)));if(!function(t){return!("[object Date]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r)&&!function(t){return!("[object RegExp]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r)){var S=Rt(r,y),A=at?at(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&&pt&&Object(r)===r&&pt in r?gt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":c?P+"{"+Et(S,c)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function st(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function bt(t){return String(t).replace(/"/g,""")}function dt(t){return!("[object Array]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}function vt(t){if(ut)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!it)return!1;try{return it.call(t),!0}catch(t){}return!1}var ht=Object.prototype.hasOwnProperty||function(t){return t in this};function mt(t,r){return ht.call(t,r)}function gt(t){return tt.call(t)}function jt(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return St(t.slice(0,r.maxStringLength),r)+n}return st(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,At),"single",r)}function At(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function Ot(t){return"Object("+t+")"}function wt(t){return t+" { ? }"}function Pt(t,r,e,n){return t+" ("+r+") {"+(n?Et(e,n):e.join(", "))+"}"}function Et(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function Rt(t,r){var e=dt(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if(Vt(e)){for(var n=[],o=0;o=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||o===_t.RFC1738&&(40===a||41===a)?u+=i.charAt(f):a<128?u+=zt[a]:a<2048?u+=zt[192|a>>6]+zt[128|63&a]:a<55296||a>=57344?u+=zt[224|a>>12]+zt[128|a>>6&63]+zt[128|63&a]:(a=65536+((1023&a)<<10|1023&i.charCodeAt(f+=1)),u+=zt[240|a>>18]+zt[128|a>>12&63]+zt[128|a>>6&63]+zt[128|63&a])}return u},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if(Vt(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Zt(f))m=f;else{var j=Object.keys(h);m=a?j.sort(a):j}for(var S=0;S-1?t.split(","):t},ar=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,u=e.depth>0&&/(\[[^[\]]*])/.exec(o),f=u?o.slice(0,u.index):o,a=[];if(f){if(!e.plainObjects&&nr.call(Object.prototype,f)&&!e.allowPrototypes)return;a.push(f)}for(var c=0;e.depth>0&&null!==(u=i.exec(o))&&c=0;--i){var u,f=t[i];if("[]"===f&&e.parseArrays)u=[].concat(o);else{u=e.plainObjects?Object.create(null):{};var a="["===f.charAt(0)&&"]"===f.charAt(f.length-1)?f.slice(1,-1):f,c=parseInt(a,10);e.parseArrays||""!==a?!isNaN(c)&&f!==a&&String(c)===a&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(u=[])[c]=o:u[a]=o:u={0:o}}o=u}return o}(a,r,e,n)}},cr=function(){function t(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}var e=t.prototype;return e.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+r+"$").test(t.replace(/\/+$/,"").split("?").shift())},e.compile=function(t){var r=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(e,n){var o;if([null,void 0].includes(t[n])&&r.parameterSegments.find(function(t){return t.name===n}).required)throw new Error("Ziggy error: '"+n+"' parameter is required for route '"+r.name+"'.");return encodeURIComponent(null!=(o=t[n])?o:"")}).replace(/\/+$/,""):this.template},r(t,[{key:"template",get:function(){return((this.config.absolute?this.definition.domain?""+this.config.url.match(/^\w+:\/\//)[0]+this.definition.domain+(this.config.port?":"+this.config.port:""):this.config.url:"")+"/"+this.definition.uri).replace(/\/+$/,"")}},{key:"parameterSegments",get:function(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),yr=function(t){var n,i;function u(r,n,o,i){var u,f;if(void 0===o&&(o=!0),(f=t.call(this)||this).t=null!=(u=null!=i?i:Ziggy)?u:null==globalThis?void 0:globalThis.Ziggy,f.t=e({},f.t,{absolute:o}),r){if(!f.t.routes[r])throw new Error("Ziggy error: route '"+r+"' is not in the route list.");f.i=new cr(r,f.t.routes[r],f.t),f.u=f.p(n)}return f}i=t,(n=u).prototype=Object.create(i.prototype),n.prototype.constructor=n,o(n,i);var f=u.prototype;return f.toString=function(){var t=this,r=Object.keys(this.u).filter(function(r){return!t.i.parameterSegments.some(function(t){return t.name===r})}).filter(function(t){return"_query"!==t}).reduce(function(r,n){var o;return e({},r,((o={})[n]=t.u[n],o))},{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return rr;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||rr.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=_t.default;if(void 0!==t.format){if(!Ht.call(_t.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=_t.formatters[e],o=rr.filter;return("function"==typeof t.filter||Zt(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:rr.addQueryPrefix,allowDots:void 0===t.allowDots?rr.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:rr.charsetSentinel,delimiter:void 0===t.delimiter?rr.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:rr.encode,encoder:"function"==typeof t.encoder?t.encoder:rr.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:rr.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:rr.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:rr.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:rr.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Zt(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var u=Qt[r&&r.arrayFormat in Qt?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var f=Ct(),a=0;a0?p+y:""}(e({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,r){return"boolean"==typeof t?Number(t):r(t)}})},f.current=function(t,r){var e=this,n=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),o=Object.entries(this.t.routes).find(function(r){return new cr(t,r[1],e.t).matchesUrl(n)})||[void 0,void 0],i=o[0],u=o[1];if(!t)return i;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(i);if([null,void 0].includes(r)||!f)return f;var a=new cr(i,u,this.t);r=this.p(r,a);var c=this.v(u);return!(!Object.values(r).every(function(t){return!t})||Object.values(c).length)||Object.entries(r).every(function(t){return c[t[0]]==t[1]})},f.l=function(){var t,r,e,n,o,i,u="undefined"!=typeof window?window.location:{},f=u.host,a=u.pathname,c=u.search;return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:void 0===f?"":f,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:void 0===a?"":a,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:void 0===c?"":c}},f.has=function(t){return Object.keys(this.t.routes).includes(t)},f.p=function(t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=this.i),t=["string","number"].includes(typeof t)?[t]:t;var o=r.parameterSegments.filter(function(t){return!n.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,r,n){var i,u;return e({},t,o[n]?((i={})[o[n].name]=r,i):((u={})[r]="",u))},{});else if(1===o.length&&!t[o[0].name]&&(t.hasOwnProperty(Object.values(r.bindings)[0])||t.hasOwnProperty("id"))){var i;(i={})[o[0].name]=t,t=i}return e({},this.h(r),this.m(t,r))},f.h=function(t){var r=this;return t.parameterSegments.filter(function(t){return r.t.defaults[t.name]}).reduce(function(t,n,o){var i,u=n.name;return e({},t,((i={})[u]=r.t.defaults[u],i))},{})},f.m=function(t,r){var n=r.bindings,o=r.parameterSegments;return Object.entries(t).reduce(function(t,r){var i,u,f=r[0],a=r[1];if(!a||"object"!=typeof a||Array.isArray(a)||!o.some(function(t){return t.name===f}))return e({},t,((u={})[f]=a,u));if(!a.hasOwnProperty(n[f])){if(!a.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+f+"' parameter is missing route model binding key '"+n[f]+"'.");n[f]="id"}return e({},t,((i={})[f]=a[n[f]],i))},{})},f.v=function(t){var r,n=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),o=function(t,r,n){void 0===r&&(r="");var o=[t,r].map(function(t){return t.split(n)}),i=o[0];return o[1].reduce(function(t,r,n){var o;return/^{[^}?]+\??}$/.test(r)&&i[n]?e({},t,((o={})[r.replace(/^{|\??}$/g,"")]=i[n],o)):t},{})};return e({},o(this.l().host,t.domain,"."),o(n,t.uri,"/"),function(t,r){var e=ir;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,u=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(a=or(a)?[a]:a),n[f]=nr.call(n,f)?Lt.combine(n[f],a):a}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),u=0;u1&&"boolean"!=typeof r)throw new m('"allowMissing" argument must be a boolean');var e=T(t),n=e.length>0?e[0]:"",o=B("%"+n+"%",r),i=o.name,u=o.value,f=!1,a=o.alias;a&&(n=a[0],M(e,k([0,1],a)));for(var c=1,y=!0;c=e.length){var b=j(u,p);u=(y=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:u[p]}else y=d(u,p),u=u[p];y&&!f&&(R[i]=u)}}return u},D=function(t){var r={exports:{}};return function(t){var r=C("%Function.prototype.apply%"),e=C("%Function.prototype.call%"),n=C("%Reflect.apply%",!0)||b.call(e,r),o=C("%Object.getOwnPropertyDescriptor%",!0),i=C("%Object.defineProperty%",!0),u=C("%Math.max%");if(i)try{i({},"a",{value:1})}catch(t){i=null}t.exports=function(t){var r=n(b,e,arguments);return o&&i&&o(r,"length").configurable&&i(r,"length",{value:1+u(0,t.length-(arguments.length-1))}),r};var f=function(){return n(b,r,arguments)};i?i(t.exports,"apply",{value:f}):t.exports.apply=f}(r),r.exports}(),$=D(C("String.prototype.indexOf")),G=function(t,r){var e=C(t,!!r);return"function"==typeof e&&$(t,".prototype.")>-1?D(e):e},_="function"==typeof Map&&Map.prototype,q=Object.getOwnPropertyDescriptor&&_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,V=_&&q&&"function"==typeof q.get?q.get:null,z=_&&Map.prototype.forEach,J="function"==typeof Set&&Set.prototype,L=Object.getOwnPropertyDescriptor&&J?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,H=J&&L&&"function"==typeof L.get?L.get:null,Q=J&&Set.prototype.forEach,Z="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,K="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,X="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,Y=Boolean.prototype.valueOf,tt=Object.prototype.toString,rt=Function.prototype.toString,et=String.prototype.match,nt="function"==typeof BigInt?BigInt.prototype.valueOf:null,ot=Object.getOwnPropertySymbols,it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,ut="function"==typeof Symbol&&"object"==typeof Symbol.iterator,ft=Object.prototype.propertyIsEnumerable,at=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),ct={__proto__:null,default:{}}.custom,yt=ct&&vt(ct)?ct:null,pt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,lt=function t(r,e,n,o){var i=e||{};if(mt(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(mt(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!mt(i,"customInspect")||i.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(mt(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return St(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var f=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=f&&f>0&&"object"==typeof r)return dt(r)?"[Array]":"[Object]";var a,c=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(jt(o,r)>=0)return"[Circular]";function y(r,e,u){if(e&&(o=o.slice()).push(e),u){var f={depth:i.depth};return mt(i,"quoteStyle")&&(f.quoteStyle=i.quoteStyle),t(r,f,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=et.call(rt.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),l=Rt(r,y);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(vt(r)){var s=ut?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):it.call(r);return"object"!=typeof r||ut?s:Ot(s)}if((a=r)&&"object"==typeof a&&("undefined"!=typeof HTMLElement&&a instanceof HTMLElement||"string"==typeof a.nodeName&&"function"==typeof a.getAttribute)){for(var b="<"+String(r.nodeName).toLowerCase(),d=r.attributes||[],v=0;v"}if(dt(r)){if(0===r.length)return"[]";var h=Rt(r,y);return c&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+Et(h,c)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r)){var m=Rt(r,y);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&u){if(yt&&"function"==typeof r[yt])return r[yt]();if("symbol"!==u&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!V||!t||"object"!=typeof t)return!1;try{V.call(t);try{H.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return z.call(r,function(t,e){g.push(y(e,r,!0)+" => "+y(t,r))}),Pt("Map",V.call(r),g,c)}if(function(t){if(!H||!t||"object"!=typeof t)return!1;try{H.call(t);try{V.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return Q.call(r,function(t){j.push(y(t,r))}),Pt("Set",H.call(r),j,c)}if(function(t){if(!Z||!t||"object"!=typeof t)return!1;try{Z.call(t,Z);try{K.call(t,K)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return wt("WeakMap");if(function(t){if(!K||!t||"object"!=typeof t)return!1;try{K.call(t,K);try{Z.call(t,Z)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return wt("WeakSet");if(function(t){if(!X||!t||"object"!=typeof t)return!1;try{return X.call(t),!0}catch(t){}return!1}(r))return wt("WeakRef");if(function(t){return!("[object Number]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r))return Ot(y(Number(r)));if(function(t){if(!t||"object"!=typeof t||!nt)return!1;try{return nt.call(t),!0}catch(t){}return!1}(r))return Ot(y(nt.call(r)));if(function(t){return!("[object Boolean]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r))return Ot(Y.call(r));if(function(t){return!("[object String]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r))return Ot(y(String(r)));if(!function(t){return!("[object Date]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r)&&!function(t){return!("[object RegExp]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}(r)){var S=Rt(r,y),A=at?at(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&&pt&&Object(r)===r&&pt in r?gt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":c?P+"{"+Et(S,c)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function st(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function bt(t){return String(t).replace(/"/g,""")}function dt(t){return!("[object Array]"!==gt(t)||pt&&"object"==typeof t&&pt in t)}function vt(t){if(ut)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!it)return!1;try{return it.call(t),!0}catch(t){}return!1}var ht=Object.prototype.hasOwnProperty||function(t){return t in this};function mt(t,r){return ht.call(t,r)}function gt(t){return tt.call(t)}function jt(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return St(t.slice(0,r.maxStringLength),r)+n}return st(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,At),"single",r)}function At(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function Ot(t){return"Object("+t+")"}function wt(t){return t+" { ? }"}function Pt(t,r,e,n){return t+" ("+r+") {"+(n?Et(e,n):e.join(", "))+"}"}function Et(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function Rt(t,r){var e=dt(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if(Vt(e)){for(var n=[],o=0;o=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||o===_t.RFC1738&&(40===a||41===a)?u+=i.charAt(f):a<128?u+=zt[a]:a<2048?u+=zt[192|a>>6]+zt[128|63&a]:a<55296||a>=57344?u+=zt[224|a>>12]+zt[128|a>>6&63]+zt[128|63&a]:(a=65536+((1023&a)<<10|1023&i.charCodeAt(f+=1)),u+=zt[240|a>>18]+zt[128|a>>12&63]+zt[128|a>>6&63]+zt[128|63&a])}return u},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if(Vt(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Zt(f))m=f;else{var j=Object.keys(h);m=a?j.sort(a):j}for(var S=0;S-1?t.split(","):t},ar=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,u=e.depth>0&&/(\[[^[\]]*])/.exec(o),f=u?o.slice(0,u.index):o,a=[];if(f){if(!e.plainObjects&&nr.call(Object.prototype,f)&&!e.allowPrototypes)return;a.push(f)}for(var c=0;e.depth>0&&null!==(u=i.exec(o))&&c=0;--i){var u,f=t[i];if("[]"===f&&e.parseArrays)u=[].concat(o);else{u=e.plainObjects?Object.create(null):{};var a="["===f.charAt(0)&&"]"===f.charAt(f.length-1)?f.slice(1,-1):f,c=parseInt(a,10);e.parseArrays||""!==a?!isNaN(c)&&f!==a&&String(c)===a&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(u=[])[c]=o:u[a]=o:u={0:o}}o=u}return o}(a,r,e,n)}},cr=function(){function t(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}var e=t.prototype;return e.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}?]*\?}/g,"([^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+r+"$").test(t.replace(/\/+$/,"").split("?").shift())},e.compile=function(t){var r=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(e,n){var o;if([null,void 0].includes(t[n])&&r.parameterSegments.find(function(t){return t.name===n}).required)throw new Error("Ziggy error: '"+n+"' parameter is required for route '"+r.name+"'.");return encodeURIComponent(null!=(o=t[n])?o:"")}).replace(/\/+$/,""):this.template},r(t,[{key:"template",get:function(){return((this.config.absolute?this.definition.domain?""+this.config.url.match(/^\w+:\/\//)[0]+this.definition.domain+(this.config.port?":"+this.config.port:""):this.config.url:"")+"/"+this.definition.uri).replace(/\/+$/,"")}},{key:"parameterSegments",get:function(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),yr=function(t){var n,i;function u(r,n,o,i){var u,f;if(void 0===o&&(o=!0),(f=t.call(this)||this).t=null!=(u=null!=i?i:Ziggy)?u:null==globalThis?void 0:globalThis.Ziggy,f.t=e({},f.t,{absolute:o}),r){if(!f.t.routes[r])throw new Error("Ziggy error: route '"+r+"' is not in the route list.");f.i=new cr(r,f.t.routes[r],f.t),f.u=f.p(n)}return f}i=t,(n=u).prototype=Object.create(i.prototype),n.prototype.constructor=n,o(n,i);var f=u.prototype;return f.toString=function(){var t=this,r=Object.keys(this.u).filter(function(r){return!t.i.parameterSegments.some(function(t){return t.name===r})}).filter(function(t){return"_query"!==t}).reduce(function(r,n){var o;return e({},r,((o={})[n]=t.u[n],o))},{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return rr;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||rr.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=_t.default;if(void 0!==t.format){if(!Ht.call(_t.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=_t.formatters[e],o=rr.filter;return("function"==typeof t.filter||Zt(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:rr.addQueryPrefix,allowDots:void 0===t.allowDots?rr.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:rr.charsetSentinel,delimiter:void 0===t.delimiter?rr.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:rr.encode,encoder:"function"==typeof t.encoder?t.encoder:rr.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:rr.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:rr.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:rr.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:rr.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Zt(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var u=Qt[r&&r.arrayFormat in Qt?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var f=Ct(),a=0;a0?p+y:""}(e({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,r){return"boolean"==typeof t?Number(t):r(t)}})},f.current=function(t,r){var e=this,n=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),o=Object.entries(this.t.routes).find(function(r){return new cr(t,r[1],e.t).matchesUrl(n)})||[void 0,void 0],i=o[0],u=o[1];if(!t)return i;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(i);if([null,void 0].includes(r)||!f)return f;var a=new cr(i,u,this.t);r=this.p(r,a);var c=this.v(u);return!(!Object.values(r).every(function(t){return!t})||Object.values(c).length)||Object.entries(r).every(function(t){return c[t[0]]==t[1]})},f.l=function(){var t,r,e,n,o,i,u="undefined"!=typeof window?window.location:{},f=u.host,a=u.pathname,c=u.search;return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:void 0===f?"":f,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:void 0===a?"":a,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:void 0===c?"":c}},f.has=function(t){return Object.keys(this.t.routes).includes(t)},f.p=function(t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=this.i),t=["string","number"].includes(typeof t)?[t]:t;var o=r.parameterSegments.filter(function(t){return!n.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,r,n){var i,u;return e({},t,o[n]?((i={})[o[n].name]=r,i):((u={})[r]="",u))},{});else if(1===o.length&&!t[o[0].name]&&(t.hasOwnProperty(Object.values(r.bindings)[0])||t.hasOwnProperty("id"))){var i;(i={})[o[0].name]=t,t=i}return e({},this.h(r),this.m(t,r))},f.h=function(t){var r=this;return t.parameterSegments.filter(function(t){return r.t.defaults[t.name]}).reduce(function(t,n,o){var i,u=n.name;return e({},t,((i={})[u]=r.t.defaults[u],i))},{})},f.m=function(t,r){var n=r.bindings,o=r.parameterSegments;return Object.entries(t).reduce(function(t,r){var i,u,f=r[0],a=r[1];if(!a||"object"!=typeof a||Array.isArray(a)||!o.some(function(t){return t.name===f}))return e({},t,((u={})[f]=a,u));if(!a.hasOwnProperty(n[f])){if(!a.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+f+"' parameter is missing route model binding key '"+n[f]+"'.");n[f]="id"}return e({},t,((i={})[f]=a[n[f]],i))},{})},f.v=function(t){var r,n=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),o=function(t,r,n){void 0===r&&(r="");var o=[t,r].map(function(t){return t.split(n)}),i=o[0];return o[1].reduce(function(t,r,n){var o;return/{[^}?]+\??}/.test(r)&&i[n]?e({},t,((o={})[r.replace(/.*{|\??}.*/g,"")]=i[n].replace(r.match(/^[^{]*/g),"").replace(r.match(/[^}]*$/g),""),o)):t},{})};return e({},o(this.l().host,t.domain,"."),o(n,t.uri,"/"),function(t,r){var e=ir;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,u=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(a=or(a)?[a]:a),n[f]=nr.call(n,f)?Lt.combine(n[f],a):a}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),u=0;u1&&"boolean"!=typeof r)throw new b('"allowMissing" argument must be a boolean');var e=N(t),n=e.length>0?e[0]:"",o=B("%"+n+"%",r),i=o.name,u=o.value,f=!1,a=o.alias;a&&(n=a[0],k(e,I([0,1],a)));for(var c=1,y=!0;c=e.length){var h=m(u,p);u=(y=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:u[p]}else y=s(u,p),u=u[p];y&&!f&&(E[i]=u)}}return u},C=(function(t){var r=T("%Function.prototype.apply%"),e=T("%Function.prototype.call%"),n=T("%Reflect.apply%",!0)||l.call(e,r),o=T("%Object.getOwnPropertyDescriptor%",!0),i=T("%Object.defineProperty%",!0),u=T("%Math.max%");if(i)try{i({},"a",{value:1})}catch(t){i=null}t.exports=function(t){var r=n(l,e,arguments);if(o&&i){var f=o(r,"length");f.configurable&&i(r,"length",{value:1+u(0,t.length-(arguments.length-1))})}return r};var f=function(){return n(l,r,arguments)};i?i(t.exports,"apply",{value:f}):t.exports.apply=f}(g={exports:{}}),g.exports),D=C(T("String.prototype.indexOf")),$=function(t,r){var e=T(t,!!r);return"function"==typeof e&&D(t,".prototype.")>-1?C(e):e},G="function"==typeof Map&&Map.prototype,_=Object.getOwnPropertyDescriptor&&G?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,q=G&&_&&"function"==typeof _.get?_.get:null,V=G&&Map.prototype.forEach,z="function"==typeof Set&&Set.prototype,J=Object.getOwnPropertyDescriptor&&z?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,L=z&&J&&"function"==typeof J.get?J.get:null,H=z&&Set.prototype.forEach,Q="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,Z="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,K="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,X=Boolean.prototype.valueOf,Y=Object.prototype.toString,tt=Function.prototype.toString,rt=String.prototype.match,et="function"==typeof BigInt?BigInt.prototype.valueOf:null,nt=Object.getOwnPropertySymbols,ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,it="function"==typeof Symbol&&"object"==typeof Symbol.iterator,ut=Object.prototype.propertyIsEnumerable,ft=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),at={__proto__:null,default:{}}.custom,ct=at&&dt(at)?at:null,yt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,pt=function t(r,e,n,o){var i=e||{};if(ht(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ht(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!ht(i,"customInspect")||i.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ht(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return jt(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var f=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=f&&f>0&&"object"==typeof r)return vt(r)?"[Array]":"[Object]";var a,c=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(gt(o,r)>=0)return"[Circular]";function y(r,e,u){if(e&&(o=o.slice()).push(e),u){var f={depth:i.depth};return ht(i,"quoteStyle")&&(f.quoteStyle=i.quoteStyle),t(r,f,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=rt.call(tt.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),l=Et(r,y);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(dt(r)){var s=it?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):ot.call(r);return"object"!=typeof r||it?s:At(s)}if((a=r)&&"object"==typeof a&&("undefined"!=typeof HTMLElement&&a instanceof HTMLElement||"string"==typeof a.nodeName&&"function"==typeof a.getAttribute)){for(var v="<"+String(r.nodeName).toLowerCase(),d=r.attributes||[],b=0;b"}if(vt(r)){if(0===r.length)return"[]";var h=Et(r,y);return c&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+Pt(h,c)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)){var m=Et(r,y);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&u){if(ct&&"function"==typeof r[ct])return r[ct]();if("symbol"!==u&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!q||!t||"object"!=typeof t)return!1;try{q.call(t);try{L.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return V.call(r,function(t,e){g.push(y(e,r,!0)+" => "+y(t,r))}),wt("Map",q.call(r),g,c)}if(function(t){if(!L||!t||"object"!=typeof t)return!1;try{L.call(t);try{q.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return H.call(r,function(t){j.push(y(t,r))}),wt("Set",L.call(r),j,c)}if(function(t){if(!Q||!t||"object"!=typeof t)return!1;try{Q.call(t,Q);try{Z.call(t,Z)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return Ot("WeakMap");if(function(t){if(!Z||!t||"object"!=typeof t)return!1;try{Z.call(t,Z);try{Q.call(t,Q)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return Ot("WeakSet");if(function(t){if(!K||!t||"object"!=typeof t)return!1;try{return K.call(t),!0}catch(t){}return!1}(r))return Ot("WeakRef");if(function(t){return!("[object Number]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(y(Number(r)));if(function(t){if(!t||"object"!=typeof t||!et)return!1;try{return et.call(t),!0}catch(t){}return!1}(r))return At(y(et.call(r)));if(function(t){return!("[object Boolean]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(X.call(r));if(function(t){return!("[object String]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(y(String(r)));if(!function(t){return!("[object Date]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)&&!function(t){return!("[object RegExp]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)){var S=Et(r,y),A=ft?ft(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&&yt&&Object(r)===r&&yt in r?mt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":c?P+"{"+Pt(S,c)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function lt(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function st(t){return String(t).replace(/"/g,""")}function vt(t){return!("[object Array]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}function dt(t){if(it)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!ot)return!1;try{return ot.call(t),!0}catch(t){}return!1}var bt=Object.prototype.hasOwnProperty||function(t){return t in this};function ht(t,r){return bt.call(t,r)}function mt(t){return Y.call(t)}function gt(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return jt(t.slice(0,r.maxStringLength),r)+n}return lt(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,St),"single",r)}function St(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function At(t){return"Object("+t+")"}function Ot(t){return t+" { ? }"}function wt(t,r,e,n){return t+" ("+r+") {"+(n?Pt(e,n):e.join(", "))+"}"}function Pt(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function Et(t,r){var e=vt(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if(_t(e)){for(var n=[],o=0;o=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||o===$t.RFC1738&&(40===a||41===a)?u+=i.charAt(f):a<128?u+=qt[a]:a<2048?u+=qt[192|a>>6]+qt[128|63&a]:a<55296||a>=57344?u+=qt[224|a>>12]+qt[128|a>>6&63]+qt[128|63&a]:(a=65536+((1023&a)<<10|1023&i.charCodeAt(f+=1)),u+=qt[240|a>>18]+qt[128|a>>12&63]+qt[128|a>>6&63]+qt[128|63&a])}return u},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if(_t(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Ht(f))m=f;else{var j=Object.keys(h);m=a?j.sort(a):j}for(var S=0;S-1?t.split(","):t},ur=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,u=e.depth>0&&/(\[[^[\]]*])/.exec(o),f=u?o.slice(0,u.index):o,a=[];if(f){if(!e.plainObjects&&rr.call(Object.prototype,f)&&!e.allowPrototypes)return;a.push(f)}for(var c=0;e.depth>0&&null!==(u=i.exec(o))&&c=0;--i){var u,f=t[i];if("[]"===f&&e.parseArrays)u=[].concat(o);else{u=e.plainObjects?Object.create(null):{};var a="["===f.charAt(0)&&"]"===f.charAt(f.length-1)?f.slice(1,-1):f,c=parseInt(a,10);e.parseArrays||""!==a?!isNaN(c)&&f!==a&&String(c)===a&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(u=[])[c]=o:u[a]=o:u={0:o}}o=u}return o}(a,r,e,n)}},fr=function(){function t(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}var e=t.prototype;return e.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+r+"$").test(t.replace(/\/+$/,"").split("?").shift())},e.compile=function(t){var r=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(e,n){var o;if([null,void 0].includes(t[n])&&r.parameterSegments.find(function(t){return t.name===n}).required)throw new Error("Ziggy error: '"+n+"' parameter is required for route '"+r.name+"'.");return encodeURIComponent(null!=(o=t[n])?o:"")}).replace(/\/+$/,""):this.template},r(t,[{key:"template",get:function(){return((this.config.absolute?this.definition.domain?""+this.config.url.match(/^\w+:\/\//)[0]+this.definition.domain+(this.config.port?":"+this.config.port:""):this.config.url:"")+"/"+this.definition.uri).replace(/\/+$/,"")}},{key:"parameterSegments",get:function(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),ar=function(t){var n,i;function u(r,n,o,i){var u,f;if(void 0===o&&(o=!0),(f=t.call(this)||this).t=null!=(u=null!=i?i:Ziggy)?u:null==globalThis?void 0:globalThis.Ziggy,f.t=e({},f.t,{absolute:o}),r){if(!f.t.routes[r])throw new Error("Ziggy error: route '"+r+"' is not in the route list.");f.i=new fr(r,f.t.routes[r],f.t),f.u=f.p(n)}return f}i=t,(n=u).prototype=Object.create(i.prototype),n.prototype.constructor=n,o(n,i);var f=u.prototype;return f.toString=function(){var t=this,r=Object.keys(this.u).filter(function(r){return!t.i.parameterSegments.some(function(t){return t.name===r})}).filter(function(t){return"_query"!==t}).reduce(function(r,n){var o;return e({},r,((o={})[n]=t.u[n],o))},{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return Yt;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||Yt.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=$t.default;if(void 0!==t.format){if(!Jt.call($t.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=$t.formatters[e],o=Yt.filter;return("function"==typeof t.filter||Ht(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:Yt.addQueryPrefix,allowDots:void 0===t.allowDots?Yt.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Yt.charsetSentinel,delimiter:void 0===t.delimiter?Yt.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:Yt.encode,encoder:"function"==typeof t.encoder?t.encoder:Yt.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:Yt.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:Yt.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:Yt.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Yt.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Ht(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var u=Lt[r&&r.arrayFormat in Lt?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var f=Tt(),a=0;a0?p+y:""}(e({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,r){return"boolean"==typeof t?Number(t):r(t)}})},f.current=function(t,r){var e=this,n=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),o=Object.entries(this.t.routes).find(function(r){return new fr(t,r[1],e.t).matchesUrl(n)})||[void 0,void 0],i=o[0],u=o[1];if(!t)return i;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(i);if([null,void 0].includes(r)||!f)return f;var a=new fr(i,u,this.t);r=this.p(r,a);var c=this.v(u);return!(!Object.values(r).every(function(t){return!t})||Object.values(c).length)||Object.entries(r).every(function(t){return c[t[0]]==t[1]})},f.l=function(){var t,r,e,n,o,i,u="undefined"!=typeof window?window.location:{},f=u.host,a=u.pathname,c=u.search;return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:void 0===f?"":f,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:void 0===a?"":a,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:void 0===c?"":c}},f.has=function(t){return Object.keys(this.t.routes).includes(t)},f.p=function(t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=this.i),t=["string","number"].includes(typeof t)?[t]:t;var o=r.parameterSegments.filter(function(t){return!n.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,r,n){var i,u;return e({},t,o[n]?((i={})[o[n].name]=r,i):((u={})[r]="",u))},{});else if(1===o.length&&!t[o[0].name]&&(t.hasOwnProperty(Object.values(r.bindings)[0])||t.hasOwnProperty("id"))){var i;(i={})[o[0].name]=t,t=i}return e({},this.h(r),this.m(t,r))},f.h=function(t){var r=this;return t.parameterSegments.filter(function(t){return r.t.defaults[t.name]}).reduce(function(t,n,o){var i,u=n.name;return e({},t,((i={})[u]=r.t.defaults[u],i))},{})},f.m=function(t,r){var n=r.bindings,o=r.parameterSegments;return Object.entries(t).reduce(function(t,r){var i,u,f=r[0],a=r[1];if(!a||"object"!=typeof a||Array.isArray(a)||!o.some(function(t){return t.name===f}))return e({},t,((u={})[f]=a,u));if(!a.hasOwnProperty(n[f])){if(!a.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+f+"' parameter is missing route model binding key '"+n[f]+"'.");n[f]="id"}return e({},t,((i={})[f]=a[n[f]],i))},{})},f.v=function(t){var r,n=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),o=function(t,r,n){void 0===r&&(r="");var o=[t,r].map(function(t){return t.split(n)}),i=o[0];return o[1].reduce(function(t,r,n){var o;return/^{[^}?]+\??}$/.test(r)&&i[n]?e({},t,((o={})[r.replace(/^{|\??}$/g,"")]=i[n],o)):t},{})};return e({},o(this.l().host,t.domain,"."),o(n,t.uri,"/"),function(t,r){var e=nr;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,u=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(a=er(a)?[a]:a),n[f]=rr.call(n,f)?zt.combine(n[f],a):a}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),u=0;u1&&"boolean"!=typeof r)throw new b('"allowMissing" argument must be a boolean');var e=N(t),n=e.length>0?e[0]:"",o=B("%"+n+"%",r),i=o.name,u=o.value,f=!1,a=o.alias;a&&(n=a[0],k(e,I([0,1],a)));for(var c=1,y=!0;c=e.length){var h=m(u,p);u=(y=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:u[p]}else y=s(u,p),u=u[p];y&&!f&&(E[i]=u)}}return u},C=(function(t){var r=T("%Function.prototype.apply%"),e=T("%Function.prototype.call%"),n=T("%Reflect.apply%",!0)||l.call(e,r),o=T("%Object.getOwnPropertyDescriptor%",!0),i=T("%Object.defineProperty%",!0),u=T("%Math.max%");if(i)try{i({},"a",{value:1})}catch(t){i=null}t.exports=function(t){var r=n(l,e,arguments);if(o&&i){var f=o(r,"length");f.configurable&&i(r,"length",{value:1+u(0,t.length-(arguments.length-1))})}return r};var f=function(){return n(l,r,arguments)};i?i(t.exports,"apply",{value:f}):t.exports.apply=f}(g={exports:{}}),g.exports),D=C(T("String.prototype.indexOf")),$=function(t,r){var e=T(t,!!r);return"function"==typeof e&&D(t,".prototype.")>-1?C(e):e},G="function"==typeof Map&&Map.prototype,_=Object.getOwnPropertyDescriptor&&G?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,q=G&&_&&"function"==typeof _.get?_.get:null,V=G&&Map.prototype.forEach,z="function"==typeof Set&&Set.prototype,J=Object.getOwnPropertyDescriptor&&z?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,L=z&&J&&"function"==typeof J.get?J.get:null,H=z&&Set.prototype.forEach,Q="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,Z="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,K="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,X=Boolean.prototype.valueOf,Y=Object.prototype.toString,tt=Function.prototype.toString,rt=String.prototype.match,et="function"==typeof BigInt?BigInt.prototype.valueOf:null,nt=Object.getOwnPropertySymbols,ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,it="function"==typeof Symbol&&"object"==typeof Symbol.iterator,ut=Object.prototype.propertyIsEnumerable,ft=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),at={__proto__:null,default:{}}.custom,ct=at&&dt(at)?at:null,yt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,pt=function t(r,e,n,o){var i=e||{};if(ht(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ht(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!ht(i,"customInspect")||i.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ht(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return jt(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var f=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=f&&f>0&&"object"==typeof r)return vt(r)?"[Array]":"[Object]";var a,c=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(gt(o,r)>=0)return"[Circular]";function y(r,e,u){if(e&&(o=o.slice()).push(e),u){var f={depth:i.depth};return ht(i,"quoteStyle")&&(f.quoteStyle=i.quoteStyle),t(r,f,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=rt.call(tt.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),l=Et(r,y);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(dt(r)){var s=it?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):ot.call(r);return"object"!=typeof r||it?s:At(s)}if((a=r)&&"object"==typeof a&&("undefined"!=typeof HTMLElement&&a instanceof HTMLElement||"string"==typeof a.nodeName&&"function"==typeof a.getAttribute)){for(var v="<"+String(r.nodeName).toLowerCase(),d=r.attributes||[],b=0;b"}if(vt(r)){if(0===r.length)return"[]";var h=Et(r,y);return c&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+Pt(h,c)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)){var m=Et(r,y);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&u){if(ct&&"function"==typeof r[ct])return r[ct]();if("symbol"!==u&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!q||!t||"object"!=typeof t)return!1;try{q.call(t);try{L.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return V.call(r,function(t,e){g.push(y(e,r,!0)+" => "+y(t,r))}),wt("Map",q.call(r),g,c)}if(function(t){if(!L||!t||"object"!=typeof t)return!1;try{L.call(t);try{q.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return H.call(r,function(t){j.push(y(t,r))}),wt("Set",L.call(r),j,c)}if(function(t){if(!Q||!t||"object"!=typeof t)return!1;try{Q.call(t,Q);try{Z.call(t,Z)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return Ot("WeakMap");if(function(t){if(!Z||!t||"object"!=typeof t)return!1;try{Z.call(t,Z);try{Q.call(t,Q)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return Ot("WeakSet");if(function(t){if(!K||!t||"object"!=typeof t)return!1;try{return K.call(t),!0}catch(t){}return!1}(r))return Ot("WeakRef");if(function(t){return!("[object Number]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(y(Number(r)));if(function(t){if(!t||"object"!=typeof t||!et)return!1;try{return et.call(t),!0}catch(t){}return!1}(r))return At(y(et.call(r)));if(function(t){return!("[object Boolean]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(X.call(r));if(function(t){return!("[object String]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(y(String(r)));if(!function(t){return!("[object Date]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)&&!function(t){return!("[object RegExp]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)){var S=Et(r,y),A=ft?ft(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&&yt&&Object(r)===r&&yt in r?mt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":c?P+"{"+Pt(S,c)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function lt(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function st(t){return String(t).replace(/"/g,""")}function vt(t){return!("[object Array]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}function dt(t){if(it)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!ot)return!1;try{return ot.call(t),!0}catch(t){}return!1}var bt=Object.prototype.hasOwnProperty||function(t){return t in this};function ht(t,r){return bt.call(t,r)}function mt(t){return Y.call(t)}function gt(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return jt(t.slice(0,r.maxStringLength),r)+n}return lt(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,St),"single",r)}function St(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function At(t){return"Object("+t+")"}function Ot(t){return t+" { ? }"}function wt(t,r,e,n){return t+" ("+r+") {"+(n?Pt(e,n):e.join(", "))+"}"}function Pt(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function Et(t,r){var e=vt(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if(_t(e)){for(var n=[],o=0;o=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||o===$t.RFC1738&&(40===a||41===a)?u+=i.charAt(f):a<128?u+=qt[a]:a<2048?u+=qt[192|a>>6]+qt[128|63&a]:a<55296||a>=57344?u+=qt[224|a>>12]+qt[128|a>>6&63]+qt[128|63&a]:(a=65536+((1023&a)<<10|1023&i.charCodeAt(f+=1)),u+=qt[240|a>>18]+qt[128|a>>12&63]+qt[128|a>>6&63]+qt[128|63&a])}return u},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if(_t(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Ht(f))m=f;else{var j=Object.keys(h);m=a?j.sort(a):j}for(var S=0;S-1?t.split(","):t},ur=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,u=e.depth>0&&/(\[[^[\]]*])/.exec(o),f=u?o.slice(0,u.index):o,a=[];if(f){if(!e.plainObjects&&rr.call(Object.prototype,f)&&!e.allowPrototypes)return;a.push(f)}for(var c=0;e.depth>0&&null!==(u=i.exec(o))&&c=0;--i){var u,f=t[i];if("[]"===f&&e.parseArrays)u=[].concat(o);else{u=e.plainObjects?Object.create(null):{};var a="["===f.charAt(0)&&"]"===f.charAt(f.length-1)?f.slice(1,-1):f,c=parseInt(a,10);e.parseArrays||""!==a?!isNaN(c)&&f!==a&&String(c)===a&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(u=[])[c]=o:u[a]=o:u={0:o}}o=u}return o}(a,r,e,n)}},fr=function(){function t(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}var e=t.prototype;return e.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}?]*\?}/g,"([^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+r+"$").test(t.replace(/\/+$/,"").split("?").shift())},e.compile=function(t){var r=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(e,n){var o;if([null,void 0].includes(t[n])&&r.parameterSegments.find(function(t){return t.name===n}).required)throw new Error("Ziggy error: '"+n+"' parameter is required for route '"+r.name+"'.");return encodeURIComponent(null!=(o=t[n])?o:"")}).replace(/\/+$/,""):this.template},r(t,[{key:"template",get:function(){return((this.config.absolute?this.definition.domain?""+this.config.url.match(/^\w+:\/\//)[0]+this.definition.domain+(this.config.port?":"+this.config.port:""):this.config.url:"")+"/"+this.definition.uri).replace(/\/+$/,"")}},{key:"parameterSegments",get:function(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),ar=function(t){var n,i;function u(r,n,o,i){var u,f;if(void 0===o&&(o=!0),(f=t.call(this)||this).t=null!=(u=null!=i?i:Ziggy)?u:null==globalThis?void 0:globalThis.Ziggy,f.t=e({},f.t,{absolute:o}),r){if(!f.t.routes[r])throw new Error("Ziggy error: route '"+r+"' is not in the route list.");f.i=new fr(r,f.t.routes[r],f.t),f.u=f.p(n)}return f}i=t,(n=u).prototype=Object.create(i.prototype),n.prototype.constructor=n,o(n,i);var f=u.prototype;return f.toString=function(){var t=this,r=Object.keys(this.u).filter(function(r){return!t.i.parameterSegments.some(function(t){return t.name===r})}).filter(function(t){return"_query"!==t}).reduce(function(r,n){var o;return e({},r,((o={})[n]=t.u[n],o))},{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return Yt;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||Yt.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=$t.default;if(void 0!==t.format){if(!Jt.call($t.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=$t.formatters[e],o=Yt.filter;return("function"==typeof t.filter||Ht(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:Yt.addQueryPrefix,allowDots:void 0===t.allowDots?Yt.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Yt.charsetSentinel,delimiter:void 0===t.delimiter?Yt.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:Yt.encode,encoder:"function"==typeof t.encoder?t.encoder:Yt.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:Yt.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:Yt.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:Yt.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Yt.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Ht(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var u=Lt[r&&r.arrayFormat in Lt?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var f=Tt(),a=0;a0?p+y:""}(e({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,r){return"boolean"==typeof t?Number(t):r(t)}})},f.current=function(t,r){var e=this,n=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),o=Object.entries(this.t.routes).find(function(r){return new fr(t,r[1],e.t).matchesUrl(n)})||[void 0,void 0],i=o[0],u=o[1];if(!t)return i;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(i);if([null,void 0].includes(r)||!f)return f;var a=new fr(i,u,this.t);r=this.p(r,a);var c=this.v(u);return!(!Object.values(r).every(function(t){return!t})||Object.values(c).length)||Object.entries(r).every(function(t){return c[t[0]]==t[1]})},f.l=function(){var t,r,e,n,o,i,u="undefined"!=typeof window?window.location:{},f=u.host,a=u.pathname,c=u.search;return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:void 0===f?"":f,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:void 0===a?"":a,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:void 0===c?"":c}},f.has=function(t){return Object.keys(this.t.routes).includes(t)},f.p=function(t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=this.i),t=["string","number"].includes(typeof t)?[t]:t;var o=r.parameterSegments.filter(function(t){return!n.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,r,n){var i,u;return e({},t,o[n]?((i={})[o[n].name]=r,i):((u={})[r]="",u))},{});else if(1===o.length&&!t[o[0].name]&&(t.hasOwnProperty(Object.values(r.bindings)[0])||t.hasOwnProperty("id"))){var i;(i={})[o[0].name]=t,t=i}return e({},this.h(r),this.m(t,r))},f.h=function(t){var r=this;return t.parameterSegments.filter(function(t){return r.t.defaults[t.name]}).reduce(function(t,n,o){var i,u=n.name;return e({},t,((i={})[u]=r.t.defaults[u],i))},{})},f.m=function(t,r){var n=r.bindings,o=r.parameterSegments;return Object.entries(t).reduce(function(t,r){var i,u,f=r[0],a=r[1];if(!a||"object"!=typeof a||Array.isArray(a)||!o.some(function(t){return t.name===f}))return e({},t,((u={})[f]=a,u));if(!a.hasOwnProperty(n[f])){if(!a.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+f+"' parameter is missing route model binding key '"+n[f]+"'.");n[f]="id"}return e({},t,((i={})[f]=a[n[f]],i))},{})},f.v=function(t){var r,n=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),o=function(t,r,n){void 0===r&&(r="");var o=[t,r].map(function(t){return t.split(n)}),i=o[0];return o[1].reduce(function(t,r,n){var o;return/{[^}?]+\??}/.test(r)&&i[n]?e({},t,((o={})[r.replace(/.*{|\??}.*/g,"")]=i[n].replace(r.match(/^[^{]*/g),"").replace(r.match(/[^}]*$/g),""),o)):t},{})};return e({},o(this.l().host,t.domain,"."),o(n,t.uri,"/"),function(t,r){var e=nr;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,u=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(a=er(a)?[a]:a),n[f]=rr.call(n,f)?zt.combine(n[f],a):a}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),u=0;u1&&"boolean"!=typeof r)throw new y('"allowMissing" argument must be a boolean');var e=R(t),n=e.length>0?e[0]:"",o=I("%"+n+"%",r),i=o.name,f=o.value,c=!1,s=o.alias;s&&(n=s[0],O(e,A([0,1],s)));for(var l=1,d=!0;l=e.length){var m=p(f,b);f=(d=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:f[b]}else d=a(f,b),f=f[b];d&&!c&&(g[i]=f)}}return f},M=(function(t){var r=k("%Function.prototype.apply%"),e=k("%Function.prototype.call%"),n=k("%Reflect.apply%",!0)||i.call(e,r),o=k("%Object.getOwnPropertyDescriptor%",!0),a=k("%Object.defineProperty%",!0),u=k("%Math.max%");if(a)try{a({},"a",{value:1})}catch(t){a=null}t.exports=function(t){var r=n(i,e,arguments);if(o&&a){var f=o(r,"length");f.configurable&&a(r,"length",{value:1+u(0,t.length-(arguments.length-1))})}return r};var f=function(){return n(i,r,arguments)};a?a(t.exports,"apply",{value:f}):t.exports.apply=f}(s={exports:{}}),s.exports),x=M(k("String.prototype.indexOf")),U=function(t,r){var e=k(t,!!r);return"function"==typeof e&&x(t,".prototype.")>-1?M(e):e},$="function"==typeof Map&&Map.prototype,W=Object.getOwnPropertyDescriptor&&$?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,N=$&&W&&"function"==typeof W.get?W.get:null,B=$&&Map.prototype.forEach,T="function"==typeof Set&&Set.prototype,C=Object.getOwnPropertyDescriptor&&T?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,_=T&&C&&"function"==typeof C.get?C.get:null,D=T&&Set.prototype.forEach,G="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,q="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,V="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,z=Boolean.prototype.valueOf,J=Object.prototype.toString,L=Function.prototype.toString,H=String.prototype.match,Q="function"==typeof BigInt?BigInt.prototype.valueOf:null,Z=Object.getOwnPropertySymbols,K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,X="function"==typeof Symbol&&"object"==typeof Symbol.iterator,Y=Object.prototype.propertyIsEnumerable,tt=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),rt={__proto__:null,default:{}}.custom,et=rt&&ft(rt)?rt:null,nt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,ot=function t(r,e,n,o){var i=e||{};if(ct(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ct(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=!ct(i,"customInspect")||i.customInspect;if("boolean"!=typeof a&&"symbol"!==a)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ct(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return lt(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var u=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=u&&u>0&&"object"==typeof r)return ut(r)?"[Array]":"[Object]";var f,y=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(st(o,r)>=0)return"[Circular]";function c(r,e,a){if(e&&(o=o.slice()).push(e),a){var u={depth:i.depth};return ct(i,"quoteStyle")&&(u.quoteStyle=i.quoteStyle),t(r,u,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=H.call(L.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),s=gt(r,c);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(s.length>0?" { "+s.join(", ")+" }":"")}if(ft(r)){var l=X?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):K.call(r);return"object"!=typeof r||X?l:bt(l)}if((f=r)&&"object"==typeof f&&("undefined"!=typeof HTMLElement&&f instanceof HTMLElement||"string"==typeof f.nodeName&&"function"==typeof f.getAttribute)){for(var d="<"+String(r.nodeName).toLowerCase(),b=r.attributes||[],v=0;v"}if(ut(r)){if(0===r.length)return"[]";var h=gt(r,c);return y&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+mt(h,y)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)){var m=gt(r,c);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&a){if(et&&"function"==typeof r[et])return r[et]();if("symbol"!==a&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!N||!t||"object"!=typeof t)return!1;try{N.call(t);try{_.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return B.call(r,function(t,e){g.push(c(e,r,!0)+" => "+c(t,r))}),ht("Map",N.call(r),g,y)}if(function(t){if(!_||!t||"object"!=typeof t)return!1;try{_.call(t);try{N.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return D.call(r,function(t){j.push(c(t,r))}),ht("Set",_.call(r),j,y)}if(function(t){if(!G||!t||"object"!=typeof t)return!1;try{G.call(t,G);try{q.call(t,q)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return vt("WeakMap");if(function(t){if(!q||!t||"object"!=typeof t)return!1;try{q.call(t,q);try{G.call(t,G)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return vt("WeakSet");if(function(t){if(!V||!t||"object"!=typeof t)return!1;try{return V.call(t),!0}catch(t){}return!1}(r))return vt("WeakRef");if(function(t){return!("[object Number]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(c(Number(r)));if(function(t){if(!t||"object"!=typeof t||!Q)return!1;try{return Q.call(t),!0}catch(t){}return!1}(r))return bt(c(Q.call(r)));if(function(t){return!("[object Boolean]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(z.call(r));if(function(t){return!("[object String]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(c(String(r)));if(!function(t){return!("[object Date]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)&&!function(t){return!("[object RegExp]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)){var S=gt(r,c),A=tt?tt(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&&nt&&Object(r)===r&&nt in r?pt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":y?P+"{"+mt(S,y)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function it(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function at(t){return String(t).replace(/"/g,""")}function ut(t){return!("[object Array]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}function ft(t){if(X)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!K)return!1;try{return K.call(t),!0}catch(t){}return!1}var yt=Object.prototype.hasOwnProperty||function(t){return t in this};function ct(t,r){return yt.call(t,r)}function pt(t){return J.call(t)}function st(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return lt(t.slice(0,r.maxStringLength),r)+n}return it(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,dt),"single",r)}function dt(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function bt(t){return"Object("+t+")"}function vt(t){return t+" { ? }"}function ht(t,r,e,n){return t+" ("+r+") {"+(n?mt(e,n):e.join(", "))+"}"}function mt(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function gt(t,r){var e=ut(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if(Wt(e)){for(var n=[],o=0;o=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||o===Ut.RFC1738&&(40===f||41===f)?a+=i.charAt(u):f<128?a+=Nt[f]:f<2048?a+=Nt[192|f>>6]+Nt[128|63&f]:f<55296||f>=57344?a+=Nt[224|f>>12]+Nt[128|f>>6&63]+Nt[128|63&f]:(f=65536+((1023&f)<<10|1023&i.charCodeAt(u+=1)),a+=Nt[240|f>>18]+Nt[128|f>>12&63]+Nt[128|f>>6&63]+Nt[128|63&f])}return a},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if(Wt(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Dt(u))m=u;else{var j=Object.keys(h);m=f?j.sort(f):j}for(var S=0;S-1?t.split(","):t},Yt=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,a=e.depth>0&&/(\[[^[\]]*])/.exec(o),u=a?o.slice(0,a.index):o,f=[];if(u){if(!e.plainObjects&&Ht.call(Object.prototype,u)&&!e.allowPrototypes)return;f.push(u)}for(var y=0;e.depth>0&&null!==(a=i.exec(o))&&y=0;--i){var a,u=t[i];if("[]"===u&&e.parseArrays)a=[].concat(o);else{a=e.plainObjects?Object.create(null):{};var f="["===u.charAt(0)&&"]"===u.charAt(u.length-1)?u.slice(1,-1):u,y=parseInt(f,10);e.parseArrays||""!==f?!isNaN(y)&&u!==f&&String(y)===f&&y>=0&&e.parseArrays&&y<=e.arrayLimit?(a=[])[y]=o:a[f]=o:a={0:o}}o=a}return o}(f,r,e,n)}};class tr{constructor(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}get template(){return`${this.config.absolute?this.definition.domain?`${this.config.url.match(/^\w+:\/\//)[0]}${this.definition.domain}${this.config.port?`:${this.config.port}`:""}`:this.config.url:""}/${this.definition.uri}`.replace(/\/+$/,"")}get parameterSegments(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))?t:[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${r}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(r,e)=>{var n;if([null,void 0].includes(t[e])&&this.parameterSegments.find(({name:t})=>t===e).required)throw new Error(`Ziggy error: '${e}' parameter is required for route '${this.name}'.`);return encodeURIComponent(null!=(n=t[e])?n:"")}).replace(/\/+$/,""):this.template}}class rr extends String{constructor(r,e,n=!0,o){var i;if(super(),this.t=null!=(i=null!=o?o:Ziggy)?i:null==globalThis?void 0:globalThis.Ziggy,this.t=t({},this.t,{absolute:n}),r){if(!this.t.routes[r])throw new Error(`Ziggy error: route '${r}' is not in the route list.`);this.i=new tr(r,this.t.routes[r],this.t),this.u=this.p(e)}}toString(){const r=Object.keys(this.u).filter(t=>!this.i.parameterSegments.some(({name:r})=>r===t)).filter(t=>"_query"!==t).reduce((r,e)=>t({},r,{[e]:this.u[e]}),{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return Jt;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||Jt.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=Ut.default;if(void 0!==t.format){if(!Ct.call(Ut.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=Ut.formatters[e],o=Jt.filter;return("function"==typeof t.filter||Dt(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:Jt.addQueryPrefix,allowDots:void 0===t.allowDots?Jt.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Jt.charsetSentinel,delimiter:void 0===t.delimiter?Jt.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:Jt.encode,encoder:"function"==typeof t.encoder?t.encoder:Jt.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:Jt.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:Jt.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:Jt.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Jt.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Dt(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var a=_t[r&&r.arrayFormat in _t?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var u=kt(),f=0;f0?p+c:""}(t({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,r)=>"boolean"==typeof t?Number(t):r(t)})}current(t,r){const e=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[n,o]=Object.entries(this.t.routes).find(([r,n])=>new tr(t,n,this.t).matchesUrl(e))||[void 0,void 0];if(!t)return n;const i=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(n);if([null,void 0].includes(r)||!i)return i;const a=new tr(n,o,this.t);r=this.p(r,a);const u=this.v(o);return!(!Object.values(r).every(t=>!t)||Object.values(u).length)||Object.entries(r).every(([t,r])=>u[t]==r)}l(){var t,r,e,n,o,i;const{host:a="",pathname:u="",search:f=""}="undefined"!=typeof window?window.location:{};return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:a,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:u,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:f}}get params(){return this.v(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}p(r={},e=this.i){r=["string","number"].includes(typeof r)?[r]:r;const n=e.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(r)?r=r.reduce((r,e,o)=>t({},r,n[o]?{[n[o].name]:e}:{[e]:""}),{}):1!==n.length||r[n[0].name]||!r.hasOwnProperty(Object.values(e.bindings)[0])&&!r.hasOwnProperty("id")||(r={[n[0].name]:r}),t({},this.h(e),this.m(r,e))}h(r){return r.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((r,{name:e},n)=>t({},r,{[e]:this.t.defaults[e]}),{})}m(r,{bindings:e,parameterSegments:n}){return Object.entries(r).reduce((r,[o,i])=>{if(!i||"object"!=typeof i||Array.isArray(i)||!n.some(({name:t})=>t===o))return t({},r,{[o]:i});if(!i.hasOwnProperty(e[o])){if(!i.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${o}' parameter is missing route model binding key '${e[o]}'.`);e[o]="id"}return t({},r,{[o]:i[e[o]]})},{})}v(r){var e;let n=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const o=(r,e="",n)=>{const[o,i]=[r,e].map(t=>t.split(n));return i.reduce((r,e,n)=>/^{[^}?]+\??}$/.test(e)&&o[n]?t({},r,{[e.replace(/^{|\??}$/g,"")]:o[n]}):r,{})};return t({},o(this.l().host,r.domain,"."),o(n,r.uri,"/"),function(t,r){var e=Zt;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,a=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(f=Qt(f)?[f]:f),n[u]=Ht.call(n,u)?Tt.combine(n[u],f):f}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;at.mixin({methods:{route:(t,e,n,o=r)=>function(t,r,e,n){const o=new rr(t,r,e,n);return t?o.toString():o}(t,e,n,o)}})};export{er as ZiggyVue}; +function t(){return(t=Object.assign||function(t){for(var r=1;r1&&"boolean"!=typeof r)throw new y('"allowMissing" argument must be a boolean');var e=R(t),n=e.length>0?e[0]:"",o=I("%"+n+"%",r),i=o.name,f=o.value,c=!1,s=o.alias;s&&(n=s[0],O(e,A([0,1],s)));for(var l=1,d=!0;l=e.length){var m=p(f,b);f=(d=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:f[b]}else d=a(f,b),f=f[b];d&&!c&&(g[i]=f)}}return f},M=(function(t){var r=k("%Function.prototype.apply%"),e=k("%Function.prototype.call%"),n=k("%Reflect.apply%",!0)||i.call(e,r),o=k("%Object.getOwnPropertyDescriptor%",!0),a=k("%Object.defineProperty%",!0),u=k("%Math.max%");if(a)try{a({},"a",{value:1})}catch(t){a=null}t.exports=function(t){var r=n(i,e,arguments);if(o&&a){var f=o(r,"length");f.configurable&&a(r,"length",{value:1+u(0,t.length-(arguments.length-1))})}return r};var f=function(){return n(i,r,arguments)};a?a(t.exports,"apply",{value:f}):t.exports.apply=f}(s={exports:{}}),s.exports),x=M(k("String.prototype.indexOf")),U=function(t,r){var e=k(t,!!r);return"function"==typeof e&&x(t,".prototype.")>-1?M(e):e},W="function"==typeof Map&&Map.prototype,$=Object.getOwnPropertyDescriptor&&W?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,N=W&&$&&"function"==typeof $.get?$.get:null,B=W&&Map.prototype.forEach,T="function"==typeof Set&&Set.prototype,C=Object.getOwnPropertyDescriptor&&T?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,_=T&&C&&"function"==typeof C.get?C.get:null,D=T&&Set.prototype.forEach,G="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,q="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,V="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,z=Boolean.prototype.valueOf,J=Object.prototype.toString,L=Function.prototype.toString,H=String.prototype.match,Q="function"==typeof BigInt?BigInt.prototype.valueOf:null,Z=Object.getOwnPropertySymbols,K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,X="function"==typeof Symbol&&"object"==typeof Symbol.iterator,Y=Object.prototype.propertyIsEnumerable,tt=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),rt={__proto__:null,default:{}}.custom,et=rt&&ft(rt)?rt:null,nt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,ot=function t(r,e,n,o){var i=e||{};if(ct(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ct(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=!ct(i,"customInspect")||i.customInspect;if("boolean"!=typeof a&&"symbol"!==a)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ct(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return lt(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var u=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=u&&u>0&&"object"==typeof r)return ut(r)?"[Array]":"[Object]";var f,y=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(st(o,r)>=0)return"[Circular]";function c(r,e,a){if(e&&(o=o.slice()).push(e),a){var u={depth:i.depth};return ct(i,"quoteStyle")&&(u.quoteStyle=i.quoteStyle),t(r,u,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=H.call(L.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),s=gt(r,c);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(s.length>0?" { "+s.join(", ")+" }":"")}if(ft(r)){var l=X?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):K.call(r);return"object"!=typeof r||X?l:bt(l)}if((f=r)&&"object"==typeof f&&("undefined"!=typeof HTMLElement&&f instanceof HTMLElement||"string"==typeof f.nodeName&&"function"==typeof f.getAttribute)){for(var d="<"+String(r.nodeName).toLowerCase(),b=r.attributes||[],v=0;v"}if(ut(r)){if(0===r.length)return"[]";var h=gt(r,c);return y&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+mt(h,y)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)){var m=gt(r,c);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&a){if(et&&"function"==typeof r[et])return r[et]();if("symbol"!==a&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!N||!t||"object"!=typeof t)return!1;try{N.call(t);try{_.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return B.call(r,function(t,e){g.push(c(e,r,!0)+" => "+c(t,r))}),ht("Map",N.call(r),g,y)}if(function(t){if(!_||!t||"object"!=typeof t)return!1;try{_.call(t);try{N.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return D.call(r,function(t){j.push(c(t,r))}),ht("Set",_.call(r),j,y)}if(function(t){if(!G||!t||"object"!=typeof t)return!1;try{G.call(t,G);try{q.call(t,q)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return vt("WeakMap");if(function(t){if(!q||!t||"object"!=typeof t)return!1;try{q.call(t,q);try{G.call(t,G)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return vt("WeakSet");if(function(t){if(!V||!t||"object"!=typeof t)return!1;try{return V.call(t),!0}catch(t){}return!1}(r))return vt("WeakRef");if(function(t){return!("[object Number]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(c(Number(r)));if(function(t){if(!t||"object"!=typeof t||!Q)return!1;try{return Q.call(t),!0}catch(t){}return!1}(r))return bt(c(Q.call(r)));if(function(t){return!("[object Boolean]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(z.call(r));if(function(t){return!("[object String]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r))return bt(c(String(r)));if(!function(t){return!("[object Date]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)&&!function(t){return!("[object RegExp]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}(r)){var S=gt(r,c),A=tt?tt(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&&nt&&Object(r)===r&&nt in r?pt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":y?P+"{"+mt(S,y)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function it(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function at(t){return String(t).replace(/"/g,""")}function ut(t){return!("[object Array]"!==pt(t)||nt&&"object"==typeof t&&nt in t)}function ft(t){if(X)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!K)return!1;try{return K.call(t),!0}catch(t){}return!1}var yt=Object.prototype.hasOwnProperty||function(t){return t in this};function ct(t,r){return yt.call(t,r)}function pt(t){return J.call(t)}function st(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return lt(t.slice(0,r.maxStringLength),r)+n}return it(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,dt),"single",r)}function dt(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function bt(t){return"Object("+t+")"}function vt(t){return t+" { ? }"}function ht(t,r,e,n){return t+" ("+r+") {"+(n?mt(e,n):e.join(", "))+"}"}function mt(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function gt(t,r){var e=ut(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if($t(e)){for(var n=[],o=0;o=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||o===Ut.RFC1738&&(40===f||41===f)?a+=i.charAt(u):f<128?a+=Nt[f]:f<2048?a+=Nt[192|f>>6]+Nt[128|63&f]:f<55296||f>=57344?a+=Nt[224|f>>12]+Nt[128|f>>6&63]+Nt[128|63&f]:(f=65536+((1023&f)<<10|1023&i.charCodeAt(u+=1)),a+=Nt[240|f>>18]+Nt[128|f>>12&63]+Nt[128|f>>6&63]+Nt[128|63&f])}return a},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if($t(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Dt(u))m=u;else{var j=Object.keys(h);m=f?j.sort(f):j}for(var S=0;S-1?t.split(","):t},Yt=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,a=e.depth>0&&/(\[[^[\]]*])/.exec(o),u=a?o.slice(0,a.index):o,f=[];if(u){if(!e.plainObjects&&Ht.call(Object.prototype,u)&&!e.allowPrototypes)return;f.push(u)}for(var y=0;e.depth>0&&null!==(a=i.exec(o))&&y=0;--i){var a,u=t[i];if("[]"===u&&e.parseArrays)a=[].concat(o);else{a=e.plainObjects?Object.create(null):{};var f="["===u.charAt(0)&&"]"===u.charAt(u.length-1)?u.slice(1,-1):u,y=parseInt(f,10);e.parseArrays||""!==f?!isNaN(y)&&u!==f&&String(y)===f&&y>=0&&e.parseArrays&&y<=e.arrayLimit?(a=[])[y]=o:a[f]=o:a={0:o}}o=a}return o}(f,r,e,n)}};class tr{constructor(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}get template(){return`${this.config.absolute?this.definition.domain?`${this.config.url.match(/^\w+:\/\//)[0]}${this.definition.domain}${this.config.port?`:${this.config.port}`:""}`:this.config.url:""}/${this.definition.uri}`.replace(/\/+$/,"")}get parameterSegments(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))?t:[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}?]*\?}/g,"([^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${r}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(r,e)=>{var n;if([null,void 0].includes(t[e])&&this.parameterSegments.find(({name:t})=>t===e).required)throw new Error(`Ziggy error: '${e}' parameter is required for route '${this.name}'.`);return encodeURIComponent(null!=(n=t[e])?n:"")}).replace(/\/+$/,""):this.template}}class rr extends String{constructor(r,e,n=!0,o){var i;if(super(),this.t=null!=(i=null!=o?o:Ziggy)?i:null==globalThis?void 0:globalThis.Ziggy,this.t=t({},this.t,{absolute:n}),r){if(!this.t.routes[r])throw new Error(`Ziggy error: route '${r}' is not in the route list.`);this.i=new tr(r,this.t.routes[r],this.t),this.u=this.p(e)}}toString(){const r=Object.keys(this.u).filter(t=>!this.i.parameterSegments.some(({name:r})=>r===t)).filter(t=>"_query"!==t).reduce((r,e)=>t({},r,{[e]:this.u[e]}),{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return Jt;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||Jt.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=Ut.default;if(void 0!==t.format){if(!Ct.call(Ut.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=Ut.formatters[e],o=Jt.filter;return("function"==typeof t.filter||Dt(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:Jt.addQueryPrefix,allowDots:void 0===t.allowDots?Jt.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Jt.charsetSentinel,delimiter:void 0===t.delimiter?Jt.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:Jt.encode,encoder:"function"==typeof t.encoder?t.encoder:Jt.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:Jt.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:Jt.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:Jt.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Jt.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Dt(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var a=_t[r&&r.arrayFormat in _t?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var u=kt(),f=0;f0?p+c:""}(t({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,r)=>"boolean"==typeof t?Number(t):r(t)})}current(t,r){const e=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[n,o]=Object.entries(this.t.routes).find(([r,n])=>new tr(t,n,this.t).matchesUrl(e))||[void 0,void 0];if(!t)return n;const i=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(n);if([null,void 0].includes(r)||!i)return i;const a=new tr(n,o,this.t);r=this.p(r,a);const u=this.v(o);return!(!Object.values(r).every(t=>!t)||Object.values(u).length)||Object.entries(r).every(([t,r])=>u[t]==r)}l(){var t,r,e,n,o,i;const{host:a="",pathname:u="",search:f=""}="undefined"!=typeof window?window.location:{};return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:a,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:u,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:f}}get params(){return this.v(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}p(r={},e=this.i){r=["string","number"].includes(typeof r)?[r]:r;const n=e.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(r)?r=r.reduce((r,e,o)=>t({},r,n[o]?{[n[o].name]:e}:{[e]:""}),{}):1!==n.length||r[n[0].name]||!r.hasOwnProperty(Object.values(e.bindings)[0])&&!r.hasOwnProperty("id")||(r={[n[0].name]:r}),t({},this.h(e),this.m(r,e))}h(r){return r.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((r,{name:e},n)=>t({},r,{[e]:this.t.defaults[e]}),{})}m(r,{bindings:e,parameterSegments:n}){return Object.entries(r).reduce((r,[o,i])=>{if(!i||"object"!=typeof i||Array.isArray(i)||!n.some(({name:t})=>t===o))return t({},r,{[o]:i});if(!i.hasOwnProperty(e[o])){if(!i.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${o}' parameter is missing route model binding key '${e[o]}'.`);e[o]="id"}return t({},r,{[o]:i[e[o]]})},{})}v(r){var e;let n=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const o=(r,e="",n)=>{const[o,i]=[r,e].map(t=>t.split(n));return i.reduce((r,e,n)=>/{[^}?]+\??}/.test(e)&&o[n]?t({},r,{[e.replace(/.*{|\??}.*/g,"")]:o[n].replace(e.match(/^[^{]*/g),"").replace(e.match(/[^}]*$/g),"")}):r,{})};return t({},o(this.l().host,r.domain,"."),o(n,r.uri,"/"),function(t,r){var e=Zt;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,a=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(f=Qt(f)?[f]:f),n[u]=Ht.call(n,u)?Tt.combine(n[u],f):f}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;at.mixin({methods:{route:(t,e,n,o=r)=>function(t,r,e,n){const o=new rr(t,r,e,n);return t?o.toString():o}(t,e,n,o)}})};export{er as ZiggyVue}; diff --git a/dist/vue.js b/dist/vue.js index ad4f14ed..e54f7222 100644 --- a/dist/vue.js +++ b/dist/vue.js @@ -1 +1 @@ -!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t||self).ZiggyVue={})}(this,function(t){function r(t,r){for(var e=0;e1&&"boolean"!=typeof r)throw new g('"allowMissing" argument must be a boolean');var e=B(t),n=e.length>0?e[0]:"",o=C("%"+n+"%",r),i=o.name,u=o.value,f=!1,a=o.alias;a&&(n=a[0],M(e,x([0,1],a)));for(var c=1,y=!0;c=e.length){var b=S(u,p);u=(y=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:u[p]}else y=v(u,p),u=u[p];y&&!f&&(F[i]=u)}}return u},$=function(t){var r={exports:{}};return function(t){var r=D("%Function.prototype.apply%"),e=D("%Function.prototype.call%"),n=D("%Reflect.apply%",!0)||d.call(e,r),o=D("%Object.getOwnPropertyDescriptor%",!0),i=D("%Object.defineProperty%",!0),u=D("%Math.max%");if(i)try{i({},"a",{value:1})}catch(t){i=null}t.exports=function(t){var r=n(d,e,arguments);return o&&i&&o(r,"length").configurable&&i(r,"length",{value:1+u(0,t.length-(arguments.length-1))}),r};var f=function(){return n(d,r,arguments)};i?i(t.exports,"apply",{value:f}):t.exports.apply=f}(r),r.exports}(),G=$(D("String.prototype.indexOf")),_=function(t,r){var e=D(t,!!r);return"function"==typeof e&&G(t,".prototype.")>-1?$(e):e},q="function"==typeof Map&&Map.prototype,V=Object.getOwnPropertyDescriptor&&q?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,z=q&&V&&"function"==typeof V.get?V.get:null,J=q&&Map.prototype.forEach,L="function"==typeof Set&&Set.prototype,H=Object.getOwnPropertyDescriptor&&L?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Q=L&&H&&"function"==typeof H.get?H.get:null,Z=L&&Set.prototype.forEach,K="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,X="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,Y="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,tt=Boolean.prototype.valueOf,rt=Object.prototype.toString,et=Function.prototype.toString,nt=String.prototype.match,ot="function"==typeof BigInt?BigInt.prototype.valueOf:null,it=Object.getOwnPropertySymbols,ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,ft="function"==typeof Symbol&&"object"==typeof Symbol.iterator,at=Object.prototype.propertyIsEnumerable,ct=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),yt={__proto__:null,default:{}}.custom,pt=yt&&ht(yt)?yt:null,lt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,st=function t(r,e,n,o){var i=e||{};if(gt(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(gt(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!gt(i,"customInspect")||i.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(gt(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return At(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var f=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=f&&f>0&&"object"==typeof r)return vt(r)?"[Array]":"[Object]";var a,c=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(St(o,r)>=0)return"[Circular]";function y(r,e,u){if(e&&(o=o.slice()).push(e),u){var f={depth:i.depth};return gt(i,"quoteStyle")&&(f.quoteStyle=i.quoteStyle),t(r,f,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=nt.call(et.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),l=Ft(r,y);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(ht(r)){var s=ft?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):ut.call(r);return"object"!=typeof r||ft?s:wt(s)}if((a=r)&&"object"==typeof a&&("undefined"!=typeof HTMLElement&&a instanceof HTMLElement||"string"==typeof a.nodeName&&"function"==typeof a.getAttribute)){for(var b="<"+String(r.nodeName).toLowerCase(),d=r.attributes||[],v=0;v"}if(vt(r)){if(0===r.length)return"[]";var h=Ft(r,y);return c&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+Rt(h,c)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r)){var m=Ft(r,y);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&u){if(pt&&"function"==typeof r[pt])return r[pt]();if("symbol"!==u&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!z||!t||"object"!=typeof t)return!1;try{z.call(t);try{Q.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return J.call(r,function(t,e){g.push(y(e,r,!0)+" => "+y(t,r))}),Et("Map",z.call(r),g,c)}if(function(t){if(!Q||!t||"object"!=typeof t)return!1;try{Q.call(t);try{z.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return Z.call(r,function(t){j.push(y(t,r))}),Et("Set",Q.call(r),j,c)}if(function(t){if(!K||!t||"object"!=typeof t)return!1;try{K.call(t,K);try{X.call(t,X)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return Pt("WeakMap");if(function(t){if(!X||!t||"object"!=typeof t)return!1;try{X.call(t,X);try{K.call(t,K)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return Pt("WeakSet");if(function(t){if(!Y||!t||"object"!=typeof t)return!1;try{return Y.call(t),!0}catch(t){}return!1}(r))return Pt("WeakRef");if(function(t){return!("[object Number]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r))return wt(y(Number(r)));if(function(t){if(!t||"object"!=typeof t||!ot)return!1;try{return ot.call(t),!0}catch(t){}return!1}(r))return wt(y(ot.call(r)));if(function(t){return!("[object Boolean]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r))return wt(tt.call(r));if(function(t){return!("[object String]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r))return wt(y(String(r)));if(!function(t){return!("[object Date]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r)&&!function(t){return!("[object RegExp]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r)){var S=Ft(r,y),A=ct?ct(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&<&&Object(r)===r&< in r?jt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":c?P+"{"+Rt(S,c)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function bt(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function dt(t){return String(t).replace(/"/g,""")}function vt(t){return!("[object Array]"!==jt(t)||lt&&"object"==typeof t&< in t)}function ht(t){if(ft)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!ut)return!1;try{return ut.call(t),!0}catch(t){}return!1}var mt=Object.prototype.hasOwnProperty||function(t){return t in this};function gt(t,r){return mt.call(t,r)}function jt(t){return rt.call(t)}function St(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return At(t.slice(0,r.maxStringLength),r)+n}return bt(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,Ot),"single",r)}function Ot(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function wt(t){return"Object("+t+")"}function Pt(t){return t+" { ? }"}function Et(t,r,e,n){return t+" ("+r+") {"+(n?Rt(e,n):e.join(", "))+"}"}function Rt(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function Ft(t,r){var e=vt(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if(zt(e)){for(var n=[],o=0;o=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||o===qt.RFC1738&&(40===a||41===a)?u+=i.charAt(f):a<128?u+=Jt[a]:a<2048?u+=Jt[192|a>>6]+Jt[128|63&a]:a<55296||a>=57344?u+=Jt[224|a>>12]+Jt[128|a>>6&63]+Jt[128|63&a]:(a=65536+((1023&a)<<10|1023&i.charCodeAt(f+=1)),u+=Jt[240|a>>18]+Jt[128|a>>12&63]+Jt[128|a>>6&63]+Jt[128|63&a])}return u},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if(zt(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Kt(f))m=f;else{var j=Object.keys(h);m=a?j.sort(a):j}for(var S=0;S-1?t.split(","):t},cr=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,u=e.depth>0&&/(\[[^[\]]*])/.exec(o),f=u?o.slice(0,u.index):o,a=[];if(f){if(!e.plainObjects&&or.call(Object.prototype,f)&&!e.allowPrototypes)return;a.push(f)}for(var c=0;e.depth>0&&null!==(u=i.exec(o))&&c=0;--i){var u,f=t[i];if("[]"===f&&e.parseArrays)u=[].concat(o);else{u=e.plainObjects?Object.create(null):{};var a="["===f.charAt(0)&&"]"===f.charAt(f.length-1)?f.slice(1,-1):f,c=parseInt(a,10);e.parseArrays||""!==a?!isNaN(c)&&f!==a&&String(c)===a&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(u=[])[c]=o:u[a]=o:u={0:o}}o=u}return o}(a,r,e,n)}},yr=function(){function t(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}var r=t.prototype;return r.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+r+"$").test(t.replace(/\/+$/,"").split("?").shift())},r.compile=function(t){var r=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(e,n){var o;if([null,void 0].includes(t[n])&&r.parameterSegments.find(function(t){return t.name===n}).required)throw new Error("Ziggy error: '"+n+"' parameter is required for route '"+r.name+"'.");return encodeURIComponent(null!=(o=t[n])?o:"")}).replace(/\/+$/,""):this.template},e(t,[{key:"template",get:function(){return((this.config.absolute?this.definition.domain?""+this.config.url.match(/^\w+:\/\//)[0]+this.definition.domain+(this.config.port?":"+this.config.port:""):this.config.url:"")+"/"+this.definition.uri).replace(/\/+$/,"")}},{key:"parameterSegments",get:function(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),pr=function(t){var r,o;function u(r,e,o,i){var u,f;if(void 0===o&&(o=!0),(f=t.call(this)||this).t=null!=(u=null!=i?i:Ziggy)?u:null==globalThis?void 0:globalThis.Ziggy,f.t=n({},f.t,{absolute:o}),r){if(!f.t.routes[r])throw new Error("Ziggy error: route '"+r+"' is not in the route list.");f.i=new yr(r,f.t.routes[r],f.t),f.u=f.p(e)}return f}o=t,(r=u).prototype=Object.create(o.prototype),r.prototype.constructor=r,i(r,o);var f=u.prototype;return f.toString=function(){var t=this,r=Object.keys(this.u).filter(function(r){return!t.i.parameterSegments.some(function(t){return t.name===r})}).filter(function(t){return"_query"!==t}).reduce(function(r,e){var o;return n({},r,((o={})[e]=t.u[e],o))},{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return er;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||er.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=qt.default;if(void 0!==t.format){if(!Qt.call(qt.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=qt.formatters[e],o=er.filter;return("function"==typeof t.filter||Kt(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:er.addQueryPrefix,allowDots:void 0===t.allowDots?er.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:er.charsetSentinel,delimiter:void 0===t.delimiter?er.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:er.encode,encoder:"function"==typeof t.encoder?t.encoder:er.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:er.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:er.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:er.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:er.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Kt(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var u=Zt[r&&r.arrayFormat in Zt?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var f=Dt(),a=0;a0?p+y:""}(n({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,r){return"boolean"==typeof t?Number(t):r(t)}})},f.current=function(t,r){var e=this,n=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),o=Object.entries(this.t.routes).find(function(r){return new yr(t,r[1],e.t).matchesUrl(n)})||[void 0,void 0],i=o[0],u=o[1];if(!t)return i;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(i);if([null,void 0].includes(r)||!f)return f;var a=new yr(i,u,this.t);r=this.p(r,a);var c=this.v(u);return!(!Object.values(r).every(function(t){return!t})||Object.values(c).length)||Object.entries(r).every(function(t){return c[t[0]]==t[1]})},f.l=function(){var t,r,e,n,o,i,u="undefined"!=typeof window?window.location:{},f=u.host,a=u.pathname,c=u.search;return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:void 0===f?"":f,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:void 0===a?"":a,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:void 0===c?"":c}},f.has=function(t){return Object.keys(this.t.routes).includes(t)},f.p=function(t,r){var e=this;void 0===t&&(t={}),void 0===r&&(r=this.i),t=["string","number"].includes(typeof t)?[t]:t;var o=r.parameterSegments.filter(function(t){return!e.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,r,e){var i,u;return n({},t,o[e]?((i={})[o[e].name]=r,i):((u={})[r]="",u))},{});else if(1===o.length&&!t[o[0].name]&&(t.hasOwnProperty(Object.values(r.bindings)[0])||t.hasOwnProperty("id"))){var i;(i={})[o[0].name]=t,t=i}return n({},this.h(r),this.m(t,r))},f.h=function(t){var r=this;return t.parameterSegments.filter(function(t){return r.t.defaults[t.name]}).reduce(function(t,e,o){var i,u=e.name;return n({},t,((i={})[u]=r.t.defaults[u],i))},{})},f.m=function(t,r){var e=r.bindings,o=r.parameterSegments;return Object.entries(t).reduce(function(t,r){var i,u,f=r[0],a=r[1];if(!a||"object"!=typeof a||Array.isArray(a)||!o.some(function(t){return t.name===f}))return n({},t,((u={})[f]=a,u));if(!a.hasOwnProperty(e[f])){if(!a.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+f+"' parameter is missing route model binding key '"+e[f]+"'.");e[f]="id"}return n({},t,((i={})[f]=a[e[f]],i))},{})},f.v=function(t){var r,e=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),o=function(t,r,e){void 0===r&&(r="");var o=[t,r].map(function(t){return t.split(e)}),i=o[0];return o[1].reduce(function(t,r,e){var o;return/^{[^}?]+\??}$/.test(r)&&i[e]?n({},t,((o={})[r.replace(/^{|\??}$/g,"")]=i[e],o)):t},{})};return n({},o(this.l().host,t.domain,"."),o(e,t.uri,"/"),function(t,r){var e=ur;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,u=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(a=ir(a)?[a]:a),n[f]=or.call(n,f)?Ht.combine(n[f],a):a}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),u=0;u1&&"boolean"!=typeof r)throw new g('"allowMissing" argument must be a boolean');var e=B(t),n=e.length>0?e[0]:"",o=C("%"+n+"%",r),i=o.name,u=o.value,f=!1,a=o.alias;a&&(n=a[0],M(e,x([0,1],a)));for(var c=1,y=!0;c=e.length){var b=S(u,p);u=(y=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:u[p]}else y=v(u,p),u=u[p];y&&!f&&(F[i]=u)}}return u},$=function(t){var r={exports:{}};return function(t){var r=D("%Function.prototype.apply%"),e=D("%Function.prototype.call%"),n=D("%Reflect.apply%",!0)||d.call(e,r),o=D("%Object.getOwnPropertyDescriptor%",!0),i=D("%Object.defineProperty%",!0),u=D("%Math.max%");if(i)try{i({},"a",{value:1})}catch(t){i=null}t.exports=function(t){var r=n(d,e,arguments);return o&&i&&o(r,"length").configurable&&i(r,"length",{value:1+u(0,t.length-(arguments.length-1))}),r};var f=function(){return n(d,r,arguments)};i?i(t.exports,"apply",{value:f}):t.exports.apply=f}(r),r.exports}(),G=$(D("String.prototype.indexOf")),_=function(t,r){var e=D(t,!!r);return"function"==typeof e&&G(t,".prototype.")>-1?$(e):e},q="function"==typeof Map&&Map.prototype,V=Object.getOwnPropertyDescriptor&&q?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,z=q&&V&&"function"==typeof V.get?V.get:null,J=q&&Map.prototype.forEach,L="function"==typeof Set&&Set.prototype,H=Object.getOwnPropertyDescriptor&&L?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Q=L&&H&&"function"==typeof H.get?H.get:null,Z=L&&Set.prototype.forEach,K="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,X="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,Y="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,tt=Boolean.prototype.valueOf,rt=Object.prototype.toString,et=Function.prototype.toString,nt=String.prototype.match,ot="function"==typeof BigInt?BigInt.prototype.valueOf:null,it=Object.getOwnPropertySymbols,ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,ft="function"==typeof Symbol&&"object"==typeof Symbol.iterator,at=Object.prototype.propertyIsEnumerable,ct=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),yt={__proto__:null,default:{}}.custom,pt=yt&&ht(yt)?yt:null,lt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,st=function t(r,e,n,o){var i=e||{};if(gt(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(gt(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!gt(i,"customInspect")||i.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(gt(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return At(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var f=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=f&&f>0&&"object"==typeof r)return vt(r)?"[Array]":"[Object]";var a,c=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(St(o,r)>=0)return"[Circular]";function y(r,e,u){if(e&&(o=o.slice()).push(e),u){var f={depth:i.depth};return gt(i,"quoteStyle")&&(f.quoteStyle=i.quoteStyle),t(r,f,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=nt.call(et.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),l=Ft(r,y);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(ht(r)){var s=ft?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):ut.call(r);return"object"!=typeof r||ft?s:wt(s)}if((a=r)&&"object"==typeof a&&("undefined"!=typeof HTMLElement&&a instanceof HTMLElement||"string"==typeof a.nodeName&&"function"==typeof a.getAttribute)){for(var b="<"+String(r.nodeName).toLowerCase(),d=r.attributes||[],v=0;v"}if(vt(r)){if(0===r.length)return"[]";var h=Ft(r,y);return c&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+Rt(h,c)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r)){var m=Ft(r,y);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&u){if(pt&&"function"==typeof r[pt])return r[pt]();if("symbol"!==u&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!z||!t||"object"!=typeof t)return!1;try{z.call(t);try{Q.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return J.call(r,function(t,e){g.push(y(e,r,!0)+" => "+y(t,r))}),Et("Map",z.call(r),g,c)}if(function(t){if(!Q||!t||"object"!=typeof t)return!1;try{Q.call(t);try{z.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return Z.call(r,function(t){j.push(y(t,r))}),Et("Set",Q.call(r),j,c)}if(function(t){if(!K||!t||"object"!=typeof t)return!1;try{K.call(t,K);try{X.call(t,X)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return Pt("WeakMap");if(function(t){if(!X||!t||"object"!=typeof t)return!1;try{X.call(t,X);try{K.call(t,K)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return Pt("WeakSet");if(function(t){if(!Y||!t||"object"!=typeof t)return!1;try{return Y.call(t),!0}catch(t){}return!1}(r))return Pt("WeakRef");if(function(t){return!("[object Number]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r))return wt(y(Number(r)));if(function(t){if(!t||"object"!=typeof t||!ot)return!1;try{return ot.call(t),!0}catch(t){}return!1}(r))return wt(y(ot.call(r)));if(function(t){return!("[object Boolean]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r))return wt(tt.call(r));if(function(t){return!("[object String]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r))return wt(y(String(r)));if(!function(t){return!("[object Date]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r)&&!function(t){return!("[object RegExp]"!==jt(t)||lt&&"object"==typeof t&< in t)}(r)){var S=Ft(r,y),A=ct?ct(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&<&&Object(r)===r&< in r?jt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":c?P+"{"+Rt(S,c)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function bt(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function dt(t){return String(t).replace(/"/g,""")}function vt(t){return!("[object Array]"!==jt(t)||lt&&"object"==typeof t&< in t)}function ht(t){if(ft)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!ut)return!1;try{return ut.call(t),!0}catch(t){}return!1}var mt=Object.prototype.hasOwnProperty||function(t){return t in this};function gt(t,r){return mt.call(t,r)}function jt(t){return rt.call(t)}function St(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return At(t.slice(0,r.maxStringLength),r)+n}return bt(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,Ot),"single",r)}function Ot(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function wt(t){return"Object("+t+")"}function Pt(t){return t+" { ? }"}function Et(t,r,e,n){return t+" ("+r+") {"+(n?Rt(e,n):e.join(", "))+"}"}function Rt(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function Ft(t,r){var e=vt(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if(zt(e)){for(var n=[],o=0;o=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||o===qt.RFC1738&&(40===a||41===a)?u+=i.charAt(f):a<128?u+=Jt[a]:a<2048?u+=Jt[192|a>>6]+Jt[128|63&a]:a<55296||a>=57344?u+=Jt[224|a>>12]+Jt[128|a>>6&63]+Jt[128|63&a]:(a=65536+((1023&a)<<10|1023&i.charCodeAt(f+=1)),u+=Jt[240|a>>18]+Jt[128|a>>12&63]+Jt[128|a>>6&63]+Jt[128|63&a])}return u},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if(zt(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Kt(f))m=f;else{var j=Object.keys(h);m=a?j.sort(a):j}for(var S=0;S-1?t.split(","):t},cr=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,u=e.depth>0&&/(\[[^[\]]*])/.exec(o),f=u?o.slice(0,u.index):o,a=[];if(f){if(!e.plainObjects&&or.call(Object.prototype,f)&&!e.allowPrototypes)return;a.push(f)}for(var c=0;e.depth>0&&null!==(u=i.exec(o))&&c=0;--i){var u,f=t[i];if("[]"===f&&e.parseArrays)u=[].concat(o);else{u=e.plainObjects?Object.create(null):{};var a="["===f.charAt(0)&&"]"===f.charAt(f.length-1)?f.slice(1,-1):f,c=parseInt(a,10);e.parseArrays||""!==a?!isNaN(c)&&f!==a&&String(c)===a&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(u=[])[c]=o:u[a]=o:u={0:o}}o=u}return o}(a,r,e,n)}},yr=function(){function t(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}var r=t.prototype;return r.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}?]*\?}/g,"([^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+r+"$").test(t.replace(/\/+$/,"").split("?").shift())},r.compile=function(t){var r=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(e,n){var o;if([null,void 0].includes(t[n])&&r.parameterSegments.find(function(t){return t.name===n}).required)throw new Error("Ziggy error: '"+n+"' parameter is required for route '"+r.name+"'.");return encodeURIComponent(null!=(o=t[n])?o:"")}).replace(/\/+$/,""):this.template},e(t,[{key:"template",get:function(){return((this.config.absolute?this.definition.domain?""+this.config.url.match(/^\w+:\/\//)[0]+this.definition.domain+(this.config.port?":"+this.config.port:""):this.config.url:"")+"/"+this.definition.uri).replace(/\/+$/,"")}},{key:"parameterSegments",get:function(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),pr=function(t){var r,o;function u(r,e,o,i){var u,f;if(void 0===o&&(o=!0),(f=t.call(this)||this).t=null!=(u=null!=i?i:Ziggy)?u:null==globalThis?void 0:globalThis.Ziggy,f.t=n({},f.t,{absolute:o}),r){if(!f.t.routes[r])throw new Error("Ziggy error: route '"+r+"' is not in the route list.");f.i=new yr(r,f.t.routes[r],f.t),f.u=f.p(e)}return f}o=t,(r=u).prototype=Object.create(o.prototype),r.prototype.constructor=r,i(r,o);var f=u.prototype;return f.toString=function(){var t=this,r=Object.keys(this.u).filter(function(r){return!t.i.parameterSegments.some(function(t){return t.name===r})}).filter(function(t){return"_query"!==t}).reduce(function(r,e){var o;return n({},r,((o={})[e]=t.u[e],o))},{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return er;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||er.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=qt.default;if(void 0!==t.format){if(!Qt.call(qt.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=qt.formatters[e],o=er.filter;return("function"==typeof t.filter||Kt(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:er.addQueryPrefix,allowDots:void 0===t.allowDots?er.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:er.charsetSentinel,delimiter:void 0===t.delimiter?er.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:er.encode,encoder:"function"==typeof t.encoder?t.encoder:er.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:er.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:er.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:er.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:er.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Kt(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var u=Zt[r&&r.arrayFormat in Zt?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var f=Dt(),a=0;a0?p+y:""}(n({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,r){return"boolean"==typeof t?Number(t):r(t)}})},f.current=function(t,r){var e=this,n=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),o=Object.entries(this.t.routes).find(function(r){return new yr(t,r[1],e.t).matchesUrl(n)})||[void 0,void 0],i=o[0],u=o[1];if(!t)return i;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(i);if([null,void 0].includes(r)||!f)return f;var a=new yr(i,u,this.t);r=this.p(r,a);var c=this.v(u);return!(!Object.values(r).every(function(t){return!t})||Object.values(c).length)||Object.entries(r).every(function(t){return c[t[0]]==t[1]})},f.l=function(){var t,r,e,n,o,i,u="undefined"!=typeof window?window.location:{},f=u.host,a=u.pathname,c=u.search;return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:void 0===f?"":f,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:void 0===a?"":a,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:void 0===c?"":c}},f.has=function(t){return Object.keys(this.t.routes).includes(t)},f.p=function(t,r){var e=this;void 0===t&&(t={}),void 0===r&&(r=this.i),t=["string","number"].includes(typeof t)?[t]:t;var o=r.parameterSegments.filter(function(t){return!e.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,r,e){var i,u;return n({},t,o[e]?((i={})[o[e].name]=r,i):((u={})[r]="",u))},{});else if(1===o.length&&!t[o[0].name]&&(t.hasOwnProperty(Object.values(r.bindings)[0])||t.hasOwnProperty("id"))){var i;(i={})[o[0].name]=t,t=i}return n({},this.h(r),this.m(t,r))},f.h=function(t){var r=this;return t.parameterSegments.filter(function(t){return r.t.defaults[t.name]}).reduce(function(t,e,o){var i,u=e.name;return n({},t,((i={})[u]=r.t.defaults[u],i))},{})},f.m=function(t,r){var e=r.bindings,o=r.parameterSegments;return Object.entries(t).reduce(function(t,r){var i,u,f=r[0],a=r[1];if(!a||"object"!=typeof a||Array.isArray(a)||!o.some(function(t){return t.name===f}))return n({},t,((u={})[f]=a,u));if(!a.hasOwnProperty(e[f])){if(!a.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+f+"' parameter is missing route model binding key '"+e[f]+"'.");e[f]="id"}return n({},t,((i={})[f]=a[e[f]],i))},{})},f.v=function(t){var r,e=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),o=function(t,r,e){void 0===r&&(r="");var o=[t,r].map(function(t){return t.split(e)}),i=o[0];return o[1].reduce(function(t,r,e){var o;return/{[^}?]+\??}/.test(r)&&i[e]?n({},t,((o={})[r.replace(/.*{|\??}.*/g,"")]=i[e].replace(r.match(/^[^{]*/g),"").replace(r.match(/[^}]*$/g),""),o)):t},{})};return n({},o(this.l().host,t.domain,"."),o(e,t.uri,"/"),function(t,r){var e=ur;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,u=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(a=ir(a)?[a]:a),n[f]=or.call(n,f)?Ht.combine(n[f],a):a}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),u=0;u1&&"boolean"!=typeof r)throw new b('"allowMissing" argument must be a boolean');var e=N(t),n=e.length>0?e[0]:"",o=B("%"+n+"%",r),i=o.name,u=o.value,f=!1,a=o.alias;a&&(n=a[0],k(e,I([0,1],a)));for(var c=1,y=!0;c=e.length){var h=m(u,p);u=(y=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:u[p]}else y=s(u,p),u=u[p];y&&!f&&(E[i]=u)}}return u},C=(function(t){var r=T("%Function.prototype.apply%"),e=T("%Function.prototype.call%"),n=T("%Reflect.apply%",!0)||l.call(e,r),o=T("%Object.getOwnPropertyDescriptor%",!0),i=T("%Object.defineProperty%",!0),u=T("%Math.max%");if(i)try{i({},"a",{value:1})}catch(t){i=null}t.exports=function(t){var r=n(l,e,arguments);if(o&&i){var f=o(r,"length");f.configurable&&i(r,"length",{value:1+u(0,t.length-(arguments.length-1))})}return r};var f=function(){return n(l,r,arguments)};i?i(t.exports,"apply",{value:f}):t.exports.apply=f}(g={exports:{}}),g.exports),D=C(T("String.prototype.indexOf")),$=function(t,r){var e=T(t,!!r);return"function"==typeof e&&D(t,".prototype.")>-1?C(e):e},G="function"==typeof Map&&Map.prototype,_=Object.getOwnPropertyDescriptor&&G?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,q=G&&_&&"function"==typeof _.get?_.get:null,V=G&&Map.prototype.forEach,z="function"==typeof Set&&Set.prototype,J=Object.getOwnPropertyDescriptor&&z?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,L=z&&J&&"function"==typeof J.get?J.get:null,H=z&&Set.prototype.forEach,Q="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,Z="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,K="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,X=Boolean.prototype.valueOf,Y=Object.prototype.toString,tt=Function.prototype.toString,rt=String.prototype.match,et="function"==typeof BigInt?BigInt.prototype.valueOf:null,nt=Object.getOwnPropertySymbols,ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,it="function"==typeof Symbol&&"object"==typeof Symbol.iterator,ut=Object.prototype.propertyIsEnumerable,ft=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),at={__proto__:null,default:{}}.custom,ct=at&&dt(at)?at:null,yt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,pt=function t(r,e,n,o){var i=e||{};if(ht(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ht(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!ht(i,"customInspect")||i.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ht(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return jt(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var f=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=f&&f>0&&"object"==typeof r)return vt(r)?"[Array]":"[Object]";var a,c=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(gt(o,r)>=0)return"[Circular]";function y(r,e,u){if(e&&(o=o.slice()).push(e),u){var f={depth:i.depth};return ht(i,"quoteStyle")&&(f.quoteStyle=i.quoteStyle),t(r,f,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=rt.call(tt.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),l=Et(r,y);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(dt(r)){var s=it?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):ot.call(r);return"object"!=typeof r||it?s:At(s)}if((a=r)&&"object"==typeof a&&("undefined"!=typeof HTMLElement&&a instanceof HTMLElement||"string"==typeof a.nodeName&&"function"==typeof a.getAttribute)){for(var v="<"+String(r.nodeName).toLowerCase(),d=r.attributes||[],b=0;b"}if(vt(r)){if(0===r.length)return"[]";var h=Et(r,y);return c&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+Pt(h,c)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)){var m=Et(r,y);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&u){if(ct&&"function"==typeof r[ct])return r[ct]();if("symbol"!==u&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!q||!t||"object"!=typeof t)return!1;try{q.call(t);try{L.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return V.call(r,function(t,e){g.push(y(e,r,!0)+" => "+y(t,r))}),wt("Map",q.call(r),g,c)}if(function(t){if(!L||!t||"object"!=typeof t)return!1;try{L.call(t);try{q.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return H.call(r,function(t){j.push(y(t,r))}),wt("Set",L.call(r),j,c)}if(function(t){if(!Q||!t||"object"!=typeof t)return!1;try{Q.call(t,Q);try{Z.call(t,Z)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return Ot("WeakMap");if(function(t){if(!Z||!t||"object"!=typeof t)return!1;try{Z.call(t,Z);try{Q.call(t,Q)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return Ot("WeakSet");if(function(t){if(!K||!t||"object"!=typeof t)return!1;try{return K.call(t),!0}catch(t){}return!1}(r))return Ot("WeakRef");if(function(t){return!("[object Number]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(y(Number(r)));if(function(t){if(!t||"object"!=typeof t||!et)return!1;try{return et.call(t),!0}catch(t){}return!1}(r))return At(y(et.call(r)));if(function(t){return!("[object Boolean]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(X.call(r));if(function(t){return!("[object String]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(y(String(r)));if(!function(t){return!("[object Date]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)&&!function(t){return!("[object RegExp]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)){var S=Et(r,y),A=ft?ft(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&&yt&&Object(r)===r&&yt in r?mt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":c?P+"{"+Pt(S,c)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function lt(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function st(t){return String(t).replace(/"/g,""")}function vt(t){return!("[object Array]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}function dt(t){if(it)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!ot)return!1;try{return ot.call(t),!0}catch(t){}return!1}var bt=Object.prototype.hasOwnProperty||function(t){return t in this};function ht(t,r){return bt.call(t,r)}function mt(t){return Y.call(t)}function gt(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return jt(t.slice(0,r.maxStringLength),r)+n}return lt(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,St),"single",r)}function St(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function At(t){return"Object("+t+")"}function Ot(t){return t+" { ? }"}function wt(t,r,e,n){return t+" ("+r+") {"+(n?Pt(e,n):e.join(", "))+"}"}function Pt(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function Et(t,r){var e=vt(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if(_t(e)){for(var n=[],o=0;o=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||o===$t.RFC1738&&(40===a||41===a)?u+=i.charAt(f):a<128?u+=qt[a]:a<2048?u+=qt[192|a>>6]+qt[128|63&a]:a<55296||a>=57344?u+=qt[224|a>>12]+qt[128|a>>6&63]+qt[128|63&a]:(a=65536+((1023&a)<<10|1023&i.charCodeAt(f+=1)),u+=qt[240|a>>18]+qt[128|a>>12&63]+qt[128|a>>6&63]+qt[128|63&a])}return u},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if(_t(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Ht(f))m=f;else{var j=Object.keys(h);m=a?j.sort(a):j}for(var S=0;S-1?t.split(","):t},ur=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,u=e.depth>0&&/(\[[^[\]]*])/.exec(o),f=u?o.slice(0,u.index):o,a=[];if(f){if(!e.plainObjects&&rr.call(Object.prototype,f)&&!e.allowPrototypes)return;a.push(f)}for(var c=0;e.depth>0&&null!==(u=i.exec(o))&&c=0;--i){var u,f=t[i];if("[]"===f&&e.parseArrays)u=[].concat(o);else{u=e.plainObjects?Object.create(null):{};var a="["===f.charAt(0)&&"]"===f.charAt(f.length-1)?f.slice(1,-1):f,c=parseInt(a,10);e.parseArrays||""!==a?!isNaN(c)&&f!==a&&String(c)===a&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(u=[])[c]=o:u[a]=o:u={0:o}}o=u}return o}(a,r,e,n)}},fr=function(){function t(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}var e=t.prototype;return e.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+r+"$").test(t.replace(/\/+$/,"").split("?").shift())},e.compile=function(t){var r=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(e,n){var o;if([null,void 0].includes(t[n])&&r.parameterSegments.find(function(t){return t.name===n}).required)throw new Error("Ziggy error: '"+n+"' parameter is required for route '"+r.name+"'.");return encodeURIComponent(null!=(o=t[n])?o:"")}).replace(/\/+$/,""):this.template},r(t,[{key:"template",get:function(){return((this.config.absolute?this.definition.domain?""+this.config.url.match(/^\w+:\/\//)[0]+this.definition.domain+(this.config.port?":"+this.config.port:""):this.config.url:"")+"/"+this.definition.uri).replace(/\/+$/,"")}},{key:"parameterSegments",get:function(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),ar=function(t){var n,i;function u(r,n,o,i){var u,f;if(void 0===o&&(o=!0),(f=t.call(this)||this).t=null!=(u=null!=i?i:Ziggy)?u:null==globalThis?void 0:globalThis.Ziggy,f.t=e({},f.t,{absolute:o}),r){if(!f.t.routes[r])throw new Error("Ziggy error: route '"+r+"' is not in the route list.");f.i=new fr(r,f.t.routes[r],f.t),f.u=f.p(n)}return f}i=t,(n=u).prototype=Object.create(i.prototype),n.prototype.constructor=n,o(n,i);var f=u.prototype;return f.toString=function(){var t=this,r=Object.keys(this.u).filter(function(r){return!t.i.parameterSegments.some(function(t){return t.name===r})}).filter(function(t){return"_query"!==t}).reduce(function(r,n){var o;return e({},r,((o={})[n]=t.u[n],o))},{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return Yt;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||Yt.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=$t.default;if(void 0!==t.format){if(!Jt.call($t.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=$t.formatters[e],o=Yt.filter;return("function"==typeof t.filter||Ht(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:Yt.addQueryPrefix,allowDots:void 0===t.allowDots?Yt.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Yt.charsetSentinel,delimiter:void 0===t.delimiter?Yt.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:Yt.encode,encoder:"function"==typeof t.encoder?t.encoder:Yt.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:Yt.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:Yt.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:Yt.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Yt.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Ht(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var u=Lt[r&&r.arrayFormat in Lt?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var f=Tt(),a=0;a0?p+y:""}(e({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,r){return"boolean"==typeof t?Number(t):r(t)}})},f.current=function(t,r){var e=this,n=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),o=Object.entries(this.t.routes).find(function(r){return new fr(t,r[1],e.t).matchesUrl(n)})||[void 0,void 0],i=o[0],u=o[1];if(!t)return i;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(i);if([null,void 0].includes(r)||!f)return f;var a=new fr(i,u,this.t);r=this.p(r,a);var c=this.v(u);return!(!Object.values(r).every(function(t){return!t})||Object.values(c).length)||Object.entries(r).every(function(t){return c[t[0]]==t[1]})},f.l=function(){var t,r,e,n,o,i,u="undefined"!=typeof window?window.location:{},f=u.host,a=u.pathname,c=u.search;return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:void 0===f?"":f,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:void 0===a?"":a,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:void 0===c?"":c}},f.has=function(t){return Object.keys(this.t.routes).includes(t)},f.p=function(t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=this.i),t=["string","number"].includes(typeof t)?[t]:t;var o=r.parameterSegments.filter(function(t){return!n.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,r,n){var i,u;return e({},t,o[n]?((i={})[o[n].name]=r,i):((u={})[r]="",u))},{});else if(1===o.length&&!t[o[0].name]&&(t.hasOwnProperty(Object.values(r.bindings)[0])||t.hasOwnProperty("id"))){var i;(i={})[o[0].name]=t,t=i}return e({},this.h(r),this.m(t,r))},f.h=function(t){var r=this;return t.parameterSegments.filter(function(t){return r.t.defaults[t.name]}).reduce(function(t,n,o){var i,u=n.name;return e({},t,((i={})[u]=r.t.defaults[u],i))},{})},f.m=function(t,r){var n=r.bindings,o=r.parameterSegments;return Object.entries(t).reduce(function(t,r){var i,u,f=r[0],a=r[1];if(!a||"object"!=typeof a||Array.isArray(a)||!o.some(function(t){return t.name===f}))return e({},t,((u={})[f]=a,u));if(!a.hasOwnProperty(n[f])){if(!a.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+f+"' parameter is missing route model binding key '"+n[f]+"'.");n[f]="id"}return e({},t,((i={})[f]=a[n[f]],i))},{})},f.v=function(t){var r,n=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),o=function(t,r,n){void 0===r&&(r="");var o=[t,r].map(function(t){return t.split(n)}),i=o[0];return o[1].reduce(function(t,r,n){var o;return/^{[^}?]+\??}$/.test(r)&&i[n]?e({},t,((o={})[r.replace(/^{|\??}$/g,"")]=i[n],o)):t},{})};return e({},o(this.l().host,t.domain,"."),o(n,t.uri,"/"),function(t,r){var e=nr;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,u=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(a=er(a)?[a]:a),n[f]=rr.call(n,f)?zt.combine(n[f],a):a}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),u=0;u1&&"boolean"!=typeof r)throw new b('"allowMissing" argument must be a boolean');var e=N(t),n=e.length>0?e[0]:"",o=B("%"+n+"%",r),i=o.name,u=o.value,f=!1,a=o.alias;a&&(n=a[0],k(e,I([0,1],a)));for(var c=1,y=!0;c=e.length){var h=m(u,p);u=(y=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:u[p]}else y=s(u,p),u=u[p];y&&!f&&(E[i]=u)}}return u},C=(function(t){var r=T("%Function.prototype.apply%"),e=T("%Function.prototype.call%"),n=T("%Reflect.apply%",!0)||l.call(e,r),o=T("%Object.getOwnPropertyDescriptor%",!0),i=T("%Object.defineProperty%",!0),u=T("%Math.max%");if(i)try{i({},"a",{value:1})}catch(t){i=null}t.exports=function(t){var r=n(l,e,arguments);if(o&&i){var f=o(r,"length");f.configurable&&i(r,"length",{value:1+u(0,t.length-(arguments.length-1))})}return r};var f=function(){return n(l,r,arguments)};i?i(t.exports,"apply",{value:f}):t.exports.apply=f}(g={exports:{}}),g.exports),D=C(T("String.prototype.indexOf")),$=function(t,r){var e=T(t,!!r);return"function"==typeof e&&D(t,".prototype.")>-1?C(e):e},G="function"==typeof Map&&Map.prototype,_=Object.getOwnPropertyDescriptor&&G?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,q=G&&_&&"function"==typeof _.get?_.get:null,V=G&&Map.prototype.forEach,z="function"==typeof Set&&Set.prototype,J=Object.getOwnPropertyDescriptor&&z?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,L=z&&J&&"function"==typeof J.get?J.get:null,H=z&&Set.prototype.forEach,Q="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,Z="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,K="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,X=Boolean.prototype.valueOf,Y=Object.prototype.toString,tt=Function.prototype.toString,rt=String.prototype.match,et="function"==typeof BigInt?BigInt.prototype.valueOf:null,nt=Object.getOwnPropertySymbols,ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,it="function"==typeof Symbol&&"object"==typeof Symbol.iterator,ut=Object.prototype.propertyIsEnumerable,ft=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),at={__proto__:null,default:{}}.custom,ct=at&&dt(at)?at:null,yt="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,pt=function t(r,e,n,o){var i=e||{};if(ht(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ht(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&Infinity!==i.maxStringLength:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!ht(i,"customInspect")||i.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ht(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===r)return"undefined";if(null===r)return"null";if("boolean"==typeof r)return r?"true":"false";if("string"==typeof r)return jt(r,i);if("number"==typeof r)return 0===r?Infinity/r>0?"0":"-0":String(r);if("bigint"==typeof r)return String(r)+"n";var f=void 0===i.depth?5:i.depth;if(void 0===n&&(n=0),n>=f&&f>0&&"object"==typeof r)return vt(r)?"[Array]":"[Object]";var a,c=function(t,r){var e;if("\t"===t.indent)e="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;e=Array(t.indent+1).join(" ")}return{base:e,prev:Array(r+1).join(e)}}(i,n);if(void 0===o)o=[];else if(gt(o,r)>=0)return"[Circular]";function y(r,e,u){if(e&&(o=o.slice()).push(e),u){var f={depth:i.depth};return ht(i,"quoteStyle")&&(f.quoteStyle=i.quoteStyle),t(r,f,n+1,o)}return t(r,i,n+1,o)}if("function"==typeof r){var p=function(t){if(t.name)return t.name;var r=rt.call(tt.call(t),/^function\s*([\w$]+)/);return r?r[1]:null}(r),l=Et(r,y);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(l.length>0?" { "+l.join(", ")+" }":"")}if(dt(r)){var s=it?String(r).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):ot.call(r);return"object"!=typeof r||it?s:At(s)}if((a=r)&&"object"==typeof a&&("undefined"!=typeof HTMLElement&&a instanceof HTMLElement||"string"==typeof a.nodeName&&"function"==typeof a.getAttribute)){for(var v="<"+String(r.nodeName).toLowerCase(),d=r.attributes||[],b=0;b"}if(vt(r)){if(0===r.length)return"[]";var h=Et(r,y);return c&&!function(t){for(var r=0;r=0)return!1;return!0}(h)?"["+Pt(h,c)+"]":"[ "+h.join(", ")+" ]"}if(function(t){return!("[object Error]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)){var m=Et(r,y);return 0===m.length?"["+String(r)+"]":"{ ["+String(r)+"] "+m.join(", ")+" }"}if("object"==typeof r&&u){if(ct&&"function"==typeof r[ct])return r[ct]();if("symbol"!==u&&"function"==typeof r.inspect)return r.inspect()}if(function(t){if(!q||!t||"object"!=typeof t)return!1;try{q.call(t);try{L.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(r)){var g=[];return V.call(r,function(t,e){g.push(y(e,r,!0)+" => "+y(t,r))}),wt("Map",q.call(r),g,c)}if(function(t){if(!L||!t||"object"!=typeof t)return!1;try{L.call(t);try{q.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(r)){var j=[];return H.call(r,function(t){j.push(y(t,r))}),wt("Set",L.call(r),j,c)}if(function(t){if(!Q||!t||"object"!=typeof t)return!1;try{Q.call(t,Q);try{Z.call(t,Z)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(r))return Ot("WeakMap");if(function(t){if(!Z||!t||"object"!=typeof t)return!1;try{Z.call(t,Z);try{Q.call(t,Q)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(r))return Ot("WeakSet");if(function(t){if(!K||!t||"object"!=typeof t)return!1;try{return K.call(t),!0}catch(t){}return!1}(r))return Ot("WeakRef");if(function(t){return!("[object Number]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(y(Number(r)));if(function(t){if(!t||"object"!=typeof t||!et)return!1;try{return et.call(t),!0}catch(t){}return!1}(r))return At(y(et.call(r)));if(function(t){return!("[object Boolean]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(X.call(r));if(function(t){return!("[object String]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r))return At(y(String(r)));if(!function(t){return!("[object Date]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)&&!function(t){return!("[object RegExp]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}(r)){var S=Et(r,y),A=ft?ft(r)===Object.prototype:r instanceof Object||r.constructor===Object,O=r instanceof Object?"":"null prototype",w=!A&&yt&&Object(r)===r&&yt in r?mt(r).slice(8,-1):O?"Object":"",P=(A||"function"!=typeof r.constructor?"":r.constructor.name?r.constructor.name+" ":"")+(w||O?"["+[].concat(w||[],O||[]).join(": ")+"] ":"");return 0===S.length?P+"{}":c?P+"{"+Pt(S,c)+"}":P+"{ "+S.join(", ")+" }"}return String(r)};function lt(t,r,e){var n="double"===(e.quoteStyle||r)?'"':"'";return n+t+n}function st(t){return String(t).replace(/"/g,""")}function vt(t){return!("[object Array]"!==mt(t)||yt&&"object"==typeof t&&yt in t)}function dt(t){if(it)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!ot)return!1;try{return ot.call(t),!0}catch(t){}return!1}var bt=Object.prototype.hasOwnProperty||function(t){return t in this};function ht(t,r){return bt.call(t,r)}function mt(t){return Y.call(t)}function gt(t,r){if(t.indexOf)return t.indexOf(r);for(var e=0,n=t.length;er.maxStringLength){var e=t.length-r.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return jt(t.slice(0,r.maxStringLength),r)+n}return lt(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,St),"single",r)}function St(t){var r=t.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return e?"\\"+e:"\\x"+(r<16?"0":"")+r.toString(16).toUpperCase()}function At(t){return"Object("+t+")"}function Ot(t){return t+" { ? }"}function wt(t,r,e,n){return t+" ("+r+") {"+(n?Pt(e,n):e.join(", "))+"}"}function Pt(t,r){if(0===t.length)return"";var e="\n"+r.prev+r.base;return e+t.join(","+e)+"\n"+r.prev}function Et(t,r){var e=vt(t),n=[];if(e){n.length=t.length;for(var o=0;o1;){var r=t.pop(),e=r.obj[r.prop];if(_t(e)){for(var n=[],o=0;o=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||o===$t.RFC1738&&(40===a||41===a)?u+=i.charAt(f):a<128?u+=qt[a]:a<2048?u+=qt[192|a>>6]+qt[128|63&a]:a<55296||a>=57344?u+=qt[224|a>>12]+qt[128|a>>6&63]+qt[128|63&a]:(a=65536+((1023&a)<<10|1023&i.charCodeAt(f+=1)),u+=qt[240|a>>18]+qt[128|a>>12&63]+qt[128|a>>6&63]+qt[128|63&a])}return u},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,r){if(_t(t)){for(var e=[],n=0;n0?h.join(",")||null:void 0}];else if(Ht(f))m=f;else{var j=Object.keys(h);m=a?j.sort(a):j}for(var S=0;S-1?t.split(","):t},ur=function(t,r,e,n){if(t){var o=e.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,u=e.depth>0&&/(\[[^[\]]*])/.exec(o),f=u?o.slice(0,u.index):o,a=[];if(f){if(!e.plainObjects&&rr.call(Object.prototype,f)&&!e.allowPrototypes)return;a.push(f)}for(var c=0;e.depth>0&&null!==(u=i.exec(o))&&c=0;--i){var u,f=t[i];if("[]"===f&&e.parseArrays)u=[].concat(o);else{u=e.plainObjects?Object.create(null):{};var a="["===f.charAt(0)&&"]"===f.charAt(f.length-1)?f.slice(1,-1):f,c=parseInt(a,10);e.parseArrays||""!==a?!isNaN(c)&&f!==a&&String(c)===a&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(u=[])[c]=o:u[a]=o:u={0:o}}o=u}return o}(a,r,e,n)}},fr=function(){function t(t,r,e){var n;this.name=t,this.definition=r,this.bindings=null!=(n=r.bindings)?n:{},this.config=e}var e=t.prototype;return e.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var r=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}?]*\?}/g,"([^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+r+"$").test(t.replace(/\/+$/,"").split("?").shift())},e.compile=function(t){var r=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(e,n){var o;if([null,void 0].includes(t[n])&&r.parameterSegments.find(function(t){return t.name===n}).required)throw new Error("Ziggy error: '"+n+"' parameter is required for route '"+r.name+"'.");return encodeURIComponent(null!=(o=t[n])?o:"")}).replace(/\/+$/,""):this.template},r(t,[{key:"template",get:function(){return((this.config.absolute?this.definition.domain?""+this.config.url.match(/^\w+:\/\//)[0]+this.definition.domain+(this.config.port?":"+this.config.port:""):this.config.url:"")+"/"+this.definition.uri).replace(/\/+$/,"")}},{key:"parameterSegments",get:function(){var t,r;return null!=(t=null==(r=this.template.match(/{[^}?]+\??}/g))?void 0:r.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),ar=function(t){var n,i;function u(r,n,o,i){var u,f;if(void 0===o&&(o=!0),(f=t.call(this)||this).t=null!=(u=null!=i?i:Ziggy)?u:null==globalThis?void 0:globalThis.Ziggy,f.t=e({},f.t,{absolute:o}),r){if(!f.t.routes[r])throw new Error("Ziggy error: route '"+r+"' is not in the route list.");f.i=new fr(r,f.t.routes[r],f.t),f.u=f.p(n)}return f}i=t,(n=u).prototype=Object.create(i.prototype),n.prototype.constructor=n,o(n,i);var f=u.prototype;return f.toString=function(){var t=this,r=Object.keys(this.u).filter(function(r){return!t.i.parameterSegments.some(function(t){return t.name===r})}).filter(function(t){return"_query"!==t}).reduce(function(r,n){var o;return e({},r,((o={})[n]=t.u[n],o))},{});return this.i.compile(this.u)+function(t,r){var e,n=t,o=function(t){if(!t)return Yt;if(null!=t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var r=t.charset||Yt.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=$t.default;if(void 0!==t.format){if(!Jt.call($t.formatters,t.format))throw new TypeError("Unknown format option provided.");e=t.format}var n=$t.formatters[e],o=Yt.filter;return("function"==typeof t.filter||Ht(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:Yt.addQueryPrefix,allowDots:void 0===t.allowDots?Yt.allowDots:!!t.allowDots,charset:r,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Yt.charsetSentinel,delimiter:void 0===t.delimiter?Yt.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:Yt.encode,encoder:"function"==typeof t.encoder?t.encoder:Yt.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:Yt.encodeValuesOnly,filter:o,format:e,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:Yt.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:Yt.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Yt.strictNullHandling}}(r);"function"==typeof o.filter?n=(0,o.filter)("",n):Ht(o.filter)&&(e=o.filter);var i=[];if("object"!=typeof n||null===n)return"";var u=Lt[r&&r.arrayFormat in Lt?r.arrayFormat:r&&"indices"in r?r.indices?"indices":"repeat":"indices"];e||(e=Object.keys(n)),o.sort&&e.sort(o.sort);for(var f=Tt(),a=0;a0?p+y:""}(e({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,r){return"boolean"==typeof t?Number(t):r(t)}})},f.current=function(t,r){var e=this,n=this.t.absolute?this.l().host+this.l().pathname:this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),o=Object.entries(this.t.routes).find(function(r){return new fr(t,r[1],e.t).matchesUrl(n)})||[void 0,void 0],i=o[0],u=o[1];if(!t)return i;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(i);if([null,void 0].includes(r)||!f)return f;var a=new fr(i,u,this.t);r=this.p(r,a);var c=this.v(u);return!(!Object.values(r).every(function(t){return!t})||Object.values(c).length)||Object.entries(r).every(function(t){return c[t[0]]==t[1]})},f.l=function(){var t,r,e,n,o,i,u="undefined"!=typeof window?window.location:{},f=u.host,a=u.pathname,c=u.search;return{host:null!=(t=null==(r=this.t.location)?void 0:r.host)?t:void 0===f?"":f,pathname:null!=(e=null==(n=this.t.location)?void 0:n.pathname)?e:void 0===a?"":a,search:null!=(o=null==(i=this.t.location)?void 0:i.search)?o:void 0===c?"":c}},f.has=function(t){return Object.keys(this.t.routes).includes(t)},f.p=function(t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r=this.i),t=["string","number"].includes(typeof t)?[t]:t;var o=r.parameterSegments.filter(function(t){return!n.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,r,n){var i,u;return e({},t,o[n]?((i={})[o[n].name]=r,i):((u={})[r]="",u))},{});else if(1===o.length&&!t[o[0].name]&&(t.hasOwnProperty(Object.values(r.bindings)[0])||t.hasOwnProperty("id"))){var i;(i={})[o[0].name]=t,t=i}return e({},this.h(r),this.m(t,r))},f.h=function(t){var r=this;return t.parameterSegments.filter(function(t){return r.t.defaults[t.name]}).reduce(function(t,n,o){var i,u=n.name;return e({},t,((i={})[u]=r.t.defaults[u],i))},{})},f.m=function(t,r){var n=r.bindings,o=r.parameterSegments;return Object.entries(t).reduce(function(t,r){var i,u,f=r[0],a=r[1];if(!a||"object"!=typeof a||Array.isArray(a)||!o.some(function(t){return t.name===f}))return e({},t,((u={})[f]=a,u));if(!a.hasOwnProperty(n[f])){if(!a.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+f+"' parameter is missing route model binding key '"+n[f]+"'.");n[f]="id"}return e({},t,((i={})[f]=a[n[f]],i))},{})},f.v=function(t){var r,n=this.l().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),o=function(t,r,n){void 0===r&&(r="");var o=[t,r].map(function(t){return t.split(n)}),i=o[0];return o[1].reduce(function(t,r,n){var o;return/{[^}?]+\??}/.test(r)&&i[n]?e({},t,((o={})[r.replace(/.*{|\??}.*/g,"")]=i[n].replace(r.match(/^[^{]*/g),"").replace(r.match(/[^}]*$/g),""),o)):t},{})};return e({},o(this.l().host,t.domain,"."),o(n,t.uri,"/"),function(t,r){var e=nr;if(""===t||null==t)return e.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,r){var e,n={},o=(r.ignoreQueryPrefix?t.replace(/^\?/,""):t).split(r.delimiter,Infinity===r.parameterLimit?void 0:r.parameterLimit),i=-1,u=r.charset;if(r.charsetSentinel)for(e=0;e-1&&(a=er(a)?[a]:a),n[f]=rr.call(n,f)?zt.combine(n[f],a):a}return n}(t,e):t,o=e.plainObjects?Object.create(null):{},i=Object.keys(n),u=0;u