/*! For license information please see command-palette.js.LICENSE.txt */
(()=>{"use strict";var e={94931:(e,o,r)=>{var t=r(51609),c=Symbol.for("react.element"),n=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};o.jsx=function(e,o,r){var t,i={},s=null,l=null;for(t in void 0!==r&&(s=""+r),void 0!==o.key&&(s=""+o.key),void 0!==o.ref&&(l=o.ref),o)n.call(o,t)&&!d.hasOwnProperty(t)&&(i[t]=o[t]);if(e&&e.defaultProps)for(t in o=e.defaultProps)void 0===i[t]&&(i[t]=o[t]);return{$$typeof:c,type:e,key:s,ref:l,props:i,_owner:a.current}}},39793:(e,o,r)=>{e.exports=r(94931)},51609:e=>{e.exports=window.React}},o={};function r(t){var c=o[t];if(void 0!==c)return c.exports;var n=o[t]={exports:{}};return e[t](n,n.exports,r),n.exports}r.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return r.d(o,{a:o}),o},r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o);const t=window.wc.tracks,c=window.wp.commands,n=window.wp.coreData,a=window.wp.data,d=window.wp.domReady;var i=r.n(d);const s=window.wp.element,l=window.wp.htmlEntities,m=window.wp.i18n;var w=r(39793);const p=window.wp.primitives;var u=(0,w.jsx)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,w.jsx)(p.Path,{fillRule:"evenodd",d:"M5 5.5h14a.5.5 0 01.5.5v1.5a.5.5 0 01-.5.5H5a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 9.232A2 2 0 013 7.5V6a2 2 0 012-2h14a2 2 0 012 2v1.5a2 2 0 01-1 1.732V18a2 2 0 01-2 2H6a2 2 0 01-2-2V9.232zm1.5.268V18a.5.5 0 00.5.5h12a.5.5 0 00.5-.5V9.5h-13z",clipRule:"evenodd"})}),_=(0,w.jsx)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,w.jsx)(p.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})});const v=window.wp.url,h=({name:e,label:o,icon:r,callback:n,origin:d})=>{(0,a.dispatch)(c.store).registerCommand({name:e,label:(0,l.decodeEntities)(o),icon:r,callback:(...o)=>{(0,t.queueRecordEvent)("woocommerce_command_palette_submit",{name:e,origin:d}),n(...o)}})};function f({search:e}){const o=(0,s.useRef)(null);(0,s.useEffect)(()=>(""!==e&&(clearTimeout(o.current),o.current=setTimeout(()=>{(0,t.recordEvent)("woocommerce_command_palette_search",{value:e})},300)),()=>{clearTimeout(o.current)}),[e]);const r="product",{records:c,isLoading:d}=(0,a.useSelect)(o=>{const{getEntityRecords:t}=o(n.store),c={search:e||void 0,per_page:10,orderby:e?"relevance":"date",status:["publish","future","draft","pending","private"]};return{records:t("postType",r,c),isLoading:!o(n.store).hasFinishedResolution("getEntityRecords",["postType",r,c])}},[e]);return{commands:(0,s.useMemo)(()=>(c??[]).map(e=>({name:r+"-"+e.id,searchLabel:e.title?.rendered+" "+e.id,label:e.title?.rendered?(0,l.decodeEntities)(e.title?.rendered):(0,m.__)("(no title)","woocommerce"),icon:u,callback:({close:o})=>{(0,t.queueRecordEvent)("woocommerce_command_palette_submit",{name:"woocommerce/product"});const r={post:e.id,action:"edit"},c=(0,v.addQueryArgs)("post.php",r);document.location=c,o()}})),[c]),isLoading:d}}i()(()=>{h({name:"woocommerce/add-new-product",label:(0,m.__)("Add new product","woocommerce"),icon:_,callback:()=>{document.location=(0,v.addQueryArgs)("post-new.php",{post_type:"product"})}}),h({name:"woocommerce/add-new-order",label:(0,m.__)("Add new order","woocommerce"),icon:_,callback:()=>{document.location=(0,v.addQueryArgs)("admin.php",{page:"wc-orders",action:"new"})}}),h({name:"woocommerce/view-products",label:(0,m.__)("Products","woocommerce"),icon:u,callback:()=>{document.location=(0,v.addQueryArgs)("edit.php",{post_type:"product"})}}),h({name:"woocommerce/view-orders",label:(0,m.__)("Orders","woocommerce"),icon:u,callback:()=>{document.location=(0,v.addQueryArgs)("admin.php",{page:"wc-orders"})}}),(0,a.dispatch)(c.store).registerCommandLoader({name:"woocommerce/product",hook:f})}),(window.wc=window.wc||{}).commandPalette={}})();