@salla.sa/twilight-components 2.14.310 → 2.14.311
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/cjs/{filepond-h5N922xu.js → filepond-C1XiGYXI.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-CRl7s-AG.js → filepond-plugin-file-poster-Buj7uCrK.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-DARqmqRu.js → filepond-plugin-file-validate-size-DF5yjsD2.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-6YKtVIYy.js → filepond-plugin-file-validate-type-xiEipTfa.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-CIBU-x5i.js → filepond-plugin-image-edit-DiWHC4pN.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-Dr0pROTo.js → filepond-plugin-image-exif-orientation-DT-DOub-.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-BwizNP0O.js → filepond-plugin-image-preview-BnQaLNMf.js} +1 -1
- package/dist/cjs/{index-Da-Fc_Dv.js → index-Bpe38t8n.js} +1 -1
- package/dist/cjs/{index-BSAcismy.js → index-CXC9Tj5-.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-accordion_62.cjs.entry.js +19 -19
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +10 -10
- package/dist/components/index.js +2 -2
- package/dist/components/salla-user-menu.js +10 -10
- package/dist/esm/{filepond-C5Ev_LRh.js → filepond-RxewwAln.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-Cf4aX93c.js → filepond-plugin-file-poster-DA_4sF_w.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DzuISSe6.js → filepond-plugin-file-validate-size-DXEZzHxl.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-C9J5EVwa.js → filepond-plugin-file-validate-type-DEXpzCfX.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-B-kqsQ7Z.js → filepond-plugin-image-edit-BZ3QiF7z.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CYim0AQy.js → filepond-plugin-image-exif-orientation-DNtcleQU.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-Bj8wrh8K.js → filepond-plugin-image-preview-NjmxyWIx.js} +1 -1
- package/dist/esm/{index-iOFc3cdD.js → index-ChHsXzQp.js} +1 -1
- package/dist/esm/{index-CS3HDvos.js → index-DPwa4NOx.js} +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-accordion_62.entry.js +19 -19
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-review-card.entry.js +1 -1
- package/dist/esm/salla-reviews-page.entry.js +1 -1
- package/dist/esm/salla-reviews.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/twilight/{p-c0781b02.entry.js → p-0ecfdb3a.entry.js} +1 -1
- package/dist/twilight/{p-9ed50290.entry.js → p-14e15e23.entry.js} +1 -1
- package/dist/twilight/{p-4c7eb26d.entry.js → p-174f6141.entry.js} +1 -1
- package/dist/twilight/{p-8771caa4.entry.js → p-17c2d01a.entry.js} +1 -1
- package/dist/twilight/{p-80f4782c.entry.js → p-1eb7c65b.entry.js} +1 -1
- package/dist/twilight/{p-0090a073.entry.js → p-2804334f.entry.js} +1 -1
- package/dist/twilight/{p-cc522297.entry.js → p-2ab7f5a7.entry.js} +1 -1
- package/dist/twilight/{p-e3f0a14d.entry.js → p-2edcccf2.entry.js} +1 -1
- package/dist/twilight/{p-62f74d46.entry.js → p-2f7e2c29.entry.js} +1 -1
- package/dist/twilight/{p-f20c22d0.entry.js → p-334fb235.entry.js} +1 -1
- package/dist/twilight/{p-c79d3385.entry.js → p-37636816.entry.js} +1 -1
- package/dist/twilight/{p-2863c253.entry.js → p-38d8a361.entry.js} +1 -1
- package/dist/twilight/{p-DAiXY47w.js → p-39vweM4j.js} +1 -1
- package/dist/twilight/{p-5d831b24.entry.js → p-3eb18097.entry.js} +1 -1
- package/dist/twilight/{p-54750047.entry.js → p-424d2aba.entry.js} +1 -1
- package/dist/twilight/{p-33165663.entry.js → p-451d1c21.entry.js} +1 -1
- package/dist/twilight/{p-fa0a4f00.entry.js → p-46363539.entry.js} +1 -1
- package/dist/twilight/{p-7921f34d.entry.js → p-4987fa21.entry.js} +1 -1
- package/dist/twilight/{p-6b633bad.entry.js → p-6815d5f3.entry.js} +1 -1
- package/dist/twilight/{p-641e95ff.entry.js → p-68f69af5.entry.js} +1 -1
- package/dist/twilight/{p-3085be93.entry.js → p-702b7a0c.entry.js} +1 -1
- package/dist/twilight/{p-a5f714c7.entry.js → p-817795b1.entry.js} +1 -1
- package/dist/twilight/{p-b3bd3e08.entry.js → p-8c297660.entry.js} +1 -1
- package/dist/twilight/p-91c3423f.entry.js +4 -0
- package/dist/twilight/{p-ecb40dd9.entry.js → p-9490b410.entry.js} +1 -1
- package/dist/twilight/{p-wxiLbf1Q.js → p-BD1SYaja.js} +1 -1
- package/dist/twilight/{p-q3t2oiUx.js → p-CZvp_jll.js} +1 -1
- package/dist/twilight/{p-BftmF7A4.js → p-CeMwSX70.js} +1 -1
- package/dist/twilight/{p-BNCAsdrU.js → p-D4RMmydN.js} +1 -1
- package/dist/twilight/{p-CS3HDvos.js → p-DPwa4NOx.js} +1 -1
- package/dist/twilight/{p-D64-sfKJ.js → p-DVNe0IfA.js} +1 -1
- package/dist/twilight/{p-3aZYPmNi.js → p-Dy4bQAqN.js} +1 -1
- package/dist/twilight/{p-GC5QwqwX.js → p-F3EUSeeS.js} +1 -1
- package/dist/twilight/{p-cb57b82f.entry.js → p-a1a1f0e1.entry.js} +1 -1
- package/dist/twilight/{p-1104aec0.entry.js → p-a4568a88.entry.js} +1 -1
- package/dist/twilight/{p-1fd4feea.entry.js → p-ac1e7799.entry.js} +1 -1
- package/dist/twilight/{p-5abed22f.entry.js → p-ac520537.entry.js} +1 -1
- package/dist/twilight/{p-548eb5a9.entry.js → p-c6f7fe97.entry.js} +1 -1
- package/dist/twilight/{p-b3101599.entry.js → p-c85ae4c7.entry.js} +1 -1
- package/dist/twilight/{p-25b06f0b.entry.js → p-d4cf4b47.entry.js} +1 -1
- package/dist/twilight/{p-655334ed.entry.js → p-e2677580.entry.js} +1 -1
- package/dist/twilight/{p-fdcb5066.entry.js → p-f394d71c.entry.js} +2 -2
- package/dist/twilight/{p-48841974.entry.js → p-f7e03ebb.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +5 -5
- package/dist/twilight/p-514b28b4.entry.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as s,a as o}from"./p-
|
|
4
|
+
import{r as t,h as s,a as o}from"./p-DPwa4NOx.js";import{H as e}from"./p-Dljb4XCt.js";import"./p-CgtvEd63.js";const a=class{constructor(s){t(this,s),this.orderNumberText=salla.lang.get("pages.thank_you.order_id"),this.totalOrderText=salla.lang.get("pages.orders.total"),this.orderDateText=salla.lang.get("pages.orders.date"),this.orderStatusText=salla.lang.get("pages.orders.status"),this.noOrderText=salla.lang.get("pages.orders.non_orders"),this.load_more_text_trans=salla.lang.get("common.elements.load_more"),this.languageCode=salla.lang.locale,this.orders=[],salla.lang.onLoaded((()=>{this.languageCode=salla.lang.locale,this.orderNumberText=salla.lang.get("pages.thank_you.order_id"),this.totalOrderText=salla.lang.get("pages.orders.total"),this.orderDateText=salla.lang.get("pages.orders.date"),this.orderStatusText=salla.lang.get("pages.orders.status"),this.noOrderText=salla.lang.get("pages.orders.non_orders"),this.load_more_text_trans=salla.lang.get("common.elements.load_more")}))}loading(t=!0){let s=this.status?.querySelector(".s-button-text");s&&(e.toggleElementClassIf(s,"s-button-hide","s-button-show",(()=>t)),this.btnLoader.style.display=t?"inherit":"none")}initiateInfiniteScroll(){this.hasInfiniteScroll&&(this.wrapper?(this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:!1,nextPage:this.nextPage,scrollThreshold:!1},!0),this.infiniteScroll?.on("request",(()=>{this.loading()})),this.infiniteScroll?.on("load",(t=>{this.loading(!1),this.pagination=t.pagination,this.nextPage=t.pagination?.links?.next||null,this.handleResponse(t.data).forEach((t=>{this.wrapper.append(t)}));let s=this.host.querySelectorAll(".s-orders-table-tbody-tr:not(.animated)");e.animateItems(s)})),this.infiniteScroll?.on("error",(t=>{salla.logger.error("Error loading more comments:",t)}))):salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll."))}async loadMore(){this.infiniteScroll.loadNextPage()}handleResponse(t){return t.map((t=>this.getSingleOrderItem(t)))}async loadInitialData(){const t=new URL(window.location.href);await salla.order.api.fetch({...this.params,types:[""],feedback_status:t.searchParams.get("feedback_status")}).then((t=>{if(this.orders=t.data,this.hasInfiniteScroll=!!t.pagination?.links.next,this.pagination=t.pagination,this.total=t.pagination?.total,this.nextPage=t.pagination?.links?.next||null,!this.orders.length)return this.showPlaceholder=!0,this.loading(!1);setTimeout((()=>{this.handleResponse(t.data).forEach((t=>{this.wrapper.append(t)})),this.initiateInfiniteScroll();let s=this.wrapper.querySelectorAll(".s-orders-table-tbody-tr:not(.animated)");e.animateItems(s)}),100)})).catch((t=>{this.showPlaceholder=!0,this.loading(!1),salla.logger.error(t)}))}getSingleOrderItem(t){const s=document.createElement("tr");s.classList.add("s-orders-table-tbody-tr","s-orders-table-tbody-tr-shadow");const o=document.createElement("td");o.classList.add("s-orders-table-tbody-tr-td");const a=document.createElement("div");a.classList.add("s-orders-table-tbody-tr-td-content");const r=document.createElement("span");r.classList.add("s-orders-mobile-title"),r.textContent=this.orderNumberText+":";const n=document.createElement("span");if(n.classList.add("s-orders-reference-id"),n.textContent="#"+t.reference_id,a.appendChild(r),a.appendChild(n),"buy_as_gift"==t.source){const t=document.createElement("i");t.classList.add("sicon-gift-sharing","s-orders-buy-as-gift-icon"),a.appendChild(t)}const i=document.createElement("a");i.href=t.url,a.appendChild(i);const d=document.createElement("div");d.classList.add("s-orders-copy-to-clipboard-button");const l=document.createElement("salla-button");l.classList.add("relative"),l.setAttribute("color","dark"),l.setAttribute("shape","link"),l.dataset.content=t.reference_id.toString(),l.addEventListener("click",(t=>{e.copyToClipboard(t),e.toggleElementClassIf(l,"copied","code-to-copy",(()=>!0)),setTimeout((()=>{e.toggleElementClassIf(l,"code-to-copy","copied",(()=>!0))}),1e3)}));const c=document.createElement("span");c.textContent="#"+t.reference_id;const h=document.createElement("i");h.classList.add("sicon-swap-stroke","s-orders-copy-to-clipboard-button-icon"),salla.config.get("theme.is_rtl",!0)?(l.appendChild(h),l.appendChild(c)):(l.appendChild(c),l.appendChild(h)),d.appendChild(l),a.appendChild(d),o.appendChild(a),s.appendChild(o);const u=document.createElement("td");u.classList.add("s-orders-table-tbody-tr-td");const b=document.createElement("div");b.classList.add("s-orders-table-tbody-tr-td-content");const m=document.createElement("span");m.classList.add("s-orders-mobile-title"),m.textContent=this.totalOrderText+":";const p=document.createElement("div");p.innerHTML=salla.money(t.total);const y=document.createElement("a");y.href=t.url,b.appendChild(m),b.appendChild(p),b.appendChild(y),u.appendChild(b),s.appendChild(u);const g=document.createElement("td");g.classList.add("s-orders-table-tbody-tr-td");const f=document.createElement("div");f.classList.add("s-orders-table-tbody-tr-td-content");const _=document.createElement("span");_.classList.add("s-orders-mobile-title"),_.textContent=this.orderDateText+":";const v=document.createElement("div");v.textContent=e.formatDateFromString(t.created_at.date,salla.helpers.number,this.languageCode);const k=document.createElement("a");k.href=t.url,f.appendChild(_),f.appendChild(v),f.appendChild(k),g.appendChild(f),s.appendChild(g);const w=document.createElement("td");w.classList.add("s-orders-table-tbody-tr-td");const x=document.createElement("div");x.classList.add("s-orders-table-tbody-tr-td-content");const j=document.createElement("span");j.classList.add("s-orders-mobile-title"),j.textContent=this.orderStatusText+":";const C=document.createElement("span");C.classList.add("s-orders-status-container"),C.style.color=t.status.color;const D=document.createElement("i");D.classList.add(t.status.icon);const I=document.createElement("span");I.textContent=t.status.name,C.appendChild(D),C.appendChild(I),x.appendChild(j),x.appendChild(C);const T=document.createElement("i");T.classList.add("sicon-star2","s-orders-status-rated",t.is_rated?"s-orders-rated-text":"s-orders-unrated-text"),x.appendChild(T);const E=document.createElement("a");return E.href=t.url,x.appendChild(E),w.appendChild(x),s.appendChild(w),s}render(){return this.showPlaceholder?s("div",{class:"s-orders-no-content"},s("i",{class:"sicon-packed-box icon"}),s("p",null,this.noOrderText)):s("div",{class:"s-orders-wrapper"},s("table",{class:"s-orders-table"},s("thead",{class:"s-orders-table-head"},s("tr",{class:"s-orders-table-head-tr"},s("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.orderNumberText),s("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.totalOrderText),s("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.orderDateText),s("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.orderStatusText))),s("tbody",{class:"s-orders-table-tbody",ref:t=>this.wrapper=t})),this.nextPage&&s("div",{class:"s-infinite-scroll-wrapper",ref:t=>this.status=t},s("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},s("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText??this.load_more_text_trans),s("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))))}componentWillLoad(){return salla.onReady().then((()=>this.loadInitialData())).then((()=>this.initiateInfiniteScroll()))}get host(){return o(this)}};a.style=":host{display:block}";export{a as salla_orders}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as i,h as a}from"./p-
|
|
4
|
+
import{r as i,h as a}from"./p-DPwa4NOx.js";const e=class{constructor(a){i(this,a)}render(){return a("a",{key:"773f4784238c5d6ff060f996891d3b42e21703a0",href:this.notification.url,class:{"s-notifications-item":!0,"s-notifications-item-shadow":!0,"s-notifications-item-read":!this.notification.is_new}},a("span",{key:"9589e70416b9ae04d82331717d29192fcfb2b0ae",class:"s-notifications-item-icon"},a("i",{key:"2a208e20051f33ed305d15f9be13d6165ad577a6",class:{"s-notifications-item-icon sicon-bell-ring":!0,"s-notifications-item-icon-new":this.notification.is_new}})),a("div",{key:"4a94e411048a69a065458c867d792c679bcf5362",class:"s-notifications-item-content"},a("div",{key:"fc9ede08e2e14d7b578f2a36ea7219dff1b9118a",class:"s-notifications-item-content-leading"},a("h4",{key:"812d7fc74046793e2fc53afbd2b4d65445dc7d7a"},this.notification.title),a("p",{key:"7a38966f6755b4261465e7b780b1028a607c6e00"},this.notification.sub_title)),a("span",{key:"ba5058df85b4fe9a685f4ea1f52e333ee9b20b7f",class:"s-notifications-item-content-trailing"},a("i",{key:"c93b353212b21a3cbfca72ff8bacd39738b332ac",class:"sicon-time s-notifications-item-content-trailing-icon"}),a("span",{key:"8206298a9fa03cd100d64b4934622033caebe7fc"},this.notification.date))))}};e.style="";export{e as salla_notification_item}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as i,a as t}from"./p-
|
|
4
|
+
import{r as s,h as i,a as t}from"./p-DPwa4NOx.js";import{I as e}from"./p-uTyAzPSy.js";const r=class{constructor(i){s(this,i),this.currentSlide=0,this.showPurchaseCount=!1,this.startPoint={x:0,y:0},this.isSwiping=!1,this.isRTL="rtl",this.handlePointerDown=s=>{s.isPrimary&&(this.sliderElement?.setPointerCapture(s.pointerId),this.startSwipe(s.clientX,s.clientY),s.preventDefault())},this.handlePointerMove=s=>{this.isSwiping&&s.isPrimary&&s.preventDefault()},this.handlePointerUp=s=>{this.isSwiping&&s.isPrimary&&(this.sliderElement?.releasePointerCapture(s.pointerId),this.endSwipe(s.clientX,s.clientY))},this.handlePointerCancel=s=>{this.isSwiping&&s.isPrimary&&(this.sliderElement?.releasePointerCapture(s.pointerId),this.isSwiping=!1)},this.goToSlide=s=>{this.currentSlide=Math.max(0,Math.min(s,this.images.length-1))}}async componentDidLoad(){await salla.onReady(),this.showPurchaseCount=!!salla.config.get("store.settings.product.total_sold_enabled",!1),this.isRTL=salla.config.get("theme.is_rtl",!0),this.purchasedCount=salla.lang.getWithDefault("blocks.home.reviews.purchased_count",this.isRTL?` تم شراءه ${this.review.product?.sold_quantity} مرة`:`Purchased ${this.review.product.sold_quantity} times`,{count:this.review.product?.sold_quantity}),this.initializeSlider()}disconnectedCallback(){this.removeEventListeners()}get images(){const{review:s}=this;return s?.images?.length>1?s.images.map(((s,i)=>({url:s,alt:"",id:i}))):s?.product?.images||[]}get hasMultipleImages(){return this.images.length>1}get slideTransform(){return`translateX(${100*this.currentSlide*(this.isRTL?1:-1)}%)`}initializeSlider(){this.hasMultipleImages&&(this.sliderElement=this.el.querySelector(".s-review-card-slider-container"),this.sliderElement&&(this.sliderElement.style.touchAction="pan-y pinch-zoom",this.addEventListeners()))}addEventListeners(){this.sliderElement&&(this.sliderElement.addEventListener("pointerdown",this.handlePointerDown,{passive:!1}),this.sliderElement.addEventListener("pointermove",this.handlePointerMove,{passive:!1}),this.sliderElement.addEventListener("pointerup",this.handlePointerUp,{passive:!0}),this.sliderElement.addEventListener("pointercancel",this.handlePointerCancel,{passive:!0}))}removeEventListeners(){this.sliderElement&&(this.sliderElement.removeEventListener("pointerdown",this.handlePointerDown),this.sliderElement.removeEventListener("pointermove",this.handlePointerMove),this.sliderElement.removeEventListener("pointerup",this.handlePointerUp),this.sliderElement.removeEventListener("pointercancel",this.handlePointerCancel))}startSwipe(s,i){this.startPoint={x:s,y:i},this.isSwiping=!0}componentDidRender(){this.removeEventListeners(),this.addEventListeners()}endSwipe(s,i){this.isSwiping=!1,this.processSwipe(s-this.startPoint.x,i-this.startPoint.y)}processSwipe(s,i){if(Math.abs(s)<10||Math.abs(i)>Math.abs(s))return;const t=s<0;(this.isRTL?!t:t)?this.goToNextSlide():this.goToPrevSlide()}goToNextSlide(){this.currentSlide<this.images.length-1&&this.currentSlide++}goToPrevSlide(){this.currentSlide>0&&this.currentSlide--}renderStars(){return Array(5).fill(null).map(((s,t)=>i("span",{key:t,innerHTML:this.review.stars>=t+1?' <svg width="18" height="17" view-box="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M9.00045 13.6951L3.71036 16.6563L4.89186 10.71L0.440918 6.59397L6.4612 5.88017L9.00045 0.375122L11.5396 5.88017L17.5599 6.59397L13.109 10.71L14.2905 16.6563L9.00045 13.6951Z" fill="currentcolor" />\n</svg>':' <svg width="18" height="17" view-box="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M9.00045 13.6951L3.71036 16.6563L4.89186 10.71L0.440918 6.59397L6.4612 5.88017L9.00045 0.375122L11.5396 5.88017L17.5599 6.59397L13.109 10.71L14.2905 16.6563L9.00045 13.6951Z" fill="#DDDDDD" />\n</svg>'})))}renderDots(){return this.images.map((({url:s},t)=>i("button",{key:s||t,type:"button",class:"s-review-card-slider-dot "+(this.currentSlide===t?"active":""),onClick:()=>this.goToSlide(t),"aria-label":`Go to slide ${t+1}`,onPointerDown:()=>this.goToSlide(t)})))}renderSlider(){return this.hasMultipleImages?i("div",{class:"s-review-card-slider-container"},i("div",{class:"s-review-card-slides",style:{transform:this.slideTransform}},this.images.map((s=>i("div",{key:s?.id,class:"s-review-card-slider-slide"},i("img",{src:s.url,alt:s.alt||"Product image",width:275,height:275,loading:"lazy",draggable:!1}))))),i("div",{class:"s-review-card-slider-dots"},this.renderDots())):null}renderSingleImage(){const s=this.review?.product?.image;return!s||this.hasMultipleImages?null:i("img",{src:s.url,alt:s.alt||"Product image",class:"s-review-card-image",width:275,height:275,loading:"lazy",decoding:"async",draggable:!1})}renderHeader(){return i("div",{class:"s-review-card-header"},i("div",{class:"s-review-card-reviewer-name"},i("p",null,this.review?.name),this.review?.has_order&&i("span",{class:"s-review-card-verified-icon",innerHTML:e})),i("div",{class:"s-review-card-stars"},this.renderStars()))}renderProductInfo(){const s=this.review?.product;return s?i("a",{href:this.review?.product?.url,class:"s-review-card-product-container"},i("img",{alt:s.image?.alt||"Product",src:s.image?.url,class:"s-review-card-product-image",width:60,height:60,loading:"lazy",decoding:"async",draggable:!1}),i("div",{class:"s-review-card-product-details"},i("p",{class:"s-review-card-product-details-name"},s.name),this.showPurchaseCount?i("p",{class:"s-review-card-product-details-purchase-count"},i("span",{innerHTML:' <svg width="12" height="17" view-box="0 0 12 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6 16.2501C9.10658 16.2501 11.625 13.7317 11.625 10.6251C11.625 9.976 11.4523 9.35252 11.25 8.77232C9.99998 10.0075 9.05002 10.6251 8.4 10.6251C11.3966 5.37512 9.75 3.12512 5.25 0.125122C5.625 3.87475 3.15302 5.58043 2.14634 6.52757C1.0559 7.5535 0.375 9.00977 0.375 10.6251C0.375 13.7317 2.89339 16.2501 6 16.2501ZM6.53205 2.92636C8.96333 4.98908 8.97495 6.59185 7.09725 9.88157C6.5265 10.8815 7.2486 12.1251 8.4 12.1251C8.9163 12.1251 9.43807 11.9745 9.98917 11.6789C9.52342 13.4466 7.91393 14.7501 6 14.7501C3.72182 14.7501 1.875 12.9033 1.875 10.6251C1.875 9.47072 2.34959 8.39582 3.17419 7.62002C3.2687 7.53115 3.74812 7.1062 3.76858 7.08782C4.08646 6.8017 4.34835 6.54985 4.60718 6.2727C5.52998 5.28461 6.19283 4.18735 6.53205 2.92636Z" fill="currentcolor" />\n </svg>'}),this.purchasedCount):null)):null}render(){return i("div",{key:"8c2e3500d7844c43e455e707c460a842995eda13",class:"s-review-card-container"},this.renderSlider(),this.renderSingleImage(),a(),i("div",{key:"1b5cb3b515118ab578d2f64202e33ff2a67b3e89",class:"s-review-card-content"},this.renderHeader(),i("p",{key:"784abce956a5ee45aa0d90b5bd5427c2658bcf2c",class:"s-review-card-review-content",innerHTML:this.review?.content}),a(),this.renderProductInfo()))}get el(){return t(this)}},a=()=>i("div",{class:"s-review-card-divider "});r.style=":host{display:block}";export{r as salla_review_card}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as t,H as r}from"./p-CS3HDvos.js";var s;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(s||(s={}));const i={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class o{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);0!==t?(this.currentTierIndex=t,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier,this.canRender=!0):this.canRender=!1}componentDidLoad(){salla.event.on("cart::updated",(async e=>{const t=await this.fetchTieredOfferData();t&&this.updateOfferValues(e,t)}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===s.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:i.staticIcons[t]||i.staticIcons[0],threshold:e.min_spend,text_color:i.staticColors[t],index:t+1})));return{current_tier:o.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return o.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.canRender=!0,!1===t.details?.with_current_cart)return;const r=t.details?.current_value||0;this.apiOfferData=t;const s=this.findCurrentTierIndex(r);0!==s?(this.canRender=!0,this.currentTierIndex=s,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,s),this.activeTabTier!==this.currentTier&&(this.activeTabTier=this.currentTier)):this.canRender=!1}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return o.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const s="rtl"===document.documentElement.dir,i=this.calculateMilestonePosition(t,r),o=e.name.length>6?"flex-end":"center";return{[s?"right":"left"]:i,alignItems:o,position:"absolute",transform:s?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,s){const i=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",s?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:i,style:this.getMilestoneIconStyles(e,r,s)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((s,i)=>{const o=e>=s.threshold,n=s.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(s,i,r)},this.renderMilestoneIcon(s,n,o),this.renderMilestoneName(s,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,s=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(s,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=o.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style=".s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}";export{n as salla_tiered_offer}
|
|
4
|
+
import{r as e,h as t,H as r}from"./p-DPwa4NOx.js";var s;!function(e){e.PERCENTAGE="percentage",e.FIXED="fixed"}(s||(s={}));const i={staticIcons:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M13.7276 3.44418L15.4874 6.99288C15.7274 7.48687 16.3673 7.9607 16.9073 8.05143L20.0969 8.58575C22.1367 8.92853 22.6167 10.4206 21.1468 11.8925L18.6671 14.3927C18.2471 14.8161 18.0172 15.6327 18.1471 16.2175L18.8571 19.3125C19.417 21.7623 18.1271 22.71 15.9774 21.4296L12.9877 19.6452C12.4478 19.3226 11.5579 19.3226 11.0079 19.6452L8.01827 21.4296C5.8785 22.71 4.57865 21.7522 5.13859 19.3125L5.84851 16.2175C5.97849 15.6327 5.74852 14.8161 5.32856 14.3927L2.84884 11.8925C1.389 10.4206 1.85895 8.92853 3.89872 8.58575L7.08837 8.05143C7.61831 7.9607 8.25824 7.48687 8.49821 6.99288L10.258 3.44418C11.2179 1.51861 12.7777 1.51861 13.7276 3.44418Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M3 12C7.5 12 12 7.5 12 3C12 7.5 16.5 12 21 12C16.5 12 12 16.5 12 21C12 16.5 7.5 12 3 12Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M2 19.5C2.83333 19.5 4.5 17.8333 4.5 17C4.5 17.8333 6.16667 19.5 7 19.5C6.16667 19.5 4.5 21.1667 4.5 22C4.5 21.1667 2.83333 19.5 2 19.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n <path d="M16 5C17 5 19 3 19 2C19 3 21 5 22 5C21 5 19 7 19 8C19 7 17 5 16 5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" color="#000000" fill="none">\n <path d="M14.2644 18.3717C14.5806 17.407 14.7387 16.9247 15.0616 16.593C15.215 16.4354 15.3932 16.3048 15.5887 16.2066C16.0003 16 16.5003 16 17.5002 16C18.5001 16 19.0001 16 19.4116 16.2066C19.6072 16.3048 19.7853 16.4354 19.9388 16.593C20.2617 16.9247 20.4198 17.407 20.736 18.3717L21.0624 19.3675C21.4561 20.5688 21.653 21.1694 21.3587 21.5847C21.0643 22 20.4418 22 19.1966 22H15.8038C14.5586 22 13.936 22 13.6417 21.5847C13.3473 21.1694 13.5442 20.5688 13.938 19.3675L14.2644 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M8.76421 10.3717C9.08041 9.40705 9.23851 8.92471 9.56143 8.59298C9.71485 8.43537 9.89299 8.3048 10.0885 8.20663C10.5001 8 11.0001 8 12 8C12.9999 8 13.4999 8 13.9115 8.20663C14.107 8.3048 14.2851 8.43537 14.4386 8.59298C14.7615 8.92471 14.9196 9.40705 15.2358 10.3717L15.5622 11.3675C15.956 12.5688 16.1528 13.1694 15.8585 13.5847C15.5642 14 14.9416 14 13.6964 14H10.3036C9.05842 14 8.43585 14 8.1415 13.5847C7.84716 13.1694 8.04404 12.5688 8.43779 11.3675L8.76421 10.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M3.26439 18.3717C3.58059 17.407 3.73869 16.9247 4.06162 16.593C4.21504 16.4354 4.39317 16.3048 4.58872 16.2066C5.00031 16 5.50027 16 6.50018 16C7.5001 16 8.00006 16 8.41165 16.2066C8.6072 16.3048 8.78533 16.4354 8.93875 16.593C9.26167 16.9247 9.41977 17.407 9.73597 18.3717L10.0624 19.3675C10.4561 20.5688 10.653 21.1694 10.3587 21.5847C10.0643 22 9.44176 22 8.19661 22H4.80375C3.5586 22 2.93603 22 2.64169 21.5847C2.34735 21.1694 2.54422 20.5688 2.93797 19.3675L3.26439 18.3717Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M12 2V4M7.5 3.5L9 5M16.5 3.5L15 5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path>\n</svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" color="#000000" fill="none">\n <path d="M5.78223 4.18192C6.43007 3.68319 6.754 3.43383 7.12788 3.27323C7.29741 3.20041 7.47367 3.14158 7.65459 3.09741C8.0536 3 8.4767 3 9.32289 3H14.6771C15.5233 3 15.9464 3 16.3454 3.09741C16.5263 3.14158 16.7026 3.20041 16.8721 3.27323C17.246 3.43383 17.5699 3.68319 18.2178 4.18192C20.3644 5.83448 21.4378 6.66077 21.8057 7.73078C21.9694 8.20673 22.0305 8.70728 21.9858 9.20461C21.8852 10.3227 21.0379 11.346 19.3433 13.3925L15.3498 18.2153C13.8126 20.0718 13.044 21 12 21C10.956 21 10.1874 20.0718 8.65018 18.2153L4.65671 13.3925C2.96208 11.346 2.11476 10.3227 2.0142 9.20461C1.96947 8.70728 2.03064 8.20673 2.1943 7.73078C2.56224 6.66077 3.63557 5.83448 5.78223 4.18192Z" stroke="currentColor" stroke-width="1.5"></path>\n <path d="M10 8.5H14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n</svg>'],staticColors:["#993018","#444444","#D18F36","#315F9C"]};class o{static findTierByIndex(e,t){return e.find((e=>e.index===t))||null}static findTierByName(e,t){return e.find((e=>e.tier_name===t))||null}static getTierNameByIndex(e,t){return this.findTierByIndex(e,t)?.tier_name}static findCurrentTierIndex(e,t){if(!t)return 0;for(let r=t.length-1;r>=0;r--)if(e>=t[r].threshold)return t[r].index;return 0}}const n=class{constructor(t){e(this,t),this.currentTierIndex=0,this.canRender=!1,this.isLoading=!1,this.handleTabClick=e=>{this.activeTabTier=e},salla.lang.onLoaded((()=>{this.loyaltyProgramText=salla.lang.get("blocks.tiered_offer.program_title"),this.currentTierText=salla.lang.get("blocks.tiered_offer.current_tier"),this.discountText=salla.lang.get("blocks.tiered_offer.discount"),this.benefitText=salla.lang.get("blocks.tiered_offer.tier_description")}))}async componentWillLoad(){try{if(await salla.onReady(),!this.checkFeatureEnabled())return;if(!this.checkCartExists())return;this.isLoading=!0;const e=await this.fetchTieredOfferData();if(!e)return;this.initializeComponent(e)}catch(e){this.canRender=!1,salla.logger.warn("salla-tiered-offer:: ",e)}finally{this.isLoading=!1}}checkFeatureEnabled(){return salla.config.get("store.features")?.includes("tiered-offer")}checkCartExists(){return!!salla.storage.get("cart")?.summary?.count}validateCouponCompatibility(e,t){return!(t&&!e.details?.applied_with_coupon)}async fetchTieredOfferData(){try{const{data:e}=await salla.api.cart.offers(),t=e.find((e=>"tiered_offer"===e.type));return t?this.validateCouponCompatibility(t,salla.storage.get("cart")?.coupon)?t:(this.canRender=!1,null):null}catch(e){throw e}}initializeComponent(e){this.apiOfferData=e,this.tieredOfferData=this.mapApiDataToTiers(this.apiOfferData),this.loyaltyProgramText=this.apiOfferData.title||this.loyaltyProgramText;const t=this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0);0!==t?(this.currentTierIndex=t,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,t),this.activeTabTier=this.currentTier,this.canRender=!0):this.canRender=!1}componentDidLoad(){salla.event.on("cart::updated",(async e=>{const t=await this.fetchTieredOfferData();t&&this.updateOfferValues(e,t)}))}mapApiDataToTiers(e){const t=[...e.details.discounts].sort(((e,t)=>e.min_spend-t.min_spend)).map(((e,t)=>({name:e.name,tier_name:e.name,discount:e.type===s.PERCENTAGE?`${salla.helpers.number(e.value)}%`:salla.money(e.value),icon:i.staticIcons[t]||i.staticIcons[0],threshold:e.min_spend,text_color:i.staticColors[t],index:t+1})));return{current_tier:o.getTierNameByIndex(t,this.findCurrentTierIndex(e.details.current_value,t)),tiers:t}}findCurrentTierIndex(e,t=this.tieredOfferData?.tiers){return o.findCurrentTierIndex(e,t||[])}updateOfferValues(e,t){if(!t||!this.tieredOfferData)return;if(!this.validateCouponCompatibility(t,e.coupon))return void(this.canRender=!1);if(this.canRender=!0,!1===t.details?.with_current_cart)return;const r=t.details?.current_value||0;this.apiOfferData=t;const s=this.findCurrentTierIndex(r);0!==s?(this.canRender=!0,this.currentTierIndex=s,this.currentTier=o.getTierNameByIndex(this.tieredOfferData.tiers,s),this.activeTabTier!==this.currentTier&&(this.activeTabTier=this.currentTier)):this.canRender=!1}getLoadingSkeletonView(){return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-skeleton-wrapper"},t("div",{class:"s-tiered-offer-skeleton-title"},t("salla-skeleton",{height:"16px",width:"40%"})),t("div",{class:"s-tiered-offer-skeleton-subtitle"},t("salla-skeleton",{height:"20px",width:"60%"})),t("div",{class:"s-tiered-offer-skeleton-progress"},t("salla-skeleton",{height:"16px",width:"100%"})),t("div",{class:"s-tiered-offer-skeleton-tabs"},t("salla-skeleton",{height:"50px",width:"100%"})))))}getCurrentTierData(){return o.findTierByIndex(this.tieredOfferData.tiers,this.currentTierIndex)||this.tieredOfferData.tiers[0]}getProgressWidth(){const e=this.tieredOfferData.tiers.length;return this.findCurrentTierIndex(this.apiOfferData.details?.current_value||0)/e*100}calculateMilestonePosition(e,t){return 1===t?"calc(100% - 18px)":`${Math.max(2,Math.min(95,(e+1)/t*100-8/t))}%`}getMilestoneStyles(e,t,r){const s="rtl"===document.documentElement.dir,i=this.calculateMilestonePosition(t,r),o=e.name.length>6?"flex-end":"center";return{[s?"right":"left"]:i,alignItems:o,position:"absolute",transform:s?"translateX(50%)":"translateX(-50%)"}}getMilestoneIconStyles(e,t,r){return t?{color:e.text_color}:r?{color:"var(--color-primary)"}:{}}renderProgressBarBackground(e){return[t("div",{class:"s-tiered-offer-progress-bg"}),t("div",{class:"s-tiered-offer-progress-fill",style:{width:`${e}%`}})]}renderMilestoneIcon(e,r,s){const i=["s-tiered-offer-milestone-icon",r?"s-tiered-offer-milestone-active":"",s?"s-tiered-offer-milestone-completed":""].filter(Boolean).join(" ");return t("div",{class:i,style:this.getMilestoneIconStyles(e,r,s)},t("span",{innerHTML:e.icon}))}renderMilestoneName(e,r){return t("div",{class:"s-tiered-offer-milestone-name"},r&&t("span",{style:{color:e.text_color}},e.name))}renderMilestones(e,r){return t("div",{class:"s-tiered-offer-milestones-wrapper"},t("div",{class:1===r?"s-tiered-offer-single-milestone-justify-end":"s-tiered-offer-milestones"},this.tieredOfferData.tiers.map(((s,i)=>{const o=e>=s.threshold,n=s.tier_name===this.currentTier;return t("div",{class:"s-tiered-offer-milestone",style:this.getMilestoneStyles(s,i,r)},this.renderMilestoneIcon(s,n,o),this.renderMilestoneName(s,n))}))))}renderProgressBar(){const e=this.getProgressWidth(),r=this.tieredOfferData.tiers.length,s=this.apiOfferData.details?.current_value||0;return t("div",{class:"s-tiered-offer-progress-container"},t("div",{class:"s-tiered-offer-progress-wrapper"},this.renderProgressBarBackground(e),this.renderMilestones(s,r)))}renderTabs(){return t("div",{class:"s-tiered-offer-tabs-container"},t("div",{class:"s-tiered-offer-tab-headers"},this.tieredOfferData.tiers.map((e=>t("button",{class:"s-tiered-offer-tab-header "+(e.tier_name===this.activeTabTier?"s-tiered-offer-tab-active":""),onClick:()=>this.handleTabClick(e.tier_name)},t("span",null,e.name))))),t("div",{class:"s-tiered-offer-tab-content-wrapper"},(()=>{const e=o.findTierByName(this.tieredOfferData.tiers,this.activeTabTier);return e?t("div",{class:"s-tiered-offer-tab-content"},t("div",{class:"s-tiered-offer-tab-content-inner"},t("div",{class:"s-tiered-offer-discount-section"},t("p",{class:"s-tiered-offer-discount-title"},this.discountText," ",t("span",{innerHTML:e.discount})),t("p",{class:"s-tiered-offer-benefit-description"},this.benefitText," ",e.name)))):null})()))}render(){if(this.isLoading)return this.getLoadingSkeletonView();if(!this.canRender||!this.tieredOfferData)return null;const e=this.getCurrentTierData();return t(r,null,t("div",{class:"s-tiered-offer-container"},t("div",{class:"s-tiered-offer-header"},t("div",{class:"s-tiered-offer-header-content"},t("p",{class:"s-tiered-offer-program-title"},this.loyaltyProgramText),t("div",{class:"s-tiered-offer-current-tier-name-wrapper"},t("h2",{class:"s-tiered-offer-current-tier"},this.currentTierText," ",t("span",{class:"s-tiered-offer-tier-name"},e.name)),t("span",{innerHTML:e.icon})))),this.renderProgressBar(),this.renderTabs()))}};n.style=".s-tiered-offer-milestone-icon svg{color:currentColor}.s-tiered-offer-milestone-icon svg path{stroke:currentColor;fill:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg path{fill:currentColor;stroke:none}.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-active svg[fill=none] path,.s-tiered-offer-milestone-icon.s-tiered-offer-milestone-completed svg[fill=none] path{fill:none;stroke:currentColor}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-bg{transform:scaleX(-1)}[dir=rtl] .s-tiered-offer-progress-wrapper .s-tiered-offer-progress-fill{transform:scaleX(-1);left:auto}[dir=rtl] .flip-x{transform:scaleX(-1)}";export{n as salla_tiered_offer}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as e,h as s,H as a}from"./p-
|
|
4
|
+
import{r as e,h as s,H as a}from"./p-DPwa4NOx.js";const t=class{constructor(s){e(this,s),this.dark=!1,this.commercialRegisterLabel="",this.freelanceLabel=""}componentWillLoad(){this.initializeTranslations()}initializeTranslations(){salla.lang.onLoaded((()=>{const e=(e,s,a)=>{salla.helpers.setNested(salla.lang.messages[e],s,a)};e("ar.trans","blocks.footer.commercial_register","السجل التجاري"),e("en.trans","blocks.footer.commercial_register","Commercial Register"),e("ar.trans","blocks.footer.freelance","وثيقة العمل الحر"),e("en.trans","blocks.footer.freelance","Freelance Certificate"),this.commercialRegisterLabel=salla.lang.getWithDefault("blocks.footer.commercial_register","السجل التجاري"),this.freelanceLabel=salla.lang.getWithDefault("blocks.footer.freelance","وثيقة العمل الحر")}))}getBadgeData(){const e=salla.config.get("store.settings.commercial_number"),s=salla.config.get("store.settings.freelance_number");return e?{number:e,label:this.commercialRegisterLabel||"السجل التجاري",imageUrl:salla.url.cdn("images/commercial-register.png",70,70),type:"commercial"}:s?{number:s,label:this.freelanceLabel||"وثيقة العمل الحر",imageUrl:this.dark?salla.url.cdn("images/freelance-white.png"):salla.url.cdn("images/freelance.png"),type:"freelance"}:null}render(){const e=this.getBadgeData();return e?s(a,{class:"s-trust-badges-wrapper "+(this.dark?"dark":"")},s("img",{class:"s-trust-badges-image",width:"55",height:"55",src:e.imageUrl,alt:e.label}),s("div",{class:"s-trust-badges-content"},s("p",{class:"s-trust-badges-label"},e.label),s("b",{class:"s-trust-badges-number"},e.number))):null}};t.style="";export{t as salla_trust_badges}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t}from"./p-
|
|
4
|
+
import{r as s,h as t}from"./p-DPwa4NOx.js";import{S as i,A as e}from"./p-yRO-ZESF.js";import{G as c}from"./p-C0JNGIpa.js";const a=class{constructor(t){s(this,t),this.internalOffers=[],this.showAll=!1,this.freeLabel="",this.receivedOffer="",this.discountAmountLabel="",this.showMoreOffers="",this.icons={DiscountCouponIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>discount-coupon</title>\n<path d="M27 28h-22c-0.552 0-1-0.448-1-1v0c0-1.657-1.343-3-3-3v0c-0.552 0-1-0.448-1-1v0-12c0-0.552 0.448-1 1-1v0c1.657 0 3-1.343 3-3v0c0-0.552 0.448-1 1-1v0h22c0.552 0 1 0.448 1 1v0c0 1.657 1.343 3 3 3v0c0.552 0 1 0.448 1 1v0 12c0 0.552-0.448 1-1 1v0c-1.657 0-3 1.343-3 3v0c0 0.552-0.448 1-1 1v0zM5.9 26h20.2c0.415-1.964 1.936-3.485 3.867-3.894l0.033-0.006v-10.2c-1.964-0.415-3.485-1.936-3.894-3.867l-0.006-0.033h-20.2c-0.415 1.964-1.936 3.485-3.867 3.894l-0.033 0.006v10.2c1.964 0.415 3.485 1.936 3.894 3.867l0.006 0.033zM20 7h2v3h-2v-3zM20 12h2v4h-2v-4zM20 18h2v4h-2v-4zM20 24h2v3h-2v-3zM9 16c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM9 12c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM15 24c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM15 20c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM7 24c-0.552-0-1-0.448-1-1 0-0.244 0.088-0.468 0.233-0.642l-0.001 0.002 10-12c0.185-0.221 0.461-0.36 0.769-0.36 0.553 0 1.001 0.448 1.001 1.001 0 0.245-0.088 0.469-0.233 0.643l0.001-0.002-10 12c-0.185 0.22-0.46 0.358-0.767 0.358-0.001 0-0.002 0-0.003 0h0z"></path>\n</svg>\n',GiftIcon:c,FireIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>fire</title>\n<path d="M21.56 3.009c-0.052-0.047-0.116-0.065-0.173-0.103-0.073-0.048-0.143-0.1-0.223-0.132-0.083-0.033-0.165-0.047-0.252-0.063-0.081-0.016-0.16-0.035-0.243-0.035-0.089 0-0.172 0.020-0.26 0.037-0.080 0.016-0.159 0.028-0.236 0.059-0.084 0.035-0.157 0.088-0.235 0.14-0.053 0.036-0.115 0.053-0.165 0.097-0.049 0.044-0.988 0.895-2.288 2.255-2.364-2.839-4.476-4.815-4.576-4.908-0.056-0.052-0.127-0.075-0.188-0.115-0.075-0.049-0.143-0.105-0.224-0.137-0.080-0.032-0.163-0.041-0.245-0.057-0.085-0.016-0.167-0.040-0.252-0.040-0.084 0-0.163 0.023-0.245 0.039-0.087 0.016-0.172 0.025-0.253 0.059-0.080 0.032-0.147 0.087-0.22 0.135-0.063 0.041-0.133 0.064-0.189 0.116-0.453 0.423-11.092 10.408-11.092 18.095 0 7.977 4.935 13.549 12 13.549h8.667c6.673 0 11.333-5.115 11.333-12.439 0-7.052-10.013-16.167-10.44-16.552zM20.667 29.333h-7.777c-2.924 0-4.889-2.044-4.889-5.084 0-2.317 2.816-6.441 4.888-8.887 0.76 0.909 2.755 3.397 3.969 5.869 0.212 0.431 0.639 0.715 1.117 0.743 0.489 0.031 0.937-0.203 1.197-0.605 0.552-0.849 1.109-1.596 1.497-2.093 1.491 1.897 3.331 4.78 3.331 6.399 0 2.188-1.34 3.659-3.333 3.659zM26.537 27.052c0.081-0.44 0.129-0.899 0.129-1.377 0-3.269-3.713-7.847-4.46-8.735l-0.523-0.617c-0.507-0.599-1.528-0.599-2.035 0l-0.531 0.627c-0.147 0.175-0.495 0.599-0.936 1.187-1.595-2.597-3.495-4.776-3.595-4.889l-0.697-0.793c-0.507-0.577-1.499-0.577-2.004 0l-0.697 0.795c-0.6 0.684-5.856 6.803-5.856 11.001 0 0.881 0.127 1.712 0.356 2.484-1.896-1.933-3.023-4.821-3.023-8.283 0-4.915 6.073-11.997 9.329-15.255 1.001 1.008 2.692 2.789 4.368 4.927 0.243 0.309 0.609 0.496 1.001 0.509h0.048c0.376 0 0.735-0.159 0.988-0.439 0.889-0.981 1.693-1.795 2.269-2.359 3.051 2.965 8.663 9.323 8.663 13.727 0 3.171-1.031 5.769-2.796 7.491z"></path>\n</svg>\n',SpecialDiscountIcon:i,TagMoneyIcon:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>tag-money</title>\n<path d="M20.567 11.433c-0.521-0.521-1.364-0.521-1.885 0l-0.524 0.524c-1.28-0.819-3.091-0.681-4.191 0.419-0.631 0.631-0.976 1.468-0.976 2.359 0 0.889 0.347 1.727 0.976 2.357l0.943 0.943c0.171 0.171 0.195 0.368 0.195 0.472s-0.025 0.301-0.196 0.472c-0.169 0.169-0.367 0.195-0.471 0.195s-0.301-0.025-0.472-0.195l-2.357-2.357c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l0.944 0.941-0.472 0.472c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l0.519-0.519c0.54 0.359 1.173 0.553 1.837 0.553 0.892 0 1.729-0.348 2.357-0.976 0.631-0.631 0.976-1.467 0.976-2.357s-0.347-1.727-0.976-2.357l-0.943-0.943c-0.26-0.26-0.26-0.684 0-0.944 0.259-0.259 0.683-0.261 0.944 0l1.885 1.887c0.521 0.521 1.364 0.521 1.885 0 0.521-0.52 0.521-1.364 0-1.885l-0.472-0.472 0.472-0.472c0.521-0.521 0.521-1.365 0.001-1.887zM28 0h-9.344c-1.059 0-2.056 0.411-2.809 1.153l-14.673 14.456c-1.56 1.56-1.561 4.097-0.001 5.657l9.56 9.56c0.755 0.755 1.76 1.172 2.828 1.173h0.003c1.068 0 2.072-0.416 2.833-1.179l14.451-14.668c0.743-0.753 1.153-1.751 1.153-2.809v-9.344c0-2.205-1.795-4-4-4zM29.333 13.344c0 0.353-0.137 0.685-0.385 0.937l-14.444 14.661c-0.252 0.252-0.587 0.391-0.941 0.391-0.001 0-0.001 0-0.001 0-0.356-0.001-0.691-0.139-0.943-0.392l-9.561-9.56c-0.52-0.52-0.52-1.365-0.005-1.88l14.667-14.449c0.253-0.248 0.585-0.385 0.937-0.385h9.344c0.736 0 1.333 0.597 1.333 1.333zM24 6.673c-0.737 0-1.333 0.604-1.333 1.341s0.596 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.015c0-0.737-0.596-1.327-1.333-1.327z"></path>\n</svg>\n'},this.visibleOffersCount=3,this.handleCartItemUpdated=s=>{const t=s.data.cart.items.find((s=>s.id===this.itemId));t?.id===this.itemId&&(this.internalQuantity=t.quantity,this.internalOffers=t.detailed_offers||[],this.internalProductPrice=t.product_price)},this.toggleShowAll=()=>{this.showAll=!this.showAll}}async componentWillLoad(){await Salla.onReady(),await salla.lang.onLoaded((()=>{this.freeLabel=salla.lang.get("common.elements.freeExclam"),this.receivedOffer=salla.lang.get("pages.cart.received_offer"),this.discountAmountLabel=salla.lang.get("pages.cart.discount_amount"),this.showMoreOffers=salla.lang.get("pages.cart.show_more_offers")})),this.internalQuantity=this.quantity,this.internalOffers=this.parseOffers(this.offers),this.internalProductPrice=this.productPrice}componentDidLoad(){salla.event.on("cart::item.updated",(s=>this.handleCartItemUpdated(s)))}parseOffers(s){try{return"string"!=typeof s?(console.warn("Offers is not a string. Returning as-is.",s),Array.isArray(s)?s:[]):JSON.parse(s||"[]")}catch(s){return console.error("Failed to parse offers",s),[]}}get visibleOffers(){return this.internalOffers.slice(0,this.visibleOffersCount)}get hiddenOffers(){return this.internalOffers.slice(this.visibleOffersCount)}getPaidQty(s,t){return s-t.free_quantity}renderOffer(s,i){const e=this.getPaidQty(s,i);return t("div",{class:"s-cart-item-offers-box"},i.free_quantity>0&&e>0&&t("div",{class:"s-cart-item-offers-paid-free"},t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(e)," × ",t("span",{innerHTML:salla.money(this.internalProductPrice)})),t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(i.free_quantity)," ×",t("span",{class:"s-cart-item-offers-regular-price",innerHTML:salla.money(this.internalProductPrice)}),t("span",{class:"s-cart-item-offers-free-label"},this.freeLabel))),t("div",{class:"s-cart-item-offers-details"},t("span",{class:"s-cart-item-offers-icon",innerHTML:this.icons[i.discount_icon]||""}),t("div",null,t("p",{class:"s-cart-item-offers-title"},this.receivedOffer.replace(":offer",i.offer_name)),t("p",{class:"s-cart-item-offers-discount"},t("span",{innerHTML:this.discountAmountLabel.replace(":amount",salla.money(i.discount_amount.toFixed(2)))})))))}render(){return this.internalOffers?.length?t("div",{class:"s-cart-item-offers-container",id:`offers_list_${this.itemId}`},this.visibleOffers.map((s=>this.renderOffer(this.internalQuantity,s))),this.internalOffers?.length>this.visibleOffersCount&&t("div",{class:"s-cart-item-offers-show-more"},t("button",{class:"s-cart-item-offers-show-more-btn",onClick:this.toggleShowAll,type:"button"},t("span",{class:"s-cart-item-offers-show-more-label"},"+",this.hiddenOffers.length," ",this.showMoreOffers,t("span",{innerHTML:e,class:{"s-cart-item-offers-arrow-icon":!0,"s-cart-item-offers-arrow-open":this.showAll}})))),this.showAll&&t("div",{class:"s-cart-item-offers-collapsed",id:`offers_${this.itemId}`},this.hiddenOffers.map((s=>this.renderOffer(this.internalQuantity,s))))):null}};a.style=":host{display:block}";export{a as salla_cart_item_offers}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t}from"./p-
|
|
4
|
+
import{r as s,h as t}from"./p-DPwa4NOx.js";import{I as a}from"./p-uTyAzPSy.js";const e=class{constructor(t){s(this,t),this.codeCopied=null,this.noItemFound=!0,this.order_items=[],this.isDigitalCard=s=>"codes"===s.product.type,this.isDigitalProduct=s=>"digital"===s.product.type}async componentWillLoad(){return salla.lang.onLoaded((()=>{this.codes_text=salla.lang.get("pages.thank_you.codes"),this.copy_text=salla.lang.get("common.elements.copy"),this.files_text=salla.lang.get("pages.thank_you.files"),this.download_text=salla.lang.get("pages.thank_you.download")})),await this.getOrderItems()}copyToClipboardHandler(s){if(navigator&&"clipboard"in navigator)try{navigator.clipboard.writeText(s).then((()=>{this.codeCopied=s,this.copyCodeButtonTimeout=setTimeout((()=>{this.codeCopied=null}),3e3)}))}catch(s){salla.loggers.error("copy functionality is not supported by the browser")}}async getOrderItems(){const s=this.orderId||salla.config.get("page.id"),t="Failed to fetch order items";if(!s)throw salla.logger.error(t),new Error(t);try{const{data:{items:t=[]}}=await salla.api.request(`orders/${s}`);t.some((s=>this.isDigitalCard(s)||this.isDigitalProduct(s)))&&(this.order_items=t,this.noItemFound=!1)}catch(s){salla.logger.error(t)}}disconnectedCallback(){this.copyCodeButtonTimeout&&clearTimeout(this.copyCodeButtonTimeout)}render(){return t("ul",{key:"75e332734c187402dcf43b73ae3d464559893203",class:"s-order-summary-wrapper"},this.noItemFound?t("salla-placeholder",{alignment:"center"},t("span",{slot:"title"})):this.order_items.map((s=>this.isDigitalCard(s)?t("li",{key:s.product.id,class:"s-order-summary-item"},t("h2",{class:"s-order-summary-item-title"},this.codes_text," (",s.name,")"),s.codes.map((s=>t("div",{key:s.code,class:"s-order-summary-code-item-wrapper"},t("p",null,t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>debit-card-back</title>\n<path d="M30 28h-28c-1.105 0-2-0.895-2-2v0-18c0-1.105 0.895-2 2-2v0h28c1.105 0 2 0.895 2 2v0 18c0 1.105-0.895 2-2 2v0zM30 26v0zM2 8v18h28v-18zM31 14h-30c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h30c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM11 22h-6c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h6c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM24 24c-2.209 0-4-1.791-4-4s1.791-4 4-4c2.209 0 4 1.791 4 4v0c0 2.209-1.791 4-4 4v0zM24 18c-1.105 0-2 0.895-2 2s0.895 2 2 2c1.105 0 2-0.895 2-2v0c0-1.105-0.895-2-2-2v0zM20 24c-2.209 0-4-1.791-4-4s1.791-4 4-4v0c0.002 0 0.005 0 0.007 0 1.032 0 1.972 0.398 2.673 1.048l-0.003-0.002c0.191 0.183 0.311 0.439 0.311 0.724 0 0.552-0.448 1-1 1-0.257 0-0.492-0.097-0.669-0.257l0.001 0.001c-0.345-0.319-0.807-0.514-1.315-0.514-0.002 0-0.003 0-0.005 0h0c-1.105 0-2 0.895-2 2s0.895 2 2 2v0c0.002 0 0.004 0 0.007 0 0.508 0 0.971-0.195 1.317-0.515l-0.001 0.001c0.179-0.171 0.422-0.276 0.689-0.276 0.552 0 1 0.448 1 1 0 0.295-0.128 0.56-0.331 0.743l-0.001 0.001c-0.699 0.648-1.638 1.046-2.671 1.046-0.003 0-0.007 0-0.010 0h0.001z"></path>\n</svg>\n'}),t("span",null,s.code)),t("salla-button",{class:"s-order-summary-item-copy-button "+(this.codeCopied===s.code?"copied":""),onClick:()=>this.copyToClipboardHandler(s.code),shape:"link"},t("span",{innerHTML:this.codeCopied===s.code?a:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>swap-stroke</title>\n<path d="M6.667 18.667h-2.667c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333v2.667c0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h2.667c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM28 10.667h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM29.333 28c0 0.736-0.597 1.333-1.333 1.333h-13.333c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333z"></path>\n</svg>\n'}),t("span",null,this.copy_text)))))):this.isDigitalProduct(s)?t("li",{key:s.product.id,class:"s-order-summary-item"},t("h2",{class:"s-order-summary-item-title"},this.files_text," (",s.name,")"),t("ul",null,s.files.map((s=>t("li",{class:"s-order-summary-digital-item-wrapper"},t("div",null,t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>file-archive</title>\n<path d="M17.333 16h-5.333c-0.737 0-1.333 0.597-1.333 1.333v2.667c0 2.205 1.795 4 4 4s4-1.795 4-4v-2.667c0-0.736-0.596-1.333-1.333-1.333zM16 20c0 0.735-0.597 1.333-1.333 1.333s-1.333-0.599-1.333-1.333v-1.333h2.667zM17.333 12h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM28.943 8.391l-8-8c-0.249-0.251-0.588-0.391-0.943-0.391h-13.333c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h18.667c2.205 0 4-1.795 4-4v-18.667c0-0.353-0.14-0.693-0.391-0.943zM26.667 28c0 0.735-0.597 1.333-1.333 1.333h-18.667c-0.736 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.597-1.333 1.333-1.333h12.781l7.219 7.219zM17.333 8h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM17.333 4h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333z"></path>\n</svg>\n'}),t("span",null,s.name)),t("a",{href:s.url,target:"_blank",class:"s-order-summary-item-download"},t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>download</title>\n<path d="M15.056 20.941c0.123 0.124 0.271 0.221 0.435 0.289 0.163 0.067 0.336 0.103 0.509 0.103s0.347-0.036 0.509-0.103c0.164-0.068 0.311-0.165 0.435-0.289l5.332-5.332c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-3.057 3.057v-12.781c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v12.781l-3.057-3.057c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885zM25.333 26.667h-18.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h18.667c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>\n</svg>\n'}),t("span",null,this.download_text))))))):null)))}};e.style=":host{display:block}";export{e as salla_order_summary}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{d as t}from"./p-CS3HDvos.js";function n(t,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(i){if("default"!==i&&!(i in t)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}}))})),Object.freeze(t)}var i,r={exports:{}},e=(i||(i=1,r.exports=function(){function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var i=[],r=!0,e=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(i.push(o.value),i.length!==n);r=!0);}catch(t){e=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(e)throw a}}return i}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var n=function(t,n){return e(t.x*n,t.y*n)},i=function(t,n){return e(t.x+n.x,t.y+n.y)},r=function(t,n,i){var r=Math.cos(n),a=Math.sin(n),o=e(t.x-i.x,t.y-i.y);return e(i.x+r*o.x-a*o.y,i.y+a*o.x+r*o.y)},e=function(){return{x:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,y:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0}},a=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0;return"string"==typeof t?parseFloat(t)*i:"number"==typeof t?t*(r?n[r]:Math.min(n.width,n.height)):void 0},o=function(t){return null!=t},u=function(t,n){return Object.keys(n).forEach((function(i){return t.setAttribute(i,n[i])}))},c=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg",t);return n&&u(i,n),i},f={contain:"xMidYMid meet",cover:"xMidYMid slice"},E={left:"start",center:"middle",right:"end"},_=function(t){return function(n){return c(t,{id:n.id})}},s={image:function(t){var n=c("image",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0"});return n.onload=function(){n.setAttribute("opacity",t.opacity||1)},n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.src),n},rect:_("rect"),ellipse:_("ellipse"),text:_("text"),path:_("path"),line:function(t){var n=c("g",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round"}),i=c("line");n.appendChild(i);var r=c("path");n.appendChild(r);var e=c("path");return n.appendChild(e),n}},l={rect:function(t){return u(t,Object.assign({},t.rect,t.styles))},ellipse:function(t){return u(t,Object.assign({cx:t.rect.x+.5*t.rect.width,cy:t.rect.y+.5*t.rect.height,rx:.5*t.rect.width,ry:.5*t.rect.height},t.styles))},image:function(t,n){u(t,Object.assign({},t.rect,t.styles,{preserveAspectRatio:f[n.fit]||"none"}))},text:function(t,n,i,r){var e=a(n.fontSize,i,r);u(t,Object.assign({},t.rect,t.styles,{"stroke-width":0,"font-weight":n.fontWeight||"normal","font-size":e,"font-family":n.fontFamily||"sans-serif","text-anchor":E[n.textAlign]||"start"})),t.text!==n.text&&(t.text=n.text,t.textContent=n.text.length?n.text:" ")},path:function(t,n,i,r){var e;u(t,Object.assign({},t.styles,{fill:"none",d:(e=n.points.map((function(t){return{x:a(t.x,i,r,"width"),y:a(t.y,i,r,"height")}})),e.map((function(t,n){return"".concat(0===n?"M":"L"," ").concat(t.x," ").concat(t.y)})).join(" "))}))},line:function(t,o,c,f){u(t,Object.assign({},t.rect,t.styles,{fill:"none"}));var E=t.childNodes[1],_=t.childNodes[2],s=t.rect,l={x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height};if(u(t.childNodes[0],{x1:s.x,y1:s.y,x2:l.x,y2:l.y}),o.lineDecoration){E.style.display="none",_.style.display="none";var v=function(t){var n=Math.sqrt(t.x*t.x+t.y*t.y);return 0===n?{x:0,y:0}:e(t.x/n,t.y/n)}({x:l.x-s.x,y:l.y-s.y}),h=a(.05,c,f);if(-1!==o.lineDecoration.indexOf("arrow-begin")){var I=n(v,h),d=i(s,I),p=r(s,2,d),M=r(s,-2,d);u(E,{style:"display:block;",d:"M".concat(p.x,",").concat(p.y," L").concat(s.x,",").concat(s.y," L").concat(M.x,",").concat(M.y)})}if(-1!==o.lineDecoration.indexOf("arrow-end")){var g=n(v,-h),m=i(l,g),T=r(l,2,m),A=r(l,-2,m);u(_,{style:"display:block;",d:"M".concat(T.x,",").concat(T.y," L").concat(l.x,",").concat(l.y," L").concat(A.x,",").concat(A.y)})}}}},v=function(t,n,i,r,e){"path"!==n&&(t.rect=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=a(t.x,n,i,"width")||a(t.left,n,i,"width"),e=a(t.y,n,i,"height")||a(t.top,n,i,"height"),u=a(t.width,n,i,"width"),c=a(t.height,n,i,"height"),f=a(t.right,n,i,"width"),E=a(t.bottom,n,i,"height");return o(e)||(e=o(c)&&o(E)?n.height-c-E:E),o(r)||(r=o(u)&&o(f)?n.width-u-f:f),o(u)||(u=o(r)&&o(f)?n.width-r-f:0),o(c)||(c=o(e)&&o(E)?n.height-e-E:0),{x:r||0,y:e||0,width:u||0,height:c||0}}(i,r,e)),t.styles=function(t,n,i){var r=t.borderStyle||t.lineStyle||"solid",e=t.backgroundColor||t.fontColor||"transparent",o=t.borderColor||t.lineColor||"transparent",u=a(t.borderWidth||t.lineWidth,n,i);return{"stroke-linecap":t.lineCap||"round","stroke-linejoin":t.lineJoin||"round","stroke-width":u||0,"stroke-dasharray":"string"==typeof r?"":r.map((function(t){return a(t,n,i)})).join(","),stroke:o,fill:e,opacity:t.opacity||1}}(i,r,e),l[n](t,i,r,e)},h=["x","y","left","top","right","bottom","width","height"],I=function(n){var i=t(n,2),r=i[0],e=i[1],a=e.points?{}:h.reduce((function(t,n){return t[n]="string"==typeof(i=e[n])&&/%/.test(i)?parseFloat(i)/100:i,t;var i}),{});return[r,Object.assign({zIndex:0},e,a)]},d=function(t,n){return t[1].zIndex>n[1].zIndex?1:t[1].zIndex<n[1].zIndex?-1:0},p=function(n){return n.utils.createView({name:"image-preview-markup",tag:"svg",ignoreRect:!0,mixins:{apis:["width","height","crop","markup","resize","dirty"]},write:function(n){var i=n.root,r=n.props;if(r.dirty){var e=r.crop,a=r.resize,o=r.markup,u=r.width,c=r.height,f=e.width,E=e.height;if(a){var _=a.size,l=_&&_.width,h=_&&_.height,p=a.mode;l&&!h&&(h=l),h&&!l&&(l=h);var M=f<l&&E<h;if(!M||M&&a.upscale){var g,m=l/f,T=h/E;"force"===p?(f=l,E=h):("cover"===p?g=Math.max(m,T):"contain"===p&&(g=Math.min(m,T)),f*=g,E*=g)}}var A={width:u,height:c};i.element.setAttribute("width",A.width),i.element.setAttribute("height",A.height);var w=Math.min(u/f,c/E);i.element.innerHTML="";var R=i.query("GET_IMAGE_PREVIEW_MARKUP_FILTER");o.filter(R).map(I).sort(d).forEach((function(n){var r=t(n,2),e=r[0],a=r[1],o=function(t,n){return s[t](n)}(e,a);v(o,e,a,A,w),i.element.appendChild(o)}))}}})},M=function(t,n){return{x:t,y:n}},g=function(t,n){return M(t.x-n.x,t.y-n.y)},m=function(t,n){return Math.sqrt(function(t,n){return function(t,n){return t.x*n.x+t.y*n.y}(g(t,n),g(t,n))}(t,n))},T=function(t,n){var i=t,r=n,e=1.5707963267948966-n,a=Math.sin(1.5707963267948966),o=Math.sin(r),u=Math.sin(e),c=Math.cos(e),f=i/a;return M(c*(f*o),c*(f*u))},A=function(t,n,i,r){var e=2*(r.x>.5?1-r.x:r.x)*t.width,a=2*(r.y>.5?1-r.y:r.y)*t.height,o=function(t,n){var i=t.height,r=T(t.width,n),e=T(i,n),a=M(t.x+Math.abs(r.x),t.y-Math.abs(r.y)),o=M(t.x+t.width+Math.abs(e.y),t.y+Math.abs(e.x)),u=M(t.x-Math.abs(e.y),t.y+t.height-Math.abs(e.x));return{width:m(a,o),height:m(a,u)}}(n,i);return Math.max(o.width/e,o.height/a)},w=function(t,n){var i=t.width,r=i*n;return r>t.height&&(i=(r=t.height)/n),{x:.5*(t.width-i),y:.5*(t.height-r),width:i,height:r}},R=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.zoom,r=n.rotation,e=n.center,a=n.aspectRatio;a||(a=t.height/t.width);var o=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t.height/t.width,e=1,a=r;a>n&&(e=(a=n)/r);var o=Math.max(1/e,n/a),u=t.width/(i*o*e);return{width:u,height:u*n}}(t,a,i),u=void 0===n.scaleToFit||n.scaleToFit,c=i*A(t,w({width:o.width,height:o.height},a),r,u?e:{x:.5,y:.5});return{widthFloat:o.width/c,heightFloat:o.height/c,width:Math.round(o.width/c),height:Math.round(o.height/c)}},y={type:"spring",stiffness:.5,damping:.45,mass:10},G=function(t){return t.utils.createView({name:"image-clip",tag:"div",ignoreRect:!0,mixins:{apis:["crop","markup","resize","width","height","dirty","background"],styles:["width","height","opacity"],animations:{opacity:{type:"tween",duration:250}}},didWriteView:function(t){var n=t.props;n.background&&(t.root.element.style.backgroundColor=n.background)},create:function(n){var i=n.root,r=n.props;i.ref.image=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-canvas-wrapper",tag:"div",ignoreRect:!0,mixins:{apis:["crop","width","height"],styles:["originX","originY","translateX","translateY","scaleX","scaleY","rotateZ"],animations:{originX:y,originY:y,scaleX:y,scaleY:y,translateX:y,translateY:y,rotateZ:y}},create:function(n){var i=n.root,r=n.props;r.width=r.image.width,r.height=r.image.height,i.ref.bitmap=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-bitmap",ignoreRect:!0,mixins:{styles:["scaleX","scaleY"]},create:function(t){t.root.appendChild(t.props.image)}})}(t),{image:r.image}))},write:function(t){var n=t.props.crop.flip,i=t.root.ref.bitmap;i.scaleX=n.horizontal?-1:1,i.scaleY=n.vertical?-1:1}})}(t),Object.assign({},r))),i.ref.createMarkup=function(){i.ref.markup||(i.ref.markup=i.appendChildView(i.createChildView(p(t),Object.assign({},r))))},i.ref.destroyMarkup=function(){i.ref.markup&&(i.removeChildView(i.ref.markup),i.ref.markup=null)};var e=i.query("GET_IMAGE_PREVIEW_TRANSPARENCY_INDICATOR");null!==e&&(i.element.dataset.transparencyIndicator="grid"===e?e:"color")},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=i.crop,a=i.markup,o=i.resize,u=i.dirty,c=i.width,f=i.height;n.ref.image.crop=e;var E={width:c,height:f,center:{x:.5*c,y:.5*f}},_={width:n.ref.image.width,height:n.ref.image.height},s={x:e.center.x*_.width,y:e.center.y*_.height},l={x:E.center.x-_.width*e.center.x,y:E.center.y-_.height*e.center.y},v=2*Math.PI+e.rotation%(2*Math.PI),h=void 0===e.scaleToFit||e.scaleToFit,I=A(_,w(E,e.aspectRatio||_.height/_.width),v,h?e.center:{x:.5,y:.5}),d=e.zoom*I;a&&a.length?(n.ref.createMarkup(),n.ref.markup.width=c,n.ref.markup.height=f,n.ref.markup.resize=o,n.ref.markup.dirty=u,n.ref.markup.markup=a,n.ref.markup.crop=R(_,e)):n.ref.markup&&n.ref.destroyMarkup();var p=n.ref.image;if(r)return p.originX=null,p.originY=null,p.translateX=null,p.translateY=null,p.rotateZ=null,p.scaleX=null,void(p.scaleY=null);p.originX=s.x,p.originY=s.y,p.translateX=l.x,p.translateY=l.y,p.rotateZ=v,p.scaleX=d,p.scaleY=d}})},P=0,D=function(){self.onmessage=function(t){createImageBitmap(t.data.message.file).then((function(n){self.postMessage({id:t.data.id,message:n},[n])}))}},O=function(){self.onmessage=function(t){for(var n=t.data.message.imageData,i=t.data.message.colorMatrix,r=n.data,e=r.length,a=i[0],o=i[1],u=i[2],c=i[3],f=i[4],E=i[5],_=i[6],s=i[7],l=i[8],v=i[9],h=i[10],I=i[11],d=i[12],p=i[13],M=i[14],g=i[15],m=i[16],T=i[17],A=i[18],w=i[19],R=0,y=0,G=0,P=0,D=0;R<e;R+=4)y=r[R]/255,G=r[R+1]/255,P=r[R+2]/255,D=r[R+3]/255,r[R]=Math.max(0,Math.min(255*(y*a+G*o+P*u+D*c+f),255)),r[R+1]=Math.max(0,Math.min(255*(y*E+G*_+P*s+D*l+v),255)),r[R+2]=Math.max(0,Math.min(255*(y*h+G*I+P*d+D*p+M),255)),r[R+3]=Math.max(0,Math.min(255*(y*g+G*m+P*T+D*A+w),255));self.postMessage({id:t.data.id,message:n},[n.data.buffer])}},x={1:function(){return[1,0,0,1,0,0]},2:function(t){return[-1,0,0,1,t,0]},3:function(t,n){return[-1,0,0,-1,t,n]},4:function(t,n){return[1,0,0,-1,0,n]},5:function(){return[0,1,1,0,0,0]},6:function(t,n){return[0,1,-1,0,n,0]},7:function(t,n){return[0,-1,-1,0,n,t]},8:function(t){return[0,-1,1,0,0,t]}},L=function(t,n,i,r){n=Math.round(n),i=Math.round(i);var e=document.createElement("canvas");e.width=n,e.height=i;var a=e.getContext("2d");if(r>=5&&r<=8){var o=[i,n];n=o[0],i=o[1]}return function(t,n,i,r){-1!==r&&t.transform.apply(t,x[r](n,i))}(a,n,i,r),a.drawImage(t,0,0,n,i),e},C=function(t){return/^image/.test(t.type)&&!/svg/.test(t.type)},W=function(t){var n=Math.min(10/t.width,10/t.height),i=document.createElement("canvas"),r=i.getContext("2d"),e=i.width=Math.ceil(t.width*n),a=i.height=Math.ceil(t.height*n);r.drawImage(t,0,0,e,a);var o=null;try{o=r.getImageData(0,0,e,a).data}catch(t){return null}for(var u=o.length,c=0,f=0,E=0,_=0;_<u;_+=4)c+=o[_]*o[_],f+=o[_+1]*o[_+1],E+=o[_+2]*o[_+2];return{r:c=S(c,u),g:f=S(f,u),b:E=S(E,u)}},S=function(t,n){return Math.floor(Math.sqrt(t/(n/4)))},k=function(t){var n=t.utils.createView({name:"image-preview-overlay",tag:"div",ignoreRect:!0,create:function(t){var n=t.root,i=t.props,r='<svg width="500" height="200" viewBox="0 0 500 200" preserveAspectRatio="none">\n <defs>\n <radialGradient id="gradient-__UID__" cx=".5" cy="1.25" r="1.15">\n <stop offset=\'50%\' stop-color=\'#000000\'/>\n <stop offset=\'56%\' stop-color=\'#0a0a0a\'/>\n <stop offset=\'63%\' stop-color=\'#262626\'/>\n <stop offset=\'69%\' stop-color=\'#4f4f4f\'/>\n <stop offset=\'75%\' stop-color=\'#808080\'/>\n <stop offset=\'81%\' stop-color=\'#b1b1b1\'/>\n <stop offset=\'88%\' stop-color=\'#dadada\'/>\n <stop offset=\'94%\' stop-color=\'#f6f6f6\'/>\n <stop offset=\'100%\' stop-color=\'#ffffff\'/>\n </radialGradient>\n <mask id="mask-__UID__">\n <rect x="0" y="0" width="500" height="200" fill="url(#gradient-__UID__)"></rect>\n </mask>\n </defs>\n <rect x="0" width="500" height="200" fill="currentColor" mask="url(#mask-__UID__)"></rect>\n</svg>';if(document.querySelector("base")){var e=new URL(window.location.href.replace(window.location.hash,"")).href;r=r.replace(/url\(\#/g,"url("+e+"#")}P++,n.element.classList.add("filepond--image-preview-overlay-".concat(i.status)),n.element.innerHTML=r.replace(/__UID__/g,P)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),i=function(t){return t.utils.createView({name:"image-preview",tag:"div",ignoreRect:!0,mixins:{apis:["image","crop","markup","resize","dirty","background"],styles:["translateY","scaleX","scaleY","opacity"],animations:{scaleX:y,scaleY:y,translateY:y,opacity:{type:"tween",duration:400}}},create:function(n){var i=n.root,r=n.props;i.ref.clip=i.appendChildView(i.createChildView(G(t),{id:r.id,image:r.image,crop:r.crop,markup:r.markup,resize:r.resize,dirty:r.dirty,background:r.background}))},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=n.ref.clip,a=i.image,o=i.crop,u=i.markup,c=i.resize,f=i.dirty;if(e.crop=o,e.markup=u,e.resize=c,e.dirty=f,e.opacity=r?0:1,!r&&!n.rect.element.hidden){var E=o.aspectRatio||a.height/a.width,_=n.rect.inner.width,s=n.rect.inner.height,l=n.query("GET_IMAGE_PREVIEW_HEIGHT"),v=n.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),h=n.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),I=n.query("GET_PANEL_ASPECT_RATIO"),d=n.query("GET_ALLOW_MULTIPLE");I&&!d&&(l=_*I,E=I);var p=null!==l?l:Math.max(v,Math.min(_*E,h)),M=p/E;M>_&&(p=(M=_)*E),p>s&&(p=s,M=s/E),e.width=M,e.height=p}}})}(t),r=t.utils.createWorker,e=function(t,n,i){return new Promise((function(e){t.ref.imageData||(t.ref.imageData=i.getContext("2d").getImageData(0,0,i.width,i.height));var a=function(t){var n;try{n=new ImageData(t.width,t.height)}catch(i){n=document.createElement("canvas").getContext("2d").createImageData(t.width,t.height)}return n.data.set(new Uint8ClampedArray(t.data)),n}(t.ref.imageData);if(!n||20!==n.length)return i.getContext("2d").putImageData(a,0,0),e();var o=r(O);o.post({imageData:a,colorMatrix:n},(function(t){i.getContext("2d").putImageData(t,0,0),o.terminate(),e()}),[a.data.buffer])}))},a=function(t){var n=t.root,r=t.image,e=t.props.id,a=n.query("GET_ITEM",{id:e});if(a){var o,u,c=a.getMetadata("crop")||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},f=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),E=!1;n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(o=a.getMetadata("markup")||[],u=a.getMetadata("resize"),E=!0);var _=n.appendChildView(n.createChildView(i,{id:e,image:r,crop:c,resize:u,markup:o,dirty:E,background:f,opacity:0,scaleX:1.15,scaleY:1.15,translateY:15}),n.childViews.length);n.ref.images.push(_),_.opacity=1,_.scaleX=1,_.scaleY=1,_.translateY=0,setTimeout((function(){n.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:e})}),250)}},o=function(t){var n=t.root;n.ref.overlayShadow.opacity=1,n.ref.overlayError.opacity=0,n.ref.overlaySuccess.opacity=0},u=function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlayError.opacity=1};return t.utils.createView({name:"image-preview-wrapper",create:function(t){var i=t.root;i.ref.images=[],i.ref.imageData=null,i.ref.imageViewBin=[],i.ref.overlayShadow=i.appendChildView(i.createChildView(n,{opacity:0,status:"idle"})),i.ref.overlaySuccess=i.appendChildView(i.createChildView(n,{opacity:0,status:"success"})),i.ref.overlayError=i.appendChildView(i.createChildView(n,{opacity:0,status:"failure"}))},styles:["height"],apis:["height"],destroy:function(t){t.root.ref.images.forEach((function(t){t.image.width=1,t.image.height=1}))},didWriteView:function(t){t.root.ref.images.forEach((function(t){t.dirty=!1}))},write:t.utils.createRoute({DID_IMAGE_PREVIEW_DRAW:function(t){var n=t.root,i=n.ref.images[n.ref.images.length-1];i.translateY=0,i.scaleX=1,i.scaleY=1,i.opacity=1},DID_IMAGE_PREVIEW_CONTAINER_CREATE:function(t){var n,i,r,e=t.root,a=t.props.id,o=e.query("GET_ITEM",a);if(o){var u=URL.createObjectURL(o.file);n=u,i=function(t,n){e.dispatch("DID_IMAGE_PREVIEW_CALCULATE_SIZE",{id:a,width:t,height:n})},(r=new Image).onload=function(){var t=r.naturalWidth,n=r.naturalHeight;r=null,i(t,n)},r.src=n}},DID_FINISH_CALCULATE_PREVIEWSIZE:function(t){var n,i,o,u=t.root,c=t.props,f=u.query("GET_ITEM",c.id);if(f){var E=URL.createObjectURL(f.file),_=function(){var t;(t=E,new Promise((function(n,i){var r=new Image;r.crossOrigin="Anonymous",r.onload=function(){n(r)},r.onerror=function(t){i(t)},r.src=t}))).then(s)},s=function(t){URL.revokeObjectURL(E);var n=(f.getMetadata("exif")||{}).orientation||-1,i=t.width,r=t.height;if(i&&r){if(n>=5&&n<=8){var o=[r,i];i=o[0],r=o[1]}var _=Math.max(1,.75*window.devicePixelRatio),s=u.query("GET_IMAGE_PREVIEW_ZOOM_FACTOR")*_,l=r/i,v=u.rect.element.width,h=u.rect.element.height,I=v,d=I*l;l>1?d=(I=Math.min(i,v*s))*l:I=(d=Math.min(r,h*s))/l;var p=L(t,I,d,n),M=function(){var n=u.query("GET_IMAGE_PREVIEW_CALCULATE_AVERAGE_IMAGE_COLOR")?W(data):null;f.setMetadata("color",n,!0),"close"in t&&t.close(),u.ref.overlayShadow.opacity=1,a({root:u,props:c,image:p})},g=f.getMetadata("filter");g?e(u,g,p).then(M):M()}};if(n=f.file,i=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./),null!==(o=i?parseInt(i[1]):null)&&o<=58||!("createImageBitmap"in window)||!C(n))_();else{var l=r(D);l.post({file:f.file},(function(t){l.terminate(),t?s(t):_()}))}}},DID_UPDATE_ITEM_METADATA:function(t){var n,i,r=t.root,o=t.props,u=t.action;if(/crop|filter|markup|resize/.test(u.change.key)&&r.ref.images.length){var c=r.query("GET_ITEM",{id:o.id});if(c)if(/filter/.test(u.change.key))e(r,u.change.value,r.ref.images[r.ref.images.length-1].image);else if(/crop|markup|resize/.test(u.change.key)){var f=c.getMetadata("crop"),E=r.ref.images[r.ref.images.length-1];if(f&&f.aspectRatio&&E.crop&&E.crop.aspectRatio&&Math.abs(f.aspectRatio-E.crop.aspectRatio)>1e-5){var _=function(t){var n=t.root,i=n.ref.images.shift();return i.opacity=0,i.translateY=-15,n.ref.imageViewBin.push(i),i}({root:r});a({root:r,props:o,image:(n=_.image,(i=i||document.createElement("canvas")).width=n.width,i.height=n.height,i.getContext("2d").drawImage(n,0,0),i)})}else!function(t){var n=t.root,i=n.query("GET_ITEM",{id:t.props.id});if(i){var r=n.ref.images[n.ref.images.length-1];r.crop=i.getMetadata("crop"),r.background=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(r.dirty=!0,r.resize=i.getMetadata("resize"),r.markup=i.getMetadata("markup"))}}({root:r,props:o})}}},DID_THROW_ITEM_LOAD_ERROR:u,DID_THROW_ITEM_PROCESSING_ERROR:u,DID_THROW_ITEM_INVALID:u,DID_COMPLETE_ITEM_PROCESSING:function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlaySuccess.opacity=1},DID_START_ITEM_PROCESSING:o,DID_REVERT_ITEM_PROCESSING:o},(function(t){var n=t.root,i=n.ref.imageViewBin.filter((function(t){return 0===t.opacity}));n.ref.imageViewBin=n.ref.imageViewBin.filter((function(t){return t.opacity>0})),i.forEach((function(t){return function(t,n){t.removeChildView(n),n.image.width=1,n.image.height=1,n._destroy()}(n,t)})),i.length=0}))})},V=function(t){var n=t.addFilter,i=t.utils,r=i.Type,e=i.createRoute,a=i.isFile,o=k(t);return n("CREATE_VIEW",(function(t){var n=t.view,i=t.query;if((0,t.is)("file")&&i("GET_ALLOW_IMAGE_PREVIEW")){var r=function(t){t.root.ref.shouldRescale=!0};n.registerWriter(e({DID_RESIZE_ROOT:r,DID_STOP_RESIZE:r,DID_LOAD_ITEM:function(t){var r=t.root,e=t.props.id,u=i("GET_ITEM",e);if(u&&a(u.file)&&!u.archived){var c=u.file;if(function(t){return/^image/.test(t.type)}(c)&&i("GET_IMAGE_PREVIEW_FILTER_ITEM")(u)){var f="createImageBitmap"in(window||{}),E=i("GET_IMAGE_PREVIEW_MAX_FILE_SIZE");if(!(!f&&E&&c.size>E)){r.ref.imagePreview=n.appendChildView(n.createChildView(o,{id:e}));var _=r.query("GET_IMAGE_PREVIEW_HEIGHT");_&&r.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:u.id,height:_});var s=!f&&c.size>i("GET_IMAGE_PREVIEW_MAX_INSTANT_PREVIEW_FILE_SIZE");r.dispatch("DID_IMAGE_PREVIEW_CONTAINER_CREATE",{id:e},s)}}}},DID_IMAGE_PREVIEW_CALCULATE_SIZE:function(t){var n=t.root,i=t.action;n.ref.imageWidth=i.width,n.ref.imageHeight=i.height,n.ref.shouldRescale=!0,n.ref.shouldDrawPreview=!0,n.dispatch("KICK")},DID_UPDATE_ITEM_METADATA:function(t){"crop"===t.action.change.key&&(t.root.ref.shouldRescale=!0)}},(function(t){var n=t.root,i=t.props;n.ref.imagePreview&&(n.rect.element.hidden||(n.ref.shouldRescale&&(function(t,n){if(t.ref.imagePreview){var i=t.query("GET_ITEM",{id:n.id});if(i){var r=t.query("GET_PANEL_ASPECT_RATIO"),e=t.query("GET_ITEM_PANEL_ASPECT_RATIO"),a=t.query("GET_IMAGE_PREVIEW_HEIGHT");if(!(r||e||a)){var o=t.ref,u=o.imageWidth,c=o.imageHeight;if(u&&c){var f=t.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),E=t.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),_=(i.getMetadata("exif")||{}).orientation||-1;if(_>=5&&_<=8){var s=[c,u];u=s[0],c=s[1]}if(!C(i.file)||t.query("GET_IMAGE_PREVIEW_UPSCALE")){var l=2048/u;u*=l,c*=l}var v=c/u,h=(i.getMetadata("crop")||{}).aspectRatio||v,I=Math.max(f,Math.min(c,E)),d=Math.min(t.rect.element.width*h,I);t.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:i.id,height:d})}}}}}(n,i),n.ref.shouldRescale=!1),n.ref.shouldDrawPreview&&(requestAnimationFrame((function(){requestAnimationFrame((function(){n.dispatch("DID_FINISH_CALCULATE_PREVIEWSIZE",{id:i.id})}))})),n.ref.shouldDrawPreview=!1)))})))}})),{options:{allowImagePreview:[!0,r.BOOLEAN],imagePreviewFilterItem:[function(){return!0},r.FUNCTION],imagePreviewHeight:[null,r.INT],imagePreviewMinHeight:[44,r.INT],imagePreviewMaxHeight:[256,r.INT],imagePreviewMaxFileSize:[null,r.INT],imagePreviewZoomFactor:[2,r.INT],imagePreviewUpscale:[!1,r.BOOLEAN],imagePreviewMaxInstantPreviewFileSize:[1e6,r.INT],imagePreviewTransparencyIndicator:[null,r.STRING],imagePreviewCalculateAverageImageColor:[!1,r.BOOLEAN],imagePreviewMarkupShow:[!0,r.BOOLEAN],imagePreviewMarkupFilter:[function(){return!0},r.FUNCTION]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:V})),V}()),r.exports),a=n({__proto__:null,default:t(e)},[e]);
|
|
4
|
+
import{d as t}from"./p-DPwa4NOx.js";function n(t,n){return n.forEach((function(n){n&&"string"!=typeof n&&!Array.isArray(n)&&Object.keys(n).forEach((function(i){if("default"!==i&&!(i in t)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}}))})),Object.freeze(t)}var i,r={exports:{}},e=(i||(i=1,r.exports=function(){function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var i=[],r=!0,e=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(i.push(o.value),i.length!==n);r=!0);}catch(t){e=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(e)throw a}}return i}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var n=function(t,n){return e(t.x*n,t.y*n)},i=function(t,n){return e(t.x+n.x,t.y+n.y)},r=function(t,n,i){var r=Math.cos(n),a=Math.sin(n),o=e(t.x-i.x,t.y-i.y);return e(i.x+r*o.x-a*o.y,i.y+a*o.x+r*o.y)},e=function(){return{x:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,y:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0}},a=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0;return"string"==typeof t?parseFloat(t)*i:"number"==typeof t?t*(r?n[r]:Math.min(n.width,n.height)):void 0},o=function(t){return null!=t},u=function(t,n){return Object.keys(n).forEach((function(i){return t.setAttribute(i,n[i])}))},c=function(t,n){var i=document.createElementNS("http://www.w3.org/2000/svg",t);return n&&u(i,n),i},f={contain:"xMidYMid meet",cover:"xMidYMid slice"},E={left:"start",center:"middle",right:"end"},_=function(t){return function(n){return c(t,{id:n.id})}},s={image:function(t){var n=c("image",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0"});return n.onload=function(){n.setAttribute("opacity",t.opacity||1)},n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.src),n},rect:_("rect"),ellipse:_("ellipse"),text:_("text"),path:_("path"),line:function(t){var n=c("g",{id:t.id,"stroke-linecap":"round","stroke-linejoin":"round"}),i=c("line");n.appendChild(i);var r=c("path");n.appendChild(r);var e=c("path");return n.appendChild(e),n}},l={rect:function(t){return u(t,Object.assign({},t.rect,t.styles))},ellipse:function(t){return u(t,Object.assign({cx:t.rect.x+.5*t.rect.width,cy:t.rect.y+.5*t.rect.height,rx:.5*t.rect.width,ry:.5*t.rect.height},t.styles))},image:function(t,n){u(t,Object.assign({},t.rect,t.styles,{preserveAspectRatio:f[n.fit]||"none"}))},text:function(t,n,i,r){var e=a(n.fontSize,i,r);u(t,Object.assign({},t.rect,t.styles,{"stroke-width":0,"font-weight":n.fontWeight||"normal","font-size":e,"font-family":n.fontFamily||"sans-serif","text-anchor":E[n.textAlign]||"start"})),t.text!==n.text&&(t.text=n.text,t.textContent=n.text.length?n.text:" ")},path:function(t,n,i,r){var e;u(t,Object.assign({},t.styles,{fill:"none",d:(e=n.points.map((function(t){return{x:a(t.x,i,r,"width"),y:a(t.y,i,r,"height")}})),e.map((function(t,n){return"".concat(0===n?"M":"L"," ").concat(t.x," ").concat(t.y)})).join(" "))}))},line:function(t,o,c,f){u(t,Object.assign({},t.rect,t.styles,{fill:"none"}));var E=t.childNodes[1],_=t.childNodes[2],s=t.rect,l={x:t.rect.x+t.rect.width,y:t.rect.y+t.rect.height};if(u(t.childNodes[0],{x1:s.x,y1:s.y,x2:l.x,y2:l.y}),o.lineDecoration){E.style.display="none",_.style.display="none";var v=function(t){var n=Math.sqrt(t.x*t.x+t.y*t.y);return 0===n?{x:0,y:0}:e(t.x/n,t.y/n)}({x:l.x-s.x,y:l.y-s.y}),h=a(.05,c,f);if(-1!==o.lineDecoration.indexOf("arrow-begin")){var I=n(v,h),d=i(s,I),p=r(s,2,d),M=r(s,-2,d);u(E,{style:"display:block;",d:"M".concat(p.x,",").concat(p.y," L").concat(s.x,",").concat(s.y," L").concat(M.x,",").concat(M.y)})}if(-1!==o.lineDecoration.indexOf("arrow-end")){var g=n(v,-h),m=i(l,g),T=r(l,2,m),A=r(l,-2,m);u(_,{style:"display:block;",d:"M".concat(T.x,",").concat(T.y," L").concat(l.x,",").concat(l.y," L").concat(A.x,",").concat(A.y)})}}}},v=function(t,n,i,r,e){"path"!==n&&(t.rect=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=a(t.x,n,i,"width")||a(t.left,n,i,"width"),e=a(t.y,n,i,"height")||a(t.top,n,i,"height"),u=a(t.width,n,i,"width"),c=a(t.height,n,i,"height"),f=a(t.right,n,i,"width"),E=a(t.bottom,n,i,"height");return o(e)||(e=o(c)&&o(E)?n.height-c-E:E),o(r)||(r=o(u)&&o(f)?n.width-u-f:f),o(u)||(u=o(r)&&o(f)?n.width-r-f:0),o(c)||(c=o(e)&&o(E)?n.height-e-E:0),{x:r||0,y:e||0,width:u||0,height:c||0}}(i,r,e)),t.styles=function(t,n,i){var r=t.borderStyle||t.lineStyle||"solid",e=t.backgroundColor||t.fontColor||"transparent",o=t.borderColor||t.lineColor||"transparent",u=a(t.borderWidth||t.lineWidth,n,i);return{"stroke-linecap":t.lineCap||"round","stroke-linejoin":t.lineJoin||"round","stroke-width":u||0,"stroke-dasharray":"string"==typeof r?"":r.map((function(t){return a(t,n,i)})).join(","),stroke:o,fill:e,opacity:t.opacity||1}}(i,r,e),l[n](t,i,r,e)},h=["x","y","left","top","right","bottom","width","height"],I=function(n){var i=t(n,2),r=i[0],e=i[1],a=e.points?{}:h.reduce((function(t,n){return t[n]="string"==typeof(i=e[n])&&/%/.test(i)?parseFloat(i)/100:i,t;var i}),{});return[r,Object.assign({zIndex:0},e,a)]},d=function(t,n){return t[1].zIndex>n[1].zIndex?1:t[1].zIndex<n[1].zIndex?-1:0},p=function(n){return n.utils.createView({name:"image-preview-markup",tag:"svg",ignoreRect:!0,mixins:{apis:["width","height","crop","markup","resize","dirty"]},write:function(n){var i=n.root,r=n.props;if(r.dirty){var e=r.crop,a=r.resize,o=r.markup,u=r.width,c=r.height,f=e.width,E=e.height;if(a){var _=a.size,l=_&&_.width,h=_&&_.height,p=a.mode;l&&!h&&(h=l),h&&!l&&(l=h);var M=f<l&&E<h;if(!M||M&&a.upscale){var g,m=l/f,T=h/E;"force"===p?(f=l,E=h):("cover"===p?g=Math.max(m,T):"contain"===p&&(g=Math.min(m,T)),f*=g,E*=g)}}var A={width:u,height:c};i.element.setAttribute("width",A.width),i.element.setAttribute("height",A.height);var w=Math.min(u/f,c/E);i.element.innerHTML="";var R=i.query("GET_IMAGE_PREVIEW_MARKUP_FILTER");o.filter(R).map(I).sort(d).forEach((function(n){var r=t(n,2),e=r[0],a=r[1],o=function(t,n){return s[t](n)}(e,a);v(o,e,a,A,w),i.element.appendChild(o)}))}}})},M=function(t,n){return{x:t,y:n}},g=function(t,n){return M(t.x-n.x,t.y-n.y)},m=function(t,n){return Math.sqrt(function(t,n){return function(t,n){return t.x*n.x+t.y*n.y}(g(t,n),g(t,n))}(t,n))},T=function(t,n){var i=t,r=n,e=1.5707963267948966-n,a=Math.sin(1.5707963267948966),o=Math.sin(r),u=Math.sin(e),c=Math.cos(e),f=i/a;return M(c*(f*o),c*(f*u))},A=function(t,n,i,r){var e=2*(r.x>.5?1-r.x:r.x)*t.width,a=2*(r.y>.5?1-r.y:r.y)*t.height,o=function(t,n){var i=t.height,r=T(t.width,n),e=T(i,n),a=M(t.x+Math.abs(r.x),t.y-Math.abs(r.y)),o=M(t.x+t.width+Math.abs(e.y),t.y+Math.abs(e.x)),u=M(t.x-Math.abs(e.y),t.y+t.height-Math.abs(e.x));return{width:m(a,o),height:m(a,u)}}(n,i);return Math.max(o.width/e,o.height/a)},w=function(t,n){var i=t.width,r=i*n;return r>t.height&&(i=(r=t.height)/n),{x:.5*(t.width-i),y:.5*(t.height-r),width:i,height:r}},R=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.zoom,r=n.rotation,e=n.center,a=n.aspectRatio;a||(a=t.height/t.width);var o=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t.height/t.width,e=1,a=r;a>n&&(e=(a=n)/r);var o=Math.max(1/e,n/a),u=t.width/(i*o*e);return{width:u,height:u*n}}(t,a,i),u=void 0===n.scaleToFit||n.scaleToFit,c=i*A(t,w({width:o.width,height:o.height},a),r,u?e:{x:.5,y:.5});return{widthFloat:o.width/c,heightFloat:o.height/c,width:Math.round(o.width/c),height:Math.round(o.height/c)}},y={type:"spring",stiffness:.5,damping:.45,mass:10},G=function(t){return t.utils.createView({name:"image-clip",tag:"div",ignoreRect:!0,mixins:{apis:["crop","markup","resize","width","height","dirty","background"],styles:["width","height","opacity"],animations:{opacity:{type:"tween",duration:250}}},didWriteView:function(t){var n=t.props;n.background&&(t.root.element.style.backgroundColor=n.background)},create:function(n){var i=n.root,r=n.props;i.ref.image=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-canvas-wrapper",tag:"div",ignoreRect:!0,mixins:{apis:["crop","width","height"],styles:["originX","originY","translateX","translateY","scaleX","scaleY","rotateZ"],animations:{originX:y,originY:y,scaleX:y,scaleY:y,translateX:y,translateY:y,rotateZ:y}},create:function(n){var i=n.root,r=n.props;r.width=r.image.width,r.height=r.image.height,i.ref.bitmap=i.appendChildView(i.createChildView(function(t){return t.utils.createView({name:"image-bitmap",ignoreRect:!0,mixins:{styles:["scaleX","scaleY"]},create:function(t){t.root.appendChild(t.props.image)}})}(t),{image:r.image}))},write:function(t){var n=t.props.crop.flip,i=t.root.ref.bitmap;i.scaleX=n.horizontal?-1:1,i.scaleY=n.vertical?-1:1}})}(t),Object.assign({},r))),i.ref.createMarkup=function(){i.ref.markup||(i.ref.markup=i.appendChildView(i.createChildView(p(t),Object.assign({},r))))},i.ref.destroyMarkup=function(){i.ref.markup&&(i.removeChildView(i.ref.markup),i.ref.markup=null)};var e=i.query("GET_IMAGE_PREVIEW_TRANSPARENCY_INDICATOR");null!==e&&(i.element.dataset.transparencyIndicator="grid"===e?e:"color")},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=i.crop,a=i.markup,o=i.resize,u=i.dirty,c=i.width,f=i.height;n.ref.image.crop=e;var E={width:c,height:f,center:{x:.5*c,y:.5*f}},_={width:n.ref.image.width,height:n.ref.image.height},s={x:e.center.x*_.width,y:e.center.y*_.height},l={x:E.center.x-_.width*e.center.x,y:E.center.y-_.height*e.center.y},v=2*Math.PI+e.rotation%(2*Math.PI),h=void 0===e.scaleToFit||e.scaleToFit,I=A(_,w(E,e.aspectRatio||_.height/_.width),v,h?e.center:{x:.5,y:.5}),d=e.zoom*I;a&&a.length?(n.ref.createMarkup(),n.ref.markup.width=c,n.ref.markup.height=f,n.ref.markup.resize=o,n.ref.markup.dirty=u,n.ref.markup.markup=a,n.ref.markup.crop=R(_,e)):n.ref.markup&&n.ref.destroyMarkup();var p=n.ref.image;if(r)return p.originX=null,p.originY=null,p.translateX=null,p.translateY=null,p.rotateZ=null,p.scaleX=null,void(p.scaleY=null);p.originX=s.x,p.originY=s.y,p.translateX=l.x,p.translateY=l.y,p.rotateZ=v,p.scaleX=d,p.scaleY=d}})},P=0,D=function(){self.onmessage=function(t){createImageBitmap(t.data.message.file).then((function(n){self.postMessage({id:t.data.id,message:n},[n])}))}},O=function(){self.onmessage=function(t){for(var n=t.data.message.imageData,i=t.data.message.colorMatrix,r=n.data,e=r.length,a=i[0],o=i[1],u=i[2],c=i[3],f=i[4],E=i[5],_=i[6],s=i[7],l=i[8],v=i[9],h=i[10],I=i[11],d=i[12],p=i[13],M=i[14],g=i[15],m=i[16],T=i[17],A=i[18],w=i[19],R=0,y=0,G=0,P=0,D=0;R<e;R+=4)y=r[R]/255,G=r[R+1]/255,P=r[R+2]/255,D=r[R+3]/255,r[R]=Math.max(0,Math.min(255*(y*a+G*o+P*u+D*c+f),255)),r[R+1]=Math.max(0,Math.min(255*(y*E+G*_+P*s+D*l+v),255)),r[R+2]=Math.max(0,Math.min(255*(y*h+G*I+P*d+D*p+M),255)),r[R+3]=Math.max(0,Math.min(255*(y*g+G*m+P*T+D*A+w),255));self.postMessage({id:t.data.id,message:n},[n.data.buffer])}},x={1:function(){return[1,0,0,1,0,0]},2:function(t){return[-1,0,0,1,t,0]},3:function(t,n){return[-1,0,0,-1,t,n]},4:function(t,n){return[1,0,0,-1,0,n]},5:function(){return[0,1,1,0,0,0]},6:function(t,n){return[0,1,-1,0,n,0]},7:function(t,n){return[0,-1,-1,0,n,t]},8:function(t){return[0,-1,1,0,0,t]}},L=function(t,n,i,r){n=Math.round(n),i=Math.round(i);var e=document.createElement("canvas");e.width=n,e.height=i;var a=e.getContext("2d");if(r>=5&&r<=8){var o=[i,n];n=o[0],i=o[1]}return function(t,n,i,r){-1!==r&&t.transform.apply(t,x[r](n,i))}(a,n,i,r),a.drawImage(t,0,0,n,i),e},C=function(t){return/^image/.test(t.type)&&!/svg/.test(t.type)},W=function(t){var n=Math.min(10/t.width,10/t.height),i=document.createElement("canvas"),r=i.getContext("2d"),e=i.width=Math.ceil(t.width*n),a=i.height=Math.ceil(t.height*n);r.drawImage(t,0,0,e,a);var o=null;try{o=r.getImageData(0,0,e,a).data}catch(t){return null}for(var u=o.length,c=0,f=0,E=0,_=0;_<u;_+=4)c+=o[_]*o[_],f+=o[_+1]*o[_+1],E+=o[_+2]*o[_+2];return{r:c=S(c,u),g:f=S(f,u),b:E=S(E,u)}},S=function(t,n){return Math.floor(Math.sqrt(t/(n/4)))},k=function(t){var n=t.utils.createView({name:"image-preview-overlay",tag:"div",ignoreRect:!0,create:function(t){var n=t.root,i=t.props,r='<svg width="500" height="200" viewBox="0 0 500 200" preserveAspectRatio="none">\n <defs>\n <radialGradient id="gradient-__UID__" cx=".5" cy="1.25" r="1.15">\n <stop offset=\'50%\' stop-color=\'#000000\'/>\n <stop offset=\'56%\' stop-color=\'#0a0a0a\'/>\n <stop offset=\'63%\' stop-color=\'#262626\'/>\n <stop offset=\'69%\' stop-color=\'#4f4f4f\'/>\n <stop offset=\'75%\' stop-color=\'#808080\'/>\n <stop offset=\'81%\' stop-color=\'#b1b1b1\'/>\n <stop offset=\'88%\' stop-color=\'#dadada\'/>\n <stop offset=\'94%\' stop-color=\'#f6f6f6\'/>\n <stop offset=\'100%\' stop-color=\'#ffffff\'/>\n </radialGradient>\n <mask id="mask-__UID__">\n <rect x="0" y="0" width="500" height="200" fill="url(#gradient-__UID__)"></rect>\n </mask>\n </defs>\n <rect x="0" width="500" height="200" fill="currentColor" mask="url(#mask-__UID__)"></rect>\n</svg>';if(document.querySelector("base")){var e=new URL(window.location.href.replace(window.location.hash,"")).href;r=r.replace(/url\(\#/g,"url("+e+"#")}P++,n.element.classList.add("filepond--image-preview-overlay-".concat(i.status)),n.element.innerHTML=r.replace(/__UID__/g,P)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),i=function(t){return t.utils.createView({name:"image-preview",tag:"div",ignoreRect:!0,mixins:{apis:["image","crop","markup","resize","dirty","background"],styles:["translateY","scaleX","scaleY","opacity"],animations:{scaleX:y,scaleY:y,translateY:y,opacity:{type:"tween",duration:400}}},create:function(n){var i=n.root,r=n.props;i.ref.clip=i.appendChildView(i.createChildView(G(t),{id:r.id,image:r.image,crop:r.crop,markup:r.markup,resize:r.resize,dirty:r.dirty,background:r.background}))},write:function(t){var n=t.root,i=t.props,r=t.shouldOptimize,e=n.ref.clip,a=i.image,o=i.crop,u=i.markup,c=i.resize,f=i.dirty;if(e.crop=o,e.markup=u,e.resize=c,e.dirty=f,e.opacity=r?0:1,!r&&!n.rect.element.hidden){var E=o.aspectRatio||a.height/a.width,_=n.rect.inner.width,s=n.rect.inner.height,l=n.query("GET_IMAGE_PREVIEW_HEIGHT"),v=n.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),h=n.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),I=n.query("GET_PANEL_ASPECT_RATIO"),d=n.query("GET_ALLOW_MULTIPLE");I&&!d&&(l=_*I,E=I);var p=null!==l?l:Math.max(v,Math.min(_*E,h)),M=p/E;M>_&&(p=(M=_)*E),p>s&&(p=s,M=s/E),e.width=M,e.height=p}}})}(t),r=t.utils.createWorker,e=function(t,n,i){return new Promise((function(e){t.ref.imageData||(t.ref.imageData=i.getContext("2d").getImageData(0,0,i.width,i.height));var a=function(t){var n;try{n=new ImageData(t.width,t.height)}catch(i){n=document.createElement("canvas").getContext("2d").createImageData(t.width,t.height)}return n.data.set(new Uint8ClampedArray(t.data)),n}(t.ref.imageData);if(!n||20!==n.length)return i.getContext("2d").putImageData(a,0,0),e();var o=r(O);o.post({imageData:a,colorMatrix:n},(function(t){i.getContext("2d").putImageData(t,0,0),o.terminate(),e()}),[a.data.buffer])}))},a=function(t){var n=t.root,r=t.image,e=t.props.id,a=n.query("GET_ITEM",{id:e});if(a){var o,u,c=a.getMetadata("crop")||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},f=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),E=!1;n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(o=a.getMetadata("markup")||[],u=a.getMetadata("resize"),E=!0);var _=n.appendChildView(n.createChildView(i,{id:e,image:r,crop:c,resize:u,markup:o,dirty:E,background:f,opacity:0,scaleX:1.15,scaleY:1.15,translateY:15}),n.childViews.length);n.ref.images.push(_),_.opacity=1,_.scaleX=1,_.scaleY=1,_.translateY=0,setTimeout((function(){n.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:e})}),250)}},o=function(t){var n=t.root;n.ref.overlayShadow.opacity=1,n.ref.overlayError.opacity=0,n.ref.overlaySuccess.opacity=0},u=function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlayError.opacity=1};return t.utils.createView({name:"image-preview-wrapper",create:function(t){var i=t.root;i.ref.images=[],i.ref.imageData=null,i.ref.imageViewBin=[],i.ref.overlayShadow=i.appendChildView(i.createChildView(n,{opacity:0,status:"idle"})),i.ref.overlaySuccess=i.appendChildView(i.createChildView(n,{opacity:0,status:"success"})),i.ref.overlayError=i.appendChildView(i.createChildView(n,{opacity:0,status:"failure"}))},styles:["height"],apis:["height"],destroy:function(t){t.root.ref.images.forEach((function(t){t.image.width=1,t.image.height=1}))},didWriteView:function(t){t.root.ref.images.forEach((function(t){t.dirty=!1}))},write:t.utils.createRoute({DID_IMAGE_PREVIEW_DRAW:function(t){var n=t.root,i=n.ref.images[n.ref.images.length-1];i.translateY=0,i.scaleX=1,i.scaleY=1,i.opacity=1},DID_IMAGE_PREVIEW_CONTAINER_CREATE:function(t){var n,i,r,e=t.root,a=t.props.id,o=e.query("GET_ITEM",a);if(o){var u=URL.createObjectURL(o.file);n=u,i=function(t,n){e.dispatch("DID_IMAGE_PREVIEW_CALCULATE_SIZE",{id:a,width:t,height:n})},(r=new Image).onload=function(){var t=r.naturalWidth,n=r.naturalHeight;r=null,i(t,n)},r.src=n}},DID_FINISH_CALCULATE_PREVIEWSIZE:function(t){var n,i,o,u=t.root,c=t.props,f=u.query("GET_ITEM",c.id);if(f){var E=URL.createObjectURL(f.file),_=function(){var t;(t=E,new Promise((function(n,i){var r=new Image;r.crossOrigin="Anonymous",r.onload=function(){n(r)},r.onerror=function(t){i(t)},r.src=t}))).then(s)},s=function(t){URL.revokeObjectURL(E);var n=(f.getMetadata("exif")||{}).orientation||-1,i=t.width,r=t.height;if(i&&r){if(n>=5&&n<=8){var o=[r,i];i=o[0],r=o[1]}var _=Math.max(1,.75*window.devicePixelRatio),s=u.query("GET_IMAGE_PREVIEW_ZOOM_FACTOR")*_,l=r/i,v=u.rect.element.width,h=u.rect.element.height,I=v,d=I*l;l>1?d=(I=Math.min(i,v*s))*l:I=(d=Math.min(r,h*s))/l;var p=L(t,I,d,n),M=function(){var n=u.query("GET_IMAGE_PREVIEW_CALCULATE_AVERAGE_IMAGE_COLOR")?W(data):null;f.setMetadata("color",n,!0),"close"in t&&t.close(),u.ref.overlayShadow.opacity=1,a({root:u,props:c,image:p})},g=f.getMetadata("filter");g?e(u,g,p).then(M):M()}};if(n=f.file,i=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./),null!==(o=i?parseInt(i[1]):null)&&o<=58||!("createImageBitmap"in window)||!C(n))_();else{var l=r(D);l.post({file:f.file},(function(t){l.terminate(),t?s(t):_()}))}}},DID_UPDATE_ITEM_METADATA:function(t){var n,i,r=t.root,o=t.props,u=t.action;if(/crop|filter|markup|resize/.test(u.change.key)&&r.ref.images.length){var c=r.query("GET_ITEM",{id:o.id});if(c)if(/filter/.test(u.change.key))e(r,u.change.value,r.ref.images[r.ref.images.length-1].image);else if(/crop|markup|resize/.test(u.change.key)){var f=c.getMetadata("crop"),E=r.ref.images[r.ref.images.length-1];if(f&&f.aspectRatio&&E.crop&&E.crop.aspectRatio&&Math.abs(f.aspectRatio-E.crop.aspectRatio)>1e-5){var _=function(t){var n=t.root,i=n.ref.images.shift();return i.opacity=0,i.translateY=-15,n.ref.imageViewBin.push(i),i}({root:r});a({root:r,props:o,image:(n=_.image,(i=i||document.createElement("canvas")).width=n.width,i.height=n.height,i.getContext("2d").drawImage(n,0,0),i)})}else!function(t){var n=t.root,i=n.query("GET_ITEM",{id:t.props.id});if(i){var r=n.ref.images[n.ref.images.length-1];r.crop=i.getMetadata("crop"),r.background=n.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),n.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(r.dirty=!0,r.resize=i.getMetadata("resize"),r.markup=i.getMetadata("markup"))}}({root:r,props:o})}}},DID_THROW_ITEM_LOAD_ERROR:u,DID_THROW_ITEM_PROCESSING_ERROR:u,DID_THROW_ITEM_INVALID:u,DID_COMPLETE_ITEM_PROCESSING:function(t){var n=t.root;n.ref.overlayShadow.opacity=.25,n.ref.overlaySuccess.opacity=1},DID_START_ITEM_PROCESSING:o,DID_REVERT_ITEM_PROCESSING:o},(function(t){var n=t.root,i=n.ref.imageViewBin.filter((function(t){return 0===t.opacity}));n.ref.imageViewBin=n.ref.imageViewBin.filter((function(t){return t.opacity>0})),i.forEach((function(t){return function(t,n){t.removeChildView(n),n.image.width=1,n.image.height=1,n._destroy()}(n,t)})),i.length=0}))})},V=function(t){var n=t.addFilter,i=t.utils,r=i.Type,e=i.createRoute,a=i.isFile,o=k(t);return n("CREATE_VIEW",(function(t){var n=t.view,i=t.query;if((0,t.is)("file")&&i("GET_ALLOW_IMAGE_PREVIEW")){var r=function(t){t.root.ref.shouldRescale=!0};n.registerWriter(e({DID_RESIZE_ROOT:r,DID_STOP_RESIZE:r,DID_LOAD_ITEM:function(t){var r=t.root,e=t.props.id,u=i("GET_ITEM",e);if(u&&a(u.file)&&!u.archived){var c=u.file;if(function(t){return/^image/.test(t.type)}(c)&&i("GET_IMAGE_PREVIEW_FILTER_ITEM")(u)){var f="createImageBitmap"in(window||{}),E=i("GET_IMAGE_PREVIEW_MAX_FILE_SIZE");if(!(!f&&E&&c.size>E)){r.ref.imagePreview=n.appendChildView(n.createChildView(o,{id:e}));var _=r.query("GET_IMAGE_PREVIEW_HEIGHT");_&&r.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:u.id,height:_});var s=!f&&c.size>i("GET_IMAGE_PREVIEW_MAX_INSTANT_PREVIEW_FILE_SIZE");r.dispatch("DID_IMAGE_PREVIEW_CONTAINER_CREATE",{id:e},s)}}}},DID_IMAGE_PREVIEW_CALCULATE_SIZE:function(t){var n=t.root,i=t.action;n.ref.imageWidth=i.width,n.ref.imageHeight=i.height,n.ref.shouldRescale=!0,n.ref.shouldDrawPreview=!0,n.dispatch("KICK")},DID_UPDATE_ITEM_METADATA:function(t){"crop"===t.action.change.key&&(t.root.ref.shouldRescale=!0)}},(function(t){var n=t.root,i=t.props;n.ref.imagePreview&&(n.rect.element.hidden||(n.ref.shouldRescale&&(function(t,n){if(t.ref.imagePreview){var i=t.query("GET_ITEM",{id:n.id});if(i){var r=t.query("GET_PANEL_ASPECT_RATIO"),e=t.query("GET_ITEM_PANEL_ASPECT_RATIO"),a=t.query("GET_IMAGE_PREVIEW_HEIGHT");if(!(r||e||a)){var o=t.ref,u=o.imageWidth,c=o.imageHeight;if(u&&c){var f=t.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),E=t.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),_=(i.getMetadata("exif")||{}).orientation||-1;if(_>=5&&_<=8){var s=[c,u];u=s[0],c=s[1]}if(!C(i.file)||t.query("GET_IMAGE_PREVIEW_UPSCALE")){var l=2048/u;u*=l,c*=l}var v=c/u,h=(i.getMetadata("crop")||{}).aspectRatio||v,I=Math.max(f,Math.min(c,E)),d=Math.min(t.rect.element.width*h,I);t.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:i.id,height:d})}}}}}(n,i),n.ref.shouldRescale=!1),n.ref.shouldDrawPreview&&(requestAnimationFrame((function(){requestAnimationFrame((function(){n.dispatch("DID_FINISH_CALCULATE_PREVIEWSIZE",{id:i.id})}))})),n.ref.shouldDrawPreview=!1)))})))}})),{options:{allowImagePreview:[!0,r.BOOLEAN],imagePreviewFilterItem:[function(){return!0},r.FUNCTION],imagePreviewHeight:[null,r.INT],imagePreviewMinHeight:[44,r.INT],imagePreviewMaxHeight:[256,r.INT],imagePreviewMaxFileSize:[null,r.INT],imagePreviewZoomFactor:[2,r.INT],imagePreviewUpscale:[!1,r.BOOLEAN],imagePreviewMaxInstantPreviewFileSize:[1e6,r.INT],imagePreviewTransparencyIndicator:[null,r.STRING],imagePreviewCalculateAverageImageColor:[!1,r.BOOLEAN],imagePreviewMarkupShow:[!0,r.BOOLEAN],imagePreviewMarkupFilter:[function(){return!0},r.FUNCTION]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:V})),V}()),r.exports),a=n({__proto__:null,default:t(e)},[e]);
|
|
5
5
|
/*!
|
|
6
6
|
* FilePondPluginImagePreview 4.6.12
|
|
7
7
|
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as e,a as t}from"./p-
|
|
4
|
+
import{r as s,h as e,a as t}from"./p-DPwa4NOx.js";var i,r;!function(s){s.ProductDetail="product.single",s.Cart="cart"}(i||(i={})),function(s){s.Conditional="conditional",s.PercentageOrFixed="fixed",s.DiscountsTable="discounts_table",s.Bank="bank",s.BuyXGetY="buy_x_get_y",s.SpecialPrice="special_price"}(r||(r={}));const a=class{constructor(e){s(this,e),this.productCardComponent="custom-salla-product-card",this.offersList=[],this.isMultipleBank=!1,this.isBankOffer=!1,this.canRender=!1,this.showOffer=salla.config.get("store.settings.product.show_special_offers"),this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""}),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title"),this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message"),this.buy_quantity_text=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s}),salla.lang.onLoaded((()=>{this.offer_with_price_text=salla.lang.get("pages.offer.with_price"),this.with_discount_text=salla.lang.get("pages.products.with_a_discount"),this.product_discount_text=salla.lang.get("pages.products.discount"),this.special_offer_text=salla.lang.get("pages.products.special_offer"),this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title"),this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message"),this.buy_quantity_text(0)})),salla.onReady((()=>{this.currentPage=salla.config.get("page.slug"),this.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol})),this.categorySlot=this.host.querySelector('[slot="category"]')?.innerHTML||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}async getEndpointByPageName(){return this.currentPage==i.Cart?`offers/cart/${await Salla.cart.getCurrentCartId()}`:this.currentPage==i.ProductDetail?`offers/product/${salla.config.get("page.id")}`:"offers"}emitPromotionViewed(){this.offersList.length&&this.canRender&&this.showOffer&&salla.event.emit("promotion::viewed",[{id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:1}])}emitPromotionClicked(s=1){this.offersList.length&&this.canRender&&this.showOffer&&salla.event.emit("promotion::clicked",[{id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:s}])}componentWillLoad(){return this.hasCustomComponent=!!customElements.get(this.productCardComponent),new Promise((s=>salla.onReady(s))).then((()=>{if(this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers"),!this.showOffer)throw new Error("Merchant disabled showing the offers on product page")})).then((async()=>salla.api.request(await this.getEndpointByPageName()))).then((s=>{if(!(this.offersList=s.data).length)throw new Error("salla-offers:: There is no offers!");const e=this.offersList.find((s=>[r.SpecialPrice,r.Bank,r.BuyXGetY,r.DiscountsTable].includes(s.type)));if(!e)throw new Error("salla-offers:: Offer type not supported yet!");if(e.type===r.DiscountsTable)return this.offersList=[e];if(this.isBankOffer=e.type===r.Bank)return this.offersList=this.offersList.filter((s=>s.type===r.Bank)),this.isMultipleBank=this.offersList.length>1,this.offersList;if(e.type===r.SpecialPrice){const s=e.details;return"product"===s.apply_to?salla.product.api.fetch({source:"selected",source_value:s.targets}).then((s=>(e.details.products=s.data,this.offersList=[e]))):salla.product.api.categories().then((t=>{const i=this.findCategories(t.data,s.targets);return e.details.categories=i,this.offersList=[e]}))}const t=e.details.get;return"products"===t.source?salla.product.api.fetch({source:"selected",source_value:t.source_value}).then((s=>(t.products=s.data,e.details.get=t,this.offersList=[e]))):salla.product.api.categories().then((s=>(t.categories=this.findCategories(s.data,t.source_value),e.details.get=t,this.offersList=[e])))})).then((s=>{salla.storage.set(this.getStorageKey(),{offers:s,stored_at:(new Date).getTime()}),this.canRender=!0})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s?.classList.add("s-offer-bank-payment-nav"),this.emitPromotionViewed()}findCategories(s,e){let t=[];for(const i of s)e.includes(i.id_||i.id)&&t.push(i),i.sub_categories?.length>0&&(t=t.concat(this.findCategories(i.sub_categories,e)));return t}getStorageKey(){try{const s=salla.config.get("page.slug").replace(".","_"),e=salla.lang.getLocale(),t=salla.config.currency().code;if(!s||!e||!t)throw new Error("Unable to get the storage key.");return`s-offers-${s}-${salla.config.get("page.id")}-${e}-${t}`}catch(s){return""}}getOffersFromStorage(){let s=salla.storage.get(this.getStorageKey());return!s||s.stored_at<(new Date).getTime()-6e5?(salla.storage.remove(this.getStorageKey()),null):(this.canRender=!0,Promise.resolve(s.offers))}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=this.offersList[0],t={"block-title":this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:s.title,"block-subTitle":this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:s.description,"show-controls":this.isMultipleBank};return e("div",{class:"s-offer-wrapper",onClick:()=>this.emitPromotionClicked()},e("p",{class:"s-offer-corner-badge"},this.special_offer_text),e("salla-slider",{type:"carousel",id:"offer-slider",...t},e("div",{slot:"items"},this.renderSectionForOfferType(s.type))))}renderSectionForOfferType(s){return this.isBankOffer?this.renderBankSection():s==r.SpecialPrice?this.renderSpecialPriceSection():s==r.BuyXGetY?this.renderBuyXGetYSection():this.renderDiscountTableSection()}getCategoriesSection(s){return e("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,s.url).replace(/\{icon\}/g,s.icon||"sicon-store").replace(/\{name\}/g,s.name)})}renderBuyXGetYSection(){const s=this.offersList[0].details;return[s.get.products?.map((s=>e("div",{class:"s-offer-slide-one-fourth"},this.hasCustomComponent?e(this.productCardComponent,{product:s}):e("salla-product-card",{"shadow-on-hover":!0,product:s})))),s.get.categories?.map((s=>this.getCategoriesSection(s)))]}renderBankSection(){return this.offersList.map((s=>e("div",{class:{"s-offer-slide-one-sixth":this.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!this.isMultipleBank}},e("div",{class:{"s-offer-bank-wrapper":!0,"s-offer-slide-one-sixth":!this.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":this.isMultipleBank}},e("div",{class:"s-offer-bank-logo"},e("img",{src:s.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":s.details.logo,alt:s.title+" offer"})),e("ul",{class:"s-offer-bank-payment-wrapper"},s.details.payments.map((s=>e("li",{class:"s-offer-bank-payment-single"},e("img",{src:salla.url.cdn("images/payment/"+s+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+s+".png"),alt:"payment"}))))),this.isMultipleBank?e("p",{class:"s-offer-bank-payment-discount-percent"},`${this.product_discount_text} ${s.details.discount_value}${"percentage"===s.details.discount_type&&"%"}`):""),this.isMultipleBank?"":e("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},e("h2",null,this.offersList[0].title),e("p",{innerHTML:this.generateBankDescription(this.offersList[0].description,s.details.discount_value)})))))}generateBankDescription(s,e){return s.replace(new RegExp(`${e} %`),`<span class="s-offer-bank-message-amount">${e} %</span>`)}renderDiscountTableSection(){let s=this.offersList[0].details.show_price_after_discount;return this.offersList[0].details.discounts?.map((t=>e("div",{class:"s-offer-slide-one-fourth"},e("div",{class:"s-offer-slide-offer-entry"},e("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},e("p",{class:"s-offer-slide-offer-entry-quantity"},this.buy_quantity_text(t.quantity)),s?e("div",{class:"s-offer-slide-offer-entry-price"},e("span",null,this.offer_with_price_text),e("span",{class:"s-offer-slide-offer-entry-price-amount"},t.discounted_amount)," ",e("span",null,this.userCurrency)):""),e("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},this.with_discount_text,"(",e("span",null,t.percentage,!!t.percentage&&"%"),")")))))}renderSpecialPriceSection(){const s=this.offersList[0].details;return["product"===s.apply_to&&s.products?.map((s=>e("div",{class:"s-offer-slide-one-fourth"},this.hasCustomComponent?e(this.productCardComponent,{product:s}):e("salla-product-card",{"shadow-on-hover":!0,product:s})))),"category"===s.apply_to&&s.categories?.map((s=>this.getCategoriesSection(s)))]}get host(){return t(this)}};a.style='.s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:"sallaicons";content:"\\ee30" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:flex;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:flex !important;width:100% !important}';export{a as salla_offer}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{e as t,f as i,i as s,d as e,r as a,h as r,a as n}from"./p-
|
|
4
|
+
import{e as t,f as i,i as s,d as e,r as a,h as r,a as n}from"./p-DPwa4NOx.js";import{S as o}from"./p-DiKTtDW5.js";import{H as l}from"./p-Dljb4XCt.js";import"./p-CgtvEd63.js";var c,h,u,f,d,p,v,m,g,w,b,y;function _(){if(w)return g;w=1;var e=i(),a=function(){if(h)return c;h=1;var i=t();return c=function(){return i.Date.now()}}(),r=function(){if(m)return v;m=1;var t=function(){if(p)return d;p=1;var t=function(){if(f)return u;f=1;var t=/\s/;return u=function(i){for(var s=i.length;s--&&t.test(i.charAt(s)););return s}}(),i=/^\s+/;return d=function(s){return s?s.slice(0,t(s)+1).replace(i,""):s}}(),e=i(),a=s(),r=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,o=/^0o[0-7]+$/i,l=parseInt;return v=function(i){if("number"==typeof i)return i;if(a(i))return NaN;if(e(i)){var s="function"==typeof i.valueOf?i.valueOf():i;i=e(s)?s+"":s}if("string"!=typeof i)return 0===i?i:+i;i=t(i);var c=n.test(i);return c||o.test(i)?l(i.slice(2),c?2:8):r.test(i)?NaN:+i}}(),n=Math.max,o=Math.min;return g=function(t,i,s){var l,c,h,u,f,d,p=0,v=!1,m=!1,g=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function w(i){var s=l,e=c;return l=c=void 0,p=i,u=t.apply(e,s)}function b(t){var s=t-d;return void 0===d||s>=i||s<0||m&&t-p>=h}function y(){var t=a();if(b(t))return _(t);f=setTimeout(y,function(t){var s=i-(t-d);return m?o(s,h-(t-p)):s}(t))}function _(t){return f=void 0,g&&l?w(t):(l=c=void 0,u)}function k(){var t=a(),s=b(t);if(l=arguments,c=this,d=t,s){if(void 0===f)return function(t){return p=t,f=setTimeout(y,i),v?w(t):u}(d);if(m)return clearTimeout(f),f=setTimeout(y,i),w(d)}return void 0===f&&(f=setTimeout(y,i)),u}return i=r(i)||0,e(s)&&(v=!!s.leading,h=(m="maxWait"in s)?n(r(s.maxWait)||0,i):h,g="trailing"in s?!!s.trailing:g),k.cancel=function(){void 0!==f&&clearTimeout(f),p=0,l=d=c=f=void 0},k.flush=function(){return void 0===f?u:_(a())},k},g}var k=e(function(){if(y)return b;y=1;var t=_(),s=i();return b=function(i,e,a){var r=!0,n=!0;if("function"!=typeof i)throw new TypeError("Expected a function");return s(a)&&(r="leading"in a?!!a.leading:r,n="trailing"in a?!!a.trailing:n),t(i,e,{leading:r,maxWait:e,trailing:n})}}());class T{constructor(t){this.grid=t,this.create=()=>{this.mutationObserver.observe(this.grid,{childList:!0});for(const t of Array.from(this.grid.children))this.resizeObserver.observe(t)},this.onContainerMutation=t=>{const i=t.flatMap((t=>Array.from(t.removedNodes))),s=t.flatMap((t=>Array.from(t.addedNodes)));for(const t of i)t instanceof Element&&this.resizeObserver.unobserve(t);for(const t of s)t instanceof Element&&this.resizeObserver.observe(t);i.length>0&&0===s.length&&this.update()},this.onChildrenResize=t=>{t.filter((t=>null!==t.target.parentElement)).length>0&&this.update()},this.update=k((()=>{const t=window.getComputedStyle(this.grid);if(!1===t.getPropertyValue("display").includes("grid"))return void this.clean();const i=function(t){return window.getComputedStyle(t).getPropertyValue("grid-template-columns").trim().split(/\s+(?=(?:[^()]*\([^()]*\))*[^()]*$)/)}(this.grid);if(i.length<=1)return void this.clean();const s=Number.parseFloat(t.getPropertyValue("row-gap").trim())||0,e=Array.from(this.grid.children);for(let t=0;t<i.length;t++){const i=e[t];i?.style.removeProperty("margin-top")}for(let t=0;t<e.length;t++){const a=e[t-i.length],r=e[t];if(void 0!==a&&void 0!==r){const t=a.getBoundingClientRect().bottom;r.style.removeProperty("margin-top");const i=r.getBoundingClientRect().top;if(i-s!==t){const e=Math.round(100*(t-(i-s)+Number.EPSILON))/100;r.style.setProperty("margin-top",`${e}px`)}}}}),32),this.destroy=()=>{this.resizeObserver.disconnect(),this.mutationObserver.disconnect(),this.clean()},this.clean=()=>{for(const t of Array.from(this.grid.children))t.style.removeProperty("margin-top")},this.mutationObserver=new MutationObserver(this.onContainerMutation),this.resizeObserver=new ResizeObserver(this.onChildrenResize),!1===CSS.supports("grid-template-rows","masonry")&&this.create()}[Symbol.dispose](){this.destroy()}}const E=class{constructor(t){a(this,t),this.reviews=[],this.isLoading=!1,this.pagination=null,this.sort="latest"}getUrlParams(){const t=new URLSearchParams(window.location.search);return{sort:t.get("sort")||null,page:Number.parseInt(t.get("page"))||1}}updateUrlParams(t){const i=new URL(window.location.href);for(const[s,e]of Object.entries(t))e?i.searchParams.set(s,e.toString()):i.searchParams.delete(s);window.history.replaceState({},"",i.toString())}fetchReviews(t,i){const s=this.getUrlParams();return salla.api.request("reviews",{params:{type:"products",format:"lite",per_page:8,page:i||s.page||1,sort:t||s.sort||null}})}async initializeMasonry(){const t=this.el.querySelector(".s-reviews-page-grid");if(t)try{new T(t),salla.logger.info("Masonry initialized successfully")}catch(t){salla.logger.error("Masonry initialization failed:",t)}}animateReviewCards(){const t=this.wrapper.querySelectorAll("salla-review-card:not(.animated)");l.animateItems(t)}initiateInfiniteScroll(){this.wrapper?(this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.pagination?.links?.next||null,history:!1,scrollThreshold:!1},!0),this.infiniteScroll?.on("request",(()=>{this.isLoading=!0})),this.infiniteScroll?.on("load",(t=>{this.pagination=t.pagination,this.reviews=[...this.reviews,...t.data],this.isLoading=!1,this.updateUrlParams({page:t.pagination.current_page})})),this.infiniteScroll?.on("error",(t=>{salla.logger.error("Error loading more reviews:",t),this.isLoading=!1}))):salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll.")}componentDidRender(){setTimeout((()=>{requestAnimationFrame(this.animateReviewCards.bind(this))}),176)}async componentWillLoad(){try{await salla.onReady(),this.langTitlesReviews=salla.lang.get("common.titles.reviews"),this.langSorting=salla.lang.get("pages.categories.sorting"),this.placeholderText=salla.lang.choice("pages.rating.reviews",0),this.langLoadMore=salla.lang.get("common.elements.load_more"),this.langSortByTopRating=salla.lang.get("pages.testimonials.sort_by_rating_desc"),this.langSortByMostRecent=salla.lang.get("pages.testimonials.sort_by_date_desc"),this.langSortByLeastRated=salla.lang.get("pages.testimonials.sort_by_rating_asc"),this.langSortByLeastRecent=salla.lang.get("pages.testimonials.sort_by_date_asc");const t=this.getUrlParams(),i=await this.fetchReviews(t.sort);this.sort=t.sort,this.reviews=i.data,this.pagination=i.pagination,this.langRatingReviews=salla.lang.choice("pages.rating.reviews",this.pagination?.total)}catch(t){salla.logger.error("Error loading reviews:",t)}}async handleSorting(t){const i=t.target.value;this.sort=i,this.updateUrlParams({sort:i,page:1});const s=await this.fetchReviews(i,1);this.reviews=s.data,this.pagination=s.pagination}async componentDidLoad(){await this.initializeMasonry(),this.initiateInfiniteScroll(),this.sort=this.getUrlParams().sort||"latest",this.updateUrlParams({sort:this.sort,page:1})}disconnectedCallback(){this.infiniteScroll&&this.infiniteScroll.destroy()}renderSortingOptions(){return[{value:"latest",label:this.langSortByMostRecent},{value:"oldest",label:this.langSortByLeastRecent},{value:"top_rating",label:this.langSortByTopRating},{value:"bottom_rating",label:this.langSortByLeastRated}].map((t=>r("option",{key:t.value,value:t.value,selected:t.value===this.sort},t.label)))}render(){return r("host",{key:"6d478caef9753d4aaf9ab1a5376961b748ec2088"},r("div",{key:"f84c127d660cba0890ba110b4d203e50fc1f2d8d",class:"s-reviews-page-header-wrapper"},r("h2",{key:"6c48e1343deaba4531987aefcc5888fc1e0d77ac",class:"s-reviews-page-title"},this.langTitlesReviews,r("span",{key:"fa9b923d592752b108da63efdf3167b118be65d0",class:"s-reviews-page-count"},"(",this.langRatingReviews,")")),r("div",{key:"52d0dd32e981721eb2529ed5d65769b078ad7538",class:"s-reviews-page-filter-wrapper"},r("label",{key:"0f7fe49f3ac27db63d8992efa2c3c04b3b19367d",class:"s-reviews-page-filter-label",htmlFor:"testimonials-filter"},this.langSorting),r("select",{key:"497563e494b7141c5a64dddc8cf4a202efba3776",onChange:t=>this.handleSorting(t),disabled:!this.reviews.length,class:"s-reviews-page-filter"},this.renderSortingOptions()))),this.reviews.length?r("main",{class:"s-reviews-page-grid",ref:t=>{this.wrapper=t}},this.reviews.map((t=>r("salla-review-card",{key:t.id,review:t})))):r("div",{class:"s-products-list-placeholder"},r("span",{innerHTML:o}),r("p",null,this.placeholderText)),this.pagination?.links?.next&&this.reviews.length?r("div",{class:"s-reviews-page-load-more-container"},r("salla-button",{class:"s-reviews-page-load-more-btn",loading:this.isLoading,onClick:()=>this.infiniteScroll?.loadNextPage(),onKeyUp:()=>this.infiniteScroll?.loadNextPage()},this.langLoadMore)):null)}get el(){return n(this)}};E.style=":host{display:block}";export{E as salla_reviews_page}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,h as l,H as t}from"./p-
|
|
4
|
+
import{r as a,h as l,H as t}from"./p-DPwa4NOx.js";import{G as s}from"./p-C0JNGIpa.js";const o=a=>a?new Date(Number(a)).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}):"",r=a=>{if(!a)return"";try{const l=a.toLowerCase(),t=salla.lang.get(`pages.loyalty_program.${l}`);return t===`pages.loyalty_program.${l}`?a:t}catch{return a}},e=class{constructor(l){a(this,l),this.loyaltyPointsArray=[],this.isLoadingLoyalty=!1,this.nextPageUrlLoyalty="",this.handleClick=()=>{this.loadMoreLoyaltyPoints()}}componentWillLoad(){return salla.onReady().then((()=>{this.loadLoyaltyPoints()}))}async loadLoyaltyPoints(){this.isLoadingLoyalty=!0;try{let a="/balance/points?page=1",l=await salla.api.request(a);this.loyaltyPointsArray=l.data,this.nextPageUrlLoyalty=l.cursor.next}catch(a){console.error("Error loading loyalty points transactions",a)}finally{this.isLoadingLoyalty=!1}}async loadMoreLoyaltyPoints(){if(this.nextPageUrlLoyalty){this.isLoadingLoyalty=!0;try{let a=await salla.api.request(this.nextPageUrlLoyalty);this.loyaltyPointsArray=[...this.loyaltyPointsArray,...a.data],this.nextPageUrlLoyalty=a.cursor?.next||""}catch(a){console.error("Error loading more loyalty points",a)}finally{this.isLoadingLoyalty=!1}}}render(){return l(t,{key:"24ab88177569df0ae3c8e9003f8817935413f6f9"},l("div",{key:"1617bdd654819bc8c24a3afd1d4af5cc3a148352"},this.isLoadingLoyalty?l("salla-loading",null):l("div",null,this.loyaltyPointsArray.length>0?l("div",null,l("table",{class:"s-loyalty-program-table"},l("thead",{class:"s-loyalty-program-table-head"},l("tr",{class:"s-loyalty-program-table-head-tr"},l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.points")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.date")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("common.elements.note")),l("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("common.elements.status")))),l("tbody",{class:"s-loyalty-program-table-tbody"},this.loyaltyPointsArray.map((a=>l("tr",{class:"s-loyalty-program-table-tbody-tr"},l("td",{class:"s-loyalty-program-table-tbody-tr-td"},"plus"===a?.type?"+":"",a?.points||""," ",salla.lang.get("pages.loyalty_program.point")),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},o(a?.created_at?1e3*Number(a.created_at):void 0)),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},o(a?.points_expire_date)),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},r(a?.key)),l("td",{class:"s-loyalty-program-table-tbody-tr-td"},r(a?.status_key))))))),l("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrlLoyalty&&l("salla-button",{onClick:this.handleClick,loading:this.isLoadingLoyalty},salla.lang.get("common.elements.load_more")))):l("div",null,l("div",{class:"s-loyalty-program-table-empty-state"},l("span",{innerHTML:s}),l("div",{class:"s-loyalty-program-table-placeholder-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_title")),l("div",{class:"s-loyalty-program-table-placeholder-sub-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_sub_title")))))))}};e.style="";export{e as salla_loyalty_program}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t,H as o}from"./p-
|
|
4
|
+
import{r as s,h as t,H as o}from"./p-DPwa4NOx.js";const i=class{constructor(t){s(this,t),this.bordered=!0,this.placeholderImage="images/placeholder.png",this.optionsData=[]}componentWillLoad(){this.parseOptionsData()}componentWillUpdate(){this.parseOptionsData()}parseOptionsData(){if(this.options)if("string"==typeof this.options)try{this.optionsData=JSON.parse(this.options)}catch(s){this.optionsData=[]}else this.optionsData=Array.isArray(this.options)?this.options:[];else this.optionsData=[]}renderOptionValue(s){return s.is_image?t("div",{class:"s-order-details-option-image-container"},t("a",{href:s.value,target:"_blank"},t("img",{class:"s-order-details-option-image",src:s.value||this.placeholderImage,alt:s.name}))):s.color?t("span",{title:s.value,class:"s-order-details-option-color-swatch",style:{backgroundColor:s.color}}):s.is_file?t("a",{href:s.value,target:"_blank",class:"s-order-details-option-file-link"},"Attachments"):s.is_color_picker?t("div",{class:"s-order-details-option-color-picker"},t("div",{class:"s-order-details-option-color-picker-content"},t("span",{class:"s-order-details-option-color-picker-text"},s.value),t("span",{class:"s-order-details-option-color-picker-swatch",style:{backgroundColor:s.value,width:"1rem"}})),t("salla-button",{onClick:t=>this.copyToClipboard(t,s.value),shape:"link",class:"s-order-details-option-color-picker-button"},t("span",{class:"s-order-details-option-color-copy-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>swap-fill</title>\n<path d="M28 10.667h-2.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h2.667c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333v-2.667c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.667c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM21.333 17.333v-13.333c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4zM2.667 17.333v-13.333c0-0.736 0.599-1.333 1.333-1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333z"></path>\n</svg>\n'}))):s.is_map&&s.latitude&&s.longitude?t("salla-map",{id:`location_map_${s.id}`,class:`map_${s.id}`,zoom:15,readonly:!0,lat:s.latitude,lng:s.longitude},t("div",{slot:"button"},t("button",{type:"button",class:"s-order-details-option-map-button",onClick:()=>this.openMap(s.id)},"Show Location"))):t("span",{class:"s-order-details-option-default-text"},s.display_value||s.value)}copyToClipboard(s,t){s.preventDefault(),navigator.clipboard&&navigator.clipboard.writeText(t)}openMap(s){const t=document.querySelector(`salla-map.map_${s}`);t&&t.open&&t.open()}render(){if(!this.optionsData.length)return null;const s=this.bordered?"s-order-details-options-container":"s-order-details-options-container-borderless";return t(o,{class:"s-order-details-options-wrapper"},t("h2",{class:"s-order-details-options-title"},salla.lang.get("pages.cart.item_options")),t("div",{class:s},t("dl",{class:"s-order-details-options-list"},this.optionsData.map((s=>t("div",{key:s.id,class:"s-order-details-options-item"},t("dt",{class:"s-order-details-options-item-name"},s.name,":"),t("dd",{class:s.is_image?"s-order-details-options-item-value-image":"s-order-details-options-item-value-text"},this.renderOptionValue(s))))))))}};i.style="";export{i as salla_order_details_options}
|