geno/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/wc-settings.js
2024-02-01 11:54:18 +00:00

1 line
No EOL
6 KiB
JavaScript

(()=>{"use strict";var e={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{ADMIN_URL:()=>a,COUNTRIES:()=>i,CURRENCY:()=>s,CURRENT_USER_IS_ADMIN:()=>c,HOME_URL:()=>l,LOCALE:()=>d,ORDER_STATUSES:()=>u,PLACEHOLDER_IMG_SRC:()=>p,SITE_TITLE:()=>_,STORE_PAGES:()=>g,WC_ASSET_URL:()=>b,WC_VERSION:()=>m,WP_LOGIN_URL:()=>w,WP_VERSION:()=>y,allSettings:()=>n,defaultAddressFields:()=>S,getAdminLink:()=>q,getPaymentMethodData:()=>N,getSetting:()=>T,getSettingWithCoercion:()=>O,isWcVersion:()=>M,isWpVersion:()=>z}),(0,window.wp.hooks.addFilter)("woocommerce_admin_analytics_settings","woocommerce-blocks/exclude-draft-status-from-analytics",(e=>{const o=e=>"customStatuses"===e.key?{...e,options:e.options.filter((e=>"checkout-draft"!==e.value))}:e,t=e.woocommerce_actionable_order_statuses.options.map(o),r=e.woocommerce_excluded_report_order_statuses.options.map(o);return{...e,woocommerce_actionable_order_statuses:{...e.woocommerce_actionable_order_statuses,options:t},woocommerce_excluded_report_order_statuses:{...e.woocommerce_excluded_report_order_statuses,options:r}}}));const t={adminUrl:"",countries:[],currency:{code:"USD",precision:2,symbol:"$",symbolPosition:"left",decimalSeparator:".",priceFormat:"%1$s%2$s",thousandSeparator:","},currentUserId:0,currentUserIsAdmin:!1,homeUrl:"",locale:{siteLocale:"en_US",userLocale:"en_US",weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},orderStatuses:[],placeholderImgSrc:"",siteTitle:"",storePages:[],wcAssetUrl:"",wcVersion:"",wpLoginUrl:"",wpVersion:""},r="object"==typeof window.wcSettings?window.wcSettings:{},n={...t,...r};n.currency={...t.currency,...n.currency},n.locale={...t.locale,...n.locale};const a=n.adminUrl,i=n.countries,s=n.currency,c=n.currentUserIsAdmin,l=n.homeUrl,d=n.locale,u=n.orderStatuses,p=n.placeholderImgSrc,_=n.siteTitle,g=n.storePages,b=n.wcAssetUrl,m=n.wcVersion,w=n.wpLoginUrl,y=n.wpVersion,h=window.wp.i18n,S={first_name:{label:(0,h.__)("First name","woocommerce"),optionalLabel:(0,h.__)("First name (optional)","woocommerce"),autocomplete:"given-name",autocapitalize:"sentences",required:!0,hidden:!1,index:10},last_name:{label:(0,h.__)("Last name","woocommerce"),optionalLabel:(0,h.__)("Last name (optional)","woocommerce"),autocomplete:"family-name",autocapitalize:"sentences",required:!0,hidden:!1,index:20},company:{label:(0,h.__)("Company","woocommerce"),optionalLabel:(0,h.__)("Company (optional)","woocommerce"),autocomplete:"organization",autocapitalize:"sentences",required:!1,hidden:!1,index:30},address_1:{label:(0,h.__)("Address","woocommerce"),optionalLabel:(0,h.__)("Address (optional)","woocommerce"),autocomplete:"address-line1",autocapitalize:"sentences",required:!0,hidden:!1,index:40},address_2:{label:(0,h.__)("Apartment, suite, etc.","woocommerce"),optionalLabel:(0,h.__)("Apartment, suite, etc. (optional)","woocommerce"),autocomplete:"address-line2",autocapitalize:"sentences",required:!1,hidden:!1,index:50},country:{label:(0,h.__)("Country/Region","woocommerce"),optionalLabel:(0,h.__)("Country/Region (optional)","woocommerce"),autocomplete:"country",required:!0,hidden:!1,index:60},city:{label:(0,h.__)("City","woocommerce"),optionalLabel:(0,h.__)("City (optional)","woocommerce"),autocomplete:"address-level2",autocapitalize:"sentences",required:!0,hidden:!1,index:70},state:{label:(0,h.__)("State/County","woocommerce"),optionalLabel:(0,h.__)("State/County (optional)","woocommerce"),autocomplete:"address-level1",autocapitalize:"sentences",required:!0,hidden:!1,index:80},postcode:{label:(0,h.__)("Postal code","woocommerce"),optionalLabel:(0,h.__)("Postal code (optional)","woocommerce"),autocomplete:"postal-code",autocapitalize:"characters",required:!0,hidden:!1,index:90},phone:{label:(0,h.__)("Phone","woocommerce"),optionalLabel:(0,h.__)("Phone (optional)","woocommerce"),autocomplete:"tel",type:"tel",required:!0,hidden:!1,index:100}};function f(e,o){const t=U(e),r=U(o),n=t.pop(),a=r.pop(),i=I(t,r);return 0!==i?i:n&&a?I(n.split("."),a.split(".")):n||a?n?-1:1:0}const k=(e,o,t)=>{C(t);const r=f(e,o);return R[t].includes(r)};f.validate=e=>"string"==typeof e&&/^[v\d]/.test(e)&&L.test(e),f.compare=k,f.sastisfies=(e,o)=>{const t=o.match(/^([<>=~^]+)/),r=t?t[1]:"=";if("^"!==r&&"~"!==r)return k(e,o,r);const[n,a,i]=U(e),[s,c,l]=U(o);return 0===E(n,s)&&("^"===r?I([a,i],[c,l])>=0:0===E(a,c)&&E(i,l)>=0)};const L=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,U=e=>{if("string"!=typeof e)throw new TypeError("Invalid argument expected string");const o=e.match(L);if(!o)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return o.shift(),o},x=e=>"*"===e||"x"===e||"X"===e,v=e=>{const o=parseInt(e,10);return isNaN(o)?e:o},E=(e,o)=>{if(x(e)||x(o))return 0;const[t,r]=((e,o)=>typeof e!=typeof o?[String(e),String(o)]:[e,o])(v(e),v(o));return t>r?1:t<r?-1:0},I=(e,o)=>{for(let t=0;t<Math.max(e.length,o.length);t++){const r=E(e[t]||0,o[t]||0);if(0!==r)return r}return 0},R={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]},A=Object.keys(R),C=e=>{if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===A.indexOf(e))throw new Error(`Invalid operator, expected one of ${A.join("|")}`)},T=(e,o=!1,t=((e,o)=>void 0!==e?e:o))=>{let r=o;if(e in n)r=n[e];else if(e.includes("_data")){const t=e.replace("_data",""),n=T("paymentMethodData",{});r=t in n?n[t]:o}return t(r,o)},O=(e,o,t)=>{const r=e in n?n[e]:o;return t(r,o)?r:o},P=(e,o,t)=>{let r=T(e,"").replace(/-[a-zA-Z0-9]*[\-]*/,".0-rc.");return r=r.endsWith(".")?r.substring(0,r.length-1):r,f.compare(r,o,t)},z=(e,o="=")=>P("wpVersion",e,o),M=(e,o="=")=>P("wcVersion",e,o),q=e=>T("adminUrl")+e,N=(e,o=null)=>{var t;return null!==(t=T("paymentMethodData",{})[e])&&void 0!==t?t:o};(this.wc=this.wc||{}).wcSettings=o})();