@oneclick.dev/cms-core-modules 0.0.83 → 0.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ContentEditor-CxKirDdL.mjs → ContentEditor-DPhhOkx3.mjs} +7068 -5926
- package/dist/{ContentEditor-CRFkD4tE.js → ContentEditor-DrxtH_Hq.js} +42 -42
- package/dist/{Create-CsqVYhPO.mjs → Create-6uT9HWar.mjs} +35 -35
- package/dist/{Create-ip0MnS0o.js → Create-DuZ5nZrX.js} +1 -1
- package/dist/{DateFormatter-CvOfaUnU.mjs → DateFormatter-2B0R-DY4.mjs} +204 -400
- package/dist/DateFormatter-DbtOLV0L.js +1 -0
- package/dist/{Detail-RMXFuSRQ.js → Detail-BZ-iE9vf.js} +1 -1
- package/dist/{Detail-B4b_FLDa.mjs → Detail-C1Blq61w.mjs} +90 -90
- package/dist/{Detail-BayNaAg9.js → Detail-C8wQiDcv.js} +1 -1
- package/dist/{Detail-CbLk1v37.mjs → Detail-CJVMJDP7.mjs} +17 -17
- package/dist/{Detail-CnK-qbhE.js → Detail-CPqug27l.js} +1 -1
- package/dist/Detail-CjuhjPby.js +1 -0
- package/dist/{Detail-U0mgLKt6.mjs → Detail-CtItxMX4.mjs} +62 -63
- package/dist/{Detail-CVgWHbMC.mjs → Detail-Dnpnmy4-.mjs} +158 -158
- package/dist/{Entries-D7MHylQE.mjs → Entries-BkOPae4R.mjs} +49 -49
- package/dist/Entries-CcEW98F5.js +1 -0
- package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-CDc8MIq2.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-Bc946oSc.mjs} +1 -1
- package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-StaNp-3y.js → NewReservationDialog.vue_vue_type_script_setup_true_lang-CqERfyYb.js} +1 -1
- package/dist/{Overview-CwCAeBnX.js → Overview-CA8wh_BI.js} +1 -1
- package/dist/{Overview-CgViRnNc.mjs → Overview-D4MFwRI_.mjs} +67 -68
- package/dist/{Overview-B2bFNGhH.js → Overview-Da0XexiT.js} +1 -1
- package/dist/Overview-DeQQ0FY3.js +1 -0
- package/dist/{Overview--XpvBbqz.mjs → Overview-DoOASlNz.mjs} +1 -3
- package/dist/{Overview-Cczt_dcE.mjs → Overview-gJSvftdE.mjs} +34 -34
- package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-B7ks5mbf.mjs → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cohhnd5x.mjs} +0 -1
- package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Vxubki_v.js → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-VWVIxIr6.js} +1 -1
- package/dist/{SeoHealth-ZpvB7CS2.mjs → SeoHealth-Bc5chnaa.mjs} +14 -14
- package/dist/{SeoHealth-DFZ0LLBH.js → SeoHealth-BkpJ1F2Y.js} +1 -1
- package/dist/TableView-BPWAx--G.mjs +5743 -0
- package/dist/TableView-D63QrVlK.js +4 -0
- package/dist/View-BL70u98U.js +1 -0
- package/dist/{View-DDXN0tKD.mjs → View-BO5N911y.mjs} +5 -5
- package/dist/{agenda-Cl3s_FIE.mjs → agenda-C5grvzSa.mjs} +166 -169
- package/dist/agenda-DXMwVWpN.js +1 -0
- package/dist/{availability-B-tRp8hB.mjs → availability-C1NqOFsQ.mjs} +81 -81
- package/dist/{availability-BiBbzEIM.js → availability-D_wnfLsH.js} +1 -1
- package/dist/cms-core-modules.css +1 -1
- package/dist/{exceptions-DQPSFSj7.mjs → exceptions-BIwMhYa4.mjs} +1 -1
- package/dist/{exceptions-BA3PsW4n.js → exceptions-Cn7zooEu.js} +1 -1
- package/dist/{index-CBC9dWZ9.js → index-C9pSS15N.js} +2 -2
- package/dist/{index-YOOlBEZB.mjs → index-MwjeLHPP.mjs} +3 -3
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +22 -22
- package/dist/orders-CG1QUCN8.js +1 -0
- package/dist/{orders-DZzdsHOW.mjs → orders-CeixEBcU.mjs} +57 -58
- package/dist/server-handlers.cjs.js +1 -1
- package/dist/server-handlers.mjs +142 -147
- package/package.json +2 -2
- package/dist/DateFormatter-ls6HfWpS.js +0 -1
- package/dist/Detail-BcboL7NF.js +0 -1
- package/dist/Entries-BPkZ7Jg5.js +0 -1
- package/dist/Overview-B-8TLLjh.js +0 -1
- package/dist/TableView-BUPPcHUW.mjs +0 -89505
- package/dist/TableView-CksiPsTL.js +0 -586
- package/dist/View-DfzaVOzS.js +0 -1
- package/dist/agenda-rlFma_wn.js +0 -1
- package/dist/floating-ui.dom-B9WYoHj2.js +0 -1
- package/dist/floating-ui.dom-fpIfhXTZ.mjs +0 -1291
- package/dist/index-DYpruS-A-Cw57iwdY.mjs +0 -4210
- package/dist/index-DYpruS-A-DwDXo9Tq.js +0 -88
- package/dist/index-YMaY4uuk-BgpTtr73.js +0 -1
- package/dist/index-YMaY4uuk-C_xV5K9Z.mjs +0 -1300
- package/dist/orders-tP4WdF5q.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneclick.dev/cms-core-modules",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.84",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@formkit/drag-and-drop": "^0.5.3",
|
|
30
30
|
"@internationalized/date": "^3.8.0",
|
|
31
|
-
"@oneclick.dev/cms-kit": "0.0.
|
|
31
|
+
"@oneclick.dev/cms-kit": "0.0.94",
|
|
32
32
|
"@tanstack/vue-table": "^8.21.3",
|
|
33
33
|
"@vee-validate/zod": "^4.15.0",
|
|
34
34
|
"@vue-flow/core": "^1.48.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function Y(e,t){return e-t*Math.floor(e/t)}const ne=1721426;function C(e,t,r,n){t=T(e,t);let a=t-1,o=-2;return r<=2?o=0:A(t)&&(o=-1),ne-1+365*a+Math.floor(a/4)-Math.floor(a/100)+Math.floor(a/400)+Math.floor((367*r-362)/12+o+n)}function A(e){return e%4===0&&(e%100!==0||e%400===0)}function T(e,t){return e==="BC"?1-t:t}function ae(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const xe={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class b{fromJulianDay(t){let r=t,n=r-ne,a=Math.floor(n/146097),o=Y(n,146097),c=Math.floor(o/36524),i=Y(o,36524),f=Math.floor(i/1461),d=Y(i,1461),g=Math.floor(d/365),w=a*400+c*100+f*4+g+(c!==4&&g!==4?1:0),[x,m]=ae(w),y=r-C(x,m,1,1),O=2;r<C(x,m,3,1)?O=0:A(m)&&(O=1);let Q=Math.floor(((y+O)*12+373)/367),we=r-C(x,m,Q,1)+1;return new M(x,m,Q,we)}toJulianDay(t){return C(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return xe[A(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return A(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year)}constructor(){this.identifier="gregory"}}const De={"001":1,AD:1,AE:6,AF:6,AI:1,AL:1,AM:1,AN:1,AR:1,AT:1,AU:1,AX:1,AZ:1,BA:1,BE:1,BG:1,BH:6,BM:1,BN:1,BY:1,CH:1,CL:1,CM:1,CN:1,CR:1,CY:1,CZ:1,DE:1,DJ:6,DK:1,DZ:6,EC:1,EE:1,EG:6,ES:1,FI:1,FJ:1,FO:1,FR:1,GB:1,GE:1,GF:1,GP:1,GR:1,HR:1,HU:1,IE:1,IQ:6,IR:6,IS:1,IT:1,JO:6,KG:1,KW:6,KZ:1,LB:1,LI:1,LK:1,LT:1,LU:1,LV:1,LY:6,MC:1,MD:1,ME:1,MK:1,MN:1,MQ:1,MV:5,MY:1,NL:1,NO:1,NZ:1,OM:6,PL:1,QA:6,RE:1,RO:1,RS:1,RU:1,SD:6,SE:1,SI:1,SK:1,SM:1,SY:6,TJ:1,TM:1,TR:1,UA:1,UY:1,UZ:1,VA:1,VN:1,XK:1};function j(e,t){return t=l(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function oe(e,t){return t=l(t,e.calendar),e=L(e),t=L(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function ve(e,t){return q(e.calendar,t.calendar)&&j(e,t)}function Ie(e,t){return q(e.calendar,t.calendar)&&oe(e,t)}function q(e,t){var r,n,a,o;return(o=(a=(r=e.isEqual)===null||r===void 0?void 0:r.call(e,t))!==null&&a!==void 0?a:(n=t.isEqual)===null||n===void 0?void 0:n.call(t,e))!==null&&o!==void 0?o:e.identifier===t.identifier}function Ee(e,t){return j(e,ce(t))}const Se={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function Ce(e,t,r){let n=e.calendar.toJulianDay(e),a=r?Se[r]:Ue(t),o=Math.ceil(n+1-a)%7;return o<0&&(o+=7),o}function Ae(e){return u(Date.now(),e)}function ce(e){return Ze(Ae(e))}function ie(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function Re(e,t){return X(e)-X(t)}function X(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let k=null,Ye=!1;function K(){return k==null&&(k=new Intl.DateTimeFormat().resolvedOptions().timeZone),k}function fe(){return Ye}function L(e){return e.subtract({days:e.day-1})}function Be(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}const ee=new Map,Z=new Map;function Te(e){if(Intl.Locale){let r=ee.get(e);return r||(r=new Intl.Locale(e).maximize().region,r&&ee.set(e,r)),r}let t=e.split("-")[1];return t==="u"?void 0:t}function Ue(e){let t=Z.get(e);if(!t){if(Intl.Locale){let n=new Intl.Locale(e);if("getWeekInfo"in n&&(t=n.getWeekInfo(),t))return Z.set(e,t),t.firstDay}let r=Te(e);if(e.includes("-fw-")){let n=e.split("-fw-")[1].split("-")[0];n==="mon"?t={firstDay:1}:n==="tue"?t={firstDay:2}:n==="wed"?t={firstDay:3}:n==="thu"?t={firstDay:4}:n==="fri"?t={firstDay:5}:n==="sat"?t={firstDay:6}:t={firstDay:0}}else e.includes("-ca-iso8601")?t={firstDay:1}:t={firstDay:r&&De[r]||0};Z.set(e,t)}return t.firstDay}function D(e){e=l(e,new b);let t=T(e.era,e.year);return le(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function le(e,t,r,n,a,o,c){let i=new Date;return i.setUTCHours(n,a,o,c),i.setUTCFullYear(e,t-1,r),i.getTime()}function N(e,t){if(t==="UTC")return 0;if(e>0&&t===K()&&!fe())return new Date(e).getTimezoneOffset()*-6e4;let{year:r,month:n,day:a,hour:o,minute:c,second:i}=se(e,t);return le(r,n,a,o,c,i,0)-Math.floor(e/1e3)*1e3}const te=new Map;function se(e,t){let r=te.get(t);r||(r=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),te.set(t,r));let n=r.formatToParts(new Date(e)),a={};for(let o of n)o.type!=="literal"&&(a[o.type]=o.value);return{year:a.era==="BC"||a.era==="B"?-a.year+1:+a.year,month:+a.month,day:+a.day,hour:a.hour==="24"?0:+a.hour,minute:+a.minute,second:+a.second}}const re=864e5;function Oe(e,t,r,n){return(r===n?[r]:[r,n]).filter(o=>ke(e,t,o))}function ke(e,t,r){let n=se(r,t);return e.year===n.year&&e.month===n.month&&e.day===n.day&&e.hour===n.hour&&e.minute===n.minute&&e.second===n.second}function h(e,t,r="compatible"){let n=v(e);if(t==="UTC")return D(n);if(t===K()&&r==="compatible"&&!fe()){n=l(n,new b);let f=new Date,d=T(n.era,n.year);return f.setFullYear(d,n.month-1,n.day),f.setHours(n.hour,n.minute,n.second,n.millisecond),f.getTime()}let a=D(n),o=N(a-re,t),c=N(a+re,t),i=Oe(n,t,a-o,a-c);if(i.length===1)return i[0];if(i.length>1)switch(r){case"compatible":case"earlier":return i[0];case"later":return i[i.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(r){case"earlier":return Math.min(a-o,a-c);case"compatible":case"later":return Math.max(a-o,a-c);case"reject":throw new RangeError("No such absolute time found")}}function de(e,t,r="compatible"){return new Date(h(e,t,r))}function u(e,t){let r=N(e,t),n=new Date(e+r),a=n.getUTCFullYear(),o=n.getUTCMonth()+1,c=n.getUTCDate(),i=n.getUTCHours(),f=n.getUTCMinutes(),d=n.getUTCSeconds(),g=n.getUTCMilliseconds();return new E(a<1?"BC":"AD",a<1?-a+1:a,o,c,t,r,i,f,d,g)}function Ze(e){return new M(e.calendar,e.era,e.year,e.month,e.day)}function v(e,t){let r=0,n=0,a=0,o=0;if("timeZone"in e)({hour:r,minute:n,second:a,millisecond:o}=e);else if("hour"in e&&!t)return e;return t&&({hour:r,minute:n,second:a,millisecond:o}=t),new I(e.calendar,e.era,e.year,e.month,e.day,r,n,a,o)}function l(e,t){if(q(e.calendar,t))return e;let r=t.fromJulianDay(e.calendar.toJulianDay(e)),n=e.copy();return n.calendar=t,n.era=r.era,n.year=r.year,n.month=r.month,n.day=r.day,p(n),n}function Pe(e,t,r){if(e instanceof E)return e.timeZone===t?e:Fe(e,t);let n=h(e,t,r);return u(n,t)}function He(e){let t=D(e)-e.offset;return new Date(t)}function Fe(e,t){let r=D(e)-e.offset;return l(u(r,t),e.calendar)}const S=36e5;function U(e,t){let r=e.copy(),n="hour"in r?We(r,t):0;J(r,t.years||0),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e),r.month+=t.months||0,W(r),he(r),r.day+=(t.weeks||0)*7,r.day+=t.days||0,r.day+=n,Le(r),r.calendar.balanceDate&&r.calendar.balanceDate(r),r.year<1&&(r.year=1,r.month=1,r.day=1);let a=r.calendar.getYearsInEra(r);if(r.year>a){var o,c;let f=(o=(c=r.calendar).isInverseEra)===null||o===void 0?void 0:o.call(c,r);r.year=a,r.month=f?1:r.calendar.getMonthsInYear(r),r.day=f?1:r.calendar.getDaysInMonth(r)}r.month<1&&(r.month=1,r.day=1);let i=r.calendar.getMonthsInYear(r);return r.month>i&&(r.month=i,r.day=r.calendar.getDaysInMonth(r)),r.day=Math.max(1,Math.min(r.calendar.getDaysInMonth(r),r.day)),r}function J(e,t){var r,n;!((r=(n=e.calendar).isInverseEra)===null||r===void 0)&&r.call(n,e)&&(t=-t),e.year+=t}function W(e){for(;e.month<1;)J(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,J(e,1)}function Le(e){for(;e.day<1;)e.month--,W(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,W(e)}function he(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function p(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),he(e)}function ue(e){let t={};for(let r in e)typeof e[r]=="number"&&(t[r]=-e[r]);return t}function $e(e,t){return U(e,ue(t))}function V(e,t){let r=e.copy();return t.era!=null&&(r.era=t.era),t.year!=null&&(r.year=t.year),t.month!=null&&(r.month=t.month),t.day!=null&&(r.day=t.day),p(r),r}function B(e,t){let r=e.copy();return t.hour!=null&&(r.hour=t.hour),t.minute!=null&&(r.minute=t.minute),t.second!=null&&(r.second=t.second),t.millisecond!=null&&(r.millisecond=t.millisecond),Je(r),r}function Ne(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=R(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=R(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=R(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=R(e.hour,24),t}function Je(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function R(e,t){let r=e%t;return r<0&&(r+=t),r}function We(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Ne(e)}function G(e,t,r,n){let a=e.copy();switch(t){case"era":{let i=e.calendar.getEras(),f=i.indexOf(e.era);if(f<0)throw new Error("Invalid era: "+e.era);f=$(f,r,0,i.length-1,n?.round),a.era=i[f],p(a);break}case"year":var o,c;!((o=(c=a.calendar).isInverseEra)===null||o===void 0)&&o.call(c,a)&&(r=-r),a.year=$(e.year,r,-1/0,9999,n?.round),a.year===-1/0&&(a.year=1),a.calendar.balanceYearMonth&&a.calendar.balanceYearMonth(a,e);break;case"month":a.month=$(e.month,r,1,e.calendar.getMonthsInYear(e),n?.round);break;case"day":a.day=$(e.day,r,1,e.calendar.getDaysInMonth(e),n?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(a),p(a),a}function ye(e,t,r,n){let a=e.copy();switch(t){case"hour":{let o=e.hour,c=0,i=23;if(n?.hourCycle===12){let f=o>=12;c=f?12:0,i=f?23:11}a.hour=$(o,r,c,i,n?.round);break}case"minute":a.minute=$(e.minute,r,0,59,n?.round);break;case"second":a.second=$(e.second,r,0,59,n?.round);break;case"millisecond":a.millisecond=$(e.millisecond,r,0,999,n?.round);break;default:throw new Error("Unsupported field "+t)}return a}function $(e,t,r,n,a=!1){if(a){e+=Math.sign(t),e<r&&(e=n);let o=Math.abs(t);t>0?e=Math.ceil(e/o)*o:e=Math.floor(e/o)*o,e>n&&(e=r)}else e+=t,e<r?e=n-(r-e-1):e>n&&(e=r+(e-n-1));return e}function me(e,t){let r;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let a=U(v(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});r=h(a,e.timeZone)}else r=D(e)-e.offset;r+=t.milliseconds||0,r+=(t.seconds||0)*1e3,r+=(t.minutes||0)*6e4,r+=(t.hours||0)*36e5;let n=u(r,e.timeZone);return l(n,e.calendar)}function je(e,t){return me(e,ue(t))}function qe(e,t,r,n){switch(t){case"hour":{let a=0,o=23;if(n?.hourCycle===12){let y=e.hour>=12;a=y?12:0,o=y?23:11}let c=v(e),i=l(B(c,{hour:a}),new b),f=[h(i,e.timeZone,"earlier"),h(i,e.timeZone,"later")].filter(y=>u(y,e.timeZone).day===i.day)[0],d=l(B(c,{hour:o}),new b),g=[h(d,e.timeZone,"earlier"),h(d,e.timeZone,"later")].filter(y=>u(y,e.timeZone).day===d.day).pop(),w=D(e)-e.offset,x=Math.floor(w/S),m=w%S;return w=$(x,r,Math.floor(f/S),Math.floor(g/S),n?.round)*S+m,l(u(w,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return ye(e,t,r,n);case"era":case"year":case"month":case"day":{let a=G(v(e),t,r,n),o=h(a,e.timeZone);return l(u(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Ke(e,t,r){let n=v(e),a=B(V(n,t),t);if(a.compare(n)===0)return e;let o=h(a,e.timeZone,r);return l(u(o,e.timeZone),e.calendar)}const Ve=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Ge=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/,be=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function _e(e){let t=e.match(Ve);if(!t)throw be.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let r=new M(s(t[1],0,9999),s(t[2],1,12),1);return r.day=s(t[3],1,r.calendar.getDaysInMonth(r)),r}function ze(e){let t=e.match(Ge);if(!t)throw be.test(e)?new Error(`Invalid ISO 8601 date time string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date time string: "+e);let r=s(t[1],-9999,9999),n=r<1?"BC":"AD",a=new I(n,r<1?-r+1:r,s(t[2],1,12),1,t[4]?s(t[4],0,23):0,t[5]?s(t[5],0,59):0,t[6]?s(t[6],0,59):0,t[7]?s(t[7],0,1/0)*1e3:0);return a.day=s(t[3],0,a.calendar.getDaysInMonth(a)),a}function s(e,t,r){let n=Number(e);if(n<t||n>r)throw new RangeError(`Value out of range: ${t} <= ${n} <= ${r}`);return n}function Qe(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function pe(e){let t=l(e,new b),r;return t.era==="BC"?r=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):r=String(t.year).padStart(4,"0"),`${r}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Me(e){return`${pe(e)}T${Qe(e)}`}function Xe(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let r=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),a=Math.floor(e%36e5%6e4/1e3),o=`${t}${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`;return a!==0&&(o+=`:${String(a).padStart(2,"0")}`),o}function et(e){return`${Me(e)}${Xe(e.offset)}[${e.timeZone}]`}function tt(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _(e,t,r){tt(e,t),t.set(e,r)}function z(e){let t=typeof e[0]=="object"?e.shift():new b,r;if(typeof e[0]=="string")r=e.shift();else{let c=t.getEras();r=c[c.length-1]}let n=e.shift(),a=e.shift(),o=e.shift();return[t,r,n,a,o]}var rt=new WeakMap;class M{copy(){return this.era?new M(this.calendar,this.era,this.year,this.month,this.day):new M(this.calendar,this.year,this.month,this.day)}add(t){return U(this,t)}subtract(t){return $e(this,t)}set(t){return V(this,t)}cycle(t,r,n){return G(this,t,r,n)}toDate(t){return de(this,t)}toString(){return pe(this)}compare(t){return ie(this,t)}constructor(...t){_(this,rt,{writable:!0,value:void 0});let[r,n,a,o,c]=z(t);this.calendar=r,this.era=n,this.year=a,this.month=o,this.day=c,p(this)}}var nt=new WeakMap;class I{copy(){return this.era?new I(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new I(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return U(this,t)}subtract(t){return $e(this,t)}set(t){return V(B(this,t),t)}cycle(t,r,n){switch(t){case"era":case"year":case"month":case"day":return G(this,t,r,n);default:return ye(this,t,r,n)}}toDate(t,r){return de(this,t,r)}toString(){return Me(this)}compare(t){let r=ie(this,t);return r===0?Re(this,v(t)):r}constructor(...t){_(this,nt,{writable:!0,value:void 0});let[r,n,a,o,c]=z(t);this.calendar=r,this.era=n,this.year=a,this.month=o,this.day=c,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,p(this)}}var at=new WeakMap;class E{copy(){return this.era?new E(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new E(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return me(this,t)}subtract(t){return je(this,t)}set(t,r){return Ke(this,t,r)}cycle(t,r,n){return qe(this,t,r,n)}toDate(){return He(this)}toString(){return et(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-Pe(t,this.timeZone).toDate().getTime()}constructor(...t){_(this,at,{writable:!0,value:void 0});let[r,n,a,o,c]=z(t),i=t.shift(),f=t.shift();this.calendar=r,this.era=n,this.year=a,this.month=o,this.day=c,this.timeZone=i,this.offset=f,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,p(this)}}let P=new Map;class ot{format(t){return this.formatter.format(t)}formatToParts(t){return this.formatter.formatToParts(t)}formatRange(t,r){if(typeof this.formatter.formatRange=="function")return this.formatter.formatRange(t,r);if(r<t)throw new RangeError("End date must be >= start date");return`${this.formatter.format(t)} – ${this.formatter.format(r)}`}formatRangeToParts(t,r){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(t,r);if(r<t)throw new RangeError("End date must be >= start date");let n=this.formatter.formatToParts(t),a=this.formatter.formatToParts(r);return[...n.map(o=>({...o,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...a.map(o=>({...o,source:"endRange"}))]}resolvedOptions(){let t=this.formatter.resolvedOptions();return ft()&&(this.resolvedHourCycle||(this.resolvedHourCycle=lt(t.locale,this.options)),t.hourCycle=this.resolvedHourCycle,t.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),t.calendar==="ethiopic-amete-alem"&&(t.calendar="ethioaa"),t}constructor(t,r={}){this.formatter=ge(t,r),this.options=r}}const ct={true:{ja:"h11"},false:{}};function ge(e,t={}){if(typeof t.hour12=="boolean"&&it()){t={...t};let a=ct[String(t.hour12)][e.split("-")[0]],o=t.hour12?"h12":"h23";t.hourCycle=a??o,delete t.hour12}let r=e+(t?Object.entries(t).sort((a,o)=>a[0]<o[0]?-1:1).join():"");if(P.has(r))return P.get(r);let n=new Intl.DateTimeFormat(e,t);return P.set(r,n),n}let H=null;function it(){return H==null&&(H=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),H}let F=null;function ft(){return F==null&&(F=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),F}function lt(e,t){if(!t.timeStyle&&!t.hour)return;e=e.replace(/(-u-)?-nu-[a-zA-Z0-9]+/,""),e+=(e.includes("-u-")?"":"-u")+"-nu-latn";let r=ge(e,{...t,timeZone:void 0}),n=parseInt(r.formatToParts(new Date(2020,2,3,0)).find(o=>o.type==="hour").value,10),a=parseInt(r.formatToParts(new Date(2020,2,3,23)).find(o=>o.type==="hour").value,10);if(n===0&&a===23)return"h23";if(n===24&&a===23)return"h24";if(n===0&&a===11)return"h11";if(n===12&&a===11)return"h12";throw new Error("Unexpected hour cycle result")}exports.$11d87f3f76e88657$export$b4a036af3fc0b032=l;exports.$14e0f24ef4ac5c92$export$2061056d06d7cdf7=Ce;exports.$14e0f24ef4ac5c92$export$5a8da0c44a3afdf2=Ie;exports.$14e0f24ef4ac5c92$export$629b0a497aa65267=Ee;exports.$14e0f24ef4ac5c92$export$91b62ebf2ba703ee=ve;exports.$14e0f24ef4ac5c92$export$a18c89cbd24170ff=oe;exports.$14e0f24ef4ac5c92$export$a2258d9c4118825c=Be;exports.$14e0f24ef4ac5c92$export$a5a3b454ada2268e=L;exports.$14e0f24ef4ac5c92$export$aa8b41735afcabd2=K;exports.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3=ce;exports.$14e0f24ef4ac5c92$export$ea39ec197993aef0=j;exports.$2b4dce13dd5a17fa$export$842a2cf37af977e1=Y;exports.$35ea8db9cb2ccb90$export$99faa760c7908e4f=M;exports.$35ea8db9cb2ccb90$export$ca871e8dbb80966f=I;exports.$35ea8db9cb2ccb90$export$d3b7288e7994edea=E;exports.$3b62074eb05584b2$export$4475b7e617eb123c=ae;exports.$3b62074eb05584b2$export$553d7fa8e3805fc0=A;exports.$3b62074eb05584b2$export$80ee6245ec4f29ec=b;exports.$3b62074eb05584b2$export$c36e0ecb2d4fa69d=T;exports.$3b62074eb05584b2$export$f297eb839006d339=C;exports.$fae977aafc393c5c$export$588937bcd60ade55=ze;exports.$fae977aafc393c5c$export$6b862160d295c8e=_e;exports.$fb18d541ea1ad717$export$ad991b66133851cf=ot;
|
package/dist/Detail-BcboL7NF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),g=require("./vee-validate-zod-ByykgYKJ.js"),$=require("lucide-vue-next"),Oe=require("@formkit/drag-and-drop"),J=require("@oneclick.dev/cms-kit"),it=require("./google-D4N3gb01.js"),X=require("./index-ijdf0d9-.js"),st={class:"flex flex-col gap-4"},dt={class:"flex flex-col"},ct={key:0,class:"text-red-500 text-sm mt-1"},ut={class:"flex flex-col gap-4"},pt={class:"flex flex-col"},ft={key:0,class:"text-red-500 text-sm mt-1"},mt={class:"flex flex-col gap-4"},gt={class:"flex flex-col"},vt={key:0,class:"text-red-500 text-sm mt-1"},xt=e.defineComponent({__name:"Main",setup(t){const o=e.inject("sources"),n=e.inject("defaultSource"),{errors:r}=g.useFormContext(),{value:l}=g.useField("title"),{value:i}=g.useField("description"),{value:s}=g.useField("media");return(d,a)=>{const f=e.resolveComponent("Label"),v=e.resolveComponent("Input"),c=e.resolveComponent("Textarea"),V=e.resolveComponent("MediaPicker"),_=e.resolveComponent("CardContent"),b=e.resolveComponent("Card");return e.openBlock(),e.createBlock(b,null,{default:e.withCtx(()=>[e.createVNode(_,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[e.createElementVNode("div",st,[e.createElementVNode("div",dt,[e.createVNode(f,{for:"title",class:"text-sm mb-2"},{default:e.withCtx(()=>[...a[3]||(a[3]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(v,{type:"text",id:"title",placeholder:"T-shirt with red heart",modelValue:e.unref(l),"onUpdate:modelValue":a[0]||(a[0]=k=>e.isRef(l)?l.value=k:null)},null,8,["modelValue"]),e.unref(r).title?(e.openBlock(),e.createElementBlock("p",ct,e.toDisplayString(e.unref(r).title),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ut,[e.createElementVNode("div",pt,[e.createVNode(f,{for:"description",class:"text-sm mb-2"},{default:e.withCtx(()=>[...a[4]||(a[4]=[e.createTextVNode("Description",-1)])]),_:1}),e.createVNode(c,{id:"description",placeholder:"Lovely T-shirt featuring a red heart",modelValue:e.unref(i),"onUpdate:modelValue":a[1]||(a[1]=k=>e.isRef(i)?i.value=k:null)},null,8,["modelValue"]),e.unref(r).description?(e.openBlock(),e.createElementBlock("p",ft,e.toDisplayString(e.unref(r).description),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",mt,[e.createElementVNode("div",gt,[e.createVNode(f,{for:"media",class:"text-sm mb-2"},{default:e.withCtx(()=>[...a[5]||(a[5]=[e.createTextVNode("Media",-1)])]),_:1}),e.createVNode(V,{id:"media",modelValue:e.unref(s),"onUpdate:modelValue":a[2]||(a[2]=k=>e.isRef(s)?s.value=k:null),sources:e.unref(o),defaultSource:e.unref(n)},null,8,["modelValue","sources","defaultSource"]),e.unref(r).media?(e.openBlock(),e.createElementBlock("p",vt,e.toDisplayString(e.unref(r).media),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})}}}),Vt={class:"grid grid-cols-2 gap-4 mb-4"},ht={class:"relative"},Nt={key:0,class:"text-red-500 text-sm mt-1"},Ct={class:"relative"},yt={class:"absolute right-2 top-1/2 -translate-y-1/2"},bt={key:0,class:"text-red-500 text-sm mt-1"},kt={class:"flex items-center gap-2 mb-4"},_t={class:"flex items-center border-t mt-4 pt-4"},wt={class:"relative"},Dt={key:0,class:"text-red-500 text-sm mt-1"},St=e.defineComponent({__name:"Price",setup(t){const{errors:o}=g.useFormContext(),{value:n}=g.useField("price"),{value:r}=g.useField("compareAtPrice"),{value:l}=g.useField("isTaxable"),{value:i}=g.useField("costPerItem");return e.computed(()=>Number(n.value)>0),(s,d)=>{const a=e.resolveComponent("Label"),f=e.resolveComponent("Input"),v=e.resolveComponent("TooltipTrigger"),c=e.resolveComponent("TooltipContent"),V=e.resolveComponent("Tooltip"),_=e.resolveComponent("Checkbox"),b=e.resolveComponent("CardContent"),k=e.resolveComponent("Card");return e.openBlock(),e.createBlock(k,null,{default:e.withCtx(()=>[e.createVNode(b,null,{default:e.withCtx(()=>[d[12]||(d[12]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Pricing",-1)),e.createElementVNode("div",Vt,[e.createElementVNode("div",null,[e.createVNode(a,{for:"price",class:"text-sm mb-2"},{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("Price",-1)])]),_:1}),e.createElementVNode("div",ht,[e.createVNode(f,{type:"number",id:"price",class:"pl-10 no-spinner",modelValue:e.unref(n),"onUpdate:modelValue":d[0]||(d[0]=S=>e.isRef(n)?n.value=S:null)},null,8,["modelValue"]),d[5]||(d[5]=e.createElementVNode("span",{class:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"},"€",-1))]),e.unref(o).price?(e.openBlock(),e.createElementBlock("p",Nt,e.toDisplayString(e.unref(o).price),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createVNode(a,{for:"compare-at-price",class:"text-sm mb-2"},{default:e.withCtx(()=>[...d[6]||(d[6]=[e.createTextVNode("Compare-at price",-1)])]),_:1}),e.createElementVNode("div",Ct,[e.createVNode(f,{type:"number",id:"compare-at-price",class:"pl-10 no-spinner",modelValue:e.unref(r),"onUpdate:modelValue":d[1]||(d[1]=S=>e.isRef(r)?r.value=S:null)},null,8,["modelValue"]),d[8]||(d[8]=e.createElementVNode("span",{class:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"},"€",-1)),e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(v,{"as-child":""},{default:e.withCtx(()=>[e.createElementVNode("button",yt,[e.createVNode(e.unref($.Info),{class:"size-4 text-muted-foreground"})])]),_:1}),e.createVNode(c,null,{default:e.withCtx(()=>[...d[7]||(d[7]=[e.createElementVNode("p",null,[e.createTextVNode(" To display a markdown, enter a value higher than your price."),e.createElementVNode("br"),e.createTextVNode(" Often shown with a strikethrough (e.g. "),e.createElementVNode("span",{class:"font-semibold line-through"},"€25,00"),e.createTextVNode("). ")],-1)])]),_:1})]),_:1})]),e.unref(o).compareAtPrice?(e.openBlock(),e.createElementBlock("p",bt,e.toDisplayString(e.unref(o).compareAtPrice),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",kt,[e.createVNode(_,{id:"charge-tax",modelValue:e.unref(l),"onUpdate:modelValue":d[2]||(d[2]=S=>e.isRef(l)?l.value=S:null)},null,8,["modelValue"]),e.createVNode(a,{for:"charge-tax",class:"text-sm"},{default:e.withCtx(()=>[...d[9]||(d[9]=[e.createTextVNode("Charge tax on this product",-1)])]),_:1})]),e.createElementVNode("div",_t,[e.createElementVNode("div",null,[e.createVNode(a,{for:"cost-per-item",class:"text-sm mb-2"},{default:e.withCtx(()=>[...d[10]||(d[10]=[e.createTextVNode("Cost per item",-1)])]),_:1}),e.createElementVNode("div",wt,[e.createVNode(f,{type:"number",id:"cost-per-item",class:"pl-10 no-spinner",modelValue:e.unref(i),"onUpdate:modelValue":d[3]||(d[3]=S=>e.isRef(i)?i.value=S:null)},null,8,["modelValue"]),d[11]||(d[11]=e.createElementVNode("span",{class:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"},"€",-1))]),e.unref(o).costPerItem?(e.openBlock(),e.createElementBlock("p",Dt,e.toDisplayString(e.unref(o).costPerItem),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})}}}),Et={class:"grid grid-cols-2 gap-4 mb-4"},Tt={class:"flex items-center gap-2 mb-4"},Bt={key:0,class:"grid grid-cols-2 gap-4 mb-4"},Pt={class:"flex items-center gap-2"},It=e.defineComponent({__name:"Inventory",setup(t){const{errors:o}=g.useFormContext(),{value:n}=g.useField("sku"),{value:r}=g.useField("barcode"),{value:l}=g.useField("trackInventory"),{value:i}=g.useField("allowBackorder"),{value:s}=g.useField("stock"),{value:d}=g.useField("options"),{value:a}=g.useField("variants"),f=e.computed(()=>a.value.reduce((v,c)=>c.stock<0?v:v+c.stock,0));return(v,c)=>{const V=e.resolveComponent("Label"),_=e.resolveComponent("Input"),b=e.resolveComponent("Checkbox"),k=e.resolveComponent("TooltipTrigger"),S=e.resolveComponent("TooltipContent"),E=e.resolveComponent("Tooltip"),m=e.resolveComponent("CardContent"),h=e.resolveComponent("Card");return e.openBlock(),e.createBlock(h,null,{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[c[12]||(c[12]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Inventory",-1)),e.createElementVNode("div",Et,[e.createElementVNode("div",null,[e.createVNode(V,{for:"sku",class:"text-sm mb-2"},{default:e.withCtx(()=>[...c[6]||(c[6]=[e.createTextVNode("SKU (Stock Keeping Unit)",-1)])]),_:1}),e.createVNode(_,{id:"sku",modelValue:e.unref(n),"onUpdate:modelValue":c[0]||(c[0]=B=>e.isRef(n)?n.value=B:null)},null,8,["modelValue"])]),e.createElementVNode("div",null,[e.createVNode(V,{for:"barcode",class:"text-sm mb-2"},{default:e.withCtx(()=>[...c[7]||(c[7]=[e.createTextVNode("Barcode (ISBN, UPC, GTIN, etc.)",-1)])]),_:1}),e.createVNode(_,{id:"barcode",modelValue:e.unref(r),"onUpdate:modelValue":c[1]||(c[1]=B=>e.isRef(r)?r.value=B:null)},null,8,["modelValue"])])]),e.createElementVNode("div",Tt,[e.createVNode(b,{id:"track-quantity",modelValue:e.unref(l),"onUpdate:modelValue":c[2]||(c[2]=B=>e.isRef(l)?l.value=B:null)},null,8,["modelValue"]),e.createVNode(V,{for:"track-quantity",class:"text-sm"},{default:e.withCtx(()=>[...c[8]||(c[8]=[e.createTextVNode("Track quantity",-1)])]),_:1})]),e.unref(l)?(e.openBlock(),e.createElementBlock("div",Bt,[e.createElementVNode("div",null,[e.createVNode(V,{for:"stock",class:"text-sm mb-2"},{default:e.withCtx(()=>[...c[9]||(c[9]=[e.createTextVNode("Stock",-1)])]),_:1}),!e.unref(d)||e.unref(d)?.length===0?(e.openBlock(),e.createBlock(_,{key:0,id:"stock",type:"number",modelValue:e.unref(s),"onUpdate:modelValue":c[3]||(c[3]=B=>e.isRef(s)?s.value=B:null),class:"no-spinner"},null,8,["modelValue"])):(e.openBlock(),e.createBlock(E,{key:1},{default:e.withCtx(()=>[e.createVNode(k,{class:"cursor-not-allowed"},{default:e.withCtx(()=>[e.createVNode(_,{modelValue:f.value,"onUpdate:modelValue":c[4]||(c[4]=B=>f.value=B),disabled:"",class:"no-spinner"},null,8,["modelValue"])]),_:1}),e.createVNode(S,null,{default:e.withCtx(()=>[...c[10]||(c[10]=[e.createElementVNode("p",null,"Total stock of all variants",-1)])]),_:1})]),_:1}))])])):e.createCommentVNode("",!0),e.createElementVNode("div",Pt,[e.createVNode(b,{id:"continue-selling",modelValue:e.unref(i),"onUpdate:modelValue":c[5]||(c[5]=B=>e.isRef(i)?i.value=B:null)},null,8,["modelValue"]),e.createVNode(V,{for:"continue-selling",class:"text-sm"},{default:e.withCtx(()=>[...c[11]||(c[11]=[e.createTextVNode("Continue selling when out of stock",-1)])]),_:1})])]),_:1})]),_:1})}}}),$t={class:"flex items-center gap-2 mb-4"},Ft={key:0,class:"grid grid-cols-2 gap-4 mb-4"},At=e.defineComponent({__name:"Shipping",setup(t){const{errors:o}=g.useFormContext(),{value:n}=g.useField("isPhysicalProduct"),{value:r}=g.useField("weight"),{value:l}=g.useField("weightUnit");return(i,s)=>{const d=e.resolveComponent("Checkbox"),a=e.resolveComponent("Label"),f=e.resolveComponent("Input"),v=e.resolveComponent("SelectValue"),c=e.resolveComponent("SelectTrigger"),V=e.resolveComponent("SelectItem"),_=e.resolveComponent("SelectGroup"),b=e.resolveComponent("SelectContent"),k=e.resolveComponent("Select"),S=e.resolveComponent("CardContent"),E=e.resolveComponent("Card");return e.openBlock(),e.createBlock(E,null,{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[s[10]||(s[10]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Shipping",-1)),e.createElementVNode("div",$t,[e.createVNode(d,{id:"is-physical-product",modelValue:e.unref(n),"onUpdate:modelValue":s[0]||(s[0]=m=>e.isRef(n)?n.value=m:null)},null,8,["modelValue"]),e.createVNode(a,{for:"is-physical-product",class:"text-sm"},{default:e.withCtx(()=>[...s[3]||(s[3]=[e.createTextVNode("This is a physical product",-1)])]),_:1})]),e.unref(n)?(e.openBlock(),e.createElementBlock("div",Ft,[e.createElementVNode("div",null,[e.createVNode(a,{for:"weight",class:"text-sm mb-2"},{default:e.withCtx(()=>[...s[4]||(s[4]=[e.createTextVNode("Weight",-1)])]),_:1}),e.createVNode(f,{id:"weight",type:"number",modelValue:e.unref(r),"onUpdate:modelValue":s[1]||(s[1]=m=>e.isRef(r)?r.value=m:null),class:"no-spinner"},null,8,["modelValue"])]),e.createElementVNode("div",null,[e.createVNode(a,{for:"weight-unit",class:"text-sm mb-2"},{default:e.withCtx(()=>[...s[5]||(s[5]=[e.createTextVNode("Weight unit",-1)])]),_:1}),e.createVNode(k,{modelValue:e.unref(l),"onUpdate:modelValue":s[2]||(s[2]=m=>e.isRef(l)?l.value=m:null)},{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(v,{placeholder:"Select unit"})]),_:1}),e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(_,null,{default:e.withCtx(()=>[e.createVNode(V,{value:"lb"},{default:e.withCtx(()=>[...s[6]||(s[6]=[e.createTextVNode(" lb ",-1)])]),_:1}),e.createVNode(V,{value:"oz"},{default:e.withCtx(()=>[...s[7]||(s[7]=[e.createTextVNode(" oz ",-1)])]),_:1}),e.createVNode(V,{value:"kg"},{default:e.withCtx(()=>[...s[8]||(s[8]=[e.createTextVNode(" kg ",-1)])]),_:1}),e.createVNode(V,{value:"g"},{default:e.withCtx(()=>[...s[9]||(s[9]=[e.createTextVNode(" g ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])])])):e.createCommentVNode("",!0)]),_:1})]),_:1})}}});function z(t){t.preventDefault()}function Z(t){t.stopPropagation()}function Re(){const t=new Map;return[function(r,l){t.get(r)&&t.get(r).forEach(i=>{i(l)})},function(r,l){const i=t.get(r)??[];i.push(l),t.set(r,i)}]}var[Le,je]=Re();function Mt(t,o){return t.source===o.source&&t.flags.split("").sort().join("")===o.flags.split("").sort().join("")}function se(t,o,n=!0,r=["__key"]){if(t===o)return!0;if(typeof o=="object"&&typeof t=="object"&&t!==null&&o!==null){if(t instanceof Map||t instanceof Set)return!1;if(t instanceof Date&&o instanceof Date)return t.getTime()===o.getTime();if(t instanceof RegExp&&o instanceof RegExp)return Mt(t,o);if(t===null||o===null)return!1;const l=t,i=o;if(Object.keys(l).length!==Object.keys(i).length)return!1;for(const s of r)if((s in l||s in i)&&l[s]!==i[s])return!1;for(const s in l)if(!(s in i)||l[s]!==i[s]&&!n||n&&!se(l[s],i[s],n,r))return!1;return!0}return!1}function Ue(t){return t.split(" ").filter(o=>o)}function le(t){return{x:t.clientX,y:t.clientY}}Array();var Te=typeof window<"u",M=new WeakMap,q=new WeakMap;function He(){if(!Te)return!1;if("userAgentData"in navigator)return navigator.userAgentData.mobile===!0;const t=navigator.userAgent,o=/android|iphone|ipod/i.test(t),n=/iPad/.test(t)||t.includes("Macintosh")&&navigator.maxTouchPoints>1;return o||n}var zt={affectedNodes:[],coordinates:{x:0,y:0},currentTargetValue:void 0,on:je,emit:Le,originalZIndex:void 0,pointerSelection:!1,preventEnter:!1,rootUserSelect:void 0,nodePointerdown:void 0,longPress:!1,scrolling:!1,longPressTimeout:void 0,remapJustFinished:!1,selectedNodes:[],selectedParent:void 0,preventSynthDrag:!1,pointerDown:void 0,lastScrollContainerX:null,lastScrollContainerY:null,rootScrollWidth:void 0,rootScrollHeight:void 0,dragItemRect:void 0,windowScrollX:void 0,windowScrollY:void 0,lastScrollDirectionX:void 0,lastScrollDirectionY:void 0,scrollDebounceTimeout:void 0,frameIdX:void 0,frameIdY:void 0},p=zt,W=!1,$e,De;function Ot(){p.scrollDebounceTimeout&&clearTimeout(p.scrollDebounceTimeout),p.longPressTimeout&&clearTimeout(p.longPressTimeout),p.frameIdX!==void 0&&cancelAnimationFrame(p.frameIdX),p.frameIdY!==void 0&&cancelAnimationFrame(p.frameIdY),p={...{affectedNodes:[],coordinates:{x:0,y:0},on:je,emit:Le,currentTargetValue:void 0,originalZIndex:void 0,pointerId:void 0,preventEnter:!1,remapJustFinished:!1,selectedNodes:[],nodePointerdown:void 0,rootUserSelect:void 0,preventSynthDrag:!1,scrolling:!1,selectedParent:void 0,pointerSelection:!1,synthScrollDirection:void 0,draggedNodeDisplay:void 0,synthDragScrolling:!1,longPress:!1,pointerDown:void 0,longPressTimeout:void 0,lastScrollContainerX:null,lastScrollContainerY:null,rootScrollWidth:void 0,rootScrollHeight:void 0,dragItemRect:void 0,windowScrollX:void 0,windowScrollY:void 0,lastScrollDirectionX:void 0,lastScrollDirectionY:void 0,scrollDebounceTimeout:void 0,frameIdX:void 0,frameIdY:void 0}}}function Xe(t){return Object.assign(p,t),t.initialParent.data.emit("dragStarted",p),W=!1,p.emit("dragStarted",p),p}function Rt(){p.activeState&&ee(p.activeState.parent,void 0,p),p.selectedState&&Q(p.selectedState.nodes,p.selectedState.parent,p),p.selectedState=p.activeState=void 0}function Lt(){if(p.pointerDown&&(p.pointerDown.node.el.draggable=!0),p.pointerDown=void 0,!j(p))return;const t=p.currentParent.data.config;j(p)&&t.handleEnd(p)}function jt(t){t.key==="Escape"&&(p.selectedState&&Q(p.selectedState.nodes,p.selectedState.parent,p),p.activeState&&ee(p.activeState.parent,void 0,p),p.selectedState=p.activeState=void 0)}function Ut(t){if(!O(p))return;W=!0;const o=p.initialParent.data.config.handleEnd;o(p)}function Ht(t){if(!O(p))return;z(t);const{x:o,y:n}=le(t);O(p)&&ge({x:o,y:n},t,p)}function Xt(t){if(!p.pointerDown||!p.pointerDown.validated)return;const o=p.pointerDown.parent.data.config;if(!(t.pointerType==="mouse"&&!He()))if(j(p))j(p)&&Fe(t,p);else{if(z(t),o.longPress&&!p.longPress){clearTimeout(p.longPressTimeout),p.longPress=!1;return}const n=o.draggedNodes(p.pointerDown);o.dragstartClasses(p.pointerDown.node,n,o,!0);const r=p.pointerDown.node.el.getBoundingClientRect(),l=yo(p.pointerDown.node,p.pointerDown.parent,t,p,n,r);Fe(t,l,!0)}}function Yt({parent:t,getValues:o,setValues:n,config:r={}}){if(!Te)return;$e||($e=pe(document,{dragover:Ht,pointerdown:Rt,pointerup:Lt,keydown:jt,drop:Ut,pointermove:Xt,pointercancel:L(r.handlePointercancel),touchmove:a=>{O(p)&&a.cancelable&&z(a)},contextmenu:a=>{j(p)&&z(a)}})),Wt(t);const[l,i]=Re(),s={getValues:o,setValues:n,config:{dragDropEffect:r.dragDropEffect??"move",dragEffectAllowed:r.dragEffectAllowed??"move",draggedNodes:ao,dragstartClasses:uo,handleNodeKeydown:fo,handleDragstart:so,handleNodeDragover:ko,handleParentDragover:_o,handleNodeDrop:go,handleNodeFocus:vo,handleNodeBlur:xo,handlePointercancel:ho,handleEnd:No,handleDragend:Vo,handleParentFocus:Kt,handleNodePointerup:Co,handleNodePointerover:mo,handleParentPointerover:wo,handleParentScroll:io,handleNodePointerdown:co,handleNodeDragenter:So,handleNodeDragleave:Eo,handleParentDrop:Gt,multiDrag:r.multiDrag??!1,nativeDrag:r.nativeDrag??!0,performSort:qt,performTransfer:Jt,root:r.root??document,setupNode:Qt,setupNodeRemap:qe,reapplyDragClasses:eo,tearDownNode:oo,tearDownNodeRemap:to,remapFinished:ro,threshold:{horizontal:0,vertical:0},...r},enabledNodes:[],abortControllers:{},privateClasses:[],on:i,emit:l};new MutationObserver(no).observe(t,{childList:!0}),M.set(t,s),r.plugins?.forEach(a=>{a(t)?.tearDown?.()}),r.plugins?.forEach(a=>{a(t)?.tearDown?.()}),r.plugins?.forEach(a=>{a(t)?.setup?.()}),Zt(t,s),fe(t,!0)}function Ye(t,o,n,r,l,i){const{x:s,y:d}=le(n),a=t.el.getBoundingClientRect();return{affectedNodes:[],ascendingDirection:!1,clonedDraggedEls:[],coordinates:{x:s,y:d},draggedNode:{el:t.el,data:t.data},draggedNodes:r,incomingDirection:void 0,initialIndex:t.data.index,initialParent:{el:o.el,data:o.data},currentParent:{el:o.el,data:o.data},longPress:o.data.config.longPress??!1,longPressTimeout:void 0,currentTargetValue:t.data.value,scrollEls:[],startLeft:l||s-(a?.left??0),startTop:i||d-(a?.top??0),targetIndex:t.data.index,transferred:!1}}function qt({parent:t,draggedNodes:o,targetNodes:n}){fe(t.el);const r=o.map(a=>a.data.value),l=re(t.el,t.data),i=o[0].data.index,s=[...t.data.enabledNodes],d=[...l.filter(a=>!r.some(f=>se(a,f)))];d.splice(n[0].data.index,0,...r),"draggedNode"in p&&(p.currentTargetValue=n[0].data.value),Se(t.el,t.data,[...d]),t.data.config.onSort&&t.data.config.onSort({parent:{el:t.el,data:t.data},previousValues:[...l],previousNodes:[...s],nodes:[...t.data.enabledNodes],values:[...d],draggedNodes:o,previousPosition:i,position:n[0].data.index,targetNodes:n,state:p})}function ee(t,o,n){if(!o){n.activeState=void 0;return}n.activeState={node:o,parent:t}}function Q(t,o,n){const r=o.data.config.selectedClass;if(!n.selectedState)return;const l=Array.from(t);G(t.map(i=>i.el),r);for(const i of l){i.el.setAttribute("aria-selected","false");const s=n.selectedState.nodes.findIndex(d=>d.el===i.el);s!==-1&&n.selectedState.nodes.splice(s,1)}}function ce(t,o,n,r,l=!1){r.pointerSelection=l;for(const i of o)i.el.setAttribute("aria-selected","true"),ne([i.el],t.data.config.selectedClass,!0);r.selectedState={nodes:o,parent:t},ee(t,n,r)}function Kt(t,o){const n=t.targetData.parent.data.enabledNodes[0];n&&(o.selectedState&&o.selectedState.parent.el!==t.targetData.parent.el?ee(t.targetData.parent,n,o):o.selectedState||ee(t.targetData.parent,n,o))}function Jt({currentParent:t,targetParent:o,initialParent:n,draggedNodes:r,initialIndex:l,targetNodes:i,state:s}){fe(n.el);const d=r.map(V=>V.data.value),a=[...re(t.el,t.data).filter(V=>!d.some(_=>se(V,_)))],f=re(o.el,o.data),v=n.el===o.el&&o.data.config.sortable===!1;let c;i.length?(v?c=l:o.data.config.sortable===!1?c=o.data.enabledNodes.length:c=i[0].data.index,f.splice(c,0,...d)):(c=v?l:o.data.enabledNodes.length,f.splice(c,0,...d)),Se(t.el,t.data,a),Se(o.el,o.data,f),o.data.config.onTransfer&&o.data.config.onTransfer({sourceParent:t,targetParent:o,initialParent:n,draggedNodes:r,targetIndex:c,state:s,targetNodes:i}),t.data.config.onTransfer&&t.data.config.onTransfer({sourceParent:t,targetParent:o,initialParent:n,draggedNodes:r,targetIndex:c,state:s,targetNodes:i||[]})}function re(t,o){return[...o.getValues(t)]}function Se(t,o,n){o.setValues(n,t)}function Gt(t,o){Z(t.e),W=!0;const n=o.initialParent.data.config.handleEnd;n(o)}function Wt(t){const o=M.get(t);o&&o.abortControllers.mainParent&&o.abortControllers.mainParent.abort()}function O(t){return"draggedNode"in t&&!!t.draggedNode}function j(t){return"synthDragging"in t&&!!t.synthDragging}function Zt(t,o){o.abortControllers.mainParent=pe(t,{dragover:ue(o.config.handleParentDragover),handleParentPointerover:o.config.handleParentPointerover,scroll:ue(o.config.handleParentScroll),drop:ue(o.config.handleParentDrop),hasNestedParent:n=>{const r=M.get(n.target);r&&(r.nestedParent=n.detail.parent)},focus:ue(o.config.handleParentFocus)}),o.config.externalDragHandle&&o.config.externalDragHandle.el&&o.config.externalDragHandle.callback&&(o.abortControllers.externalDragHandle=pe(o.config.externalDragHandle.el,{pointerdown:n=>{if(!o.config.externalDragHandle||!o.config.externalDragHandle.callback)return;const r=o.config.externalDragHandle.callback();if(!ve(r)){console.warn("No draggable item found from external drag handle callback");return}const l=q.get(r);if(!l)return;const i=r.parentNode;if(!(i instanceof HTMLElement))return;const s=M.get(i);s&&(p.pointerDown={parent:{el:i,data:s},node:{el:r,data:l},validated:!0},r.draggable=!0)}}))}function Qt(t){const o=t.parent.data.config;t.node.data.abortControllers.mainNode=pe(t.node.el,{keydown:L(o.handleNodeKeydown),dragstart:L(o.handleDragstart),dragover:L(o.handleNodeDragover),dragenter:L(o.handleNodeDragenter),dragleave:L(o.handleNodeDragleave),dragend:L(o.handleDragend),drop:L(o.handleNodeDrop),focus:L(o.handleNodeFocus),blur:L(o.handleNodeBlur),pointerup:L(o.handleNodePointerup),pointercancel:L(o.handlePointercancel),pointerdown:L(o.handleNodePointerdown),handleNodePointerover:o.handleNodePointerover,touchmove:n=>{O(p)&&n.cancelable&&z(n)},contextmenu:n=>{j(p)&&z(n)}}),t.node.el.draggable=!0,o.reapplyDragClasses(t.node.el,t.parent.data),t.parent.data.config.plugins?.forEach(n=>{n(t.parent.el)?.setupNode?.(t)})}function qe(t){q.set(t.node.el,t.node.data),t.parent.data.config.plugins?.forEach(o=>{o(t.parent.el)?.setupNodeRemap?.(t)})}function eo(t,o){if(!O(p))return;const n=j(p)?o.config.synthDropZoneClass:o.config.dropZoneClass;p.draggedNode.el===t&&ne([t],n,!0)}function to(t){t.parent.data.config.plugins?.forEach(o=>{o(t.parent.el)?.tearDownNodeRemap?.(t)})}function oo(t){t.parent.data.config.plugins?.forEach(o=>{o(t.parent.el)?.tearDownNode?.(t)}),t.node.el.draggable=!1,t.node.data?.abortControllers?.mainNode&&t.node.data?.abortControllers?.mainNode.abort()}function no(t){if(t.length===1&&t[0].addedNodes.length===1&&!(t[0].addedNodes[0]instanceof HTMLElement))return;const o=t[0].target;!(o instanceof HTMLElement)||!M.get(o)||fe(o)}function fe(t,o){const n=M.get(t);if(!n)return;n.privateClasses=Array.from(t.classList);const r=[],l=n.config;for(let d=0;d<t.children.length;d++){const a=t.children[d];if(!ve(a)||a.id==="dnd-dragged-node-clone")continue;const f=q.get(a);(o||!f)&&l.tearDownNode({parent:{el:t,data:n},node:{el:a,data:f}}),!l.disabled&&(!l.draggable||l.draggable&&l.draggable(a))&&r.push(a)}if(r.length!==n.getValues(t).length&&!l.disabled){console.warn("The number of draggable items defined in the parent element does not match the number of values. This may cause unexpected behavior.");return}const i=n.getValues(t),s=[];for(let d=0;d<r.length;d++){const a=r[d],f=q.get(a);if(l.draggableValue&&!l.draggableValue(i[d]))continue;const v=Object.assign(f??{privateClasses:[],abortControllers:{}},{value:i[d],index:d});if(!O(p)&&p.activeState&&se(p.activeState.node.data.value,v.value)&&ee({data:n,el:t},{el:a,data:v},p),O(p)&&se(p.draggedNode.data.value,v.value)){p.draggedNode.data=v,p.draggedNode.el=a;const c=p.draggedNodes.find(V=>V.data.value===v.value);c&&(c.el=a)}s.push({el:a,data:v}),(o||!f)&&l.setupNode({parent:{el:t,data:n},node:{el:a,data:v}}),qe({parent:{el:t,data:n},node:{el:a,data:v}})}M.set(t,{...n,enabledNodes:s}),l.remapFinished(n),n.config.plugins?.forEach(d=>{d(t)?.remapFinished?.()})}function ro(){p.remapJustFinished=!0,"draggedNode"in p&&(p.affectedNodes=[])}function lo(t){return!!t.targetData.parent.data.config.nativeDrag}function ao(t){if(t.parent.data.config.multiDrag){if(p.selectedState)return[t.node,...p.selectedState?.nodes.filter(o=>o.el!==t.node.el)]}else return[t.node];return[]}function io(t){O(p)&&(p.emit("scrollStarted",p),!j(p)&&(p.preventEnter=!0,De&&clearTimeout(De),De=setTimeout(()=>{p.preventEnter=!1,p.emit("scrollEnded",p)},100)))}function so(t,o){const n=t.targetData.parent.data.config;if(!n.nativeDrag||!lo(t)||!Ke({x:t.e.clientX,y:t.e.clientY,node:t.targetData.node,config:n})){z(t.e);return}let r=n.draggedNodes({parent:t.targetData.parent,node:t.targetData.node});r.length===0&&(r=[t.targetData.node]),n.dragstartClasses(t.targetData.node,r,n);const l=po(t,r);if(n.onDragstart){const i={parent:t.targetData.parent,values:re(t.targetData.parent.el,t.targetData.parent.data),draggedNode:l.draggedNode,draggedNodes:l.draggedNodes,position:l.initialIndex,state:l};n.onDragstart(i)}}function co(t,o){if(Z(t.e),o.pointerDown={parent:t.targetData.parent,node:t.targetData.node,validated:!1},!Ke({x:t.e.clientX,y:t.e.clientY,node:t.targetData.node,config:t.targetData.parent.data.config}))return;o.pointerDown.validated=!0,bo(t,o,t.targetData.node);const n=t.targetData.parent.data;let r=[t.targetData.node];const l=t.e.ctrlKey||t.e.metaKey,i=t.e.shiftKey,s=t.targetData.node;if(l&&n.config.multiDrag){o.selectedState?o.selectedState.nodes.findIndex(a=>a.el===s.el)===-1?r=[...o.selectedState.nodes,s]:r=o.selectedState.nodes.filter(a=>a.el!==s.el):r=[s],ce(t.targetData.parent,r,t.targetData.node,o,!0);return}if(i&&n.config.multiDrag){const d=t.targetData.parent.data.enabledNodes;if(o.selectedState&&o.activeState)if(o.selectedState.parent.el!==t.targetData.parent.el){Q(o.selectedState.nodes,o.selectedState.parent,o),o.selectedState=void 0;for(let a=0;a<=s.data.index;a++)r.push(d[a])}else{const[a,f]=o.activeState.node.data.index<t.targetData.node.data.index?[o.activeState.node.data.index,t.targetData.node.data.index]:[t.targetData.node.data.index,o.activeState.node.data.index];r=d.slice(a,f+1)}else for(let a=0;a<=s.data.index;a++)r.push(d[a]);ce(t.targetData.parent,r,t.targetData.node,o,!0);return}o.selectedState?.nodes?.length?o.selectedState.nodes.findIndex(a=>a.el===t.targetData.node.el)===-1&&(o.selectedState.parent.el!==t.targetData.parent.el?Q(o.selectedState.nodes,t.targetData.parent,o):n.config.multiDrag&&He()?r.push(...o.selectedState.nodes):Q(o.selectedState.nodes,t.targetData.parent,o),ce(t.targetData.parent,r,t.targetData.node,o,!0)):ce(t.targetData.parent,[t.targetData.node],t.targetData.node,o,!0)}function uo(t,o,n,r=!1){ne(o.map(l=>l.el),r?n.synthDraggingClass:n.draggingClass),setTimeout(()=>{G(o.map(l=>l.el),r?n.synthDraggingClass:n.draggingClass),ne(o.map(l=>l.el),r?n.synthDragPlaceholderClass:n.dragPlaceholderClass),ne(o.map(l=>l.el),r?n.synthDropZoneClass:n.dropZoneClass),G(o.map(l=>l.el),n.selectedClass)})}function po(t,o){Z(t.e);const n=Xe(Ye(t.targetData.node,t.targetData.parent,t.e,o));if(t.e.dataTransfer){const r=t.targetData.parent.data.config;t.e.dataTransfer.dropEffect=r.dragDropEffect,t.e.dataTransfer.effectAllowed=r.dragEffectAllowed;let l;if(t.e.dataTransfer.setData("text/plain",""),r.dragImage)l=r.dragImage(t,o);else{if(!r.multiDrag||o.length===1)return t.targetData.node.el.style.zIndex="9999",t.targetData.node.el.style.boxSizing="border-box",t.e.dataTransfer.setDragImage(t.targetData.node.el,t.e.offsetX,t.e.offsetY),n.originalZIndex=t.targetData.node.el.style.zIndex,n;{const i=document.createElement("div");i.setAttribute("id","dnd-dragged-node-clone"),i.setAttribute("popover","manual");for(const d of o){const a=d.el.cloneNode(!0);a.id=d.el.id+"-clone",a.style.pointerEvents="none",i.appendChild(a)}const{width:s}=o[0].el.getBoundingClientRect();Object.assign(i.style,{display:"flex",flexDirection:"column",width:`${s}px`,position:"absolute",pointerEvents:"none",zIndex:"9999",left:"-9999px",boxSizing:"border-box",background:"transparent",overflow:"hidden"}),t.targetData.parent.el.appendChild(i),i.showPopover(),i.getBoundingClientRect(),l=i,t.e.dataTransfer.setDragImage(l,t.e.offsetX,t.e.offsetY)}}setTimeout(()=>{l?.remove()})}return n}function Ke({x:t,y:o,node:n,config:r}){if(r.externalDragHandle)return!1;if(!r.dragHandle)return!0;const l=n.el.querySelectorAll(r.dragHandle);if(!l)return!1;const i=r.root.elementFromPoint(t,o);if(!i)return!1;for(const s of Array.from(l))if(i===s||s.contains(i))return!0;return!1}function fo(t){}function mo(t){t.detail.targetData.parent.el===t.detail.state.currentParent.el?Ge(t.detail,t.detail.state):me(t.detail,t.detail.state)}function go(t,o){const n=t.targetData.parent.data.config;n.nativeDrag&&(Z(t.e),W=!0,n.handleEnd(o))}function vo(t){t.e.target!==t.e.currentTarget&&p.pointerDown&&(p.pointerDown.node.el.draggable=!1)}function xo(t){t.e.target!==t.e.currentTarget&&p.pointerDown&&(p.pointerDown.node.el.draggable=!0)}function Vo(t,o){const n=t.targetData.parent.data.config;if(n.nativeDrag){if(z(t.e),Z(t.e),W){W=!1;return}n.handleEnd(o)}}function ho(t,o){if(!j(o))return;if(z(t.e),W){W=!1;return}const n=M.get(o.initialParent.el)?.config;n?.onDragend&&n.onDragend({parent:o.currentParent,values:re(o.currentParent.el,o.currentParent.data),draggedNode:o.draggedNode,draggedNodes:o.draggedNodes,state:o}),n?.handleEnd(o)}function No(t){t.draggedNode&&(t.draggedNode.el.draggable=!0);const o=t.draggedNodes.map(v=>v.el),n=t.initialParent.data,r=j(t),l=M.get(t.initialParent.el)?.config,i=r?l?.synthDropZoneClass:l?.dropZoneClass,s=n?.config?.longPressClass,d=r?n?.config?.synthDragPlaceholderClass:n?.config?.dragPlaceholderClass,a=t.originalZIndex;j(t)&&(t.clonedDraggedNode&&t.clonedDraggedNode.remove(),t.longPressTimeout&&clearTimeout(t.longPressTimeout)),Ee(t),t.lastScrollDirectionX=void 0,t.lastScrollDirectionY=void 0,t.preventEnter=!1,t.scrollDebounceTimeout&&(clearTimeout(t.scrollDebounceTimeout),t.scrollDebounceTimeout=void 0),a!==void 0&&t.draggedNode&&(t.draggedNode.el.style.zIndex=a),requestAnimationFrame(()=>{G(o,i),G(o,s),G(o,d)}),Q(t.draggedNodes,t.currentParent,t),ee(t.currentParent,void 0,t);const f={...t};l?.onDragend?.({parent:f.currentParent,values:re(f.currentParent.el,f.currentParent.data),draggedNode:f.draggedNode,draggedNodes:f.draggedNodes,state:f}),t.emit("dragEnded",f),Ot()}function Co(t,o){Z(t.e),!o.pointerSelection&&o.selectedState&&Q(o.selectedState.nodes,t.targetData.parent,o);const n=t.targetData.parent.data.config;o.pointerSelection=!1,"longPressTimeout"in o&&o.longPressTimeout&&clearTimeout(o.longPressTimeout),o.longPress=!1,G(t.targetData.parent.data.enabledNodes.map(r=>r.el),n.longPressClass),O(o)&&n.handleEnd(o)}function yo(t,o,n,r,l,i){const s=o.data.config;let d,a;const f=["display","flexDirection","alignItems","justifyContent","padding","paddingTop","margin","marginTop","marginBottom","marginLeft","marginRight","paddingBottom","paddingLeft","paddingRight","border","borderRadius","background","backgroundColor","boxShadow","font","color","lineHeight","gap","width","height","boxSizing","overflow"],v=(b,k)=>{const S=window.getComputedStyle(b);f.forEach(E=>{k.style[E]=S[E]})},c=(b,k={})=>{Object.assign(b.style,{position:"absolute",zIndex:"9999",pointerEvents:"none",willChange:"transform",boxSizing:"border-box",opacity:"0",overflow:"hidden",width:`${i.width}px`,height:`${i.height}px`,...k})};if(s.synthDragImage)a=s.synthDragImage(t,o,n,l),d=a.dragImage,d.setAttribute("popover","manual"),c(d);else if(!s.multiDrag||l.length===1)d=t.el.cloneNode(!0),v(t.el,d),d.setAttribute("popover","manual"),c(d);else{const b=document.createElement("div");b.setAttribute("popover","manual"),l.forEach(k=>{const S=k.el.cloneNode(!0);v(k.el,S),S.style.pointerEvents="none",S.style.margin="0",b.append(S)}),b.style.display="flex",b.style.flexDirection="column",b.style.padding="0",b.style.margin="0",b.style.position="absolute",b.style.zIndex="9999",b.style.pointerEvents="none",d=b}d.id="dnd-dragged-node-clone",o.el.appendChild(d),d.showPopover();const V={clonedDraggedEls:[],clonedDraggedNode:d,synthDragScrolling:!1,synthDragging:!0,rootScrollWidth:document.scrollingElement?.scrollWidth,rootScrollHeight:document.scrollingElement?.scrollHeight};return Xe({...Ye(t,o,n,l,a?.offsetX,a?.offsetY),...V})}function bo(t,o,n){const r=t.targetData.parent.data.config;o.longPressTimeout=setTimeout(()=>{o&&(o.longPress=!0,r.longPressClass&&t.e.cancelable&&ne([n.el],r.longPressClass),z(t.e))},r.longPressDuration||1e3)}function Ee(t,o=!0,n=!0){o&&(t.frameIdX!==void 0&&(cancelAnimationFrame(t.frameIdX),t.frameIdX=void 0),t.lastScrollDirectionX=void 0),n&&(t.frameIdY!==void 0&&(cancelAnimationFrame(t.frameIdY),t.frameIdY=void 0),t.lastScrollDirectionY=void 0),!t.frameIdX&&!t.frameIdY&&(t.preventEnter=!1)}function Je(t,o=!1){const{x:n,y:r}=t.coordinates,l=t.startLeft??0,i=t.startTop??0,s=window.scrollX??0,d=window.scrollY??0,a=n-l+s,f=r-i+d;t.clonedDraggedNode.style.transform=`translate3d(${a}px, ${f}px, 0px)`,o&&(t.clonedDraggedNode.style.opacity="1",G(t.draggedNodes.map(v=>v.el),t.initialParent.data.config?.longPressClass))}function Fe(t,o,n=!1){const r=le(t);o.coordinates.x=r.x,o.coordinates.y=r.y,Je(o,n),o.scrollDebounceTimeout&&(clearTimeout(o.scrollDebounceTimeout),o.scrollDebounceTimeout=void 0),o.scrollDebounceTimeout=setTimeout(()=>{j(o)&&ge(o.coordinates,t,o)},16);const l=Io(r);if(!l){document.dispatchEvent(new CustomEvent("handleRootPointerover",{detail:{e:t,state:o}}));return}const i={e:t,targetData:l,state:o};"node"in l?l.node.el.dispatchEvent(new CustomEvent("handleNodePointerover",{detail:i})):l.parent.el.dispatchEvent(new CustomEvent("handleParentPointerover",{detail:i}))}function ko(t,o){if(!t.targetData.parent.data.config.nativeDrag)return;const{x:r,y:l}=le(t.e);o.coordinates.y=l,o.coordinates.x=r,z(t.e),Z(t.e),O(o)&&ge({x:r,y:l},t.e,o),t.targetData.parent.el===o.currentParent?.el?Ge(t,o):me(t,o)}function _o(t,o){if(!t.targetData.parent.data.config.nativeDrag)return;z(t.e),Z(t.e);const{x:r,y:l}=le(t.e);O(o)&&ge({x:r,y:l},t.e,o),me(t,o)}function wo(t){t.detail.targetData.parent.el!==t.detail.state.currentParent.el&&me(t.detail,t.detail.state)}function Do({currentParent:t,targetParent:o,initialParent:n,draggedNodes:r,state:l}){if(o.el===t.el)return!1;const i=o.data.config;if(r[0].el.contains(o.el)||i.dropZone===!1)return!1;const s=n.data.config;return i.accepts?i.accepts(o,n,t,l):!(!i.group||i.group!==s.group)}function So(t,o){z(t.e)}function Eo(t,o){z(t.e)}function To(t,o,n,r){if(o.affectedNodes.map(v=>v.data.value).includes(t.targetData.node.data.value))return!1;if(o.remapJustFinished)return o.remapJustFinished=!1,(t.targetData.node.data.value===o.currentTargetValue||o.draggedNodes.map(v=>v.el).includes(t.targetData.node.el))&&(o.currentTargetValue=t.targetData.node.data.value),!1;if(o.preventEnter)return!1;if(o.draggedNodes.map(v=>v.el).includes(t.targetData.node.el))return o.currentTargetValue=void 0,!1;if(t.targetData.node.data.value===o.currentTargetValue||t.targetData.parent.el!==o.currentParent?.el||t.targetData.parent.data.config.sortable===!1||t.targetData.node.el.contains(o.draggedNodes[0].el))return!1;const l=t.targetData.node.el.getBoundingClientRect(),i=o.draggedNode.el.getBoundingClientRect(),s=l.y-i.y,d=l.x-i.x;let a;Math.abs(s)>Math.abs(d)?a=s>0?"above":"below":a=d>0?"left":"right";const f=o.currentParent.data.config.threshold;switch(a){case"left":if(n>l.x+l.width*f.horizontal)return o.incomingDirection="left",!0;break;case"right":if(n<l.x+l.width*(1-f.horizontal))return o.incomingDirection="right",!0;break;case"above":if(r>l.y+l.height*f.vertical)return o.incomingDirection="above",!0;break;case"below":if(r<l.y+l.height*(1-f.vertical))return o.incomingDirection="below",!0;break}return!1}function Ge(t,o){const{x:n,y:r}=le(t.e);if(!To(t,o,n,r))return;const l=o.draggedNode.data.index>t.targetData.node.data.index?[t.targetData.node.data.index,o.draggedNode.data.index]:[o.draggedNode.data.index,t.targetData.node.data.index];o.targetIndex=t.targetData.node.data.index,o.affectedNodes=t.targetData.parent.data.enabledNodes.filter(i=>l[0]<=i.data.index&&i.data.index<=l[1]&&i.el!==o.draggedNode.el),t.targetData.parent.data.config.performSort({parent:t.targetData.parent,draggedNodes:o.draggedNodes,targetNodes:[t.targetData.node]})}function L(t){function o(n){const r=q.get(n);if(!r)return;const l=M.get(n.parentNode);if(l)return{node:{el:n,data:r},parent:{el:n.parentNode,data:l}}}return n=>{const r=o(n.currentTarget);if(r)return t({e:n,targetData:r},p)}}function me(t,o){z(t.e),Do({currentParent:o.currentParent,targetParent:t.targetData.parent,initialParent:o.initialParent,draggedNodes:o.draggedNodes,state:o})&&(t.targetData.parent.data.config.performTransfer({currentParent:o.currentParent,targetParent:t.targetData.parent,initialParent:o.initialParent,draggedNodes:o.draggedNodes,initialIndex:o.initialIndex,state:o,targetNodes:"node"in t.targetData?[t.targetData.node]:[]}),o.currentParent=t.targetData.parent,o.transferred=!0)}function ue(t){function o(n){const r=M.get(n);if(r)return{parent:{el:n,data:r}}}return n=>{const r=o(n.currentTarget);if(r)return t({e:n,targetData:r},p)}}function ne(t,o,n=!1){function r(l,i){q.set(l,i)}for(const l of t){const i=q.get(l),s=Bo(l,o,i,n);s&&r(l,s)}}function Bo(t,o,n,r=!1){if(!o)return;const l=Ue(o);if(!l.length)return;if(!n){t.classList.add(...l);return}const i=[];for(const s of l)t.classList.contains(s)?t.classList.contains(s)&&r===!1&&i.push(s):t.classList.add(s);return n.privateClasses=i,n}function G(t,o){if(!o)return;const n=Ue(o);if(n.length)for(const r of t){if(!ve(r)){r.classList.remove(...n);continue}const l=q.get(r)||M.get(r);if(l)for(const i of n)l.privateClasses.includes(i)||r.classList.remove(i)}}function Ae(t,o,n,r,l){const s=l.axis==="x",d=t===document.scrollingElement,a=s?"scrollLeft":"scrollTop",f=s?"clientWidth":"clientHeight",v=s?"offsetWidth":"offsetHeight",c=s?"scrollWidth":"scrollHeight",V=s?o.clientX:o.clientY,_=s?r.left:r.top,b=s?n.overflowX:n.overflowY;if(d){const k=t[a],S=t[f],E=k>0,m=k+S<(s?l.state.rootScrollWidth||0:t[c]);return s?{left:E&&V<S*.075,right:m&&V>S*(1-.075)}:{up:E&&V<S*.075,down:m&&V>S*(1-.075)}}if((b==="auto"||b==="scroll")&&t!==document.body&&t!==document.documentElement){const k=t[c],S=t[v],E=t[a],m=E>0,h=E<k-S;return s?{left:m&&V<_+S*.075,right:h&&V>_+S*(1-.075)}:{up:m&&V<_+S*.075,down:h&&V>_+S*(1-.075)}}return s?{left:!1,right:!1}:{up:!1,down:!1}}function Po(t,o,n,r){if(!O(n)||!n.draggedNode)return;n.preventEnter=!0;const l=r.axis==="x",i=r.direction==="positive"?1:-1,s=20,d=l?"lastScrollDirectionX":"lastScrollDirectionY",a=l?"frameIdX":"frameIdY";n[a]!==void 0&&(cancelAnimationFrame(n[a]),n[a]=void 0),n[d]=r.direction;const f=()=>{if(!O(n)||!n.draggedNode){n[a]!==void 0&&(cancelAnimationFrame(n[a]),n[a]=void 0);return}const v=l?"scrollLeft":"scrollTop",c=l?"clientWidth":"clientHeight",V=l?"scrollWidth":"scrollHeight",_=t[v],b=t[c],k=t[V];if(!(i>0?_+b<k:_>0)){n[a]=void 0,n[d]=void 0;return}t[v]+=s*i,j(n)&&Je(n),n[a]=requestAnimationFrame(f)};n[a]=requestAnimationFrame(f)}function Me(t,o,n){const r=t.getBoundingClientRect();return o>=r.left&&o<=r.right&&n>=r.top&&n<=r.bottom}function ge(t,o,n){if(!O(n)||!n.draggedNode)return;Ee(n);const{x:r,y:l}=t;let i=!1;const s=(a,f,v)=>{Po(v,o,n,{axis:a,direction:f}),i=!0},d=a=>{const f=window.getComputedStyle(a),v=a.getBoundingClientRect(),c=Ae(a,o,f,v,{axis:"x",state:n}),V=Ae(a,o,f,v,{axis:"y"});(c.left||c.right)&&(n.lastScrollContainerX=a,s("x",c.right?"positive":"negative",a)),(V.up||V.down)&&(n.lastScrollContainerY=a,s("y",V.down?"positive":"negative",a))};if(n.lastScrollContainerX&&Me(n.lastScrollContainerX,r,l)&&d(n.lastScrollContainerX),!i&&n.lastScrollContainerY&&Me(n.lastScrollContainerY,r,l)&&d(n.lastScrollContainerY),!i){let a=document.elementFromPoint(r,l);for(;a&&!(i&&n.lastScrollContainerX&&n.lastScrollContainerY);)a instanceof HTMLElement&&d(a),a=a.parentElement}if(!i){const a=document.scrollingElement;a instanceof HTMLElement&&d(a)}i||Ee(n)}function Io(t){let o=document.elementFromPoint(t.x,t.y);if(!ve(o))return;let n,r=!0;for(;o&&r;){if(q.has(o)||M.has(o)){r=!1,n=M.has(o);break}o=o.parentNode}if(n){const l=M.get(o);return l?{parent:{el:o,data:l}}:void 0}else{const l=q.get(o);if(!l)return;const i=M.get(o.parentNode);return i?{node:{el:o,data:l},parent:{el:o.parentNode,data:i}}:void 0}}function ve(t){return t instanceof HTMLElement&&t.parentNode instanceof HTMLElement}function pe(t,o){const n=new AbortController;for(const r in o){const l=o[r];t.addEventListener(r,l,{signal:n.signal,passive:!1,capture:r==="focus"||r==="blur"})}return n}function ze(t){if(t instanceof HTMLElement)return t;if(t.value instanceof HTMLElement)return t.value;if("$el"in t&&t.$el instanceof HTMLElement)return t.$el}function $o(t,o){Array.isArray(t)||(t=[t]);for(const n of t){const r=ze(n);if(r)return o(r);const l=e.watch(n,i=>{if(!i)return;const s=ze(i);s?o(s):console.warn("Invalid parent element",i),l()})}}var Be=new WeakMap;function Fo(t){const o=Be.get(t);return o?"value"in o?o.value:o:(console.warn("No values found for parent element"),[])}function Ao(t,o){const n=Be.get(o);n&&"value"in n&&(n.value=t)}function We(t){Te&&(Array.isArray(t)||(t=[t]),t.forEach(o=>{const{parent:n,values:r,...l}=o;$o(n,Mo(l,r))}))}function Mo(t,o){return n=>{Be.set(n,o),Yt({parent:n,getValues:Fo,setValues:Ao,config:{...t}})}}const zo={key:0,class:"flex gap-4 p-6 border-b last:border-b-0"},Oo={class:"option-drag-handle flex-none mt-9.5 cursor-grab"},Ro={class:"flex-1"},Lo={class:"mb-3"},jo={class:"flex items-center"},Uo={key:0,class:"mt-1 text-sm text-red-600"},Ho={class:"flex items-center gap-1"},Xo={class:"mb-2"},Yo={key:0,class:"option-value-drag-handle absolute -left-7 top-1/2 -translate-y-1/2 flex-none mr-2 cursor-grab"},qo=["onClick"],Ko={class:"flex justify-between"},Jo={class:"flex-1"},Go={class:"text-sm mb-2"},Wo={class:"flex flex-wrap gap-2"},Zo={key:0,class:"px-2 py-1 border rounded-full bg-muted text-muted-foreground text-sm"},Qo=e.defineComponent({__name:"Option",props:{option:{type:Object,required:!0}},emits:["update:option","remove"],setup(t,{expose:o,emit:n}){const r=t,{confirm:l}=J.useConfirmation(),i=n,s=e.computed({get(){return r.option},set(m){i("update:option",m)}}),d=e.computed({get(){return s.value.values},set(m){s.value.values=m}}),a=e.useTemplateRef("valueListRef"),f=e.ref(!1);e.watch(f,async m=>{console.log("minified",m),m||(await e.nextTick(),We({parent:a?.value,values:d,group:"valueList",dragHandle:".option-value-drag-handle",plugins:[Oe.animations()]}))},{immediate:!0});const v=()=>Math.random().toString(36).substring(2,15),c=()=>{s.value.values.push({id:v(),value:""})},V=async()=>{(s.value.name.trim()||s.value.values.filter(m=>m.value.trim()!=="").length>0)&&!await l("Are you sure you want to remove this option?")||i("remove")},_=m=>{s.value.values.splice(m,1)},b=m=>{m.name.trim()?m.nameError=void 0:m.nameError="Option name is required."},k=(m,h)=>{const B=m.target,F=s.value.values;if(m.key==="Backspace"&&B.value===""&&F?.length>2){_(h);return}},S=(m,h)=>{m.target;const B=s.value.values,F=B?.[h];F.touched=!0,B?.every(R=>R.value.trim()!=="")&&c()},E=m=>{const h=s.value,B=h?.values.every((F,I)=>F.value.trim()!==""||I===m);h&&h.values[m].value.trim()===""&&!B&&_(m)};return o({minified:f}),(m,h)=>{const B=e.resolveComponent("Input"),F=e.resolveComponent("Button");return f.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"flex gap-4 p-6 border-b last:border-b-0 hover:bg-accent dark:hover:bg-accent/50 cursor-pointer transition-colors duration-200",onClick:h[5]||(h[5]=I=>f.value=!1)},[e.createElementVNode("div",null,[e.createElementVNode("div",{class:"option-drag-handle flex-none mt-5 cursor-grab",onClick:h[4]||(h[4]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(e.unref($.GripVertical),{class:"size-4 text-gray-400"})])]),e.createElementVNode("div",Jo,[e.createElementVNode("p",Go,e.toDisplayString(s.value.name),1),e.createElementVNode("div",Wo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,I=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:I.id},[I.value?(e.openBlock(),e.createElementBlock("span",Zo,e.toDisplayString(I.value),1)):e.createCommentVNode("",!0)],64))),128))])])])):(e.openBlock(),e.createElementBlock("div",zo,[e.createElementVNode("div",null,[e.createElementVNode("div",Oo,[e.createVNode(e.unref($.GripVertical),{class:"size-4 text-gray-400"})])]),e.createElementVNode("div",Ro,[e.createElementVNode("div",Lo,[h[6]||(h[6]=e.createElementVNode("label",{class:"block text-sm mb-2"},"Option name",-1)),e.createElementVNode("div",jo,[e.createVNode(B,{modelValue:s.value.name,"onUpdate:modelValue":h[0]||(h[0]=I=>s.value.name=I),onBlur:h[1]||(h[1]=I=>b(s.value)),"aria-invalid":s.value.nameError?"true":"false",placeholder:"Color",spellcheck:"false"},null,8,["modelValue","aria-invalid"])]),s.value.nameError?(e.openBlock(),e.createElementBlock("p",Uo,[e.createElementVNode("span",Ho,[e.createVNode(e.unref($.CircleX),{class:"size-4"}),e.createTextVNode(" "+e.toDisplayString(s.value.nameError),1)])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Xo,[h[7]||(h[7]=e.createElementVNode("label",{class:"block text-sm mb-2"},"Option values",-1)),e.createElementVNode("div",{ref_key:"valueListRef",ref:a},[d.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.value,(I,R)=>(e.openBlock(),e.createElementBlock("div",{key:I.id,class:"relative flex items-center mb-2"},[I.touched?(e.openBlock(),e.createElementBlock("div",Yo,[e.createVNode(e.unref($.GripVertical),{class:"size-4 text-gray-400"})])):e.createCommentVNode("",!0),e.createVNode(B,{modelValue:I.value,"onUpdate:modelValue":U=>I.value=U,placeholder:"Option value",class:"pr-12",onKeydown:U=>k(U,R),onKeyup:U=>S(U,R),onBlur:U=>E(R),spellcheck:"false"},null,8,["modelValue","onUpdate:modelValue","onKeydown","onKeyup","onBlur"]),d.value.length>2&&I.touched?(e.openBlock(),e.createElementBlock("button",{key:1,onClick:U=>_(R),class:"absolute right-2 top-1/2 -translate-y-1/2 ml-2 p-2 text-muted-foreground/50 hover:text-muted-foreground",type:"button"},[e.createVNode(e.unref($.Trash2),{class:"size-4"})],8,qo)):e.createCommentVNode("",!0)]))),128)):e.createCommentVNode("",!0)],512)]),e.createElementVNode("div",Ko,[e.createVNode(F,{size:"sm",variant:"outline",onClick:h[2]||(h[2]=I=>V()),class:"text-red-500 hover:text-red-600"},{default:e.withCtx(()=>[...h[8]||(h[8]=[e.createTextVNode("Delete",-1)])]),_:1}),e.createVNode(F,{size:"sm",onClick:h[3]||(h[3]=I=>f.value=!0),disabled:s.value.name.trim()===""},{default:e.withCtx(()=>[...h[9]||(h[9]=[e.createTextVNode("Done",-1)])]),_:1},8,["disabled"])])])]))}}}),en=e.defineComponent({__name:"Options",props:{modelValue:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(t,{expose:o,emit:n}){const r=t,l=n,i=e.ref([]),s=e.useTemplateRef("optionsListRefElement"),d=e.useTemplateRef("optionRefs"),a=e.computed({get(){return r.modelValue},set(E){l("update:modelValue",E)}}),f=e.ref(!1);e.watch(a,E=>{console.log("mutableOptions2",E?JSON.parse(JSON.stringify(E)):[]),!f.value&&(!i.value||i.value.length===0&&E.length>0)&&(f.value=!0,i.value=E?JSON.parse(JSON.stringify(E)):[])},{deep:!0}),e.watch(i,E=>{a.value=E?.map(m=>({...m,values:m.values.filter(h=>h.value.trim()!=="")})),!k.value&&E.length>0&&S()},{deep:!0});const v=()=>Math.random().toString(36).substring(2,15),c=()=>{const m={id:v(),name:"",values:[{id:v(),value:""}],nameError:void 0};i.value.push(m)},V=()=>{d.value?.forEach(E=>{E&&(E.minified=!0)})},_=E=>{const m=i.value.findIndex(h=>h.id===E.id);m!==-1&&(i.value[m]=E)},b=E=>{const m=i.value.findIndex(h=>h.id===E.id);m!==-1&&i.value.splice(m,1)},k=e.ref(!1),S=()=>{try{k.value=!0,We({parent:s?.value,values:i,group:"optionsList",dragHandle:".option-drag-handle",plugins:[Oe.animations()]})}catch(E){console.error(E)}};return e.onMounted(()=>{i.value=r.modelValue?JSON.parse(JSON.stringify(r.modelValue)):[],console.log("mutableOptions",r.modelValue?JSON.parse(JSON.stringify(r.modelValue)):[]),i.value.length>0&&S()}),o({minifyAll:V}),(E,m)=>{const h=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{class:e.normalizeClass(["rounded-lg",i.value.length>0?"border mb-6":""])},[e.createElementVNode("div",{ref_key:"optionsListRefElement",ref:s},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,B=>(e.openBlock(),e.createBlock(Qo,{ref_for:!0,ref_key:"optionRefs",ref:d,key:B.id,option:B,"onUpdate:option":m[0]||(m[0]=F=>_(F)),onRemove:F=>b(B)},null,8,["option","onRemove"]))),128))],512),i.value&&i.value.length<3?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value.length>0?"border-t":"")},[i.value.length===0?(e.openBlock(),e.createBlock(h,{key:0,onClick:c,variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref($.PlusCircle),{class:"size-4"}),m[1]||(m[1]=e.createTextVNode(" Add options like size or color ",-1))]),_:1})):(e.openBlock(),e.createBlock(h,{key:1,onClick:c,variant:"ghost",class:"w-full justify-start pl-2 rounded-t-none"},{default:e.withCtx(()=>[e.createVNode(e.unref($.PlusCircle),{class:"size-4"}),m[2]||(m[2]=e.createTextVNode(" Add another option ",-1))]),_:1}))],2)):e.createCommentVNode("",!0)],2)])}}}),tn={key:0},on={class:"flex items-center justify-between gap-2 mb-2"},nn={key:0,class:"flex items-center gap-2"},rn={key:0,class:"mb-4"},ln={class:"flex flex-wrap gap-2"},an=["onClick"],sn={class:"-mx-6 w-[calc(100%+3rem)]"},dn={class:"text-muted-foreground text-xs"},cn={class:"z-[101] sticky -top-4 py-2 font-normal bg-accent dark:bg-border"},un={class:"z-[101] sticky -top-4 py-2 font-normal whitespace-nowrap bg-accent dark:bg-border"},pn={class:"flex items-center gap-2"},fn={class:"z-[101] sticky -top-4 py-2 pr-6 font-normal bg-accent dark:bg-border"},mn={class:"text-sm"},gn=["onClick"],vn={class:"w-10 p-2"},xn={class:"p-2"},Vn={class:"flex items-stretch gap-2"},hn=["src"],Nn={key:2,class:"relative"},Cn=["src"],yn=["src"],bn={class:"flex flex-col justify-center px-2"},kn={class:"text-md mb-0.5 hover:underline select-none"},_n={class:"flex items-center gap-1 text-xs text-muted-foreground hover:opacity-70 transition-opacity duration-200 cursor-pointer select-none"},wn={class:"p-2 w-[30%]"},Dn={class:"relative"},Sn={key:0},En={key:1},Tn={key:0,class:"absolute inset-0 top-1/2 -translate-y-1/2 px-2 truncate text-sm text-muted-foreground w-full text-center pointer-events-none"},Bn={class:"p-2 w-[18%]"},Pn={class:"w-10"},In={class:"w-10 p-2 translate-x-10"},$n={class:"p-2 pl-12"},Fn={class:"flex items-stretch gap-2"},An=["src"],Mn={class:"flex flex-col justify-center px-2"},zn={class:"p-2 w-[30%]"},On={class:"p-2 w-[18%] group"},Rn={class:"text-center text-sm text-muted-foreground bg-accent dark:bg-border p-3 -mx-6 -mb-6 rounded-b-lg"},Ln={key:0},jn=e.defineComponent({__name:"VariantList",props:{options:{type:Object,required:!0},modelValue:{type:Array,required:!0},hide:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{expose:o,emit:n}){const r=t,l=n,i=e.computed({get(){return r.modelValue},set(C){l("update:modelValue",C)}}),s=e.inject("sources"),d=e.ref(""),a=e.ref(""),f=e.ref(!1),v=e.ref([]),c=e.ref({}),V=()=>{Object.keys(r.options).length>0&&(a.value=Object.keys(r.options)[0])};e.watch(()=>r.options,()=>{a.value===""&&V()},{immediate:!0,deep:!0}),e.watch(c,C=>{_()},{deep:!0}),e.watch(()=>r.hide,C=>{C||(V(),_())});function _(){if(!c.value){i.value=[];return}let C=[];Object.keys(c.value)?.forEach(u=>{C.push({combinedOptions:u,name:S(u),disabled:!1,price:c.value[u].price,stock:c.value[u].stock,image:c.value[u].image,options:E(u)})}),i.value=C.filter(u=>u.options?.length===Object.keys(r.options).length&&u.options?.every(x=>Object.entries(r.options).find(([w,P])=>P.id===x.optionId)))}function b(C){return C.reduce((u,x)=>u.flatMap(w=>x.map(P=>[...w,P])),[[]])}function k(C){return C.slice().sort((u,x)=>u.optionId.localeCompare(x.optionId)).map(({optionId:u,valueId:x})=>`${u}:${x}`).join("|")}const S=C=>C.split("|").map(x=>{const[w,P]=x.split(":");return{optionId:w,valueId:P}}).map(x=>r.options?.[x.optionId]?.values?.find(Y=>Y.id===x.valueId)?.value||"").join(" "),E=C=>C.split("|").map(x=>{const[w,P]=x.split(":");return{optionId:w,valueId:P}}).map(x=>{const w=r.options?.[x.optionId],P=w?.values?.find(Y=>Y.id===x.valueId);return{optionId:w?.id,option:w?.name,valueId:P?.id,value:P?.value}}),m=e.computed(()=>{const C=Object.values(r.options).map(x=>x.values.map(w=>({optionId:x.id,optionName:x.name,valueId:w.id,value:w.value})));return b(C).map(x=>{const w=k(x);return c.value[w]||(c.value[w]={price:0,stock:0}),{key:w,options:x,...c.value[w]}})}),h=e.computed(()=>{let C=[...m.value];return d.value&&(C=C.filter(u=>u.options?.find(x=>x.value.toLowerCase().includes(d.value.toLowerCase())))),C}),B=(C,u)=>{const x=h.value.filter(w=>w.options?.find(P=>P.optionId===a.value)?.valueId===u);x&&x.forEach(w=>{c.value[k(w.options)].image=C})},F=C=>m.value.filter(x=>x.options?.find(w=>w.optionId===a.value)?.valueId===C).every(x=>!x.image),I=C=>{const u=m.value.filter(w=>w.options?.find(P=>P.optionId===a.value)?.valueId===C);return u.filter((w,P)=>w.image&&u.findIndex(Y=>Y.image===w.image)===P).length===1},R=C=>m.value.filter(x=>x.options?.find(w=>w.optionId===a.value)?.valueId===C).filter(x=>x.image)[0]?.image,U=C=>m.value.filter(x=>x.options?.find(w=>w.optionId===a.value)?.valueId===C).filter(x=>x.image)[1]?.image,xe=C=>{const u=m.value.filter(w=>w.options?.find(P=>P.valueId===C));if(u.length===0)return"0";const x=u.map(w=>w.price);return Math.min(...x)===Math.max(...x)?x[0]?.toString()||"0":`${Math.min(...x)} - ${Math.max(...x)}`},ae=C=>m.value.filter(u=>u.options?.find(x=>x.valueId===C)).reduce((u,x)=>x.stock>0?u+x.stock:u,0),Ve=C=>m.value.filter(u=>u.options?.find(x=>x.valueId===C)).reduce((u,x)=>x.stock<0?u+x.stock:u,0),he=()=>{let C=0;return r.options?.[a.value]?.values?.forEach(u=>{C+=ae(u.id)}),C},de=()=>{let C=0;return r.options?.[a.value]?.values?.forEach(u=>{C+=Ve(u.id)}),C},te=e.ref(null),K=e.ref(""),ie=async(C,u)=>{C.preventDefault();const x=h?.value?.filter(P=>P.options?.find(Y=>Y.optionId===a.value)?.valueId===u.id).map(P=>P.price),w=x.length===0?!0:x.every(P=>P===x[0]);te.value=u.id,K.value=w?x[0].toString():"",await e.nextTick(),document.getElementById(`variant-price-${u.id}`)?.focus(),document.getElementById(`variant-price-${u.id}`)?.select()},N=C=>{D(C),te.value=null,K.value=""},D=C=>{if(K.value.trim()&&Number(K.value.trim().replace(",","."))>0){const u=Number(K.value.trim().replace(",","."));h?.value?.filter(x=>x.options?.find(w=>w.optionId===a.value)?.valueId===C).forEach(x=>{c.value[k(x.options)].price=u})}},H=C=>{c.value=C.reduce((u,x)=>(u[x.combinedOptions]={price:x.price,stock:x.stock,image:x.image},u),{})};return e.onMounted(()=>{V()}),o({setVariantMap:H,refreshVariants:_}),(C,u)=>{const x=e.resolveComponent("SelectValue"),w=e.resolveComponent("SelectTrigger"),P=e.resolveComponent("SelectItem"),Y=e.resolveComponent("SelectContent"),Ze=e.resolveComponent("Select"),oe=e.resolveComponent("Button"),Pe=e.resolveComponent("Input"),Qe=e.resolveComponent("PopoverTrigger"),et=e.resolveComponent("RadioGroupItem"),tt=e.resolveComponent("Label"),ot=e.resolveComponent("RadioGroup"),nt=e.resolveComponent("PopoverContent"),rt=e.resolveComponent("Popover"),Ne=e.resolveComponent("Checkbox"),Ce=e.resolveComponent("TooltipTrigger"),ye=e.resolveComponent("TooltipContent"),be=e.resolveComponent("Tooltip"),Ie=e.resolveComponent("MediaPickerDialog"),ke=e.resolveComponent("NumberFieldInput"),_e=e.resolveComponent("NumberFieldContent"),we=e.resolveComponent("NumberField"),lt=e.resolveComponent("NumberFieldDecrement"),at=e.resolveComponent("NumberFieldIncrement");return t.hide?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",tn,[e.createElementVNode("div",on,[Object.keys(t.options).length>1?(e.openBlock(),e.createElementBlock("div",nn,[u[13]||(u[13]=e.createElementVNode("p",null,"Group by",-1)),e.createVNode(Ze,{modelValue:a.value,"onUpdate:modelValue":u[0]||(u[0]=y=>a.value=y)},{default:e.withCtx(()=>[e.createVNode(w,{size:"sm"},{default:e.withCtx(()=>[e.createVNode(x,{placeholder:"Option"})]),_:1}),e.createVNode(Y,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,y=>(e.openBlock(),e.createBlock(P,{key:y.id,value:y.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),f.value?(e.openBlock(),e.createBlock(oe,{key:2,variant:"outline",onClick:u[2]||(u[2]=y=>f.value=!1),size:"sm",class:"ml-auto"},{default:e.withCtx(()=>[...u[14]||(u[14]=[e.createTextVNode(" Cancel ",-1)])]),_:1})):(e.openBlock(),e.createBlock(oe,{key:1,variant:"outline",onClick:u[1]||(u[1]=y=>f.value=!0),size:"sm",class:"ml-auto"},{default:e.withCtx(()=>[e.createVNode(e.unref($.Search),{class:"size-4"}),e.createVNode(e.unref($.ListFilter),{class:"size-4"})]),_:1}))]),f.value?(e.openBlock(),e.createElementBlock("div",rn,[e.createElementVNode("div",{class:e.normalizeClass(["relative",{"mb-4":Object.keys(t.options).length>0}])},[e.createVNode(Pe,{placeholder:"Search",class:"pl-10",modelValue:d.value,"onUpdate:modelValue":u[3]||(u[3]=y=>d.value=y)},null,8,["modelValue"]),e.createVNode(e.unref($.Search),{class:"size-4 absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none"})],2),e.createElementVNode("div",ln,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,y=>(e.openBlock(),e.createBlock(rt,{key:y.id},{default:e.withCtx(()=>[e.createVNode(Qe,{asChild:""},{default:e.withCtx(()=>[e.createVNode(oe,{variant:"outline",size:"sm",class:"border-dashed"},{default:e.withCtx(()=>[y.groupBy?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(y.name)+" is "+e.toDisplayString(y.values.find(T=>T.id===y.groupBy)?.value)+" ",1),e.createElementVNode("div",{class:"p-2",onClick:e.withModifiers(T=>y.groupBy="",["stop"])},[e.createVNode(e.unref($.X),{class:"size-3"})],8,an)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(y.name)+" ",1),e.createVNode(e.unref($.ChevronDown),{class:"size-3"})],64))]),_:2},1024)]),_:2},1024),e.createVNode(nt,null,{default:e.withCtx(()=>[e.createVNode(ot,{modelValue:y.groupBy,"onUpdate:modelValue":T=>y.groupBy=T,class:"mb-4"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.values,T=>(e.openBlock(),e.createElementBlock("div",{class:"flex items-center space-x-2",key:T.id},[e.createVNode(et,{id:T.id,value:T.id,class:"border-ring"},null,8,["id","value"]),e.createVNode(tt,{for:T.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(T.value),1)]),_:2},1032,["for"])]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),e.createVNode(oe,{variant:"ghost",onClick:T=>y.groupBy="",size:"sm",class:"ml-auto",disabled:!y.groupBy},{default:e.withCtx(()=>[...u[15]||(u[15]=[e.createTextVNode(" Clear ",-1)])]),_:1},8,["onClick","disabled"])]),_:2},1024)]),_:2},1024))),128))])])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("table",sn,[e.createElementVNode("thead",dn,[e.createElementVNode("tr",null,[e.createElementVNode("th",cn,[e.createVNode(Ne,{class:"border-muted-foreground translate-y-0.5"})]),e.createElementVNode("th",un,[e.createElementVNode("div",pn,[u[16]||(u[16]=e.createElementVNode("span",null,"Variant",-1)),u[17]||(u[17]=e.createElementVNode("span",null,"·",-1)),v.value.length>0?(e.openBlock(),e.createElementBlock("button",{key:0,class:"hover:underline cursor-pointer",onClick:u[4]||(u[4]=y=>v.value=[])},"Collapse all")):(e.openBlock(),e.createElementBlock("button",{key:1,class:"hover:underline cursor-pointer",onClick:u[5]||(u[5]=y=>v.value=t.options[a.value].values.map(T=>T.id))},"Expand all"))])]),u[20]||(u[20]=e.createElementVNode("th",{class:"z-[101] sticky -top-4 py-2 font-normal bg-accent dark:bg-border"},"Price",-1)),e.createElementVNode("th",fn,[e.createVNode(be,null,{default:e.withCtx(()=>[e.createVNode(Ce,{class:"underline decoration-dashed underline-offset-4"},{default:e.withCtx(()=>[...u[18]||(u[18]=[e.createTextVNode("Available",-1)])]),_:1}),e.createVNode(ye,null,{default:e.withCtx(()=>[...u[19]||(u[19]=[e.createElementVNode("p",null,"Inventory at your store that can be sold.",-1)])]),_:1})]),_:1})])])]),e.createElementVNode("tbody",mn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options[a.value].values,y=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y.id},[e.createElementVNode("tr",{class:"hover:bg-accent/50 cursor-pointer transition-colors duration-200 border-b border-input",onClick:T=>v.value.includes(y.id)?v.value.splice(v.value.indexOf(y.id),1):v.value.push(y.id)},[e.createElementVNode("td",vn,[e.createVNode(Ne,{class:"border-muted-foreground translate-y-0.5",onClick:u[6]||(u[6]=e.withModifiers(()=>{},["stop"]))})]),e.createElementVNode("td",xn,[e.createElementVNode("div",Vn,[e.createElementVNode("div",null,[e.createVNode(Ie,{sources:e.unref(s),maxFiles:1,"initial-value":F(y.id)?[]:I(y.id)?[R(y.id)]:[R(y.id),U(y.id)],onSubmit:T=>B(T,y.id)},{default:e.withCtx(()=>[e.createElementVNode("button",{onClick:u[7]||(u[7]=e.withModifiers(()=>{},["stop"])),tabindex:"-1",class:"cursor-pointer"},[F(y.id)?(e.openBlock(),e.createBlock(oe,{key:0,variant:"outline",class:"size-15 border-dashed cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref($.ImagePlus))]),_:1})):I(y.id)?(e.openBlock(),e.createElementBlock("img",{key:1,src:R(y.id),class:"size-15 rounded-md object-cover",draggable:"false"},null,8,hn)):(e.openBlock(),e.createElementBlock("div",Nn,[e.createElementVNode("img",{src:U(y.id),class:"absolute rotate-[12deg] size-15 rounded-md object-cover",draggable:"false"},null,8,Cn),e.createElementVNode("img",{src:R(y.id),class:"relative size-15 rounded-md shadow object-cover",draggable:"false"},null,8,yn)]))])]),_:2},1032,["sources","initial-value","onSubmit"])]),e.createElementVNode("div",bn,[e.createElementVNode("p",kn,e.toDisplayString(y.value),1),e.createElementVNode("button",_n,[e.createTextVNode(e.toDisplayString(h.value?.filter(T=>T.options?.find(A=>A.optionId===a.value)?.valueId===y.id).length)+" variants ",1),e.createVNode(e.unref($.ChevronDown),{class:e.normalizeClass(["size-3 transition-transform duration-200",v.value.includes(y.id)?"rotate-180":""])},null,8,["class"])])])])]),e.createElementVNode("td",wn,[e.createElementVNode("div",Dn,[e.createVNode(be,null,{default:e.withCtx(()=>[e.createVNode(Ce,{class:"w-full",asChild:""},{default:e.withCtx(()=>[e.createVNode(Pe,{id:`variant-price-${y.id}`,modelValue:K.value,"onUpdate:modelValue":u[8]||(u[8]=T=>K.value=T),class:e.normalizeClass(["dark:bg-transparent dark:border-ring/50 text-center",te.value===y.id?"":"text-transparent"]),onClick:u[9]||(u[9]=e.withModifiers(()=>{},["stop"])),onFocus:T=>ie(T,y),onBlur:T=>N(y.id),onKeydown:e.withKeys(T=>D(y.id),["enter"])},null,8,["id","modelValue","class","onFocus","onBlur","onKeydown"])]),_:2},1024),e.createVNode(ye,null,{default:e.withCtx(()=>[h.value?.filter(T=>T.options?.find(A=>A.optionId===a.value)?.valueId===y.id).length===1?(e.openBlock(),e.createElementBlock("p",Sn,"Applies to 1 variant")):(e.openBlock(),e.createElementBlock("p",En,"Applies to all "+e.toDisplayString(h.value?.filter(T=>T.options?.find(A=>A.optionId===a.value)?.valueId===y.id).length)+" variants",1))]),_:2},1024)]),_:2},1024),te.value!==y.id?(e.openBlock(),e.createElementBlock("span",Tn,e.toDisplayString(xe(y.id)),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",Bn,[e.createVNode(be,null,{default:e.withCtx(()=>[e.createVNode(Ce,{class:"w-full focus-visible:outline-none",onClick:u[10]||(u[10]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.createVNode(we,null,{default:e.withCtx(()=>[e.createVNode(_e,null,{default:e.withCtx(()=>[e.createVNode(ke,{value:ae(y.id),class:"dark:border-ring/50",disabled:""},null,8,["value"])]),_:2},1024)]),_:2},1024)]),_:2},1024),e.createVNode(ye,null,{default:e.withCtx(()=>[...u[21]||(u[21]=[e.createElementVNode("p",null,"Update for individual variants only",-1)])]),_:1})]),_:2},1024)])],8,gn),v.value.includes(y.id)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(h.value?.filter(T=>T.options?.find(A=>A.optionId===a.value)?.valueId===y.id),T=>(e.openBlock(),e.createElementBlock("tr",{key:T.id,class:"hover:bg-accent/50 cursor-pointer transition-colors duration-200 border-b border-input"},[e.createElementVNode("td",Pn,[e.createElementVNode("div",In,[e.createVNode(Ne,{class:"border-muted-foreground translate-y-0.5",onClick:u[11]||(u[11]=e.withModifiers(()=>{},["stop"]))})])]),e.createElementVNode("td",$n,[e.createElementVNode("div",Fn,[e.createElementVNode("div",null,[e.createVNode(Ie,{sources:e.unref(s),maxFiles:1,"initial-value":c.value[k(T.options)].image?[c.value[k(T.options)].image]:[],onSubmit:A=>c.value[k(T.options)].image=A},{default:e.withCtx(()=>[e.createElementVNode("button",{onClick:u[12]||(u[12]=e.withModifiers(()=>{},["stop"])),tabindex:"-1",class:"cursor-pointer"},[c.value[k(T.options)].image?(e.openBlock(),e.createElementBlock("img",{key:0,src:c.value[k(T.options)].image,class:"size-10 object-cover rounded-md",draggable:"false"},null,8,An)):(e.openBlock(),e.createBlock(oe,{key:1,variant:"outline",class:"size-10 border-dashed cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref($.ImagePlus))]),_:1}))])]),_:2},1032,["sources","initial-value","onSubmit"])]),e.createElementVNode("div",Mn,[e.createElementVNode("p",null,e.toDisplayString(T.options.filter(A=>A.optionId!==a.value).map(A=>A.value).join(" / ")),1)])])]),e.createElementVNode("td",zn,[e.createVNode(we,{"format-options":{style:"currency",currency:"EUR",currencyDisplay:"symbol",currencySign:"standard"},modelValue:c.value[k(T.options)].price,"onUpdate:modelValue":A=>c.value[k(T.options)].price=A,min:0},{default:e.withCtx(()=>[e.createVNode(_e,null,{default:e.withCtx(()=>[e.createVNode(ke,{class:"dark:border-ring/50"})]),_:1})]),_:1},8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("td",On,[e.createVNode(we,{modelValue:c.value[k(T.options)].stock,"onUpdate:modelValue":A=>c.value[k(T.options)].stock=A},{default:e.withCtx(()=>[e.createVNode(_e,null,{default:e.withCtx(()=>[e.createVNode(lt,{class:"group-hover:opacity-100 opacity-0 transition-opacity duration-200"}),e.createVNode(ke,{class:"dark:border-ring/50"}),e.createVNode(at,{class:"group-hover:opacity-100 opacity-0 transition-opacity duration-200"})]),_:1})]),_:1},8,["modelValue","onUpdate:modelValue"])])]))),128)):e.createCommentVNode("",!0)],64))),128))])]),e.createElementVNode("div",Rn,[e.createTextVNode(" Total inventory at Webshop: "+e.toDisplayString(he())+" ",1),de()<0?(e.openBlock(),e.createElementBlock("span",Ln,"("+e.toDisplayString(de())+")",1)):e.createCommentVNode("",!0),u[22]||(u[22]=e.createTextVNode(" available ",-1))])],64)):e.createCommentVNode("",!0)]))}}}),Un=e.defineComponent({__name:"Variants",setup(t){const{params:o}=J.useModuleRoute(),{value:n}=g.useField("options"),{value:r}=g.useField("variants"),l=e.ref([]),i=e.ref([]),s=e.useTemplateRef("optionsEl"),d=e.useTemplateRef("variantsEl");e.watch(l,async c=>{n.value=c?JSON.parse(JSON.stringify(c)):[],await e.nextTick(),d.value?.refreshVariants()},{deep:!0}),e.watch(i,c=>{r.value=c?JSON.parse(JSON.stringify(c)):[]},{deep:!0});const a=e.ref(!1),f=e.ref(!1);e.watch(n,async c=>{o.value.productId=="new"||!c||Array.isArray(c)&&c.length===0||a.value||(a.value=!0,l.value=JSON.parse(JSON.stringify(c)),await e.nextTick(),c.length>1&&s.value?.minifyAll())},{deep:!0,immediate:!0}),e.watch(r,async c=>{o.value.productId=="new"||!c||Array.isArray(c)&&c.length===0||f.value||(f.value=!0,i.value=JSON.parse(JSON.stringify(c)),await e.nextTick(),d.value?.setVariantMap(c))},{deep:!0,immediate:!0});const v=e.computed(()=>{let c=l.value||[],V={};return!c||!Array.isArray(c)||c.forEach(_=>{!_.name.trim()||_.values?.filter(b=>b.value.trim()!=="")?.length===0||(V[_.id]={id:_.id,name:_.name,values:_.values?.map(b=>({id:b.id,value:b.value}))?.filter(b=>b.value.trim()!=="")||[]})}),V});return(c,V)=>{const _=e.resolveComponent("CardContent"),b=e.resolveComponent("Card");return e.openBlock(),e.createBlock(b,null,{default:e.withCtx(()=>[e.createVNode(_,null,{default:e.withCtx(()=>[V[2]||(V[2]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Variants",-1)),e.createVNode(en,{modelValue:l.value,"onUpdate:modelValue":V[0]||(V[0]=k=>l.value=k),ref_key:"optionsEl",ref:s},null,8,["modelValue"]),e.createVNode(jn,{ref_key:"variantsEl",ref:d,options:v.value,modelValue:i.value,"onUpdate:modelValue":V[1]||(V[1]=k=>i.value=k),hide:Object.keys(v.value).length===0},null,8,["options","modelValue","hide"])]),_:1})]),_:1})}}}),Hn={class:"bg-white dark:bg-gray-50 border-4 dark:border-gray-600 p-4 rounded-lg mb-4"},Xn={class:"flex items-center gap-2 mb-2"},Yn=["src"],qn={class:"text-[#1a0dab] text-lg"},Kn={class:"text-[#006621] text-[13px]"},Jn={class:"text-[#545454] text-[13px]"},Gn={class:"flex flex-col gap-4 mb-4"},Wn={class:"flex flex-col"},Zn={key:0,class:"text-red-500 text-sm mt-1"},Qn={class:"flex flex-col gap-4 mb-4"},er={class:"flex flex-col"},tr={key:0,class:"text-red-500 text-sm mt-1"},or={class:"flex flex-col gap-4"},nr={class:"flex flex-col"},rr={class:"flex gap-2"},lr={key:0,class:"text-red-500 text-sm mt-1"},ar={key:1,class:"text-[#545454] text-[13px]"},ir={key:2,class:"text-orange-500 text-[13px]"},sr=e.defineComponent({__name:"SEO",setup(t){const{errors:o}=g.useFormContext(),{value:n}=g.useField("title"),{value:r}=g.useField("slug"),{value:l}=g.useField("seo");function i(s){return s?s.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,"-"):""}return e.watch(n,(s,d)=>{(!r.value||i(d)===r.value)&&(r.value=i(s)),(!l.value.title||d===l.value.title)&&(l.value.title=s)}),(s,d)=>{const a=e.resolveComponent("Label"),f=e.resolveComponent("Input"),v=e.resolveComponent("Textarea"),c=e.resolveComponent("ProgressCircle"),V=e.resolveComponent("CardContent"),_=e.resolveComponent("Card");return e.openBlock(),e.createBlock(_,null,{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[d[7]||(d[7]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Search engine listing",-1)),e.createElementVNode("div",Hn,[e.createElementVNode("div",Xn,[e.createElementVNode("img",{src:e.unref(it.googleImg),alt:"Google",class:"w-16 pointer-events-none",draggable:"false"},null,8,Yn),d[3]||(d[3]=e.createElementVNode("span",{class:"text-[#4186f5] font-medium text-xs"},"Preview",-1))]),e.createElementVNode("p",qn,e.toDisplayString(e.unref(l).title),1),e.createElementVNode("p",Kn,e.toDisplayString(e.unref(r)),1),e.createElementVNode("p",Jn,e.toDisplayString(e.unref(l).description?.slice(0,155))+e.toDisplayString(e.unref(l).description?.length>155?" ...":""),1)]),e.createElementVNode("div",Gn,[e.createElementVNode("div",Wn,[e.createVNode(a,{for:"slug",class:"text-sm mb-2"},{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("Slug",-1)])]),_:1}),e.createVNode(f,{id:"slug",placeholder:"t-shirt-with-red-heart",modelValue:e.unref(r),"onUpdate:modelValue":d[0]||(d[0]=b=>e.isRef(r)?r.value=b:null)},null,8,["modelValue"]),e.unref(o).slug?(e.openBlock(),e.createElementBlock("p",Zn,e.toDisplayString(e.unref(o).slug),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Qn,[e.createElementVNode("div",er,[e.createVNode(a,{for:"meta-title",class:"text-sm mb-2"},{default:e.withCtx(()=>[...d[5]||(d[5]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(f,{id:"meta-title",placeholder:"T-shirt with red heart",modelValue:e.unref(l).title,"onUpdate:modelValue":d[1]||(d[1]=b=>e.unref(l).title=b)},null,8,["modelValue"]),e.unref(o).seo?.title?(e.openBlock(),e.createElementBlock("p",tr,e.toDisplayString(e.unref(o).seo.title),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",or,[e.createElementVNode("div",nr,[e.createVNode(a,{for:"meta-description",class:"text-sm mb-2"},{default:e.withCtx(()=>[...d[6]||(d[6]=[e.createTextVNode("Description",-1)])]),_:1}),e.createVNode(v,{id:"meta-description",placeholder:"Lovely T-shirt featuring a red heart",modelValue:e.unref(l).description,"onUpdate:modelValue":d[2]||(d[2]=b=>e.unref(l).description=b),class:"mb-2 resize-none"},null,8,["modelValue"]),e.createElementVNode("div",rr,[e.createVNode(c,{progress:(e.unref(l).description?.length??0)/155},null,8,["progress"]),e.unref(o).seo?.description?(e.openBlock(),e.createElementBlock("p",lr,e.toDisplayString(e.unref(o).seo.description),1)):e.unref(l).description?.length<155?(e.openBlock(),e.createElementBlock("p",ar,e.toDisplayString(e.unref(l).description.length)+" characters",1)):(e.openBlock(),e.createElementBlock("p",ir,"Please keep it under 155 characters"))])])])]),_:1})]),_:1})}}}),dr=e.defineComponent({__name:"NewSection",setup(t){return(o,n)=>{const r=e.resolveComponent("Button"),l=e.resolveComponent("CardContent"),i=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock(e.Fragment,null,[n[3]||(n[3]=e.createElementVNode("hr",{class:"my-4"},null,-1)),e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(l,null,{default:e.withCtx(()=>[n[1]||(n[1]=e.createElementVNode("h2",{class:"text-lg font-medium"},"New Section",-1)),n[2]||(n[2]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-4"},"As an admin, you can define new sections within the product detail page.",-1)),e.createVNode(r,null,{default:e.withCtx(()=>[e.createVNode(e.unref($.Plus),{class:"size-4"}),n[0]||(n[0]=e.createTextVNode(" Create new section ",-1))]),_:1})]),_:1})]),_:1})],64)}}}),cr={class:"flex items-center gap-2"},ur={key:0,class:"size-3 rounded-full bg-green-500"},pr={key:1,class:"size-3 rounded-full bg-blue-500"},fr={key:2,class:"size-3 rounded-full bg-gray-300"},mr=e.defineComponent({__name:"Status",setup(t){const{errors:o}=g.useFormContext(),{value:n}=g.useField("status");return(r,l)=>{const i=e.resolveComponent("SelectValue"),s=e.resolveComponent("SelectTrigger"),d=e.resolveComponent("SelectItem"),a=e.resolveComponent("SelectGroup"),f=e.resolveComponent("SelectContent"),v=e.resolveComponent("Select"),c=e.resolveComponent("CardContent"),V=e.resolveComponent("Card");return e.openBlock(),e.createBlock(V,null,{default:e.withCtx(()=>[e.createVNode(c,null,{default:e.withCtx(()=>[l[4]||(l[4]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Status",-1)),e.createVNode(v,{modelValue:e.unref(n),"onUpdate:modelValue":l[0]||(l[0]=_=>e.isRef(n)?n.value=_:null),class:"w-full"},{default:e.withCtx(()=>[e.createVNode(s,{class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("div",cr,[e.unref(n)==="published"?(e.openBlock(),e.createElementBlock("span",ur)):e.unref(n)==="draft"?(e.openBlock(),e.createElementBlock("span",pr)):e.unref(n)==="archived"?(e.openBlock(),e.createElementBlock("span",fr)):e.createCommentVNode("",!0),e.createVNode(i,{placeholder:"Status"})])]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(d,{value:"published"},{default:e.withCtx(()=>[...l[1]||(l[1]=[e.createElementVNode("span",{class:"size-3 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(d,{value:"draft"},{default:e.withCtx(()=>[...l[2]||(l[2]=[e.createElementVNode("span",{class:"size-3 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1}),e.createVNode(d,{value:"archived"},{default:e.withCtx(()=>[...l[3]||(l[3]=[e.createElementVNode("span",{class:"size-3 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})}}}),gr={class:"flex items-center gap-2 truncate"},vr=e.defineComponent({__name:"Collections",props:{config:{type:Object,required:!0}},setup(t){const o=t,n=J.useFirebaseIntegration(o.config.project),r=async()=>{if(!o.config.collectionsCollection)return[];const a=o.config.collectionsCollection.split(":");return a.length!==2?[]:(await n.get(a[0]))?.[a[1]]||[]},l=e.ref([]);(async()=>{const a=await r();l.value=a})();const{errors:s}=g.useFormContext(),{value:d}=g.useField("collections");return(a,f)=>{const v=e.resolveComponent("SelectValue"),c=e.resolveComponent("SelectTrigger"),V=e.resolveComponent("SelectLabel"),_=e.resolveComponent("SelectItem"),b=e.resolveComponent("SelectGroup"),k=e.resolveComponent("SelectContent"),S=e.resolveComponent("Select"),E=e.resolveComponent("CardContent"),m=e.resolveComponent("Card");return e.openBlock(),e.createBlock(m,null,{default:e.withCtx(()=>[e.createVNode(E,null,{default:e.withCtx(()=>[f[5]||(f[5]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Collections",-1)),e.createVNode(S,{modelValue:e.unref(d),"onUpdate:modelValue":f[0]||(f[0]=h=>e.isRef(d)?d.value=h:null),class:"w-full",multiple:!0},{default:e.withCtx(()=>[e.createVNode(c,{class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("div",gr,[e.createVNode(v,{placeholder:"Collections"})])]),_:1}),e.createVNode(k,null,{default:e.withCtx(()=>[e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[...f[1]||(f[1]=[e.createTextVNode("Active collections",-1)])]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.filter(h=>h.status==="published"),h=>(e.openBlock(),e.createBlock(_,{key:h.id,value:h.id},{default:e.withCtx(()=>[f[2]||(f[2]=e.createElementVNode("div",{class:"size-2 rounded-full bg-green-500"},null,-1)),e.createTextVNode(" "+e.toDisplayString(h.title),1)]),_:2},1032,["value"]))),128))]),_:1}),e.createVNode(b,null,{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[...f[3]||(f[3]=[e.createTextVNode("Drafts",-1)])]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.filter(h=>h.status==="draft"),h=>(e.openBlock(),e.createBlock(_,{key:h.id,value:h.id},{default:e.withCtx(()=>[f[4]||(f[4]=e.createElementVNode("div",{class:"size-2 rounded-full bg-blue-500"},null,-1)),e.createTextVNode(" "+e.toDisplayString(h.title),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})}}}),xr={class:"relative @container"},Vr={class:"flex flex-row gap-4 justify-between max-w-5xl mx-auto mt-4 mb-6"},hr={class:"flex items-center"},Nr={class:"text-lg font-semibold mx-2"},Cr={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},yr={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},br={key:2,class:"bg-gray-300 dark:bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},kr={class:"flex flex-col @3xl:flex-row gap-4 max-w-5xl mx-auto pb-24"},_r={class:"flex flex-col gap-4 w-full @3xl:w-2/3"},wr={class:"flex flex-col gap-4 w-full @3xl:w-1/3"},Dr={key:0,class:"fixed bottom-4 left-0 md:left-12 right-0 min-w-xs max-w-5xl w-[calc(100%-2rem)] md:w-[calc(100%-5rem)] xl:w-[calc(100%-2rem)] h-16 border border-white/10 backdrop-blur-sm border-t border-border flex items-center justify-center px-4 mx-auto z-[9999] rounded-xl overflow-hidden shadow bg-[radial-gradient(#ffffff80,transparent)] dark:bg-[radial-gradient(#00000080,transparent)]"},Sr={class:"w-full max-w-5xl flex items-center justify-end mx-auto"},Er=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},async setup(t){let o,n;const r=t,{hasPermission:l,hasAnyPermission:i,isAdmin:s}=J.useModulePermissions(),{params:d,navigateTo:a}=J.useModuleRoute(),{confirm:f}=J.useConfirmation(),v=J.useFirebaseIntegration(r.config.project);e.provide("sources",r.config.allowedMediaSources),e.provide("defaultSource",r.config.defaultUploadMediaSource);const c=e.ref(!1),V=e.computed(()=>!d.value.productId||d.value.productId==="new"),_=e.ref(""),b=e.ref([]);b.value=([o,n]=e.withAsyncContext(()=>K()),o=await o,n(),o);const k=g.toTypedSchema(g.objectType({title:g.stringType().min(1,"Title is required"),description:g.stringType().optional(),media:g.arrayType(g.stringType()).optional(),price:g.coerce.number().positive("Must be positive"),compareAtPrice:g.preprocessType(N=>N===""?void 0:N,g.coerce.number().positive("Must be positive").optional()),isTaxable:g.booleanType().optional(),costPerItem:g.preprocessType(N=>N===""?void 0:N,g.coerce.number().positive("Must be positive").optional()),currency:g.stringType(),stock:g.preprocessType(N=>N===""?void 0:N,g.coerce.number().optional()),trackInventory:g.booleanType().optional(),allowBackorder:g.booleanType().optional(),isPhysicalProduct:g.booleanType().optional(),weight:g.preprocessType(N=>N===""?void 0:N,g.coerce.number().optional()),weightUnit:g.stringType().optional(),slug:g.stringType(),seo:g.objectType({title:g.stringType().optional(),description:g.stringType().optional()}).optional(),createdAt:g.dateType(),updatedAt:g.dateType(),status:g.stringType(),options:g.arrayType(g.objectType({id:g.stringType(),name:g.stringType().min(1),values:g.arrayType(g.objectType({id:g.stringType(),value:g.stringType()}))})).optional(),variants:g.arrayType(g.objectType({combinedOptions:g.stringType().min(1),name:g.stringType().min(1),disabled:g.booleanType().optional(),price:g.coerce.number().positive("Must be positive"),stock:g.preprocessType(N=>N===""?void 0:N,g.coerce.number().optional()),image:g.stringType().optional(),options:g.arrayType(g.objectType({optionId:g.stringType(),option:g.stringType(),valueId:g.stringType(),value:g.stringType()}))})).optional(),tags:g.arrayType(g.stringType()).optional(),collections:g.arrayType(g.stringType()).optional()})),{handleSubmit:S,errors:E,values:m,setValues:h}=g.useForm({validationSchema:k,initialValues:{createdAt:new Date,updatedAt:new Date,status:"draft",options:[],variants:[],media:[],isTaxable:!1,trackInventory:!1,allowBackorder:!1,isPhysicalProduct:!0,weight:0,weightUnit:"kg",tags:[],collections:[],currency:r.config.defaultCurrency||"USD",price:1,stock:0,seo:{title:"",description:""}}});J.useModuleBreadcrumbs(()=>[{text:V.value?"New Product":m.title||"Product"}]);const B=N=>{let D={...N,maxPrice:F(),minPrice:I(),maxCompareAtPrice:U(),minCompareAtPrice:R(),isSingleVariant:!N.variants||N.variants.length===0,variantsTotal:N.variants?.length||1,stock:xe(),featuredMedia:N.media?.[0]};return D.isPhysicalProduct?D.type="physical":(D.weight=0,D.weightUnit="kg",D.type="digital"),D},F=()=>!m.variants||m.variants.length===0?m.price:Math.max(...m.variants.map(N=>N.price)),I=()=>!m.variants||m.variants.length===0?m.price:Math.min(...m.variants.map(N=>N.price)),R=()=>m.compareAtPrice,U=()=>m.compareAtPrice,xe=()=>!m.variants||m.variants.length===0?m.stock:m.variants.reduce((N,D)=>D.stock<0?N:N+D.stock,0),ae=S(async N=>{c.value=!0;let D=B(N);if(V.value){if(await ie(D.slug)){X.toast.error("Product slug already exists");return}D.createdAt=new Date,D.updatedAt=new Date;const H=await v.add(r.config.productCollection,D);a(H.id),X.toast.success("Product created")}else{if(_.value!==D.slug&&await ie(D.slug)){X.toast.error("Product slug already exists");return}D.updatedAt=new Date,await v.update(r.config.productCollection,d.value.productId,D),a(`${d.value.productId}`),X.toast.success("Product updated")}c.value=!1}),Ve=async()=>{const N=await v.get(r.config.productCollection,d.value.productId);if(!N){X.toast.error("Product not found"),a("");return}N.createdAt=new Date(N.createdAt),N.updatedAt=new Date(N.updatedAt),N.options?.forEach(D=>{D.values.forEach(H=>{H.touched=!0}),D.values.push({id:Math.random().toString(36).substring(2,15),value:""})}),h(N),_.value=N.slug},he=async()=>{try{let N={...m},D=N.slug+"-copy",H=2;for(;await ie(D);)D=N.slug+"-copy-"+H,H++;N.id=void 0,N.createdAt=new Date,N.updatedAt=new Date,N.slug=D,N.status="draft",N.title=N.title+" (copy)";const C=await v.add(r.config.productCollection,N);a(C.id),X.toast.success("Product duplicated")}catch{X.toast.error("Failed to duplicate product")}},de=async()=>{try{await v.update(r.config.productCollection,d.value.productId,{status:"archived"}),h({status:"archived"},{force:!1}),X.toast.success("Product archived")}catch{X.toast.error("Failed to archive product")}},te=async()=>{if(await f("Are you sure you want to delete this product?"))try{await v.remove(r.config.productCollection,d.value.productId),a(""),X.toast.success("Product deleted")}catch{X.toast.error("Failed to delete product")}};async function K(){if(!r.config.collectionsCollection)return[];const N=r.config.collectionsCollection.split(":");return N.length!==2?[]:(await v.get(N[0]))?.[N[1]]||[]}async function ie(N){return(await v.find(r.config.productCollection,{filters:[{field:"slug",operator:"==",value:N}]})).length>0}return e.onMounted(()=>{V.value||Ve()}),(N,D)=>{const H=e.resolveComponent("Button"),C=e.resolveComponent("MenubarTrigger"),u=e.resolveComponent("MenubarMenu"),x=e.resolveComponent("MenubarItem"),w=e.resolveComponent("MenubarContent"),P=e.resolveComponent("Menubar");return e.openBlock(),e.createElementBlock("div",xr,[e.createElementVNode("div",Vr,[e.createElementVNode("div",hr,[e.createVNode(H,{variant:"ghost",onClick:D[0]||(D[0]=Y=>e.unref(a)(""))},{default:e.withCtx(()=>[e.createVNode(e.unref($.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref($.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",Nr,e.toDisplayString(V.value?"New Product":e.unref(m).title),1),e.unref(m).status==="published"?(e.openBlock(),e.createElementBlock("span",Cr,"Published")):e.unref(m).status==="draft"?(e.openBlock(),e.createElementBlock("span",yr,"Draft")):e.unref(m).status==="archived"?(e.openBlock(),e.createElementBlock("span",br,"Archived")):e.createCommentVNode("",!0)]),V.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(P,{key:0,class:"rounded-lg shadow-xs"},{default:e.withCtx(()=>[e.unref(l)("create-product")?(e.openBlock(),e.createBlock(u,{key:0},{default:e.withCtx(()=>[e.createVNode(C,{onClick:he},{default:e.withCtx(()=>[...D[1]||(D[1]=[e.createTextVNode("Duplicate",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(C,null,{default:e.withCtx(()=>[...D[2]||(D[2]=[e.createTextVNode("Preview",-1)])]),_:1})]),_:1}),e.unref(i)("edit-product","delete-product")?(e.openBlock(),e.createBlock(u,{key:1},{default:e.withCtx(()=>[e.createVNode(C,null,{default:e.withCtx(()=>[...D[3]||(D[3]=[e.createTextVNode("More actions",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.unref(l)("edit-product")?(e.openBlock(),e.createBlock(x,{key:0,onClick:de},{default:e.withCtx(()=>[e.createVNode(e.unref($.Archive),{class:"size-4"}),D[4]||(D[4]=e.createTextVNode(" Archive product ",-1))]),_:1})):e.createCommentVNode("",!0),e.unref(l)("delete-product")?(e.openBlock(),e.createBlock(x,{key:1,variant:"destructive",onClick:te},{default:e.withCtx(()=>[e.createVNode(e.unref($.Trash),{class:"size-4"}),D[5]||(D[5]=e.createTextVNode(" Delete product ",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:1}))]),e.createElementVNode("div",kr,[e.createElementVNode("div",_r,[e.createVNode(xt),e.createVNode(St),e.createVNode(It),e.createVNode(At),e.createVNode(Un),e.createVNode(sr),e.unref(s)()?(e.openBlock(),e.createBlock(dr,{key:0})):e.createCommentVNode("",!0)]),e.createElementVNode("div",wr,[e.createVNode(mr),e.createVNode(vr,{config:t.config},null,8,["config"])])]),e.unref(i)("create-product","edit-product")?(e.openBlock(),e.createElementBlock("div",Dr,[e.createElementVNode("div",Sr,[V.value&&e.unref(l)("create-product")?(e.openBlock(),e.createBlock(H,{key:0,onClick:e.unref(ae),disabled:c.value},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createBlock(e.unref($.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(c.value?"Creating":"Create")+" New Product ",1)]),_:1},8,["onClick","disabled"])):e.unref(l)("edit-product")?(e.openBlock(),e.createBlock(H,{key:1,onClick:e.unref(ae),disabled:c.value},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createBlock(e.unref($.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(c.value?"Saving":"Save")+" Changes ",1)]),_:1},8,["onClick","disabled"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)])}}});exports.default=Er;
|
package/dist/Entries-BPkZ7Jg5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),P=require("lucide-vue-next"),V=require("@oneclick.dev/cms-kit"),H=require("./interpolation-We8hT28L.js"),_=require("./index-ijdf0d9-.js"),O={class:"flex items-center gap-2"},W={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},G={key:0},Q={key:1},X={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},J={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},Y=["href"],Z=["href"],ee=e.defineComponent({__name:"ListView",props:{entries:{type:Array,required:!0}},setup(D){const r=e.inject("selection"),v=e.inject("collection"),b=D,{config:c}=V.useModule(),{navigateTo:a,params:E}=V.useModuleRoute(),{hasPermission:N}=V.useModulePermissions(),s=(l,t)=>{l?r.value.push(t):r.value=r.value.filter(i=>i!==t)},g=l=>{if(!v.value)return"about:blank";let t=c.domain?.trim(),i=v.value.defaultLanguageRoutePattern?.trim();if(console.log("waza",{domain:t,pattern:i,entry:l}),!t||!i)return"about:blank";t.endsWith("/")&&(t=t.slice(0,-1)),i.startsWith("/")||(i="/"+i);const m=l.liveByLocale.find(u=>u.locale===c.defaultLanguage)?.slug;return H.interpolateTemplateFromVariableContext(t+i,[{name:"slug",value:m},{name:"id",value:l.id},{name:"lang",value:c.defaultLanguage||"en"}])},y=l=>`${(window.location.origin+window.location.pathname).replace(/\/$/,"")}/${l.id}`,x=e.computed(()=>b.entries?.map(l=>({...l,status:l.archived?"archived":l.liveByLocale&&l.liveByLocale.length>0?"published":"draft",publishProgress:{completed:l.liveByLocale.length,total:c.supportedLanguages?.length||1}}))||[]);return(l,t)=>{const i=e.resolveComponent("TableHead"),m=e.resolveComponent("TableRow"),u=e.resolveComponent("TableHeader"),C=e.resolveComponent("Checkbox"),w=e.resolveComponent("TableCell"),T=e.resolveComponent("Button"),h=e.resolveComponent("TableBody"),$=e.resolveComponent("Table"),M=e.resolveComponent("Card");return e.openBlock(),e.createBlock(M,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode($,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.unref(r)?.length>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createVNode(i,{class:"capitalize"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)?.contentEntryName||"entry"),1)]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Last updated at",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(i,{class:"text-right"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Edit",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(h,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,d=>(e.openBlock(),e.createBlock(m,{key:d.id,onClick:f=>e.unref(a)("collections/"+e.unref(E).collectionId+"/"+d.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(r)?.length>0?(e.openBlock(),e.createBlock(w,{key:0},{default:e.withCtx(()=>[e.createVNode(C,{"model-value":e.unref(r)?.includes(d.id),"onUpdate:modelValue":f=>s(f,d.id),onClick:t[0]||(t[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(w,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createElementVNode("span",null,e.toDisplayString(d.title),1)])]),_:2},1024),e.createVNode(w,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.updated?.at?new Date(d.updated.at).toLocaleString():"N/A"),1)]),_:2},1024),e.createVNode(w,null,{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("span",W,[d.publishProgress.completed===d.publishProgress.total?(e.openBlock(),e.createElementBlock("span",G,"Published")):(e.openBlock(),e.createElementBlock("span",Q,"Partly Published ("+e.toDisplayString(d.publishProgress.completed)+"/"+e.toDisplayString(d.publishProgress.total)+")",1))])):d.status==="draft"?(e.openBlock(),e.createElementBlock("span",X,"Draft")):d.status==="archived"?(e.openBlock(),e.createElementBlock("span",J,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(w,{class:"text-right"},{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("a",{key:0,href:g(d),target:"_blank",rel:"noreferrer",onClick:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(T,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Globe),{class:"size-4"})]),_:1})],8,Y)):e.createCommentVNode("",!0),e.createElementVNode("a",{href:y(d),rel:"noreferrer",onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(T,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Pencil),{class:"size-4"})]),_:1})],8,Z)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),te={class:"flex items-center space-x-2 mb-4"},oe={for:"chk_published_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},ne={class:"flex items-center space-x-2 mb-4"},le={for:"chk_draft_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},re={class:"flex items-center space-x-2 mb-4"},ae={for:"chk_archived_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},se=e.defineComponent({__name:"FilterPopover",setup(D){const r=e.inject("filter"),v=e.ref(""),b=()=>{r.value={published:!0,draft:!0,archived:!1}};return(c,a)=>{const E=e.resolveComponent("Button"),N=e.resolveComponent("PopoverTrigger"),s=e.resolveComponent("Checkbox"),g=e.resolveComponent("PopoverContent"),y=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(y,null,{default:e.withCtx(()=>[e.createVNode(N,{asChild:""},{default:e.withCtx(()=>[e.createVNode(E,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Filter),{class:"size-4"}),a[3]||(a[3]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(g,{class:"w-64"},{default:e.withCtx(()=>[a[5]||(a[5]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",te,[e.createVNode(s,{id:"chk_published_entries",modelValue:e.unref(r).published,"onUpdate:modelValue":a[0]||(a[0]=x=>e.unref(r).published=x)},null,8,["modelValue"]),e.createElementVNode("label",oe," Show published "+e.toDisplayString(v.value||"entries"),1)]),e.createElementVNode("div",ne,[e.createVNode(s,{id:"chk_draft_entries",modelValue:e.unref(r).draft,"onUpdate:modelValue":a[1]||(a[1]=x=>e.unref(r).draft=x)},null,8,["modelValue"]),e.createElementVNode("label",le," Show draft "+e.toDisplayString(v.value||"entries"),1)]),e.createElementVNode("div",re,[e.createVNode(s,{id:"chk_archived_entries",modelValue:e.unref(r).archived,"onUpdate:modelValue":a[2]||(a[2]=x=>e.unref(r).archived=x)},null,8,["modelValue"]),e.createElementVNode("label",ae," Show archived "+e.toDisplayString(v.value||"entries"),1)]),!e.unref(r).published||!e.unref(r).draft||e.unref(r).archived?(e.openBlock(),e.createBlock(E,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:b},{default:e.withCtx(()=>[e.createVNode(e.unref(P.RotateCcw),{class:"size-3"}),a[4]||(a[4]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),ie=e.defineComponent({__name:"ContentEntryContextMenu",emits:["selectAll","duplicateEntry","deleteEntry","deleteSelection"],setup(D,{emit:r}){const v=r,b=e.inject("entries"),c=e.inject("selection"),a=e.inject("config"),{hasPermission:E}=V.useModulePermissions(),{navigateTo:N}=V.useModuleRoute(),s=e.computed(()=>c.value?.length!==1?null:b.value?.find(l=>l.id===c.value[0])),g=l=>{let t=a.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",l.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",l.slug),window.open(t,"_blank")},y=async(l,t)=>{try{if(!["draft","published","archived"].includes(t))return;await V.useFirebaseIntegration(a.project).update(a.contentCollection,l.id,{status:t}),l.status=t,_.toast.success("Entry status changed")}catch{_.toast.error("Failed to change entry status")}},x=async l=>{try{if(!["draft","published","archived"].includes(l))return;const t=V.useFirebaseIntegration(a.project),i=[];c.value.forEach(async m=>{i.push(t.update(a.contentCollection,m,{status:l}))}),_.toast.promise(Promise.all(i),{loading:`Changing status of ${c.value.length} entries...`,success:()=>{const m=c.value.length;return c.value.forEach(u=>{b.value.find(C=>C.id==u).status=l}),c.value=[],`Entry status changed for ${m} entries`},error:m=>"Failed to change entry status"})}catch{_.toast.error("Failed to change entry status")}};return(l,t)=>{const i=e.resolveComponent("ContextMenuTrigger"),m=e.resolveComponent("ContextMenuShortcut"),u=e.resolveComponent("ContextMenuItem"),C=e.resolveComponent("ContextMenuContent"),w=e.resolveComponent("ContextMenuSeparator"),T=e.resolveComponent("ContextMenuSubTrigger"),h=e.resolveComponent("ContextMenuCheckboxItem"),$=e.resolveComponent("ContextMenuSubContent"),M=e.resolveComponent("ContextMenuSub"),d=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(d,null,{default:e.withCtx(()=>[e.createVNode(i,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3}),e.unref(c).length===0?(e.openBlock(),e.createBlock(C,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[0]||(t[0]=f=>v("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(m,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length===1&&s.value?(e.openBlock(),e.createBlock(C,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[1]||(t[1]=f=>e.unref(N)(s.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit entry ",-1)])]),_:1}),e.createVNode(w),e.unref(a).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(u,{inset:"",onClick:t[2]||(t[2]=f=>g(s.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview entry ",-1)),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(P.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(w)],64)):e.createCommentVNode("",!0),e.createVNode(u,{inset:"",onClick:t[3]||(t[3]=f=>v("duplicateEntry",s.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate entry ",-1)])]),_:1}),e.createVNode(M,null,{default:e.withCtx(()=>[e.createVNode(T,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode($,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[4]||(t[4]=f=>y(s.value,"draft")),modelValue:s.value.status==="draft"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[5]||(t[5]=f=>y(s.value,"published")),modelValue:s.value.status==="published"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[6]||(t[6]=f=>y(s.value,"archived")),modelValue:s.value.status==="archived"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.createVNode(u,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=f=>v("deleteEntry",s.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete entry ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length>1?(e.openBlock(),e.createBlock(C,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createVNode(T,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1}),e.createVNode($,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[8]||(t[8]=f=>x("draft"))},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1}),e.createVNode(h,{onClick:t[9]||(t[9]=f=>x("published"))},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(h,{onClick:t[10]||(t[10]=f=>x("archived"))},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(u,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=f=>v("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete entries ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),ce={key:0,class:"relative flex flex-col flex-1"},de={class:"flex items-center justify-between gap-4 w-full my-4"},ue={ref:"container",class:"flex items-center justify-between gap-4 w-full mb-8"},pe={class:"flex items-center gap-4"},me={class:"text-lg whitespace-nowrap"},fe={class:"relative w-full max-w-sm items-center"},ve={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},ge={class:"flex items-center gap-4"},Ce={class:"capitalize"},xe={class:"flex mb-4"},Ve=e.defineComponent({__name:"Entries",props:{config:{type:Object,required:!0}},setup(D){const r=D,{hasPermission:v,isAdmin:b}=V.useModulePermissions(),{params:c,navigateTo:a}=V.useModuleRoute(),{confirm:E}=V.useConfirmation(),N=V.useFirebaseIntegration(r.config.project),s=e.ref(null),g=e.ref([]);V.useModuleBreadcrumbs(()=>[{text:s.value?.name??""}]);const y=async()=>{const n=await N.get(r.config.collectionsCollection,c.value.collectionId);n?s.value=n:(a("/"),_.toast.error("Collection not found"))},x=async()=>{const n=await N.find(r.config.contentCollection,{filters:[{field:"collectionId",operator:"==",value:c.value.collectionId}]});g.value=n||[]},l=e.ref(1),t=e.ref([]),i=e.ref(""),m=e.ref(10),u=n=>{if(!n)return 0;if(typeof n?.toDate=="function")return n.toDate().getTime();const o=n instanceof Date?n:new Date(n);return Number.isNaN(o.getTime())?0:o.getTime()},C=e.computed(()=>{const n=i.value.trim().toLowerCase();return[...n?g.value.filter(p=>{const k=String(p?.title??"").toLowerCase(),S=String(p?.slug??"").toLowerCase();return k.includes(n)||S.includes(n)||p?.id===n}):g.value].sort((p,k)=>{const S=u(p?.updated?.at)||u(p?.updatedAt)||u(p?.createdAt);return(u(k?.updated?.at)||u(k?.updatedAt)||u(k?.createdAt))-S})}),w=e.computed(()=>{if(C.value.length<=m.value)return C.value;const n=(l.value-1)*m.value,o=n+m.value;return C.value.slice(n,o)});async function T(n){return(await N.find(r.config.contentCollection,{filters:[{field:"slug",operator:"==",value:n}]})).length>0}const h=()=>{t.value=w.value.map(n=>n.id)},$=async n=>{try{let o={...n},p=o.slug+"-copy",k=2;for(;await T(p);)p=o.slug+"-copy-"+k,k++;o.id=void 0,o.createdAt=new Date,o.updatedAt=new Date,o.slug=p,o.status="draft",o.title=o.title+" (copy)";const S=await N.add(r.config.contentCollection,o);a(S.id),_.toast.success("Entry duplicated")}catch{_.toast.error("Failed to duplicate entry")}},M=async n=>{if(await E(`Are you sure you want to delete "${n.title}"?`))try{await N.remove(r.config.contentCollection,n.id),g.value=g.value.filter(p=>p.id!==n.id),t.value=[],_.toast.success("Entry deleted")}catch{_.toast.error("Failed to delete entry")}},d=async()=>{if(await E(`Are you sure you want to delete all selected ${s?.contentEntryNamePlural||"entries"} (${t.value.length})?`))try{t.value.forEach(async o=>{await N.remove(r.config.contentCollection,o)}),g.value=g.value.filter(o=>!t.value.includes(o.id)),t.value=[],_.toast.success("Entries deleted")}catch{_.toast.error("Failed to delete entries")}},f=e.ref({published:!0,draft:!0,archived:!1});e.watch(f,()=>{l.value=1});const z=n=>{n.target?.matches("input, textarea")||n.target?.isContentEditable||(n.key==="Escape"&&(t.value=[]),(n.metaKey||n.ctrlKey)&&n.key.toLowerCase()==="a"&&(n.preventDefault(),h()))};return e.onMounted(()=>{y(),x(),window.addEventListener("keydown",z)}),e.onUnmounted(()=>{window.removeEventListener("keydown",z)}),e.provide("config",r.config),e.provide("filter",f),e.provide("entries",g),e.provide("selection",t),e.provide("collection",s),(n,o)=>{const p=e.resolveComponent("Button"),k=e.resolveComponent("Input"),S=e.resolveComponent("PaginationFirst"),A=e.resolveComponent("PaginationPrev"),I=e.resolveComponent("PaginationListItem"),U=e.resolveComponent("PaginationEllipsis"),j=e.resolveComponent("PaginationNext"),R=e.resolveComponent("PaginationLast"),q=e.resolveComponent("PaginationList"),K=e.resolveComponent("Pagination");return s.value?(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",de,[e.createVNode(p,{onClick:o[0]||(o[0]=B=>e.unref(a)("/")),variant:"link",class:"!pl-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.ChevronLeft),{class:"size-4"}),o[5]||(o[5]=e.createTextVNode(" Collections ",-1))]),_:1})]),e.createElementVNode("div",ue,[e.createElementVNode("div",pe,[e.createElementVNode("p",me,e.toDisplayString(C.value?.length)+" "+e.toDisplayString(s.value?.contentEntryNamePlural||"entries"),1),e.createElementVNode("div",fe,[e.createVNode(k,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:o[1]||(o[1]=e.withKeys(B=>i.value="",["escape"])),modelValue:i.value,"onUpdate:modelValue":o[2]||(o[2]=B=>i.value=B)},null,8,["modelValue"]),e.createElementVNode("span",ve,[e.createVNode(e.unref(P.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",ge,[t.value.length>0?(e.openBlock(),e.createBlock(p,{key:0,variant:"destructive",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(t.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(b)()||e.unref(v)("create-entry")&&s.value?.allowUserEntryManagement?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(c)?.collectionId?(e.openBlock(),e.createBlock(p,{key:0,variant:"outline",onClick:o[3]||(o[3]=B=>e.unref(a)(`collections/${e.unref(c).collectionId}/new`))},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Plus),{class:"size-4"}),e.createElementVNode("span",null,[o[6]||(o[6]=e.createTextVNode(" New ",-1)),e.createElementVNode("span",Ce,e.toDisplayString(s.value?.contentEntryName||"entry"),1)])]),_:1})):e.createCommentVNode("",!0),o[7]||(o[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(se)])],512),e.createElementVNode("div",xe,[e.createVNode(ie,{onSelectAll:h,onDuplicateEntry:$,onDeleteEntry:M,onDeleteSelection:d},{default:e.withCtx(()=>[e.createVNode(ee,{entries:w.value},null,8,["entries"])]),_:1})]),C.value?.length>m.value?(e.openBlock(),e.createBlock(K,{key:0,page:l.value,"onUpdate:page":o[4]||(o[4]=B=>l.value=B),"items-per-page":m.value,total:C.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(q,{class:"flex items-center gap-1"},{default:e.withCtx(({items:B})=>[e.createVNode(S),e.createVNode(A),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B,(L,F)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[L.type==="page"?(e.openBlock(),e.createBlock(I,{key:F,value:L.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(p,{class:"size-10 p-0",variant:L.value===l.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(L.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(U,{key:L.type,index:F},null,8,["index"]))],64))),256)),e.createVNode(j),e.createVNode(R)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}});exports.default=Ve;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),B=require("lucide-vue-next"),_=require("@oneclick.dev/cms-kit"),X=require("./index-CxETuRsG.js"),j=require("./utils-D6CaKJbp.js"),y=require("./index-ijdf0d9-.js"),J={class:"grid @md:grid-cols-2 @2xl:grid-cols-3 @3xl:grid-cols-4 @4xl:grid-cols-5 @5xl:grid-cols-6 gap-6"},Y=["onClick","onContextmenu"],Z=["src"],ee={class:"font-semibold"},te={class:"text-sm text-muted-foreground flex items-center gap-2"},oe={class:"flex items-center gap-2"},ne={key:0},le=e.defineComponent({__name:"GridView",props:{products:{type:Array,required:!0}},setup(T){const o=e.inject("selection"),{navigateTo:f}=_.useModuleRoute(),{hasPermission:g}=_.useModulePermissions(),v=(i,l)=>{const u=l.ctrlKey||l.metaKey;if(l.shiftKey)console.log("range");else if(u||o.value.length>0){const x=o.value.indexOf(i.id);x>-1?o.value.splice(x,1):o.value.push(i.id)}else o.value=[],f(i.id)},n=i=>{i.target.closest(".GRID_ITEM")||(o.value=[])},d=(i,l)=>{l.ctrlKey||l.metaKey?o.value.includes(i.id)?o.value.splice(o.value.indexOf(i.id),1):o.value.push(i.id):o.value.includes(i.id)||(o.value=[i.id])};return(i,l)=>(e.openBlock(),e.createElementBlock("div",{class:"@container mb-4 flex-1 select-none",onClick:l[0]||(l[0]=u=>o.value=[]),onContextmenu:n},[e.createElementVNode("div",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.products,u=>(e.openBlock(),e.createElementBlock("div",{key:u.id,onClick:e.withModifiers(k=>v(u,k),["stop"]),onContextmenu:k=>d(u,k),class:"GRID_ITEM cursor-pointer"},[e.createElementVNode("div",{class:e.normalizeClass(["aspect-square bg-muted rounded-xl overflow-hidden mb-2 transition-all duration-200",{"outline outline-4 outline-primary/50":e.unref(o).includes(u.id)}])},[u.featuredMedia?(e.openBlock(),e.createElementBlock("img",{key:0,src:u.featuredMedia,class:"w-full h-full object-cover pointer-events-none",draggable:"false"},null,8,Z)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",null,[e.createElementVNode("p",ee,e.toDisplayString(u.title),1),e.createElementVNode("p",te,[e.createElementVNode("span",oe,[u.status==="published"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[1]||(l[1]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-green-500"},null,-1)),l[2]||(l[2]=e.createTextVNode(" Published ",-1))],64)):u.status==="draft"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l[3]||(l[3]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-blue-500"},null,-1)),l[4]||(l[4]=e.createTextVNode(" Draft ",-1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[l[5]||(l[5]=e.createElementVNode("span",{class:"block shrink-0 size-3 rounded-full bg-gray-300"},null,-1)),l[6]||(l[6]=e.createTextVNode(" Archived ",-1))],64))]),u.variantsTotal>1?(e.openBlock(),e.createElementBlock("span",ne,"| "+e.toDisplayString(u.variantsTotal)+" variants",1)):e.createCommentVNode("",!0)])])],40,Y))),128))])],32))}}),re={class:"flex items-center gap-2"},se={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},ae={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},ie={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},ce=e.defineComponent({__name:"ListView",props:{products:{type:Array,required:!0}},setup(T){const o=e.inject("selection"),{navigateTo:f}=_.useModuleRoute(),{hasPermission:g}=_.useModulePermissions(),v=(n,d)=>{n?o.value.push(d):o.value=o.value.filter(i=>i!==d)};return(n,d)=>{const i=e.resolveComponent("TableHead"),l=e.resolveComponent("TableRow"),u=e.resolveComponent("TableHeader"),k=e.resolveComponent("Checkbox"),x=e.resolveComponent("TableCell"),m=e.resolveComponent("AvatarImage"),t=e.resolveComponent("AvatarFallback"),p=e.resolveComponent("Avatar"),C=e.resolveComponent("TableBody"),V=e.resolveComponent("Table"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode(V,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(l,null,{default:e.withCtx(()=>[e.unref(o)?.length>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createVNode(i,null,{default:e.withCtx(()=>[...d[1]||(d[1]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode(" Variants",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("Price",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(C,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.products,c=>(e.openBlock(),e.createBlock(l,{key:c.id,onClick:w=>e.unref(f)(c.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(o)?.length>0?(e.openBlock(),e.createBlock(x,{key:0},{default:e.withCtx(()=>[e.createVNode(k,{"model-value":e.unref(o)?.includes(c.id),"onUpdate:modelValue":w=>v(w,c.id),onClick:d[0]||(d[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(x,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",re,[e.createVNode(p,{class:"size-12 rounded-xl"},{default:e.withCtx(()=>[e.createVNode(m,{src:c.media?.[0],class:"object-cover"},null,8,["src"]),e.createVNode(t,{class:"rounded-xl"})]),_:2},1024),e.createElementVNode("span",null,e.toDisplayString(c.title),1)])]),_:2},1024),e.createVNode(x,null,{default:e.withCtx(()=>[c.status==="published"?(e.openBlock(),e.createElementBlock("span",se,"Published")):c.status==="draft"?(e.openBlock(),e.createElementBlock("span",ae,"Draft")):c.status==="archived"?(e.openBlock(),e.createElementBlock("span",ie,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(x,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.variantsTotal),1)]),_:2},1024),e.createVNode(x,{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(" € "+e.toDisplayString(c.price||0),1)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),de={class:"truncate"},ue={key:0},me={key:1},pe={key:2},fe={key:3},ve={class:"relative w-full max-w-sm items-center"},Ce={class:"truncate"},xe={class:"truncate"},ge={class:"flex items-center space-x-2 mb-4"},Ve={class:"flex items-center space-x-2 mb-4"},Ne={class:"flex items-center space-x-2 mb-4"},ke=e.defineComponent({__name:"FilterPopover",setup(T){const o=e.inject("filter"),f=e.inject("collections"),g=()=>{o.value={collections:[],published:!0,draft:!0,archived:!1}};return(v,n)=>{const d=e.resolveComponent("Button"),i=e.resolveComponent("PopoverTrigger"),l=e.resolveComponent("ComboboxTrigger"),u=e.resolveComponent("ComboboxAnchor"),k=e.resolveComponent("ComboboxInput"),x=e.resolveComponent("ComboboxEmpty"),m=e.resolveComponent("ComboboxItemIndicator"),t=e.resolveComponent("ComboboxItem"),p=e.resolveComponent("ScrollArea"),C=e.resolveComponent("ComboboxGroup"),V=e.resolveComponent("ComboboxList"),N=e.resolveComponent("Combobox"),c=e.resolveComponent("Checkbox"),w=e.resolveComponent("PopoverContent"),h=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(h,null,{default:e.withCtx(()=>[e.createVNode(i,{asChild:""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.Filter),{class:"size-4"}),n[4]||(n[4]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(w,{class:"w-64"},{default:e.withCtx(()=>[n[14]||(n[14]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Collection ",-1)),e.createVNode(N,{modelValue:e.unref(o).collections,"onUpdate:modelValue":n[0]||(n[0]=s=>e.unref(o).collections=s),by:"id",multiple:!0,class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(u,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(l,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline",class:"justify-between w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",de,[e.unref(o).collections.length===1?(e.openBlock(),e.createElementBlock("span",ue,e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[0])?.title),1)):e.unref(o).collections.length===2?(e.openBlock(),e.createElementBlock("span",me,e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[0])?.title)+", "+e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[1])?.title),1)):e.unref(o).collections.length>2?(e.openBlock(),e.createElementBlock("span",pe,e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[0])?.title)+", "+e.toDisplayString(e.unref(f).find(s=>s.id===e.unref(o).collections[1])?.title)+" + "+e.toDisplayString(e.unref(o).collections.length-2),1)):(e.openBlock(),e.createElementBlock("span",fe,"Select collection"))]),e.createVNode(e.unref(B.ChevronsUpDown),{class:"ml-2 size-4 shrink-0 opacity-50"})]),_:1})]),_:1})]),_:1}),e.createVNode(V,null,{default:e.withCtx(()=>[e.createElementVNode("div",ve,[e.createVNode(k,{placeholder:"Select category..."})]),e.createVNode(x,null,{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode(" No category found. ",-1)])]),_:1}),e.unref(f)?.filter(s=>s.status==="published")?.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[7]||(n[7]=e.createElementVNode("p",{class:"px-2 py-1.5 text-sm font-medium mt-2"},"Published",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"max-h-[200px] overflow-y-auto"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f).filter(s=>s.status==="published"),s=>(e.openBlock(),e.createBlock(t,{key:s.id,value:s.id},{default:e.withCtx(()=>[n[6]||(n[6]=e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1)),e.createElementVNode("span",Ce,e.toDisplayString(s.title),1),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.Check),{class:e.normalizeClass(e.unref(j.classNames)("ml-auto size-4"))},null,8,["class"])]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],64)):e.createCommentVNode("",!0),e.unref(f)?.filter(s=>s.status==="draft")?.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n[9]||(n[9]=e.createElementVNode("p",{class:"px-2 py-1.5 text-sm font-medium"},"Drafts",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"max-h-[200px] overflow-y-auto"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f).filter(s=>s.status==="draft"),s=>(e.openBlock(),e.createBlock(t,{key:s.id,value:s.id},{default:e.withCtx(()=>[n[8]||(n[8]=e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1)),e.createElementVNode("span",xe,e.toDisplayString(s.title),1),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.Check),{class:e.normalizeClass(e.unref(j.classNames)("ml-auto size-4"))},null,8,["class"])]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})],64)):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["modelValue"]),n[15]||(n[15]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",ge,[e.createVNode(c,{id:"chk_published_products",modelValue:e.unref(o).published,"onUpdate:modelValue":n[1]||(n[1]=s=>e.unref(o).published=s)},null,8,["modelValue"]),n[10]||(n[10]=e.createElementVNode("label",{for:"chk_published_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show published products ",-1))]),e.createElementVNode("div",Ve,[e.createVNode(c,{id:"chk_draft_products",modelValue:e.unref(o).draft,"onUpdate:modelValue":n[2]||(n[2]=s=>e.unref(o).draft=s)},null,8,["modelValue"]),n[11]||(n[11]=e.createElementVNode("label",{for:"chk_draft_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show draft products ",-1))]),e.createElementVNode("div",Ne,[e.createVNode(c,{id:"chk_archived_products",modelValue:e.unref(o).archived,"onUpdate:modelValue":n[3]||(n[3]=s=>e.unref(o).archived=s)},null,8,["modelValue"]),n[12]||(n[12]=e.createElementVNode("label",{for:"chk_archived_products",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"}," Show archived products ",-1))]),e.unref(o).collections.length>0||!e.unref(o).published||!e.unref(o).draft||e.unref(o).archived?(e.openBlock(),e.createBlock(d,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:g},{default:e.withCtx(()=>[e.createVNode(e.unref(B.RotateCcw),{class:"size-3"}),n[13]||(n[13]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),be=e.defineComponent({__name:"ProductContextMenu",emits:["selectAll","duplicateProduct","deleteProduct","deleteSelection"],setup(T,{emit:o}){const f=o,g=e.inject("products"),v=e.inject("selection"),n=e.inject("config"),{hasPermission:d}=_.useModulePermissions(),{navigateTo:i}=_.useModuleRoute(),l=e.computed(()=>v.value?.length!==1?null:g.value?.find(m=>m.id===v.value[0])),u=m=>{let t=n.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",m.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",m.slug),window.open(t,"_blank")},k=async(m,t)=>{try{if(!["draft","published","archived"].includes(t))return;await _.useFirebaseIntegration(n.project).update(n.productCollection,m.id,{status:t}),m.status=t,y.toast.success("Product status changed")}catch{y.toast.error("Failed to change product status")}},x=async m=>{try{if(!["draft","published","archived"].includes(m))return;const t=_.useFirebaseIntegration(n.project),p=[];v.value.forEach(async C=>{p.push(t.update(n.productCollection,C,{status:m}))}),y.toast.promise(Promise.all(p),{loading:`Changing status of ${v.value.length} products...`,success:()=>{const C=v.value.length;return v.value.forEach(V=>{g.value.find(N=>N.id==V).status=m}),v.value=[],`Product status changed for ${C} products`},error:C=>"Failed to change product status"})}catch{y.toast.error("Failed to change product status")}};return(m,t)=>{const p=e.resolveComponent("ContextMenuTrigger"),C=e.resolveComponent("ContextMenuShortcut"),V=e.resolveComponent("ContextMenuItem"),N=e.resolveComponent("ContextMenuContent"),c=e.resolveComponent("ContextMenuSeparator"),w=e.resolveComponent("ContextMenuSubTrigger"),h=e.resolveComponent("ContextMenuCheckboxItem"),s=e.resolveComponent("ContextMenuSubContent"),$=e.resolveComponent("ContextMenuSub"),z=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(z,null,{default:e.withCtx(()=>[e.createVNode(p,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"default")]),_:3}),e.unref(v).length===0?(e.openBlock(),e.createBlock(N,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(V,{inset:"",onClick:t[0]||(t[0]=b=>f("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(v).length===1&&l.value?(e.openBlock(),e.createBlock(N,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(V,{inset:"",onClick:t[1]||(t[1]=b=>e.unref(i)(l.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit product ",-1)])]),_:1}),e.createVNode(c),e.unref(n).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(V,{inset:"",onClick:t[2]||(t[2]=b=>u(l.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview product ",-1)),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(c)],64)):e.createCommentVNode("",!0),e.createVNode(V,{inset:"",onClick:t[3]||(t[3]=b=>f("duplicateProduct",l.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate product ",-1)])]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(w,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode(s,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[4]||(t[4]=b=>k(l.value,"draft")),modelValue:l.value.status==="draft"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[5]||(t[5]=b=>k(l.value,"published")),modelValue:l.value.status==="published"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[6]||(t[6]=b=>k(l.value,"archived")),modelValue:l.value.status==="archived"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.createVNode(V,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=b=>f("deleteProduct",l.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete product ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(v).length>1?(e.openBlock(),e.createBlock(N,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(w,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(v).length)+") ",1)]),_:1}),e.createVNode(s,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[8]||(t[8]=b=>x("draft"))},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1}),e.createVNode(h,{onClick:t[9]||(t[9]=b=>x("published"))},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(h,{onClick:t[10]||(t[10]=b=>x("archived"))},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(V,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=b=>f("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete products ("+e.toDisplayString(e.unref(v).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),_e={class:"relative flex flex-col flex-1"},we={ref:"container",class:"flex items-center justify-between gap-4 w-full mt-12 mb-8"},he={class:"flex items-center gap-4"},ye={class:"text-lg whitespace-nowrap"},Be={class:"relative w-full max-w-sm items-center"},Ee={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},Pe={class:"flex items-center gap-4"},Te={class:"flex flex-1"},Se=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},async setup(T){let o,f;const g=T,{hasPermission:v}=_.useModulePermissions(),{navigateTo:n}=_.useModuleRoute(),{confirm:d}=_.useConfirmation();_.useModuleBreadcrumbs(()=>[]);const i=_.useFirebaseIntegration(g.config.project),l=e.ref([]),u=async()=>{const a=await i.find(g.config.productCollection);l.value=a||[]},k=e.useTemplateRef("container"),{width:x}=X.useElementSize(k),m=e.ref("grid"),t=e.ref(1),p=e.ref([]),C=e.ref(""),V=e.ref([]);V.value=([o,f]=e.withAsyncContext(()=>h()),o=await o,f(),o);const N=e.computed(()=>m.value==="grid"?x.value<768?6:x.value<896?8:x.value<1024?10:12:10),c=e.computed(()=>l.value.filter(a=>!(S.value.collections.length>0&&!a.collections?.some(r=>S.value.collections.includes(r))||!S.value.published&&a.status==="published"||!S.value.draft&&a.status==="draft"||!S.value.archived&&a.status==="archived")).filter(a=>a.title.toLowerCase().includes(C.value.toLowerCase())||a.slug.toLowerCase().includes(C.value.toLowerCase())||a.id.toLowerCase().includes(C.value.toLowerCase()))),w=e.computed(()=>{if(c.value.length<=N.value)return c.value;const a=(t.value-1)*N.value,r=a+N.value;return c.value.slice(a,r)});async function h(){if(!g.config.collectionsCollection)return[];const a=g.config.collectionsCollection.split(":");return a.length!==2?[]:(await i.get(a[0]))?.[a[1]]||[]}async function s(a){return(await i.find(g.config.productCollection,{filters:[{field:"slug",operator:"==",value:a}]})).length>0}const $=()=>{p.value=w.value.map(a=>a.id)},z=async a=>{try{let r={...a},P=r.slug+"-copy",M=2;for(;await s(P);)P=r.slug+"-copy-"+M,M++;r.id=void 0,r.createdAt=new Date,r.updatedAt=new Date,r.slug=P,r.status="draft",r.title=r.title+" (copy)";const F=await i.add(g.config.productCollection,r);n(F.id),y.toast.success("Product duplicated")}catch{y.toast.error("Failed to duplicate product")}},b=async a=>{if(await d(`Are you sure you want to delete "${a.title}"?`))try{await i.remove(g.config.productCollection,a.id),l.value=l.value.filter(P=>P.id!==a.id),p.value=[],y.toast.success("Product deleted")}catch{y.toast.error("Failed to delete product")}},A=async()=>{if(await d(`Are you sure you want to delete all selected products (${p.value.length})?`))try{p.value.forEach(async r=>{await i.remove(g.config.productCollection,r)}),l.value=l.value.filter(r=>!p.value.includes(r.id)),p.value=[],y.toast.success("Products deleted")}catch{y.toast.error("Failed to delete products")}},S=e.ref({collections:[],published:!0,draft:!0,archived:!1});e.watch(S,()=>{t.value=1});const I=a=>{a.target?.matches("input, textarea")||a.target?.isContentEditable||(a.key==="Escape"&&(p.value=[]),(a.metaKey||a.ctrlKey)&&a.key.toLowerCase()==="a"&&(a.preventDefault(),$()))};return e.onMounted(()=>{u(),window.addEventListener("keydown",I)}),e.onUnmounted(()=>{window.removeEventListener("keydown",I)}),e.provide("config",g.config),e.provide("filter",S),e.provide("products",l),e.provide("collections",V),e.provide("selection",p),(a,r)=>{const P=e.resolveComponent("Input"),M=e.resolveComponent("Button"),F=e.resolveComponent("SegmentedControlButton"),R=e.resolveComponent("SegmentedControl"),U=e.resolveComponent("PaginationFirst"),K=e.resolveComponent("PaginationPrev"),q=e.resolveComponent("PaginationListItem"),G=e.resolveComponent("PaginationEllipsis"),O=e.resolveComponent("PaginationNext"),H=e.resolveComponent("PaginationLast"),Q=e.resolveComponent("PaginationList"),W=e.resolveComponent("Pagination");return e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",we,[e.createElementVNode("div",he,[e.createElementVNode("p",ye,e.toDisplayString(c.value?.length)+" products",1),e.createElementVNode("div",Be,[e.createVNode(P,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:r[0]||(r[0]=e.withKeys(E=>C.value="",["escape"])),modelValue:C.value,"onUpdate:modelValue":r[1]||(r[1]=E=>C.value=E)},null,8,["modelValue"]),e.createElementVNode("span",Ee,[e.createVNode(e.unref(B.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",Pe,[p.value.length>0?(e.openBlock(),e.createBlock(M,{key:0,variant:"destructive",onClick:A},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(p.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(v)("create-product")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(M,{variant:"outline",onClick:r[2]||(r[2]=E=>e.unref(n)("new"))},{default:e.withCtx(()=>[e.createVNode(e.unref(B.Plus),{class:"size-4"}),r[5]||(r[5]=e.createTextVNode(" New Product ",-1))]),_:1}),r[6]||(r[6]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(ke),r[7]||(r[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1)),e.createElementVNode("div",null,[e.createVNode(R,{modelValue:m.value,"onUpdate:modelValue":r[3]||(r[3]=E=>m.value=E),"aria-label":"View mode"},{default:e.withCtx(()=>[e.createVNode(F,{value:"grid"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.LayoutGrid),{class:"size-4"})]),_:1}),e.createVNode(F,{value:"list"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.List),{class:"size-4"})]),_:1})]),_:1},8,["modelValue"])])])],512),e.createElementVNode("div",Te,[e.createVNode(be,{onSelectAll:$,onDuplicateProduct:z,onDeleteProduct:b,onDeleteSelection:A},{default:e.withCtx(()=>[m.value==="grid"?(e.openBlock(),e.createBlock(le,{key:0,products:w.value},null,8,["products"])):(e.openBlock(),e.createBlock(ce,{key:1,products:w.value},null,8,["products"]))]),_:1})]),c.value?.length>N.value?(e.openBlock(),e.createBlock(W,{key:0,page:t.value,"onUpdate:page":r[4]||(r[4]=E=>t.value=E),"items-per-page":N.value,total:c.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(Q,{class:"flex items-center gap-1"},{default:e.withCtx(({items:E})=>[e.createVNode(U),e.createVNode(K),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E,(D,L)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[D.type==="page"?(e.openBlock(),e.createBlock(q,{key:L,value:D.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(M,{class:"size-10 p-0",variant:D.value===t.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(D.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(G,{key:D.type,index:L},null,8,["index"]))],64))),256)),e.createVNode(O),e.createVNode(H)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])}}});exports.default=Se;
|