diff --git a/app/package-lock.json b/app/package-lock.json index a131d709..4aa0378f 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "devDependencies": { - "@protonemedia/laravel-splade": "file:../protonemedia-laravel-splade-0.4.7.tgz", + "@protonemedia/laravel-splade": "file:../protonemedia-laravel-splade-0.4.8.tgz", "@tailwindcss/forms": "^0.5.2", "@tailwindcss/typography": "^0.5.2", "@vitejs/plugin-vue": "^3.0.0", @@ -97,9 +97,9 @@ } }, "node_modules/@protonemedia/laravel-splade": { - "version": "0.4.7", - "resolved": "file:../protonemedia-laravel-splade-0.4.7.tgz", - "integrity": "sha512-/+bhdbkIzZwUg2IM8kuHyaaUoxnP1MbluKnvBnC2wFund5PBTgioSUEA8+agcSk34n/hjDEZLt1WvD2J3Sv+oA==", + "version": "0.4.8", + "resolved": "file:../protonemedia-laravel-splade-0.4.8.tgz", + "integrity": "sha512-UmL1Zeq/9afUfovBJ473rz8LdiChonl+gspuJJTsKB9Cyk5qaz5NBrnhPm+lLG8AleFRJWP/mp6+RI6l8ofZtw==", "dev": true, "license": "MIT", "dependencies": { @@ -434,9 +434,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001382", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001382.tgz", - "integrity": "sha512-2rtJwDmSZ716Pxm1wCtbPvHtbDWAreTPxXbkc5RkKglow3Ig/4GNGazDI9/BVnXbG/wnv6r3B5FEbkfg9OcTGg==", + "version": "1.0.30001383", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001383.tgz", + "integrity": "sha512-swMpEoTp5vDoGBZsYZX7L7nXHe6dsHxi9o6/LKf/f0LukVtnrxly5GVb/fWdCDTqi/yw6Km6tiJ0pmBacm0gbg==", "dev": true, "funding": [ { @@ -589,9 +589,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.228", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.228.tgz", - "integrity": "sha512-XfDHCvou7CsDMlFwb0WZ1tWmW48e7Sn7VBRyPfZsZZila9esRsJl1trO+OqDNV97GggFSt0ISbWslKXfQkG//g==", + "version": "1.4.230", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.230.tgz", + "integrity": "sha512-3pwjAK0qHSDN9+YAF4fJknsSruP7mpjdWzUSruIJD/JCH77pEh0SorEyb3xVaKkfwk2tzjOt2D8scJ0KAdfXLA==", "dev": true }, "node_modules/esbuild": { @@ -1908,8 +1908,8 @@ } }, "@protonemedia/laravel-splade": { - "version": "file:../protonemedia-laravel-splade-0.4.7.tgz", - "integrity": "sha512-/+bhdbkIzZwUg2IM8kuHyaaUoxnP1MbluKnvBnC2wFund5PBTgioSUEA8+agcSk34n/hjDEZLt1WvD2J3Sv+oA==", + "version": "file:../protonemedia-laravel-splade-0.4.8.tgz", + "integrity": "sha512-UmL1Zeq/9afUfovBJ473rz8LdiChonl+gspuJJTsKB9Cyk5qaz5NBrnhPm+lLG8AleFRJWP/mp6+RI6l8ofZtw==", "dev": true, "requires": { "autosize": "^5.0.1", @@ -2168,9 +2168,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001382", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001382.tgz", - "integrity": "sha512-2rtJwDmSZ716Pxm1wCtbPvHtbDWAreTPxXbkc5RkKglow3Ig/4GNGazDI9/BVnXbG/wnv6r3B5FEbkfg9OcTGg==", + "version": "1.0.30001383", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001383.tgz", + "integrity": "sha512-swMpEoTp5vDoGBZsYZX7L7nXHe6dsHxi9o6/LKf/f0LukVtnrxly5GVb/fWdCDTqi/yw6Km6tiJ0pmBacm0gbg==", "dev": true }, "choices.js": { @@ -2280,9 +2280,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.4.228", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.228.tgz", - "integrity": "sha512-XfDHCvou7CsDMlFwb0WZ1tWmW48e7Sn7VBRyPfZsZZila9esRsJl1trO+OqDNV97GggFSt0ISbWslKXfQkG//g==", + "version": "1.4.230", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.230.tgz", + "integrity": "sha512-3pwjAK0qHSDN9+YAF4fJknsSruP7mpjdWzUSruIJD/JCH77pEh0SorEyb3xVaKkfwk2tzjOt2D8scJ0KAdfXLA==", "dev": true }, "esbuild": { diff --git a/app/package.json b/app/package.json index 607ef47e..0f0c39b1 100644 --- a/app/package.json +++ b/app/package.json @@ -5,7 +5,7 @@ "build": "vite build && vite build --ssr" }, "devDependencies": { - "@protonemedia/laravel-splade": "file:../protonemedia-laravel-splade-0.4.7.tgz", + "@protonemedia/laravel-splade": "file:../protonemedia-laravel-splade-0.4.8.tgz", "@tailwindcss/forms": "^0.5.2", "@tailwindcss/typography": "^0.5.2", "@vitejs/plugin-vue": "^3.0.0", diff --git a/dist/protone-media-laravel-splade.js b/dist/protone-media-laravel-splade.js index 9e22791b..a9ed9885 100644 --- a/dist/protone-media-laravel-splade.js +++ b/dist/protone-media-laravel-splade.js @@ -3321,8 +3321,9 @@ const qf = { $put(e, t) { return Vi(this.values, e, t); }, - submit() { - if (!this.confirm) + submit(e) { + const t = e.submitter; + if (t.name && this.$put(t.name, t.value), !this.confirm) return this.request(); m.confirm( Ki(this.confirm) ? "" : this.confirm, @@ -3389,15 +3390,17 @@ const qf = { default: () => ({}) }, modelValue: { - type: String, + type: [String, Number], required: !1 } }, emits: ["update:modelValue"], data() { return { + disabled: !1, element: null, - flatpickrInstance: null + flatpickrInstance: null, + observer: null }; }, watch: { @@ -3406,10 +3409,16 @@ const qf = { } }, mounted() { - this.element = this.$refs.input.querySelector("input"), this.flatpickr && this.initFlatpickr(this.element); + this.element = this.$refs.input.querySelector("input"), this.flatpickr && this.initFlatpickr(this.element), this.disabled = this.element.disabled; + const e = this; + this.observer = new MutationObserver(function(t) { + t.forEach(function(r) { + r.attributeName === "disabled" && (e.disabled = r.target.disabled); + }); + }), this.observer.observe(this.element, { attributes: !0 }); }, beforeUnmount() { - this.flatpickrInstance && this.flatpickrInstance.destroy(); + this.observer.disconnect(), this.flatpickrInstance && this.flatpickrInstance.destroy(); }, methods: { initFlatpickr(e) { @@ -3428,7 +3437,7 @@ const qf = { }, Nf = { ref: "input" }; function kf(e, t, r, n, i, o) { return R(), se("div", Nf, [ - ge(e.$slots, "default") + ge(e.$slots, "default", { disabled: i.disabled }) ], 512); } const Hf = /* @__PURE__ */ ft(Mf, [["render", kf]]), Vf = ["href", "onClick"], Uf = { @@ -3653,7 +3662,7 @@ const sd = ad, ld = { default: !1 }, modelValue: { - type: [String, Array], + type: [String, Number, Array], required: !1 }, placeholder: { @@ -3992,7 +4001,7 @@ const $d = { default: !1 }, modelValue: { - type: String, + type: [String, Number], required: !1 } }, diff --git a/dist/protone-media-laravel-splade.umd.cjs b/dist/protone-media-laravel-splade.umd.cjs index ff633025..8f282db0 100644 --- a/dist/protone-media-laravel-splade.umd.cjs +++ b/dist/protone-media-laravel-splade.umd.cjs @@ -6,5 +6,5 @@ `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".',"Render a single element as the child so that we can forward the props onto that element."].map(h=>` - ${h}`).join(` `)].join(` `));return s.cloneVNode(f,Object.assign({},l,c))}return Array.isArray(u)&&u.length===1?u[0]:u}return s.h(a,Object.assign({},l,c),u)}function Bn(e){return e.flatMap(t=>t.type===s.Fragment?Bn(t.children):[t])}function Gl(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let i in n)i.startsWith("on")&&typeof n[i]=="function"?(r[i]!=null||(r[i]=[]),r[i].push(n[i])):t[i]=n[i];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(r).map(n=>[n,void 0])));for(let n in r)Object.assign(t,{[n](i,...o){let a=r[n];for(let l of a){if(i!=null&&i.defaultPrevented)return;l(i,...o)}}});return t}function jn(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function zl(e){return e==null?!1:typeof e.type=="string"||typeof e.type=="object"||typeof e.type=="function"}let Kl=0;function Xl(){return++Kl}function we(){return Xl()}var Dn=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Dn||{});function re(e){var t;return e==null||e.value==null?null:(t=e.value.$el)!=null?t:e.value}let Fn=Symbol("Context");var Se=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Se||{});function Ql(){return or()!==null}function or(){return s.inject(Fn,null)}function Yl(e){s.provide(Fn,e)}function je(e){if(typeof window>"u")return null;if(e instanceof Node)return e.ownerDocument;if(e!=null&&e.hasOwnProperty("value")){let t=re(e);if(t)return t.ownerDocument}return document}let ar=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Ke=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(Ke||{}),Rn=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Rn||{}),Jl=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Jl||{});function Zl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(ar))}var Mn=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Mn||{});function eu(e,t=0){var r;return e===((r=je(e))==null?void 0:r.body)?!1:U(t,{[0](){return e.matches(ar)},[1](){let n=e;for(;n!==null;){if(n.matches(ar))return!0;n=n.parentElement}return!1}})}function Xe(e){e==null||e.focus({preventScroll:!0})}let tu=["textarea","input"].join(",");function ru(e){var t,r;return(r=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,tu))!=null?r:!1}function nu(e,t=r=>r){return e.slice().sort((r,n)=>{let i=t(r),o=t(n);if(i===null||o===null)return 0;let a=i.compareDocumentPosition(o);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function sr(e,t,r=!0){var n;let i=(n=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e==null?void 0:e.ownerDocument)!=null?n:document,o=Array.isArray(e)?r?nu(e):e:Zl(e),a=i.activeElement,l=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,o.indexOf(a))-1;if(t&4)return Math.max(0,o.indexOf(a))+1;if(t&8)return o.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},f=0,d=o.length,h;do{if(f>=d||f+d<=0)return 0;let p=u+f;if(t&16)p=(p+d)%d;else{if(p<0)return 3;if(p>=d)return 1}h=o[p],h==null||h.focus(c),f+=l}while(h!==i.activeElement);return h.hasAttribute("tabindex")||h.setAttribute("tabindex","0"),t&6&&ru(h)&&h.select(),2}function lr(e,t,r){typeof window<"u"&&s.watchEffect(n=>{window.addEventListener(e,t,r),n(()=>window.removeEventListener(e,t,r))})}function iu(e,t,r=s.computed(()=>!0)){function n(i,o){if(!r.value||i.defaultPrevented)return;let a=o(i);if(a===null||!a.ownerDocument.documentElement.contains(a))return;let l=function u(c){return typeof c=="function"?u(c()):Array.isArray(c)||c instanceof Set?c:[c]}(e);for(let u of l){if(u===null)continue;let c=u instanceof HTMLElement?u:re(u);if(c!=null&&c.contains(a))return}return!eu(a,Mn.Loose)&&a.tabIndex!==-1&&i.preventDefault(),t(i,a)}lr("click",i=>n(i,o=>o.target),!0),lr("blur",i=>n(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}var bt=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(bt||{});let ur=s.defineComponent({name:"Hidden",props:{as:{type:[Object,String],default:"div"},features:{type:Number,default:1}},setup(e,{slots:t,attrs:r}){return()=>{let{features:n,...i}=e,o={"aria-hidden":(n&2)===2?!0:void 0,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return M({ourProps:o,theirProps:i,slot:{},attrs:r,slots:t,name:"Hidden"})}}});var cr=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(cr||{});function ou(){let e=s.ref(0);return lr("keydown",t=>{t.key==="Tab"&&(e.value=t.shiftKey?1:0)}),e}function Ln(e,t,r,n){typeof window<"u"&&s.watchEffect(i=>{e=e!=null?e:window,e.addEventListener(t,r,n),i(()=>e.removeEventListener(t,r,n))})}var kn=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(kn||{});let Qe=Object.assign(s.defineComponent({name:"FocusTrap",props:{as:{type:[Object,String],default:"div"},initialFocus:{type:Object,default:null},features:{type:Number,default:30},containers:{type:Object,default:s.ref(new Set)}},inheritAttrs:!1,setup(e,{attrs:t,slots:r,expose:n}){let i=s.ref(null);n({el:i,$el:i});let o=s.computed(()=>je(i));au({ownerDocument:o},s.computed(()=>Boolean(e.features&16)));let a=su({ownerDocument:o,container:i,initialFocus:s.computed(()=>e.initialFocus)},s.computed(()=>Boolean(e.features&2)));lu({ownerDocument:o,container:i,containers:e.containers,previousActiveElement:a},s.computed(()=>Boolean(e.features&8)));let l=ou();function u(){let c=re(i);!c||U(l.value,{[cr.Forwards]:()=>sr(c,Ke.First),[cr.Backwards]:()=>sr(c,Ke.Last)})}return()=>{let c={},f={ref:i},{features:d,initialFocus:h,containers:p,...g}=e;return s.h(s.Fragment,[Boolean(d&4)&&s.h(ur,{as:"button",type:"button",onFocus:u,features:bt.Focusable}),M({ourProps:f,theirProps:{...t,...g},slot:c,attrs:t,slots:r,name:"FocusTrap"}),Boolean(d&4)&&s.h(ur,{as:"button",type:"button",onFocus:u,features:bt.Focusable})])}}}),{features:kn});function au({ownerDocument:e},t){let r=s.ref(null),n={value:!1};s.onMounted(()=>{s.watch(t,(i,o)=>{var a;i!==o&&(!t.value||(n.value=!0,r.value||(r.value=(a=e.value)==null?void 0:a.activeElement)))},{immediate:!0}),s.watch(t,(i,o,a)=>{i!==o&&(!t.value||a(()=>{n.value!==!1&&(n.value=!1,Xe(r.value),r.value=null)}))},{immediate:!0})})}function su({ownerDocument:e,container:t,initialFocus:r},n){let i=s.ref(null);return s.onMounted(()=>{s.watch([t,r,n],(o,a)=>{if(o.every((u,c)=>(a==null?void 0:a[c])===u)||!n.value)return;let l=re(t);!l||requestAnimationFrame(()=>{var u,c;let f=re(r),d=(u=e.value)==null?void 0:u.activeElement;if(f){if(f===d){i.value=d;return}}else if(l.contains(d)){i.value=d;return}f?Xe(f):sr(l,Ke.First|Ke.NoScroll)===Rn.Error&&console.warn("There are no focusable elements inside the "),i.value=(c=e.value)==null?void 0:c.activeElement})},{immediate:!0,flush:"post"})}),i}function lu({ownerDocument:e,container:t,containers:r,previousActiveElement:n},i){var o;Ln((o=e.value)==null?void 0:o.defaultView,"focus",a=>{if(!i.value)return;let l=new Set(r==null?void 0:r.value);l.add(t);let u=n.value;if(!u)return;let c=a.target;c&&c instanceof HTMLElement?uu(l,c)?(n.value=c,Xe(c)):(a.preventDefault(),a.stopPropagation(),Xe(u)):Xe(n.value)},!0)}function uu(e,t){var r;for(let n of e)if((r=n.value)!=null&&r.contains(t))return!0;return!1}let qn="body > *",De=new Set,fe=new Map;function Nn(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function Hn(e){let t=fe.get(e);!t||(t["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}function cu(e,t=s.ref(!0)){s.watchEffect(r=>{if(!t.value||!e.value)return;let n=e.value,i=je(n);if(i){De.add(n);for(let o of fe.keys())o.contains(n)&&(Hn(o),fe.delete(o));i.querySelectorAll(qn).forEach(o=>{if(o instanceof HTMLElement){for(let a of De)if(o.contains(a))return;De.size===1&&(fe.set(o,{"aria-hidden":o.getAttribute("aria-hidden"),inert:o.inert}),Nn(o))}}),r(()=>{if(De.delete(n),De.size>0)i.querySelectorAll(qn).forEach(o=>{if(o instanceof HTMLElement&&!fe.has(o)){for(let a of De)if(o.contains(a))return;fe.set(o,{"aria-hidden":o.getAttribute("aria-hidden"),inert:o.inert}),Nn(o)}});else for(let o of fe.keys())Hn(o),fe.delete(o)})}})}let Vn=Symbol("ForcePortalRootContext");function fu(){return s.inject(Vn,!1)}let fr=s.defineComponent({name:"ForcePortalRoot",props:{as:{type:[Object,String],default:"template"},force:{type:Boolean,default:!1}},setup(e,{slots:t,attrs:r}){return s.provide(Vn,e.force),()=>{let{force:n,...i}=e;return M({theirProps:i,ourProps:{},slot:{},slots:t,attrs:r,name:"ForcePortalRoot"})}}});function du(e){let t=je(e);if(!t){if(e===null)return null;throw new Error(`[Headless UI]: Cannot find ownerDocument for contextElement: ${e}`)}let r=t.getElementById("headlessui-portal-root");if(r)return r;let n=t.createElement("div");return n.setAttribute("id","headlessui-portal-root"),t.body.appendChild(n)}let Un=s.defineComponent({name:"Portal",props:{as:{type:[Object,String],default:"div"}},setup(e,{slots:t,attrs:r}){let n=s.ref(null),i=s.computed(()=>je(n)),o=fu(),a=s.inject(Wn,null),l=s.ref(o===!0||a==null?du(n.value):a.resolveTarget());return s.watchEffect(()=>{o||a!=null&&(l.value=a.resolveTarget())}),s.onUnmounted(()=>{var u,c;let f=(u=i.value)==null?void 0:u.getElementById("headlessui-portal-root");!f||l.value===f&&l.value.children.length<=0&&((c=l.value.parentElement)==null||c.removeChild(l.value))}),()=>{if(l.value===null)return null;let u={ref:n,"data-headlessui-portal":""};return s.h(s.Teleport,{to:l.value},M({ourProps:u,theirProps:e,slot:{},attrs:r,slots:t,name:"Portal"}))}}}),Wn=Symbol("PortalGroupContext"),pu=s.defineComponent({name:"PortalGroup",props:{as:{type:[Object,String],default:"template"},target:{type:Object,default:null}},setup(e,{attrs:t,slots:r}){let n=s.reactive({resolveTarget(){return e.target}});return s.provide(Wn,n),()=>{let{target:i,...o}=e;return M({theirProps:o,ourProps:{},slot:{},attrs:t,slots:r,name:"PortalGroup"})}}}),Gn=Symbol("StackContext");var dr=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(dr||{});function hu(){return s.inject(Gn,()=>{})}function mu({type:e,element:t,onUpdate:r}){let n=hu();function i(...o){r==null||r(...o),n(...o)}s.onMounted(()=>{i(0,e,t),s.onUnmounted(()=>{i(1,e,t)})}),s.provide(Gn,i)}let zn=Symbol("DescriptionContext");function gu(){let e=s.inject(zn,null);if(e===null)throw new Error("Missing parent");return e}function vu({slot:e=s.ref({}),name:t="Description",props:r={}}={}){let n=s.ref([]);function i(o){return n.value.push(o),()=>{let a=n.value.indexOf(o);a!==-1&&n.value.splice(a,1)}}return s.provide(zn,{register:i,slot:e,name:t,props:r}),s.computed(()=>n.value.length>0?n.value.join(" "):void 0)}let yu=s.defineComponent({name:"Description",props:{as:{type:[Object,String],default:"p"}},setup(e,{attrs:t,slots:r}){let n=gu(),i=`headlessui-description-${we()}`;return s.onMounted(()=>s.onUnmounted(n.register(i))),()=>{let{name:o="Description",slot:a=s.ref({}),props:l={}}=n,u=e,c={...Object.entries(l).reduce((f,[d,h])=>Object.assign(f,{[d]:s.unref(h)}),{}),id:i};return M({ourProps:c,theirProps:u,slot:a.value,attrs:t,slots:r,name:o})}}});var bu=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(bu||{});let pr=Symbol("DialogContext");function Ye(e){let t=s.inject(pr,null);if(t===null){let r=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ye),r}return t}let wt="DC8F892D-2EBD-447C-A4C8-A03058436FF4",Kn=s.defineComponent({name:"Dialog",inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},open:{type:[Boolean,String],default:wt},initialFocus:{type:Object,default:null}},emits:{close:e=>!0},setup(e,{emit:t,attrs:r,slots:n,expose:i}){var o;let a=s.ref(!1);s.onMounted(()=>{a.value=!0});let l=s.ref(0),u=or(),c=s.computed(()=>e.open===wt&&u!==null?U(u.value,{[Se.Open]:!0,[Se.Closed]:!1}):e.open),f=s.ref(new Set),d=s.ref(null),h=s.ref(null),p=s.computed(()=>je(d));if(i({el:d,$el:d}),!(e.open!==wt||u!==null))throw new Error("You forgot to provide an `open` prop to the `Dialog`.");if(typeof c.value!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${c.value===wt?void 0:e.open}`);let g=s.computed(()=>a.value&&c.value?0:1),b=s.computed(()=>g.value===0),w=s.computed(()=>l.value>1),x=s.inject(pr,null)!==null,A=s.computed(()=>w.value?"parent":"leaf");cu(d,s.computed(()=>w.value?b.value:!1)),mu({type:"Dialog",element:d,onUpdate:(y,S,_)=>{if(S==="Dialog")return U(y,{[dr.Add](){f.value.add(_),l.value+=1},[dr.Remove](){f.value.delete(_),l.value-=1}})}});let P=vu({name:"DialogDescription",slot:s.computed(()=>({open:c.value}))}),E=`headlessui-dialog-${we()}`,$=s.ref(null),m={titleId:$,panelRef:s.ref(null),dialogState:g,setTitleId(y){$.value!==y&&($.value=y)},close(){t("close",!1)}};return s.provide(pr,m),iu(()=>{var y,S,_;return[...Array.from((S=(y=p.value)==null?void 0:y.querySelectorAll("body > *, [data-headlessui-portal]"))!=null?S:[]).filter(O=>!(!(O instanceof HTMLElement)||O.contains(re(h))||m.panelRef.value&&O.contains(m.panelRef.value))),(_=m.panelRef.value)!=null?_:d.value]},(y,S)=>{m.close(),s.nextTick(()=>S==null?void 0:S.focus())},s.computed(()=>g.value===0&&!w.value)),Ln((o=p.value)==null?void 0:o.defaultView,"keydown",y=>{y.defaultPrevented||y.key===Dn.Escape&&g.value===0&&(w.value||(y.preventDefault(),y.stopPropagation(),m.close()))}),s.watchEffect(y=>{var S;if(g.value!==0||x)return;let _=p.value;if(!_)return;let O=_==null?void 0:_.documentElement,T=(S=_.defaultView)!=null?S:window,B=O.style.overflow,j=O.style.paddingRight,W=T.innerWidth-O.clientWidth;if(O.style.overflow="hidden",W>0){let X=O.clientWidth-O.offsetWidth,D=W-X;O.style.paddingRight=`${D}px`}y(()=>{O.style.overflow=B,O.style.paddingRight=j})}),s.watchEffect(y=>{if(g.value!==0)return;let S=re(d);if(!S)return;let _=new IntersectionObserver(O=>{for(let T of O)T.boundingClientRect.x===0&&T.boundingClientRect.y===0&&T.boundingClientRect.width===0&&T.boundingClientRect.height===0&&m.close()});_.observe(S),y(()=>_.disconnect())}),()=>{let y={...r,ref:d,id:E,role:"dialog","aria-modal":g.value===0?!0:void 0,"aria-labelledby":$.value,"aria-describedby":P.value},{open:S,initialFocus:_,...O}=e,T={open:g.value===0};return s.h(fr,{force:!0},()=>[s.h(Un,()=>s.h(pu,{target:d.value},()=>s.h(fr,{force:!1},()=>s.h(Qe,{initialFocus:_,containers:f,features:b.value?U(A.value,{parent:Qe.features.RestoreFocus,leaf:Qe.features.All&~Qe.features.FocusLock}):Qe.features.None},()=>M({ourProps:y,theirProps:O,slot:T,attrs:r,slots:n,visible:g.value===0,features:yt.RenderStrategy|yt.Static,name:"Dialog"}))))),s.h(ur,{features:bt.Hidden,ref:h})])}}});s.defineComponent({name:"DialogOverlay",props:{as:{type:[Object,String],default:"div"}},setup(e,{attrs:t,slots:r}){let n=Ye("DialogOverlay"),i=`headlessui-dialog-overlay-${we()}`;function o(a){a.target===a.currentTarget&&(a.preventDefault(),a.stopPropagation(),n.close())}return()=>M({ourProps:{id:i,"aria-hidden":!0,onClick:o},theirProps:e,slot:{open:n.dialogState.value===0},attrs:t,slots:r,name:"DialogOverlay"})}}),s.defineComponent({name:"DialogBackdrop",props:{as:{type:[Object,String],default:"div"}},inheritAttrs:!1,setup(e,{attrs:t,slots:r,expose:n}){let i=Ye("DialogBackdrop"),o=`headlessui-dialog-backdrop-${we()}`,a=s.ref(null);return n({el:a,$el:a}),s.onMounted(()=>{if(i.panelRef.value===null)throw new Error("A component is being used, but a component is missing.")}),()=>{let l=e,u={id:o,ref:a,"aria-hidden":!0};return s.h(fr,{force:!0},()=>s.h(Un,()=>M({ourProps:u,theirProps:{...t,...l},slot:{open:i.dialogState.value===0},attrs:t,slots:r,name:"DialogBackdrop"})))}}});let Xn=s.defineComponent({name:"DialogPanel",props:{as:{type:[Object,String],default:"div"}},setup(e,{attrs:t,slots:r,expose:n}){let i=Ye("DialogPanel"),o=`headlessui-dialog-panel-${we()}`;n({el:i.panelRef,$el:i.panelRef});function a(l){l.stopPropagation()}return()=>{let l={id:o,ref:i.panelRef,onClick:a};return M({ourProps:l,theirProps:e,slot:{open:i.dialogState.value===0},attrs:t,slots:r,name:"DialogPanel"})}}});s.defineComponent({name:"DialogTitle",props:{as:{type:[Object,String],default:"h2"}},setup(e,{attrs:t,slots:r}){let n=Ye("DialogTitle"),i=`headlessui-dialog-title-${we()}`;return s.onMounted(()=>{n.setTitleId(i),s.onUnmounted(()=>n.setTitleId(null))}),()=>M({ourProps:{id:i},theirProps:e,slot:{open:n.dialogState.value===0},attrs:t,slots:r,name:"DialogTitle"})}});function wu(e){let t={called:!1};return(...r)=>{if(!t.called)return t.called=!0,e(...r)}}function Qn(){let e=[],t=[],r={enqueue(n){t.push(n)},requestAnimationFrame(...n){let i=requestAnimationFrame(...n);r.add(()=>cancelAnimationFrame(i))},nextFrame(...n){r.requestAnimationFrame(()=>{r.requestAnimationFrame(...n)})},setTimeout(...n){let i=setTimeout(...n);r.add(()=>clearTimeout(i))},add(n){e.push(n)},dispose(){for(let n of e.splice(0))n()},async workQueue(){for(let n of t.splice(0))await n()}};return r}function hr(e,...t){e&&t.length>0&&e.classList.add(...t)}function St(e,...t){e&&t.length>0&&e.classList.remove(...t)}var mr=(e=>(e.Finished="finished",e.Cancelled="cancelled",e))(mr||{});function Su(e,t){let r=Qn();if(!e)return r.dispose;let{transitionDuration:n,transitionDelay:i}=getComputedStyle(e),[o,a]=[n,i].map(l=>{let[u=0]=l.split(",").filter(Boolean).map(c=>c.includes("ms")?parseFloat(c):parseFloat(c)*1e3).sort((c,f)=>f-c);return u});return o!==0?r.setTimeout(()=>t("finished"),o+a):t("finished"),r.add(()=>t("cancelled")),r.dispose}function Yn(e,t,r,n,i,o){let a=Qn(),l=o!==void 0?wu(o):()=>{};return St(e,...i),hr(e,...t,...r),a.nextFrame(()=>{St(e,...r),hr(e,...n),a.add(Su(e,u=>(St(e,...n,...t),hr(e,...i),l(u))))}),a.add(()=>St(e,...t,...r,...n,...i)),a.add(()=>l("cancelled")),a.dispose}function Oe(e=""){return e.split(" ").filter(t=>t.trim().length>1)}let gr=Symbol("TransitionContext");var Ou=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Ou||{});function $u(){return s.inject(gr,null)!==null}function Eu(){let e=s.inject(gr,null);if(e===null)throw new Error("A is used but it is missing a parent .");return e}function _u(){let e=s.inject(vr,null);if(e===null)throw new Error("A is used but it is missing a parent .");return e}let vr=Symbol("NestingContext");function Ot(e){return"children"in e?Ot(e.children):e.value.filter(({state:t})=>t==="visible").length>0}function Jn(e){let t=s.ref([]),r=s.ref(!1);s.onMounted(()=>r.value=!0),s.onUnmounted(()=>r.value=!1);function n(o,a=ce.Hidden){let l=t.value.findIndex(({id:u})=>u===o);l!==-1&&(U(a,{[ce.Unmount](){t.value.splice(l,1)},[ce.Hidden](){t.value[l].state="hidden"}}),!Ot(t)&&r.value&&(e==null||e()))}function i(o){let a=t.value.find(({id:l})=>l===o);return a?a.state!=="visible"&&(a.state="visible"):t.value.push({id:o,state:"visible"}),()=>n(o,ce.Unmount)}return{children:t,register:i,unregister:n}}let Zn=yt.RenderStrategy,Je=s.defineComponent({props:{as:{type:[Object,String],default:"div"},show:{type:[Boolean],default:null},unmount:{type:[Boolean],default:!0},appear:{type:[Boolean],default:!1},enter:{type:[String],default:""},enterFrom:{type:[String],default:""},enterTo:{type:[String],default:""},entered:{type:[String],default:""},leave:{type:[String],default:""},leaveFrom:{type:[String],default:""},leaveTo:{type:[String],default:""}},emits:{beforeEnter:()=>!0,afterEnter:()=>!0,beforeLeave:()=>!0,afterLeave:()=>!0},setup(e,{emit:t,attrs:r,slots:n,expose:i}){if(!$u()&&Ql())return()=>s.h(Ze,{...e,onBeforeEnter:()=>t("beforeEnter"),onAfterEnter:()=>t("afterEnter"),onBeforeLeave:()=>t("beforeLeave"),onAfterLeave:()=>t("afterLeave")},n);let o=s.ref(null),a=s.ref("visible"),l=s.computed(()=>e.unmount?ce.Unmount:ce.Hidden);i({el:o,$el:o});let{show:u,appear:c}=Eu(),{register:f,unregister:d}=_u(),h={value:!0},p=we(),g={value:!1},b=Jn(()=>{g.value||(a.value="hidden",d(p),t("afterLeave"))});s.onMounted(()=>{let S=f(p);s.onUnmounted(S)}),s.watchEffect(()=>{if(l.value===ce.Hidden&&!!p){if(u&&a.value!=="visible"){a.value="visible";return}U(a.value,{hidden:()=>d(p),visible:()=>f(p)})}});let w=Oe(e.enter),x=Oe(e.enterFrom),A=Oe(e.enterTo),P=Oe(e.entered),E=Oe(e.leave),$=Oe(e.leaveFrom),m=Oe(e.leaveTo);s.onMounted(()=>{s.watchEffect(()=>{if(a.value==="visible"){let S=re(o);if(S instanceof Comment&&S.data==="")throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}})});function y(S){let _=h.value&&!c.value,O=re(o);!O||!(O instanceof HTMLElement)||_||(g.value=!0,u.value&&t("beforeEnter"),u.value||t("beforeLeave"),S(u.value?Yn(O,w,x,A,P,T=>{g.value=!1,T===mr.Finished&&t("afterEnter")}):Yn(O,E,$,m,P,T=>{g.value=!1,T===mr.Finished&&(Ot(b)||(a.value="hidden",d(p),t("afterLeave")))})))}return s.onMounted(()=>{s.watch([u],(S,_,O)=>{y(O),h.value=!1},{immediate:!0})}),s.provide(vr,b),Yl(s.computed(()=>U(a.value,{visible:Se.Open,hidden:Se.Closed}))),()=>{let{appear:S,show:_,enter:O,enterFrom:T,enterTo:B,entered:j,leave:W,leaveFrom:X,leaveTo:D,...L}=e;return M({theirProps:L,ourProps:{ref:o},slot:{},slots:n,attrs:r,features:Zn,visible:a.value==="visible",name:"TransitionChild"})}}}),Tu=Je,Ze=s.defineComponent({inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"},show:{type:[Boolean],default:null},unmount:{type:[Boolean],default:!0},appear:{type:[Boolean],default:!1},enter:{type:[String],default:""},enterFrom:{type:[String],default:""},enterTo:{type:[String],default:""},entered:{type:[String],default:""},leave:{type:[String],default:""},leaveFrom:{type:[String],default:""},leaveTo:{type:[String],default:""}},emits:{beforeEnter:()=>!0,afterEnter:()=>!0,beforeLeave:()=>!0,afterLeave:()=>!0},setup(e,{emit:t,attrs:r,slots:n}){let i=or(),o=s.computed(()=>e.show===null&&i!==null?U(i.value,{[Se.Open]:!0,[Se.Closed]:!1}):e.show);s.watchEffect(()=>{if(![!0,!1].includes(o.value))throw new Error('A is used but it is missing a `:show="true | false"` prop.')});let a=s.ref(o.value?"visible":"hidden"),l=Jn(()=>{a.value="hidden"}),u=s.ref(!0),c={show:o,appear:s.computed(()=>e.appear||!u.value)};return s.onMounted(()=>{s.watchEffect(()=>{u.value=!1,o.value?a.value="visible":Ot(l)||(a.value="hidden")})}),s.provide(vr,l),s.provide(gr,c),()=>{let f=jn(e,["show","appear","unmount","onBeforeEnter","onBeforeLeave","onAfterEnter","onAfterLeave"]),d={unmount:e.unmount};return M({ourProps:{...d,as:"template"},theirProps:{},slot:{},slots:{...n,default:()=>[s.h(Tu,{onBeforeEnter:()=>t("beforeEnter"),onAfterEnter:()=>t("afterEnter"),onBeforeLeave:()=>t("beforeLeave"),onAfterLeave:()=>t("afterLeave"),...r,...d,...f},n.default)]},attrs:{},features:Zn,visible:a.value==="visible",name:"Transition"})}}});const xu={props:{defaultTitle:{type:String,required:!1,default:""},defaultText:{type:String,required:!1,default:""},defaultConfirmButton:{type:String,required:!1,default:""},defaultCancelButton:{type:String,required:!1,default:""}},data(){return{isOpen:!1}},computed:{hasConfirmModal:()=>!!v.confirmModal.value,title:function(){var e;return(e=v.confirmModal.value)!=null&&e.title?v.confirmModal.value.title:this.defaultTitle},text:function(){var e;return(e=v.confirmModal.value)!=null&&e.text?v.confirmModal.value.text:this.defaultText},confirmButton:function(){var e;return(e=v.confirmModal.value)!=null&&e.confirmButton?v.confirmModal.value.confirmButton:this.defaultConfirmButton},cancelButton:function(){var e;return(e=v.confirmModal.value)!=null&&e.cancelButton?v.confirmModal.value.cancelButton:this.defaultCancelButton}},watch:{hasConfirmModal(e){e&&(this.isOpen=!0)}},methods:{cancel(){v.confirmModal.value.rejectPromise(),this.setIsOpen(!1)},confirm(){v.confirmModal.value.resolvePromise(),this.setIsOpen(!1)},setIsOpen(e){this.isOpen=e},emitClose(){v.clearConfirmModal()}},render(){return this.$slots.default({title:this.title,text:this.text,confirmButton:this.confirmButton,cancelButton:this.cancelButton,isOpen:this.isOpen,setIsOpen:this.setIsOpen,cancel:this.cancel,confirm:this.confirm,emitClose:this.emitClose,Dialog:Kn,DialogPanel:Xn,TransitionRoot:Ze,TransitionChild:Je})}};function ei(e,t){t=Xt(t,e);for(var r=0,n=t.length;e!=null&&r({}),required:!1},remember:{type:String,default:null,required:!1},localStorage:{type:Boolean,default:!1,required:!1}},data(){return{values:{}}},mounted(){if(this.remember){let e=v.restore(this.remember,this.localStorage);e||(e={}),this.values=Object.assign({},{...this.default,...e})}else this.values=Object.assign({},{...this.default})},updated(){this.remember&&v.remember(this.remember,{...this.values},this.localStorage)},render(){const e=this;return this.$slots.default(new Proxy(this.values,{ownKeys(){return Object.keys(e.values)},get(t,r){return yr(e.values,r)},set(t,r,n){ni(e.values,r,n)}}))}},Du={props:{url:{type:String,required:!0},method:{type:String,required:!1,default:"GET"},acceptHeader:{type:String,required:!1,default:"application/json"},poll:{type:Number,required:!1,default:null},default:{type:Object,required:!1,default:()=>({})},request:{type:Object,required:!1,default:()=>({})}},data(){return{response:Object.assign({},{...this.default}),processing:!1}},mounted(){this.$nextTick(this.performRequest)},methods:{performRequest(){this.processing=!0;const e={url:this.url,method:this.method,headers:{Accept:this.acceptHeader}};Object.keys(this.request).length>0&&(e.data=this.request),Br.default(e).then(t=>{this.response=t.data,this.processing=!1}).catch(()=>{this.processing=!1}),this.poll&&setTimeout(()=>{this.performRequest()},this.poll)}},render(){return this.$slots.default({processing:this.processing,response:this.response,reload:this.performRequest})}};function ii(e){return e&&e.length?e[0]:void 0}const Fu={inject:["stack"],computed:{values(){return v.validationErrors(this.stack)}},render(){const e=this;return this.$slots.default({has(t){return N(e.values,t)},first(t){return ii(e.values[t]||[])},all:{...this.values},...this.values})}},Ru={props:{private:{type:Boolean,required:!1,default:!1},channel:{type:String,required:!0},listeners:{type:Array,required:!0}},data(){return{subscribed:!1,subscription:null,subscriptions:[],events:[]}},beforeUnmount(){this.subscription&&(window.Echo.leave(this.subscription.subscription.name),this.subscription=null,this.subscriptions=[])},mounted(){this.subscription=this.private?window.Echo.private(this.channel):window.Echo.channel(this.channel),this.subscription.on("pusher:subscription_succeeded",()=>{this.subscribed=!0}),this.listeners.forEach(e=>{const t=this.subscription.listen(e,r=>{const n="splade.redirect",i="splade.refresh",o="splade.toast";let a=null,l=!1,u=[];Ae(r,c=>{!Q(c)||(n in c&&(a=c[n]),i in c&&(l=c[i]),o in c&&u.push(c))}),a?v.visit(a):l?v.refresh():this.events.push({name:e,data:r}),u.length>0&&u.forEach(c=>{v.pushToast(c)}),this.$root.$emit(`event.${e}`,r)});this.subscriptions.push(t)})},render(){return this.$slots.default({subscribed:this.subscribed,events:this.events})}},Mu={props:{form:{type:Object,required:!0},field:{type:String,required:!0},multiple:{type:Boolean,required:!0}},data(){return{filenames:[]}},methods:{handleFileInput(e){const t=Object.values(e.target.files);this.form.$put(this.field,this.multiple?t:t[0]),this.filenames=[],t.forEach(r=>{this.filenames.push(r.name)})}}},Lu={ref:"file"};function ku(e,t,r,n,i,o){return s.openBlock(),s.createElementBlock("div",Lu,[s.renderSlot(e.$slots,"default",{handleFileInput:o.handleFileInput,filenames:i.filenames})],512)}const qu=ze(Mu,[["render",ku]]),Nu={inject:["stack"],computed:{values(){return v.flashData(this.stack)}},render(){const e=this;return this.$slots.default({has(t){return N(e.values,t)},...this.values})}};function br(e){return e instanceof File||e instanceof Blob||e instanceof FileList&&e.length>0||e instanceof FormData&&Array.from(e.values()).some(t=>br(t))||typeof e=="object"&&e!==null&&Object.values(e).some(t=>br(t))}function oi(e){e=e||{};let t=new FormData;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&si(t,ai(null,r),e[r]);return t}function ai(e,t){return e?e+"["+t+"]":t}function si(e,t,r){if(Array.isArray(r))return Array.from(r.keys()).forEach(n=>si(e,ai(t,n.toString()),r[n]));if(r instanceof Date)return e.append(t,r.toISOString());if(r instanceof File)return e.append(t,r,r.name);if(r instanceof Blob)return e.append(t,r);if(typeof r=="boolean")return e.append(t,r?"1":"0");if(typeof r=="string")return e.append(t,r);if(typeof r=="number")return e.append(t,`${r}`);if(r==null)return e.append(t,"");oi(r)}var Hu="[object Boolean]";function li(e){return e===!0||e===!1||ae(e)&&oe(e)==Hu}function Vu(){this.__data__=new J,this.size=0}function Uu(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function Wu(e){return this.__data__.get(e)}function Gu(e){return this.__data__.has(e)}var zu=200;function Ku(e,t){var r=this.__data__;if(r instanceof J){var n=r.__data__;if(!He||n.lengthl))return!1;var c=o.get(e),f=o.get(t);if(c&&f)return c==t&&f==e;var d=-1,h=!0,p=r&tc?new $t:void 0;for(o.set(e,t),o.set(t,e);++d({})},forceFormData:{type:Boolean,required:!1,default:!1},confirm:{type:[Boolean,String],required:!1,default:!1},confirmText:{type:String,required:!1,default:""},confirmButton:{type:String,required:!1,default:""},cancelButton:{type:String,required:!1,default:""},stay:{type:Boolean,require:!1,default:!1},restoreOnSuccess:{type:Boolean,required:!1,default:!0},resetOnSuccess:{type:Boolean,required:!1,default:!1}},emits:["success","error"],data(){return{missingAttributes:[],values:Object.assign({},{...this.default}),processing:!1,wasSuccessful:!1,recentlySuccessful:!1,recentlySuccessfulTimeoutId:null}},computed:{$all(){return this.values},rawErrors(){return v.validationErrors(this.stack)},errors(){return Ti(this.rawErrors,e=>e.join(` -`))}},mounted(){let e=document.querySelector(`form[data-splade-id="${this.spladeId}"]`);e||(e=document),this.missingAttributes.forEach(t=>{let r="";const n=e.querySelector(`[name="${t}"]`);n?r=n.type==="checkbox"?!1:"":e.querySelector(`[name="${t}[]"]`)?r=[]:(e.querySelector(`[name^="${t}."]`)||e.querySelector(`[name^="${t}["]`))&&(r={}),this.$put(t,r)}),this.missingAttributes=[]},methods:{hasError(e){return N(this.errors,e)},reset(){this.values={}},restore(){this.values=Object.assign({},{...this.default})},$put(e,t){return ni(this.values,e,t)},submit(){if(!this.confirm)return this.request();v.confirm(li(this.confirm)?"":this.confirm,this.confirmText,this.confirmButton,this.cancelButton).then(()=>{this.request()}).catch(()=>{})},request(){this.processing=!0,this.wasSuccessful=!1,this.recentlySuccessful=!1,clearTimeout(this.recentlySuccessfulTimeoutId);const e=this.forceFormData||br(this.values)?oi(this.values):this.values,t={Accept:"application/json"};this.stay&&(t["X-Splade-Prevent-Refresh"]=!0),v.request(this.action,this.method.toUpperCase(),e,t).then(r=>{this.$emit("success",r),this.restoreOnSuccess&&this.restore(),this.resetOnSuccess&&this.reset(),this.processing=!1,this.wasSuccessful=!0,this.recentlySuccessful=!0,this.recentlySuccessfulTimeoutId=setTimeout(()=>this.recentlySuccessful=!1,2e3)}).catch(r=>{this.processing=!1,this.$emit("error",r)})}},render(){const e=this;return this.$slots.default(new Proxy({},{ownKeys(){return Object.keys(e.values)},get(t,r){return["$all","$attrs","$put","errors","restore","reset","hasError","processing","rawErrors","submit","wasSuccessful","recentlySuccessful"].includes(r)?e[r]:(N(e.values,r)||(e.missingAttributes.push(r),e.$put(r,"")),yr(e.values,r))},set(t,r,n){return e.$put(r,n)}}))}},nf={props:{flatpickr:{type:[Boolean,Object],required:!1,default:!1},jsFlatpickrOptions:{type:Object,required:!1,default:()=>({})},modelValue:{type:String,required:!1}},emits:["update:modelValue"],data(){return{element:null,flatpickrInstance:null}},watch:{modelValue(e){this.flatpickrInstance&&this.flatpickrInstance.setDate(e)}},mounted(){this.element=this.$refs.input.querySelector("input"),this.flatpickr&&this.initFlatpickr(this.element)},beforeUnmount(){this.flatpickrInstance&&this.flatpickrInstance.destroy()},methods:{initFlatpickr(e){import("flatpickr").then(t=>{this.flatpickrInstance=t.default(e,Object.assign({},this.flatpickr,this.jsFlatpickrOptions,{onChange:(r,n)=>{n!=this.modelValue&&this.$emit("update:modelValue",n)}}))})}}},of={ref:"input"};function af(e,t,r,n,i,o){return s.openBlock(),s.createElementBlock("div",of,[s.renderSlot(e.$slots,"default")],512)}const sf=ze(nf,[["render",af]]),lf=["href","onClick"],uf={__name:"Link",props:{href:{type:String,required:!0},confirm:{type:[Boolean,String],required:!1,default:!1},confirmText:{type:String,required:!1,default:""},confirmButton:{type:String,required:!1,default:""},cancelButton:{type:String,required:!1,default:""},modal:{type:Boolean,required:!1,default:!1},slideover:{type:Boolean,required:!1,default:!1}},setup(e){const t=e;function r(){if(!t.confirm)return n();v.confirm(li(t.confirm)?"":t.confirm,t.confirmText,t.confirmButton,t.cancelButton).then(()=>{n()}).catch(()=>{})}function n(){if(t.modal)return v.modal(t.href);if(t.slideover)return v.slideover(t.href);v.visit(t.href)}return(i,o)=>(s.openBlock(),s.createElementBlock("a",{href:e.href,onClick:s.withModifiers(r,["prevent"])},[s.renderSlot(i.$slots,"default")],8,lf))}},cf={provide(){return{stack:this.stack}},props:{closeButton:{type:Boolean,required:!1,default:!0},type:{type:String,required:!0},stack:{type:Number,required:!0},onTopOfStack:{type:Boolean,required:!1,default:!1},maxWidth:{type:String,required:!1,default:e=>e.type==="modal"?"2xl":"md"}},emits:["close"],data(){return{isOpen:!1}},mounted(){this.setIsOpen(!0)},methods:{emitClose(){this.$emit("close")},close(){this.setIsOpen(!1)},setIsOpen(e){this.isOpen=e}},render(){return this.$slots.default({type:this.type,isOpen:this.isOpen,setIsOpen:this.setIsOpen,close:this.close,stack:this.stack,onTopOfStack:this.onTopOfStack,maxWidth:this.maxWidth,emitClose:this.emitClose,closeButton:this.closeButton,Dialog:Kn,DialogPanel:Xn,TransitionRoot:Ze,TransitionChild:Je})}};function ff(e){return function(t,r,n){var i=Object(t);if(!nt(t)){var o=et(r);t=it(t),r=function(l){return o(i[l],l,i)}}var a=e(t,r,n);return a>-1?i[o?t[a]:a]:void 0}}function df(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o({})},multiple:{type:Boolean,required:!1,default:!1},modelValue:{type:[String,Array],required:!1},placeholder:{type:Boolean,required:!1,default:!1}},emits:["update:modelValue"],data(){return{choicesInstance:null,element:null,placeholderText:null}},computed:{hasSelection(){return this.multiple?Array.isArray(this.model)?this.model.length>0:!1:!(this.model===null||this.model==="")}},watch:{modelValue(e,t){if(this.choicesInstance){if(JSON.stringify(e)==JSON.stringify(t))return;Array.isArray(e)&&this.choicesInstance.removeActiveItems(),e===null&&(e=""),this.choicesInstance.setChoiceByValue(e),this.updateHasSelectionAttribute(),this.handlePlaceholderVisibility()}}},mounted(){this.element=this.$refs.select.querySelector("select"),this.choices&&this.initChoices(this.element)},beforeUnmount(){this.choices&&this.choicesInstance&&this.choicesInstance.destroy()},methods:{getItemOfCurrentModel(){const e=this.modelValue;return Tf(this.choicesInstance._store.choices,t=>t.value==e)},handlePlaceholderVisibility(){if(!this.multiple)return;const e=this.choicesInstance.containerInner.element.querySelector("input.choices__input");this.placeholderText=e.placeholder?e.placeholder:this.placeholderText;const t=this.choicesInstance.getValue().length;e.placeholder=t?"":this.placeholderText?this.placeholderText:"",e.style.minWidth="0",e.style.width=t?"1px":"auto",e.style.paddingTop=t?"0px":"1px",e.style.paddingBottom=t?"0px":"1px"},initChoices(e){const t=Array.from(e.querySelectorAll("option:not([placeholder])")).length,r=this;import("choices.js").then(n=>{const i=Object.assign({},this.choices,this.jsChoicesOptions);r.choicesInstance=new n.default(e,i),this.choicesInstance.containerInner.element.setAttribute("data-select-name",e.name),this.handlePlaceholderVisibility(),this.updateHasSelectionAttribute(),e.addEventListener("change",function(){if(r.$emit("update:modelValue",r.choicesInstance.getValue(!0)),!r.multiple||t<1)return;r.choicesInstance.getValue().length>=t&&r.choicesInstance.hideDropdown()}),e.addEventListener("showDropdown",function(){if(r.multiple||!r.modelValue)return;const o=r.getItemOfCurrentModel(),a=r.choicesInstance.dropdown.element.querySelector(`.choices__item[data-id="${o.id}"]`);r.choicesInstance.choiceList.scrollToChildElement(a,1),r.choicesInstance._highlightChoice(a)})})},updateHasSelectionAttribute(){this.choicesInstance.containerInner.element.setAttribute("data-has-selection",this.hasSelection)}}},Af={ref:"select"};function Pf(e,t,r,n,i,o){return s.openBlock(),s.createElementBlock("div",Af,[s.renderSlot(e.$slots,"default")],512)}const Cf=ze(xf,[["render",Pf]]),If={inject:["stack"],render(){const e=v.validationErrors(this.stack),t=v.flashData(this.stack),r=v.sharedData.value,n=Ti(e,i=>i.join(` -`));return this.$slots.default({flash:t,errors:n,rawErrors:e,shared:r,hasError(i){return N(e,i)},hasFlash(i){return N(t,i)},hasShared(i){return N(r,i)},hasErrors:Object.keys(e).length>0})}};var Bf=function(){return G.Date.now()};const xr=Bf;var jf="Expected a function",Df=Math.max,Ff=Math.min;function Rf(e,t,r){var n,i,o,a,l,u,c=0,f=!1,d=!1,h=!0;if(typeof e!="function")throw new TypeError(jf);t=_r(t)||0,Q(r)&&(f=!!r.leading,d="maxWait"in r,o=d?Df(_r(r.maxWait)||0,t):o,h="trailing"in r?!!r.trailing:h);function p(m){var y=n,S=i;return n=i=void 0,c=m,a=e.apply(S,y),a}function g(m){return c=m,l=setTimeout(x,t),f?p(m):a}function b(m){var y=m-u,S=m-c,_=t-y;return d?Ff(_,o-S):_}function w(m){var y=m-u,S=m-c;return u===void 0||y>=t||y<0||d&&S>=o}function x(){var m=xr();if(w(m))return A(m);l=setTimeout(x,b(m))}function A(m){return l=void 0,h&&n?p(m):(n=i=void 0,a)}function P(){l!==void 0&&clearTimeout(l),c=0,n=u=i=l=void 0}function E(){return l===void 0?a:A(xr())}function $(){var m=xr(),y=w(m);if(n=arguments,i=this,u=m,y){if(l===void 0)return g(u);if(d)return clearTimeout(l),l=setTimeout(x,t),p(u)}return l===void 0&&(l=setTimeout(x,t)),a}return $.cancel=P,$.flush=E,$}function Pi(e,t,r){return e===e&&(r!==void 0&&(e=e<=r?e:r),t!==void 0&&(e=e>=t?e:t)),e}function Mf(e,t,r){e=Kt(e),t=ut(t);var n=e.length;r=r===void 0?n:Pi(Tr(r),0,n);var i=r;return r-=t.length,r>=0&&e.slice(r,i)==t}function Lf(e,t){var r=[];return Mt(e,function(n,i,o){t(n,i,o)&&r.push(n)}),r}function kf(e,t){var r=F(e)?di:Lf;return r(e,et(t))}function Ci(e,t){return _t(e,t)}function qf(e,t){var r=-1,n=nt(e)?Array(e.length):[];return Mt(e,function(i,o,a){n[++r]=t(i,o,a)}),n}function Nf(e,t){var r=F(e)?dn:qf;return r(e,et(t))}function Tt(e,t,r){return e=Kt(e),r=r==null?0:Pi(Tr(r),0,e.length),t=ut(t),e.slice(r,r+t.length)==t}const Hf={props:{striped:{type:Boolean,required:!1,default:!1},columns:{type:Object,required:!0},defaultVisibleToggleableColumns:{type:Array,required:!0}},data(){return{visibleColumns:[],forcedVisibleSearchInputs:[]}},computed:{columnsAreToggled(){return!Ci(this.visibleColumns,this.defaultVisibleToggleableColumns)},hasForcedVisibleSearchInputs(){return this.forcedVisibleSearchInputs.length>0}},mounted(){const e=this.getCurrentQuery(),t=e.columns||[];Ae(e,(r,n)=>{if(Tt(n,"filter[")&&!r){const i=n.split("["),o=i[1].substring(0,i[1].length-1);this.forcedVisibleSearchInputs=[...this.forcedVisibleSearchInputs,o]}}),t.length===0?this.visibleColumns=this.defaultVisibleToggleableColumns:this.visibleColumns=t},methods:{reset(){this.forcedVisibleSearchInputs=[],this.visibleColumns=this.defaultVisibleToggleableColumns;let e=this.getCurrentQuery();e.columns=[],e.page=null,e.perPage=null,e.sort=null,Ae(e,(t,r)=>{Tt(r,"filter[")&&(e[r]=null)}),this.visitWithQueryObject(e,null,!0)},columnIsVisible(e){return this.visibleColumns.includes(e)},toggleColumn(e){const t=!this.columnIsVisible(e),r=kf(this.columns,i=>i.can_be_hidden?i.key===e?t:this.visibleColumns.includes(i.key):!0);let n=Nf(r,i=>i.key).sort();Ci(n,this.defaultVisibleToggleableColumns)&&(n=[]),this.visibleColumns=n.length===0?this.defaultVisibleToggleableColumns:n,this.updateQuery("columns",n,null,!1)},disableSearchInput(e){this.forcedVisibleSearchInputs=this.forcedVisibleSearchInputs.filter(t=>t!=e),this.updateQuery(`filter[${e}]`,null)},showSearchInput(e){this.forcedVisibleSearchInputs=[...this.forcedVisibleSearchInputs,e],s.nextTick(()=>{document.querySelector(`[name="searchInput-${e}"]`).focus()})},isForcedVisible(e){return this.forcedVisibleSearchInputs.includes(e)},debounceUpdateQuery:Rf(function(e,t,r){this.updateQuery(e,t,r)},350),getCurrentQuery(){const e=window.location.search;if(!e)return{};let t={};return e.substring(1).split("&").forEach(r=>{const n=decodeURIComponent(r).split("=");let i=n[0];if(!Mf(i,"]")){t[i]=n[1];return}const o=i.split("["),a=o[1].substring(0,o[1].length-1);parseInt(a)==a?(i=o[0],F(t[i])||(t[i]=[]),t[i].push(n[1])):t[i]=n[1]}),t},updateQuery(e,t,r,n){typeof n>"u"&&(n=!0);let i=this.getCurrentQuery();i[e]=t,(Tt(e,"perPage")||Tt(e,"filter["))&&delete i.page,this.visitWithQueryObject(i,r,n)},visitWithQueryObject(e,t,r){typeof r>"u"&&(r=!0);let n={};Ae(e,(a,l)=>{if(!F(a)){n[l]=a;return}a.length!==0&&a.forEach((u,c)=>{n[`${l}[${c}]`]=u})});let i="";Ae(n,(a,l)=>{a===null||a===[]||(i&&(i+="&"),i+=`${l}=${a}`)}),i&&(i="?"+i);const o=window.location.pathname+i;if(!r)return v.replaceUrlOfCurrentPage(o);v.replace(o).then(()=>{typeof t<"u"&&t&&s.nextTick(()=>{document.querySelector(`[name="${t.name}"]`).focus()})})}},render(){return this.$slots.default({columnIsVisible:this.columnIsVisible,columnsAreToggled:this.columnsAreToggled,debounceUpdateQuery:this.debounceUpdateQuery,disableSearchInput:this.disableSearchInput,hasForcedVisibleSearchInputs:this.hasForcedVisibleSearchInputs,isForcedVisible:this.isForcedVisible,reset:this.reset,showSearchInput:this.showSearchInput,striped:this.striped,toggleColumn:this.toggleColumn,updateQuery:this.updateQuery,visit:v.visit})}},Vf={props:{autosize:{type:Boolean,required:!1,default:!1},modelValue:{type:String,required:!1}},data(){return{autosizeInstance:null,element:null}},watch:{modelValue(){!this.autosize||!this.autosizeInstance||import("autosize").then(e=>{s.nextTick(()=>e.default.update(this.element))})}},mounted(){this.element=this.$refs.textarea.querySelector("textarea"),this.autosize&&import("autosize").then(e=>{this.autosizeInstance=e.default(this.element)})},beforeUnmount(){this.autosize&&this.autosizeInstance&&import("autosize").then(e=>{e.default.destroy(this.element)})}},Uf={ref:"textarea"};function Wf(e,t,r,n,i,o){return s.openBlock(),s.createElementBlock("div",Uf,[s.renderSlot(e.$slots,"default")],512)}const Gf=ze(Vf,[["render",Wf]]),zf={props:{toastKey:{type:Number,required:!0},autoDismiss:{type:Number,required:!1,default:0}},emits:["dismiss"],data(){return{show:!0}},mounted(){this.autoDismiss&&setTimeout(()=>{this.setShow(!1)},this.autoDismiss*1e3)},methods:{setShow(e){this.show=e},emitDismiss(){this.$emit("dismiss")}},render(){return this.$slots.default({key:this.toastKey,show:this.show,setShow:this.setShow,emitDismiss:this.emitDismiss,TransitionRoot:Ze,TransitionChild:Je})}},Kf=["left-top","center-top","right-top","left-center","center-center","right-center","left-bottom","center-bottom","right-bottom"],Xf={computed:{toasts:function(){return v.toastsReversed.value},hasBackdrop:function(){return v.toasts.value.filter(e=>!e.dismissed&&e.backdrop&&e.html).length>0}},methods:{dismissToast(e){v.dismissToast(e)}},render(){return this.$slots.default({positions:Kf,toasts:this.toasts,dismissToast:this.dismissToast,hasBackdrop:this.hasBackdrop,Render:qe,TransitionRoot:Ze,TransitionChild:Je})}},Qf={props:{default:{type:Object,required:!0}},data(){return{toggles:{...this.default}}},methods:{toggled(e){var t;return(t=this.toggles[e])!=null?t:!1},toggle(e){this.setToggle(e,!this.toggled(e))},setToggle(e,t){this.toggles[e]=t}},render(){const e=this;return this.$slots.default(new Proxy({},{ownKeys(){return Object.keys(e.toggles)},get(t,r){const n=Object.keys(e.toggles);if(n.length===1&&ii(n)==="default"){if(r==="toggled")return e.toggled("default");if(r==="setToggle")return i=>{e.setToggle("default",i)};if(r==="toggle")return()=>{e.toggle("default")}}return r==="setToggle"?(i,o)=>{e.setToggle(i,o)}:r==="toggle"?i=>{e.toggle(i)}:e.toggled(r)}}))}},Yf={install:(e,t)=>{t=t||{},t.max_keep_alive=N(t,"max_keep_alive")?t.max_keep_alive:10,t.prefix=N(t,"prefix")?t.prefix:"Splade",t.transform_anchors=N(t,"transform_anchors")?t.transform_anchors:!1,t.link_component=N(t,"link_component")?t.link_component:"Link";const r=t.prefix;e.component(`${r}ButtonWithDropdown`,Wl).component(`${r}Confirm`,xu).component(`${r}Data`,ju).component(`${r}Defer`,Du).component(`${r}Errors`,Fu).component(`${r}Event`,Ru).component(`${r}File`,qu).component(`${r}Flash`,Nu).component(`${r}Form`,rf).component(`${r}Input`,sf).component(`${r}Modal`,cf).component(`${r}Render`,qe).component(`${r}Select`,Cf).component(`${r}State`,If).component(`${r}Table`,Hf).component(`${r}Textarea`,Gf).component(`${r}Toast`,zf).component(`${r}Toasts`,Xf).component(`${r}Toggle`,Qf).component(t.link_component,uf),Object.defineProperty(e.config.globalProperties,"$splade",{get:()=>v}),Object.defineProperty(e.config.globalProperties,"$spladeOptions",{get:()=>Object.assign({},{...t})}),e.provide("$splade",e.config.globalProperties.$splade),e.provide("$spladeOptions",e.config.globalProperties.$spladeOptions)}};function Jf(e,t,r){const n={};process.argv.slice(2).forEach(o=>{const a=o.replace(/^-+/,"").split("=");n[a[0]]=a.length===2?a[1]:!0});const i=n.port||9e3;e(async(o,a)=>{if(o.method=="POST"){let l="";o.on("data",u=>l+=u),o.on("end",async()=>{const u=JSON.parse(l),c=r({components:u.components,initialHtml:u.html,initialSpladeData:u.splade}),f=await t(c);a.writeHead(200,{"Content-Type":"application/json",Server:"Splade SSR"}),a.write(JSON.stringify({body:f})),a.end()})}}).listen(i,()=>console.log(`Splade SSR server started on port ${i}.`))}I.Splade=v,I.SpladeApp=cn,I.SpladePlugin=Yf,I.renderSpladeApp=Ra,I.startServer=Jf,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); +`))}},mounted(){let e=document.querySelector(`form[data-splade-id="${this.spladeId}"]`);e||(e=document),this.missingAttributes.forEach(t=>{let r="";const n=e.querySelector(`[name="${t}"]`);n?r=n.type==="checkbox"?!1:"":e.querySelector(`[name="${t}[]"]`)?r=[]:(e.querySelector(`[name^="${t}."]`)||e.querySelector(`[name^="${t}["]`))&&(r={}),this.$put(t,r)}),this.missingAttributes=[]},methods:{hasError(e){return N(this.errors,e)},reset(){this.values={}},restore(){this.values=Object.assign({},{...this.default})},$put(e,t){return ni(this.values,e,t)},submit(e){const t=e.submitter;if(t.name&&this.$put(t.name,t.value),!this.confirm)return this.request();v.confirm(li(this.confirm)?"":this.confirm,this.confirmText,this.confirmButton,this.cancelButton).then(()=>{this.request()}).catch(()=>{})},request(){this.processing=!0,this.wasSuccessful=!1,this.recentlySuccessful=!1,clearTimeout(this.recentlySuccessfulTimeoutId);const e=this.forceFormData||br(this.values)?oi(this.values):this.values,t={Accept:"application/json"};this.stay&&(t["X-Splade-Prevent-Refresh"]=!0),v.request(this.action,this.method.toUpperCase(),e,t).then(r=>{this.$emit("success",r),this.restoreOnSuccess&&this.restore(),this.resetOnSuccess&&this.reset(),this.processing=!1,this.wasSuccessful=!0,this.recentlySuccessful=!0,this.recentlySuccessfulTimeoutId=setTimeout(()=>this.recentlySuccessful=!1,2e3)}).catch(r=>{this.processing=!1,this.$emit("error",r)})}},render(){const e=this;return this.$slots.default(new Proxy({},{ownKeys(){return Object.keys(e.values)},get(t,r){return["$all","$attrs","$put","errors","restore","reset","hasError","processing","rawErrors","submit","wasSuccessful","recentlySuccessful"].includes(r)?e[r]:(N(e.values,r)||(e.missingAttributes.push(r),e.$put(r,"")),yr(e.values,r))},set(t,r,n){return e.$put(r,n)}}))}},nf={props:{flatpickr:{type:[Boolean,Object],required:!1,default:!1},jsFlatpickrOptions:{type:Object,required:!1,default:()=>({})},modelValue:{type:[String,Number],required:!1}},emits:["update:modelValue"],data(){return{disabled:!1,element:null,flatpickrInstance:null,observer:null}},watch:{modelValue(e){this.flatpickrInstance&&this.flatpickrInstance.setDate(e)}},mounted(){this.element=this.$refs.input.querySelector("input"),this.flatpickr&&this.initFlatpickr(this.element),this.disabled=this.element.disabled;const e=this;this.observer=new MutationObserver(function(t){t.forEach(function(r){r.attributeName==="disabled"&&(e.disabled=r.target.disabled)})}),this.observer.observe(this.element,{attributes:!0})},beforeUnmount(){this.observer.disconnect(),this.flatpickrInstance&&this.flatpickrInstance.destroy()},methods:{initFlatpickr(e){import("flatpickr").then(t=>{this.flatpickrInstance=t.default(e,Object.assign({},this.flatpickr,this.jsFlatpickrOptions,{onChange:(r,n)=>{n!=this.modelValue&&this.$emit("update:modelValue",n)}}))})}}},of={ref:"input"};function af(e,t,r,n,i,o){return s.openBlock(),s.createElementBlock("div",of,[s.renderSlot(e.$slots,"default",{disabled:i.disabled})],512)}const sf=ze(nf,[["render",af]]),lf=["href","onClick"],uf={__name:"Link",props:{href:{type:String,required:!0},confirm:{type:[Boolean,String],required:!1,default:!1},confirmText:{type:String,required:!1,default:""},confirmButton:{type:String,required:!1,default:""},cancelButton:{type:String,required:!1,default:""},modal:{type:Boolean,required:!1,default:!1},slideover:{type:Boolean,required:!1,default:!1}},setup(e){const t=e;function r(){if(!t.confirm)return n();v.confirm(li(t.confirm)?"":t.confirm,t.confirmText,t.confirmButton,t.cancelButton).then(()=>{n()}).catch(()=>{})}function n(){if(t.modal)return v.modal(t.href);if(t.slideover)return v.slideover(t.href);v.visit(t.href)}return(i,o)=>(s.openBlock(),s.createElementBlock("a",{href:e.href,onClick:s.withModifiers(r,["prevent"])},[s.renderSlot(i.$slots,"default")],8,lf))}},cf={provide(){return{stack:this.stack}},props:{closeButton:{type:Boolean,required:!1,default:!0},type:{type:String,required:!0},stack:{type:Number,required:!0},onTopOfStack:{type:Boolean,required:!1,default:!1},maxWidth:{type:String,required:!1,default:e=>e.type==="modal"?"2xl":"md"}},emits:["close"],data(){return{isOpen:!1}},mounted(){this.setIsOpen(!0)},methods:{emitClose(){this.$emit("close")},close(){this.setIsOpen(!1)},setIsOpen(e){this.isOpen=e}},render(){return this.$slots.default({type:this.type,isOpen:this.isOpen,setIsOpen:this.setIsOpen,close:this.close,stack:this.stack,onTopOfStack:this.onTopOfStack,maxWidth:this.maxWidth,emitClose:this.emitClose,closeButton:this.closeButton,Dialog:Kn,DialogPanel:Xn,TransitionRoot:Ze,TransitionChild:Je})}};function ff(e){return function(t,r,n){var i=Object(t);if(!nt(t)){var o=et(r);t=it(t),r=function(l){return o(i[l],l,i)}}var a=e(t,r,n);return a>-1?i[o?t[a]:a]:void 0}}function df(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o({})},multiple:{type:Boolean,required:!1,default:!1},modelValue:{type:[String,Number,Array],required:!1},placeholder:{type:Boolean,required:!1,default:!1}},emits:["update:modelValue"],data(){return{choicesInstance:null,element:null,placeholderText:null}},computed:{hasSelection(){return this.multiple?Array.isArray(this.model)?this.model.length>0:!1:!(this.model===null||this.model==="")}},watch:{modelValue(e,t){if(this.choicesInstance){if(JSON.stringify(e)==JSON.stringify(t))return;Array.isArray(e)&&this.choicesInstance.removeActiveItems(),e===null&&(e=""),this.choicesInstance.setChoiceByValue(e),this.updateHasSelectionAttribute(),this.handlePlaceholderVisibility()}}},mounted(){this.element=this.$refs.select.querySelector("select"),this.choices&&this.initChoices(this.element)},beforeUnmount(){this.choices&&this.choicesInstance&&this.choicesInstance.destroy()},methods:{getItemOfCurrentModel(){const e=this.modelValue;return Tf(this.choicesInstance._store.choices,t=>t.value==e)},handlePlaceholderVisibility(){if(!this.multiple)return;const e=this.choicesInstance.containerInner.element.querySelector("input.choices__input");this.placeholderText=e.placeholder?e.placeholder:this.placeholderText;const t=this.choicesInstance.getValue().length;e.placeholder=t?"":this.placeholderText?this.placeholderText:"",e.style.minWidth="0",e.style.width=t?"1px":"auto",e.style.paddingTop=t?"0px":"1px",e.style.paddingBottom=t?"0px":"1px"},initChoices(e){const t=Array.from(e.querySelectorAll("option:not([placeholder])")).length,r=this;import("choices.js").then(n=>{const i=Object.assign({},this.choices,this.jsChoicesOptions);r.choicesInstance=new n.default(e,i),this.choicesInstance.containerInner.element.setAttribute("data-select-name",e.name),this.handlePlaceholderVisibility(),this.updateHasSelectionAttribute(),e.addEventListener("change",function(){if(r.$emit("update:modelValue",r.choicesInstance.getValue(!0)),!r.multiple||t<1)return;r.choicesInstance.getValue().length>=t&&r.choicesInstance.hideDropdown()}),e.addEventListener("showDropdown",function(){if(r.multiple||!r.modelValue)return;const o=r.getItemOfCurrentModel(),a=r.choicesInstance.dropdown.element.querySelector(`.choices__item[data-id="${o.id}"]`);r.choicesInstance.choiceList.scrollToChildElement(a,1),r.choicesInstance._highlightChoice(a)})})},updateHasSelectionAttribute(){this.choicesInstance.containerInner.element.setAttribute("data-has-selection",this.hasSelection)}}},Af={ref:"select"};function Pf(e,t,r,n,i,o){return s.openBlock(),s.createElementBlock("div",Af,[s.renderSlot(e.$slots,"default")],512)}const Cf=ze(xf,[["render",Pf]]),If={inject:["stack"],render(){const e=v.validationErrors(this.stack),t=v.flashData(this.stack),r=v.sharedData.value,n=Ti(e,i=>i.join(` +`));return this.$slots.default({flash:t,errors:n,rawErrors:e,shared:r,hasError(i){return N(e,i)},hasFlash(i){return N(t,i)},hasShared(i){return N(r,i)},hasErrors:Object.keys(e).length>0})}};var Bf=function(){return G.Date.now()};const xr=Bf;var jf="Expected a function",Df=Math.max,Ff=Math.min;function Rf(e,t,r){var n,i,o,a,l,u,c=0,f=!1,d=!1,h=!0;if(typeof e!="function")throw new TypeError(jf);t=_r(t)||0,Q(r)&&(f=!!r.leading,d="maxWait"in r,o=d?Df(_r(r.maxWait)||0,t):o,h="trailing"in r?!!r.trailing:h);function p(m){var y=n,S=i;return n=i=void 0,c=m,a=e.apply(S,y),a}function g(m){return c=m,l=setTimeout(x,t),f?p(m):a}function b(m){var y=m-u,S=m-c,_=t-y;return d?Ff(_,o-S):_}function w(m){var y=m-u,S=m-c;return u===void 0||y>=t||y<0||d&&S>=o}function x(){var m=xr();if(w(m))return A(m);l=setTimeout(x,b(m))}function A(m){return l=void 0,h&&n?p(m):(n=i=void 0,a)}function P(){l!==void 0&&clearTimeout(l),c=0,n=u=i=l=void 0}function E(){return l===void 0?a:A(xr())}function $(){var m=xr(),y=w(m);if(n=arguments,i=this,u=m,y){if(l===void 0)return g(u);if(d)return clearTimeout(l),l=setTimeout(x,t),p(u)}return l===void 0&&(l=setTimeout(x,t)),a}return $.cancel=P,$.flush=E,$}function Pi(e,t,r){return e===e&&(r!==void 0&&(e=e<=r?e:r),t!==void 0&&(e=e>=t?e:t)),e}function Mf(e,t,r){e=Kt(e),t=ut(t);var n=e.length;r=r===void 0?n:Pi(Tr(r),0,n);var i=r;return r-=t.length,r>=0&&e.slice(r,i)==t}function Lf(e,t){var r=[];return Mt(e,function(n,i,o){t(n,i,o)&&r.push(n)}),r}function kf(e,t){var r=F(e)?di:Lf;return r(e,et(t))}function Ci(e,t){return _t(e,t)}function qf(e,t){var r=-1,n=nt(e)?Array(e.length):[];return Mt(e,function(i,o,a){n[++r]=t(i,o,a)}),n}function Nf(e,t){var r=F(e)?dn:qf;return r(e,et(t))}function Tt(e,t,r){return e=Kt(e),r=r==null?0:Pi(Tr(r),0,e.length),t=ut(t),e.slice(r,r+t.length)==t}const Hf={props:{striped:{type:Boolean,required:!1,default:!1},columns:{type:Object,required:!0},defaultVisibleToggleableColumns:{type:Array,required:!0}},data(){return{visibleColumns:[],forcedVisibleSearchInputs:[]}},computed:{columnsAreToggled(){return!Ci(this.visibleColumns,this.defaultVisibleToggleableColumns)},hasForcedVisibleSearchInputs(){return this.forcedVisibleSearchInputs.length>0}},mounted(){const e=this.getCurrentQuery(),t=e.columns||[];Ae(e,(r,n)=>{if(Tt(n,"filter[")&&!r){const i=n.split("["),o=i[1].substring(0,i[1].length-1);this.forcedVisibleSearchInputs=[...this.forcedVisibleSearchInputs,o]}}),t.length===0?this.visibleColumns=this.defaultVisibleToggleableColumns:this.visibleColumns=t},methods:{reset(){this.forcedVisibleSearchInputs=[],this.visibleColumns=this.defaultVisibleToggleableColumns;let e=this.getCurrentQuery();e.columns=[],e.page=null,e.perPage=null,e.sort=null,Ae(e,(t,r)=>{Tt(r,"filter[")&&(e[r]=null)}),this.visitWithQueryObject(e,null,!0)},columnIsVisible(e){return this.visibleColumns.includes(e)},toggleColumn(e){const t=!this.columnIsVisible(e),r=kf(this.columns,i=>i.can_be_hidden?i.key===e?t:this.visibleColumns.includes(i.key):!0);let n=Nf(r,i=>i.key).sort();Ci(n,this.defaultVisibleToggleableColumns)&&(n=[]),this.visibleColumns=n.length===0?this.defaultVisibleToggleableColumns:n,this.updateQuery("columns",n,null,!1)},disableSearchInput(e){this.forcedVisibleSearchInputs=this.forcedVisibleSearchInputs.filter(t=>t!=e),this.updateQuery(`filter[${e}]`,null)},showSearchInput(e){this.forcedVisibleSearchInputs=[...this.forcedVisibleSearchInputs,e],s.nextTick(()=>{document.querySelector(`[name="searchInput-${e}"]`).focus()})},isForcedVisible(e){return this.forcedVisibleSearchInputs.includes(e)},debounceUpdateQuery:Rf(function(e,t,r){this.updateQuery(e,t,r)},350),getCurrentQuery(){const e=window.location.search;if(!e)return{};let t={};return e.substring(1).split("&").forEach(r=>{const n=decodeURIComponent(r).split("=");let i=n[0];if(!Mf(i,"]")){t[i]=n[1];return}const o=i.split("["),a=o[1].substring(0,o[1].length-1);parseInt(a)==a?(i=o[0],F(t[i])||(t[i]=[]),t[i].push(n[1])):t[i]=n[1]}),t},updateQuery(e,t,r,n){typeof n>"u"&&(n=!0);let i=this.getCurrentQuery();i[e]=t,(Tt(e,"perPage")||Tt(e,"filter["))&&delete i.page,this.visitWithQueryObject(i,r,n)},visitWithQueryObject(e,t,r){typeof r>"u"&&(r=!0);let n={};Ae(e,(a,l)=>{if(!F(a)){n[l]=a;return}a.length!==0&&a.forEach((u,c)=>{n[`${l}[${c}]`]=u})});let i="";Ae(n,(a,l)=>{a===null||a===[]||(i&&(i+="&"),i+=`${l}=${a}`)}),i&&(i="?"+i);const o=window.location.pathname+i;if(!r)return v.replaceUrlOfCurrentPage(o);v.replace(o).then(()=>{typeof t<"u"&&t&&s.nextTick(()=>{document.querySelector(`[name="${t.name}"]`).focus()})})}},render(){return this.$slots.default({columnIsVisible:this.columnIsVisible,columnsAreToggled:this.columnsAreToggled,debounceUpdateQuery:this.debounceUpdateQuery,disableSearchInput:this.disableSearchInput,hasForcedVisibleSearchInputs:this.hasForcedVisibleSearchInputs,isForcedVisible:this.isForcedVisible,reset:this.reset,showSearchInput:this.showSearchInput,striped:this.striped,toggleColumn:this.toggleColumn,updateQuery:this.updateQuery,visit:v.visit})}},Vf={props:{autosize:{type:Boolean,required:!1,default:!1},modelValue:{type:[String,Number],required:!1}},data(){return{autosizeInstance:null,element:null}},watch:{modelValue(){!this.autosize||!this.autosizeInstance||import("autosize").then(e=>{s.nextTick(()=>e.default.update(this.element))})}},mounted(){this.element=this.$refs.textarea.querySelector("textarea"),this.autosize&&import("autosize").then(e=>{this.autosizeInstance=e.default(this.element)})},beforeUnmount(){this.autosize&&this.autosizeInstance&&import("autosize").then(e=>{e.default.destroy(this.element)})}},Uf={ref:"textarea"};function Wf(e,t,r,n,i,o){return s.openBlock(),s.createElementBlock("div",Uf,[s.renderSlot(e.$slots,"default")],512)}const Gf=ze(Vf,[["render",Wf]]),zf={props:{toastKey:{type:Number,required:!0},autoDismiss:{type:Number,required:!1,default:0}},emits:["dismiss"],data(){return{show:!0}},mounted(){this.autoDismiss&&setTimeout(()=>{this.setShow(!1)},this.autoDismiss*1e3)},methods:{setShow(e){this.show=e},emitDismiss(){this.$emit("dismiss")}},render(){return this.$slots.default({key:this.toastKey,show:this.show,setShow:this.setShow,emitDismiss:this.emitDismiss,TransitionRoot:Ze,TransitionChild:Je})}},Kf=["left-top","center-top","right-top","left-center","center-center","right-center","left-bottom","center-bottom","right-bottom"],Xf={computed:{toasts:function(){return v.toastsReversed.value},hasBackdrop:function(){return v.toasts.value.filter(e=>!e.dismissed&&e.backdrop&&e.html).length>0}},methods:{dismissToast(e){v.dismissToast(e)}},render(){return this.$slots.default({positions:Kf,toasts:this.toasts,dismissToast:this.dismissToast,hasBackdrop:this.hasBackdrop,Render:qe,TransitionRoot:Ze,TransitionChild:Je})}},Qf={props:{default:{type:Object,required:!0}},data(){return{toggles:{...this.default}}},methods:{toggled(e){var t;return(t=this.toggles[e])!=null?t:!1},toggle(e){this.setToggle(e,!this.toggled(e))},setToggle(e,t){this.toggles[e]=t}},render(){const e=this;return this.$slots.default(new Proxy({},{ownKeys(){return Object.keys(e.toggles)},get(t,r){const n=Object.keys(e.toggles);if(n.length===1&&ii(n)==="default"){if(r==="toggled")return e.toggled("default");if(r==="setToggle")return i=>{e.setToggle("default",i)};if(r==="toggle")return()=>{e.toggle("default")}}return r==="setToggle"?(i,o)=>{e.setToggle(i,o)}:r==="toggle"?i=>{e.toggle(i)}:e.toggled(r)}}))}},Yf={install:(e,t)=>{t=t||{},t.max_keep_alive=N(t,"max_keep_alive")?t.max_keep_alive:10,t.prefix=N(t,"prefix")?t.prefix:"Splade",t.transform_anchors=N(t,"transform_anchors")?t.transform_anchors:!1,t.link_component=N(t,"link_component")?t.link_component:"Link";const r=t.prefix;e.component(`${r}ButtonWithDropdown`,Wl).component(`${r}Confirm`,xu).component(`${r}Data`,ju).component(`${r}Defer`,Du).component(`${r}Errors`,Fu).component(`${r}Event`,Ru).component(`${r}File`,qu).component(`${r}Flash`,Nu).component(`${r}Form`,rf).component(`${r}Input`,sf).component(`${r}Modal`,cf).component(`${r}Render`,qe).component(`${r}Select`,Cf).component(`${r}State`,If).component(`${r}Table`,Hf).component(`${r}Textarea`,Gf).component(`${r}Toast`,zf).component(`${r}Toasts`,Xf).component(`${r}Toggle`,Qf).component(t.link_component,uf),Object.defineProperty(e.config.globalProperties,"$splade",{get:()=>v}),Object.defineProperty(e.config.globalProperties,"$spladeOptions",{get:()=>Object.assign({},{...t})}),e.provide("$splade",e.config.globalProperties.$splade),e.provide("$spladeOptions",e.config.globalProperties.$spladeOptions)}};function Jf(e,t,r){const n={};process.argv.slice(2).forEach(o=>{const a=o.replace(/^-+/,"").split("=");n[a[0]]=a.length===2?a[1]:!0});const i=n.port||9e3;e(async(o,a)=>{if(o.method=="POST"){let l="";o.on("data",u=>l+=u),o.on("end",async()=>{const u=JSON.parse(l),c=r({components:u.components,initialHtml:u.html,initialSpladeData:u.splade}),f=await t(c);a.writeHead(200,{"Content-Type":"application/json",Server:"Splade SSR"}),a.write(JSON.stringify({body:f})),a.end()})}}).listen(i,()=>console.log(`Splade SSR server started on port ${i}.`))}I.Splade=v,I.SpladeApp=cn,I.SpladePlugin=Yf,I.renderSpladeApp=Ra,I.startServer=Jf,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); diff --git a/package-lock.json b/package-lock.json index 0441cbd5..3351dd19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@protonemedia/laravel-splade", - "version": "0.4.7", + "version": "0.4.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@protonemedia/laravel-splade", - "version": "0.4.7", + "version": "0.4.8", "license": "MIT", "dependencies": { "autosize": "^5.0.1", diff --git a/package.json b/package.json index 4983f6ab..f4f90894 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@protonemedia/laravel-splade", - "version": "0.4.7", + "version": "0.4.8", "description": "Laravel Splade: the magic of Inertia.js with the simplicity of Blade.", "private": false, "author": "Pascal Baljet ", diff --git a/src/Commands/SpladeInstallCommand.php b/src/Commands/SpladeInstallCommand.php index fe5c3bf3..1183867a 100644 --- a/src/Commands/SpladeInstallCommand.php +++ b/src/Commands/SpladeInstallCommand.php @@ -21,7 +21,7 @@ public function handle(): int // Install NPM packages... $this->updateNodePackages(function ($packages) { return [ - '@protonemedia/laravel-splade' => '^0.4.7', + '@protonemedia/laravel-splade' => '^0.4.8', '@tailwindcss/forms' => '^0.5.2', '@tailwindcss/typography' => '^0.5.2', '@vitejs/plugin-vue' => '^3.0.0',