Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ziggy-js

Package Overview
Dependencies
Maintainers
2
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ziggy-js - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

2

dist/index.es.js

@@ -1,1 +0,1 @@

import{stringify as t,parse as i}from"qs";function r(){return(r=Object.assign||function(t){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}class e{constructor(t,i,r){var e;this.name=t,this.definition=i,this.bindings=null!=(e=i.bindings)?e:{},this.config=r}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,i;return null!=(t=null===(i=this.template.match(/{[^}?]+\??}/g))||void 0===i?void 0:i.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))?t:[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const i=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${i}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(i,r)=>{var e;if([null,void 0].includes(t[r])&&this.parameterSegments.find(({name:t})=>t===r).required)throw new Error(`Ziggy error: '${r}' parameter is required for route '${this.name}'.`);return encodeURIComponent(null!=(e=t[r])?e:"")}).replace(/\/+$/,""):this.template}}class s extends String{constructor(t,i,s=!0,n){var h;if(super(),this.t=null!=(h=null!=n?n:Ziggy)?h:null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy,this.t=r({},this.t,{absolute:s}),t){if(!this.t.routes[t])throw new Error(`Ziggy error: route '${t}' is not in the route list.`);this.i=new e(t,this.t.routes[t],this.t),this.s=this.h(i)}}toString(){const i=Object.keys(this.s).filter(t=>!this.i.parameterSegments.some(({name:i})=>i===t)).filter(t=>"_query"!==t).reduce((t,i)=>r({},t,{[i]:this.s[i]}),{});return this.i.compile(this.s)+t(r({},i,this.s._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,i)=>"boolean"==typeof t?Number(t):i(t)})}current(t,i){const r=this.t.absolute?this.o.host+this.o.pathname:this.o.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[s,n]=Object.entries(this.t.routes).find(([i,s])=>new e(t,s,this.t).matchesUrl(r))||[void 0,void 0];if(!t)return s;const h=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(s);if([null,void 0].includes(i)||!h)return h;const o=new e(s,n,this.t);i=this.h(i,o);const u=this.u(n);return!(!Object.values(i).every(t=>!t)||Object.values(u).length)||Object.entries(i).every(([t,i])=>u[t]==i)}get o(){var t,i,r,e,s,n;const{host:h="",pathname:o="",search:u=""}="undefined"!=typeof window?window.location:{};return{host:null!=(t=null===(i=this.t.location)||void 0===i?void 0:i.host)?t:h,pathname:null!=(r=null===(e=this.t.location)||void 0===e?void 0:e.pathname)?r:o,search:null!=(s=null===(n=this.t.location)||void 0===n?void 0:n.search)?s:u}}get params(){return this.u(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}h(t={},i=this.i){t=["string","number"].includes(typeof t)?[t]:t;const e=i.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(t)?t=t.reduce((t,i,s)=>r({},t,e[s]?{[e[s].name]:i}:{[i]:""}),{}):1!==e.length||t[e[0].name]||!t.hasOwnProperty(Object.values(i.bindings)[0])&&!t.hasOwnProperty("id")||(t={[e[0].name]:t}),r({},this.l(i),this.g(t,i.bindings))}l(t){return t.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((t,{name:i},e)=>r({},t,{[i]:this.t.defaults[i]}),{})}g(t,i={}){return Object.entries(t).reduce((t,[e,s])=>{if(!s||"object"!=typeof s||Array.isArray(s)||"_query"===e)return r({},t,{[e]:s});if(!s.hasOwnProperty(i[e])){if(!s.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${e}' parameter is missing route model binding key '${i[e]}'.`);i[e]="id"}return r({},t,{[e]:s[i[e]]})},{})}u(t){var e;let s=this.o.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const n=(t,i="",e)=>{const[s,n]=[t,i].map(t=>t.split(e));return n.reduce((t,i,e)=>/^{[^}?]+\??}$/.test(i)&&s[e]?r({},t,{[i.replace(/^{|\??}$/g,"")]:s[e]}):t,{})};return r({},n(this.o.host,t.domain,"."),n(s,t.uri,"/"),i(null===(e=this.o.search)||void 0===e?void 0:e.replace(/^\?/,"")))}valueOf(){return this.toString()}check(t){return this.has(t)}}export default function(t,i,r,e){const n=new s(t,i,r,e);return t?n.toString():n}
import{stringify as t,parse as i}from"qs";function r(){return(r=Object.assign||function(t){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}class e{constructor(t,i,r){var e;this.name=t,this.definition=i,this.bindings=null!=(e=i.bindings)?e:{},this.config=r}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,i;return null!=(t=null===(i=this.template.match(/{[^}?]+\??}/g))||void 0===i?void 0:i.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))?t:[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const i=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${i}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(i,r)=>{var e;if([null,void 0].includes(t[r])&&this.parameterSegments.find(({name:t})=>t===r).required)throw new Error(`Ziggy error: '${r}' parameter is required for route '${this.name}'.`);return encodeURIComponent(null!=(e=t[r])?e:"")}).replace(/\/+$/,""):this.template}}class s extends String{constructor(t,i,s=!0,n){var h;if(super(),this.t=null!=(h=null!=n?n:Ziggy)?h:null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy,this.t=r({},this.t,{absolute:s}),t){if(!this.t.routes[t])throw new Error(`Ziggy error: route '${t}' is not in the route list.`);this.i=new e(t,this.t.routes[t],this.t),this.s=this.h(i)}}toString(){const i=Object.keys(this.s).filter(t=>!this.i.parameterSegments.some(({name:i})=>i===t)).filter(t=>"_query"!==t).reduce((t,i)=>r({},t,{[i]:this.s[i]}),{});return this.i.compile(this.s)+t(r({},i,this.s._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,i)=>"boolean"==typeof t?Number(t):i(t)})}current(t,i){const r=this.t.absolute?this.o().host+this.o().pathname:this.o().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[s,n]=Object.entries(this.t.routes).find(([i,s])=>new e(t,s,this.t).matchesUrl(r))||[void 0,void 0];if(!t)return s;const h=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(s);if([null,void 0].includes(i)||!h)return h;const o=new e(s,n,this.t);i=this.h(i,o);const u=this.u(n);return!(!Object.values(i).every(t=>!t)||Object.values(u).length)||Object.entries(i).every(([t,i])=>u[t]==i)}o(){var t,i,r,e,s,n;const{host:h="",pathname:o="",search:u=""}="undefined"!=typeof window?window.location:{};return{host:null!=(t=null===(i=this.t.location)||void 0===i?void 0:i.host)?t:h,pathname:null!=(r=null===(e=this.t.location)||void 0===e?void 0:e.pathname)?r:o,search:null!=(s=null===(n=this.t.location)||void 0===n?void 0:n.search)?s:u}}get params(){return this.u(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}h(t={},i=this.i){t=["string","number"].includes(typeof t)?[t]:t;const e=i.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(t)?t=t.reduce((t,i,s)=>r({},t,e[s]?{[e[s].name]:i}:{[i]:""}),{}):1!==e.length||t[e[0].name]||!t.hasOwnProperty(Object.values(i.bindings)[0])&&!t.hasOwnProperty("id")||(t={[e[0].name]:t}),r({},this.l(i),this.g(t,i.bindings))}l(t){return t.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((t,{name:i},e)=>r({},t,{[i]:this.t.defaults[i]}),{})}g(t,i={}){return Object.entries(t).reduce((t,[e,s])=>{if(!s||"object"!=typeof s||Array.isArray(s)||"_query"===e)return r({},t,{[e]:s});if(!s.hasOwnProperty(i[e])){if(!s.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${e}' parameter is missing route model binding key '${i[e]}'.`);i[e]="id"}return r({},t,{[e]:s[i[e]]})},{})}u(t){var e;let s=this.o().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const n=(t,i="",e)=>{const[s,n]=[t,i].map(t=>t.split(e));return n.reduce((t,i,e)=>/^{[^}?]+\??}$/.test(i)&&s[e]?r({},t,{[i.replace(/^{|\??}$/g,"")]:s[e]}):t,{})};return r({},n(this.o().host,t.domain,"."),n(s,t.uri,"/"),i(null===(e=this.o().search)||void 0===e?void 0:e.replace(/^\?/,"")))}valueOf(){return this.toString()}check(t){return this.has(t)}}export default function(t,i,r,e){const n=new s(t,i,r,e);return t?n.toString():n}

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("qs")):"function"==typeof define&&define.amd?define(["qs"],e):(t=t||self).route=e(t.qs)}(this,function(t){class e{constructor(t,e,i){this.name=t,this.definition=e,this.bindings=e.bindings??{},this.config=i}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;return(null===(t=this.template.match(/{[^}?]+\??}/g))||void 0===t?void 0:t.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))??[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const e=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${e}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(e,i)=>{if([null,void 0].includes(t[i])&&this.parameterSegments.find(({name:t})=>t===i).required)throw new Error(`Ziggy error: '${i}' parameter is required for route '${this.name}'.`);return encodeURIComponent(t[i]??"")}).replace(/\/+$/,""):this.template}}class i extends String{constructor(t,i,r=!0,s){if(super(),this.t=s??Ziggy??(null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy),this.t={...this.t,absolute:r},t){if(!this.t.routes[t])throw new Error(`Ziggy error: route '${t}' is not in the route list.`);this.i=new e(t,this.t.routes[t],this.t),this.s=this.o(i)}}toString(){const e=Object.keys(this.s).filter(t=>!this.i.parameterSegments.some(({name:e})=>e===t)).filter(t=>"_query"!==t).reduce((t,e)=>({...t,[e]:this.s[e]}),{});return this.i.compile(this.s)+t.stringify({...e,...this.s._query},{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,e)=>"boolean"==typeof t?Number(t):e(t)})}current(t,i){const r=this.t.absolute?this.h.host+this.h.pathname:this.h.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[s,n]=Object.entries(this.t.routes).find(([i,s])=>new e(t,s,this.t).matchesUrl(r))||[void 0,void 0];if(!t)return s;const o=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(s);if([null,void 0].includes(i)||!o)return o;const h=new e(s,n,this.t);i=this.o(i,h);const u=this.u(n);return!(!Object.values(i).every(t=>!t)||Object.values(u).length)||Object.entries(i).every(([t,e])=>u[t]==e)}get h(){var t,e,i;const{host:r="",pathname:s="",search:n=""}="undefined"!=typeof window?window.location:{};return{host:(null===(t=this.t.location)||void 0===t?void 0:t.host)??r,pathname:(null===(e=this.t.location)||void 0===e?void 0:e.pathname)??s,search:(null===(i=this.t.location)||void 0===i?void 0:i.search)??n}}get params(){return this.u(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}o(t={},e=this.i){t=["string","number"].includes(typeof t)?[t]:t;const i=e.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(t)?t=t.reduce((t,e,r)=>i[r]?{...t,[i[r].name]:e}:{...t,[e]:""},{}):1!==i.length||t[i[0].name]||!t.hasOwnProperty(Object.values(e.bindings)[0])&&!t.hasOwnProperty("id")||(t={[i[0].name]:t}),{...this.l(e),...this.g(t,e.bindings)}}l(t){return t.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((t,{name:e},i)=>({...t,[e]:this.t.defaults[e]}),{})}g(t,e={}){return Object.entries(t).reduce((t,[i,r])=>{if(!r||"object"!=typeof r||Array.isArray(r)||"_query"===i)return{...t,[i]:r};if(!r.hasOwnProperty(e[i])){if(!r.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${i}' parameter is missing route model binding key '${e[i]}'.`);e[i]="id"}return{...t,[i]:r[e[i]]}},{})}u(e){var i;let r=this.h.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const s=(t,e="",i)=>{const[r,s]=[t,e].map(t=>t.split(i));return s.reduce((t,e,i)=>/^{[^}?]+\??}$/.test(e)&&r[i]?{...t,[e.replace(/^{|\??}$/g,"")]:r[i]}:t,{})};return{...s(this.h.host,e.domain,"."),...s(r,e.uri,"/"),...t.parse(null===(i=this.h.search)||void 0===i?void 0:i.replace(/^\?/,""))}}valueOf(){return this.toString()}check(t){return this.has(t)}}return function(t,e,r,s){const n=new i(t,e,r,s);return t?n.toString():n}});
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("qs")):"function"==typeof define&&define.amd?define(["qs"],t):(n=n||self).route=t(n.qs)}(this,function(n){function t(n,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}function r(n,r,i){return r&&t(n.prototype,r),i&&t(n,i),n}function i(){return(i=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])}return n}).apply(this,arguments)}function e(n){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function u(n,t){return(u=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n})(n,t)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(n){return!1}}function f(n,t,r){return(f=o()?Reflect.construct:function(n,t,r){var i=[null];i.push.apply(i,t);var e=new(Function.bind.apply(n,i));return r&&u(e,r.prototype),e}).apply(null,arguments)}function c(n){var t="function"==typeof Map?new Map:void 0;return(c=function(n){if(null===n||-1===Function.toString.call(n).indexOf("[native code]"))return n;if("function"!=typeof n)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(n))return t.get(n);t.set(n,r)}function r(){return f(n,arguments,e(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),u(r,n)})(n)}var s=function(){function n(n,t,r){var i;this.name=n,this.definition=t,this.bindings=null!=(i=t.bindings)?i:{},this.config=r}var t=n.prototype;return t.matchesUrl=function(n){if(!this.definition.methods.includes("GET"))return!1;var t=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+t+"$").test(n.replace(/\/+$/,"").split("?").shift())},t.compile=function(n){var t=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(r,i){var e;if([null,void 0].includes(n[i])&&t.parameterSegments.find(function(n){return n.name===i}).required)throw new Error("Ziggy error: '"+i+"' parameter is required for route '"+t.name+"'.");return encodeURIComponent(null!=(e=n[i])?e:"")}).replace(/\/+$/,""):this.template},r(n,[{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 n,t;return null!=(n=null===(t=this.template.match(/{[^}?]+\??}/g))||void 0===t?void 0:t.map(function(n){return{name:n.replace(/{|\??}/g,""),required:!/\?}$/.test(n)}}))?n:[]}}]),n}(),a=function(t){var e,u;function o(n,r,e,u){var o,f;if(void 0===e&&(e=!0),(f=t.call(this)||this).t=null!=(o=null!=u?u:Ziggy)?o:null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy,f.t=i({},f.t,{absolute:e}),n){if(!f.t.routes[n])throw new Error("Ziggy error: route '"+n+"' is not in the route list.");f.i=new s(n,f.t.routes[n],f.t),f.u=f.o(r)}return f}u=t,(e=o).prototype=Object.create(u.prototype),e.prototype.constructor=e,e.__proto__=u;var f=o.prototype;return f.toString=function(){var t=this,r=Object.keys(this.u).filter(function(n){return!t.i.parameterSegments.some(function(t){return t.name===n})}).filter(function(n){return"_query"!==n}).reduce(function(n,r){var e;return i({},n,((e={})[r]=t.u[r],e))},{});return this.i.compile(this.u)+n.stringify(i({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(n,t){return"boolean"==typeof n?Number(n):t(n)}})},f.current=function(n,t){var r=this,i=this.t.absolute?this.s().host+this.s().pathname:this.s().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),e=Object.entries(this.t.routes).find(function(t){return new s(n,t[1],r.t).matchesUrl(i)})||[void 0,void 0],u=e[0],o=e[1];if(!n)return u;var f=new RegExp("^"+n.replace(".","\\.").replace("*",".*")+"$").test(u);if([null,void 0].includes(t)||!f)return f;var c=new s(u,o,this.t);t=this.o(t,c);var a=this.h(o);return!(!Object.values(t).every(function(n){return!n})||Object.values(a).length)||Object.entries(t).every(function(n){return a[n[0]]==n[1]})},f.s=function(){var n,t,r,i,e,u,o="undefined"!=typeof window?window.location:{},f=o.host,c=o.pathname,s=o.search;return{host:null!=(n=null===(t=this.t.location)||void 0===t?void 0:t.host)?n:void 0===f?"":f,pathname:null!=(r=null===(i=this.t.location)||void 0===i?void 0:i.pathname)?r:void 0===c?"":c,search:null!=(e=null===(u=this.t.location)||void 0===u?void 0:u.search)?e:void 0===s?"":s}},f.has=function(n){return Object.keys(this.t.routes).includes(n)},f.o=function(n,t){var r=this;void 0===n&&(n={}),void 0===t&&(t=this.i),n=["string","number"].includes(typeof n)?[n]:n;var e=t.parameterSegments.filter(function(n){return!r.t.defaults[n.name]});if(Array.isArray(n))n=n.reduce(function(n,t,r){var u,o;return i({},n,e[r]?((u={})[e[r].name]=t,u):((o={})[t]="",o))},{});else if(1===e.length&&!n[e[0].name]&&(n.hasOwnProperty(Object.values(t.bindings)[0])||n.hasOwnProperty("id"))){var u;(u={})[e[0].name]=n,n=u}return i({},this.l(t),this.v(n,t.bindings))},f.l=function(n){var t=this;return n.parameterSegments.filter(function(n){return t.t.defaults[n.name]}).reduce(function(n,r,e){var u,o=r.name;return i({},n,((u={})[o]=t.t.defaults[o],u))},{})},f.v=function(n,t){return void 0===t&&(t={}),Object.entries(n).reduce(function(n,r){var e,u,o=r[0],f=r[1];if(!f||"object"!=typeof f||Array.isArray(f)||"_query"===o)return i({},n,((u={})[o]=f,u));if(!f.hasOwnProperty(t[o])){if(!f.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+o+"' parameter is missing route model binding key '"+t[o]+"'.");t[o]="id"}return i({},n,((e={})[o]=f[t[o]],e))},{})},f.h=function(t){var r,e=this.s().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),u=function(n,t,r){void 0===t&&(t="");var e=[n,t].map(function(n){return n.split(r)}),u=e[0];return e[1].reduce(function(n,t,r){var e;return/^{[^}?]+\??}$/.test(t)&&u[r]?i({},n,((e={})[t.replace(/^{|\??}$/g,"")]=u[r],e)):n},{})};return i({},u(this.s().host,t.domain,"."),u(e,t.uri,"/"),n.parse(null===(r=this.s().search)||void 0===r?void 0:r.replace(/^\?/,"")))},f.valueOf=function(){return this.toString()},f.check=function(n){return this.has(n)},r(o,[{key:"params",get:function(){return this.h(this.t.routes[this.current()])}}]),o}(c(String));return function(n,t,r,i){var e=new a(n,t,r,i);return n?e.toString():e}});

@@ -1,1 +0,1 @@

import{stringify as t,parse as i}from"qs";class e{constructor(t,i,e){this.name=t,this.definition=i,this.bindings=i.bindings??{},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;return(null===(t=this.template.match(/{[^}?]+\??}/g))||void 0===t?void 0:t.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))??[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const i=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${i}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(i,e)=>{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(t[e]??"")}).replace(/\/+$/,""):this.template}}class r extends String{constructor(t,i,r=!0,s){if(super(),this.t=s??Ziggy??(null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy),this.t={...this.t,absolute:r},t){if(!this.t.routes[t])throw new Error(`Ziggy error: route '${t}' is not in the route list.`);this.i=new e(t,this.t.routes[t],this.t),this.s=this.h(i)}}toString(){const i=Object.keys(this.s).filter(t=>!this.i.parameterSegments.some(({name:i})=>i===t)).filter(t=>"_query"!==t).reduce((t,i)=>({...t,[i]:this.s[i]}),{});return this.i.compile(this.s)+t({...i,...this.s._query},{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,i)=>"boolean"==typeof t?Number(t):i(t)})}current(t,i){const r=this.t.absolute?this.o.host+this.o.pathname:this.o.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[s,n]=Object.entries(this.t.routes).find(([i,s])=>new e(t,s,this.t).matchesUrl(r))||[void 0,void 0];if(!t)return s;const h=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(s);if([null,void 0].includes(i)||!h)return h;const o=new e(s,n,this.t);i=this.h(i,o);const u=this.u(n);return!(!Object.values(i).every(t=>!t)||Object.values(u).length)||Object.entries(i).every(([t,i])=>u[t]==i)}get o(){var t,i,e;const{host:r="",pathname:s="",search:n=""}="undefined"!=typeof window?window.location:{};return{host:(null===(t=this.t.location)||void 0===t?void 0:t.host)??r,pathname:(null===(i=this.t.location)||void 0===i?void 0:i.pathname)??s,search:(null===(e=this.t.location)||void 0===e?void 0:e.search)??n}}get params(){return this.u(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}h(t={},i=this.i){t=["string","number"].includes(typeof t)?[t]:t;const e=i.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(t)?t=t.reduce((t,i,r)=>e[r]?{...t,[e[r].name]:i}:{...t,[i]:""},{}):1!==e.length||t[e[0].name]||!t.hasOwnProperty(Object.values(i.bindings)[0])&&!t.hasOwnProperty("id")||(t={[e[0].name]:t}),{...this.l(i),...this.g(t,i.bindings)}}l(t){return t.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((t,{name:i},e)=>({...t,[i]:this.t.defaults[i]}),{})}g(t,i={}){return Object.entries(t).reduce((t,[e,r])=>{if(!r||"object"!=typeof r||Array.isArray(r)||"_query"===e)return{...t,[e]:r};if(!r.hasOwnProperty(i[e])){if(!r.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${e}' parameter is missing route model binding key '${i[e]}'.`);i[e]="id"}return{...t,[e]:r[i[e]]}},{})}u(t){var e;let r=this.o.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const s=(t,i="",e)=>{const[r,s]=[t,i].map(t=>t.split(e));return s.reduce((t,i,e)=>/^{[^}?]+\??}$/.test(i)&&r[e]?{...t,[i.replace(/^{|\??}$/g,"")]:r[e]}:t,{})};return{...s(this.o.host,t.domain,"."),...s(r,t.uri,"/"),...i(null===(e=this.o.search)||void 0===e?void 0:e.replace(/^\?/,""))}}valueOf(){return this.toString()}check(t){return this.has(t)}}export default function(t,i,e,s){const n=new r(t,i,e,s);return t?n.toString():n}
import{stringify as t,parse as n}from"qs";function r(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function i(t,n,i){return n&&r(t.prototype,n),i&&r(t,i),t}function e(){return(e=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}).apply(this,arguments)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function c(t,n,r){return(c=f()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var e=new(Function.bind.apply(t,i));return r&&o(e,r.prototype),e}).apply(null,arguments)}function s(t){var n="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return c(t,arguments,u(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}var a=function(){function t(t,n,r){var i;this.name=t,this.definition=n,this.bindings=null!=(i=n.bindings)?i:{},this.config=r}var n=t.prototype;return n.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var n=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+n+"$").test(t.replace(/\/+$/,"").split("?").shift())},n.compile=function(t){var n=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(r,i){var e;if([null,void 0].includes(t[i])&&n.parameterSegments.find(function(t){return t.name===i}).required)throw new Error("Ziggy error: '"+i+"' parameter is required for route '"+n.name+"'.");return encodeURIComponent(null!=(e=t[i])?e:"")}).replace(/\/+$/,""):this.template},i(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,n;return null!=(t=null===(n=this.template.match(/{[^}?]+\??}/g))||void 0===n?void 0:n.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),h=function(r){var u,o;function f(t,n,i,u){var o,f;if(void 0===i&&(i=!0),(f=r.call(this)||this).t=null!=(o=null!=u?u:Ziggy)?o:null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy,f.t=e({},f.t,{absolute:i}),t){if(!f.t.routes[t])throw new Error("Ziggy error: route '"+t+"' is not in the route list.");f.i=new a(t,f.t.routes[t],f.t),f.u=f.o(n)}return f}o=r,(u=f).prototype=Object.create(o.prototype),u.prototype.constructor=u,u.__proto__=o;var c=f.prototype;return c.toString=function(){var n=this,r=Object.keys(this.u).filter(function(t){return!n.i.parameterSegments.some(function(n){return n.name===t})}).filter(function(t){return"_query"!==t}).reduce(function(t,r){var i;return e({},t,((i={})[r]=n.u[r],i))},{});return this.i.compile(this.u)+t(e({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,n){return"boolean"==typeof t?Number(t):n(t)}})},c.current=function(t,n){var r=this,i=this.t.absolute?this.s().host+this.s().pathname:this.s().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),e=Object.entries(this.t.routes).find(function(n){return new a(t,n[1],r.t).matchesUrl(i)})||[void 0,void 0],u=e[0],o=e[1];if(!t)return u;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(u);if([null,void 0].includes(n)||!f)return f;var c=new a(u,o,this.t);n=this.o(n,c);var s=this.h(o);return!(!Object.values(n).every(function(t){return!t})||Object.values(s).length)||Object.entries(n).every(function(t){return s[t[0]]==t[1]})},c.s=function(){var t,n,r,i,e,u,o="undefined"!=typeof window?window.location:{},f=o.host,c=o.pathname,s=o.search;return{host:null!=(t=null===(n=this.t.location)||void 0===n?void 0:n.host)?t:void 0===f?"":f,pathname:null!=(r=null===(i=this.t.location)||void 0===i?void 0:i.pathname)?r:void 0===c?"":c,search:null!=(e=null===(u=this.t.location)||void 0===u?void 0:u.search)?e:void 0===s?"":s}},c.has=function(t){return Object.keys(this.t.routes).includes(t)},c.o=function(t,n){var r=this;void 0===t&&(t={}),void 0===n&&(n=this.i),t=["string","number"].includes(typeof t)?[t]:t;var i=n.parameterSegments.filter(function(t){return!r.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,n,r){var u,o;return e({},t,i[r]?((u={})[i[r].name]=n,u):((o={})[n]="",o))},{});else if(1===i.length&&!t[i[0].name]&&(t.hasOwnProperty(Object.values(n.bindings)[0])||t.hasOwnProperty("id"))){var u;(u={})[i[0].name]=t,t=u}return e({},this.l(n),this.v(t,n.bindings))},c.l=function(t){var n=this;return t.parameterSegments.filter(function(t){return n.t.defaults[t.name]}).reduce(function(t,r,i){var u,o=r.name;return e({},t,((u={})[o]=n.t.defaults[o],u))},{})},c.v=function(t,n){return void 0===n&&(n={}),Object.entries(t).reduce(function(t,r){var i,u,o=r[0],f=r[1];if(!f||"object"!=typeof f||Array.isArray(f)||"_query"===o)return e({},t,((u={})[o]=f,u));if(!f.hasOwnProperty(n[o])){if(!f.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+o+"' parameter is missing route model binding key '"+n[o]+"'.");n[o]="id"}return e({},t,((i={})[o]=f[n[o]],i))},{})},c.h=function(t){var r,i=this.s().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),u=function(t,n,r){void 0===n&&(n="");var i=[t,n].map(function(t){return t.split(r)}),u=i[0];return i[1].reduce(function(t,n,r){var i;return/^{[^}?]+\??}$/.test(n)&&u[r]?e({},t,((i={})[n.replace(/^{|\??}$/g,"")]=u[r],i)):t},{})};return e({},u(this.s().host,t.domain,"."),u(i,t.uri,"/"),n(null===(r=this.s().search)||void 0===r?void 0:r.replace(/^\?/,"")))},c.valueOf=function(){return this.toString()},c.check=function(t){return this.has(t)},i(f,[{key:"params",get:function(){return this.h(this.t.routes[this.current()])}}]),f}(s(String));export default function(t,n,r,i){var e=new h(t,n,r,i);return t?e.toString():e}

@@ -1,1 +0,1 @@

import{stringify as t,parse as i}from"qs";function r(){return(r=Object.assign||function(t){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}class e{constructor(t,i,r){var e;this.name=t,this.definition=i,this.bindings=null!=(e=i.bindings)?e:{},this.config=r}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,i;return null!=(t=null===(i=this.template.match(/{[^}?]+\??}/g))||void 0===i?void 0:i.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))?t:[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const i=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${i}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(i,r)=>{var e;if([null,void 0].includes(t[r])&&this.parameterSegments.find(({name:t})=>t===r).required)throw new Error(`Ziggy error: '${r}' parameter is required for route '${this.name}'.`);return encodeURIComponent(null!=(e=t[r])?e:"")}).replace(/\/+$/,""):this.template}}class s extends String{constructor(t,i,s=!0,n){var o;if(super(),this.t=null!=(o=null!=n?n:Ziggy)?o:null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy,this.t=r({},this.t,{absolute:s}),t){if(!this.t.routes[t])throw new Error(`Ziggy error: route '${t}' is not in the route list.`);this.i=new e(t,this.t.routes[t],this.t),this.s=this.o(i)}}toString(){const i=Object.keys(this.s).filter(t=>!this.i.parameterSegments.some(({name:i})=>i===t)).filter(t=>"_query"!==t).reduce((t,i)=>r({},t,{[i]:this.s[i]}),{});return this.i.compile(this.s)+t(r({},i,this.s._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,i)=>"boolean"==typeof t?Number(t):i(t)})}current(t,i){const r=this.t.absolute?this.h.host+this.h.pathname:this.h.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[s,n]=Object.entries(this.t.routes).find(([i,s])=>new e(t,s,this.t).matchesUrl(r))||[void 0,void 0];if(!t)return s;const o=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(s);if([null,void 0].includes(i)||!o)return o;const h=new e(s,n,this.t);i=this.o(i,h);const u=this.u(n);return!(!Object.values(i).every(t=>!t)||Object.values(u).length)||Object.entries(i).every(([t,i])=>u[t]==i)}get h(){var t,i,r,e,s,n;const{host:o="",pathname:h="",search:u=""}="undefined"!=typeof window?window.location:{};return{host:null!=(t=null===(i=this.t.location)||void 0===i?void 0:i.host)?t:o,pathname:null!=(r=null===(e=this.t.location)||void 0===e?void 0:e.pathname)?r:h,search:null!=(s=null===(n=this.t.location)||void 0===n?void 0:n.search)?s:u}}get params(){return this.u(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}o(t={},i=this.i){t=["string","number"].includes(typeof t)?[t]:t;const e=i.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(t)?t=t.reduce((t,i,s)=>r({},t,e[s]?{[e[s].name]:i}:{[i]:""}),{}):1!==e.length||t[e[0].name]||!t.hasOwnProperty(Object.values(i.bindings)[0])&&!t.hasOwnProperty("id")||(t={[e[0].name]:t}),r({},this.l(i),this.g(t,i.bindings))}l(t){return t.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((t,{name:i},e)=>r({},t,{[i]:this.t.defaults[i]}),{})}g(t,i={}){return Object.entries(t).reduce((t,[e,s])=>{if(!s||"object"!=typeof s||Array.isArray(s)||"_query"===e)return r({},t,{[e]:s});if(!s.hasOwnProperty(i[e])){if(!s.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${e}' parameter is missing route model binding key '${i[e]}'.`);i[e]="id"}return r({},t,{[e]:s[i[e]]})},{})}u(t){var e;let s=this.h.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const n=(t,i="",e)=>{const[s,n]=[t,i].map(t=>t.split(e));return n.reduce((t,i,e)=>/^{[^}?]+\??}$/.test(i)&&s[e]?r({},t,{[i.replace(/^{|\??}$/g,"")]:s[e]}):t,{})};return r({},n(this.h.host,t.domain,"."),n(s,t.uri,"/"),i(null===(e=this.h.search)||void 0===e?void 0:e.replace(/^\?/,"")))}valueOf(){return this.toString()}check(t){return this.has(t)}}const n={install:(t,i)=>t.mixin({methods:{route:(t,r,e,n=i)=>function(t,i,r,e){const n=new s(t,i,r,e);return t?n.toString():n}(t,r,e,n)}})};export{n as ZiggyVue};
import{stringify as t,parse as i}from"qs";function r(){return(r=Object.assign||function(t){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}class e{constructor(t,i,r){var e;this.name=t,this.definition=i,this.bindings=null!=(e=i.bindings)?e:{},this.config=r}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,i;return null!=(t=null===(i=this.template.match(/{[^}?]+\??}/g))||void 0===i?void 0:i.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))?t:[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const i=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${i}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(i,r)=>{var e;if([null,void 0].includes(t[r])&&this.parameterSegments.find(({name:t})=>t===r).required)throw new Error(`Ziggy error: '${r}' parameter is required for route '${this.name}'.`);return encodeURIComponent(null!=(e=t[r])?e:"")}).replace(/\/+$/,""):this.template}}class s extends String{constructor(t,i,s=!0,n){var o;if(super(),this.t=null!=(o=null!=n?n:Ziggy)?o:null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy,this.t=r({},this.t,{absolute:s}),t){if(!this.t.routes[t])throw new Error(`Ziggy error: route '${t}' is not in the route list.`);this.i=new e(t,this.t.routes[t],this.t),this.s=this.o(i)}}toString(){const i=Object.keys(this.s).filter(t=>!this.i.parameterSegments.some(({name:i})=>i===t)).filter(t=>"_query"!==t).reduce((t,i)=>r({},t,{[i]:this.s[i]}),{});return this.i.compile(this.s)+t(r({},i,this.s._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,i)=>"boolean"==typeof t?Number(t):i(t)})}current(t,i){const r=this.t.absolute?this.h().host+this.h().pathname:this.h().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[s,n]=Object.entries(this.t.routes).find(([i,s])=>new e(t,s,this.t).matchesUrl(r))||[void 0,void 0];if(!t)return s;const o=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(s);if([null,void 0].includes(i)||!o)return o;const h=new e(s,n,this.t);i=this.o(i,h);const u=this.u(n);return!(!Object.values(i).every(t=>!t)||Object.values(u).length)||Object.entries(i).every(([t,i])=>u[t]==i)}h(){var t,i,r,e,s,n;const{host:o="",pathname:h="",search:u=""}="undefined"!=typeof window?window.location:{};return{host:null!=(t=null===(i=this.t.location)||void 0===i?void 0:i.host)?t:o,pathname:null!=(r=null===(e=this.t.location)||void 0===e?void 0:e.pathname)?r:h,search:null!=(s=null===(n=this.t.location)||void 0===n?void 0:n.search)?s:u}}get params(){return this.u(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}o(t={},i=this.i){t=["string","number"].includes(typeof t)?[t]:t;const e=i.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(t)?t=t.reduce((t,i,s)=>r({},t,e[s]?{[e[s].name]:i}:{[i]:""}),{}):1!==e.length||t[e[0].name]||!t.hasOwnProperty(Object.values(i.bindings)[0])&&!t.hasOwnProperty("id")||(t={[e[0].name]:t}),r({},this.l(i),this.g(t,i.bindings))}l(t){return t.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((t,{name:i},e)=>r({},t,{[i]:this.t.defaults[i]}),{})}g(t,i={}){return Object.entries(t).reduce((t,[e,s])=>{if(!s||"object"!=typeof s||Array.isArray(s)||"_query"===e)return r({},t,{[e]:s});if(!s.hasOwnProperty(i[e])){if(!s.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${e}' parameter is missing route model binding key '${i[e]}'.`);i[e]="id"}return r({},t,{[e]:s[i[e]]})},{})}u(t){var e;let s=this.h().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const n=(t,i="",e)=>{const[s,n]=[t,i].map(t=>t.split(e));return n.reduce((t,i,e)=>/^{[^}?]+\??}$/.test(i)&&s[e]?r({},t,{[i.replace(/^{|\??}$/g,"")]:s[e]}):t,{})};return r({},n(this.h().host,t.domain,"."),n(s,t.uri,"/"),i(null===(e=this.h().search)||void 0===e?void 0:e.replace(/^\?/,"")))}valueOf(){return this.toString()}check(t){return this.has(t)}}const n={install:(t,i)=>t.mixin({methods:{route:(t,r,e,n=i)=>function(t,i,r,e){const n=new s(t,i,r,e);return t?n.toString():n}(t,r,e,n)}})};export{n as ZiggyVue};

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("qs")):"function"==typeof define&&define.amd?define(["exports","qs"],e):e((t=t||self).ZiggyVue={},t.qs)}(this,function(t,e){class i{constructor(t,e,i){this.name=t,this.definition=e,this.bindings=e.bindings??{},this.config=i}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;return(null===(t=this.template.match(/{[^}?]+\??}/g))||void 0===t?void 0:t.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))??[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const e=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${e}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(e,i)=>{if([null,void 0].includes(t[i])&&this.parameterSegments.find(({name:t})=>t===i).required)throw new Error(`Ziggy error: '${i}' parameter is required for route '${this.name}'.`);return encodeURIComponent(t[i]??"")}).replace(/\/+$/,""):this.template}}class s extends String{constructor(t,e,s=!0,r){if(super(),this.t=r??Ziggy??(null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy),this.t={...this.t,absolute:s},t){if(!this.t.routes[t])throw new Error(`Ziggy error: route '${t}' is not in the route list.`);this.i=new i(t,this.t.routes[t],this.t),this.s=this.o(e)}}toString(){const t=Object.keys(this.s).filter(t=>!this.i.parameterSegments.some(({name:e})=>e===t)).filter(t=>"_query"!==t).reduce((t,e)=>({...t,[e]:this.s[e]}),{});return this.i.compile(this.s)+e.stringify({...t,...this.s._query},{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,e)=>"boolean"==typeof t?Number(t):e(t)})}current(t,e){const s=this.t.absolute?this.h.host+this.h.pathname:this.h.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[r,n]=Object.entries(this.t.routes).find(([e,r])=>new i(t,r,this.t).matchesUrl(s))||[void 0,void 0];if(!t)return r;const o=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(r);if([null,void 0].includes(e)||!o)return o;const h=new i(r,n,this.t);e=this.o(e,h);const u=this.u(n);return!(!Object.values(e).every(t=>!t)||Object.values(u).length)||Object.entries(e).every(([t,e])=>u[t]==e)}get h(){var t,e,i;const{host:s="",pathname:r="",search:n=""}="undefined"!=typeof window?window.location:{};return{host:(null===(t=this.t.location)||void 0===t?void 0:t.host)??s,pathname:(null===(e=this.t.location)||void 0===e?void 0:e.pathname)??r,search:(null===(i=this.t.location)||void 0===i?void 0:i.search)??n}}get params(){return this.u(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}o(t={},e=this.i){t=["string","number"].includes(typeof t)?[t]:t;const i=e.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(t)?t=t.reduce((t,e,s)=>i[s]?{...t,[i[s].name]:e}:{...t,[e]:""},{}):1!==i.length||t[i[0].name]||!t.hasOwnProperty(Object.values(e.bindings)[0])&&!t.hasOwnProperty("id")||(t={[i[0].name]:t}),{...this.l(e),...this.g(t,e.bindings)}}l(t){return t.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((t,{name:e},i)=>({...t,[e]:this.t.defaults[e]}),{})}g(t,e={}){return Object.entries(t).reduce((t,[i,s])=>{if(!s||"object"!=typeof s||Array.isArray(s)||"_query"===i)return{...t,[i]:s};if(!s.hasOwnProperty(e[i])){if(!s.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${i}' parameter is missing route model binding key '${e[i]}'.`);e[i]="id"}return{...t,[i]:s[e[i]]}},{})}u(t){var i;let s=this.h.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const r=(t,e="",i)=>{const[s,r]=[t,e].map(t=>t.split(i));return r.reduce((t,e,i)=>/^{[^}?]+\??}$/.test(e)&&s[i]?{...t,[e.replace(/^{|\??}$/g,"")]:s[i]}:t,{})};return{...r(this.h.host,t.domain,"."),...r(s,t.uri,"/"),...e.parse(null===(i=this.h.search)||void 0===i?void 0:i.replace(/^\?/,""))}}valueOf(){return this.toString()}check(t){return this.has(t)}}t.ZiggyVue={install:(t,e)=>t.mixin({methods:{route:(t,i,r,n=e)=>function(t,e,i,r){const n=new s(t,e,i,r);return t?n.toString():n}(t,i,r,n)}})}});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("qs")):"function"==typeof define&&define.amd?define(["exports","qs"],n):n((t=t||self).ZiggyVue={},t.qs)}(this,function(t,n){function r(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function i(t,n,i){return n&&r(t.prototype,n),i&&r(t,i),t}function e(){return(e=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}).apply(this,arguments)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function c(t,n,r){return(c=f()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var e=new(Function.bind.apply(t,i));return r&&o(e,r.prototype),e}).apply(null,arguments)}function s(t){var n="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return c(t,arguments,u(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}var a=function(){function t(t,n,r){var i;this.name=t,this.definition=n,this.bindings=null!=(i=n.bindings)?i:{},this.config=r}var n=t.prototype;return n.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var n=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+n+"$").test(t.replace(/\/+$/,"").split("?").shift())},n.compile=function(t){var n=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(r,i){var e;if([null,void 0].includes(t[i])&&n.parameterSegments.find(function(t){return t.name===i}).required)throw new Error("Ziggy error: '"+i+"' parameter is required for route '"+n.name+"'.");return encodeURIComponent(null!=(e=t[i])?e:"")}).replace(/\/+$/,""):this.template},i(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,n;return null!=(t=null===(n=this.template.match(/{[^}?]+\??}/g))||void 0===n?void 0:n.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),h=function(t){var r,u;function o(n,r,i,u){var o,f;if(void 0===i&&(i=!0),(f=t.call(this)||this).t=null!=(o=null!=u?u:Ziggy)?o:null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy,f.t=e({},f.t,{absolute:i}),n){if(!f.t.routes[n])throw new Error("Ziggy error: route '"+n+"' is not in the route list.");f.i=new a(n,f.t.routes[n],f.t),f.u=f.o(r)}return f}u=t,(r=o).prototype=Object.create(u.prototype),r.prototype.constructor=r,r.__proto__=u;var f=o.prototype;return f.toString=function(){var t=this,r=Object.keys(this.u).filter(function(n){return!t.i.parameterSegments.some(function(t){return t.name===n})}).filter(function(t){return"_query"!==t}).reduce(function(n,r){var i;return e({},n,((i={})[r]=t.u[r],i))},{});return this.i.compile(this.u)+n.stringify(e({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,n){return"boolean"==typeof t?Number(t):n(t)}})},f.current=function(t,n){var r=this,i=this.t.absolute?this.s().host+this.s().pathname:this.s().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),e=Object.entries(this.t.routes).find(function(n){return new a(t,n[1],r.t).matchesUrl(i)})||[void 0,void 0],u=e[0],o=e[1];if(!t)return u;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(u);if([null,void 0].includes(n)||!f)return f;var c=new a(u,o,this.t);n=this.o(n,c);var s=this.h(o);return!(!Object.values(n).every(function(t){return!t})||Object.values(s).length)||Object.entries(n).every(function(t){return s[t[0]]==t[1]})},f.s=function(){var t,n,r,i,e,u,o="undefined"!=typeof window?window.location:{},f=o.host,c=o.pathname,s=o.search;return{host:null!=(t=null===(n=this.t.location)||void 0===n?void 0:n.host)?t:void 0===f?"":f,pathname:null!=(r=null===(i=this.t.location)||void 0===i?void 0:i.pathname)?r:void 0===c?"":c,search:null!=(e=null===(u=this.t.location)||void 0===u?void 0:u.search)?e:void 0===s?"":s}},f.has=function(t){return Object.keys(this.t.routes).includes(t)},f.o=function(t,n){var r=this;void 0===t&&(t={}),void 0===n&&(n=this.i),t=["string","number"].includes(typeof t)?[t]:t;var i=n.parameterSegments.filter(function(t){return!r.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,n,r){var u,o;return e({},t,i[r]?((u={})[i[r].name]=n,u):((o={})[n]="",o))},{});else if(1===i.length&&!t[i[0].name]&&(t.hasOwnProperty(Object.values(n.bindings)[0])||t.hasOwnProperty("id"))){var u;(u={})[i[0].name]=t,t=u}return e({},this.l(n),this.v(t,n.bindings))},f.l=function(t){var n=this;return t.parameterSegments.filter(function(t){return n.t.defaults[t.name]}).reduce(function(t,r,i){var u,o=r.name;return e({},t,((u={})[o]=n.t.defaults[o],u))},{})},f.v=function(t,n){return void 0===n&&(n={}),Object.entries(t).reduce(function(t,r){var i,u,o=r[0],f=r[1];if(!f||"object"!=typeof f||Array.isArray(f)||"_query"===o)return e({},t,((u={})[o]=f,u));if(!f.hasOwnProperty(n[o])){if(!f.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+o+"' parameter is missing route model binding key '"+n[o]+"'.");n[o]="id"}return e({},t,((i={})[o]=f[n[o]],i))},{})},f.h=function(t){var r,i=this.s().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),u=function(t,n,r){void 0===n&&(n="");var i=[t,n].map(function(t){return t.split(r)}),u=i[0];return i[1].reduce(function(t,n,r){var i;return/^{[^}?]+\??}$/.test(n)&&u[r]?e({},t,((i={})[n.replace(/^{|\??}$/g,"")]=u[r],i)):t},{})};return e({},u(this.s().host,t.domain,"."),u(i,t.uri,"/"),n.parse(null===(r=this.s().search)||void 0===r?void 0:r.replace(/^\?/,"")))},f.valueOf=function(){return this.toString()},f.check=function(t){return this.has(t)},i(o,[{key:"params",get:function(){return this.h(this.t.routes[this.current()])}}]),o}(s(String));t.ZiggyVue={install:function(t,n){return t.mixin({methods:{route:function(t,r,i,e){return void 0===e&&(e=n),function(t,n,r,i){var e=new h(t,n,r,i);return t?e.toString():e}(t,r,i,e)}}})}}});

@@ -1,1 +0,1 @@

import{stringify as t,parse as i}from"qs";class e{constructor(t,i,e){this.name=t,this.definition=i,this.bindings=i.bindings??{},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;return(null===(t=this.template.match(/{[^}?]+\??}/g))||void 0===t?void 0:t.map(t=>({name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)})))??[]}matchesUrl(t){if(!this.definition.methods.includes("GET"))return!1;const i=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp(`^${i}$`).test(t.replace(/\/+$/,"").split("?").shift())}compile(t){return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,(i,e)=>{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(t[e]??"")}).replace(/\/+$/,""):this.template}}class r extends String{constructor(t,i,r=!0,s){if(super(),this.t=s??Ziggy??(null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy),this.t={...this.t,absolute:r},t){if(!this.t.routes[t])throw new Error(`Ziggy error: route '${t}' is not in the route list.`);this.i=new e(t,this.t.routes[t],this.t),this.s=this.h(i)}}toString(){const i=Object.keys(this.s).filter(t=>!this.i.parameterSegments.some(({name:i})=>i===t)).filter(t=>"_query"!==t).reduce((t,i)=>({...t,[i]:this.s[i]}),{});return this.i.compile(this.s)+t({...i,...this.s._query},{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(t,i)=>"boolean"==typeof t?Number(t):i(t)})}current(t,i){const r=this.t.absolute?this.o.host+this.o.pathname:this.o.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),[s,n]=Object.entries(this.t.routes).find(([i,s])=>new e(t,s,this.t).matchesUrl(r))||[void 0,void 0];if(!t)return s;const h=new RegExp(`^${t.replace(".","\\.").replace("*",".*")}$`).test(s);if([null,void 0].includes(i)||!h)return h;const o=new e(s,n,this.t);i=this.h(i,o);const u=this.u(n);return!(!Object.values(i).every(t=>!t)||Object.values(u).length)||Object.entries(i).every(([t,i])=>u[t]==i)}get o(){var t,i,e;const{host:r="",pathname:s="",search:n=""}="undefined"!=typeof window?window.location:{};return{host:(null===(t=this.t.location)||void 0===t?void 0:t.host)??r,pathname:(null===(i=this.t.location)||void 0===i?void 0:i.pathname)??s,search:(null===(e=this.t.location)||void 0===e?void 0:e.search)??n}}get params(){return this.u(this.t.routes[this.current()])}has(t){return Object.keys(this.t.routes).includes(t)}h(t={},i=this.i){t=["string","number"].includes(typeof t)?[t]:t;const e=i.parameterSegments.filter(({name:t})=>!this.t.defaults[t]);return Array.isArray(t)?t=t.reduce((t,i,r)=>e[r]?{...t,[e[r].name]:i}:{...t,[i]:""},{}):1!==e.length||t[e[0].name]||!t.hasOwnProperty(Object.values(i.bindings)[0])&&!t.hasOwnProperty("id")||(t={[e[0].name]:t}),{...this.l(i),...this.g(t,i.bindings)}}l(t){return t.parameterSegments.filter(({name:t})=>this.t.defaults[t]).reduce((t,{name:i},e)=>({...t,[i]:this.t.defaults[i]}),{})}g(t,i={}){return Object.entries(t).reduce((t,[e,r])=>{if(!r||"object"!=typeof r||Array.isArray(r)||"_query"===e)return{...t,[e]:r};if(!r.hasOwnProperty(i[e])){if(!r.hasOwnProperty("id"))throw new Error(`Ziggy error: object passed as '${e}' parameter is missing route model binding key '${i[e]}'.`);i[e]="id"}return{...t,[e]:r[i[e]]}},{})}u(t){var e;let r=this.o.pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"");const s=(t,i="",e)=>{const[r,s]=[t,i].map(t=>t.split(e));return s.reduce((t,i,e)=>/^{[^}?]+\??}$/.test(i)&&r[e]?{...t,[i.replace(/^{|\??}$/g,"")]:r[e]}:t,{})};return{...s(this.o.host,t.domain,"."),...s(r,t.uri,"/"),...i(null===(e=this.o.search)||void 0===e?void 0:e.replace(/^\?/,""))}}valueOf(){return this.toString()}check(t){return this.has(t)}}const s={install:(t,i)=>t.mixin({methods:{route:(t,e,s,n=i)=>function(t,i,e,s){const n=new r(t,i,e,s);return t?n.toString():n}(t,e,s,n)}})};export{s as ZiggyVue};
import{stringify as t,parse as n}from"qs";function r(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function i(t,n,i){return n&&r(t.prototype,n),i&&r(t,i),t}function e(){return(e=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}).apply(this,arguments)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function c(t,n,r){return(c=f()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var e=new(Function.bind.apply(t,i));return r&&o(e,r.prototype),e}).apply(null,arguments)}function s(t){var n="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return c(t,arguments,u(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}var a=function(){function t(t,n,r){var i;this.name=t,this.definition=n,this.bindings=null!=(i=n.bindings)?i:{},this.config=r}var n=t.prototype;return n.matchesUrl=function(t){if(!this.definition.methods.includes("GET"))return!1;var n=this.template.replace(/\/{[^}?]*\?}/g,"(/[^/?]+)?").replace(/{[^}]+}/g,"[^/?]+").replace(/^\w+:\/\//,"");return new RegExp("^"+n+"$").test(t.replace(/\/+$/,"").split("?").shift())},n.compile=function(t){var n=this;return this.parameterSegments.length?this.template.replace(/{([^}?]+)\??}/g,function(r,i){var e;if([null,void 0].includes(t[i])&&n.parameterSegments.find(function(t){return t.name===i}).required)throw new Error("Ziggy error: '"+i+"' parameter is required for route '"+n.name+"'.");return encodeURIComponent(null!=(e=t[i])?e:"")}).replace(/\/+$/,""):this.template},i(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,n;return null!=(t=null===(n=this.template.match(/{[^}?]+\??}/g))||void 0===n?void 0:n.map(function(t){return{name:t.replace(/{|\??}/g,""),required:!/\?}$/.test(t)}}))?t:[]}}]),t}(),h=function(r){var u,o;function f(t,n,i,u){var o,f;if(void 0===i&&(i=!0),(f=r.call(this)||this).t=null!=(o=null!=u?u:Ziggy)?o:null===globalThis||void 0===globalThis?void 0:globalThis.Ziggy,f.t=e({},f.t,{absolute:i}),t){if(!f.t.routes[t])throw new Error("Ziggy error: route '"+t+"' is not in the route list.");f.i=new a(t,f.t.routes[t],f.t),f.u=f.o(n)}return f}o=r,(u=f).prototype=Object.create(o.prototype),u.prototype.constructor=u,u.__proto__=o;var c=f.prototype;return c.toString=function(){var n=this,r=Object.keys(this.u).filter(function(t){return!n.i.parameterSegments.some(function(n){return n.name===t})}).filter(function(t){return"_query"!==t}).reduce(function(t,r){var i;return e({},t,((i={})[r]=n.u[r],i))},{});return this.i.compile(this.u)+t(e({},r,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(t,n){return"boolean"==typeof t?Number(t):n(t)}})},c.current=function(t,n){var r=this,i=this.t.absolute?this.s().host+this.s().pathname:this.s().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"),e=Object.entries(this.t.routes).find(function(n){return new a(t,n[1],r.t).matchesUrl(i)})||[void 0,void 0],u=e[0],o=e[1];if(!t)return u;var f=new RegExp("^"+t.replace(".","\\.").replace("*",".*")+"$").test(u);if([null,void 0].includes(n)||!f)return f;var c=new a(u,o,this.t);n=this.o(n,c);var s=this.h(o);return!(!Object.values(n).every(function(t){return!t})||Object.values(s).length)||Object.entries(n).every(function(t){return s[t[0]]==t[1]})},c.s=function(){var t,n,r,i,e,u,o="undefined"!=typeof window?window.location:{},f=o.host,c=o.pathname,s=o.search;return{host:null!=(t=null===(n=this.t.location)||void 0===n?void 0:n.host)?t:void 0===f?"":f,pathname:null!=(r=null===(i=this.t.location)||void 0===i?void 0:i.pathname)?r:void 0===c?"":c,search:null!=(e=null===(u=this.t.location)||void 0===u?void 0:u.search)?e:void 0===s?"":s}},c.has=function(t){return Object.keys(this.t.routes).includes(t)},c.o=function(t,n){var r=this;void 0===t&&(t={}),void 0===n&&(n=this.i),t=["string","number"].includes(typeof t)?[t]:t;var i=n.parameterSegments.filter(function(t){return!r.t.defaults[t.name]});if(Array.isArray(t))t=t.reduce(function(t,n,r){var u,o;return e({},t,i[r]?((u={})[i[r].name]=n,u):((o={})[n]="",o))},{});else if(1===i.length&&!t[i[0].name]&&(t.hasOwnProperty(Object.values(n.bindings)[0])||t.hasOwnProperty("id"))){var u;(u={})[i[0].name]=t,t=u}return e({},this.l(n),this.v(t,n.bindings))},c.l=function(t){var n=this;return t.parameterSegments.filter(function(t){return n.t.defaults[t.name]}).reduce(function(t,r,i){var u,o=r.name;return e({},t,((u={})[o]=n.t.defaults[o],u))},{})},c.v=function(t,n){return void 0===n&&(n={}),Object.entries(t).reduce(function(t,r){var i,u,o=r[0],f=r[1];if(!f||"object"!=typeof f||Array.isArray(f)||"_query"===o)return e({},t,((u={})[o]=f,u));if(!f.hasOwnProperty(n[o])){if(!f.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+o+"' parameter is missing route model binding key '"+n[o]+"'.");n[o]="id"}return e({},t,((i={})[o]=f[n[o]],i))},{})},c.h=function(t){var r,i=this.s().pathname.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,""),u=function(t,n,r){void 0===n&&(n="");var i=[t,n].map(function(t){return t.split(r)}),u=i[0];return i[1].reduce(function(t,n,r){var i;return/^{[^}?]+\??}$/.test(n)&&u[r]?e({},t,((i={})[n.replace(/^{|\??}$/g,"")]=u[r],i)):t},{})};return e({},u(this.s().host,t.domain,"."),u(i,t.uri,"/"),n(null===(r=this.s().search)||void 0===r?void 0:r.replace(/^\?/,"")))},c.valueOf=function(){return this.toString()},c.check=function(t){return this.has(t)},i(f,[{key:"params",get:function(){return this.h(this.t.routes[this.current()])}}]),f}(s(String)),l={install:function(t,n){return t.mixin({methods:{route:function(t,r,i,e){return void 0===e&&(e=n),function(t,n,r,i){var e=new h(t,n,r,i);return t?e.toString():e}(t,r,i,e)}}})}};export{l as ZiggyVue};
{
"name": "ziggy-js",
"version": "1.3.3",
"version": "1.3.4",
"description": "Use your Laravel named routes in JavaScript.",

@@ -48,3 +48,3 @@ "keywords": [

"build:npm:vue": "microbundle --entry src/js/vue.js --output dist/vue.js --name ZiggyVue --format modern,es,umd --no-sourcemap",
"test": "jest",
"test": "jest --verbose",
"prepublishOnly": "npm run build:npm && npm run build:npm:vue"

@@ -61,3 +61,3 @@ },

"babel-preset-power-assert": "^3.0.0",
"jest": "^26.2.2",
"jest": "^27.0.6",
"microbundle": "^0.12.3",

@@ -64,0 +64,0 @@ "power-assert": "^1.6.1"

@@ -73,4 +73,4 @@ import { parse, stringify } from 'qs';

const url = this._config.absolute
? this._location.host + this._location.pathname
: this._location.pathname.replace(this._config.url.replace(/^\w*:\/\/[^/]+/, ''), '').replace(/^\/+/, '/');
? this._location().host + this._location().pathname
: this._location().pathname.replace(this._config.url.replace(/^\w*:\/\/[^/]+/, ''), '').replace(/^\/+/, '/');

@@ -110,3 +110,3 @@ // Find the first route that matches the current URL

*/
get _location() {
_location() {
const { host = '', pathname = '', search = '' } = typeof window !== 'undefined' ? window.location : {};

@@ -244,3 +244,3 @@

_dehydrate(route) {
let pathname = this._location.pathname
let pathname = this._location().pathname
// If this Laravel app is in a subdirectory, trim the subdirectory from the path

@@ -266,5 +266,5 @@ .replace(this._config.url.replace(/^\w*:\/\/[^/]+/, ''), '')

return {
...dehydrate(this._location.host, route.domain, '.'), // Domain parameters
...dehydrate(this._location().host, route.domain, '.'), // Domain parameters
...dehydrate(pathname, route.uri, '/'), // Path parameters
...parse(this._location.search?.replace(/^\?/, '')), // Query parameters
...parse(this._location().search?.replace(/^\?/, '')), // Query parameters
};

@@ -271,0 +271,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc