diff --git a/CHANGELOG.md b/CHANGELOG.md
index d24da2bfb5..dd4316f799 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,13 @@
### This is a list detailing changes for all Jetpack releases.
+## 13.6-a.0 - unreleased
+
+This is an alpha version! The changes listed here are not final.
+
+### Other changes
+- AI Featured Image: let the backend decide the model for the image generation.
+
## 13.5-beta - 2024-06-03
### Enhancements
- AI Assistant: Fallback to transformation when multiple blocks are selected. [#37632]
diff --git a/_inc/blocks/editor-beta.asset.php b/_inc/blocks/editor-beta.asset.php
index 6937805722..ffcbbbc89e 100644
--- a/_inc/blocks/editor-beta.asset.php
+++ b/_inc/blocks/editor-beta.asset.php
@@ -1 +1 @@
- array('lodash', 'moment', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '1b8c2e0b520ff701a1f5');
+ array('lodash', 'moment', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '44ae0b0597d90ceb0e30');
diff --git a/_inc/blocks/editor-beta.js b/_inc/blocks/editor-beta.js
index 46a1e0b988..a67bcf13b4 100644
--- a/_inc/blocks/editor-beta.js
+++ b/_inc/blocks/editor-beta.js
@@ -3,7 +3,7 @@
// translators: %1$d: number of requests remaining
__("You have %1$d requests remaining.","jetpack"),e)),React.createElement(r.Button,{variant:"link",onClick:n,href:s,target:s?"_blank":null},__("Upgrade now","jetpack")))}function C({error:e,code:t,onTryAgainClick:n,onUpgradeClick:s,upgradeUrl:o}){const i=e||__("Something went wrong","jetpack");return React.createElement(E,{severity:m},React.createElement("span",null,(0,a.sprintf)(
// translators: %1$d: A dynamic error message
-__("Error: %1$s","jetpack"),i)),t===d.$L?React.createElement(r.Button,{variant:"link",onClick:s,href:o,target:o?"_blank":null},__("Upgrade now","jetpack")):React.createElement(r.Button,{variant:"link",onClick:n},__("Try again","jetpack")))}},62282:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,u:()=>s});var r=n(99196),a=n.n(r);const s=(0,r.createContext)({}),o=({value:e,children:t})=>a().createElement(s.Provider,{value:e,children:t})},20281:(e,t,n)=>{"use strict";n.d(t,{X_:()=>s.Z,hE:()=>r.h,oN:()=>a.Z,uE:()=>r.u});var r=n(62282),a=n(3669),s=n(79466)},79466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(99196),a=n(16700),s=n(20281);function o({onDone:e,onSuggestion:t,onError:n}={}){const o=(0,r.useContext)(s.uE),{eventSource:i}=o,l=(0,r.useCallback)((t=>e?.(t?.detail)),[e]),c=(0,r.useCallback)((e=>t?.(e?.detail)),[t]),u=(0,r.useCallback)((e=>{n?.(e?.detail)}),[]);return(0,r.useEffect)((()=>{if(i)return e&&i.addEventListener("done",l),t&&i.addEventListener("suggestion",c),n&&i.addEventListener(a.vF,u),()=>{i.removeEventListener("done",l),i.removeEventListener("suggestion",c),i.removeEventListener(a.vF,u)}}),[i]),o}},3669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(94333),a=n(69307),s=n(99196),o=n.n(s),i=n(42194),l=n(20281);const c=(0,r.createHigherOrderComponent)((e=>t=>{const{suggestion:n,error:r,requestingState:s,request:c,stopSuggestion:u,eventSource:d}=(0,i.Z)(),p=(0,a.useMemo)((()=>({suggestion:n,requestingError:r,requestingState:s,eventSource:d,requestSuggestion:c,stopSuggestion:u})),[n,r,s,d,c,u]);return o().createElement(l.hE,{value:p},o().createElement(e,t))}),"withAiDataProvider")},42194:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Z:()=>l});var r=n(69307),a=n(65736),s=n(67742),o=n(16700);const __=a.__;function i(e){switch(e){case o.$L:return{code:o.$L,message:__("You have reached the limit of requests for this site.","jetpack"),severity:"info"};case o.bC:return{code:o.bC,message:__("Your request was unclear. Mind trying again?","jetpack"),severity:"info"};case o.$u:return{code:o.$u,message:__("Jetpack AI services are currently unavailable. Sorry for the inconvenience.","jetpack"),severity:"info"};case o.q4:return{code:o.q4,message:__("This request has been flagged by our moderation system. Please try to rephrase it and try again.","jetpack"),severity:"info"};case o.cv:return{code:o.cv,message:__("The content is too large to be processed all at once. Please try to shorten it or divide it into smaller parts.","jetpack"),severity:"info"};case o.co:default:return{code:o.co,message:__("It was not possible to process your request. Mind trying again?","jetpack"),severity:"info"}}}function l({prompt:e,autoRequest:t=!1,askQuestionOptions:n={},initialRequestingState:a="init",onSuggestion:l,onDone:c,onStop:u,onError:d,onAllErrors:p}={}){const[m,g]=(0,r.useState)(a),[A,h]=(0,r.useState)(""),[E,f]=(0,r.useState)(),b=(0,r.useRef)(void 0),C=(0,r.useCallback)((e=>{h(e?.detail),l?.(e?.detail)}),[l]),v=(0,r.useCallback)((e=>{Q(),c?.(e?.detail),g("done")}),[c]),k=(0,r.useCallback)((e=>{p?.(e?.detail)}),[p]),B=(0,r.useCallback)((e=>{b?.current?.close(),g("error"),f(i(e)),d?.(i(e))}),[d]),y=(0,r.useCallback)((()=>B(o.$L)),[]),w=(0,r.useCallback)((()=>B(o.bC)),[]),_=(0,r.useCallback)((()=>B(o.$u)),[]),I=(0,r.useCallback)((()=>B(o.q4)),[]),j=(0,r.useCallback)((()=>B(o.co)),[]),x=(0,r.useCallback)((async(e,t={...n})=>{if(f(void 0),g("requesting"),b.current=await(0,s.Z)(e,t),!b?.current)return;const r=b.current;g("suggesting"),r.addEventListener("suggestion",C),r.addEventListener(o.$L,y),r.addEventListener(o.bC,w),r.addEventListener(o.$u,_),r.addEventListener(o.q4,I),r.addEventListener(o.co,j),r.addEventListener(o.vF,k),r.addEventListener("done",v)}),[v,y,w,_,I,j,C]),S=(0,r.useCallback)((()=>{g("init"),h(""),f(void 0)}),[]),Q=(0,r.useCallback)((()=>{if(!b?.current)return;const e=b?.current;e.close(),e.removeEventListener("suggestion",C),e.removeEventListener(o.$L,y),e.removeEventListener(o.bC,w),e.removeEventListener(o.$u,_),e.removeEventListener(o.q4,I),e.removeEventListener(o.co,j),e.removeEventListener("done",v)}),[b,C,y,w,_,I,j,v]),N=(0,r.useCallback)((()=>{Q(),u?.(),g("done")}),[u]);return(0,r.useEffect)((()=>{if(e?.length)return t&&x(e,n),()=>{N()}}),[t,e,x,N]),{suggestion:A,error:E,requestingState:m,request:x,stopSuggestion:N,reset:S,handleErrorQuotaExceededError:y,eventSource:b.current}}},93509:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(69307),a=n(65736),s=n(51128),o=n.n(s),i=n(46961);const __=a.__,l=o()("jetpack-ai-client:use-audio-transcription"),c=e=>{if("string"==typeof e)return e;if("code"in e)switch(e.code){case"error_quota_exceeded":return __("You exceeded your current quota, please check your plan details.","jetpack");case"jetpack_ai_missing_audio_param":return __("The audio_file is required to perform a transcription.","jetpack");case"jetpack_ai_service_unavailable":return __("The Jetpack AI service is temporarily unavailable.","jetpack");case"file_size_not_supported":return __("The provided audio file is too big.","jetpack");case"file_type_not_supported":return __("The provided audio file type is not supported.","jetpack");case"jetpack_ai_error":return __("There was an error processing the transcription request.","jetpack");default:return e.message}return"message"in e?e.message:__("There was an error processing the transcription request.","jetpack")};function u({feature:e,onReady:t,onError:n}){const[a,s]=(0,r.useState)(""),[o,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useRef)(null);return{transcriptionResult:a,isTranscribingAudio:d,transcriptionError:o,transcribeAudio:(0,r.useCallback)((r=>{l("Transcribing audio"),s(""),u(""),p(!0);const a=new AbortController;m.current=a,(0,i.Z)(r,e,a.signal).then((e=>{s(e),t?.(e)})).catch((e=>{a.signal.aborted||(u(e.message),n?.(c(e)))})).finally((()=>p(!1)))}),[i.Z,s,u,p]),cancelTranscription:(0,r.useCallback)((()=>{m.current?.abort(),s(""),u(""),p(!1)}),[m,s,u,p])}}},92718:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(69307),a=n(65736);const __=a.__,s=25e6,o=1500,i=["audio/mpeg","audio/mp3","audio/ogg","audio/flac","audio/x-flac","audio/m4a","audio/x-m4a","audio/mp4","audio/wav","audio/wave","audio/x-wav","audio/webm"];function l(){const[e,t]=(0,r.useState)(!1);return{isValidatingAudio:e,validateAudio:(0,r.useCallback)(((e,n,r)=>{if(t(!0),e?.size>s)return t(!1),r(__("The audio file is too large. The maximum file size is 25MB.","jetpack"));const a=e instanceof File;if(a&&!i.includes(e.type))return t(!1),r(__("The audio file type is not supported. Please use a supported audio file type.","jetpack"));const l=new AudioContext;e.arrayBuffer().then((s=>{l.decodeAudioData(s,(function(s){const i=Math.ceil(s.duration);return i>o?(t(!1),r(__("The audio file is too long. The maximum recording time is 25 minutes.","jetpack"))):(t(!1),n({duration:i,isFile:a,size:e?.size}))}))}))}),[t])}}},70286:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51128),a=n.n(r),s=n(78982),o=n(2890);const i=a()("ai-client:use-image-generator"),l=(e,t)=>{const n=4e3-t;return e.length>n?e.substring(0,n-6)+" [...]":e},c=async(e,t,n)=>{const r=((e,t)=>{if(t){const n=`I need a Stable Diffusion prompt to generate a featured image for a blog post based on this user-provided image description:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nThe image should be a photo. Make sure you highlight the main suject of the image description, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}return"I need a Stable Diffusion prompt to generate a featured image for a blog post with the following content.\nThe image should be a photo. Make sure you highlight the main suject of the content, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments. The content is:\n\n"+l(e,412)})(e,t),a=await(0,s.Z)(r,{feature:n});return a.choices?.[0]?.message?.content},u=()=>{const e=async function(e){let t="";try{t=(await(0,o.Z)()).token}catch(e){return i("Error getting token: %o",e),Promise.reject(e)}try{const n="https://public-api.wordpress.com/wpcom/v2/jetpack-ai-image",r={Authorization:`Bearer ${t}`,"Content-Type":"application/json"},a=await fetch(n,{method:"POST",headers:r,body:JSON.stringify(e)}).then((e=>e.json()));return a?.data?.status&&a?.data?.status>200?(i("Error generating image: %o",a),Promise.reject(a)):a}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}};return{generateImage:async function({feature:t,postContent:n,responseFormat:r="url",userPrompt:a}){try{i("Generating image");const s=((e,t)=>{if(t){const n=`I need a cover image for a blog post based on this user prompt:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nBefore creating the image, identify the main topic of the user prompt and relate it to the post content.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}const n="I need a cover image for a blog post.\nBefore creating the image, identify the main topic of the content and only represent it.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nThis is the post content:\n\n";return n+l(e,838)})(n,a),o={prompt:s,response_format:r,feature:t,size:"1792x1024"};return await e(o)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithStableDiffusion:async function({feature:t,postContent:n,userPrompt:r}){try{i("Generating image with Stable Diffusion");const a={prompt:await c(n,r,t),feature:t,model:"stable-diffusion",style:"photographic"};return await e(a)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}}}}},13109:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(69307);const a="audio/mp4;codecs=mp4a",s="audio/mp4",o="audio/webm";function i({onDone:e}={}){const t=(0,r.useRef)(null),[n,i]=(0,r.useState)("inactive"),l=(0,r.useRef)(!1),c=(0,r.useRef)(0),[u,d]=(0,r.useState)(0),p=(0,r.useRef)(null),[m,g]=(0,r.useState)(null),A=(0,r.useRef)([]).current,[h,E]=(0,r.useState)(null),f=(0,r.useRef)(null);function b(){return MediaRecorder.isTypeSupported(a)?new Blob(A,{type:s}):new Blob(A,{type:o})}const C=(0,r.useCallback)((e=>{if(y(),!e)return t?.current?.start();e<100&&(e=100),c.current=Date.now(),t?.current?.start(e)}),[]),v=(0,r.useCallback)((()=>{l.current=!0,t?.current?.pause(),d((e=>e+Date.now()-c.current))}),[]),k=(0,r.useCallback)((()=>{l.current=!1,t?.current?.resume(),c.current=Date.now()}),[]),B=(0,r.useCallback)((()=>{t?.current?.stop(),"recording"===n&&d((e=>e+Date.now()-c.current))}),[]),y=(0,r.useCallback)((()=>{A.length=0,g(null),E(null),d(0),l.current=!1,c.current=0}),[]),w=(0,r.useCallback)((()=>{t?.current&&(t.current.removeEventListener("start",j),t.current.removeEventListener("stop",x),t.current.removeEventListener("pause",S),t.current.removeEventListener("resume",Q),t.current.removeEventListener("dataavailable",N),t.current=null)}),[]),_=(0,r.useCallback)((()=>{if(i("inactive"),y(),w(),!navigator.mediaDevices?.getUserMedia)return;const e=new AudioContext;f.current=e.createAnalyser();navigator.mediaDevices.getUserMedia({audio:!0}).then((n=>{p.current=n;e.createMediaStreamSource(n).connect(f.current),MediaRecorder.isTypeSupported(a)?t.current=new MediaRecorder(n,{mimeType:a}):t.current=new MediaRecorder(n,{mimeType:o}),t.current.addEventListener("start",j),t.current.addEventListener("stop",x),t.current.addEventListener("pause",S),t.current.addEventListener("resume",Q),t.current.addEventListener("dataavailable",N)})).catch((e=>{throw e}))}),[]),I=(0,r.useCallback)((e=>{B(),E("string"==typeof e?e:e.message),i("error")}),[]);function j(){i("recording")}function x(){const t=b();e?.(t),A.length=0}function S(){i("paused")}function Q(){i("recording")}function N(e){const{data:t}=e;t?.size&&(A.push(t),g(b()),l.current||d((e=>{const t=Date.now(),n=t-c.current;return c.current=t,e+n})))}return(0,r.useEffect)((()=>(_(),()=>{p.current&&p.current.getTracks().forEach((e=>e.stop())),w()})),[]),{state:n,blob:m,error:h,duration:u,analyser:f.current,onError:I,controls:{start:C,pause:v,resume:k,stop:B,reset:_}}}},44696:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>c});var r=n(69307),a=n(51128),s=n.n(a),o=n(42194);const i=s()("jetpack-ai-client:use-transcription-post-processing"),l="voice-to-content-simple-draft";function c({feature:e,onReady:t,onError:n,onUpdate:a}){const[s,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useCallback)((e=>{l(e),a?.(e)}),[l,a]),g=(0,r.useCallback)((e=>{l(e),a?.(e),t?.(e)}),[l,a,t]),A=(0,r.useCallback)((e=>{u(e.message),n?.(e.message)}),[u,n]),{request:h,stopSuggestion:E}=(0,o.Z)({onSuggestion:m,onDone:g,onError:A});return{postProcessingResult:s,isProcessingTranscription:d,postProcessingError:c,processTranscription:(0,r.useCallback)(((t,n)=>{i("Post-processing transcription"),l(""),u(""),p(!0);h([{role:"jetpack-ai",context:{type:t,content:n}}],{feature:e})}),[l,u,p,h,e]),cancelTranscriptionProcessing:(0,r.useCallback)((()=>{E(),p(!1)}),[E,p])}}},61317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"ai-assistant-icon"},s().createElement(r.Path,{className:"spark-first",d:"M9.33301 5.33325L10.4644 8.20188L13.333 9.33325L10.4644 10.4646L9.33301 13.3333L8.20164 10.4646L5.33301 9.33325L8.20164 8.20188L9.33301 5.33325Z"}),s().createElement(r.Path,{className:"spark-second",d:"M21.3333 5.33333L22.8418 9.15817L26.6667 10.6667L22.8418 12.1752L21.3333 16L19.8248 12.1752L16 10.6667L19.8248 9.15817L21.3333 5.33333Z"}),s().createElement(r.Path,{className:"spark-third",d:"M14.6667 13.3333L16.5523 18.1144L21.3333 20L16.5523 21.8856L14.6667 26.6667L12.781 21.8856L8 20L12.781 18.1144L14.6667 13.3333Z"}))},83585:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(55609);const a=React.createElement(r.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.95833C6.66328 3.95833 3.95833 6.66327 3.95833 9.99999C3.95833 13.3367 6.66328 16.0417 10 16.0417C13.3367 16.0417 16.0417 13.3367 16.0417 9.99999C16.0417 6.66327 13.3367 3.95833 10 3.95833ZM2.70833 9.99999C2.70833 5.97292 5.97292 2.70833 10 2.70833C14.0271 2.70833 17.2917 5.97292 17.2917 9.99999C17.2917 14.0271 14.0271 17.2917 10 17.2917C5.97292 17.2917 2.70833 14.0271 2.70833 9.99999Z"}),React.createElement(r.Path,{d:"M10.8333 5.83333H9.16667V10.8333H10.8333V5.83333Z"}),React.createElement(r.Path,{d:"M10.8333 12.5H9.16667V14.1667H10.8333V12.5Z"}))},59822:(e,t,n)=>{"use strict";n.d(t,{Qf:()=>a.Z,Qr:()=>s.Z,u_:()=>r.Z,v_:()=>o.Z});var r=n(61317),a=n(81204),s=(n(4454),n(71893),n(52887),n(96083)),o=n(50500)},81204:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"10.5",y:"8.25",width:"3",height:"4.875",rx:"1.5",fill:"#008710"}),s().createElement(r.Path,{d:"M15 11.25C15 11.644 14.9224 12.0341 14.7716 12.3981C14.6209 12.762 14.3999 13.0927 14.1213 13.3713C13.8427 13.6499 13.512 13.8709 13.1481 14.0216C12.7841 14.1724 12.394 14.25 12 14.25C11.606 14.25 11.2159 14.1724 10.8519 14.0216C10.488 13.8709 10.1573 13.6499 9.87868 13.3713C9.6001 13.0927 9.37913 12.762 9.22836 12.3981C9.0776 12.0341 9 11.644 9 11.25",stroke:"#008710",strokeWidth:"1.125",strokeLinecap:"round"}),s().createElement(r.Path,{d:"M11.4375 15.75C11.4375 16.0607 11.6893 16.3125 12 16.3125C12.3107 16.3125 12.5625 16.0607 12.5625 15.75L11.4375 15.75ZM11.4375 14.25L11.4375 15.75L12.5625 15.75L12.5625 14.25L11.4375 14.25Z",fill:"#008710"}))},4454:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},96083:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"12.75",y:"9",width:"2.25",height:"6",fill:"#008710"}),s().createElement(r.Rect,{x:"9",y:"9",width:"2.25",height:"6",fill:"#008710"}))},71893:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},52887:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Rect},50500:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5 10C12.5 11.3807 11.3807 12.5 10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10ZM14 10C14 12.2091 12.2091 14 10 14C7.79086 14 6 12.2091 6 10C6 7.79086 7.79086 6 10 6C12.2091 6 14 7.79086 14 10ZM16.75 21V19C16.75 17.4812 15.5188 16.25 14 16.25L6 16.25C4.48122 16.25 3.25 17.4812 3.25 19V21H4.75L4.75 19C4.75 18.3096 5.30964 17.75 6 17.75L14 17.75C14.6904 17.75 15.25 18.3096 15.25 19V21H16.75Z",fill:"currentColor"}),s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M19.976 16.3599C21.2507 14.5642 22.0001 12.3695 22.0001 9.99969C22.0001 7.63128 21.2515 5.43769 19.9782 3.64258L18.754 4.50967C19.8537 6.05996 20.5001 7.95434 20.5001 9.99969C20.5001 12.0464 19.8528 13.9419 18.7519 15.4928L19.976 16.3599ZM17.3357 14.4897C18.2357 13.222 18.7648 11.6727 18.7648 9.99969C18.7648 8.32808 18.2365 6.77984 17.3379 5.51279L16.1137 6.37988C16.8387 7.4021 17.2648 8.65114 17.2648 9.99969C17.2648 11.3496 16.8378 12.5998 16.1116 13.6226L17.3357 14.4897Z",fill:"currentColor"}))},42290:(e,t,n)=>{"use strict";n.d(t,{$L:()=>p.$L,$u:()=>p.$u,C3:()=>u.C3,Eo:()=>u.Eo,JP:()=>m.JP,L$:()=>i.Z,LB:()=>m.LB,MW:()=>u.MW,OS:()=>o.Z,Qf:()=>c.Qf,Qr:()=>c.Qr,Rc:()=>l.Z,X_:()=>d.X_,Y:()=>p.Y,ZK:()=>u.ZK,_T:()=>a.Z,bC:()=>p.bC,cH:()=>s.Z,co:()=>p.co,cv:()=>p.cv,g:()=>m.g,oN:()=>d.oN,pw:()=>r.Z,q4:()=>p.q4,rp:()=>u.rp,u_:()=>c.u_,v_:()=>c.v_,xi:()=>u.xi});n(2890),n(56694),n(67742),n(46961);var r=n(42194),a=n(13109),s=n(93509),o=n(44696),i=n(92718),l=n(70286),c=n(59822),u=n(58890),d=n(20281),p=n(16700),m=n(35613)},2890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(51128),s=n.n(a),o=n(87309);const i=s()("jetpack-ai-client:jwt"),l="jetpack-ai-jwt",c=12e4;async function u({apiNonce:e,siteId:t,expirationTime:n}={}){e=e||window.JP_CONNECTION_INITIAL_STATE.apiNonce,t=t||window.JP_CONNECTION_INITIAL_STATE.siteSuffix,n=n||c;const a=(0,r.Wp)(),s=localStorage.getItem(l);let u,d=null;if(s)try{d=JSON.parse(s)}catch(e){i("Error parsing token",e)}if(d&&d?.expire>Date.now())return i("Using cached token"),d;u=a?await(0,o.Z)({path:"/wpcom/v2/sites/"+t+"/jetpack-openai-query/jwt",method:"POST"}):await(0,o.Z)({path:"/jetpack/v4/jetpack-ai-jwt?_cacheBuster="+Date.now(),credentials:"same-origin",headers:{"X-WP-Nonce":e},method:"POST"});const p={token:u.token,blogId:a?t:u.blog_id,expire:Date.now()+n};return i("Storing new token"),localStorage.setItem(l,JSON.stringify(p)),p}},35613:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.JP,LB:()=>r.LB,g:()=>r.g});var r=n(71197)},22999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(92213);const a={paragraph:e=>e.replaceAll("\n"," ")},s={emDelimiter:"_",headingStyle:"atx"},o={strikethrough:{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}}};class i{constructor({options:e={},rules:t={},keep:n=[],remove:a=[],fixes:i=[]}={}){this.fixes=i,this.turndownService=new r.Z({...s,...e}),this.turndownService.keep(n),this.turndownService.remove(a);const l={...o,...t};for(const e in l)this.turndownService.addRule(e,l[e])}render({content:e}){const t=this.turndownService.turndown(e);return this.fixes.reduce(((e,t)=>a[t](e)),t)}}},71197:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.Z,LB:()=>o,g:()=>i});var r=n(22999);const a=new(n(28603).Z),s=new r.Z,o=({content:e,rules:t,extension:n})=>a.render({content:e,rules:t,extension:n}),i=({content:e})=>s.render({content:e})},28603:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(95601);const a=e=>e.replaceAll("\x3c!-- wp:list-item --\x3e","").replaceAll("\x3c!-- /wp:list-item --\x3e","").replaceAll("\x3c!-- wp:list --\x3e","").replaceAll("\x3c!-- /wp:list --\x3e","").replaceAll("
","\x3c!-- wp:list-item --\x3e ").replaceAll(" ","\x3c!-- /wp:list-item --\x3e").replaceAll("",'\x3c!-- wp:list {"ordered":true} --\x3e').replaceAll(" "," \x3c!-- /wp:list --\x3e").replaceAll("","\x3c!-- wp:list --\x3e"," \x3c!-- /wp:list --\x3e"),s={list:(e,t=!1)=>{const n=e.replace(/\s+/g,"
").replace(/<\/p>\s+<\/li>/g," ");return t?a(n):n},listItem:(e,t=!1)=>t?a(e.replace(/^<[ou]l>\s*/g,"").replace(/\s*<\/[ou]l>\s*$/g,"")):e,paragraph:(e,t=!1)=>t?e.replaceAll(/\s*<br \/>\s*/g," "):e},o={breaks:!0},i=["list"];class l{constructor(e=o){this.markdownConverter=new r.Z(e)}render({content:e,rules:t=i,extension:n=!1}){const r=this.markdownConverter.render(e);return t.reduce(((e,t)=>s[t](e,n)),r)}}},56694:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(60400),a=n(51128),s=n.n(a),o=n(42194),i=n(2890),l=n(16700);const c=s()("jetpack-ai-client:suggestions-event-source");class u extends EventTarget{constructor(e){super(),this.fullMessage="",this.fullFunctionCall={name:"",arguments:""},this.isPromptClear=!1,this.controller=new AbortController,this.initEventSource(e)}async initEventSource({url:e,question:t,token:n,options:a={}}){if(!n)try{c("Token was not provided, requesting one..."),n=(await(0,i.Z)()).token}catch(e){return void this.processErrorEvent(e)}const s={};if(Number.isInteger(parseInt(a.postId))&&(s.post_id=+a.postId),!e){const t=new URL("https://public-api.wordpress.com/wpcom/v2/jetpack-ai-query");a?.fromCache&&t.searchParams.append("stream_cache","true"),e=t.toString(),c("URL not provided, using default: %o",e)}Array.isArray(t)?s.messages=t:s.question=t,a?.feature?.length&&(c("Feature: %o",a.feature),s.feature=a.feature),a?.functions?.length&&(c("Functions: %o",a.functions),s.functions=a.functions),a?.model?.length&&(c("Model: %o",a.model),s.model=a.model),this.errorUnclearPromptTriggered=!1,await(0,r.L)(e,{openWhenHidden:!0,method:"POST",headers:{"Content-type":"application/json",Authorization:"Bearer "+n},body:JSON.stringify(s),onclose:()=>{c("Stream closed")},onerror:e=>{throw this.processErrorEvent(e),e},onmessage:e=>{this.processEvent(e)},onopen:async e=>{if(e.ok)return;let t;throw e.status>=400&&e.status<=500&&![413,422,429].includes(e.status)&&(c("Connection error: %o",e),t=l.co,this.dispatchEvent(new CustomEvent(l.co,{detail:e}))),503===e.status&&(t=l.$u,this.dispatchEvent(new CustomEvent(l.$u))),413===e.status&&(t=l.cv,this.dispatchEvent(new CustomEvent(l.cv))),422===e.status&&(t=l.q4,this.dispatchEvent(new CustomEvent(l.q4))),429===e.status&&(t=l.$L,this.dispatchEvent(new CustomEvent(l.$L))),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(t)})),new Error},signal:this.controller.signal})}checkForUnclearPrompt(){if(this.isPromptClear)return;const e=this.fullMessage.replace(/__|(\*\*)/g,"");if(e.startsWith("JETPACK_AI_ERROR")){if(this.errorUnclearPromptTriggered)return;this.errorUnclearPromptTriggered=!0,this.dispatchEvent(new CustomEvent(l.bC)),c("Unclear error prompt dispatched"),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.bC)}))}else"JETPACK_AI_ERROR".startsWith(e)?c(this.fullMessage):this.isPromptClear=!0}close(){this.controller.abort()}processEvent(e){if("[DONE]"===e.data){if(this.errorUnclearPromptTriggered)return;if(this.fullMessage.length)return this.dispatchEvent(new CustomEvent("done",{detail:this.fullMessage})),void c("Done: %o",this.fullMessage);if(this.fullFunctionCall.name.length)return this.dispatchEvent(new CustomEvent("function_done",{detail:this.fullFunctionCall})),void c("Done: %o",this.fullFunctionCall)}let t;try{t=JSON.parse(e.data)}catch(t){return void c("Error parsing JSON",e,t)}const{delta:n}=t?.choices?.[0]??{delta:{content:null,function_call:null}},r=n.content,a=n.function_call;r&&(this.fullMessage+=r,this.checkForUnclearPrompt(),this.isPromptClear&&(this.dispatchEvent(new CustomEvent("chunk",{detail:r})),c("suggestion: %o",this.fullMessage),this.dispatchEvent(new CustomEvent("suggestion",{detail:this.fullMessage})))),a&&(null!=a.name&&(this.fullFunctionCall.name+=a.name),null!=a.arguments&&(this.fullFunctionCall.arguments+=a.arguments),this.dispatchEvent(new CustomEvent("functionCallChunk",{detail:this.fullFunctionCall})))}processErrorEvent(e){c("onerror: %o",e),this.dispatchEvent(new CustomEvent(l.co,{detail:e})),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.co)}))}}},16700:(e,t,n)=>{"use strict";n.d(t,{$L:()=>s,$u:()=>a,Y:()=>r.Y,bC:()=>c,co:()=>l,cv:()=>i,q4:()=>o,vF:()=>u});var r=n(44696);const a="error_service_unavailable",s="error_quota_exceeded",o="error_moderation",i="error_context_too_large",l="error_network",c="error_unclear_prompt",u="error_response"},6975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51128);const a=n.n(r)()("dops:analytics");let s,o;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const i={initialize:function(e,t,n){i.setUser(e,t),i.setSuperProps(n),i.identifyUser()},setGoogleAnalyticsEnabled:function(e,t=null){this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){o={ID:e,username:t}},setSuperProps:function(e){s=e},assignSuperProps:function(e){s=Object.assign(s||{},e)},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Built stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){i.tracks.recordPageView(e),i.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,a,s,o){i.ga.recordPurchase(e,t,n,r,a,s,o)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(s&&(a("- Super Props: %o",s),t=Object.assign(t,s)),a('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):a('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};i.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){i.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){a("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};i.ga.initialized||(o&&(e={userId:"u-"+o.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),i.ga.initialized=!0)},recordPageView:function(e,t){i.ga.initialize(),a("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){i.ga.initialize();let s="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(s+=" [Option Label: "+n+"]"),void 0!==r&&(s+=" [Option Value: "+r+"]"),a(s),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,a,s,o){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:o}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:a,quantity:s}),window.ga("ecommerce:send")}},identifyUser:function(){o&&window._tkq.push(["identifyUser",o.ID,o.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}},l=i},64743:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(61132),a=n(96483);function s(e){class t extends Error{constructor(...t){super(...t),this.name=e}}return t}const o=s("JsonParseError"),i=s("JsonParseAfterRedirectError"),l=s("Api404Error"),c=s("Api404AfterRedirectError"),u=s("FetchNetworkError");const d=new function(e,t){let n=e,s=e,o={"X-WP-Nonce":t},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})},c=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setWpcomOriginApiUrl(e){s=e},setApiNonce(e){o={"X-WP-Nonce":e},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{c=e},registerSite:(e,t,a)=>{const s={registration_nonce:e,no_iframe:!0};return(0,r.jetpackConfigHas)("consumer_slug")&&(s.plugin_slug=(0,r.jetpackConfigGet)("consumer_slug")),null!==t&&(s.redirect_uri=t),a&&(s.from=a),g(`${n}jetpack/v4/connection/register`,l,{body:JSON.stringify(s)}).then(p).then(m)},fetchAuthorizationUrl:e=>d((0,a.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),i).then(p).then(m),fetchSiteConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchSiteConnectionStatus:()=>d(`${n}jetpack/v4/connection`,i).then(m),fetchSiteConnectionTest:()=>d(`${n}jetpack/v4/connection/test`,i).then(p).then(m),fetchUserConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchUserTrackingSettings:()=>d(`${n}jetpack/v4/tracking/settings`,i).then(p).then(m),updateUserTrackingSettings:e=>g(`${n}jetpack/v4/tracking/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),disconnectSite:()=>g(`${n}jetpack/v4/connection`,l,{body:JSON.stringify({isActive:!1})}).then(p).then(m),fetchConnectUrl:()=>d(`${n}jetpack/v4/connection/url`,i).then(p).then(m),unlinkUser:()=>g(`${n}jetpack/v4/connection/user`,l,{body:JSON.stringify({linked:!1})}).then(p).then(m),reconnect:()=>g(`${n}jetpack/v4/connection/reconnect`,l).then(p).then(m),fetchConnectedPlugins:()=>d(`${n}jetpack/v4/connection/plugins`,i).then(p).then(m),setHasSeenWCConnectionModal:()=>g(`${n}jetpack/v4/seen-wc-connection-modal`,l).then(p).then(m),fetchModules:()=>d(`${n}jetpack/v4/module/all`,i).then(p).then(m),fetchModule:e=>d(`${n}jetpack/v4/module/${e}`,i).then(p).then(m),activateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!0})}).then(p).then(m),deactivateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>g(`${n}jetpack/v4/module/${e}`,l,{body:JSON.stringify(t)}).then(p).then(m),updateSettings:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),getProtectCount:()=>d(`${n}jetpack/v4/module/protect/data`,i).then(p).then(m),resetOptions:e=>g(`${n}jetpack/v4/options/${e}`,l,{body:JSON.stringify({reset:!0})}).then(p).then(m),activateVaultPress:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(p).then(m),getVaultPressData:()=>d(`${n}jetpack/v4/module/vaultpress/data`,i).then(p).then(m),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify(r)}).then(p).then(m)},activateAkismet:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(p).then(m),getAkismetData:()=>d(`${n}jetpack/v4/module/akismet/data`,i).then(p).then(m),checkAkismetKey:()=>d(`${n}jetpack/v4/module/akismet/key/check`,i).then(p).then(m),checkAkismetKeyTyped:e=>g(`${n}jetpack/v4/module/akismet/key/check`,l,{body:JSON.stringify({api_key:e})}).then(p).then(m),fetchStatsData:e=>d(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),i).then(p).then(m).then(h),getPluginUpdates:()=>d(`${n}jetpack/v4/updates/plugins`,i).then(p).then(m),getPlans:()=>d(`${n}jetpack/v4/plans`,i).then(p).then(m),fetchSettings:()=>d(`${n}jetpack/v4/settings`,i).then(p).then(m),updateSetting:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSiteData:()=>d(`${n}jetpack/v4/site`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>d(`${n}jetpack/v4/site/features`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>d(`${n}jetpack/v4/site/products`,i).then(p).then(m),fetchSitePurchases:()=>d(`${n}jetpack/v4/site/purchases`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>d(`${n}jetpack/v4/site/benefits`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteDiscount:()=>d(`${n}jetpack/v4/site/discount`,i).then(p).then(m).then((e=>e.data)),fetchSetupQuestionnaire:()=>d(`${n}jetpack/v4/setup/questionnaire`,i).then(p).then(m),fetchRecommendationsData:()=>d(`${n}jetpack/v4/recommendations/data`,i).then(p).then(m),fetchRecommendationsProductSuggestions:()=>d(`${n}jetpack/v4/recommendations/product-suggestions`,i).then(p).then(m),fetchRecommendationsUpsell:()=>d(`${n}jetpack/v4/recommendations/upsell`,i).then(p).then(m),fetchRecommendationsConditional:()=>d(`${n}jetpack/v4/recommendations/conditional`,i).then(p).then(m),saveRecommendationsData:e=>g(`${n}jetpack/v4/recommendations/data`,l,{body:JSON.stringify({data:e})}).then(p),fetchProducts:()=>d(`${n}jetpack/v4/products`,i).then(p).then(m),fetchRewindStatus:()=>d(`${n}jetpack/v4/rewind`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>d(`${n}jetpack/v4/scan`,i).then(p).then(m).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>g(`${n}jetpack/v4/notice/${e}`,l,{body:JSON.stringify({dismissed:!0})}).then(p).then(m),fetchPluginsData:()=>d(`${n}jetpack/v4/plugins`,i).then(p).then(m),fetchIntroOffers:()=>d(`${n}jetpack/v4/intro-offers`,i).then(p).then(m),fetchVerifySiteGoogleStatus:e=>d(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,i).then(p).then(m),verifySiteGoogle:e=>g(`${n}jetpack/v4/verify-site/google`,l,{body:JSON.stringify({keyring_id:e})}).then(p).then(m),submitSurvey:e=>g(`${n}jetpack/v4/marketing/survey`,l,{body:JSON.stringify(e)}).then(p).then(m),saveSetupQuestionnaire:e=>g(`${n}jetpack/v4/setup/questionnaire`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicensingError:e=>g(`${n}jetpack/v4/licensing/error`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicenseKey:e=>g(`${n}jetpack/v4/licensing/set-license`,l,{body:JSON.stringify({license:e})}).then(p).then(m),getUserLicensesCounts:()=>d(`${n}jetpack/v4/licensing/user/counts`,i).then(p).then(m),getUserLicenses:()=>d(`${n}jetpack/v4/licensing/user/licenses`,i).then(p).then(m),updateLicensingActivationNoticeDismiss:e=>g(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,l,{body:JSON.stringify({last_detached_count:e})}).then(p).then(m),updateRecommendationsStep:e=>g(`${n}jetpack/v4/recommendations/step`,l,{body:JSON.stringify({step:e})}).then(p),confirmIDCSafeMode:()=>g(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,l).then(p),startIDCFresh:e=>g(`${n}jetpack/v4/identity-crisis/start-fresh`,l,{body:JSON.stringify({redirect_uri:e})}).then(p).then(m),migrateIDC:()=>g(`${n}jetpack/v4/identity-crisis/migrate`,l).then(p),attachLicenses:e=>g(`${n}jetpack/v4/licensing/attach-licenses`,l,{body:JSON.stringify({licenses:e})}).then(p).then(m),fetchSearchPlanInfo:()=>d(`${s}jetpack/v4/search/plan`,i).then(p).then(m),fetchSearchSettings:()=>d(`${s}jetpack/v4/search/settings`,i).then(p).then(m),updateSearchSettings:e=>g(`${s}jetpack/v4/search/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSearchStats:()=>d(`${s}jetpack/v4/search/stats`,i).then(p).then(m),fetchWafSettings:()=>d(`${n}jetpack/v4/waf`,i).then(p).then(m),updateWafSettings:e=>g(`${n}jetpack/v4/waf`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchWordAdsSettings:()=>d(`${n}jetpack/v4/wordads/settings`,i).then(p).then(m),updateWordAdsSettings:e=>g(`${n}jetpack/v4/wordads/settings`,l,{body:JSON.stringify(e)}),fetchSearchPricing:()=>d(`${s}jetpack/v4/search/pricing`,i).then(p).then(m),fetchMigrationStatus:()=>d(`${n}jetpack/v4/migration/status`,i).then(p).then(m),fetchBackupUndoEvent:()=>d(`${n}jetpack/v4/site/backup/undo-event`,i).then(p).then(m),fetchBackupPreflightStatus:()=>d(`${n}jetpack/v4/site/backup/preflight`,i).then(p).then(m)};function d(e,t){return fetch(c(e),t)}function g(e,t,n){return fetch(e,Object.assign({},t,n)).catch(A)}function h(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}Object.assign(this,u)};function p(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new c(e.redirected):new l})):e.json().catch((e=>g(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function m(e){return e.json().catch((t=>g(t,e.redirected,e.url)))}function g(e,t,n){throw t?new i(n):new o}function A(){throw new u}},90526:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(82674),a=n.n(r),s=n(55609),o=n(65736),i=n(61074),l=n(15381),c=n(65235),u=n.n(c),d=n(99196),p=n.n(d),m=n(62103);const __=o.__,g=(0,d.forwardRef)(((e,t)=>{const{children:n,variant:r="primary",size:o="normal",weight:c="bold",icon:d,iconSize:g,disabled:A,isDestructive:h,isLoading:E,isExternalLink:f,className:b,text:C,fullWidth:v,...k}=e,B=u()(m.Z.button,b,{[m.Z.normal]:"normal"===o,[m.Z.small]:"small"===o,[m.Z.icon]:Boolean(d),[m.Z.loading]:E,[m.Z.regular]:"regular"===c,[m.Z["full-width"]]:v,[m.Z["is-icon-button"]]:Boolean(d)&&!n});k.ref=t;const y="normal"===o?20:16,w=f&&p().createElement(p().Fragment,null,p().createElement(i.Z,{size:y,icon:l.Z,className:m.Z["external-icon"]}),p().createElement(s.VisuallyHidden,{as:"span"},/* translators: accessibility text */
+__("Error: %1$s","jetpack"),i)),t===d.$L?React.createElement(r.Button,{variant:"link",onClick:s,href:o,target:o?"_blank":null},__("Upgrade now","jetpack")):React.createElement(r.Button,{variant:"link",onClick:n},__("Try again","jetpack")))}},62282:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,u:()=>s});var r=n(99196),a=n.n(r);const s=(0,r.createContext)({}),o=({value:e,children:t})=>a().createElement(s.Provider,{value:e,children:t})},20281:(e,t,n)=>{"use strict";n.d(t,{X_:()=>s.Z,hE:()=>r.h,oN:()=>a.Z,uE:()=>r.u});var r=n(62282),a=n(3669),s=n(79466)},79466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(99196),a=n(16700),s=n(20281);function o({onDone:e,onSuggestion:t,onError:n}={}){const o=(0,r.useContext)(s.uE),{eventSource:i}=o,l=(0,r.useCallback)((t=>e?.(t?.detail)),[e]),c=(0,r.useCallback)((e=>t?.(e?.detail)),[t]),u=(0,r.useCallback)((e=>{n?.(e?.detail)}),[]);return(0,r.useEffect)((()=>{if(i)return e&&i.addEventListener("done",l),t&&i.addEventListener("suggestion",c),n&&i.addEventListener(a.vF,u),()=>{i.removeEventListener("done",l),i.removeEventListener("suggestion",c),i.removeEventListener(a.vF,u)}}),[i]),o}},3669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(94333),a=n(69307),s=n(99196),o=n.n(s),i=n(42194),l=n(20281);const c=(0,r.createHigherOrderComponent)((e=>t=>{const{suggestion:n,error:r,requestingState:s,request:c,stopSuggestion:u,eventSource:d}=(0,i.Z)(),p=(0,a.useMemo)((()=>({suggestion:n,requestingError:r,requestingState:s,eventSource:d,requestSuggestion:c,stopSuggestion:u})),[n,r,s,d,c,u]);return o().createElement(l.hE,{value:p},o().createElement(e,t))}),"withAiDataProvider")},42194:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Z:()=>l});var r=n(69307),a=n(65736),s=n(67742),o=n(16700);const __=a.__;function i(e){switch(e){case o.$L:return{code:o.$L,message:__("You have reached the limit of requests for this site.","jetpack"),severity:"info"};case o.bC:return{code:o.bC,message:__("Your request was unclear. Mind trying again?","jetpack"),severity:"info"};case o.$u:return{code:o.$u,message:__("Jetpack AI services are currently unavailable. Sorry for the inconvenience.","jetpack"),severity:"info"};case o.q4:return{code:o.q4,message:__("This request has been flagged by our moderation system. Please try to rephrase it and try again.","jetpack"),severity:"info"};case o.cv:return{code:o.cv,message:__("The content is too large to be processed all at once. Please try to shorten it or divide it into smaller parts.","jetpack"),severity:"info"};case o.co:default:return{code:o.co,message:__("It was not possible to process your request. Mind trying again?","jetpack"),severity:"info"}}}function l({prompt:e,autoRequest:t=!1,askQuestionOptions:n={},initialRequestingState:a="init",onSuggestion:l,onDone:c,onStop:u,onError:d,onAllErrors:p}={}){const[m,g]=(0,r.useState)(a),[A,h]=(0,r.useState)(""),[E,f]=(0,r.useState)(),b=(0,r.useRef)(void 0),C=(0,r.useCallback)((e=>{h(e?.detail),l?.(e?.detail)}),[l]),v=(0,r.useCallback)((e=>{Q(),c?.(e?.detail),g("done")}),[c]),k=(0,r.useCallback)((e=>{p?.(e?.detail)}),[p]),B=(0,r.useCallback)((e=>{b?.current?.close(),g("error"),f(i(e)),d?.(i(e))}),[d]),y=(0,r.useCallback)((()=>B(o.$L)),[]),w=(0,r.useCallback)((()=>B(o.bC)),[]),_=(0,r.useCallback)((()=>B(o.$u)),[]),I=(0,r.useCallback)((()=>B(o.q4)),[]),j=(0,r.useCallback)((()=>B(o.co)),[]),x=(0,r.useCallback)((async(e,t={...n})=>{if(f(void 0),g("requesting"),b.current=await(0,s.Z)(e,t),!b?.current)return;const r=b.current;g("suggesting"),r.addEventListener("suggestion",C),r.addEventListener(o.$L,y),r.addEventListener(o.bC,w),r.addEventListener(o.$u,_),r.addEventListener(o.q4,I),r.addEventListener(o.co,j),r.addEventListener(o.vF,k),r.addEventListener("done",v)}),[v,y,w,_,I,j,C]),S=(0,r.useCallback)((()=>{g("init"),h(""),f(void 0)}),[]),Q=(0,r.useCallback)((()=>{if(!b?.current)return;const e=b?.current;e.close(),e.removeEventListener("suggestion",C),e.removeEventListener(o.$L,y),e.removeEventListener(o.bC,w),e.removeEventListener(o.$u,_),e.removeEventListener(o.q4,I),e.removeEventListener(o.co,j),e.removeEventListener("done",v)}),[b,C,y,w,_,I,j,v]),N=(0,r.useCallback)((()=>{Q(),u?.(),g("done")}),[u]);return(0,r.useEffect)((()=>{if(e?.length)return t&&x(e,n),()=>{N()}}),[t,e,x,N]),{suggestion:A,error:E,requestingState:m,request:x,stopSuggestion:N,reset:S,handleErrorQuotaExceededError:y,eventSource:b.current}}},93509:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(69307),a=n(65736),s=n(51128),o=n.n(s),i=n(46961);const __=a.__,l=o()("jetpack-ai-client:use-audio-transcription"),c=e=>{if("string"==typeof e)return e;if("code"in e)switch(e.code){case"error_quota_exceeded":return __("You exceeded your current quota, please check your plan details.","jetpack");case"jetpack_ai_missing_audio_param":return __("The audio_file is required to perform a transcription.","jetpack");case"jetpack_ai_service_unavailable":return __("The Jetpack AI service is temporarily unavailable.","jetpack");case"file_size_not_supported":return __("The provided audio file is too big.","jetpack");case"file_type_not_supported":return __("The provided audio file type is not supported.","jetpack");case"jetpack_ai_error":return __("There was an error processing the transcription request.","jetpack");default:return e.message}return"message"in e?e.message:__("There was an error processing the transcription request.","jetpack")};function u({feature:e,onReady:t,onError:n}){const[a,s]=(0,r.useState)(""),[o,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useRef)(null);return{transcriptionResult:a,isTranscribingAudio:d,transcriptionError:o,transcribeAudio:(0,r.useCallback)((r=>{l("Transcribing audio"),s(""),u(""),p(!0);const a=new AbortController;m.current=a,(0,i.Z)(r,e,a.signal).then((e=>{s(e),t?.(e)})).catch((e=>{a.signal.aborted||(u(e.message),n?.(c(e)))})).finally((()=>p(!1)))}),[i.Z,s,u,p]),cancelTranscription:(0,r.useCallback)((()=>{m.current?.abort(),s(""),u(""),p(!1)}),[m,s,u,p])}}},92718:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(69307),a=n(65736);const __=a.__,s=25e6,o=1500,i=["audio/mpeg","audio/mp3","audio/ogg","audio/flac","audio/x-flac","audio/m4a","audio/x-m4a","audio/mp4","audio/wav","audio/wave","audio/x-wav","audio/webm"];function l(){const[e,t]=(0,r.useState)(!1);return{isValidatingAudio:e,validateAudio:(0,r.useCallback)(((e,n,r)=>{if(t(!0),e?.size>s)return t(!1),r(__("The audio file is too large. The maximum file size is 25MB.","jetpack"));const a=e instanceof File;if(a&&!i.includes(e.type))return t(!1),r(__("The audio file type is not supported. Please use a supported audio file type.","jetpack"));const l=new AudioContext;e.arrayBuffer().then((s=>{l.decodeAudioData(s,(function(s){const i=Math.ceil(s.duration);return i>o?(t(!1),r(__("The audio file is too long. The maximum recording time is 25 minutes.","jetpack"))):(t(!1),n({duration:i,isFile:a,size:e?.size}))}))}))}),[t])}}},70286:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51128),a=n.n(r),s=n(78982),o=n(2890);const i=a()("ai-client:use-image-generator"),l=(e,t)=>{const n=4e3-t;return e.length>n?e.substring(0,n-6)+" [...]":e},c=async(e,t,n)=>{const r=((e,t)=>{if(t){const n=`I need a Stable Diffusion prompt to generate a featured image for a blog post based on this user-provided image description:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nThe image should be a photo. Make sure you highlight the main suject of the image description, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}return"I need a Stable Diffusion prompt to generate a featured image for a blog post with the following content.\nThe image should be a photo. Make sure you highlight the main suject of the content, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments. The content is:\n\n"+l(e,412)})(e,t),a=await(0,s.Z)(r,{feature:n});return a.choices?.[0]?.message?.content},u=()=>{const e=async function(e){let t="";try{t=(await(0,o.Z)()).token}catch(e){return i("Error getting token: %o",e),Promise.reject(e)}try{const n="https://public-api.wordpress.com/wpcom/v2/jetpack-ai-image",r={Authorization:`Bearer ${t}`,"Content-Type":"application/json"},a=await fetch(n,{method:"POST",headers:r,body:JSON.stringify(e)}).then((e=>e.json()));return a?.data?.status&&a?.data?.status>200?(i("Error generating image: %o",a),Promise.reject(a)):a}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}};return{generateImage:async function({feature:t,postContent:n,responseFormat:r="url",userPrompt:a}){try{i("Generating image");const s=((e,t)=>{if(t){const n=`I need a cover image for a blog post based on this user prompt:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nBefore creating the image, identify the main topic of the user prompt and relate it to the post content.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}const n="I need a cover image for a blog post.\nBefore creating the image, identify the main topic of the content and only represent it.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nThis is the post content:\n\n";return n+l(e,838)})(n,a),o={prompt:s,response_format:r,feature:t,size:"1792x1024"};return await e(o)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithStableDiffusion:async function({feature:t,postContent:n,userPrompt:r}){try{i("Generating image with Stable Diffusion");const a={prompt:await c(n,r,t),feature:t,model:"stable-diffusion",style:"photographic"};return await e(a)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithParameters:e}}},13109:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(69307);const a="audio/mp4;codecs=mp4a",s="audio/mp4",o="audio/webm";function i({onDone:e}={}){const t=(0,r.useRef)(null),[n,i]=(0,r.useState)("inactive"),l=(0,r.useRef)(!1),c=(0,r.useRef)(0),[u,d]=(0,r.useState)(0),p=(0,r.useRef)(null),[m,g]=(0,r.useState)(null),A=(0,r.useRef)([]).current,[h,E]=(0,r.useState)(null),f=(0,r.useRef)(null);function b(){return MediaRecorder.isTypeSupported(a)?new Blob(A,{type:s}):new Blob(A,{type:o})}const C=(0,r.useCallback)((e=>{if(y(),!e)return t?.current?.start();e<100&&(e=100),c.current=Date.now(),t?.current?.start(e)}),[]),v=(0,r.useCallback)((()=>{l.current=!0,t?.current?.pause(),d((e=>e+Date.now()-c.current))}),[]),k=(0,r.useCallback)((()=>{l.current=!1,t?.current?.resume(),c.current=Date.now()}),[]),B=(0,r.useCallback)((()=>{t?.current?.stop(),"recording"===n&&d((e=>e+Date.now()-c.current))}),[]),y=(0,r.useCallback)((()=>{A.length=0,g(null),E(null),d(0),l.current=!1,c.current=0}),[]),w=(0,r.useCallback)((()=>{t?.current&&(t.current.removeEventListener("start",j),t.current.removeEventListener("stop",x),t.current.removeEventListener("pause",S),t.current.removeEventListener("resume",Q),t.current.removeEventListener("dataavailable",N),t.current=null)}),[]),_=(0,r.useCallback)((()=>{if(i("inactive"),y(),w(),!navigator.mediaDevices?.getUserMedia)return;const e=new AudioContext;f.current=e.createAnalyser();navigator.mediaDevices.getUserMedia({audio:!0}).then((n=>{p.current=n;e.createMediaStreamSource(n).connect(f.current),MediaRecorder.isTypeSupported(a)?t.current=new MediaRecorder(n,{mimeType:a}):t.current=new MediaRecorder(n,{mimeType:o}),t.current.addEventListener("start",j),t.current.addEventListener("stop",x),t.current.addEventListener("pause",S),t.current.addEventListener("resume",Q),t.current.addEventListener("dataavailable",N)})).catch((e=>{throw e}))}),[]),I=(0,r.useCallback)((e=>{B(),E("string"==typeof e?e:e.message),i("error")}),[]);function j(){i("recording")}function x(){const t=b();e?.(t),A.length=0}function S(){i("paused")}function Q(){i("recording")}function N(e){const{data:t}=e;t?.size&&(A.push(t),g(b()),l.current||d((e=>{const t=Date.now(),n=t-c.current;return c.current=t,e+n})))}return(0,r.useEffect)((()=>(_(),()=>{p.current&&p.current.getTracks().forEach((e=>e.stop())),w()})),[]),{state:n,blob:m,error:h,duration:u,analyser:f.current,onError:I,controls:{start:C,pause:v,resume:k,stop:B,reset:_}}}},44696:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>c});var r=n(69307),a=n(51128),s=n.n(a),o=n(42194);const i=s()("jetpack-ai-client:use-transcription-post-processing"),l="voice-to-content-simple-draft";function c({feature:e,onReady:t,onError:n,onUpdate:a}){const[s,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useCallback)((e=>{l(e),a?.(e)}),[l,a]),g=(0,r.useCallback)((e=>{l(e),a?.(e),t?.(e)}),[l,a,t]),A=(0,r.useCallback)((e=>{u(e.message),n?.(e.message)}),[u,n]),{request:h,stopSuggestion:E}=(0,o.Z)({onSuggestion:m,onDone:g,onError:A});return{postProcessingResult:s,isProcessingTranscription:d,postProcessingError:c,processTranscription:(0,r.useCallback)(((t,n)=>{i("Post-processing transcription"),l(""),u(""),p(!0);h([{role:"jetpack-ai",context:{type:t,content:n}}],{feature:e})}),[l,u,p,h,e]),cancelTranscriptionProcessing:(0,r.useCallback)((()=>{E(),p(!1)}),[E,p])}}},61317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"ai-assistant-icon"},s().createElement(r.Path,{className:"spark-first",d:"M9.33301 5.33325L10.4644 8.20188L13.333 9.33325L10.4644 10.4646L9.33301 13.3333L8.20164 10.4646L5.33301 9.33325L8.20164 8.20188L9.33301 5.33325Z"}),s().createElement(r.Path,{className:"spark-second",d:"M21.3333 5.33333L22.8418 9.15817L26.6667 10.6667L22.8418 12.1752L21.3333 16L19.8248 12.1752L16 10.6667L19.8248 9.15817L21.3333 5.33333Z"}),s().createElement(r.Path,{className:"spark-third",d:"M14.6667 13.3333L16.5523 18.1144L21.3333 20L16.5523 21.8856L14.6667 26.6667L12.781 21.8856L8 20L12.781 18.1144L14.6667 13.3333Z"}))},83585:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(55609);const a=React.createElement(r.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.95833C6.66328 3.95833 3.95833 6.66327 3.95833 9.99999C3.95833 13.3367 6.66328 16.0417 10 16.0417C13.3367 16.0417 16.0417 13.3367 16.0417 9.99999C16.0417 6.66327 13.3367 3.95833 10 3.95833ZM2.70833 9.99999C2.70833 5.97292 5.97292 2.70833 10 2.70833C14.0271 2.70833 17.2917 5.97292 17.2917 9.99999C17.2917 14.0271 14.0271 17.2917 10 17.2917C5.97292 17.2917 2.70833 14.0271 2.70833 9.99999Z"}),React.createElement(r.Path,{d:"M10.8333 5.83333H9.16667V10.8333H10.8333V5.83333Z"}),React.createElement(r.Path,{d:"M10.8333 12.5H9.16667V14.1667H10.8333V12.5Z"}))},59822:(e,t,n)=>{"use strict";n.d(t,{Qf:()=>a.Z,Qr:()=>s.Z,u_:()=>r.Z,v_:()=>o.Z});var r=n(61317),a=n(81204),s=(n(4454),n(71893),n(52887),n(96083)),o=n(50500)},81204:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"10.5",y:"8.25",width:"3",height:"4.875",rx:"1.5",fill:"#008710"}),s().createElement(r.Path,{d:"M15 11.25C15 11.644 14.9224 12.0341 14.7716 12.3981C14.6209 12.762 14.3999 13.0927 14.1213 13.3713C13.8427 13.6499 13.512 13.8709 13.1481 14.0216C12.7841 14.1724 12.394 14.25 12 14.25C11.606 14.25 11.2159 14.1724 10.8519 14.0216C10.488 13.8709 10.1573 13.6499 9.87868 13.3713C9.6001 13.0927 9.37913 12.762 9.22836 12.3981C9.0776 12.0341 9 11.644 9 11.25",stroke:"#008710",strokeWidth:"1.125",strokeLinecap:"round"}),s().createElement(r.Path,{d:"M11.4375 15.75C11.4375 16.0607 11.6893 16.3125 12 16.3125C12.3107 16.3125 12.5625 16.0607 12.5625 15.75L11.4375 15.75ZM11.4375 14.25L11.4375 15.75L12.5625 15.75L12.5625 14.25L11.4375 14.25Z",fill:"#008710"}))},4454:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},96083:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"12.75",y:"9",width:"2.25",height:"6",fill:"#008710"}),s().createElement(r.Rect,{x:"9",y:"9",width:"2.25",height:"6",fill:"#008710"}))},71893:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},52887:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Rect},50500:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5 10C12.5 11.3807 11.3807 12.5 10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10ZM14 10C14 12.2091 12.2091 14 10 14C7.79086 14 6 12.2091 6 10C6 7.79086 7.79086 6 10 6C12.2091 6 14 7.79086 14 10ZM16.75 21V19C16.75 17.4812 15.5188 16.25 14 16.25L6 16.25C4.48122 16.25 3.25 17.4812 3.25 19V21H4.75L4.75 19C4.75 18.3096 5.30964 17.75 6 17.75L14 17.75C14.6904 17.75 15.25 18.3096 15.25 19V21H16.75Z",fill:"currentColor"}),s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M19.976 16.3599C21.2507 14.5642 22.0001 12.3695 22.0001 9.99969C22.0001 7.63128 21.2515 5.43769 19.9782 3.64258L18.754 4.50967C19.8537 6.05996 20.5001 7.95434 20.5001 9.99969C20.5001 12.0464 19.8528 13.9419 18.7519 15.4928L19.976 16.3599ZM17.3357 14.4897C18.2357 13.222 18.7648 11.6727 18.7648 9.99969C18.7648 8.32808 18.2365 6.77984 17.3379 5.51279L16.1137 6.37988C16.8387 7.4021 17.2648 8.65114 17.2648 9.99969C17.2648 11.3496 16.8378 12.5998 16.1116 13.6226L17.3357 14.4897Z",fill:"currentColor"}))},42290:(e,t,n)=>{"use strict";n.d(t,{$L:()=>p.$L,$u:()=>p.$u,C3:()=>u.C3,Eo:()=>u.Eo,JP:()=>m.JP,L$:()=>i.Z,LB:()=>m.LB,MW:()=>u.MW,OS:()=>o.Z,Qf:()=>c.Qf,Qr:()=>c.Qr,Rc:()=>l.Z,X_:()=>d.X_,Y:()=>p.Y,ZK:()=>u.ZK,_T:()=>a.Z,bC:()=>p.bC,cH:()=>s.Z,co:()=>p.co,cv:()=>p.cv,g:()=>m.g,oN:()=>d.oN,pw:()=>r.Z,q4:()=>p.q4,rp:()=>u.rp,u_:()=>c.u_,v_:()=>c.v_,xi:()=>u.xi});n(2890),n(56694),n(67742),n(46961);var r=n(42194),a=n(13109),s=n(93509),o=n(44696),i=n(92718),l=n(70286),c=n(59822),u=n(58890),d=n(20281),p=n(16700),m=n(35613)},2890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(51128),s=n.n(a),o=n(87309);const i=s()("jetpack-ai-client:jwt"),l="jetpack-ai-jwt",c=12e4;async function u({apiNonce:e,siteId:t,expirationTime:n}={}){e=e||window.JP_CONNECTION_INITIAL_STATE.apiNonce,t=t||window.JP_CONNECTION_INITIAL_STATE.siteSuffix,n=n||c;const a=(0,r.Wp)(),s=localStorage.getItem(l);let u,d=null;if(s)try{d=JSON.parse(s)}catch(e){i("Error parsing token",e)}if(d&&d?.expire>Date.now())return i("Using cached token"),d;u=a?await(0,o.Z)({path:"/wpcom/v2/sites/"+t+"/jetpack-openai-query/jwt",method:"POST"}):await(0,o.Z)({path:"/jetpack/v4/jetpack-ai-jwt?_cacheBuster="+Date.now(),credentials:"same-origin",headers:{"X-WP-Nonce":e},method:"POST"});const p={token:u.token,blogId:a?t:u.blog_id,expire:Date.now()+n};return i("Storing new token"),localStorage.setItem(l,JSON.stringify(p)),p}},35613:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.JP,LB:()=>r.LB,g:()=>r.g});var r=n(71197)},22999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(92213);const a={paragraph:e=>e.replaceAll("\n"," ")},s={emDelimiter:"_",headingStyle:"atx"},o={strikethrough:{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}}};class i{constructor({options:e={},rules:t={},keep:n=[],remove:a=[],fixes:i=[]}={}){this.fixes=i,this.turndownService=new r.Z({...s,...e}),this.turndownService.keep(n),this.turndownService.remove(a);const l={...o,...t};for(const e in l)this.turndownService.addRule(e,l[e])}render({content:e}){const t=this.turndownService.turndown(e);return this.fixes.reduce(((e,t)=>a[t](e)),t)}}},71197:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.Z,LB:()=>o,g:()=>i});var r=n(22999);const a=new(n(28603).Z),s=new r.Z,o=({content:e,rules:t,extension:n})=>a.render({content:e,rules:t,extension:n}),i=({content:e})=>s.render({content:e})},28603:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(95601);const a=e=>e.replaceAll("\x3c!-- wp:list-item --\x3e","").replaceAll("\x3c!-- /wp:list-item --\x3e","").replaceAll("\x3c!-- wp:list --\x3e","").replaceAll("\x3c!-- /wp:list --\x3e","").replaceAll("","\x3c!-- wp:list-item --\x3e ").replaceAll(" ","\x3c!-- /wp:list-item --\x3e").replaceAll("",'\x3c!-- wp:list {"ordered":true} --\x3e').replaceAll(" "," \x3c!-- /wp:list --\x3e").replaceAll("","\x3c!-- wp:list --\x3e"," \x3c!-- /wp:list --\x3e"),s={list:(e,t=!1)=>{const n=e.replace(/\s+/g,"
").replace(/<\/p>\s+<\/li>/g," ");return t?a(n):n},listItem:(e,t=!1)=>t?a(e.replace(/^<[ou]l>\s*/g,"").replace(/\s*<\/[ou]l>\s*$/g,"")):e,paragraph:(e,t=!1)=>t?e.replaceAll(/\s*<br \/>\s*/g," "):e},o={breaks:!0},i=["list"];class l{constructor(e=o){this.markdownConverter=new r.Z(e)}render({content:e,rules:t=i,extension:n=!1}){const r=this.markdownConverter.render(e);return t.reduce(((e,t)=>s[t](e,n)),r)}}},56694:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(60400),a=n(51128),s=n.n(a),o=n(42194),i=n(2890),l=n(16700);const c=s()("jetpack-ai-client:suggestions-event-source");class u extends EventTarget{constructor(e){super(),this.fullMessage="",this.fullFunctionCall={name:"",arguments:""},this.isPromptClear=!1,this.controller=new AbortController,this.initEventSource(e)}async initEventSource({url:e,question:t,token:n,options:a={}}){if(!n)try{c("Token was not provided, requesting one..."),n=(await(0,i.Z)()).token}catch(e){return void this.processErrorEvent(e)}const s={};if(Number.isInteger(parseInt(a.postId))&&(s.post_id=+a.postId),!e){const t=new URL("https://public-api.wordpress.com/wpcom/v2/jetpack-ai-query");a?.fromCache&&t.searchParams.append("stream_cache","true"),e=t.toString(),c("URL not provided, using default: %o",e)}Array.isArray(t)?s.messages=t:s.question=t,a?.feature?.length&&(c("Feature: %o",a.feature),s.feature=a.feature),a?.functions?.length&&(c("Functions: %o",a.functions),s.functions=a.functions),a?.model?.length&&(c("Model: %o",a.model),s.model=a.model),this.errorUnclearPromptTriggered=!1,await(0,r.L)(e,{openWhenHidden:!0,method:"POST",headers:{"Content-type":"application/json",Authorization:"Bearer "+n},body:JSON.stringify(s),onclose:()=>{c("Stream closed")},onerror:e=>{throw this.processErrorEvent(e),e},onmessage:e=>{this.processEvent(e)},onopen:async e=>{if(e.ok)return;let t;throw e.status>=400&&e.status<=500&&![413,422,429].includes(e.status)&&(c("Connection error: %o",e),t=l.co,this.dispatchEvent(new CustomEvent(l.co,{detail:e}))),503===e.status&&(t=l.$u,this.dispatchEvent(new CustomEvent(l.$u))),413===e.status&&(t=l.cv,this.dispatchEvent(new CustomEvent(l.cv))),422===e.status&&(t=l.q4,this.dispatchEvent(new CustomEvent(l.q4))),429===e.status&&(t=l.$L,this.dispatchEvent(new CustomEvent(l.$L))),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(t)})),new Error},signal:this.controller.signal})}checkForUnclearPrompt(){if(this.isPromptClear)return;const e=this.fullMessage.replace(/__|(\*\*)/g,"");if(e.startsWith("JETPACK_AI_ERROR")){if(this.errorUnclearPromptTriggered)return;this.errorUnclearPromptTriggered=!0,this.dispatchEvent(new CustomEvent(l.bC)),c("Unclear error prompt dispatched"),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.bC)}))}else"JETPACK_AI_ERROR".startsWith(e)?c(this.fullMessage):this.isPromptClear=!0}close(){this.controller.abort()}processEvent(e){if("[DONE]"===e.data){if(this.errorUnclearPromptTriggered)return;if(this.fullMessage.length)return this.dispatchEvent(new CustomEvent("done",{detail:this.fullMessage})),void c("Done: %o",this.fullMessage);if(this.fullFunctionCall.name.length)return this.dispatchEvent(new CustomEvent("function_done",{detail:this.fullFunctionCall})),void c("Done: %o",this.fullFunctionCall)}let t;try{t=JSON.parse(e.data)}catch(t){return void c("Error parsing JSON",e,t)}const{delta:n}=t?.choices?.[0]??{delta:{content:null,function_call:null}},r=n.content,a=n.function_call;r&&(this.fullMessage+=r,this.checkForUnclearPrompt(),this.isPromptClear&&(this.dispatchEvent(new CustomEvent("chunk",{detail:r})),c("suggestion: %o",this.fullMessage),this.dispatchEvent(new CustomEvent("suggestion",{detail:this.fullMessage})))),a&&(null!=a.name&&(this.fullFunctionCall.name+=a.name),null!=a.arguments&&(this.fullFunctionCall.arguments+=a.arguments),this.dispatchEvent(new CustomEvent("functionCallChunk",{detail:this.fullFunctionCall})))}processErrorEvent(e){c("onerror: %o",e),this.dispatchEvent(new CustomEvent(l.co,{detail:e})),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.co)}))}}},16700:(e,t,n)=>{"use strict";n.d(t,{$L:()=>s,$u:()=>a,Y:()=>r.Y,bC:()=>c,co:()=>l,cv:()=>i,q4:()=>o,vF:()=>u});var r=n(44696);const a="error_service_unavailable",s="error_quota_exceeded",o="error_moderation",i="error_context_too_large",l="error_network",c="error_unclear_prompt",u="error_response"},6975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51128);const a=n.n(r)()("dops:analytics");let s,o;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const i={initialize:function(e,t,n){i.setUser(e,t),i.setSuperProps(n),i.identifyUser()},setGoogleAnalyticsEnabled:function(e,t=null){this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){o={ID:e,username:t}},setSuperProps:function(e){s=e},assignSuperProps:function(e){s=Object.assign(s||{},e)},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Built stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){i.tracks.recordPageView(e),i.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,a,s,o){i.ga.recordPurchase(e,t,n,r,a,s,o)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(s&&(a("- Super Props: %o",s),t=Object.assign(t,s)),a('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):a('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};i.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){i.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){a("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};i.ga.initialized||(o&&(e={userId:"u-"+o.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),i.ga.initialized=!0)},recordPageView:function(e,t){i.ga.initialize(),a("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){i.ga.initialize();let s="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(s+=" [Option Label: "+n+"]"),void 0!==r&&(s+=" [Option Value: "+r+"]"),a(s),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,a,s,o){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:o}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:a,quantity:s}),window.ga("ecommerce:send")}},identifyUser:function(){o&&window._tkq.push(["identifyUser",o.ID,o.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}},l=i},64743:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(61132),a=n(96483);function s(e){class t extends Error{constructor(...t){super(...t),this.name=e}}return t}const o=s("JsonParseError"),i=s("JsonParseAfterRedirectError"),l=s("Api404Error"),c=s("Api404AfterRedirectError"),u=s("FetchNetworkError");const d=new function(e,t){let n=e,s=e,o={"X-WP-Nonce":t},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})},c=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setWpcomOriginApiUrl(e){s=e},setApiNonce(e){o={"X-WP-Nonce":e},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{c=e},registerSite:(e,t,a)=>{const s={registration_nonce:e,no_iframe:!0};return(0,r.jetpackConfigHas)("consumer_slug")&&(s.plugin_slug=(0,r.jetpackConfigGet)("consumer_slug")),null!==t&&(s.redirect_uri=t),a&&(s.from=a),g(`${n}jetpack/v4/connection/register`,l,{body:JSON.stringify(s)}).then(p).then(m)},fetchAuthorizationUrl:e=>d((0,a.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),i).then(p).then(m),fetchSiteConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchSiteConnectionStatus:()=>d(`${n}jetpack/v4/connection`,i).then(m),fetchSiteConnectionTest:()=>d(`${n}jetpack/v4/connection/test`,i).then(p).then(m),fetchUserConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchUserTrackingSettings:()=>d(`${n}jetpack/v4/tracking/settings`,i).then(p).then(m),updateUserTrackingSettings:e=>g(`${n}jetpack/v4/tracking/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),disconnectSite:()=>g(`${n}jetpack/v4/connection`,l,{body:JSON.stringify({isActive:!1})}).then(p).then(m),fetchConnectUrl:()=>d(`${n}jetpack/v4/connection/url`,i).then(p).then(m),unlinkUser:()=>g(`${n}jetpack/v4/connection/user`,l,{body:JSON.stringify({linked:!1})}).then(p).then(m),reconnect:()=>g(`${n}jetpack/v4/connection/reconnect`,l).then(p).then(m),fetchConnectedPlugins:()=>d(`${n}jetpack/v4/connection/plugins`,i).then(p).then(m),setHasSeenWCConnectionModal:()=>g(`${n}jetpack/v4/seen-wc-connection-modal`,l).then(p).then(m),fetchModules:()=>d(`${n}jetpack/v4/module/all`,i).then(p).then(m),fetchModule:e=>d(`${n}jetpack/v4/module/${e}`,i).then(p).then(m),activateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!0})}).then(p).then(m),deactivateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>g(`${n}jetpack/v4/module/${e}`,l,{body:JSON.stringify(t)}).then(p).then(m),updateSettings:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),getProtectCount:()=>d(`${n}jetpack/v4/module/protect/data`,i).then(p).then(m),resetOptions:e=>g(`${n}jetpack/v4/options/${e}`,l,{body:JSON.stringify({reset:!0})}).then(p).then(m),activateVaultPress:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(p).then(m),getVaultPressData:()=>d(`${n}jetpack/v4/module/vaultpress/data`,i).then(p).then(m),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify(r)}).then(p).then(m)},activateAkismet:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(p).then(m),getAkismetData:()=>d(`${n}jetpack/v4/module/akismet/data`,i).then(p).then(m),checkAkismetKey:()=>d(`${n}jetpack/v4/module/akismet/key/check`,i).then(p).then(m),checkAkismetKeyTyped:e=>g(`${n}jetpack/v4/module/akismet/key/check`,l,{body:JSON.stringify({api_key:e})}).then(p).then(m),fetchStatsData:e=>d(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),i).then(p).then(m).then(h),getPluginUpdates:()=>d(`${n}jetpack/v4/updates/plugins`,i).then(p).then(m),getPlans:()=>d(`${n}jetpack/v4/plans`,i).then(p).then(m),fetchSettings:()=>d(`${n}jetpack/v4/settings`,i).then(p).then(m),updateSetting:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSiteData:()=>d(`${n}jetpack/v4/site`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>d(`${n}jetpack/v4/site/features`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>d(`${n}jetpack/v4/site/products`,i).then(p).then(m),fetchSitePurchases:()=>d(`${n}jetpack/v4/site/purchases`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>d(`${n}jetpack/v4/site/benefits`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteDiscount:()=>d(`${n}jetpack/v4/site/discount`,i).then(p).then(m).then((e=>e.data)),fetchSetupQuestionnaire:()=>d(`${n}jetpack/v4/setup/questionnaire`,i).then(p).then(m),fetchRecommendationsData:()=>d(`${n}jetpack/v4/recommendations/data`,i).then(p).then(m),fetchRecommendationsProductSuggestions:()=>d(`${n}jetpack/v4/recommendations/product-suggestions`,i).then(p).then(m),fetchRecommendationsUpsell:()=>d(`${n}jetpack/v4/recommendations/upsell`,i).then(p).then(m),fetchRecommendationsConditional:()=>d(`${n}jetpack/v4/recommendations/conditional`,i).then(p).then(m),saveRecommendationsData:e=>g(`${n}jetpack/v4/recommendations/data`,l,{body:JSON.stringify({data:e})}).then(p),fetchProducts:()=>d(`${n}jetpack/v4/products`,i).then(p).then(m),fetchRewindStatus:()=>d(`${n}jetpack/v4/rewind`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>d(`${n}jetpack/v4/scan`,i).then(p).then(m).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>g(`${n}jetpack/v4/notice/${e}`,l,{body:JSON.stringify({dismissed:!0})}).then(p).then(m),fetchPluginsData:()=>d(`${n}jetpack/v4/plugins`,i).then(p).then(m),fetchIntroOffers:()=>d(`${n}jetpack/v4/intro-offers`,i).then(p).then(m),fetchVerifySiteGoogleStatus:e=>d(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,i).then(p).then(m),verifySiteGoogle:e=>g(`${n}jetpack/v4/verify-site/google`,l,{body:JSON.stringify({keyring_id:e})}).then(p).then(m),submitSurvey:e=>g(`${n}jetpack/v4/marketing/survey`,l,{body:JSON.stringify(e)}).then(p).then(m),saveSetupQuestionnaire:e=>g(`${n}jetpack/v4/setup/questionnaire`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicensingError:e=>g(`${n}jetpack/v4/licensing/error`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicenseKey:e=>g(`${n}jetpack/v4/licensing/set-license`,l,{body:JSON.stringify({license:e})}).then(p).then(m),getUserLicensesCounts:()=>d(`${n}jetpack/v4/licensing/user/counts`,i).then(p).then(m),getUserLicenses:()=>d(`${n}jetpack/v4/licensing/user/licenses`,i).then(p).then(m),updateLicensingActivationNoticeDismiss:e=>g(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,l,{body:JSON.stringify({last_detached_count:e})}).then(p).then(m),updateRecommendationsStep:e=>g(`${n}jetpack/v4/recommendations/step`,l,{body:JSON.stringify({step:e})}).then(p),confirmIDCSafeMode:()=>g(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,l).then(p),startIDCFresh:e=>g(`${n}jetpack/v4/identity-crisis/start-fresh`,l,{body:JSON.stringify({redirect_uri:e})}).then(p).then(m),migrateIDC:()=>g(`${n}jetpack/v4/identity-crisis/migrate`,l).then(p),attachLicenses:e=>g(`${n}jetpack/v4/licensing/attach-licenses`,l,{body:JSON.stringify({licenses:e})}).then(p).then(m),fetchSearchPlanInfo:()=>d(`${s}jetpack/v4/search/plan`,i).then(p).then(m),fetchSearchSettings:()=>d(`${s}jetpack/v4/search/settings`,i).then(p).then(m),updateSearchSettings:e=>g(`${s}jetpack/v4/search/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSearchStats:()=>d(`${s}jetpack/v4/search/stats`,i).then(p).then(m),fetchWafSettings:()=>d(`${n}jetpack/v4/waf`,i).then(p).then(m),updateWafSettings:e=>g(`${n}jetpack/v4/waf`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchWordAdsSettings:()=>d(`${n}jetpack/v4/wordads/settings`,i).then(p).then(m),updateWordAdsSettings:e=>g(`${n}jetpack/v4/wordads/settings`,l,{body:JSON.stringify(e)}),fetchSearchPricing:()=>d(`${s}jetpack/v4/search/pricing`,i).then(p).then(m),fetchMigrationStatus:()=>d(`${n}jetpack/v4/migration/status`,i).then(p).then(m),fetchBackupUndoEvent:()=>d(`${n}jetpack/v4/site/backup/undo-event`,i).then(p).then(m),fetchBackupPreflightStatus:()=>d(`${n}jetpack/v4/site/backup/preflight`,i).then(p).then(m)};function d(e,t){return fetch(c(e),t)}function g(e,t,n){return fetch(e,Object.assign({},t,n)).catch(A)}function h(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}Object.assign(this,u)};function p(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new c(e.redirected):new l})):e.json().catch((e=>g(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function m(e){return e.json().catch((t=>g(t,e.redirected,e.url)))}function g(e,t,n){throw t?new i(n):new o}function A(){throw new u}},90526:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(82674),a=n.n(r),s=n(55609),o=n(65736),i=n(61074),l=n(15381),c=n(65235),u=n.n(c),d=n(99196),p=n.n(d),m=n(62103);const __=o.__,g=(0,d.forwardRef)(((e,t)=>{const{children:n,variant:r="primary",size:o="normal",weight:c="bold",icon:d,iconSize:g,disabled:A,isDestructive:h,isLoading:E,isExternalLink:f,className:b,text:C,fullWidth:v,...k}=e,B=u()(m.Z.button,b,{[m.Z.normal]:"normal"===o,[m.Z.small]:"small"===o,[m.Z.icon]:Boolean(d),[m.Z.loading]:E,[m.Z.regular]:"regular"===c,[m.Z["full-width"]]:v,[m.Z["is-icon-button"]]:Boolean(d)&&!n});k.ref=t;const y="normal"===o?20:16,w=f&&p().createElement(p().Fragment,null,p().createElement(i.Z,{size:y,icon:l.Z,className:m.Z["external-icon"]}),p().createElement(s.VisuallyHidden,{as:"span"},/* translators: accessibility text */
__("(opens in a new tab)","jetpack"))),_=f?"_blank":void 0,I=n?.[0]&&null!==n[0]&&"components-tooltip"!==n?.[0]?.props?.className;return p().createElement(s.Button,a()({target:_,variant:r,className:u()(B,{"has-text":!!d&&I}),icon:f?void 0:d,iconSize:g,disabled:A,"aria-disabled":A,isDestructive:h,text:C},k),E&&p().createElement(s.Spinner,null),p().createElement("span",null,n),w)}));g.displayName="Button";const A=g},14203:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(82674),a=n.n(r),s=n(94333),o=n(69307),i=n(65736),l=n(90526),c=n(3396);const __=i.__,u=({buttonStyle:e="icon",textToCopy:t,onCopy:n,...r})=>{const[i,u]=(0,o.useState)(!1),d=(0,o.useRef)(),p=(0,s.useCopyToClipboard)(t,(()=>{d.current&&clearTimeout(d.current),u(!0),n?.(),d.current=setTimeout((()=>{u(!1),d.current=void 0}),3e3)}));(0,o.useEffect)((()=>()=>{d.current&&clearTimeout(d.current)}),[]);let m=null,g=null;"text"!==e&&(m=i?React.createElement(c.KM,null):React.createElement(c.Km,null));const A=__("Copy to clipboard","jetpack");return"icon"!==e&&(g=i?__("Copied!","jetpack"):A),React.createElement(l.Z,a()({"aria-label":A,icon:m,children:g,ref:p},r))}},60068:(e,t,n)=>{"use strict";n.d(t,{_:()=>s});var r=n(9818),a=n(53961);function s(){const e=(0,r.useDispatch)(a.store),t=(0,r.useSelect)((e=>e(a.store).getNotices()),[]);return{...e,createNotice:(t,n,r)=>e.createNotice(t,n,{type:"snackbar",...r}),createErrorNotice:(t,n)=>e.createErrorNotice(t,{type:"snackbar",...n}),createInfoNotice:(t,n)=>e.createInfoNotice(t,{type:"snackbar",...n}),createSuccessNotice:(t,n)=>e.createSuccessNotice(t,{type:"snackbar",...n}),createWarningNotice:(t,n)=>e.createWarningNotice(t,{type:"snackbar",...n}),getNotices:()=>t}}},67172:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(65736),a=n(65235),s=n.n(a),o=n(99196);n(53351);const __=r.__;class i extends o.Component{static defaultProps={"aria-hidden":"false",focusable:"true"};needsOffset(e,t){return["gridicons-arrow-left","gridicons-arrow-right","gridicons-calendar","gridicons-cart","gridicons-folder","gridicons-info","gridicons-info-outline","gridicons-posts","gridicons-star-outline","gridicons-star"].indexOf(e)>=0&&t%18==0}getSVGDescription(e){if("description"in this.props)return this.props.description;switch(e){default:return"";case"gridicons-audio":return __("Has audio.","jetpack");case"gridicons-arrow-left":return __("Arrow left","jetpack");case"gridicons-arrow-right":return __("Arrow right","jetpack");case"gridicons-calendar":return __("Is an event.","jetpack");case"gridicons-cart":return __("Is a product.","jetpack");case"chevron-down":return __("Show filters","jetpack");case"gridicons-comment":return __("Matching comment.","jetpack");case"gridicons-cross":return __("Close.","jetpack");case"gridicons-filter":return __("Toggle search filters.","jetpack");case"gridicons-folder":return __("Category","jetpack");case"gridicons-info":case"gridicons-info-outline":return __("Information.","jetpack");case"gridicons-image-multiple":return __("Has multiple images.","jetpack");case"gridicons-image":return __("Has an image.","jetpack");case"gridicons-page":return __("Page","jetpack");case"gridicons-post":return __("Post","jetpack");case"gridicons-jetpack-search":case"gridicons-search":return __("Magnifying Glass","jetpack");case"gridicons-tag":return __("Tag","jetpack");case"gridicons-video":return __("Has a video.","jetpack")}}renderIcon(e){switch(e){default:return null;case"gridicons-audio":return React.createElement("g",null,React.createElement("path",{d:"M8 4v10.184C7.686 14.072 7.353 14 7 14c-1.657 0-3 1.343-3 3s1.343 3 3 3 3-1.343 3-3V7h7v4.184c-.314-.112-.647-.184-1-.184-1.657 0-3 1.343-3 3s1.343 3 3 3 3-1.343 3-3V4H8z"}));case"gridicons-arrow-left":return React.createElement("g",null,React.createElement("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"}));case"gridicons-arrow-right":return React.createElement("g",null,React.createElement("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z"}));case"gridicons-block":return React.createElement("g",null,React.createElement("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12c0-4.418 3.582-8 8-8 1.848 0 3.545.633 4.9 1.686L5.686 16.9C4.633 15.545 4 13.848 4 12zm8 8c-1.848 0-3.546-.633-4.9-1.686L18.314 7.1C19.367 8.455 20 10.152 20 12c0 4.418-3.582 8-8 8z"}));case"gridicons-calendar":return React.createElement("g",null,React.createElement("path",{d:"M19 4h-1V2h-2v2H8V2H6v2H5c-1.105 0-2 .896-2 2v13c0 1.104.895 2 2 2h14c1.104 0 2-.896 2-2V6c0-1.104-.896-2-2-2zm0 15H5V8h14v11z"}));case"gridicons-cart":return React.createElement("g",null,React.createElement("path",{d:"M9 20c0 1.1-.9 2-2 2s-1.99-.9-1.99-2S5.9 18 7 18s2 .9 2 2zm8-2c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm.396-5c.937 0 1.75-.65 1.952-1.566L21 5H7V4c0-1.105-.895-2-2-2H3v2h2v11c0 1.105.895 2 2 2h12c0-1.105-.895-2-2-2H7v-2h10.396z"}));case"gridicons-checkmark":return React.createElement("g",null,React.createElement("path",{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658C17.823 3.39 15.075 2 12 2 6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-1.528-.353-2.97-.966-4.266L11 17.768z"}));case"gridicons-chevron-left":return React.createElement("g",null,React.createElement("path",{d:"M16.443 7.41L15.0399 6L9.06934 12L15.0399 18L16.443 16.59L11.8855 12L16.443 7.41Z"}));case"gridicons-chevron-right":return React.createElement("g",null,React.createElement("path",{d:"M10.2366 6L8.8335 7.41L13.391 12L8.8335 16.59L10.2366 18L16.2072 12L10.2366 6Z"}));case"gridicons-chevron-down":return React.createElement("g",null,React.createElement("path",{d:"M20 9l-8 8-8-8 1.414-1.414L12 14.172l6.586-6.586"}));case"gridicons-comment":return React.createElement("g",null,React.createElement("path",{d:"M3 6v9c0 1.105.895 2 2 2h9v5l5.325-3.804c1.05-.75 1.675-1.963 1.675-3.254V6c0-1.105-.895-2-2-2H5c-1.105 0-2 .895-2 2z"}));case"gridicons-computer":return React.createElement("g",null,React.createElement("path",{d:"M20 2H4c-1.104 0-2 .896-2 2v12c0 1.104.896 2 2 2h6v2H7v2h10v-2h-3v-2h6c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm0 14H4V4h16v12z"}));case"gridicons-cross":return React.createElement("g",null,React.createElement("path",{d:"M18.36 19.78L12 13.41l-6.36 6.37-1.42-1.42L10.59 12 4.22 5.64l1.42-1.42L12 10.59l6.36-6.36 1.41 1.41L13.41 12l6.36 6.36z"}));case"gridicons-filter":return React.createElement("g",null,React.createElement("path",{d:"M10 19h4v-2h-4v2zm-4-6h12v-2H6v2zM3 5v2h18V5H3z"}));case"gridicons-folder":return React.createElement("g",null,React.createElement("path",{d:"M18 19H6c-1.1 0-2-.9-2-2V7c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2h7c1.1 0 2 .9 2 2v8c0 1.1-.9 2-2 2z"}));case"gridicons-image":return React.createElement("g",null,React.createElement("path",{d:"M13 9.5c0-.828.672-1.5 1.5-1.5s1.5.672 1.5 1.5-.672 1.5-1.5 1.5-1.5-.672-1.5-1.5zM22 6v12c0 1.105-.895 2-2 2H4c-1.105 0-2-.895-2-2V6c0-1.105.895-2 2-2h16c1.105 0 2 .895 2 2zm-2 0H4v7.444L8 9l5.895 6.55 1.587-1.85c.798-.932 2.24-.932 3.037 0L20 15.426V6z"}));case"gridicons-image-multiple":return React.createElement("g",null,React.createElement("path",{d:"M15 7.5c0-.828.672-1.5 1.5-1.5s1.5.672 1.5 1.5S17.328 9 16.5 9 15 8.328 15 7.5zM4 20h14c0 1.105-.895 2-2 2H4c-1.1 0-2-.9-2-2V8c0-1.105.895-2 2-2v14zM22 4v12c0 1.105-.895 2-2 2H8c-1.105 0-2-.895-2-2V4c0-1.105.895-2 2-2h12c1.105 0 2 .895 2 2zM8 4v6.333L11 7l4.855 5.395.656-.73c.796-.886 2.183-.886 2.977 0l.513.57V4H8z"}));case"gridicons-info":return React.createElement("g",null,React.createElement("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"}));case"gridicons-info-outline":return React.createElement("g",null,React.createElement("path",{d:"M13 9h-2V7h2v2zm0 2h-2v6h2v-6zm-1-7c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8m0-2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2z"}));case"gridicons-jetpack-search":return React.createElement("g",null,React.createElement("path",{d:"M0 9.257C0 4.15 4.151 0 9.257 0c5.105 0 9.256 4.151 9.256 9.257a9.218 9.218 0 01-2.251 6.045l.034.033h1.053L24 22.01l-1.986 1.989-6.664-6.662v-1.055l-.033-.033a9.218 9.218 0 01-6.06 2.264C4.15 18.513 0 14.362 0 9.257zm4.169 1.537h4.61V1.82l-4.61 8.973zm5.547-3.092v8.974l4.61-8.974h-4.61z"}));case"gridicons-phone":return React.createElement("g",null,React.createElement("path",{d:"M16 2H8c-1.104 0-2 .896-2 2v16c0 1.104.896 2 2 2h8c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm-3 19h-2v-1h2v1zm3-2H8V5h8v14z"}));case"gridicons-pages":return React.createElement("g",null,React.createElement("path",{d:"M16 8H8V6h8v2zm0 2H8v2h8v-2zm4-6v12l-6 6H6c-1.105 0-2-.895-2-2V4c0-1.105.895-2 2-2h12c1.105 0 2 .895 2 2zm-2 10V4H6v16h6v-4c0-1.105.895-2 2-2h4z"}));case"gridicons-posts":return React.createElement("g",null,React.createElement("path",{d:"M16 19H3v-2h13v2zm5-10H3v2h18V9zM3 5v2h11V5H3zm14 0v2h4V5h-4zm-6 8v2h10v-2H11zm-8 0v2h5v-2H3z"}));case"gridicons-search":return React.createElement("g",null,React.createElement("path",{d:"M21 19l-5.154-5.154C16.574 12.742 17 11.42 17 10c0-3.866-3.134-7-7-7s-7 3.134-7 7 3.134 7 7 7c1.42 0 2.742-.426 3.846-1.154L19 21l2-2zM5 10c0-2.757 2.243-5 5-5s5 2.243 5 5-2.243 5-5 5-5-2.243-5-5z"}));case"gridicons-star-outline":return React.createElement("g",null,React.createElement("path",{d:"M12 6.308l1.176 3.167.347.936.997.042 3.374.14-2.647 2.09-.784.62.27.963.91 3.25-2.813-1.872-.83-.553-.83.552-2.814 1.87.91-3.248.27-.962-.783-.62-2.648-2.092 3.374-.14.996-.04.347-.936L12 6.308M12 2L9.418 8.953 2 9.257l5.822 4.602L5.82 21 12 16.89 18.18 21l-2.002-7.14L22 9.256l-7.418-.305L12 2z"}));case"gridicons-star":return React.createElement("g",null,React.createElement("path",{d:"M12 2l2.582 6.953L22 9.257l-5.822 4.602L18.18 21 12 16.89 5.82 21l2.002-7.14L2 9.256l7.418-.304"}));case"gridicons-tag":return React.createElement("g",null,React.createElement("path",{d:"M20 2.007h-7.087c-.53 0-1.04.21-1.414.586L2.592 11.5c-.78.78-.78 2.046 0 2.827l7.086 7.086c.78.78 2.046.78 2.827 0l8.906-8.906c.376-.374.587-.883.587-1.413V4.007c0-1.105-.895-2-2-2zM17.007 9c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2z"}));case"gridicons-video":return React.createElement("g",null,React.createElement("path",{d:"M20 4v2h-2V4H6v2H4V4c-1.105 0-2 .895-2 2v12c0 1.105.895 2 2 2v-2h2v2h12v-2h2v2c1.105 0 2-.895 2-2V6c0-1.105-.895-2-2-2zM6 16H4v-3h2v3zm0-5H4V8h2v3zm4 4V9l4.5 3-4.5 3zm10 1h-2v-3h2v3zm0-5h-2V8h2v3z"}));case"gridicons-lock":return React.createElement(React.Fragment,null,React.createElement("g",{id:"lock"},React.createElement("path",{d:"M18,8h-1V7c0-2.757-2.243-5-5-5S7,4.243,7,7v1H6c-1.105,0-2,0.895-2,2v10c0,1.105,0.895,2,2,2h12c1.105,0,2-0.895,2-2V10 C20,8.895,19.105,8,18,8z M9,7c0-1.654,1.346-3,3-3s3,1.346,3,3v1H9V7z M13,15.723V18h-2v-2.277c-0.595-0.346-1-0.984-1-1.723 c0-1.105,0.895-2,2-2s2,0.895,2,2C14,14.738,13.595,15.376,13,15.723z"})),React.createElement("g",{id:"Layer_1"}));case"gridicons-external":return React.createElement("g",null,React.createElement("path",{d:"M19 13v6c0 1.105-.895 2-2 2H5c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h6v2H5v12h12v-6h2zM13 3v2h4.586l-7.793 7.793 1.414 1.414L19 6.414V11h2V3h-8z"}))}}render(){const{size:e=24,className:t=""}=this.props,n=this.props.height||e,r=this.props.width||e,a=this.props.style||{height:n,width:r},o="gridicons-"+this.props.icon,i=s()("gridicon",o,t,{"needs-offset":this.needsOffset(o,e)}),l=this.getSVGDescription(o);return React.createElement("svg",{className:i,focusable:this.props.focusable,height:n,onClick:this.props.onClick,style:a,viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg","aria-hidden":this.props["aria-hidden"]},l?React.createElement("desc",null,l):null,this.renderIcon(o))}}const l=i},69665:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(55609),a=n(65235),s=n.n(a),o=n(99196),i=n.n(o),l=n(90526),c=n(67172);n(72098);const u=e=>({"top-end":"top left",top:"top center","top-start":"top right","bottom-end":"bottom left",bottom:"bottom center","bottom-start":"bottom right"}[e]),d=({className:e="",iconClassName:t="",placement:n="bottom-end",animate:a=!0,iconCode:d="info-outline",iconSize:p=18,offset:m=10,title:g,children:A,popoverAnchorStyle:h="icon",forceShow:E=!1,wide:f=!1,inline:b=!0,shift:C=!1})=>{const[v,k]=(0,o.useState)(!1),B=(0,o.useCallback)((()=>k(!1)),[k]),y=(0,o.useCallback)((e=>{e.preventDefault(),k(!v)}),[v,k]),w={position:u(n),placement:n,animate:a,noArrow:!1,resize:!1,flip:!1,offset:m,focusOnMount:"container",onClose:B,className:"icon-tooltip-container",inline:b,shift:C},_="wrapper"===h,I=s()("icon-tooltip-wrapper",e),j={left:_?0:-(62-p/2)+"px"},x=_&&E;return i().createElement("div",{className:I,"data-testid":"icon-tooltip_wrapper"},!_&&i().createElement(l.Z,{variant:"link",onMouseDown:y},i().createElement(c.Z,{className:t,icon:d,size:p})),i().createElement("div",{className:s()("icon-tooltip-helper",{"is-wide":f}),style:j},(x||v)&&i().createElement(r.Popover,w,i().createElement("div",null,g&&i().createElement("div",{className:"icon-tooltip-title"},g),i().createElement("div",{className:"icon-tooltip-content"},A)))))}},3396:(e,t,n)=>{"use strict";n.d(t,{KM:()=>d,Km:()=>p,av:()=>m});var r=n(82674),a=n.n(r),s=n(55609),o=n(65235),i=n.n(o),l=n(56286),c=n(45460);const u=({className:e,size:t=24,viewBox:n="0 0 24 24",opacity:r=1,color:o="#2C3338",children:l})=>{const u={className:i()(c.Z.iconWrapper,e),width:t,height:t,viewBox:n,opacity:r,fill:void 0};return o&&(u.fill=o),React.createElement(s.SVG,a()({},u,{fillRule:"evenodd",clipRule:"evenodd",xmlns:"http://www.w3.org/2000/svg"}),React.createElement(s.G,{opacity:r},l))},d=({size:e,className:t=c.Z["checkmark-icon"],color:n})=>React.createElement(u,{className:t,size:e,color:n},React.createElement(s.Path,{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658C17.823 3.39 15.075 2 12 2 6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-1.528-.353-2.97-.966-4.266L11 17.768z"})),p=({size:e,className:t=c.Z["clipboard-icon"],color:n})=>React.createElement(u,{className:t,size:e,color:n},React.createElement(s.Path,{d:"M5.625 5.5H15.375C15.444 5.5 15.5 5.55596 15.5 5.625V15.375C15.5 15.444 15.444 15.5 15.375 15.5H5.625C5.55596 15.5 5.5 15.444 5.5 15.375V5.625C5.5 5.55596 5.55596 5.5 5.625 5.5ZM4 5.625C4 4.72754 4.72754 4 5.625 4H15.375C16.2725 4 17 4.72754 17 5.625V10V15.375C17 16.2725 16.2725 17 15.375 17C15.375 17 6.52246 17 5.625 17C4.72754 17 4 16.2725 4 15.375V5.625ZM18.5 17.2812V8.28125H20V17.2812C20 18.7995 18.7704 20 17.2511 20H6.25V18.5H17.2511C17.9409 18.5 18.5 17.9721 18.5 17.2812Z"}));const m=({serviceName:e,className:t,iconSize:n})=>React.createElement(l.ZP,{className:i()(c.Z.socialIcon,c.Z[e],t),icon:e,size:n||24})},78868:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(82674),a=n.n(r),s=n(65736),o=n(65235),i=n.n(o),l=n(99196),c=n.n(l);const __=s.__,u=({logoColor:e="#069e08",showText:t=!0,className:n,height:r=32,...s})=>{const o=t?"0 0 118 32":"0 0 32 32";return c().createElement("svg",a()({xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:o,className:i()("jetpack-logo",n),"aria-labelledby":"jetpack-logo-title",height:r},s,{role:"img"}),c().createElement("title",{id:"jetpack-logo-title"},__("Jetpack Logo","jetpack")),c().createElement("path",{fill:e,d:"M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"}),t&&c().createElement(c().Fragment,null,c().createElement("path",{d:"M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z"}),c().createElement("path",{d:"M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z"}),c().createElement("path",{d:"M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z"}),c().createElement("path",{d:"M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z"}),c().createElement("path",{d:"M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z"}),c().createElement("path",{d:"M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z"}),c().createElement("path",{d:"M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z"})))}},32054:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(94333),a=n(49710);const s=["sm","md","lg"],o=(e,t)=>{const n=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t],[i,l,c]=s,u={sm:(0,r.useMediaQuery)(a.Z[i]),md:(0,r.useMediaQuery)(a.Z[l]),lg:(0,r.useMediaQuery)(a.Z[c])};return n.map(((e,t)=>{const n=o[t];return n?((e,t,n)=>{const r=s.indexOf(e),a=r+1,o=t.includes("=");let i=[];return t.startsWith("<")&&(i=s.slice(0,o?a:r)),t.startsWith(">")&&(i=s.slice(o?r:a)),i?.length?i.some((e=>n[e])):n[e]})(e,n,u):u[e]}))}},22636:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(65235),a=n.n(r),s=n(99196),o=n.n(s),i=n(46409);const l=({children:e=null,width:t=null,height:n=null,className:r=""})=>o().createElement("div",{className:a()(i.Z.placeholder,r),style:{width:t,height:n}},e)},52947:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(98709);const a=(e,t={})=>{const n=(0,r.X)();return new Intl.NumberFormat(n,t).format(e)}},49777:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(28918);const a=({value:e="https://jetpack.com",bgColor:t,fgColor:n,level:a,includeMargin:s,imageSettings:o,renderAs:i="canvas",size:l=248})=>React.createElement(r.ZP,{value:e,size:l,bgColor:t,fgColor:n,level:a,includeMargin:s,imageSettings:o,renderAs:i})},43521:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(65736),a=n(65235),s=n.n(a),o=n(99196),i=n.n(o),l=n(52947);n(34086);const __=r.__,c=({totalCount:e,items:t=[],showLegendLabelBeforeCount:n=!1,sortByCount:r,className:a,tableCaption:c,legendTitle:u,recordTypeLabel:d,recordCountLabel:p})=>{const m=(0,o.useMemo)((()=>e||t.reduce(((e,{count:t})=>e+t),0)),[t,e]),g=(0,o.useMemo)((()=>r?[...t].sort(((e,t)=>"ascending"===r?e.count-t.count:t.count-e.count)):t),[t,r]);return i().createElement("div",{className:s()("record-meter-bar",a)},i().createElement("div",{className:"record-meter-bar__items","aria-hidden":"true"},g.map((({count:e,label:t,backgroundColor:n})=>{const r=(e/m*100).toPrecision(2);return i().createElement("div",{key:t,style:{backgroundColor:n,flexBasis:`${r}%`}})}))),i().createElement("div",{className:"record-meter-bar__legend","aria-hidden":"true"},u&&i().createElement("div",{className:"record-meter-bar__legend--title"},u),i().createElement("ul",{className:"record-meter-bar__legend--items"},g.map((({count:e,label:t,backgroundColor:r})=>{const a=(0,l.Z)(e);return i().createElement("li",{key:t,className:"record-meter-bar__legend--item"},i().createElement("div",{className:"record-meter-bar__legend--item-circle",style:{backgroundColor:r}}),!n&&i().createElement("span",null,i().createElement("span",{className:"record-meter-bar__legend--item-count"},a),i().createElement("span",{className:"record-meter-bar__legend--item-label"},t)),n&&i().createElement("span",null,i().createElement("span",{className:"record-meter-bar__legend--item-label record-meter-bar__legend--item-label-first"},t),i().createElement("span",{className:"record-meter-bar__legend--item-count"},"(",a,")")))})))),i().createElement("table",{className:"screen-reader-text"},i().createElement("caption",null,c||__("Summary of the records","jetpack")),i().createElement("tbody",null,i().createElement("tr",null,i().createElement("th",{scope:"col"},d||__("Record type","jetpack")),i().createElement("th",{scope:"col"},p||__("Record count","jetpack"))),g.map((({label:e,count:t})=>i().createElement("tr",{key:e},i().createElement("td",null,e),i().createElement("td",null,t)))))))}},45033:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(25162),a=n.n(r),s=n(99196),o=n.n(s);n(48026);const i=({color:e="#FFFFFF",className:t="",size:n=20})=>{const r=t+" jp-components-spinner",a={width:n,height:n,fontSize:n,borderTopColor:e},s={borderTopColor:e,borderRightColor:e};return o().createElement("div",{className:r},o().createElement("div",{className:"jp-components-spinner__outer",style:a},o().createElement("div",{className:"jp-components-spinner__inner",style:s})))};i.propTypes={color:a().string,className:a().string,size:a().number};const l=i},66017:(e,t,n)=>{"use strict";n.d(t,{h:()=>r,s:()=>a});const r={"headline-medium":"h1","headline-small":"h2","headline-small-regular":"h2","title-medium":"h3","title-medium-semi-bold":"h3","title-small":"h4",body:"p","body-small":"p","body-extra-small":"p","body-extra-small-bold":"p",label:"p"},a=["mt","mr","mb","ml","mx","my","m","pt","pr","pb","pl","px","py","p"]},45106:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>p});var r=n(82674),a=n.n(r),s=n(65235),o=n.n(s),i=n(99196),l=n.n(i),c=n(66017),u=n(85837);const d=(0,i.forwardRef)((({variant:e="body",children:t,component:n,className:r,...s},d)=>{const p=n||c.h[e]||"span",m=(0,i.useMemo)((()=>c.s.reduce(((e,t)=>(void 0!==s[t]&&(e+=u.Z[`${t}-${s[t]}`]+" ",delete s[t]),e)),"")),[s]);return s.ref=d,l().createElement(p,a()({className:o()(u.Z.reset,u.Z[e],r,m)},s),t)}));d.displayName="Text";const p=d},88275:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>p});var r=n(99196),a=n.n(r),s=n(93468);const o={"--font-headline-medium":"48px","--font-headline-small":"36px","--font-title-medium":"24px","--font-title-small":"20px","--font-body":"16px","--font-body-small":"14px","--font-body-extra-small":"12px","--font-title-large":"var(--font-headline-small)","--font-label":"var(--font-body-extra-small)"},i={"--jp-black":"#000000","--jp-black-80":"#2c3338","--jp-white":"#ffffff","--jp-white-off":"#f9f9f6","--jp-gray":"#dcdcde","--jp-gray-0":"#F6F7F7","--jp-gray-5":"var(--jp-gray)","--jp-gray-10":"#C3C4C7","--jp-gray-20":"#A7AAAD","--jp-gray-40":"#787C82","--jp-gray-50":"#646970","--jp-gray-60":"#50575E","--jp-gray-70":"#3C434A","--jp-gray-80":"#2C3338","--jp-gray-90":"#1d2327","--jp-gray-off":"#e2e2df","--jp-red-0":"#F7EBEC","--jp-red-5":"#FACFD2","--jp-red-40":"#E65054","--jp-red-50":"#D63638","--jp-red-60":"#B32D2E","--jp-red-70":"#8A2424","--jp-red-80":"#691C1C","--jp-red":"#d63639","--jp-yellow-5":"#F5E6B3","--jp-yellow-10":"#F2CF75","--jp-yellow-20":"#F0C930","--jp-yellow-30":"#DEB100","--jp-yellow-40":"#C08C00","--jp-yellow-50":"#9D6E00","--jp-yellow-60":"#7D5600","--jp-blue-20":"#68B3E8","--jp-blue-40":"#1689DB","--jp-pink":"#C9356E","--jp-green-0":"#f0f2eb","--jp-green-5":"#d0e6b8","--jp-green-10":"#9dd977","--jp-green-20":"#64ca43","--jp-green-30":"#2fb41f","--jp-green-40":"#069e08","--jp-green-50":"#008710","--jp-green-60":"#007117","--jp-green-70":"#005b18","--jp-green-80":"#004515","--jp-green-90":"#003010","--jp-green-100":"#001c09","--jp-green":"#069e08","--jp-green-primary":"var( --jp-green-40 )","--jp-green-secondary":"var( --jp-green-30 )"},l={"--jp-border-radius":"4px","--jp-menu-border-height":"1px","--jp-underline-thickness":"2px"},c={"--spacing-base":"8px"},u={},d=(e,t,n)=>{const r={...o,...i,...l,...c};for(const t in r)e.style.setProperty(t,r[t]);n&&e.classList.add(s.Z.global),t&&(u[t]={provided:!0,root:e})},p=({children:e=null,targetDom:t,id:n,withGlobalStyles:s=!0})=>{const o=(0,r.useRef)(),i=u?.[n]?.provided;return(0,r.useLayoutEffect)((()=>{if(!i)return t?d(t,n,s):void(o?.current&&d(o.current,n,s))}),[t,o,i,n,s]),t?a().createElement(a().Fragment,null,e):a().createElement("div",{ref:o},e)}},98709:(e,t,n)=>{"use strict";n.d(t,{X:()=>a});var r=n(69771);const a=()=>{const{l10n:{locale:e}}=(0,r.getSettings)();if(e)return(e=>{const t=e.match(/^([a-z]{2,3})(_[a-z]{2}|_[a-z][a-z0-9]{4,7})?(?:_.*)?$/i);return t?`${t[1]}${t[2]?t[2]:""}`.replace("_","-"):"en-US"})(e);return window?.window?.navigator?.language??"en-US"}},6895:(e,t,n)=>{"use strict";function r(e,t={}){const n={};let r;if("undefined"!=typeof window&&(r=window?.JP_CONNECTION_INITIAL_STATE?.calypsoEnv),0===e.search("https://")){const t=new URL(e);e=`https://${t.host}${t.pathname}`,n.url=encodeURIComponent(e)}else n.source=encodeURIComponent(e);for(const e in t)n[e]=encodeURIComponent(t[e]);!Object.keys(n).includes("site")&&"undefined"!=typeof jetpack_redirects&&jetpack_redirects.hasOwnProperty("currentSiteRawUrl")&&(n.site=jetpack_redirects.currentBlogID??jetpack_redirects.currentSiteRawUrl),r&&(n.calypso_env=r);return"https://jetpack.com/redirect/?"+Object.keys(n).map((e=>e+"="+n[e])).join("&")}n.d(t,{Z:()=>r})},61132:(e,t,n)=>{let r={};try{r=n(92787)}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),r={missingConfig:!0}}const a=e=>r.hasOwnProperty(e);e.exports={jetpackConfigHas:a,jetpackConfigGet:e=>{if(!a(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return r[e]}}},31294:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(64743),a=n(9818),s=n(99196),o=n(80428);const i=window?.JP_CONNECTION_INITIAL_STATE?window.JP_CONNECTION_INITIAL_STATE:{},l=({registrationNonce:e=i.registrationNonce,apiRoot:t=i.apiRoot,apiNonce:n=i.apiNonce,redirectUri:l,autoTrigger:c,from:u,skipUserConnection:d}={})=>{const{registerSite:p,connectUser:m,refreshConnectedPlugins:g}=(0,a.useDispatch)(o.t),A=(0,a.useSelect)((e=>e(o.t).getRegistrationError())),{siteIsRegistering:h,userIsConnecting:E,userConnectionData:f,connectedPlugins:b,connectionErrors:C,isRegistered:v,isUserConnected:k,hasConnectedOwner:B,isOfflineMode:y}=(0,a.useSelect)((e=>({siteIsRegistering:e(o.t).getSiteIsRegistering(),userIsConnecting:e(o.t).getUserIsConnecting(),userConnectionData:e(o.t).getUserConnectionData(),connectedPlugins:e(o.t).getConnectedPlugins(),connectionErrors:e(o.t).getConnectionErrors(),isOfflineMode:e(o.t).getIsOfflineMode(),...e(o.t).getConnectionStatus()}))),w=()=>d?l?(window.location=l,Promise.resolve(l)):Promise.resolve():m({from:u,redirectUri:l}),_=t=>(t&&t.preventDefault(),v?w():p({registrationNonce:e,redirectUri:l,from:u}).then((()=>w())));return(0,s.useEffect)((()=>{r.ZP.setApiRoot(t),r.ZP.setApiNonce(n)}),[t,n]),(0,s.useEffect)((()=>{!c||h||E||_()}),[]),{handleRegisterSite:_,handleConnectUser:w,refreshConnectedPlugins:g,isRegistered:v,isUserConnected:k,siteIsRegistering:h,userIsConnecting:E,registrationError:A,userConnectionData:f,hasConnectedOwner:B,connectedPlugins:b,connectionErrors:C,isOfflineMode:y}}},27523:(e,t,n)=>{"use strict";n.d(t,{LI:()=>s,N4:()=>i,Qo:()=>d,T1:()=>c,TS:()=>u,ZP:()=>k,b5:()=>m,i6:()=>a,qJ:()=>g,qV:()=>l,r7:()=>o,wQ:()=>p});var r=n(64743);const a="SET_CONNECTION_STATUS",s="SET_CONNECTION_STATUS_IS_FETCHING",o="SET_SITE_IS_REGISTERING",i="SET_USER_IS_CONNECTING",l="SET_REGISTRATION_ERROR",c="CLEAR_REGISTRATION_ERROR",u="SET_AUTHORIZATION_URL",d="DISCONNECT_USER_SUCCESS",p="SET_CONNECTED_PLUGINS",m="SET_CONNECTION_ERRORS",g="SET_IS_OFFLINE_MODE",A=e=>({type:a,connectionStatus:e}),h=e=>({type:o,isRegistering:e}),E=e=>({type:i,isConnecting:e}),f=e=>({type:l,registrationError:e}),b=()=>({type:c}),C=e=>({type:u,authorizationUrl:e}),v=e=>({type:p,connectedPlugins:e});const k={setConnectionStatus:A,setConnectionStatusIsFetching:e=>({type:s,isFetching:e}),fetchConnectionStatus:()=>({type:"FETCH_CONNECTION_STATUS"}),fetchAuthorizationUrl:e=>({type:"FETCH_AUTHORIZATION_URL",redirectUri:e}),setSiteIsRegistering:h,setUserIsConnecting:E,setRegistrationError:f,clearRegistrationError:b,setAuthorizationUrl:C,registerSite:function*({registrationNonce:e,redirectUri:t,from:n=""}){yield b(),yield h(!0);try{const r=yield{type:"REGISTER_SITE",registrationNonce:e,redirectUri:t,from:n};return yield A({isRegistered:!0}),yield C(r.authorizeUrl),yield h(!1),Promise.resolve(r)}catch(e){return yield f(e),yield h(!1),Promise.reject(e)}},connectUser:function*({from:e,redirectFunc:t,redirectUri:n}={}){yield E(!0),yield{type:"CONNECT_USER",from:e,redirectFunc:t,redirectUri:n}},disconnectUserSuccess:()=>({type:d}),setConnectedPlugins:v,refreshConnectedPlugins:()=>async({dispatch:e})=>await new Promise((t=>r.ZP.fetchConnectedPlugins().then((n=>{e(v(n)),t(n)})))),setConnectionErrors:e=>({type:m,connectionErrors:e}),setIsOfflineMode:e=>({type:g,isOfflineMode:e})}},31432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(64743),a=n(9818),s=n(27057);const o={FETCH_AUTHORIZATION_URL:({redirectUri:e})=>r.ZP.fetchAuthorizationUrl(e),REGISTER_SITE:({registrationNonce:e,redirectUri:t,from:n})=>r.ZP.registerSite(e,t,n),CONNECT_USER:(0,a.createRegistryControl)((({resolveSelect:e})=>({from:t,redirectFunc:n,redirectUri:r}={})=>new Promise(((a,o)=>{e(s.Z).getAuthorizationUrl(r).then((e=>{const r=n||(e=>window.location.assign(e)),s=new URL(e);t&&s.searchParams.set("from",encodeURIComponent(t));const o=s.toString();r(o),a(o)})).catch((e=>{o(e)}))}))))}},41479:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818),a=n(27523);const s=(0,r.combineReducers)({connectionStatus:(e={},t)=>{switch(t.type){case a.i6:return{...e,...t.connectionStatus};case a.Qo:return{...e,isUserConnected:!1}}return e},connectionStatusIsFetching:(e=!1,t)=>t.type===a.LI?t.isFetching:e,siteIsRegistering:(e=!1,t)=>t.type===a.r7?t.isRegistering:e,userIsConnecting:(e=!1,t)=>t.type===a.N4?t.isConnecting:e,registrationError:(e,t)=>{switch(t.type){case a.T1:return!1;case a.qV:return t.registrationError;default:return e}},authorizationUrl:(e,t)=>t.type===a.TS?t.authorizationUrl:e,userConnectionData:(e,t)=>(t.type,e),connectedPlugins:(e={},t)=>t.type===a.wQ?t.connectedPlugins:e,connectionErrors:(e={},t)=>t.type===a.b5?t.connectionErrors:e,isOfflineMode:(e=!1,t)=>t.type===a.qJ?t.isConnecting:e})},77728:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9818),a=n(27523),s=n(27057);const o={...{getAuthorizationUrl:{isFulfilled:(e,...t)=>{const n=Boolean(e.authorizationUrl),a=(0,r.select)(s.Z).hasFinishedResolution("getAuthorizationUrl",t);return n&&!a&&(0,r.dispatch)(s.Z).finishResolution("getAuthorizationUrl",t),n},*fulfill(e){const t=yield a.ZP.fetchAuthorizationUrl(e);yield a.ZP.setAuthorizationUrl(t.authorizeUrl)}}}}},82725:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r={...{getConnectionStatus:e=>e.connectionStatus||{},getConnectionStatusIsFetching:()=>!1,getSiteIsRegistering:e=>e.siteIsRegistering||!1,getUserIsConnecting:e=>e.userIsConnecting||!1,getRegistrationError:e=>e.registrationError||!1,getAuthorizationUrl:e=>e.authorizationUrl||!1,getUserConnectionData:e=>e.userConnectionData||!1,getConnectedPlugins:e=>e.connectedPlugins||[],getConnectionErrors:e=>e.connectionErrors||[],getIsOfflineMode:e=>e.isOfflineMode||!1,getWpcomUser:e=>e?.userConnectionData?.currentUser?.wpcomUser,getBlogId:e=>e?.userConnectionData?.currentUser?.blogId}}},13535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818);class a{static store=null;static mayBeInit(e,t){null===a.store&&(a.store=(0,r.createReduxStore)(e,t),(0,r.register)(a.store))}}const s=a},27057:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r="jetpack-connection"},80428:(e,t,n)=>{"use strict";n.d(t,{t:()=>c.Z});var r=n(27523),a=n(31432),s=n(41479),o=n(77728),i=n(82725),l=n(13535),c=n(27057);const u=window.JP_CONNECTION_INITIAL_STATE;u||console.error("Jetpack Connection package: Initial state is missing. Check documentation to see how to use the Connection composer package to set up the initial state."),l.Z.mayBeInit(c.Z,{__experimentalUseThunks:!0,reducer:s.Z,actions:r.ZP,selectors:i.Z,resolvers:o.Z,controls:a.Z,initialState:u||{}})},81050:(e,t,n)=>{"use strict";n.d(t,{PostPublishManualSharing:()=>l.Z,PostPublishReviewPrompt:()=>i.Z,PublicizePanel:()=>o.Z,SocialImageGeneratorPanel:()=>s.Z,SocialPreviewsModal:()=>r.Z,SocialPreviewsPanel:()=>a.Z,usePublicizeConfig:()=>u.Z,useSocialMediaConnections:()=>c.Z,useSyncPostDataToStore:()=>p.N});n(23177),n(4277),n(49021),n(84703);var r=n(8454),a=n(74140),s=n(54005),o=(n(8350),n(76848),n(92116),n(79631),n(8714)),i=(n(19649),n(52403)),l=n(91750),c=(n(77106),n(75674),n(37568)),u=(n(48751),n(14085)),d=(n(45579),n(75323),n(42032));n.o(d,"useSyncPostDataToStore")&&n.d(t,{useSyncPostDataToStore:function(){return d.useSyncPostDataToStore}});n(91474);var p=n(19890);n(32637),n(86419),n(34431),n(71806),n(22917),n(95766)},92116:(e,t,n)=>{"use strict";n(9818),n(69307),n(99196),n(23177)},85761:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(3396),a=n(69307),s=n(65235),o=n.n(s),i=n(25162),l=n.n(i);const c=e=>{const{checked:t,serviceName:n,label:s,onClick:i,profilePicture:l}=e,[c,u]=(0,a.useState)(!!l),d=(0,a.useCallback)((()=>u(!1)),[]),p=(0,a.useCallback)((e=>{13===e.keyCode&&i()}),[i]);return React.createElement("div",{onClick:i,onKeyDown:p,role:"switch","aria-checked":t,tabIndex:"0",className:o()("components-connection-icon",{"components-connection-icon__picture":c})},c&&React.createElement("img",{src:l,alt:s,onError:d}),React.createElement(r.av,{alt:s,serviceName:"instagram-business"===n?"instagram":"twitter"===n?"x":n,className:"jetpack-publicize-gutenberg-social-icon"}))};c.propTypes={serviceName:l().string,label:l().string,profilePicture:l().string};const u=c},60676:(e,t,n)=>{"use strict";n(55609),n(65736),n(99196),n(85761),n(62878),n(25893),n(20841),n(43876),n(75124)},62878:(e,t,n)=>{"use strict";n.d(t,{d:()=>o});var r=n(55609),a=n(65736),s=n(75124);const __=a.__;function o({connection:e}){return e.display_name?React.createElement("div",{className:s.Z["connection-name"]},e.profile_link?React.createElement(r.ExternalLink,{className:s.Z["profile-link"],href:e.profile_link},e.display_name):React.createElement("span",{className:s.Z["profile-link"]},e.display_name)):React.createElement(r.Spinner,{color:"black","aria-label":__("Loading account details","jetpack")})}},25893:(e,t,n)=>{"use strict";n.d(t,{Q:()=>s});var r=n(65736),a=n(67660);const __=r.__;function s({connection:e,service:t,onConfirmReconnect:n}){return"broken"!==e.status?null:React.createElement("div",null,React.createElement("span",{className:"description"},__("There is an issue with this connection.","jetpack"))," ",React.createElement(a.w,{connection:e,service:t,onConfirmReconnect:n}))}},20841:(e,t,n)=>{"use strict";n.d(t,{c:()=>u});var r=n(90526),a=n(55609),s=n(9818),o=n(69307),i=n(65736),l=n(23177),c=n(75124);const __=i.__,_x=i._x;function u({connection:e,variant:t="secondary",isDestructive:n=!0,buttonClassName:u}){const[d,p]=(0,o.useReducer)((e=>!e),!1),{deleteConnectionById:m}=(0,s.useDispatch)(l.h),{isDisconnecting:g}=(0,s.useSelect)((t=>{const{getDeletingConnections:n}=t(l.h);return{isDisconnecting:n().includes(e.connection_id)}}),[e.connection_id]),A=(0,o.useCallback)((async()=>{p(),await m({connectionId:e.connection_id})}),[e.connection_id,m]);return e.can_disconnect?React.createElement(React.Fragment,null,React.createElement(a.__experimentalConfirmDialog,{className:c.Z.confirmDialog,isOpen:d,onConfirm:A,onCancel:p,cancelButtonText:__("Cancel","jetpack"),confirmButtonText:__("Yes","jetpack")},(0,o.createInterpolateElement)((0,i.sprintf)(
// translators: %s: The name of the connection the user is disconnecting.
__("Are you sure you want to disconnect %s ?","jetpack"),e.display_name),{strong:React.createElement("strong",null)})),React.createElement(r.Z,{size:"small",onClick:p,disabled:g,variant:t,isDestructive:n,className:u},g?__("Disconnecting…","jetpack"):_x("Disconnect","Disconnect a social media account","jetpack"))):null}},75674:(e,t,n)=>{"use strict";n(55609),n(9818),n(69307),n(65736),n(65235),n(37568),n(23177),n(95766),n(66475),n(60676),n(75124)},43876:(e,t,n)=>{"use strict";n.d(t,{l:()=>l});var r=n(55609),a=n(9818),s=n(69307),o=n(65736),i=n(23177);const __=o.__;function l({connection:e}){const{updateConnectionById:t}=(0,a.useDispatch)(i.h),{isUpdating:n}=(0,a.useSelect)((t=>{const{getUpdatingConnections:n}=t(i.h);return{isUpdating:n().includes(e.connection_id)}}),[e.connection_id]),o=(0,s.useCallback)((n=>{t(e.connection_id,{shared:n})}),[e.connection_id,t]);return React.createElement(r.CheckboxControl,{checked:e.shared??!1,onChange:o,disabled:n||"broken"===e.status,label:__("Mark the connection as shared","jetpack")})}},67660:(e,t,n)=>{"use strict";n.d(t,{w:()=>c});var r=n(90526),a=n(9818),s=n(69307),o=n(65736),i=n(23177),l=n(58300);const __=o.__,_x=o._x;function c({connection:e,service:t,variant:n="link",onConfirmReconnect:o}){const{deleteConnectionById:c,setKeyringResult:u}=(0,a.useDispatch)(i.h),{isDisconnecting:d}=(0,a.useSelect)((t=>{const{getDeletingConnections:n}=t(i.h);return{isDisconnecting:n().includes(e.connection_id)}}),[e.connection_id]),p=(0,s.useCallback)((e=>{u(e),e?.ID&&o?.()}),[o,u]),m=(0,l.N)({service:t,onConfirm:p}),g=(0,s.useCallback)((async()=>{if(!await c({connectionId:e.connection_id,showSuccessNotice:!1}))return;const n=new FormData;"mastodon"===t.ID&&n.set("instance",e.external_display),m(n)}),[e,c,m,t.ID]);return e.can_disconnect?React.createElement(React.Fragment,null,React.createElement(r.Z,{size:"small",onClick:g,disabled:d,variant:n},d?__("Disconnecting…","jetpack"):_x("Reconnect","Reconnect a social media account","jetpack"))):null}},24479:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(65235),a=n.n(r),s=n(25162),o=n.n(s),i=n(85761);const l=e=>{const{checked:t,disabled:n,onChange:r,serviceName:s,label:o,profilePicture:l}=e,c=a()("components-connection-toggle",{"is-not-checked":!t,"is-disabled":n});return React.createElement("div",{className:c,title:o},React.createElement(i.Z,{checked:t,label:o,onClick:r,serviceName:s,profilePicture:l}))};l.propTypes={className:o().string,checked:o().bool,id:o().string.isRequired,disabled:o().bool,onChange:o().func,serviceName:o().string,label:o().string,profilePicture:o().string};const c=l},49021:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(94333),a=n(9818),s=n(69307),o=n(23177);class i extends s.Component{componentDidMount(){this.props.refreshConnections()}render(){return null}}const l=(0,r.compose)([(0,a.withSelect)((e=>({failedConnections:e(o.Eg).getFailedConnections()}))),(0,a.withDispatch)((e=>({refreshConnections:e(o.Eg).refreshConnectionTestResults})))])(i)},4277:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(13419),a=n(55609),s=n(9818),o=n(69307),i=n(65736),l=n(23177),c=n(24479),u=n(28161),d=n(91853);const __=i.__;class p extends o.Component{maybeDisplayLinkedInNotice=()=>this.connectionNeedsReauth()&&React.createElement(a.Notice,{className:u.Z["publicize-notice"],isDismissible:!1,status:"error"},React.createElement("p",null,__("Your LinkedIn connection needs to be reauthenticated to continue working – head to Sharing to take care of it.","jetpack")),React.createElement(a.ExternalLink,{href:`https://wordpress.com/marketing/connections/${(0,r.lQ)()}`},__("Go to Sharing settings","jetpack")));connectionNeedsReauth=()=>this.props.mustReauthConnections.includes(this.props.name);onConnectionChange=()=>{const{id:e}=this.props;this.isDisabled()||this.props.toggleConnection(e)};connectionIsFailing(){const{failedConnections:e,name:t}=this.props;return e.some((e=>e.service_name===t))}isDisabled(){return this.props.disabled||this.connectionIsFailing()||this.connectionNeedsReauth()}render(){const{enabled:e,id:t,label:n,name:r,profilePicture:a}=this.props,s="connection-"+r+"-"+t,o=r.replace("_","-"),i=React.createElement(c.Z,{id:s,className:d.Z["connection-toggle"],checked:e,onChange:this.onConnectionChange,disabled:this.isDisabled(),serviceName:o,label:n,profilePicture:a});return React.createElement("li",null,this.maybeDisplayLinkedInNotice(),React.createElement("div",{className:d.Z["connection-container"]},i))}}const m=(0,s.withSelect)((e=>({failedConnections:e(l.Eg).getFailedConnections(),mustReauthConnections:e(l.Eg).getMustReauthConnections()})))(p)},1922:(e,t,n)=>{"use strict";n.d(t,{F:()=>d});var r=n(6895),a=n(13419),s=n(55609),o=n(69307),i=n(65736),l=n(81050),c=n(75323),u=n(62578);const __=i.__,d=()=>{const{shouldShowAdvancedPlanNudge:e}=(0,l.usePublicizeConfig)(),{dismissNotice:t,shouldShowNotice:n,NOTICES:i}=(0,c.Z)(),d=(0,o.useCallback)((()=>t(i.advancedUpgradeEditor,7776e3)),[t,i]);return e&&n(i.advancedUpgradeEditor)&&React.createElement(u.Z,{onDismiss:d,type:"highlight"},(0,o.createInterpolateElement)(__("Need more reach? Unlock custom media sharing with the Advanced Plan ","jetpack"),{upgradeLink:React.createElement(s.ExternalLink,{href:(0,r.Z)("jetpack-social-advanced-site-checkout",{site:(0,a.lQ)(),query:"redirect_to="+encodeURIComponent(window.location.href)})})}))}},87029:(e,t,n)=>{"use strict";n.d(t,{w:()=>d});var r=n(13419),a=n(55609),s=n(69307),o=n(65736),i=n(81050),l=n(75323),c=n(62578),u=n(75631);const __=o.__,d=()=>{const{dismissNotice:e,shouldShowNotice:t,NOTICES:n}=(0,l.Z)(),o=(0,s.useCallback)((()=>e(n.autoConversion)),[e,n]),{adminUrl:d,jetpackSharingSettingsUrl:p}=(0,i.usePublicizeConfig)();return!(0,r.Wp)()&&t(n.autoConversion)&&React.createElement(c.Z,{type:"warning",actions:[React.createElement(a.Button,{onClick:o,key:"dismiss",variant:"primary"},__("Got it","jetpack")),React.createElement(a.Button,{className:u.Z["change-settings-button"],key:"change-settings",href:d||p,target:"_blank",rel:"noreferrer noopener"},__("Change settings","jetpack"))]},__("When your post is published, the selected image will be converted for maximum compatibility across your connected social networks.","jetpack"))}},63503:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(55609),a=n(69307),s=n(65736),o=n(81050),i=n(37568),l=n(62578),c=n(49285);const _n=s._n,u=()=>{const{connections:e}=(0,i.Z)(),t=e.filter((e=>(0,c.A)(e,"broken"))),{connectionsAdminUrl:n}=(0,o.usePublicizeConfig)();return t.length>0&&React.createElement(l.Z,{type:"error"},(0,a.createInterpolateElement)(_n("One of your social connections is broken. Reconnect them on the connection management page.","Some of your social connections are broken. Reconnect them on the connection management page.",t.length,"jetpack"),{fixLink:React.createElement(r.ExternalLink,{href:n})}))}},75457:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(14085),a=n(37568),s=n(4277),o=n(69709),i=n(75631),l=n(28155);const c=()=>{const{connections:e,toggleById:t}=(0,a.Z)(),{canBeTurnedOn:n,shouldBeDisabled:c}=(0,l.z)(),{needsUserConnection:u}=(0,r.Z)();return React.createElement("ul",{className:i.Z["connections-list"]},e.map((e=>{const{display_name:r,id:a,service_name:o,profile_picture:i,connection_id:l}=e,u=l||a;return React.createElement(s.Z,{disabled:c(e),enabled:n(e)&&e.enabled,key:u,id:u,label:r,name:o,toggleConnection:t,profilePicture:i})})),u?null:React.createElement("li",null,React.createElement(o.Z,null)))}},82356:(e,t,n)=>{"use strict";n.d(t,{H:()=>c});var r=n(55609),a=n(65736),s=n(14085),o=n(37568),i=n(75631),l=n(28155);const _n=a._n;function c(){const{enabledConnections:e}=(0,o.Z)(),{isPublicizeEnabled:t}=(0,s.Z)(),{canBeTurnedOn:n,shouldBeDisabled:c}=(0,l.z)(),u=e.filter((e=>n(e)&&!c(e)));return u.length&&t?React.createElement(r.PanelRow,null,React.createElement("p",{className:i.Z["enabled-connections-notice"]},(0,a.sprintf)(/* translators: %d: number of connections */
@@ -124,11 +124,11 @@ __("Delete %s","jetpack"),o.label),disabled:a===l},a===l?__("Deleting","jetpack"
__("Kind","jetpack"),onChange:t=>{n({...e,kind:t})},disabled:f}),(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-buttons-container"},f?(0,r.createElement)(i.Spinner,null):(0,r.createElement)(i.Button,{variant:"secondary",disabled:!e.tmpFile,onClick:()=>{h(null),""===C&&(e.label=__("English","jetpack")),""===v&&(e.srcLang="en"),void 0===e.kind&&(e.kind=p),d(e)?h(__("A track already exists for that language and kind.","jetpack")):(b(!0),E(e,t).then((()=>{n(e),h(null),a()})).catch((e=>{e.message&&h(e.message)})).finally((()=>{b(!1)})))}},__("Save","jetpack")),(0,r.createElement)(i.Button,{variant:"link",onClick:s},__("Close","jetpack"))),A&&(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-error"},/* translators: %s: An error message returned after a failed video track file upload." */ /* translators: %s: An error message returned after a failed video track file upload." */
(0,u.sprintf)(__("Error: %s","jetpack"),A))))}function v({tracks:e=[],onChange:t,guid:n}){const[a,s]=(0,c.useState)(null);return(0,r.createElement)(i.Dropdown,{contentClassName:"videopress-block-tracks-editor",renderToggle:({isOpen:e,onToggle:t})=>(0,r.createElement)(i.ToolbarButton,{label:__("Text tracks","jetpack"),showTooltip:!0,"aria-expanded":e,"aria-haspopup":"true",onClick:t,icon:A}),renderContent:()=>null!==a?(0,r.createElement)(C,{track:e[a],guid:n,onChange:n=>{const r=[...e];r[a]=n,t(r)},onClose:()=>s(null),onCancel:()=>{t(e.filter(((e,t)=>t!==a))),s(null)},trackExists:t=>-1!==e.filter(((e,t)=>t!==a)).findIndex((e=>e.kind===t.kind&&e.srcLang===t.srcLang))}):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.NavigableMenu,null,(0,r.createElement)(b,{tracks:e,onChange:t,guid:n}),(0,r.createElement)(i.MenuGroup,{className:"videopress-block-tracks-editor__add-tracks-container",label:__("Add tracks","jetpack")},(0,r.createElement)(i.MenuItem,{icon:d.Z,onClick:()=>{(()=>{const n=e.length,r=[...e];r[n]||(r[n]={}),r[n]={...e[n]},t(r),s(n)})()}},__("Upload track","jetpack")))))})}},32478:(e,t,n)=>{"use strict";n.d(t,{$:()=>A});var r=n(51806),a=n(52175),s=n(55609),o=n(69307),i=n(65736),l=n(61074),c=n(65235),u=n.n(c),d=n(81427);const __=i.__,p=["image"],m=e=>{const{videoPosterImageUrl:t}=e;return(0,r.createElement)("div",{className:"resumable-upload__editor-thumb-placeholder"},t?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("img",{src:t,alt:"Poster"}),(0,r.createElement)(l.Z,{className:"uploading-editor__play-icon",icon:d.o1})):(0,r.createElement)("span",null,"No Poster Selected"))},g=e=>{const{onSelectPoster:t,onRemovePoster:n}=e;return(0,r.createElement)(s.BaseControl,{className:u()(e.className,"editor-video-poster-control")},(0,r.createElement)(m,e),(0,r.createElement)(a.MediaUpload,{title:__("Select Poster Image","jetpack"),onSelect:t,allowedTypes:p,render:({open:e})=>(0,r.createElement)("div",{className:"poster-selector__buttons"},(0,r.createElement)(s.Button,{onClick:n,variant:"link",isDestructive:!0},__("Remove Poster Image","jetpack")),(0,r.createElement)(s.Button,{variant:"secondary",onClick:e},__("Select Poster Image","jetpack")))}))},A=e=>{const{file:t,onSelectPoster:n,onRemovePoster:i,videoPosterImageData:c,title:u,onChangeTitle:m,onVideoFrameSelected:A}=e,[h,E]=(0,o.useState)(0),[f,b]=(0,o.useState)(!0),C=(0,o.useRef)(null),v=(0,o.useRef)(null),k=()=>{b(!1)};(0,o.useEffect)((()=>{null!==t&&C&&(C.current.src=URL.createObjectURL(t))}),[t,C]);const B={};return c&&(B.display="none"),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"uploading-editor"},(0,r.createElement)("div",{className:"uploading-editor__summary"}),(0,r.createElement)("div",{className:"uploading-editor__fields"},(0,r.createElement)(s.TextControl,{label:__("Video title","jetpack"),className:"uploading-editor__title",onChange:m,value:u}),(0,r.createElement)("div",{className:"uploading-editor__content"},(0,r.createElement)(s.BaseControl,{label:__("Video poster (optional)","jetpack")},f?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"uploading-editor__video-container"},(0,r.createElement)("div",{className:"uploading-editor__video-poster-wrapper"},c&&(0,r.createElement)(g,{onSelectPoster:n,onRemovePoster:i,videoPosterImageUrl:c.url}),(0,r.createElement)("video",{ref:C,muted:!0,className:"uploading-editor__video",onDurationChange:e=>{const t=e.target.duration;E(t),C.current&&(C.current.currentTime=t/2)},onError:k,onLoadedMetadata:e=>{e.target.videoHeight||k()},style:B})),!c&&(0,r.createElement)(l.Z,{className:"uploading-editor__play-icon",icon:d.o1})),(0,r.createElement)("span",{style:B},(0,r.createElement)(s.RangeControl,{className:"uploading-editor__range",min:"0",step:"0.1",max:h,showTooltip:!1,withInputField:!1,onChange:e=>{A(1e3*e),C.current&&(C.current.currentTime=e)}})),(0,r.createElement)("span",{className:"uploading-editor__scrubber-help",style:B},(0,o.createInterpolateElement)(__("This is how the video will look. Use the slider to choose a poster or select a custom one .","jetpack"),{a:(0,r.createElement)(a.MediaUpload,{title:__("Select Poster Image","jetpack"),onSelect:n,allowedTypes:p,render:({open:e})=>(0,r.createElement)("a",{className:"uploading-editor__upload-link",onClick:e,onKeyDown:e,ref:v,role:"button",tabIndex:0},__("select a custom one","jetpack"))})}))):(0,r.createElement)(g,{onSelectPoster:n,videoPosterImageUrl:c?c.url:null}))))))}},90953:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(96483);const a=(e,{autoplay:t,controls:n,loop:a,muted:s,playsinline:o,poster:i,preload:l,seekbarColor:c,seekbarPlayedColor:u,seekbarLoadingColor:d,useAverageColor:p})=>{if(!e)return null;const m={resizeToParent:!0,cover:!0,...t&&{autoPlay:!0},...!n&&{controls:!1},...a&&{loop:!0},...s&&{muted:!0,persistVolume:!1},...o&&{playsinline:!0},...i&&{posterUrl:i},...""!==l&&{preloadContent:l},...""!==c&&{sbc:c},...""!==u&&{sbpc:u},...""!==d&&{sblc:d},...p&&{useAverageColor:!0}};return(0,r.addQueryArgs)(`https://videopress.com/v/${e}`,m)}},77290:(e,t,n)=>{"use strict";n.d(t,{K8:()=>l,Kp:()=>u,Zx:()=>c,f6:()=>i});n(4981);var r=n(65235),a=n.n(r),s=n(90879);const o=e=>{const t=s.sl.reduce(((e,{className:t})=>(e[t]=!1,e)),{"wp-has-aspect-ratio":!1});return a()(e,t)};function i(e,t="",n=!0){if(!n)return o(t);const r=document.implementation.createHTMLDocument("");r.body.innerHTML=e;const i=r.body.querySelector("iframe");if(i&&i.height&&i.width){const e=(i.width/i.height).toFixed(2);for(let n=0;n=r.ratio)return a()(o(t),r.className,"wp-has-aspect-ratio")}}return t}const l=e=>e.replace(/\.[^/.]+$/,""),c=e=>{if(!e||"string"!=typeof e)return null;const t=e.match(/^https?:\/\/(?video(?:\.word|s\.files\.word)?press\.com)(?:\/v|\/embed)?\/(?[a-zA-Z\d]{8})/);return t?.groups?.guid?t.groups.guid:null},u=e=>{const{guid:t,videoPressTracks:n,isVideoPressExample:r}=e;if(!t?.length)return!1;if(!Array.isArray(n))return!1;return!(!Object.keys(e).includes("isVideoPressExample")||"boolean"!=typeof r)}},65192:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(13419),s=n(52175),o=n(4981),i=n(55609),l=n(9818),c=n(12238),u=(n(69307),n(65736)),d=n(77290),p=n(5743);const __=u.__,m={instances:[]},g=(e=[],t=!1,n=0)=>{if(t&&(m.instances=[]),e.forEach((e=>{if(e.innerBlocks.length)return void g(e.innerBlocks,!1,n+1);const{clientId:t,name:r,attributes:a}=e;"core/video"===r&&(0,d.Kp)(a)&&m.instances.push({clientId:t,name:r,attributes:a})})),0===n)return m.instances};function A({clientId:e,attributes:t}){const n=(0,l.useSelect)((e=>e(c.store).getCurrentPostId())),{getBlocks:u}=(0,l.useSelect)(s.store),{replaceBlock:m}=(0,l.useDispatch)(s.store),{tracks:A}=(0,a.z$)();return(0,r.createElement)("div",{className:p.Z.wrapper},(0,r.createElement)(i.Notice,{status:"info",isDismissible:!1,className:p.Z["conversion-notice"]},__("You can transform this post's video blocks to the new VideoPress block to take advantage of new features, such as adding chapters directly in the description or hiding the video's share menu.","jetpack")),(0,r.createElement)(i.Button,{variant:"primary",onClick:()=>{const r=g(u(),!0);r?.length&&(r.find((t=>t.clientId===e))||r.push({clientId:e,name:"core/video",currentBlockAttributes:t}),r.forEach((e=>{const{clientId:t,name:r,attributes:a}=e;"core/video"===r&&(0,d.Kp)(a)&&(m(t,(0,o.createBlock)("videopress/video",a)),A.recordEvent("jetpack_editor_videopress_block_manual_conversion_click",{post_id:n}))})))}},__("Transform blocks to VideoPress","jetpack")))}},68938:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(52175),s=n(94333),o=n(77290),i=n(65192);const l=(0,s.createHigherOrderComponent)((e=>t=>(0,o.Kp)(t.attributes)?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(i.Z,{clientId:t.clientId,attributes:t.attributes})),(0,r.createElement)(e,t)):(0,r.createElement)(e,t)))},23062:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(13419),a=n(68938);const s="videopress/video";function o(e,t){if("core/video"!==t)return e;const{available:n}=(0,r.OZ)(s);return n?{...e,edit:(0,a.Z)(e.edit)}:e}},73859:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(51806),a=n(55609),s=n(65736),o=n(78680),i=n(75255);const __=s.__,l="videopress/video-chapters",c=!!window?.Jetpack_Editor_Initial_State?.available_blocks[l],u=31;function d({isRequestingVideoItem:e}){const{attributes:t,setAttributes:n}=(0,i.Z)(),{title:s,description:d}=t,p=(0,o.L)(l),m=d?.length?d.split("\n").map((e=>Math.ceil(e.length/u)||1)).reduce(((e,t)=>e+t),0):4,g=Math.min(12,Math.max(m,4));if(!c)return null;return(0,r.createElement)(a.PanelBody,{title:__("Details","jetpack"),className:p?"is-beta":""},(0,r.createElement)(a.TextControl,{label:__("Title","jetpack"),value:s,placeholder:__("Video title","jetpack"),onChange:e=>{n({title:e})},disabled:e}),(0,r.createElement)(a.TextareaControl,{label:__("Description","jetpack"),value:d,placeholder:__("Video description","jetpack"),onChange:e=>{n({description:e})},disabled:e,rows:g}))}},24288:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(51806),a=n(52175),s=n(94333),o=n(69307),i=n(73859),l=n(67203),c=n(49664),u=n(84676);const d=(0,s.createHigherOrderComponent)((e=>t=>{const{attributes:n,setAttributes:s}=t,[d,p]=(0,l.Z)(n?.id),[m]=(0,c.v)(n);return(0,o.useEffect)((()=>{if(!d)return;const e={};d?.title&&(e.title=d.title),d?.description&&(e.description=d.description),Object.keys(e).length&&(s(e),m(e))}),[d,s,m]),u.d&&"core/video"!==!t.name&&t.attributes?.guid?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(i.Z,{isRequestingVideoItem:p})),(0,r.createElement)(e,t)):(0,r.createElement)(e,t)}))},75255:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(52175),a=n(9818);function s(){const{clientId:e,attributes:t}=(0,a.useSelect)((e=>{const t=e(r.store).getSelectedBlockClientId();return{clientId:t,attributes:t?e("core/block-editor").getBlockAttributes(t):void 0}})),{updateBlockAttributes:n}=(0,a.useDispatch)(r.store);return{clientId:e,attributes:t,setAttributes:t=>n(e,t)}}},49664:(e,t,n)=>{"use strict";n.d(t,{v:()=>A});var r=n(86989),a=n.n(r),s=n(94333),o=n(37798),i=n(9818),l=n(12238),c=n(69307),u=n(65736),d=n(22081),p=n(90953),m=n(84321),g=n(38871);const __=u.__;function A(e){const{id:t,title:n,description:r,guid:u}=e,A=(0,i.useSelect)((e=>e(l.store).isSavingPost()),[]),h=(0,s.usePrevious)(A),E=(0,i.useDispatch)(o.store).invalidateResolution,[f,b]=(0,c.useState)(),C=(0,c.useCallback)((e=>{b((t=>({...t,...e})))}),[]);(0,c.useEffect)((()=>{b({title:n,description:r})}),[]);const v=function(e){return t=>new Promise(((n,r)=>{a()({path:"/wpcom/v2/videopress/meta",method:"POST",data:{id:e,...t}}).then((e=>{if(200!==e?.data)return r(e);n(e)})).catch(r)}))}(t);return(0,c.useEffect)((()=>{if(!A||h)return;if(!t)return;const a={};if(f?.title!==n&&(a.title=n),f?.description!==r&&(a.description=r),!Object.keys(a).length)return;if(v(a).then((()=>C({title:n,description:r}))),!a?.description?.length)return;const s=(0,m.ZP)(a.description);if(!s?.length)return;const o={label:__("English","jetpack"),srcLang:"en",kind:"chapters",tmpFile:(0,g.ZP)(a.description)};(0,d.n)(o,u).then((()=>{const t=(0,p.p)(u,e);E("getEmbedPreview",[t])}))}),[A,h,n,f?.title,f?.description,r,v,C,e,E,t,u]),[C]}},67203:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(86989),a=n.n(r),s=n(69307);function o(e){const[t,n]=(0,s.useState)({}),[r,o]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{e&&(o(!0),async function(){try{const t=await a()({path:`/wp/v2/media/${e}`});n(t?.jetpack_videopress||{}),o(!1)}catch(e){throw o(!1),new Error(e)}}())}),[e]),[t,r]}},84676:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s,d:()=>a});var r=n(24288);const a=!!window?.Jetpack_Editor_Initial_State?.available_blocks["videopress/video-chapters"];function s(e,t){if(!a)return e;if("core/video"!==t)return e;const n={...e.attributes,title:{type:"string"},description:{type:"string"}};return{...e,attributes:n,edit:(0,r.Z)(e.edit)}}},84321:(e,t,n)=>{"use strict";function r(e){return e.split("\n").map((e=>function(e){const t=/(?\(?(?\d{1,2}:\d{2}:\d{2}|\d{1,2}:\d{2})\)?)/.exec(e);if(null==t||null==t.groups)return null;const{groups:{timeBlock:n,time:r}}=t,a=e.indexOf(n),s=(a<(e.length-n.length)/2?e.substring(a+n.length,e.length):e.substring(0,a)).trim().replace(/(\s-$)|(^-\s)/,""),o=r.split(":");return 1===o[0].length&&(o[0]=`0${o[0]}`),2===o.length&&o.unshift("00"),{startAt:o.join(":"),title:s}}(e))).filter((e=>null!==e)).sort(((e,t)=>e.startAt.localeCompare(t.startAt)))}n.d(t,{Tn:()=>r,ZP:()=>r})},38871:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>s});var r=n(84321);function a(e){const t=Math.floor(e/36e5);let n=e-36e5*t;const r=Math.floor(n/6e4);n-=6e4*r;return[t,r,Math.floor(n/1e3)].map((e=>e<10?`0${e}`:e)).join(":")}function s(e,t){const n=function(e,t=359999e3){const n=(0,r.Tn)(e);if(0===n.length)return null;let s="WEBVTT\n",o=1;for(const[e,r]of n.entries()){const i=0===e?"000":"001",l=e{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(42290),s=n(55609),o=n(65736);const __=o.__;function i({state:e,onUpload:t,onCancel:n,onRecord:o,onPause:i,onResume:l,onDone:c}){return(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__action-buttons"},["inactive","error","validating"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qf,variant:"secondary",onClick:o},__("Begin recording","jetpack")),["recording"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qr,variant:"secondary",onClick:i},__("Pause recording","jetpack")),["paused"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qf,variant:"secondary",onClick:l},__("Resume recording","jetpack")),["inactive","error","validating"].includes(e)&&(0,r.createElement)(s.FormFileUpload,{accept:".mp3,.mpeg,.mpga,.ogg,.flac,.m4a,.mp4,.wav,.wave,.webm",onChange:t,variant:"secondary",className:"jetpack-ai-voice-to-content__button"},__("Upload audio","jetpack")),["recording","paused"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",variant:"primary",onClick:c},__("Done","jetpack")),["recording","paused","processing"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",variant:"secondary",onClick:n},__("Cancel","jetpack")))}},36265:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(42290),s=n(65736),o=n(79554);const __=s.__;function i({state:e,error:t=null,analyser:n,duration:s=0}){return"inactive"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("File size limit: 25MB. Recording time limit: 25 minutes.","jetpack")):"recording"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__audio"},(0,r.createElement)(a.ZK,{className:"jetpack-ai-voice-to-content__audio--duration",duration:s}),(0,r.createElement)(o.Z,{analyser:n,paused:!1}),(0,r.createElement)("span",{className:"jetpack-ai-voice-to-content__information"},__("Recording…","jetpack"))):"paused"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__audio"},(0,r.createElement)(a.ZK,{className:"jetpack-ai-voice-to-content__audio--duration",duration:s}),(0,r.createElement)(o.Z,{analyser:n,paused:!0}),(0,r.createElement)("span",{className:"jetpack-ai-voice-to-content__information"},__("Paused","jetpack"))):"processing"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("Uploading and transcribing audio…","jetpack")):"validating"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("Validating audio…","jetpack")):"error"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information--error"},t):null}},79554:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(69307);function s({analyser:e,paused:t=!1}){const n=(0,a.useRef)(null),s=(0,a.useRef)(t),o=(0,a.useRef)(null);return(0,a.useEffect)((()=>{s.current=t}),[t]),(0,a.useEffect)((()=>{e&&n.current&&(o.current&&o.current(),o.current=function(e,t,n){const r=t.getContext("2d");let a=!1;if(!r)return;e.fftSize=Math.pow(2,13);const s=e.fftSize,o=new Float32Array(s),i=s/10,{width:l,height:c}=t,u=c/2;r.lineWidth=4,r.lineCap="round",r.strokeStyle=getComputedStyle(t).getPropertyValue("--jp-green-50")||"#008710";const d=()=>{r.clearRect(0,0,l,c),e.getFloatTimeDomainData(o);for(let e=1;e<=10;e++){let t=0;n.current||(t=o.slice(e*i,(e+1)*i).reduce(((e,t)=>e+t),0)/i,t*=2048,t=Math.abs(t),t=Math.min(16,Math.max(0,t))),r.beginPath(),r.moveTo(2+6*e,u-t),r.lineTo(2+6*e,u+t),r.stroke()}setTimeout((()=>{a||requestAnimationFrame(d)}),50)};return d(),()=>{a=!0}}(e,n.current,s))}),[e,n,s]),(0,a.useEffect)((()=>()=>{o.current&&o.current()}),[]),(0,r.createElement)("canvas",{className:"jetpack-ai-voice-to-content__oscilloscope",width:70,height:38,ref:n})}},32663:(e,t,n)=>{"use strict";n.d(t,{Z:()=>b});var r=n(82674),a=n.n(r),s=n(51806),o=n(42290),i=n(88275),l=n(13419),c=n(55609),u=n(9818),d=n(69307),p=n(65736),m=n(15381),g=(n(99196),n(83181)),A=n(36265),h=n(48384),E=n(24167);const __=p.__,f=(e,t,n)=>t?"validating":e?"processing":n;function b({clientId:e}){const[t,n]=(0,d.useState)(null),{removeBlock:r}=(0,u.useDispatch)("core/block-editor"),{getBlocks:p}=(0,u.useSelect)((e=>e("core/editor")),[]),b=(0,d.useCallback)((()=>{setTimeout((()=>{r(e)}),100)}),[r,e]),{tracks:C}=(0,l.z$)(),{isValidatingAudio:v,validateAudio:k}=(0,o.L$)(),{upsertTranscription:B}=(0,E.Z)(),{isCreatingTranscription:y,createTranscription:w,cancelTranscription:_}=(0,h.Z)({onReady:e=>{B(e);const t=p();for(let e=0;e<2;e++)"core/paragraph"===t[e].name&&""===t[e].attributes?.content&&r(String(t[e].clientId));I()},onUpdate:e=>{B(e)},onError:e=>{Q(e)}}),I=()=>{_(),b()},{state:j,controls:x,error:S,onError:Q,duration:N,analyser:P}=(0,o._T)({onDone:e=>{T(e)}}),T=(0,d.useCallback)((e=>{e&&n(e)}),[n]);(0,d.useEffect)((()=>{t&&k(t,(e=>{C.recordEvent("jetpack_ai_voice_to_content_transcription_started",{post_processing_action:o.Y,type:e.isFile?"upload":"record",audio_duration:e.duration,audio_file_size:e.size}),w(t,o.Y)}),Q)}),[t,C,k,w,Q]);const{start:R,pause:Z,resume:L,stop:M,reset:D}=x,F=(0,d.useCallback)((e=>{if(e.currentTarget.files.length>0){const t=e.currentTarget.files[0];T(t)}}),[T]),z=(0,d.useCallback)((()=>{_(),D()}),[_,D]),O=(0,d.useCallback)((()=>{R(1e3)}),[R]),U=(0,d.useCallback)((()=>{Z()}),[Z]),H=(0,d.useCallback)((()=>{L()}),[L]),V=(0,d.useCallback)((()=>{M()}),[M]),q=f(y,v,j);return(0,s.createElement)(c.Modal,{onRequestClose:I,title:__("Jetpack AI Voice to content","jetpack"),className:"jetpack-ai-voice-to-content__modal",shouldCloseOnEsc:!1,shouldCloseOnClickOutside:!1},(0,s.createElement)(i.ZP,null,(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__wrapper"},(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__body"},(0,s.createElement)("span",{className:"jetpack-ai-voice-to-content__description"},__("Transform your spoken words into a post ready to publish with AI.","jetpack")),(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__contextual-row"},(0,s.createElement)(A.Z,{state:q,error:S,duration:N,analyser:P})),(0,s.createElement)(g.Z,{state:q,onUpload:F,onCancel:z,onRecord:O,onPause:U,onResume:H,onDone:V})),(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__footer"},(0,s.createElement)(c.Button,{variant:"link",className:"jetpack-ai-voice-to-content__feedback-button",href:"https://a8c.slack.com/archives/C054LN8RNVA",target:"_blank"},(0,s.createElement)("span",null,__("Provide feedback","jetpack")),(0,s.createElement)(c.Icon,a()({icon:m.Z},{className:"icon"})))))))}},13006:(e,t,n)=>{"use strict";var r=n(31985),a=n(58940),s=n(32663);(0,r.S)(a,{edit:s.Z,save:()=>null})},48384:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(42290),a=n(69307),s=n(51128);const o=n.n(s)()("voice-to-content:use-transcription-creator"),i="voice-to-content";function l({onReady:e,onUpdate:t,onError:n}){const s=(0,a.useRef)(null),l=(0,a.useRef)(null),{processTranscription:c,cancelTranscriptionProcessing:u,isProcessingTranscription:d}=(0,r.OS)({feature:i,onReady:e,onUpdate:t,onError:t=>{if(s.current)return e(s.current);o("Transcription post-processing error: ",t)}}),p=(0,a.useCallback)((e=>{s.current=e,l.current&&c(l.current,e)}),[c]),{transcribeAudio:m,cancelTranscription:g,isTranscribingAudio:A}=(0,r.cH)({feature:i,onReady:p,onError:n});return{isCreatingTranscription:A||d,createTranscription:(0,a.useCallback)(((e,t)=>{if(e&&t)return l.current=t,m(e)}),[m]),cancelTranscription:(0,a.useCallback)((()=>{g(),u()}),[g,u])}}},24167:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(42290),a=n(4981),s=n(9818),o=n(69307),i=n(51128);const l=n.n(i)()("voice-to-content:use-transcription-inserter");function c(){const{updateBlockAttributes:e,insertBlocks:t,replaceInnerBlocks:n}=(0,s.useDispatch)("core/block-editor"),i=(0,o.useRef)([]);return{upsertTranscription:(0,o.useCallback)((s=>{l("Upserting transcription");const o=(0,r.LB)({content:s||""}),c=(0,a.rawHandler)({HTML:o});for(let r=0;r0&&n(t,c[r].innerBlocks)}else t([c[r]],void 0,void 0,!0,null),i.current.push(c[r])}),[i,t,e,n])}}},68925:(e,t,n)=>{"use strict";n.d(t,{W:()=>c});var r=n(51806),a=n(13419),s=n(55609),o=n(65736),i=n(99787);const __=o.__,l=(0,a.dM)(i),c=({changeStatus:e,isLoading:t,isModuleActive:n})=>(0,r.createElement)(s.Placeholder,{icon:l,instructions:__("You'll need to activate the WordAds feature to use this block.","jetpack"),label:i.title},(0,r.createElement)(s.Button,{disabled:n||t,isBusy:t,onClick:()=>e(!0),variant:"secondary"},t?__("Activating WordAds","jetpack"):__("Activate WordAds","jetpack",0)),(0,r.createElement)("div",{className:"membership-button__disclaimer"},(0,r.createElement)(s.ExternalLink,{href:"https://jetpack.com/support/ads/"},__("Learn more about the WordAds feature.","jetpack"))))},61981:(e,t,n)=>{"use strict";n.d(t,{c:()=>o});var r=n(51806),a=n(22636),s=n(55609);const o=()=>(0,r.createElement)(s.Placeholder,null,(0,r.createElement)(s.Flex,{gap:2,direction:"column",style:{width:"100%"}},(0,r.createElement)(s.Flex,{gap:4},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(a.Z,{width:30,height:30})),(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{width:"90%",height:30}))),(0,r.createElement)(s.Flex,{style:{marginTop:12}},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{height:30,width:"60%"}))),(0,r.createElement)(s.Flex,{style:{marginTop:12}},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{width:150,height:50}))),(0,r.createElement)(s.Flex,{style:{marginTop:18}},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{width:"90%",height:16})))))},50354:(e,t,n)=>{"use strict";n.d(t,{m:()=>o});var r=n(51806),a=n(55609),s=n(65736);const __=s.__,o=[{height:250,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-7-2h2V7h-4v2h2z"})),name:__("Rectangle 300x250","jetpack"),tag:"mrec",width:300,editorPadding:30},{height:90,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4h-4v-2h2c1.1 0 2-.89 2-2V9c0-1.11-.9-2-2-2H9v2h4v2h-2c-1.1 0-2 .89-2 2v4h6v-2z"})),name:__("Leaderboard 728x90","jetpack"),tag:"leaderboard",width:728,editorPadding:60},{height:50,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V9c0-1.11-.9-2-2-2H9v2h4v2h-2v2h2v2H9v2h4c1.1 0 2-.89 2-2z"})),name:__("Mobile Leaderboard 320x50","jetpack"),tag:"mobile_leaderboard",width:320,editorPadding:100},{height:600,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M.04 0h24v24h-24V0z"}),(0,r.createElement)(a.Path,{d:"M19.04 3h-14c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16h-14V5h14v14zm-6-2h2V7h-2v4h-2V7h-2v6h4z"})),name:__("Wide Skyscraper 160x600","jetpack"),tag:"wideskyscraper",width:160,editorPadding:30}]},56565:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(51806),a=n(52175),s=n(55609),o=n(65736),i=n(1020);const __=o.__,l=({value:e,onChange:t})=>(0,r.createElement)(s.PanelBody,{title:__("Visibility","jetpack")},(0,r.createElement)(s.ToggleControl,{className:"jetpack-wordads__mobile-visibility",checked:!!e,label:__("Hide on mobile","jetpack"),help:__("Hides this block for site visitors on mobile devices.","jetpack"),onChange:t})),c=({attributes:{format:e,hideMobile:t},setAttributes:n})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.BlockControls,null,(0,r.createElement)(i.Z,{value:e,onChange:e=>n({format:e})})),(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(l,{value:t,onChange:e=>n({hideMobile:!!e})})))},53193:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(88275),s=n(13419),o=n(52175),i=n(68925),l=n(61981),c=n(50354),u=n(56565),d=n(80405),p=n(72473),m=n(38511),g=n(52203);const A=({attributes:e,setAttributes:t})=>{const n=(0,o.useBlockProps)(),{format:A}=e,{isLoadingModules:h,isChangingStatus:E,isModuleActive:f,changeStatus:b}=(0,s.el)("wordads"),C=c.m.find((({tag:e})=>e===A)),v=e=>{switch(e){case"leaderboard":return g;case"mobile_leaderboard":return m;case"wideskyscraper":return d;default:return p}};let k;return k=f?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(u.Z,{attributes:e,setAttributes:t}),(0,r.createElement)("div",{className:`wp-block-jetpack-wordads jetpack-wordads-${A}`},(0,r.createElement)("div",{className:"jetpack-wordads__ad",style:{width:C.width,height:C.height,backgroundImage:`url( ${v(A)} )`,backgroundSize:"cover"}}))):h?(0,r.createElement)(a.ZP,null,(0,r.createElement)(l.c,null)):(0,r.createElement)(i.W,{changeStatus:b,isModuleActive:f,isLoading:E}),(0,r.createElement)("div",n,k)}},3432:(e,t,n)=>{"use strict";var r=n(31985),a=n(99787),s=n(53193);(0,r.S)(a,{edit:s.Z,save:()=>null})},1020:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(55609),s=n(65736),o=n(50354);const i=(0,s.__)("Pick an ad format","jetpack");function l({value:e,onChange:t}){return(0,r.createElement)(a.Dropdown,{placement:"bottom-start",renderToggle:({onToggle:e,isOpen:t})=>(0,r.createElement)(a.ToolbarGroup,{controls:[{icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M1 9h2V7H1v2zm0 4h2v-2H1v2zm0-8h2V3c-1.1 0-2 .9-2 2zm8 16h2v-2H9v2zm-8-4h2v-2H1v2zm2 4v-2H1c0 1.1.9 2 2 2zM21 3h-8v6h10V5c0-1.1-.9-2-2-2zm0 14h2v-2h-2v2zM9 5h2V3H9v2zM5 21h2v-2H5v2zM5 5h2V3H5v2zm16 16c1.1 0 2-.9 2-2h-2v2zm0-8h2v-2h-2v2zm-8 8h2v-2h-2v2zm4 0h2v-2h-2v2z"})),title:i,onClick:e,extraProps:{"aria-expanded":t},className:"wp-block-jetpack-wordads__format-picker-icon"}]}),renderContent:({onClose:n})=>(0,r.createElement)(a.NavigableMenu,{className:"wp-block-jetpack-wordads__format-picker"},o.m.map((({tag:s,name:o,icon:i})=>(0,r.createElement)(a.MenuItem,{className:s===e?"is-active":void 0,icon:i,isSelected:s===e,key:s,onClick:()=>{t(s),n()},role:"menuitemcheckbox"},o))))})}},78680:(e,t,n)=>{"use strict";n.d(t,{L:()=>d});var r=n(82674),a=n.n(r),s=n(51806),o=n(86989),i=n.n(o),l=n(94333),c=n(92694),u=(n(80425),n(85921),n(63066),n(92713),n(54414),n(36215),n(31657),n(23984),n(14688),n(7652),n(29692),n(1949));function d(e){if(!u)return!1;const t=u.beta||[],n=e.replace(/jetpack\//,"");return t.includes(e)||t.includes(n)}i().use(((e,t)=>{if("cors"===e.mode)return t(e);if(e.url)try{const n=new URL(e.url,location.href);if(n.protocol!==location.protocol||n.hostname!==location.hostname||n.port!==location.port)return t(e)}catch{return t(e)}return e.headers||(e.headers={}),e.headers["x-wp-api-fetch-from-editor"]="true",t(e)})),(0,c.addFilter)("blocks.registerBlockType","jetpack/label-beta-blocks-title",(function(e,t){if(!d(t))return e;const{title:n,keywords:r}=e,a="(beta)",s="beta",o={...e};return n&&(o.title=n.toLowerCase().endsWith(a)?n:`${e.title} ${a}`),Array.isArray(r)&&(o.keywords=r.includes(s)?r:[...r,s]),o}));const p=(0,l.createHigherOrderComponent)((e=>t=>{if(t?.clientRootId)return(0,s.createElement)(e,t);const{name:n}=t;return d(n)?(0,s.createElement)(e,a()({},t,{className:"is-beta-extension"})):(0,s.createElement)(e,t)}),"withBetaClassName");(0,c.addFilter)("editor.BlockListBlock","jetpack/label-beta-extensions",p)},6460:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),s=n(81427);const __=a.__,o={name:"descript",title:"Descript",icon:s.h,keywords:[__("descript","jetpack")],description:__("Embed a Descript Item.","jetpack"),patterns:[/^https:\/\/share.descript.com\/(view|embed)\/\w+/i],attributes:{providerNameSlug:"descript",responsive:!0}};(0,r.registerBlockVariation)("core/embed",o)},5166:(e,t,n)=>{"use strict";var r=n(92694),a=n(65736),s=n(70355),o=n(81427);const __=a.__,_x=a._x,i={name:"facebook",title:"Facebook",icon:{src:o.Vq,foreground:(0,s.m)()},keywords:[_x("social","block search term","jetpack")],description:__("Embed a Facebook post.","jetpack"),patterns:[/^https?:\/\/www\.facebook.com\/.+/i],attributes:{providerNameSlug:"facebook",previewable:!1,responsive:!0}};(0,r.addFilter)("blocks.registerBlockType","reactivateFacebookEmbedBlockVariation",(function(e,t){if("core/embed"!==t||!e.variations)return e;const n=e.variations.filter((e=>e.name!==i.name));return e.variations=[...n,i],e}))},36215:(e,t,n)=>{"use strict";n(5166),n(20970),n(25467),n(91128),n(6460)},20970:(e,t,n)=>{"use strict";var r=n(92694),a=n(65736),s=n(70355),o=n(81427),i=n(12923);const __=a.__,_x=a._x,l={name:"instagram",title:"Instagram",icon:{src:o.yu,foreground:(0,s.m)()},keywords:[_x("image","block search term","jetpack"),_x("social","block search term","jetpack")],description:__("Embed an Instagram post.","jetpack"),patterns:[/^https?:\/\/(www\.)?instagr(\.am|am\.com)\/.+/i],attributes:{providerNameSlug:"instagram",responsive:!0}};(0,r.addFilter)("blocks.registerBlockType","reactivateInstagramEmbedBlockVariation",(function(e,t){if("core/embed"!==t||!e.variations||!(0,i.Z)())return e;const n=e.variations.filter((e=>e.name!==l.name));return e.variations=[...n,l],e}))},25467:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),s=n(81427);const __=a.__,o={name:"loom",title:"Loom",icon:s.zf,keywords:[__("video","jetpack")],description:__("Embed a Loom video.","jetpack"),patterns:[/^https?:\/\/(www\.)?loom\.com\/share\/.+/i],attributes:{providerNameSlug:"loom",responsive:!0}};(0,r.registerBlockVariation)("core/embed",o)},91128:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),s=n(81427);const __=a.__,o={name:"smartframe",title:"SmartFrame",icon:s.Ae,keywords:[__("smartframe","jetpack")],description:__("Embed a SmartFrame Image.","jetpack"),patterns:[/^https?:\/\/(.*?).smartframe.(io|net)\/.*/i],attributes:{providerNameSlug:"smartframe",responsive:!0}};(0,r.registerBlockVariation)("core/embed",o)},31657:(e,t,n)=>{"use strict";var r=n(4981),a=n(92694),s=n(6512);const o={from:[{type:"block",isMultiBlock:!1,blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>!!t?.raw&&"jetpack_widget_social_icons"===e,transform:({instance:e})=>{let t=[];return e.raw.icons.forEach((e=>{const n=new URL(e.url.includes(":")?e.url:"https://"+e.url),a=n.hostname?n.hostname:n.protocol,o=s.Z.find((e=>a.includes(e.url)||e.url.includes(a))),i=(0,r.createBlock)("core/social-link",{service:o?o.name:"chain",url:e.url});t=[...t,i]})),(0,r.createBlock)("core/social-links",{},t)}}]};(0,a.addFilter)("blocks.registerBlockType","addTransformToSocialLinksWidget",(function(e,t){return"core/social-links"!==t||(e.transforms=o),e}))},6512:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r=[{name:"wordpress",url:["wordpress."]},{name:"fivehundredpx",url:["500px.com"]},{name:"amazon",url:["amazon."]},{name:"bandcamp",url:["bandcamp.com"]},{name:"behance",url:["behance.net"]},{name:"codepen",url:["codepen.io"]},{name:"deviantart",url:["deviantart.com"]},{name:"dribbble",url:["dribbble.com"]},{name:"dropbox",url:["dropbox.com"]},{name:"etsy",url:["etsy.com"]},{name:"facebook",url:["facebook.com"]},{name:"flickr",url:["flickr.com"]},{name:"foursquare",url:["foursquare.com"]},{name:"goodreads",url:["goodreads.com"]},{name:"google",url:["google."]},{name:"github",url:["github.com"]},{name:"instagram",url:["instagram.com"]},{name:"lastfm",url:["last.fm"]},{name:"linkedin",url:["linkedin.com"]},{name:"mail",url:["mailto:"]},{name:"linkedin",url:["linkedin.com"]},{name:"mastodon",url:["mastodon.social"]},{name:"meetup",url:["meetup.com"]},{name:"medium",url:["medium.com"]},{name:"patreon",url:["patreon.com"]},{name:"pinterest",url:["pinterest."]},{name:"pocket",url:["getpocket.com"]},{name:"reddit",url:["reddit.com"]},{name:"skype",url:["skype.com","skype:"]},{name:"snapchat",url:["snapchat.com"]},{name:"soundcloud",url:["soundcloud.com"]},{name:"spotify",url:["spotify.com"]},{name:"telegram",url:["telegram.me","t.me"]},{name:"tiktok",url:["tiktok.com"]},{name:"tumblr",url:["tumblr.com"]},{name:"twitch",url:["twitch.tv"]},{name:"twitter",url:["twitter.com"]},{name:"vimeo",url:["vimeo.com"]},{name:"vk",url:["vk.com"]},{name:"yelp",url:["yelp.com"]},{name:"youtube",url:["youtube.com"]}]},87950:(e,t,n)=>{"use strict";n.d(t,{L:()=>o,x:()=>s});var r=n(51806),a=n(69307);const s=(0,a.createContext)(),o=({onBannerVisibilityChange:e,hasParentBanner:t,children:n})=>(0,r.createElement)(s.Provider,{value:{onBannerVisibilityChange:e,hasParentBanner:t},children:n})},23984:(e,t,n)=>{"use strict";var r=n(13419),a=n(47701),s=n.n(a),o=n(92694),i=n(65736),l=n(92819),c=n(30371),u=n(7832),d=n(42770),p=n(27003);const __=i.__,m=[];(0,o.addFilter)("blocks.registerBlockType","jetpack/paid-block",((e,t)=>((0,r.X1)(t)&&(m.includes(t)||m.push(t),e.keywords=(0,l.uniq)([...e.keywords,"premium",__("premium","jetpack")]),(0,r.HD)(t)||(e.icon=(0,d.Z)(e.icon)),e.attributes.shouldDisplayFrontendBanner||(e.attributes.shouldDisplayFrontendBanner={type:"boolean",default:!0}),"core/cover"!==t&&(e.supports={...e.supports,__experimentalExposeControlsToChildren:!0})),e))),(0,o.addFilter)("blocks.registerBlockType","jetpack/paid-block-with-upgrade-banner",p.v),(0,o.addFilter)("editor.MediaPlaceholder","jetpack/paid-block-media-placeholder",c.Z),(0,o.addFilter)("editor.MediaReplaceFlow","jetpack/paid-block-media-placeholder",u.Z),s()((function(){(0,r.FK)()&&document.body.classList.add("jetpack-enable-upgrade-nudge")}))},30371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(82674),a=n.n(r),s=n(51806),o=n(13419),i=n(52175),l=n(94333),c=n(69307),u=n(11317),d=n(87950);const p=(0,l.createHigherOrderComponent)((e=>t=>{const{name:n}=(0,i.useBlockEditContext)(),r=(0,o.m3)(n);if(!r?.mediaPlaceholder||!(0,o.X1)(n))return(0,s.createElement)(e,t);const{fileType:l}=r,{onError:p}=t,{onBannerVisibilityChange:m}=(0,c.useContext)(d.x),g=(0,c.useCallback)((e=>m(e?.length&&(0,u.Qu)(e[0],l))),[l,m]),A=(0,c.useCallback)((e=>{const t=e?.[0]?.props?.children;return(0,u.Qu)(t,l)?g([t]):p(e)}),[g,l,p]);return(0,s.createElement)("div",{className:"paid-block-media-placeholder"},(0,s.createElement)(e,a()({},t,{onFilesPreUpload:g,onError:A})))}),"withMediaPlaceholderUpgradable")},7832:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(82674),a=n.n(r),s=n(51806),o=n(13419),i=n(52175),l=n(94333),c=n(69307),u=n(11317),d=n(87950);const p=(0,l.createHigherOrderComponent)((e=>t=>{const{name:n}=(0,i.useBlockEditContext)(),r=(0,o.m3)(n),l=(0,c.useRef)();if(!r?.mediaReplaceFlow||!(0,o.X1)(n))return(0,s.createElement)(e,t);const{fileType:p}=r,{onBannerVisibilityChange:m}=(0,c.useContext)(d.x);return(0,s.createElement)(e,a()({},t,{onFilesUpload:e=>{l.current=e?.length?e[0]:null,m(e?.length&&(0,u.Qu)(e[0],p))},createNotice:(e,n,r)=>{if((0,u.Qu)(l.current,p))return l.current=null,null;t.createNotice(e,n,r)}}))}),"withMediaReplaceFlowUpgradable")},95796:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(55609);const s=({cx:e=0,cy:t=0,r:n=4,fill:s="#e34c84",stroke:o="#ffffff",strokeWidth:i="2"})=>(0,r.createElement)(a.SVG,{className:"jetpack-paid-block-symbol"},(0,r.createElement)(a.Circle,{cx:e,cy:t,r:n,fill:s,stroke:o,strokeWidth:i}))},42770:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i,p:()=>l});var r=n(51806),a=n(13419),s=n(95796);const o=e=>{const t=(0,r.createElement)(s.Z,{key:"paid-symbol"});return e?.src?{...e,src:(0,r.createElement)(r.Fragment,null,e.src,t)}:(0,r.createElement)(r.Fragment,null,e,t)},i=o;function l(e,t){return(0,a.X1)(e)?o(t):t}},66316:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(51806),a=n(9818),s=n(65736),o=n(26546),i=n(78798);const __=s.__,_x=s._x,l=__("Premium Block","jetpack"),/** translators: %s: name of the plan. */
c=__("Upgrade to %s to use this premium block","jetpack"),u=(__("Upgrade your plan to use this premium block","jetpack"),_x("Upgrade","Call to action to buy a new plan","jetpack")),d=({onRedirect:e,align:t,className:n,title:d=l,description:p=null,buttonText:m=u,visible:g=!0,requiredPlan:A,context:h})=>{const[E,f,b]=(0,i.Z)(A,e),C=(0,a.useSelect)((e=>{if(p)return p;const t=e("wordpress-com/plans"),n=t&&t.getPlan(A);return n?(0,s.sprintf)(c,n.product_name_short):null}),[p]);return C&&(0,r.createElement)(o.p,{align:t,buttonText:m,checkoutUrl:E,className:n,context:h,description:C,goToCheckoutPage:f,isRedirecting:b,title:d,visible:g})}},38140:(e,t,n)=>{"use strict";n.d(t,{W:()=>a,v:()=>r});const r=({plan:e,blockName:t,context:n,tracks:r})=>{r.recordEvent("jetpack_editor_block_upgrade_click",{plan:e,block:t,context:n})},a=({plan:e,blockName:t,context:n,tracks:r})=>{r.recordEvent("jetpack_editor_block_upgrade_banner_impression",{plan:e,block:t,context:n})}},27003:(e,t,n)=>{"use strict";n.d(t,{v:()=>m});var r=n(51806),a=n(13419),s=n(52175),o=n(94333),i=n(9818),l=n(69307),c=n(87950),u=n(66316),d=n(38140);const p=(0,o.createHigherOrderComponent)((e=>t=>{const{name:n,clientId:o,isSelected:p,attributes:m,setAttributes:g}=t||{},A=(0,a.Rl)(n);if(!A)return(0,r.createElement)(e,t);const h=(0,a.HD)(n),E=(0,a.m3)(n),[f,b]=(0,l.useState)(!h),[C,v]=(0,l.useState)(!1),k="editor-canvas",B=(0,i.useSelect)((e=>e("core/block-editor").hasSelectedInnerBlock(o,!0)),[]),{hasParentBanner:y}=(0,l.useContext)(c.x)||{},w=(p||B)&&f&&!y,{tracks:_}=(0,a.z$)(),I=(0,l.useMemo)((()=>({plan:A,blockName:n,context:k,tracks:_})),[A,n,_]);(0,l.useEffect)((()=>{w&&v(!0)}),[w,v]),(0,l.useEffect)((()=>{!C&&w&&(0,d.W)(I)}),[C,I,w]),(0,l.useEffect)((()=>b(!h)),[m,b,h]),(0,l.useEffect)((()=>{g({shouldDisplayFrontendBanner:!y})}),[g,y]);const j=(0,s.useBlockProps)();return(0,r.createElement)(c.L,{onBannerVisibilityChange:b,hasParentBanner:w},(0,r.createElement)("div",{ref:j.ref,style:{"max-width":"unset"}},(0,r.createElement)(u.ZP,{className:`is-${n.replace(/\//,"-")}-paid-block`,title:null,align:m?.align,visible:w,description:E?.description,requiredPlan:A,context:k,onRedirect:()=>(0,d.v)(I)}),(0,r.createElement)(e,t)))}),"withUpgradeBanner");function m(e,t){return(0,a.Rl)(t)?{...e,edit:p(e.edit)}:e}},90607:(e,t,n)=>{"use strict";n.d(t,{Z:()=>y});var r=n(51806),a=n(13419),s=n(55609),o=n(72067),i=n(65736),l=n(51128),c=n.n(l),u=(n(99196),n(63206)),d=n(18135),p=n(34613),m=n(77371),g=n(75317),A=n(75554),h=n(84102),E=n(30664),f=n(16597);const __=i.__,b=c()("jetpack-ai-assistant-plugin:sidebar"),C=window?.Jetpack_Editor_Initial_State?.available_blocks?.["ai-assistant-usage-panel"]?.available||!1,v=window?.Jetpack_Editor_Initial_State?.available_blocks?.["ai-featured-image-generator"]?.available||!1,k=window?.Jetpack_Editor_Initial_State?.available_blocks?.["ai-title-optimization"]?.available||!1,B=({placement:e,requireUpgrade:t,upgradeType:n})=>{const{checkoutUrl:a}=(0,u.Z)();return(0,r.createElement)(r.Fragment,null,k&&(0,r.createElement)(s.PanelRow,{className:"jetpack-ai-title-optimization__header"},(0,r.createElement)(s.BaseControl,{label:__("Optimize Publishing","jetpack")},(0,r.createElement)(A.Z,{placement:e,busy:!1,disabled:t}))),(0,r.createElement)(s.PanelRow,{className:"jetpack-ai-proofread-control__header"},(0,r.createElement)(s.BaseControl,{label:__("AI feedback on post","jetpack")},(0,r.createElement)(g.Z,{busy:!1,disabled:t}))),v&&(0,r.createElement)(s.PanelRow,{className:"jetpack-ai-featured-image-control__header"},(0,r.createElement)(s.BaseControl,{label:__("AI Featured Image","jetpack")},(0,r.createElement)(m.Z,{busy:!1,disabled:t,placement:e}))),t&&!C&&(0,r.createElement)(s.PanelRow,null,(0,r.createElement)(f.Z,{placement:e,type:n,upgradeUrl:a})),C&&(0,r.createElement)(s.PanelRow,null,(0,r.createElement)(h.Z,{placement:e})))};function y(){const{requireUpgrade:e,upgradeType:t,currentTier:n}=(0,d.Z)(),{checkoutUrl:i}=(0,u.Z)(),{tracks:l}=(0,a.z$)(),c=__("AI Assistant","jetpack");return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(p.Z,null,(0,r.createElement)(s.PanelBody,{title:c,initialOpen:!1,onToggle:e=>{var t;e&&(t=E.bA,b(t),l.recordEvent("jetpack_ai_panel_open",{placement:t}))}},(0,r.createElement)(B,{placement:E.bA,requireUpgrade:e,upgradeType:t}))),(0,r.createElement)(o.PluginDocumentSettingPanel,{icon:(0,r.createElement)(a.Pm,null),title:c,name:"jetpack-ai-assistant"},(0,r.createElement)(B,{placement:E.cG,requireUpgrade:e,upgradeType:t})),(0,r.createElement)(o.PluginPrePublishPanel,{title:c,icon:(0,r.createElement)(a.Pm,null),initialOpen:!1},(0,r.createElement)(r.Fragment,null,k&&(0,r.createElement)(A.Z,{placement:E.jm,busy:!1,disabled:e}),(0,r.createElement)(g.Z,{busy:!1,disabled:e}),e&&(0,r.createElement)(f.Z,{placement:E.jm,type:t,currentTier:n,upgradeUrl:i}))))}},30664:(e,t,n)=>{"use strict";n.d(t,{bA:()=>r,cG:()=>a,jm:()=>s});const r="jetpack-sidebar",a="document-settings",s="pre-publish"},16597:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(13419),s=n(55609),o=n(69307),i=n(65736);const __=i.__;function l({onClick:e,type:t,placement:n="",currentTier:l,upgradeUrl:c}){const{tracks:u}=(0,a.z$)(),d=(0,o.useCallback)((t=>{u.recordEvent("jetpack_ai_upgrade_button",{placement:n}),e?.(t)}),[e,u,n]),p=l?.value&&1!==l?.value?l.limit:20,m=__("You have reached the limit of 20 free requests. Upgrade to continue generating feedback. ","jetpack"),g=(0,i.sprintf)(/* translators: number is the request limit for the current tier/plan */
-__("You have reached the limit of %d requests . Upgrade to continue generating feedback. ","jetpack"),p),A=(0,o.createInterpolateElement)(__("You've reached the Jetpack AI rate limit. Please reach out to your VIP account team. ","jetpack"),{strong:(0,r.createElement)("strong",null)}),h=(0,o.createInterpolateElement)(20===p?m:g,{strong:(0,r.createElement)("strong",null),button:(0,r.createElement)(s.Button,{variant:"link",onClick:d,href:c,target:"_blank"})});return(0,r.createElement)("p",null,"vip"===t?A:h)}},30494:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(51806),a=n(55609),s=n(65736),o=n(61074),i=n(52800),l=n(46936),c=n(65235),u=n.n(c),d=n(69282);const __=s.__;function p({children:e,isDotted:t=!1}){const n=(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:`data:image/png;base64,${d.U}`,alt:""});return(0,r.createElement)("div",{className:"ai-assistant-featured-image__blank"},n,(0,r.createElement)("div",{className:u()("ai-assistant-featured-image__blank-content",{"is-dotted":t})},e))}function m({images:e,current:t,handlePreviousImage:n,handleNextImage:s,actions:c=null}){const d=(0,r.createElement)("button",{className:"ai-carrousel__prev",onClick:n},(0,r.createElement)(o.Z,{icon:i.Z,className:u()("ai-carrousel__prev-icon",{"is-disabled":0===t})})),m=(0,r.createElement)("button",{className:"ai-carrousel__next",onClick:s},(0,r.createElement)(o.Z,{icon:l.Z,className:u()("ai-carrousel__next-icon",{"is-disabled":t+1===e.length})}));return(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-images"},e.length>1&&d,e.map((({image:e,generating:n,error:s},o)=>(0,r.createElement)("div",{key:"image:"+o,className:u()("ai-assistant-featured-image__carrousel-image-container",{"is-current":t===o,"is-prev":t>o})},n?(0,r.createElement)(p,null,(0,r.createElement)(a.Spinner,{style:{width:"50px",height:"50px"}})):(0,r.createElement)(r.Fragment,null,s?(0,r.createElement)(p,{isDotted:!0},(0,r.createElement)("div",{className:"ai-assistant-featured-image__error"},__("An error occurred while generating the image. Please, try again!","jetpack"),s?.message&&(0,r.createElement)("span",{className:"ai-assistant-featured-image__error-message"},s?.message))):(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:e,alt:""}))))),e.length>1&&m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-footer"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-counter"},d,t+1," / ",e.length,m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-actions"},c)))}},77371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>j,h:()=>y});var r=n(51806),a=n(42290),s=n(13419),o=n(55609),i=n(9818),l=n(69307),c=n(65736),u=n(61074),d=n(15381),p=n(5246),m=n(18135),g=n(28788),A=n(23795),h=n(45975),E=n(84944),f=n(30664),b=n(78116),C=n(30494),v=n(62815);const __=c.__,k="ai-image-generator",B="featured-post-image",y="media-source-dropdown",w=(0,g.$)("ai-assistant-experimental-image-generation-support"),_=w?"stable-diffusion":"dall-e-3",I=(0,s.Ug)()?"atomic":(0,s.Wp)()?"simple":"jetpack";function j({busy:e,disabled:t,placement:n,onClose:g=(()=>{})}){const{toggleEditorPanelOpened:j}=(0,i.useDispatch)("core/edit-post"),{editPost:x,toggleEditorPanelOpened:S}=(0,i.useDispatch)("core/editor"),{clearSelectedBlock:Q}=(0,i.useDispatch)("core/block-editor"),[N,P]=(0,l.useState)(!1),[T,R]=(0,l.useState)([{generating:!0}]),[Z,L]=(0,l.useState)(0),M=(0,l.useRef)(0),[D,F]=(0,l.useState)(""),z=(0,l.useRef)(!1),{enableComplementaryArea:O}=(0,i.useDispatch)("core/interface"),{generateImage:U,generateImageWithStableDiffusion:H}=(0,a.Rc)(),{saveToMediaLibrary:V}=(0,E.Z)(),{tracks:q}=(0,s.z$)(),{recordEvent:G}=q,$=T[Z],W=T[M.current],{requireUpgrade:J,requestsCount:Y,requestsLimit:K,currentTier:X,increaseRequestsCount:ee,costs:te}=(0,m.Z)(),ne=(0,A.U_)(X),re=w?te?.[B]?.stableDiffusion??1:te?.[B]?.image,ae=ne===A.hp,se=K-Ye("core/editor").isEditorPanelOpened??e("core/edit-post").isEditorPanelOpened),[]),ce=(0,l.useCallback)((()=>{ee(re)}),[ee,re]),ue=(0,l.useCallback)(((e,t)=>{R((n=>{const r=[...n];return r[t]={...r[t],...e},r})),e.error&&G("jetpack_ai_featured_image_generation_error",{placement:n,error:e.error?.message,model:_,site_type:I})}),[n,G]),de=(0,l.useCallback)((()=>{L(Math.max(Z-1,0))}),[Z,L]),pe=(0,l.useCallback)((()=>{L(Math.min(Z+1,T.length-1))}),[Z,T.length]),me=(0,l.useCallback)((()=>{if(ue({generating:!0,error:null},M.current),se)return void ue({generating:!1,error:new Error(__("You don't have enough requests to generate another image.","jetpack"))},M.current);if(!D&&!oe)return void ue({generating:!1,error:new Error(__("No content to generate image. Please type custom instructions and try again.","jetpack"))},M.current);(w?H({feature:B,postContent:oe,userPrompt:D}):U({feature:B,postContent:oe,responseFormat:"b64_json",userPrompt:D})).then((e=>{if(e.data.length>0){const t="data:image/png;base64,"+e.data[0].b64_json;ue({image:t},M.current),ce(),V(t).then((e=>{ue({libraryId:e.id,generating:!1},M.current),M.current+=1})).catch((()=>{ue({generating:!1},M.current),M.current+=1}))}})).catch((e=>{ue({generating:!1,error:e},M.current)}))}),[se,ue,U,H,oe,D,ce,V]),ge=(0,l.useCallback)((()=>{P(!N)}),[N,P]),Ae=(0,l.useCallback)((()=>{ge(),g?.()}),[ge,g]),he=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_generate_image",{placement:n,model:_,site_type:I}),ge(),me()}),[ge,me,G,n]),Ee=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_generate_another_image",{placement:n,model:_,site_type:I}),me(),L((e=>e+1))}),[me,G,n]),fe=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_try_again",{placement:n,model:_,site_type:I}),me()}),[me,G,n]),be=(0,l.useCallback)((e=>{F(e.target.value)}),[F]),Ce=(0,l.useCallback)((()=>(Q(),O("core/edit-post","edit-post/document"))),[Q,O]),ve=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_use_image",{placement:n,model:_,site_type:I});const e=e=>{x({featured_media:e}),Ae(),setTimeout((()=>{const e=le("featured-image"),t=le("post-status");Ce().then((()=>{e||ie("featured-image"),t||ie("post-status")}))}),500)};T[Z].libraryId?e(T[Z].libraryId):V(T[Z].image).then((t=>{e(t.id)}))}),[Z,x,T,le,G,V,ie,Ce,Ae,n]);(0,l.useEffect)((()=>{n===y&&(z.current||(z.current=!0,he()))}),[n,he]);const ke=__("Generate a featured image with AI","jetpack"),Be=__("1 request per image","jetpack"),ye=(0,c.sprintf)(
+__("You have reached the limit of %d requests . Upgrade to continue generating feedback. ","jetpack"),p),A=(0,o.createInterpolateElement)(__("You've reached the Jetpack AI rate limit. Please reach out to your VIP account team. ","jetpack"),{strong:(0,r.createElement)("strong",null)}),h=(0,o.createInterpolateElement)(20===p?m:g,{strong:(0,r.createElement)("strong",null),button:(0,r.createElement)(s.Button,{variant:"link",onClick:d,href:c,target:"_blank"})});return(0,r.createElement)("p",null,"vip"===t?A:h)}},30494:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(51806),a=n(55609),s=n(65736),o=n(61074),i=n(52800),l=n(46936),c=n(65235),u=n.n(c),d=n(69282);const __=s.__;function p({children:e,isDotted:t=!1}){const n=(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:`data:image/png;base64,${d.U}`,alt:""});return(0,r.createElement)("div",{className:"ai-assistant-featured-image__blank"},n,(0,r.createElement)("div",{className:u()("ai-assistant-featured-image__blank-content",{"is-dotted":t})},e))}function m({images:e,current:t,handlePreviousImage:n,handleNextImage:s,actions:c=null}){const d=(0,r.createElement)("button",{className:"ai-carrousel__prev",onClick:n},(0,r.createElement)(o.Z,{icon:i.Z,className:u()("ai-carrousel__prev-icon",{"is-disabled":0===t})})),m=(0,r.createElement)("button",{className:"ai-carrousel__next",onClick:s},(0,r.createElement)(o.Z,{icon:l.Z,className:u()("ai-carrousel__next-icon",{"is-disabled":t+1===e.length})}));return(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-images"},e.length>1&&d,e.map((({image:e,generating:n,error:s},o)=>(0,r.createElement)("div",{key:"image:"+o,className:u()("ai-assistant-featured-image__carrousel-image-container",{"is-current":t===o,"is-prev":t>o})},n?(0,r.createElement)(p,null,(0,r.createElement)(a.Spinner,{style:{width:"50px",height:"50px"}})):(0,r.createElement)(r.Fragment,null,s?(0,r.createElement)(p,{isDotted:!0},(0,r.createElement)("div",{className:"ai-assistant-featured-image__error"},__("An error occurred while generating the image. Please, try again!","jetpack"),s?.message&&(0,r.createElement)("span",{className:"ai-assistant-featured-image__error-message"},s?.message))):(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:e,alt:""}))))),e.length>1&&m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-footer"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-counter"},d,t+1," / ",e.length,m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-actions"},c)))}},77371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>I,h:()=>B});var r=n(51806),a=n(42290),s=n(13419),o=n(55609),i=n(9818),l=n(69307),c=n(65736),u=n(61074),d=n(15381),p=n(5246),m=n(18135),g=n(23795),A=n(45975),h=n(84944),E=n(30664),f=n(78116),b=n(30494),C=n(62815);const __=c.__,v="ai-image-generator",k="featured-post-image",B="media-source-dropdown",y="stable-diffusion",w="dall-e-3",_=(0,s.Ug)()?"atomic":(0,s.Wp)()?"simple":"jetpack";function I({busy:e,disabled:t,placement:n,onClose:I=(()=>{})}){const{toggleEditorPanelOpened:j}=(0,i.useDispatch)("core/edit-post"),{editPost:x,toggleEditorPanelOpened:S}=(0,i.useDispatch)("core/editor"),{clearSelectedBlock:Q}=(0,i.useDispatch)("core/block-editor"),[N,P]=(0,l.useState)(!1),[T,R]=(0,l.useState)([{generating:!0}]),[Z,L]=(0,l.useState)(0),M=(0,l.useRef)(0),[D,F]=(0,l.useState)(""),z=(0,l.useRef)(!1),{enableComplementaryArea:O}=(0,i.useDispatch)("core/interface"),{generateImageWithParameters:U}=(0,a.Rc)(),{saveToMediaLibrary:H}=(0,h.Z)(),{tracks:V}=(0,s.z$)(),{recordEvent:q}=V,G=T[Z],$=T[M.current],{requireUpgrade:W,requestsCount:J,requestsLimit:Y,currentTier:K,increaseRequestsCount:X,costs:ee}=(0,m.Z)(),te=(0,g.U_)(K),ne=ee?.[k]?.activeModel??10,re=ne===ee?.[k]?.stableDiffusion?y:w,ae=te===g.hp,se=Y-Je("core/editor").isEditorPanelOpened??e("core/edit-post").isEditorPanelOpened),[]),ce=(0,l.useCallback)((()=>{X(ne)}),[X,ne]),ue=(0,l.useCallback)(((e,t)=>{R((n=>{const r=[...n];return r[t]={...r[t],...e},r})),e.error&&q("jetpack_ai_featured_image_generation_error",{placement:n,error:e.error?.message,model:re,site_type:_})}),[n,q,re]),de=(0,l.useCallback)((()=>{L(Math.max(Z-1,0))}),[Z,L]),pe=(0,l.useCallback)((()=>{L(Math.min(Z+1,T.length-1))}),[Z,T.length]),me=(0,l.useCallback)((()=>{if(ue({generating:!0,error:null},M.current),se)return void ue({generating:!1,error:new Error(__("You don't have enough requests to generate another image.","jetpack"))},M.current);if(!D&&!oe)return void ue({generating:!1,error:new Error(__("No content to generate image. Please type custom instructions and try again.","jetpack"))},M.current);U({feature:k,size:"1792x1024",responseFormat:"b64_json",style:"photographic",messages:[{role:"jetpack-ai",context:{type:"featured-image-generation",request:D||null,content:oe}}]}).then((e=>{if(e.data.length>0){const t="data:image/png;base64,"+e.data[0].b64_json;ue({image:t},M.current),ce(),H(t).then((e=>{ue({libraryId:e.id,generating:!1},M.current),M.current+=1})).catch((()=>{ue({generating:!1},M.current),M.current+=1}))}})).catch((e=>{ue({generating:!1,error:e},M.current)}))}),[se,ue,U,oe,D,ce,H]),ge=(0,l.useCallback)((()=>{P(!N)}),[N,P]),Ae=(0,l.useCallback)((()=>{ge(),I?.()}),[ge,I]),he=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_generate_image",{placement:n,model:re,site_type:_}),ge(),me()}),[ge,me,q,n,re]),Ee=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_generate_another_image",{placement:n,model:re,site_type:_}),me(),L((e=>e+1))}),[me,q,n,re]),fe=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_try_again",{placement:n,model:re,site_type:_}),me()}),[me,q,n,re]),be=(0,l.useCallback)((e=>{F(e.target.value)}),[F]),Ce=(0,l.useCallback)((()=>(Q(),O("core/edit-post","edit-post/document"))),[Q,O]),ve=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_use_image",{placement:n,model:re,site_type:_});const e=e=>{x({featured_media:e}),Ae(),setTimeout((()=>{const e=le("featured-image"),t=le("post-status");Ce().then((()=>{e||ie("featured-image"),t||ie("post-status")}))}),500)};T[Z].libraryId?e(T[Z].libraryId):H(T[Z].image).then((t=>{e(t.id)}))}),[Z,x,T,le,q,H,ie,Ce,Ae,n,re]);(0,l.useEffect)((()=>{n===B&&(z.current||(z.current=!0,he()))}),[n,he]);const ke=__("Generate a featured image with AI","jetpack"),Be=__("1 request per image","jetpack"),ye=(0,c.sprintf)(
// Translators: %d is the cost of generating one image.
-__("%d requests per image","jetpack"),re),we=1===re?Be:ye,_e=(0,r.createElement)(o.Button,{onClick:ve,variant:"primary",isBusy:$?.generating,disabled:!$?.image},__("Set as featured image","jetpack"));return(0,r.createElement)("div",null,(n===f.bA||n===f.cG)&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",null,__("Create and use an AI generated featured image for your post.","jetpack")),(0,r.createElement)(o.Button,{onClick:he,isBusy:e,disabled:!oe||t||se,variant:"secondary"},__("Generate image","jetpack"))),N&&(0,r.createElement)(b.Z,{handleClose:Ae,title:ke},(0,r.createElement)("div",{className:"ai-assistant-featured-image__content"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt-textarea"},(0,r.createElement)("textarea",{disabled:se||W?.generating,maxLength:1e3,rows:2,onChange:be,placeholder:__("Include optional instructions to generate a new image","jetpack")}))),(J||se)&&!W?.generating&&(0,r.createElement)(p.Z,{description:se?(0,c.sprintf)(
+__("%d requests per image","jetpack"),ne),we=1===ne?Be:ye,_e=(0,r.createElement)(o.Button,{onClick:ve,variant:"primary",isBusy:G?.generating,disabled:!G?.image},__("Set as featured image","jetpack"));return(0,r.createElement)("div",null,(n===E.bA||n===E.cG)&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",null,__("Create and use an AI generated featured image for your post.","jetpack")),(0,r.createElement)(o.Button,{onClick:he,isBusy:e,disabled:!oe||t||se,variant:"secondary"},__("Generate image","jetpack"))),N&&(0,r.createElement)(f.Z,{handleClose:Ae,title:ke},(0,r.createElement)("div",{className:"ai-assistant-featured-image__content"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt-textarea"},(0,r.createElement)("textarea",{disabled:se||$?.generating,maxLength:1e3,rows:2,onChange:be,placeholder:__("Include optional instructions to generate a new image","jetpack")}))),(W||se)&&!$?.generating&&(0,r.createElement)(p.Z,{description:se?(0,c.sprintf)(
// Translators: %d is the cost of generating a featured image.
-__("Featured image generation costs %d requests per image. You don't have enough requests to generate another image.","jetpack"),re):null,placement:k,useLightNudge:!0}),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-left"},!ae&&re&&K&&(0,r.createElement)(v.Z,{cost:re,currentLimit:K,currentUsage:Y})),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-right"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__action-buttons"},W?.error?(0,r.createElement)(o.Button,{onClick:fe,variant:"secondary",disabled:!D&&!oe},__("Try again","jetpack")):(0,r.createElement)(o.Tooltip,{text:we,placement:"bottom"},(0,r.createElement)(o.Button,{onClick:Ee,variant:"secondary",isBusy:W?.generating,disabled:se||W?.generating||!D&&!oe},__("Generate again","jetpack")))))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__image-canvas"},(0,r.createElement)(C.Z,{images:T,current:Z,handlePreviousImage:de,handleNextImage:pe,actions:_e}))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__footer"},(0,r.createElement)(o.Button,{variant:"link",className:"ai-assistant-featured-image__feedback-button",href:"https://jetpack.com/redirect/?source=jetpack-ai-feedback",target:"_blank"},(0,r.createElement)("span",null,__("Provide feedback","jetpack")),(0,r.createElement)(u.Z,{icon:d.Z,className:"icon"})))))}},62815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(69307),s=n(65736);const __=s.__;function o({currentLimit:e,currentUsage:t,cost:n}){const o=e-t,i=(0,a.createInterpolateElement)(
+__("Featured image generation costs %d requests per image. You don't have enough requests to generate another image.","jetpack"),ne):null,placement:v,useLightNudge:!0}),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-left"},!ae&&ne&&Y&&(0,r.createElement)(C.Z,{cost:ne,currentLimit:Y,currentUsage:J})),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-right"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__action-buttons"},$?.error?(0,r.createElement)(o.Button,{onClick:fe,variant:"secondary",disabled:!D&&!oe},__("Try again","jetpack")):(0,r.createElement)(o.Tooltip,{text:we,placement:"bottom"},(0,r.createElement)(o.Button,{onClick:Ee,variant:"secondary",isBusy:$?.generating,disabled:se||$?.generating||!D&&!oe},__("Generate again","jetpack")))))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__image-canvas"},(0,r.createElement)(b.Z,{images:T,current:Z,handlePreviousImage:de,handleNextImage:pe,actions:_e}))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__footer"},(0,r.createElement)(o.Button,{variant:"link",className:"ai-assistant-featured-image__feedback-button",href:"https://jetpack.com/redirect/?source=jetpack-ai-feedback",target:"_blank"},(0,r.createElement)("span",null,__("Provide feedback","jetpack")),(0,r.createElement)(u.Z,{icon:d.Z,className:"icon"})))))}},62815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(69307),s=n(65736);const __=s.__;function o({currentLimit:e,currentUsage:t,cost:n}){const o=e-t,i=(0,a.createInterpolateElement)(
// Translators: %d is the cost of one image.
// Translators: %d is the cost of one image.
(0,s.sprintf)(__("Requests needed: %d ","jetpack"),n),{counter:(0,r.createElement)("span",null)}),l=(0,a.createInterpolateElement)(
diff --git a/_inc/blocks/editor-experimental.asset.php b/_inc/blocks/editor-experimental.asset.php
index 2956d1b434..4dcf78541b 100644
--- a/_inc/blocks/editor-experimental.asset.php
+++ b/_inc/blocks/editor-experimental.asset.php
@@ -1 +1 @@
- array('lodash', 'moment', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => 'dd31d027322e454dea88');
+ array('lodash', 'moment', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '0c221a1d53da55dc6c31');
diff --git a/_inc/blocks/editor-experimental.js b/_inc/blocks/editor-experimental.js
index adbe704e66..4d412a0054 100644
--- a/_inc/blocks/editor-experimental.js
+++ b/_inc/blocks/editor-experimental.js
@@ -3,7 +3,7 @@
// translators: %1$d: number of requests remaining
__("You have %1$d requests remaining.","jetpack"),e)),React.createElement(r.Button,{variant:"link",onClick:n,href:s,target:s?"_blank":null},__("Upgrade now","jetpack")))}function b({error:e,code:t,onTryAgainClick:n,onUpgradeClick:s,upgradeUrl:o}){const i=e||__("Something went wrong","jetpack");return React.createElement(E,{severity:m},React.createElement("span",null,(0,a.sprintf)(
// translators: %1$d: A dynamic error message
-__("Error: %1$s","jetpack"),i)),t===d.$L?React.createElement(r.Button,{variant:"link",onClick:s,href:o,target:o?"_blank":null},__("Upgrade now","jetpack")):React.createElement(r.Button,{variant:"link",onClick:n},__("Try again","jetpack")))}},62282:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,u:()=>s});var r=n(99196),a=n.n(r);const s=(0,r.createContext)({}),o=({value:e,children:t})=>a().createElement(s.Provider,{value:e,children:t})},20281:(e,t,n)=>{"use strict";n.d(t,{X_:()=>s.Z,hE:()=>r.h,oN:()=>a.Z,uE:()=>r.u});var r=n(62282),a=n(3669),s=n(79466)},79466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(99196),a=n(16700),s=n(20281);function o({onDone:e,onSuggestion:t,onError:n}={}){const o=(0,r.useContext)(s.uE),{eventSource:i}=o,l=(0,r.useCallback)((t=>e?.(t?.detail)),[e]),c=(0,r.useCallback)((e=>t?.(e?.detail)),[t]),u=(0,r.useCallback)((e=>{n?.(e?.detail)}),[]);return(0,r.useEffect)((()=>{if(i)return e&&i.addEventListener("done",l),t&&i.addEventListener("suggestion",c),n&&i.addEventListener(a.vF,u),()=>{i.removeEventListener("done",l),i.removeEventListener("suggestion",c),i.removeEventListener(a.vF,u)}}),[i]),o}},3669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(94333),a=n(69307),s=n(99196),o=n.n(s),i=n(42194),l=n(20281);const c=(0,r.createHigherOrderComponent)((e=>t=>{const{suggestion:n,error:r,requestingState:s,request:c,stopSuggestion:u,eventSource:d}=(0,i.Z)(),p=(0,a.useMemo)((()=>({suggestion:n,requestingError:r,requestingState:s,eventSource:d,requestSuggestion:c,stopSuggestion:u})),[n,r,s,d,c,u]);return o().createElement(l.hE,{value:p},o().createElement(e,t))}),"withAiDataProvider")},42194:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Z:()=>l});var r=n(69307),a=n(65736),s=n(67742),o=n(16700);const __=a.__;function i(e){switch(e){case o.$L:return{code:o.$L,message:__("You have reached the limit of requests for this site.","jetpack"),severity:"info"};case o.bC:return{code:o.bC,message:__("Your request was unclear. Mind trying again?","jetpack"),severity:"info"};case o.$u:return{code:o.$u,message:__("Jetpack AI services are currently unavailable. Sorry for the inconvenience.","jetpack"),severity:"info"};case o.q4:return{code:o.q4,message:__("This request has been flagged by our moderation system. Please try to rephrase it and try again.","jetpack"),severity:"info"};case o.cv:return{code:o.cv,message:__("The content is too large to be processed all at once. Please try to shorten it or divide it into smaller parts.","jetpack"),severity:"info"};case o.co:default:return{code:o.co,message:__("It was not possible to process your request. Mind trying again?","jetpack"),severity:"info"}}}function l({prompt:e,autoRequest:t=!1,askQuestionOptions:n={},initialRequestingState:a="init",onSuggestion:l,onDone:c,onStop:u,onError:d,onAllErrors:p}={}){const[m,g]=(0,r.useState)(a),[A,h]=(0,r.useState)(""),[E,f]=(0,r.useState)(),C=(0,r.useRef)(void 0),b=(0,r.useCallback)((e=>{h(e?.detail),l?.(e?.detail)}),[l]),v=(0,r.useCallback)((e=>{Q(),c?.(e?.detail),g("done")}),[c]),k=(0,r.useCallback)((e=>{p?.(e?.detail)}),[p]),B=(0,r.useCallback)((e=>{C?.current?.close(),g("error"),f(i(e)),d?.(i(e))}),[d]),y=(0,r.useCallback)((()=>B(o.$L)),[]),w=(0,r.useCallback)((()=>B(o.bC)),[]),_=(0,r.useCallback)((()=>B(o.$u)),[]),I=(0,r.useCallback)((()=>B(o.q4)),[]),j=(0,r.useCallback)((()=>B(o.co)),[]),x=(0,r.useCallback)((async(e,t={...n})=>{if(f(void 0),g("requesting"),C.current=await(0,s.Z)(e,t),!C?.current)return;const r=C.current;g("suggesting"),r.addEventListener("suggestion",b),r.addEventListener(o.$L,y),r.addEventListener(o.bC,w),r.addEventListener(o.$u,_),r.addEventListener(o.q4,I),r.addEventListener(o.co,j),r.addEventListener(o.vF,k),r.addEventListener("done",v)}),[v,y,w,_,I,j,b]),S=(0,r.useCallback)((()=>{g("init"),h(""),f(void 0)}),[]),Q=(0,r.useCallback)((()=>{if(!C?.current)return;const e=C?.current;e.close(),e.removeEventListener("suggestion",b),e.removeEventListener(o.$L,y),e.removeEventListener(o.bC,w),e.removeEventListener(o.$u,_),e.removeEventListener(o.q4,I),e.removeEventListener(o.co,j),e.removeEventListener("done",v)}),[C,b,y,w,_,I,j,v]),N=(0,r.useCallback)((()=>{Q(),u?.(),g("done")}),[u]);return(0,r.useEffect)((()=>{if(e?.length)return t&&x(e,n),()=>{N()}}),[t,e,x,N]),{suggestion:A,error:E,requestingState:m,request:x,stopSuggestion:N,reset:S,handleErrorQuotaExceededError:y,eventSource:C.current}}},93509:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(69307),a=n(65736),s=n(51128),o=n.n(s),i=n(46961);const __=a.__,l=o()("jetpack-ai-client:use-audio-transcription"),c=e=>{if("string"==typeof e)return e;if("code"in e)switch(e.code){case"error_quota_exceeded":return __("You exceeded your current quota, please check your plan details.","jetpack");case"jetpack_ai_missing_audio_param":return __("The audio_file is required to perform a transcription.","jetpack");case"jetpack_ai_service_unavailable":return __("The Jetpack AI service is temporarily unavailable.","jetpack");case"file_size_not_supported":return __("The provided audio file is too big.","jetpack");case"file_type_not_supported":return __("The provided audio file type is not supported.","jetpack");case"jetpack_ai_error":return __("There was an error processing the transcription request.","jetpack");default:return e.message}return"message"in e?e.message:__("There was an error processing the transcription request.","jetpack")};function u({feature:e,onReady:t,onError:n}){const[a,s]=(0,r.useState)(""),[o,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useRef)(null);return{transcriptionResult:a,isTranscribingAudio:d,transcriptionError:o,transcribeAudio:(0,r.useCallback)((r=>{l("Transcribing audio"),s(""),u(""),p(!0);const a=new AbortController;m.current=a,(0,i.Z)(r,e,a.signal).then((e=>{s(e),t?.(e)})).catch((e=>{a.signal.aborted||(u(e.message),n?.(c(e)))})).finally((()=>p(!1)))}),[i.Z,s,u,p]),cancelTranscription:(0,r.useCallback)((()=>{m.current?.abort(),s(""),u(""),p(!1)}),[m,s,u,p])}}},92718:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(69307),a=n(65736);const __=a.__,s=25e6,o=1500,i=["audio/mpeg","audio/mp3","audio/ogg","audio/flac","audio/x-flac","audio/m4a","audio/x-m4a","audio/mp4","audio/wav","audio/wave","audio/x-wav","audio/webm"];function l(){const[e,t]=(0,r.useState)(!1);return{isValidatingAudio:e,validateAudio:(0,r.useCallback)(((e,n,r)=>{if(t(!0),e?.size>s)return t(!1),r(__("The audio file is too large. The maximum file size is 25MB.","jetpack"));const a=e instanceof File;if(a&&!i.includes(e.type))return t(!1),r(__("The audio file type is not supported. Please use a supported audio file type.","jetpack"));const l=new AudioContext;e.arrayBuffer().then((s=>{l.decodeAudioData(s,(function(s){const i=Math.ceil(s.duration);return i>o?(t(!1),r(__("The audio file is too long. The maximum recording time is 25 minutes.","jetpack"))):(t(!1),n({duration:i,isFile:a,size:e?.size}))}))}))}),[t])}}},70286:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51128),a=n.n(r),s=n(78982),o=n(2890);const i=a()("ai-client:use-image-generator"),l=(e,t)=>{const n=4e3-t;return e.length>n?e.substring(0,n-6)+" [...]":e},c=async(e,t,n)=>{const r=((e,t)=>{if(t){const n=`I need a Stable Diffusion prompt to generate a featured image for a blog post based on this user-provided image description:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nThe image should be a photo. Make sure you highlight the main suject of the image description, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}return"I need a Stable Diffusion prompt to generate a featured image for a blog post with the following content.\nThe image should be a photo. Make sure you highlight the main suject of the content, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments. The content is:\n\n"+l(e,412)})(e,t),a=await(0,s.Z)(r,{feature:n});return a.choices?.[0]?.message?.content},u=()=>{const e=async function(e){let t="";try{t=(await(0,o.Z)()).token}catch(e){return i("Error getting token: %o",e),Promise.reject(e)}try{const n="https://public-api.wordpress.com/wpcom/v2/jetpack-ai-image",r={Authorization:`Bearer ${t}`,"Content-Type":"application/json"},a=await fetch(n,{method:"POST",headers:r,body:JSON.stringify(e)}).then((e=>e.json()));return a?.data?.status&&a?.data?.status>200?(i("Error generating image: %o",a),Promise.reject(a)):a}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}};return{generateImage:async function({feature:t,postContent:n,responseFormat:r="url",userPrompt:a}){try{i("Generating image");const s=((e,t)=>{if(t){const n=`I need a cover image for a blog post based on this user prompt:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nBefore creating the image, identify the main topic of the user prompt and relate it to the post content.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}const n="I need a cover image for a blog post.\nBefore creating the image, identify the main topic of the content and only represent it.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nThis is the post content:\n\n";return n+l(e,838)})(n,a),o={prompt:s,response_format:r,feature:t,size:"1792x1024"};return await e(o)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithStableDiffusion:async function({feature:t,postContent:n,userPrompt:r}){try{i("Generating image with Stable Diffusion");const a={prompt:await c(n,r,t),feature:t,model:"stable-diffusion",style:"photographic"};return await e(a)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}}}}},13109:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(69307);const a="audio/mp4;codecs=mp4a",s="audio/mp4",o="audio/webm";function i({onDone:e}={}){const t=(0,r.useRef)(null),[n,i]=(0,r.useState)("inactive"),l=(0,r.useRef)(!1),c=(0,r.useRef)(0),[u,d]=(0,r.useState)(0),p=(0,r.useRef)(null),[m,g]=(0,r.useState)(null),A=(0,r.useRef)([]).current,[h,E]=(0,r.useState)(null),f=(0,r.useRef)(null);function C(){return MediaRecorder.isTypeSupported(a)?new Blob(A,{type:s}):new Blob(A,{type:o})}const b=(0,r.useCallback)((e=>{if(y(),!e)return t?.current?.start();e<100&&(e=100),c.current=Date.now(),t?.current?.start(e)}),[]),v=(0,r.useCallback)((()=>{l.current=!0,t?.current?.pause(),d((e=>e+Date.now()-c.current))}),[]),k=(0,r.useCallback)((()=>{l.current=!1,t?.current?.resume(),c.current=Date.now()}),[]),B=(0,r.useCallback)((()=>{t?.current?.stop(),"recording"===n&&d((e=>e+Date.now()-c.current))}),[]),y=(0,r.useCallback)((()=>{A.length=0,g(null),E(null),d(0),l.current=!1,c.current=0}),[]),w=(0,r.useCallback)((()=>{t?.current&&(t.current.removeEventListener("start",j),t.current.removeEventListener("stop",x),t.current.removeEventListener("pause",S),t.current.removeEventListener("resume",Q),t.current.removeEventListener("dataavailable",N),t.current=null)}),[]),_=(0,r.useCallback)((()=>{if(i("inactive"),y(),w(),!navigator.mediaDevices?.getUserMedia)return;const e=new AudioContext;f.current=e.createAnalyser();navigator.mediaDevices.getUserMedia({audio:!0}).then((n=>{p.current=n;e.createMediaStreamSource(n).connect(f.current),MediaRecorder.isTypeSupported(a)?t.current=new MediaRecorder(n,{mimeType:a}):t.current=new MediaRecorder(n,{mimeType:o}),t.current.addEventListener("start",j),t.current.addEventListener("stop",x),t.current.addEventListener("pause",S),t.current.addEventListener("resume",Q),t.current.addEventListener("dataavailable",N)})).catch((e=>{throw e}))}),[]),I=(0,r.useCallback)((e=>{B(),E("string"==typeof e?e:e.message),i("error")}),[]);function j(){i("recording")}function x(){const t=C();e?.(t),A.length=0}function S(){i("paused")}function Q(){i("recording")}function N(e){const{data:t}=e;t?.size&&(A.push(t),g(C()),l.current||d((e=>{const t=Date.now(),n=t-c.current;return c.current=t,e+n})))}return(0,r.useEffect)((()=>(_(),()=>{p.current&&p.current.getTracks().forEach((e=>e.stop())),w()})),[]),{state:n,blob:m,error:h,duration:u,analyser:f.current,onError:I,controls:{start:b,pause:v,resume:k,stop:B,reset:_}}}},44696:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>c});var r=n(69307),a=n(51128),s=n.n(a),o=n(42194);const i=s()("jetpack-ai-client:use-transcription-post-processing"),l="voice-to-content-simple-draft";function c({feature:e,onReady:t,onError:n,onUpdate:a}){const[s,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useCallback)((e=>{l(e),a?.(e)}),[l,a]),g=(0,r.useCallback)((e=>{l(e),a?.(e),t?.(e)}),[l,a,t]),A=(0,r.useCallback)((e=>{u(e.message),n?.(e.message)}),[u,n]),{request:h,stopSuggestion:E}=(0,o.Z)({onSuggestion:m,onDone:g,onError:A});return{postProcessingResult:s,isProcessingTranscription:d,postProcessingError:c,processTranscription:(0,r.useCallback)(((t,n)=>{i("Post-processing transcription"),l(""),u(""),p(!0);h([{role:"jetpack-ai",context:{type:t,content:n}}],{feature:e})}),[l,u,p,h,e]),cancelTranscriptionProcessing:(0,r.useCallback)((()=>{E(),p(!1)}),[E,p])}}},61317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"ai-assistant-icon"},s().createElement(r.Path,{className:"spark-first",d:"M9.33301 5.33325L10.4644 8.20188L13.333 9.33325L10.4644 10.4646L9.33301 13.3333L8.20164 10.4646L5.33301 9.33325L8.20164 8.20188L9.33301 5.33325Z"}),s().createElement(r.Path,{className:"spark-second",d:"M21.3333 5.33333L22.8418 9.15817L26.6667 10.6667L22.8418 12.1752L21.3333 16L19.8248 12.1752L16 10.6667L19.8248 9.15817L21.3333 5.33333Z"}),s().createElement(r.Path,{className:"spark-third",d:"M14.6667 13.3333L16.5523 18.1144L21.3333 20L16.5523 21.8856L14.6667 26.6667L12.781 21.8856L8 20L12.781 18.1144L14.6667 13.3333Z"}))},83585:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(55609);const a=React.createElement(r.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.95833C6.66328 3.95833 3.95833 6.66327 3.95833 9.99999C3.95833 13.3367 6.66328 16.0417 10 16.0417C13.3367 16.0417 16.0417 13.3367 16.0417 9.99999C16.0417 6.66327 13.3367 3.95833 10 3.95833ZM2.70833 9.99999C2.70833 5.97292 5.97292 2.70833 10 2.70833C14.0271 2.70833 17.2917 5.97292 17.2917 9.99999C17.2917 14.0271 14.0271 17.2917 10 17.2917C5.97292 17.2917 2.70833 14.0271 2.70833 9.99999Z"}),React.createElement(r.Path,{d:"M10.8333 5.83333H9.16667V10.8333H10.8333V5.83333Z"}),React.createElement(r.Path,{d:"M10.8333 12.5H9.16667V14.1667H10.8333V12.5Z"}))},59822:(e,t,n)=>{"use strict";n.d(t,{Qf:()=>a.Z,Qr:()=>s.Z,u_:()=>r.Z,v_:()=>o.Z});var r=n(61317),a=n(81204),s=(n(4454),n(71893),n(52887),n(96083)),o=n(50500)},81204:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"10.5",y:"8.25",width:"3",height:"4.875",rx:"1.5",fill:"#008710"}),s().createElement(r.Path,{d:"M15 11.25C15 11.644 14.9224 12.0341 14.7716 12.3981C14.6209 12.762 14.3999 13.0927 14.1213 13.3713C13.8427 13.6499 13.512 13.8709 13.1481 14.0216C12.7841 14.1724 12.394 14.25 12 14.25C11.606 14.25 11.2159 14.1724 10.8519 14.0216C10.488 13.8709 10.1573 13.6499 9.87868 13.3713C9.6001 13.0927 9.37913 12.762 9.22836 12.3981C9.0776 12.0341 9 11.644 9 11.25",stroke:"#008710",strokeWidth:"1.125",strokeLinecap:"round"}),s().createElement(r.Path,{d:"M11.4375 15.75C11.4375 16.0607 11.6893 16.3125 12 16.3125C12.3107 16.3125 12.5625 16.0607 12.5625 15.75L11.4375 15.75ZM11.4375 14.25L11.4375 15.75L12.5625 15.75L12.5625 14.25L11.4375 14.25Z",fill:"#008710"}))},4454:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},96083:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"12.75",y:"9",width:"2.25",height:"6",fill:"#008710"}),s().createElement(r.Rect,{x:"9",y:"9",width:"2.25",height:"6",fill:"#008710"}))},71893:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},52887:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Rect},50500:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5 10C12.5 11.3807 11.3807 12.5 10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10ZM14 10C14 12.2091 12.2091 14 10 14C7.79086 14 6 12.2091 6 10C6 7.79086 7.79086 6 10 6C12.2091 6 14 7.79086 14 10ZM16.75 21V19C16.75 17.4812 15.5188 16.25 14 16.25L6 16.25C4.48122 16.25 3.25 17.4812 3.25 19V21H4.75L4.75 19C4.75 18.3096 5.30964 17.75 6 17.75L14 17.75C14.6904 17.75 15.25 18.3096 15.25 19V21H16.75Z",fill:"currentColor"}),s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M19.976 16.3599C21.2507 14.5642 22.0001 12.3695 22.0001 9.99969C22.0001 7.63128 21.2515 5.43769 19.9782 3.64258L18.754 4.50967C19.8537 6.05996 20.5001 7.95434 20.5001 9.99969C20.5001 12.0464 19.8528 13.9419 18.7519 15.4928L19.976 16.3599ZM17.3357 14.4897C18.2357 13.222 18.7648 11.6727 18.7648 9.99969C18.7648 8.32808 18.2365 6.77984 17.3379 5.51279L16.1137 6.37988C16.8387 7.4021 17.2648 8.65114 17.2648 9.99969C17.2648 11.3496 16.8378 12.5998 16.1116 13.6226L17.3357 14.4897Z",fill:"currentColor"}))},42290:(e,t,n)=>{"use strict";n.d(t,{$L:()=>p.$L,$u:()=>p.$u,C3:()=>u.C3,Eo:()=>u.Eo,JP:()=>m.JP,L$:()=>i.Z,LB:()=>m.LB,MW:()=>u.MW,OS:()=>o.Z,Qf:()=>c.Qf,Qr:()=>c.Qr,Rc:()=>l.Z,X_:()=>d.X_,Y:()=>p.Y,ZK:()=>u.ZK,_T:()=>a.Z,bC:()=>p.bC,cH:()=>s.Z,co:()=>p.co,cv:()=>p.cv,g:()=>m.g,oN:()=>d.oN,pw:()=>r.Z,q4:()=>p.q4,rp:()=>u.rp,u_:()=>c.u_,v_:()=>c.v_,xi:()=>u.xi});n(2890),n(56694),n(67742),n(46961);var r=n(42194),a=n(13109),s=n(93509),o=n(44696),i=n(92718),l=n(70286),c=n(59822),u=n(58890),d=n(20281),p=n(16700),m=n(35613)},2890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(51128),s=n.n(a),o=n(87309);const i=s()("jetpack-ai-client:jwt"),l="jetpack-ai-jwt",c=12e4;async function u({apiNonce:e,siteId:t,expirationTime:n}={}){e=e||window.JP_CONNECTION_INITIAL_STATE.apiNonce,t=t||window.JP_CONNECTION_INITIAL_STATE.siteSuffix,n=n||c;const a=(0,r.Wp)(),s=localStorage.getItem(l);let u,d=null;if(s)try{d=JSON.parse(s)}catch(e){i("Error parsing token",e)}if(d&&d?.expire>Date.now())return i("Using cached token"),d;u=a?await(0,o.Z)({path:"/wpcom/v2/sites/"+t+"/jetpack-openai-query/jwt",method:"POST"}):await(0,o.Z)({path:"/jetpack/v4/jetpack-ai-jwt?_cacheBuster="+Date.now(),credentials:"same-origin",headers:{"X-WP-Nonce":e},method:"POST"});const p={token:u.token,blogId:a?t:u.blog_id,expire:Date.now()+n};return i("Storing new token"),localStorage.setItem(l,JSON.stringify(p)),p}},35613:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.JP,LB:()=>r.LB,g:()=>r.g});var r=n(71197)},22999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(92213);const a={paragraph:e=>e.replaceAll("\n"," ")},s={emDelimiter:"_",headingStyle:"atx"},o={strikethrough:{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}}};class i{constructor({options:e={},rules:t={},keep:n=[],remove:a=[],fixes:i=[]}={}){this.fixes=i,this.turndownService=new r.Z({...s,...e}),this.turndownService.keep(n),this.turndownService.remove(a);const l={...o,...t};for(const e in l)this.turndownService.addRule(e,l[e])}render({content:e}){const t=this.turndownService.turndown(e);return this.fixes.reduce(((e,t)=>a[t](e)),t)}}},71197:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.Z,LB:()=>o,g:()=>i});var r=n(22999);const a=new(n(28603).Z),s=new r.Z,o=({content:e,rules:t,extension:n})=>a.render({content:e,rules:t,extension:n}),i=({content:e})=>s.render({content:e})},28603:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(95601);const a=e=>e.replaceAll("\x3c!-- wp:list-item --\x3e","").replaceAll("\x3c!-- /wp:list-item --\x3e","").replaceAll("\x3c!-- wp:list --\x3e","").replaceAll("\x3c!-- /wp:list --\x3e","").replaceAll("","\x3c!-- wp:list-item --\x3e ").replaceAll(" ","\x3c!-- /wp:list-item --\x3e").replaceAll("",'\x3c!-- wp:list {"ordered":true} --\x3e').replaceAll(" "," \x3c!-- /wp:list --\x3e").replaceAll("","\x3c!-- wp:list --\x3e"," \x3c!-- /wp:list --\x3e"),s={list:(e,t=!1)=>{const n=e.replace(/\s+/g,"
").replace(/<\/p>\s+<\/li>/g," ");return t?a(n):n},listItem:(e,t=!1)=>t?a(e.replace(/^<[ou]l>\s*/g,"").replace(/\s*<\/[ou]l>\s*$/g,"")):e,paragraph:(e,t=!1)=>t?e.replaceAll(/\s*<br \/>\s*/g," "):e},o={breaks:!0},i=["list"];class l{constructor(e=o){this.markdownConverter=new r.Z(e)}render({content:e,rules:t=i,extension:n=!1}){const r=this.markdownConverter.render(e);return t.reduce(((e,t)=>s[t](e,n)),r)}}},56694:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(60400),a=n(51128),s=n.n(a),o=n(42194),i=n(2890),l=n(16700);const c=s()("jetpack-ai-client:suggestions-event-source");class u extends EventTarget{constructor(e){super(),this.fullMessage="",this.fullFunctionCall={name:"",arguments:""},this.isPromptClear=!1,this.controller=new AbortController,this.initEventSource(e)}async initEventSource({url:e,question:t,token:n,options:a={}}){if(!n)try{c("Token was not provided, requesting one..."),n=(await(0,i.Z)()).token}catch(e){return void this.processErrorEvent(e)}const s={};if(Number.isInteger(parseInt(a.postId))&&(s.post_id=+a.postId),!e){const t=new URL("https://public-api.wordpress.com/wpcom/v2/jetpack-ai-query");a?.fromCache&&t.searchParams.append("stream_cache","true"),e=t.toString(),c("URL not provided, using default: %o",e)}Array.isArray(t)?s.messages=t:s.question=t,a?.feature?.length&&(c("Feature: %o",a.feature),s.feature=a.feature),a?.functions?.length&&(c("Functions: %o",a.functions),s.functions=a.functions),a?.model?.length&&(c("Model: %o",a.model),s.model=a.model),this.errorUnclearPromptTriggered=!1,await(0,r.L)(e,{openWhenHidden:!0,method:"POST",headers:{"Content-type":"application/json",Authorization:"Bearer "+n},body:JSON.stringify(s),onclose:()=>{c("Stream closed")},onerror:e=>{throw this.processErrorEvent(e),e},onmessage:e=>{this.processEvent(e)},onopen:async e=>{if(e.ok)return;let t;throw e.status>=400&&e.status<=500&&![413,422,429].includes(e.status)&&(c("Connection error: %o",e),t=l.co,this.dispatchEvent(new CustomEvent(l.co,{detail:e}))),503===e.status&&(t=l.$u,this.dispatchEvent(new CustomEvent(l.$u))),413===e.status&&(t=l.cv,this.dispatchEvent(new CustomEvent(l.cv))),422===e.status&&(t=l.q4,this.dispatchEvent(new CustomEvent(l.q4))),429===e.status&&(t=l.$L,this.dispatchEvent(new CustomEvent(l.$L))),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(t)})),new Error},signal:this.controller.signal})}checkForUnclearPrompt(){if(this.isPromptClear)return;const e=this.fullMessage.replace(/__|(\*\*)/g,"");if(e.startsWith("JETPACK_AI_ERROR")){if(this.errorUnclearPromptTriggered)return;this.errorUnclearPromptTriggered=!0,this.dispatchEvent(new CustomEvent(l.bC)),c("Unclear error prompt dispatched"),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.bC)}))}else"JETPACK_AI_ERROR".startsWith(e)?c(this.fullMessage):this.isPromptClear=!0}close(){this.controller.abort()}processEvent(e){if("[DONE]"===e.data){if(this.errorUnclearPromptTriggered)return;if(this.fullMessage.length)return this.dispatchEvent(new CustomEvent("done",{detail:this.fullMessage})),void c("Done: %o",this.fullMessage);if(this.fullFunctionCall.name.length)return this.dispatchEvent(new CustomEvent("function_done",{detail:this.fullFunctionCall})),void c("Done: %o",this.fullFunctionCall)}let t;try{t=JSON.parse(e.data)}catch(t){return void c("Error parsing JSON",e,t)}const{delta:n}=t?.choices?.[0]??{delta:{content:null,function_call:null}},r=n.content,a=n.function_call;r&&(this.fullMessage+=r,this.checkForUnclearPrompt(),this.isPromptClear&&(this.dispatchEvent(new CustomEvent("chunk",{detail:r})),c("suggestion: %o",this.fullMessage),this.dispatchEvent(new CustomEvent("suggestion",{detail:this.fullMessage})))),a&&(null!=a.name&&(this.fullFunctionCall.name+=a.name),null!=a.arguments&&(this.fullFunctionCall.arguments+=a.arguments),this.dispatchEvent(new CustomEvent("functionCallChunk",{detail:this.fullFunctionCall})))}processErrorEvent(e){c("onerror: %o",e),this.dispatchEvent(new CustomEvent(l.co,{detail:e})),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.co)}))}}},16700:(e,t,n)=>{"use strict";n.d(t,{$L:()=>s,$u:()=>a,Y:()=>r.Y,bC:()=>c,co:()=>l,cv:()=>i,q4:()=>o,vF:()=>u});var r=n(44696);const a="error_service_unavailable",s="error_quota_exceeded",o="error_moderation",i="error_context_too_large",l="error_network",c="error_unclear_prompt",u="error_response"},6975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51128);const a=n.n(r)()("dops:analytics");let s,o;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const i={initialize:function(e,t,n){i.setUser(e,t),i.setSuperProps(n),i.identifyUser()},setGoogleAnalyticsEnabled:function(e,t=null){this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){o={ID:e,username:t}},setSuperProps:function(e){s=e},assignSuperProps:function(e){s=Object.assign(s||{},e)},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Built stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){i.tracks.recordPageView(e),i.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,a,s,o){i.ga.recordPurchase(e,t,n,r,a,s,o)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(s&&(a("- Super Props: %o",s),t=Object.assign(t,s)),a('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):a('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};i.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){i.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){a("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};i.ga.initialized||(o&&(e={userId:"u-"+o.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),i.ga.initialized=!0)},recordPageView:function(e,t){i.ga.initialize(),a("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){i.ga.initialize();let s="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(s+=" [Option Label: "+n+"]"),void 0!==r&&(s+=" [Option Value: "+r+"]"),a(s),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,a,s,o){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:o}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:a,quantity:s}),window.ga("ecommerce:send")}},identifyUser:function(){o&&window._tkq.push(["identifyUser",o.ID,o.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}},l=i},64743:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(61132),a=n(96483);function s(e){class t extends Error{constructor(...t){super(...t),this.name=e}}return t}const o=s("JsonParseError"),i=s("JsonParseAfterRedirectError"),l=s("Api404Error"),c=s("Api404AfterRedirectError"),u=s("FetchNetworkError");const d=new function(e,t){let n=e,s=e,o={"X-WP-Nonce":t},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})},c=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setWpcomOriginApiUrl(e){s=e},setApiNonce(e){o={"X-WP-Nonce":e},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{c=e},registerSite:(e,t,a)=>{const s={registration_nonce:e,no_iframe:!0};return(0,r.jetpackConfigHas)("consumer_slug")&&(s.plugin_slug=(0,r.jetpackConfigGet)("consumer_slug")),null!==t&&(s.redirect_uri=t),a&&(s.from=a),g(`${n}jetpack/v4/connection/register`,l,{body:JSON.stringify(s)}).then(p).then(m)},fetchAuthorizationUrl:e=>d((0,a.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),i).then(p).then(m),fetchSiteConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchSiteConnectionStatus:()=>d(`${n}jetpack/v4/connection`,i).then(m),fetchSiteConnectionTest:()=>d(`${n}jetpack/v4/connection/test`,i).then(p).then(m),fetchUserConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchUserTrackingSettings:()=>d(`${n}jetpack/v4/tracking/settings`,i).then(p).then(m),updateUserTrackingSettings:e=>g(`${n}jetpack/v4/tracking/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),disconnectSite:()=>g(`${n}jetpack/v4/connection`,l,{body:JSON.stringify({isActive:!1})}).then(p).then(m),fetchConnectUrl:()=>d(`${n}jetpack/v4/connection/url`,i).then(p).then(m),unlinkUser:()=>g(`${n}jetpack/v4/connection/user`,l,{body:JSON.stringify({linked:!1})}).then(p).then(m),reconnect:()=>g(`${n}jetpack/v4/connection/reconnect`,l).then(p).then(m),fetchConnectedPlugins:()=>d(`${n}jetpack/v4/connection/plugins`,i).then(p).then(m),setHasSeenWCConnectionModal:()=>g(`${n}jetpack/v4/seen-wc-connection-modal`,l).then(p).then(m),fetchModules:()=>d(`${n}jetpack/v4/module/all`,i).then(p).then(m),fetchModule:e=>d(`${n}jetpack/v4/module/${e}`,i).then(p).then(m),activateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!0})}).then(p).then(m),deactivateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>g(`${n}jetpack/v4/module/${e}`,l,{body:JSON.stringify(t)}).then(p).then(m),updateSettings:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),getProtectCount:()=>d(`${n}jetpack/v4/module/protect/data`,i).then(p).then(m),resetOptions:e=>g(`${n}jetpack/v4/options/${e}`,l,{body:JSON.stringify({reset:!0})}).then(p).then(m),activateVaultPress:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(p).then(m),getVaultPressData:()=>d(`${n}jetpack/v4/module/vaultpress/data`,i).then(p).then(m),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify(r)}).then(p).then(m)},activateAkismet:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(p).then(m),getAkismetData:()=>d(`${n}jetpack/v4/module/akismet/data`,i).then(p).then(m),checkAkismetKey:()=>d(`${n}jetpack/v4/module/akismet/key/check`,i).then(p).then(m),checkAkismetKeyTyped:e=>g(`${n}jetpack/v4/module/akismet/key/check`,l,{body:JSON.stringify({api_key:e})}).then(p).then(m),fetchStatsData:e=>d(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),i).then(p).then(m).then(h),getPluginUpdates:()=>d(`${n}jetpack/v4/updates/plugins`,i).then(p).then(m),getPlans:()=>d(`${n}jetpack/v4/plans`,i).then(p).then(m),fetchSettings:()=>d(`${n}jetpack/v4/settings`,i).then(p).then(m),updateSetting:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSiteData:()=>d(`${n}jetpack/v4/site`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>d(`${n}jetpack/v4/site/features`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>d(`${n}jetpack/v4/site/products`,i).then(p).then(m),fetchSitePurchases:()=>d(`${n}jetpack/v4/site/purchases`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>d(`${n}jetpack/v4/site/benefits`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteDiscount:()=>d(`${n}jetpack/v4/site/discount`,i).then(p).then(m).then((e=>e.data)),fetchSetupQuestionnaire:()=>d(`${n}jetpack/v4/setup/questionnaire`,i).then(p).then(m),fetchRecommendationsData:()=>d(`${n}jetpack/v4/recommendations/data`,i).then(p).then(m),fetchRecommendationsProductSuggestions:()=>d(`${n}jetpack/v4/recommendations/product-suggestions`,i).then(p).then(m),fetchRecommendationsUpsell:()=>d(`${n}jetpack/v4/recommendations/upsell`,i).then(p).then(m),fetchRecommendationsConditional:()=>d(`${n}jetpack/v4/recommendations/conditional`,i).then(p).then(m),saveRecommendationsData:e=>g(`${n}jetpack/v4/recommendations/data`,l,{body:JSON.stringify({data:e})}).then(p),fetchProducts:()=>d(`${n}jetpack/v4/products`,i).then(p).then(m),fetchRewindStatus:()=>d(`${n}jetpack/v4/rewind`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>d(`${n}jetpack/v4/scan`,i).then(p).then(m).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>g(`${n}jetpack/v4/notice/${e}`,l,{body:JSON.stringify({dismissed:!0})}).then(p).then(m),fetchPluginsData:()=>d(`${n}jetpack/v4/plugins`,i).then(p).then(m),fetchIntroOffers:()=>d(`${n}jetpack/v4/intro-offers`,i).then(p).then(m),fetchVerifySiteGoogleStatus:e=>d(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,i).then(p).then(m),verifySiteGoogle:e=>g(`${n}jetpack/v4/verify-site/google`,l,{body:JSON.stringify({keyring_id:e})}).then(p).then(m),submitSurvey:e=>g(`${n}jetpack/v4/marketing/survey`,l,{body:JSON.stringify(e)}).then(p).then(m),saveSetupQuestionnaire:e=>g(`${n}jetpack/v4/setup/questionnaire`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicensingError:e=>g(`${n}jetpack/v4/licensing/error`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicenseKey:e=>g(`${n}jetpack/v4/licensing/set-license`,l,{body:JSON.stringify({license:e})}).then(p).then(m),getUserLicensesCounts:()=>d(`${n}jetpack/v4/licensing/user/counts`,i).then(p).then(m),getUserLicenses:()=>d(`${n}jetpack/v4/licensing/user/licenses`,i).then(p).then(m),updateLicensingActivationNoticeDismiss:e=>g(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,l,{body:JSON.stringify({last_detached_count:e})}).then(p).then(m),updateRecommendationsStep:e=>g(`${n}jetpack/v4/recommendations/step`,l,{body:JSON.stringify({step:e})}).then(p),confirmIDCSafeMode:()=>g(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,l).then(p),startIDCFresh:e=>g(`${n}jetpack/v4/identity-crisis/start-fresh`,l,{body:JSON.stringify({redirect_uri:e})}).then(p).then(m),migrateIDC:()=>g(`${n}jetpack/v4/identity-crisis/migrate`,l).then(p),attachLicenses:e=>g(`${n}jetpack/v4/licensing/attach-licenses`,l,{body:JSON.stringify({licenses:e})}).then(p).then(m),fetchSearchPlanInfo:()=>d(`${s}jetpack/v4/search/plan`,i).then(p).then(m),fetchSearchSettings:()=>d(`${s}jetpack/v4/search/settings`,i).then(p).then(m),updateSearchSettings:e=>g(`${s}jetpack/v4/search/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSearchStats:()=>d(`${s}jetpack/v4/search/stats`,i).then(p).then(m),fetchWafSettings:()=>d(`${n}jetpack/v4/waf`,i).then(p).then(m),updateWafSettings:e=>g(`${n}jetpack/v4/waf`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchWordAdsSettings:()=>d(`${n}jetpack/v4/wordads/settings`,i).then(p).then(m),updateWordAdsSettings:e=>g(`${n}jetpack/v4/wordads/settings`,l,{body:JSON.stringify(e)}),fetchSearchPricing:()=>d(`${s}jetpack/v4/search/pricing`,i).then(p).then(m),fetchMigrationStatus:()=>d(`${n}jetpack/v4/migration/status`,i).then(p).then(m),fetchBackupUndoEvent:()=>d(`${n}jetpack/v4/site/backup/undo-event`,i).then(p).then(m),fetchBackupPreflightStatus:()=>d(`${n}jetpack/v4/site/backup/preflight`,i).then(p).then(m)};function d(e,t){return fetch(c(e),t)}function g(e,t,n){return fetch(e,Object.assign({},t,n)).catch(A)}function h(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}Object.assign(this,u)};function p(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new c(e.redirected):new l})):e.json().catch((e=>g(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function m(e){return e.json().catch((t=>g(t,e.redirected,e.url)))}function g(e,t,n){throw t?new i(n):new o}function A(){throw new u}},90526:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(82674),a=n.n(r),s=n(55609),o=n(65736),i=n(61074),l=n(15381),c=n(65235),u=n.n(c),d=n(99196),p=n.n(d),m=n(62103);const __=o.__,g=(0,d.forwardRef)(((e,t)=>{const{children:n,variant:r="primary",size:o="normal",weight:c="bold",icon:d,iconSize:g,disabled:A,isDestructive:h,isLoading:E,isExternalLink:f,className:C,text:b,fullWidth:v,...k}=e,B=u()(m.Z.button,C,{[m.Z.normal]:"normal"===o,[m.Z.small]:"small"===o,[m.Z.icon]:Boolean(d),[m.Z.loading]:E,[m.Z.regular]:"regular"===c,[m.Z["full-width"]]:v,[m.Z["is-icon-button"]]:Boolean(d)&&!n});k.ref=t;const y="normal"===o?20:16,w=f&&p().createElement(p().Fragment,null,p().createElement(i.Z,{size:y,icon:l.Z,className:m.Z["external-icon"]}),p().createElement(s.VisuallyHidden,{as:"span"},/* translators: accessibility text */
+__("Error: %1$s","jetpack"),i)),t===d.$L?React.createElement(r.Button,{variant:"link",onClick:s,href:o,target:o?"_blank":null},__("Upgrade now","jetpack")):React.createElement(r.Button,{variant:"link",onClick:n},__("Try again","jetpack")))}},62282:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,u:()=>s});var r=n(99196),a=n.n(r);const s=(0,r.createContext)({}),o=({value:e,children:t})=>a().createElement(s.Provider,{value:e,children:t})},20281:(e,t,n)=>{"use strict";n.d(t,{X_:()=>s.Z,hE:()=>r.h,oN:()=>a.Z,uE:()=>r.u});var r=n(62282),a=n(3669),s=n(79466)},79466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(99196),a=n(16700),s=n(20281);function o({onDone:e,onSuggestion:t,onError:n}={}){const o=(0,r.useContext)(s.uE),{eventSource:i}=o,l=(0,r.useCallback)((t=>e?.(t?.detail)),[e]),c=(0,r.useCallback)((e=>t?.(e?.detail)),[t]),u=(0,r.useCallback)((e=>{n?.(e?.detail)}),[]);return(0,r.useEffect)((()=>{if(i)return e&&i.addEventListener("done",l),t&&i.addEventListener("suggestion",c),n&&i.addEventListener(a.vF,u),()=>{i.removeEventListener("done",l),i.removeEventListener("suggestion",c),i.removeEventListener(a.vF,u)}}),[i]),o}},3669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(94333),a=n(69307),s=n(99196),o=n.n(s),i=n(42194),l=n(20281);const c=(0,r.createHigherOrderComponent)((e=>t=>{const{suggestion:n,error:r,requestingState:s,request:c,stopSuggestion:u,eventSource:d}=(0,i.Z)(),p=(0,a.useMemo)((()=>({suggestion:n,requestingError:r,requestingState:s,eventSource:d,requestSuggestion:c,stopSuggestion:u})),[n,r,s,d,c,u]);return o().createElement(l.hE,{value:p},o().createElement(e,t))}),"withAiDataProvider")},42194:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Z:()=>l});var r=n(69307),a=n(65736),s=n(67742),o=n(16700);const __=a.__;function i(e){switch(e){case o.$L:return{code:o.$L,message:__("You have reached the limit of requests for this site.","jetpack"),severity:"info"};case o.bC:return{code:o.bC,message:__("Your request was unclear. Mind trying again?","jetpack"),severity:"info"};case o.$u:return{code:o.$u,message:__("Jetpack AI services are currently unavailable. Sorry for the inconvenience.","jetpack"),severity:"info"};case o.q4:return{code:o.q4,message:__("This request has been flagged by our moderation system. Please try to rephrase it and try again.","jetpack"),severity:"info"};case o.cv:return{code:o.cv,message:__("The content is too large to be processed all at once. Please try to shorten it or divide it into smaller parts.","jetpack"),severity:"info"};case o.co:default:return{code:o.co,message:__("It was not possible to process your request. Mind trying again?","jetpack"),severity:"info"}}}function l({prompt:e,autoRequest:t=!1,askQuestionOptions:n={},initialRequestingState:a="init",onSuggestion:l,onDone:c,onStop:u,onError:d,onAllErrors:p}={}){const[m,g]=(0,r.useState)(a),[A,h]=(0,r.useState)(""),[E,f]=(0,r.useState)(),C=(0,r.useRef)(void 0),b=(0,r.useCallback)((e=>{h(e?.detail),l?.(e?.detail)}),[l]),v=(0,r.useCallback)((e=>{Q(),c?.(e?.detail),g("done")}),[c]),k=(0,r.useCallback)((e=>{p?.(e?.detail)}),[p]),B=(0,r.useCallback)((e=>{C?.current?.close(),g("error"),f(i(e)),d?.(i(e))}),[d]),y=(0,r.useCallback)((()=>B(o.$L)),[]),w=(0,r.useCallback)((()=>B(o.bC)),[]),_=(0,r.useCallback)((()=>B(o.$u)),[]),I=(0,r.useCallback)((()=>B(o.q4)),[]),j=(0,r.useCallback)((()=>B(o.co)),[]),x=(0,r.useCallback)((async(e,t={...n})=>{if(f(void 0),g("requesting"),C.current=await(0,s.Z)(e,t),!C?.current)return;const r=C.current;g("suggesting"),r.addEventListener("suggestion",b),r.addEventListener(o.$L,y),r.addEventListener(o.bC,w),r.addEventListener(o.$u,_),r.addEventListener(o.q4,I),r.addEventListener(o.co,j),r.addEventListener(o.vF,k),r.addEventListener("done",v)}),[v,y,w,_,I,j,b]),S=(0,r.useCallback)((()=>{g("init"),h(""),f(void 0)}),[]),Q=(0,r.useCallback)((()=>{if(!C?.current)return;const e=C?.current;e.close(),e.removeEventListener("suggestion",b),e.removeEventListener(o.$L,y),e.removeEventListener(o.bC,w),e.removeEventListener(o.$u,_),e.removeEventListener(o.q4,I),e.removeEventListener(o.co,j),e.removeEventListener("done",v)}),[C,b,y,w,_,I,j,v]),N=(0,r.useCallback)((()=>{Q(),u?.(),g("done")}),[u]);return(0,r.useEffect)((()=>{if(e?.length)return t&&x(e,n),()=>{N()}}),[t,e,x,N]),{suggestion:A,error:E,requestingState:m,request:x,stopSuggestion:N,reset:S,handleErrorQuotaExceededError:y,eventSource:C.current}}},93509:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(69307),a=n(65736),s=n(51128),o=n.n(s),i=n(46961);const __=a.__,l=o()("jetpack-ai-client:use-audio-transcription"),c=e=>{if("string"==typeof e)return e;if("code"in e)switch(e.code){case"error_quota_exceeded":return __("You exceeded your current quota, please check your plan details.","jetpack");case"jetpack_ai_missing_audio_param":return __("The audio_file is required to perform a transcription.","jetpack");case"jetpack_ai_service_unavailable":return __("The Jetpack AI service is temporarily unavailable.","jetpack");case"file_size_not_supported":return __("The provided audio file is too big.","jetpack");case"file_type_not_supported":return __("The provided audio file type is not supported.","jetpack");case"jetpack_ai_error":return __("There was an error processing the transcription request.","jetpack");default:return e.message}return"message"in e?e.message:__("There was an error processing the transcription request.","jetpack")};function u({feature:e,onReady:t,onError:n}){const[a,s]=(0,r.useState)(""),[o,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useRef)(null);return{transcriptionResult:a,isTranscribingAudio:d,transcriptionError:o,transcribeAudio:(0,r.useCallback)((r=>{l("Transcribing audio"),s(""),u(""),p(!0);const a=new AbortController;m.current=a,(0,i.Z)(r,e,a.signal).then((e=>{s(e),t?.(e)})).catch((e=>{a.signal.aborted||(u(e.message),n?.(c(e)))})).finally((()=>p(!1)))}),[i.Z,s,u,p]),cancelTranscription:(0,r.useCallback)((()=>{m.current?.abort(),s(""),u(""),p(!1)}),[m,s,u,p])}}},92718:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(69307),a=n(65736);const __=a.__,s=25e6,o=1500,i=["audio/mpeg","audio/mp3","audio/ogg","audio/flac","audio/x-flac","audio/m4a","audio/x-m4a","audio/mp4","audio/wav","audio/wave","audio/x-wav","audio/webm"];function l(){const[e,t]=(0,r.useState)(!1);return{isValidatingAudio:e,validateAudio:(0,r.useCallback)(((e,n,r)=>{if(t(!0),e?.size>s)return t(!1),r(__("The audio file is too large. The maximum file size is 25MB.","jetpack"));const a=e instanceof File;if(a&&!i.includes(e.type))return t(!1),r(__("The audio file type is not supported. Please use a supported audio file type.","jetpack"));const l=new AudioContext;e.arrayBuffer().then((s=>{l.decodeAudioData(s,(function(s){const i=Math.ceil(s.duration);return i>o?(t(!1),r(__("The audio file is too long. The maximum recording time is 25 minutes.","jetpack"))):(t(!1),n({duration:i,isFile:a,size:e?.size}))}))}))}),[t])}}},70286:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51128),a=n.n(r),s=n(78982),o=n(2890);const i=a()("ai-client:use-image-generator"),l=(e,t)=>{const n=4e3-t;return e.length>n?e.substring(0,n-6)+" [...]":e},c=async(e,t,n)=>{const r=((e,t)=>{if(t){const n=`I need a Stable Diffusion prompt to generate a featured image for a blog post based on this user-provided image description:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nThe image should be a photo. Make sure you highlight the main suject of the image description, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}return"I need a Stable Diffusion prompt to generate a featured image for a blog post with the following content.\nThe image should be a photo. Make sure you highlight the main suject of the content, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments. The content is:\n\n"+l(e,412)})(e,t),a=await(0,s.Z)(r,{feature:n});return a.choices?.[0]?.message?.content},u=()=>{const e=async function(e){let t="";try{t=(await(0,o.Z)()).token}catch(e){return i("Error getting token: %o",e),Promise.reject(e)}try{const n="https://public-api.wordpress.com/wpcom/v2/jetpack-ai-image",r={Authorization:`Bearer ${t}`,"Content-Type":"application/json"},a=await fetch(n,{method:"POST",headers:r,body:JSON.stringify(e)}).then((e=>e.json()));return a?.data?.status&&a?.data?.status>200?(i("Error generating image: %o",a),Promise.reject(a)):a}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}};return{generateImage:async function({feature:t,postContent:n,responseFormat:r="url",userPrompt:a}){try{i("Generating image");const s=((e,t)=>{if(t){const n=`I need a cover image for a blog post based on this user prompt:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nBefore creating the image, identify the main topic of the user prompt and relate it to the post content.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}const n="I need a cover image for a blog post.\nBefore creating the image, identify the main topic of the content and only represent it.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nThis is the post content:\n\n";return n+l(e,838)})(n,a),o={prompt:s,response_format:r,feature:t,size:"1792x1024"};return await e(o)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithStableDiffusion:async function({feature:t,postContent:n,userPrompt:r}){try{i("Generating image with Stable Diffusion");const a={prompt:await c(n,r,t),feature:t,model:"stable-diffusion",style:"photographic"};return await e(a)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithParameters:e}}},13109:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(69307);const a="audio/mp4;codecs=mp4a",s="audio/mp4",o="audio/webm";function i({onDone:e}={}){const t=(0,r.useRef)(null),[n,i]=(0,r.useState)("inactive"),l=(0,r.useRef)(!1),c=(0,r.useRef)(0),[u,d]=(0,r.useState)(0),p=(0,r.useRef)(null),[m,g]=(0,r.useState)(null),A=(0,r.useRef)([]).current,[h,E]=(0,r.useState)(null),f=(0,r.useRef)(null);function C(){return MediaRecorder.isTypeSupported(a)?new Blob(A,{type:s}):new Blob(A,{type:o})}const b=(0,r.useCallback)((e=>{if(y(),!e)return t?.current?.start();e<100&&(e=100),c.current=Date.now(),t?.current?.start(e)}),[]),v=(0,r.useCallback)((()=>{l.current=!0,t?.current?.pause(),d((e=>e+Date.now()-c.current))}),[]),k=(0,r.useCallback)((()=>{l.current=!1,t?.current?.resume(),c.current=Date.now()}),[]),B=(0,r.useCallback)((()=>{t?.current?.stop(),"recording"===n&&d((e=>e+Date.now()-c.current))}),[]),y=(0,r.useCallback)((()=>{A.length=0,g(null),E(null),d(0),l.current=!1,c.current=0}),[]),w=(0,r.useCallback)((()=>{t?.current&&(t.current.removeEventListener("start",j),t.current.removeEventListener("stop",x),t.current.removeEventListener("pause",S),t.current.removeEventListener("resume",Q),t.current.removeEventListener("dataavailable",N),t.current=null)}),[]),_=(0,r.useCallback)((()=>{if(i("inactive"),y(),w(),!navigator.mediaDevices?.getUserMedia)return;const e=new AudioContext;f.current=e.createAnalyser();navigator.mediaDevices.getUserMedia({audio:!0}).then((n=>{p.current=n;e.createMediaStreamSource(n).connect(f.current),MediaRecorder.isTypeSupported(a)?t.current=new MediaRecorder(n,{mimeType:a}):t.current=new MediaRecorder(n,{mimeType:o}),t.current.addEventListener("start",j),t.current.addEventListener("stop",x),t.current.addEventListener("pause",S),t.current.addEventListener("resume",Q),t.current.addEventListener("dataavailable",N)})).catch((e=>{throw e}))}),[]),I=(0,r.useCallback)((e=>{B(),E("string"==typeof e?e:e.message),i("error")}),[]);function j(){i("recording")}function x(){const t=C();e?.(t),A.length=0}function S(){i("paused")}function Q(){i("recording")}function N(e){const{data:t}=e;t?.size&&(A.push(t),g(C()),l.current||d((e=>{const t=Date.now(),n=t-c.current;return c.current=t,e+n})))}return(0,r.useEffect)((()=>(_(),()=>{p.current&&p.current.getTracks().forEach((e=>e.stop())),w()})),[]),{state:n,blob:m,error:h,duration:u,analyser:f.current,onError:I,controls:{start:b,pause:v,resume:k,stop:B,reset:_}}}},44696:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>c});var r=n(69307),a=n(51128),s=n.n(a),o=n(42194);const i=s()("jetpack-ai-client:use-transcription-post-processing"),l="voice-to-content-simple-draft";function c({feature:e,onReady:t,onError:n,onUpdate:a}){const[s,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useCallback)((e=>{l(e),a?.(e)}),[l,a]),g=(0,r.useCallback)((e=>{l(e),a?.(e),t?.(e)}),[l,a,t]),A=(0,r.useCallback)((e=>{u(e.message),n?.(e.message)}),[u,n]),{request:h,stopSuggestion:E}=(0,o.Z)({onSuggestion:m,onDone:g,onError:A});return{postProcessingResult:s,isProcessingTranscription:d,postProcessingError:c,processTranscription:(0,r.useCallback)(((t,n)=>{i("Post-processing transcription"),l(""),u(""),p(!0);h([{role:"jetpack-ai",context:{type:t,content:n}}],{feature:e})}),[l,u,p,h,e]),cancelTranscriptionProcessing:(0,r.useCallback)((()=>{E(),p(!1)}),[E,p])}}},61317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"ai-assistant-icon"},s().createElement(r.Path,{className:"spark-first",d:"M9.33301 5.33325L10.4644 8.20188L13.333 9.33325L10.4644 10.4646L9.33301 13.3333L8.20164 10.4646L5.33301 9.33325L8.20164 8.20188L9.33301 5.33325Z"}),s().createElement(r.Path,{className:"spark-second",d:"M21.3333 5.33333L22.8418 9.15817L26.6667 10.6667L22.8418 12.1752L21.3333 16L19.8248 12.1752L16 10.6667L19.8248 9.15817L21.3333 5.33333Z"}),s().createElement(r.Path,{className:"spark-third",d:"M14.6667 13.3333L16.5523 18.1144L21.3333 20L16.5523 21.8856L14.6667 26.6667L12.781 21.8856L8 20L12.781 18.1144L14.6667 13.3333Z"}))},83585:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(55609);const a=React.createElement(r.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.95833C6.66328 3.95833 3.95833 6.66327 3.95833 9.99999C3.95833 13.3367 6.66328 16.0417 10 16.0417C13.3367 16.0417 16.0417 13.3367 16.0417 9.99999C16.0417 6.66327 13.3367 3.95833 10 3.95833ZM2.70833 9.99999C2.70833 5.97292 5.97292 2.70833 10 2.70833C14.0271 2.70833 17.2917 5.97292 17.2917 9.99999C17.2917 14.0271 14.0271 17.2917 10 17.2917C5.97292 17.2917 2.70833 14.0271 2.70833 9.99999Z"}),React.createElement(r.Path,{d:"M10.8333 5.83333H9.16667V10.8333H10.8333V5.83333Z"}),React.createElement(r.Path,{d:"M10.8333 12.5H9.16667V14.1667H10.8333V12.5Z"}))},59822:(e,t,n)=>{"use strict";n.d(t,{Qf:()=>a.Z,Qr:()=>s.Z,u_:()=>r.Z,v_:()=>o.Z});var r=n(61317),a=n(81204),s=(n(4454),n(71893),n(52887),n(96083)),o=n(50500)},81204:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"10.5",y:"8.25",width:"3",height:"4.875",rx:"1.5",fill:"#008710"}),s().createElement(r.Path,{d:"M15 11.25C15 11.644 14.9224 12.0341 14.7716 12.3981C14.6209 12.762 14.3999 13.0927 14.1213 13.3713C13.8427 13.6499 13.512 13.8709 13.1481 14.0216C12.7841 14.1724 12.394 14.25 12 14.25C11.606 14.25 11.2159 14.1724 10.8519 14.0216C10.488 13.8709 10.1573 13.6499 9.87868 13.3713C9.6001 13.0927 9.37913 12.762 9.22836 12.3981C9.0776 12.0341 9 11.644 9 11.25",stroke:"#008710",strokeWidth:"1.125",strokeLinecap:"round"}),s().createElement(r.Path,{d:"M11.4375 15.75C11.4375 16.0607 11.6893 16.3125 12 16.3125C12.3107 16.3125 12.5625 16.0607 12.5625 15.75L11.4375 15.75ZM11.4375 14.25L11.4375 15.75L12.5625 15.75L12.5625 14.25L11.4375 14.25Z",fill:"#008710"}))},4454:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},96083:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"12.75",y:"9",width:"2.25",height:"6",fill:"#008710"}),s().createElement(r.Rect,{x:"9",y:"9",width:"2.25",height:"6",fill:"#008710"}))},71893:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},52887:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Rect},50500:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5 10C12.5 11.3807 11.3807 12.5 10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10ZM14 10C14 12.2091 12.2091 14 10 14C7.79086 14 6 12.2091 6 10C6 7.79086 7.79086 6 10 6C12.2091 6 14 7.79086 14 10ZM16.75 21V19C16.75 17.4812 15.5188 16.25 14 16.25L6 16.25C4.48122 16.25 3.25 17.4812 3.25 19V21H4.75L4.75 19C4.75 18.3096 5.30964 17.75 6 17.75L14 17.75C14.6904 17.75 15.25 18.3096 15.25 19V21H16.75Z",fill:"currentColor"}),s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M19.976 16.3599C21.2507 14.5642 22.0001 12.3695 22.0001 9.99969C22.0001 7.63128 21.2515 5.43769 19.9782 3.64258L18.754 4.50967C19.8537 6.05996 20.5001 7.95434 20.5001 9.99969C20.5001 12.0464 19.8528 13.9419 18.7519 15.4928L19.976 16.3599ZM17.3357 14.4897C18.2357 13.222 18.7648 11.6727 18.7648 9.99969C18.7648 8.32808 18.2365 6.77984 17.3379 5.51279L16.1137 6.37988C16.8387 7.4021 17.2648 8.65114 17.2648 9.99969C17.2648 11.3496 16.8378 12.5998 16.1116 13.6226L17.3357 14.4897Z",fill:"currentColor"}))},42290:(e,t,n)=>{"use strict";n.d(t,{$L:()=>p.$L,$u:()=>p.$u,C3:()=>u.C3,Eo:()=>u.Eo,JP:()=>m.JP,L$:()=>i.Z,LB:()=>m.LB,MW:()=>u.MW,OS:()=>o.Z,Qf:()=>c.Qf,Qr:()=>c.Qr,Rc:()=>l.Z,X_:()=>d.X_,Y:()=>p.Y,ZK:()=>u.ZK,_T:()=>a.Z,bC:()=>p.bC,cH:()=>s.Z,co:()=>p.co,cv:()=>p.cv,g:()=>m.g,oN:()=>d.oN,pw:()=>r.Z,q4:()=>p.q4,rp:()=>u.rp,u_:()=>c.u_,v_:()=>c.v_,xi:()=>u.xi});n(2890),n(56694),n(67742),n(46961);var r=n(42194),a=n(13109),s=n(93509),o=n(44696),i=n(92718),l=n(70286),c=n(59822),u=n(58890),d=n(20281),p=n(16700),m=n(35613)},2890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(51128),s=n.n(a),o=n(87309);const i=s()("jetpack-ai-client:jwt"),l="jetpack-ai-jwt",c=12e4;async function u({apiNonce:e,siteId:t,expirationTime:n}={}){e=e||window.JP_CONNECTION_INITIAL_STATE.apiNonce,t=t||window.JP_CONNECTION_INITIAL_STATE.siteSuffix,n=n||c;const a=(0,r.Wp)(),s=localStorage.getItem(l);let u,d=null;if(s)try{d=JSON.parse(s)}catch(e){i("Error parsing token",e)}if(d&&d?.expire>Date.now())return i("Using cached token"),d;u=a?await(0,o.Z)({path:"/wpcom/v2/sites/"+t+"/jetpack-openai-query/jwt",method:"POST"}):await(0,o.Z)({path:"/jetpack/v4/jetpack-ai-jwt?_cacheBuster="+Date.now(),credentials:"same-origin",headers:{"X-WP-Nonce":e},method:"POST"});const p={token:u.token,blogId:a?t:u.blog_id,expire:Date.now()+n};return i("Storing new token"),localStorage.setItem(l,JSON.stringify(p)),p}},35613:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.JP,LB:()=>r.LB,g:()=>r.g});var r=n(71197)},22999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(92213);const a={paragraph:e=>e.replaceAll("\n"," ")},s={emDelimiter:"_",headingStyle:"atx"},o={strikethrough:{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}}};class i{constructor({options:e={},rules:t={},keep:n=[],remove:a=[],fixes:i=[]}={}){this.fixes=i,this.turndownService=new r.Z({...s,...e}),this.turndownService.keep(n),this.turndownService.remove(a);const l={...o,...t};for(const e in l)this.turndownService.addRule(e,l[e])}render({content:e}){const t=this.turndownService.turndown(e);return this.fixes.reduce(((e,t)=>a[t](e)),t)}}},71197:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.Z,LB:()=>o,g:()=>i});var r=n(22999);const a=new(n(28603).Z),s=new r.Z,o=({content:e,rules:t,extension:n})=>a.render({content:e,rules:t,extension:n}),i=({content:e})=>s.render({content:e})},28603:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(95601);const a=e=>e.replaceAll("\x3c!-- wp:list-item --\x3e","").replaceAll("\x3c!-- /wp:list-item --\x3e","").replaceAll("\x3c!-- wp:list --\x3e","").replaceAll("\x3c!-- /wp:list --\x3e","").replaceAll("","\x3c!-- wp:list-item --\x3e ").replaceAll(" ","\x3c!-- /wp:list-item --\x3e").replaceAll("",'\x3c!-- wp:list {"ordered":true} --\x3e').replaceAll(" "," \x3c!-- /wp:list --\x3e").replaceAll("","\x3c!-- wp:list --\x3e"," \x3c!-- /wp:list --\x3e"),s={list:(e,t=!1)=>{const n=e.replace(/\s+/g,"
").replace(/<\/p>\s+<\/li>/g," ");return t?a(n):n},listItem:(e,t=!1)=>t?a(e.replace(/^<[ou]l>\s*/g,"").replace(/\s*<\/[ou]l>\s*$/g,"")):e,paragraph:(e,t=!1)=>t?e.replaceAll(/\s*<br \/>\s*/g," "):e},o={breaks:!0},i=["list"];class l{constructor(e=o){this.markdownConverter=new r.Z(e)}render({content:e,rules:t=i,extension:n=!1}){const r=this.markdownConverter.render(e);return t.reduce(((e,t)=>s[t](e,n)),r)}}},56694:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(60400),a=n(51128),s=n.n(a),o=n(42194),i=n(2890),l=n(16700);const c=s()("jetpack-ai-client:suggestions-event-source");class u extends EventTarget{constructor(e){super(),this.fullMessage="",this.fullFunctionCall={name:"",arguments:""},this.isPromptClear=!1,this.controller=new AbortController,this.initEventSource(e)}async initEventSource({url:e,question:t,token:n,options:a={}}){if(!n)try{c("Token was not provided, requesting one..."),n=(await(0,i.Z)()).token}catch(e){return void this.processErrorEvent(e)}const s={};if(Number.isInteger(parseInt(a.postId))&&(s.post_id=+a.postId),!e){const t=new URL("https://public-api.wordpress.com/wpcom/v2/jetpack-ai-query");a?.fromCache&&t.searchParams.append("stream_cache","true"),e=t.toString(),c("URL not provided, using default: %o",e)}Array.isArray(t)?s.messages=t:s.question=t,a?.feature?.length&&(c("Feature: %o",a.feature),s.feature=a.feature),a?.functions?.length&&(c("Functions: %o",a.functions),s.functions=a.functions),a?.model?.length&&(c("Model: %o",a.model),s.model=a.model),this.errorUnclearPromptTriggered=!1,await(0,r.L)(e,{openWhenHidden:!0,method:"POST",headers:{"Content-type":"application/json",Authorization:"Bearer "+n},body:JSON.stringify(s),onclose:()=>{c("Stream closed")},onerror:e=>{throw this.processErrorEvent(e),e},onmessage:e=>{this.processEvent(e)},onopen:async e=>{if(e.ok)return;let t;throw e.status>=400&&e.status<=500&&![413,422,429].includes(e.status)&&(c("Connection error: %o",e),t=l.co,this.dispatchEvent(new CustomEvent(l.co,{detail:e}))),503===e.status&&(t=l.$u,this.dispatchEvent(new CustomEvent(l.$u))),413===e.status&&(t=l.cv,this.dispatchEvent(new CustomEvent(l.cv))),422===e.status&&(t=l.q4,this.dispatchEvent(new CustomEvent(l.q4))),429===e.status&&(t=l.$L,this.dispatchEvent(new CustomEvent(l.$L))),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(t)})),new Error},signal:this.controller.signal})}checkForUnclearPrompt(){if(this.isPromptClear)return;const e=this.fullMessage.replace(/__|(\*\*)/g,"");if(e.startsWith("JETPACK_AI_ERROR")){if(this.errorUnclearPromptTriggered)return;this.errorUnclearPromptTriggered=!0,this.dispatchEvent(new CustomEvent(l.bC)),c("Unclear error prompt dispatched"),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.bC)}))}else"JETPACK_AI_ERROR".startsWith(e)?c(this.fullMessage):this.isPromptClear=!0}close(){this.controller.abort()}processEvent(e){if("[DONE]"===e.data){if(this.errorUnclearPromptTriggered)return;if(this.fullMessage.length)return this.dispatchEvent(new CustomEvent("done",{detail:this.fullMessage})),void c("Done: %o",this.fullMessage);if(this.fullFunctionCall.name.length)return this.dispatchEvent(new CustomEvent("function_done",{detail:this.fullFunctionCall})),void c("Done: %o",this.fullFunctionCall)}let t;try{t=JSON.parse(e.data)}catch(t){return void c("Error parsing JSON",e,t)}const{delta:n}=t?.choices?.[0]??{delta:{content:null,function_call:null}},r=n.content,a=n.function_call;r&&(this.fullMessage+=r,this.checkForUnclearPrompt(),this.isPromptClear&&(this.dispatchEvent(new CustomEvent("chunk",{detail:r})),c("suggestion: %o",this.fullMessage),this.dispatchEvent(new CustomEvent("suggestion",{detail:this.fullMessage})))),a&&(null!=a.name&&(this.fullFunctionCall.name+=a.name),null!=a.arguments&&(this.fullFunctionCall.arguments+=a.arguments),this.dispatchEvent(new CustomEvent("functionCallChunk",{detail:this.fullFunctionCall})))}processErrorEvent(e){c("onerror: %o",e),this.dispatchEvent(new CustomEvent(l.co,{detail:e})),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.co)}))}}},16700:(e,t,n)=>{"use strict";n.d(t,{$L:()=>s,$u:()=>a,Y:()=>r.Y,bC:()=>c,co:()=>l,cv:()=>i,q4:()=>o,vF:()=>u});var r=n(44696);const a="error_service_unavailable",s="error_quota_exceeded",o="error_moderation",i="error_context_too_large",l="error_network",c="error_unclear_prompt",u="error_response"},6975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51128);const a=n.n(r)()("dops:analytics");let s,o;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const i={initialize:function(e,t,n){i.setUser(e,t),i.setSuperProps(n),i.identifyUser()},setGoogleAnalyticsEnabled:function(e,t=null){this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){o={ID:e,username:t}},setSuperProps:function(e){s=e},assignSuperProps:function(e){s=Object.assign(s||{},e)},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Built stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){i.tracks.recordPageView(e),i.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,a,s,o){i.ga.recordPurchase(e,t,n,r,a,s,o)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(s&&(a("- Super Props: %o",s),t=Object.assign(t,s)),a('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):a('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};i.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){i.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){a("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};i.ga.initialized||(o&&(e={userId:"u-"+o.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),i.ga.initialized=!0)},recordPageView:function(e,t){i.ga.initialize(),a("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){i.ga.initialize();let s="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(s+=" [Option Label: "+n+"]"),void 0!==r&&(s+=" [Option Value: "+r+"]"),a(s),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,a,s,o){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:o}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:a,quantity:s}),window.ga("ecommerce:send")}},identifyUser:function(){o&&window._tkq.push(["identifyUser",o.ID,o.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}},l=i},64743:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(61132),a=n(96483);function s(e){class t extends Error{constructor(...t){super(...t),this.name=e}}return t}const o=s("JsonParseError"),i=s("JsonParseAfterRedirectError"),l=s("Api404Error"),c=s("Api404AfterRedirectError"),u=s("FetchNetworkError");const d=new function(e,t){let n=e,s=e,o={"X-WP-Nonce":t},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})},c=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setWpcomOriginApiUrl(e){s=e},setApiNonce(e){o={"X-WP-Nonce":e},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{c=e},registerSite:(e,t,a)=>{const s={registration_nonce:e,no_iframe:!0};return(0,r.jetpackConfigHas)("consumer_slug")&&(s.plugin_slug=(0,r.jetpackConfigGet)("consumer_slug")),null!==t&&(s.redirect_uri=t),a&&(s.from=a),g(`${n}jetpack/v4/connection/register`,l,{body:JSON.stringify(s)}).then(p).then(m)},fetchAuthorizationUrl:e=>d((0,a.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),i).then(p).then(m),fetchSiteConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchSiteConnectionStatus:()=>d(`${n}jetpack/v4/connection`,i).then(m),fetchSiteConnectionTest:()=>d(`${n}jetpack/v4/connection/test`,i).then(p).then(m),fetchUserConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchUserTrackingSettings:()=>d(`${n}jetpack/v4/tracking/settings`,i).then(p).then(m),updateUserTrackingSettings:e=>g(`${n}jetpack/v4/tracking/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),disconnectSite:()=>g(`${n}jetpack/v4/connection`,l,{body:JSON.stringify({isActive:!1})}).then(p).then(m),fetchConnectUrl:()=>d(`${n}jetpack/v4/connection/url`,i).then(p).then(m),unlinkUser:()=>g(`${n}jetpack/v4/connection/user`,l,{body:JSON.stringify({linked:!1})}).then(p).then(m),reconnect:()=>g(`${n}jetpack/v4/connection/reconnect`,l).then(p).then(m),fetchConnectedPlugins:()=>d(`${n}jetpack/v4/connection/plugins`,i).then(p).then(m),setHasSeenWCConnectionModal:()=>g(`${n}jetpack/v4/seen-wc-connection-modal`,l).then(p).then(m),fetchModules:()=>d(`${n}jetpack/v4/module/all`,i).then(p).then(m),fetchModule:e=>d(`${n}jetpack/v4/module/${e}`,i).then(p).then(m),activateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!0})}).then(p).then(m),deactivateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>g(`${n}jetpack/v4/module/${e}`,l,{body:JSON.stringify(t)}).then(p).then(m),updateSettings:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),getProtectCount:()=>d(`${n}jetpack/v4/module/protect/data`,i).then(p).then(m),resetOptions:e=>g(`${n}jetpack/v4/options/${e}`,l,{body:JSON.stringify({reset:!0})}).then(p).then(m),activateVaultPress:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(p).then(m),getVaultPressData:()=>d(`${n}jetpack/v4/module/vaultpress/data`,i).then(p).then(m),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify(r)}).then(p).then(m)},activateAkismet:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(p).then(m),getAkismetData:()=>d(`${n}jetpack/v4/module/akismet/data`,i).then(p).then(m),checkAkismetKey:()=>d(`${n}jetpack/v4/module/akismet/key/check`,i).then(p).then(m),checkAkismetKeyTyped:e=>g(`${n}jetpack/v4/module/akismet/key/check`,l,{body:JSON.stringify({api_key:e})}).then(p).then(m),fetchStatsData:e=>d(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),i).then(p).then(m).then(h),getPluginUpdates:()=>d(`${n}jetpack/v4/updates/plugins`,i).then(p).then(m),getPlans:()=>d(`${n}jetpack/v4/plans`,i).then(p).then(m),fetchSettings:()=>d(`${n}jetpack/v4/settings`,i).then(p).then(m),updateSetting:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSiteData:()=>d(`${n}jetpack/v4/site`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>d(`${n}jetpack/v4/site/features`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>d(`${n}jetpack/v4/site/products`,i).then(p).then(m),fetchSitePurchases:()=>d(`${n}jetpack/v4/site/purchases`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>d(`${n}jetpack/v4/site/benefits`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteDiscount:()=>d(`${n}jetpack/v4/site/discount`,i).then(p).then(m).then((e=>e.data)),fetchSetupQuestionnaire:()=>d(`${n}jetpack/v4/setup/questionnaire`,i).then(p).then(m),fetchRecommendationsData:()=>d(`${n}jetpack/v4/recommendations/data`,i).then(p).then(m),fetchRecommendationsProductSuggestions:()=>d(`${n}jetpack/v4/recommendations/product-suggestions`,i).then(p).then(m),fetchRecommendationsUpsell:()=>d(`${n}jetpack/v4/recommendations/upsell`,i).then(p).then(m),fetchRecommendationsConditional:()=>d(`${n}jetpack/v4/recommendations/conditional`,i).then(p).then(m),saveRecommendationsData:e=>g(`${n}jetpack/v4/recommendations/data`,l,{body:JSON.stringify({data:e})}).then(p),fetchProducts:()=>d(`${n}jetpack/v4/products`,i).then(p).then(m),fetchRewindStatus:()=>d(`${n}jetpack/v4/rewind`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>d(`${n}jetpack/v4/scan`,i).then(p).then(m).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>g(`${n}jetpack/v4/notice/${e}`,l,{body:JSON.stringify({dismissed:!0})}).then(p).then(m),fetchPluginsData:()=>d(`${n}jetpack/v4/plugins`,i).then(p).then(m),fetchIntroOffers:()=>d(`${n}jetpack/v4/intro-offers`,i).then(p).then(m),fetchVerifySiteGoogleStatus:e=>d(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,i).then(p).then(m),verifySiteGoogle:e=>g(`${n}jetpack/v4/verify-site/google`,l,{body:JSON.stringify({keyring_id:e})}).then(p).then(m),submitSurvey:e=>g(`${n}jetpack/v4/marketing/survey`,l,{body:JSON.stringify(e)}).then(p).then(m),saveSetupQuestionnaire:e=>g(`${n}jetpack/v4/setup/questionnaire`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicensingError:e=>g(`${n}jetpack/v4/licensing/error`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicenseKey:e=>g(`${n}jetpack/v4/licensing/set-license`,l,{body:JSON.stringify({license:e})}).then(p).then(m),getUserLicensesCounts:()=>d(`${n}jetpack/v4/licensing/user/counts`,i).then(p).then(m),getUserLicenses:()=>d(`${n}jetpack/v4/licensing/user/licenses`,i).then(p).then(m),updateLicensingActivationNoticeDismiss:e=>g(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,l,{body:JSON.stringify({last_detached_count:e})}).then(p).then(m),updateRecommendationsStep:e=>g(`${n}jetpack/v4/recommendations/step`,l,{body:JSON.stringify({step:e})}).then(p),confirmIDCSafeMode:()=>g(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,l).then(p),startIDCFresh:e=>g(`${n}jetpack/v4/identity-crisis/start-fresh`,l,{body:JSON.stringify({redirect_uri:e})}).then(p).then(m),migrateIDC:()=>g(`${n}jetpack/v4/identity-crisis/migrate`,l).then(p),attachLicenses:e=>g(`${n}jetpack/v4/licensing/attach-licenses`,l,{body:JSON.stringify({licenses:e})}).then(p).then(m),fetchSearchPlanInfo:()=>d(`${s}jetpack/v4/search/plan`,i).then(p).then(m),fetchSearchSettings:()=>d(`${s}jetpack/v4/search/settings`,i).then(p).then(m),updateSearchSettings:e=>g(`${s}jetpack/v4/search/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSearchStats:()=>d(`${s}jetpack/v4/search/stats`,i).then(p).then(m),fetchWafSettings:()=>d(`${n}jetpack/v4/waf`,i).then(p).then(m),updateWafSettings:e=>g(`${n}jetpack/v4/waf`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchWordAdsSettings:()=>d(`${n}jetpack/v4/wordads/settings`,i).then(p).then(m),updateWordAdsSettings:e=>g(`${n}jetpack/v4/wordads/settings`,l,{body:JSON.stringify(e)}),fetchSearchPricing:()=>d(`${s}jetpack/v4/search/pricing`,i).then(p).then(m),fetchMigrationStatus:()=>d(`${n}jetpack/v4/migration/status`,i).then(p).then(m),fetchBackupUndoEvent:()=>d(`${n}jetpack/v4/site/backup/undo-event`,i).then(p).then(m),fetchBackupPreflightStatus:()=>d(`${n}jetpack/v4/site/backup/preflight`,i).then(p).then(m)};function d(e,t){return fetch(c(e),t)}function g(e,t,n){return fetch(e,Object.assign({},t,n)).catch(A)}function h(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}Object.assign(this,u)};function p(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new c(e.redirected):new l})):e.json().catch((e=>g(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function m(e){return e.json().catch((t=>g(t,e.redirected,e.url)))}function g(e,t,n){throw t?new i(n):new o}function A(){throw new u}},90526:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(82674),a=n.n(r),s=n(55609),o=n(65736),i=n(61074),l=n(15381),c=n(65235),u=n.n(c),d=n(99196),p=n.n(d),m=n(62103);const __=o.__,g=(0,d.forwardRef)(((e,t)=>{const{children:n,variant:r="primary",size:o="normal",weight:c="bold",icon:d,iconSize:g,disabled:A,isDestructive:h,isLoading:E,isExternalLink:f,className:C,text:b,fullWidth:v,...k}=e,B=u()(m.Z.button,C,{[m.Z.normal]:"normal"===o,[m.Z.small]:"small"===o,[m.Z.icon]:Boolean(d),[m.Z.loading]:E,[m.Z.regular]:"regular"===c,[m.Z["full-width"]]:v,[m.Z["is-icon-button"]]:Boolean(d)&&!n});k.ref=t;const y="normal"===o?20:16,w=f&&p().createElement(p().Fragment,null,p().createElement(i.Z,{size:y,icon:l.Z,className:m.Z["external-icon"]}),p().createElement(s.VisuallyHidden,{as:"span"},/* translators: accessibility text */
__("(opens in a new tab)","jetpack"))),_=f?"_blank":void 0,I=n?.[0]&&null!==n[0]&&"components-tooltip"!==n?.[0]?.props?.className;return p().createElement(s.Button,a()({target:_,variant:r,className:u()(B,{"has-text":!!d&&I}),icon:f?void 0:d,iconSize:g,disabled:A,"aria-disabled":A,isDestructive:h,text:b},k),E&&p().createElement(s.Spinner,null),p().createElement("span",null,n),w)}));g.displayName="Button";const A=g},14203:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(82674),a=n.n(r),s=n(94333),o=n(69307),i=n(65736),l=n(90526),c=n(3396);const __=i.__,u=({buttonStyle:e="icon",textToCopy:t,onCopy:n,...r})=>{const[i,u]=(0,o.useState)(!1),d=(0,o.useRef)(),p=(0,s.useCopyToClipboard)(t,(()=>{d.current&&clearTimeout(d.current),u(!0),n?.(),d.current=setTimeout((()=>{u(!1),d.current=void 0}),3e3)}));(0,o.useEffect)((()=>()=>{d.current&&clearTimeout(d.current)}),[]);let m=null,g=null;"text"!==e&&(m=i?React.createElement(c.KM,null):React.createElement(c.Km,null));const A=__("Copy to clipboard","jetpack");return"icon"!==e&&(g=i?__("Copied!","jetpack"):A),React.createElement(l.Z,a()({"aria-label":A,icon:m,children:g,ref:p},r))}},60068:(e,t,n)=>{"use strict";n.d(t,{_:()=>s});var r=n(9818),a=n(53961);function s(){const e=(0,r.useDispatch)(a.store),t=(0,r.useSelect)((e=>e(a.store).getNotices()),[]);return{...e,createNotice:(t,n,r)=>e.createNotice(t,n,{type:"snackbar",...r}),createErrorNotice:(t,n)=>e.createErrorNotice(t,{type:"snackbar",...n}),createInfoNotice:(t,n)=>e.createInfoNotice(t,{type:"snackbar",...n}),createSuccessNotice:(t,n)=>e.createSuccessNotice(t,{type:"snackbar",...n}),createWarningNotice:(t,n)=>e.createWarningNotice(t,{type:"snackbar",...n}),getNotices:()=>t}}},67172:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(65736),a=n(65235),s=n.n(a),o=n(99196);n(53351);const __=r.__;class i extends o.Component{static defaultProps={"aria-hidden":"false",focusable:"true"};needsOffset(e,t){return["gridicons-arrow-left","gridicons-arrow-right","gridicons-calendar","gridicons-cart","gridicons-folder","gridicons-info","gridicons-info-outline","gridicons-posts","gridicons-star-outline","gridicons-star"].indexOf(e)>=0&&t%18==0}getSVGDescription(e){if("description"in this.props)return this.props.description;switch(e){default:return"";case"gridicons-audio":return __("Has audio.","jetpack");case"gridicons-arrow-left":return __("Arrow left","jetpack");case"gridicons-arrow-right":return __("Arrow right","jetpack");case"gridicons-calendar":return __("Is an event.","jetpack");case"gridicons-cart":return __("Is a product.","jetpack");case"chevron-down":return __("Show filters","jetpack");case"gridicons-comment":return __("Matching comment.","jetpack");case"gridicons-cross":return __("Close.","jetpack");case"gridicons-filter":return __("Toggle search filters.","jetpack");case"gridicons-folder":return __("Category","jetpack");case"gridicons-info":case"gridicons-info-outline":return __("Information.","jetpack");case"gridicons-image-multiple":return __("Has multiple images.","jetpack");case"gridicons-image":return __("Has an image.","jetpack");case"gridicons-page":return __("Page","jetpack");case"gridicons-post":return __("Post","jetpack");case"gridicons-jetpack-search":case"gridicons-search":return __("Magnifying Glass","jetpack");case"gridicons-tag":return __("Tag","jetpack");case"gridicons-video":return __("Has a video.","jetpack")}}renderIcon(e){switch(e){default:return null;case"gridicons-audio":return React.createElement("g",null,React.createElement("path",{d:"M8 4v10.184C7.686 14.072 7.353 14 7 14c-1.657 0-3 1.343-3 3s1.343 3 3 3 3-1.343 3-3V7h7v4.184c-.314-.112-.647-.184-1-.184-1.657 0-3 1.343-3 3s1.343 3 3 3 3-1.343 3-3V4H8z"}));case"gridicons-arrow-left":return React.createElement("g",null,React.createElement("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"}));case"gridicons-arrow-right":return React.createElement("g",null,React.createElement("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z"}));case"gridicons-block":return React.createElement("g",null,React.createElement("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12c0-4.418 3.582-8 8-8 1.848 0 3.545.633 4.9 1.686L5.686 16.9C4.633 15.545 4 13.848 4 12zm8 8c-1.848 0-3.546-.633-4.9-1.686L18.314 7.1C19.367 8.455 20 10.152 20 12c0 4.418-3.582 8-8 8z"}));case"gridicons-calendar":return React.createElement("g",null,React.createElement("path",{d:"M19 4h-1V2h-2v2H8V2H6v2H5c-1.105 0-2 .896-2 2v13c0 1.104.895 2 2 2h14c1.104 0 2-.896 2-2V6c0-1.104-.896-2-2-2zm0 15H5V8h14v11z"}));case"gridicons-cart":return React.createElement("g",null,React.createElement("path",{d:"M9 20c0 1.1-.9 2-2 2s-1.99-.9-1.99-2S5.9 18 7 18s2 .9 2 2zm8-2c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm.396-5c.937 0 1.75-.65 1.952-1.566L21 5H7V4c0-1.105-.895-2-2-2H3v2h2v11c0 1.105.895 2 2 2h12c0-1.105-.895-2-2-2H7v-2h10.396z"}));case"gridicons-checkmark":return React.createElement("g",null,React.createElement("path",{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658C17.823 3.39 15.075 2 12 2 6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-1.528-.353-2.97-.966-4.266L11 17.768z"}));case"gridicons-chevron-left":return React.createElement("g",null,React.createElement("path",{d:"M16.443 7.41L15.0399 6L9.06934 12L15.0399 18L16.443 16.59L11.8855 12L16.443 7.41Z"}));case"gridicons-chevron-right":return React.createElement("g",null,React.createElement("path",{d:"M10.2366 6L8.8335 7.41L13.391 12L8.8335 16.59L10.2366 18L16.2072 12L10.2366 6Z"}));case"gridicons-chevron-down":return React.createElement("g",null,React.createElement("path",{d:"M20 9l-8 8-8-8 1.414-1.414L12 14.172l6.586-6.586"}));case"gridicons-comment":return React.createElement("g",null,React.createElement("path",{d:"M3 6v9c0 1.105.895 2 2 2h9v5l5.325-3.804c1.05-.75 1.675-1.963 1.675-3.254V6c0-1.105-.895-2-2-2H5c-1.105 0-2 .895-2 2z"}));case"gridicons-computer":return React.createElement("g",null,React.createElement("path",{d:"M20 2H4c-1.104 0-2 .896-2 2v12c0 1.104.896 2 2 2h6v2H7v2h10v-2h-3v-2h6c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm0 14H4V4h16v12z"}));case"gridicons-cross":return React.createElement("g",null,React.createElement("path",{d:"M18.36 19.78L12 13.41l-6.36 6.37-1.42-1.42L10.59 12 4.22 5.64l1.42-1.42L12 10.59l6.36-6.36 1.41 1.41L13.41 12l6.36 6.36z"}));case"gridicons-filter":return React.createElement("g",null,React.createElement("path",{d:"M10 19h4v-2h-4v2zm-4-6h12v-2H6v2zM3 5v2h18V5H3z"}));case"gridicons-folder":return React.createElement("g",null,React.createElement("path",{d:"M18 19H6c-1.1 0-2-.9-2-2V7c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2h7c1.1 0 2 .9 2 2v8c0 1.1-.9 2-2 2z"}));case"gridicons-image":return React.createElement("g",null,React.createElement("path",{d:"M13 9.5c0-.828.672-1.5 1.5-1.5s1.5.672 1.5 1.5-.672 1.5-1.5 1.5-1.5-.672-1.5-1.5zM22 6v12c0 1.105-.895 2-2 2H4c-1.105 0-2-.895-2-2V6c0-1.105.895-2 2-2h16c1.105 0 2 .895 2 2zm-2 0H4v7.444L8 9l5.895 6.55 1.587-1.85c.798-.932 2.24-.932 3.037 0L20 15.426V6z"}));case"gridicons-image-multiple":return React.createElement("g",null,React.createElement("path",{d:"M15 7.5c0-.828.672-1.5 1.5-1.5s1.5.672 1.5 1.5S17.328 9 16.5 9 15 8.328 15 7.5zM4 20h14c0 1.105-.895 2-2 2H4c-1.1 0-2-.9-2-2V8c0-1.105.895-2 2-2v14zM22 4v12c0 1.105-.895 2-2 2H8c-1.105 0-2-.895-2-2V4c0-1.105.895-2 2-2h12c1.105 0 2 .895 2 2zM8 4v6.333L11 7l4.855 5.395.656-.73c.796-.886 2.183-.886 2.977 0l.513.57V4H8z"}));case"gridicons-info":return React.createElement("g",null,React.createElement("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"}));case"gridicons-info-outline":return React.createElement("g",null,React.createElement("path",{d:"M13 9h-2V7h2v2zm0 2h-2v6h2v-6zm-1-7c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8m0-2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2z"}));case"gridicons-jetpack-search":return React.createElement("g",null,React.createElement("path",{d:"M0 9.257C0 4.15 4.151 0 9.257 0c5.105 0 9.256 4.151 9.256 9.257a9.218 9.218 0 01-2.251 6.045l.034.033h1.053L24 22.01l-1.986 1.989-6.664-6.662v-1.055l-.033-.033a9.218 9.218 0 01-6.06 2.264C4.15 18.513 0 14.362 0 9.257zm4.169 1.537h4.61V1.82l-4.61 8.973zm5.547-3.092v8.974l4.61-8.974h-4.61z"}));case"gridicons-phone":return React.createElement("g",null,React.createElement("path",{d:"M16 2H8c-1.104 0-2 .896-2 2v16c0 1.104.896 2 2 2h8c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm-3 19h-2v-1h2v1zm3-2H8V5h8v14z"}));case"gridicons-pages":return React.createElement("g",null,React.createElement("path",{d:"M16 8H8V6h8v2zm0 2H8v2h8v-2zm4-6v12l-6 6H6c-1.105 0-2-.895-2-2V4c0-1.105.895-2 2-2h12c1.105 0 2 .895 2 2zm-2 10V4H6v16h6v-4c0-1.105.895-2 2-2h4z"}));case"gridicons-posts":return React.createElement("g",null,React.createElement("path",{d:"M16 19H3v-2h13v2zm5-10H3v2h18V9zM3 5v2h11V5H3zm14 0v2h4V5h-4zm-6 8v2h10v-2H11zm-8 0v2h5v-2H3z"}));case"gridicons-search":return React.createElement("g",null,React.createElement("path",{d:"M21 19l-5.154-5.154C16.574 12.742 17 11.42 17 10c0-3.866-3.134-7-7-7s-7 3.134-7 7 3.134 7 7 7c1.42 0 2.742-.426 3.846-1.154L19 21l2-2zM5 10c0-2.757 2.243-5 5-5s5 2.243 5 5-2.243 5-5 5-5-2.243-5-5z"}));case"gridicons-star-outline":return React.createElement("g",null,React.createElement("path",{d:"M12 6.308l1.176 3.167.347.936.997.042 3.374.14-2.647 2.09-.784.62.27.963.91 3.25-2.813-1.872-.83-.553-.83.552-2.814 1.87.91-3.248.27-.962-.783-.62-2.648-2.092 3.374-.14.996-.04.347-.936L12 6.308M12 2L9.418 8.953 2 9.257l5.822 4.602L5.82 21 12 16.89 18.18 21l-2.002-7.14L22 9.256l-7.418-.305L12 2z"}));case"gridicons-star":return React.createElement("g",null,React.createElement("path",{d:"M12 2l2.582 6.953L22 9.257l-5.822 4.602L18.18 21 12 16.89 5.82 21l2.002-7.14L2 9.256l7.418-.304"}));case"gridicons-tag":return React.createElement("g",null,React.createElement("path",{d:"M20 2.007h-7.087c-.53 0-1.04.21-1.414.586L2.592 11.5c-.78.78-.78 2.046 0 2.827l7.086 7.086c.78.78 2.046.78 2.827 0l8.906-8.906c.376-.374.587-.883.587-1.413V4.007c0-1.105-.895-2-2-2zM17.007 9c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2z"}));case"gridicons-video":return React.createElement("g",null,React.createElement("path",{d:"M20 4v2h-2V4H6v2H4V4c-1.105 0-2 .895-2 2v12c0 1.105.895 2 2 2v-2h2v2h12v-2h2v2c1.105 0 2-.895 2-2V6c0-1.105-.895-2-2-2zM6 16H4v-3h2v3zm0-5H4V8h2v3zm4 4V9l4.5 3-4.5 3zm10 1h-2v-3h2v3zm0-5h-2V8h2v3z"}));case"gridicons-lock":return React.createElement(React.Fragment,null,React.createElement("g",{id:"lock"},React.createElement("path",{d:"M18,8h-1V7c0-2.757-2.243-5-5-5S7,4.243,7,7v1H6c-1.105,0-2,0.895-2,2v10c0,1.105,0.895,2,2,2h12c1.105,0,2-0.895,2-2V10 C20,8.895,19.105,8,18,8z M9,7c0-1.654,1.346-3,3-3s3,1.346,3,3v1H9V7z M13,15.723V18h-2v-2.277c-0.595-0.346-1-0.984-1-1.723 c0-1.105,0.895-2,2-2s2,0.895,2,2C14,14.738,13.595,15.376,13,15.723z"})),React.createElement("g",{id:"Layer_1"}));case"gridicons-external":return React.createElement("g",null,React.createElement("path",{d:"M19 13v6c0 1.105-.895 2-2 2H5c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h6v2H5v12h12v-6h2zM13 3v2h4.586l-7.793 7.793 1.414 1.414L19 6.414V11h2V3h-8z"}))}}render(){const{size:e=24,className:t=""}=this.props,n=this.props.height||e,r=this.props.width||e,a=this.props.style||{height:n,width:r},o="gridicons-"+this.props.icon,i=s()("gridicon",o,t,{"needs-offset":this.needsOffset(o,e)}),l=this.getSVGDescription(o);return React.createElement("svg",{className:i,focusable:this.props.focusable,height:n,onClick:this.props.onClick,style:a,viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg","aria-hidden":this.props["aria-hidden"]},l?React.createElement("desc",null,l):null,this.renderIcon(o))}}const l=i},69665:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(55609),a=n(65235),s=n.n(a),o=n(99196),i=n.n(o),l=n(90526),c=n(67172);n(72098);const u=e=>({"top-end":"top left",top:"top center","top-start":"top right","bottom-end":"bottom left",bottom:"bottom center","bottom-start":"bottom right"}[e]),d=({className:e="",iconClassName:t="",placement:n="bottom-end",animate:a=!0,iconCode:d="info-outline",iconSize:p=18,offset:m=10,title:g,children:A,popoverAnchorStyle:h="icon",forceShow:E=!1,wide:f=!1,inline:C=!0,shift:b=!1})=>{const[v,k]=(0,o.useState)(!1),B=(0,o.useCallback)((()=>k(!1)),[k]),y=(0,o.useCallback)((e=>{e.preventDefault(),k(!v)}),[v,k]),w={position:u(n),placement:n,animate:a,noArrow:!1,resize:!1,flip:!1,offset:m,focusOnMount:"container",onClose:B,className:"icon-tooltip-container",inline:C,shift:b},_="wrapper"===h,I=s()("icon-tooltip-wrapper",e),j={left:_?0:-(62-p/2)+"px"},x=_&&E;return i().createElement("div",{className:I,"data-testid":"icon-tooltip_wrapper"},!_&&i().createElement(l.Z,{variant:"link",onMouseDown:y},i().createElement(c.Z,{className:t,icon:d,size:p})),i().createElement("div",{className:s()("icon-tooltip-helper",{"is-wide":f}),style:j},(x||v)&&i().createElement(r.Popover,w,i().createElement("div",null,g&&i().createElement("div",{className:"icon-tooltip-title"},g),i().createElement("div",{className:"icon-tooltip-content"},A)))))}},3396:(e,t,n)=>{"use strict";n.d(t,{KM:()=>d,Km:()=>p,av:()=>m});var r=n(82674),a=n.n(r),s=n(55609),o=n(65235),i=n.n(o),l=n(56286),c=n(45460);const u=({className:e,size:t=24,viewBox:n="0 0 24 24",opacity:r=1,color:o="#2C3338",children:l})=>{const u={className:i()(c.Z.iconWrapper,e),width:t,height:t,viewBox:n,opacity:r,fill:void 0};return o&&(u.fill=o),React.createElement(s.SVG,a()({},u,{fillRule:"evenodd",clipRule:"evenodd",xmlns:"http://www.w3.org/2000/svg"}),React.createElement(s.G,{opacity:r},l))},d=({size:e,className:t=c.Z["checkmark-icon"],color:n})=>React.createElement(u,{className:t,size:e,color:n},React.createElement(s.Path,{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658C17.823 3.39 15.075 2 12 2 6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-1.528-.353-2.97-.966-4.266L11 17.768z"})),p=({size:e,className:t=c.Z["clipboard-icon"],color:n})=>React.createElement(u,{className:t,size:e,color:n},React.createElement(s.Path,{d:"M5.625 5.5H15.375C15.444 5.5 15.5 5.55596 15.5 5.625V15.375C15.5 15.444 15.444 15.5 15.375 15.5H5.625C5.55596 15.5 5.5 15.444 5.5 15.375V5.625C5.5 5.55596 5.55596 5.5 5.625 5.5ZM4 5.625C4 4.72754 4.72754 4 5.625 4H15.375C16.2725 4 17 4.72754 17 5.625V10V15.375C17 16.2725 16.2725 17 15.375 17C15.375 17 6.52246 17 5.625 17C4.72754 17 4 16.2725 4 15.375V5.625ZM18.5 17.2812V8.28125H20V17.2812C20 18.7995 18.7704 20 17.2511 20H6.25V18.5H17.2511C17.9409 18.5 18.5 17.9721 18.5 17.2812Z"}));const m=({serviceName:e,className:t,iconSize:n})=>React.createElement(l.ZP,{className:i()(c.Z.socialIcon,c.Z[e],t),icon:e,size:n||24})},78868:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(82674),a=n.n(r),s=n(65736),o=n(65235),i=n.n(o),l=n(99196),c=n.n(l);const __=s.__,u=({logoColor:e="#069e08",showText:t=!0,className:n,height:r=32,...s})=>{const o=t?"0 0 118 32":"0 0 32 32";return c().createElement("svg",a()({xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:o,className:i()("jetpack-logo",n),"aria-labelledby":"jetpack-logo-title",height:r},s,{role:"img"}),c().createElement("title",{id:"jetpack-logo-title"},__("Jetpack Logo","jetpack")),c().createElement("path",{fill:e,d:"M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"}),t&&c().createElement(c().Fragment,null,c().createElement("path",{d:"M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z"}),c().createElement("path",{d:"M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z"}),c().createElement("path",{d:"M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z"}),c().createElement("path",{d:"M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z"}),c().createElement("path",{d:"M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z"}),c().createElement("path",{d:"M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z"}),c().createElement("path",{d:"M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z"})))}},32054:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(94333),a=n(49710);const s=["sm","md","lg"],o=(e,t)=>{const n=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t],[i,l,c]=s,u={sm:(0,r.useMediaQuery)(a.Z[i]),md:(0,r.useMediaQuery)(a.Z[l]),lg:(0,r.useMediaQuery)(a.Z[c])};return n.map(((e,t)=>{const n=o[t];return n?((e,t,n)=>{const r=s.indexOf(e),a=r+1,o=t.includes("=");let i=[];return t.startsWith("<")&&(i=s.slice(0,o?a:r)),t.startsWith(">")&&(i=s.slice(o?r:a)),i?.length?i.some((e=>n[e])):n[e]})(e,n,u):u[e]}))}},22636:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(65235),a=n.n(r),s=n(99196),o=n.n(s),i=n(46409);const l=({children:e=null,width:t=null,height:n=null,className:r=""})=>o().createElement("div",{className:a()(i.Z.placeholder,r),style:{width:t,height:n}},e)},52947:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(98709);const a=(e,t={})=>{const n=(0,r.X)();return new Intl.NumberFormat(n,t).format(e)}},49777:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(28918);const a=({value:e="https://jetpack.com",bgColor:t,fgColor:n,level:a,includeMargin:s,imageSettings:o,renderAs:i="canvas",size:l=248})=>React.createElement(r.ZP,{value:e,size:l,bgColor:t,fgColor:n,level:a,includeMargin:s,imageSettings:o,renderAs:i})},43521:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(65736),a=n(65235),s=n.n(a),o=n(99196),i=n.n(o),l=n(52947);n(34086);const __=r.__,c=({totalCount:e,items:t=[],showLegendLabelBeforeCount:n=!1,sortByCount:r,className:a,tableCaption:c,legendTitle:u,recordTypeLabel:d,recordCountLabel:p})=>{const m=(0,o.useMemo)((()=>e||t.reduce(((e,{count:t})=>e+t),0)),[t,e]),g=(0,o.useMemo)((()=>r?[...t].sort(((e,t)=>"ascending"===r?e.count-t.count:t.count-e.count)):t),[t,r]);return i().createElement("div",{className:s()("record-meter-bar",a)},i().createElement("div",{className:"record-meter-bar__items","aria-hidden":"true"},g.map((({count:e,label:t,backgroundColor:n})=>{const r=(e/m*100).toPrecision(2);return i().createElement("div",{key:t,style:{backgroundColor:n,flexBasis:`${r}%`}})}))),i().createElement("div",{className:"record-meter-bar__legend","aria-hidden":"true"},u&&i().createElement("div",{className:"record-meter-bar__legend--title"},u),i().createElement("ul",{className:"record-meter-bar__legend--items"},g.map((({count:e,label:t,backgroundColor:r})=>{const a=(0,l.Z)(e);return i().createElement("li",{key:t,className:"record-meter-bar__legend--item"},i().createElement("div",{className:"record-meter-bar__legend--item-circle",style:{backgroundColor:r}}),!n&&i().createElement("span",null,i().createElement("span",{className:"record-meter-bar__legend--item-count"},a),i().createElement("span",{className:"record-meter-bar__legend--item-label"},t)),n&&i().createElement("span",null,i().createElement("span",{className:"record-meter-bar__legend--item-label record-meter-bar__legend--item-label-first"},t),i().createElement("span",{className:"record-meter-bar__legend--item-count"},"(",a,")")))})))),i().createElement("table",{className:"screen-reader-text"},i().createElement("caption",null,c||__("Summary of the records","jetpack")),i().createElement("tbody",null,i().createElement("tr",null,i().createElement("th",{scope:"col"},d||__("Record type","jetpack")),i().createElement("th",{scope:"col"},p||__("Record count","jetpack"))),g.map((({label:e,count:t})=>i().createElement("tr",{key:e},i().createElement("td",null,e),i().createElement("td",null,t)))))))}},45033:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(25162),a=n.n(r),s=n(99196),o=n.n(s);n(48026);const i=({color:e="#FFFFFF",className:t="",size:n=20})=>{const r=t+" jp-components-spinner",a={width:n,height:n,fontSize:n,borderTopColor:e},s={borderTopColor:e,borderRightColor:e};return o().createElement("div",{className:r},o().createElement("div",{className:"jp-components-spinner__outer",style:a},o().createElement("div",{className:"jp-components-spinner__inner",style:s})))};i.propTypes={color:a().string,className:a().string,size:a().number};const l=i},66017:(e,t,n)=>{"use strict";n.d(t,{h:()=>r,s:()=>a});const r={"headline-medium":"h1","headline-small":"h2","headline-small-regular":"h2","title-medium":"h3","title-medium-semi-bold":"h3","title-small":"h4",body:"p","body-small":"p","body-extra-small":"p","body-extra-small-bold":"p",label:"p"},a=["mt","mr","mb","ml","mx","my","m","pt","pr","pb","pl","px","py","p"]},45106:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>p});var r=n(82674),a=n.n(r),s=n(65235),o=n.n(s),i=n(99196),l=n.n(i),c=n(66017),u=n(85837);const d=(0,i.forwardRef)((({variant:e="body",children:t,component:n,className:r,...s},d)=>{const p=n||c.h[e]||"span",m=(0,i.useMemo)((()=>c.s.reduce(((e,t)=>(void 0!==s[t]&&(e+=u.Z[`${t}-${s[t]}`]+" ",delete s[t]),e)),"")),[s]);return s.ref=d,l().createElement(p,a()({className:o()(u.Z.reset,u.Z[e],r,m)},s),t)}));d.displayName="Text";const p=d},88275:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>p});var r=n(99196),a=n.n(r),s=n(93468);const o={"--font-headline-medium":"48px","--font-headline-small":"36px","--font-title-medium":"24px","--font-title-small":"20px","--font-body":"16px","--font-body-small":"14px","--font-body-extra-small":"12px","--font-title-large":"var(--font-headline-small)","--font-label":"var(--font-body-extra-small)"},i={"--jp-black":"#000000","--jp-black-80":"#2c3338","--jp-white":"#ffffff","--jp-white-off":"#f9f9f6","--jp-gray":"#dcdcde","--jp-gray-0":"#F6F7F7","--jp-gray-5":"var(--jp-gray)","--jp-gray-10":"#C3C4C7","--jp-gray-20":"#A7AAAD","--jp-gray-40":"#787C82","--jp-gray-50":"#646970","--jp-gray-60":"#50575E","--jp-gray-70":"#3C434A","--jp-gray-80":"#2C3338","--jp-gray-90":"#1d2327","--jp-gray-off":"#e2e2df","--jp-red-0":"#F7EBEC","--jp-red-5":"#FACFD2","--jp-red-40":"#E65054","--jp-red-50":"#D63638","--jp-red-60":"#B32D2E","--jp-red-70":"#8A2424","--jp-red-80":"#691C1C","--jp-red":"#d63639","--jp-yellow-5":"#F5E6B3","--jp-yellow-10":"#F2CF75","--jp-yellow-20":"#F0C930","--jp-yellow-30":"#DEB100","--jp-yellow-40":"#C08C00","--jp-yellow-50":"#9D6E00","--jp-yellow-60":"#7D5600","--jp-blue-20":"#68B3E8","--jp-blue-40":"#1689DB","--jp-pink":"#C9356E","--jp-green-0":"#f0f2eb","--jp-green-5":"#d0e6b8","--jp-green-10":"#9dd977","--jp-green-20":"#64ca43","--jp-green-30":"#2fb41f","--jp-green-40":"#069e08","--jp-green-50":"#008710","--jp-green-60":"#007117","--jp-green-70":"#005b18","--jp-green-80":"#004515","--jp-green-90":"#003010","--jp-green-100":"#001c09","--jp-green":"#069e08","--jp-green-primary":"var( --jp-green-40 )","--jp-green-secondary":"var( --jp-green-30 )"},l={"--jp-border-radius":"4px","--jp-menu-border-height":"1px","--jp-underline-thickness":"2px"},c={"--spacing-base":"8px"},u={},d=(e,t,n)=>{const r={...o,...i,...l,...c};for(const t in r)e.style.setProperty(t,r[t]);n&&e.classList.add(s.Z.global),t&&(u[t]={provided:!0,root:e})},p=({children:e=null,targetDom:t,id:n,withGlobalStyles:s=!0})=>{const o=(0,r.useRef)(),i=u?.[n]?.provided;return(0,r.useLayoutEffect)((()=>{if(!i)return t?d(t,n,s):void(o?.current&&d(o.current,n,s))}),[t,o,i,n,s]),t?a().createElement(a().Fragment,null,e):a().createElement("div",{ref:o},e)}},98709:(e,t,n)=>{"use strict";n.d(t,{X:()=>a});var r=n(69771);const a=()=>{const{l10n:{locale:e}}=(0,r.getSettings)();if(e)return(e=>{const t=e.match(/^([a-z]{2,3})(_[a-z]{2}|_[a-z][a-z0-9]{4,7})?(?:_.*)?$/i);return t?`${t[1]}${t[2]?t[2]:""}`.replace("_","-"):"en-US"})(e);return window?.window?.navigator?.language??"en-US"}},6895:(e,t,n)=>{"use strict";function r(e,t={}){const n={};let r;if("undefined"!=typeof window&&(r=window?.JP_CONNECTION_INITIAL_STATE?.calypsoEnv),0===e.search("https://")){const t=new URL(e);e=`https://${t.host}${t.pathname}`,n.url=encodeURIComponent(e)}else n.source=encodeURIComponent(e);for(const e in t)n[e]=encodeURIComponent(t[e]);!Object.keys(n).includes("site")&&"undefined"!=typeof jetpack_redirects&&jetpack_redirects.hasOwnProperty("currentSiteRawUrl")&&(n.site=jetpack_redirects.currentBlogID??jetpack_redirects.currentSiteRawUrl),r&&(n.calypso_env=r);return"https://jetpack.com/redirect/?"+Object.keys(n).map((e=>e+"="+n[e])).join("&")}n.d(t,{Z:()=>r})},61132:(e,t,n)=>{let r={};try{r=n(92787)}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),r={missingConfig:!0}}const a=e=>r.hasOwnProperty(e);e.exports={jetpackConfigHas:a,jetpackConfigGet:e=>{if(!a(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return r[e]}}},31294:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(64743),a=n(9818),s=n(99196),o=n(80428);const i=window?.JP_CONNECTION_INITIAL_STATE?window.JP_CONNECTION_INITIAL_STATE:{},l=({registrationNonce:e=i.registrationNonce,apiRoot:t=i.apiRoot,apiNonce:n=i.apiNonce,redirectUri:l,autoTrigger:c,from:u,skipUserConnection:d}={})=>{const{registerSite:p,connectUser:m,refreshConnectedPlugins:g}=(0,a.useDispatch)(o.t),A=(0,a.useSelect)((e=>e(o.t).getRegistrationError())),{siteIsRegistering:h,userIsConnecting:E,userConnectionData:f,connectedPlugins:C,connectionErrors:b,isRegistered:v,isUserConnected:k,hasConnectedOwner:B,isOfflineMode:y}=(0,a.useSelect)((e=>({siteIsRegistering:e(o.t).getSiteIsRegistering(),userIsConnecting:e(o.t).getUserIsConnecting(),userConnectionData:e(o.t).getUserConnectionData(),connectedPlugins:e(o.t).getConnectedPlugins(),connectionErrors:e(o.t).getConnectionErrors(),isOfflineMode:e(o.t).getIsOfflineMode(),...e(o.t).getConnectionStatus()}))),w=()=>d?l?(window.location=l,Promise.resolve(l)):Promise.resolve():m({from:u,redirectUri:l}),_=t=>(t&&t.preventDefault(),v?w():p({registrationNonce:e,redirectUri:l,from:u}).then((()=>w())));return(0,s.useEffect)((()=>{r.ZP.setApiRoot(t),r.ZP.setApiNonce(n)}),[t,n]),(0,s.useEffect)((()=>{!c||h||E||_()}),[]),{handleRegisterSite:_,handleConnectUser:w,refreshConnectedPlugins:g,isRegistered:v,isUserConnected:k,siteIsRegistering:h,userIsConnecting:E,registrationError:A,userConnectionData:f,hasConnectedOwner:B,connectedPlugins:C,connectionErrors:b,isOfflineMode:y}}},27523:(e,t,n)=>{"use strict";n.d(t,{LI:()=>s,N4:()=>i,Qo:()=>d,T1:()=>c,TS:()=>u,ZP:()=>k,b5:()=>m,i6:()=>a,qJ:()=>g,qV:()=>l,r7:()=>o,wQ:()=>p});var r=n(64743);const a="SET_CONNECTION_STATUS",s="SET_CONNECTION_STATUS_IS_FETCHING",o="SET_SITE_IS_REGISTERING",i="SET_USER_IS_CONNECTING",l="SET_REGISTRATION_ERROR",c="CLEAR_REGISTRATION_ERROR",u="SET_AUTHORIZATION_URL",d="DISCONNECT_USER_SUCCESS",p="SET_CONNECTED_PLUGINS",m="SET_CONNECTION_ERRORS",g="SET_IS_OFFLINE_MODE",A=e=>({type:a,connectionStatus:e}),h=e=>({type:o,isRegistering:e}),E=e=>({type:i,isConnecting:e}),f=e=>({type:l,registrationError:e}),C=()=>({type:c}),b=e=>({type:u,authorizationUrl:e}),v=e=>({type:p,connectedPlugins:e});const k={setConnectionStatus:A,setConnectionStatusIsFetching:e=>({type:s,isFetching:e}),fetchConnectionStatus:()=>({type:"FETCH_CONNECTION_STATUS"}),fetchAuthorizationUrl:e=>({type:"FETCH_AUTHORIZATION_URL",redirectUri:e}),setSiteIsRegistering:h,setUserIsConnecting:E,setRegistrationError:f,clearRegistrationError:C,setAuthorizationUrl:b,registerSite:function*({registrationNonce:e,redirectUri:t,from:n=""}){yield C(),yield h(!0);try{const r=yield{type:"REGISTER_SITE",registrationNonce:e,redirectUri:t,from:n};return yield A({isRegistered:!0}),yield b(r.authorizeUrl),yield h(!1),Promise.resolve(r)}catch(e){return yield f(e),yield h(!1),Promise.reject(e)}},connectUser:function*({from:e,redirectFunc:t,redirectUri:n}={}){yield E(!0),yield{type:"CONNECT_USER",from:e,redirectFunc:t,redirectUri:n}},disconnectUserSuccess:()=>({type:d}),setConnectedPlugins:v,refreshConnectedPlugins:()=>async({dispatch:e})=>await new Promise((t=>r.ZP.fetchConnectedPlugins().then((n=>{e(v(n)),t(n)})))),setConnectionErrors:e=>({type:m,connectionErrors:e}),setIsOfflineMode:e=>({type:g,isOfflineMode:e})}},31432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(64743),a=n(9818),s=n(27057);const o={FETCH_AUTHORIZATION_URL:({redirectUri:e})=>r.ZP.fetchAuthorizationUrl(e),REGISTER_SITE:({registrationNonce:e,redirectUri:t,from:n})=>r.ZP.registerSite(e,t,n),CONNECT_USER:(0,a.createRegistryControl)((({resolveSelect:e})=>({from:t,redirectFunc:n,redirectUri:r}={})=>new Promise(((a,o)=>{e(s.Z).getAuthorizationUrl(r).then((e=>{const r=n||(e=>window.location.assign(e)),s=new URL(e);t&&s.searchParams.set("from",encodeURIComponent(t));const o=s.toString();r(o),a(o)})).catch((e=>{o(e)}))}))))}},41479:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818),a=n(27523);const s=(0,r.combineReducers)({connectionStatus:(e={},t)=>{switch(t.type){case a.i6:return{...e,...t.connectionStatus};case a.Qo:return{...e,isUserConnected:!1}}return e},connectionStatusIsFetching:(e=!1,t)=>t.type===a.LI?t.isFetching:e,siteIsRegistering:(e=!1,t)=>t.type===a.r7?t.isRegistering:e,userIsConnecting:(e=!1,t)=>t.type===a.N4?t.isConnecting:e,registrationError:(e,t)=>{switch(t.type){case a.T1:return!1;case a.qV:return t.registrationError;default:return e}},authorizationUrl:(e,t)=>t.type===a.TS?t.authorizationUrl:e,userConnectionData:(e,t)=>(t.type,e),connectedPlugins:(e={},t)=>t.type===a.wQ?t.connectedPlugins:e,connectionErrors:(e={},t)=>t.type===a.b5?t.connectionErrors:e,isOfflineMode:(e=!1,t)=>t.type===a.qJ?t.isConnecting:e})},77728:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9818),a=n(27523),s=n(27057);const o={...{getAuthorizationUrl:{isFulfilled:(e,...t)=>{const n=Boolean(e.authorizationUrl),a=(0,r.select)(s.Z).hasFinishedResolution("getAuthorizationUrl",t);return n&&!a&&(0,r.dispatch)(s.Z).finishResolution("getAuthorizationUrl",t),n},*fulfill(e){const t=yield a.ZP.fetchAuthorizationUrl(e);yield a.ZP.setAuthorizationUrl(t.authorizeUrl)}}}}},82725:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r={...{getConnectionStatus:e=>e.connectionStatus||{},getConnectionStatusIsFetching:()=>!1,getSiteIsRegistering:e=>e.siteIsRegistering||!1,getUserIsConnecting:e=>e.userIsConnecting||!1,getRegistrationError:e=>e.registrationError||!1,getAuthorizationUrl:e=>e.authorizationUrl||!1,getUserConnectionData:e=>e.userConnectionData||!1,getConnectedPlugins:e=>e.connectedPlugins||[],getConnectionErrors:e=>e.connectionErrors||[],getIsOfflineMode:e=>e.isOfflineMode||!1,getWpcomUser:e=>e?.userConnectionData?.currentUser?.wpcomUser,getBlogId:e=>e?.userConnectionData?.currentUser?.blogId}}},13535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818);class a{static store=null;static mayBeInit(e,t){null===a.store&&(a.store=(0,r.createReduxStore)(e,t),(0,r.register)(a.store))}}const s=a},27057:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r="jetpack-connection"},80428:(e,t,n)=>{"use strict";n.d(t,{t:()=>c.Z});var r=n(27523),a=n(31432),s=n(41479),o=n(77728),i=n(82725),l=n(13535),c=n(27057);const u=window.JP_CONNECTION_INITIAL_STATE;u||console.error("Jetpack Connection package: Initial state is missing. Check documentation to see how to use the Connection composer package to set up the initial state."),l.Z.mayBeInit(c.Z,{__experimentalUseThunks:!0,reducer:s.Z,actions:r.ZP,selectors:i.Z,resolvers:o.Z,controls:a.Z,initialState:u||{}})},81050:(e,t,n)=>{"use strict";n.d(t,{PostPublishManualSharing:()=>l.Z,PostPublishReviewPrompt:()=>i.Z,PublicizePanel:()=>o.Z,SocialImageGeneratorPanel:()=>s.Z,SocialPreviewsModal:()=>r.Z,SocialPreviewsPanel:()=>a.Z,usePublicizeConfig:()=>u.Z,useSocialMediaConnections:()=>c.Z,useSyncPostDataToStore:()=>p.N});n(23177),n(4277),n(49021),n(84703);var r=n(8454),a=n(74140),s=n(54005),o=(n(8350),n(76848),n(92116),n(79631),n(8714)),i=(n(19649),n(52403)),l=n(91750),c=(n(77106),n(75674),n(37568)),u=(n(48751),n(14085)),d=(n(45579),n(75323),n(42032));n.o(d,"useSyncPostDataToStore")&&n.d(t,{useSyncPostDataToStore:function(){return d.useSyncPostDataToStore}});n(91474);var p=n(19890);n(32637),n(86419),n(34431),n(71806),n(22917),n(95766)},92116:(e,t,n)=>{"use strict";n(9818),n(69307),n(99196),n(23177)},85761:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(3396),a=n(69307),s=n(65235),o=n.n(s),i=n(25162),l=n.n(i);const c=e=>{const{checked:t,serviceName:n,label:s,onClick:i,profilePicture:l}=e,[c,u]=(0,a.useState)(!!l),d=(0,a.useCallback)((()=>u(!1)),[]),p=(0,a.useCallback)((e=>{13===e.keyCode&&i()}),[i]);return React.createElement("div",{onClick:i,onKeyDown:p,role:"switch","aria-checked":t,tabIndex:"0",className:o()("components-connection-icon",{"components-connection-icon__picture":c})},c&&React.createElement("img",{src:l,alt:s,onError:d}),React.createElement(r.av,{alt:s,serviceName:"instagram-business"===n?"instagram":"twitter"===n?"x":n,className:"jetpack-publicize-gutenberg-social-icon"}))};c.propTypes={serviceName:l().string,label:l().string,profilePicture:l().string};const u=c},60676:(e,t,n)=>{"use strict";n(55609),n(65736),n(99196),n(85761),n(62878),n(25893),n(20841),n(43876),n(75124)},62878:(e,t,n)=>{"use strict";n.d(t,{d:()=>o});var r=n(55609),a=n(65736),s=n(75124);const __=a.__;function o({connection:e}){return e.display_name?React.createElement("div",{className:s.Z["connection-name"]},e.profile_link?React.createElement(r.ExternalLink,{className:s.Z["profile-link"],href:e.profile_link},e.display_name):React.createElement("span",{className:s.Z["profile-link"]},e.display_name)):React.createElement(r.Spinner,{color:"black","aria-label":__("Loading account details","jetpack")})}},25893:(e,t,n)=>{"use strict";n.d(t,{Q:()=>s});var r=n(65736),a=n(67660);const __=r.__;function s({connection:e,service:t,onConfirmReconnect:n}){return"broken"!==e.status?null:React.createElement("div",null,React.createElement("span",{className:"description"},__("There is an issue with this connection.","jetpack"))," ",React.createElement(a.w,{connection:e,service:t,onConfirmReconnect:n}))}},20841:(e,t,n)=>{"use strict";n.d(t,{c:()=>u});var r=n(90526),a=n(55609),s=n(9818),o=n(69307),i=n(65736),l=n(23177),c=n(75124);const __=i.__,_x=i._x;function u({connection:e,variant:t="secondary",isDestructive:n=!0,buttonClassName:u}){const[d,p]=(0,o.useReducer)((e=>!e),!1),{deleteConnectionById:m}=(0,s.useDispatch)(l.h),{isDisconnecting:g}=(0,s.useSelect)((t=>{const{getDeletingConnections:n}=t(l.h);return{isDisconnecting:n().includes(e.connection_id)}}),[e.connection_id]),A=(0,o.useCallback)((async()=>{p(),await m({connectionId:e.connection_id})}),[e.connection_id,m]);return e.can_disconnect?React.createElement(React.Fragment,null,React.createElement(a.__experimentalConfirmDialog,{className:c.Z.confirmDialog,isOpen:d,onConfirm:A,onCancel:p,cancelButtonText:__("Cancel","jetpack"),confirmButtonText:__("Yes","jetpack")},(0,o.createInterpolateElement)((0,i.sprintf)(
// translators: %s: The name of the connection the user is disconnecting.
__("Are you sure you want to disconnect %s ?","jetpack"),e.display_name),{strong:React.createElement("strong",null)})),React.createElement(r.Z,{size:"small",onClick:p,disabled:g,variant:t,isDestructive:n,className:u},g?__("Disconnecting…","jetpack"):_x("Disconnect","Disconnect a social media account","jetpack"))):null}},75674:(e,t,n)=>{"use strict";n(55609),n(9818),n(69307),n(65736),n(65235),n(37568),n(23177),n(95766),n(66475),n(60676),n(75124)},43876:(e,t,n)=>{"use strict";n.d(t,{l:()=>l});var r=n(55609),a=n(9818),s=n(69307),o=n(65736),i=n(23177);const __=o.__;function l({connection:e}){const{updateConnectionById:t}=(0,a.useDispatch)(i.h),{isUpdating:n}=(0,a.useSelect)((t=>{const{getUpdatingConnections:n}=t(i.h);return{isUpdating:n().includes(e.connection_id)}}),[e.connection_id]),o=(0,s.useCallback)((n=>{t(e.connection_id,{shared:n})}),[e.connection_id,t]);return React.createElement(r.CheckboxControl,{checked:e.shared??!1,onChange:o,disabled:n||"broken"===e.status,label:__("Mark the connection as shared","jetpack")})}},67660:(e,t,n)=>{"use strict";n.d(t,{w:()=>c});var r=n(90526),a=n(9818),s=n(69307),o=n(65736),i=n(23177),l=n(58300);const __=o.__,_x=o._x;function c({connection:e,service:t,variant:n="link",onConfirmReconnect:o}){const{deleteConnectionById:c,setKeyringResult:u}=(0,a.useDispatch)(i.h),{isDisconnecting:d}=(0,a.useSelect)((t=>{const{getDeletingConnections:n}=t(i.h);return{isDisconnecting:n().includes(e.connection_id)}}),[e.connection_id]),p=(0,s.useCallback)((e=>{u(e),e?.ID&&o?.()}),[o,u]),m=(0,l.N)({service:t,onConfirm:p}),g=(0,s.useCallback)((async()=>{if(!await c({connectionId:e.connection_id,showSuccessNotice:!1}))return;const n=new FormData;"mastodon"===t.ID&&n.set("instance",e.external_display),m(n)}),[e,c,m,t.ID]);return e.can_disconnect?React.createElement(React.Fragment,null,React.createElement(r.Z,{size:"small",onClick:g,disabled:d,variant:n},d?__("Disconnecting…","jetpack"):_x("Reconnect","Reconnect a social media account","jetpack"))):null}},24479:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(65235),a=n.n(r),s=n(25162),o=n.n(s),i=n(85761);const l=e=>{const{checked:t,disabled:n,onChange:r,serviceName:s,label:o,profilePicture:l}=e,c=a()("components-connection-toggle",{"is-not-checked":!t,"is-disabled":n});return React.createElement("div",{className:c,title:o},React.createElement(i.Z,{checked:t,label:o,onClick:r,serviceName:s,profilePicture:l}))};l.propTypes={className:o().string,checked:o().bool,id:o().string.isRequired,disabled:o().bool,onChange:o().func,serviceName:o().string,label:o().string,profilePicture:o().string};const c=l},49021:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(94333),a=n(9818),s=n(69307),o=n(23177);class i extends s.Component{componentDidMount(){this.props.refreshConnections()}render(){return null}}const l=(0,r.compose)([(0,a.withSelect)((e=>({failedConnections:e(o.Eg).getFailedConnections()}))),(0,a.withDispatch)((e=>({refreshConnections:e(o.Eg).refreshConnectionTestResults})))])(i)},4277:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(13419),a=n(55609),s=n(9818),o=n(69307),i=n(65736),l=n(23177),c=n(24479),u=n(28161),d=n(91853);const __=i.__;class p extends o.Component{maybeDisplayLinkedInNotice=()=>this.connectionNeedsReauth()&&React.createElement(a.Notice,{className:u.Z["publicize-notice"],isDismissible:!1,status:"error"},React.createElement("p",null,__("Your LinkedIn connection needs to be reauthenticated to continue working – head to Sharing to take care of it.","jetpack")),React.createElement(a.ExternalLink,{href:`https://wordpress.com/marketing/connections/${(0,r.lQ)()}`},__("Go to Sharing settings","jetpack")));connectionNeedsReauth=()=>this.props.mustReauthConnections.includes(this.props.name);onConnectionChange=()=>{const{id:e}=this.props;this.isDisabled()||this.props.toggleConnection(e)};connectionIsFailing(){const{failedConnections:e,name:t}=this.props;return e.some((e=>e.service_name===t))}isDisabled(){return this.props.disabled||this.connectionIsFailing()||this.connectionNeedsReauth()}render(){const{enabled:e,id:t,label:n,name:r,profilePicture:a}=this.props,s="connection-"+r+"-"+t,o=r.replace("_","-"),i=React.createElement(c.Z,{id:s,className:d.Z["connection-toggle"],checked:e,onChange:this.onConnectionChange,disabled:this.isDisabled(),serviceName:o,label:n,profilePicture:a});return React.createElement("li",null,this.maybeDisplayLinkedInNotice(),React.createElement("div",{className:d.Z["connection-container"]},i))}}const m=(0,s.withSelect)((e=>({failedConnections:e(l.Eg).getFailedConnections(),mustReauthConnections:e(l.Eg).getMustReauthConnections()})))(p)},1922:(e,t,n)=>{"use strict";n.d(t,{F:()=>d});var r=n(6895),a=n(13419),s=n(55609),o=n(69307),i=n(65736),l=n(81050),c=n(75323),u=n(62578);const __=i.__,d=()=>{const{shouldShowAdvancedPlanNudge:e}=(0,l.usePublicizeConfig)(),{dismissNotice:t,shouldShowNotice:n,NOTICES:i}=(0,c.Z)(),d=(0,o.useCallback)((()=>t(i.advancedUpgradeEditor,7776e3)),[t,i]);return e&&n(i.advancedUpgradeEditor)&&React.createElement(u.Z,{onDismiss:d,type:"highlight"},(0,o.createInterpolateElement)(__("Need more reach? Unlock custom media sharing with the Advanced Plan ","jetpack"),{upgradeLink:React.createElement(s.ExternalLink,{href:(0,r.Z)("jetpack-social-advanced-site-checkout",{site:(0,a.lQ)(),query:"redirect_to="+encodeURIComponent(window.location.href)})})}))}},87029:(e,t,n)=>{"use strict";n.d(t,{w:()=>d});var r=n(13419),a=n(55609),s=n(69307),o=n(65736),i=n(81050),l=n(75323),c=n(62578),u=n(75631);const __=o.__,d=()=>{const{dismissNotice:e,shouldShowNotice:t,NOTICES:n}=(0,l.Z)(),o=(0,s.useCallback)((()=>e(n.autoConversion)),[e,n]),{adminUrl:d,jetpackSharingSettingsUrl:p}=(0,i.usePublicizeConfig)();return!(0,r.Wp)()&&t(n.autoConversion)&&React.createElement(c.Z,{type:"warning",actions:[React.createElement(a.Button,{onClick:o,key:"dismiss",variant:"primary"},__("Got it","jetpack")),React.createElement(a.Button,{className:u.Z["change-settings-button"],key:"change-settings",href:d||p,target:"_blank",rel:"noreferrer noopener"},__("Change settings","jetpack"))]},__("When your post is published, the selected image will be converted for maximum compatibility across your connected social networks.","jetpack"))}},63503:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(55609),a=n(69307),s=n(65736),o=n(81050),i=n(37568),l=n(62578),c=n(49285);const _n=s._n,u=()=>{const{connections:e}=(0,i.Z)(),t=e.filter((e=>(0,c.A)(e,"broken"))),{connectionsAdminUrl:n}=(0,o.usePublicizeConfig)();return t.length>0&&React.createElement(l.Z,{type:"error"},(0,a.createInterpolateElement)(_n("One of your social connections is broken. Reconnect them on the connection management page.","Some of your social connections are broken. Reconnect them on the connection management page.",t.length,"jetpack"),{fixLink:React.createElement(r.ExternalLink,{href:n})}))}},75457:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(14085),a=n(37568),s=n(4277),o=n(69709),i=n(75631),l=n(28155);const c=()=>{const{connections:e,toggleById:t}=(0,a.Z)(),{canBeTurnedOn:n,shouldBeDisabled:c}=(0,l.z)(),{needsUserConnection:u}=(0,r.Z)();return React.createElement("ul",{className:i.Z["connections-list"]},e.map((e=>{const{display_name:r,id:a,service_name:o,profile_picture:i,connection_id:l}=e,u=l||a;return React.createElement(s.Z,{disabled:c(e),enabled:n(e)&&e.enabled,key:u,id:u,label:r,name:o,toggleConnection:t,profilePicture:i})})),u?null:React.createElement("li",null,React.createElement(o.Z,null)))}},82356:(e,t,n)=>{"use strict";n.d(t,{H:()=>c});var r=n(55609),a=n(65736),s=n(14085),o=n(37568),i=n(75631),l=n(28155);const _n=a._n;function c(){const{enabledConnections:e}=(0,o.Z)(),{isPublicizeEnabled:t}=(0,s.Z)(),{canBeTurnedOn:n,shouldBeDisabled:c}=(0,l.z)(),u=e.filter((e=>n(e)&&!c(e)));return u.length&&t?React.createElement(r.PanelRow,null,React.createElement("p",{className:i.Z["enabled-connections-notice"]},(0,a.sprintf)(/* translators: %d: number of connections */
@@ -107,11 +107,11 @@ __("Delete %s","jetpack"),o.label),disabled:a===l},a===l?__("Deleting","jetpack"
__("Kind","jetpack"),onChange:t=>{n({...e,kind:t})},disabled:f}),(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-buttons-container"},f?(0,r.createElement)(i.Spinner,null):(0,r.createElement)(i.Button,{variant:"secondary",disabled:!e.tmpFile,onClick:()=>{h(null),""===b&&(e.label=__("English","jetpack")),""===v&&(e.srcLang="en"),void 0===e.kind&&(e.kind=p),d(e)?h(__("A track already exists for that language and kind.","jetpack")):(C(!0),E(e,t).then((()=>{n(e),h(null),a()})).catch((e=>{e.message&&h(e.message)})).finally((()=>{C(!1)})))}},__("Save","jetpack")),(0,r.createElement)(i.Button,{variant:"link",onClick:s},__("Close","jetpack"))),A&&(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-error"},/* translators: %s: An error message returned after a failed video track file upload." */ /* translators: %s: An error message returned after a failed video track file upload." */
(0,u.sprintf)(__("Error: %s","jetpack"),A))))}function v({tracks:e=[],onChange:t,guid:n}){const[a,s]=(0,c.useState)(null);return(0,r.createElement)(i.Dropdown,{contentClassName:"videopress-block-tracks-editor",renderToggle:({isOpen:e,onToggle:t})=>(0,r.createElement)(i.ToolbarButton,{label:__("Text tracks","jetpack"),showTooltip:!0,"aria-expanded":e,"aria-haspopup":"true",onClick:t,icon:A}),renderContent:()=>null!==a?(0,r.createElement)(b,{track:e[a],guid:n,onChange:n=>{const r=[...e];r[a]=n,t(r)},onClose:()=>s(null),onCancel:()=>{t(e.filter(((e,t)=>t!==a))),s(null)},trackExists:t=>-1!==e.filter(((e,t)=>t!==a)).findIndex((e=>e.kind===t.kind&&e.srcLang===t.srcLang))}):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.NavigableMenu,null,(0,r.createElement)(C,{tracks:e,onChange:t,guid:n}),(0,r.createElement)(i.MenuGroup,{className:"videopress-block-tracks-editor__add-tracks-container",label:__("Add tracks","jetpack")},(0,r.createElement)(i.MenuItem,{icon:d.Z,onClick:()=>{(()=>{const n=e.length,r=[...e];r[n]||(r[n]={}),r[n]={...e[n]},t(r),s(n)})()}},__("Upload track","jetpack")))))})}},32478:(e,t,n)=>{"use strict";n.d(t,{$:()=>A});var r=n(51806),a=n(52175),s=n(55609),o=n(69307),i=n(65736),l=n(61074),c=n(65235),u=n.n(c),d=n(81427);const __=i.__,p=["image"],m=e=>{const{videoPosterImageUrl:t}=e;return(0,r.createElement)("div",{className:"resumable-upload__editor-thumb-placeholder"},t?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("img",{src:t,alt:"Poster"}),(0,r.createElement)(l.Z,{className:"uploading-editor__play-icon",icon:d.o1})):(0,r.createElement)("span",null,"No Poster Selected"))},g=e=>{const{onSelectPoster:t,onRemovePoster:n}=e;return(0,r.createElement)(s.BaseControl,{className:u()(e.className,"editor-video-poster-control")},(0,r.createElement)(m,e),(0,r.createElement)(a.MediaUpload,{title:__("Select Poster Image","jetpack"),onSelect:t,allowedTypes:p,render:({open:e})=>(0,r.createElement)("div",{className:"poster-selector__buttons"},(0,r.createElement)(s.Button,{onClick:n,variant:"link",isDestructive:!0},__("Remove Poster Image","jetpack")),(0,r.createElement)(s.Button,{variant:"secondary",onClick:e},__("Select Poster Image","jetpack")))}))},A=e=>{const{file:t,onSelectPoster:n,onRemovePoster:i,videoPosterImageData:c,title:u,onChangeTitle:m,onVideoFrameSelected:A}=e,[h,E]=(0,o.useState)(0),[f,C]=(0,o.useState)(!0),b=(0,o.useRef)(null),v=(0,o.useRef)(null),k=()=>{C(!1)};(0,o.useEffect)((()=>{null!==t&&b&&(b.current.src=URL.createObjectURL(t))}),[t,b]);const B={};return c&&(B.display="none"),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"uploading-editor"},(0,r.createElement)("div",{className:"uploading-editor__summary"}),(0,r.createElement)("div",{className:"uploading-editor__fields"},(0,r.createElement)(s.TextControl,{label:__("Video title","jetpack"),className:"uploading-editor__title",onChange:m,value:u}),(0,r.createElement)("div",{className:"uploading-editor__content"},(0,r.createElement)(s.BaseControl,{label:__("Video poster (optional)","jetpack")},f?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"uploading-editor__video-container"},(0,r.createElement)("div",{className:"uploading-editor__video-poster-wrapper"},c&&(0,r.createElement)(g,{onSelectPoster:n,onRemovePoster:i,videoPosterImageUrl:c.url}),(0,r.createElement)("video",{ref:b,muted:!0,className:"uploading-editor__video",onDurationChange:e=>{const t=e.target.duration;E(t),b.current&&(b.current.currentTime=t/2)},onError:k,onLoadedMetadata:e=>{e.target.videoHeight||k()},style:B})),!c&&(0,r.createElement)(l.Z,{className:"uploading-editor__play-icon",icon:d.o1})),(0,r.createElement)("span",{style:B},(0,r.createElement)(s.RangeControl,{className:"uploading-editor__range",min:"0",step:"0.1",max:h,showTooltip:!1,withInputField:!1,onChange:e=>{A(1e3*e),b.current&&(b.current.currentTime=e)}})),(0,r.createElement)("span",{className:"uploading-editor__scrubber-help",style:B},(0,o.createInterpolateElement)(__("This is how the video will look. Use the slider to choose a poster or select a custom one .","jetpack"),{a:(0,r.createElement)(a.MediaUpload,{title:__("Select Poster Image","jetpack"),onSelect:n,allowedTypes:p,render:({open:e})=>(0,r.createElement)("a",{className:"uploading-editor__upload-link",onClick:e,onKeyDown:e,ref:v,role:"button",tabIndex:0},__("select a custom one","jetpack"))})}))):(0,r.createElement)(g,{onSelectPoster:n,videoPosterImageUrl:c?c.url:null}))))))}},90953:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(96483);const a=(e,{autoplay:t,controls:n,loop:a,muted:s,playsinline:o,poster:i,preload:l,seekbarColor:c,seekbarPlayedColor:u,seekbarLoadingColor:d,useAverageColor:p})=>{if(!e)return null;const m={resizeToParent:!0,cover:!0,...t&&{autoPlay:!0},...!n&&{controls:!1},...a&&{loop:!0},...s&&{muted:!0,persistVolume:!1},...o&&{playsinline:!0},...i&&{posterUrl:i},...""!==l&&{preloadContent:l},...""!==c&&{sbc:c},...""!==u&&{sbpc:u},...""!==d&&{sblc:d},...p&&{useAverageColor:!0}};return(0,r.addQueryArgs)(`https://videopress.com/v/${e}`,m)}},77290:(e,t,n)=>{"use strict";n.d(t,{K8:()=>l,Kp:()=>u,Zx:()=>c,f6:()=>i});n(4981);var r=n(65235),a=n.n(r),s=n(90879);const o=e=>{const t=s.sl.reduce(((e,{className:t})=>(e[t]=!1,e)),{"wp-has-aspect-ratio":!1});return a()(e,t)};function i(e,t="",n=!0){if(!n)return o(t);const r=document.implementation.createHTMLDocument("");r.body.innerHTML=e;const i=r.body.querySelector("iframe");if(i&&i.height&&i.width){const e=(i.width/i.height).toFixed(2);for(let n=0;n=r.ratio)return a()(o(t),r.className,"wp-has-aspect-ratio")}}return t}const l=e=>e.replace(/\.[^/.]+$/,""),c=e=>{if(!e||"string"!=typeof e)return null;const t=e.match(/^https?:\/\/(?video(?:\.word|s\.files\.word)?press\.com)(?:\/v|\/embed)?\/(?[a-zA-Z\d]{8})/);return t?.groups?.guid?t.groups.guid:null},u=e=>{const{guid:t,videoPressTracks:n,isVideoPressExample:r}=e;if(!t?.length)return!1;if(!Array.isArray(n))return!1;return!(!Object.keys(e).includes("isVideoPressExample")||"boolean"!=typeof r)}},65192:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(13419),s=n(52175),o=n(4981),i=n(55609),l=n(9818),c=n(12238),u=(n(69307),n(65736)),d=n(77290),p=n(5743);const __=u.__,m={instances:[]},g=(e=[],t=!1,n=0)=>{if(t&&(m.instances=[]),e.forEach((e=>{if(e.innerBlocks.length)return void g(e.innerBlocks,!1,n+1);const{clientId:t,name:r,attributes:a}=e;"core/video"===r&&(0,d.Kp)(a)&&m.instances.push({clientId:t,name:r,attributes:a})})),0===n)return m.instances};function A({clientId:e,attributes:t}){const n=(0,l.useSelect)((e=>e(c.store).getCurrentPostId())),{getBlocks:u}=(0,l.useSelect)(s.store),{replaceBlock:m}=(0,l.useDispatch)(s.store),{tracks:A}=(0,a.z$)();return(0,r.createElement)("div",{className:p.Z.wrapper},(0,r.createElement)(i.Notice,{status:"info",isDismissible:!1,className:p.Z["conversion-notice"]},__("You can transform this post's video blocks to the new VideoPress block to take advantage of new features, such as adding chapters directly in the description or hiding the video's share menu.","jetpack")),(0,r.createElement)(i.Button,{variant:"primary",onClick:()=>{const r=g(u(),!0);r?.length&&(r.find((t=>t.clientId===e))||r.push({clientId:e,name:"core/video",currentBlockAttributes:t}),r.forEach((e=>{const{clientId:t,name:r,attributes:a}=e;"core/video"===r&&(0,d.Kp)(a)&&(m(t,(0,o.createBlock)("videopress/video",a)),A.recordEvent("jetpack_editor_videopress_block_manual_conversion_click",{post_id:n}))})))}},__("Transform blocks to VideoPress","jetpack")))}},68938:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(52175),s=n(94333),o=n(77290),i=n(65192);const l=(0,s.createHigherOrderComponent)((e=>t=>(0,o.Kp)(t.attributes)?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(i.Z,{clientId:t.clientId,attributes:t.attributes})),(0,r.createElement)(e,t)):(0,r.createElement)(e,t)))},23062:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(13419),a=n(68938);const s="videopress/video";function o(e,t){if("core/video"!==t)return e;const{available:n}=(0,r.OZ)(s);return n?{...e,edit:(0,a.Z)(e.edit)}:e}},73859:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(51806),a=n(55609),s=n(65736),o=n(78680),i=n(75255);const __=s.__,l="videopress/video-chapters",c=!!window?.Jetpack_Editor_Initial_State?.available_blocks[l],u=31;function d({isRequestingVideoItem:e}){const{attributes:t,setAttributes:n}=(0,i.Z)(),{title:s,description:d}=t,p=(0,o.L)(l),m=d?.length?d.split("\n").map((e=>Math.ceil(e.length/u)||1)).reduce(((e,t)=>e+t),0):4,g=Math.min(12,Math.max(m,4));if(!c)return null;return(0,r.createElement)(a.PanelBody,{title:__("Details","jetpack"),className:p?"is-beta":""},(0,r.createElement)(a.TextControl,{label:__("Title","jetpack"),value:s,placeholder:__("Video title","jetpack"),onChange:e=>{n({title:e})},disabled:e}),(0,r.createElement)(a.TextareaControl,{label:__("Description","jetpack"),value:d,placeholder:__("Video description","jetpack"),onChange:e=>{n({description:e})},disabled:e,rows:g}))}},24288:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(51806),a=n(52175),s=n(94333),o=n(69307),i=n(73859),l=n(67203),c=n(49664),u=n(84676);const d=(0,s.createHigherOrderComponent)((e=>t=>{const{attributes:n,setAttributes:s}=t,[d,p]=(0,l.Z)(n?.id),[m]=(0,c.v)(n);return(0,o.useEffect)((()=>{if(!d)return;const e={};d?.title&&(e.title=d.title),d?.description&&(e.description=d.description),Object.keys(e).length&&(s(e),m(e))}),[d,s,m]),u.d&&"core/video"!==!t.name&&t.attributes?.guid?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(i.Z,{isRequestingVideoItem:p})),(0,r.createElement)(e,t)):(0,r.createElement)(e,t)}))},75255:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(52175),a=n(9818);function s(){const{clientId:e,attributes:t}=(0,a.useSelect)((e=>{const t=e(r.store).getSelectedBlockClientId();return{clientId:t,attributes:t?e("core/block-editor").getBlockAttributes(t):void 0}})),{updateBlockAttributes:n}=(0,a.useDispatch)(r.store);return{clientId:e,attributes:t,setAttributes:t=>n(e,t)}}},49664:(e,t,n)=>{"use strict";n.d(t,{v:()=>A});var r=n(86989),a=n.n(r),s=n(94333),o=n(37798),i=n(9818),l=n(12238),c=n(69307),u=n(65736),d=n(22081),p=n(90953),m=n(84321),g=n(38871);const __=u.__;function A(e){const{id:t,title:n,description:r,guid:u}=e,A=(0,i.useSelect)((e=>e(l.store).isSavingPost()),[]),h=(0,s.usePrevious)(A),E=(0,i.useDispatch)(o.store).invalidateResolution,[f,C]=(0,c.useState)(),b=(0,c.useCallback)((e=>{C((t=>({...t,...e})))}),[]);(0,c.useEffect)((()=>{C({title:n,description:r})}),[]);const v=function(e){return t=>new Promise(((n,r)=>{a()({path:"/wpcom/v2/videopress/meta",method:"POST",data:{id:e,...t}}).then((e=>{if(200!==e?.data)return r(e);n(e)})).catch(r)}))}(t);return(0,c.useEffect)((()=>{if(!A||h)return;if(!t)return;const a={};if(f?.title!==n&&(a.title=n),f?.description!==r&&(a.description=r),!Object.keys(a).length)return;if(v(a).then((()=>b({title:n,description:r}))),!a?.description?.length)return;const s=(0,m.ZP)(a.description);if(!s?.length)return;const o={label:__("English","jetpack"),srcLang:"en",kind:"chapters",tmpFile:(0,g.ZP)(a.description)};(0,d.n)(o,u).then((()=>{const t=(0,p.p)(u,e);E("getEmbedPreview",[t])}))}),[A,h,n,f?.title,f?.description,r,v,b,e,E,t,u]),[b]}},67203:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(86989),a=n.n(r),s=n(69307);function o(e){const[t,n]=(0,s.useState)({}),[r,o]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{e&&(o(!0),async function(){try{const t=await a()({path:`/wp/v2/media/${e}`});n(t?.jetpack_videopress||{}),o(!1)}catch(e){throw o(!1),new Error(e)}}())}),[e]),[t,r]}},84676:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s,d:()=>a});var r=n(24288);const a=!!window?.Jetpack_Editor_Initial_State?.available_blocks["videopress/video-chapters"];function s(e,t){if(!a)return e;if("core/video"!==t)return e;const n={...e.attributes,title:{type:"string"},description:{type:"string"}};return{...e,attributes:n,edit:(0,r.Z)(e.edit)}}},84321:(e,t,n)=>{"use strict";function r(e){return e.split("\n").map((e=>function(e){const t=/(?\(?(?\d{1,2}:\d{2}:\d{2}|\d{1,2}:\d{2})\)?)/.exec(e);if(null==t||null==t.groups)return null;const{groups:{timeBlock:n,time:r}}=t,a=e.indexOf(n),s=(a<(e.length-n.length)/2?e.substring(a+n.length,e.length):e.substring(0,a)).trim().replace(/(\s-$)|(^-\s)/,""),o=r.split(":");return 1===o[0].length&&(o[0]=`0${o[0]}`),2===o.length&&o.unshift("00"),{startAt:o.join(":"),title:s}}(e))).filter((e=>null!==e)).sort(((e,t)=>e.startAt.localeCompare(t.startAt)))}n.d(t,{Tn:()=>r,ZP:()=>r})},38871:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>s});var r=n(84321);function a(e){const t=Math.floor(e/36e5);let n=e-36e5*t;const r=Math.floor(n/6e4);n-=6e4*r;return[t,r,Math.floor(n/1e3)].map((e=>e<10?`0${e}`:e)).join(":")}function s(e,t){const n=function(e,t=359999e3){const n=(0,r.Tn)(e);if(0===n.length)return null;let s="WEBVTT\n",o=1;for(const[e,r]of n.entries()){const i=0===e?"000":"001",l=e{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(42290),s=n(55609),o=n(65736);const __=o.__;function i({state:e,onUpload:t,onCancel:n,onRecord:o,onPause:i,onResume:l,onDone:c}){return(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__action-buttons"},["inactive","error","validating"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qf,variant:"secondary",onClick:o},__("Begin recording","jetpack")),["recording"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qr,variant:"secondary",onClick:i},__("Pause recording","jetpack")),["paused"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qf,variant:"secondary",onClick:l},__("Resume recording","jetpack")),["inactive","error","validating"].includes(e)&&(0,r.createElement)(s.FormFileUpload,{accept:".mp3,.mpeg,.mpga,.ogg,.flac,.m4a,.mp4,.wav,.wave,.webm",onChange:t,variant:"secondary",className:"jetpack-ai-voice-to-content__button"},__("Upload audio","jetpack")),["recording","paused"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",variant:"primary",onClick:c},__("Done","jetpack")),["recording","paused","processing"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",variant:"secondary",onClick:n},__("Cancel","jetpack")))}},36265:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(42290),s=n(65736),o=n(79554);const __=s.__;function i({state:e,error:t=null,analyser:n,duration:s=0}){return"inactive"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("File size limit: 25MB. Recording time limit: 25 minutes.","jetpack")):"recording"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__audio"},(0,r.createElement)(a.ZK,{className:"jetpack-ai-voice-to-content__audio--duration",duration:s}),(0,r.createElement)(o.Z,{analyser:n,paused:!1}),(0,r.createElement)("span",{className:"jetpack-ai-voice-to-content__information"},__("Recording…","jetpack"))):"paused"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__audio"},(0,r.createElement)(a.ZK,{className:"jetpack-ai-voice-to-content__audio--duration",duration:s}),(0,r.createElement)(o.Z,{analyser:n,paused:!0}),(0,r.createElement)("span",{className:"jetpack-ai-voice-to-content__information"},__("Paused","jetpack"))):"processing"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("Uploading and transcribing audio…","jetpack")):"validating"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("Validating audio…","jetpack")):"error"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information--error"},t):null}},79554:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(69307);function s({analyser:e,paused:t=!1}){const n=(0,a.useRef)(null),s=(0,a.useRef)(t),o=(0,a.useRef)(null);return(0,a.useEffect)((()=>{s.current=t}),[t]),(0,a.useEffect)((()=>{e&&n.current&&(o.current&&o.current(),o.current=function(e,t,n){const r=t.getContext("2d");let a=!1;if(!r)return;e.fftSize=Math.pow(2,13);const s=e.fftSize,o=new Float32Array(s),i=s/10,{width:l,height:c}=t,u=c/2;r.lineWidth=4,r.lineCap="round",r.strokeStyle=getComputedStyle(t).getPropertyValue("--jp-green-50")||"#008710";const d=()=>{r.clearRect(0,0,l,c),e.getFloatTimeDomainData(o);for(let e=1;e<=10;e++){let t=0;n.current||(t=o.slice(e*i,(e+1)*i).reduce(((e,t)=>e+t),0)/i,t*=2048,t=Math.abs(t),t=Math.min(16,Math.max(0,t))),r.beginPath(),r.moveTo(2+6*e,u-t),r.lineTo(2+6*e,u+t),r.stroke()}setTimeout((()=>{a||requestAnimationFrame(d)}),50)};return d(),()=>{a=!0}}(e,n.current,s))}),[e,n,s]),(0,a.useEffect)((()=>()=>{o.current&&o.current()}),[]),(0,r.createElement)("canvas",{className:"jetpack-ai-voice-to-content__oscilloscope",width:70,height:38,ref:n})}},32663:(e,t,n)=>{"use strict";n.d(t,{Z:()=>C});var r=n(82674),a=n.n(r),s=n(51806),o=n(42290),i=n(88275),l=n(13419),c=n(55609),u=n(9818),d=n(69307),p=n(65736),m=n(15381),g=(n(99196),n(83181)),A=n(36265),h=n(48384),E=n(24167);const __=p.__,f=(e,t,n)=>t?"validating":e?"processing":n;function C({clientId:e}){const[t,n]=(0,d.useState)(null),{removeBlock:r}=(0,u.useDispatch)("core/block-editor"),{getBlocks:p}=(0,u.useSelect)((e=>e("core/editor")),[]),C=(0,d.useCallback)((()=>{setTimeout((()=>{r(e)}),100)}),[r,e]),{tracks:b}=(0,l.z$)(),{isValidatingAudio:v,validateAudio:k}=(0,o.L$)(),{upsertTranscription:B}=(0,E.Z)(),{isCreatingTranscription:y,createTranscription:w,cancelTranscription:_}=(0,h.Z)({onReady:e=>{B(e);const t=p();for(let e=0;e<2;e++)"core/paragraph"===t[e].name&&""===t[e].attributes?.content&&r(String(t[e].clientId));I()},onUpdate:e=>{B(e)},onError:e=>{Q(e)}}),I=()=>{_(),C()},{state:j,controls:x,error:S,onError:Q,duration:N,analyser:P}=(0,o._T)({onDone:e=>{R(e)}}),R=(0,d.useCallback)((e=>{e&&n(e)}),[n]);(0,d.useEffect)((()=>{t&&k(t,(e=>{b.recordEvent("jetpack_ai_voice_to_content_transcription_started",{post_processing_action:o.Y,type:e.isFile?"upload":"record",audio_duration:e.duration,audio_file_size:e.size}),w(t,o.Y)}),Q)}),[t,b,k,w,Q]);const{start:T,pause:Z,resume:L,stop:M,reset:D}=x,F=(0,d.useCallback)((e=>{if(e.currentTarget.files.length>0){const t=e.currentTarget.files[0];R(t)}}),[R]),z=(0,d.useCallback)((()=>{_(),D()}),[_,D]),O=(0,d.useCallback)((()=>{T(1e3)}),[T]),U=(0,d.useCallback)((()=>{Z()}),[Z]),H=(0,d.useCallback)((()=>{L()}),[L]),V=(0,d.useCallback)((()=>{M()}),[M]),q=f(y,v,j);return(0,s.createElement)(c.Modal,{onRequestClose:I,title:__("Jetpack AI Voice to content","jetpack"),className:"jetpack-ai-voice-to-content__modal",shouldCloseOnEsc:!1,shouldCloseOnClickOutside:!1},(0,s.createElement)(i.ZP,null,(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__wrapper"},(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__body"},(0,s.createElement)("span",{className:"jetpack-ai-voice-to-content__description"},__("Transform your spoken words into a post ready to publish with AI.","jetpack")),(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__contextual-row"},(0,s.createElement)(A.Z,{state:q,error:S,duration:N,analyser:P})),(0,s.createElement)(g.Z,{state:q,onUpload:F,onCancel:z,onRecord:O,onPause:U,onResume:H,onDone:V})),(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__footer"},(0,s.createElement)(c.Button,{variant:"link",className:"jetpack-ai-voice-to-content__feedback-button",href:"https://a8c.slack.com/archives/C054LN8RNVA",target:"_blank"},(0,s.createElement)("span",null,__("Provide feedback","jetpack")),(0,s.createElement)(c.Icon,a()({icon:m.Z},{className:"icon"})))))))}},13006:(e,t,n)=>{"use strict";var r=n(31985),a=n(58940),s=n(32663);(0,r.S)(a,{edit:s.Z,save:()=>null})},48384:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(42290),a=n(69307),s=n(51128);const o=n.n(s)()("voice-to-content:use-transcription-creator"),i="voice-to-content";function l({onReady:e,onUpdate:t,onError:n}){const s=(0,a.useRef)(null),l=(0,a.useRef)(null),{processTranscription:c,cancelTranscriptionProcessing:u,isProcessingTranscription:d}=(0,r.OS)({feature:i,onReady:e,onUpdate:t,onError:t=>{if(s.current)return e(s.current);o("Transcription post-processing error: ",t)}}),p=(0,a.useCallback)((e=>{s.current=e,l.current&&c(l.current,e)}),[c]),{transcribeAudio:m,cancelTranscription:g,isTranscribingAudio:A}=(0,r.cH)({feature:i,onReady:p,onError:n});return{isCreatingTranscription:A||d,createTranscription:(0,a.useCallback)(((e,t)=>{if(e&&t)return l.current=t,m(e)}),[m]),cancelTranscription:(0,a.useCallback)((()=>{g(),u()}),[g,u])}}},24167:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(42290),a=n(4981),s=n(9818),o=n(69307),i=n(51128);const l=n.n(i)()("voice-to-content:use-transcription-inserter");function c(){const{updateBlockAttributes:e,insertBlocks:t,replaceInnerBlocks:n}=(0,s.useDispatch)("core/block-editor"),i=(0,o.useRef)([]);return{upsertTranscription:(0,o.useCallback)((s=>{l("Upserting transcription");const o=(0,r.LB)({content:s||""}),c=(0,a.rawHandler)({HTML:o});for(let r=0;r0&&n(t,c[r].innerBlocks)}else t([c[r]],void 0,void 0,!0,null),i.current.push(c[r])}),[i,t,e,n])}}},68925:(e,t,n)=>{"use strict";n.d(t,{W:()=>c});var r=n(51806),a=n(13419),s=n(55609),o=n(65736),i=n(99787);const __=o.__,l=(0,a.dM)(i),c=({changeStatus:e,isLoading:t,isModuleActive:n})=>(0,r.createElement)(s.Placeholder,{icon:l,instructions:__("You'll need to activate the WordAds feature to use this block.","jetpack"),label:i.title},(0,r.createElement)(s.Button,{disabled:n||t,isBusy:t,onClick:()=>e(!0),variant:"secondary"},t?__("Activating WordAds","jetpack"):__("Activate WordAds","jetpack",0)),(0,r.createElement)("div",{className:"membership-button__disclaimer"},(0,r.createElement)(s.ExternalLink,{href:"https://jetpack.com/support/ads/"},__("Learn more about the WordAds feature.","jetpack"))))},61981:(e,t,n)=>{"use strict";n.d(t,{c:()=>o});var r=n(51806),a=n(22636),s=n(55609);const o=()=>(0,r.createElement)(s.Placeholder,null,(0,r.createElement)(s.Flex,{gap:2,direction:"column",style:{width:"100%"}},(0,r.createElement)(s.Flex,{gap:4},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(a.Z,{width:30,height:30})),(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{width:"90%",height:30}))),(0,r.createElement)(s.Flex,{style:{marginTop:12}},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{height:30,width:"60%"}))),(0,r.createElement)(s.Flex,{style:{marginTop:12}},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{width:150,height:50}))),(0,r.createElement)(s.Flex,{style:{marginTop:18}},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{width:"90%",height:16})))))},50354:(e,t,n)=>{"use strict";n.d(t,{m:()=>o});var r=n(51806),a=n(55609),s=n(65736);const __=s.__,o=[{height:250,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-7-2h2V7h-4v2h2z"})),name:__("Rectangle 300x250","jetpack"),tag:"mrec",width:300,editorPadding:30},{height:90,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4h-4v-2h2c1.1 0 2-.89 2-2V9c0-1.11-.9-2-2-2H9v2h4v2h-2c-1.1 0-2 .89-2 2v4h6v-2z"})),name:__("Leaderboard 728x90","jetpack"),tag:"leaderboard",width:728,editorPadding:60},{height:50,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V9c0-1.11-.9-2-2-2H9v2h4v2h-2v2h2v2H9v2h4c1.1 0 2-.89 2-2z"})),name:__("Mobile Leaderboard 320x50","jetpack"),tag:"mobile_leaderboard",width:320,editorPadding:100},{height:600,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M.04 0h24v24h-24V0z"}),(0,r.createElement)(a.Path,{d:"M19.04 3h-14c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16h-14V5h14v14zm-6-2h2V7h-2v4h-2V7h-2v6h4z"})),name:__("Wide Skyscraper 160x600","jetpack"),tag:"wideskyscraper",width:160,editorPadding:30}]},56565:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(51806),a=n(52175),s=n(55609),o=n(65736),i=n(1020);const __=o.__,l=({value:e,onChange:t})=>(0,r.createElement)(s.PanelBody,{title:__("Visibility","jetpack")},(0,r.createElement)(s.ToggleControl,{className:"jetpack-wordads__mobile-visibility",checked:!!e,label:__("Hide on mobile","jetpack"),help:__("Hides this block for site visitors on mobile devices.","jetpack"),onChange:t})),c=({attributes:{format:e,hideMobile:t},setAttributes:n})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.BlockControls,null,(0,r.createElement)(i.Z,{value:e,onChange:e=>n({format:e})})),(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(l,{value:t,onChange:e=>n({hideMobile:!!e})})))},53193:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(88275),s=n(13419),o=n(52175),i=n(68925),l=n(61981),c=n(50354),u=n(56565),d=n(80405),p=n(72473),m=n(38511),g=n(52203);const A=({attributes:e,setAttributes:t})=>{const n=(0,o.useBlockProps)(),{format:A}=e,{isLoadingModules:h,isChangingStatus:E,isModuleActive:f,changeStatus:C}=(0,s.el)("wordads"),b=c.m.find((({tag:e})=>e===A)),v=e=>{switch(e){case"leaderboard":return g;case"mobile_leaderboard":return m;case"wideskyscraper":return d;default:return p}};let k;return k=f?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(u.Z,{attributes:e,setAttributes:t}),(0,r.createElement)("div",{className:`wp-block-jetpack-wordads jetpack-wordads-${A}`},(0,r.createElement)("div",{className:"jetpack-wordads__ad",style:{width:b.width,height:b.height,backgroundImage:`url( ${v(A)} )`,backgroundSize:"cover"}}))):h?(0,r.createElement)(a.ZP,null,(0,r.createElement)(l.c,null)):(0,r.createElement)(i.W,{changeStatus:C,isModuleActive:f,isLoading:E}),(0,r.createElement)("div",n,k)}},3432:(e,t,n)=>{"use strict";var r=n(31985),a=n(99787),s=n(53193);(0,r.S)(a,{edit:s.Z,save:()=>null})},1020:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(55609),s=n(65736),o=n(50354);const i=(0,s.__)("Pick an ad format","jetpack");function l({value:e,onChange:t}){return(0,r.createElement)(a.Dropdown,{placement:"bottom-start",renderToggle:({onToggle:e,isOpen:t})=>(0,r.createElement)(a.ToolbarGroup,{controls:[{icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M1 9h2V7H1v2zm0 4h2v-2H1v2zm0-8h2V3c-1.1 0-2 .9-2 2zm8 16h2v-2H9v2zm-8-4h2v-2H1v2zm2 4v-2H1c0 1.1.9 2 2 2zM21 3h-8v6h10V5c0-1.1-.9-2-2-2zm0 14h2v-2h-2v2zM9 5h2V3H9v2zM5 21h2v-2H5v2zM5 5h2V3H5v2zm16 16c1.1 0 2-.9 2-2h-2v2zm0-8h2v-2h-2v2zm-8 8h2v-2h-2v2zm4 0h2v-2h-2v2z"})),title:i,onClick:e,extraProps:{"aria-expanded":t},className:"wp-block-jetpack-wordads__format-picker-icon"}]}),renderContent:({onClose:n})=>(0,r.createElement)(a.NavigableMenu,{className:"wp-block-jetpack-wordads__format-picker"},o.m.map((({tag:s,name:o,icon:i})=>(0,r.createElement)(a.MenuItem,{className:s===e?"is-active":void 0,icon:i,isSelected:s===e,key:s,onClick:()=>{t(s),n()},role:"menuitemcheckbox"},o))))})}},78680:(e,t,n)=>{"use strict";n.d(t,{L:()=>d});var r=n(82674),a=n.n(r),s=n(51806),o=n(86989),i=n.n(o),l=n(94333),c=n(92694),u=(n(80425),n(85921),n(63066),n(92713),n(54414),n(36215),n(31657),n(23984),n(14688),n(7652),n(29692),n(1949));function d(e){if(!u)return!1;const t=u.beta||[],n=e.replace(/jetpack\//,"");return t.includes(e)||t.includes(n)}i().use(((e,t)=>{if("cors"===e.mode)return t(e);if(e.url)try{const n=new URL(e.url,location.href);if(n.protocol!==location.protocol||n.hostname!==location.hostname||n.port!==location.port)return t(e)}catch{return t(e)}return e.headers||(e.headers={}),e.headers["x-wp-api-fetch-from-editor"]="true",t(e)})),(0,c.addFilter)("blocks.registerBlockType","jetpack/label-beta-blocks-title",(function(e,t){if(!d(t))return e;const{title:n,keywords:r}=e,a="(beta)",s="beta",o={...e};return n&&(o.title=n.toLowerCase().endsWith(a)?n:`${e.title} ${a}`),Array.isArray(r)&&(o.keywords=r.includes(s)?r:[...r,s]),o}));const p=(0,l.createHigherOrderComponent)((e=>t=>{if(t?.clientRootId)return(0,s.createElement)(e,t);const{name:n}=t;return d(n)?(0,s.createElement)(e,a()({},t,{className:"is-beta-extension"})):(0,s.createElement)(e,t)}),"withBetaClassName");(0,c.addFilter)("editor.BlockListBlock","jetpack/label-beta-extensions",p)},6460:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),s=n(81427);const __=a.__,o={name:"descript",title:"Descript",icon:s.h,keywords:[__("descript","jetpack")],description:__("Embed a Descript Item.","jetpack"),patterns:[/^https:\/\/share.descript.com\/(view|embed)\/\w+/i],attributes:{providerNameSlug:"descript",responsive:!0}};(0,r.registerBlockVariation)("core/embed",o)},5166:(e,t,n)=>{"use strict";var r=n(92694),a=n(65736),s=n(70355),o=n(81427);const __=a.__,_x=a._x,i={name:"facebook",title:"Facebook",icon:{src:o.Vq,foreground:(0,s.m)()},keywords:[_x("social","block search term","jetpack")],description:__("Embed a Facebook post.","jetpack"),patterns:[/^https?:\/\/www\.facebook.com\/.+/i],attributes:{providerNameSlug:"facebook",previewable:!1,responsive:!0}};(0,r.addFilter)("blocks.registerBlockType","reactivateFacebookEmbedBlockVariation",(function(e,t){if("core/embed"!==t||!e.variations)return e;const n=e.variations.filter((e=>e.name!==i.name));return e.variations=[...n,i],e}))},36215:(e,t,n)=>{"use strict";n(5166),n(20970),n(25467),n(91128),n(6460)},20970:(e,t,n)=>{"use strict";var r=n(92694),a=n(65736),s=n(70355),o=n(81427),i=n(12923);const __=a.__,_x=a._x,l={name:"instagram",title:"Instagram",icon:{src:o.yu,foreground:(0,s.m)()},keywords:[_x("image","block search term","jetpack"),_x("social","block search term","jetpack")],description:__("Embed an Instagram post.","jetpack"),patterns:[/^https?:\/\/(www\.)?instagr(\.am|am\.com)\/.+/i],attributes:{providerNameSlug:"instagram",responsive:!0}};(0,r.addFilter)("blocks.registerBlockType","reactivateInstagramEmbedBlockVariation",(function(e,t){if("core/embed"!==t||!e.variations||!(0,i.Z)())return e;const n=e.variations.filter((e=>e.name!==l.name));return e.variations=[...n,l],e}))},25467:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),s=n(81427);const __=a.__,o={name:"loom",title:"Loom",icon:s.zf,keywords:[__("video","jetpack")],description:__("Embed a Loom video.","jetpack"),patterns:[/^https?:\/\/(www\.)?loom\.com\/share\/.+/i],attributes:{providerNameSlug:"loom",responsive:!0}};(0,r.registerBlockVariation)("core/embed",o)},91128:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),s=n(81427);const __=a.__,o={name:"smartframe",title:"SmartFrame",icon:s.Ae,keywords:[__("smartframe","jetpack")],description:__("Embed a SmartFrame Image.","jetpack"),patterns:[/^https?:\/\/(.*?).smartframe.(io|net)\/.*/i],attributes:{providerNameSlug:"smartframe",responsive:!0}};(0,r.registerBlockVariation)("core/embed",o)},31657:(e,t,n)=>{"use strict";var r=n(4981),a=n(92694),s=n(6512);const o={from:[{type:"block",isMultiBlock:!1,blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>!!t?.raw&&"jetpack_widget_social_icons"===e,transform:({instance:e})=>{let t=[];return e.raw.icons.forEach((e=>{const n=new URL(e.url.includes(":")?e.url:"https://"+e.url),a=n.hostname?n.hostname:n.protocol,o=s.Z.find((e=>a.includes(e.url)||e.url.includes(a))),i=(0,r.createBlock)("core/social-link",{service:o?o.name:"chain",url:e.url});t=[...t,i]})),(0,r.createBlock)("core/social-links",{},t)}}]};(0,a.addFilter)("blocks.registerBlockType","addTransformToSocialLinksWidget",(function(e,t){return"core/social-links"!==t||(e.transforms=o),e}))},6512:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r=[{name:"wordpress",url:["wordpress."]},{name:"fivehundredpx",url:["500px.com"]},{name:"amazon",url:["amazon."]},{name:"bandcamp",url:["bandcamp.com"]},{name:"behance",url:["behance.net"]},{name:"codepen",url:["codepen.io"]},{name:"deviantart",url:["deviantart.com"]},{name:"dribbble",url:["dribbble.com"]},{name:"dropbox",url:["dropbox.com"]},{name:"etsy",url:["etsy.com"]},{name:"facebook",url:["facebook.com"]},{name:"flickr",url:["flickr.com"]},{name:"foursquare",url:["foursquare.com"]},{name:"goodreads",url:["goodreads.com"]},{name:"google",url:["google."]},{name:"github",url:["github.com"]},{name:"instagram",url:["instagram.com"]},{name:"lastfm",url:["last.fm"]},{name:"linkedin",url:["linkedin.com"]},{name:"mail",url:["mailto:"]},{name:"linkedin",url:["linkedin.com"]},{name:"mastodon",url:["mastodon.social"]},{name:"meetup",url:["meetup.com"]},{name:"medium",url:["medium.com"]},{name:"patreon",url:["patreon.com"]},{name:"pinterest",url:["pinterest."]},{name:"pocket",url:["getpocket.com"]},{name:"reddit",url:["reddit.com"]},{name:"skype",url:["skype.com","skype:"]},{name:"snapchat",url:["snapchat.com"]},{name:"soundcloud",url:["soundcloud.com"]},{name:"spotify",url:["spotify.com"]},{name:"telegram",url:["telegram.me","t.me"]},{name:"tiktok",url:["tiktok.com"]},{name:"tumblr",url:["tumblr.com"]},{name:"twitch",url:["twitch.tv"]},{name:"twitter",url:["twitter.com"]},{name:"vimeo",url:["vimeo.com"]},{name:"vk",url:["vk.com"]},{name:"yelp",url:["yelp.com"]},{name:"youtube",url:["youtube.com"]}]},87950:(e,t,n)=>{"use strict";n.d(t,{L:()=>o,x:()=>s});var r=n(51806),a=n(69307);const s=(0,a.createContext)(),o=({onBannerVisibilityChange:e,hasParentBanner:t,children:n})=>(0,r.createElement)(s.Provider,{value:{onBannerVisibilityChange:e,hasParentBanner:t},children:n})},23984:(e,t,n)=>{"use strict";var r=n(13419),a=n(47701),s=n.n(a),o=n(92694),i=n(65736),l=n(92819),c=n(30371),u=n(7832),d=n(42770),p=n(27003);const __=i.__,m=[];(0,o.addFilter)("blocks.registerBlockType","jetpack/paid-block",((e,t)=>((0,r.X1)(t)&&(m.includes(t)||m.push(t),e.keywords=(0,l.uniq)([...e.keywords,"premium",__("premium","jetpack")]),(0,r.HD)(t)||(e.icon=(0,d.Z)(e.icon)),e.attributes.shouldDisplayFrontendBanner||(e.attributes.shouldDisplayFrontendBanner={type:"boolean",default:!0}),"core/cover"!==t&&(e.supports={...e.supports,__experimentalExposeControlsToChildren:!0})),e))),(0,o.addFilter)("blocks.registerBlockType","jetpack/paid-block-with-upgrade-banner",p.v),(0,o.addFilter)("editor.MediaPlaceholder","jetpack/paid-block-media-placeholder",c.Z),(0,o.addFilter)("editor.MediaReplaceFlow","jetpack/paid-block-media-placeholder",u.Z),s()((function(){(0,r.FK)()&&document.body.classList.add("jetpack-enable-upgrade-nudge")}))},30371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(82674),a=n.n(r),s=n(51806),o=n(13419),i=n(52175),l=n(94333),c=n(69307),u=n(11317),d=n(87950);const p=(0,l.createHigherOrderComponent)((e=>t=>{const{name:n}=(0,i.useBlockEditContext)(),r=(0,o.m3)(n);if(!r?.mediaPlaceholder||!(0,o.X1)(n))return(0,s.createElement)(e,t);const{fileType:l}=r,{onError:p}=t,{onBannerVisibilityChange:m}=(0,c.useContext)(d.x),g=(0,c.useCallback)((e=>m(e?.length&&(0,u.Qu)(e[0],l))),[l,m]),A=(0,c.useCallback)((e=>{const t=e?.[0]?.props?.children;return(0,u.Qu)(t,l)?g([t]):p(e)}),[g,l,p]);return(0,s.createElement)("div",{className:"paid-block-media-placeholder"},(0,s.createElement)(e,a()({},t,{onFilesPreUpload:g,onError:A})))}),"withMediaPlaceholderUpgradable")},7832:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(82674),a=n.n(r),s=n(51806),o=n(13419),i=n(52175),l=n(94333),c=n(69307),u=n(11317),d=n(87950);const p=(0,l.createHigherOrderComponent)((e=>t=>{const{name:n}=(0,i.useBlockEditContext)(),r=(0,o.m3)(n),l=(0,c.useRef)();if(!r?.mediaReplaceFlow||!(0,o.X1)(n))return(0,s.createElement)(e,t);const{fileType:p}=r,{onBannerVisibilityChange:m}=(0,c.useContext)(d.x);return(0,s.createElement)(e,a()({},t,{onFilesUpload:e=>{l.current=e?.length?e[0]:null,m(e?.length&&(0,u.Qu)(e[0],p))},createNotice:(e,n,r)=>{if((0,u.Qu)(l.current,p))return l.current=null,null;t.createNotice(e,n,r)}}))}),"withMediaReplaceFlowUpgradable")},95796:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(55609);const s=({cx:e=0,cy:t=0,r:n=4,fill:s="#e34c84",stroke:o="#ffffff",strokeWidth:i="2"})=>(0,r.createElement)(a.SVG,{className:"jetpack-paid-block-symbol"},(0,r.createElement)(a.Circle,{cx:e,cy:t,r:n,fill:s,stroke:o,strokeWidth:i}))},42770:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i,p:()=>l});var r=n(51806),a=n(13419),s=n(95796);const o=e=>{const t=(0,r.createElement)(s.Z,{key:"paid-symbol"});return e?.src?{...e,src:(0,r.createElement)(r.Fragment,null,e.src,t)}:(0,r.createElement)(r.Fragment,null,e,t)},i=o;function l(e,t){return(0,a.X1)(e)?o(t):t}},66316:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(51806),a=n(9818),s=n(65736),o=n(26546),i=n(78798);const __=s.__,_x=s._x,l=__("Premium Block","jetpack"),/** translators: %s: name of the plan. */
c=__("Upgrade to %s to use this premium block","jetpack"),u=(__("Upgrade your plan to use this premium block","jetpack"),_x("Upgrade","Call to action to buy a new plan","jetpack")),d=({onRedirect:e,align:t,className:n,title:d=l,description:p=null,buttonText:m=u,visible:g=!0,requiredPlan:A,context:h})=>{const[E,f,C]=(0,i.Z)(A,e),b=(0,a.useSelect)((e=>{if(p)return p;const t=e("wordpress-com/plans"),n=t&&t.getPlan(A);return n?(0,s.sprintf)(c,n.product_name_short):null}),[p]);return b&&(0,r.createElement)(o.p,{align:t,buttonText:m,checkoutUrl:E,className:n,context:h,description:b,goToCheckoutPage:f,isRedirecting:C,title:d,visible:g})}},38140:(e,t,n)=>{"use strict";n.d(t,{W:()=>a,v:()=>r});const r=({plan:e,blockName:t,context:n,tracks:r})=>{r.recordEvent("jetpack_editor_block_upgrade_click",{plan:e,block:t,context:n})},a=({plan:e,blockName:t,context:n,tracks:r})=>{r.recordEvent("jetpack_editor_block_upgrade_banner_impression",{plan:e,block:t,context:n})}},27003:(e,t,n)=>{"use strict";n.d(t,{v:()=>m});var r=n(51806),a=n(13419),s=n(52175),o=n(94333),i=n(9818),l=n(69307),c=n(87950),u=n(66316),d=n(38140);const p=(0,o.createHigherOrderComponent)((e=>t=>{const{name:n,clientId:o,isSelected:p,attributes:m,setAttributes:g}=t||{},A=(0,a.Rl)(n);if(!A)return(0,r.createElement)(e,t);const h=(0,a.HD)(n),E=(0,a.m3)(n),[f,C]=(0,l.useState)(!h),[b,v]=(0,l.useState)(!1),k="editor-canvas",B=(0,i.useSelect)((e=>e("core/block-editor").hasSelectedInnerBlock(o,!0)),[]),{hasParentBanner:y}=(0,l.useContext)(c.x)||{},w=(p||B)&&f&&!y,{tracks:_}=(0,a.z$)(),I=(0,l.useMemo)((()=>({plan:A,blockName:n,context:k,tracks:_})),[A,n,_]);(0,l.useEffect)((()=>{w&&v(!0)}),[w,v]),(0,l.useEffect)((()=>{!b&&w&&(0,d.W)(I)}),[b,I,w]),(0,l.useEffect)((()=>C(!h)),[m,C,h]),(0,l.useEffect)((()=>{g({shouldDisplayFrontendBanner:!y})}),[g,y]);const j=(0,s.useBlockProps)();return(0,r.createElement)(c.L,{onBannerVisibilityChange:C,hasParentBanner:w},(0,r.createElement)("div",{ref:j.ref,style:{"max-width":"unset"}},(0,r.createElement)(u.ZP,{className:`is-${n.replace(/\//,"-")}-paid-block`,title:null,align:m?.align,visible:w,description:E?.description,requiredPlan:A,context:k,onRedirect:()=>(0,d.v)(I)}),(0,r.createElement)(e,t)))}),"withUpgradeBanner");function m(e,t){return(0,a.Rl)(t)?{...e,edit:p(e.edit)}:e}},90607:(e,t,n)=>{"use strict";n.d(t,{Z:()=>y});var r=n(51806),a=n(13419),s=n(55609),o=n(72067),i=n(65736),l=n(51128),c=n.n(l),u=(n(99196),n(63206)),d=n(18135),p=n(34613),m=n(77371),g=n(75317),A=n(75554),h=n(84102),E=n(30664),f=n(16597);const __=i.__,C=c()("jetpack-ai-assistant-plugin:sidebar"),b=window?.Jetpack_Editor_Initial_State?.available_blocks?.["ai-assistant-usage-panel"]?.available||!1,v=window?.Jetpack_Editor_Initial_State?.available_blocks?.["ai-featured-image-generator"]?.available||!1,k=window?.Jetpack_Editor_Initial_State?.available_blocks?.["ai-title-optimization"]?.available||!1,B=({placement:e,requireUpgrade:t,upgradeType:n})=>{const{checkoutUrl:a}=(0,u.Z)();return(0,r.createElement)(r.Fragment,null,k&&(0,r.createElement)(s.PanelRow,{className:"jetpack-ai-title-optimization__header"},(0,r.createElement)(s.BaseControl,{label:__("Optimize Publishing","jetpack")},(0,r.createElement)(A.Z,{placement:e,busy:!1,disabled:t}))),(0,r.createElement)(s.PanelRow,{className:"jetpack-ai-proofread-control__header"},(0,r.createElement)(s.BaseControl,{label:__("AI feedback on post","jetpack")},(0,r.createElement)(g.Z,{busy:!1,disabled:t}))),v&&(0,r.createElement)(s.PanelRow,{className:"jetpack-ai-featured-image-control__header"},(0,r.createElement)(s.BaseControl,{label:__("AI Featured Image","jetpack")},(0,r.createElement)(m.Z,{busy:!1,disabled:t,placement:e}))),t&&!b&&(0,r.createElement)(s.PanelRow,null,(0,r.createElement)(f.Z,{placement:e,type:n,upgradeUrl:a})),b&&(0,r.createElement)(s.PanelRow,null,(0,r.createElement)(h.Z,{placement:e})))};function y(){const{requireUpgrade:e,upgradeType:t,currentTier:n}=(0,d.Z)(),{checkoutUrl:i}=(0,u.Z)(),{tracks:l}=(0,a.z$)(),c=__("AI Assistant","jetpack");return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(p.Z,null,(0,r.createElement)(s.PanelBody,{title:c,initialOpen:!1,onToggle:e=>{var t;e&&(t=E.bA,C(t),l.recordEvent("jetpack_ai_panel_open",{placement:t}))}},(0,r.createElement)(B,{placement:E.bA,requireUpgrade:e,upgradeType:t}))),(0,r.createElement)(o.PluginDocumentSettingPanel,{icon:(0,r.createElement)(a.Pm,null),title:c,name:"jetpack-ai-assistant"},(0,r.createElement)(B,{placement:E.cG,requireUpgrade:e,upgradeType:t})),(0,r.createElement)(o.PluginPrePublishPanel,{title:c,icon:(0,r.createElement)(a.Pm,null),initialOpen:!1},(0,r.createElement)(r.Fragment,null,k&&(0,r.createElement)(A.Z,{placement:E.jm,busy:!1,disabled:e}),(0,r.createElement)(g.Z,{busy:!1,disabled:e}),e&&(0,r.createElement)(f.Z,{placement:E.jm,type:t,currentTier:n,upgradeUrl:i}))))}},30664:(e,t,n)=>{"use strict";n.d(t,{bA:()=>r,cG:()=>a,jm:()=>s});const r="jetpack-sidebar",a="document-settings",s="pre-publish"},16597:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(13419),s=n(55609),o=n(69307),i=n(65736);const __=i.__;function l({onClick:e,type:t,placement:n="",currentTier:l,upgradeUrl:c}){const{tracks:u}=(0,a.z$)(),d=(0,o.useCallback)((t=>{u.recordEvent("jetpack_ai_upgrade_button",{placement:n}),e?.(t)}),[e,u,n]),p=l?.value&&1!==l?.value?l.limit:20,m=__("You have reached the limit of 20 free requests. Upgrade to continue generating feedback. ","jetpack"),g=(0,i.sprintf)(/* translators: number is the request limit for the current tier/plan */
-__("You have reached the limit of %d requests . Upgrade to continue generating feedback. ","jetpack"),p),A=(0,o.createInterpolateElement)(__("You've reached the Jetpack AI rate limit. Please reach out to your VIP account team. ","jetpack"),{strong:(0,r.createElement)("strong",null)}),h=(0,o.createInterpolateElement)(20===p?m:g,{strong:(0,r.createElement)("strong",null),button:(0,r.createElement)(s.Button,{variant:"link",onClick:d,href:c,target:"_blank"})});return(0,r.createElement)("p",null,"vip"===t?A:h)}},30494:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(51806),a=n(55609),s=n(65736),o=n(61074),i=n(52800),l=n(46936),c=n(65235),u=n.n(c),d=n(69282);const __=s.__;function p({children:e,isDotted:t=!1}){const n=(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:`data:image/png;base64,${d.U}`,alt:""});return(0,r.createElement)("div",{className:"ai-assistant-featured-image__blank"},n,(0,r.createElement)("div",{className:u()("ai-assistant-featured-image__blank-content",{"is-dotted":t})},e))}function m({images:e,current:t,handlePreviousImage:n,handleNextImage:s,actions:c=null}){const d=(0,r.createElement)("button",{className:"ai-carrousel__prev",onClick:n},(0,r.createElement)(o.Z,{icon:i.Z,className:u()("ai-carrousel__prev-icon",{"is-disabled":0===t})})),m=(0,r.createElement)("button",{className:"ai-carrousel__next",onClick:s},(0,r.createElement)(o.Z,{icon:l.Z,className:u()("ai-carrousel__next-icon",{"is-disabled":t+1===e.length})}));return(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-images"},e.length>1&&d,e.map((({image:e,generating:n,error:s},o)=>(0,r.createElement)("div",{key:"image:"+o,className:u()("ai-assistant-featured-image__carrousel-image-container",{"is-current":t===o,"is-prev":t>o})},n?(0,r.createElement)(p,null,(0,r.createElement)(a.Spinner,{style:{width:"50px",height:"50px"}})):(0,r.createElement)(r.Fragment,null,s?(0,r.createElement)(p,{isDotted:!0},(0,r.createElement)("div",{className:"ai-assistant-featured-image__error"},__("An error occurred while generating the image. Please, try again!","jetpack"),s?.message&&(0,r.createElement)("span",{className:"ai-assistant-featured-image__error-message"},s?.message))):(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:e,alt:""}))))),e.length>1&&m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-footer"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-counter"},d,t+1," / ",e.length,m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-actions"},c)))}},77371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>j,h:()=>y});var r=n(51806),a=n(42290),s=n(13419),o=n(55609),i=n(9818),l=n(69307),c=n(65736),u=n(61074),d=n(15381),p=n(5246),m=n(18135),g=n(28788),A=n(23795),h=n(45975),E=n(84944),f=n(30664),C=n(78116),b=n(30494),v=n(62815);const __=c.__,k="ai-image-generator",B="featured-post-image",y="media-source-dropdown",w=(0,g.$)("ai-assistant-experimental-image-generation-support"),_=w?"stable-diffusion":"dall-e-3",I=(0,s.Ug)()?"atomic":(0,s.Wp)()?"simple":"jetpack";function j({busy:e,disabled:t,placement:n,onClose:g=(()=>{})}){const{toggleEditorPanelOpened:j}=(0,i.useDispatch)("core/edit-post"),{editPost:x,toggleEditorPanelOpened:S}=(0,i.useDispatch)("core/editor"),{clearSelectedBlock:Q}=(0,i.useDispatch)("core/block-editor"),[N,P]=(0,l.useState)(!1),[R,T]=(0,l.useState)([{generating:!0}]),[Z,L]=(0,l.useState)(0),M=(0,l.useRef)(0),[D,F]=(0,l.useState)(""),z=(0,l.useRef)(!1),{enableComplementaryArea:O}=(0,i.useDispatch)("core/interface"),{generateImage:U,generateImageWithStableDiffusion:H}=(0,a.Rc)(),{saveToMediaLibrary:V}=(0,E.Z)(),{tracks:q}=(0,s.z$)(),{recordEvent:G}=q,$=R[Z],W=R[M.current],{requireUpgrade:J,requestsCount:Y,requestsLimit:K,currentTier:X,increaseRequestsCount:ee,costs:te}=(0,m.Z)(),ne=(0,A.U_)(X),re=w?te?.[B]?.stableDiffusion??1:te?.[B]?.image,ae=ne===A.hp,se=K-Ye("core/editor").isEditorPanelOpened??e("core/edit-post").isEditorPanelOpened),[]),ce=(0,l.useCallback)((()=>{ee(re)}),[ee,re]),ue=(0,l.useCallback)(((e,t)=>{T((n=>{const r=[...n];return r[t]={...r[t],...e},r})),e.error&&G("jetpack_ai_featured_image_generation_error",{placement:n,error:e.error?.message,model:_,site_type:I})}),[n,G]),de=(0,l.useCallback)((()=>{L(Math.max(Z-1,0))}),[Z,L]),pe=(0,l.useCallback)((()=>{L(Math.min(Z+1,R.length-1))}),[Z,R.length]),me=(0,l.useCallback)((()=>{if(ue({generating:!0,error:null},M.current),se)return void ue({generating:!1,error:new Error(__("You don't have enough requests to generate another image.","jetpack"))},M.current);if(!D&&!oe)return void ue({generating:!1,error:new Error(__("No content to generate image. Please type custom instructions and try again.","jetpack"))},M.current);(w?H({feature:B,postContent:oe,userPrompt:D}):U({feature:B,postContent:oe,responseFormat:"b64_json",userPrompt:D})).then((e=>{if(e.data.length>0){const t="data:image/png;base64,"+e.data[0].b64_json;ue({image:t},M.current),ce(),V(t).then((e=>{ue({libraryId:e.id,generating:!1},M.current),M.current+=1})).catch((()=>{ue({generating:!1},M.current),M.current+=1}))}})).catch((e=>{ue({generating:!1,error:e},M.current)}))}),[se,ue,U,H,oe,D,ce,V]),ge=(0,l.useCallback)((()=>{P(!N)}),[N,P]),Ae=(0,l.useCallback)((()=>{ge(),g?.()}),[ge,g]),he=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_generate_image",{placement:n,model:_,site_type:I}),ge(),me()}),[ge,me,G,n]),Ee=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_generate_another_image",{placement:n,model:_,site_type:I}),me(),L((e=>e+1))}),[me,G,n]),fe=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_try_again",{placement:n,model:_,site_type:I}),me()}),[me,G,n]),Ce=(0,l.useCallback)((e=>{F(e.target.value)}),[F]),be=(0,l.useCallback)((()=>(Q(),O("core/edit-post","edit-post/document"))),[Q,O]),ve=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_use_image",{placement:n,model:_,site_type:I});const e=e=>{x({featured_media:e}),Ae(),setTimeout((()=>{const e=le("featured-image"),t=le("post-status");be().then((()=>{e||ie("featured-image"),t||ie("post-status")}))}),500)};R[Z].libraryId?e(R[Z].libraryId):V(R[Z].image).then((t=>{e(t.id)}))}),[Z,x,R,le,G,V,ie,be,Ae,n]);(0,l.useEffect)((()=>{n===y&&(z.current||(z.current=!0,he()))}),[n,he]);const ke=__("Generate a featured image with AI","jetpack"),Be=__("1 request per image","jetpack"),ye=(0,c.sprintf)(
+__("You have reached the limit of %d requests . Upgrade to continue generating feedback. ","jetpack"),p),A=(0,o.createInterpolateElement)(__("You've reached the Jetpack AI rate limit. Please reach out to your VIP account team. ","jetpack"),{strong:(0,r.createElement)("strong",null)}),h=(0,o.createInterpolateElement)(20===p?m:g,{strong:(0,r.createElement)("strong",null),button:(0,r.createElement)(s.Button,{variant:"link",onClick:d,href:c,target:"_blank"})});return(0,r.createElement)("p",null,"vip"===t?A:h)}},30494:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(51806),a=n(55609),s=n(65736),o=n(61074),i=n(52800),l=n(46936),c=n(65235),u=n.n(c),d=n(69282);const __=s.__;function p({children:e,isDotted:t=!1}){const n=(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:`data:image/png;base64,${d.U}`,alt:""});return(0,r.createElement)("div",{className:"ai-assistant-featured-image__blank"},n,(0,r.createElement)("div",{className:u()("ai-assistant-featured-image__blank-content",{"is-dotted":t})},e))}function m({images:e,current:t,handlePreviousImage:n,handleNextImage:s,actions:c=null}){const d=(0,r.createElement)("button",{className:"ai-carrousel__prev",onClick:n},(0,r.createElement)(o.Z,{icon:i.Z,className:u()("ai-carrousel__prev-icon",{"is-disabled":0===t})})),m=(0,r.createElement)("button",{className:"ai-carrousel__next",onClick:s},(0,r.createElement)(o.Z,{icon:l.Z,className:u()("ai-carrousel__next-icon",{"is-disabled":t+1===e.length})}));return(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-images"},e.length>1&&d,e.map((({image:e,generating:n,error:s},o)=>(0,r.createElement)("div",{key:"image:"+o,className:u()("ai-assistant-featured-image__carrousel-image-container",{"is-current":t===o,"is-prev":t>o})},n?(0,r.createElement)(p,null,(0,r.createElement)(a.Spinner,{style:{width:"50px",height:"50px"}})):(0,r.createElement)(r.Fragment,null,s?(0,r.createElement)(p,{isDotted:!0},(0,r.createElement)("div",{className:"ai-assistant-featured-image__error"},__("An error occurred while generating the image. Please, try again!","jetpack"),s?.message&&(0,r.createElement)("span",{className:"ai-assistant-featured-image__error-message"},s?.message))):(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:e,alt:""}))))),e.length>1&&m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-footer"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-counter"},d,t+1," / ",e.length,m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-actions"},c)))}},77371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>I,h:()=>B});var r=n(51806),a=n(42290),s=n(13419),o=n(55609),i=n(9818),l=n(69307),c=n(65736),u=n(61074),d=n(15381),p=n(5246),m=n(18135),g=n(23795),A=n(45975),h=n(84944),E=n(30664),f=n(78116),C=n(30494),b=n(62815);const __=c.__,v="ai-image-generator",k="featured-post-image",B="media-source-dropdown",y="stable-diffusion",w="dall-e-3",_=(0,s.Ug)()?"atomic":(0,s.Wp)()?"simple":"jetpack";function I({busy:e,disabled:t,placement:n,onClose:I=(()=>{})}){const{toggleEditorPanelOpened:j}=(0,i.useDispatch)("core/edit-post"),{editPost:x,toggleEditorPanelOpened:S}=(0,i.useDispatch)("core/editor"),{clearSelectedBlock:Q}=(0,i.useDispatch)("core/block-editor"),[N,P]=(0,l.useState)(!1),[R,T]=(0,l.useState)([{generating:!0}]),[Z,L]=(0,l.useState)(0),M=(0,l.useRef)(0),[D,F]=(0,l.useState)(""),z=(0,l.useRef)(!1),{enableComplementaryArea:O}=(0,i.useDispatch)("core/interface"),{generateImageWithParameters:U}=(0,a.Rc)(),{saveToMediaLibrary:H}=(0,h.Z)(),{tracks:V}=(0,s.z$)(),{recordEvent:q}=V,G=R[Z],$=R[M.current],{requireUpgrade:W,requestsCount:J,requestsLimit:Y,currentTier:K,increaseRequestsCount:X,costs:ee}=(0,m.Z)(),te=(0,g.U_)(K),ne=ee?.[k]?.activeModel??10,re=ne===ee?.[k]?.stableDiffusion?y:w,ae=te===g.hp,se=Y-Je("core/editor").isEditorPanelOpened??e("core/edit-post").isEditorPanelOpened),[]),ce=(0,l.useCallback)((()=>{X(ne)}),[X,ne]),ue=(0,l.useCallback)(((e,t)=>{T((n=>{const r=[...n];return r[t]={...r[t],...e},r})),e.error&&q("jetpack_ai_featured_image_generation_error",{placement:n,error:e.error?.message,model:re,site_type:_})}),[n,q,re]),de=(0,l.useCallback)((()=>{L(Math.max(Z-1,0))}),[Z,L]),pe=(0,l.useCallback)((()=>{L(Math.min(Z+1,R.length-1))}),[Z,R.length]),me=(0,l.useCallback)((()=>{if(ue({generating:!0,error:null},M.current),se)return void ue({generating:!1,error:new Error(__("You don't have enough requests to generate another image.","jetpack"))},M.current);if(!D&&!oe)return void ue({generating:!1,error:new Error(__("No content to generate image. Please type custom instructions and try again.","jetpack"))},M.current);U({feature:k,size:"1792x1024",responseFormat:"b64_json",style:"photographic",messages:[{role:"jetpack-ai",context:{type:"featured-image-generation",request:D||null,content:oe}}]}).then((e=>{if(e.data.length>0){const t="data:image/png;base64,"+e.data[0].b64_json;ue({image:t},M.current),ce(),H(t).then((e=>{ue({libraryId:e.id,generating:!1},M.current),M.current+=1})).catch((()=>{ue({generating:!1},M.current),M.current+=1}))}})).catch((e=>{ue({generating:!1,error:e},M.current)}))}),[se,ue,U,oe,D,ce,H]),ge=(0,l.useCallback)((()=>{P(!N)}),[N,P]),Ae=(0,l.useCallback)((()=>{ge(),I?.()}),[ge,I]),he=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_generate_image",{placement:n,model:re,site_type:_}),ge(),me()}),[ge,me,q,n,re]),Ee=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_generate_another_image",{placement:n,model:re,site_type:_}),me(),L((e=>e+1))}),[me,q,n,re]),fe=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_try_again",{placement:n,model:re,site_type:_}),me()}),[me,q,n,re]),Ce=(0,l.useCallback)((e=>{F(e.target.value)}),[F]),be=(0,l.useCallback)((()=>(Q(),O("core/edit-post","edit-post/document"))),[Q,O]),ve=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_use_image",{placement:n,model:re,site_type:_});const e=e=>{x({featured_media:e}),Ae(),setTimeout((()=>{const e=le("featured-image"),t=le("post-status");be().then((()=>{e||ie("featured-image"),t||ie("post-status")}))}),500)};R[Z].libraryId?e(R[Z].libraryId):H(R[Z].image).then((t=>{e(t.id)}))}),[Z,x,R,le,q,H,ie,be,Ae,n,re]);(0,l.useEffect)((()=>{n===B&&(z.current||(z.current=!0,he()))}),[n,he]);const ke=__("Generate a featured image with AI","jetpack"),Be=__("1 request per image","jetpack"),ye=(0,c.sprintf)(
// Translators: %d is the cost of generating one image.
-__("%d requests per image","jetpack"),re),we=1===re?Be:ye,_e=(0,r.createElement)(o.Button,{onClick:ve,variant:"primary",isBusy:$?.generating,disabled:!$?.image},__("Set as featured image","jetpack"));return(0,r.createElement)("div",null,(n===f.bA||n===f.cG)&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",null,__("Create and use an AI generated featured image for your post.","jetpack")),(0,r.createElement)(o.Button,{onClick:he,isBusy:e,disabled:!oe||t||se,variant:"secondary"},__("Generate image","jetpack"))),N&&(0,r.createElement)(C.Z,{handleClose:Ae,title:ke},(0,r.createElement)("div",{className:"ai-assistant-featured-image__content"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt-textarea"},(0,r.createElement)("textarea",{disabled:se||W?.generating,maxLength:1e3,rows:2,onChange:Ce,placeholder:__("Include optional instructions to generate a new image","jetpack")}))),(J||se)&&!W?.generating&&(0,r.createElement)(p.Z,{description:se?(0,c.sprintf)(
+__("%d requests per image","jetpack"),ne),we=1===ne?Be:ye,_e=(0,r.createElement)(o.Button,{onClick:ve,variant:"primary",isBusy:G?.generating,disabled:!G?.image},__("Set as featured image","jetpack"));return(0,r.createElement)("div",null,(n===E.bA||n===E.cG)&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",null,__("Create and use an AI generated featured image for your post.","jetpack")),(0,r.createElement)(o.Button,{onClick:he,isBusy:e,disabled:!oe||t||se,variant:"secondary"},__("Generate image","jetpack"))),N&&(0,r.createElement)(f.Z,{handleClose:Ae,title:ke},(0,r.createElement)("div",{className:"ai-assistant-featured-image__content"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt-textarea"},(0,r.createElement)("textarea",{disabled:se||$?.generating,maxLength:1e3,rows:2,onChange:Ce,placeholder:__("Include optional instructions to generate a new image","jetpack")}))),(W||se)&&!$?.generating&&(0,r.createElement)(p.Z,{description:se?(0,c.sprintf)(
// Translators: %d is the cost of generating a featured image.
-__("Featured image generation costs %d requests per image. You don't have enough requests to generate another image.","jetpack"),re):null,placement:k,useLightNudge:!0}),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-left"},!ae&&re&&K&&(0,r.createElement)(v.Z,{cost:re,currentLimit:K,currentUsage:Y})),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-right"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__action-buttons"},W?.error?(0,r.createElement)(o.Button,{onClick:fe,variant:"secondary",disabled:!D&&!oe},__("Try again","jetpack")):(0,r.createElement)(o.Tooltip,{text:we,placement:"bottom"},(0,r.createElement)(o.Button,{onClick:Ee,variant:"secondary",isBusy:W?.generating,disabled:se||W?.generating||!D&&!oe},__("Generate again","jetpack")))))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__image-canvas"},(0,r.createElement)(b.Z,{images:R,current:Z,handlePreviousImage:de,handleNextImage:pe,actions:_e}))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__footer"},(0,r.createElement)(o.Button,{variant:"link",className:"ai-assistant-featured-image__feedback-button",href:"https://jetpack.com/redirect/?source=jetpack-ai-feedback",target:"_blank"},(0,r.createElement)("span",null,__("Provide feedback","jetpack")),(0,r.createElement)(u.Z,{icon:d.Z,className:"icon"})))))}},62815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(69307),s=n(65736);const __=s.__;function o({currentLimit:e,currentUsage:t,cost:n}){const o=e-t,i=(0,a.createInterpolateElement)(
+__("Featured image generation costs %d requests per image. You don't have enough requests to generate another image.","jetpack"),ne):null,placement:v,useLightNudge:!0}),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-left"},!ae&&ne&&Y&&(0,r.createElement)(b.Z,{cost:ne,currentLimit:Y,currentUsage:J})),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-right"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__action-buttons"},$?.error?(0,r.createElement)(o.Button,{onClick:fe,variant:"secondary",disabled:!D&&!oe},__("Try again","jetpack")):(0,r.createElement)(o.Tooltip,{text:we,placement:"bottom"},(0,r.createElement)(o.Button,{onClick:Ee,variant:"secondary",isBusy:$?.generating,disabled:se||$?.generating||!D&&!oe},__("Generate again","jetpack")))))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__image-canvas"},(0,r.createElement)(C.Z,{images:R,current:Z,handlePreviousImage:de,handleNextImage:pe,actions:_e}))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__footer"},(0,r.createElement)(o.Button,{variant:"link",className:"ai-assistant-featured-image__feedback-button",href:"https://jetpack.com/redirect/?source=jetpack-ai-feedback",target:"_blank"},(0,r.createElement)("span",null,__("Provide feedback","jetpack")),(0,r.createElement)(u.Z,{icon:d.Z,className:"icon"})))))}},62815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(69307),s=n(65736);const __=s.__;function o({currentLimit:e,currentUsage:t,cost:n}){const o=e-t,i=(0,a.createInterpolateElement)(
// Translators: %d is the cost of one image.
// Translators: %d is the cost of one image.
(0,s.sprintf)(__("Requests needed: %d ","jetpack"),n),{counter:(0,r.createElement)("span",null)}),l=(0,a.createInterpolateElement)(
diff --git a/_inc/blocks/editor-no-post-editor.asset.php b/_inc/blocks/editor-no-post-editor.asset.php
index 125da8263e..0ecb54be58 100644
--- a/_inc/blocks/editor-no-post-editor.asset.php
+++ b/_inc/blocks/editor-no-post-editor.asset.php
@@ -1 +1 @@
- array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets'), 'version' => 'bda03b0be6a1fa4d96a0');
+ array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets'), 'version' => '943ebc51baa07de59788');
diff --git a/_inc/blocks/editor-no-post-editor.js b/_inc/blocks/editor-no-post-editor.js
index 2c9577613a..dc9c533467 100644
--- a/_inc/blocks/editor-no-post-editor.js
+++ b/_inc/blocks/editor-no-post-editor.js
@@ -3,7 +3,7 @@
// translators: %1$d: number of requests remaining
__("You have %1$d requests remaining.","jetpack"),e)),React.createElement(r.Button,{variant:"link",onClick:n,href:o,target:o?"_blank":null},__("Upgrade now","jetpack")))}function B({error:e,code:t,onTryAgainClick:n,onUpgradeClick:o,upgradeUrl:s}){const i=e||__("Something went wrong","jetpack");return React.createElement(E,{severity:p},React.createElement("span",null,(0,a.sprintf)(
// translators: %1$d: A dynamic error message
-__("Error: %1$s","jetpack"),i)),t===A.$L?React.createElement(r.Button,{variant:"link",onClick:o,href:s,target:s?"_blank":null},__("Upgrade now","jetpack")):React.createElement(r.Button,{variant:"link",onClick:n},__("Try again","jetpack")))}},62282:(e,t,n)=>{"use strict";n.d(t,{h:()=>s,u:()=>o});var r=n(99196),a=n.n(r);const o=(0,r.createContext)({}),s=({value:e,children:t})=>a().createElement(o.Provider,{value:e,children:t})},20281:(e,t,n)=>{"use strict";n.d(t,{X_:()=>o.Z,hE:()=>r.h,oN:()=>a.Z,uE:()=>r.u});var r=n(62282),a=n(3669),o=n(79466)},79466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(99196),a=n(16700),o=n(20281);function s({onDone:e,onSuggestion:t,onError:n}={}){const s=(0,r.useContext)(o.uE),{eventSource:i}=s,l=(0,r.useCallback)((t=>e?.(t?.detail)),[e]),c=(0,r.useCallback)((e=>t?.(e?.detail)),[t]),u=(0,r.useCallback)((e=>{n?.(e?.detail)}),[]);return(0,r.useEffect)((()=>{if(i)return e&&i.addEventListener("done",l),t&&i.addEventListener("suggestion",c),n&&i.addEventListener(a.vF,u),()=>{i.removeEventListener("done",l),i.removeEventListener("suggestion",c),i.removeEventListener(a.vF,u)}}),[i]),s}},3669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(94333),a=n(69307),o=n(99196),s=n.n(o),i=n(42194),l=n(20281);const c=(0,r.createHigherOrderComponent)((e=>t=>{const{suggestion:n,error:r,requestingState:o,request:c,stopSuggestion:u,eventSource:A}=(0,i.Z)(),g=(0,a.useMemo)((()=>({suggestion:n,requestingError:r,requestingState:o,eventSource:A,requestSuggestion:c,stopSuggestion:u})),[n,r,o,A,c,u]);return s().createElement(l.hE,{value:g},s().createElement(e,t))}),"withAiDataProvider")},42194:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Z:()=>l});var r=n(69307),a=n(65736),o=n(67742),s=n(16700);const __=a.__;function i(e){switch(e){case s.$L:return{code:s.$L,message:__("You have reached the limit of requests for this site.","jetpack"),severity:"info"};case s.bC:return{code:s.bC,message:__("Your request was unclear. Mind trying again?","jetpack"),severity:"info"};case s.$u:return{code:s.$u,message:__("Jetpack AI services are currently unavailable. Sorry for the inconvenience.","jetpack"),severity:"info"};case s.q4:return{code:s.q4,message:__("This request has been flagged by our moderation system. Please try to rephrase it and try again.","jetpack"),severity:"info"};case s.cv:return{code:s.cv,message:__("The content is too large to be processed all at once. Please try to shorten it or divide it into smaller parts.","jetpack"),severity:"info"};case s.co:default:return{code:s.co,message:__("It was not possible to process your request. Mind trying again?","jetpack"),severity:"info"}}}function l({prompt:e,autoRequest:t=!1,askQuestionOptions:n={},initialRequestingState:a="init",onSuggestion:l,onDone:c,onStop:u,onError:A,onAllErrors:g}={}){const[p,d]=(0,r.useState)(a),[m,h]=(0,r.useState)(""),[E,f]=(0,r.useState)(),C=(0,r.useRef)(void 0),B=(0,r.useCallback)((e=>{h(e?.detail),l?.(e?.detail)}),[l]),b=(0,r.useCallback)((e=>{x(),c?.(e?.detail),d("done")}),[c]),k=(0,r.useCallback)((e=>{g?.(e?.detail)}),[g]),v=(0,r.useCallback)((e=>{C?.current?.close(),d("error"),f(i(e)),A?.(i(e))}),[A]),I=(0,r.useCallback)((()=>v(s.$L)),[]),y=(0,r.useCallback)((()=>v(s.bC)),[]),w=(0,r.useCallback)((()=>v(s.$u)),[]),Q=(0,r.useCallback)((()=>v(s.q4)),[]),_=(0,r.useCallback)((()=>v(s.co)),[]),S=(0,r.useCallback)((async(e,t={...n})=>{if(f(void 0),d("requesting"),C.current=await(0,o.Z)(e,t),!C?.current)return;const r=C.current;d("suggesting"),r.addEventListener("suggestion",B),r.addEventListener(s.$L,I),r.addEventListener(s.bC,y),r.addEventListener(s.$u,w),r.addEventListener(s.q4,Q),r.addEventListener(s.co,_),r.addEventListener(s.vF,k),r.addEventListener("done",b)}),[b,I,y,w,Q,_,B]),j=(0,r.useCallback)((()=>{d("init"),h(""),f(void 0)}),[]),x=(0,r.useCallback)((()=>{if(!C?.current)return;const e=C?.current;e.close(),e.removeEventListener("suggestion",B),e.removeEventListener(s.$L,I),e.removeEventListener(s.bC,y),e.removeEventListener(s.$u,w),e.removeEventListener(s.q4,Q),e.removeEventListener(s.co,_),e.removeEventListener("done",b)}),[C,B,I,y,w,Q,_,b]),L=(0,r.useCallback)((()=>{x(),u?.(),d("done")}),[u]);return(0,r.useEffect)((()=>{if(e?.length)return t&&S(e,n),()=>{L()}}),[t,e,S,L]),{suggestion:m,error:E,requestingState:p,request:S,stopSuggestion:L,reset:j,handleErrorQuotaExceededError:I,eventSource:C.current}}},93509:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(69307),a=n(65736),o=n(51128),s=n.n(o),i=n(46961);const __=a.__,l=s()("jetpack-ai-client:use-audio-transcription"),c=e=>{if("string"==typeof e)return e;if("code"in e)switch(e.code){case"error_quota_exceeded":return __("You exceeded your current quota, please check your plan details.","jetpack");case"jetpack_ai_missing_audio_param":return __("The audio_file is required to perform a transcription.","jetpack");case"jetpack_ai_service_unavailable":return __("The Jetpack AI service is temporarily unavailable.","jetpack");case"file_size_not_supported":return __("The provided audio file is too big.","jetpack");case"file_type_not_supported":return __("The provided audio file type is not supported.","jetpack");case"jetpack_ai_error":return __("There was an error processing the transcription request.","jetpack");default:return e.message}return"message"in e?e.message:__("There was an error processing the transcription request.","jetpack")};function u({feature:e,onReady:t,onError:n}){const[a,o]=(0,r.useState)(""),[s,u]=(0,r.useState)(""),[A,g]=(0,r.useState)(!1),p=(0,r.useRef)(null);return{transcriptionResult:a,isTranscribingAudio:A,transcriptionError:s,transcribeAudio:(0,r.useCallback)((r=>{l("Transcribing audio"),o(""),u(""),g(!0);const a=new AbortController;p.current=a,(0,i.Z)(r,e,a.signal).then((e=>{o(e),t?.(e)})).catch((e=>{a.signal.aborted||(u(e.message),n?.(c(e)))})).finally((()=>g(!1)))}),[i.Z,o,u,g]),cancelTranscription:(0,r.useCallback)((()=>{p.current?.abort(),o(""),u(""),g(!1)}),[p,o,u,g])}}},92718:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(69307),a=n(65736);const __=a.__,o=25e6,s=1500,i=["audio/mpeg","audio/mp3","audio/ogg","audio/flac","audio/x-flac","audio/m4a","audio/x-m4a","audio/mp4","audio/wav","audio/wave","audio/x-wav","audio/webm"];function l(){const[e,t]=(0,r.useState)(!1);return{isValidatingAudio:e,validateAudio:(0,r.useCallback)(((e,n,r)=>{if(t(!0),e?.size>o)return t(!1),r(__("The audio file is too large. The maximum file size is 25MB.","jetpack"));const a=e instanceof File;if(a&&!i.includes(e.type))return t(!1),r(__("The audio file type is not supported. Please use a supported audio file type.","jetpack"));const l=new AudioContext;e.arrayBuffer().then((o=>{l.decodeAudioData(o,(function(o){const i=Math.ceil(o.duration);return i>s?(t(!1),r(__("The audio file is too long. The maximum recording time is 25 minutes.","jetpack"))):(t(!1),n({duration:i,isFile:a,size:e?.size}))}))}))}),[t])}}},70286:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51128),a=n.n(r),o=n(78982),s=n(2890);const i=a()("ai-client:use-image-generator"),l=(e,t)=>{const n=4e3-t;return e.length>n?e.substring(0,n-6)+" [...]":e},c=async(e,t,n)=>{const r=((e,t)=>{if(t){const n=`I need a Stable Diffusion prompt to generate a featured image for a blog post based on this user-provided image description:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nThe image should be a photo. Make sure you highlight the main suject of the image description, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}return"I need a Stable Diffusion prompt to generate a featured image for a blog post with the following content.\nThe image should be a photo. Make sure you highlight the main suject of the content, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments. The content is:\n\n"+l(e,412)})(e,t),a=await(0,o.Z)(r,{feature:n});return a.choices?.[0]?.message?.content},u=()=>{const e=async function(e){let t="";try{t=(await(0,s.Z)()).token}catch(e){return i("Error getting token: %o",e),Promise.reject(e)}try{const n="https://public-api.wordpress.com/wpcom/v2/jetpack-ai-image",r={Authorization:`Bearer ${t}`,"Content-Type":"application/json"},a=await fetch(n,{method:"POST",headers:r,body:JSON.stringify(e)}).then((e=>e.json()));return a?.data?.status&&a?.data?.status>200?(i("Error generating image: %o",a),Promise.reject(a)):a}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}};return{generateImage:async function({feature:t,postContent:n,responseFormat:r="url",userPrompt:a}){try{i("Generating image");const o=((e,t)=>{if(t){const n=`I need a cover image for a blog post based on this user prompt:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nBefore creating the image, identify the main topic of the user prompt and relate it to the post content.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}const n="I need a cover image for a blog post.\nBefore creating the image, identify the main topic of the content and only represent it.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nThis is the post content:\n\n";return n+l(e,838)})(n,a),s={prompt:o,response_format:r,feature:t,size:"1792x1024"};return await e(s)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithStableDiffusion:async function({feature:t,postContent:n,userPrompt:r}){try{i("Generating image with Stable Diffusion");const a={prompt:await c(n,r,t),feature:t,model:"stable-diffusion",style:"photographic"};return await e(a)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}}}}},13109:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(69307);const a="audio/mp4;codecs=mp4a",o="audio/mp4",s="audio/webm";function i({onDone:e}={}){const t=(0,r.useRef)(null),[n,i]=(0,r.useState)("inactive"),l=(0,r.useRef)(!1),c=(0,r.useRef)(0),[u,A]=(0,r.useState)(0),g=(0,r.useRef)(null),[p,d]=(0,r.useState)(null),m=(0,r.useRef)([]).current,[h,E]=(0,r.useState)(null),f=(0,r.useRef)(null);function C(){return MediaRecorder.isTypeSupported(a)?new Blob(m,{type:o}):new Blob(m,{type:s})}const B=(0,r.useCallback)((e=>{if(I(),!e)return t?.current?.start();e<100&&(e=100),c.current=Date.now(),t?.current?.start(e)}),[]),b=(0,r.useCallback)((()=>{l.current=!0,t?.current?.pause(),A((e=>e+Date.now()-c.current))}),[]),k=(0,r.useCallback)((()=>{l.current=!1,t?.current?.resume(),c.current=Date.now()}),[]),v=(0,r.useCallback)((()=>{t?.current?.stop(),"recording"===n&&A((e=>e+Date.now()-c.current))}),[]),I=(0,r.useCallback)((()=>{m.length=0,d(null),E(null),A(0),l.current=!1,c.current=0}),[]),y=(0,r.useCallback)((()=>{t?.current&&(t.current.removeEventListener("start",_),t.current.removeEventListener("stop",S),t.current.removeEventListener("pause",j),t.current.removeEventListener("resume",x),t.current.removeEventListener("dataavailable",L),t.current=null)}),[]),w=(0,r.useCallback)((()=>{if(i("inactive"),I(),y(),!navigator.mediaDevices?.getUserMedia)return;const e=new AudioContext;f.current=e.createAnalyser();navigator.mediaDevices.getUserMedia({audio:!0}).then((n=>{g.current=n;e.createMediaStreamSource(n).connect(f.current),MediaRecorder.isTypeSupported(a)?t.current=new MediaRecorder(n,{mimeType:a}):t.current=new MediaRecorder(n,{mimeType:s}),t.current.addEventListener("start",_),t.current.addEventListener("stop",S),t.current.addEventListener("pause",j),t.current.addEventListener("resume",x),t.current.addEventListener("dataavailable",L)})).catch((e=>{throw e}))}),[]),Q=(0,r.useCallback)((e=>{v(),E("string"==typeof e?e:e.message),i("error")}),[]);function _(){i("recording")}function S(){const t=C();e?.(t),m.length=0}function j(){i("paused")}function x(){i("recording")}function L(e){const{data:t}=e;t?.size&&(m.push(t),d(C()),l.current||A((e=>{const t=Date.now(),n=t-c.current;return c.current=t,e+n})))}return(0,r.useEffect)((()=>(w(),()=>{g.current&&g.current.getTracks().forEach((e=>e.stop())),y()})),[]),{state:n,blob:p,error:h,duration:u,analyser:f.current,onError:Q,controls:{start:B,pause:b,resume:k,stop:v,reset:w}}}},44696:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>c});var r=n(69307),a=n(51128),o=n.n(a),s=n(42194);const i=o()("jetpack-ai-client:use-transcription-post-processing"),l="voice-to-content-simple-draft";function c({feature:e,onReady:t,onError:n,onUpdate:a}){const[o,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[A,g]=(0,r.useState)(!1),p=(0,r.useCallback)((e=>{l(e),a?.(e)}),[l,a]),d=(0,r.useCallback)((e=>{l(e),a?.(e),t?.(e)}),[l,a,t]),m=(0,r.useCallback)((e=>{u(e.message),n?.(e.message)}),[u,n]),{request:h,stopSuggestion:E}=(0,s.Z)({onSuggestion:p,onDone:d,onError:m});return{postProcessingResult:o,isProcessingTranscription:A,postProcessingError:c,processTranscription:(0,r.useCallback)(((t,n)=>{i("Post-processing transcription"),l(""),u(""),g(!0);h([{role:"jetpack-ai",context:{type:t,content:n}}],{feature:e})}),[l,u,g,h,e]),cancelTranscriptionProcessing:(0,r.useCallback)((()=>{E(),g(!1)}),[E,g])}}},61317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(55609),a=n(99196),o=n.n(a);const s=o().createElement(r.SVG,{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"ai-assistant-icon"},o().createElement(r.Path,{className:"spark-first",d:"M9.33301 5.33325L10.4644 8.20188L13.333 9.33325L10.4644 10.4646L9.33301 13.3333L8.20164 10.4646L5.33301 9.33325L8.20164 8.20188L9.33301 5.33325Z"}),o().createElement(r.Path,{className:"spark-second",d:"M21.3333 5.33333L22.8418 9.15817L26.6667 10.6667L22.8418 12.1752L21.3333 16L19.8248 12.1752L16 10.6667L19.8248 9.15817L21.3333 5.33333Z"}),o().createElement(r.Path,{className:"spark-third",d:"M14.6667 13.3333L16.5523 18.1144L21.3333 20L16.5523 21.8856L14.6667 26.6667L12.781 21.8856L8 20L12.781 18.1144L14.6667 13.3333Z"}))},83585:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(55609);const a=React.createElement(r.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.95833C6.66328 3.95833 3.95833 6.66327 3.95833 9.99999C3.95833 13.3367 6.66328 16.0417 10 16.0417C13.3367 16.0417 16.0417 13.3367 16.0417 9.99999C16.0417 6.66327 13.3367 3.95833 10 3.95833ZM2.70833 9.99999C2.70833 5.97292 5.97292 2.70833 10 2.70833C14.0271 2.70833 17.2917 5.97292 17.2917 9.99999C17.2917 14.0271 14.0271 17.2917 10 17.2917C5.97292 17.2917 2.70833 14.0271 2.70833 9.99999Z"}),React.createElement(r.Path,{d:"M10.8333 5.83333H9.16667V10.8333H10.8333V5.83333Z"}),React.createElement(r.Path,{d:"M10.8333 12.5H9.16667V14.1667H10.8333V12.5Z"}))},59822:(e,t,n)=>{"use strict";n.d(t,{Qf:()=>a.Z,Qr:()=>o.Z,u_:()=>r.Z,v_:()=>s.Z});var r=n(61317),a=n(81204),o=(n(4454),n(71893),n(52887),n(96083)),s=n(50500)},81204:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(55609),a=n(99196),o=n.n(a);const s=o().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},o().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),o().createElement(r.Rect,{x:"10.5",y:"8.25",width:"3",height:"4.875",rx:"1.5",fill:"#008710"}),o().createElement(r.Path,{d:"M15 11.25C15 11.644 14.9224 12.0341 14.7716 12.3981C14.6209 12.762 14.3999 13.0927 14.1213 13.3713C13.8427 13.6499 13.512 13.8709 13.1481 14.0216C12.7841 14.1724 12.394 14.25 12 14.25C11.606 14.25 11.2159 14.1724 10.8519 14.0216C10.488 13.8709 10.1573 13.6499 9.87868 13.3713C9.6001 13.0927 9.37913 12.762 9.22836 12.3981C9.0776 12.0341 9 11.644 9 11.25",stroke:"#008710",strokeWidth:"1.125",strokeLinecap:"round"}),o().createElement(r.Path,{d:"M11.4375 15.75C11.4375 16.0607 11.6893 16.3125 12 16.3125C12.3107 16.3125 12.5625 16.0607 12.5625 15.75L11.4375 15.75ZM11.4375 14.25L11.4375 15.75L12.5625 15.75L12.5625 14.25L11.4375 14.25Z",fill:"#008710"}))},4454:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),o=n.n(a);r.SVG,r.Path,r.Path},96083:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(55609),a=n(99196),o=n.n(a);const s=o().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},o().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),o().createElement(r.Rect,{x:"12.75",y:"9",width:"2.25",height:"6",fill:"#008710"}),o().createElement(r.Rect,{x:"9",y:"9",width:"2.25",height:"6",fill:"#008710"}))},71893:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),o=n.n(a);r.SVG,r.Path,r.Path},52887:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),o=n.n(a);r.SVG,r.Path,r.Rect},50500:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(55609),a=n(99196),o=n.n(a);const s=o().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5 10C12.5 11.3807 11.3807 12.5 10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10ZM14 10C14 12.2091 12.2091 14 10 14C7.79086 14 6 12.2091 6 10C6 7.79086 7.79086 6 10 6C12.2091 6 14 7.79086 14 10ZM16.75 21V19C16.75 17.4812 15.5188 16.25 14 16.25L6 16.25C4.48122 16.25 3.25 17.4812 3.25 19V21H4.75L4.75 19C4.75 18.3096 5.30964 17.75 6 17.75L14 17.75C14.6904 17.75 15.25 18.3096 15.25 19V21H16.75Z",fill:"currentColor"}),o().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M19.976 16.3599C21.2507 14.5642 22.0001 12.3695 22.0001 9.99969C22.0001 7.63128 21.2515 5.43769 19.9782 3.64258L18.754 4.50967C19.8537 6.05996 20.5001 7.95434 20.5001 9.99969C20.5001 12.0464 19.8528 13.9419 18.7519 15.4928L19.976 16.3599ZM17.3357 14.4897C18.2357 13.222 18.7648 11.6727 18.7648 9.99969C18.7648 8.32808 18.2365 6.77984 17.3379 5.51279L16.1137 6.37988C16.8387 7.4021 17.2648 8.65114 17.2648 9.99969C17.2648 11.3496 16.8378 12.5998 16.1116 13.6226L17.3357 14.4897Z",fill:"currentColor"}))},42290:(e,t,n)=>{"use strict";n.d(t,{$L:()=>g.$L,$u:()=>g.$u,C3:()=>u.C3,JP:()=>p.JP,L$:()=>i.Z,LB:()=>p.LB,MW:()=>u.MW,OS:()=>s.Z,Qf:()=>c.Qf,Qr:()=>c.Qr,Rc:()=>l.Z,X_:()=>A.X_,Y:()=>g.Y,ZK:()=>u.ZK,_T:()=>a.Z,bC:()=>g.bC,cH:()=>o.Z,co:()=>g.co,cv:()=>g.cv,g:()=>p.g,oN:()=>A.oN,pw:()=>r.Z,q4:()=>g.q4,rp:()=>u.rp,u_:()=>c.u_,v_:()=>c.v_,xi:()=>u.xi});n(2890),n(56694),n(67742),n(46961);var r=n(42194),a=n(13109),o=n(93509),s=n(44696),i=n(92718),l=n(70286),c=n(59822),u=n(58890),A=n(20281),g=n(16700),p=n(35613)},2890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(51128),o=n.n(a),s=n(87309);const i=o()("jetpack-ai-client:jwt"),l="jetpack-ai-jwt",c=12e4;async function u({apiNonce:e,siteId:t,expirationTime:n}={}){e=e||window.JP_CONNECTION_INITIAL_STATE.apiNonce,t=t||window.JP_CONNECTION_INITIAL_STATE.siteSuffix,n=n||c;const a=(0,r.Wp)(),o=localStorage.getItem(l);let u,A=null;if(o)try{A=JSON.parse(o)}catch(e){i("Error parsing token",e)}if(A&&A?.expire>Date.now())return i("Using cached token"),A;u=a?await(0,s.Z)({path:"/wpcom/v2/sites/"+t+"/jetpack-openai-query/jwt",method:"POST"}):await(0,s.Z)({path:"/jetpack/v4/jetpack-ai-jwt?_cacheBuster="+Date.now(),credentials:"same-origin",headers:{"X-WP-Nonce":e},method:"POST"});const g={token:u.token,blogId:a?t:u.blog_id,expire:Date.now()+n};return i("Storing new token"),localStorage.setItem(l,JSON.stringify(g)),g}},35613:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.JP,LB:()=>r.LB,g:()=>r.g});var r=n(71197)},22999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(92213);const a={paragraph:e=>e.replaceAll("\n"," ")},o={emDelimiter:"_",headingStyle:"atx"},s={strikethrough:{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}}};class i{constructor({options:e={},rules:t={},keep:n=[],remove:a=[],fixes:i=[]}={}){this.fixes=i,this.turndownService=new r.Z({...o,...e}),this.turndownService.keep(n),this.turndownService.remove(a);const l={...s,...t};for(const e in l)this.turndownService.addRule(e,l[e])}render({content:e}){const t=this.turndownService.turndown(e);return this.fixes.reduce(((e,t)=>a[t](e)),t)}}},71197:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.Z,LB:()=>s,g:()=>i});var r=n(22999);const a=new(n(28603).Z),o=new r.Z,s=({content:e,rules:t,extension:n})=>a.render({content:e,rules:t,extension:n}),i=({content:e})=>o.render({content:e})},28603:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(95601);const a=e=>e.replaceAll("\x3c!-- wp:list-item --\x3e","").replaceAll("\x3c!-- /wp:list-item --\x3e","").replaceAll("\x3c!-- wp:list --\x3e","").replaceAll("\x3c!-- /wp:list --\x3e","").replaceAll("","\x3c!-- wp:list-item --\x3e ").replaceAll(" ","\x3c!-- /wp:list-item --\x3e").replaceAll("",'\x3c!-- wp:list {"ordered":true} --\x3e').replaceAll(" "," \x3c!-- /wp:list --\x3e").replaceAll("","\x3c!-- wp:list --\x3e"," \x3c!-- /wp:list --\x3e"),o={list:(e,t=!1)=>{const n=e.replace(/\s+/g,"
").replace(/<\/p>\s+<\/li>/g," ");return t?a(n):n},listItem:(e,t=!1)=>t?a(e.replace(/^<[ou]l>\s*/g,"").replace(/\s*<\/[ou]l>\s*$/g,"")):e,paragraph:(e,t=!1)=>t?e.replaceAll(/\s*<br \/>\s*/g," "):e},s={breaks:!0},i=["list"];class l{constructor(e=s){this.markdownConverter=new r.Z(e)}render({content:e,rules:t=i,extension:n=!1}){const r=this.markdownConverter.render(e);return t.reduce(((e,t)=>o[t](e,n)),r)}}},56694:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(60400),a=n(51128),o=n.n(a),s=n(42194),i=n(2890),l=n(16700);const c=o()("jetpack-ai-client:suggestions-event-source");class u extends EventTarget{constructor(e){super(),this.fullMessage="",this.fullFunctionCall={name:"",arguments:""},this.isPromptClear=!1,this.controller=new AbortController,this.initEventSource(e)}async initEventSource({url:e,question:t,token:n,options:a={}}){if(!n)try{c("Token was not provided, requesting one..."),n=(await(0,i.Z)()).token}catch(e){return void this.processErrorEvent(e)}const o={};if(Number.isInteger(parseInt(a.postId))&&(o.post_id=+a.postId),!e){const t=new URL("https://public-api.wordpress.com/wpcom/v2/jetpack-ai-query");a?.fromCache&&t.searchParams.append("stream_cache","true"),e=t.toString(),c("URL not provided, using default: %o",e)}Array.isArray(t)?o.messages=t:o.question=t,a?.feature?.length&&(c("Feature: %o",a.feature),o.feature=a.feature),a?.functions?.length&&(c("Functions: %o",a.functions),o.functions=a.functions),a?.model?.length&&(c("Model: %o",a.model),o.model=a.model),this.errorUnclearPromptTriggered=!1,await(0,r.L)(e,{openWhenHidden:!0,method:"POST",headers:{"Content-type":"application/json",Authorization:"Bearer "+n},body:JSON.stringify(o),onclose:()=>{c("Stream closed")},onerror:e=>{throw this.processErrorEvent(e),e},onmessage:e=>{this.processEvent(e)},onopen:async e=>{if(e.ok)return;let t;throw e.status>=400&&e.status<=500&&![413,422,429].includes(e.status)&&(c("Connection error: %o",e),t=l.co,this.dispatchEvent(new CustomEvent(l.co,{detail:e}))),503===e.status&&(t=l.$u,this.dispatchEvent(new CustomEvent(l.$u))),413===e.status&&(t=l.cv,this.dispatchEvent(new CustomEvent(l.cv))),422===e.status&&(t=l.q4,this.dispatchEvent(new CustomEvent(l.q4))),429===e.status&&(t=l.$L,this.dispatchEvent(new CustomEvent(l.$L))),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,s.A)(t)})),new Error},signal:this.controller.signal})}checkForUnclearPrompt(){if(this.isPromptClear)return;const e=this.fullMessage.replace(/__|(\*\*)/g,"");if(e.startsWith("JETPACK_AI_ERROR")){if(this.errorUnclearPromptTriggered)return;this.errorUnclearPromptTriggered=!0,this.dispatchEvent(new CustomEvent(l.bC)),c("Unclear error prompt dispatched"),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,s.A)(l.bC)}))}else"JETPACK_AI_ERROR".startsWith(e)?c(this.fullMessage):this.isPromptClear=!0}close(){this.controller.abort()}processEvent(e){if("[DONE]"===e.data){if(this.errorUnclearPromptTriggered)return;if(this.fullMessage.length)return this.dispatchEvent(new CustomEvent("done",{detail:this.fullMessage})),void c("Done: %o",this.fullMessage);if(this.fullFunctionCall.name.length)return this.dispatchEvent(new CustomEvent("function_done",{detail:this.fullFunctionCall})),void c("Done: %o",this.fullFunctionCall)}let t;try{t=JSON.parse(e.data)}catch(t){return void c("Error parsing JSON",e,t)}const{delta:n}=t?.choices?.[0]??{delta:{content:null,function_call:null}},r=n.content,a=n.function_call;r&&(this.fullMessage+=r,this.checkForUnclearPrompt(),this.isPromptClear&&(this.dispatchEvent(new CustomEvent("chunk",{detail:r})),c("suggestion: %o",this.fullMessage),this.dispatchEvent(new CustomEvent("suggestion",{detail:this.fullMessage})))),a&&(null!=a.name&&(this.fullFunctionCall.name+=a.name),null!=a.arguments&&(this.fullFunctionCall.arguments+=a.arguments),this.dispatchEvent(new CustomEvent("functionCallChunk",{detail:this.fullFunctionCall})))}processErrorEvent(e){c("onerror: %o",e),this.dispatchEvent(new CustomEvent(l.co,{detail:e})),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,s.A)(l.co)}))}}},16700:(e,t,n)=>{"use strict";n.d(t,{$L:()=>o,$u:()=>a,Y:()=>r.Y,bC:()=>c,co:()=>l,cv:()=>i,q4:()=>s,vF:()=>u});var r=n(44696);const a="error_service_unavailable",o="error_quota_exceeded",s="error_moderation",i="error_context_too_large",l="error_network",c="error_unclear_prompt",u="error_response"},6975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51128);const a=n.n(r)()("dops:analytics");let o,s;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const i={initialize:function(e,t,n){i.setUser(e,t),i.setSuperProps(n),i.identifyUser()},setGoogleAnalyticsEnabled:function(e,t=null){this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){s={ID:e,username:t}},setSuperProps:function(e){o=e},assignSuperProps:function(e){o=Object.assign(o||{},e)},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Built stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){i.tracks.recordPageView(e),i.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,a,o,s){i.ga.recordPurchase(e,t,n,r,a,o,s)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(o&&(a("- Super Props: %o",o),t=Object.assign(t,o)),a('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):a('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};i.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){i.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){a("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};i.ga.initialized||(s&&(e={userId:"u-"+s.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),i.ga.initialized=!0)},recordPageView:function(e,t){i.ga.initialize(),a("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){i.ga.initialize();let o="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(o+=" [Option Label: "+n+"]"),void 0!==r&&(o+=" [Option Value: "+r+"]"),a(o),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,a,o,s){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:s}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:a,quantity:o}),window.ga("ecommerce:send")}},identifyUser:function(){s&&window._tkq.push(["identifyUser",s.ID,s.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}},l=i},64743:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>A});var r=n(61132),a=n(96483);function o(e){class t extends Error{constructor(...t){super(...t),this.name=e}}return t}const s=o("JsonParseError"),i=o("JsonParseAfterRedirectError"),l=o("Api404Error"),c=o("Api404AfterRedirectError"),u=o("FetchNetworkError");const A=new function(e,t){let n=e,o=e,s={"X-WP-Nonce":t},i={credentials:"same-origin",headers:s},l={method:"post",credentials:"same-origin",headers:Object.assign({},s,{"Content-type":"application/json"})},c=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setWpcomOriginApiUrl(e){o=e},setApiNonce(e){s={"X-WP-Nonce":e},i={credentials:"same-origin",headers:s},l={method:"post",credentials:"same-origin",headers:Object.assign({},s,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{c=e},registerSite:(e,t,a)=>{const o={registration_nonce:e,no_iframe:!0};return(0,r.jetpackConfigHas)("consumer_slug")&&(o.plugin_slug=(0,r.jetpackConfigGet)("consumer_slug")),null!==t&&(o.redirect_uri=t),a&&(o.from=a),d(`${n}jetpack/v4/connection/register`,l,{body:JSON.stringify(o)}).then(g).then(p)},fetchAuthorizationUrl:e=>A((0,a.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),i).then(g).then(p),fetchSiteConnectionData:()=>A(`${n}jetpack/v4/connection/data`,i).then(p),fetchSiteConnectionStatus:()=>A(`${n}jetpack/v4/connection`,i).then(p),fetchSiteConnectionTest:()=>A(`${n}jetpack/v4/connection/test`,i).then(g).then(p),fetchUserConnectionData:()=>A(`${n}jetpack/v4/connection/data`,i).then(p),fetchUserTrackingSettings:()=>A(`${n}jetpack/v4/tracking/settings`,i).then(g).then(p),updateUserTrackingSettings:e=>d(`${n}jetpack/v4/tracking/settings`,l,{body:JSON.stringify(e)}).then(g).then(p),disconnectSite:()=>d(`${n}jetpack/v4/connection`,l,{body:JSON.stringify({isActive:!1})}).then(g).then(p),fetchConnectUrl:()=>A(`${n}jetpack/v4/connection/url`,i).then(g).then(p),unlinkUser:()=>d(`${n}jetpack/v4/connection/user`,l,{body:JSON.stringify({linked:!1})}).then(g).then(p),reconnect:()=>d(`${n}jetpack/v4/connection/reconnect`,l).then(g).then(p),fetchConnectedPlugins:()=>A(`${n}jetpack/v4/connection/plugins`,i).then(g).then(p),setHasSeenWCConnectionModal:()=>d(`${n}jetpack/v4/seen-wc-connection-modal`,l).then(g).then(p),fetchModules:()=>A(`${n}jetpack/v4/module/all`,i).then(g).then(p),fetchModule:e=>A(`${n}jetpack/v4/module/${e}`,i).then(g).then(p),activateModule:e=>d(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!0})}).then(g).then(p),deactivateModule:e=>d(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>d(`${n}jetpack/v4/module/${e}`,l,{body:JSON.stringify(t)}).then(g).then(p),updateSettings:e=>d(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(g).then(p),getProtectCount:()=>A(`${n}jetpack/v4/module/protect/data`,i).then(g).then(p),resetOptions:e=>d(`${n}jetpack/v4/options/${e}`,l,{body:JSON.stringify({reset:!0})}).then(g).then(p),activateVaultPress:()=>d(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(g).then(p),getVaultPressData:()=>A(`${n}jetpack/v4/module/vaultpress/data`,i).then(g).then(p),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),d(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify(r)}).then(g).then(p)},activateAkismet:()=>d(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(g).then(p),getAkismetData:()=>A(`${n}jetpack/v4/module/akismet/data`,i).then(g).then(p),checkAkismetKey:()=>A(`${n}jetpack/v4/module/akismet/key/check`,i).then(g).then(p),checkAkismetKeyTyped:e=>d(`${n}jetpack/v4/module/akismet/key/check`,l,{body:JSON.stringify({api_key:e})}).then(g).then(p),fetchStatsData:e=>A(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),i).then(g).then(p).then(h),getPluginUpdates:()=>A(`${n}jetpack/v4/updates/plugins`,i).then(g).then(p),getPlans:()=>A(`${n}jetpack/v4/plans`,i).then(g).then(p),fetchSettings:()=>A(`${n}jetpack/v4/settings`,i).then(g).then(p),updateSetting:e=>d(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(g).then(p),fetchSiteData:()=>A(`${n}jetpack/v4/site`,i).then(g).then(p).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>A(`${n}jetpack/v4/site/features`,i).then(g).then(p).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>A(`${n}jetpack/v4/site/products`,i).then(g).then(p),fetchSitePurchases:()=>A(`${n}jetpack/v4/site/purchases`,i).then(g).then(p).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>A(`${n}jetpack/v4/site/benefits`,i).then(g).then(p).then((e=>JSON.parse(e.data))),fetchSiteDiscount:()=>A(`${n}jetpack/v4/site/discount`,i).then(g).then(p).then((e=>e.data)),fetchSetupQuestionnaire:()=>A(`${n}jetpack/v4/setup/questionnaire`,i).then(g).then(p),fetchRecommendationsData:()=>A(`${n}jetpack/v4/recommendations/data`,i).then(g).then(p),fetchRecommendationsProductSuggestions:()=>A(`${n}jetpack/v4/recommendations/product-suggestions`,i).then(g).then(p),fetchRecommendationsUpsell:()=>A(`${n}jetpack/v4/recommendations/upsell`,i).then(g).then(p),fetchRecommendationsConditional:()=>A(`${n}jetpack/v4/recommendations/conditional`,i).then(g).then(p),saveRecommendationsData:e=>d(`${n}jetpack/v4/recommendations/data`,l,{body:JSON.stringify({data:e})}).then(g),fetchProducts:()=>A(`${n}jetpack/v4/products`,i).then(g).then(p),fetchRewindStatus:()=>A(`${n}jetpack/v4/rewind`,i).then(g).then(p).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>A(`${n}jetpack/v4/scan`,i).then(g).then(p).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>d(`${n}jetpack/v4/notice/${e}`,l,{body:JSON.stringify({dismissed:!0})}).then(g).then(p),fetchPluginsData:()=>A(`${n}jetpack/v4/plugins`,i).then(g).then(p),fetchIntroOffers:()=>A(`${n}jetpack/v4/intro-offers`,i).then(g).then(p),fetchVerifySiteGoogleStatus:e=>A(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,i).then(g).then(p),verifySiteGoogle:e=>d(`${n}jetpack/v4/verify-site/google`,l,{body:JSON.stringify({keyring_id:e})}).then(g).then(p),submitSurvey:e=>d(`${n}jetpack/v4/marketing/survey`,l,{body:JSON.stringify(e)}).then(g).then(p),saveSetupQuestionnaire:e=>d(`${n}jetpack/v4/setup/questionnaire`,l,{body:JSON.stringify(e)}).then(g).then(p),updateLicensingError:e=>d(`${n}jetpack/v4/licensing/error`,l,{body:JSON.stringify(e)}).then(g).then(p),updateLicenseKey:e=>d(`${n}jetpack/v4/licensing/set-license`,l,{body:JSON.stringify({license:e})}).then(g).then(p),getUserLicensesCounts:()=>A(`${n}jetpack/v4/licensing/user/counts`,i).then(g).then(p),getUserLicenses:()=>A(`${n}jetpack/v4/licensing/user/licenses`,i).then(g).then(p),updateLicensingActivationNoticeDismiss:e=>d(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,l,{body:JSON.stringify({last_detached_count:e})}).then(g).then(p),updateRecommendationsStep:e=>d(`${n}jetpack/v4/recommendations/step`,l,{body:JSON.stringify({step:e})}).then(g),confirmIDCSafeMode:()=>d(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,l).then(g),startIDCFresh:e=>d(`${n}jetpack/v4/identity-crisis/start-fresh`,l,{body:JSON.stringify({redirect_uri:e})}).then(g).then(p),migrateIDC:()=>d(`${n}jetpack/v4/identity-crisis/migrate`,l).then(g),attachLicenses:e=>d(`${n}jetpack/v4/licensing/attach-licenses`,l,{body:JSON.stringify({licenses:e})}).then(g).then(p),fetchSearchPlanInfo:()=>A(`${o}jetpack/v4/search/plan`,i).then(g).then(p),fetchSearchSettings:()=>A(`${o}jetpack/v4/search/settings`,i).then(g).then(p),updateSearchSettings:e=>d(`${o}jetpack/v4/search/settings`,l,{body:JSON.stringify(e)}).then(g).then(p),fetchSearchStats:()=>A(`${o}jetpack/v4/search/stats`,i).then(g).then(p),fetchWafSettings:()=>A(`${n}jetpack/v4/waf`,i).then(g).then(p),updateWafSettings:e=>d(`${n}jetpack/v4/waf`,l,{body:JSON.stringify(e)}).then(g).then(p),fetchWordAdsSettings:()=>A(`${n}jetpack/v4/wordads/settings`,i).then(g).then(p),updateWordAdsSettings:e=>d(`${n}jetpack/v4/wordads/settings`,l,{body:JSON.stringify(e)}),fetchSearchPricing:()=>A(`${o}jetpack/v4/search/pricing`,i).then(g).then(p),fetchMigrationStatus:()=>A(`${n}jetpack/v4/migration/status`,i).then(g).then(p),fetchBackupUndoEvent:()=>A(`${n}jetpack/v4/site/backup/undo-event`,i).then(g).then(p),fetchBackupPreflightStatus:()=>A(`${n}jetpack/v4/site/backup/preflight`,i).then(g).then(p)};function A(e,t){return fetch(c(e),t)}function d(e,t,n){return fetch(e,Object.assign({},t,n)).catch(m)}function h(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}Object.assign(this,u)};function g(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new c(e.redirected):new l})):e.json().catch((e=>d(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function p(e){return e.json().catch((t=>d(t,e.redirected,e.url)))}function d(e,t,n){throw t?new i(n):new s}function m(){throw new u}},22636:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(65235),a=n.n(r),o=n(99196),s=n.n(o),i=n(46409);const l=({children:e=null,width:t=null,height:n=null,className:r=""})=>s().createElement("div",{className:a()(i.Z.placeholder,r),style:{width:t,height:n}},e)},49777:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(28918);const a=({value:e="https://jetpack.com",bgColor:t,fgColor:n,level:a,includeMargin:o,imageSettings:s,renderAs:i="canvas",size:l=248})=>React.createElement(r.ZP,{value:e,size:l,bgColor:t,fgColor:n,level:a,includeMargin:o,imageSettings:s,renderAs:i})},45033:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(25162),a=n.n(r),o=n(99196),s=n.n(o);n(48026);const i=({color:e="#FFFFFF",className:t="",size:n=20})=>{const r=t+" jp-components-spinner",a={width:n,height:n,fontSize:n,borderTopColor:e},o={borderTopColor:e,borderRightColor:e};return s().createElement("div",{className:r},s().createElement("div",{className:"jp-components-spinner__outer",style:a},s().createElement("div",{className:"jp-components-spinner__inner",style:o})))};i.propTypes={color:a().string,className:a().string,size:a().number};const l=i},88275:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>g});var r=n(99196),a=n.n(r),o=n(93468);const s={"--font-headline-medium":"48px","--font-headline-small":"36px","--font-title-medium":"24px","--font-title-small":"20px","--font-body":"16px","--font-body-small":"14px","--font-body-extra-small":"12px","--font-title-large":"var(--font-headline-small)","--font-label":"var(--font-body-extra-small)"},i={"--jp-black":"#000000","--jp-black-80":"#2c3338","--jp-white":"#ffffff","--jp-white-off":"#f9f9f6","--jp-gray":"#dcdcde","--jp-gray-0":"#F6F7F7","--jp-gray-5":"var(--jp-gray)","--jp-gray-10":"#C3C4C7","--jp-gray-20":"#A7AAAD","--jp-gray-40":"#787C82","--jp-gray-50":"#646970","--jp-gray-60":"#50575E","--jp-gray-70":"#3C434A","--jp-gray-80":"#2C3338","--jp-gray-90":"#1d2327","--jp-gray-off":"#e2e2df","--jp-red-0":"#F7EBEC","--jp-red-5":"#FACFD2","--jp-red-40":"#E65054","--jp-red-50":"#D63638","--jp-red-60":"#B32D2E","--jp-red-70":"#8A2424","--jp-red-80":"#691C1C","--jp-red":"#d63639","--jp-yellow-5":"#F5E6B3","--jp-yellow-10":"#F2CF75","--jp-yellow-20":"#F0C930","--jp-yellow-30":"#DEB100","--jp-yellow-40":"#C08C00","--jp-yellow-50":"#9D6E00","--jp-yellow-60":"#7D5600","--jp-blue-20":"#68B3E8","--jp-blue-40":"#1689DB","--jp-pink":"#C9356E","--jp-green-0":"#f0f2eb","--jp-green-5":"#d0e6b8","--jp-green-10":"#9dd977","--jp-green-20":"#64ca43","--jp-green-30":"#2fb41f","--jp-green-40":"#069e08","--jp-green-50":"#008710","--jp-green-60":"#007117","--jp-green-70":"#005b18","--jp-green-80":"#004515","--jp-green-90":"#003010","--jp-green-100":"#001c09","--jp-green":"#069e08","--jp-green-primary":"var( --jp-green-40 )","--jp-green-secondary":"var( --jp-green-30 )"},l={"--jp-border-radius":"4px","--jp-menu-border-height":"1px","--jp-underline-thickness":"2px"},c={"--spacing-base":"8px"},u={},A=(e,t,n)=>{const r={...s,...i,...l,...c};for(const t in r)e.style.setProperty(t,r[t]);n&&e.classList.add(o.Z.global),t&&(u[t]={provided:!0,root:e})},g=({children:e=null,targetDom:t,id:n,withGlobalStyles:o=!0})=>{const s=(0,r.useRef)(),i=u?.[n]?.provided;return(0,r.useLayoutEffect)((()=>{if(!i)return t?A(t,n,o):void(s?.current&&A(s.current,n,o))}),[t,s,i,n,o]),t?a().createElement(a().Fragment,null,e):a().createElement("div",{ref:s},e)}},6895:(e,t,n)=>{"use strict";function r(e,t={}){const n={};let r;if("undefined"!=typeof window&&(r=window?.JP_CONNECTION_INITIAL_STATE?.calypsoEnv),0===e.search("https://")){const t=new URL(e);e=`https://${t.host}${t.pathname}`,n.url=encodeURIComponent(e)}else n.source=encodeURIComponent(e);for(const e in t)n[e]=encodeURIComponent(t[e]);!Object.keys(n).includes("site")&&"undefined"!=typeof jetpack_redirects&&jetpack_redirects.hasOwnProperty("currentSiteRawUrl")&&(n.site=jetpack_redirects.currentBlogID??jetpack_redirects.currentSiteRawUrl),r&&(n.calypso_env=r);return"https://jetpack.com/redirect/?"+Object.keys(n).map((e=>e+"="+n[e])).join("&")}n.d(t,{Z:()=>r})},61132:(e,t,n)=>{let r={};try{r=n(92787)}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),r={missingConfig:!0}}const a=e=>r.hasOwnProperty(e);e.exports={jetpackConfigHas:a,jetpackConfigGet:e=>{if(!a(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return r[e]}}},31294:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(64743),a=n(9818),o=n(99196),s=n(80428);const i=window?.JP_CONNECTION_INITIAL_STATE?window.JP_CONNECTION_INITIAL_STATE:{},l=({registrationNonce:e=i.registrationNonce,apiRoot:t=i.apiRoot,apiNonce:n=i.apiNonce,redirectUri:l,autoTrigger:c,from:u,skipUserConnection:A}={})=>{const{registerSite:g,connectUser:p,refreshConnectedPlugins:d}=(0,a.useDispatch)(s.t),m=(0,a.useSelect)((e=>e(s.t).getRegistrationError())),{siteIsRegistering:h,userIsConnecting:E,userConnectionData:f,connectedPlugins:C,connectionErrors:B,isRegistered:b,isUserConnected:k,hasConnectedOwner:v,isOfflineMode:I}=(0,a.useSelect)((e=>({siteIsRegistering:e(s.t).getSiteIsRegistering(),userIsConnecting:e(s.t).getUserIsConnecting(),userConnectionData:e(s.t).getUserConnectionData(),connectedPlugins:e(s.t).getConnectedPlugins(),connectionErrors:e(s.t).getConnectionErrors(),isOfflineMode:e(s.t).getIsOfflineMode(),...e(s.t).getConnectionStatus()}))),y=()=>A?l?(window.location=l,Promise.resolve(l)):Promise.resolve():p({from:u,redirectUri:l}),w=t=>(t&&t.preventDefault(),b?y():g({registrationNonce:e,redirectUri:l,from:u}).then((()=>y())));return(0,o.useEffect)((()=>{r.ZP.setApiRoot(t),r.ZP.setApiNonce(n)}),[t,n]),(0,o.useEffect)((()=>{!c||h||E||w()}),[]),{handleRegisterSite:w,handleConnectUser:y,refreshConnectedPlugins:d,isRegistered:b,isUserConnected:k,siteIsRegistering:h,userIsConnecting:E,registrationError:m,userConnectionData:f,hasConnectedOwner:v,connectedPlugins:C,connectionErrors:B,isOfflineMode:I}}},27523:(e,t,n)=>{"use strict";n.d(t,{LI:()=>o,N4:()=>i,Qo:()=>A,T1:()=>c,TS:()=>u,ZP:()=>k,b5:()=>p,i6:()=>a,qJ:()=>d,qV:()=>l,r7:()=>s,wQ:()=>g});var r=n(64743);const a="SET_CONNECTION_STATUS",o="SET_CONNECTION_STATUS_IS_FETCHING",s="SET_SITE_IS_REGISTERING",i="SET_USER_IS_CONNECTING",l="SET_REGISTRATION_ERROR",c="CLEAR_REGISTRATION_ERROR",u="SET_AUTHORIZATION_URL",A="DISCONNECT_USER_SUCCESS",g="SET_CONNECTED_PLUGINS",p="SET_CONNECTION_ERRORS",d="SET_IS_OFFLINE_MODE",m=e=>({type:a,connectionStatus:e}),h=e=>({type:s,isRegistering:e}),E=e=>({type:i,isConnecting:e}),f=e=>({type:l,registrationError:e}),C=()=>({type:c}),B=e=>({type:u,authorizationUrl:e}),b=e=>({type:g,connectedPlugins:e});const k={setConnectionStatus:m,setConnectionStatusIsFetching:e=>({type:o,isFetching:e}),fetchConnectionStatus:()=>({type:"FETCH_CONNECTION_STATUS"}),fetchAuthorizationUrl:e=>({type:"FETCH_AUTHORIZATION_URL",redirectUri:e}),setSiteIsRegistering:h,setUserIsConnecting:E,setRegistrationError:f,clearRegistrationError:C,setAuthorizationUrl:B,registerSite:function*({registrationNonce:e,redirectUri:t,from:n=""}){yield C(),yield h(!0);try{const r=yield{type:"REGISTER_SITE",registrationNonce:e,redirectUri:t,from:n};return yield m({isRegistered:!0}),yield B(r.authorizeUrl),yield h(!1),Promise.resolve(r)}catch(e){return yield f(e),yield h(!1),Promise.reject(e)}},connectUser:function*({from:e,redirectFunc:t,redirectUri:n}={}){yield E(!0),yield{type:"CONNECT_USER",from:e,redirectFunc:t,redirectUri:n}},disconnectUserSuccess:()=>({type:A}),setConnectedPlugins:b,refreshConnectedPlugins:()=>async({dispatch:e})=>await new Promise((t=>r.ZP.fetchConnectedPlugins().then((n=>{e(b(n)),t(n)})))),setConnectionErrors:e=>({type:p,connectionErrors:e}),setIsOfflineMode:e=>({type:d,isOfflineMode:e})}},31432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(64743),a=n(9818),o=n(27057);const s={FETCH_AUTHORIZATION_URL:({redirectUri:e})=>r.ZP.fetchAuthorizationUrl(e),REGISTER_SITE:({registrationNonce:e,redirectUri:t,from:n})=>r.ZP.registerSite(e,t,n),CONNECT_USER:(0,a.createRegistryControl)((({resolveSelect:e})=>({from:t,redirectFunc:n,redirectUri:r}={})=>new Promise(((a,s)=>{e(o.Z).getAuthorizationUrl(r).then((e=>{const r=n||(e=>window.location.assign(e)),o=new URL(e);t&&o.searchParams.set("from",encodeURIComponent(t));const s=o.toString();r(s),a(s)})).catch((e=>{s(e)}))}))))}},41479:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9818),a=n(27523);const o=(0,r.combineReducers)({connectionStatus:(e={},t)=>{switch(t.type){case a.i6:return{...e,...t.connectionStatus};case a.Qo:return{...e,isUserConnected:!1}}return e},connectionStatusIsFetching:(e=!1,t)=>t.type===a.LI?t.isFetching:e,siteIsRegistering:(e=!1,t)=>t.type===a.r7?t.isRegistering:e,userIsConnecting:(e=!1,t)=>t.type===a.N4?t.isConnecting:e,registrationError:(e,t)=>{switch(t.type){case a.T1:return!1;case a.qV:return t.registrationError;default:return e}},authorizationUrl:(e,t)=>t.type===a.TS?t.authorizationUrl:e,userConnectionData:(e,t)=>(t.type,e),connectedPlugins:(e={},t)=>t.type===a.wQ?t.connectedPlugins:e,connectionErrors:(e={},t)=>t.type===a.b5?t.connectionErrors:e,isOfflineMode:(e=!1,t)=>t.type===a.qJ?t.isConnecting:e})},77728:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818),a=n(27523),o=n(27057);const s={...{getAuthorizationUrl:{isFulfilled:(e,...t)=>{const n=Boolean(e.authorizationUrl),a=(0,r.select)(o.Z).hasFinishedResolution("getAuthorizationUrl",t);return n&&!a&&(0,r.dispatch)(o.Z).finishResolution("getAuthorizationUrl",t),n},*fulfill(e){const t=yield a.ZP.fetchAuthorizationUrl(e);yield a.ZP.setAuthorizationUrl(t.authorizeUrl)}}}}},82725:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r={...{getConnectionStatus:e=>e.connectionStatus||{},getConnectionStatusIsFetching:()=>!1,getSiteIsRegistering:e=>e.siteIsRegistering||!1,getUserIsConnecting:e=>e.userIsConnecting||!1,getRegistrationError:e=>e.registrationError||!1,getAuthorizationUrl:e=>e.authorizationUrl||!1,getUserConnectionData:e=>e.userConnectionData||!1,getConnectedPlugins:e=>e.connectedPlugins||[],getConnectionErrors:e=>e.connectionErrors||[],getIsOfflineMode:e=>e.isOfflineMode||!1,getWpcomUser:e=>e?.userConnectionData?.currentUser?.wpcomUser,getBlogId:e=>e?.userConnectionData?.currentUser?.blogId}}},13535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9818);class a{static store=null;static mayBeInit(e,t){null===a.store&&(a.store=(0,r.createReduxStore)(e,t),(0,r.register)(a.store))}}const o=a},27057:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r="jetpack-connection"},80428:(e,t,n)=>{"use strict";n.d(t,{t:()=>c.Z});var r=n(27523),a=n(31432),o=n(41479),s=n(77728),i=n(82725),l=n(13535),c=n(27057);const u=window.JP_CONNECTION_INITIAL_STATE;u||console.error("Jetpack Connection package: Initial state is missing. Check documentation to see how to use the Connection composer package to set up the initial state."),l.Z.mayBeInit(c.Z,{__experimentalUseThunks:!0,reducer:o.Z,actions:r.ZP,selectors:i.Z,resolvers:s.Z,controls:a.Z,initialState:u||{}})},13419:(e,t,n)=>{"use strict";n.d(t,{Dp:()=>c.Z,FK:()=>l.FK,HD:()=>l.HD,M6:()=>o.M6,OZ:()=>s.Z,Pb:()=>r.Z,Qq:()=>l.Qq,Rl:()=>l.Rl,T:()=>i.Z,Ug:()=>o.Ug,Wp:()=>o.Wp,X1:()=>l.X1,_D:()=>l._D,dM:()=>g.d,el:()=>A.Z,lQ:()=>a.Z,lt:()=>g.l,m3:()=>l.m3,z$:()=>u.Z});var r=n(50148),a=n(35004),o=n(99505),s=n(48052),i=(n(76714),n(80354)),l=n(75404),c=n(68586),u=n(61053),A=n(11380),g=(n(6342),n(96959));n(39058)},6342:(e,t,n)=>{"use strict";n(99196)},96959:(e,t,n)=>{"use strict";n.d(t,{d:()=>o,l:()=>s});var r=n(69307),a=n(12953);function o(e){const t={};let n="span",a=e.icon;const o=document.createElement("div");o.innerHTML=e.icon;const s=o.querySelector("svg");return s&&(n="svg",a=s.innerHTML,Array.from(s.attributes).forEach((({nodeName:e,nodeValue:n})=>t[e]=n))),(0,r.createElement)(n,{...t,dangerouslySetInnerHTML:{__html:a||""}})}function s(e){return{src:o(e),foreground:(0,a.Z)()}}},12953:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(99505);const a="#069e08";function o(){return(0,r.Ug)()||(0,r.Wp)()?null:a}},50148:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});const r="Jetpack_Editor_Initial_State";function a(){return"object"==typeof window?window?.[r]??null:null}},48052:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(50148);function a(e){const t=(0,r.Z)(),n=t?.available_blocks?.[e]?.available??!1,a=t?.available_blocks?.[e]?.unavailable_reason??"unknown";return{available:n,...!n&&{details:t?.available_blocks?.[e]?.details??[],unavailableReason:a}}}},35004:(e,t,n)=>{"use strict";function r(){return window&&window.Jetpack_Editor_Initial_State&&window.Jetpack_Editor_Initial_State.siteFragment?window.Jetpack_Editor_Initial_State.siteFragment:null}n.d(t,{Z:()=>r})},61053:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(6975),a=n(31294),o=n(69307);const{tracks:s}=r.Z,{recordEvent:i}=s,l=({pageViewEventName:e=null,pageViewNamespace:t="jetpack",pageViewSuffix:n="page_view",pageViewEventProperties:l={}}={})=>{const[c,u]=(0,o.useState)(!1),{isUserConnected:A,isRegistered:g,userConnectionData:p={}}=(0,a.Z)(),{wpcomUser:{login:d,ID:m}={},blogId:h}=p.currentUser||{},E=(0,o.useCallback)((async(e,t={})=>{A&&m&&d&&i(e,t)}),[A,m,d]);return(0,o.useEffect)((()=>{A&&m&&d&&h&&r.Z.initialize(m,d,{blog_id:h})}),[h,m,d,A]),(0,o.useEffect)((()=>{const r=e?`${t}_${e}_${n}`:null;g&&r&&(c||(E(r,l),u(!0)))}),[c,t,e,n,g,l,E]),{recordEvent:E,tracks:s}}},11380:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818),a=n(69307),o=n(39058);const s=e=>{const{isModuleActive:t,isChangingStatus:n,isLoadingModules:s}=(0,r.useSelect)((t=>{const n=t(o.p);return{isModuleActive:n.isModuleActive(e),isChangingStatus:n.isModuleUpdating(e),isLoadingModules:n.areModulesLoading(e)}}),[o.p]),{updateJetpackModuleStatus:i}=(0,r.useDispatch)(o.p),l=(0,a.useCallback)((t=>i({name:e,active:t})),[e,i]);return(0,a.useMemo)((()=>({isLoadingModules:s,isChangingStatus:n,isModuleActive:t,changeStatus:l})),[s,n,t,l])}},68586:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(50148);function a(){return(0,r.Z)()?.jetpack?.is_current_user_connected??!1}},44166:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>g,rW:()=>A});var r=n(9818),a=n(99505),o=n(82162),s=n(39058);const i="SET_JETPACK_MODULES",l="SET_MODULE_UPDATING";function c(e){return A({isLoading:e})}function u(e,t){return{type:l,name:e,isUpdating:t}}function A(e){return{type:i,options:e}}const g={updateJetpackModuleStatus:function*(e){try{yield u(e.name,!0),yield(0,o.zL)(e);const t=yield(0,o.Bs)();return yield A({data:t}),!0}catch(e){const t=(0,r.select)(s.p).getJetpackModules();return yield A(t),!1}finally{yield u(e.name,!1)}},setJetpackModules:A,fetchModules:function*(){if((0,a.Wp)())return!0;try{yield c(!0);const e=yield(0,o.Bs)();return yield A({data:e}),!0}catch(e){const t=(0,r.select)(s.p).getJetpackModules();return yield A(t),!1}finally{yield c(!1)}}}},82162:(e,t,n)=>{"use strict";n.d(t,{Bs:()=>i,ZP:()=>c,zL:()=>l});var r=n(86989),a=n.n(r);const o="FETCH_JETPACK_MODULES",s="UPDATE_JETPACK_MODULE_STATUS",i=()=>({type:o}),l=e=>({type:s,settings:e}),c={[o]:function(){return a()({path:"/jetpack/v4/module/all",method:"GET"})},[s]:function({settings:e}){return a()({path:`/jetpack/v4/module/${e.name}/active`,method:"POST",data:{active:e.active}})}}},39058:(e,t,n)=>{"use strict";n.d(t,{p:()=>c});var r=n(9818),a=n(44166),o=n(82162),s=n(42469),i=n(55133),l=n(43524);const c="jetpack-modules",u=(0,r.createReduxStore)(c,{reducer:s.Z,actions:a.ZP,controls:o.ZP,resolvers:i.Z,selectors:l.Z});(0,r.register)(u);const A=window?.Initial_State?.getModules||window?.Jetpack_Editor_Initial_State?.modules||null;null!==A&&(0,r.dispatch)(c).setJetpackModules({data:{...A}})},42469:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});const r={isLoading:!1,isUpdating:{},data:{}},a=(e=r,t)=>{switch(t.type){case"SET_JETPACK_MODULES":return{...e,...t.options};case"SET_MODULE_UPDATING":return{...e,isUpdating:{...e.isUpdating,[t.name]:t.isUpdating}}}return e}},55133:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(44166),a=n(82162);const o={getJetpackModules:function*(){try{const e=yield(0,a.Bs)();if(e)return(0,r.rW)({data:e})}catch(e){console.error(e)}}}},43524:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(99505);const a={getJetpackModules:e=>e.data,isModuleActive:(e,t)=>(0,r.Wp)()||(e?.data?.[t]?.activated??!1),areModulesLoading:e=>e.isLoading??!1,isModuleUpdating:(e,t)=>e?.isUpdating?.[t]??!1}},75404:(e,t,n)=>{"use strict";n.d(t,{FK:()=>m,HD:()=>h,Qq:()=>u,Rl:()=>p,X1:()=>A,_D:()=>g,m3:()=>E});var r=n(65736),a=n(96483),o=n(92819),s=n(50148),i=n(48052),l=n(35004),c=n(99505);const __=r.__;function u({planSlug:e,plan:t,postId:n,postType:r}){const s=(0,o.startsWith)(e,"jetpack_")?e:(0,o.get)(t,["path_slug"]),i=(void 0===r?()=>{const e=new URLSearchParams(window.location.search);return(0,a.addQueryArgs)(window.location.protocol+`//${(0,l.Z)().replace("::","/")}/wp-admin/site-editor.php`,{postId:e.get("postId"),postType:e.get("postType"),plan_upgraded:1})}:()=>{const e=["page","post"].includes(r)?"":"edit";return(0,c.Wp)()?(0,a.addQueryArgs)("/"+(0,o.compact)([e,r,(0,l.Z)(),n]).join("/"),{plan_upgraded:1}):(0,a.addQueryArgs)(window.location.protocol+`//${(0,l.Z)().replace("::","/")}/wp-admin/post.php`,{action:"edit",post:n,plan_upgraded:1})})();return(0,c.Ug)()?(0,a.addQueryArgs)(`https://wordpress.com/plans/${(0,l.Z)()}`,{redirect_to:i,customerType:"business"}):s&&(0,a.addQueryArgs)(`https://wordpress.com/checkout/${(0,l.Z)()}/${s}`,{redirect_to:i})}function A(e){if(!e)return!1;const t=/^jetpack\//.test(e)?e.substr(8,e.length):e,{available:n,unavailableReason:r}=(0,i.Z)(t);return!n&&"missing_plan"===r}function g(e,t){return"missing_plan"===e&&t.required_plan}function p(e){if(!e)return!1;const t=/^jetpack\//.test(e)?e.substr(8,e.length):e,{details:n,unavailableReason:r}=(0,i.Z)(t);return g(r,n)}const d=[{name:"core/cover",mediaPlaceholder:!0,mediaReplaceFlow:!0,fileType:"video",description:__("Upgrade your plan to use video covers","jetpack")},{name:"core/audio",mediaPlaceholder:!0,mediaReplaceFlow:!0,fileType:"audio",description:__("Upgrade your plan to upload audio","jetpack")}];function m(){return(0,o.get)((0,s.Z)(),"jetpack.enable_upgrade_nudge",!1)}const h=e=>(0,o.map)(d,"name").includes(e),E=e=>(0,o.head)((0,o.filter)(d,(({name:t})=>t===e)))},76714:(e,t,n)=>{"use strict";n(98817)},99505:(e,t,n)=>{"use strict";n.d(t,{M6:()=>i,Ug:()=>s,Wp:()=>o});var r=n(50148);function a(){return"object"==typeof window&&"string"==typeof window._currentSiteType?window._currentSiteType:null}function o(){return"simple"===a()}function s(){return"atomic"===a()}function i(){const e=(0,r.Z)();return e?.jetpack?.is_private_site??!1}},80354:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(82674),a=n.n(r),o=n(94333);const s=e=>(0,o.createHigherOrderComponent)((t=>n=>React.createElement(t,a()({},n,{className:n.name===e?"has-warning is-interactive":n.className}))),"withHasWarningIsInteractiveClassNames")},47798:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>b});var r=n(51806),a=n(42290),o=n(55609),s=n(65736),i=n(586),l=n(3639),c=n(92710),u=n(58532),A=n(59756),g=(n(99196),n(54765)),p=n(63634),d=n(72881),m=n(81612),h=n(27298);const __=s.__,E="simplify",f="make-longer",C="make-shorter",B={default:[{name:__("Correct spelling and grammar","jetpack"),key:"correct-spelling",aiSuggestion:p.Hd,icon:i.Z}],"core/paragraph":[{name:__("Simplify","jetpack"),key:E,aiSuggestion:p.hI,icon:l.Z},{name:__("Summarize","jetpack"),key:"summarize",aiSuggestion:p.Lq,icon:c.Z},{name:__("Expand","jetpack"),key:f,aiSuggestion:p.TV,icon:u.Z},{name:__("Make shorter","jetpack"),key:C,aiSuggestion:p.DR,icon:u.Z}],"core/list-item":[{name:__("Simplify","jetpack"),key:E,aiSuggestion:p.hI,icon:l.Z},{name:__("Expand","jetpack"),key:f,aiSuggestion:p.TV,icon:u.Z},{name:__("Make shorter","jetpack"),key:C,aiSuggestion:p.DR,icon:u.Z}],"core/list":g.jz.includes("core/list")?[{name:__("Simplify","jetpack"),key:E,aiSuggestion:p.hI,icon:l.Z},{name:__("Expand","jetpack"),key:f,aiSuggestion:p.TV,icon:u.Z},{name:__("Make shorter","jetpack"),key:C,aiSuggestion:p.DR,icon:u.Z}]:[{name:__("Turn list into a table","jetpack"),key:"turn-into-table",aiSuggestion:p.Gh,icon:A.Z,options:{userPrompt:"make a table from this list, do not enclose the response in a code block"}},{name:__("Write a post from this list","jetpack"),key:"write-post-from-list",aiSuggestion:p.Gh,icon:l.Z,options:{userPrompt:"Write a post based on the list items. Include a title as first order heading and try to use secondary headings for each entry"}}]};function b({blockType:e,disabled:t=!1,onAskAiAssistant:n,onRequestSuggestion:s}){const i=B[e]??[];return(0,r.createElement)(r.Fragment,null,t&&(0,r.createElement)(o.Notice,{status:"warning",isDismissible:!1,className:"jetpack-ai-assistant__info"},__("Add content to activate the tools below","jetpack")),(0,r.createElement)(o.MenuGroup,null,(0,r.createElement)(o.MenuItem,{icon:a.u_,iconPosition:"left",key:"key-ai-assistant",onClick:n,disabled:t},(0,r.createElement)("div",{className:"jetpack-ai-assistant__menu-item"},__("Ask AI Assistant","jetpack"))),[...B.default,...i].map((e=>(0,r.createElement)(o.MenuItem,{icon:e?.icon,iconPosition:"left",key:`key-${e.key}`,onClick:()=>{s(e.aiSuggestion,{...e.options??{}},e.name)},disabled:t},(0,r.createElement)("div",{className:"jetpack-ai-assistant__menu-item"},e.name)))),(0,r.createElement)(h.IP,{onChange:e=>{s(p.Lg,{tone:e},`${h.iQ}: ${(0,d.k)(e)}`)},disabled:t}),(0,r.createElement)(m.xK,{onChange:(e,t)=>{s(p.Nw,{language:e},`${m.aO}: ${t}`)},disabled:t})))}},54458:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(51806),a=n(42290),o=n(13419),s=n(55609),i=n(9818),l=n(69307),c=n(65736),u=n(51128),A=n.n(u),g=(n(99196),n(49259)),p=n(854),d=n(6747),m=n(47798);const __=c.__,h=A()("jetpack-ai-assistant:dropdown");function E({onClose:e,blockType:t}){const[n,a]=(0,l.useState)(!1),{getSelectedBlockClientIds:s,getBlocksByClientId:c}=(0,i.useSelect)("core/block-editor"),{removeBlocks:u,replaceBlock:A}=(0,i.useDispatch)("core/block-editor");(0,l.useEffect)((()=>{const e=s(),t=c(e),n=(0,p.vL)(t),r=(0,p.t$)(n);return a(!r.length)}),[c,s]);const{tracks:E}=(0,o.z$)();return(0,r.createElement)(m.ZP,{blockType:t,onRequestSuggestion:(n,r={})=>{const a=s(),o=c(a),i=(0,p.vL)(o);e(),h("requestSuggestion",n,r),E.recordEvent("jetpack_editor_ai_assistant_extension_toolbar_button_click",{suggestion:n,block_type:t});const[l]=o,[m,...f]=a,C={...l?.attributes||{},content:i},B=(0,d.b)(t,C),b={clientId:m,type:n,options:{...r,contentType:"generated",fromExtension:!0}};localStorage.setItem((0,g.$M)(B.clientId),JSON.stringify(b)),A(m,B),u(f)},onAskAiAssistant:()=>{const e=s(),n=c(e),r=(0,p.vL)(n),[a,...o]=e,[i]=n,l={...i?.attributes||{},content:r};A(a,(0,d.b)(t,l)),u(o),E.recordEvent("jetpack_ai_assistant_prompt_show",{block_type:t})},disabled:n})}function f({blockType:e,label:t=__("AI Assistant","jetpack")}){const{tracks:n}=(0,o.z$)();return(0,r.createElement)(s.Dropdown,{popoverProps:{variant:"toolbar"},renderToggle:({isOpen:e,onToggle:n})=>(0,r.createElement)(s.ToolbarButton,{className:"jetpack-ai-assistant__button",showTooltip:!0,onClick:n,"aria-haspopup":"true","aria-expanded":e,label:t,icon:a.u_}),onToggle:t=>{t&&n.recordEvent("jetpack_ai_assistant_extension_toolbar_menu_show",{block_type:e})},renderContent:({onClose:t})=>(0,r.createElement)(E,{onClose:t,blockType:e})})}},3180:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(65736),o=n(26546),s=n(46867);const __=a.__,i=()=>{const e=`${window?.Jetpack_Editor_Initial_State?.adminUrl}admin.php?page=my-jetpack#/connection`,{autosaveAndRedirect:t,isRedirecting:n}=(0,s.Z)(e);return(0,r.createElement)(o.p,{buttonText:__("Reconnect Jetpack","jetpack"),checkoutUrl:e,className:"jetpack-ai-connect-banner",description:__("Your account is not connected to Jetpack at the moment.","jetpack"),goToCheckoutPage:e=>{t(e)},isRedirecting:n,visible:!0,align:null,title:null,context:null})}},87445:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(6895),o=n(55609),s=n(65736);const __=s.__;const i=function(){const e=(0,a.Z)("jetpack-ai-feedback");return(0,r.createElement)("div",{className:"jetpack-ai-feedback-control"},(0,r.createElement)(o.BaseControl,{label:__("Feedback","jetpack")},(0,r.createElement)("p",null,__("Your feedback is valuable in our commitment to refine and improve this feature.","jetpack")),(0,r.createElement)(o.ExternalLink,{href:e},__("Share your feedback","jetpack"))))}},81612:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>h,aO:()=>g,xK:()=>E});var r=n(51806),a=n(13419),o=n(55609),s=n(65736),i=n(61074),l=n(46936),c=n(43618);n(99196);const __=s.__,u=["en","es","fr","de","it","pt","ru","zh","ja","ar","hi","ko"],A=window?.Jetpack_Editor_Initial_State?.siteLocale||navigator?.language,g=__("Translate","jetpack"),p=A?.split("-")[0]||"en",d=(A?.split("-"),{en:{label:__("English","jetpack")},es:{label:__("Spanish","jetpack")},fr:{label:__("French","jetpack")},de:{label:__("German","jetpack")},it:{label:__("Italian","jetpack")},pt:{label:__("Portuguese","jetpack")},ru:{label:__("Russian","jetpack")},zh:{label:__("Chinese","jetpack")},ja:{label:__("Japanese","jetpack")},ar:{label:__("Arabic","jetpack")},hi:{label:__("Hindi","jetpack")},ko:{label:__("Korean","jetpack")}}),m=({value:e,onChange:t})=>{const n=[...u.filter((e=>e!==p))];return u.includes(p)&&n.unshift(p),(0,r.createElement)(o.MenuGroup,{label:__("Select language","jetpack")},n.map((n=>(0,r.createElement)(o.MenuItem,{key:`key-${n}`,onClick:()=>t(n+" ("+d[n].label+")",d[n].label),isSelected:e===n},d[n].label))))};function h({value:e=p,label:t=g,onChange:n,disabled:s=!1}){const{tracks:l}=(0,a.z$)();return s?(0,r.createElement)(o.Tooltip,{text:t},(0,r.createElement)(o.Button,{disabled:!0},(0,r.createElement)(i.Z,{icon:c.Z}))):(0,r.createElement)(o.ToolbarDropdownMenu,{icon:c.Z,label:t,popoverProps:{variant:"toolbar"},onToggle:e=>{e&&l.recordEvent("jetpack_ai_assistant_block_toolbar_menu_show",{tool:"i18n"})}},(()=>(0,r.createElement)(m,{value:e,onChange:n})))}function E({value:e=p,label:t=g,onChange:n,disabled:a=!1}){return(0,r.createElement)(o.DropdownMenu,{className:"ai-assistant__i18n-dropdown",icon:c.Z,label:t,toggleProps:{children:(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"ai-assistant__i18n-dropdown__toggle-label"},t),(0,r.createElement)(i.Z,{icon:l.Z})),disabled:a}},(({onClose:t})=>(0,r.createElement)(m,{onChange:(...e)=>{n(...e),t()},value:e})))}},24404:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>m});var r=n(51806),a=n(13419),o=n(55609),s=n(65736),i=n(77840);const __=s.__,l="make-longer",c="makeLonger",u="make-shorter",A="makeShorter",g="summarize",p="summarize",d=[{name:__("Summarize","jetpack"),key:g,aiSuggestion:p},{name:__("Make longer","jetpack"),key:l,aiSuggestion:c},{name:__("Make shorter","jetpack"),key:u,aiSuggestion:A}];function m({key:e,label:t=__("Improve","jetpack"),exclude:n=[],onChange:s,disabled:l=!1}){const{tracks:c}=(0,a.z$)();return l?(0,r.createElement)(o.Tooltip,{text:t},(0,r.createElement)(o.Button,{disabled:!0},(0,r.createElement)(o.Icon,{icon:i.Z}))):(0,r.createElement)(o.ToolbarDropdownMenu,{icon:i.Z,label:t,popoverProps:{variant:"toolbar"},onToggle:e=>{e&&c.recordEvent("jetpack_ai_assistant_block_toolbar_menu_show",{tool:"improve"})}},(()=>{const a=d.filter((e=>!n.includes(e.key)));return(0,r.createElement)(o.MenuGroup,{label:t},a.map((t=>(0,r.createElement)(o.MenuItem,{key:`key-${t.key}`,onClick:()=>s(t.aiSuggestion,{contentType:"generated"}),isSelected:e===t.key},t.name))))}))}},85642:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>m});var r=n(51806),a=n(13419),o=n(55609),s=n(65736),i=n(77840),l=n(58532),c=n(586),u=n(3639),A=n(92710),g=n(32677);const __=s.__,p=[{label:__("Post about…","jetpack"),description:{original:"Write a post about ",translated:__("Write a post about ","jetpack")}},{label:__("Informative article on…","jetpack"),description:{original:"Craft an informative article explaining ",translated:__("Craft an informative article explaining ","jetpack")}},{label:__("Step-by-step tutorial on…","jetpack"),description:{original:"Write a step-by-step tutorial on ",translated:__("Write a step-by-step tutorial on ","jetpack")}},{label:__("Motivational post on…","jetpack"),description:{original:"Create a motivational post on ",translated:__("Create a motivational post on ","jetpack")}}],d=[{label:__("Say it differently…","jetpack"),description:{original:"Rewrite it in a way that ",translated:__("Rewrite it in a way that ","jetpack")}},{label:__("Add…","jetpack"),description:{original:"Add more details about ",translated:__("Add more details about ","jetpack")}},{label:__("Remove…","jetpack"),description:{original:"Remove unnecessary details about ",translated:__("Remove unnecessary details about ","jetpack")}}];function m({hasContentBefore:e,hasContent:t,hasPostTitle:n,contentIsLoaded:s,onPromptSelect:m,onSuggestionSelect:h}){const E=__("Write with AI…","jetpack"),{tracks:f}=(0,a.z$)();return(0,r.createElement)(o.ToolbarDropdownMenu,{className:"jetpack-ai-assistant__templates-control",icon:null,label:E,text:E,onToggle:e=>{e&&f.recordEvent("jetpack_ai_assistant_block_toolbar_menu_show",{tool:"write-with-ai"})}},(({onClose:a})=>s?(0,r.createElement)(o.MenuGroup,{label:__("Write…","jetpack")},d.map(((e,t)=>(0,r.createElement)(o.MenuItem,{icon:i.Z,iconPosition:"left",key:`key-${t}`,onClick:()=>{a(),m(e.description)}},e.label)))):(0,r.createElement)(r.Fragment,null,e&&(0,r.createElement)(o.MenuGroup,{label:__("Based on preceding content…","jetpack")},(0,r.createElement)(o.MenuItem,{icon:l.Z,iconPosition:"left",onClick:()=>h("continue")},__("Continue writing","jetpack")),(0,r.createElement)(o.MenuItem,{icon:c.Z,iconPosition:"left",onClick:()=>h("correctSpelling")},__("Correct spelling and grammar","jetpack")),(0,r.createElement)(o.MenuItem,{icon:u.Z,iconPosition:"left",onClick:()=>h("simplify")},__("Simplify","jetpack"))),t&&(0,r.createElement)(o.MenuGroup,{label:__("Based on entire content…","jetpack")},t&&(0,r.createElement)(o.MenuItem,{icon:A.Z,iconPosition:"left",onClick:()=>h("summarize")},__("Summarize","jetpack")),t&&(0,r.createElement)(o.MenuItem,{icon:g.Z,iconPosition:"left",onClick:()=>h("generateTitle")},__("Generate a post title","jetpack"))),(0,r.createElement)(o.MenuGroup,{label:__("Write…","jetpack")},n&&(0,r.createElement)(o.MenuItem,{icon:i.Z,iconPosition:"left",onClick:()=>h("titleSummary")},__("Summary based on title","jetpack")),p.map(((e,t)=>(0,r.createElement)(o.MenuItem,{icon:i.Z,iconPosition:"left",key:`key-${t}`,onClick:()=>{a(),m(e.description)}},e.label)))))))}},27298:(e,t,n)=>{"use strict";n.d(t,{IP:()=>d,Nj:()=>u,ZP:()=>m,iQ:()=>A});var r=n(51806),a=n(42290),o=n(13419),s=n(55609),i=n(65736),l=n(46936);n(99196);const __=i.__,c=["formal","informal","optimistic","humorous","serious","skeptical","empathetic","confident","passionate","provocative"],u="formal",A=__("Change tone","jetpack"),g={formal:{label:__("Formal","jetpack"),emoji:"🎩"},informal:{label:__("Informal","jetpack"),emoji:"😊"},optimistic:{label:__("Optimistic","jetpack"),emoji:"😃"},humorous:{label:__("Humorous","jetpack"),emoji:"😂"},serious:{label:__("Serious","jetpack"),emoji:"😐"},skeptical:{label:__("Skeptical","jetpack"),emoji:"🤨"},empathetic:{label:__("Empathetic","jetpack"),emoji:"💗"},confident:{label:__("Confident","jetpack"),emoji:"😎"},passionate:{label:__("Passionate","jetpack"),emoji:"❤️"},provocative:{label:__("Provocative","jetpack"),emoji:"🔥"}},p=({value:e,onChange:t})=>(0,r.createElement)(s.MenuGroup,{label:__("Select tone","jetpack")},c.map((n=>(0,r.createElement)(s.MenuItem,{key:`key-${n}`,onClick:()=>t(n),isSelected:e===n},`${g[n].emoji} ${g[n].label}`))));function d({label:e=A,value:t=u,onChange:n,disabled:o=!1}){return(0,r.createElement)(s.DropdownMenu,{icon:a.v_,label:e,className:"ai-assistant__tone-dropdown",popoverProps:{variant:"toolbar"},toggleProps:{children:(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"ai-assistant__tone-dropdown__toggle-label"},e),(0,r.createElement)(s.Icon,{icon:l.Z})),disabled:o}},(({onClose:e})=>(0,r.createElement)(p,{value:t,onChange:t=>{n(t),e()}})))}function m({value:e=u,onChange:t,disabled:n=!1}){const{tracks:i}=(0,o.z$)();return n?(0,r.createElement)(s.Tooltip,{text:A},(0,r.createElement)(s.Button,{disabled:!0},(0,r.createElement)(s.Icon,{icon:a.v_}))):(0,r.createElement)(s.ToolbarDropdownMenu,{icon:a.v_,label:A,popoverProps:{variant:"toolbar"},disabled:n,onToggle:e=>{e&&i.recordEvent("jetpack_ai_assistant_block_toolbar_menu_show",{tool:"tone"})}},(()=>(0,r.createElement)(p,{value:e,onChange:t})))}},4965:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(51806),a=n(52175),o=n(55609),s=n(65736),i=n(79201),l=n(48381),c=n(63634),u=n(81612),A=n(24404),g=n(85642),p=n(27298);const __=s.__,d=({contentIsLoaded:e,getSuggestionFromOpenAI:t,retryRequest:n,handleAcceptContent:s,handleTryAgain:d,showRetry:m,contentBefore:h,hasPostTitle:E,wholeContent:f,setUserPrompt:C,recordEvent:B,isGeneratingTitle:b})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.BlockControls,null,!m&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(o.ToolbarGroup,null,(0,r.createElement)(g.ZP,{hasContentBefore:!!h?.length,hasContent:!!f?.length,hasPostTitle:E,contentIsLoaded:e,onPromptSelect:e=>{B("jetpack_editor_ai_assistant_block_toolbar_button_click",{type:"prompt-template",prompt:e.original}),C(e.translated)},onSuggestionSelect:e=>{B("jetpack_editor_ai_assistant_block_toolbar_button_click",{type:"suggestion",suggestion:e}),t(e)}})),(0,r.createElement)(a.BlockControls,{group:"block"},(0,r.createElement)(p.ZP,{value:"neutral",onChange:n=>{B("jetpack_editor_ai_assistant_block_toolbar_button_click",{type:"suggestion",suggestion:c.Lg}),t(c.Lg,{tone:n,contentType:e?"generated":null})},disabled:!e&&!f?.length}),(0,r.createElement)(u.ZP,{value:"en",onChange:n=>{B("jetpack_editor_ai_assistant_block_toolbar_button_click",{type:"suggestion",suggestion:c.Nw}),t(c.Nw,{language:n,contentType:e?"generated":null})},disabled:!e&&!f?.length}),(0,r.createElement)(A.ZP,{onChange:t,exclude:b?["summarize"]:[],disabled:!e}))),(m||d)&&(0,r.createElement)(o.ToolbarGroup,null,!m&&e&&d&&(0,r.createElement)(o.ToolbarButton,{onClick:d},__("Try Again","jetpack")),m&&e&&(0,r.createElement)(o.ToolbarButton,{icon:i.Z,onClick:s},__("Accept","jetpack")),m&&(0,r.createElement)(o.ToolbarButton,{icon:l.Z,onClick:n},__("Retry","jetpack")))))},5246:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var r=n(51806),a=n(6895),o=n(13419),s=n(69307),i=n(65736),l=n(51128),c=n.n(l),u=n(26546),A=n(63206),g=n(18135),p=n(71449),d=n(78595);const __=i.__,m=c()("jetpack-ai-assistant:upgrade-prompt"),h=e=>{const{upgradeType:t}=(0,g.Z)();return"vip"===t?(({description:e=null,useLightNudge:t=!1})=>{const n=t?d.g:u.p,a=(0,s.createInterpolateElement)(__("You've reached the Jetpack AI rate limit. Please reach out to your VIP account team. ","jetpack"),{strong:(0,r.createElement)("strong",null)});return(0,r.createElement)(n,{buttonText:null,checkoutUrl:null,className:"jetpack-ai-upgrade-banner",description:e||a,goToCheckoutPage:null,isRedirecting:null,visible:!0,align:null,title:null,context:null})})({description:e.description,useLightNudge:e?.useLightNudge}):(({placement:e=null,description:t=null,useLightNudge:n=!1})=>{const l=n?d.g:u.p,{checkoutUrl:c}=(0,A.Z)(),h=(0,p.d)(),{nextTier:E,tierPlansEnabled:f,currentTier:C,requestsCount:B}=(0,g.Z)(),{tracks:b}=(0,o.z$)(),k=(0,s.useCallback)((()=>{m("upgrade",e),b.recordEvent("jetpack_ai_upgrade_button",{current_tier_slug:C?.slug,requests_count:B,placement:e})}),[C,B,b,e]),v=(0,s.useCallback)((()=>{m("contact us",e),b.recordEvent("jetpack_ai_upgrade_contact_us",{placement:e})}),[b,e]);if(!h){const e=(0,s.createInterpolateElement)(__("Congratulations on exploring Jetpack AI and reaching the free requests limit! Reach out to the site administrator to upgrade and keep using Jetpack AI. ","jetpack"),{strong:(0,r.createElement)("strong",null)});return(0,r.createElement)(l,{showButton:!1,className:"jetpack-ai-upgrade-banner",description:t||e,visible:!0,align:null,title:null,context:null})}if(f){if(!E){const e=(0,a.Z)("jetpack-ai-tiers-more-requests-contact"),n=__("You have reached the request limit for your current plan.","jetpack");return(0,r.createElement)(l,{buttonText:__("Contact Us","jetpack"),description:t||n,className:"jetpack-ai-upgrade-banner",checkoutUrl:e,visible:!0,align:null,title:null,context:null,goToCheckoutPage:v,target:"_blank"})}const e=(0,s.createInterpolateElement)((0,i.sprintf)(/* Translators: number of requests */
+__("Error: %1$s","jetpack"),i)),t===A.$L?React.createElement(r.Button,{variant:"link",onClick:o,href:s,target:s?"_blank":null},__("Upgrade now","jetpack")):React.createElement(r.Button,{variant:"link",onClick:n},__("Try again","jetpack")))}},62282:(e,t,n)=>{"use strict";n.d(t,{h:()=>s,u:()=>o});var r=n(99196),a=n.n(r);const o=(0,r.createContext)({}),s=({value:e,children:t})=>a().createElement(o.Provider,{value:e,children:t})},20281:(e,t,n)=>{"use strict";n.d(t,{X_:()=>o.Z,hE:()=>r.h,oN:()=>a.Z,uE:()=>r.u});var r=n(62282),a=n(3669),o=n(79466)},79466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(99196),a=n(16700),o=n(20281);function s({onDone:e,onSuggestion:t,onError:n}={}){const s=(0,r.useContext)(o.uE),{eventSource:i}=s,l=(0,r.useCallback)((t=>e?.(t?.detail)),[e]),c=(0,r.useCallback)((e=>t?.(e?.detail)),[t]),u=(0,r.useCallback)((e=>{n?.(e?.detail)}),[]);return(0,r.useEffect)((()=>{if(i)return e&&i.addEventListener("done",l),t&&i.addEventListener("suggestion",c),n&&i.addEventListener(a.vF,u),()=>{i.removeEventListener("done",l),i.removeEventListener("suggestion",c),i.removeEventListener(a.vF,u)}}),[i]),s}},3669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(94333),a=n(69307),o=n(99196),s=n.n(o),i=n(42194),l=n(20281);const c=(0,r.createHigherOrderComponent)((e=>t=>{const{suggestion:n,error:r,requestingState:o,request:c,stopSuggestion:u,eventSource:A}=(0,i.Z)(),g=(0,a.useMemo)((()=>({suggestion:n,requestingError:r,requestingState:o,eventSource:A,requestSuggestion:c,stopSuggestion:u})),[n,r,o,A,c,u]);return s().createElement(l.hE,{value:g},s().createElement(e,t))}),"withAiDataProvider")},42194:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Z:()=>l});var r=n(69307),a=n(65736),o=n(67742),s=n(16700);const __=a.__;function i(e){switch(e){case s.$L:return{code:s.$L,message:__("You have reached the limit of requests for this site.","jetpack"),severity:"info"};case s.bC:return{code:s.bC,message:__("Your request was unclear. Mind trying again?","jetpack"),severity:"info"};case s.$u:return{code:s.$u,message:__("Jetpack AI services are currently unavailable. Sorry for the inconvenience.","jetpack"),severity:"info"};case s.q4:return{code:s.q4,message:__("This request has been flagged by our moderation system. Please try to rephrase it and try again.","jetpack"),severity:"info"};case s.cv:return{code:s.cv,message:__("The content is too large to be processed all at once. Please try to shorten it or divide it into smaller parts.","jetpack"),severity:"info"};case s.co:default:return{code:s.co,message:__("It was not possible to process your request. Mind trying again?","jetpack"),severity:"info"}}}function l({prompt:e,autoRequest:t=!1,askQuestionOptions:n={},initialRequestingState:a="init",onSuggestion:l,onDone:c,onStop:u,onError:A,onAllErrors:g}={}){const[p,d]=(0,r.useState)(a),[m,h]=(0,r.useState)(""),[E,f]=(0,r.useState)(),C=(0,r.useRef)(void 0),B=(0,r.useCallback)((e=>{h(e?.detail),l?.(e?.detail)}),[l]),b=(0,r.useCallback)((e=>{x(),c?.(e?.detail),d("done")}),[c]),k=(0,r.useCallback)((e=>{g?.(e?.detail)}),[g]),v=(0,r.useCallback)((e=>{C?.current?.close(),d("error"),f(i(e)),A?.(i(e))}),[A]),I=(0,r.useCallback)((()=>v(s.$L)),[]),y=(0,r.useCallback)((()=>v(s.bC)),[]),w=(0,r.useCallback)((()=>v(s.$u)),[]),Q=(0,r.useCallback)((()=>v(s.q4)),[]),_=(0,r.useCallback)((()=>v(s.co)),[]),S=(0,r.useCallback)((async(e,t={...n})=>{if(f(void 0),d("requesting"),C.current=await(0,o.Z)(e,t),!C?.current)return;const r=C.current;d("suggesting"),r.addEventListener("suggestion",B),r.addEventListener(s.$L,I),r.addEventListener(s.bC,y),r.addEventListener(s.$u,w),r.addEventListener(s.q4,Q),r.addEventListener(s.co,_),r.addEventListener(s.vF,k),r.addEventListener("done",b)}),[b,I,y,w,Q,_,B]),j=(0,r.useCallback)((()=>{d("init"),h(""),f(void 0)}),[]),x=(0,r.useCallback)((()=>{if(!C?.current)return;const e=C?.current;e.close(),e.removeEventListener("suggestion",B),e.removeEventListener(s.$L,I),e.removeEventListener(s.bC,y),e.removeEventListener(s.$u,w),e.removeEventListener(s.q4,Q),e.removeEventListener(s.co,_),e.removeEventListener("done",b)}),[C,B,I,y,w,Q,_,b]),L=(0,r.useCallback)((()=>{x(),u?.(),d("done")}),[u]);return(0,r.useEffect)((()=>{if(e?.length)return t&&S(e,n),()=>{L()}}),[t,e,S,L]),{suggestion:m,error:E,requestingState:p,request:S,stopSuggestion:L,reset:j,handleErrorQuotaExceededError:I,eventSource:C.current}}},93509:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(69307),a=n(65736),o=n(51128),s=n.n(o),i=n(46961);const __=a.__,l=s()("jetpack-ai-client:use-audio-transcription"),c=e=>{if("string"==typeof e)return e;if("code"in e)switch(e.code){case"error_quota_exceeded":return __("You exceeded your current quota, please check your plan details.","jetpack");case"jetpack_ai_missing_audio_param":return __("The audio_file is required to perform a transcription.","jetpack");case"jetpack_ai_service_unavailable":return __("The Jetpack AI service is temporarily unavailable.","jetpack");case"file_size_not_supported":return __("The provided audio file is too big.","jetpack");case"file_type_not_supported":return __("The provided audio file type is not supported.","jetpack");case"jetpack_ai_error":return __("There was an error processing the transcription request.","jetpack");default:return e.message}return"message"in e?e.message:__("There was an error processing the transcription request.","jetpack")};function u({feature:e,onReady:t,onError:n}){const[a,o]=(0,r.useState)(""),[s,u]=(0,r.useState)(""),[A,g]=(0,r.useState)(!1),p=(0,r.useRef)(null);return{transcriptionResult:a,isTranscribingAudio:A,transcriptionError:s,transcribeAudio:(0,r.useCallback)((r=>{l("Transcribing audio"),o(""),u(""),g(!0);const a=new AbortController;p.current=a,(0,i.Z)(r,e,a.signal).then((e=>{o(e),t?.(e)})).catch((e=>{a.signal.aborted||(u(e.message),n?.(c(e)))})).finally((()=>g(!1)))}),[i.Z,o,u,g]),cancelTranscription:(0,r.useCallback)((()=>{p.current?.abort(),o(""),u(""),g(!1)}),[p,o,u,g])}}},92718:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(69307),a=n(65736);const __=a.__,o=25e6,s=1500,i=["audio/mpeg","audio/mp3","audio/ogg","audio/flac","audio/x-flac","audio/m4a","audio/x-m4a","audio/mp4","audio/wav","audio/wave","audio/x-wav","audio/webm"];function l(){const[e,t]=(0,r.useState)(!1);return{isValidatingAudio:e,validateAudio:(0,r.useCallback)(((e,n,r)=>{if(t(!0),e?.size>o)return t(!1),r(__("The audio file is too large. The maximum file size is 25MB.","jetpack"));const a=e instanceof File;if(a&&!i.includes(e.type))return t(!1),r(__("The audio file type is not supported. Please use a supported audio file type.","jetpack"));const l=new AudioContext;e.arrayBuffer().then((o=>{l.decodeAudioData(o,(function(o){const i=Math.ceil(o.duration);return i>s?(t(!1),r(__("The audio file is too long. The maximum recording time is 25 minutes.","jetpack"))):(t(!1),n({duration:i,isFile:a,size:e?.size}))}))}))}),[t])}}},70286:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51128),a=n.n(r),o=n(78982),s=n(2890);const i=a()("ai-client:use-image-generator"),l=(e,t)=>{const n=4e3-t;return e.length>n?e.substring(0,n-6)+" [...]":e},c=async(e,t,n)=>{const r=((e,t)=>{if(t){const n=`I need a Stable Diffusion prompt to generate a featured image for a blog post based on this user-provided image description:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nThe image should be a photo. Make sure you highlight the main suject of the image description, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}return"I need a Stable Diffusion prompt to generate a featured image for a blog post with the following content.\nThe image should be a photo. Make sure you highlight the main suject of the content, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments. The content is:\n\n"+l(e,412)})(e,t),a=await(0,o.Z)(r,{feature:n});return a.choices?.[0]?.message?.content},u=()=>{const e=async function(e){let t="";try{t=(await(0,s.Z)()).token}catch(e){return i("Error getting token: %o",e),Promise.reject(e)}try{const n="https://public-api.wordpress.com/wpcom/v2/jetpack-ai-image",r={Authorization:`Bearer ${t}`,"Content-Type":"application/json"},a=await fetch(n,{method:"POST",headers:r,body:JSON.stringify(e)}).then((e=>e.json()));return a?.data?.status&&a?.data?.status>200?(i("Error generating image: %o",a),Promise.reject(a)):a}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}};return{generateImage:async function({feature:t,postContent:n,responseFormat:r="url",userPrompt:a}){try{i("Generating image");const o=((e,t)=>{if(t){const n=`I need a cover image for a blog post based on this user prompt:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nBefore creating the image, identify the main topic of the user prompt and relate it to the post content.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}const n="I need a cover image for a blog post.\nBefore creating the image, identify the main topic of the content and only represent it.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nThis is the post content:\n\n";return n+l(e,838)})(n,a),s={prompt:o,response_format:r,feature:t,size:"1792x1024"};return await e(s)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithStableDiffusion:async function({feature:t,postContent:n,userPrompt:r}){try{i("Generating image with Stable Diffusion");const a={prompt:await c(n,r,t),feature:t,model:"stable-diffusion",style:"photographic"};return await e(a)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithParameters:e}}},13109:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(69307);const a="audio/mp4;codecs=mp4a",o="audio/mp4",s="audio/webm";function i({onDone:e}={}){const t=(0,r.useRef)(null),[n,i]=(0,r.useState)("inactive"),l=(0,r.useRef)(!1),c=(0,r.useRef)(0),[u,A]=(0,r.useState)(0),g=(0,r.useRef)(null),[p,d]=(0,r.useState)(null),m=(0,r.useRef)([]).current,[h,E]=(0,r.useState)(null),f=(0,r.useRef)(null);function C(){return MediaRecorder.isTypeSupported(a)?new Blob(m,{type:o}):new Blob(m,{type:s})}const B=(0,r.useCallback)((e=>{if(I(),!e)return t?.current?.start();e<100&&(e=100),c.current=Date.now(),t?.current?.start(e)}),[]),b=(0,r.useCallback)((()=>{l.current=!0,t?.current?.pause(),A((e=>e+Date.now()-c.current))}),[]),k=(0,r.useCallback)((()=>{l.current=!1,t?.current?.resume(),c.current=Date.now()}),[]),v=(0,r.useCallback)((()=>{t?.current?.stop(),"recording"===n&&A((e=>e+Date.now()-c.current))}),[]),I=(0,r.useCallback)((()=>{m.length=0,d(null),E(null),A(0),l.current=!1,c.current=0}),[]),y=(0,r.useCallback)((()=>{t?.current&&(t.current.removeEventListener("start",_),t.current.removeEventListener("stop",S),t.current.removeEventListener("pause",j),t.current.removeEventListener("resume",x),t.current.removeEventListener("dataavailable",L),t.current=null)}),[]),w=(0,r.useCallback)((()=>{if(i("inactive"),I(),y(),!navigator.mediaDevices?.getUserMedia)return;const e=new AudioContext;f.current=e.createAnalyser();navigator.mediaDevices.getUserMedia({audio:!0}).then((n=>{g.current=n;e.createMediaStreamSource(n).connect(f.current),MediaRecorder.isTypeSupported(a)?t.current=new MediaRecorder(n,{mimeType:a}):t.current=new MediaRecorder(n,{mimeType:s}),t.current.addEventListener("start",_),t.current.addEventListener("stop",S),t.current.addEventListener("pause",j),t.current.addEventListener("resume",x),t.current.addEventListener("dataavailable",L)})).catch((e=>{throw e}))}),[]),Q=(0,r.useCallback)((e=>{v(),E("string"==typeof e?e:e.message),i("error")}),[]);function _(){i("recording")}function S(){const t=C();e?.(t),m.length=0}function j(){i("paused")}function x(){i("recording")}function L(e){const{data:t}=e;t?.size&&(m.push(t),d(C()),l.current||A((e=>{const t=Date.now(),n=t-c.current;return c.current=t,e+n})))}return(0,r.useEffect)((()=>(w(),()=>{g.current&&g.current.getTracks().forEach((e=>e.stop())),y()})),[]),{state:n,blob:p,error:h,duration:u,analyser:f.current,onError:Q,controls:{start:B,pause:b,resume:k,stop:v,reset:w}}}},44696:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>c});var r=n(69307),a=n(51128),o=n.n(a),s=n(42194);const i=o()("jetpack-ai-client:use-transcription-post-processing"),l="voice-to-content-simple-draft";function c({feature:e,onReady:t,onError:n,onUpdate:a}){const[o,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[A,g]=(0,r.useState)(!1),p=(0,r.useCallback)((e=>{l(e),a?.(e)}),[l,a]),d=(0,r.useCallback)((e=>{l(e),a?.(e),t?.(e)}),[l,a,t]),m=(0,r.useCallback)((e=>{u(e.message),n?.(e.message)}),[u,n]),{request:h,stopSuggestion:E}=(0,s.Z)({onSuggestion:p,onDone:d,onError:m});return{postProcessingResult:o,isProcessingTranscription:A,postProcessingError:c,processTranscription:(0,r.useCallback)(((t,n)=>{i("Post-processing transcription"),l(""),u(""),g(!0);h([{role:"jetpack-ai",context:{type:t,content:n}}],{feature:e})}),[l,u,g,h,e]),cancelTranscriptionProcessing:(0,r.useCallback)((()=>{E(),g(!1)}),[E,g])}}},61317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(55609),a=n(99196),o=n.n(a);const s=o().createElement(r.SVG,{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"ai-assistant-icon"},o().createElement(r.Path,{className:"spark-first",d:"M9.33301 5.33325L10.4644 8.20188L13.333 9.33325L10.4644 10.4646L9.33301 13.3333L8.20164 10.4646L5.33301 9.33325L8.20164 8.20188L9.33301 5.33325Z"}),o().createElement(r.Path,{className:"spark-second",d:"M21.3333 5.33333L22.8418 9.15817L26.6667 10.6667L22.8418 12.1752L21.3333 16L19.8248 12.1752L16 10.6667L19.8248 9.15817L21.3333 5.33333Z"}),o().createElement(r.Path,{className:"spark-third",d:"M14.6667 13.3333L16.5523 18.1144L21.3333 20L16.5523 21.8856L14.6667 26.6667L12.781 21.8856L8 20L12.781 18.1144L14.6667 13.3333Z"}))},83585:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(55609);const a=React.createElement(r.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.95833C6.66328 3.95833 3.95833 6.66327 3.95833 9.99999C3.95833 13.3367 6.66328 16.0417 10 16.0417C13.3367 16.0417 16.0417 13.3367 16.0417 9.99999C16.0417 6.66327 13.3367 3.95833 10 3.95833ZM2.70833 9.99999C2.70833 5.97292 5.97292 2.70833 10 2.70833C14.0271 2.70833 17.2917 5.97292 17.2917 9.99999C17.2917 14.0271 14.0271 17.2917 10 17.2917C5.97292 17.2917 2.70833 14.0271 2.70833 9.99999Z"}),React.createElement(r.Path,{d:"M10.8333 5.83333H9.16667V10.8333H10.8333V5.83333Z"}),React.createElement(r.Path,{d:"M10.8333 12.5H9.16667V14.1667H10.8333V12.5Z"}))},59822:(e,t,n)=>{"use strict";n.d(t,{Qf:()=>a.Z,Qr:()=>o.Z,u_:()=>r.Z,v_:()=>s.Z});var r=n(61317),a=n(81204),o=(n(4454),n(71893),n(52887),n(96083)),s=n(50500)},81204:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(55609),a=n(99196),o=n.n(a);const s=o().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},o().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),o().createElement(r.Rect,{x:"10.5",y:"8.25",width:"3",height:"4.875",rx:"1.5",fill:"#008710"}),o().createElement(r.Path,{d:"M15 11.25C15 11.644 14.9224 12.0341 14.7716 12.3981C14.6209 12.762 14.3999 13.0927 14.1213 13.3713C13.8427 13.6499 13.512 13.8709 13.1481 14.0216C12.7841 14.1724 12.394 14.25 12 14.25C11.606 14.25 11.2159 14.1724 10.8519 14.0216C10.488 13.8709 10.1573 13.6499 9.87868 13.3713C9.6001 13.0927 9.37913 12.762 9.22836 12.3981C9.0776 12.0341 9 11.644 9 11.25",stroke:"#008710",strokeWidth:"1.125",strokeLinecap:"round"}),o().createElement(r.Path,{d:"M11.4375 15.75C11.4375 16.0607 11.6893 16.3125 12 16.3125C12.3107 16.3125 12.5625 16.0607 12.5625 15.75L11.4375 15.75ZM11.4375 14.25L11.4375 15.75L12.5625 15.75L12.5625 14.25L11.4375 14.25Z",fill:"#008710"}))},4454:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),o=n.n(a);r.SVG,r.Path,r.Path},96083:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(55609),a=n(99196),o=n.n(a);const s=o().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},o().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),o().createElement(r.Rect,{x:"12.75",y:"9",width:"2.25",height:"6",fill:"#008710"}),o().createElement(r.Rect,{x:"9",y:"9",width:"2.25",height:"6",fill:"#008710"}))},71893:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),o=n.n(a);r.SVG,r.Path,r.Path},52887:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),o=n.n(a);r.SVG,r.Path,r.Rect},50500:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(55609),a=n(99196),o=n.n(a);const s=o().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5 10C12.5 11.3807 11.3807 12.5 10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10ZM14 10C14 12.2091 12.2091 14 10 14C7.79086 14 6 12.2091 6 10C6 7.79086 7.79086 6 10 6C12.2091 6 14 7.79086 14 10ZM16.75 21V19C16.75 17.4812 15.5188 16.25 14 16.25L6 16.25C4.48122 16.25 3.25 17.4812 3.25 19V21H4.75L4.75 19C4.75 18.3096 5.30964 17.75 6 17.75L14 17.75C14.6904 17.75 15.25 18.3096 15.25 19V21H16.75Z",fill:"currentColor"}),o().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M19.976 16.3599C21.2507 14.5642 22.0001 12.3695 22.0001 9.99969C22.0001 7.63128 21.2515 5.43769 19.9782 3.64258L18.754 4.50967C19.8537 6.05996 20.5001 7.95434 20.5001 9.99969C20.5001 12.0464 19.8528 13.9419 18.7519 15.4928L19.976 16.3599ZM17.3357 14.4897C18.2357 13.222 18.7648 11.6727 18.7648 9.99969C18.7648 8.32808 18.2365 6.77984 17.3379 5.51279L16.1137 6.37988C16.8387 7.4021 17.2648 8.65114 17.2648 9.99969C17.2648 11.3496 16.8378 12.5998 16.1116 13.6226L17.3357 14.4897Z",fill:"currentColor"}))},42290:(e,t,n)=>{"use strict";n.d(t,{$L:()=>g.$L,$u:()=>g.$u,C3:()=>u.C3,JP:()=>p.JP,L$:()=>i.Z,LB:()=>p.LB,MW:()=>u.MW,OS:()=>s.Z,Qf:()=>c.Qf,Qr:()=>c.Qr,Rc:()=>l.Z,X_:()=>A.X_,Y:()=>g.Y,ZK:()=>u.ZK,_T:()=>a.Z,bC:()=>g.bC,cH:()=>o.Z,co:()=>g.co,cv:()=>g.cv,g:()=>p.g,oN:()=>A.oN,pw:()=>r.Z,q4:()=>g.q4,rp:()=>u.rp,u_:()=>c.u_,v_:()=>c.v_,xi:()=>u.xi});n(2890),n(56694),n(67742),n(46961);var r=n(42194),a=n(13109),o=n(93509),s=n(44696),i=n(92718),l=n(70286),c=n(59822),u=n(58890),A=n(20281),g=n(16700),p=n(35613)},2890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(51128),o=n.n(a),s=n(87309);const i=o()("jetpack-ai-client:jwt"),l="jetpack-ai-jwt",c=12e4;async function u({apiNonce:e,siteId:t,expirationTime:n}={}){e=e||window.JP_CONNECTION_INITIAL_STATE.apiNonce,t=t||window.JP_CONNECTION_INITIAL_STATE.siteSuffix,n=n||c;const a=(0,r.Wp)(),o=localStorage.getItem(l);let u,A=null;if(o)try{A=JSON.parse(o)}catch(e){i("Error parsing token",e)}if(A&&A?.expire>Date.now())return i("Using cached token"),A;u=a?await(0,s.Z)({path:"/wpcom/v2/sites/"+t+"/jetpack-openai-query/jwt",method:"POST"}):await(0,s.Z)({path:"/jetpack/v4/jetpack-ai-jwt?_cacheBuster="+Date.now(),credentials:"same-origin",headers:{"X-WP-Nonce":e},method:"POST"});const g={token:u.token,blogId:a?t:u.blog_id,expire:Date.now()+n};return i("Storing new token"),localStorage.setItem(l,JSON.stringify(g)),g}},35613:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.JP,LB:()=>r.LB,g:()=>r.g});var r=n(71197)},22999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(92213);const a={paragraph:e=>e.replaceAll("\n"," ")},o={emDelimiter:"_",headingStyle:"atx"},s={strikethrough:{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}}};class i{constructor({options:e={},rules:t={},keep:n=[],remove:a=[],fixes:i=[]}={}){this.fixes=i,this.turndownService=new r.Z({...o,...e}),this.turndownService.keep(n),this.turndownService.remove(a);const l={...s,...t};for(const e in l)this.turndownService.addRule(e,l[e])}render({content:e}){const t=this.turndownService.turndown(e);return this.fixes.reduce(((e,t)=>a[t](e)),t)}}},71197:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.Z,LB:()=>s,g:()=>i});var r=n(22999);const a=new(n(28603).Z),o=new r.Z,s=({content:e,rules:t,extension:n})=>a.render({content:e,rules:t,extension:n}),i=({content:e})=>o.render({content:e})},28603:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(95601);const a=e=>e.replaceAll("\x3c!-- wp:list-item --\x3e","").replaceAll("\x3c!-- /wp:list-item --\x3e","").replaceAll("\x3c!-- wp:list --\x3e","").replaceAll("\x3c!-- /wp:list --\x3e","").replaceAll("","\x3c!-- wp:list-item --\x3e ").replaceAll(" ","\x3c!-- /wp:list-item --\x3e").replaceAll("",'\x3c!-- wp:list {"ordered":true} --\x3e').replaceAll(" "," \x3c!-- /wp:list --\x3e").replaceAll("","\x3c!-- wp:list --\x3e"," \x3c!-- /wp:list --\x3e"),o={list:(e,t=!1)=>{const n=e.replace(/\s+/g,"
").replace(/<\/p>\s+<\/li>/g," ");return t?a(n):n},listItem:(e,t=!1)=>t?a(e.replace(/^<[ou]l>\s*/g,"").replace(/\s*<\/[ou]l>\s*$/g,"")):e,paragraph:(e,t=!1)=>t?e.replaceAll(/\s*<br \/>\s*/g," "):e},s={breaks:!0},i=["list"];class l{constructor(e=s){this.markdownConverter=new r.Z(e)}render({content:e,rules:t=i,extension:n=!1}){const r=this.markdownConverter.render(e);return t.reduce(((e,t)=>o[t](e,n)),r)}}},56694:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(60400),a=n(51128),o=n.n(a),s=n(42194),i=n(2890),l=n(16700);const c=o()("jetpack-ai-client:suggestions-event-source");class u extends EventTarget{constructor(e){super(),this.fullMessage="",this.fullFunctionCall={name:"",arguments:""},this.isPromptClear=!1,this.controller=new AbortController,this.initEventSource(e)}async initEventSource({url:e,question:t,token:n,options:a={}}){if(!n)try{c("Token was not provided, requesting one..."),n=(await(0,i.Z)()).token}catch(e){return void this.processErrorEvent(e)}const o={};if(Number.isInteger(parseInt(a.postId))&&(o.post_id=+a.postId),!e){const t=new URL("https://public-api.wordpress.com/wpcom/v2/jetpack-ai-query");a?.fromCache&&t.searchParams.append("stream_cache","true"),e=t.toString(),c("URL not provided, using default: %o",e)}Array.isArray(t)?o.messages=t:o.question=t,a?.feature?.length&&(c("Feature: %o",a.feature),o.feature=a.feature),a?.functions?.length&&(c("Functions: %o",a.functions),o.functions=a.functions),a?.model?.length&&(c("Model: %o",a.model),o.model=a.model),this.errorUnclearPromptTriggered=!1,await(0,r.L)(e,{openWhenHidden:!0,method:"POST",headers:{"Content-type":"application/json",Authorization:"Bearer "+n},body:JSON.stringify(o),onclose:()=>{c("Stream closed")},onerror:e=>{throw this.processErrorEvent(e),e},onmessage:e=>{this.processEvent(e)},onopen:async e=>{if(e.ok)return;let t;throw e.status>=400&&e.status<=500&&![413,422,429].includes(e.status)&&(c("Connection error: %o",e),t=l.co,this.dispatchEvent(new CustomEvent(l.co,{detail:e}))),503===e.status&&(t=l.$u,this.dispatchEvent(new CustomEvent(l.$u))),413===e.status&&(t=l.cv,this.dispatchEvent(new CustomEvent(l.cv))),422===e.status&&(t=l.q4,this.dispatchEvent(new CustomEvent(l.q4))),429===e.status&&(t=l.$L,this.dispatchEvent(new CustomEvent(l.$L))),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,s.A)(t)})),new Error},signal:this.controller.signal})}checkForUnclearPrompt(){if(this.isPromptClear)return;const e=this.fullMessage.replace(/__|(\*\*)/g,"");if(e.startsWith("JETPACK_AI_ERROR")){if(this.errorUnclearPromptTriggered)return;this.errorUnclearPromptTriggered=!0,this.dispatchEvent(new CustomEvent(l.bC)),c("Unclear error prompt dispatched"),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,s.A)(l.bC)}))}else"JETPACK_AI_ERROR".startsWith(e)?c(this.fullMessage):this.isPromptClear=!0}close(){this.controller.abort()}processEvent(e){if("[DONE]"===e.data){if(this.errorUnclearPromptTriggered)return;if(this.fullMessage.length)return this.dispatchEvent(new CustomEvent("done",{detail:this.fullMessage})),void c("Done: %o",this.fullMessage);if(this.fullFunctionCall.name.length)return this.dispatchEvent(new CustomEvent("function_done",{detail:this.fullFunctionCall})),void c("Done: %o",this.fullFunctionCall)}let t;try{t=JSON.parse(e.data)}catch(t){return void c("Error parsing JSON",e,t)}const{delta:n}=t?.choices?.[0]??{delta:{content:null,function_call:null}},r=n.content,a=n.function_call;r&&(this.fullMessage+=r,this.checkForUnclearPrompt(),this.isPromptClear&&(this.dispatchEvent(new CustomEvent("chunk",{detail:r})),c("suggestion: %o",this.fullMessage),this.dispatchEvent(new CustomEvent("suggestion",{detail:this.fullMessage})))),a&&(null!=a.name&&(this.fullFunctionCall.name+=a.name),null!=a.arguments&&(this.fullFunctionCall.arguments+=a.arguments),this.dispatchEvent(new CustomEvent("functionCallChunk",{detail:this.fullFunctionCall})))}processErrorEvent(e){c("onerror: %o",e),this.dispatchEvent(new CustomEvent(l.co,{detail:e})),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,s.A)(l.co)}))}}},16700:(e,t,n)=>{"use strict";n.d(t,{$L:()=>o,$u:()=>a,Y:()=>r.Y,bC:()=>c,co:()=>l,cv:()=>i,q4:()=>s,vF:()=>u});var r=n(44696);const a="error_service_unavailable",o="error_quota_exceeded",s="error_moderation",i="error_context_too_large",l="error_network",c="error_unclear_prompt",u="error_response"},6975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51128);const a=n.n(r)()("dops:analytics");let o,s;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const i={initialize:function(e,t,n){i.setUser(e,t),i.setSuperProps(n),i.identifyUser()},setGoogleAnalyticsEnabled:function(e,t=null){this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){s={ID:e,username:t}},setSuperProps:function(e){o=e},assignSuperProps:function(e){o=Object.assign(o||{},e)},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Built stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){i.tracks.recordPageView(e),i.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,a,o,s){i.ga.recordPurchase(e,t,n,r,a,o,s)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(o&&(a("- Super Props: %o",o),t=Object.assign(t,o)),a('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):a('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};i.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){i.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){a("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};i.ga.initialized||(s&&(e={userId:"u-"+s.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),i.ga.initialized=!0)},recordPageView:function(e,t){i.ga.initialize(),a("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){i.ga.initialize();let o="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(o+=" [Option Label: "+n+"]"),void 0!==r&&(o+=" [Option Value: "+r+"]"),a(o),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,a,o,s){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:s}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:a,quantity:o}),window.ga("ecommerce:send")}},identifyUser:function(){s&&window._tkq.push(["identifyUser",s.ID,s.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}},l=i},64743:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>A});var r=n(61132),a=n(96483);function o(e){class t extends Error{constructor(...t){super(...t),this.name=e}}return t}const s=o("JsonParseError"),i=o("JsonParseAfterRedirectError"),l=o("Api404Error"),c=o("Api404AfterRedirectError"),u=o("FetchNetworkError");const A=new function(e,t){let n=e,o=e,s={"X-WP-Nonce":t},i={credentials:"same-origin",headers:s},l={method:"post",credentials:"same-origin",headers:Object.assign({},s,{"Content-type":"application/json"})},c=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setWpcomOriginApiUrl(e){o=e},setApiNonce(e){s={"X-WP-Nonce":e},i={credentials:"same-origin",headers:s},l={method:"post",credentials:"same-origin",headers:Object.assign({},s,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{c=e},registerSite:(e,t,a)=>{const o={registration_nonce:e,no_iframe:!0};return(0,r.jetpackConfigHas)("consumer_slug")&&(o.plugin_slug=(0,r.jetpackConfigGet)("consumer_slug")),null!==t&&(o.redirect_uri=t),a&&(o.from=a),d(`${n}jetpack/v4/connection/register`,l,{body:JSON.stringify(o)}).then(g).then(p)},fetchAuthorizationUrl:e=>A((0,a.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),i).then(g).then(p),fetchSiteConnectionData:()=>A(`${n}jetpack/v4/connection/data`,i).then(p),fetchSiteConnectionStatus:()=>A(`${n}jetpack/v4/connection`,i).then(p),fetchSiteConnectionTest:()=>A(`${n}jetpack/v4/connection/test`,i).then(g).then(p),fetchUserConnectionData:()=>A(`${n}jetpack/v4/connection/data`,i).then(p),fetchUserTrackingSettings:()=>A(`${n}jetpack/v4/tracking/settings`,i).then(g).then(p),updateUserTrackingSettings:e=>d(`${n}jetpack/v4/tracking/settings`,l,{body:JSON.stringify(e)}).then(g).then(p),disconnectSite:()=>d(`${n}jetpack/v4/connection`,l,{body:JSON.stringify({isActive:!1})}).then(g).then(p),fetchConnectUrl:()=>A(`${n}jetpack/v4/connection/url`,i).then(g).then(p),unlinkUser:()=>d(`${n}jetpack/v4/connection/user`,l,{body:JSON.stringify({linked:!1})}).then(g).then(p),reconnect:()=>d(`${n}jetpack/v4/connection/reconnect`,l).then(g).then(p),fetchConnectedPlugins:()=>A(`${n}jetpack/v4/connection/plugins`,i).then(g).then(p),setHasSeenWCConnectionModal:()=>d(`${n}jetpack/v4/seen-wc-connection-modal`,l).then(g).then(p),fetchModules:()=>A(`${n}jetpack/v4/module/all`,i).then(g).then(p),fetchModule:e=>A(`${n}jetpack/v4/module/${e}`,i).then(g).then(p),activateModule:e=>d(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!0})}).then(g).then(p),deactivateModule:e=>d(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>d(`${n}jetpack/v4/module/${e}`,l,{body:JSON.stringify(t)}).then(g).then(p),updateSettings:e=>d(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(g).then(p),getProtectCount:()=>A(`${n}jetpack/v4/module/protect/data`,i).then(g).then(p),resetOptions:e=>d(`${n}jetpack/v4/options/${e}`,l,{body:JSON.stringify({reset:!0})}).then(g).then(p),activateVaultPress:()=>d(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(g).then(p),getVaultPressData:()=>A(`${n}jetpack/v4/module/vaultpress/data`,i).then(g).then(p),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),d(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify(r)}).then(g).then(p)},activateAkismet:()=>d(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(g).then(p),getAkismetData:()=>A(`${n}jetpack/v4/module/akismet/data`,i).then(g).then(p),checkAkismetKey:()=>A(`${n}jetpack/v4/module/akismet/key/check`,i).then(g).then(p),checkAkismetKeyTyped:e=>d(`${n}jetpack/v4/module/akismet/key/check`,l,{body:JSON.stringify({api_key:e})}).then(g).then(p),fetchStatsData:e=>A(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),i).then(g).then(p).then(h),getPluginUpdates:()=>A(`${n}jetpack/v4/updates/plugins`,i).then(g).then(p),getPlans:()=>A(`${n}jetpack/v4/plans`,i).then(g).then(p),fetchSettings:()=>A(`${n}jetpack/v4/settings`,i).then(g).then(p),updateSetting:e=>d(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(g).then(p),fetchSiteData:()=>A(`${n}jetpack/v4/site`,i).then(g).then(p).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>A(`${n}jetpack/v4/site/features`,i).then(g).then(p).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>A(`${n}jetpack/v4/site/products`,i).then(g).then(p),fetchSitePurchases:()=>A(`${n}jetpack/v4/site/purchases`,i).then(g).then(p).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>A(`${n}jetpack/v4/site/benefits`,i).then(g).then(p).then((e=>JSON.parse(e.data))),fetchSiteDiscount:()=>A(`${n}jetpack/v4/site/discount`,i).then(g).then(p).then((e=>e.data)),fetchSetupQuestionnaire:()=>A(`${n}jetpack/v4/setup/questionnaire`,i).then(g).then(p),fetchRecommendationsData:()=>A(`${n}jetpack/v4/recommendations/data`,i).then(g).then(p),fetchRecommendationsProductSuggestions:()=>A(`${n}jetpack/v4/recommendations/product-suggestions`,i).then(g).then(p),fetchRecommendationsUpsell:()=>A(`${n}jetpack/v4/recommendations/upsell`,i).then(g).then(p),fetchRecommendationsConditional:()=>A(`${n}jetpack/v4/recommendations/conditional`,i).then(g).then(p),saveRecommendationsData:e=>d(`${n}jetpack/v4/recommendations/data`,l,{body:JSON.stringify({data:e})}).then(g),fetchProducts:()=>A(`${n}jetpack/v4/products`,i).then(g).then(p),fetchRewindStatus:()=>A(`${n}jetpack/v4/rewind`,i).then(g).then(p).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>A(`${n}jetpack/v4/scan`,i).then(g).then(p).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>d(`${n}jetpack/v4/notice/${e}`,l,{body:JSON.stringify({dismissed:!0})}).then(g).then(p),fetchPluginsData:()=>A(`${n}jetpack/v4/plugins`,i).then(g).then(p),fetchIntroOffers:()=>A(`${n}jetpack/v4/intro-offers`,i).then(g).then(p),fetchVerifySiteGoogleStatus:e=>A(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,i).then(g).then(p),verifySiteGoogle:e=>d(`${n}jetpack/v4/verify-site/google`,l,{body:JSON.stringify({keyring_id:e})}).then(g).then(p),submitSurvey:e=>d(`${n}jetpack/v4/marketing/survey`,l,{body:JSON.stringify(e)}).then(g).then(p),saveSetupQuestionnaire:e=>d(`${n}jetpack/v4/setup/questionnaire`,l,{body:JSON.stringify(e)}).then(g).then(p),updateLicensingError:e=>d(`${n}jetpack/v4/licensing/error`,l,{body:JSON.stringify(e)}).then(g).then(p),updateLicenseKey:e=>d(`${n}jetpack/v4/licensing/set-license`,l,{body:JSON.stringify({license:e})}).then(g).then(p),getUserLicensesCounts:()=>A(`${n}jetpack/v4/licensing/user/counts`,i).then(g).then(p),getUserLicenses:()=>A(`${n}jetpack/v4/licensing/user/licenses`,i).then(g).then(p),updateLicensingActivationNoticeDismiss:e=>d(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,l,{body:JSON.stringify({last_detached_count:e})}).then(g).then(p),updateRecommendationsStep:e=>d(`${n}jetpack/v4/recommendations/step`,l,{body:JSON.stringify({step:e})}).then(g),confirmIDCSafeMode:()=>d(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,l).then(g),startIDCFresh:e=>d(`${n}jetpack/v4/identity-crisis/start-fresh`,l,{body:JSON.stringify({redirect_uri:e})}).then(g).then(p),migrateIDC:()=>d(`${n}jetpack/v4/identity-crisis/migrate`,l).then(g),attachLicenses:e=>d(`${n}jetpack/v4/licensing/attach-licenses`,l,{body:JSON.stringify({licenses:e})}).then(g).then(p),fetchSearchPlanInfo:()=>A(`${o}jetpack/v4/search/plan`,i).then(g).then(p),fetchSearchSettings:()=>A(`${o}jetpack/v4/search/settings`,i).then(g).then(p),updateSearchSettings:e=>d(`${o}jetpack/v4/search/settings`,l,{body:JSON.stringify(e)}).then(g).then(p),fetchSearchStats:()=>A(`${o}jetpack/v4/search/stats`,i).then(g).then(p),fetchWafSettings:()=>A(`${n}jetpack/v4/waf`,i).then(g).then(p),updateWafSettings:e=>d(`${n}jetpack/v4/waf`,l,{body:JSON.stringify(e)}).then(g).then(p),fetchWordAdsSettings:()=>A(`${n}jetpack/v4/wordads/settings`,i).then(g).then(p),updateWordAdsSettings:e=>d(`${n}jetpack/v4/wordads/settings`,l,{body:JSON.stringify(e)}),fetchSearchPricing:()=>A(`${o}jetpack/v4/search/pricing`,i).then(g).then(p),fetchMigrationStatus:()=>A(`${n}jetpack/v4/migration/status`,i).then(g).then(p),fetchBackupUndoEvent:()=>A(`${n}jetpack/v4/site/backup/undo-event`,i).then(g).then(p),fetchBackupPreflightStatus:()=>A(`${n}jetpack/v4/site/backup/preflight`,i).then(g).then(p)};function A(e,t){return fetch(c(e),t)}function d(e,t,n){return fetch(e,Object.assign({},t,n)).catch(m)}function h(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}Object.assign(this,u)};function g(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new c(e.redirected):new l})):e.json().catch((e=>d(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function p(e){return e.json().catch((t=>d(t,e.redirected,e.url)))}function d(e,t,n){throw t?new i(n):new s}function m(){throw new u}},22636:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(65235),a=n.n(r),o=n(99196),s=n.n(o),i=n(46409);const l=({children:e=null,width:t=null,height:n=null,className:r=""})=>s().createElement("div",{className:a()(i.Z.placeholder,r),style:{width:t,height:n}},e)},49777:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(28918);const a=({value:e="https://jetpack.com",bgColor:t,fgColor:n,level:a,includeMargin:o,imageSettings:s,renderAs:i="canvas",size:l=248})=>React.createElement(r.ZP,{value:e,size:l,bgColor:t,fgColor:n,level:a,includeMargin:o,imageSettings:s,renderAs:i})},45033:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(25162),a=n.n(r),o=n(99196),s=n.n(o);n(48026);const i=({color:e="#FFFFFF",className:t="",size:n=20})=>{const r=t+" jp-components-spinner",a={width:n,height:n,fontSize:n,borderTopColor:e},o={borderTopColor:e,borderRightColor:e};return s().createElement("div",{className:r},s().createElement("div",{className:"jp-components-spinner__outer",style:a},s().createElement("div",{className:"jp-components-spinner__inner",style:o})))};i.propTypes={color:a().string,className:a().string,size:a().number};const l=i},88275:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>g});var r=n(99196),a=n.n(r),o=n(93468);const s={"--font-headline-medium":"48px","--font-headline-small":"36px","--font-title-medium":"24px","--font-title-small":"20px","--font-body":"16px","--font-body-small":"14px","--font-body-extra-small":"12px","--font-title-large":"var(--font-headline-small)","--font-label":"var(--font-body-extra-small)"},i={"--jp-black":"#000000","--jp-black-80":"#2c3338","--jp-white":"#ffffff","--jp-white-off":"#f9f9f6","--jp-gray":"#dcdcde","--jp-gray-0":"#F6F7F7","--jp-gray-5":"var(--jp-gray)","--jp-gray-10":"#C3C4C7","--jp-gray-20":"#A7AAAD","--jp-gray-40":"#787C82","--jp-gray-50":"#646970","--jp-gray-60":"#50575E","--jp-gray-70":"#3C434A","--jp-gray-80":"#2C3338","--jp-gray-90":"#1d2327","--jp-gray-off":"#e2e2df","--jp-red-0":"#F7EBEC","--jp-red-5":"#FACFD2","--jp-red-40":"#E65054","--jp-red-50":"#D63638","--jp-red-60":"#B32D2E","--jp-red-70":"#8A2424","--jp-red-80":"#691C1C","--jp-red":"#d63639","--jp-yellow-5":"#F5E6B3","--jp-yellow-10":"#F2CF75","--jp-yellow-20":"#F0C930","--jp-yellow-30":"#DEB100","--jp-yellow-40":"#C08C00","--jp-yellow-50":"#9D6E00","--jp-yellow-60":"#7D5600","--jp-blue-20":"#68B3E8","--jp-blue-40":"#1689DB","--jp-pink":"#C9356E","--jp-green-0":"#f0f2eb","--jp-green-5":"#d0e6b8","--jp-green-10":"#9dd977","--jp-green-20":"#64ca43","--jp-green-30":"#2fb41f","--jp-green-40":"#069e08","--jp-green-50":"#008710","--jp-green-60":"#007117","--jp-green-70":"#005b18","--jp-green-80":"#004515","--jp-green-90":"#003010","--jp-green-100":"#001c09","--jp-green":"#069e08","--jp-green-primary":"var( --jp-green-40 )","--jp-green-secondary":"var( --jp-green-30 )"},l={"--jp-border-radius":"4px","--jp-menu-border-height":"1px","--jp-underline-thickness":"2px"},c={"--spacing-base":"8px"},u={},A=(e,t,n)=>{const r={...s,...i,...l,...c};for(const t in r)e.style.setProperty(t,r[t]);n&&e.classList.add(o.Z.global),t&&(u[t]={provided:!0,root:e})},g=({children:e=null,targetDom:t,id:n,withGlobalStyles:o=!0})=>{const s=(0,r.useRef)(),i=u?.[n]?.provided;return(0,r.useLayoutEffect)((()=>{if(!i)return t?A(t,n,o):void(s?.current&&A(s.current,n,o))}),[t,s,i,n,o]),t?a().createElement(a().Fragment,null,e):a().createElement("div",{ref:s},e)}},6895:(e,t,n)=>{"use strict";function r(e,t={}){const n={};let r;if("undefined"!=typeof window&&(r=window?.JP_CONNECTION_INITIAL_STATE?.calypsoEnv),0===e.search("https://")){const t=new URL(e);e=`https://${t.host}${t.pathname}`,n.url=encodeURIComponent(e)}else n.source=encodeURIComponent(e);for(const e in t)n[e]=encodeURIComponent(t[e]);!Object.keys(n).includes("site")&&"undefined"!=typeof jetpack_redirects&&jetpack_redirects.hasOwnProperty("currentSiteRawUrl")&&(n.site=jetpack_redirects.currentBlogID??jetpack_redirects.currentSiteRawUrl),r&&(n.calypso_env=r);return"https://jetpack.com/redirect/?"+Object.keys(n).map((e=>e+"="+n[e])).join("&")}n.d(t,{Z:()=>r})},61132:(e,t,n)=>{let r={};try{r=n(92787)}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),r={missingConfig:!0}}const a=e=>r.hasOwnProperty(e);e.exports={jetpackConfigHas:a,jetpackConfigGet:e=>{if(!a(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return r[e]}}},31294:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(64743),a=n(9818),o=n(99196),s=n(80428);const i=window?.JP_CONNECTION_INITIAL_STATE?window.JP_CONNECTION_INITIAL_STATE:{},l=({registrationNonce:e=i.registrationNonce,apiRoot:t=i.apiRoot,apiNonce:n=i.apiNonce,redirectUri:l,autoTrigger:c,from:u,skipUserConnection:A}={})=>{const{registerSite:g,connectUser:p,refreshConnectedPlugins:d}=(0,a.useDispatch)(s.t),m=(0,a.useSelect)((e=>e(s.t).getRegistrationError())),{siteIsRegistering:h,userIsConnecting:E,userConnectionData:f,connectedPlugins:C,connectionErrors:B,isRegistered:b,isUserConnected:k,hasConnectedOwner:v,isOfflineMode:I}=(0,a.useSelect)((e=>({siteIsRegistering:e(s.t).getSiteIsRegistering(),userIsConnecting:e(s.t).getUserIsConnecting(),userConnectionData:e(s.t).getUserConnectionData(),connectedPlugins:e(s.t).getConnectedPlugins(),connectionErrors:e(s.t).getConnectionErrors(),isOfflineMode:e(s.t).getIsOfflineMode(),...e(s.t).getConnectionStatus()}))),y=()=>A?l?(window.location=l,Promise.resolve(l)):Promise.resolve():p({from:u,redirectUri:l}),w=t=>(t&&t.preventDefault(),b?y():g({registrationNonce:e,redirectUri:l,from:u}).then((()=>y())));return(0,o.useEffect)((()=>{r.ZP.setApiRoot(t),r.ZP.setApiNonce(n)}),[t,n]),(0,o.useEffect)((()=>{!c||h||E||w()}),[]),{handleRegisterSite:w,handleConnectUser:y,refreshConnectedPlugins:d,isRegistered:b,isUserConnected:k,siteIsRegistering:h,userIsConnecting:E,registrationError:m,userConnectionData:f,hasConnectedOwner:v,connectedPlugins:C,connectionErrors:B,isOfflineMode:I}}},27523:(e,t,n)=>{"use strict";n.d(t,{LI:()=>o,N4:()=>i,Qo:()=>A,T1:()=>c,TS:()=>u,ZP:()=>k,b5:()=>p,i6:()=>a,qJ:()=>d,qV:()=>l,r7:()=>s,wQ:()=>g});var r=n(64743);const a="SET_CONNECTION_STATUS",o="SET_CONNECTION_STATUS_IS_FETCHING",s="SET_SITE_IS_REGISTERING",i="SET_USER_IS_CONNECTING",l="SET_REGISTRATION_ERROR",c="CLEAR_REGISTRATION_ERROR",u="SET_AUTHORIZATION_URL",A="DISCONNECT_USER_SUCCESS",g="SET_CONNECTED_PLUGINS",p="SET_CONNECTION_ERRORS",d="SET_IS_OFFLINE_MODE",m=e=>({type:a,connectionStatus:e}),h=e=>({type:s,isRegistering:e}),E=e=>({type:i,isConnecting:e}),f=e=>({type:l,registrationError:e}),C=()=>({type:c}),B=e=>({type:u,authorizationUrl:e}),b=e=>({type:g,connectedPlugins:e});const k={setConnectionStatus:m,setConnectionStatusIsFetching:e=>({type:o,isFetching:e}),fetchConnectionStatus:()=>({type:"FETCH_CONNECTION_STATUS"}),fetchAuthorizationUrl:e=>({type:"FETCH_AUTHORIZATION_URL",redirectUri:e}),setSiteIsRegistering:h,setUserIsConnecting:E,setRegistrationError:f,clearRegistrationError:C,setAuthorizationUrl:B,registerSite:function*({registrationNonce:e,redirectUri:t,from:n=""}){yield C(),yield h(!0);try{const r=yield{type:"REGISTER_SITE",registrationNonce:e,redirectUri:t,from:n};return yield m({isRegistered:!0}),yield B(r.authorizeUrl),yield h(!1),Promise.resolve(r)}catch(e){return yield f(e),yield h(!1),Promise.reject(e)}},connectUser:function*({from:e,redirectFunc:t,redirectUri:n}={}){yield E(!0),yield{type:"CONNECT_USER",from:e,redirectFunc:t,redirectUri:n}},disconnectUserSuccess:()=>({type:A}),setConnectedPlugins:b,refreshConnectedPlugins:()=>async({dispatch:e})=>await new Promise((t=>r.ZP.fetchConnectedPlugins().then((n=>{e(b(n)),t(n)})))),setConnectionErrors:e=>({type:p,connectionErrors:e}),setIsOfflineMode:e=>({type:d,isOfflineMode:e})}},31432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(64743),a=n(9818),o=n(27057);const s={FETCH_AUTHORIZATION_URL:({redirectUri:e})=>r.ZP.fetchAuthorizationUrl(e),REGISTER_SITE:({registrationNonce:e,redirectUri:t,from:n})=>r.ZP.registerSite(e,t,n),CONNECT_USER:(0,a.createRegistryControl)((({resolveSelect:e})=>({from:t,redirectFunc:n,redirectUri:r}={})=>new Promise(((a,s)=>{e(o.Z).getAuthorizationUrl(r).then((e=>{const r=n||(e=>window.location.assign(e)),o=new URL(e);t&&o.searchParams.set("from",encodeURIComponent(t));const s=o.toString();r(s),a(s)})).catch((e=>{s(e)}))}))))}},41479:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9818),a=n(27523);const o=(0,r.combineReducers)({connectionStatus:(e={},t)=>{switch(t.type){case a.i6:return{...e,...t.connectionStatus};case a.Qo:return{...e,isUserConnected:!1}}return e},connectionStatusIsFetching:(e=!1,t)=>t.type===a.LI?t.isFetching:e,siteIsRegistering:(e=!1,t)=>t.type===a.r7?t.isRegistering:e,userIsConnecting:(e=!1,t)=>t.type===a.N4?t.isConnecting:e,registrationError:(e,t)=>{switch(t.type){case a.T1:return!1;case a.qV:return t.registrationError;default:return e}},authorizationUrl:(e,t)=>t.type===a.TS?t.authorizationUrl:e,userConnectionData:(e,t)=>(t.type,e),connectedPlugins:(e={},t)=>t.type===a.wQ?t.connectedPlugins:e,connectionErrors:(e={},t)=>t.type===a.b5?t.connectionErrors:e,isOfflineMode:(e=!1,t)=>t.type===a.qJ?t.isConnecting:e})},77728:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818),a=n(27523),o=n(27057);const s={...{getAuthorizationUrl:{isFulfilled:(e,...t)=>{const n=Boolean(e.authorizationUrl),a=(0,r.select)(o.Z).hasFinishedResolution("getAuthorizationUrl",t);return n&&!a&&(0,r.dispatch)(o.Z).finishResolution("getAuthorizationUrl",t),n},*fulfill(e){const t=yield a.ZP.fetchAuthorizationUrl(e);yield a.ZP.setAuthorizationUrl(t.authorizeUrl)}}}}},82725:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r={...{getConnectionStatus:e=>e.connectionStatus||{},getConnectionStatusIsFetching:()=>!1,getSiteIsRegistering:e=>e.siteIsRegistering||!1,getUserIsConnecting:e=>e.userIsConnecting||!1,getRegistrationError:e=>e.registrationError||!1,getAuthorizationUrl:e=>e.authorizationUrl||!1,getUserConnectionData:e=>e.userConnectionData||!1,getConnectedPlugins:e=>e.connectedPlugins||[],getConnectionErrors:e=>e.connectionErrors||[],getIsOfflineMode:e=>e.isOfflineMode||!1,getWpcomUser:e=>e?.userConnectionData?.currentUser?.wpcomUser,getBlogId:e=>e?.userConnectionData?.currentUser?.blogId}}},13535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9818);class a{static store=null;static mayBeInit(e,t){null===a.store&&(a.store=(0,r.createReduxStore)(e,t),(0,r.register)(a.store))}}const o=a},27057:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r="jetpack-connection"},80428:(e,t,n)=>{"use strict";n.d(t,{t:()=>c.Z});var r=n(27523),a=n(31432),o=n(41479),s=n(77728),i=n(82725),l=n(13535),c=n(27057);const u=window.JP_CONNECTION_INITIAL_STATE;u||console.error("Jetpack Connection package: Initial state is missing. Check documentation to see how to use the Connection composer package to set up the initial state."),l.Z.mayBeInit(c.Z,{__experimentalUseThunks:!0,reducer:o.Z,actions:r.ZP,selectors:i.Z,resolvers:s.Z,controls:a.Z,initialState:u||{}})},13419:(e,t,n)=>{"use strict";n.d(t,{Dp:()=>c.Z,FK:()=>l.FK,HD:()=>l.HD,M6:()=>o.M6,OZ:()=>s.Z,Pb:()=>r.Z,Qq:()=>l.Qq,Rl:()=>l.Rl,T:()=>i.Z,Ug:()=>o.Ug,Wp:()=>o.Wp,X1:()=>l.X1,_D:()=>l._D,dM:()=>g.d,el:()=>A.Z,lQ:()=>a.Z,lt:()=>g.l,m3:()=>l.m3,z$:()=>u.Z});var r=n(50148),a=n(35004),o=n(99505),s=n(48052),i=(n(76714),n(80354)),l=n(75404),c=n(68586),u=n(61053),A=n(11380),g=(n(6342),n(96959));n(39058)},6342:(e,t,n)=>{"use strict";n(99196)},96959:(e,t,n)=>{"use strict";n.d(t,{d:()=>o,l:()=>s});var r=n(69307),a=n(12953);function o(e){const t={};let n="span",a=e.icon;const o=document.createElement("div");o.innerHTML=e.icon;const s=o.querySelector("svg");return s&&(n="svg",a=s.innerHTML,Array.from(s.attributes).forEach((({nodeName:e,nodeValue:n})=>t[e]=n))),(0,r.createElement)(n,{...t,dangerouslySetInnerHTML:{__html:a||""}})}function s(e){return{src:o(e),foreground:(0,a.Z)()}}},12953:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(99505);const a="#069e08";function o(){return(0,r.Ug)()||(0,r.Wp)()?null:a}},50148:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});const r="Jetpack_Editor_Initial_State";function a(){return"object"==typeof window?window?.[r]??null:null}},48052:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(50148);function a(e){const t=(0,r.Z)(),n=t?.available_blocks?.[e]?.available??!1,a=t?.available_blocks?.[e]?.unavailable_reason??"unknown";return{available:n,...!n&&{details:t?.available_blocks?.[e]?.details??[],unavailableReason:a}}}},35004:(e,t,n)=>{"use strict";function r(){return window&&window.Jetpack_Editor_Initial_State&&window.Jetpack_Editor_Initial_State.siteFragment?window.Jetpack_Editor_Initial_State.siteFragment:null}n.d(t,{Z:()=>r})},61053:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(6975),a=n(31294),o=n(69307);const{tracks:s}=r.Z,{recordEvent:i}=s,l=({pageViewEventName:e=null,pageViewNamespace:t="jetpack",pageViewSuffix:n="page_view",pageViewEventProperties:l={}}={})=>{const[c,u]=(0,o.useState)(!1),{isUserConnected:A,isRegistered:g,userConnectionData:p={}}=(0,a.Z)(),{wpcomUser:{login:d,ID:m}={},blogId:h}=p.currentUser||{},E=(0,o.useCallback)((async(e,t={})=>{A&&m&&d&&i(e,t)}),[A,m,d]);return(0,o.useEffect)((()=>{A&&m&&d&&h&&r.Z.initialize(m,d,{blog_id:h})}),[h,m,d,A]),(0,o.useEffect)((()=>{const r=e?`${t}_${e}_${n}`:null;g&&r&&(c||(E(r,l),u(!0)))}),[c,t,e,n,g,l,E]),{recordEvent:E,tracks:s}}},11380:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818),a=n(69307),o=n(39058);const s=e=>{const{isModuleActive:t,isChangingStatus:n,isLoadingModules:s}=(0,r.useSelect)((t=>{const n=t(o.p);return{isModuleActive:n.isModuleActive(e),isChangingStatus:n.isModuleUpdating(e),isLoadingModules:n.areModulesLoading(e)}}),[o.p]),{updateJetpackModuleStatus:i}=(0,r.useDispatch)(o.p),l=(0,a.useCallback)((t=>i({name:e,active:t})),[e,i]);return(0,a.useMemo)((()=>({isLoadingModules:s,isChangingStatus:n,isModuleActive:t,changeStatus:l})),[s,n,t,l])}},68586:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(50148);function a(){return(0,r.Z)()?.jetpack?.is_current_user_connected??!1}},44166:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>g,rW:()=>A});var r=n(9818),a=n(99505),o=n(82162),s=n(39058);const i="SET_JETPACK_MODULES",l="SET_MODULE_UPDATING";function c(e){return A({isLoading:e})}function u(e,t){return{type:l,name:e,isUpdating:t}}function A(e){return{type:i,options:e}}const g={updateJetpackModuleStatus:function*(e){try{yield u(e.name,!0),yield(0,o.zL)(e);const t=yield(0,o.Bs)();return yield A({data:t}),!0}catch(e){const t=(0,r.select)(s.p).getJetpackModules();return yield A(t),!1}finally{yield u(e.name,!1)}},setJetpackModules:A,fetchModules:function*(){if((0,a.Wp)())return!0;try{yield c(!0);const e=yield(0,o.Bs)();return yield A({data:e}),!0}catch(e){const t=(0,r.select)(s.p).getJetpackModules();return yield A(t),!1}finally{yield c(!1)}}}},82162:(e,t,n)=>{"use strict";n.d(t,{Bs:()=>i,ZP:()=>c,zL:()=>l});var r=n(86989),a=n.n(r);const o="FETCH_JETPACK_MODULES",s="UPDATE_JETPACK_MODULE_STATUS",i=()=>({type:o}),l=e=>({type:s,settings:e}),c={[o]:function(){return a()({path:"/jetpack/v4/module/all",method:"GET"})},[s]:function({settings:e}){return a()({path:`/jetpack/v4/module/${e.name}/active`,method:"POST",data:{active:e.active}})}}},39058:(e,t,n)=>{"use strict";n.d(t,{p:()=>c});var r=n(9818),a=n(44166),o=n(82162),s=n(42469),i=n(55133),l=n(43524);const c="jetpack-modules",u=(0,r.createReduxStore)(c,{reducer:s.Z,actions:a.ZP,controls:o.ZP,resolvers:i.Z,selectors:l.Z});(0,r.register)(u);const A=window?.Initial_State?.getModules||window?.Jetpack_Editor_Initial_State?.modules||null;null!==A&&(0,r.dispatch)(c).setJetpackModules({data:{...A}})},42469:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});const r={isLoading:!1,isUpdating:{},data:{}},a=(e=r,t)=>{switch(t.type){case"SET_JETPACK_MODULES":return{...e,...t.options};case"SET_MODULE_UPDATING":return{...e,isUpdating:{...e.isUpdating,[t.name]:t.isUpdating}}}return e}},55133:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(44166),a=n(82162);const o={getJetpackModules:function*(){try{const e=yield(0,a.Bs)();if(e)return(0,r.rW)({data:e})}catch(e){console.error(e)}}}},43524:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(99505);const a={getJetpackModules:e=>e.data,isModuleActive:(e,t)=>(0,r.Wp)()||(e?.data?.[t]?.activated??!1),areModulesLoading:e=>e.isLoading??!1,isModuleUpdating:(e,t)=>e?.isUpdating?.[t]??!1}},75404:(e,t,n)=>{"use strict";n.d(t,{FK:()=>m,HD:()=>h,Qq:()=>u,Rl:()=>p,X1:()=>A,_D:()=>g,m3:()=>E});var r=n(65736),a=n(96483),o=n(92819),s=n(50148),i=n(48052),l=n(35004),c=n(99505);const __=r.__;function u({planSlug:e,plan:t,postId:n,postType:r}){const s=(0,o.startsWith)(e,"jetpack_")?e:(0,o.get)(t,["path_slug"]),i=(void 0===r?()=>{const e=new URLSearchParams(window.location.search);return(0,a.addQueryArgs)(window.location.protocol+`//${(0,l.Z)().replace("::","/")}/wp-admin/site-editor.php`,{postId:e.get("postId"),postType:e.get("postType"),plan_upgraded:1})}:()=>{const e=["page","post"].includes(r)?"":"edit";return(0,c.Wp)()?(0,a.addQueryArgs)("/"+(0,o.compact)([e,r,(0,l.Z)(),n]).join("/"),{plan_upgraded:1}):(0,a.addQueryArgs)(window.location.protocol+`//${(0,l.Z)().replace("::","/")}/wp-admin/post.php`,{action:"edit",post:n,plan_upgraded:1})})();return(0,c.Ug)()?(0,a.addQueryArgs)(`https://wordpress.com/plans/${(0,l.Z)()}`,{redirect_to:i,customerType:"business"}):s&&(0,a.addQueryArgs)(`https://wordpress.com/checkout/${(0,l.Z)()}/${s}`,{redirect_to:i})}function A(e){if(!e)return!1;const t=/^jetpack\//.test(e)?e.substr(8,e.length):e,{available:n,unavailableReason:r}=(0,i.Z)(t);return!n&&"missing_plan"===r}function g(e,t){return"missing_plan"===e&&t.required_plan}function p(e){if(!e)return!1;const t=/^jetpack\//.test(e)?e.substr(8,e.length):e,{details:n,unavailableReason:r}=(0,i.Z)(t);return g(r,n)}const d=[{name:"core/cover",mediaPlaceholder:!0,mediaReplaceFlow:!0,fileType:"video",description:__("Upgrade your plan to use video covers","jetpack")},{name:"core/audio",mediaPlaceholder:!0,mediaReplaceFlow:!0,fileType:"audio",description:__("Upgrade your plan to upload audio","jetpack")}];function m(){return(0,o.get)((0,s.Z)(),"jetpack.enable_upgrade_nudge",!1)}const h=e=>(0,o.map)(d,"name").includes(e),E=e=>(0,o.head)((0,o.filter)(d,(({name:t})=>t===e)))},76714:(e,t,n)=>{"use strict";n(98817)},99505:(e,t,n)=>{"use strict";n.d(t,{M6:()=>i,Ug:()=>s,Wp:()=>o});var r=n(50148);function a(){return"object"==typeof window&&"string"==typeof window._currentSiteType?window._currentSiteType:null}function o(){return"simple"===a()}function s(){return"atomic"===a()}function i(){const e=(0,r.Z)();return e?.jetpack?.is_private_site??!1}},80354:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(82674),a=n.n(r),o=n(94333);const s=e=>(0,o.createHigherOrderComponent)((t=>n=>React.createElement(t,a()({},n,{className:n.name===e?"has-warning is-interactive":n.className}))),"withHasWarningIsInteractiveClassNames")},47798:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>b});var r=n(51806),a=n(42290),o=n(55609),s=n(65736),i=n(586),l=n(3639),c=n(92710),u=n(58532),A=n(59756),g=(n(99196),n(54765)),p=n(63634),d=n(72881),m=n(81612),h=n(27298);const __=s.__,E="simplify",f="make-longer",C="make-shorter",B={default:[{name:__("Correct spelling and grammar","jetpack"),key:"correct-spelling",aiSuggestion:p.Hd,icon:i.Z}],"core/paragraph":[{name:__("Simplify","jetpack"),key:E,aiSuggestion:p.hI,icon:l.Z},{name:__("Summarize","jetpack"),key:"summarize",aiSuggestion:p.Lq,icon:c.Z},{name:__("Expand","jetpack"),key:f,aiSuggestion:p.TV,icon:u.Z},{name:__("Make shorter","jetpack"),key:C,aiSuggestion:p.DR,icon:u.Z}],"core/list-item":[{name:__("Simplify","jetpack"),key:E,aiSuggestion:p.hI,icon:l.Z},{name:__("Expand","jetpack"),key:f,aiSuggestion:p.TV,icon:u.Z},{name:__("Make shorter","jetpack"),key:C,aiSuggestion:p.DR,icon:u.Z}],"core/list":g.jz.includes("core/list")?[{name:__("Simplify","jetpack"),key:E,aiSuggestion:p.hI,icon:l.Z},{name:__("Expand","jetpack"),key:f,aiSuggestion:p.TV,icon:u.Z},{name:__("Make shorter","jetpack"),key:C,aiSuggestion:p.DR,icon:u.Z}]:[{name:__("Turn list into a table","jetpack"),key:"turn-into-table",aiSuggestion:p.Gh,icon:A.Z,options:{userPrompt:"make a table from this list, do not enclose the response in a code block"}},{name:__("Write a post from this list","jetpack"),key:"write-post-from-list",aiSuggestion:p.Gh,icon:l.Z,options:{userPrompt:"Write a post based on the list items. Include a title as first order heading and try to use secondary headings for each entry"}}]};function b({blockType:e,disabled:t=!1,onAskAiAssistant:n,onRequestSuggestion:s}){const i=B[e]??[];return(0,r.createElement)(r.Fragment,null,t&&(0,r.createElement)(o.Notice,{status:"warning",isDismissible:!1,className:"jetpack-ai-assistant__info"},__("Add content to activate the tools below","jetpack")),(0,r.createElement)(o.MenuGroup,null,(0,r.createElement)(o.MenuItem,{icon:a.u_,iconPosition:"left",key:"key-ai-assistant",onClick:n,disabled:t},(0,r.createElement)("div",{className:"jetpack-ai-assistant__menu-item"},__("Ask AI Assistant","jetpack"))),[...B.default,...i].map((e=>(0,r.createElement)(o.MenuItem,{icon:e?.icon,iconPosition:"left",key:`key-${e.key}`,onClick:()=>{s(e.aiSuggestion,{...e.options??{}},e.name)},disabled:t},(0,r.createElement)("div",{className:"jetpack-ai-assistant__menu-item"},e.name)))),(0,r.createElement)(h.IP,{onChange:e=>{s(p.Lg,{tone:e},`${h.iQ}: ${(0,d.k)(e)}`)},disabled:t}),(0,r.createElement)(m.xK,{onChange:(e,t)=>{s(p.Nw,{language:e},`${m.aO}: ${t}`)},disabled:t})))}},54458:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(51806),a=n(42290),o=n(13419),s=n(55609),i=n(9818),l=n(69307),c=n(65736),u=n(51128),A=n.n(u),g=(n(99196),n(49259)),p=n(854),d=n(6747),m=n(47798);const __=c.__,h=A()("jetpack-ai-assistant:dropdown");function E({onClose:e,blockType:t}){const[n,a]=(0,l.useState)(!1),{getSelectedBlockClientIds:s,getBlocksByClientId:c}=(0,i.useSelect)("core/block-editor"),{removeBlocks:u,replaceBlock:A}=(0,i.useDispatch)("core/block-editor");(0,l.useEffect)((()=>{const e=s(),t=c(e),n=(0,p.vL)(t),r=(0,p.t$)(n);return a(!r.length)}),[c,s]);const{tracks:E}=(0,o.z$)();return(0,r.createElement)(m.ZP,{blockType:t,onRequestSuggestion:(n,r={})=>{const a=s(),o=c(a),i=(0,p.vL)(o);e(),h("requestSuggestion",n,r),E.recordEvent("jetpack_editor_ai_assistant_extension_toolbar_button_click",{suggestion:n,block_type:t});const[l]=o,[m,...f]=a,C={...l?.attributes||{},content:i},B=(0,d.b)(t,C),b={clientId:m,type:n,options:{...r,contentType:"generated",fromExtension:!0}};localStorage.setItem((0,g.$M)(B.clientId),JSON.stringify(b)),A(m,B),u(f)},onAskAiAssistant:()=>{const e=s(),n=c(e),r=(0,p.vL)(n),[a,...o]=e,[i]=n,l={...i?.attributes||{},content:r};A(a,(0,d.b)(t,l)),u(o),E.recordEvent("jetpack_ai_assistant_prompt_show",{block_type:t})},disabled:n})}function f({blockType:e,label:t=__("AI Assistant","jetpack")}){const{tracks:n}=(0,o.z$)();return(0,r.createElement)(s.Dropdown,{popoverProps:{variant:"toolbar"},renderToggle:({isOpen:e,onToggle:n})=>(0,r.createElement)(s.ToolbarButton,{className:"jetpack-ai-assistant__button",showTooltip:!0,onClick:n,"aria-haspopup":"true","aria-expanded":e,label:t,icon:a.u_}),onToggle:t=>{t&&n.recordEvent("jetpack_ai_assistant_extension_toolbar_menu_show",{block_type:e})},renderContent:({onClose:t})=>(0,r.createElement)(E,{onClose:t,blockType:e})})}},3180:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(65736),o=n(26546),s=n(46867);const __=a.__,i=()=>{const e=`${window?.Jetpack_Editor_Initial_State?.adminUrl}admin.php?page=my-jetpack#/connection`,{autosaveAndRedirect:t,isRedirecting:n}=(0,s.Z)(e);return(0,r.createElement)(o.p,{buttonText:__("Reconnect Jetpack","jetpack"),checkoutUrl:e,className:"jetpack-ai-connect-banner",description:__("Your account is not connected to Jetpack at the moment.","jetpack"),goToCheckoutPage:e=>{t(e)},isRedirecting:n,visible:!0,align:null,title:null,context:null})}},87445:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(6895),o=n(55609),s=n(65736);const __=s.__;const i=function(){const e=(0,a.Z)("jetpack-ai-feedback");return(0,r.createElement)("div",{className:"jetpack-ai-feedback-control"},(0,r.createElement)(o.BaseControl,{label:__("Feedback","jetpack")},(0,r.createElement)("p",null,__("Your feedback is valuable in our commitment to refine and improve this feature.","jetpack")),(0,r.createElement)(o.ExternalLink,{href:e},__("Share your feedback","jetpack"))))}},81612:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>h,aO:()=>g,xK:()=>E});var r=n(51806),a=n(13419),o=n(55609),s=n(65736),i=n(61074),l=n(46936),c=n(43618);n(99196);const __=s.__,u=["en","es","fr","de","it","pt","ru","zh","ja","ar","hi","ko"],A=window?.Jetpack_Editor_Initial_State?.siteLocale||navigator?.language,g=__("Translate","jetpack"),p=A?.split("-")[0]||"en",d=(A?.split("-"),{en:{label:__("English","jetpack")},es:{label:__("Spanish","jetpack")},fr:{label:__("French","jetpack")},de:{label:__("German","jetpack")},it:{label:__("Italian","jetpack")},pt:{label:__("Portuguese","jetpack")},ru:{label:__("Russian","jetpack")},zh:{label:__("Chinese","jetpack")},ja:{label:__("Japanese","jetpack")},ar:{label:__("Arabic","jetpack")},hi:{label:__("Hindi","jetpack")},ko:{label:__("Korean","jetpack")}}),m=({value:e,onChange:t})=>{const n=[...u.filter((e=>e!==p))];return u.includes(p)&&n.unshift(p),(0,r.createElement)(o.MenuGroup,{label:__("Select language","jetpack")},n.map((n=>(0,r.createElement)(o.MenuItem,{key:`key-${n}`,onClick:()=>t(n+" ("+d[n].label+")",d[n].label),isSelected:e===n},d[n].label))))};function h({value:e=p,label:t=g,onChange:n,disabled:s=!1}){const{tracks:l}=(0,a.z$)();return s?(0,r.createElement)(o.Tooltip,{text:t},(0,r.createElement)(o.Button,{disabled:!0},(0,r.createElement)(i.Z,{icon:c.Z}))):(0,r.createElement)(o.ToolbarDropdownMenu,{icon:c.Z,label:t,popoverProps:{variant:"toolbar"},onToggle:e=>{e&&l.recordEvent("jetpack_ai_assistant_block_toolbar_menu_show",{tool:"i18n"})}},(()=>(0,r.createElement)(m,{value:e,onChange:n})))}function E({value:e=p,label:t=g,onChange:n,disabled:a=!1}){return(0,r.createElement)(o.DropdownMenu,{className:"ai-assistant__i18n-dropdown",icon:c.Z,label:t,toggleProps:{children:(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"ai-assistant__i18n-dropdown__toggle-label"},t),(0,r.createElement)(i.Z,{icon:l.Z})),disabled:a}},(({onClose:t})=>(0,r.createElement)(m,{onChange:(...e)=>{n(...e),t()},value:e})))}},24404:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>m});var r=n(51806),a=n(13419),o=n(55609),s=n(65736),i=n(77840);const __=s.__,l="make-longer",c="makeLonger",u="make-shorter",A="makeShorter",g="summarize",p="summarize",d=[{name:__("Summarize","jetpack"),key:g,aiSuggestion:p},{name:__("Make longer","jetpack"),key:l,aiSuggestion:c},{name:__("Make shorter","jetpack"),key:u,aiSuggestion:A}];function m({key:e,label:t=__("Improve","jetpack"),exclude:n=[],onChange:s,disabled:l=!1}){const{tracks:c}=(0,a.z$)();return l?(0,r.createElement)(o.Tooltip,{text:t},(0,r.createElement)(o.Button,{disabled:!0},(0,r.createElement)(o.Icon,{icon:i.Z}))):(0,r.createElement)(o.ToolbarDropdownMenu,{icon:i.Z,label:t,popoverProps:{variant:"toolbar"},onToggle:e=>{e&&c.recordEvent("jetpack_ai_assistant_block_toolbar_menu_show",{tool:"improve"})}},(()=>{const a=d.filter((e=>!n.includes(e.key)));return(0,r.createElement)(o.MenuGroup,{label:t},a.map((t=>(0,r.createElement)(o.MenuItem,{key:`key-${t.key}`,onClick:()=>s(t.aiSuggestion,{contentType:"generated"}),isSelected:e===t.key},t.name))))}))}},85642:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>m});var r=n(51806),a=n(13419),o=n(55609),s=n(65736),i=n(77840),l=n(58532),c=n(586),u=n(3639),A=n(92710),g=n(32677);const __=s.__,p=[{label:__("Post about…","jetpack"),description:{original:"Write a post about ",translated:__("Write a post about ","jetpack")}},{label:__("Informative article on…","jetpack"),description:{original:"Craft an informative article explaining ",translated:__("Craft an informative article explaining ","jetpack")}},{label:__("Step-by-step tutorial on…","jetpack"),description:{original:"Write a step-by-step tutorial on ",translated:__("Write a step-by-step tutorial on ","jetpack")}},{label:__("Motivational post on…","jetpack"),description:{original:"Create a motivational post on ",translated:__("Create a motivational post on ","jetpack")}}],d=[{label:__("Say it differently…","jetpack"),description:{original:"Rewrite it in a way that ",translated:__("Rewrite it in a way that ","jetpack")}},{label:__("Add…","jetpack"),description:{original:"Add more details about ",translated:__("Add more details about ","jetpack")}},{label:__("Remove…","jetpack"),description:{original:"Remove unnecessary details about ",translated:__("Remove unnecessary details about ","jetpack")}}];function m({hasContentBefore:e,hasContent:t,hasPostTitle:n,contentIsLoaded:s,onPromptSelect:m,onSuggestionSelect:h}){const E=__("Write with AI…","jetpack"),{tracks:f}=(0,a.z$)();return(0,r.createElement)(o.ToolbarDropdownMenu,{className:"jetpack-ai-assistant__templates-control",icon:null,label:E,text:E,onToggle:e=>{e&&f.recordEvent("jetpack_ai_assistant_block_toolbar_menu_show",{tool:"write-with-ai"})}},(({onClose:a})=>s?(0,r.createElement)(o.MenuGroup,{label:__("Write…","jetpack")},d.map(((e,t)=>(0,r.createElement)(o.MenuItem,{icon:i.Z,iconPosition:"left",key:`key-${t}`,onClick:()=>{a(),m(e.description)}},e.label)))):(0,r.createElement)(r.Fragment,null,e&&(0,r.createElement)(o.MenuGroup,{label:__("Based on preceding content…","jetpack")},(0,r.createElement)(o.MenuItem,{icon:l.Z,iconPosition:"left",onClick:()=>h("continue")},__("Continue writing","jetpack")),(0,r.createElement)(o.MenuItem,{icon:c.Z,iconPosition:"left",onClick:()=>h("correctSpelling")},__("Correct spelling and grammar","jetpack")),(0,r.createElement)(o.MenuItem,{icon:u.Z,iconPosition:"left",onClick:()=>h("simplify")},__("Simplify","jetpack"))),t&&(0,r.createElement)(o.MenuGroup,{label:__("Based on entire content…","jetpack")},t&&(0,r.createElement)(o.MenuItem,{icon:A.Z,iconPosition:"left",onClick:()=>h("summarize")},__("Summarize","jetpack")),t&&(0,r.createElement)(o.MenuItem,{icon:g.Z,iconPosition:"left",onClick:()=>h("generateTitle")},__("Generate a post title","jetpack"))),(0,r.createElement)(o.MenuGroup,{label:__("Write…","jetpack")},n&&(0,r.createElement)(o.MenuItem,{icon:i.Z,iconPosition:"left",onClick:()=>h("titleSummary")},__("Summary based on title","jetpack")),p.map(((e,t)=>(0,r.createElement)(o.MenuItem,{icon:i.Z,iconPosition:"left",key:`key-${t}`,onClick:()=>{a(),m(e.description)}},e.label)))))))}},27298:(e,t,n)=>{"use strict";n.d(t,{IP:()=>d,Nj:()=>u,ZP:()=>m,iQ:()=>A});var r=n(51806),a=n(42290),o=n(13419),s=n(55609),i=n(65736),l=n(46936);n(99196);const __=i.__,c=["formal","informal","optimistic","humorous","serious","skeptical","empathetic","confident","passionate","provocative"],u="formal",A=__("Change tone","jetpack"),g={formal:{label:__("Formal","jetpack"),emoji:"🎩"},informal:{label:__("Informal","jetpack"),emoji:"😊"},optimistic:{label:__("Optimistic","jetpack"),emoji:"😃"},humorous:{label:__("Humorous","jetpack"),emoji:"😂"},serious:{label:__("Serious","jetpack"),emoji:"😐"},skeptical:{label:__("Skeptical","jetpack"),emoji:"🤨"},empathetic:{label:__("Empathetic","jetpack"),emoji:"💗"},confident:{label:__("Confident","jetpack"),emoji:"😎"},passionate:{label:__("Passionate","jetpack"),emoji:"❤️"},provocative:{label:__("Provocative","jetpack"),emoji:"🔥"}},p=({value:e,onChange:t})=>(0,r.createElement)(s.MenuGroup,{label:__("Select tone","jetpack")},c.map((n=>(0,r.createElement)(s.MenuItem,{key:`key-${n}`,onClick:()=>t(n),isSelected:e===n},`${g[n].emoji} ${g[n].label}`))));function d({label:e=A,value:t=u,onChange:n,disabled:o=!1}){return(0,r.createElement)(s.DropdownMenu,{icon:a.v_,label:e,className:"ai-assistant__tone-dropdown",popoverProps:{variant:"toolbar"},toggleProps:{children:(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"ai-assistant__tone-dropdown__toggle-label"},e),(0,r.createElement)(s.Icon,{icon:l.Z})),disabled:o}},(({onClose:e})=>(0,r.createElement)(p,{value:t,onChange:t=>{n(t),e()}})))}function m({value:e=u,onChange:t,disabled:n=!1}){const{tracks:i}=(0,o.z$)();return n?(0,r.createElement)(s.Tooltip,{text:A},(0,r.createElement)(s.Button,{disabled:!0},(0,r.createElement)(s.Icon,{icon:a.v_}))):(0,r.createElement)(s.ToolbarDropdownMenu,{icon:a.v_,label:A,popoverProps:{variant:"toolbar"},disabled:n,onToggle:e=>{e&&i.recordEvent("jetpack_ai_assistant_block_toolbar_menu_show",{tool:"tone"})}},(()=>(0,r.createElement)(p,{value:e,onChange:t})))}},4965:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(51806),a=n(52175),o=n(55609),s=n(65736),i=n(79201),l=n(48381),c=n(63634),u=n(81612),A=n(24404),g=n(85642),p=n(27298);const __=s.__,d=({contentIsLoaded:e,getSuggestionFromOpenAI:t,retryRequest:n,handleAcceptContent:s,handleTryAgain:d,showRetry:m,contentBefore:h,hasPostTitle:E,wholeContent:f,setUserPrompt:C,recordEvent:B,isGeneratingTitle:b})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.BlockControls,null,!m&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(o.ToolbarGroup,null,(0,r.createElement)(g.ZP,{hasContentBefore:!!h?.length,hasContent:!!f?.length,hasPostTitle:E,contentIsLoaded:e,onPromptSelect:e=>{B("jetpack_editor_ai_assistant_block_toolbar_button_click",{type:"prompt-template",prompt:e.original}),C(e.translated)},onSuggestionSelect:e=>{B("jetpack_editor_ai_assistant_block_toolbar_button_click",{type:"suggestion",suggestion:e}),t(e)}})),(0,r.createElement)(a.BlockControls,{group:"block"},(0,r.createElement)(p.ZP,{value:"neutral",onChange:n=>{B("jetpack_editor_ai_assistant_block_toolbar_button_click",{type:"suggestion",suggestion:c.Lg}),t(c.Lg,{tone:n,contentType:e?"generated":null})},disabled:!e&&!f?.length}),(0,r.createElement)(u.ZP,{value:"en",onChange:n=>{B("jetpack_editor_ai_assistant_block_toolbar_button_click",{type:"suggestion",suggestion:c.Nw}),t(c.Nw,{language:n,contentType:e?"generated":null})},disabled:!e&&!f?.length}),(0,r.createElement)(A.ZP,{onChange:t,exclude:b?["summarize"]:[],disabled:!e}))),(m||d)&&(0,r.createElement)(o.ToolbarGroup,null,!m&&e&&d&&(0,r.createElement)(o.ToolbarButton,{onClick:d},__("Try Again","jetpack")),m&&e&&(0,r.createElement)(o.ToolbarButton,{icon:i.Z,onClick:s},__("Accept","jetpack")),m&&(0,r.createElement)(o.ToolbarButton,{icon:l.Z,onClick:n},__("Retry","jetpack")))))},5246:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var r=n(51806),a=n(6895),o=n(13419),s=n(69307),i=n(65736),l=n(51128),c=n.n(l),u=n(26546),A=n(63206),g=n(18135),p=n(71449),d=n(78595);const __=i.__,m=c()("jetpack-ai-assistant:upgrade-prompt"),h=e=>{const{upgradeType:t}=(0,g.Z)();return"vip"===t?(({description:e=null,useLightNudge:t=!1})=>{const n=t?d.g:u.p,a=(0,s.createInterpolateElement)(__("You've reached the Jetpack AI rate limit. Please reach out to your VIP account team. ","jetpack"),{strong:(0,r.createElement)("strong",null)});return(0,r.createElement)(n,{buttonText:null,checkoutUrl:null,className:"jetpack-ai-upgrade-banner",description:e||a,goToCheckoutPage:null,isRedirecting:null,visible:!0,align:null,title:null,context:null})})({description:e.description,useLightNudge:e?.useLightNudge}):(({placement:e=null,description:t=null,useLightNudge:n=!1})=>{const l=n?d.g:u.p,{checkoutUrl:c}=(0,A.Z)(),h=(0,p.d)(),{nextTier:E,tierPlansEnabled:f,currentTier:C,requestsCount:B}=(0,g.Z)(),{tracks:b}=(0,o.z$)(),k=(0,s.useCallback)((()=>{m("upgrade",e),b.recordEvent("jetpack_ai_upgrade_button",{current_tier_slug:C?.slug,requests_count:B,placement:e})}),[C,B,b,e]),v=(0,s.useCallback)((()=>{m("contact us",e),b.recordEvent("jetpack_ai_upgrade_contact_us",{placement:e})}),[b,e]);if(!h){const e=(0,s.createInterpolateElement)(__("Congratulations on exploring Jetpack AI and reaching the free requests limit! Reach out to the site administrator to upgrade and keep using Jetpack AI. ","jetpack"),{strong:(0,r.createElement)("strong",null)});return(0,r.createElement)(l,{showButton:!1,className:"jetpack-ai-upgrade-banner",description:t||e,visible:!0,align:null,title:null,context:null})}if(f){if(!E){const e=(0,a.Z)("jetpack-ai-tiers-more-requests-contact"),n=__("You have reached the request limit for your current plan.","jetpack");return(0,r.createElement)(l,{buttonText:__("Contact Us","jetpack"),description:t||n,className:"jetpack-ai-upgrade-banner",checkoutUrl:e,visible:!0,align:null,title:null,context:null,goToCheckoutPage:v,target:"_blank"})}const e=(0,s.createInterpolateElement)((0,i.sprintf)(/* Translators: number of requests */
__("You have reached the requests limit for your current plan. Upgrade now to increase your requests limit to %d. ","jetpack"),E.limit),{strong:(0,r.createElement)("strong",null)});return(0,r.createElement)(l,{buttonText:(0,i.sprintf)(/* Translators: number of requests */
__("Upgrade to %d requests","jetpack"),E.limit),checkoutUrl:c,className:"jetpack-ai-upgrade-banner",description:t||e,goToCheckoutPage:k,visible:!0,align:"center",title:null,context:null,target:"_blank"})}return(0,r.createElement)(l,{buttonText:"Upgrade",checkoutUrl:c,className:"jetpack-ai-upgrade-banner",description:(0,s.createInterpolateElement)(__("Congratulations on exploring Jetpack AI and reaching the free requests limit! Upgrade now to keep using it. ","jetpack"),{strong:(0,r.createElement)("strong",null)}),goToCheckoutPage:k,visible:!0,align:null,title:null,context:null,target:"_blank"})})(e)}},78595:(e,t,n)=>{"use strict";n.d(t,{g:()=>s});var r=n(51806),a=n(55609),o=n(65736);const __=o.__,s=({title:e,description:t,buttonText:n=null,checkoutUrl:o=null,goToCheckoutPage:s=null,isRedirecting:i=!1,showButton:l=!0,target:c="_top"})=>{const u=__("Redirecting…","jetpack");return(0,r.createElement)("div",{className:"jetpack-upgrade-plan-banner-light"},(0,r.createElement)(a.Notice,{status:"warning",isDismissible:!1},(0,r.createElement)("p",null,e&&(0,r.createElement)("strong",null,e),t," ",l&&(0,r.createElement)(a.Button,{href:i?null:o,onClick:s,variant:"link",target:c},i?u:n))))}},45624:(e,t,n)=>{"use strict";n.d(t,{Z:()=>_});var r=n(51806),a=n(42290),o=n(13419),s=n(52175),i=n(4981),l=n(55609),c=n(94333),u=n(9818),A=n(69307),g=n(65736),p=n(65235),d=n.n(p),m=n(84102),h=n(80013),E=n(23795),f=n(3180),C=n(87445),B=n(4965),b=n(5246),k=n(49259),v=n(46448),I=n(63206),y=n(18135),w=n(71449);const __=g.__,Q="post"===window?.Jetpack_Editor_Initial_State?.screenBase;function _({attributes:e,setAttributes:t,clientId:n,isSelected:g}){const[p,_]=(0,A.useState)(null),{tracks:S}=(0,o.z$)(),{getBlock:j}=(0,u.useSelect)("core/block-editor"),x=(0,A.useRef)(null),L=(0,A.useRef)(null),{replaceBlocks:P,removeBlock:T}=(0,u.useDispatch)("core/block-editor"),{editPost:D}=(0,u.useDispatch)("core/editor"),{isOverLimit:N,requireUpgrade:R,increaseRequestsCount:Z,requestsCount:M,requestsLimit:F,currentTier:U,loading:O}=(0,y.Z)(),z=Math.max(F-M,0),{autosaveAndRedirect:H}=(0,I.Z)(),q=(0,E.U_)(U),$=()=>{setTimeout((()=>{x.current?.focus?.()}),100)},V=()=>{setTimeout((()=>{L.current?.focus?.()}),100)},G=(0,c.useViewportMatch)("medium","<"),W=(0,A.useRef)(null),{getSuggestionFromOpenAI:Y,stopSuggestion:K,showRetry:J,contentBefore:X,postTitle:ee,retryRequest:te,wholeContent:ne,requestingState:re,error:ae}=(0,v.Z)({onSuggestionDone:(0,A.useCallback)((()=>{$(),Z()}),[Z]),onUnclearPrompt:(0,A.useCallback)((()=>{V(),Z()}),[Z]),onModeration:$,attributes:e,clientId:n,content:e.content,tracks:S,userPrompt:e.userPrompt,requireUpgrade:R,initialRequestingState:e.requestingState,contentRef:W,blockRef:L}),oe="requesting"===re,se=["requesting","suggesting"].includes(re),ie=(0,w.b)(),le=(0,k.$M)(n);(0,A.useEffect)((()=>{if(!le)return;const e=JSON.parse(localStorage.getItem(le));if(!e)return;const{type:t,options:n}=e;localStorage.removeItem(le),Y(t,n)}),[le,Y]),(0,A.useEffect)((()=>{ae&&_(!1)}),[ae]),(0,A.useEffect)((()=>{["init","done"].includes(re)&&t({requestingState:re})}),[re,t]);const ce=!!e.content,ue="generateTitle"===e.promptType,Ae=__("Accept","jetpack"),ge=__("Accept title","jetpack"),pe=ue?ge:Ae,de=async()=>{let t=[],r=(0,a.LB)({content:e.content||""});if(r?.split("\n").length>1&&r?.split("\n")?.[0]?.match(/^.*<\/h1>$/)&&!ee){const e=r.split("\n"),t=e.shift();r=e.join("\n"),D({title:t.replace(/<[^>]*>/g,"")})}t=(0,i.rawHandler)({HTML:r}),await P(n,t);const o=(e=>{let t=null;return e.forEach((e=>{const n=document.querySelector(`.wp-block[data-block="${e.clientId}"]`);if(!n)return;"true"===n.contentEditable&&(t=n);const r=n.querySelectorAll("[contenteditable=true]");t=r.length?r[r.length-1]:t})),t})(t);o&&(e=>{const t=window.getSelection();t.selectAllChildren(e),t.collapseToEnd(),e.focus()})(o)},me=()=>{de(),S.recordEvent("jetpack_ai_assistant_block_accept",{feature:"ai-assistant"})},he=()=>{Q?(D({title:e.content?e.content.trim():""}),T(n),S.recordEvent("jetpack_ai_assistant_block_accept",{feature:"ai-assistant"})):me()},Ee=()=>{K(),$(),S.recordEvent("jetpack_ai_assistant_block_stop",{feature:"ai-assistant"})},fe=(0,s.useBlockProps)({ref:L,className:d()({"is-waiting-response":oe})}),Ce=__("Ask Jetpack AI…","jetpack"),Be=__("Write about… Make a table for…","jetpack"),be=(0,r.createElement)(r.Fragment,null,N&&g&&(0,r.createElement)(b.Z,{placement:"ai-assistant-block"}),!ie&&(0,r.createElement)(f.Z,null)),ke=(0,r.createElement)(r.Fragment,null,ae?.message&&!p&&"error_quota_exceeded"!==ae?.code&&(0,r.createElement)(l.Notice,{status:ae.status,isDismissible:!1,className:"jetpack-ai-assistant__error"},ae.message)),ve=(0,A.useCallback)((e=>{e.preventDefault(),S.recordEvent("jetpack_ai_upgrade_button",{current_tier_slug:U?.slug,requests_count:M,placement:"jetpack_ai_assistant_block"}),H(e)}),[S,U,M,H]);return(0,r.createElement)(l.KeyboardShortcuts,{bindGlobal:!0,shortcuts:{esc:()=>{["requesting","suggesting"].includes(re)&&Ee()}}},(0,r.createElement)("div",fe,ce&&(0,r.createElement)("div",{ref:W,className:"jetpack-ai-assistant__content"},(0,r.createElement)(A.RawHTML,null,(0,a.LB)({content:e.content||""}))),(0,r.createElement)(s.InspectorControls,null,(0,r.createElement)(l.PanelBody,{initialOpen:!0},(0,r.createElement)(l.PanelRow,null,(0,r.createElement)(m.Z,{placement:h.I}))),(0,r.createElement)(l.PanelBody,{initialOpen:!0},(0,r.createElement)(l.PanelRow,null,(0,r.createElement)(C.Z,null)))),!se&&ie&&!R&&(0,r.createElement)(B.Z,{isWaitingState:se,contentIsLoaded:ce,getSuggestionFromOpenAI:Y,retryRequest:te,handleAcceptContent:me,handleAcceptTitle:he,handleTryAgain:null,showRetry:J,contentBefore:X,hasPostTitle:!!ee?.length,wholeContent:ne,promptType:e.promptType,setUserPrompt:e=>{if(!x?.current)return;x.current.focus(),t({userPrompt:e})},recordEvent:S.recordEvent,isGeneratingTitle:ue}),(0,r.createElement)(a.MW,{ref:x,disabled:R||!ie,value:e.userPrompt,placeholder:e?.content?Ce:Be,onChange:e=>{_(!0),t({userPrompt:e})},onSend:()=>{((...e)=>{Y(...e),V()})("userPrompt"),S.recordEvent("jetpack_ai_assistant_block_generate",{feature:"ai-assistant"})},onStop:Ee,onAccept:()=>{ue?he():me()},onDiscard:()=>{const r=e?.content===j(n).attributes?.content;t({content:e?.originalContent,promptType:void 0,messages:e?.originalMessages}),de(),r?S.recordEvent("jetpack_ai_assistant_block_dismiss"):S.recordEvent("jetpack_ai_assistant_block_discard",{feature:"ai-assistant"})},state:re,isTransparent:R||!ie,showButtonLabels:!G,showAccept:"init"!==re&&ce&&!se,acceptLabel:pe,showGuideLine:ce,showRemove:e?.content?.length>0,banner:be,error:ke,customFooter:z%5!=0&&1!==M||O||q!==E._5?null:(0,r.createElement)(a.xi,{requestsRemaining:z,onUpgradeClick:ve})})))}},27559:(e,t,n)=>{"use strict";var r=n(31985),a=n(23536),o=n(45624),s=n(6747);n(81765),n(54765),n(94662),n(21715);(0,r.S)(a,{edit:o.Z,save:()=>null,transforms:s.Z})},54765:(e,t,n)=>{"use strict";n.d(t,{J7:()=>d,Ri:()=>g,jz:()=>p,kI:()=>A,sr:()=>c});var r=n(4981),a=n(9818),o=n(92694),s=n(23536),i=n(71449),l=n(28788);const c=(0,l.$)("ai-assistant-support"),u=(0,l.$)("ai-assistant-extensions-support"),A=["core/paragraph","core/list","core/heading"];let g=[...A];const p=[];function d(){if(!(0,r.getBlockType)(s.name))return!1;if(!c)return!1;if(!(0,i.b)())return!1;const{errorCode:e}=(0,a.select)("wordpress-com/plans")?.getAiAssistantFeature?.()||{};if(e)return!1;const{getHiddenBlockTypes:t}=(0,a.select)("core/edit-post")||{};return!(t?.()||[]).includes(s.name)}["core/heading","core/paragraph","core/list-item","core/list"].forEach((e=>{p.push(e),g=g.filter((t=>t!==e))})),[].forEach((e=>{u&&(p.push(e),g=g.filter((t=>t!==e)))})),(0,o.addFilter)("blocks.registerBlockType","jetpack/ai-assistant-support",(function(e,t){return g.includes(t)&&d()?{...e,supports:{...e.supports,"jetpack/ai":{assistant:!0}}}:e}),100)},49259:(e,t,n)=>{"use strict";n.d(t,{$M:()=>i,ZP:()=>l});var r=n(51806),a=n(52175),o=n(94333),s=(n(99196),n(54458));function i(e){return`ai-assistant-block-${e}`}const l=(0,o.createHigherOrderComponent)((e=>t=>{const{name:n}=t;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(e,t),(0,r.createElement)(a.BlockControls,{group:"block"},(0,r.createElement)(s.Z,{blockType:n})))}),"withAIAssistant")},79191:(e,t,n)=>{"use strict";n.d(t,{Z:()=>I});var r=n(51806),a=n(42290),o=n(13419),s=n(4981),i=n(55609),l=n(94333),c=n(9818),u=n(69307),A=n(65736),g=n(53961),p=n(65235),d=n.n(p),m=(n(99196),n(3180)),h=n(5246),E=n(18135),f=n(71449),C=n(63634),B=n(79817),b=n(44110);const __=A.__,k={huge:1440,wide:1280,large:960,medium:782,small:600,mobile:480};function v(e){if(!e?.length)return"";const t=(0,c.select)("core/block-editor").getBlock(e);if(!t)return"";const{innerBlocks:n}=t;return n?.length?n.reduce(((e,t)=>e+(0,s.serialize)(t)+"\n\n"),""):""}function I({clientId:e,className:t=""}){const n=(0,u.useRef)(null),s=(0,u.useRef)(null),{tracks:A}=(0,o.z$)(),p=(0,f.b)(),{inputValue:I,setInputValue:y,isVisible:w,assistantAnchor:Q}=(0,u.useContext)(B.D),{dequeueAiAssistantFeatureAsyncRequest:_}=(0,c.useDispatch)("wordpress-com/plans"),S=()=>{setTimeout((()=>{s.current?.focus?.()}),100)},{requestSuggestion:j,requestingState:x,stopSuggestion:L,requestingError:P}=(0,a.X_)({onDone:S}),{requireUpgrade:T}=(0,E.Z)(),D=P?.code===a.$L||T,N="requesting"===x||"suggesting"===x,R="suggesting"===x||"done"===x,Z=__("Ask Jetpack AI to create your form","jetpack"),M=__("Creating your form. Please wait a few moments.","jetpack"),{removeNotice:F}=(0,c.useDispatch)(g.store),U=(0,u.useCallback)((()=>{if(!I?.length)return;F(b.uu);const t=(0,C.KR)({request:I,content:v(e)});_(),j(t,{feature:"jetpack-form-ai-extension"}),A.recordEvent("jetpack_ai_assistant_block_generate",{feature:"jetpack-form-ai-extension"}),n?.current?.focus()}),[e,_,I,F,j,A]),O=(0,u.useCallback)((()=>{L(),S(),A.recordEvent("jetpack_ai_assistant_block_stop",{feature:"jetpack-form-ai-extension"})}),[L,A]),z=(0,l.useViewportMatch)("medium","<"),H=z&&Q,q=(0,u.useRef)(null),$=(0,u.useRef)(z),[V,G]=(0,u.useState)(z);if((0,u.useEffect)((()=>{const e=n?.current;if(e)return q?.current||(q.current=new ResizeObserver((e=>{if(!w)return;if(H)return;const t=e[0].contentRect.width{q?.current?.disconnect()}}),[H,w]),(0,u.useEffect)((()=>{w&&A.recordEvent("jetpack_ai_assistant_prompt_show",{block_type:"jetpack/contact-form"})}),[w,A]),(0,u.useEffect)((()=>{const e=setTimeout((()=>{w&&s?.current&&s.current.focus()}),300);return function(){clearTimeout(e)}}),[]),!w)return null;const W=(0,r.createElement)("div",{className:"jetpack-ai-assistant__bar-wrapper"},(0,r.createElement)(i.KeyboardShortcuts,{bindGlobal:!0,shortcuts:{esc:()=>{["requesting","suggesting"].includes(x)&&O()}}},(0,r.createElement)("div",{ref:n,className:d()("jetpack-ai-assistant__bar",{[t]:t,"is-fixed":H,"is-mobile-mode":V}),tabIndex:-1},D&&(0,r.createElement)(h.Z,{placement:"jetpack-form-block"}),!p&&(0,r.createElement)(m.Z,null),(0,r.createElement)(a.MW,{ref:s,disabled:D||!p,value:I,placeholder:N?M:Z,onChange:y,onSend:U,onStop:O,state:x,isTransparent:D||!p,showButtonLabels:!V,showGuideLine:R}))));return H?(0,u.createPortal)(W,Q):W}},81732:(e,t,n)=>{"use strict";n.d(t,{Z:()=>g});var r=n(51806),a=n(42290),o=n(55609),s=n(94333),i=n(69307),l=n(65736),c=n(79817),u=n(44110);const __=l.__,A="jetpack-ai-assistant-bar__slot";function g({jetpackFormClientId:e}){const{isVisible:t,toggle:n,setAnchor:l,assistantAnchor:g}=(0,i.useContext)(c.D),{requestingState:p}=(0,a.X_)(),d=(0,i.useRef)(null),m=(0,s.useViewportMatch)("medium","<");(0,i.useEffect)((()=>{if(!d.current)return;const e=d.current.closest(".block-editor-block-contextual-toolbar");if(!e)return;let t=e.parentElement?.querySelector(`.${A}`);if(t)return e.after(t),l(t);t=document.createElement("div"),t.setAttribute("role","toolbar"),t.setAttribute("aria-label",__("AI Assistant","jetpack")),t.setAttribute("aria-orientation","horizontal"),t.className=A;const n=e.offsetHeight;t.style.top=`${n}px`,e.after(t),l(t)}),[l]),(0,i.useEffect)((()=>{m||g?.remove()}),[m,g]);const h=(0,i.useCallback)((()=>{if(!e)return n();(0,u.Vl)(e,n)}),[e,n]),E="requesting"===p||"suggesting"===p;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(o.KeyboardShortcuts,{bindGlobal:!0,shortcuts:{"mod+/":n}}),(0,r.createElement)(o.ToolbarButton,{ref:d,showTooltip:!0,onClick:h,"aria-haspopup":"true","aria-expanded":t,label:__("Ask AI Assistant","jetpack"),icon:a.u_,disabled:E}))}},59090:(e,t,n)=>{"use strict";n.d(t,{aE:()=>r,nB:()=>a});const r=window?.Jetpack_Editor_Initial_State?.available_blocks?.["ai-assistant-form-support"]?.available,a=["jetpack/field-name","jetpack/field-email","jetpack/field-text","jetpack/field-textarea","jetpack/field-checkbox","jetpack/field-date","jetpack/field-telephone","jetpack/field-url","jetpack/field-checkbox-multiple","jetpack/field-radio","jetpack/field-select","jetpack/field-consent","jetpack/button"]},94662:(e,t,n)=>{"use strict";n.d(t,{G:()=>h});var r=n(51806),a=n(42290),o=n(13419),s=n(52175),i=n(4981),l=n(94333),c=n(9818),u=n(69307),A=n(92694),g=(n(99196),n(79191)),p=n(81732),d=n(59090),m=n(44110);function h(e,{checkChildrenBlocks:t=!1,clientId:n}={clientId:""}){const r=(0,i.getBlockType)("jetpack/ai-assistant"),{isModuleActive:a}=(0,o.el)("contact-form");if(!a)return!1;if(!r)return!1;if("string"!=typeof e)return!1;if(!d.aE)return!1;if(!n?.length)return!1;if(t){if(!d.nB.includes(e))return!1}else if("jetpack/contact-form"!==e)return!1;const{getHiddenBlockTypes:s}=(0,c.select)("core/edit-post")||{};return!(s?.()||[]).includes(e)}const E=(0,l.createHigherOrderComponent)((e=>t=>{const n=h(t?.name,{clientId:t.clientId}),{increaseAiAssistantRequestsCount:o}=(0,c.useDispatch)("wordpress-com/plans"),{eventSource:i}=(0,a.X_)({onDone:(0,u.useCallback)((()=>{o()}),[o]),onError:(0,u.useCallback)((e=>{"error_network"!==e.code&&"error_quota_exceeded"!==e.code&&o()}),[o])}),l=(0,u.useCallback)((()=>{i&&i?.close()}),[i]);if((0,u.useEffect)((()=>()=>{"jetpack/contact-form"===t?.name&&l()}),[l,t?.name]),!n)return(0,r.createElement)(e,t);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(e,t),(0,r.createElement)(g.Z,{clientId:t.clientId}),(0,r.createElement)(s.BlockControls,{group:"block"},(0,r.createElement)(p.Z,null)))}),"jetpackFormEditWithAiComponents");(0,A.addFilter)("blocks.registerBlockType","jetpack/ai-assistant-support",(function(e,t){return"jetpack/contact-form"!==t?e:{...e,edit:(0,a.oN)((0,m.ZP)(E(e.edit)))}}),100);const f=(0,l.createHigherOrderComponent)((e=>t=>{const n=(0,c.useSelect)((e=>{const n=e("core/block-editor"),{getBlockParentsByBlockName:r}=n;return r(t.clientId,"jetpack/contact-form")?.[0]}),[t.clientId]);if(!h(t?.name,{checkChildrenBlocks:!0,clientId:n}))return(0,r.createElement)(e,t);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(e,t),(0,r.createElement)(s.BlockControls,{group:"parent"},(0,r.createElement)(p.Z,{jetpackFormClientId:n})))}),"jetpackFormChildrenEditWithAiComponents");(0,A.addFilter)("blocks.registerBlockType","jetpack/ai-assistant-support",(function(e,t){return d.nB.includes(t)?{...e,edit:f(e.edit)}:e}))},79817:(e,t,n)=>{"use strict";n.d(t,{D:()=>o,v:()=>s});var r=n(51806),a=n(69307);const o=(0,a.createContext)({}),s=({value:e,children:t})=>(0,r.createElement)(o.Provider,{value:e,children:t})},44110:(e,t,n)=>{"use strict";n.d(t,{Vl:()=>E,ZP:()=>f,uu:()=>h});var r=n(51806),a=n(42290),o=n(4981),s=n(55609),i=n(94333),l=n(9818),c=n(69307),u=n(65736),A=n(53961),g=n(94662),p=n(5863),d=n(56359),m=n(79817);const __=u.__,h="ai-assistant";function E(e,t){(0,l.dispatch)("core/block-editor").selectBlock(e),t?.()}const f=(0,i.createHigherOrderComponent)((e=>t=>{const{clientId:n,isSelected:i}=t,{replaceInnerBlocks:u}=(0,l.useDispatch)("core/block-editor"),f=(0,l.useSelect)((e=>e("core/editor")),[]),C=(0,l.useSelect)((e=>e("core/block-editor")),[]),B=f.getCurrentPostId(),b=C.getBlock(n),[k,v]=(0,c.useState)(""),I="jetpack/contact-form"===b?.name&&0===b?.innerBlocks?.length,[y,w]=(0,c.useState)(I),[Q,_]=(0,c.useState)(!1),[S,j]=(0,c.useState)(null),x=(0,c.useRef)([]),L=(0,c.useCallback)((()=>{w(!0)}),[]),P=(0,c.useCallback)((()=>{w(!1)}),[]),T=(0,c.useCallback)((()=>{w(!y)}),[y]),D=(0,c.useCallback)((e=>{j(e)}),[]),{createNotice:N}=(0,l.useDispatch)(A.store),R=(0,c.useCallback)((({severity:e,message:t,code:n})=>{n!==a.$L&&N(e,t,{isDismissible:!0,id:h})}),[N]);(0,c.useEffect)((()=>{i||P()}),[i,P]);const Z=(0,c.useMemo)((()=>({inputValue:k,setInputValue:v,isVisible:y,show:L,hide:P,toggle:T,isFixed:Q,setAssistantFixed:_,assistantAnchor:S,setAnchor:D})),[k,y,L,P,T,Q,S,D]),M=(0,c.useCallback)(((e,t=!1)=>{const r=e.replace(//g,""),a=(0,d.J)(r),s=(0,o.parse)(a).filter((e=>e.isValid&&!["core/freeform","core/missing","core/html"].includes(e.name)));let i=!1;if(s.length0){const e=s[s.length-1],t=x.current[s.length-1];i=!(0,p.c)(e,t)}if(s.length>0&&(s.length!==x.current.length||i)&&(u(n,s),x.current=s),t){const e=s.filter((e=>"jetpack/button"===e.name));if(x.current=x.current||[],e.length>1){let t=0;x.current=x.current.filter((n=>"jetpack/button"!==n.name||(t++,t===e.length))),u(n,x.current)}else 0===e.length&&u(n,[...x.current,(0,o.createBlock)("jetpack/button",{label:__("Submit","jetpack"),element:"button",text:__("Submit","jetpack"),borderRadius:8,lock:{remove:!0}})]);x.current=[]}}),[n,u]);return(0,a.X_)({askQuestionOptions:{postId:B},onDone:e=>{M(e,!0),v("")},onSuggestion:M,onError:R}),(0,g.G)(t.name,{clientId:t.clientId})?(0,r.createElement)(m.v,{value:Z},(0,r.createElement)(s.KeyboardShortcuts,{shortcuts:{"mod+/":()=>E(n,L)}},(0,r.createElement)(e,t))):(0,r.createElement)(e,t)}),"withUiHandlerDataProvider")},46448:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(42290),a=n(9818),o=n(69307),s=n(51128),i=n.n(s),l=n(27298),c=n(63634),u=n(854),A=n(80609);const g=i()("jetpack-ai-assistant:error"),p=({attributes:e,clientId:t,content:n,tracks:s,userPrompt:i,onSuggestionDone:p,onUnclearPrompt:d,onModeration:m,requireUpgrade:h,initialRequestingState:E,contentRef:f,blockRef:C})=>{const[B,b]=(0,o.useState)(!1),[k,v]=(0,o.useState)(""),{updateBlockAttributes:I}=(0,a.useDispatch)("core/block-editor"),{dequeueAiAssistantFeatureAsyncRequest:y,setAiAssistantFeatureRequireUpgrade:w}=(0,a.useDispatch)("wordpress-com/plans"),{snapToBottom:Q,enableAutoScroll:_,disableAutoScroll:S}=(0,A.Z)(C,f),j=(0,a.useSelect)((e=>e("core/editor").getEditedPostAttribute("title"))),x=(0,a.useSelect)((e=>e("core/editor").getCurrentPostId())),L=(0,o.useRef)([]),P=(0,o.useRef)(),{request:T,stopSuggestion:D,handleErrorQuotaExceededError:N,requestingState:R,error:Z}=(0,r.pw)({onSuggestion:e=>{I(t,{content:e?.replaceAll(c._W,"")}),Q()},onDone:e=>{const n=e.replaceAll(c._W,""),r={role:"assistant",content:n};L.current.push(P.current,r),L.current.length>20&&L.current.splice(0,L.current.length-20),I(t,{content:n,messages:L.current}),Q(),S(),p?.()},onStop:()=>{Q(),S(),p?.()},onError:e=>{switch(e?.code){case r.cv:b(!1);break;case r.q4:b(!1),m?.();break;case r.co:case r.$u:b(!0);break;case r.$L:b(!1),w(!0);break;case r.bC:d?.()}},onAllErrors:e=>{g(e)},initialRequestingState:E,askQuestionOptions:{postId:x,feature:"ai-assistant",functions:{}}}),M=["requesting","suggesting"].includes(R),F=async(r,a={})=>{if(y(),h)return N(),void b(!1);if(a={retryRequest:!1,tone:l.Nj,...a},M)return;b(!1);let o=k;if(s.recordEvent("jetpack_ai_chat_completion",{post_id:x}),L.current=[...e.messages]??[],P.current={},a.retryRequest)P.current=o[o.length-1];else{const s=e?.isLayoutBuldingModeEnable?(0,u.WN)(t):(0,u.xN)();o=(0,c.Iq)({generatedContent:n,allPostContent:s,postContentAbove:(0,u.h7)(t),currentPostTitle:j,options:a,userPrompt:a?.userPrompt||i,type:r,isGeneratingTitle:"generateTitle"===e.promptType}),P.current=o.pop(),o=[...o,...L.current],o.push(P.current),v(o),"generateTitle"!==e.promptType&&I(t,{promptType:r})}try{_(),await T(o)}catch(e){g(e),b(!0),S()}};return{setShowRetry:b,showRetry:B,postTitle:j,contentBefore:(0,u.h7)(t),wholeContent:(0,u.xN)(),requestingState:R,error:Z,getSuggestionFromOpenAI:F,stopSuggestion:D,retryRequest:()=>F("",{retryRequest:!0})}}},63206:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(6895),a=n(13419),o=n(46867),s=n(18135);const i=()=>{const e=new URLSearchParams(window.location.search),t=(0,a.lQ)();return(0,a.Wp)()&&e.has("post")?`https://wordpress.com/post/${t}/${e.get("post")}`:`https://wordpress.com/home/${t}`};function l(){const{nextTier:e,tierPlansEnabled:t}=(0,s.Z)(),n=i(),l=t?(0,r.Z)("jetpack-ai-yearly-tier-upgrade-nudge",{site:(0,a.lQ)(),path:`jetpack_ai_yearly:-q-${e?.limit}`,query:`redirect_to=${encodeURIComponent(n)}`}):(0,r.Z)("jetpack-ai-monthly-plan-ai-assistant-block-banner",{site:(0,a.lQ)()}),c=(0,a.Ug)()||(0,a.Wp)()?l:`${window?.Jetpack_Editor_Initial_State?.adminUrl}admin.php?redirect_to_referrer=1&page=my-jetpack#/add-jetpack-ai`,{autosaveAndRedirect:u,isRedirecting:A}=(0,o.Z)(c);return{checkoutUrl:c,autosaveAndRedirect:u,isRedirecting:A}}},18135:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9818),a=n(23795);function o(){const{data:e,loading:t,requestsLimit:n,requestsCount:o}=(0,r.useSelect)((e=>{const{getAiAssistantFeature:t,getIsRequestingAiAssistantFeature:n}=e("wordpress-com/plans"),r=t(),{currentTier:o,usagePeriod:s,requestsCount:i,requestsLimit:l}=r,c=(0,a.U_)(o),u=c===a.dt?s?.requestsCount:i,A=c===a._5?l:o?.limit;return{data:r,loading:n(),requestsCount:u,requestsLimit:A}}),[]),{fetchAiAssistantFeature:s,increaseAiAssistantRequestsCount:i,dequeueAiAssistantFeatureAsyncRequest:l}=(0,r.useDispatch)("wordpress-com/plans");return{...e,requestsCount:o,requestsLimit:n,loading:t,error:null,refresh:s,increaseRequestsCount:i,dequeueAsyncRequest:l}}},42890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(6975),a=n(69307);const o=window?.Jetpack_Editor_Initial_State?.tracksUserData||null,s=parseInt(window?.Jetpack_Editor_Initial_State?.wpcomBlogId)||0,i=()=>((0,a.useEffect)((()=>{o&&r.Z.initialize(o?.userid,o?.username,s?{blog_id:s}:{})}),[]),r.Z)},80609:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(69307),a=n(51128);const o=n.n(a)()("jetpack-ai-assistant:use-auto-scroll"),s=(e,t,n=!1)=>{const a=(0,r.useRef)(null),s=(0,r.useRef)(null),i=(0,r.useRef)(!1),l=(0,r.useRef)(!1),c=(0,r.useRef)(!1),u=(0,r.useRef)(!1),A=(0,r.useRef)({scrollPadding:"",scrollMargin:""}),g=(0,r.useCallback)((()=>{o("enabling ignore scroll"),l.current=!0}),[]),p=(0,r.useCallback)((()=>{i.current&&c.current&&!l.current&&g()}),[g]),d=(0,r.useCallback)((()=>{i.current=!0,l.current=!1,c.current=!1,u.current=!1,a.current?.addEventListener("scroll",p),o("enabling auto scroll")}),[p]),m=(0,r.useCallback)((()=>{i.current=!1,l.current=!1,c.current=!1,u.current=!1,a.current?.removeEventListener("scroll",p),s.current?.style&&(s.current.style.scrollPadding=A.current.scrollPadding,s.current.style.scrollMargin=A.current.scrollMargin),a.current=null,o("disabling auto scroll")}),[p]),h=(0,r.useCallback)((()=>{if(!i.current||l.current)return;const r=n?e?.current:t?.current?.firstElementChild?.lastElementChild;r&&!u.current&&(c.current=!0,u.current=!0,a?.current?.removeEventListener?.("scroll",p),r?.scrollIntoView({block:"end",inline:"end"}),setTimeout((()=>{u.current=!1,a?.current?.addEventListener?.("scroll",p)}),200))}),[e,t,n,p]),E=(0,r.useCallback)((e=>{if(null==e)return null;if("BODY"===e?.nodeName)return e;if(e?.ownerDocument!==document)return e.ownerDocument;const{overflow:t}=window.getComputedStyle(e);return t.split(" ").every((e=>"auto"===e||"scroll"===e))?e:e?.parentElement?E(e?.parentElement):e}),[]);return(0,r.useEffect)((()=>{const t=E(e?.current?.parentElement);!a.current&&t&&(a.current=t,s.current=t instanceof HTMLElement?t:t.documentElement,A.current={scrollPadding:s.current.style.scrollPadding,scrollMargin:s.current.style.scrollMargin},s.current.style.scrollPadding="80px",s.current.style.scrollMargin="10px")}),[e,E]),{snapToBottom:h,enableAutoScroll:d,disableAutoScroll:m}}},97477:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(9818),o=n(99196),s=n(54765),i=n(49259),l=n(854),c=n(6747);const u=()=>{const{replaceBlock:e,removeBlocks:t}=(0,a.useDispatch)("core/block-editor"),n=(0,a.useSelect)((e=>e("core/block-editor")),[]),{getSelectedBlockClientIds:u,getBlocksByClientId:A,getBlock:g,getBlockParents:p}=n,{tracks:d}=(0,r.z$)();return{canTransformToAIAssistant:(0,o.useCallback)((({clientId:e,blockName:t})=>{if(!g(e))return!1;if(!s.kI.includes(t))return!1;const n=p(e);if(0===n.length)return!0;const r=g(n[n.length-1]);return!["core/list","core/list-item"].includes(r.name)}),[g,p]),transformToAIAssistant:(0,o.useCallback)((({request:n}={})=>{const r=u(),a=A(r),o=(0,l.vL)(a),[s]=a,[g,...p]=r,m={...s?.attributes||{},content:o},h=(0,c.b)(s.name,m);if(n?.promptType){d.recordEvent("jetpack_editor_ai_assistant_extension_toolbar_button_click",{suggestion:n.promptType,block_type:s.name});const e={clientId:g,type:n.promptType,options:{...n.options,contentType:"generated",fromExtension:!0}};localStorage.setItem((0,i.$M)(h.clientId),JSON.stringify(e))}else d.recordEvent("jetpack_ai_assistant_prompt_show",{block_type:s.name});e(g,h),t(p)}),[A,u,t,e,d]),getSelectedBlockClientIds:u}}},62378:(e,t,n)=>{"use strict";n.d(t,{gH:()=>s});var r=n(42290),a=n(4981),o=n(9818);class s{renderRules=[];firstUpdate=!0;behavior="dropdown";isChildBlock=!1;constructor(e,t=[],n="dropdown",r=!1){this.clientId=e,this.renderRules=t,this.behavior=n,this.isChildBlock=r}getBlock(){const{getBlock:e}=(0,o.select)("core/block-editor");return e(this.clientId)}getContent(){const e=this.getBlock();return t=(0,a.getBlockContent)(e),(0,r.g)({content:t});var t}renderContent(e){return function(e,t=[]){return(0,r.LB)({content:e,rules:t,extension:!0})}(e,this.renderRules)}onSuggestion(e){if(!e)return;const t=this.renderContent(e);this.replaceBlockContent(t)}onDone(e){this.firstUpdate=!0}replaceBlockContent(e){const[t]=(0,a.rawHandler)({HTML:e});if(!t)return;const{updateBlockAttributes:n,replaceInnerBlocks:r,__unstableMarkNextChangeAsNotPersistent:s}=(0,o.dispatch)("core/block-editor");this.firstUpdate?this.firstUpdate=!1:s(),n(this.clientId,t.attributes),s(),r(this.clientId,t.innerBlocks)}}},65598:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(51806),a=n(42290),o=n(13419),s=n(69307),i=n(65736),l=n(65235),c=n.n(l),u=(n(99196),n(63206)),A=n(18135);const __=i.__,g=c()("jetpack-ai-assistant-extension-ai-input","wp-block");function p({className:e,requestingState:t,requestingError:n,inputRef:i,wrapperRef:l,action:p,blockType:d,request:m,stopSuggestion:h,close:E,undo:f,tryAgain:C}){const[B,b]=(0,s.useState)(""),[k,v]=(0,s.useState)(__("Ask Jetpack AI to edit…","jetpack")),{checkoutUrl:I}=(0,u.Z)(),{tracks:y}=(0,o.z$)(),[w,Q]=(0,s.useState)(0),[_,S]=(0,s.useState)(!1),{requireUpgrade:j,requestsCount:x,requestsLimit:L,loading:P,nextTier:T,currentTier:D}=(0,A.Z)(),N=(0,s.useMemo)((()=>j||["requesting","suggesting"].includes(t)),[j,t]),R=(0,s.useCallback)((()=>{y.recordEvent("jetpack_ai_assistant_extension_generate",{block_type:d}),m?.(B)}),[d,m,y,B]),Z=(0,s.useCallback)((()=>{y.recordEvent("jetpack_ai_assistant_extension_stop",{block_type:d}),h?.()}),[d,h,y]);const M=(0,s.useCallback)((()=>{y.recordEvent("jetpack_ai_assistant_undo",{block_type:d}),f?.()}),[d,y,f]),F=(0,s.useCallback)((()=>{y.recordEvent("jetpack_ai_upgrade_button",{current_tier_slug:D?.slug,requests_count:x,placement:"jetpack_ai_assistant_extension"})}),[D?.slug,x,y]),U=(0,s.useCallback)((()=>{y.recordEvent("jetpack_ai_assistant_try_again",{block_type:d}),C?.()}),[d,y,C]);return(0,s.useEffect)((()=>{["init","done"].includes(t)&&b("")}),[t]),(0,s.useEffect)((()=>{v(p||__("Ask Jetpack AI to edit…","jetpack")),p&&b("")}),[p]),(0,s.useEffect)((()=>{S(!P&&!!T&&0===B.length)}),[P,T,B]),(0,s.useEffect)((()=>{const e=Math.max(L-x,0);Q(e)}),[L,x]),(0,r.createElement)(a.C3,{className:c()(g,e),placeholder:k,disabled:N,value:B,state:t,showGuideLine:!0,error:n,requestsRemaining:w,showUpgradeMessage:_,upgradeUrl:I,onChange:b,onSend:R,onStop:Z,onClose:function(){E?.()},onUndo:M,onUpgrade:F,onTryAgain:U,wrapperRef:l,ref:i})}},27222:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(51806),a=n(42290),o=n(13419),s=n(55609),i=n(69307),l=n(65736),c=n(47798),u=n(97477),A=n(57556);const __=l.__;function g({blockType:e,onClose:t,onAskAiAssistant:n,onRequestSuggestion:a}){const{canTransformToAIAssistant:o,transformToAIAssistant:s,getSelectedBlockClientIds:l}=(0,u.Z)(),A=(0,i.useCallback)((r=>{const i=l(),[c]=i;i.length<2||!o({clientId:c,blockName:e})?(r?a?.(r.promptType,r.options,r.humanText):n?.(),t?.()):s({request:r})}),[e,o,l,n,t,a,s]);return(0,r.createElement)(c.ZP,{blockType:e,onRequestSuggestion:(e,t,n)=>{A({promptType:e,options:t,humanText:n})},onAskAiAssistant:async()=>{A()},disabled:!1})}function p({behavior:e,blockType:t,label:n=__("AI Assistant","jetpack"),onAskAiAssistant:l,onRequestSuggestion:c}){const{tracks:u}=(0,o.z$)(),p=(0,i.useContext)(A.y),d=(0,i.useCallback)((e=>{e&&u.recordEvent("jetpack_ai_assistant_extension_toolbar_menu_show",{block_type:t})}),[t,u]),m=(0,i.useCallback)((()=>{u.recordEvent("jetpack_editor_ai_assistant_extension_toolbar_prompt_show",{block_type:t}),l?.()}),[t,l,u]),h=(0,i.useCallback)(((e,n,r)=>{u.recordEvent("jetpack_editor_ai_assistant_extension_toolbar_button_click",{suggestion:e,block_type:t}),c?.(e,n,r)}),[t,c,u]);return(0,r.createElement)(s.Dropdown,{popoverProps:{variant:"toolbar"},renderToggle:({isOpen:t,onToggle:o})=>(0,r.createElement)(s.ToolbarButton,{className:"jetpack-ai-assistant__button",showTooltip:!0,onClick:()=>{if("function"!=typeof e)switch(e){case"action":m();break;case"dropdown":o()}else e({onToggle:o,onAskAiAssistant:l,context:p})},"aria-haspopup":"true","aria-expanded":t,label:n,icon:a.u_}),onToggle:d,renderContent:({onClose:e})=>(0,r.createElement)(g,{onClose:e,blockType:t,onAskAiAssistant:m,onRequestSuggestion:h})})}},57556:(e,t,n)=>{"use strict";n.d(t,{W:()=>d,y:()=>p});var r=n(69307),a=n(51128),o=n.n(a),s=n(62378),i=n(47963),l=n(50084),c=n(81101),u=n(25073);const A=o()("jetpack-ai-assistant:extensions:get-block-handler"),g={"core/heading":i.s,"core/paragraph":u.Z,"core/list-item":c.n,"core/list":l.J},p=(0,r.createContext)({});function d(e,t){let n=g[e];n||(A(`No handler found for block type: ${e}. Using default handler.`),n=s.gH);const r=new n(t);return{onSuggestion:r.onSuggestion.bind(r),onDone:r.onDone.bind(r),getContent:r.getContent.bind(r),behavior:r.behavior,isChildBlock:r.isChildBlock}}},47963:(e,t,n)=>{"use strict";n.d(t,{s:()=>a});var r=n(62378);class a extends r.gH{constructor(e){super(e,[])}onSuggestion(e){const t=this.getBlock();if(e.startsWith("#")||(e=`${"#".repeat(t?.attributes?.level||1)} ${e}`),e.match(/^#*\s*$/))return;const n=this.renderContent(e);this.replaceBlockContent(n)}}},73283:(e,t,n)=>{"use strict";n.d(t,{J:()=>s});var r=n(4981),a=n(9818),o=n(54765);function s(e){if(!(0,r.getBlockType)("jetpack/ai-assistant"))return!1;if(!o.sr)return!1;if(!o.jz.includes(e))return!1;const{getHiddenBlockTypes:t}=(0,a.select)("core/edit-post")||{};return!(t?.()||[]).includes(e)}},81101:(e,t,n)=>{"use strict";n.d(t,{n:()=>a});var r=n(62378);class a extends r.gH{constructor(e){super(e,["listItem"]),this.isChildBlock=!0}}},50084:(e,t,n)=>{"use strict";n.d(t,{J:()=>a});var r=n(62378);class a extends r.gH{constructor(e){super(e,["list"])}}},25073:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(42290),a=n(4981),o=n(62378);const s=new r.JP({fixes:["paragraph"]});class i extends o.gH{constructor(e){super(e,["paragraph"])}getContent(){const e=this.getBlock();return t=(0,a.getBlockContent)(e),s.render({content:t});var t}}},21715:(e,t,n)=>{"use strict";var r=n(51806),a=n(42290),o=n(52175),s=n(94333),i=n(9818),l=n(69307),c=n(92694),u=n(51128),A=n.n(u),g=(n(99196),n(18135)),p=n(80609),d=n(57832),m=n(65598),h=n(27222),E=n(57556),f=n(73283);const C=A()("jetpack-ai-assistant:extensions:with-ai-extension"),B={"core/heading":"heading","core/paragraph":"paragraph","core/list-item":"list-item","core/list":"list"},b={group:"block"},k=(0,s.createHigherOrderComponent)((e=>t=>{const{clientId:n,isSelected:s,name:c}=t,u=(0,l.useRef)(null),A=(0,l.useRef)(0),f=(0,l.useRef)(null),k=(0,l.useRef)(""),v=(0,l.useRef)(null),I=(0,l.useRef)(document),y=(0,l.useRef)([]),[w,Q]=(0,l.useState)(""),_=(0,l.useRef)(null),[S,j]=(0,l.useState)(!1),{undo:x}=(0,i.useDispatch)("core/editor"),{postId:L}=(0,i.useSelect)((e=>{const{getCurrentPostId:t}=e("core/editor");return{postId:t()}}),[]),{id:P,className:T}=(0,o.useBlockProps)(),{increaseRequestsCount:D,dequeueAsyncRequest:N,requireUpgrade:R}=(0,g.Z)(),{snapToBottom:Z,enableAutoScroll:M,disableAutoScroll:F}=(0,p.Z)({current:I?.current?.getElementById(P)},void 0,!0),U=(0,l.useCallback)((()=>{v.current?.focus()}),[]),{onSuggestion:O,onDone:z,getContent:H,behavior:q,isChildBlock:$}=(0,l.useMemo)((()=>(0,E.W)(c,n)),[c,n]),V=(0,l.useCallback)((()=>{j((e=>!e))}),[]),G=(0,l.useCallback)((({promptType:e,options:t})=>{const n=H(),r=B[c];return[...y.current,{role:"jetpack-ai",context:{type:(0,d.Sb)(e,r),content:n,request:t?.userPrompt,tone:t?.tone,language:t?.language,is_follow_up:y.current.length>0}}]}),[c,H]),W=(0,l.useCallback)((e=>{const t=e||I.current.getElementById(P);t&&u.current&&t.style.setProperty("padding-bottom",`calc(${A.current+16}px + ${k.current||"0px"} )`,"important")}),[P]),Y=(0,l.useCallback)((e=>{O(e),W(),Z()}),[O,W,Z]),K=(0,l.useCallback)((e=>{if(F(),z(e),D(),Q(""),_.current?.message){const e={role:"assistant",content:H()};if(y.current.push(_.current.message,e),y.current.length>20){y.current.splice(0,y.current.length-20);const e=y.current.findIndex((e=>"jetpack-ai"===e.role));-1!==e&&(y.current=y.current.slice(e),y.current[0].context={...y.current[0].context,is_follow_up:!1})}}_.current=null,setTimeout((()=>{W(),U()}),100)}),[F,z,D,H,W,U]),J=(0,l.useCallback)((e=>{F(),Q(""),C("Request error",e),e.code!==a.co&&e.code!==a.$L&&D()}),[F,D]),{request:X,stopSuggestion:ee,requestingState:te,error:ne,reset:re}=(0,a.pw)({onSuggestion:Y,onDone:K,onError:J,askQuestionOptions:{postId:L,feature:"ai-assistant"}}),ae=(0,l.useCallback)(((e,t,n)=>{if(j(!0),R)return;n&&Q(n);const r=G({promptType:e,options:t});C("Request suggestion",e,t);const a=r[r.length-1];_.current={promptType:e,options:t,humanText:n,message:a},N(),M(),X(r)}),[N,M,G,X,R]),oe=(0,l.useCallback)((e=>{const t={userPrompt:e};M(),ae("userPrompt",t)}),[M,ae]),se=(0,l.useCallback)((()=>{F(),ee(),U()}),[F,ee,U]),ie=(0,l.useCallback)((()=>{_.current&&ae(_.current.promptType,_.current.options,_.current.humanText)}),[_,ae]),le=(0,l.useCallback)((()=>{j(!1),re(),Q(""),_.current=null,y.current=[]}),[re]),ce=(0,l.useCallback)((async()=>{await x(),le()}),[x,le]);(0,l.useEffect)((()=>{s||le()}),[s,le]),(0,l.useEffect)((()=>{v.current&&(I.current=v.current.ownerDocument,U())}),[S,U]),(0,l.useEffect)((()=>{let e=I.current.getElementById(P);if(e)return S&&!f.current&&u.current?(k.current=e.style.paddingBottom,f.current=new ResizeObserver((([t])=>{if(e=I.current.getElementById(P),A.current=t.contentRect.height,e&&u.current&&A.current>0){W(e);const{marginBottom:t}=getComputedStyle(e),n=parseFloat(t);u.current.style.setProperty("margin-top",`-${A.current+n}px`,"important"),u.current.style.setProperty("margin-bottom",`${n+16}px`,"important")}})),f.current.observe(u.current)):f.current&&(e.style.paddingBottom=k.current,f.current.disconnect(),f.current=null,A.current=0),()=>{f.current&&f.current.disconnect()}}),[W,n,f,P,S]);const ue=(0,r.createElement)(r.Fragment,null,(0,r.createElement)(e,t),S&&(0,r.createElement)(m.Z,{className:T,requestingState:te,requestingError:ne,wrapperRef:u,inputRef:v,action:w,blockType:c,request:oe,stopSuggestion:se,close:le,undo:ce,tryAgain:ie}),(0,r.createElement)(o.BlockControls,b,(0,r.createElement)(h.Z,{blockType:c,onAskAiAssistant:V,onRequestSuggestion:ae,behavior:q})));if($)return ue;const Ae={value:{[c]:{handleAskAiAssistant:V,handleRequestSuggestion:ae}}};return(0,r.createElement)(E.y.Provider,Ae,ue)}),"blockEditWithAiComponents");(0,c.addFilter)("blocks.registerBlockType","jetpack/ai-assistant-support/with-ai-extension",(function(e,t){return(0,f.J)(t)?{...e,edit:k(e.edit)}:e}),100)},71449:(e,t,n)=>{"use strict";n.d(t,{b:()=>u,d:()=>A});var r=n(13419),a=n(51128),o=n.n(a);const s=window?.JP_CONNECTION_INITIAL_STATE,i=o()("jetpack-ai-assistant:connection");let l=!1;const c=e=>{l||(i(e),l=!0)};function u(){return(0,r.Wp)()?(c("Simple site connected ✅"),!0):(0,r.Ug)()?(c("Atomic site connected ✅"),!0):s?.connectionStatus?.isUserConnected?(c("Jetpack user is connected ✅"),!0):(c("User is not connected ❌"),!1)}function A(){if((0,r.Wp)())return!0;return!1==!(s?.userConnectionData?.currentUser?.permissions??{}).manage_options}},57832:(e,t,n)=>{"use strict";n.d(t,{Sb:()=>u,v_:()=>i,x1:()=>l});var r=n(63634);const a="title",o="content",s=null;function i(e){return{role:"jetpack-ai",context:{type:"ai-assistant-initial-prompt",for:u(e)}}}function l({generatedContent:e,allPostContent:t,postContentAbove:n,currentPostTitle:a,options:o,type:s,userPrompt:i,isGeneratingTitle:l}){const u=[],A="generated"===o?.contentType;let g=null;switch(s){case r.qA:g=a;break;case r.sz:case r.hI:case r.Hd:g=n;break;case r.jf:g=t;break;case r.TV:case r.DR:g=e;break;case r.Lg:case r.Lq:case r.Nw:g=A?e:t;break;case r.Gh:g=e||t}const p=function(e,t){return!e&&t&&t.length>0?{role:"jetpack-ai",context:{type:"ai-assistant-relevant-content",content:t}}:null}(s===r.Gh?!!e?.length:A,g);return p&&u.push(p),u.push({role:"jetpack-ai",context:c({generatedContent:e,allPostContent:t,postContentAbove:n,currentPostTitle:a,options:o,type:s,userPrompt:i,isGeneratingTitle:l})}),u}function c({options:e,type:t,userPrompt:n,isGeneratingTitle:i}){const l=function(e,t,n){return e?a:!t||n?o:s}(i,"generated"===e?.contentType,e?.fromExtension||!1);return{type:u(t),...l?{subject:l}:{},...t===r.Lg&&e?.tone?{tone:e.tone}:{},...t===r.Nw&&e?.language?{language:e.language}:{},...t===r.Gh&&n?{request:n}:{}}}function u(e,t){const n={[r.qA]:"ai-assistant-summary-by-title",[r.sz]:"ai-assistant-continue-writing",[r.hI]:"ai-assistant-simplify",[r.Hd]:"ai-assistant-correct-spelling",[r.jf]:"ai-assistant-generate-title",[r.TV]:"ai-assistant-make-longer",[r.DR]:"ai-assistant-make-shorter",[r.Lg]:"ai-assistant-change-tone",[r.Lq]:"ai-assistant-summarize",[r.Nw]:"ai-assistant-change-language",[r.Gh]:"ai-assistant-user-prompt"};return t?`${n[e]}-${t}-extension`:n[e]}},63634:(e,t,n)=>{"use strict";n.d(t,{DR:()=>u,Gh:()=>d,Hd:()=>i,Iq:()=>E,KR:()=>h,Lg:()=>A,Lq:()=>g,Nw:()=>p,TV:()=>c,_W:()=>m,hI:()=>s,jf:()=>l,qA:()=>a,sz:()=>o});var r=n(57832);const a="titleSummary",o="continue",s="simplify",i="correctSpelling",l="generateTitle",c="makeLonger",u="makeShorter",A="changeTone",g="summarize",p="changeLanguage",d="userPrompt",m="````";function h({content:e,request:t}){if(!t)throw new Error("You must provide a custom prompt for the Jetpack Form Custom Prompt");return[{role:"jetpack-ai",context:{type:"form-ai-extension",content:e,request:t}}]}function E({generatedContent:e,allPostContent:t,postContentAbove:n,currentPostTitle:a,options:o,type:s,userPrompt:i,isGeneratingTitle:l}){return[(0,r.v_)(s),...(0,r.x1)({generatedContent:e,allPostContent:t,postContentAbove:n,currentPostTitle:a,options:o,type:s,userPrompt:i,isGeneratingTitle:l})]}},854:(e,t,n)=>{"use strict";n.d(t,{WN:()=>c,h7:()=>s,t$:()=>u,vL:()=>l,xN:()=>i});var r=n(42290),a=n(4981),o=n(9818);function s(e){if(!e)return"";const t=(0,o.select)("core/block-editor"),n=t.getBlockIndex(e),s=t.getBlocks().slice(0,n)??[];return s?.length?(0,r.g)({content:(0,a.serialize)(s)}):""}function i(){const e=(0,o.select)("core/block-editor").getBlocks();return e?.length?(0,r.g)({content:(0,a.serialize)(e)}):""}function l(e){return e.filter((e=>null!=e)).map((e=>(0,a.getBlockContent)(e))).join("\n\n")}function c(e){const t=(0,o.select)("core/block-editor").getBlock(e);return t?.innerBlocks?.length?l(t.innerBlocks):""}function u(e){if(!e?.replace(/\s+/,"").length)return"";const t=document.createElement("div");t.innerHTML=e;const{textContent:n,innerText:r}=t;return n&&!n.replace(/\s+/,"").length||r&&!r.replace(/\s+/,"").length?"":t.textContent||t.innerText||""}},72881:(e,t,n)=>{"use strict";function r(e){return e&&"string"==typeof e?e.charAt(0).toUpperCase()+e.slice(1):""}n.d(t,{k:()=>r})},5863:(e,t,n)=>{"use strict";n.d(t,{c:()=>o});const r=e=>{delete e.clientId;for(const t of e.innerBlocks??[])r(t);return e},a=e=>r((e=>JSON.parse(JSON.stringify(e)))(e));function o(e,t){const n=a(e),r=a(t);return JSON.stringify(n)===JSON.stringify(r)}},56359:(e,t,n)=>{"use strict";function r(e){const t=document.createElement("div");return t.innerHTML=e,t.innerHTML}n.d(t,{J:()=>r})},28788:(e,t,n)=>{"use strict";function r(e){return!0===window?.Jetpack_Editor_Initial_State?.available_blocks?.[e]?.available}n.d(t,{$:()=>r})},81765:(e,t,n)=>{"use strict";var r=n(4981),a=n(92694),o=n(54765),s=n(49259);(0,a.addFilter)("blocks.registerBlockType","jetpack/handle-jetpack-ai-supports",(function(e){const t=(0,r.getBlockSupport)(e,"jetpack/ai");return t&&t?.assistant&&(0,o.J7)()?{...e,edit:(0,s.ZP)(e.edit)}:e}),100)},6747:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c,b:()=>l});var r=n(42290),a=n(4981),o=n(23536),s=n(54765);const i=[];function l(e,t){const{content:n,...s}=t;let i=n;"core/heading"===e&&t?.level&&(i=i.replace(/<(\/?)h\d([^>]*)>/g,`<$1h${t.level}$2>`));const l=(0,r.g)({content:i}),c=[];return c.push({role:"jetpack-ai",context:{type:"ai-assistant-relevant-content",content:l}}),(0,a.createBlock)(o.name,{...s,content:l,originalContent:l,messages:c,originalMessages:c})}for(const e of s.Ri)i.push({type:"block",blocks:[e],isMatch:()=>(0,s.J7)(),transform:(t,n)=>{const r=(0,a.getSaveContent)(e,t,n);return l(e,{...t,content:r})}});const c={from:i}},50756:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(51806),a=n(55609),o=n(69307),s=n(65736),i=n(65235),l=n.n(i),c=n(92819);const __=s.__,u="09:00",A="17:00";class g extends o.Component{renderInterval=(e,t)=>{const{day:n}=this.props,{opening:s,closing:i}=e;return(0,r.createElement)(o.Fragment,{key:t},(0,r.createElement)("div",{className:"business-hours__row"},(0,r.createElement)("div",{className:l()(n.name,"business-hours__day")},0===t&&this.renderDayToggle()),(0,r.createElement)("div",{className:l()(n.name,"business-hours__hours")},(0,r.createElement)(a.TextControl,{type:"time",label:__("Opening","jetpack"),value:s,className:"business-hours__open",placeholder:u,onChange:e=>{this.setHour(e,"opening",t)}}),(0,r.createElement)(a.TextControl,{type:"time",label:__("Closing","jetpack"),value:i,className:"business-hours__close",placeholder:A,onChange:e=>{this.setHour(e,"closing",t)}})),(0,r.createElement)("div",{className:"business-hours__remove"},n.hours.length>1&&(0,r.createElement)(a.Button,{isSmall:!0,variant:"link",icon:"trash",label:__("Remove Hours","jetpack"),onClick:()=>{this.removeInterval(t)}}))),t===n.hours.length-1&&(0,r.createElement)("div",{className:"business-hours__row business-hours-row__add"},(0,r.createElement)("div",{className:l()(n.name,"business-hours__day")}," "),(0,r.createElement)("div",{className:l()(n.name,"business-hours__hours")},(0,r.createElement)(a.Button,{variant:"link",label:__("Add Hours","jetpack"),onClick:this.addInterval},__("Add Hours","jetpack"))),(0,r.createElement)("div",{className:"business-hours__remove"}," ")))};setHour=(e,t,n)=>{const{day:r,attributes:a,setAttributes:o}=this.props,{days:s}=a;o({days:s.map((a=>a.name===r.name?{...a,hours:a.hours.map(((r,a)=>a===n?{...r,[t]:e}:r))}:a))})};toggleClosed=e=>{const{day:t,attributes:n,setAttributes:r}=this.props,{days:a}=n;r({days:a.map((n=>{if(n.name===t.name){const t=e?[{opening:u,closing:A}]:[];return{...n,hours:t}}return n}))})};addInterval=()=>{const{day:e,attributes:t,setAttributes:n}=this.props,{days:r}=t;e.hours.push({opening:"",closing:""}),n({days:r.map((t=>t.name===e.name?{...t,hours:e.hours}:t))})};removeInterval=e=>{const{day:t,attributes:n,setAttributes:r}=this.props,{days:a}=n;r({days:a.map((n=>t.name===n.name?{...n,hours:n.hours.filter(((t,n)=>e!==n))}:n))})};isClosed(){const{day:e}=this.props;return(0,c.isEmpty)(e.hours)}renderDayToggle(){const{day:e,localization:t}=this.props;return(0,r.createElement)(o.Fragment,null,(0,r.createElement)("span",{className:"business-hours__day-name"},t.days[e.name]),(0,r.createElement)(a.ToggleControl,{label:this.isClosed()?__("Closed","jetpack"):__("Open","jetpack"),checked:!this.isClosed(),onChange:this.toggleClosed}))}renderClosed(){const{day:e}=this.props;return(0,r.createElement)("div",{className:"business-hours__row business-hours-row__closed"},(0,r.createElement)("div",{className:l()(e.name,"business-hours__day")},this.renderDayToggle()),(0,r.createElement)("div",{className:l()(e.name,"closed","business-hours__hours")}," "),(0,r.createElement)("div",{className:"business-hours__remove"}," "))}render(){const{day:e}=this.props;return this.isClosed()?this.renderClosed():e.hours.map(this.renderInterval)}}const p=g},80190:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51806),a=n(69307),o=n(65736),s=n(92819);const _x=o._x,i="undefined"!=typeof window&&window.navigator?.language||"en",l=Intl?.DateTimeFormat?new Intl.DateTimeFormat(i,{hour:"numeric",minute:"numeric",hour12:!0}):null;class c extends a.Component{formatTime(e){const[t,n]=e.split(":");if(!t||!n)return!1;const r=new Date;return r.setHours(t),r.setMinutes(n),l?l.format(r):e}renderInterval=(e,t)=>{const{day:n}=this.props,a=n.hours;return(0,r.createElement)("span",{key:t},(0,o.sprintf)("%1$s - %2$s",this.formatTime(e.opening),this.formatTime(e.closing)),a.length>1+t&&(0,r.createElement)("span",null,", "))};render(){const{day:e,localization:t}=this.props,n=e.hours.filter((e=>this.formatTime(e.opening)&&this.formatTime(e.closing)));return(0,r.createElement)("div",{className:"jetpack-business-hours__item"},(0,r.createElement)("dt",{className:e.name},t.days[e.name]),(0,r.createElement)("dd",null,(0,s.isEmpty)(n)?_x("Closed","business is closed on a full day","jetpack"):n.map(this.renderInterval),(0,r.createElement)("br",null)))}}const u=c},86162:(e,t,n)=>{"use strict";n.d(t,{Z:()=>C});var r=n(82674),a=n.n(r),o=n(51806),s=n(13419),i=n(86989),l=n.n(i),c=n(52175),u=n(55609),A=n(69771),g=n(69307),p=n(65736),d=n(22023),m=n(50756),h=n(80190);const __=p.__,E=(0,s.dM)(d),f={days:{Sun:__("Sunday","jetpack"),Mon:__("Monday","jetpack"),Tue:__("Tuesday","jetpack"),Wed:__("Wednesday","jetpack"),Thu:__("Thursday","jetpack"),Fri:__("Friday","jetpack"),Sat:__("Saturday","jetpack")},startOfWeek:0},C=e=>{const{attributes:t,isSelected:n}=e,r=(0,c.useBlockProps)(),[s,i]=(0,g.useState)(f),[p,d]=(0,g.useState)(!1),{days:C}=t,{startOfWeek:B}=s,b=C.concat(C.slice(0,B)).slice(B);let k;if((0,g.useEffect)((()=>{l()({path:"/wpcom/v2/business-hours/localized-week"}).then((e=>{i(e),d(!0)}),(()=>{i(f),d(!0)}))}),[]),p)if(n)k=(0,o.createElement)("div",{className:"is-edit"},b.map(((t,n)=>(0,o.createElement)(m.Z,a()({key:n,day:t,localization:s},e)))));else{const e=(0,A.getSettings)(),{formats:{time:t}}=e;k=(0,o.createElement)("dl",{className:"jetpack-business-hours"},b.map(((e,n)=>(0,o.createElement)(h.Z,{key:n,day:e,localization:s,timeFormat:t}))))}else k=(0,o.createElement)(u.Placeholder,{icon:E,label:__("Loading business hours","jetpack")});return(0,o.createElement)("div",r,k)}},60866:(e,t,n)=>{"use strict";var r=n(51806),a=n(31985),o=n(22023),s=n(86162);(0,a.S)(o,{edit:e=>(0,r.createElement)(s.Z,e),save:()=>null})},98625:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(92819);const o=(0,r.withFallbackStyles)(((e,t)=>{const{backgroundColor:n,textColor:r}=t,o=(0,a.get)(n,"color"),s=!(0,a.get)(r,"color")&&e?e.querySelector('[contenteditable="true"]'):null;return{fallbackBackgroundColor:o||!e?void 0:getComputedStyle(e).backgroundColor,fallbackTextColor:r||!s?void 0:getComputedStyle(s).color}}))},70424:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(24381);const a={element:{type:"string",enum:["a","button","input"]},saveInPostContent:{type:"boolean",default:!1},uniqueId:{type:"string"},passthroughAttributes:{type:"object"},text:{type:"string"},placeholder:{type:"string"},url:{type:"string"},textColor:{type:"string"},customTextColor:{type:"string",validator:r.Z},backgroundColor:{type:"string"},customBackgroundColor:{type:"string",validator:r.Z},gradient:{type:"string"},customGradient:{type:"string"},borderRadius:{type:"number"},width:{type:"string"}}},43043:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(55609),o=n(69307),s=n(65736),i=n(90446);const __=s.__;function l({borderRadius:e="",setAttributes:t}){const n=(0,o.useCallback)((e=>t({borderRadius:e})),[t]);return(0,r.createElement)(a.PanelBody,{title:__("Border Settings","jetpack")},(0,r.createElement)(a.RangeControl,{allowReset:!0,initialPosition:i.pg,label:__("Border radius","jetpack"),max:i.Gp,min:i.G0,onChange:n,value:e}))}},36953:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(52175),o=n(65736);const __=o.__;function s({isGradientAvailable:e,backgroundColor:t,fallbackBackgroundColor:n,fallbackTextColor:o,gradientValue:s,setBackgroundColor:i,setGradient:l,setTextColor:c,textColor:u}){const A=(0,r.createElement)(a.ContrastChecker,{backgroundColor:t.color,fallbackBackgroundColor:n,fallbackTextColor:o,isLargeText:!1,textColor:u.color});return e?(0,r.createElement)(a.__experimentalPanelColorGradientSettings,{settings:[{colorValue:u.color,label:__("Text Color","jetpack"),onColorChange:c},{colorValue:t.color,gradientValue:s,label:__("Background","jetpack"),onColorChange:i,onGradientChange:l}],title:__("Background & Text Color","jetpack")},A):(0,r.createElement)(a.PanelColorSettings,{colorSettings:[{value:u.color,onChange:c,label:__("Text Color","jetpack")},{value:t.color,onChange:i,label:__("Background","jetpack")}],title:__("Background & Text Color","jetpack")},A)}},90446:(e,t,n)=>{"use strict";n.d(t,{DA:()=>a,G0:()=>i,Gp:()=>s,pg:()=>o});var r=n(52175);const a=!!r.__experimentalUseGradient,o=5,s=50,i=0},29343:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(9818),o=n(30429),s=n(43043),i=n(36953);function l({attributes:e,backgroundColor:t,clientId:n,context:l,fallbackBackgroundColor:c,fallbackTextColor:u,setAttributes:A,setBackgroundColor:g,setTextColor:p,textColor:d,gradientValue:m,setGradient:h,isGradientAvailable:E}){const{align:f,borderRadius:C}=e,B="jetpack/parentBlockWidth"in l,b=B?l["jetpack/parentBlockWidth"]:e.width,k=(0,a.useSelect)((e=>{const{getBlock:t,getBlockRootClientId:r}=e("core/block-editor");return t(r(n))})),{updateBlockAttributes:v}=(0,a.useDispatch)("core/block-editor");return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.Z,{backgroundColor:t,fallbackBackgroundColor:c,fallbackTextColor:u,gradientValue:m,setBackgroundColor:g,setGradient:h,setTextColor:p,textColor:d,isGradientAvailable:E}),(0,r.createElement)(s.Z,{borderRadius:C,setAttributes:A}),(0,r.createElement)(o.G,{align:f,width:b,onChange:e=>{B?v(k.clientId,{width:e}):A({width:e})}}))}},5501:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var r=n(82674),a=n.n(r),o=n(51806),s=n(52175),i=n(94333),l=n(65736),c=n(65235),u=n.n(c),A=n(81673),g=n(98625),p=n(90446),d=n(29343),m=n(16969);const __=l.__;const h=(0,i.compose)((0,s.withColors)({backgroundColor:"background-color"},{textColor:"color"}),g.Z)((function(e){const{attributes:t,backgroundColor:n,className:r,clientId:i,context:l,setAttributes:c,textColor:g}=e,{borderRadius:h,element:E,placeholder:f,text:C,width:B,fontSize:b}=t,k="jetpack/parentBlockWidth"in l;(0,m.Z)({attributes:t,clientId:i,setAttributes:c}),(0,A.Z)({attributes:t,disableEffects:k,setAttributes:c});const{gradientClass:v,gradientValue:I,setGradient:y}=p.DA?(0,s.__experimentalUseGradient)({gradientAttribute:"gradient",customGradientAttribute:"customGradient"}):{},w=u()("wp-block-button",r),Q=u()("wp-block-button__link",{"has-background":n.color||I,[n.class]:!I&&n.class,"has-text-color":g.color,[g.class]:g.class,[v]:v,"no-border-radius":0===h,"has-custom-width":!!B,[`has-${b}-font-size`]:!!b,"has-custom-font-size":!!b}),_={...!n.color&&I?{background:I}:{backgroundColor:n.color},fontSize:t.style?.typography?.fontSize,color:g.color,borderRadius:h?h+"px":void 0,width:B};return(0,o.createElement)("div",{className:w},(0,o.createElement)(s.RichText,{allowedFormats:"input"===E?[]:void 0,className:Q,disableLineBreaks:"input"===E,onChange:e=>c({text:e}),placeholder:f||__("Add text…","jetpack"),style:_,value:C,withoutInteractiveFormatting:!0}),(0,o.createElement)(s.InspectorControls,null,(0,o.createElement)(d.Z,a()({gradientValue:I,setGradient:y,isGradientAvailable:p.DA},e))))}))},48887:(e,t,n)=>{"use strict";var r=n(31985),a=n(77123);(0,r.Z)(a.u,a.X)},26361:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(55609);const o=(0,r.createElement)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(a.Path,{d:"M19 6.5H5c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v7zM8 13h8v-1.5H8V13z"}))},77123:(e,t,n)=>{"use strict";n.d(t,{X:()=>u,u:()=>c});var r=n(65736),a=n(5820),o=n(70424),s=n(5501),i=n(26361),l=n(29586);const __=r.__,c="button",u={title:__("Button","jetpack"),icon:i.Z,category:(0,a.Z)("design","layout"),keywords:[],supports:{html:!1,inserter:!1,align:["left","center","right"],typography:{fontSize:!0,__experimentalFontFamily:!0,__experimentalTextTransform:!0,__experimentalDefaultControls:{fontSize:!0}}},styles:[{name:"fill",label:__("Fill","jetpack"),isDefault:!0},{name:"outline",label:__("Outline","jetpack")}],attributes:o.Z,edit:s.Z,save:l.Z,usesContext:["jetpack/parentBlockWidth"]}},29586:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(52175),o=n(65235),s=n.n(o),i=n(90446);function l({attributes:e,blockName:t,uniqueId:n}){const{backgroundColor:o,borderRadius:l,className:c,customBackgroundColor:u,customGradient:A,customTextColor:g,gradient:p,saveInPostContent:d,text:m,textColor:h,url:E,width:f,fontSize:C}=e;if(!d)return null;const B=(0,a.getColorClassName)("background-color",o),b=i.DA?(0,a.__experimentalGetGradientClass)(p):void 0,k=(0,a.getColorClassName)("color",h),v=s()("wp-block-button","jetpack-submit-button",c,{[`wp-block-jetpack-${t}`]:t}),I=s()("wp-block-button__link",{"has-text-color":h||g,[k]:k,"has-background":o||p||u||A,[B]:B,[b]:b,"no-border-radius":0===l,"has-custom-width":!!f,[`has-${C}-font-size`]:!!C,"has-custom-font-size":!!C}),y={background:A||void 0,backgroundColor:B||A||p?void 0:u,fontSize:e.style?.typography?.fontSize,color:k?void 0:g,borderRadius:l?l+"px":void 0,width:f};return(0,r.createElement)("div",{className:v},(0,r.createElement)(a.RichText.Content,{className:I,"data-id-attr":n||"placeholder",href:E,id:n,rel:"noopener noreferrer",role:"button",style:y,tagName:"a",target:"_blank",value:m}))}},16969:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818),a=n(69307),o=n(92819);function s({attributes:e,clientId:t,setAttributes:n}){const{passthroughAttributes:s}=e,{attributesToSync:i}=(0,r.useSelect)((n=>{const{getBlockAttributes:r,getBlockRootClientId:a}=n("core/block-editor"),i=r(a(t))||{},l=(0,o.mapValues)(s,(e=>i[e]));return{attributesToSync:(0,o.pickBy)(l,((t,n)=>t!==e[n]))}}));(0,a.useEffect)((()=>{(0,o.isEmpty)(i)||n(i)}),[i,n])}},39964:(e,t,n)=>{"use strict";n.d(t,{l:()=>r});const r="https://calendly.com/wpcom/jetpack-block-example"},60153:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>A});var r=n(51806),a=n(13419),o=n(52175),s=n(55609),i=n(65736),l=n(57538);const __=i.__,_x=i._x,c=({onEditClick:e})=>(0,r.createElement)(s.ToolbarGroup,null,(0,r.createElement)(s.ToolbarButton,{onClick:()=>e(!0)},__("Edit","jetpack"))),u=e=>{const{attributes:{hideEventTypeDetails:t,url:n},defaultClassName:o,embedCode:i,parseEmbedCode:l,setAttributes:c,setEmbedCode:u}=e;let A=null;return n&&(A=(0,a.Ug)()||(0,a.Wp)()?"https://wordpress.com/support/wordpress-editor/blocks/calendly-block/#customize-the-calendly-block":"https://jetpack.com/support/jetpack-blocks/calendly-block/#customizing-a-calendly-block"),(0,r.createElement)(r.Fragment,null,(0,r.createElement)(s.PanelBody,{PanelBody:!0,title:__("Calendar settings","jetpack"),initialOpen:!1},(0,r.createElement)("form",{onSubmit:l,className:`${o}-embed-form-sidebar`},(0,r.createElement)("input",{type:"text",id:"embedCode",onChange:e=>u(e.target.value),placeholder:__("Calendly web address or embed code…","jetpack"),value:i||"",className:"components-placeholder__input"}),(0,r.createElement)("div",null,(0,r.createElement)(s.Button,{variant:"secondary",type:"submit"},_x("Embed","button label","jetpack")))),(0,r.createElement)(s.ToggleControl,{label:__("Hide event type details","jetpack"),checked:t,onChange:()=>c({hideEventTypeDetails:!t})})),A&&(0,r.createElement)(s.Notice,{className:`${o}-color-notice`,isDismissible:!1},(0,r.createElement)(s.ExternalLink,{href:A},__("Explore more customization options.","jetpack"))))},A=e=>{const{attributes:t,clientId:n,isEditingUrl:a,setAttributes:s,setIsEditingUrl:i}=e,{style:A,url:g}=t,p=[{value:"inline",label:__("Inline","jetpack")},{value:"link",label:__("Link","jetpack")}];return(0,r.createElement)(r.Fragment,null,g&&!a&&(0,r.createElement)(o.BlockControls,null,(0,r.createElement)(c,{onEditClick:i})),g&&(0,r.createElement)(l.Z,{clientId:n,styleOptions:p,onSelectStyle:s,activeStyle:A,attributes:t,viewportWidth:500}),(0,r.createElement)(o.InspectorControls,null,(0,r.createElement)(u,e)))}},83830:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(4981),o=n(65736),s=n(24381);const __=o.__,i={attributes:{backgroundColor:{type:"string",default:"ffffff",validator:s.Z},submitButtonText:{type:"string",default:__("Schedule time with me","jetpack")},submitButtonTextColor:{type:"string"},submitButtonBackgroundColor:{type:"string"},submitButtonClasses:{type:"string"},hideEventTypeDetails:{type:"boolean",default:!1},primaryColor:{type:"string",default:"00A2FF",validator:s.Z},textColor:{type:"string",default:"4D5055",validator:s.Z},style:{type:"string",default:"inline",validValues:["inline","link"]},url:{type:"string",validator:e=>!e||e.startsWith("https://calendly.com/")},backgroundButtonColor:{type:"string"},textButtonColor:{type:"string"},customBackgroundButtonColor:{type:"string",validator:s.Z},customTextButtonColor:{type:"string",validator:s.Z}},migrate:e=>{const{submitButtonText:t,submitButtonTextColor:n,submitButtonBackgroundColor:r,submitButtonClasses:o,backgroundButtonColor:s,textButtonColor:i,customBackgroundButtonColor:l,customTextButtonColor:c,...u}=e,A={text:(g=e).submitButtonText||__("Schedule time with me","jetpack"),textColor:g.submitButtonTextColor||g.textButtonColor,customTextColor:g.customTextButtonColor,backgroundColor:g.submitButtonBackgroundColor||g.backgroundButtonColor,customBackgroundColor:g.customBackgroundButtonColor,url:g.url};var g;return[u,[(0,a.createBlock)("jetpack/button",{element:"a",uniqueId:"calendly-widget-id",...A})]]},save:({attributes:{url:e}})=>(0,r.createElement)("a",{href:e},e)}},29415:(e,t,n)=>{"use strict";n.d(t,{Z:()=>y});var r=n(82674),a=n.n(r),o=n(51806),s=n(13419),i=n(52175),l=n(4981),c=n(55609),u=n(9818),A=n(69307),g=n(65736),p=n(65235),d=n.n(p),m=n(92819),h=n(4554),E=n(23621),f=n(23329),C=n(39964),B=n(60153),b=n(4867);const __=g.__,_x=g._x,k="jetpack/button",v={element:"a",text:__("Schedule time with me","jetpack"),uniqueId:"calendly-widget-id",url:C.l},I=(0,s.dM)(f);const y=(0,c.withNotices)((function(e){const{attributes:t,clientId:n,name:r,noticeOperations:s,noticeUI:g,setAttributes:p}=e,y=(0,l.getBlockDefaultClassName)(r),w=(0,h.S)(f.attributes,t);(0,m.isEqual)(w,t)||p(w);const{backgroundColor:Q,hideEventTypeDetails:_,primaryColor:S,textColor:j,style:x,url:L}=w,[P,T]=(0,A.useState)(L),[D,N]=(0,A.useState)(!1),[R,Z]=(0,A.useState)(!1),[M,F]=(0,A.useState)({}),U=(0,i.useBlockProps)(),O=()=>{s.removeAllNotices(),s.createErrorNotice(__("Your calendar couldn't be embedded. Please double check your URL or code.","jetpack"))};(0,A.useEffect)((()=>{L&&C.l!==L&&"link"!==x&&(0,E.Z)(L,Z).catch((()=>{p({url:void 0}),O()}))}),[]);const z=e=>{if(!e)return void O();e.preventDefault();const t=(0,b.CC)(P);if(t){if(t.buttonAttributes&&"link"===t.style){const e=(0,u.select)("core/editor").getBlocksByClientId(n);e.length&&e[0].innerBlocks.forEach((e=>{(0,u.dispatch)("core/editor").updateBlockAttributes(e.clientId,t.buttonAttributes)})),F(t.buttonAttributes)}(0,E.Z)(t.url,Z).then((()=>{const e=(0,h.S)(f.attributes,t);p(e),N(!1),s.removeAllNotices()})).catch((()=>{p({url:void 0}),O()}))}else O()},H=(0,o.createElement)("div",{className:"wp-block-embed is-loading"},(0,o.createElement)(c.Spinner,null),(0,o.createElement)("p",null,__("Embedding…","jetpack"))),q=(0,o.createElement)(c.Placeholder,{label:__("Calendly","jetpack"),instructions:__("Enter your Calendly web address or embed code below.","jetpack"),icon:I,notices:g},(0,o.createElement)("form",{onSubmit:z},(0,o.createElement)("input",{type:"text",id:"embedCode",onChange:e=>T(e.target.value),placeholder:__("Calendly web address or embed code…","jetpack"),value:P||"",className:"components-placeholder__input"}),(0,o.createElement)("div",null,(0,o.createElement)(c.Button,{variant:"secondary",type:"submit"},_x("Embed","button label","jetpack")))),(0,o.createElement)("div",{className:`${y}-learn-more`},(0,o.createElement)(c.ExternalLink,{href:"https://help.calendly.com/hc/en-us/articles/223147027-Embed-options-overview"},__("Need help finding your embed code?","jetpack")))),$=(0,o.createElement)(o.Fragment,null,(0,o.createElement)("div",{className:`${y}-overlay`}),(0,o.createElement)("iframe",{src:(()=>{const e=new URLSearchParams({embed_domain:"wordpress.com",embed_type:"Inline",hide_event_type_details:_?1:0,background_color:Q,primary_color:S,text_color:j});return`${L}?${e}`})(),width:"100%",height:"100%",frameBorder:"0","data-origwidth":"100%","data-origheight":"100%",title:"Calendly"})),V=(0,o.createElement)(i.InnerBlocks,{template:[[k,{...v,...M,passthroughAttributes:{url:"url"}}]],templateLock:"all"});return R?H:(0,o.createElement)("div",a()({},U,{className:d()(U.className,{[`calendly-style-${x}`]:L&&!D})}),(0,o.createElement)(B.ZP,a()({},e,{defaultClassName:y,embedCode:P,isEditingUrl:D,parseEmbedCode:z,setEmbedCode:T,setIsEditingUrl:N})),L&&!D?"inline"===x?$:V:q)}))},52020:(e,t,n)=>{"use strict";var r=n(4981),a=n(31985),o=n(23329),s=n(83830),i=n(29415),l=n(15816),c=n(4867);(0,a.S)(o,{edit:i.Z,save:l.Z,transforms:{from:[{type:"raw",isMatch:e=>"P"===e.nodeName&&c.mL.test(e.textContent),transform:e=>{const t=(0,c.CC)(e.textContent);return(0,r.createBlock)("jetpack/calendly",t)}}]},deprecated:[s.Z]})},15816:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(52175);function o(){const e=a.useBlockProps.save();return(0,r.createElement)("div",e,(0,r.createElement)(a.InnerBlocks.Content,null))}},4867:(e,t,n)=>{"use strict";n.d(t,{CC:()=>a,mL:()=>r});const r=/(^|\/\/)(calendly\.com[^"']*)/i,a=e=>{if(!e)return;const t=(e=>{const t=e.match(r);if(t)return"https://"+t[2]})(e);if(!t)return;const n=(e=>{const t={},n=new URL(e);if(t.url=n.origin+n.pathname,!n.search)return t;const r=new URLSearchParams(n.search),a=r.get("background_color"),o=r.get("primary_color"),s=r.get("text_color"),i=/^[A-Za-z0-9]{6}$/;return r.get("hide_event_type_details")&&(t.hideEventTypeDetails=r.get("hide_event_type_details")),a&&a.match(i)&&(t.backgroundColor=a),o&&o.match(i)&&(t.primaryColor=o),s&&s.match(i)&&(t.textColor=s),t})(t),a=(e=>e.indexOf("data-url")>0?"inline":e.indexOf("initPopupWidget")>0||e.indexOf("initBadgeWidget")>0?"link":void 0)(e);if(a&&(n.style=a),"link"===a){n.buttonAttributes={};const t=(e=>{let t=e.match(/false;">([^<]+)<\//);return t?t[1]:(t=e.match(/text: '([^']*?)'/),t?t[1]:void 0)})(e);t&&(n.buttonAttributes.text=t);const r=(e=>{const t=e.match(/textColor: '([^']*?)'/);if(t)return t[1]})(e);r&&(n.buttonAttributes.textColor=void 0,n.buttonAttributes.customTextColor=r);const a=(e=>{const t=e.match(/color: '([^']*?)'/);if(t)return t[1]})(e);a&&(n.buttonAttributes.backgroundColor=void 0,n.buttonAttributes.customBackgroundColor=a)}return n}},36553:(e,t,n)=>{"use strict";n.d(t,{Z:()=>g});var r=n(51806),a=n(52175),o=n(55609),s=n(69307),i=n(65736),l=n(65235),c=n.n(l),u=n(35208);const __=i.__;class A extends s.Component{constructor(...e){super(...e),this.preventEnterKey=this.preventEnterKey.bind(this)}preventEnterKey(e){"Enter"!==e.key||e.preventDefault()}render(){const{attributes:{address:e,addressLine2:t,addressLine3:n,city:i,region:l,postal:A,country:g,linkToGoogleMaps:p},isSelected:d,setAttributes:m}=this.props,h=[e,t,n,i,l,A,g].some((e=>""!==e)),E=c()({"jetpack-address-block":!0,"is-selected":d}),f=(0,r.createElement)(o.ToggleControl,{label:__("Link address to Google Maps","jetpack"),checked:p,onChange:e=>m({linkToGoogleMaps:e})});return(0,r.createElement)("div",{className:E},!d&&h&&(0,u.Z)(this.props),(d||!h)&&(0,r.createElement)(s.Fragment,null,(0,r.createElement)(a.PlainText,{value:e,placeholder:__("Street Address","jetpack"),"aria-label":__("Street Address","jetpack"),onChange:e=>m({address:e}),onKeyDown:this.preventEnterKey}),(0,r.createElement)(a.PlainText,{value:t,placeholder:__("Address Line 2","jetpack"),"aria-label":__("Address Line 2","jetpack"),onChange:e=>m({addressLine2:e}),onKeyDown:this.preventEnterKey}),(0,r.createElement)(a.PlainText,{value:n,placeholder:__("Address Line 3","jetpack"),"aria-label":__("Address Line 3","jetpack"),onChange:e=>m({addressLine3:e}),onKeyDown:this.preventEnterKey}),(0,r.createElement)(a.PlainText,{value:i,placeholder:__("City","jetpack"),"aria-label":__("City","jetpack"),onChange:e=>m({city:e}),onKeyDown:this.preventEnterKey}),(0,r.createElement)(a.PlainText,{value:l,placeholder:__("State/Province/Region","jetpack"),"aria-label":__("State/Province/Region","jetpack"),onChange:e=>m({region:e}),onKeyDown:this.preventEnterKey}),(0,r.createElement)(a.PlainText,{value:A,placeholder:__("Postal/Zip Code","jetpack"),"aria-label":__("Postal/Zip Code","jetpack"),onChange:e=>m({postal:e}),onKeyDown:this.preventEnterKey}),(0,r.createElement)(a.PlainText,{value:g,placeholder:__("Country","jetpack"),"aria-label":__("Country","jetpack"),onChange:e=>m({country:e}),onKeyDown:this.preventEnterKey}),f))}}const g=A},11005:(e,t,n)=>{"use strict";n.d(t,{X:()=>A,u:()=>u});var r=n(51806),a=n(55609),o=n(69307),s=n(65736),i=n(36598),l=n(36553),c=n(35208);const __=s.__,_x=s._x,u="address",A={title:__("Address","jetpack"),description:__("Lets you add a physical address with Schema markup.","jetpack"),keywords:[_x("location","block search term","jetpack"),_x("direction","block search term","jetpack"),_x("place","block search term","jetpack")],icon:(0,i.Z)((0,r.createElement)(o.Fragment,null,(0,r.createElement)(a.Path,{d:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zM7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 2.88-2.88 7.19-5 9.88C9.92 16.21 7 11.85 7 9z"}),(0,r.createElement)(a.Circle,{cx:"12",cy:"9",r:"2.5"}))),category:"grow",attributes:{address:{type:"string",default:""},addressLine2:{type:"string",default:""},addressLine3:{type:"string",default:""},city:{type:"string",default:""},region:{type:"string",default:""},postal:{type:"string",default:""},country:{type:"string",default:""},linkToGoogleMaps:{type:"boolean",default:!1}},parent:["jetpack/contact-info"],edit:l.Z,save:c.Z}},35208:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(69307),o=n(65736);const __=o.__,s=({attributes:{address:e,addressLine2:t,addressLine3:n,city:o,region:s,postal:i,country:l}})=>(0,r.createElement)(a.Fragment,null,e&&(0,r.createElement)("div",{className:"jetpack-address__address jetpack-address__address1"},e),t&&(0,r.createElement)("div",{className:"jetpack-address__address jetpack-address__address2"},t),n&&(0,r.createElement)("div",{className:"jetpack-address__address jetpack-address__address3"},n),o&&!(s||i)&&(0,r.createElement)("div",{className:"jetpack-address__city"},o),o&&(s||i)&&(0,r.createElement)("div",null,(0,r.createElement)("span",{className:"jetpack-address__city"},o),", ",(0,r.createElement)("span",{className:"jetpack-address__region"},s)," ",(0,r.createElement)("span",{className:"jetpack-address__postal"},i)),!o&&(s||i)&&(0,r.createElement)("div",null,(0,r.createElement)("span",{className:"jetpack-address__region"},s)," ",(0,r.createElement)("span",{className:"jetpack-address__postal"},i)),l&&(0,r.createElement)("div",{className:"jetpack-address__country"},l)),i=({attributes:{address:e,addressLine2:t,addressLine3:n,city:r,region:a,postal:o,country:s}})=>{let i=a?`+${a},`:"";i=o?`${i}+${o}`:i;return`https://www.google.com/maps/search/${e?`${e},`:""}${t?`${t},`:""}${n?`${n},`:""}${r?`+${r},`:""}${i}${s?`+${s}`:""}`.replace(" ","+")},l=e=>(({address:e,addressLine2:t,addressLine3:n,city:r,region:a,postal:o,country:s})=>[e,t,n,r,a,o,s].some((e=>""!==e)))(e.attributes)&&(0,r.createElement)("div",{className:e.className},e.attributes.linkToGoogleMaps&&(0,r.createElement)("a",{href:i(e),target:"_blank",rel:"noopener noreferrer",title:__("Open address in Google Maps","jetpack")},(0,r.createElement)(s,e)),!e.attributes.linkToGoogleMaps&&(0,r.createElement)(s,e))},83238:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(82674),a=n.n(r),o=n(51806),s=n(52175),i=n(65235),l=n.n(i);const c=["jetpack/markdown","jetpack/address","jetpack/email","jetpack/phone","jetpack/map","jetpack/business-hours","core/paragraph","core/image","core/heading","core/gallery","core/list","core/quote","core/shortcode","core/audio","core/code","core/cover","core/html","core/separator","core/spacer","core/subhead","core/video"],u=[["jetpack/email"],["jetpack/phone"],["jetpack/address"]],A=e=>{const{isSelected:t}=e,n=(0,s.useBlockProps)();return(0,o.createElement)("div",a()({},n,{className:l()(n.className,{"jetpack-contact-info-block":!0,"is-selected":t})}),(0,o.createElement)(s.InnerBlocks,{allowedBlocks:c,templateLock:!1,template:u}))}},82566:(e,t,n)=>{"use strict";var r=n(4981),a=n(31985),o=n(11005),s=n(58891),i=n(83238),l=n(99804),c=n(52398),u=n(56162);(0,a.S)(s,{edit:i.Z,save:u.Z,transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>!!t?.raw&&"widget_contact_info"===e,transform:({instance:e})=>{let t=[(0,r.createBlock)("core/heading",{content:e.raw.title}),(0,r.createBlock)("jetpack/email",{email:e.raw.email}),(0,r.createBlock)("jetpack/phone",{phone:e.raw.phone}),(0,r.createBlock)("jetpack/address",{address:e.raw.address})];return e.raw.hours&&(t=[...t,(0,r.createBlock)("core/paragraph",{content:e.raw.hours})]),e.raw.showmap&&e.raw.address&&(t=[...t,(0,r.createBlock)("jetpack/map",{address:e.raw.address})]),(0,r.createBlock)("jetpack/contact-info",{},t)}}]}},[{name:o.u,settings:o.X},{name:l.u,settings:l.X},{name:c.u,settings:c.X}])},31336:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(65736),a=n(66425),o=n(90458);const __=r.__,s=e=>{const{setAttributes:t}=e;return(0,a.Z)("email",e,__("Email","jetpack"),o.Z,(e=>t({email:e})))}},99804:(e,t,n)=>{"use strict";n.d(t,{X:()=>u,u:()=>c});var r=n(51806),a=n(55609),o=n(65736),s=n(36598),i=n(31336),l=n(90458);const __=o.__,_x=o._x,c="email",u={title:__("Email Address","jetpack"),description:__("Lets you add an email address with an automatically generated click-to-email link.","jetpack"),keywords:["e-mail","email",_x("message","block search term","jetpack")],icon:(0,s.Z)((0,r.createElement)(a.Path,{d:"M22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6zm-2 0l-8 5-8-5h16zm0 12H4V8l8 5 8-5v10z"})),category:"grow",attributes:{email:{type:"string",default:""}},edit:i.Z,save:l.Z,parent:["jetpack/contact-info"]}},90458:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(69307),o=n(92384);const s=({attributes:{email:e},className:t})=>e&&(0,r.createElement)("div",{className:t},e.split(/(\s+)/).map(((e,t)=>{const n=e.replace(/([.,/#!$%^&*;:{}=\-_`~()\][])+$/g,"");return e.indexOf("@")&&o.validate(n)?e===n?(0,r.createElement)("a",{href:`mailto:${e}`,key:t},e):(0,r.createElement)(a.Fragment,{key:t},(0,r.createElement)("a",{href:`mailto:${e}`,key:t},n),(0,r.createElement)(a.Fragment,null,e.slice(-(e.length-n.length)))):(0,r.createElement)(a.Fragment,{key:t},e)})))},70835:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(65736),a=n(66425),o=n(21621);const __=r.__,s=e=>{const{setAttributes:t}=e;return(0,a.Z)("phone",e,__("Phone number","jetpack"),o.Z,(e=>t({phone:e})))}},52398:(e,t,n)=>{"use strict";n.d(t,{X:()=>u,u:()=>c});var r=n(51806),a=n(55609),o=n(65736),s=n(36598),i=n(70835),l=n(21621);const __=o.__,_x=o._x,c="phone",u={title:__("Phone Number","jetpack"),description:__("Lets you add a phone number with an automatically generated click-to-call link.","jetpack"),keywords:[_x("mobile","block search term","jetpack"),_x("telephone","block search term","jetpack"),_x("cell","block search term","jetpack")],icon:(0,s.Z)((0,r.createElement)(a.Path,{d:"M6.54 5c.06.89.21 1.76.45 2.59l-1.2 1.2c-.41-1.2-.67-2.47-.76-3.79h1.51m9.86 12.02c.85.24 1.72.39 2.6.45v1.49c-1.32-.09-2.59-.35-3.8-.75l1.2-1.19M7.5 3H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.49c0-.55-.45-1-1-1-1.24 0-2.45-.2-3.57-.57-.1-.04-.21-.05-.31-.05-.26 0-.51.1-.71.29l-2.2 2.2c-2.83-1.45-5.15-3.76-6.59-6.59l2.2-2.2c.28-.28.36-.67.25-1.02C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1z"})),category:"grow",attributes:{phone:{type:"string",default:""}},parent:["jetpack/contact-info"],edit:i.Z,save:l.Z}},21621:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(51806);const a=({attributes:{phone:e},className:t})=>e&&(0,r.createElement)("div",{className:t},function(e){const t=e.match(/\d+\.\d+|\d+\b|\d+(?=\w)/g);if(!t)return e;const n=e.indexOf(t[0]);let a=n?e.substring(n-1):e,o=n?e.substring(0,n):"",s=a.replace(/\D/g,"");return/[0-9/+/(]/.test(a[0])?(o=o.slice(0,-1),"+"===a[0]&&(s="+"+s)):a=a.substring(1),[o.trim()?(0,r.createElement)("span",{key:"phonePrefix",className:"phone-prefix"},o):null,(0,r.createElement)("a",{key:"phoneNumber",href:`tel:${s}`},a)]}(e))},56162:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(52175);const o=()=>{const e=a.useBlockProps.save();return(0,r.createElement)("div",e,(0,r.createElement)(a.InnerBlocks.Content,null))}},10764:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(25607),o=n(43317),s=n(52175),i=n(69307),l=n(65235),c=n.n(l),u=n(79162);const A=({className:e=null,currency:t=null,defaultValue:n=null,disabled:l=!1,label:A="",onChange:g=null,value:p=""})=>{const[d,m]=(0,i.useState)((0,a.ZP)(p,t,{symbol:""})),[h,E]=(0,i.useState)(!1),[f,C]=(0,i.useState)(!1),B=(0,i.useRef)(null),b=(0,i.useCallback)((e=>{if(m(e),!g)return;const n=(0,u.Vm)(e,t);n&&n>=(0,u.hj)(t)?(g(n),C(!1)):C(!0)}),[t,g]),k=()=>{B.current&&(B.current.focus(),E(!0))};return(0,i.useEffect)((()=>{if(!B.current)return;const e=B.current,r=()=>{E(!1),d||b((0,a.ZP)(n,t,{symbol:""}))};return e.addEventListener("blur",r),()=>{e.removeEventListener("blur",r)}}),[t,n,d,B,b]),(0,i.useEffect)((()=>{h||f||m((0,a.ZP)(p,t,{symbol:""}))}),[t,h,f,b,p]),(0,i.useEffect)((()=>{b((0,a.ZP)(p,t,{symbol:""}))}),[p]),(0,r.createElement)("div",{className:c()("donations__amount",e,{"has-focus":h,"has-error":f}),role:"button",tabIndex:0,onClick:k,onKeyDown:k},o.M[t].symbol,l?(0,r.createElement)("div",{className:"donations__amount-value"},(0,a.ZP)(p||n,t,{symbol:""})):(0,r.createElement)(s.RichText,{allowedFormats:[],"aria-label":A,onChange:e=>b(e),placeholder:(0,a.ZP)(n,t,{symbol:""}),ref:B,value:d,withoutInteractiveFormatting:!0}))}},82275:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(43317),o=n(13419),s=n(52175),i=n(55609),l=n(65736),c=n(39630),u=n(79162);const __=l.__,A=e=>{const{attributes:t,setAttributes:n}=e,{currency:l,oneTimeDonation:A,monthlyDonation:g,annualDonation:p,showCustomAmount:d}=t,m=(e,r)=>{const a={"1 month":"monthlyDonation","1 year":"annualDonation"}[e],o=t[a];n({[a]:{...o,show:r}})};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(s.BlockControls,null,(0,r.createElement)(i.ToolbarGroup,null,(0,r.createElement)(i.ToolbarItem,null,(()=>(0,r.createElement)(i.Dropdown,{contentClassName:"jetpack-donations__currency-popover",renderToggle:({onToggle:e,isOpen:t})=>(0,r.createElement)(i.Button,{className:"jetpack-donations__currency-toggle",icon:(0,r.createElement)(r.Fragment,null,l+" - "+a.M[l].symbol,(0,r.createElement)(i.Dashicon,{icon:"arrow-down"})),label:__("Change currency","jetpack"),onClick:e,onKeyDown:n=>{t||n.keyCode!==c.DOWN||(n.preventDefault(),n.stopPropagation(),e())}}),renderContent:({onClose:e})=>(0,r.createElement)(i.MenuGroup,null,Object.keys(u.ck).map((t=>(0,r.createElement)(i.MenuItem,{isSelected:t===l,icon:t===l?"yes":"",onClick:()=>{(e=>{const t=(0,u.li)(e);n({currency:e,oneTimeDonation:{...A,amounts:t},monthlyDonation:{...g,amounts:t},annualDonation:{...p,amounts:t}})})(t),e()},key:`jetpack-donations-currency-${t}`},t+" - "+a.M[t].symbol))))}))))),(0,r.createElement)(s.InspectorControls,null,(0,r.createElement)(i.PanelBody,{title:__("Settings","jetpack")},(0,r.createElement)(i.ToggleControl,{checked:g.show,onChange:e=>m("1 month",e),label:__("Show monthly donations","jetpack")}),(0,r.createElement)(i.ToggleControl,{checked:p.show,onChange:e=>m("1 year",e),label:__("Show annual donations","jetpack")}),(0,r.createElement)(i.ToggleControl,{checked:d,onChange:e=>n({showCustomAmount:e}),label:__("Show custom amount option","jetpack")}),(0,r.createElement)(i.ExternalLink,{href:`https://wordpress.com/earn/payments/${(0,o.lQ)()}`},__("View donation earnings","jetpack")))))}},853:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(51806),a=n(25607),o=n(43317),s=n(52175),i=n(65736),l=n(79162);const __=i.__,c={attributes:{currency:{type:"string",default:"USD"},oneTimeDonation:{type:"object",default:{show:!0,planId:null,amounts:[5,15,100],heading:__("Make a one-time donation","jetpack"),extraText:__("Your contribution is appreciated.","jetpack"),buttonText:__("Donate","jetpack")}},monthlyDonation:{type:"object",default:{show:!0,planId:null,amounts:[5,15,100],heading:__("Make a monthly donation","jetpack"),extraText:__("Your contribution is appreciated.","jetpack"),buttonText:__("Donate monthly","jetpack")}},annualDonation:{type:"object",default:{show:!0,planId:null,amounts:[5,15,100],heading:__("Make a yearly donation","jetpack"),extraText:__("Your contribution is appreciated.","jetpack"),buttonText:__("Donate yearly","jetpack")}},showCustomAmount:{type:"boolean",default:!0},chooseAmountText:{type:"string",default:__("Choose an amount","jetpack")},customAmountText:{type:"string",default:__("Or enter a custom amount","jetpack")}},supports:{html:!1},save:({attributes:e})=>{const{currency:t,oneTimeDonation:n,monthlyDonation:i,annualDonation:c,showCustomAmount:u,chooseAmountText:A,customAmountText:g}=e;if(!n||!n.show||-1===n.planId)return null;const p={"one-time":{title:__("One-Time","jetpack")},...i.show&&{"1 month":{title:__("Monthly","jetpack")}},...c.show&&{"1 year":{title:__("Yearly","jetpack")}}};return(0,r.createElement)("div",null,(0,r.createElement)("div",{className:"donations__container"},Object.keys(p).length>1&&(0,r.createElement)("div",{className:"donations__nav"},Object.entries(p).map((([e,{title:t}])=>(0,r.createElement)("div",{role:"button",tabIndex:0,className:"donations__nav-item",key:`jetpack-donations-nav-item-${e} `,"data-interval":e},t)))),(0,r.createElement)("div",{className:"donations__content"},(0,r.createElement)("div",{className:"donations__tab"},(0,r.createElement)(s.RichText.Content,{tagName:"h4",className:"donations__one-time-item",value:n.heading}),i.show&&(0,r.createElement)(s.RichText.Content,{tagName:"h4",className:"donations__monthly-item",value:i.heading}),c.show&&(0,r.createElement)(s.RichText.Content,{tagName:"h4",className:"donations__annual-item",value:c.heading}),(0,r.createElement)(s.RichText.Content,{tagName:"p",value:A}),(0,r.createElement)("div",{className:"donations__amounts donations__one-time-item"},n.amounts.map((e=>(0,r.createElement)("div",{className:"donations__amount","data-amount":e},(0,a.ZP)(e,t))))),i.show&&(0,r.createElement)("div",{className:"donations__amounts donations__monthly-item"},i.amounts.map((e=>(0,r.createElement)("div",{className:"donations__amount","data-amount":e},(0,a.ZP)(e,t))))),c.show&&(0,r.createElement)("div",{className:"donations__amounts donations__annual-item"},c.amounts.map((e=>(0,r.createElement)("div",{className:"donations__amount","data-amount":e},(0,a.ZP)(e,t))))),u&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(s.RichText.Content,{tagName:"p",value:g}),(0,r.createElement)("div",{className:"donations__amount donations__custom-amount"},o.M[t].symbol,(0,r.createElement)("div",{className:"donations__amount-value","data-currency":t,"data-empty-text":(0,a.ZP)(100*(0,l.hj)(t),t,{symbol:""})}))),(0,r.createElement)("div",{className:"donations__separator"},"——"),(0,r.createElement)(s.RichText.Content,{tagName:"p",className:"donations__one-time-item",value:n.extraText}),i.show&&(0,r.createElement)(s.RichText.Content,{tagName:"p",className:"donations__monthly-item",value:i.extraText}),c.show&&(0,r.createElement)(s.RichText.Content,{tagName:"p",className:"donations__annual-item",value:c.extraText}),(0,r.createElement)("div",{className:"wp-block-button donations__donate-button-wrapper donations__one-time-item"},(0,r.createElement)(s.RichText.Content,{tagName:"a",className:"wp-block-button__link donations__donate-button donations__one-time-item",value:n.buttonText})),i.show&&(0,r.createElement)("div",{className:"wp-block-button donations__donate-button-wrapper donations__monthly-item"},(0,r.createElement)(s.RichText.Content,{tagName:"a",className:"wp-block-button__link donations__donate-button donations__monthly-item",value:i.buttonText})),c.show&&(0,r.createElement)("div",{className:"wp-block-button donations__donate-button-wrapper donations__annual-item"},(0,r.createElement)(s.RichText.Content,{tagName:"a",className:"wp-block-button__link donations__donate-button donations__annual-item",value:c.buttonText}))))))}}},86245:(e,t,n)=>{"use strict";n.d(t,{Z:()=>B});var r=n(82674),a=n.n(r),o=n(51806),s=n(45033),i=n(52175),l=n(9818),c=n(69307),u=n(65736),A=n(16367),g=n(79162),p=n(74251),d=n(7652),m=n(23267),h=n(21789),E=n(85731),f=n(24177),C=n(72833);const __=u.__,B=e=>{const{attributes:t,setAttributes:n}=e,{currency:r}=t,u=(0,i.useBlockProps)(),[B,b]=(0,c.useState)(""),[k,v]=(0,c.useState)([]),{lockPostSaving:I,unlockPostSaving:y}=(0,l.useDispatch)("core/editor"),w=(0,l.useSelect)((e=>e("core/editor").getCurrentPost()),[]),Q=(0,l.useSelect)((e=>e(d.h).getConnectUrl()),""),{setConnectUrl:_,setConnectedAccountDefaultCurrency:S}=(0,l.useDispatch)(m.G4);(0,c.useEffect)((()=>{n({fallbackLinkUrl:w.link})}),[w.link,n]);const j=(0,l.useSelect)((e=>e(m.G4).getConnectedAccountDefaultCurrency()));(0,c.useEffect)((()=>{if(!r&&j){const e=j.toUpperCase(),t=!!g.ck[e];n(t?{currency:e}:{currency:"USD"})}}),[r,j,n]);const x=e=>{b(e)};let L;return(0,c.useEffect)((()=>{I("donations");const e=e=>e.reduce(((e,{id:t,currency:n,type:a,interval:o})=>(n===r&&"donation"===a&&(e[o]=t),e)),{});(0,E.Z)("donation").then((t=>{if(!t&&"object"!=typeof t||t.errors)return y("donations"),void b(__("Could not load data from WordPress.com.","jetpack"));_((0,p.Z)(w.id,t.connect_url)),S(t?.connected_account_default_currency?.toUpperCase());const n=e(t.products);return(e=>{const t=Object.keys(e);return t.includes("one-time")&&t.includes("1 month")&&t.includes("1 year")})(n)?(v(n),void y("donations")):t.connect_url?(v({"one-time":-1,"1 month":-1,"1 year":-1}),void y("donations")):void(r&&(0,h.Z)(r).then((t=>{v(e(t)),y("donations")}),x))}),x)}),[I,r,w.id,_,S,y]),L=B?(0,o.createElement)(f.Z,{error:B}):Q?(0,o.createElement)(A.U,{blockName:"donations"}):r?(0,o.createElement)(C.Z,a()({},e,{products:k})):(0,o.createElement)(s.Z,{color:"black"}),(0,o.createElement)("div",u,L)}},67140:(e,t,n)=>{"use strict";var r=n(31985),a=n(98826),o=n(853),s=n(86245),i=n(75314);(0,r.S)(a,{edit:s.Z,save:i.Z,deprecated:[o.Z]})},21789:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(86989),a=n.n(r);const o=async e=>{try{return await a()({path:"/wpcom/v2/memberships/products",method:"POST",data:{type:"donation",currency:e,is_editable:!1}})}catch(e){return Promise.reject(e.message)}}},85731:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(86989),a=n.n(r),o=n(96483);const s=async(e=null)=>{const t=new URLSearchParams(window.location.search),n=(0,o.addQueryArgs)("/wpcom/v2/memberships/status",{source:"https://wordpress.com"===t.get("origin")?"gutenberg-wpcom":"gutenberg",...e&&{type:e},is_editable:!1});try{return await a()({path:n,method:"GET"})}catch(e){return Promise.reject(e.message)}}},24177:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(55609),o=n(65736);const __=o.__,s=({error:e})=>(0,r.createElement)(a.Placeholder,{icon:"lock",label:__("Donations","jetpack"),instructions:e})},75314:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(52175);const o=(0,n(34943).X)(),s=({attributes:e})=>{const t=a.useBlockProps.save(),{fallbackLinkUrl:n,oneTimeDonation:s,monthlyDonation:i,annualDonation:l}=e;return s&&s.show&&s.planId&&-1!==s.planId?(0,r.createElement)("div",t,(0,r.createElement)(a.RichText.Content,{tagName:"h4",value:o.oneTimeDonation?.heading}),(0,r.createElement)(a.RichText.Content,{tagName:"p",value:s.extraText??o.extraText}),(0,r.createElement)(a.RichText.Content,{tagName:"a",className:"jetpack-donations-fallback-link",href:n,rel:"noopener noreferrer noamphtml",target:"_blank",value:o.oneTimeDonation?.buttonText}),i.show&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("hr",{className:"donations__separator"}),(0,r.createElement)(a.RichText.Content,{tagName:"h4",value:o.monthlyDonation?.heading}),(0,r.createElement)(a.RichText.Content,{tagName:"p",value:i.extraText??o.extraText}),(0,r.createElement)(a.RichText.Content,{tagName:"a",className:"jetpack-donations-fallback-link",href:n,rel:"noopener noreferrer noamphtml",target:"_blank",value:o.monthlyDonation?.buttonText})),l.show&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("hr",{className:"donations__separator"}),(0,r.createElement)(a.RichText.Content,{tagName:"h4",value:o.annualDonation?.heading}),(0,r.createElement)(a.RichText.Content,{tagName:"p",value:l.extraText??o.extraText}),(0,r.createElement)(a.RichText.Content,{tagName:"a",className:"jetpack-donations-fallback-link",href:n,rel:"noopener noreferrer noamphtml",target:"_blank",value:o.annualDonation?.buttonText}))):null}},91757:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(52175),o=n(9818),s=n(65736),i=n(79162),l=n(10764),c=n(34943);const __=s.__,u=(0,c.X)(),A=({activeTab:e,attributes:t,setAttributes:n})=>{const{currency:c,oneTimeDonation:A,monthlyDonation:g,annualDonation:p,showCustomAmount:d,chooseAmountText:m=u.chooseAmountText,customAmountText:h=u.customAmountText}=t,E={"one-time":"oneTimeDonation","1 month":"monthlyDonation","1 year":"annualDonation"}[e],f=e=>t[E][e],C=(e,r)=>{const a=t[E];n({[E]:{...a,[e]:r}})},B=(0,i.li)(c),b=f("amounts"),k=(0,o.useSelect)((e=>e("core/rich-text").getFormatTypes()),[]).map((e=>e.name)).filter((e=>"core/link"!==e));return(0,r.createElement)("div",{className:"donations__tab"},(0,r.createElement)(a.RichText,{tagName:"h4",placeholder:__("Write a message…","jetpack"),value:f("heading")||u[E]?.heading,onChange:e=>C("heading",e)}),(0,r.createElement)(a.RichText,{tagName:"p",placeholder:__("Write a message…","jetpack"),value:m,onChange:e=>n({chooseAmountText:e})}),(0,r.createElement)("div",{className:"donations__amounts"},b.map(((e,t)=>(0,r.createElement)(l.Z,{currency:c,defaultValue:B[t],label:(0,s.sprintf)(
// translators: %d: Tier level e.g: "1", "2", "3"
@@ -40,11 +40,11 @@ __("Delete %s","jetpack"),s.label),disabled:a===l},a===l?__("Deleting","jetpack"
(0,u.sprintf)(__("Allowed formats: %s","jetpack"),p))),(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-label-language"},(0,r.createElement)(i.TextControl,{onChange:t=>n({...e,label:t}),label:__("Label","jetpack"),value:B,help:__("Title of track","jetpack"),disabled:f}),(0,r.createElement)(i.TextControl,{onChange:t=>n({...e,srcLang:t}),label:__("Source language","jetpack"),value:b,help:__("Language tag (en, fr, etc.)","jetpack"),disabled:f})),(0,r.createElement)(i.SelectControl,{className:"videopress-block-tracks-editor__single-track-editor-kind-select",options:d,value:k,label:/* translators: %s: The kind of video text track e.g: "Subtitles, Captions" */
__("Kind","jetpack"),onChange:t=>{n({...e,kind:t})},disabled:f}),(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-buttons-container"},f?(0,r.createElement)(i.Spinner,null):(0,r.createElement)(i.Button,{variant:"secondary",disabled:!e.tmpFile,onClick:()=>{h(null),""===B&&(e.label=__("English","jetpack")),""===b&&(e.srcLang="en"),void 0===e.kind&&(e.kind=g),A(e)?h(__("A track already exists for that language and kind.","jetpack")):(C(!0),E(e,t).then((()=>{n(e),h(null),a()})).catch((e=>{e.message&&h(e.message)})).finally((()=>{C(!1)})))}},__("Save","jetpack")),(0,r.createElement)(i.Button,{variant:"link",onClick:o},__("Close","jetpack"))),m&&(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-error"},/* translators: %s: An error message returned after a failed video track file upload." */ /* translators: %s: An error message returned after a failed video track file upload." */
(0,u.sprintf)(__("Error: %s","jetpack"),m))))}function b({tracks:e=[],onChange:t,guid:n}){const[a,o]=(0,c.useState)(null);return(0,r.createElement)(i.Dropdown,{contentClassName:"videopress-block-tracks-editor",renderToggle:({isOpen:e,onToggle:t})=>(0,r.createElement)(i.ToolbarButton,{label:__("Text tracks","jetpack"),showTooltip:!0,"aria-expanded":e,"aria-haspopup":"true",onClick:t,icon:m}),renderContent:()=>null!==a?(0,r.createElement)(B,{track:e[a],guid:n,onChange:n=>{const r=[...e];r[a]=n,t(r)},onClose:()=>o(null),onCancel:()=>{t(e.filter(((e,t)=>t!==a))),o(null)},trackExists:t=>-1!==e.filter(((e,t)=>t!==a)).findIndex((e=>e.kind===t.kind&&e.srcLang===t.srcLang))}):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.NavigableMenu,null,(0,r.createElement)(C,{tracks:e,onChange:t,guid:n}),(0,r.createElement)(i.MenuGroup,{className:"videopress-block-tracks-editor__add-tracks-container",label:__("Add tracks","jetpack")},(0,r.createElement)(i.MenuItem,{icon:A.Z,onClick:()=>{(()=>{const n=e.length,r=[...e];r[n]||(r[n]={}),r[n]={...e[n]},t(r),o(n)})()}},__("Upload track","jetpack")))))})}},32478:(e,t,n)=>{"use strict";n.d(t,{$:()=>m});var r=n(51806),a=n(52175),o=n(55609),s=n(69307),i=n(65736),l=n(61074),c=n(65235),u=n.n(c),A=n(81427);const __=i.__,g=["image"],p=e=>{const{videoPosterImageUrl:t}=e;return(0,r.createElement)("div",{className:"resumable-upload__editor-thumb-placeholder"},t?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("img",{src:t,alt:"Poster"}),(0,r.createElement)(l.Z,{className:"uploading-editor__play-icon",icon:A.o1})):(0,r.createElement)("span",null,"No Poster Selected"))},d=e=>{const{onSelectPoster:t,onRemovePoster:n}=e;return(0,r.createElement)(o.BaseControl,{className:u()(e.className,"editor-video-poster-control")},(0,r.createElement)(p,e),(0,r.createElement)(a.MediaUpload,{title:__("Select Poster Image","jetpack"),onSelect:t,allowedTypes:g,render:({open:e})=>(0,r.createElement)("div",{className:"poster-selector__buttons"},(0,r.createElement)(o.Button,{onClick:n,variant:"link",isDestructive:!0},__("Remove Poster Image","jetpack")),(0,r.createElement)(o.Button,{variant:"secondary",onClick:e},__("Select Poster Image","jetpack")))}))},m=e=>{const{file:t,onSelectPoster:n,onRemovePoster:i,videoPosterImageData:c,title:u,onChangeTitle:p,onVideoFrameSelected:m}=e,[h,E]=(0,s.useState)(0),[f,C]=(0,s.useState)(!0),B=(0,s.useRef)(null),b=(0,s.useRef)(null),k=()=>{C(!1)};(0,s.useEffect)((()=>{null!==t&&B&&(B.current.src=URL.createObjectURL(t))}),[t,B]);const v={};return c&&(v.display="none"),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"uploading-editor"},(0,r.createElement)("div",{className:"uploading-editor__summary"}),(0,r.createElement)("div",{className:"uploading-editor__fields"},(0,r.createElement)(o.TextControl,{label:__("Video title","jetpack"),className:"uploading-editor__title",onChange:p,value:u}),(0,r.createElement)("div",{className:"uploading-editor__content"},(0,r.createElement)(o.BaseControl,{label:__("Video poster (optional)","jetpack")},f?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"uploading-editor__video-container"},(0,r.createElement)("div",{className:"uploading-editor__video-poster-wrapper"},c&&(0,r.createElement)(d,{onSelectPoster:n,onRemovePoster:i,videoPosterImageUrl:c.url}),(0,r.createElement)("video",{ref:B,muted:!0,className:"uploading-editor__video",onDurationChange:e=>{const t=e.target.duration;E(t),B.current&&(B.current.currentTime=t/2)},onError:k,onLoadedMetadata:e=>{e.target.videoHeight||k()},style:v})),!c&&(0,r.createElement)(l.Z,{className:"uploading-editor__play-icon",icon:A.o1})),(0,r.createElement)("span",{style:v},(0,r.createElement)(o.RangeControl,{className:"uploading-editor__range",min:"0",step:"0.1",max:h,showTooltip:!1,withInputField:!1,onChange:e=>{m(1e3*e),B.current&&(B.current.currentTime=e)}})),(0,r.createElement)("span",{className:"uploading-editor__scrubber-help",style:v},(0,s.createInterpolateElement)(__("This is how the video will look. Use the slider to choose a poster or select a custom one .","jetpack"),{a:(0,r.createElement)(a.MediaUpload,{title:__("Select Poster Image","jetpack"),onSelect:n,allowedTypes:g,render:({open:e})=>(0,r.createElement)("a",{className:"uploading-editor__upload-link",onClick:e,onKeyDown:e,ref:b,role:"button",tabIndex:0},__("select a custom one","jetpack"))})}))):(0,r.createElement)(d,{onSelectPoster:n,videoPosterImageUrl:c?c.url:null}))))))}},90953:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(96483);const a=(e,{autoplay:t,controls:n,loop:a,muted:o,playsinline:s,poster:i,preload:l,seekbarColor:c,seekbarPlayedColor:u,seekbarLoadingColor:A,useAverageColor:g})=>{if(!e)return null;const p={resizeToParent:!0,cover:!0,...t&&{autoPlay:!0},...!n&&{controls:!1},...a&&{loop:!0},...o&&{muted:!0,persistVolume:!1},...s&&{playsinline:!0},...i&&{posterUrl:i},...""!==l&&{preloadContent:l},...""!==c&&{sbc:c},...""!==u&&{sbpc:u},...""!==A&&{sblc:A},...g&&{useAverageColor:!0}};return(0,r.addQueryArgs)(`https://videopress.com/v/${e}`,p)}},77290:(e,t,n)=>{"use strict";n.d(t,{K8:()=>l,Kp:()=>u,Zx:()=>c,f6:()=>i});n(4981);var r=n(65235),a=n.n(r),o=n(90879);const s=e=>{const t=o.sl.reduce(((e,{className:t})=>(e[t]=!1,e)),{"wp-has-aspect-ratio":!1});return a()(e,t)};function i(e,t="",n=!0){if(!n)return s(t);const r=document.implementation.createHTMLDocument("");r.body.innerHTML=e;const i=r.body.querySelector("iframe");if(i&&i.height&&i.width){const e=(i.width/i.height).toFixed(2);for(let n=0;n=r.ratio)return a()(s(t),r.className,"wp-has-aspect-ratio")}}return t}const l=e=>e.replace(/\.[^/.]+$/,""),c=e=>{if(!e||"string"!=typeof e)return null;const t=e.match(/^https?:\/\/(?video(?:\.word|s\.files\.word)?press\.com)(?:\/v|\/embed)?\/(?[a-zA-Z\d]{8})/);return t?.groups?.guid?t.groups.guid:null},u=e=>{const{guid:t,videoPressTracks:n,isVideoPressExample:r}=e;if(!t?.length)return!1;if(!Array.isArray(n))return!1;return!(!Object.keys(e).includes("isVideoPressExample")||"boolean"!=typeof r)}},65192:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(51806),a=n(13419),o=n(52175),s=n(4981),i=n(55609),l=n(9818),c=n(12238),u=(n(69307),n(65736)),A=n(77290),g=n(5743);const __=u.__,p={instances:[]},d=(e=[],t=!1,n=0)=>{if(t&&(p.instances=[]),e.forEach((e=>{if(e.innerBlocks.length)return void d(e.innerBlocks,!1,n+1);const{clientId:t,name:r,attributes:a}=e;"core/video"===r&&(0,A.Kp)(a)&&p.instances.push({clientId:t,name:r,attributes:a})})),0===n)return p.instances};function m({clientId:e,attributes:t}){const n=(0,l.useSelect)((e=>e(c.store).getCurrentPostId())),{getBlocks:u}=(0,l.useSelect)(o.store),{replaceBlock:p}=(0,l.useDispatch)(o.store),{tracks:m}=(0,a.z$)();return(0,r.createElement)("div",{className:g.Z.wrapper},(0,r.createElement)(i.Notice,{status:"info",isDismissible:!1,className:g.Z["conversion-notice"]},__("You can transform this post's video blocks to the new VideoPress block to take advantage of new features, such as adding chapters directly in the description or hiding the video's share menu.","jetpack")),(0,r.createElement)(i.Button,{variant:"primary",onClick:()=>{const r=d(u(),!0);r?.length&&(r.find((t=>t.clientId===e))||r.push({clientId:e,name:"core/video",currentBlockAttributes:t}),r.forEach((e=>{const{clientId:t,name:r,attributes:a}=e;"core/video"===r&&(0,A.Kp)(a)&&(p(t,(0,s.createBlock)("videopress/video",a)),m.recordEvent("jetpack_editor_videopress_block_manual_conversion_click",{post_id:n}))})))}},__("Transform blocks to VideoPress","jetpack")))}},68938:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(52175),o=n(94333),s=n(77290),i=n(65192);const l=(0,o.createHigherOrderComponent)((e=>t=>(0,s.Kp)(t.attributes)?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(i.Z,{clientId:t.clientId,attributes:t.attributes})),(0,r.createElement)(e,t)):(0,r.createElement)(e,t)))},23062:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(13419),a=n(68938);const o="videopress/video";function s(e,t){if("core/video"!==t)return e;const{available:n}=(0,r.OZ)(o);return n?{...e,edit:(0,a.Z)(e.edit)}:e}},73859:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(55609),o=n(65736),s=n(78680),i=n(75255);const __=o.__,l="videopress/video-chapters",c=!!window?.Jetpack_Editor_Initial_State?.available_blocks[l],u=31;function A({isRequestingVideoItem:e}){const{attributes:t,setAttributes:n}=(0,i.Z)(),{title:o,description:A}=t,g=(0,s.L)(l),p=A?.length?A.split("\n").map((e=>Math.ceil(e.length/u)||1)).reduce(((e,t)=>e+t),0):4,d=Math.min(12,Math.max(p,4));if(!c)return null;return(0,r.createElement)(a.PanelBody,{title:__("Details","jetpack"),className:g?"is-beta":""},(0,r.createElement)(a.TextControl,{label:__("Title","jetpack"),value:o,placeholder:__("Video title","jetpack"),onChange:e=>{n({title:e})},disabled:e}),(0,r.createElement)(a.TextareaControl,{label:__("Description","jetpack"),value:A,placeholder:__("Video description","jetpack"),onChange:e=>{n({description:e})},disabled:e,rows:d}))}},24288:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(52175),o=n(94333),s=n(69307),i=n(73859),l=n(67203),c=n(49664),u=n(84676);const A=(0,o.createHigherOrderComponent)((e=>t=>{const{attributes:n,setAttributes:o}=t,[A,g]=(0,l.Z)(n?.id),[p]=(0,c.v)(n);return(0,s.useEffect)((()=>{if(!A)return;const e={};A?.title&&(e.title=A.title),A?.description&&(e.description=A.description),Object.keys(e).length&&(o(e),p(e))}),[A,o,p]),u.d&&"core/video"!==!t.name&&t.attributes?.guid?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(i.Z,{isRequestingVideoItem:g})),(0,r.createElement)(e,t)):(0,r.createElement)(e,t)}))},75255:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(52175),a=n(9818);function o(){const{clientId:e,attributes:t}=(0,a.useSelect)((e=>{const t=e(r.store).getSelectedBlockClientId();return{clientId:t,attributes:t?e("core/block-editor").getBlockAttributes(t):void 0}})),{updateBlockAttributes:n}=(0,a.useDispatch)(r.store);return{clientId:e,attributes:t,setAttributes:t=>n(e,t)}}},49664:(e,t,n)=>{"use strict";n.d(t,{v:()=>m});var r=n(86989),a=n.n(r),o=n(94333),s=n(37798),i=n(9818),l=n(12238),c=n(69307),u=n(65736),A=n(22081),g=n(90953),p=n(84321),d=n(38871);const __=u.__;function m(e){const{id:t,title:n,description:r,guid:u}=e,m=(0,i.useSelect)((e=>e(l.store).isSavingPost()),[]),h=(0,o.usePrevious)(m),E=(0,i.useDispatch)(s.store).invalidateResolution,[f,C]=(0,c.useState)(),B=(0,c.useCallback)((e=>{C((t=>({...t,...e})))}),[]);(0,c.useEffect)((()=>{C({title:n,description:r})}),[]);const b=function(e){return t=>new Promise(((n,r)=>{a()({path:"/wpcom/v2/videopress/meta",method:"POST",data:{id:e,...t}}).then((e=>{if(200!==e?.data)return r(e);n(e)})).catch(r)}))}(t);return(0,c.useEffect)((()=>{if(!m||h)return;if(!t)return;const a={};if(f?.title!==n&&(a.title=n),f?.description!==r&&(a.description=r),!Object.keys(a).length)return;if(b(a).then((()=>B({title:n,description:r}))),!a?.description?.length)return;const o=(0,p.ZP)(a.description);if(!o?.length)return;const s={label:__("English","jetpack"),srcLang:"en",kind:"chapters",tmpFile:(0,d.ZP)(a.description)};(0,A.n)(s,u).then((()=>{const t=(0,g.p)(u,e);E("getEmbedPreview",[t])}))}),[m,h,n,f?.title,f?.description,r,b,B,e,E,t,u]),[B]}},67203:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(86989),a=n.n(r),o=n(69307);function s(e){const[t,n]=(0,o.useState)({}),[r,s]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{e&&(s(!0),async function(){try{const t=await a()({path:`/wp/v2/media/${e}`});n(t?.jetpack_videopress||{}),s(!1)}catch(e){throw s(!1),new Error(e)}}())}),[e]),[t,r]}},84676:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o,d:()=>a});var r=n(24288);const a=!!window?.Jetpack_Editor_Initial_State?.available_blocks["videopress/video-chapters"];function o(e,t){if(!a)return e;if("core/video"!==t)return e;const n={...e.attributes,title:{type:"string"},description:{type:"string"}};return{...e,attributes:n,edit:(0,r.Z)(e.edit)}}},84321:(e,t,n)=>{"use strict";function r(e){return e.split("\n").map((e=>function(e){const t=/(?\(?(?\d{1,2}:\d{2}:\d{2}|\d{1,2}:\d{2})\)?)/.exec(e);if(null==t||null==t.groups)return null;const{groups:{timeBlock:n,time:r}}=t,a=e.indexOf(n),o=(a<(e.length-n.length)/2?e.substring(a+n.length,e.length):e.substring(0,a)).trim().replace(/(\s-$)|(^-\s)/,""),s=r.split(":");return 1===s[0].length&&(s[0]=`0${s[0]}`),2===s.length&&s.unshift("00"),{startAt:s.join(":"),title:o}}(e))).filter((e=>null!==e)).sort(((e,t)=>e.startAt.localeCompare(t.startAt)))}n.d(t,{Tn:()=>r,ZP:()=>r})},38871:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>o});var r=n(84321);function a(e){const t=Math.floor(e/36e5);let n=e-36e5*t;const r=Math.floor(n/6e4);n-=6e4*r;return[t,r,Math.floor(n/1e3)].map((e=>e<10?`0${e}`:e)).join(":")}function o(e,t){const n=function(e,t=359999e3){const n=(0,r.Tn)(e);if(0===n.length)return null;let o="WEBVTT\n",s=1;for(const[e,r]of n.entries()){const i=0===e?"000":"001",l=e{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(42290),o=n(55609),s=n(65736);const __=s.__;function i({state:e,onUpload:t,onCancel:n,onRecord:s,onPause:i,onResume:l,onDone:c}){return(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__action-buttons"},["inactive","error","validating"].includes(e)&&(0,r.createElement)(o.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qf,variant:"secondary",onClick:s},__("Begin recording","jetpack")),["recording"].includes(e)&&(0,r.createElement)(o.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qr,variant:"secondary",onClick:i},__("Pause recording","jetpack")),["paused"].includes(e)&&(0,r.createElement)(o.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qf,variant:"secondary",onClick:l},__("Resume recording","jetpack")),["inactive","error","validating"].includes(e)&&(0,r.createElement)(o.FormFileUpload,{accept:".mp3,.mpeg,.mpga,.ogg,.flac,.m4a,.mp4,.wav,.wave,.webm",onChange:t,variant:"secondary",className:"jetpack-ai-voice-to-content__button"},__("Upload audio","jetpack")),["recording","paused"].includes(e)&&(0,r.createElement)(o.Button,{className:"jetpack-ai-voice-to-content__button",variant:"primary",onClick:c},__("Done","jetpack")),["recording","paused","processing"].includes(e)&&(0,r.createElement)(o.Button,{className:"jetpack-ai-voice-to-content__button",variant:"secondary",onClick:n},__("Cancel","jetpack")))}},36265:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(42290),o=n(65736),s=n(79554);const __=o.__;function i({state:e,error:t=null,analyser:n,duration:o=0}){return"inactive"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("File size limit: 25MB. Recording time limit: 25 minutes.","jetpack")):"recording"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__audio"},(0,r.createElement)(a.ZK,{className:"jetpack-ai-voice-to-content__audio--duration",duration:o}),(0,r.createElement)(s.Z,{analyser:n,paused:!1}),(0,r.createElement)("span",{className:"jetpack-ai-voice-to-content__information"},__("Recording…","jetpack"))):"paused"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__audio"},(0,r.createElement)(a.ZK,{className:"jetpack-ai-voice-to-content__audio--duration",duration:o}),(0,r.createElement)(s.Z,{analyser:n,paused:!0}),(0,r.createElement)("span",{className:"jetpack-ai-voice-to-content__information"},__("Paused","jetpack"))):"processing"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("Uploading and transcribing audio…","jetpack")):"validating"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("Validating audio…","jetpack")):"error"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information--error"},t):null}},79554:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(69307);function o({analyser:e,paused:t=!1}){const n=(0,a.useRef)(null),o=(0,a.useRef)(t),s=(0,a.useRef)(null);return(0,a.useEffect)((()=>{o.current=t}),[t]),(0,a.useEffect)((()=>{e&&n.current&&(s.current&&s.current(),s.current=function(e,t,n){const r=t.getContext("2d");let a=!1;if(!r)return;e.fftSize=Math.pow(2,13);const o=e.fftSize,s=new Float32Array(o),i=o/10,{width:l,height:c}=t,u=c/2;r.lineWidth=4,r.lineCap="round",r.strokeStyle=getComputedStyle(t).getPropertyValue("--jp-green-50")||"#008710";const A=()=>{r.clearRect(0,0,l,c),e.getFloatTimeDomainData(s);for(let e=1;e<=10;e++){let t=0;n.current||(t=s.slice(e*i,(e+1)*i).reduce(((e,t)=>e+t),0)/i,t*=2048,t=Math.abs(t),t=Math.min(16,Math.max(0,t))),r.beginPath(),r.moveTo(2+6*e,u-t),r.lineTo(2+6*e,u+t),r.stroke()}setTimeout((()=>{a||requestAnimationFrame(A)}),50)};return A(),()=>{a=!0}}(e,n.current,o))}),[e,n,o]),(0,a.useEffect)((()=>()=>{s.current&&s.current()}),[]),(0,r.createElement)("canvas",{className:"jetpack-ai-voice-to-content__oscilloscope",width:70,height:38,ref:n})}},32663:(e,t,n)=>{"use strict";n.d(t,{Z:()=>C});var r=n(82674),a=n.n(r),o=n(51806),s=n(42290),i=n(88275),l=n(13419),c=n(55609),u=n(9818),A=n(69307),g=n(65736),p=n(15381),d=(n(99196),n(83181)),m=n(36265),h=n(48384),E=n(24167);const __=g.__,f=(e,t,n)=>t?"validating":e?"processing":n;function C({clientId:e}){const[t,n]=(0,A.useState)(null),{removeBlock:r}=(0,u.useDispatch)("core/block-editor"),{getBlocks:g}=(0,u.useSelect)((e=>e("core/editor")),[]),C=(0,A.useCallback)((()=>{setTimeout((()=>{r(e)}),100)}),[r,e]),{tracks:B}=(0,l.z$)(),{isValidatingAudio:b,validateAudio:k}=(0,s.L$)(),{upsertTranscription:v}=(0,E.Z)(),{isCreatingTranscription:I,createTranscription:y,cancelTranscription:w}=(0,h.Z)({onReady:e=>{v(e);const t=g();for(let e=0;e<2;e++)"core/paragraph"===t[e].name&&""===t[e].attributes?.content&&r(String(t[e].clientId));Q()},onUpdate:e=>{v(e)},onError:e=>{x(e)}}),Q=()=>{w(),C()},{state:_,controls:S,error:j,onError:x,duration:L,analyser:P}=(0,s._T)({onDone:e=>{T(e)}}),T=(0,A.useCallback)((e=>{e&&n(e)}),[n]);(0,A.useEffect)((()=>{t&&k(t,(e=>{B.recordEvent("jetpack_ai_voice_to_content_transcription_started",{post_processing_action:s.Y,type:e.isFile?"upload":"record",audio_duration:e.duration,audio_file_size:e.size}),y(t,s.Y)}),x)}),[t,B,k,y,x]);const{start:D,pause:N,resume:R,stop:Z,reset:M}=S,F=(0,A.useCallback)((e=>{if(e.currentTarget.files.length>0){const t=e.currentTarget.files[0];T(t)}}),[T]),U=(0,A.useCallback)((()=>{w(),M()}),[w,M]),O=(0,A.useCallback)((()=>{D(1e3)}),[D]),z=(0,A.useCallback)((()=>{N()}),[N]),H=(0,A.useCallback)((()=>{R()}),[R]),q=(0,A.useCallback)((()=>{Z()}),[Z]),$=f(I,b,_);return(0,o.createElement)(c.Modal,{onRequestClose:Q,title:__("Jetpack AI Voice to content","jetpack"),className:"jetpack-ai-voice-to-content__modal",shouldCloseOnEsc:!1,shouldCloseOnClickOutside:!1},(0,o.createElement)(i.ZP,null,(0,o.createElement)("div",{className:"jetpack-ai-voice-to-content__wrapper"},(0,o.createElement)("div",{className:"jetpack-ai-voice-to-content__body"},(0,o.createElement)("span",{className:"jetpack-ai-voice-to-content__description"},__("Transform your spoken words into a post ready to publish with AI.","jetpack")),(0,o.createElement)("div",{className:"jetpack-ai-voice-to-content__contextual-row"},(0,o.createElement)(m.Z,{state:$,error:j,duration:L,analyser:P})),(0,o.createElement)(d.Z,{state:$,onUpload:F,onCancel:U,onRecord:O,onPause:z,onResume:H,onDone:q})),(0,o.createElement)("div",{className:"jetpack-ai-voice-to-content__footer"},(0,o.createElement)(c.Button,{variant:"link",className:"jetpack-ai-voice-to-content__feedback-button",href:"https://a8c.slack.com/archives/C054LN8RNVA",target:"_blank"},(0,o.createElement)("span",null,__("Provide feedback","jetpack")),(0,o.createElement)(c.Icon,a()({icon:p.Z},{className:"icon"})))))))}},13006:(e,t,n)=>{"use strict";var r=n(31985),a=n(58940),o=n(32663);(0,r.S)(a,{edit:o.Z,save:()=>null})},48384:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(42290),a=n(69307),o=n(51128);const s=n.n(o)()("voice-to-content:use-transcription-creator"),i="voice-to-content";function l({onReady:e,onUpdate:t,onError:n}){const o=(0,a.useRef)(null),l=(0,a.useRef)(null),{processTranscription:c,cancelTranscriptionProcessing:u,isProcessingTranscription:A}=(0,r.OS)({feature:i,onReady:e,onUpdate:t,onError:t=>{if(o.current)return e(o.current);s("Transcription post-processing error: ",t)}}),g=(0,a.useCallback)((e=>{o.current=e,l.current&&c(l.current,e)}),[c]),{transcribeAudio:p,cancelTranscription:d,isTranscribingAudio:m}=(0,r.cH)({feature:i,onReady:g,onError:n});return{isCreatingTranscription:m||A,createTranscription:(0,a.useCallback)(((e,t)=>{if(e&&t)return l.current=t,p(e)}),[p]),cancelTranscription:(0,a.useCallback)((()=>{d(),u()}),[d,u])}}},24167:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(42290),a=n(4981),o=n(9818),s=n(69307),i=n(51128);const l=n.n(i)()("voice-to-content:use-transcription-inserter");function c(){const{updateBlockAttributes:e,insertBlocks:t,replaceInnerBlocks:n}=(0,o.useDispatch)("core/block-editor"),i=(0,s.useRef)([]);return{upsertTranscription:(0,s.useCallback)((o=>{l("Upserting transcription");const s=(0,r.LB)({content:o||""}),c=(0,a.rawHandler)({HTML:s});for(let r=0;r0&&n(t,c[r].innerBlocks)}else t([c[r]],void 0,void 0,!0,null),i.current.push(c[r])}),[i,t,e,n])}}},68925:(e,t,n)=>{"use strict";n.d(t,{W:()=>c});var r=n(51806),a=n(13419),o=n(55609),s=n(65736),i=n(99787);const __=s.__,l=(0,a.dM)(i),c=({changeStatus:e,isLoading:t,isModuleActive:n})=>(0,r.createElement)(o.Placeholder,{icon:l,instructions:__("You'll need to activate the WordAds feature to use this block.","jetpack"),label:i.title},(0,r.createElement)(o.Button,{disabled:n||t,isBusy:t,onClick:()=>e(!0),variant:"secondary"},t?__("Activating WordAds","jetpack"):__("Activate WordAds","jetpack",0)),(0,r.createElement)("div",{className:"membership-button__disclaimer"},(0,r.createElement)(o.ExternalLink,{href:"https://jetpack.com/support/ads/"},__("Learn more about the WordAds feature.","jetpack"))))},61981:(e,t,n)=>{"use strict";n.d(t,{c:()=>s});var r=n(51806),a=n(22636),o=n(55609);const s=()=>(0,r.createElement)(o.Placeholder,null,(0,r.createElement)(o.Flex,{gap:2,direction:"column",style:{width:"100%"}},(0,r.createElement)(o.Flex,{gap:4},(0,r.createElement)(o.FlexItem,null,(0,r.createElement)(a.Z,{width:30,height:30})),(0,r.createElement)(o.FlexBlock,null,(0,r.createElement)(a.Z,{width:"90%",height:30}))),(0,r.createElement)(o.Flex,{style:{marginTop:12}},(0,r.createElement)(o.FlexBlock,null,(0,r.createElement)(a.Z,{height:30,width:"60%"}))),(0,r.createElement)(o.Flex,{style:{marginTop:12}},(0,r.createElement)(o.FlexBlock,null,(0,r.createElement)(a.Z,{width:150,height:50}))),(0,r.createElement)(o.Flex,{style:{marginTop:18}},(0,r.createElement)(o.FlexBlock,null,(0,r.createElement)(a.Z,{width:"90%",height:16})))))},50354:(e,t,n)=>{"use strict";n.d(t,{m:()=>s});var r=n(51806),a=n(55609),o=n(65736);const __=o.__,s=[{height:250,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-7-2h2V7h-4v2h2z"})),name:__("Rectangle 300x250","jetpack"),tag:"mrec",width:300,editorPadding:30},{height:90,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4h-4v-2h2c1.1 0 2-.89 2-2V9c0-1.11-.9-2-2-2H9v2h4v2h-2c-1.1 0-2 .89-2 2v4h6v-2z"})),name:__("Leaderboard 728x90","jetpack"),tag:"leaderboard",width:728,editorPadding:60},{height:50,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V9c0-1.11-.9-2-2-2H9v2h4v2h-2v2h2v2H9v2h4c1.1 0 2-.89 2-2z"})),name:__("Mobile Leaderboard 320x50","jetpack"),tag:"mobile_leaderboard",width:320,editorPadding:100},{height:600,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M.04 0h24v24h-24V0z"}),(0,r.createElement)(a.Path,{d:"M19.04 3h-14c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16h-14V5h14v14zm-6-2h2V7h-2v4h-2V7h-2v6h4z"})),name:__("Wide Skyscraper 160x600","jetpack"),tag:"wideskyscraper",width:160,editorPadding:30}]},56565:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(51806),a=n(52175),o=n(55609),s=n(65736),i=n(1020);const __=s.__,l=({value:e,onChange:t})=>(0,r.createElement)(o.PanelBody,{title:__("Visibility","jetpack")},(0,r.createElement)(o.ToggleControl,{className:"jetpack-wordads__mobile-visibility",checked:!!e,label:__("Hide on mobile","jetpack"),help:__("Hides this block for site visitors on mobile devices.","jetpack"),onChange:t})),c=({attributes:{format:e,hideMobile:t},setAttributes:n})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.BlockControls,null,(0,r.createElement)(i.Z,{value:e,onChange:e=>n({format:e})})),(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(l,{value:t,onChange:e=>n({hideMobile:!!e})})))},53193:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(51806),a=n(88275),o=n(13419),s=n(52175),i=n(68925),l=n(61981),c=n(50354),u=n(56565),A=n(80405),g=n(72473),p=n(38511),d=n(52203);const m=({attributes:e,setAttributes:t})=>{const n=(0,s.useBlockProps)(),{format:m}=e,{isLoadingModules:h,isChangingStatus:E,isModuleActive:f,changeStatus:C}=(0,o.el)("wordads"),B=c.m.find((({tag:e})=>e===m)),b=e=>{switch(e){case"leaderboard":return d;case"mobile_leaderboard":return p;case"wideskyscraper":return A;default:return g}};let k;return k=f?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(u.Z,{attributes:e,setAttributes:t}),(0,r.createElement)("div",{className:`wp-block-jetpack-wordads jetpack-wordads-${m}`},(0,r.createElement)("div",{className:"jetpack-wordads__ad",style:{width:B.width,height:B.height,backgroundImage:`url( ${b(m)} )`,backgroundSize:"cover"}}))):h?(0,r.createElement)(a.ZP,null,(0,r.createElement)(l.c,null)):(0,r.createElement)(i.W,{changeStatus:C,isModuleActive:f,isLoading:E}),(0,r.createElement)("div",n,k)}},3432:(e,t,n)=>{"use strict";var r=n(31985),a=n(99787),o=n(53193);(0,r.S)(a,{edit:o.Z,save:()=>null})},1020:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(55609),o=n(65736),s=n(50354);const i=(0,o.__)("Pick an ad format","jetpack");function l({value:e,onChange:t}){return(0,r.createElement)(a.Dropdown,{placement:"bottom-start",renderToggle:({onToggle:e,isOpen:t})=>(0,r.createElement)(a.ToolbarGroup,{controls:[{icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M1 9h2V7H1v2zm0 4h2v-2H1v2zm0-8h2V3c-1.1 0-2 .9-2 2zm8 16h2v-2H9v2zm-8-4h2v-2H1v2zm2 4v-2H1c0 1.1.9 2 2 2zM21 3h-8v6h10V5c0-1.1-.9-2-2-2zm0 14h2v-2h-2v2zM9 5h2V3H9v2zM5 21h2v-2H5v2zM5 5h2V3H5v2zm16 16c1.1 0 2-.9 2-2h-2v2zm0-8h2v-2h-2v2zm-8 8h2v-2h-2v2zm4 0h2v-2h-2v2z"})),title:i,onClick:e,extraProps:{"aria-expanded":t},className:"wp-block-jetpack-wordads__format-picker-icon"}]}),renderContent:({onClose:n})=>(0,r.createElement)(a.NavigableMenu,{className:"wp-block-jetpack-wordads__format-picker"},s.m.map((({tag:o,name:s,icon:i})=>(0,r.createElement)(a.MenuItem,{className:o===e?"is-active":void 0,icon:i,isSelected:o===e,key:o,onClick:()=>{t(o),n()},role:"menuitemcheckbox"},s))))})}},78680:(e,t,n)=>{"use strict";n.d(t,{L:()=>A});var r=n(82674),a=n.n(r),o=n(51806),s=n(86989),i=n.n(s),l=n(94333),c=n(92694),u=(n(80425),n(85921),n(63066),n(92713),n(54414),n(36215),n(31657),n(23984),n(14688),n(7652),n(29692),n(1949));function A(e){if(!u)return!1;const t=u.beta||[],n=e.replace(/jetpack\//,"");return t.includes(e)||t.includes(n)}i().use(((e,t)=>{if("cors"===e.mode)return t(e);if(e.url)try{const n=new URL(e.url,location.href);if(n.protocol!==location.protocol||n.hostname!==location.hostname||n.port!==location.port)return t(e)}catch{return t(e)}return e.headers||(e.headers={}),e.headers["x-wp-api-fetch-from-editor"]="true",t(e)})),(0,c.addFilter)("blocks.registerBlockType","jetpack/label-beta-blocks-title",(function(e,t){if(!A(t))return e;const{title:n,keywords:r}=e,a="(beta)",o="beta",s={...e};return n&&(s.title=n.toLowerCase().endsWith(a)?n:`${e.title} ${a}`),Array.isArray(r)&&(s.keywords=r.includes(o)?r:[...r,o]),s}));const g=(0,l.createHigherOrderComponent)((e=>t=>{if(t?.clientRootId)return(0,o.createElement)(e,t);const{name:n}=t;return A(n)?(0,o.createElement)(e,a()({},t,{className:"is-beta-extension"})):(0,o.createElement)(e,t)}),"withBetaClassName");(0,c.addFilter)("editor.BlockListBlock","jetpack/label-beta-extensions",g)},6460:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),o=n(81427);const __=a.__,s={name:"descript",title:"Descript",icon:o.h,keywords:[__("descript","jetpack")],description:__("Embed a Descript Item.","jetpack"),patterns:[/^https:\/\/share.descript.com\/(view|embed)\/\w+/i],attributes:{providerNameSlug:"descript",responsive:!0}};(0,r.registerBlockVariation)("core/embed",s)},5166:(e,t,n)=>{"use strict";var r=n(92694),a=n(65736),o=n(70355),s=n(81427);const __=a.__,_x=a._x,i={name:"facebook",title:"Facebook",icon:{src:s.Vq,foreground:(0,o.m)()},keywords:[_x("social","block search term","jetpack")],description:__("Embed a Facebook post.","jetpack"),patterns:[/^https?:\/\/www\.facebook.com\/.+/i],attributes:{providerNameSlug:"facebook",previewable:!1,responsive:!0}};(0,r.addFilter)("blocks.registerBlockType","reactivateFacebookEmbedBlockVariation",(function(e,t){if("core/embed"!==t||!e.variations)return e;const n=e.variations.filter((e=>e.name!==i.name));return e.variations=[...n,i],e}))},36215:(e,t,n)=>{"use strict";n(5166),n(20970),n(25467),n(91128),n(6460)},20970:(e,t,n)=>{"use strict";var r=n(92694),a=n(65736),o=n(70355),s=n(81427),i=n(12923);const __=a.__,_x=a._x,l={name:"instagram",title:"Instagram",icon:{src:s.yu,foreground:(0,o.m)()},keywords:[_x("image","block search term","jetpack"),_x("social","block search term","jetpack")],description:__("Embed an Instagram post.","jetpack"),patterns:[/^https?:\/\/(www\.)?instagr(\.am|am\.com)\/.+/i],attributes:{providerNameSlug:"instagram",responsive:!0}};(0,r.addFilter)("blocks.registerBlockType","reactivateInstagramEmbedBlockVariation",(function(e,t){if("core/embed"!==t||!e.variations||!(0,i.Z)())return e;const n=e.variations.filter((e=>e.name!==l.name));return e.variations=[...n,l],e}))},25467:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),o=n(81427);const __=a.__,s={name:"loom",title:"Loom",icon:o.zf,keywords:[__("video","jetpack")],description:__("Embed a Loom video.","jetpack"),patterns:[/^https?:\/\/(www\.)?loom\.com\/share\/.+/i],attributes:{providerNameSlug:"loom",responsive:!0}};(0,r.registerBlockVariation)("core/embed",s)},91128:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),o=n(81427);const __=a.__,s={name:"smartframe",title:"SmartFrame",icon:o.Ae,keywords:[__("smartframe","jetpack")],description:__("Embed a SmartFrame Image.","jetpack"),patterns:[/^https?:\/\/(.*?).smartframe.(io|net)\/.*/i],attributes:{providerNameSlug:"smartframe",responsive:!0}};(0,r.registerBlockVariation)("core/embed",s)},31657:(e,t,n)=>{"use strict";var r=n(4981),a=n(92694),o=n(6512);const s={from:[{type:"block",isMultiBlock:!1,blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>!!t?.raw&&"jetpack_widget_social_icons"===e,transform:({instance:e})=>{let t=[];return e.raw.icons.forEach((e=>{const n=new URL(e.url.includes(":")?e.url:"https://"+e.url),a=n.hostname?n.hostname:n.protocol,s=o.Z.find((e=>a.includes(e.url)||e.url.includes(a))),i=(0,r.createBlock)("core/social-link",{service:s?s.name:"chain",url:e.url});t=[...t,i]})),(0,r.createBlock)("core/social-links",{},t)}}]};(0,a.addFilter)("blocks.registerBlockType","addTransformToSocialLinksWidget",(function(e,t){return"core/social-links"!==t||(e.transforms=s),e}))},6512:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r=[{name:"wordpress",url:["wordpress."]},{name:"fivehundredpx",url:["500px.com"]},{name:"amazon",url:["amazon."]},{name:"bandcamp",url:["bandcamp.com"]},{name:"behance",url:["behance.net"]},{name:"codepen",url:["codepen.io"]},{name:"deviantart",url:["deviantart.com"]},{name:"dribbble",url:["dribbble.com"]},{name:"dropbox",url:["dropbox.com"]},{name:"etsy",url:["etsy.com"]},{name:"facebook",url:["facebook.com"]},{name:"flickr",url:["flickr.com"]},{name:"foursquare",url:["foursquare.com"]},{name:"goodreads",url:["goodreads.com"]},{name:"google",url:["google."]},{name:"github",url:["github.com"]},{name:"instagram",url:["instagram.com"]},{name:"lastfm",url:["last.fm"]},{name:"linkedin",url:["linkedin.com"]},{name:"mail",url:["mailto:"]},{name:"linkedin",url:["linkedin.com"]},{name:"mastodon",url:["mastodon.social"]},{name:"meetup",url:["meetup.com"]},{name:"medium",url:["medium.com"]},{name:"patreon",url:["patreon.com"]},{name:"pinterest",url:["pinterest."]},{name:"pocket",url:["getpocket.com"]},{name:"reddit",url:["reddit.com"]},{name:"skype",url:["skype.com","skype:"]},{name:"snapchat",url:["snapchat.com"]},{name:"soundcloud",url:["soundcloud.com"]},{name:"spotify",url:["spotify.com"]},{name:"telegram",url:["telegram.me","t.me"]},{name:"tiktok",url:["tiktok.com"]},{name:"tumblr",url:["tumblr.com"]},{name:"twitch",url:["twitch.tv"]},{name:"twitter",url:["twitter.com"]},{name:"vimeo",url:["vimeo.com"]},{name:"vk",url:["vk.com"]},{name:"yelp",url:["yelp.com"]},{name:"youtube",url:["youtube.com"]}]},87950:(e,t,n)=>{"use strict";n.d(t,{L:()=>s,x:()=>o});var r=n(51806),a=n(69307);const o=(0,a.createContext)(),s=({onBannerVisibilityChange:e,hasParentBanner:t,children:n})=>(0,r.createElement)(o.Provider,{value:{onBannerVisibilityChange:e,hasParentBanner:t},children:n})},23984:(e,t,n)=>{"use strict";var r=n(13419),a=n(47701),o=n.n(a),s=n(92694),i=n(65736),l=n(92819),c=n(30371),u=n(7832),A=n(42770),g=n(27003);const __=i.__,p=[];(0,s.addFilter)("blocks.registerBlockType","jetpack/paid-block",((e,t)=>((0,r.X1)(t)&&(p.includes(t)||p.push(t),e.keywords=(0,l.uniq)([...e.keywords,"premium",__("premium","jetpack")]),(0,r.HD)(t)||(e.icon=(0,A.Z)(e.icon)),e.attributes.shouldDisplayFrontendBanner||(e.attributes.shouldDisplayFrontendBanner={type:"boolean",default:!0}),"core/cover"!==t&&(e.supports={...e.supports,__experimentalExposeControlsToChildren:!0})),e))),(0,s.addFilter)("blocks.registerBlockType","jetpack/paid-block-with-upgrade-banner",g.v),(0,s.addFilter)("editor.MediaPlaceholder","jetpack/paid-block-media-placeholder",c.Z),(0,s.addFilter)("editor.MediaReplaceFlow","jetpack/paid-block-media-placeholder",u.Z),o()((function(){(0,r.FK)()&&document.body.classList.add("jetpack-enable-upgrade-nudge")}))},30371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>g});var r=n(82674),a=n.n(r),o=n(51806),s=n(13419),i=n(52175),l=n(94333),c=n(69307),u=n(11317),A=n(87950);const g=(0,l.createHigherOrderComponent)((e=>t=>{const{name:n}=(0,i.useBlockEditContext)(),r=(0,s.m3)(n);if(!r?.mediaPlaceholder||!(0,s.X1)(n))return(0,o.createElement)(e,t);const{fileType:l}=r,{onError:g}=t,{onBannerVisibilityChange:p}=(0,c.useContext)(A.x),d=(0,c.useCallback)((e=>p(e?.length&&(0,u.Qu)(e[0],l))),[l,p]),m=(0,c.useCallback)((e=>{const t=e?.[0]?.props?.children;return(0,u.Qu)(t,l)?d([t]):g(e)}),[d,l,g]);return(0,o.createElement)("div",{className:"paid-block-media-placeholder"},(0,o.createElement)(e,a()({},t,{onFilesPreUpload:d,onError:m})))}),"withMediaPlaceholderUpgradable")},7832:(e,t,n)=>{"use strict";n.d(t,{Z:()=>g});var r=n(82674),a=n.n(r),o=n(51806),s=n(13419),i=n(52175),l=n(94333),c=n(69307),u=n(11317),A=n(87950);const g=(0,l.createHigherOrderComponent)((e=>t=>{const{name:n}=(0,i.useBlockEditContext)(),r=(0,s.m3)(n),l=(0,c.useRef)();if(!r?.mediaReplaceFlow||!(0,s.X1)(n))return(0,o.createElement)(e,t);const{fileType:g}=r,{onBannerVisibilityChange:p}=(0,c.useContext)(A.x);return(0,o.createElement)(e,a()({},t,{onFilesUpload:e=>{l.current=e?.length?e[0]:null,p(e?.length&&(0,u.Qu)(e[0],g))},createNotice:(e,n,r)=>{if((0,u.Qu)(l.current,g))return l.current=null,null;t.createNotice(e,n,r)}}))}),"withMediaReplaceFlowUpgradable")},95796:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(55609);const o=({cx:e=0,cy:t=0,r:n=4,fill:o="#e34c84",stroke:s="#ffffff",strokeWidth:i="2"})=>(0,r.createElement)(a.SVG,{className:"jetpack-paid-block-symbol"},(0,r.createElement)(a.Circle,{cx:e,cy:t,r:n,fill:o,stroke:s,strokeWidth:i}))},42770:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=(n(13419),n(95796));const o=e=>{const t=(0,r.createElement)(a.Z,{key:"paid-symbol"});return e?.src?{...e,src:(0,r.createElement)(r.Fragment,null,e.src,t)}:(0,r.createElement)(r.Fragment,null,e,t)},s=o},66316:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>A});var r=n(51806),a=n(9818),o=n(65736),s=n(26546),i=n(78798);const __=o.__,_x=o._x,l=__("Premium Block","jetpack"),/** translators: %s: name of the plan. */
-c=__("Upgrade to %s to use this premium block","jetpack"),u=(__("Upgrade your plan to use this premium block","jetpack"),_x("Upgrade","Call to action to buy a new plan","jetpack")),A=({onRedirect:e,align:t,className:n,title:A=l,description:g=null,buttonText:p=u,visible:d=!0,requiredPlan:m,context:h})=>{const[E,f,C]=(0,i.Z)(m,e),B=(0,a.useSelect)((e=>{if(g)return g;const t=e("wordpress-com/plans"),n=t&&t.getPlan(m);return n?(0,o.sprintf)(c,n.product_name_short):null}),[g]);return B&&(0,r.createElement)(s.p,{align:t,buttonText:p,checkoutUrl:E,className:n,context:h,description:B,goToCheckoutPage:f,isRedirecting:C,title:A,visible:d})}},38140:(e,t,n)=>{"use strict";n.d(t,{W:()=>a,v:()=>r});const r=({plan:e,blockName:t,context:n,tracks:r})=>{r.recordEvent("jetpack_editor_block_upgrade_click",{plan:e,block:t,context:n})},a=({plan:e,blockName:t,context:n,tracks:r})=>{r.recordEvent("jetpack_editor_block_upgrade_banner_impression",{plan:e,block:t,context:n})}},27003:(e,t,n)=>{"use strict";n.d(t,{v:()=>p});var r=n(51806),a=n(13419),o=n(52175),s=n(94333),i=n(9818),l=n(69307),c=n(87950),u=n(66316),A=n(38140);const g=(0,s.createHigherOrderComponent)((e=>t=>{const{name:n,clientId:s,isSelected:g,attributes:p,setAttributes:d}=t||{},m=(0,a.Rl)(n);if(!m)return(0,r.createElement)(e,t);const h=(0,a.HD)(n),E=(0,a.m3)(n),[f,C]=(0,l.useState)(!h),[B,b]=(0,l.useState)(!1),k="editor-canvas",v=(0,i.useSelect)((e=>e("core/block-editor").hasSelectedInnerBlock(s,!0)),[]),{hasParentBanner:I}=(0,l.useContext)(c.x)||{},y=(g||v)&&f&&!I,{tracks:w}=(0,a.z$)(),Q=(0,l.useMemo)((()=>({plan:m,blockName:n,context:k,tracks:w})),[m,n,w]);(0,l.useEffect)((()=>{y&&b(!0)}),[y,b]),(0,l.useEffect)((()=>{!B&&y&&(0,A.W)(Q)}),[B,Q,y]),(0,l.useEffect)((()=>C(!h)),[p,C,h]),(0,l.useEffect)((()=>{d({shouldDisplayFrontendBanner:!I})}),[d,I]);const _=(0,o.useBlockProps)();return(0,r.createElement)(c.L,{onBannerVisibilityChange:C,hasParentBanner:y},(0,r.createElement)("div",{ref:_.ref,style:{"max-width":"unset"}},(0,r.createElement)(u.ZP,{className:`is-${n.replace(/\//,"-")}-paid-block`,title:null,align:p?.align,visible:y,description:E?.description,requiredPlan:m,context:k,onRedirect:()=>(0,A.v)(Q)}),(0,r.createElement)(e,t)))}),"withUpgradeBanner");function p(e,t){return(0,a.Rl)(t)?{...e,edit:g(e.edit)}:e}},30664:(e,t,n)=>{"use strict";n.d(t,{bA:()=>r,cG:()=>a});const r="jetpack-sidebar",a="document-settings"},30494:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(51806),a=n(55609),o=n(65736),s=n(61074),i=n(52800),l=n(46936),c=n(65235),u=n.n(c),A=n(69282);const __=o.__;function g({children:e,isDotted:t=!1}){const n=(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:`data:image/png;base64,${A.U}`,alt:""});return(0,r.createElement)("div",{className:"ai-assistant-featured-image__blank"},n,(0,r.createElement)("div",{className:u()("ai-assistant-featured-image__blank-content",{"is-dotted":t})},e))}function p({images:e,current:t,handlePreviousImage:n,handleNextImage:o,actions:c=null}){const A=(0,r.createElement)("button",{className:"ai-carrousel__prev",onClick:n},(0,r.createElement)(s.Z,{icon:i.Z,className:u()("ai-carrousel__prev-icon",{"is-disabled":0===t})})),p=(0,r.createElement)("button",{className:"ai-carrousel__next",onClick:o},(0,r.createElement)(s.Z,{icon:l.Z,className:u()("ai-carrousel__next-icon",{"is-disabled":t+1===e.length})}));return(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-images"},e.length>1&&A,e.map((({image:e,generating:n,error:o},s)=>(0,r.createElement)("div",{key:"image:"+s,className:u()("ai-assistant-featured-image__carrousel-image-container",{"is-current":t===s,"is-prev":t>s})},n?(0,r.createElement)(g,null,(0,r.createElement)(a.Spinner,{style:{width:"50px",height:"50px"}})):(0,r.createElement)(r.Fragment,null,o?(0,r.createElement)(g,{isDotted:!0},(0,r.createElement)("div",{className:"ai-assistant-featured-image__error"},__("An error occurred while generating the image. Please, try again!","jetpack"),o?.message&&(0,r.createElement)("span",{className:"ai-assistant-featured-image__error-message"},o?.message))):(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:e,alt:""}))))),e.length>1&&p),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-footer"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-counter"},A,t+1," / ",e.length,p),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-actions"},c)))}},77371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>_,h:()=>I});var r=n(51806),a=n(42290),o=n(13419),s=n(55609),i=n(9818),l=n(69307),c=n(65736),u=n(61074),A=n(15381),g=n(5246),p=n(18135),d=n(28788),m=n(23795),h=n(45975),E=n(84944),f=n(30664),C=n(78116),B=n(30494),b=n(62815);const __=c.__,k="ai-image-generator",v="featured-post-image",I="media-source-dropdown",y=(0,d.$)("ai-assistant-experimental-image-generation-support"),w=y?"stable-diffusion":"dall-e-3",Q=(0,o.Ug)()?"atomic":(0,o.Wp)()?"simple":"jetpack";function _({busy:e,disabled:t,placement:n,onClose:d=(()=>{})}){const{toggleEditorPanelOpened:_}=(0,i.useDispatch)("core/edit-post"),{editPost:S,toggleEditorPanelOpened:j}=(0,i.useDispatch)("core/editor"),{clearSelectedBlock:x}=(0,i.useDispatch)("core/block-editor"),[L,P]=(0,l.useState)(!1),[T,D]=(0,l.useState)([{generating:!0}]),[N,R]=(0,l.useState)(0),Z=(0,l.useRef)(0),[M,F]=(0,l.useState)(""),U=(0,l.useRef)(!1),{enableComplementaryArea:O}=(0,i.useDispatch)("core/interface"),{generateImage:z,generateImageWithStableDiffusion:H}=(0,a.Rc)(),{saveToMediaLibrary:q}=(0,E.Z)(),{tracks:$}=(0,o.z$)(),{recordEvent:V}=$,G=T[N],W=T[Z.current],{requireUpgrade:Y,requestsCount:K,requestsLimit:J,currentTier:X,increaseRequestsCount:ee,costs:te}=(0,p.Z)(),ne=(0,m.U_)(X),re=y?te?.[v]?.stableDiffusion??1:te?.[v]?.image,ae=ne===m.hp,oe=J-Ke("core/editor").isEditorPanelOpened??e("core/edit-post").isEditorPanelOpened),[]),ce=(0,l.useCallback)((()=>{ee(re)}),[ee,re]),ue=(0,l.useCallback)(((e,t)=>{D((n=>{const r=[...n];return r[t]={...r[t],...e},r})),e.error&&V("jetpack_ai_featured_image_generation_error",{placement:n,error:e.error?.message,model:w,site_type:Q})}),[n,V]),Ae=(0,l.useCallback)((()=>{R(Math.max(N-1,0))}),[N,R]),ge=(0,l.useCallback)((()=>{R(Math.min(N+1,T.length-1))}),[N,T.length]),pe=(0,l.useCallback)((()=>{if(ue({generating:!0,error:null},Z.current),oe)return void ue({generating:!1,error:new Error(__("You don't have enough requests to generate another image.","jetpack"))},Z.current);if(!M&&!se)return void ue({generating:!1,error:new Error(__("No content to generate image. Please type custom instructions and try again.","jetpack"))},Z.current);(y?H({feature:v,postContent:se,userPrompt:M}):z({feature:v,postContent:se,responseFormat:"b64_json",userPrompt:M})).then((e=>{if(e.data.length>0){const t="data:image/png;base64,"+e.data[0].b64_json;ue({image:t},Z.current),ce(),q(t).then((e=>{ue({libraryId:e.id,generating:!1},Z.current),Z.current+=1})).catch((()=>{ue({generating:!1},Z.current),Z.current+=1}))}})).catch((e=>{ue({generating:!1,error:e},Z.current)}))}),[oe,ue,z,H,se,M,ce,q]),de=(0,l.useCallback)((()=>{P(!L)}),[L,P]),me=(0,l.useCallback)((()=>{de(),d?.()}),[de,d]),he=(0,l.useCallback)((()=>{V("jetpack_ai_featured_image_generation_generate_image",{placement:n,model:w,site_type:Q}),de(),pe()}),[de,pe,V,n]),Ee=(0,l.useCallback)((()=>{V("jetpack_ai_featured_image_generation_generate_another_image",{placement:n,model:w,site_type:Q}),pe(),R((e=>e+1))}),[pe,V,n]),fe=(0,l.useCallback)((()=>{V("jetpack_ai_featured_image_generation_try_again",{placement:n,model:w,site_type:Q}),pe()}),[pe,V,n]),Ce=(0,l.useCallback)((e=>{F(e.target.value)}),[F]),Be=(0,l.useCallback)((()=>(x(),O("core/edit-post","edit-post/document"))),[x,O]),be=(0,l.useCallback)((()=>{V("jetpack_ai_featured_image_generation_use_image",{placement:n,model:w,site_type:Q});const e=e=>{S({featured_media:e}),me(),setTimeout((()=>{const e=le("featured-image"),t=le("post-status");Be().then((()=>{e||ie("featured-image"),t||ie("post-status")}))}),500)};T[N].libraryId?e(T[N].libraryId):q(T[N].image).then((t=>{e(t.id)}))}),[N,S,T,le,V,q,ie,Be,me,n]);(0,l.useEffect)((()=>{n===I&&(U.current||(U.current=!0,he()))}),[n,he]);const ke=__("Generate a featured image with AI","jetpack"),ve=__("1 request per image","jetpack"),Ie=(0,c.sprintf)(
+c=__("Upgrade to %s to use this premium block","jetpack"),u=(__("Upgrade your plan to use this premium block","jetpack"),_x("Upgrade","Call to action to buy a new plan","jetpack")),A=({onRedirect:e,align:t,className:n,title:A=l,description:g=null,buttonText:p=u,visible:d=!0,requiredPlan:m,context:h})=>{const[E,f,C]=(0,i.Z)(m,e),B=(0,a.useSelect)((e=>{if(g)return g;const t=e("wordpress-com/plans"),n=t&&t.getPlan(m);return n?(0,o.sprintf)(c,n.product_name_short):null}),[g]);return B&&(0,r.createElement)(s.p,{align:t,buttonText:p,checkoutUrl:E,className:n,context:h,description:B,goToCheckoutPage:f,isRedirecting:C,title:A,visible:d})}},38140:(e,t,n)=>{"use strict";n.d(t,{W:()=>a,v:()=>r});const r=({plan:e,blockName:t,context:n,tracks:r})=>{r.recordEvent("jetpack_editor_block_upgrade_click",{plan:e,block:t,context:n})},a=({plan:e,blockName:t,context:n,tracks:r})=>{r.recordEvent("jetpack_editor_block_upgrade_banner_impression",{plan:e,block:t,context:n})}},27003:(e,t,n)=>{"use strict";n.d(t,{v:()=>p});var r=n(51806),a=n(13419),o=n(52175),s=n(94333),i=n(9818),l=n(69307),c=n(87950),u=n(66316),A=n(38140);const g=(0,s.createHigherOrderComponent)((e=>t=>{const{name:n,clientId:s,isSelected:g,attributes:p,setAttributes:d}=t||{},m=(0,a.Rl)(n);if(!m)return(0,r.createElement)(e,t);const h=(0,a.HD)(n),E=(0,a.m3)(n),[f,C]=(0,l.useState)(!h),[B,b]=(0,l.useState)(!1),k="editor-canvas",v=(0,i.useSelect)((e=>e("core/block-editor").hasSelectedInnerBlock(s,!0)),[]),{hasParentBanner:I}=(0,l.useContext)(c.x)||{},y=(g||v)&&f&&!I,{tracks:w}=(0,a.z$)(),Q=(0,l.useMemo)((()=>({plan:m,blockName:n,context:k,tracks:w})),[m,n,w]);(0,l.useEffect)((()=>{y&&b(!0)}),[y,b]),(0,l.useEffect)((()=>{!B&&y&&(0,A.W)(Q)}),[B,Q,y]),(0,l.useEffect)((()=>C(!h)),[p,C,h]),(0,l.useEffect)((()=>{d({shouldDisplayFrontendBanner:!I})}),[d,I]);const _=(0,o.useBlockProps)();return(0,r.createElement)(c.L,{onBannerVisibilityChange:C,hasParentBanner:y},(0,r.createElement)("div",{ref:_.ref,style:{"max-width":"unset"}},(0,r.createElement)(u.ZP,{className:`is-${n.replace(/\//,"-")}-paid-block`,title:null,align:p?.align,visible:y,description:E?.description,requiredPlan:m,context:k,onRedirect:()=>(0,A.v)(Q)}),(0,r.createElement)(e,t)))}),"withUpgradeBanner");function p(e,t){return(0,a.Rl)(t)?{...e,edit:g(e.edit)}:e}},30664:(e,t,n)=>{"use strict";n.d(t,{bA:()=>r,cG:()=>a});const r="jetpack-sidebar",a="document-settings"},30494:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(51806),a=n(55609),o=n(65736),s=n(61074),i=n(52800),l=n(46936),c=n(65235),u=n.n(c),A=n(69282);const __=o.__;function g({children:e,isDotted:t=!1}){const n=(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:`data:image/png;base64,${A.U}`,alt:""});return(0,r.createElement)("div",{className:"ai-assistant-featured-image__blank"},n,(0,r.createElement)("div",{className:u()("ai-assistant-featured-image__blank-content",{"is-dotted":t})},e))}function p({images:e,current:t,handlePreviousImage:n,handleNextImage:o,actions:c=null}){const A=(0,r.createElement)("button",{className:"ai-carrousel__prev",onClick:n},(0,r.createElement)(s.Z,{icon:i.Z,className:u()("ai-carrousel__prev-icon",{"is-disabled":0===t})})),p=(0,r.createElement)("button",{className:"ai-carrousel__next",onClick:o},(0,r.createElement)(s.Z,{icon:l.Z,className:u()("ai-carrousel__next-icon",{"is-disabled":t+1===e.length})}));return(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-images"},e.length>1&&A,e.map((({image:e,generating:n,error:o},s)=>(0,r.createElement)("div",{key:"image:"+s,className:u()("ai-assistant-featured-image__carrousel-image-container",{"is-current":t===s,"is-prev":t>s})},n?(0,r.createElement)(g,null,(0,r.createElement)(a.Spinner,{style:{width:"50px",height:"50px"}})):(0,r.createElement)(r.Fragment,null,o?(0,r.createElement)(g,{isDotted:!0},(0,r.createElement)("div",{className:"ai-assistant-featured-image__error"},__("An error occurred while generating the image. Please, try again!","jetpack"),o?.message&&(0,r.createElement)("span",{className:"ai-assistant-featured-image__error-message"},o?.message))):(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:e,alt:""}))))),e.length>1&&p),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-footer"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-counter"},A,t+1," / ",e.length,p),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-actions"},c)))}},77371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Q,h:()=>v});var r=n(51806),a=n(42290),o=n(13419),s=n(55609),i=n(9818),l=n(69307),c=n(65736),u=n(61074),A=n(15381),g=n(5246),p=n(18135),d=n(23795),m=n(45975),h=n(84944),E=n(30664),f=n(78116),C=n(30494),B=n(62815);const __=c.__,b="ai-image-generator",k="featured-post-image",v="media-source-dropdown",I="stable-diffusion",y="dall-e-3",w=(0,o.Ug)()?"atomic":(0,o.Wp)()?"simple":"jetpack";function Q({busy:e,disabled:t,placement:n,onClose:Q=(()=>{})}){const{toggleEditorPanelOpened:_}=(0,i.useDispatch)("core/edit-post"),{editPost:S,toggleEditorPanelOpened:j}=(0,i.useDispatch)("core/editor"),{clearSelectedBlock:x}=(0,i.useDispatch)("core/block-editor"),[L,P]=(0,l.useState)(!1),[T,D]=(0,l.useState)([{generating:!0}]),[N,R]=(0,l.useState)(0),Z=(0,l.useRef)(0),[M,F]=(0,l.useState)(""),U=(0,l.useRef)(!1),{enableComplementaryArea:O}=(0,i.useDispatch)("core/interface"),{generateImageWithParameters:z}=(0,a.Rc)(),{saveToMediaLibrary:H}=(0,h.Z)(),{tracks:q}=(0,o.z$)(),{recordEvent:$}=q,V=T[N],G=T[Z.current],{requireUpgrade:W,requestsCount:Y,requestsLimit:K,currentTier:J,increaseRequestsCount:X,costs:ee}=(0,p.Z)(),te=(0,d.U_)(J),ne=ee?.[k]?.activeModel??10,re=ne===ee?.[k]?.stableDiffusion?I:y,ae=te===d.hp,oe=K-Ye("core/editor").isEditorPanelOpened??e("core/edit-post").isEditorPanelOpened),[]),ce=(0,l.useCallback)((()=>{X(ne)}),[X,ne]),ue=(0,l.useCallback)(((e,t)=>{D((n=>{const r=[...n];return r[t]={...r[t],...e},r})),e.error&&$("jetpack_ai_featured_image_generation_error",{placement:n,error:e.error?.message,model:re,site_type:w})}),[n,$,re]),Ae=(0,l.useCallback)((()=>{R(Math.max(N-1,0))}),[N,R]),ge=(0,l.useCallback)((()=>{R(Math.min(N+1,T.length-1))}),[N,T.length]),pe=(0,l.useCallback)((()=>{if(ue({generating:!0,error:null},Z.current),oe)return void ue({generating:!1,error:new Error(__("You don't have enough requests to generate another image.","jetpack"))},Z.current);if(!M&&!se)return void ue({generating:!1,error:new Error(__("No content to generate image. Please type custom instructions and try again.","jetpack"))},Z.current);z({feature:k,size:"1792x1024",responseFormat:"b64_json",style:"photographic",messages:[{role:"jetpack-ai",context:{type:"featured-image-generation",request:M||null,content:se}}]}).then((e=>{if(e.data.length>0){const t="data:image/png;base64,"+e.data[0].b64_json;ue({image:t},Z.current),ce(),H(t).then((e=>{ue({libraryId:e.id,generating:!1},Z.current),Z.current+=1})).catch((()=>{ue({generating:!1},Z.current),Z.current+=1}))}})).catch((e=>{ue({generating:!1,error:e},Z.current)}))}),[oe,ue,z,se,M,ce,H]),de=(0,l.useCallback)((()=>{P(!L)}),[L,P]),me=(0,l.useCallback)((()=>{de(),Q?.()}),[de,Q]),he=(0,l.useCallback)((()=>{$("jetpack_ai_featured_image_generation_generate_image",{placement:n,model:re,site_type:w}),de(),pe()}),[de,pe,$,n,re]),Ee=(0,l.useCallback)((()=>{$("jetpack_ai_featured_image_generation_generate_another_image",{placement:n,model:re,site_type:w}),pe(),R((e=>e+1))}),[pe,$,n,re]),fe=(0,l.useCallback)((()=>{$("jetpack_ai_featured_image_generation_try_again",{placement:n,model:re,site_type:w}),pe()}),[pe,$,n,re]),Ce=(0,l.useCallback)((e=>{F(e.target.value)}),[F]),Be=(0,l.useCallback)((()=>(x(),O("core/edit-post","edit-post/document"))),[x,O]),be=(0,l.useCallback)((()=>{$("jetpack_ai_featured_image_generation_use_image",{placement:n,model:re,site_type:w});const e=e=>{S({featured_media:e}),me(),setTimeout((()=>{const e=le("featured-image"),t=le("post-status");Be().then((()=>{e||ie("featured-image"),t||ie("post-status")}))}),500)};T[N].libraryId?e(T[N].libraryId):H(T[N].image).then((t=>{e(t.id)}))}),[N,S,T,le,$,H,ie,Be,me,n,re]);(0,l.useEffect)((()=>{n===v&&(U.current||(U.current=!0,he()))}),[n,he]);const ke=__("Generate a featured image with AI","jetpack"),ve=__("1 request per image","jetpack"),Ie=(0,c.sprintf)(
// Translators: %d is the cost of generating one image.
-__("%d requests per image","jetpack"),re),ye=1===re?ve:Ie,we=(0,r.createElement)(s.Button,{onClick:be,variant:"primary",isBusy:G?.generating,disabled:!G?.image},__("Set as featured image","jetpack"));return(0,r.createElement)("div",null,(n===f.bA||n===f.cG)&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",null,__("Create and use an AI generated featured image for your post.","jetpack")),(0,r.createElement)(s.Button,{onClick:he,isBusy:e,disabled:!se||t||oe,variant:"secondary"},__("Generate image","jetpack"))),L&&(0,r.createElement)(C.Z,{handleClose:me,title:ke},(0,r.createElement)("div",{className:"ai-assistant-featured-image__content"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt-textarea"},(0,r.createElement)("textarea",{disabled:oe||W?.generating,maxLength:1e3,rows:2,onChange:Ce,placeholder:__("Include optional instructions to generate a new image","jetpack")}))),(Y||oe)&&!W?.generating&&(0,r.createElement)(g.Z,{description:oe?(0,c.sprintf)(
+__("%d requests per image","jetpack"),ne),ye=1===ne?ve:Ie,we=(0,r.createElement)(s.Button,{onClick:be,variant:"primary",isBusy:V?.generating,disabled:!V?.image},__("Set as featured image","jetpack"));return(0,r.createElement)("div",null,(n===E.bA||n===E.cG)&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",null,__("Create and use an AI generated featured image for your post.","jetpack")),(0,r.createElement)(s.Button,{onClick:he,isBusy:e,disabled:!se||t||oe,variant:"secondary"},__("Generate image","jetpack"))),L&&(0,r.createElement)(f.Z,{handleClose:me,title:ke},(0,r.createElement)("div",{className:"ai-assistant-featured-image__content"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt-textarea"},(0,r.createElement)("textarea",{disabled:oe||G?.generating,maxLength:1e3,rows:2,onChange:Ce,placeholder:__("Include optional instructions to generate a new image","jetpack")}))),(W||oe)&&!G?.generating&&(0,r.createElement)(g.Z,{description:oe?(0,c.sprintf)(
// Translators: %d is the cost of generating a featured image.
-__("Featured image generation costs %d requests per image. You don't have enough requests to generate another image.","jetpack"),re):null,placement:k,useLightNudge:!0}),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-left"},!ae&&re&&J&&(0,r.createElement)(b.Z,{cost:re,currentLimit:J,currentUsage:K})),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-right"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__action-buttons"},W?.error?(0,r.createElement)(s.Button,{onClick:fe,variant:"secondary",disabled:!M&&!se},__("Try again","jetpack")):(0,r.createElement)(s.Tooltip,{text:ye,placement:"bottom"},(0,r.createElement)(s.Button,{onClick:Ee,variant:"secondary",isBusy:W?.generating,disabled:oe||W?.generating||!M&&!se},__("Generate again","jetpack")))))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__image-canvas"},(0,r.createElement)(B.Z,{images:T,current:N,handlePreviousImage:Ae,handleNextImage:ge,actions:we}))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__footer"},(0,r.createElement)(s.Button,{variant:"link",className:"ai-assistant-featured-image__feedback-button",href:"https://jetpack.com/redirect/?source=jetpack-ai-feedback",target:"_blank"},(0,r.createElement)("span",null,__("Provide feedback","jetpack")),(0,r.createElement)(u.Z,{icon:A.Z,className:"icon"})))))}},62815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(69307),o=n(65736);const __=o.__;function s({currentLimit:e,currentUsage:t,cost:n}){const s=e-t,i=(0,a.createInterpolateElement)(
+__("Featured image generation costs %d requests per image. You don't have enough requests to generate another image.","jetpack"),ne):null,placement:b,useLightNudge:!0}),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-left"},!ae&&ne&&K&&(0,r.createElement)(B.Z,{cost:ne,currentLimit:K,currentUsage:Y})),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-right"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__action-buttons"},G?.error?(0,r.createElement)(s.Button,{onClick:fe,variant:"secondary",disabled:!M&&!se},__("Try again","jetpack")):(0,r.createElement)(s.Tooltip,{text:ye,placement:"bottom"},(0,r.createElement)(s.Button,{onClick:Ee,variant:"secondary",isBusy:G?.generating,disabled:oe||G?.generating||!M&&!se},__("Generate again","jetpack")))))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__image-canvas"},(0,r.createElement)(C.Z,{images:T,current:N,handlePreviousImage:Ae,handleNextImage:ge,actions:we}))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__footer"},(0,r.createElement)(s.Button,{variant:"link",className:"ai-assistant-featured-image__feedback-button",href:"https://jetpack.com/redirect/?source=jetpack-ai-feedback",target:"_blank"},(0,r.createElement)("span",null,__("Provide feedback","jetpack")),(0,r.createElement)(u.Z,{icon:A.Z,className:"icon"})))))}},62815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(69307),o=n(65736);const __=o.__;function s({currentLimit:e,currentUsage:t,cost:n}){const s=e-t,i=(0,a.createInterpolateElement)(
// Translators: %d is the cost of one image.
// Translators: %d is the cost of one image.
(0,o.sprintf)(__("Requests needed: %d ","jetpack"),n),{counter:(0,r.createElement)("span",null)}),l=(0,a.createInterpolateElement)(
diff --git a/_inc/blocks/editor.asset.php b/_inc/blocks/editor.asset.php
index d904bab5f0..03182b3e32 100644
--- a/_inc/blocks/editor.asset.php
+++ b/_inc/blocks/editor.asset.php
@@ -1 +1 @@
- array('lodash', 'moment', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => 'caccf1506bf2ebe6cd47');
+ array('lodash', 'moment', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '53690cab00c7dfbbe591');
diff --git a/_inc/blocks/editor.js b/_inc/blocks/editor.js
index adc0af8117..1c472757da 100644
--- a/_inc/blocks/editor.js
+++ b/_inc/blocks/editor.js
@@ -3,7 +3,7 @@
// translators: %1$d: number of requests remaining
__("You have %1$d requests remaining.","jetpack"),e)),React.createElement(r.Button,{variant:"link",onClick:n,href:s,target:s?"_blank":null},__("Upgrade now","jetpack")))}function b({error:e,code:t,onTryAgainClick:n,onUpgradeClick:s,upgradeUrl:o}){const i=e||__("Something went wrong","jetpack");return React.createElement(E,{severity:m},React.createElement("span",null,(0,a.sprintf)(
// translators: %1$d: A dynamic error message
-__("Error: %1$s","jetpack"),i)),t===d.$L?React.createElement(r.Button,{variant:"link",onClick:s,href:o,target:o?"_blank":null},__("Upgrade now","jetpack")):React.createElement(r.Button,{variant:"link",onClick:n},__("Try again","jetpack")))}},62282:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,u:()=>s});var r=n(99196),a=n.n(r);const s=(0,r.createContext)({}),o=({value:e,children:t})=>a().createElement(s.Provider,{value:e,children:t})},20281:(e,t,n)=>{"use strict";n.d(t,{X_:()=>s.Z,hE:()=>r.h,oN:()=>a.Z,uE:()=>r.u});var r=n(62282),a=n(3669),s=n(79466)},79466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(99196),a=n(16700),s=n(20281);function o({onDone:e,onSuggestion:t,onError:n}={}){const o=(0,r.useContext)(s.uE),{eventSource:i}=o,l=(0,r.useCallback)((t=>e?.(t?.detail)),[e]),c=(0,r.useCallback)((e=>t?.(e?.detail)),[t]),u=(0,r.useCallback)((e=>{n?.(e?.detail)}),[]);return(0,r.useEffect)((()=>{if(i)return e&&i.addEventListener("done",l),t&&i.addEventListener("suggestion",c),n&&i.addEventListener(a.vF,u),()=>{i.removeEventListener("done",l),i.removeEventListener("suggestion",c),i.removeEventListener(a.vF,u)}}),[i]),o}},3669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(94333),a=n(69307),s=n(99196),o=n.n(s),i=n(42194),l=n(20281);const c=(0,r.createHigherOrderComponent)((e=>t=>{const{suggestion:n,error:r,requestingState:s,request:c,stopSuggestion:u,eventSource:d}=(0,i.Z)(),p=(0,a.useMemo)((()=>({suggestion:n,requestingError:r,requestingState:s,eventSource:d,requestSuggestion:c,stopSuggestion:u})),[n,r,s,d,c,u]);return o().createElement(l.hE,{value:p},o().createElement(e,t))}),"withAiDataProvider")},42194:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Z:()=>l});var r=n(69307),a=n(65736),s=n(67742),o=n(16700);const __=a.__;function i(e){switch(e){case o.$L:return{code:o.$L,message:__("You have reached the limit of requests for this site.","jetpack"),severity:"info"};case o.bC:return{code:o.bC,message:__("Your request was unclear. Mind trying again?","jetpack"),severity:"info"};case o.$u:return{code:o.$u,message:__("Jetpack AI services are currently unavailable. Sorry for the inconvenience.","jetpack"),severity:"info"};case o.q4:return{code:o.q4,message:__("This request has been flagged by our moderation system. Please try to rephrase it and try again.","jetpack"),severity:"info"};case o.cv:return{code:o.cv,message:__("The content is too large to be processed all at once. Please try to shorten it or divide it into smaller parts.","jetpack"),severity:"info"};case o.co:default:return{code:o.co,message:__("It was not possible to process your request. Mind trying again?","jetpack"),severity:"info"}}}function l({prompt:e,autoRequest:t=!1,askQuestionOptions:n={},initialRequestingState:a="init",onSuggestion:l,onDone:c,onStop:u,onError:d,onAllErrors:p}={}){const[m,g]=(0,r.useState)(a),[A,h]=(0,r.useState)(""),[E,f]=(0,r.useState)(),C=(0,r.useRef)(void 0),b=(0,r.useCallback)((e=>{h(e?.detail),l?.(e?.detail)}),[l]),v=(0,r.useCallback)((e=>{Q(),c?.(e?.detail),g("done")}),[c]),k=(0,r.useCallback)((e=>{p?.(e?.detail)}),[p]),B=(0,r.useCallback)((e=>{C?.current?.close(),g("error"),f(i(e)),d?.(i(e))}),[d]),y=(0,r.useCallback)((()=>B(o.$L)),[]),w=(0,r.useCallback)((()=>B(o.bC)),[]),_=(0,r.useCallback)((()=>B(o.$u)),[]),I=(0,r.useCallback)((()=>B(o.q4)),[]),j=(0,r.useCallback)((()=>B(o.co)),[]),x=(0,r.useCallback)((async(e,t={...n})=>{if(f(void 0),g("requesting"),C.current=await(0,s.Z)(e,t),!C?.current)return;const r=C.current;g("suggesting"),r.addEventListener("suggestion",b),r.addEventListener(o.$L,y),r.addEventListener(o.bC,w),r.addEventListener(o.$u,_),r.addEventListener(o.q4,I),r.addEventListener(o.co,j),r.addEventListener(o.vF,k),r.addEventListener("done",v)}),[v,y,w,_,I,j,b]),S=(0,r.useCallback)((()=>{g("init"),h(""),f(void 0)}),[]),Q=(0,r.useCallback)((()=>{if(!C?.current)return;const e=C?.current;e.close(),e.removeEventListener("suggestion",b),e.removeEventListener(o.$L,y),e.removeEventListener(o.bC,w),e.removeEventListener(o.$u,_),e.removeEventListener(o.q4,I),e.removeEventListener(o.co,j),e.removeEventListener("done",v)}),[C,b,y,w,_,I,j,v]),N=(0,r.useCallback)((()=>{Q(),u?.(),g("done")}),[u]);return(0,r.useEffect)((()=>{if(e?.length)return t&&x(e,n),()=>{N()}}),[t,e,x,N]),{suggestion:A,error:E,requestingState:m,request:x,stopSuggestion:N,reset:S,handleErrorQuotaExceededError:y,eventSource:C.current}}},93509:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(69307),a=n(65736),s=n(51128),o=n.n(s),i=n(46961);const __=a.__,l=o()("jetpack-ai-client:use-audio-transcription"),c=e=>{if("string"==typeof e)return e;if("code"in e)switch(e.code){case"error_quota_exceeded":return __("You exceeded your current quota, please check your plan details.","jetpack");case"jetpack_ai_missing_audio_param":return __("The audio_file is required to perform a transcription.","jetpack");case"jetpack_ai_service_unavailable":return __("The Jetpack AI service is temporarily unavailable.","jetpack");case"file_size_not_supported":return __("The provided audio file is too big.","jetpack");case"file_type_not_supported":return __("The provided audio file type is not supported.","jetpack");case"jetpack_ai_error":return __("There was an error processing the transcription request.","jetpack");default:return e.message}return"message"in e?e.message:__("There was an error processing the transcription request.","jetpack")};function u({feature:e,onReady:t,onError:n}){const[a,s]=(0,r.useState)(""),[o,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useRef)(null);return{transcriptionResult:a,isTranscribingAudio:d,transcriptionError:o,transcribeAudio:(0,r.useCallback)((r=>{l("Transcribing audio"),s(""),u(""),p(!0);const a=new AbortController;m.current=a,(0,i.Z)(r,e,a.signal).then((e=>{s(e),t?.(e)})).catch((e=>{a.signal.aborted||(u(e.message),n?.(c(e)))})).finally((()=>p(!1)))}),[i.Z,s,u,p]),cancelTranscription:(0,r.useCallback)((()=>{m.current?.abort(),s(""),u(""),p(!1)}),[m,s,u,p])}}},92718:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(69307),a=n(65736);const __=a.__,s=25e6,o=1500,i=["audio/mpeg","audio/mp3","audio/ogg","audio/flac","audio/x-flac","audio/m4a","audio/x-m4a","audio/mp4","audio/wav","audio/wave","audio/x-wav","audio/webm"];function l(){const[e,t]=(0,r.useState)(!1);return{isValidatingAudio:e,validateAudio:(0,r.useCallback)(((e,n,r)=>{if(t(!0),e?.size>s)return t(!1),r(__("The audio file is too large. The maximum file size is 25MB.","jetpack"));const a=e instanceof File;if(a&&!i.includes(e.type))return t(!1),r(__("The audio file type is not supported. Please use a supported audio file type.","jetpack"));const l=new AudioContext;e.arrayBuffer().then((s=>{l.decodeAudioData(s,(function(s){const i=Math.ceil(s.duration);return i>o?(t(!1),r(__("The audio file is too long. The maximum recording time is 25 minutes.","jetpack"))):(t(!1),n({duration:i,isFile:a,size:e?.size}))}))}))}),[t])}}},70286:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51128),a=n.n(r),s=n(78982),o=n(2890);const i=a()("ai-client:use-image-generator"),l=(e,t)=>{const n=4e3-t;return e.length>n?e.substring(0,n-6)+" [...]":e},c=async(e,t,n)=>{const r=((e,t)=>{if(t){const n=`I need a Stable Diffusion prompt to generate a featured image for a blog post based on this user-provided image description:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nThe image should be a photo. Make sure you highlight the main suject of the image description, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}return"I need a Stable Diffusion prompt to generate a featured image for a blog post with the following content.\nThe image should be a photo. Make sure you highlight the main suject of the content, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments. The content is:\n\n"+l(e,412)})(e,t),a=await(0,s.Z)(r,{feature:n});return a.choices?.[0]?.message?.content},u=()=>{const e=async function(e){let t="";try{t=(await(0,o.Z)()).token}catch(e){return i("Error getting token: %o",e),Promise.reject(e)}try{const n="https://public-api.wordpress.com/wpcom/v2/jetpack-ai-image",r={Authorization:`Bearer ${t}`,"Content-Type":"application/json"},a=await fetch(n,{method:"POST",headers:r,body:JSON.stringify(e)}).then((e=>e.json()));return a?.data?.status&&a?.data?.status>200?(i("Error generating image: %o",a),Promise.reject(a)):a}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}};return{generateImage:async function({feature:t,postContent:n,responseFormat:r="url",userPrompt:a}){try{i("Generating image");const s=((e,t)=>{if(t){const n=`I need a cover image for a blog post based on this user prompt:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nBefore creating the image, identify the main topic of the user prompt and relate it to the post content.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}const n="I need a cover image for a blog post.\nBefore creating the image, identify the main topic of the content and only represent it.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nThis is the post content:\n\n";return n+l(e,838)})(n,a),o={prompt:s,response_format:r,feature:t,size:"1792x1024"};return await e(o)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithStableDiffusion:async function({feature:t,postContent:n,userPrompt:r}){try{i("Generating image with Stable Diffusion");const a={prompt:await c(n,r,t),feature:t,model:"stable-diffusion",style:"photographic"};return await e(a)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}}}}},13109:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(69307);const a="audio/mp4;codecs=mp4a",s="audio/mp4",o="audio/webm";function i({onDone:e}={}){const t=(0,r.useRef)(null),[n,i]=(0,r.useState)("inactive"),l=(0,r.useRef)(!1),c=(0,r.useRef)(0),[u,d]=(0,r.useState)(0),p=(0,r.useRef)(null),[m,g]=(0,r.useState)(null),A=(0,r.useRef)([]).current,[h,E]=(0,r.useState)(null),f=(0,r.useRef)(null);function C(){return MediaRecorder.isTypeSupported(a)?new Blob(A,{type:s}):new Blob(A,{type:o})}const b=(0,r.useCallback)((e=>{if(y(),!e)return t?.current?.start();e<100&&(e=100),c.current=Date.now(),t?.current?.start(e)}),[]),v=(0,r.useCallback)((()=>{l.current=!0,t?.current?.pause(),d((e=>e+Date.now()-c.current))}),[]),k=(0,r.useCallback)((()=>{l.current=!1,t?.current?.resume(),c.current=Date.now()}),[]),B=(0,r.useCallback)((()=>{t?.current?.stop(),"recording"===n&&d((e=>e+Date.now()-c.current))}),[]),y=(0,r.useCallback)((()=>{A.length=0,g(null),E(null),d(0),l.current=!1,c.current=0}),[]),w=(0,r.useCallback)((()=>{t?.current&&(t.current.removeEventListener("start",j),t.current.removeEventListener("stop",x),t.current.removeEventListener("pause",S),t.current.removeEventListener("resume",Q),t.current.removeEventListener("dataavailable",N),t.current=null)}),[]),_=(0,r.useCallback)((()=>{if(i("inactive"),y(),w(),!navigator.mediaDevices?.getUserMedia)return;const e=new AudioContext;f.current=e.createAnalyser();navigator.mediaDevices.getUserMedia({audio:!0}).then((n=>{p.current=n;e.createMediaStreamSource(n).connect(f.current),MediaRecorder.isTypeSupported(a)?t.current=new MediaRecorder(n,{mimeType:a}):t.current=new MediaRecorder(n,{mimeType:o}),t.current.addEventListener("start",j),t.current.addEventListener("stop",x),t.current.addEventListener("pause",S),t.current.addEventListener("resume",Q),t.current.addEventListener("dataavailable",N)})).catch((e=>{throw e}))}),[]),I=(0,r.useCallback)((e=>{B(),E("string"==typeof e?e:e.message),i("error")}),[]);function j(){i("recording")}function x(){const t=C();e?.(t),A.length=0}function S(){i("paused")}function Q(){i("recording")}function N(e){const{data:t}=e;t?.size&&(A.push(t),g(C()),l.current||d((e=>{const t=Date.now(),n=t-c.current;return c.current=t,e+n})))}return(0,r.useEffect)((()=>(_(),()=>{p.current&&p.current.getTracks().forEach((e=>e.stop())),w()})),[]),{state:n,blob:m,error:h,duration:u,analyser:f.current,onError:I,controls:{start:b,pause:v,resume:k,stop:B,reset:_}}}},44696:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>c});var r=n(69307),a=n(51128),s=n.n(a),o=n(42194);const i=s()("jetpack-ai-client:use-transcription-post-processing"),l="voice-to-content-simple-draft";function c({feature:e,onReady:t,onError:n,onUpdate:a}){const[s,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useCallback)((e=>{l(e),a?.(e)}),[l,a]),g=(0,r.useCallback)((e=>{l(e),a?.(e),t?.(e)}),[l,a,t]),A=(0,r.useCallback)((e=>{u(e.message),n?.(e.message)}),[u,n]),{request:h,stopSuggestion:E}=(0,o.Z)({onSuggestion:m,onDone:g,onError:A});return{postProcessingResult:s,isProcessingTranscription:d,postProcessingError:c,processTranscription:(0,r.useCallback)(((t,n)=>{i("Post-processing transcription"),l(""),u(""),p(!0);h([{role:"jetpack-ai",context:{type:t,content:n}}],{feature:e})}),[l,u,p,h,e]),cancelTranscriptionProcessing:(0,r.useCallback)((()=>{E(),p(!1)}),[E,p])}}},61317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"ai-assistant-icon"},s().createElement(r.Path,{className:"spark-first",d:"M9.33301 5.33325L10.4644 8.20188L13.333 9.33325L10.4644 10.4646L9.33301 13.3333L8.20164 10.4646L5.33301 9.33325L8.20164 8.20188L9.33301 5.33325Z"}),s().createElement(r.Path,{className:"spark-second",d:"M21.3333 5.33333L22.8418 9.15817L26.6667 10.6667L22.8418 12.1752L21.3333 16L19.8248 12.1752L16 10.6667L19.8248 9.15817L21.3333 5.33333Z"}),s().createElement(r.Path,{className:"spark-third",d:"M14.6667 13.3333L16.5523 18.1144L21.3333 20L16.5523 21.8856L14.6667 26.6667L12.781 21.8856L8 20L12.781 18.1144L14.6667 13.3333Z"}))},83585:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(55609);const a=React.createElement(r.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.95833C6.66328 3.95833 3.95833 6.66327 3.95833 9.99999C3.95833 13.3367 6.66328 16.0417 10 16.0417C13.3367 16.0417 16.0417 13.3367 16.0417 9.99999C16.0417 6.66327 13.3367 3.95833 10 3.95833ZM2.70833 9.99999C2.70833 5.97292 5.97292 2.70833 10 2.70833C14.0271 2.70833 17.2917 5.97292 17.2917 9.99999C17.2917 14.0271 14.0271 17.2917 10 17.2917C5.97292 17.2917 2.70833 14.0271 2.70833 9.99999Z"}),React.createElement(r.Path,{d:"M10.8333 5.83333H9.16667V10.8333H10.8333V5.83333Z"}),React.createElement(r.Path,{d:"M10.8333 12.5H9.16667V14.1667H10.8333V12.5Z"}))},59822:(e,t,n)=>{"use strict";n.d(t,{Qf:()=>a.Z,Qr:()=>s.Z,u_:()=>r.Z,v_:()=>o.Z});var r=n(61317),a=n(81204),s=(n(4454),n(71893),n(52887),n(96083)),o=n(50500)},81204:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"10.5",y:"8.25",width:"3",height:"4.875",rx:"1.5",fill:"#008710"}),s().createElement(r.Path,{d:"M15 11.25C15 11.644 14.9224 12.0341 14.7716 12.3981C14.6209 12.762 14.3999 13.0927 14.1213 13.3713C13.8427 13.6499 13.512 13.8709 13.1481 14.0216C12.7841 14.1724 12.394 14.25 12 14.25C11.606 14.25 11.2159 14.1724 10.8519 14.0216C10.488 13.8709 10.1573 13.6499 9.87868 13.3713C9.6001 13.0927 9.37913 12.762 9.22836 12.3981C9.0776 12.0341 9 11.644 9 11.25",stroke:"#008710",strokeWidth:"1.125",strokeLinecap:"round"}),s().createElement(r.Path,{d:"M11.4375 15.75C11.4375 16.0607 11.6893 16.3125 12 16.3125C12.3107 16.3125 12.5625 16.0607 12.5625 15.75L11.4375 15.75ZM11.4375 14.25L11.4375 15.75L12.5625 15.75L12.5625 14.25L11.4375 14.25Z",fill:"#008710"}))},4454:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},96083:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"12.75",y:"9",width:"2.25",height:"6",fill:"#008710"}),s().createElement(r.Rect,{x:"9",y:"9",width:"2.25",height:"6",fill:"#008710"}))},71893:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},52887:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Rect},50500:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5 10C12.5 11.3807 11.3807 12.5 10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10ZM14 10C14 12.2091 12.2091 14 10 14C7.79086 14 6 12.2091 6 10C6 7.79086 7.79086 6 10 6C12.2091 6 14 7.79086 14 10ZM16.75 21V19C16.75 17.4812 15.5188 16.25 14 16.25L6 16.25C4.48122 16.25 3.25 17.4812 3.25 19V21H4.75L4.75 19C4.75 18.3096 5.30964 17.75 6 17.75L14 17.75C14.6904 17.75 15.25 18.3096 15.25 19V21H16.75Z",fill:"currentColor"}),s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M19.976 16.3599C21.2507 14.5642 22.0001 12.3695 22.0001 9.99969C22.0001 7.63128 21.2515 5.43769 19.9782 3.64258L18.754 4.50967C19.8537 6.05996 20.5001 7.95434 20.5001 9.99969C20.5001 12.0464 19.8528 13.9419 18.7519 15.4928L19.976 16.3599ZM17.3357 14.4897C18.2357 13.222 18.7648 11.6727 18.7648 9.99969C18.7648 8.32808 18.2365 6.77984 17.3379 5.51279L16.1137 6.37988C16.8387 7.4021 17.2648 8.65114 17.2648 9.99969C17.2648 11.3496 16.8378 12.5998 16.1116 13.6226L17.3357 14.4897Z",fill:"currentColor"}))},42290:(e,t,n)=>{"use strict";n.d(t,{$L:()=>p.$L,$u:()=>p.$u,C3:()=>u.C3,Eo:()=>u.Eo,JP:()=>m.JP,L$:()=>i.Z,LB:()=>m.LB,MW:()=>u.MW,OS:()=>o.Z,Qf:()=>c.Qf,Qr:()=>c.Qr,Rc:()=>l.Z,X_:()=>d.X_,Y:()=>p.Y,ZK:()=>u.ZK,_T:()=>a.Z,bC:()=>p.bC,cH:()=>s.Z,co:()=>p.co,cv:()=>p.cv,g:()=>m.g,oN:()=>d.oN,pw:()=>r.Z,q4:()=>p.q4,rp:()=>u.rp,u_:()=>c.u_,v_:()=>c.v_,xi:()=>u.xi});n(2890),n(56694),n(67742),n(46961);var r=n(42194),a=n(13109),s=n(93509),o=n(44696),i=n(92718),l=n(70286),c=n(59822),u=n(58890),d=n(20281),p=n(16700),m=n(35613)},2890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(51128),s=n.n(a),o=n(87309);const i=s()("jetpack-ai-client:jwt"),l="jetpack-ai-jwt",c=12e4;async function u({apiNonce:e,siteId:t,expirationTime:n}={}){e=e||window.JP_CONNECTION_INITIAL_STATE.apiNonce,t=t||window.JP_CONNECTION_INITIAL_STATE.siteSuffix,n=n||c;const a=(0,r.Wp)(),s=localStorage.getItem(l);let u,d=null;if(s)try{d=JSON.parse(s)}catch(e){i("Error parsing token",e)}if(d&&d?.expire>Date.now())return i("Using cached token"),d;u=a?await(0,o.Z)({path:"/wpcom/v2/sites/"+t+"/jetpack-openai-query/jwt",method:"POST"}):await(0,o.Z)({path:"/jetpack/v4/jetpack-ai-jwt?_cacheBuster="+Date.now(),credentials:"same-origin",headers:{"X-WP-Nonce":e},method:"POST"});const p={token:u.token,blogId:a?t:u.blog_id,expire:Date.now()+n};return i("Storing new token"),localStorage.setItem(l,JSON.stringify(p)),p}},35613:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.JP,LB:()=>r.LB,g:()=>r.g});var r=n(71197)},22999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(92213);const a={paragraph:e=>e.replaceAll("\n"," ")},s={emDelimiter:"_",headingStyle:"atx"},o={strikethrough:{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}}};class i{constructor({options:e={},rules:t={},keep:n=[],remove:a=[],fixes:i=[]}={}){this.fixes=i,this.turndownService=new r.Z({...s,...e}),this.turndownService.keep(n),this.turndownService.remove(a);const l={...o,...t};for(const e in l)this.turndownService.addRule(e,l[e])}render({content:e}){const t=this.turndownService.turndown(e);return this.fixes.reduce(((e,t)=>a[t](e)),t)}}},71197:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.Z,LB:()=>o,g:()=>i});var r=n(22999);const a=new(n(28603).Z),s=new r.Z,o=({content:e,rules:t,extension:n})=>a.render({content:e,rules:t,extension:n}),i=({content:e})=>s.render({content:e})},28603:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(95601);const a=e=>e.replaceAll("\x3c!-- wp:list-item --\x3e","").replaceAll("\x3c!-- /wp:list-item --\x3e","").replaceAll("\x3c!-- wp:list --\x3e","").replaceAll("\x3c!-- /wp:list --\x3e","").replaceAll("","\x3c!-- wp:list-item --\x3e ").replaceAll(" ","\x3c!-- /wp:list-item --\x3e").replaceAll("",'\x3c!-- wp:list {"ordered":true} --\x3e').replaceAll(" "," \x3c!-- /wp:list --\x3e").replaceAll("","\x3c!-- wp:list --\x3e"," \x3c!-- /wp:list --\x3e"),s={list:(e,t=!1)=>{const n=e.replace(/\s+/g,"
").replace(/<\/p>\s+<\/li>/g," ");return t?a(n):n},listItem:(e,t=!1)=>t?a(e.replace(/^<[ou]l>\s*/g,"").replace(/\s*<\/[ou]l>\s*$/g,"")):e,paragraph:(e,t=!1)=>t?e.replaceAll(/\s*<br \/>\s*/g," "):e},o={breaks:!0},i=["list"];class l{constructor(e=o){this.markdownConverter=new r.Z(e)}render({content:e,rules:t=i,extension:n=!1}){const r=this.markdownConverter.render(e);return t.reduce(((e,t)=>s[t](e,n)),r)}}},56694:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(60400),a=n(51128),s=n.n(a),o=n(42194),i=n(2890),l=n(16700);const c=s()("jetpack-ai-client:suggestions-event-source");class u extends EventTarget{constructor(e){super(),this.fullMessage="",this.fullFunctionCall={name:"",arguments:""},this.isPromptClear=!1,this.controller=new AbortController,this.initEventSource(e)}async initEventSource({url:e,question:t,token:n,options:a={}}){if(!n)try{c("Token was not provided, requesting one..."),n=(await(0,i.Z)()).token}catch(e){return void this.processErrorEvent(e)}const s={};if(Number.isInteger(parseInt(a.postId))&&(s.post_id=+a.postId),!e){const t=new URL("https://public-api.wordpress.com/wpcom/v2/jetpack-ai-query");a?.fromCache&&t.searchParams.append("stream_cache","true"),e=t.toString(),c("URL not provided, using default: %o",e)}Array.isArray(t)?s.messages=t:s.question=t,a?.feature?.length&&(c("Feature: %o",a.feature),s.feature=a.feature),a?.functions?.length&&(c("Functions: %o",a.functions),s.functions=a.functions),a?.model?.length&&(c("Model: %o",a.model),s.model=a.model),this.errorUnclearPromptTriggered=!1,await(0,r.L)(e,{openWhenHidden:!0,method:"POST",headers:{"Content-type":"application/json",Authorization:"Bearer "+n},body:JSON.stringify(s),onclose:()=>{c("Stream closed")},onerror:e=>{throw this.processErrorEvent(e),e},onmessage:e=>{this.processEvent(e)},onopen:async e=>{if(e.ok)return;let t;throw e.status>=400&&e.status<=500&&![413,422,429].includes(e.status)&&(c("Connection error: %o",e),t=l.co,this.dispatchEvent(new CustomEvent(l.co,{detail:e}))),503===e.status&&(t=l.$u,this.dispatchEvent(new CustomEvent(l.$u))),413===e.status&&(t=l.cv,this.dispatchEvent(new CustomEvent(l.cv))),422===e.status&&(t=l.q4,this.dispatchEvent(new CustomEvent(l.q4))),429===e.status&&(t=l.$L,this.dispatchEvent(new CustomEvent(l.$L))),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(t)})),new Error},signal:this.controller.signal})}checkForUnclearPrompt(){if(this.isPromptClear)return;const e=this.fullMessage.replace(/__|(\*\*)/g,"");if(e.startsWith("JETPACK_AI_ERROR")){if(this.errorUnclearPromptTriggered)return;this.errorUnclearPromptTriggered=!0,this.dispatchEvent(new CustomEvent(l.bC)),c("Unclear error prompt dispatched"),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.bC)}))}else"JETPACK_AI_ERROR".startsWith(e)?c(this.fullMessage):this.isPromptClear=!0}close(){this.controller.abort()}processEvent(e){if("[DONE]"===e.data){if(this.errorUnclearPromptTriggered)return;if(this.fullMessage.length)return this.dispatchEvent(new CustomEvent("done",{detail:this.fullMessage})),void c("Done: %o",this.fullMessage);if(this.fullFunctionCall.name.length)return this.dispatchEvent(new CustomEvent("function_done",{detail:this.fullFunctionCall})),void c("Done: %o",this.fullFunctionCall)}let t;try{t=JSON.parse(e.data)}catch(t){return void c("Error parsing JSON",e,t)}const{delta:n}=t?.choices?.[0]??{delta:{content:null,function_call:null}},r=n.content,a=n.function_call;r&&(this.fullMessage+=r,this.checkForUnclearPrompt(),this.isPromptClear&&(this.dispatchEvent(new CustomEvent("chunk",{detail:r})),c("suggestion: %o",this.fullMessage),this.dispatchEvent(new CustomEvent("suggestion",{detail:this.fullMessage})))),a&&(null!=a.name&&(this.fullFunctionCall.name+=a.name),null!=a.arguments&&(this.fullFunctionCall.arguments+=a.arguments),this.dispatchEvent(new CustomEvent("functionCallChunk",{detail:this.fullFunctionCall})))}processErrorEvent(e){c("onerror: %o",e),this.dispatchEvent(new CustomEvent(l.co,{detail:e})),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.co)}))}}},16700:(e,t,n)=>{"use strict";n.d(t,{$L:()=>s,$u:()=>a,Y:()=>r.Y,bC:()=>c,co:()=>l,cv:()=>i,q4:()=>o,vF:()=>u});var r=n(44696);const a="error_service_unavailable",s="error_quota_exceeded",o="error_moderation",i="error_context_too_large",l="error_network",c="error_unclear_prompt",u="error_response"},6975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51128);const a=n.n(r)()("dops:analytics");let s,o;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const i={initialize:function(e,t,n){i.setUser(e,t),i.setSuperProps(n),i.identifyUser()},setGoogleAnalyticsEnabled:function(e,t=null){this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){o={ID:e,username:t}},setSuperProps:function(e){s=e},assignSuperProps:function(e){s=Object.assign(s||{},e)},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Built stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){i.tracks.recordPageView(e),i.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,a,s,o){i.ga.recordPurchase(e,t,n,r,a,s,o)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(s&&(a("- Super Props: %o",s),t=Object.assign(t,s)),a('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):a('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};i.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){i.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){a("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};i.ga.initialized||(o&&(e={userId:"u-"+o.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),i.ga.initialized=!0)},recordPageView:function(e,t){i.ga.initialize(),a("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){i.ga.initialize();let s="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(s+=" [Option Label: "+n+"]"),void 0!==r&&(s+=" [Option Value: "+r+"]"),a(s),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,a,s,o){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:o}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:a,quantity:s}),window.ga("ecommerce:send")}},identifyUser:function(){o&&window._tkq.push(["identifyUser",o.ID,o.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}},l=i},64743:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(61132),a=n(96483);function s(e){class t extends Error{constructor(...t){super(...t),this.name=e}}return t}const o=s("JsonParseError"),i=s("JsonParseAfterRedirectError"),l=s("Api404Error"),c=s("Api404AfterRedirectError"),u=s("FetchNetworkError");const d=new function(e,t){let n=e,s=e,o={"X-WP-Nonce":t},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})},c=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setWpcomOriginApiUrl(e){s=e},setApiNonce(e){o={"X-WP-Nonce":e},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{c=e},registerSite:(e,t,a)=>{const s={registration_nonce:e,no_iframe:!0};return(0,r.jetpackConfigHas)("consumer_slug")&&(s.plugin_slug=(0,r.jetpackConfigGet)("consumer_slug")),null!==t&&(s.redirect_uri=t),a&&(s.from=a),g(`${n}jetpack/v4/connection/register`,l,{body:JSON.stringify(s)}).then(p).then(m)},fetchAuthorizationUrl:e=>d((0,a.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),i).then(p).then(m),fetchSiteConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchSiteConnectionStatus:()=>d(`${n}jetpack/v4/connection`,i).then(m),fetchSiteConnectionTest:()=>d(`${n}jetpack/v4/connection/test`,i).then(p).then(m),fetchUserConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchUserTrackingSettings:()=>d(`${n}jetpack/v4/tracking/settings`,i).then(p).then(m),updateUserTrackingSettings:e=>g(`${n}jetpack/v4/tracking/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),disconnectSite:()=>g(`${n}jetpack/v4/connection`,l,{body:JSON.stringify({isActive:!1})}).then(p).then(m),fetchConnectUrl:()=>d(`${n}jetpack/v4/connection/url`,i).then(p).then(m),unlinkUser:()=>g(`${n}jetpack/v4/connection/user`,l,{body:JSON.stringify({linked:!1})}).then(p).then(m),reconnect:()=>g(`${n}jetpack/v4/connection/reconnect`,l).then(p).then(m),fetchConnectedPlugins:()=>d(`${n}jetpack/v4/connection/plugins`,i).then(p).then(m),setHasSeenWCConnectionModal:()=>g(`${n}jetpack/v4/seen-wc-connection-modal`,l).then(p).then(m),fetchModules:()=>d(`${n}jetpack/v4/module/all`,i).then(p).then(m),fetchModule:e=>d(`${n}jetpack/v4/module/${e}`,i).then(p).then(m),activateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!0})}).then(p).then(m),deactivateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>g(`${n}jetpack/v4/module/${e}`,l,{body:JSON.stringify(t)}).then(p).then(m),updateSettings:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),getProtectCount:()=>d(`${n}jetpack/v4/module/protect/data`,i).then(p).then(m),resetOptions:e=>g(`${n}jetpack/v4/options/${e}`,l,{body:JSON.stringify({reset:!0})}).then(p).then(m),activateVaultPress:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(p).then(m),getVaultPressData:()=>d(`${n}jetpack/v4/module/vaultpress/data`,i).then(p).then(m),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify(r)}).then(p).then(m)},activateAkismet:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(p).then(m),getAkismetData:()=>d(`${n}jetpack/v4/module/akismet/data`,i).then(p).then(m),checkAkismetKey:()=>d(`${n}jetpack/v4/module/akismet/key/check`,i).then(p).then(m),checkAkismetKeyTyped:e=>g(`${n}jetpack/v4/module/akismet/key/check`,l,{body:JSON.stringify({api_key:e})}).then(p).then(m),fetchStatsData:e=>d(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),i).then(p).then(m).then(h),getPluginUpdates:()=>d(`${n}jetpack/v4/updates/plugins`,i).then(p).then(m),getPlans:()=>d(`${n}jetpack/v4/plans`,i).then(p).then(m),fetchSettings:()=>d(`${n}jetpack/v4/settings`,i).then(p).then(m),updateSetting:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSiteData:()=>d(`${n}jetpack/v4/site`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>d(`${n}jetpack/v4/site/features`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>d(`${n}jetpack/v4/site/products`,i).then(p).then(m),fetchSitePurchases:()=>d(`${n}jetpack/v4/site/purchases`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>d(`${n}jetpack/v4/site/benefits`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteDiscount:()=>d(`${n}jetpack/v4/site/discount`,i).then(p).then(m).then((e=>e.data)),fetchSetupQuestionnaire:()=>d(`${n}jetpack/v4/setup/questionnaire`,i).then(p).then(m),fetchRecommendationsData:()=>d(`${n}jetpack/v4/recommendations/data`,i).then(p).then(m),fetchRecommendationsProductSuggestions:()=>d(`${n}jetpack/v4/recommendations/product-suggestions`,i).then(p).then(m),fetchRecommendationsUpsell:()=>d(`${n}jetpack/v4/recommendations/upsell`,i).then(p).then(m),fetchRecommendationsConditional:()=>d(`${n}jetpack/v4/recommendations/conditional`,i).then(p).then(m),saveRecommendationsData:e=>g(`${n}jetpack/v4/recommendations/data`,l,{body:JSON.stringify({data:e})}).then(p),fetchProducts:()=>d(`${n}jetpack/v4/products`,i).then(p).then(m),fetchRewindStatus:()=>d(`${n}jetpack/v4/rewind`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>d(`${n}jetpack/v4/scan`,i).then(p).then(m).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>g(`${n}jetpack/v4/notice/${e}`,l,{body:JSON.stringify({dismissed:!0})}).then(p).then(m),fetchPluginsData:()=>d(`${n}jetpack/v4/plugins`,i).then(p).then(m),fetchIntroOffers:()=>d(`${n}jetpack/v4/intro-offers`,i).then(p).then(m),fetchVerifySiteGoogleStatus:e=>d(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,i).then(p).then(m),verifySiteGoogle:e=>g(`${n}jetpack/v4/verify-site/google`,l,{body:JSON.stringify({keyring_id:e})}).then(p).then(m),submitSurvey:e=>g(`${n}jetpack/v4/marketing/survey`,l,{body:JSON.stringify(e)}).then(p).then(m),saveSetupQuestionnaire:e=>g(`${n}jetpack/v4/setup/questionnaire`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicensingError:e=>g(`${n}jetpack/v4/licensing/error`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicenseKey:e=>g(`${n}jetpack/v4/licensing/set-license`,l,{body:JSON.stringify({license:e})}).then(p).then(m),getUserLicensesCounts:()=>d(`${n}jetpack/v4/licensing/user/counts`,i).then(p).then(m),getUserLicenses:()=>d(`${n}jetpack/v4/licensing/user/licenses`,i).then(p).then(m),updateLicensingActivationNoticeDismiss:e=>g(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,l,{body:JSON.stringify({last_detached_count:e})}).then(p).then(m),updateRecommendationsStep:e=>g(`${n}jetpack/v4/recommendations/step`,l,{body:JSON.stringify({step:e})}).then(p),confirmIDCSafeMode:()=>g(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,l).then(p),startIDCFresh:e=>g(`${n}jetpack/v4/identity-crisis/start-fresh`,l,{body:JSON.stringify({redirect_uri:e})}).then(p).then(m),migrateIDC:()=>g(`${n}jetpack/v4/identity-crisis/migrate`,l).then(p),attachLicenses:e=>g(`${n}jetpack/v4/licensing/attach-licenses`,l,{body:JSON.stringify({licenses:e})}).then(p).then(m),fetchSearchPlanInfo:()=>d(`${s}jetpack/v4/search/plan`,i).then(p).then(m),fetchSearchSettings:()=>d(`${s}jetpack/v4/search/settings`,i).then(p).then(m),updateSearchSettings:e=>g(`${s}jetpack/v4/search/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSearchStats:()=>d(`${s}jetpack/v4/search/stats`,i).then(p).then(m),fetchWafSettings:()=>d(`${n}jetpack/v4/waf`,i).then(p).then(m),updateWafSettings:e=>g(`${n}jetpack/v4/waf`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchWordAdsSettings:()=>d(`${n}jetpack/v4/wordads/settings`,i).then(p).then(m),updateWordAdsSettings:e=>g(`${n}jetpack/v4/wordads/settings`,l,{body:JSON.stringify(e)}),fetchSearchPricing:()=>d(`${s}jetpack/v4/search/pricing`,i).then(p).then(m),fetchMigrationStatus:()=>d(`${n}jetpack/v4/migration/status`,i).then(p).then(m),fetchBackupUndoEvent:()=>d(`${n}jetpack/v4/site/backup/undo-event`,i).then(p).then(m),fetchBackupPreflightStatus:()=>d(`${n}jetpack/v4/site/backup/preflight`,i).then(p).then(m)};function d(e,t){return fetch(c(e),t)}function g(e,t,n){return fetch(e,Object.assign({},t,n)).catch(A)}function h(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}Object.assign(this,u)};function p(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new c(e.redirected):new l})):e.json().catch((e=>g(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function m(e){return e.json().catch((t=>g(t,e.redirected,e.url)))}function g(e,t,n){throw t?new i(n):new o}function A(){throw new u}},90526:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(82674),a=n.n(r),s=n(55609),o=n(65736),i=n(61074),l=n(15381),c=n(65235),u=n.n(c),d=n(99196),p=n.n(d),m=n(62103);const __=o.__,g=(0,d.forwardRef)(((e,t)=>{const{children:n,variant:r="primary",size:o="normal",weight:c="bold",icon:d,iconSize:g,disabled:A,isDestructive:h,isLoading:E,isExternalLink:f,className:C,text:b,fullWidth:v,...k}=e,B=u()(m.Z.button,C,{[m.Z.normal]:"normal"===o,[m.Z.small]:"small"===o,[m.Z.icon]:Boolean(d),[m.Z.loading]:E,[m.Z.regular]:"regular"===c,[m.Z["full-width"]]:v,[m.Z["is-icon-button"]]:Boolean(d)&&!n});k.ref=t;const y="normal"===o?20:16,w=f&&p().createElement(p().Fragment,null,p().createElement(i.Z,{size:y,icon:l.Z,className:m.Z["external-icon"]}),p().createElement(s.VisuallyHidden,{as:"span"},/* translators: accessibility text */
+__("Error: %1$s","jetpack"),i)),t===d.$L?React.createElement(r.Button,{variant:"link",onClick:s,href:o,target:o?"_blank":null},__("Upgrade now","jetpack")):React.createElement(r.Button,{variant:"link",onClick:n},__("Try again","jetpack")))}},62282:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,u:()=>s});var r=n(99196),a=n.n(r);const s=(0,r.createContext)({}),o=({value:e,children:t})=>a().createElement(s.Provider,{value:e,children:t})},20281:(e,t,n)=>{"use strict";n.d(t,{X_:()=>s.Z,hE:()=>r.h,oN:()=>a.Z,uE:()=>r.u});var r=n(62282),a=n(3669),s=n(79466)},79466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(99196),a=n(16700),s=n(20281);function o({onDone:e,onSuggestion:t,onError:n}={}){const o=(0,r.useContext)(s.uE),{eventSource:i}=o,l=(0,r.useCallback)((t=>e?.(t?.detail)),[e]),c=(0,r.useCallback)((e=>t?.(e?.detail)),[t]),u=(0,r.useCallback)((e=>{n?.(e?.detail)}),[]);return(0,r.useEffect)((()=>{if(i)return e&&i.addEventListener("done",l),t&&i.addEventListener("suggestion",c),n&&i.addEventListener(a.vF,u),()=>{i.removeEventListener("done",l),i.removeEventListener("suggestion",c),i.removeEventListener(a.vF,u)}}),[i]),o}},3669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(94333),a=n(69307),s=n(99196),o=n.n(s),i=n(42194),l=n(20281);const c=(0,r.createHigherOrderComponent)((e=>t=>{const{suggestion:n,error:r,requestingState:s,request:c,stopSuggestion:u,eventSource:d}=(0,i.Z)(),p=(0,a.useMemo)((()=>({suggestion:n,requestingError:r,requestingState:s,eventSource:d,requestSuggestion:c,stopSuggestion:u})),[n,r,s,d,c,u]);return o().createElement(l.hE,{value:p},o().createElement(e,t))}),"withAiDataProvider")},42194:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Z:()=>l});var r=n(69307),a=n(65736),s=n(67742),o=n(16700);const __=a.__;function i(e){switch(e){case o.$L:return{code:o.$L,message:__("You have reached the limit of requests for this site.","jetpack"),severity:"info"};case o.bC:return{code:o.bC,message:__("Your request was unclear. Mind trying again?","jetpack"),severity:"info"};case o.$u:return{code:o.$u,message:__("Jetpack AI services are currently unavailable. Sorry for the inconvenience.","jetpack"),severity:"info"};case o.q4:return{code:o.q4,message:__("This request has been flagged by our moderation system. Please try to rephrase it and try again.","jetpack"),severity:"info"};case o.cv:return{code:o.cv,message:__("The content is too large to be processed all at once. Please try to shorten it or divide it into smaller parts.","jetpack"),severity:"info"};case o.co:default:return{code:o.co,message:__("It was not possible to process your request. Mind trying again?","jetpack"),severity:"info"}}}function l({prompt:e,autoRequest:t=!1,askQuestionOptions:n={},initialRequestingState:a="init",onSuggestion:l,onDone:c,onStop:u,onError:d,onAllErrors:p}={}){const[m,g]=(0,r.useState)(a),[A,h]=(0,r.useState)(""),[E,f]=(0,r.useState)(),C=(0,r.useRef)(void 0),b=(0,r.useCallback)((e=>{h(e?.detail),l?.(e?.detail)}),[l]),v=(0,r.useCallback)((e=>{Q(),c?.(e?.detail),g("done")}),[c]),k=(0,r.useCallback)((e=>{p?.(e?.detail)}),[p]),B=(0,r.useCallback)((e=>{C?.current?.close(),g("error"),f(i(e)),d?.(i(e))}),[d]),y=(0,r.useCallback)((()=>B(o.$L)),[]),w=(0,r.useCallback)((()=>B(o.bC)),[]),_=(0,r.useCallback)((()=>B(o.$u)),[]),I=(0,r.useCallback)((()=>B(o.q4)),[]),j=(0,r.useCallback)((()=>B(o.co)),[]),x=(0,r.useCallback)((async(e,t={...n})=>{if(f(void 0),g("requesting"),C.current=await(0,s.Z)(e,t),!C?.current)return;const r=C.current;g("suggesting"),r.addEventListener("suggestion",b),r.addEventListener(o.$L,y),r.addEventListener(o.bC,w),r.addEventListener(o.$u,_),r.addEventListener(o.q4,I),r.addEventListener(o.co,j),r.addEventListener(o.vF,k),r.addEventListener("done",v)}),[v,y,w,_,I,j,b]),S=(0,r.useCallback)((()=>{g("init"),h(""),f(void 0)}),[]),Q=(0,r.useCallback)((()=>{if(!C?.current)return;const e=C?.current;e.close(),e.removeEventListener("suggestion",b),e.removeEventListener(o.$L,y),e.removeEventListener(o.bC,w),e.removeEventListener(o.$u,_),e.removeEventListener(o.q4,I),e.removeEventListener(o.co,j),e.removeEventListener("done",v)}),[C,b,y,w,_,I,j,v]),N=(0,r.useCallback)((()=>{Q(),u?.(),g("done")}),[u]);return(0,r.useEffect)((()=>{if(e?.length)return t&&x(e,n),()=>{N()}}),[t,e,x,N]),{suggestion:A,error:E,requestingState:m,request:x,stopSuggestion:N,reset:S,handleErrorQuotaExceededError:y,eventSource:C.current}}},93509:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(69307),a=n(65736),s=n(51128),o=n.n(s),i=n(46961);const __=a.__,l=o()("jetpack-ai-client:use-audio-transcription"),c=e=>{if("string"==typeof e)return e;if("code"in e)switch(e.code){case"error_quota_exceeded":return __("You exceeded your current quota, please check your plan details.","jetpack");case"jetpack_ai_missing_audio_param":return __("The audio_file is required to perform a transcription.","jetpack");case"jetpack_ai_service_unavailable":return __("The Jetpack AI service is temporarily unavailable.","jetpack");case"file_size_not_supported":return __("The provided audio file is too big.","jetpack");case"file_type_not_supported":return __("The provided audio file type is not supported.","jetpack");case"jetpack_ai_error":return __("There was an error processing the transcription request.","jetpack");default:return e.message}return"message"in e?e.message:__("There was an error processing the transcription request.","jetpack")};function u({feature:e,onReady:t,onError:n}){const[a,s]=(0,r.useState)(""),[o,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useRef)(null);return{transcriptionResult:a,isTranscribingAudio:d,transcriptionError:o,transcribeAudio:(0,r.useCallback)((r=>{l("Transcribing audio"),s(""),u(""),p(!0);const a=new AbortController;m.current=a,(0,i.Z)(r,e,a.signal).then((e=>{s(e),t?.(e)})).catch((e=>{a.signal.aborted||(u(e.message),n?.(c(e)))})).finally((()=>p(!1)))}),[i.Z,s,u,p]),cancelTranscription:(0,r.useCallback)((()=>{m.current?.abort(),s(""),u(""),p(!1)}),[m,s,u,p])}}},92718:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(69307),a=n(65736);const __=a.__,s=25e6,o=1500,i=["audio/mpeg","audio/mp3","audio/ogg","audio/flac","audio/x-flac","audio/m4a","audio/x-m4a","audio/mp4","audio/wav","audio/wave","audio/x-wav","audio/webm"];function l(){const[e,t]=(0,r.useState)(!1);return{isValidatingAudio:e,validateAudio:(0,r.useCallback)(((e,n,r)=>{if(t(!0),e?.size>s)return t(!1),r(__("The audio file is too large. The maximum file size is 25MB.","jetpack"));const a=e instanceof File;if(a&&!i.includes(e.type))return t(!1),r(__("The audio file type is not supported. Please use a supported audio file type.","jetpack"));const l=new AudioContext;e.arrayBuffer().then((s=>{l.decodeAudioData(s,(function(s){const i=Math.ceil(s.duration);return i>o?(t(!1),r(__("The audio file is too long. The maximum recording time is 25 minutes.","jetpack"))):(t(!1),n({duration:i,isFile:a,size:e?.size}))}))}))}),[t])}}},70286:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51128),a=n.n(r),s=n(78982),o=n(2890);const i=a()("ai-client:use-image-generator"),l=(e,t)=>{const n=4e3-t;return e.length>n?e.substring(0,n-6)+" [...]":e},c=async(e,t,n)=>{const r=((e,t)=>{if(t){const n=`I need a Stable Diffusion prompt to generate a featured image for a blog post based on this user-provided image description:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nThe image should be a photo. Make sure you highlight the main suject of the image description, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}return"I need a Stable Diffusion prompt to generate a featured image for a blog post with the following content.\nThe image should be a photo. Make sure you highlight the main suject of the content, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments. The content is:\n\n"+l(e,412)})(e,t),a=await(0,s.Z)(r,{feature:n});return a.choices?.[0]?.message?.content},u=()=>{const e=async function(e){let t="";try{t=(await(0,o.Z)()).token}catch(e){return i("Error getting token: %o",e),Promise.reject(e)}try{const n="https://public-api.wordpress.com/wpcom/v2/jetpack-ai-image",r={Authorization:`Bearer ${t}`,"Content-Type":"application/json"},a=await fetch(n,{method:"POST",headers:r,body:JSON.stringify(e)}).then((e=>e.json()));return a?.data?.status&&a?.data?.status>200?(i("Error generating image: %o",a),Promise.reject(a)):a}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}};return{generateImage:async function({feature:t,postContent:n,responseFormat:r="url",userPrompt:a}){try{i("Generating image");const s=((e,t)=>{if(t){const n=`I need a cover image for a blog post based on this user prompt:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nBefore creating the image, identify the main topic of the user prompt and relate it to the post content.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}const n="I need a cover image for a blog post.\nBefore creating the image, identify the main topic of the content and only represent it.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nThis is the post content:\n\n";return n+l(e,838)})(n,a),o={prompt:s,response_format:r,feature:t,size:"1792x1024"};return await e(o)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithStableDiffusion:async function({feature:t,postContent:n,userPrompt:r}){try{i("Generating image with Stable Diffusion");const a={prompt:await c(n,r,t),feature:t,model:"stable-diffusion",style:"photographic"};return await e(a)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithParameters:e}}},13109:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(69307);const a="audio/mp4;codecs=mp4a",s="audio/mp4",o="audio/webm";function i({onDone:e}={}){const t=(0,r.useRef)(null),[n,i]=(0,r.useState)("inactive"),l=(0,r.useRef)(!1),c=(0,r.useRef)(0),[u,d]=(0,r.useState)(0),p=(0,r.useRef)(null),[m,g]=(0,r.useState)(null),A=(0,r.useRef)([]).current,[h,E]=(0,r.useState)(null),f=(0,r.useRef)(null);function C(){return MediaRecorder.isTypeSupported(a)?new Blob(A,{type:s}):new Blob(A,{type:o})}const b=(0,r.useCallback)((e=>{if(y(),!e)return t?.current?.start();e<100&&(e=100),c.current=Date.now(),t?.current?.start(e)}),[]),v=(0,r.useCallback)((()=>{l.current=!0,t?.current?.pause(),d((e=>e+Date.now()-c.current))}),[]),k=(0,r.useCallback)((()=>{l.current=!1,t?.current?.resume(),c.current=Date.now()}),[]),B=(0,r.useCallback)((()=>{t?.current?.stop(),"recording"===n&&d((e=>e+Date.now()-c.current))}),[]),y=(0,r.useCallback)((()=>{A.length=0,g(null),E(null),d(0),l.current=!1,c.current=0}),[]),w=(0,r.useCallback)((()=>{t?.current&&(t.current.removeEventListener("start",j),t.current.removeEventListener("stop",x),t.current.removeEventListener("pause",S),t.current.removeEventListener("resume",Q),t.current.removeEventListener("dataavailable",N),t.current=null)}),[]),_=(0,r.useCallback)((()=>{if(i("inactive"),y(),w(),!navigator.mediaDevices?.getUserMedia)return;const e=new AudioContext;f.current=e.createAnalyser();navigator.mediaDevices.getUserMedia({audio:!0}).then((n=>{p.current=n;e.createMediaStreamSource(n).connect(f.current),MediaRecorder.isTypeSupported(a)?t.current=new MediaRecorder(n,{mimeType:a}):t.current=new MediaRecorder(n,{mimeType:o}),t.current.addEventListener("start",j),t.current.addEventListener("stop",x),t.current.addEventListener("pause",S),t.current.addEventListener("resume",Q),t.current.addEventListener("dataavailable",N)})).catch((e=>{throw e}))}),[]),I=(0,r.useCallback)((e=>{B(),E("string"==typeof e?e:e.message),i("error")}),[]);function j(){i("recording")}function x(){const t=C();e?.(t),A.length=0}function S(){i("paused")}function Q(){i("recording")}function N(e){const{data:t}=e;t?.size&&(A.push(t),g(C()),l.current||d((e=>{const t=Date.now(),n=t-c.current;return c.current=t,e+n})))}return(0,r.useEffect)((()=>(_(),()=>{p.current&&p.current.getTracks().forEach((e=>e.stop())),w()})),[]),{state:n,blob:m,error:h,duration:u,analyser:f.current,onError:I,controls:{start:b,pause:v,resume:k,stop:B,reset:_}}}},44696:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>c});var r=n(69307),a=n(51128),s=n.n(a),o=n(42194);const i=s()("jetpack-ai-client:use-transcription-post-processing"),l="voice-to-content-simple-draft";function c({feature:e,onReady:t,onError:n,onUpdate:a}){const[s,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useCallback)((e=>{l(e),a?.(e)}),[l,a]),g=(0,r.useCallback)((e=>{l(e),a?.(e),t?.(e)}),[l,a,t]),A=(0,r.useCallback)((e=>{u(e.message),n?.(e.message)}),[u,n]),{request:h,stopSuggestion:E}=(0,o.Z)({onSuggestion:m,onDone:g,onError:A});return{postProcessingResult:s,isProcessingTranscription:d,postProcessingError:c,processTranscription:(0,r.useCallback)(((t,n)=>{i("Post-processing transcription"),l(""),u(""),p(!0);h([{role:"jetpack-ai",context:{type:t,content:n}}],{feature:e})}),[l,u,p,h,e]),cancelTranscriptionProcessing:(0,r.useCallback)((()=>{E(),p(!1)}),[E,p])}}},61317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"ai-assistant-icon"},s().createElement(r.Path,{className:"spark-first",d:"M9.33301 5.33325L10.4644 8.20188L13.333 9.33325L10.4644 10.4646L9.33301 13.3333L8.20164 10.4646L5.33301 9.33325L8.20164 8.20188L9.33301 5.33325Z"}),s().createElement(r.Path,{className:"spark-second",d:"M21.3333 5.33333L22.8418 9.15817L26.6667 10.6667L22.8418 12.1752L21.3333 16L19.8248 12.1752L16 10.6667L19.8248 9.15817L21.3333 5.33333Z"}),s().createElement(r.Path,{className:"spark-third",d:"M14.6667 13.3333L16.5523 18.1144L21.3333 20L16.5523 21.8856L14.6667 26.6667L12.781 21.8856L8 20L12.781 18.1144L14.6667 13.3333Z"}))},83585:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(55609);const a=React.createElement(r.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.95833C6.66328 3.95833 3.95833 6.66327 3.95833 9.99999C3.95833 13.3367 6.66328 16.0417 10 16.0417C13.3367 16.0417 16.0417 13.3367 16.0417 9.99999C16.0417 6.66327 13.3367 3.95833 10 3.95833ZM2.70833 9.99999C2.70833 5.97292 5.97292 2.70833 10 2.70833C14.0271 2.70833 17.2917 5.97292 17.2917 9.99999C17.2917 14.0271 14.0271 17.2917 10 17.2917C5.97292 17.2917 2.70833 14.0271 2.70833 9.99999Z"}),React.createElement(r.Path,{d:"M10.8333 5.83333H9.16667V10.8333H10.8333V5.83333Z"}),React.createElement(r.Path,{d:"M10.8333 12.5H9.16667V14.1667H10.8333V12.5Z"}))},59822:(e,t,n)=>{"use strict";n.d(t,{Qf:()=>a.Z,Qr:()=>s.Z,u_:()=>r.Z,v_:()=>o.Z});var r=n(61317),a=n(81204),s=(n(4454),n(71893),n(52887),n(96083)),o=n(50500)},81204:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"10.5",y:"8.25",width:"3",height:"4.875",rx:"1.5",fill:"#008710"}),s().createElement(r.Path,{d:"M15 11.25C15 11.644 14.9224 12.0341 14.7716 12.3981C14.6209 12.762 14.3999 13.0927 14.1213 13.3713C13.8427 13.6499 13.512 13.8709 13.1481 14.0216C12.7841 14.1724 12.394 14.25 12 14.25C11.606 14.25 11.2159 14.1724 10.8519 14.0216C10.488 13.8709 10.1573 13.6499 9.87868 13.3713C9.6001 13.0927 9.37913 12.762 9.22836 12.3981C9.0776 12.0341 9 11.644 9 11.25",stroke:"#008710",strokeWidth:"1.125",strokeLinecap:"round"}),s().createElement(r.Path,{d:"M11.4375 15.75C11.4375 16.0607 11.6893 16.3125 12 16.3125C12.3107 16.3125 12.5625 16.0607 12.5625 15.75L11.4375 15.75ZM11.4375 14.25L11.4375 15.75L12.5625 15.75L12.5625 14.25L11.4375 14.25Z",fill:"#008710"}))},4454:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},96083:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"12.75",y:"9",width:"2.25",height:"6",fill:"#008710"}),s().createElement(r.Rect,{x:"9",y:"9",width:"2.25",height:"6",fill:"#008710"}))},71893:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},52887:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Rect},50500:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5 10C12.5 11.3807 11.3807 12.5 10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10ZM14 10C14 12.2091 12.2091 14 10 14C7.79086 14 6 12.2091 6 10C6 7.79086 7.79086 6 10 6C12.2091 6 14 7.79086 14 10ZM16.75 21V19C16.75 17.4812 15.5188 16.25 14 16.25L6 16.25C4.48122 16.25 3.25 17.4812 3.25 19V21H4.75L4.75 19C4.75 18.3096 5.30964 17.75 6 17.75L14 17.75C14.6904 17.75 15.25 18.3096 15.25 19V21H16.75Z",fill:"currentColor"}),s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M19.976 16.3599C21.2507 14.5642 22.0001 12.3695 22.0001 9.99969C22.0001 7.63128 21.2515 5.43769 19.9782 3.64258L18.754 4.50967C19.8537 6.05996 20.5001 7.95434 20.5001 9.99969C20.5001 12.0464 19.8528 13.9419 18.7519 15.4928L19.976 16.3599ZM17.3357 14.4897C18.2357 13.222 18.7648 11.6727 18.7648 9.99969C18.7648 8.32808 18.2365 6.77984 17.3379 5.51279L16.1137 6.37988C16.8387 7.4021 17.2648 8.65114 17.2648 9.99969C17.2648 11.3496 16.8378 12.5998 16.1116 13.6226L17.3357 14.4897Z",fill:"currentColor"}))},42290:(e,t,n)=>{"use strict";n.d(t,{$L:()=>p.$L,$u:()=>p.$u,C3:()=>u.C3,Eo:()=>u.Eo,JP:()=>m.JP,L$:()=>i.Z,LB:()=>m.LB,MW:()=>u.MW,OS:()=>o.Z,Qf:()=>c.Qf,Qr:()=>c.Qr,Rc:()=>l.Z,X_:()=>d.X_,Y:()=>p.Y,ZK:()=>u.ZK,_T:()=>a.Z,bC:()=>p.bC,cH:()=>s.Z,co:()=>p.co,cv:()=>p.cv,g:()=>m.g,oN:()=>d.oN,pw:()=>r.Z,q4:()=>p.q4,rp:()=>u.rp,u_:()=>c.u_,v_:()=>c.v_,xi:()=>u.xi});n(2890),n(56694),n(67742),n(46961);var r=n(42194),a=n(13109),s=n(93509),o=n(44696),i=n(92718),l=n(70286),c=n(59822),u=n(58890),d=n(20281),p=n(16700),m=n(35613)},2890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(51128),s=n.n(a),o=n(87309);const i=s()("jetpack-ai-client:jwt"),l="jetpack-ai-jwt",c=12e4;async function u({apiNonce:e,siteId:t,expirationTime:n}={}){e=e||window.JP_CONNECTION_INITIAL_STATE.apiNonce,t=t||window.JP_CONNECTION_INITIAL_STATE.siteSuffix,n=n||c;const a=(0,r.Wp)(),s=localStorage.getItem(l);let u,d=null;if(s)try{d=JSON.parse(s)}catch(e){i("Error parsing token",e)}if(d&&d?.expire>Date.now())return i("Using cached token"),d;u=a?await(0,o.Z)({path:"/wpcom/v2/sites/"+t+"/jetpack-openai-query/jwt",method:"POST"}):await(0,o.Z)({path:"/jetpack/v4/jetpack-ai-jwt?_cacheBuster="+Date.now(),credentials:"same-origin",headers:{"X-WP-Nonce":e},method:"POST"});const p={token:u.token,blogId:a?t:u.blog_id,expire:Date.now()+n};return i("Storing new token"),localStorage.setItem(l,JSON.stringify(p)),p}},35613:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.JP,LB:()=>r.LB,g:()=>r.g});var r=n(71197)},22999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(92213);const a={paragraph:e=>e.replaceAll("\n"," ")},s={emDelimiter:"_",headingStyle:"atx"},o={strikethrough:{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}}};class i{constructor({options:e={},rules:t={},keep:n=[],remove:a=[],fixes:i=[]}={}){this.fixes=i,this.turndownService=new r.Z({...s,...e}),this.turndownService.keep(n),this.turndownService.remove(a);const l={...o,...t};for(const e in l)this.turndownService.addRule(e,l[e])}render({content:e}){const t=this.turndownService.turndown(e);return this.fixes.reduce(((e,t)=>a[t](e)),t)}}},71197:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.Z,LB:()=>o,g:()=>i});var r=n(22999);const a=new(n(28603).Z),s=new r.Z,o=({content:e,rules:t,extension:n})=>a.render({content:e,rules:t,extension:n}),i=({content:e})=>s.render({content:e})},28603:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(95601);const a=e=>e.replaceAll("\x3c!-- wp:list-item --\x3e","").replaceAll("\x3c!-- /wp:list-item --\x3e","").replaceAll("\x3c!-- wp:list --\x3e","").replaceAll("\x3c!-- /wp:list --\x3e","").replaceAll("","\x3c!-- wp:list-item --\x3e ").replaceAll(" ","\x3c!-- /wp:list-item --\x3e").replaceAll("",'\x3c!-- wp:list {"ordered":true} --\x3e').replaceAll(" "," \x3c!-- /wp:list --\x3e").replaceAll("","\x3c!-- wp:list --\x3e"," \x3c!-- /wp:list --\x3e"),s={list:(e,t=!1)=>{const n=e.replace(/\s+/g,"
").replace(/<\/p>\s+<\/li>/g," ");return t?a(n):n},listItem:(e,t=!1)=>t?a(e.replace(/^<[ou]l>\s*/g,"").replace(/\s*<\/[ou]l>\s*$/g,"")):e,paragraph:(e,t=!1)=>t?e.replaceAll(/\s*<br \/>\s*/g," "):e},o={breaks:!0},i=["list"];class l{constructor(e=o){this.markdownConverter=new r.Z(e)}render({content:e,rules:t=i,extension:n=!1}){const r=this.markdownConverter.render(e);return t.reduce(((e,t)=>s[t](e,n)),r)}}},56694:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(60400),a=n(51128),s=n.n(a),o=n(42194),i=n(2890),l=n(16700);const c=s()("jetpack-ai-client:suggestions-event-source");class u extends EventTarget{constructor(e){super(),this.fullMessage="",this.fullFunctionCall={name:"",arguments:""},this.isPromptClear=!1,this.controller=new AbortController,this.initEventSource(e)}async initEventSource({url:e,question:t,token:n,options:a={}}){if(!n)try{c("Token was not provided, requesting one..."),n=(await(0,i.Z)()).token}catch(e){return void this.processErrorEvent(e)}const s={};if(Number.isInteger(parseInt(a.postId))&&(s.post_id=+a.postId),!e){const t=new URL("https://public-api.wordpress.com/wpcom/v2/jetpack-ai-query");a?.fromCache&&t.searchParams.append("stream_cache","true"),e=t.toString(),c("URL not provided, using default: %o",e)}Array.isArray(t)?s.messages=t:s.question=t,a?.feature?.length&&(c("Feature: %o",a.feature),s.feature=a.feature),a?.functions?.length&&(c("Functions: %o",a.functions),s.functions=a.functions),a?.model?.length&&(c("Model: %o",a.model),s.model=a.model),this.errorUnclearPromptTriggered=!1,await(0,r.L)(e,{openWhenHidden:!0,method:"POST",headers:{"Content-type":"application/json",Authorization:"Bearer "+n},body:JSON.stringify(s),onclose:()=>{c("Stream closed")},onerror:e=>{throw this.processErrorEvent(e),e},onmessage:e=>{this.processEvent(e)},onopen:async e=>{if(e.ok)return;let t;throw e.status>=400&&e.status<=500&&![413,422,429].includes(e.status)&&(c("Connection error: %o",e),t=l.co,this.dispatchEvent(new CustomEvent(l.co,{detail:e}))),503===e.status&&(t=l.$u,this.dispatchEvent(new CustomEvent(l.$u))),413===e.status&&(t=l.cv,this.dispatchEvent(new CustomEvent(l.cv))),422===e.status&&(t=l.q4,this.dispatchEvent(new CustomEvent(l.q4))),429===e.status&&(t=l.$L,this.dispatchEvent(new CustomEvent(l.$L))),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(t)})),new Error},signal:this.controller.signal})}checkForUnclearPrompt(){if(this.isPromptClear)return;const e=this.fullMessage.replace(/__|(\*\*)/g,"");if(e.startsWith("JETPACK_AI_ERROR")){if(this.errorUnclearPromptTriggered)return;this.errorUnclearPromptTriggered=!0,this.dispatchEvent(new CustomEvent(l.bC)),c("Unclear error prompt dispatched"),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.bC)}))}else"JETPACK_AI_ERROR".startsWith(e)?c(this.fullMessage):this.isPromptClear=!0}close(){this.controller.abort()}processEvent(e){if("[DONE]"===e.data){if(this.errorUnclearPromptTriggered)return;if(this.fullMessage.length)return this.dispatchEvent(new CustomEvent("done",{detail:this.fullMessage})),void c("Done: %o",this.fullMessage);if(this.fullFunctionCall.name.length)return this.dispatchEvent(new CustomEvent("function_done",{detail:this.fullFunctionCall})),void c("Done: %o",this.fullFunctionCall)}let t;try{t=JSON.parse(e.data)}catch(t){return void c("Error parsing JSON",e,t)}const{delta:n}=t?.choices?.[0]??{delta:{content:null,function_call:null}},r=n.content,a=n.function_call;r&&(this.fullMessage+=r,this.checkForUnclearPrompt(),this.isPromptClear&&(this.dispatchEvent(new CustomEvent("chunk",{detail:r})),c("suggestion: %o",this.fullMessage),this.dispatchEvent(new CustomEvent("suggestion",{detail:this.fullMessage})))),a&&(null!=a.name&&(this.fullFunctionCall.name+=a.name),null!=a.arguments&&(this.fullFunctionCall.arguments+=a.arguments),this.dispatchEvent(new CustomEvent("functionCallChunk",{detail:this.fullFunctionCall})))}processErrorEvent(e){c("onerror: %o",e),this.dispatchEvent(new CustomEvent(l.co,{detail:e})),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.co)}))}}},16700:(e,t,n)=>{"use strict";n.d(t,{$L:()=>s,$u:()=>a,Y:()=>r.Y,bC:()=>c,co:()=>l,cv:()=>i,q4:()=>o,vF:()=>u});var r=n(44696);const a="error_service_unavailable",s="error_quota_exceeded",o="error_moderation",i="error_context_too_large",l="error_network",c="error_unclear_prompt",u="error_response"},6975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51128);const a=n.n(r)()("dops:analytics");let s,o;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const i={initialize:function(e,t,n){i.setUser(e,t),i.setSuperProps(n),i.identifyUser()},setGoogleAnalyticsEnabled:function(e,t=null){this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){o={ID:e,username:t}},setSuperProps:function(e){s=e},assignSuperProps:function(e){s=Object.assign(s||{},e)},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Built stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){i.tracks.recordPageView(e),i.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,a,s,o){i.ga.recordPurchase(e,t,n,r,a,s,o)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(s&&(a("- Super Props: %o",s),t=Object.assign(t,s)),a('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):a('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};i.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){i.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){a("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};i.ga.initialized||(o&&(e={userId:"u-"+o.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),i.ga.initialized=!0)},recordPageView:function(e,t){i.ga.initialize(),a("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){i.ga.initialize();let s="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(s+=" [Option Label: "+n+"]"),void 0!==r&&(s+=" [Option Value: "+r+"]"),a(s),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,a,s,o){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:o}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:a,quantity:s}),window.ga("ecommerce:send")}},identifyUser:function(){o&&window._tkq.push(["identifyUser",o.ID,o.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}},l=i},64743:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(61132),a=n(96483);function s(e){class t extends Error{constructor(...t){super(...t),this.name=e}}return t}const o=s("JsonParseError"),i=s("JsonParseAfterRedirectError"),l=s("Api404Error"),c=s("Api404AfterRedirectError"),u=s("FetchNetworkError");const d=new function(e,t){let n=e,s=e,o={"X-WP-Nonce":t},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})},c=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setWpcomOriginApiUrl(e){s=e},setApiNonce(e){o={"X-WP-Nonce":e},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{c=e},registerSite:(e,t,a)=>{const s={registration_nonce:e,no_iframe:!0};return(0,r.jetpackConfigHas)("consumer_slug")&&(s.plugin_slug=(0,r.jetpackConfigGet)("consumer_slug")),null!==t&&(s.redirect_uri=t),a&&(s.from=a),g(`${n}jetpack/v4/connection/register`,l,{body:JSON.stringify(s)}).then(p).then(m)},fetchAuthorizationUrl:e=>d((0,a.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),i).then(p).then(m),fetchSiteConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchSiteConnectionStatus:()=>d(`${n}jetpack/v4/connection`,i).then(m),fetchSiteConnectionTest:()=>d(`${n}jetpack/v4/connection/test`,i).then(p).then(m),fetchUserConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchUserTrackingSettings:()=>d(`${n}jetpack/v4/tracking/settings`,i).then(p).then(m),updateUserTrackingSettings:e=>g(`${n}jetpack/v4/tracking/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),disconnectSite:()=>g(`${n}jetpack/v4/connection`,l,{body:JSON.stringify({isActive:!1})}).then(p).then(m),fetchConnectUrl:()=>d(`${n}jetpack/v4/connection/url`,i).then(p).then(m),unlinkUser:()=>g(`${n}jetpack/v4/connection/user`,l,{body:JSON.stringify({linked:!1})}).then(p).then(m),reconnect:()=>g(`${n}jetpack/v4/connection/reconnect`,l).then(p).then(m),fetchConnectedPlugins:()=>d(`${n}jetpack/v4/connection/plugins`,i).then(p).then(m),setHasSeenWCConnectionModal:()=>g(`${n}jetpack/v4/seen-wc-connection-modal`,l).then(p).then(m),fetchModules:()=>d(`${n}jetpack/v4/module/all`,i).then(p).then(m),fetchModule:e=>d(`${n}jetpack/v4/module/${e}`,i).then(p).then(m),activateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!0})}).then(p).then(m),deactivateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>g(`${n}jetpack/v4/module/${e}`,l,{body:JSON.stringify(t)}).then(p).then(m),updateSettings:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),getProtectCount:()=>d(`${n}jetpack/v4/module/protect/data`,i).then(p).then(m),resetOptions:e=>g(`${n}jetpack/v4/options/${e}`,l,{body:JSON.stringify({reset:!0})}).then(p).then(m),activateVaultPress:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(p).then(m),getVaultPressData:()=>d(`${n}jetpack/v4/module/vaultpress/data`,i).then(p).then(m),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify(r)}).then(p).then(m)},activateAkismet:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(p).then(m),getAkismetData:()=>d(`${n}jetpack/v4/module/akismet/data`,i).then(p).then(m),checkAkismetKey:()=>d(`${n}jetpack/v4/module/akismet/key/check`,i).then(p).then(m),checkAkismetKeyTyped:e=>g(`${n}jetpack/v4/module/akismet/key/check`,l,{body:JSON.stringify({api_key:e})}).then(p).then(m),fetchStatsData:e=>d(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),i).then(p).then(m).then(h),getPluginUpdates:()=>d(`${n}jetpack/v4/updates/plugins`,i).then(p).then(m),getPlans:()=>d(`${n}jetpack/v4/plans`,i).then(p).then(m),fetchSettings:()=>d(`${n}jetpack/v4/settings`,i).then(p).then(m),updateSetting:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSiteData:()=>d(`${n}jetpack/v4/site`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>d(`${n}jetpack/v4/site/features`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>d(`${n}jetpack/v4/site/products`,i).then(p).then(m),fetchSitePurchases:()=>d(`${n}jetpack/v4/site/purchases`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>d(`${n}jetpack/v4/site/benefits`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteDiscount:()=>d(`${n}jetpack/v4/site/discount`,i).then(p).then(m).then((e=>e.data)),fetchSetupQuestionnaire:()=>d(`${n}jetpack/v4/setup/questionnaire`,i).then(p).then(m),fetchRecommendationsData:()=>d(`${n}jetpack/v4/recommendations/data`,i).then(p).then(m),fetchRecommendationsProductSuggestions:()=>d(`${n}jetpack/v4/recommendations/product-suggestions`,i).then(p).then(m),fetchRecommendationsUpsell:()=>d(`${n}jetpack/v4/recommendations/upsell`,i).then(p).then(m),fetchRecommendationsConditional:()=>d(`${n}jetpack/v4/recommendations/conditional`,i).then(p).then(m),saveRecommendationsData:e=>g(`${n}jetpack/v4/recommendations/data`,l,{body:JSON.stringify({data:e})}).then(p),fetchProducts:()=>d(`${n}jetpack/v4/products`,i).then(p).then(m),fetchRewindStatus:()=>d(`${n}jetpack/v4/rewind`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>d(`${n}jetpack/v4/scan`,i).then(p).then(m).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>g(`${n}jetpack/v4/notice/${e}`,l,{body:JSON.stringify({dismissed:!0})}).then(p).then(m),fetchPluginsData:()=>d(`${n}jetpack/v4/plugins`,i).then(p).then(m),fetchIntroOffers:()=>d(`${n}jetpack/v4/intro-offers`,i).then(p).then(m),fetchVerifySiteGoogleStatus:e=>d(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,i).then(p).then(m),verifySiteGoogle:e=>g(`${n}jetpack/v4/verify-site/google`,l,{body:JSON.stringify({keyring_id:e})}).then(p).then(m),submitSurvey:e=>g(`${n}jetpack/v4/marketing/survey`,l,{body:JSON.stringify(e)}).then(p).then(m),saveSetupQuestionnaire:e=>g(`${n}jetpack/v4/setup/questionnaire`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicensingError:e=>g(`${n}jetpack/v4/licensing/error`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicenseKey:e=>g(`${n}jetpack/v4/licensing/set-license`,l,{body:JSON.stringify({license:e})}).then(p).then(m),getUserLicensesCounts:()=>d(`${n}jetpack/v4/licensing/user/counts`,i).then(p).then(m),getUserLicenses:()=>d(`${n}jetpack/v4/licensing/user/licenses`,i).then(p).then(m),updateLicensingActivationNoticeDismiss:e=>g(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,l,{body:JSON.stringify({last_detached_count:e})}).then(p).then(m),updateRecommendationsStep:e=>g(`${n}jetpack/v4/recommendations/step`,l,{body:JSON.stringify({step:e})}).then(p),confirmIDCSafeMode:()=>g(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,l).then(p),startIDCFresh:e=>g(`${n}jetpack/v4/identity-crisis/start-fresh`,l,{body:JSON.stringify({redirect_uri:e})}).then(p).then(m),migrateIDC:()=>g(`${n}jetpack/v4/identity-crisis/migrate`,l).then(p),attachLicenses:e=>g(`${n}jetpack/v4/licensing/attach-licenses`,l,{body:JSON.stringify({licenses:e})}).then(p).then(m),fetchSearchPlanInfo:()=>d(`${s}jetpack/v4/search/plan`,i).then(p).then(m),fetchSearchSettings:()=>d(`${s}jetpack/v4/search/settings`,i).then(p).then(m),updateSearchSettings:e=>g(`${s}jetpack/v4/search/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSearchStats:()=>d(`${s}jetpack/v4/search/stats`,i).then(p).then(m),fetchWafSettings:()=>d(`${n}jetpack/v4/waf`,i).then(p).then(m),updateWafSettings:e=>g(`${n}jetpack/v4/waf`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchWordAdsSettings:()=>d(`${n}jetpack/v4/wordads/settings`,i).then(p).then(m),updateWordAdsSettings:e=>g(`${n}jetpack/v4/wordads/settings`,l,{body:JSON.stringify(e)}),fetchSearchPricing:()=>d(`${s}jetpack/v4/search/pricing`,i).then(p).then(m),fetchMigrationStatus:()=>d(`${n}jetpack/v4/migration/status`,i).then(p).then(m),fetchBackupUndoEvent:()=>d(`${n}jetpack/v4/site/backup/undo-event`,i).then(p).then(m),fetchBackupPreflightStatus:()=>d(`${n}jetpack/v4/site/backup/preflight`,i).then(p).then(m)};function d(e,t){return fetch(c(e),t)}function g(e,t,n){return fetch(e,Object.assign({},t,n)).catch(A)}function h(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}Object.assign(this,u)};function p(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new c(e.redirected):new l})):e.json().catch((e=>g(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function m(e){return e.json().catch((t=>g(t,e.redirected,e.url)))}function g(e,t,n){throw t?new i(n):new o}function A(){throw new u}},90526:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(82674),a=n.n(r),s=n(55609),o=n(65736),i=n(61074),l=n(15381),c=n(65235),u=n.n(c),d=n(99196),p=n.n(d),m=n(62103);const __=o.__,g=(0,d.forwardRef)(((e,t)=>{const{children:n,variant:r="primary",size:o="normal",weight:c="bold",icon:d,iconSize:g,disabled:A,isDestructive:h,isLoading:E,isExternalLink:f,className:C,text:b,fullWidth:v,...k}=e,B=u()(m.Z.button,C,{[m.Z.normal]:"normal"===o,[m.Z.small]:"small"===o,[m.Z.icon]:Boolean(d),[m.Z.loading]:E,[m.Z.regular]:"regular"===c,[m.Z["full-width"]]:v,[m.Z["is-icon-button"]]:Boolean(d)&&!n});k.ref=t;const y="normal"===o?20:16,w=f&&p().createElement(p().Fragment,null,p().createElement(i.Z,{size:y,icon:l.Z,className:m.Z["external-icon"]}),p().createElement(s.VisuallyHidden,{as:"span"},/* translators: accessibility text */
__("(opens in a new tab)","jetpack"))),_=f?"_blank":void 0,I=n?.[0]&&null!==n[0]&&"components-tooltip"!==n?.[0]?.props?.className;return p().createElement(s.Button,a()({target:_,variant:r,className:u()(B,{"has-text":!!d&&I}),icon:f?void 0:d,iconSize:g,disabled:A,"aria-disabled":A,isDestructive:h,text:b},k),E&&p().createElement(s.Spinner,null),p().createElement("span",null,n),w)}));g.displayName="Button";const A=g},14203:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(82674),a=n.n(r),s=n(94333),o=n(69307),i=n(65736),l=n(90526),c=n(3396);const __=i.__,u=({buttonStyle:e="icon",textToCopy:t,onCopy:n,...r})=>{const[i,u]=(0,o.useState)(!1),d=(0,o.useRef)(),p=(0,s.useCopyToClipboard)(t,(()=>{d.current&&clearTimeout(d.current),u(!0),n?.(),d.current=setTimeout((()=>{u(!1),d.current=void 0}),3e3)}));(0,o.useEffect)((()=>()=>{d.current&&clearTimeout(d.current)}),[]);let m=null,g=null;"text"!==e&&(m=i?React.createElement(c.KM,null):React.createElement(c.Km,null));const A=__("Copy to clipboard","jetpack");return"icon"!==e&&(g=i?__("Copied!","jetpack"):A),React.createElement(l.Z,a()({"aria-label":A,icon:m,children:g,ref:p},r))}},60068:(e,t,n)=>{"use strict";n.d(t,{_:()=>s});var r=n(9818),a=n(53961);function s(){const e=(0,r.useDispatch)(a.store),t=(0,r.useSelect)((e=>e(a.store).getNotices()),[]);return{...e,createNotice:(t,n,r)=>e.createNotice(t,n,{type:"snackbar",...r}),createErrorNotice:(t,n)=>e.createErrorNotice(t,{type:"snackbar",...n}),createInfoNotice:(t,n)=>e.createInfoNotice(t,{type:"snackbar",...n}),createSuccessNotice:(t,n)=>e.createSuccessNotice(t,{type:"snackbar",...n}),createWarningNotice:(t,n)=>e.createWarningNotice(t,{type:"snackbar",...n}),getNotices:()=>t}}},67172:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(65736),a=n(65235),s=n.n(a),o=n(99196);n(53351);const __=r.__;class i extends o.Component{static defaultProps={"aria-hidden":"false",focusable:"true"};needsOffset(e,t){return["gridicons-arrow-left","gridicons-arrow-right","gridicons-calendar","gridicons-cart","gridicons-folder","gridicons-info","gridicons-info-outline","gridicons-posts","gridicons-star-outline","gridicons-star"].indexOf(e)>=0&&t%18==0}getSVGDescription(e){if("description"in this.props)return this.props.description;switch(e){default:return"";case"gridicons-audio":return __("Has audio.","jetpack");case"gridicons-arrow-left":return __("Arrow left","jetpack");case"gridicons-arrow-right":return __("Arrow right","jetpack");case"gridicons-calendar":return __("Is an event.","jetpack");case"gridicons-cart":return __("Is a product.","jetpack");case"chevron-down":return __("Show filters","jetpack");case"gridicons-comment":return __("Matching comment.","jetpack");case"gridicons-cross":return __("Close.","jetpack");case"gridicons-filter":return __("Toggle search filters.","jetpack");case"gridicons-folder":return __("Category","jetpack");case"gridicons-info":case"gridicons-info-outline":return __("Information.","jetpack");case"gridicons-image-multiple":return __("Has multiple images.","jetpack");case"gridicons-image":return __("Has an image.","jetpack");case"gridicons-page":return __("Page","jetpack");case"gridicons-post":return __("Post","jetpack");case"gridicons-jetpack-search":case"gridicons-search":return __("Magnifying Glass","jetpack");case"gridicons-tag":return __("Tag","jetpack");case"gridicons-video":return __("Has a video.","jetpack")}}renderIcon(e){switch(e){default:return null;case"gridicons-audio":return React.createElement("g",null,React.createElement("path",{d:"M8 4v10.184C7.686 14.072 7.353 14 7 14c-1.657 0-3 1.343-3 3s1.343 3 3 3 3-1.343 3-3V7h7v4.184c-.314-.112-.647-.184-1-.184-1.657 0-3 1.343-3 3s1.343 3 3 3 3-1.343 3-3V4H8z"}));case"gridicons-arrow-left":return React.createElement("g",null,React.createElement("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"}));case"gridicons-arrow-right":return React.createElement("g",null,React.createElement("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z"}));case"gridicons-block":return React.createElement("g",null,React.createElement("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12c0-4.418 3.582-8 8-8 1.848 0 3.545.633 4.9 1.686L5.686 16.9C4.633 15.545 4 13.848 4 12zm8 8c-1.848 0-3.546-.633-4.9-1.686L18.314 7.1C19.367 8.455 20 10.152 20 12c0 4.418-3.582 8-8 8z"}));case"gridicons-calendar":return React.createElement("g",null,React.createElement("path",{d:"M19 4h-1V2h-2v2H8V2H6v2H5c-1.105 0-2 .896-2 2v13c0 1.104.895 2 2 2h14c1.104 0 2-.896 2-2V6c0-1.104-.896-2-2-2zm0 15H5V8h14v11z"}));case"gridicons-cart":return React.createElement("g",null,React.createElement("path",{d:"M9 20c0 1.1-.9 2-2 2s-1.99-.9-1.99-2S5.9 18 7 18s2 .9 2 2zm8-2c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm.396-5c.937 0 1.75-.65 1.952-1.566L21 5H7V4c0-1.105-.895-2-2-2H3v2h2v11c0 1.105.895 2 2 2h12c0-1.105-.895-2-2-2H7v-2h10.396z"}));case"gridicons-checkmark":return React.createElement("g",null,React.createElement("path",{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658C17.823 3.39 15.075 2 12 2 6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-1.528-.353-2.97-.966-4.266L11 17.768z"}));case"gridicons-chevron-left":return React.createElement("g",null,React.createElement("path",{d:"M16.443 7.41L15.0399 6L9.06934 12L15.0399 18L16.443 16.59L11.8855 12L16.443 7.41Z"}));case"gridicons-chevron-right":return React.createElement("g",null,React.createElement("path",{d:"M10.2366 6L8.8335 7.41L13.391 12L8.8335 16.59L10.2366 18L16.2072 12L10.2366 6Z"}));case"gridicons-chevron-down":return React.createElement("g",null,React.createElement("path",{d:"M20 9l-8 8-8-8 1.414-1.414L12 14.172l6.586-6.586"}));case"gridicons-comment":return React.createElement("g",null,React.createElement("path",{d:"M3 6v9c0 1.105.895 2 2 2h9v5l5.325-3.804c1.05-.75 1.675-1.963 1.675-3.254V6c0-1.105-.895-2-2-2H5c-1.105 0-2 .895-2 2z"}));case"gridicons-computer":return React.createElement("g",null,React.createElement("path",{d:"M20 2H4c-1.104 0-2 .896-2 2v12c0 1.104.896 2 2 2h6v2H7v2h10v-2h-3v-2h6c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm0 14H4V4h16v12z"}));case"gridicons-cross":return React.createElement("g",null,React.createElement("path",{d:"M18.36 19.78L12 13.41l-6.36 6.37-1.42-1.42L10.59 12 4.22 5.64l1.42-1.42L12 10.59l6.36-6.36 1.41 1.41L13.41 12l6.36 6.36z"}));case"gridicons-filter":return React.createElement("g",null,React.createElement("path",{d:"M10 19h4v-2h-4v2zm-4-6h12v-2H6v2zM3 5v2h18V5H3z"}));case"gridicons-folder":return React.createElement("g",null,React.createElement("path",{d:"M18 19H6c-1.1 0-2-.9-2-2V7c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2h7c1.1 0 2 .9 2 2v8c0 1.1-.9 2-2 2z"}));case"gridicons-image":return React.createElement("g",null,React.createElement("path",{d:"M13 9.5c0-.828.672-1.5 1.5-1.5s1.5.672 1.5 1.5-.672 1.5-1.5 1.5-1.5-.672-1.5-1.5zM22 6v12c0 1.105-.895 2-2 2H4c-1.105 0-2-.895-2-2V6c0-1.105.895-2 2-2h16c1.105 0 2 .895 2 2zm-2 0H4v7.444L8 9l5.895 6.55 1.587-1.85c.798-.932 2.24-.932 3.037 0L20 15.426V6z"}));case"gridicons-image-multiple":return React.createElement("g",null,React.createElement("path",{d:"M15 7.5c0-.828.672-1.5 1.5-1.5s1.5.672 1.5 1.5S17.328 9 16.5 9 15 8.328 15 7.5zM4 20h14c0 1.105-.895 2-2 2H4c-1.1 0-2-.9-2-2V8c0-1.105.895-2 2-2v14zM22 4v12c0 1.105-.895 2-2 2H8c-1.105 0-2-.895-2-2V4c0-1.105.895-2 2-2h12c1.105 0 2 .895 2 2zM8 4v6.333L11 7l4.855 5.395.656-.73c.796-.886 2.183-.886 2.977 0l.513.57V4H8z"}));case"gridicons-info":return React.createElement("g",null,React.createElement("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"}));case"gridicons-info-outline":return React.createElement("g",null,React.createElement("path",{d:"M13 9h-2V7h2v2zm0 2h-2v6h2v-6zm-1-7c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8m0-2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2z"}));case"gridicons-jetpack-search":return React.createElement("g",null,React.createElement("path",{d:"M0 9.257C0 4.15 4.151 0 9.257 0c5.105 0 9.256 4.151 9.256 9.257a9.218 9.218 0 01-2.251 6.045l.034.033h1.053L24 22.01l-1.986 1.989-6.664-6.662v-1.055l-.033-.033a9.218 9.218 0 01-6.06 2.264C4.15 18.513 0 14.362 0 9.257zm4.169 1.537h4.61V1.82l-4.61 8.973zm5.547-3.092v8.974l4.61-8.974h-4.61z"}));case"gridicons-phone":return React.createElement("g",null,React.createElement("path",{d:"M16 2H8c-1.104 0-2 .896-2 2v16c0 1.104.896 2 2 2h8c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm-3 19h-2v-1h2v1zm3-2H8V5h8v14z"}));case"gridicons-pages":return React.createElement("g",null,React.createElement("path",{d:"M16 8H8V6h8v2zm0 2H8v2h8v-2zm4-6v12l-6 6H6c-1.105 0-2-.895-2-2V4c0-1.105.895-2 2-2h12c1.105 0 2 .895 2 2zm-2 10V4H6v16h6v-4c0-1.105.895-2 2-2h4z"}));case"gridicons-posts":return React.createElement("g",null,React.createElement("path",{d:"M16 19H3v-2h13v2zm5-10H3v2h18V9zM3 5v2h11V5H3zm14 0v2h4V5h-4zm-6 8v2h10v-2H11zm-8 0v2h5v-2H3z"}));case"gridicons-search":return React.createElement("g",null,React.createElement("path",{d:"M21 19l-5.154-5.154C16.574 12.742 17 11.42 17 10c0-3.866-3.134-7-7-7s-7 3.134-7 7 3.134 7 7 7c1.42 0 2.742-.426 3.846-1.154L19 21l2-2zM5 10c0-2.757 2.243-5 5-5s5 2.243 5 5-2.243 5-5 5-5-2.243-5-5z"}));case"gridicons-star-outline":return React.createElement("g",null,React.createElement("path",{d:"M12 6.308l1.176 3.167.347.936.997.042 3.374.14-2.647 2.09-.784.62.27.963.91 3.25-2.813-1.872-.83-.553-.83.552-2.814 1.87.91-3.248.27-.962-.783-.62-2.648-2.092 3.374-.14.996-.04.347-.936L12 6.308M12 2L9.418 8.953 2 9.257l5.822 4.602L5.82 21 12 16.89 18.18 21l-2.002-7.14L22 9.256l-7.418-.305L12 2z"}));case"gridicons-star":return React.createElement("g",null,React.createElement("path",{d:"M12 2l2.582 6.953L22 9.257l-5.822 4.602L18.18 21 12 16.89 5.82 21l2.002-7.14L2 9.256l7.418-.304"}));case"gridicons-tag":return React.createElement("g",null,React.createElement("path",{d:"M20 2.007h-7.087c-.53 0-1.04.21-1.414.586L2.592 11.5c-.78.78-.78 2.046 0 2.827l7.086 7.086c.78.78 2.046.78 2.827 0l8.906-8.906c.376-.374.587-.883.587-1.413V4.007c0-1.105-.895-2-2-2zM17.007 9c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2z"}));case"gridicons-video":return React.createElement("g",null,React.createElement("path",{d:"M20 4v2h-2V4H6v2H4V4c-1.105 0-2 .895-2 2v12c0 1.105.895 2 2 2v-2h2v2h12v-2h2v2c1.105 0 2-.895 2-2V6c0-1.105-.895-2-2-2zM6 16H4v-3h2v3zm0-5H4V8h2v3zm4 4V9l4.5 3-4.5 3zm10 1h-2v-3h2v3zm0-5h-2V8h2v3z"}));case"gridicons-lock":return React.createElement(React.Fragment,null,React.createElement("g",{id:"lock"},React.createElement("path",{d:"M18,8h-1V7c0-2.757-2.243-5-5-5S7,4.243,7,7v1H6c-1.105,0-2,0.895-2,2v10c0,1.105,0.895,2,2,2h12c1.105,0,2-0.895,2-2V10 C20,8.895,19.105,8,18,8z M9,7c0-1.654,1.346-3,3-3s3,1.346,3,3v1H9V7z M13,15.723V18h-2v-2.277c-0.595-0.346-1-0.984-1-1.723 c0-1.105,0.895-2,2-2s2,0.895,2,2C14,14.738,13.595,15.376,13,15.723z"})),React.createElement("g",{id:"Layer_1"}));case"gridicons-external":return React.createElement("g",null,React.createElement("path",{d:"M19 13v6c0 1.105-.895 2-2 2H5c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h6v2H5v12h12v-6h2zM13 3v2h4.586l-7.793 7.793 1.414 1.414L19 6.414V11h2V3h-8z"}))}}render(){const{size:e=24,className:t=""}=this.props,n=this.props.height||e,r=this.props.width||e,a=this.props.style||{height:n,width:r},o="gridicons-"+this.props.icon,i=s()("gridicon",o,t,{"needs-offset":this.needsOffset(o,e)}),l=this.getSVGDescription(o);return React.createElement("svg",{className:i,focusable:this.props.focusable,height:n,onClick:this.props.onClick,style:a,viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg","aria-hidden":this.props["aria-hidden"]},l?React.createElement("desc",null,l):null,this.renderIcon(o))}}const l=i},69665:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(55609),a=n(65235),s=n.n(a),o=n(99196),i=n.n(o),l=n(90526),c=n(67172);n(72098);const u=e=>({"top-end":"top left",top:"top center","top-start":"top right","bottom-end":"bottom left",bottom:"bottom center","bottom-start":"bottom right"}[e]),d=({className:e="",iconClassName:t="",placement:n="bottom-end",animate:a=!0,iconCode:d="info-outline",iconSize:p=18,offset:m=10,title:g,children:A,popoverAnchorStyle:h="icon",forceShow:E=!1,wide:f=!1,inline:C=!0,shift:b=!1})=>{const[v,k]=(0,o.useState)(!1),B=(0,o.useCallback)((()=>k(!1)),[k]),y=(0,o.useCallback)((e=>{e.preventDefault(),k(!v)}),[v,k]),w={position:u(n),placement:n,animate:a,noArrow:!1,resize:!1,flip:!1,offset:m,focusOnMount:"container",onClose:B,className:"icon-tooltip-container",inline:C,shift:b},_="wrapper"===h,I=s()("icon-tooltip-wrapper",e),j={left:_?0:-(62-p/2)+"px"},x=_&&E;return i().createElement("div",{className:I,"data-testid":"icon-tooltip_wrapper"},!_&&i().createElement(l.Z,{variant:"link",onMouseDown:y},i().createElement(c.Z,{className:t,icon:d,size:p})),i().createElement("div",{className:s()("icon-tooltip-helper",{"is-wide":f}),style:j},(x||v)&&i().createElement(r.Popover,w,i().createElement("div",null,g&&i().createElement("div",{className:"icon-tooltip-title"},g),i().createElement("div",{className:"icon-tooltip-content"},A)))))}},3396:(e,t,n)=>{"use strict";n.d(t,{KM:()=>d,Km:()=>p,av:()=>m});var r=n(82674),a=n.n(r),s=n(55609),o=n(65235),i=n.n(o),l=n(56286),c=n(45460);const u=({className:e,size:t=24,viewBox:n="0 0 24 24",opacity:r=1,color:o="#2C3338",children:l})=>{const u={className:i()(c.Z.iconWrapper,e),width:t,height:t,viewBox:n,opacity:r,fill:void 0};return o&&(u.fill=o),React.createElement(s.SVG,a()({},u,{fillRule:"evenodd",clipRule:"evenodd",xmlns:"http://www.w3.org/2000/svg"}),React.createElement(s.G,{opacity:r},l))},d=({size:e,className:t=c.Z["checkmark-icon"],color:n})=>React.createElement(u,{className:t,size:e,color:n},React.createElement(s.Path,{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658C17.823 3.39 15.075 2 12 2 6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-1.528-.353-2.97-.966-4.266L11 17.768z"})),p=({size:e,className:t=c.Z["clipboard-icon"],color:n})=>React.createElement(u,{className:t,size:e,color:n},React.createElement(s.Path,{d:"M5.625 5.5H15.375C15.444 5.5 15.5 5.55596 15.5 5.625V15.375C15.5 15.444 15.444 15.5 15.375 15.5H5.625C5.55596 15.5 5.5 15.444 5.5 15.375V5.625C5.5 5.55596 5.55596 5.5 5.625 5.5ZM4 5.625C4 4.72754 4.72754 4 5.625 4H15.375C16.2725 4 17 4.72754 17 5.625V10V15.375C17 16.2725 16.2725 17 15.375 17C15.375 17 6.52246 17 5.625 17C4.72754 17 4 16.2725 4 15.375V5.625ZM18.5 17.2812V8.28125H20V17.2812C20 18.7995 18.7704 20 17.2511 20H6.25V18.5H17.2511C17.9409 18.5 18.5 17.9721 18.5 17.2812Z"}));const m=({serviceName:e,className:t,iconSize:n})=>React.createElement(l.ZP,{className:i()(c.Z.socialIcon,c.Z[e],t),icon:e,size:n||24})},78868:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(82674),a=n.n(r),s=n(65736),o=n(65235),i=n.n(o),l=n(99196),c=n.n(l);const __=s.__,u=({logoColor:e="#069e08",showText:t=!0,className:n,height:r=32,...s})=>{const o=t?"0 0 118 32":"0 0 32 32";return c().createElement("svg",a()({xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:o,className:i()("jetpack-logo",n),"aria-labelledby":"jetpack-logo-title",height:r},s,{role:"img"}),c().createElement("title",{id:"jetpack-logo-title"},__("Jetpack Logo","jetpack")),c().createElement("path",{fill:e,d:"M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"}),t&&c().createElement(c().Fragment,null,c().createElement("path",{d:"M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z"}),c().createElement("path",{d:"M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z"}),c().createElement("path",{d:"M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z"}),c().createElement("path",{d:"M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z"}),c().createElement("path",{d:"M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z"}),c().createElement("path",{d:"M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z"}),c().createElement("path",{d:"M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z"})))}},32054:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(94333),a=n(49710);const s=["sm","md","lg"],o=(e,t)=>{const n=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t],[i,l,c]=s,u={sm:(0,r.useMediaQuery)(a.Z[i]),md:(0,r.useMediaQuery)(a.Z[l]),lg:(0,r.useMediaQuery)(a.Z[c])};return n.map(((e,t)=>{const n=o[t];return n?((e,t,n)=>{const r=s.indexOf(e),a=r+1,o=t.includes("=");let i=[];return t.startsWith("<")&&(i=s.slice(0,o?a:r)),t.startsWith(">")&&(i=s.slice(o?r:a)),i?.length?i.some((e=>n[e])):n[e]})(e,n,u):u[e]}))}},22636:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(65235),a=n.n(r),s=n(99196),o=n.n(s),i=n(46409);const l=({children:e=null,width:t=null,height:n=null,className:r=""})=>o().createElement("div",{className:a()(i.Z.placeholder,r),style:{width:t,height:n}},e)},52947:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(98709);const a=(e,t={})=>{const n=(0,r.X)();return new Intl.NumberFormat(n,t).format(e)}},49777:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(28918);const a=({value:e="https://jetpack.com",bgColor:t,fgColor:n,level:a,includeMargin:s,imageSettings:o,renderAs:i="canvas",size:l=248})=>React.createElement(r.ZP,{value:e,size:l,bgColor:t,fgColor:n,level:a,includeMargin:s,imageSettings:o,renderAs:i})},43521:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(65736),a=n(65235),s=n.n(a),o=n(99196),i=n.n(o),l=n(52947);n(34086);const __=r.__,c=({totalCount:e,items:t=[],showLegendLabelBeforeCount:n=!1,sortByCount:r,className:a,tableCaption:c,legendTitle:u,recordTypeLabel:d,recordCountLabel:p})=>{const m=(0,o.useMemo)((()=>e||t.reduce(((e,{count:t})=>e+t),0)),[t,e]),g=(0,o.useMemo)((()=>r?[...t].sort(((e,t)=>"ascending"===r?e.count-t.count:t.count-e.count)):t),[t,r]);return i().createElement("div",{className:s()("record-meter-bar",a)},i().createElement("div",{className:"record-meter-bar__items","aria-hidden":"true"},g.map((({count:e,label:t,backgroundColor:n})=>{const r=(e/m*100).toPrecision(2);return i().createElement("div",{key:t,style:{backgroundColor:n,flexBasis:`${r}%`}})}))),i().createElement("div",{className:"record-meter-bar__legend","aria-hidden":"true"},u&&i().createElement("div",{className:"record-meter-bar__legend--title"},u),i().createElement("ul",{className:"record-meter-bar__legend--items"},g.map((({count:e,label:t,backgroundColor:r})=>{const a=(0,l.Z)(e);return i().createElement("li",{key:t,className:"record-meter-bar__legend--item"},i().createElement("div",{className:"record-meter-bar__legend--item-circle",style:{backgroundColor:r}}),!n&&i().createElement("span",null,i().createElement("span",{className:"record-meter-bar__legend--item-count"},a),i().createElement("span",{className:"record-meter-bar__legend--item-label"},t)),n&&i().createElement("span",null,i().createElement("span",{className:"record-meter-bar__legend--item-label record-meter-bar__legend--item-label-first"},t),i().createElement("span",{className:"record-meter-bar__legend--item-count"},"(",a,")")))})))),i().createElement("table",{className:"screen-reader-text"},i().createElement("caption",null,c||__("Summary of the records","jetpack")),i().createElement("tbody",null,i().createElement("tr",null,i().createElement("th",{scope:"col"},d||__("Record type","jetpack")),i().createElement("th",{scope:"col"},p||__("Record count","jetpack"))),g.map((({label:e,count:t})=>i().createElement("tr",{key:e},i().createElement("td",null,e),i().createElement("td",null,t)))))))}},45033:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(25162),a=n.n(r),s=n(99196),o=n.n(s);n(48026);const i=({color:e="#FFFFFF",className:t="",size:n=20})=>{const r=t+" jp-components-spinner",a={width:n,height:n,fontSize:n,borderTopColor:e},s={borderTopColor:e,borderRightColor:e};return o().createElement("div",{className:r},o().createElement("div",{className:"jp-components-spinner__outer",style:a},o().createElement("div",{className:"jp-components-spinner__inner",style:s})))};i.propTypes={color:a().string,className:a().string,size:a().number};const l=i},66017:(e,t,n)=>{"use strict";n.d(t,{h:()=>r,s:()=>a});const r={"headline-medium":"h1","headline-small":"h2","headline-small-regular":"h2","title-medium":"h3","title-medium-semi-bold":"h3","title-small":"h4",body:"p","body-small":"p","body-extra-small":"p","body-extra-small-bold":"p",label:"p"},a=["mt","mr","mb","ml","mx","my","m","pt","pr","pb","pl","px","py","p"]},45106:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>p});var r=n(82674),a=n.n(r),s=n(65235),o=n.n(s),i=n(99196),l=n.n(i),c=n(66017),u=n(85837);const d=(0,i.forwardRef)((({variant:e="body",children:t,component:n,className:r,...s},d)=>{const p=n||c.h[e]||"span",m=(0,i.useMemo)((()=>c.s.reduce(((e,t)=>(void 0!==s[t]&&(e+=u.Z[`${t}-${s[t]}`]+" ",delete s[t]),e)),"")),[s]);return s.ref=d,l().createElement(p,a()({className:o()(u.Z.reset,u.Z[e],r,m)},s),t)}));d.displayName="Text";const p=d},88275:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>p});var r=n(99196),a=n.n(r),s=n(93468);const o={"--font-headline-medium":"48px","--font-headline-small":"36px","--font-title-medium":"24px","--font-title-small":"20px","--font-body":"16px","--font-body-small":"14px","--font-body-extra-small":"12px","--font-title-large":"var(--font-headline-small)","--font-label":"var(--font-body-extra-small)"},i={"--jp-black":"#000000","--jp-black-80":"#2c3338","--jp-white":"#ffffff","--jp-white-off":"#f9f9f6","--jp-gray":"#dcdcde","--jp-gray-0":"#F6F7F7","--jp-gray-5":"var(--jp-gray)","--jp-gray-10":"#C3C4C7","--jp-gray-20":"#A7AAAD","--jp-gray-40":"#787C82","--jp-gray-50":"#646970","--jp-gray-60":"#50575E","--jp-gray-70":"#3C434A","--jp-gray-80":"#2C3338","--jp-gray-90":"#1d2327","--jp-gray-off":"#e2e2df","--jp-red-0":"#F7EBEC","--jp-red-5":"#FACFD2","--jp-red-40":"#E65054","--jp-red-50":"#D63638","--jp-red-60":"#B32D2E","--jp-red-70":"#8A2424","--jp-red-80":"#691C1C","--jp-red":"#d63639","--jp-yellow-5":"#F5E6B3","--jp-yellow-10":"#F2CF75","--jp-yellow-20":"#F0C930","--jp-yellow-30":"#DEB100","--jp-yellow-40":"#C08C00","--jp-yellow-50":"#9D6E00","--jp-yellow-60":"#7D5600","--jp-blue-20":"#68B3E8","--jp-blue-40":"#1689DB","--jp-pink":"#C9356E","--jp-green-0":"#f0f2eb","--jp-green-5":"#d0e6b8","--jp-green-10":"#9dd977","--jp-green-20":"#64ca43","--jp-green-30":"#2fb41f","--jp-green-40":"#069e08","--jp-green-50":"#008710","--jp-green-60":"#007117","--jp-green-70":"#005b18","--jp-green-80":"#004515","--jp-green-90":"#003010","--jp-green-100":"#001c09","--jp-green":"#069e08","--jp-green-primary":"var( --jp-green-40 )","--jp-green-secondary":"var( --jp-green-30 )"},l={"--jp-border-radius":"4px","--jp-menu-border-height":"1px","--jp-underline-thickness":"2px"},c={"--spacing-base":"8px"},u={},d=(e,t,n)=>{const r={...o,...i,...l,...c};for(const t in r)e.style.setProperty(t,r[t]);n&&e.classList.add(s.Z.global),t&&(u[t]={provided:!0,root:e})},p=({children:e=null,targetDom:t,id:n,withGlobalStyles:s=!0})=>{const o=(0,r.useRef)(),i=u?.[n]?.provided;return(0,r.useLayoutEffect)((()=>{if(!i)return t?d(t,n,s):void(o?.current&&d(o.current,n,s))}),[t,o,i,n,s]),t?a().createElement(a().Fragment,null,e):a().createElement("div",{ref:o},e)}},98709:(e,t,n)=>{"use strict";n.d(t,{X:()=>a});var r=n(69771);const a=()=>{const{l10n:{locale:e}}=(0,r.getSettings)();if(e)return(e=>{const t=e.match(/^([a-z]{2,3})(_[a-z]{2}|_[a-z][a-z0-9]{4,7})?(?:_.*)?$/i);return t?`${t[1]}${t[2]?t[2]:""}`.replace("_","-"):"en-US"})(e);return window?.window?.navigator?.language??"en-US"}},6895:(e,t,n)=>{"use strict";function r(e,t={}){const n={};let r;if("undefined"!=typeof window&&(r=window?.JP_CONNECTION_INITIAL_STATE?.calypsoEnv),0===e.search("https://")){const t=new URL(e);e=`https://${t.host}${t.pathname}`,n.url=encodeURIComponent(e)}else n.source=encodeURIComponent(e);for(const e in t)n[e]=encodeURIComponent(t[e]);!Object.keys(n).includes("site")&&"undefined"!=typeof jetpack_redirects&&jetpack_redirects.hasOwnProperty("currentSiteRawUrl")&&(n.site=jetpack_redirects.currentBlogID??jetpack_redirects.currentSiteRawUrl),r&&(n.calypso_env=r);return"https://jetpack.com/redirect/?"+Object.keys(n).map((e=>e+"="+n[e])).join("&")}n.d(t,{Z:()=>r})},61132:(e,t,n)=>{let r={};try{r=n(92787)}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),r={missingConfig:!0}}const a=e=>r.hasOwnProperty(e);e.exports={jetpackConfigHas:a,jetpackConfigGet:e=>{if(!a(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return r[e]}}},31294:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(64743),a=n(9818),s=n(99196),o=n(80428);const i=window?.JP_CONNECTION_INITIAL_STATE?window.JP_CONNECTION_INITIAL_STATE:{},l=({registrationNonce:e=i.registrationNonce,apiRoot:t=i.apiRoot,apiNonce:n=i.apiNonce,redirectUri:l,autoTrigger:c,from:u,skipUserConnection:d}={})=>{const{registerSite:p,connectUser:m,refreshConnectedPlugins:g}=(0,a.useDispatch)(o.t),A=(0,a.useSelect)((e=>e(o.t).getRegistrationError())),{siteIsRegistering:h,userIsConnecting:E,userConnectionData:f,connectedPlugins:C,connectionErrors:b,isRegistered:v,isUserConnected:k,hasConnectedOwner:B,isOfflineMode:y}=(0,a.useSelect)((e=>({siteIsRegistering:e(o.t).getSiteIsRegistering(),userIsConnecting:e(o.t).getUserIsConnecting(),userConnectionData:e(o.t).getUserConnectionData(),connectedPlugins:e(o.t).getConnectedPlugins(),connectionErrors:e(o.t).getConnectionErrors(),isOfflineMode:e(o.t).getIsOfflineMode(),...e(o.t).getConnectionStatus()}))),w=()=>d?l?(window.location=l,Promise.resolve(l)):Promise.resolve():m({from:u,redirectUri:l}),_=t=>(t&&t.preventDefault(),v?w():p({registrationNonce:e,redirectUri:l,from:u}).then((()=>w())));return(0,s.useEffect)((()=>{r.ZP.setApiRoot(t),r.ZP.setApiNonce(n)}),[t,n]),(0,s.useEffect)((()=>{!c||h||E||_()}),[]),{handleRegisterSite:_,handleConnectUser:w,refreshConnectedPlugins:g,isRegistered:v,isUserConnected:k,siteIsRegistering:h,userIsConnecting:E,registrationError:A,userConnectionData:f,hasConnectedOwner:B,connectedPlugins:C,connectionErrors:b,isOfflineMode:y}}},27523:(e,t,n)=>{"use strict";n.d(t,{LI:()=>s,N4:()=>i,Qo:()=>d,T1:()=>c,TS:()=>u,ZP:()=>k,b5:()=>m,i6:()=>a,qJ:()=>g,qV:()=>l,r7:()=>o,wQ:()=>p});var r=n(64743);const a="SET_CONNECTION_STATUS",s="SET_CONNECTION_STATUS_IS_FETCHING",o="SET_SITE_IS_REGISTERING",i="SET_USER_IS_CONNECTING",l="SET_REGISTRATION_ERROR",c="CLEAR_REGISTRATION_ERROR",u="SET_AUTHORIZATION_URL",d="DISCONNECT_USER_SUCCESS",p="SET_CONNECTED_PLUGINS",m="SET_CONNECTION_ERRORS",g="SET_IS_OFFLINE_MODE",A=e=>({type:a,connectionStatus:e}),h=e=>({type:o,isRegistering:e}),E=e=>({type:i,isConnecting:e}),f=e=>({type:l,registrationError:e}),C=()=>({type:c}),b=e=>({type:u,authorizationUrl:e}),v=e=>({type:p,connectedPlugins:e});const k={setConnectionStatus:A,setConnectionStatusIsFetching:e=>({type:s,isFetching:e}),fetchConnectionStatus:()=>({type:"FETCH_CONNECTION_STATUS"}),fetchAuthorizationUrl:e=>({type:"FETCH_AUTHORIZATION_URL",redirectUri:e}),setSiteIsRegistering:h,setUserIsConnecting:E,setRegistrationError:f,clearRegistrationError:C,setAuthorizationUrl:b,registerSite:function*({registrationNonce:e,redirectUri:t,from:n=""}){yield C(),yield h(!0);try{const r=yield{type:"REGISTER_SITE",registrationNonce:e,redirectUri:t,from:n};return yield A({isRegistered:!0}),yield b(r.authorizeUrl),yield h(!1),Promise.resolve(r)}catch(e){return yield f(e),yield h(!1),Promise.reject(e)}},connectUser:function*({from:e,redirectFunc:t,redirectUri:n}={}){yield E(!0),yield{type:"CONNECT_USER",from:e,redirectFunc:t,redirectUri:n}},disconnectUserSuccess:()=>({type:d}),setConnectedPlugins:v,refreshConnectedPlugins:()=>async({dispatch:e})=>await new Promise((t=>r.ZP.fetchConnectedPlugins().then((n=>{e(v(n)),t(n)})))),setConnectionErrors:e=>({type:m,connectionErrors:e}),setIsOfflineMode:e=>({type:g,isOfflineMode:e})}},31432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(64743),a=n(9818),s=n(27057);const o={FETCH_AUTHORIZATION_URL:({redirectUri:e})=>r.ZP.fetchAuthorizationUrl(e),REGISTER_SITE:({registrationNonce:e,redirectUri:t,from:n})=>r.ZP.registerSite(e,t,n),CONNECT_USER:(0,a.createRegistryControl)((({resolveSelect:e})=>({from:t,redirectFunc:n,redirectUri:r}={})=>new Promise(((a,o)=>{e(s.Z).getAuthorizationUrl(r).then((e=>{const r=n||(e=>window.location.assign(e)),s=new URL(e);t&&s.searchParams.set("from",encodeURIComponent(t));const o=s.toString();r(o),a(o)})).catch((e=>{o(e)}))}))))}},41479:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818),a=n(27523);const s=(0,r.combineReducers)({connectionStatus:(e={},t)=>{switch(t.type){case a.i6:return{...e,...t.connectionStatus};case a.Qo:return{...e,isUserConnected:!1}}return e},connectionStatusIsFetching:(e=!1,t)=>t.type===a.LI?t.isFetching:e,siteIsRegistering:(e=!1,t)=>t.type===a.r7?t.isRegistering:e,userIsConnecting:(e=!1,t)=>t.type===a.N4?t.isConnecting:e,registrationError:(e,t)=>{switch(t.type){case a.T1:return!1;case a.qV:return t.registrationError;default:return e}},authorizationUrl:(e,t)=>t.type===a.TS?t.authorizationUrl:e,userConnectionData:(e,t)=>(t.type,e),connectedPlugins:(e={},t)=>t.type===a.wQ?t.connectedPlugins:e,connectionErrors:(e={},t)=>t.type===a.b5?t.connectionErrors:e,isOfflineMode:(e=!1,t)=>t.type===a.qJ?t.isConnecting:e})},77728:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9818),a=n(27523),s=n(27057);const o={...{getAuthorizationUrl:{isFulfilled:(e,...t)=>{const n=Boolean(e.authorizationUrl),a=(0,r.select)(s.Z).hasFinishedResolution("getAuthorizationUrl",t);return n&&!a&&(0,r.dispatch)(s.Z).finishResolution("getAuthorizationUrl",t),n},*fulfill(e){const t=yield a.ZP.fetchAuthorizationUrl(e);yield a.ZP.setAuthorizationUrl(t.authorizeUrl)}}}}},82725:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r={...{getConnectionStatus:e=>e.connectionStatus||{},getConnectionStatusIsFetching:()=>!1,getSiteIsRegistering:e=>e.siteIsRegistering||!1,getUserIsConnecting:e=>e.userIsConnecting||!1,getRegistrationError:e=>e.registrationError||!1,getAuthorizationUrl:e=>e.authorizationUrl||!1,getUserConnectionData:e=>e.userConnectionData||!1,getConnectedPlugins:e=>e.connectedPlugins||[],getConnectionErrors:e=>e.connectionErrors||[],getIsOfflineMode:e=>e.isOfflineMode||!1,getWpcomUser:e=>e?.userConnectionData?.currentUser?.wpcomUser,getBlogId:e=>e?.userConnectionData?.currentUser?.blogId}}},13535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818);class a{static store=null;static mayBeInit(e,t){null===a.store&&(a.store=(0,r.createReduxStore)(e,t),(0,r.register)(a.store))}}const s=a},27057:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r="jetpack-connection"},80428:(e,t,n)=>{"use strict";n.d(t,{t:()=>c.Z});var r=n(27523),a=n(31432),s=n(41479),o=n(77728),i=n(82725),l=n(13535),c=n(27057);const u=window.JP_CONNECTION_INITIAL_STATE;u||console.error("Jetpack Connection package: Initial state is missing. Check documentation to see how to use the Connection composer package to set up the initial state."),l.Z.mayBeInit(c.Z,{__experimentalUseThunks:!0,reducer:s.Z,actions:r.ZP,selectors:i.Z,resolvers:o.Z,controls:a.Z,initialState:u||{}})},81050:(e,t,n)=>{"use strict";n.d(t,{PostPublishManualSharing:()=>l.Z,PostPublishReviewPrompt:()=>i.Z,PublicizePanel:()=>o.Z,SocialImageGeneratorPanel:()=>s.Z,SocialPreviewsModal:()=>r.Z,SocialPreviewsPanel:()=>a.Z,usePublicizeConfig:()=>u.Z,useSocialMediaConnections:()=>c.Z,useSyncPostDataToStore:()=>p.N});n(23177),n(4277),n(49021),n(84703);var r=n(8454),a=n(74140),s=n(54005),o=(n(8350),n(76848),n(92116),n(79631),n(8714)),i=(n(19649),n(52403)),l=n(91750),c=(n(77106),n(75674),n(37568)),u=(n(48751),n(14085)),d=(n(45579),n(75323),n(42032));n.o(d,"useSyncPostDataToStore")&&n.d(t,{useSyncPostDataToStore:function(){return d.useSyncPostDataToStore}});n(91474);var p=n(19890);n(32637),n(86419),n(34431),n(71806),n(22917),n(95766)},92116:(e,t,n)=>{"use strict";n(9818),n(69307),n(99196),n(23177)},85761:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(3396),a=n(69307),s=n(65235),o=n.n(s),i=n(25162),l=n.n(i);const c=e=>{const{checked:t,serviceName:n,label:s,onClick:i,profilePicture:l}=e,[c,u]=(0,a.useState)(!!l),d=(0,a.useCallback)((()=>u(!1)),[]),p=(0,a.useCallback)((e=>{13===e.keyCode&&i()}),[i]);return React.createElement("div",{onClick:i,onKeyDown:p,role:"switch","aria-checked":t,tabIndex:"0",className:o()("components-connection-icon",{"components-connection-icon__picture":c})},c&&React.createElement("img",{src:l,alt:s,onError:d}),React.createElement(r.av,{alt:s,serviceName:"instagram-business"===n?"instagram":"twitter"===n?"x":n,className:"jetpack-publicize-gutenberg-social-icon"}))};c.propTypes={serviceName:l().string,label:l().string,profilePicture:l().string};const u=c},60676:(e,t,n)=>{"use strict";n(55609),n(65736),n(99196),n(85761),n(62878),n(25893),n(20841),n(43876),n(75124)},62878:(e,t,n)=>{"use strict";n.d(t,{d:()=>o});var r=n(55609),a=n(65736),s=n(75124);const __=a.__;function o({connection:e}){return e.display_name?React.createElement("div",{className:s.Z["connection-name"]},e.profile_link?React.createElement(r.ExternalLink,{className:s.Z["profile-link"],href:e.profile_link},e.display_name):React.createElement("span",{className:s.Z["profile-link"]},e.display_name)):React.createElement(r.Spinner,{color:"black","aria-label":__("Loading account details","jetpack")})}},25893:(e,t,n)=>{"use strict";n.d(t,{Q:()=>s});var r=n(65736),a=n(67660);const __=r.__;function s({connection:e,service:t,onConfirmReconnect:n}){return"broken"!==e.status?null:React.createElement("div",null,React.createElement("span",{className:"description"},__("There is an issue with this connection.","jetpack"))," ",React.createElement(a.w,{connection:e,service:t,onConfirmReconnect:n}))}},20841:(e,t,n)=>{"use strict";n.d(t,{c:()=>u});var r=n(90526),a=n(55609),s=n(9818),o=n(69307),i=n(65736),l=n(23177),c=n(75124);const __=i.__,_x=i._x;function u({connection:e,variant:t="secondary",isDestructive:n=!0,buttonClassName:u}){const[d,p]=(0,o.useReducer)((e=>!e),!1),{deleteConnectionById:m}=(0,s.useDispatch)(l.h),{isDisconnecting:g}=(0,s.useSelect)((t=>{const{getDeletingConnections:n}=t(l.h);return{isDisconnecting:n().includes(e.connection_id)}}),[e.connection_id]),A=(0,o.useCallback)((async()=>{p(),await m({connectionId:e.connection_id})}),[e.connection_id,m]);return e.can_disconnect?React.createElement(React.Fragment,null,React.createElement(a.__experimentalConfirmDialog,{className:c.Z.confirmDialog,isOpen:d,onConfirm:A,onCancel:p,cancelButtonText:__("Cancel","jetpack"),confirmButtonText:__("Yes","jetpack")},(0,o.createInterpolateElement)((0,i.sprintf)(
// translators: %s: The name of the connection the user is disconnecting.
__("Are you sure you want to disconnect %s ?","jetpack"),e.display_name),{strong:React.createElement("strong",null)})),React.createElement(r.Z,{size:"small",onClick:p,disabled:g,variant:t,isDestructive:n,className:u},g?__("Disconnecting…","jetpack"):_x("Disconnect","Disconnect a social media account","jetpack"))):null}},75674:(e,t,n)=>{"use strict";n(55609),n(9818),n(69307),n(65736),n(65235),n(37568),n(23177),n(95766),n(66475),n(60676),n(75124)},43876:(e,t,n)=>{"use strict";n.d(t,{l:()=>l});var r=n(55609),a=n(9818),s=n(69307),o=n(65736),i=n(23177);const __=o.__;function l({connection:e}){const{updateConnectionById:t}=(0,a.useDispatch)(i.h),{isUpdating:n}=(0,a.useSelect)((t=>{const{getUpdatingConnections:n}=t(i.h);return{isUpdating:n().includes(e.connection_id)}}),[e.connection_id]),o=(0,s.useCallback)((n=>{t(e.connection_id,{shared:n})}),[e.connection_id,t]);return React.createElement(r.CheckboxControl,{checked:e.shared??!1,onChange:o,disabled:n||"broken"===e.status,label:__("Mark the connection as shared","jetpack")})}},67660:(e,t,n)=>{"use strict";n.d(t,{w:()=>c});var r=n(90526),a=n(9818),s=n(69307),o=n(65736),i=n(23177),l=n(58300);const __=o.__,_x=o._x;function c({connection:e,service:t,variant:n="link",onConfirmReconnect:o}){const{deleteConnectionById:c,setKeyringResult:u}=(0,a.useDispatch)(i.h),{isDisconnecting:d}=(0,a.useSelect)((t=>{const{getDeletingConnections:n}=t(i.h);return{isDisconnecting:n().includes(e.connection_id)}}),[e.connection_id]),p=(0,s.useCallback)((e=>{u(e),e?.ID&&o?.()}),[o,u]),m=(0,l.N)({service:t,onConfirm:p}),g=(0,s.useCallback)((async()=>{if(!await c({connectionId:e.connection_id,showSuccessNotice:!1}))return;const n=new FormData;"mastodon"===t.ID&&n.set("instance",e.external_display),m(n)}),[e,c,m,t.ID]);return e.can_disconnect?React.createElement(React.Fragment,null,React.createElement(r.Z,{size:"small",onClick:g,disabled:d,variant:n},d?__("Disconnecting…","jetpack"):_x("Reconnect","Reconnect a social media account","jetpack"))):null}},24479:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(65235),a=n.n(r),s=n(25162),o=n.n(s),i=n(85761);const l=e=>{const{checked:t,disabled:n,onChange:r,serviceName:s,label:o,profilePicture:l}=e,c=a()("components-connection-toggle",{"is-not-checked":!t,"is-disabled":n});return React.createElement("div",{className:c,title:o},React.createElement(i.Z,{checked:t,label:o,onClick:r,serviceName:s,profilePicture:l}))};l.propTypes={className:o().string,checked:o().bool,id:o().string.isRequired,disabled:o().bool,onChange:o().func,serviceName:o().string,label:o().string,profilePicture:o().string};const c=l},49021:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(94333),a=n(9818),s=n(69307),o=n(23177);class i extends s.Component{componentDidMount(){this.props.refreshConnections()}render(){return null}}const l=(0,r.compose)([(0,a.withSelect)((e=>({failedConnections:e(o.Eg).getFailedConnections()}))),(0,a.withDispatch)((e=>({refreshConnections:e(o.Eg).refreshConnectionTestResults})))])(i)},4277:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(13419),a=n(55609),s=n(9818),o=n(69307),i=n(65736),l=n(23177),c=n(24479),u=n(28161),d=n(91853);const __=i.__;class p extends o.Component{maybeDisplayLinkedInNotice=()=>this.connectionNeedsReauth()&&React.createElement(a.Notice,{className:u.Z["publicize-notice"],isDismissible:!1,status:"error"},React.createElement("p",null,__("Your LinkedIn connection needs to be reauthenticated to continue working – head to Sharing to take care of it.","jetpack")),React.createElement(a.ExternalLink,{href:`https://wordpress.com/marketing/connections/${(0,r.lQ)()}`},__("Go to Sharing settings","jetpack")));connectionNeedsReauth=()=>this.props.mustReauthConnections.includes(this.props.name);onConnectionChange=()=>{const{id:e}=this.props;this.isDisabled()||this.props.toggleConnection(e)};connectionIsFailing(){const{failedConnections:e,name:t}=this.props;return e.some((e=>e.service_name===t))}isDisabled(){return this.props.disabled||this.connectionIsFailing()||this.connectionNeedsReauth()}render(){const{enabled:e,id:t,label:n,name:r,profilePicture:a}=this.props,s="connection-"+r+"-"+t,o=r.replace("_","-"),i=React.createElement(c.Z,{id:s,className:d.Z["connection-toggle"],checked:e,onChange:this.onConnectionChange,disabled:this.isDisabled(),serviceName:o,label:n,profilePicture:a});return React.createElement("li",null,this.maybeDisplayLinkedInNotice(),React.createElement("div",{className:d.Z["connection-container"]},i))}}const m=(0,s.withSelect)((e=>({failedConnections:e(l.Eg).getFailedConnections(),mustReauthConnections:e(l.Eg).getMustReauthConnections()})))(p)},1922:(e,t,n)=>{"use strict";n.d(t,{F:()=>d});var r=n(6895),a=n(13419),s=n(55609),o=n(69307),i=n(65736),l=n(81050),c=n(75323),u=n(62578);const __=i.__,d=()=>{const{shouldShowAdvancedPlanNudge:e}=(0,l.usePublicizeConfig)(),{dismissNotice:t,shouldShowNotice:n,NOTICES:i}=(0,c.Z)(),d=(0,o.useCallback)((()=>t(i.advancedUpgradeEditor,7776e3)),[t,i]);return e&&n(i.advancedUpgradeEditor)&&React.createElement(u.Z,{onDismiss:d,type:"highlight"},(0,o.createInterpolateElement)(__("Need more reach? Unlock custom media sharing with the Advanced Plan ","jetpack"),{upgradeLink:React.createElement(s.ExternalLink,{href:(0,r.Z)("jetpack-social-advanced-site-checkout",{site:(0,a.lQ)(),query:"redirect_to="+encodeURIComponent(window.location.href)})})}))}},87029:(e,t,n)=>{"use strict";n.d(t,{w:()=>d});var r=n(13419),a=n(55609),s=n(69307),o=n(65736),i=n(81050),l=n(75323),c=n(62578),u=n(75631);const __=o.__,d=()=>{const{dismissNotice:e,shouldShowNotice:t,NOTICES:n}=(0,l.Z)(),o=(0,s.useCallback)((()=>e(n.autoConversion)),[e,n]),{adminUrl:d,jetpackSharingSettingsUrl:p}=(0,i.usePublicizeConfig)();return!(0,r.Wp)()&&t(n.autoConversion)&&React.createElement(c.Z,{type:"warning",actions:[React.createElement(a.Button,{onClick:o,key:"dismiss",variant:"primary"},__("Got it","jetpack")),React.createElement(a.Button,{className:u.Z["change-settings-button"],key:"change-settings",href:d||p,target:"_blank",rel:"noreferrer noopener"},__("Change settings","jetpack"))]},__("When your post is published, the selected image will be converted for maximum compatibility across your connected social networks.","jetpack"))}},63503:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(55609),a=n(69307),s=n(65736),o=n(81050),i=n(37568),l=n(62578),c=n(49285);const _n=s._n,u=()=>{const{connections:e}=(0,i.Z)(),t=e.filter((e=>(0,c.A)(e,"broken"))),{connectionsAdminUrl:n}=(0,o.usePublicizeConfig)();return t.length>0&&React.createElement(l.Z,{type:"error"},(0,a.createInterpolateElement)(_n("One of your social connections is broken. Reconnect them on the connection management page.","Some of your social connections are broken. Reconnect them on the connection management page.",t.length,"jetpack"),{fixLink:React.createElement(r.ExternalLink,{href:n})}))}},75457:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(14085),a=n(37568),s=n(4277),o=n(69709),i=n(75631),l=n(28155);const c=()=>{const{connections:e,toggleById:t}=(0,a.Z)(),{canBeTurnedOn:n,shouldBeDisabled:c}=(0,l.z)(),{needsUserConnection:u}=(0,r.Z)();return React.createElement("ul",{className:i.Z["connections-list"]},e.map((e=>{const{display_name:r,id:a,service_name:o,profile_picture:i,connection_id:l}=e,u=l||a;return React.createElement(s.Z,{disabled:c(e),enabled:n(e)&&e.enabled,key:u,id:u,label:r,name:o,toggleConnection:t,profilePicture:i})})),u?null:React.createElement("li",null,React.createElement(o.Z,null)))}},82356:(e,t,n)=>{"use strict";n.d(t,{H:()=>c});var r=n(55609),a=n(65736),s=n(14085),o=n(37568),i=n(75631),l=n(28155);const _n=a._n;function c(){const{enabledConnections:e}=(0,o.Z)(),{isPublicizeEnabled:t}=(0,s.Z)(),{canBeTurnedOn:n,shouldBeDisabled:c}=(0,l.z)(),u=e.filter((e=>n(e)&&!c(e)));return u.length&&t?React.createElement(r.PanelRow,null,React.createElement("p",{className:i.Z["enabled-connections-notice"]},(0,a.sprintf)(/* translators: %d: number of connections */
@@ -97,11 +97,11 @@ __("Delete %s","jetpack"),o.label),disabled:a===l},a===l?__("Deleting","jetpack"
__("Kind","jetpack"),onChange:t=>{n({...e,kind:t})},disabled:f}),(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-buttons-container"},f?(0,r.createElement)(i.Spinner,null):(0,r.createElement)(i.Button,{variant:"secondary",disabled:!e.tmpFile,onClick:()=>{h(null),""===b&&(e.label=__("English","jetpack")),""===v&&(e.srcLang="en"),void 0===e.kind&&(e.kind=p),d(e)?h(__("A track already exists for that language and kind.","jetpack")):(C(!0),E(e,t).then((()=>{n(e),h(null),a()})).catch((e=>{e.message&&h(e.message)})).finally((()=>{C(!1)})))}},__("Save","jetpack")),(0,r.createElement)(i.Button,{variant:"link",onClick:s},__("Close","jetpack"))),A&&(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-error"},/* translators: %s: An error message returned after a failed video track file upload." */ /* translators: %s: An error message returned after a failed video track file upload." */
(0,u.sprintf)(__("Error: %s","jetpack"),A))))}function v({tracks:e=[],onChange:t,guid:n}){const[a,s]=(0,c.useState)(null);return(0,r.createElement)(i.Dropdown,{contentClassName:"videopress-block-tracks-editor",renderToggle:({isOpen:e,onToggle:t})=>(0,r.createElement)(i.ToolbarButton,{label:__("Text tracks","jetpack"),showTooltip:!0,"aria-expanded":e,"aria-haspopup":"true",onClick:t,icon:A}),renderContent:()=>null!==a?(0,r.createElement)(b,{track:e[a],guid:n,onChange:n=>{const r=[...e];r[a]=n,t(r)},onClose:()=>s(null),onCancel:()=>{t(e.filter(((e,t)=>t!==a))),s(null)},trackExists:t=>-1!==e.filter(((e,t)=>t!==a)).findIndex((e=>e.kind===t.kind&&e.srcLang===t.srcLang))}):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.NavigableMenu,null,(0,r.createElement)(C,{tracks:e,onChange:t,guid:n}),(0,r.createElement)(i.MenuGroup,{className:"videopress-block-tracks-editor__add-tracks-container",label:__("Add tracks","jetpack")},(0,r.createElement)(i.MenuItem,{icon:d.Z,onClick:()=>{(()=>{const n=e.length,r=[...e];r[n]||(r[n]={}),r[n]={...e[n]},t(r),s(n)})()}},__("Upload track","jetpack")))))})}},32478:(e,t,n)=>{"use strict";n.d(t,{$:()=>A});var r=n(51806),a=n(52175),s=n(55609),o=n(69307),i=n(65736),l=n(61074),c=n(65235),u=n.n(c),d=n(81427);const __=i.__,p=["image"],m=e=>{const{videoPosterImageUrl:t}=e;return(0,r.createElement)("div",{className:"resumable-upload__editor-thumb-placeholder"},t?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("img",{src:t,alt:"Poster"}),(0,r.createElement)(l.Z,{className:"uploading-editor__play-icon",icon:d.o1})):(0,r.createElement)("span",null,"No Poster Selected"))},g=e=>{const{onSelectPoster:t,onRemovePoster:n}=e;return(0,r.createElement)(s.BaseControl,{className:u()(e.className,"editor-video-poster-control")},(0,r.createElement)(m,e),(0,r.createElement)(a.MediaUpload,{title:__("Select Poster Image","jetpack"),onSelect:t,allowedTypes:p,render:({open:e})=>(0,r.createElement)("div",{className:"poster-selector__buttons"},(0,r.createElement)(s.Button,{onClick:n,variant:"link",isDestructive:!0},__("Remove Poster Image","jetpack")),(0,r.createElement)(s.Button,{variant:"secondary",onClick:e},__("Select Poster Image","jetpack")))}))},A=e=>{const{file:t,onSelectPoster:n,onRemovePoster:i,videoPosterImageData:c,title:u,onChangeTitle:m,onVideoFrameSelected:A}=e,[h,E]=(0,o.useState)(0),[f,C]=(0,o.useState)(!0),b=(0,o.useRef)(null),v=(0,o.useRef)(null),k=()=>{C(!1)};(0,o.useEffect)((()=>{null!==t&&b&&(b.current.src=URL.createObjectURL(t))}),[t,b]);const B={};return c&&(B.display="none"),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"uploading-editor"},(0,r.createElement)("div",{className:"uploading-editor__summary"}),(0,r.createElement)("div",{className:"uploading-editor__fields"},(0,r.createElement)(s.TextControl,{label:__("Video title","jetpack"),className:"uploading-editor__title",onChange:m,value:u}),(0,r.createElement)("div",{className:"uploading-editor__content"},(0,r.createElement)(s.BaseControl,{label:__("Video poster (optional)","jetpack")},f?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"uploading-editor__video-container"},(0,r.createElement)("div",{className:"uploading-editor__video-poster-wrapper"},c&&(0,r.createElement)(g,{onSelectPoster:n,onRemovePoster:i,videoPosterImageUrl:c.url}),(0,r.createElement)("video",{ref:b,muted:!0,className:"uploading-editor__video",onDurationChange:e=>{const t=e.target.duration;E(t),b.current&&(b.current.currentTime=t/2)},onError:k,onLoadedMetadata:e=>{e.target.videoHeight||k()},style:B})),!c&&(0,r.createElement)(l.Z,{className:"uploading-editor__play-icon",icon:d.o1})),(0,r.createElement)("span",{style:B},(0,r.createElement)(s.RangeControl,{className:"uploading-editor__range",min:"0",step:"0.1",max:h,showTooltip:!1,withInputField:!1,onChange:e=>{A(1e3*e),b.current&&(b.current.currentTime=e)}})),(0,r.createElement)("span",{className:"uploading-editor__scrubber-help",style:B},(0,o.createInterpolateElement)(__("This is how the video will look. Use the slider to choose a poster or select a custom one .","jetpack"),{a:(0,r.createElement)(a.MediaUpload,{title:__("Select Poster Image","jetpack"),onSelect:n,allowedTypes:p,render:({open:e})=>(0,r.createElement)("a",{className:"uploading-editor__upload-link",onClick:e,onKeyDown:e,ref:v,role:"button",tabIndex:0},__("select a custom one","jetpack"))})}))):(0,r.createElement)(g,{onSelectPoster:n,videoPosterImageUrl:c?c.url:null}))))))}},90953:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(96483);const a=(e,{autoplay:t,controls:n,loop:a,muted:s,playsinline:o,poster:i,preload:l,seekbarColor:c,seekbarPlayedColor:u,seekbarLoadingColor:d,useAverageColor:p})=>{if(!e)return null;const m={resizeToParent:!0,cover:!0,...t&&{autoPlay:!0},...!n&&{controls:!1},...a&&{loop:!0},...s&&{muted:!0,persistVolume:!1},...o&&{playsinline:!0},...i&&{posterUrl:i},...""!==l&&{preloadContent:l},...""!==c&&{sbc:c},...""!==u&&{sbpc:u},...""!==d&&{sblc:d},...p&&{useAverageColor:!0}};return(0,r.addQueryArgs)(`https://videopress.com/v/${e}`,m)}},77290:(e,t,n)=>{"use strict";n.d(t,{K8:()=>l,Kp:()=>u,Zx:()=>c,f6:()=>i});n(4981);var r=n(65235),a=n.n(r),s=n(90879);const o=e=>{const t=s.sl.reduce(((e,{className:t})=>(e[t]=!1,e)),{"wp-has-aspect-ratio":!1});return a()(e,t)};function i(e,t="",n=!0){if(!n)return o(t);const r=document.implementation.createHTMLDocument("");r.body.innerHTML=e;const i=r.body.querySelector("iframe");if(i&&i.height&&i.width){const e=(i.width/i.height).toFixed(2);for(let n=0;n=r.ratio)return a()(o(t),r.className,"wp-has-aspect-ratio")}}return t}const l=e=>e.replace(/\.[^/.]+$/,""),c=e=>{if(!e||"string"!=typeof e)return null;const t=e.match(/^https?:\/\/(?video(?:\.word|s\.files\.word)?press\.com)(?:\/v|\/embed)?\/(?[a-zA-Z\d]{8})/);return t?.groups?.guid?t.groups.guid:null},u=e=>{const{guid:t,videoPressTracks:n,isVideoPressExample:r}=e;if(!t?.length)return!1;if(!Array.isArray(n))return!1;return!(!Object.keys(e).includes("isVideoPressExample")||"boolean"!=typeof r)}},65192:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(13419),s=n(52175),o=n(4981),i=n(55609),l=n(9818),c=n(12238),u=(n(69307),n(65736)),d=n(77290),p=n(5743);const __=u.__,m={instances:[]},g=(e=[],t=!1,n=0)=>{if(t&&(m.instances=[]),e.forEach((e=>{if(e.innerBlocks.length)return void g(e.innerBlocks,!1,n+1);const{clientId:t,name:r,attributes:a}=e;"core/video"===r&&(0,d.Kp)(a)&&m.instances.push({clientId:t,name:r,attributes:a})})),0===n)return m.instances};function A({clientId:e,attributes:t}){const n=(0,l.useSelect)((e=>e(c.store).getCurrentPostId())),{getBlocks:u}=(0,l.useSelect)(s.store),{replaceBlock:m}=(0,l.useDispatch)(s.store),{tracks:A}=(0,a.z$)();return(0,r.createElement)("div",{className:p.Z.wrapper},(0,r.createElement)(i.Notice,{status:"info",isDismissible:!1,className:p.Z["conversion-notice"]},__("You can transform this post's video blocks to the new VideoPress block to take advantage of new features, such as adding chapters directly in the description or hiding the video's share menu.","jetpack")),(0,r.createElement)(i.Button,{variant:"primary",onClick:()=>{const r=g(u(),!0);r?.length&&(r.find((t=>t.clientId===e))||r.push({clientId:e,name:"core/video",currentBlockAttributes:t}),r.forEach((e=>{const{clientId:t,name:r,attributes:a}=e;"core/video"===r&&(0,d.Kp)(a)&&(m(t,(0,o.createBlock)("videopress/video",a)),A.recordEvent("jetpack_editor_videopress_block_manual_conversion_click",{post_id:n}))})))}},__("Transform blocks to VideoPress","jetpack")))}},68938:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(52175),s=n(94333),o=n(77290),i=n(65192);const l=(0,s.createHigherOrderComponent)((e=>t=>(0,o.Kp)(t.attributes)?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(i.Z,{clientId:t.clientId,attributes:t.attributes})),(0,r.createElement)(e,t)):(0,r.createElement)(e,t)))},23062:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(13419),a=n(68938);const s="videopress/video";function o(e,t){if("core/video"!==t)return e;const{available:n}=(0,r.OZ)(s);return n?{...e,edit:(0,a.Z)(e.edit)}:e}},73859:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(51806),a=n(55609),s=n(65736),o=n(78680),i=n(75255);const __=s.__,l="videopress/video-chapters",c=!!window?.Jetpack_Editor_Initial_State?.available_blocks[l],u=31;function d({isRequestingVideoItem:e}){const{attributes:t,setAttributes:n}=(0,i.Z)(),{title:s,description:d}=t,p=(0,o.L)(l),m=d?.length?d.split("\n").map((e=>Math.ceil(e.length/u)||1)).reduce(((e,t)=>e+t),0):4,g=Math.min(12,Math.max(m,4));if(!c)return null;return(0,r.createElement)(a.PanelBody,{title:__("Details","jetpack"),className:p?"is-beta":""},(0,r.createElement)(a.TextControl,{label:__("Title","jetpack"),value:s,placeholder:__("Video title","jetpack"),onChange:e=>{n({title:e})},disabled:e}),(0,r.createElement)(a.TextareaControl,{label:__("Description","jetpack"),value:d,placeholder:__("Video description","jetpack"),onChange:e=>{n({description:e})},disabled:e,rows:g}))}},24288:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(51806),a=n(52175),s=n(94333),o=n(69307),i=n(73859),l=n(67203),c=n(49664),u=n(84676);const d=(0,s.createHigherOrderComponent)((e=>t=>{const{attributes:n,setAttributes:s}=t,[d,p]=(0,l.Z)(n?.id),[m]=(0,c.v)(n);return(0,o.useEffect)((()=>{if(!d)return;const e={};d?.title&&(e.title=d.title),d?.description&&(e.description=d.description),Object.keys(e).length&&(s(e),m(e))}),[d,s,m]),u.d&&"core/video"!==!t.name&&t.attributes?.guid?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(i.Z,{isRequestingVideoItem:p})),(0,r.createElement)(e,t)):(0,r.createElement)(e,t)}))},75255:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(52175),a=n(9818);function s(){const{clientId:e,attributes:t}=(0,a.useSelect)((e=>{const t=e(r.store).getSelectedBlockClientId();return{clientId:t,attributes:t?e("core/block-editor").getBlockAttributes(t):void 0}})),{updateBlockAttributes:n}=(0,a.useDispatch)(r.store);return{clientId:e,attributes:t,setAttributes:t=>n(e,t)}}},49664:(e,t,n)=>{"use strict";n.d(t,{v:()=>A});var r=n(86989),a=n.n(r),s=n(94333),o=n(37798),i=n(9818),l=n(12238),c=n(69307),u=n(65736),d=n(22081),p=n(90953),m=n(84321),g=n(38871);const __=u.__;function A(e){const{id:t,title:n,description:r,guid:u}=e,A=(0,i.useSelect)((e=>e(l.store).isSavingPost()),[]),h=(0,s.usePrevious)(A),E=(0,i.useDispatch)(o.store).invalidateResolution,[f,C]=(0,c.useState)(),b=(0,c.useCallback)((e=>{C((t=>({...t,...e})))}),[]);(0,c.useEffect)((()=>{C({title:n,description:r})}),[]);const v=function(e){return t=>new Promise(((n,r)=>{a()({path:"/wpcom/v2/videopress/meta",method:"POST",data:{id:e,...t}}).then((e=>{if(200!==e?.data)return r(e);n(e)})).catch(r)}))}(t);return(0,c.useEffect)((()=>{if(!A||h)return;if(!t)return;const a={};if(f?.title!==n&&(a.title=n),f?.description!==r&&(a.description=r),!Object.keys(a).length)return;if(v(a).then((()=>b({title:n,description:r}))),!a?.description?.length)return;const s=(0,m.ZP)(a.description);if(!s?.length)return;const o={label:__("English","jetpack"),srcLang:"en",kind:"chapters",tmpFile:(0,g.ZP)(a.description)};(0,d.n)(o,u).then((()=>{const t=(0,p.p)(u,e);E("getEmbedPreview",[t])}))}),[A,h,n,f?.title,f?.description,r,v,b,e,E,t,u]),[b]}},67203:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(86989),a=n.n(r),s=n(69307);function o(e){const[t,n]=(0,s.useState)({}),[r,o]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{e&&(o(!0),async function(){try{const t=await a()({path:`/wp/v2/media/${e}`});n(t?.jetpack_videopress||{}),o(!1)}catch(e){throw o(!1),new Error(e)}}())}),[e]),[t,r]}},84676:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s,d:()=>a});var r=n(24288);const a=!!window?.Jetpack_Editor_Initial_State?.available_blocks["videopress/video-chapters"];function s(e,t){if(!a)return e;if("core/video"!==t)return e;const n={...e.attributes,title:{type:"string"},description:{type:"string"}};return{...e,attributes:n,edit:(0,r.Z)(e.edit)}}},84321:(e,t,n)=>{"use strict";function r(e){return e.split("\n").map((e=>function(e){const t=/(?\(?(?\d{1,2}:\d{2}:\d{2}|\d{1,2}:\d{2})\)?)/.exec(e);if(null==t||null==t.groups)return null;const{groups:{timeBlock:n,time:r}}=t,a=e.indexOf(n),s=(a<(e.length-n.length)/2?e.substring(a+n.length,e.length):e.substring(0,a)).trim().replace(/(\s-$)|(^-\s)/,""),o=r.split(":");return 1===o[0].length&&(o[0]=`0${o[0]}`),2===o.length&&o.unshift("00"),{startAt:o.join(":"),title:s}}(e))).filter((e=>null!==e)).sort(((e,t)=>e.startAt.localeCompare(t.startAt)))}n.d(t,{Tn:()=>r,ZP:()=>r})},38871:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>s});var r=n(84321);function a(e){const t=Math.floor(e/36e5);let n=e-36e5*t;const r=Math.floor(n/6e4);n-=6e4*r;return[t,r,Math.floor(n/1e3)].map((e=>e<10?`0${e}`:e)).join(":")}function s(e,t){const n=function(e,t=359999e3){const n=(0,r.Tn)(e);if(0===n.length)return null;let s="WEBVTT\n",o=1;for(const[e,r]of n.entries()){const i=0===e?"000":"001",l=e{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(42290),s=n(55609),o=n(65736);const __=o.__;function i({state:e,onUpload:t,onCancel:n,onRecord:o,onPause:i,onResume:l,onDone:c}){return(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__action-buttons"},["inactive","error","validating"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qf,variant:"secondary",onClick:o},__("Begin recording","jetpack")),["recording"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qr,variant:"secondary",onClick:i},__("Pause recording","jetpack")),["paused"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",icon:a.Qf,variant:"secondary",onClick:l},__("Resume recording","jetpack")),["inactive","error","validating"].includes(e)&&(0,r.createElement)(s.FormFileUpload,{accept:".mp3,.mpeg,.mpga,.ogg,.flac,.m4a,.mp4,.wav,.wave,.webm",onChange:t,variant:"secondary",className:"jetpack-ai-voice-to-content__button"},__("Upload audio","jetpack")),["recording","paused"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",variant:"primary",onClick:c},__("Done","jetpack")),["recording","paused","processing"].includes(e)&&(0,r.createElement)(s.Button,{className:"jetpack-ai-voice-to-content__button",variant:"secondary",onClick:n},__("Cancel","jetpack")))}},36265:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(51806),a=n(42290),s=n(65736),o=n(79554);const __=s.__;function i({state:e,error:t=null,analyser:n,duration:s=0}){return"inactive"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("File size limit: 25MB. Recording time limit: 25 minutes.","jetpack")):"recording"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__audio"},(0,r.createElement)(a.ZK,{className:"jetpack-ai-voice-to-content__audio--duration",duration:s}),(0,r.createElement)(o.Z,{analyser:n,paused:!1}),(0,r.createElement)("span",{className:"jetpack-ai-voice-to-content__information"},__("Recording…","jetpack"))):"paused"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__audio"},(0,r.createElement)(a.ZK,{className:"jetpack-ai-voice-to-content__audio--duration",duration:s}),(0,r.createElement)(o.Z,{analyser:n,paused:!0}),(0,r.createElement)("span",{className:"jetpack-ai-voice-to-content__information"},__("Paused","jetpack"))):"processing"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("Uploading and transcribing audio…","jetpack")):"validating"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information"},__("Validating audio…","jetpack")):"error"===e?(0,r.createElement)("div",{className:"jetpack-ai-voice-to-content__information--error"},t):null}},79554:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(69307);function s({analyser:e,paused:t=!1}){const n=(0,a.useRef)(null),s=(0,a.useRef)(t),o=(0,a.useRef)(null);return(0,a.useEffect)((()=>{s.current=t}),[t]),(0,a.useEffect)((()=>{e&&n.current&&(o.current&&o.current(),o.current=function(e,t,n){const r=t.getContext("2d");let a=!1;if(!r)return;e.fftSize=Math.pow(2,13);const s=e.fftSize,o=new Float32Array(s),i=s/10,{width:l,height:c}=t,u=c/2;r.lineWidth=4,r.lineCap="round",r.strokeStyle=getComputedStyle(t).getPropertyValue("--jp-green-50")||"#008710";const d=()=>{r.clearRect(0,0,l,c),e.getFloatTimeDomainData(o);for(let e=1;e<=10;e++){let t=0;n.current||(t=o.slice(e*i,(e+1)*i).reduce(((e,t)=>e+t),0)/i,t*=2048,t=Math.abs(t),t=Math.min(16,Math.max(0,t))),r.beginPath(),r.moveTo(2+6*e,u-t),r.lineTo(2+6*e,u+t),r.stroke()}setTimeout((()=>{a||requestAnimationFrame(d)}),50)};return d(),()=>{a=!0}}(e,n.current,s))}),[e,n,s]),(0,a.useEffect)((()=>()=>{o.current&&o.current()}),[]),(0,r.createElement)("canvas",{className:"jetpack-ai-voice-to-content__oscilloscope",width:70,height:38,ref:n})}},32663:(e,t,n)=>{"use strict";n.d(t,{Z:()=>C});var r=n(82674),a=n.n(r),s=n(51806),o=n(42290),i=n(88275),l=n(13419),c=n(55609),u=n(9818),d=n(69307),p=n(65736),m=n(15381),g=(n(99196),n(83181)),A=n(36265),h=n(48384),E=n(24167);const __=p.__,f=(e,t,n)=>t?"validating":e?"processing":n;function C({clientId:e}){const[t,n]=(0,d.useState)(null),{removeBlock:r}=(0,u.useDispatch)("core/block-editor"),{getBlocks:p}=(0,u.useSelect)((e=>e("core/editor")),[]),C=(0,d.useCallback)((()=>{setTimeout((()=>{r(e)}),100)}),[r,e]),{tracks:b}=(0,l.z$)(),{isValidatingAudio:v,validateAudio:k}=(0,o.L$)(),{upsertTranscription:B}=(0,E.Z)(),{isCreatingTranscription:y,createTranscription:w,cancelTranscription:_}=(0,h.Z)({onReady:e=>{B(e);const t=p();for(let e=0;e<2;e++)"core/paragraph"===t[e].name&&""===t[e].attributes?.content&&r(String(t[e].clientId));I()},onUpdate:e=>{B(e)},onError:e=>{Q(e)}}),I=()=>{_(),C()},{state:j,controls:x,error:S,onError:Q,duration:N,analyser:P}=(0,o._T)({onDone:e=>{R(e)}}),R=(0,d.useCallback)((e=>{e&&n(e)}),[n]);(0,d.useEffect)((()=>{t&&k(t,(e=>{b.recordEvent("jetpack_ai_voice_to_content_transcription_started",{post_processing_action:o.Y,type:e.isFile?"upload":"record",audio_duration:e.duration,audio_file_size:e.size}),w(t,o.Y)}),Q)}),[t,b,k,w,Q]);const{start:T,pause:Z,resume:L,stop:M,reset:D}=x,F=(0,d.useCallback)((e=>{if(e.currentTarget.files.length>0){const t=e.currentTarget.files[0];R(t)}}),[R]),z=(0,d.useCallback)((()=>{_(),D()}),[_,D]),O=(0,d.useCallback)((()=>{T(1e3)}),[T]),U=(0,d.useCallback)((()=>{Z()}),[Z]),H=(0,d.useCallback)((()=>{L()}),[L]),V=(0,d.useCallback)((()=>{M()}),[M]),q=f(y,v,j);return(0,s.createElement)(c.Modal,{onRequestClose:I,title:__("Jetpack AI Voice to content","jetpack"),className:"jetpack-ai-voice-to-content__modal",shouldCloseOnEsc:!1,shouldCloseOnClickOutside:!1},(0,s.createElement)(i.ZP,null,(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__wrapper"},(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__body"},(0,s.createElement)("span",{className:"jetpack-ai-voice-to-content__description"},__("Transform your spoken words into a post ready to publish with AI.","jetpack")),(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__contextual-row"},(0,s.createElement)(A.Z,{state:q,error:S,duration:N,analyser:P})),(0,s.createElement)(g.Z,{state:q,onUpload:F,onCancel:z,onRecord:O,onPause:U,onResume:H,onDone:V})),(0,s.createElement)("div",{className:"jetpack-ai-voice-to-content__footer"},(0,s.createElement)(c.Button,{variant:"link",className:"jetpack-ai-voice-to-content__feedback-button",href:"https://a8c.slack.com/archives/C054LN8RNVA",target:"_blank"},(0,s.createElement)("span",null,__("Provide feedback","jetpack")),(0,s.createElement)(c.Icon,a()({icon:m.Z},{className:"icon"})))))))}},13006:(e,t,n)=>{"use strict";var r=n(31985),a=n(58940),s=n(32663);(0,r.S)(a,{edit:s.Z,save:()=>null})},48384:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(42290),a=n(69307),s=n(51128);const o=n.n(s)()("voice-to-content:use-transcription-creator"),i="voice-to-content";function l({onReady:e,onUpdate:t,onError:n}){const s=(0,a.useRef)(null),l=(0,a.useRef)(null),{processTranscription:c,cancelTranscriptionProcessing:u,isProcessingTranscription:d}=(0,r.OS)({feature:i,onReady:e,onUpdate:t,onError:t=>{if(s.current)return e(s.current);o("Transcription post-processing error: ",t)}}),p=(0,a.useCallback)((e=>{s.current=e,l.current&&c(l.current,e)}),[c]),{transcribeAudio:m,cancelTranscription:g,isTranscribingAudio:A}=(0,r.cH)({feature:i,onReady:p,onError:n});return{isCreatingTranscription:A||d,createTranscription:(0,a.useCallback)(((e,t)=>{if(e&&t)return l.current=t,m(e)}),[m]),cancelTranscription:(0,a.useCallback)((()=>{g(),u()}),[g,u])}}},24167:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(42290),a=n(4981),s=n(9818),o=n(69307),i=n(51128);const l=n.n(i)()("voice-to-content:use-transcription-inserter");function c(){const{updateBlockAttributes:e,insertBlocks:t,replaceInnerBlocks:n}=(0,s.useDispatch)("core/block-editor"),i=(0,o.useRef)([]);return{upsertTranscription:(0,o.useCallback)((s=>{l("Upserting transcription");const o=(0,r.LB)({content:s||""}),c=(0,a.rawHandler)({HTML:o});for(let r=0;r0&&n(t,c[r].innerBlocks)}else t([c[r]],void 0,void 0,!0,null),i.current.push(c[r])}),[i,t,e,n])}}},68925:(e,t,n)=>{"use strict";n.d(t,{W:()=>c});var r=n(51806),a=n(13419),s=n(55609),o=n(65736),i=n(99787);const __=o.__,l=(0,a.dM)(i),c=({changeStatus:e,isLoading:t,isModuleActive:n})=>(0,r.createElement)(s.Placeholder,{icon:l,instructions:__("You'll need to activate the WordAds feature to use this block.","jetpack"),label:i.title},(0,r.createElement)(s.Button,{disabled:n||t,isBusy:t,onClick:()=>e(!0),variant:"secondary"},t?__("Activating WordAds","jetpack"):__("Activate WordAds","jetpack",0)),(0,r.createElement)("div",{className:"membership-button__disclaimer"},(0,r.createElement)(s.ExternalLink,{href:"https://jetpack.com/support/ads/"},__("Learn more about the WordAds feature.","jetpack"))))},61981:(e,t,n)=>{"use strict";n.d(t,{c:()=>o});var r=n(51806),a=n(22636),s=n(55609);const o=()=>(0,r.createElement)(s.Placeholder,null,(0,r.createElement)(s.Flex,{gap:2,direction:"column",style:{width:"100%"}},(0,r.createElement)(s.Flex,{gap:4},(0,r.createElement)(s.FlexItem,null,(0,r.createElement)(a.Z,{width:30,height:30})),(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{width:"90%",height:30}))),(0,r.createElement)(s.Flex,{style:{marginTop:12}},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{height:30,width:"60%"}))),(0,r.createElement)(s.Flex,{style:{marginTop:12}},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{width:150,height:50}))),(0,r.createElement)(s.Flex,{style:{marginTop:18}},(0,r.createElement)(s.FlexBlock,null,(0,r.createElement)(a.Z,{width:"90%",height:16})))))},50354:(e,t,n)=>{"use strict";n.d(t,{m:()=>o});var r=n(51806),a=n(55609),s=n(65736);const __=s.__,o=[{height:250,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-7-2h2V7h-4v2h2z"})),name:__("Rectangle 300x250","jetpack"),tag:"mrec",width:300,editorPadding:30},{height:90,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4h-4v-2h2c1.1 0 2-.89 2-2V9c0-1.11-.9-2-2-2H9v2h4v2h-2c-1.1 0-2 .89-2 2v4h6v-2z"})),name:__("Leaderboard 728x90","jetpack"),tag:"leaderboard",width:728,editorPadding:60},{height:50,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V9c0-1.11-.9-2-2-2H9v2h4v2h-2v2h2v2H9v2h4c1.1 0 2-.89 2-2z"})),name:__("Mobile Leaderboard 320x50","jetpack"),tag:"mobile_leaderboard",width:320,editorPadding:100},{height:600,icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M.04 0h24v24h-24V0z"}),(0,r.createElement)(a.Path,{d:"M19.04 3h-14c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16h-14V5h14v14zm-6-2h2V7h-2v4h-2V7h-2v6h4z"})),name:__("Wide Skyscraper 160x600","jetpack"),tag:"wideskyscraper",width:160,editorPadding:30}]},56565:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(51806),a=n(52175),s=n(55609),o=n(65736),i=n(1020);const __=o.__,l=({value:e,onChange:t})=>(0,r.createElement)(s.PanelBody,{title:__("Visibility","jetpack")},(0,r.createElement)(s.ToggleControl,{className:"jetpack-wordads__mobile-visibility",checked:!!e,label:__("Hide on mobile","jetpack"),help:__("Hides this block for site visitors on mobile devices.","jetpack"),onChange:t})),c=({attributes:{format:e,hideMobile:t},setAttributes:n})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.BlockControls,null,(0,r.createElement)(i.Z,{value:e,onChange:e=>n({format:e})})),(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(l,{value:t,onChange:e=>n({hideMobile:!!e})})))},53193:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(88275),s=n(13419),o=n(52175),i=n(68925),l=n(61981),c=n(50354),u=n(56565),d=n(80405),p=n(72473),m=n(38511),g=n(52203);const A=({attributes:e,setAttributes:t})=>{const n=(0,o.useBlockProps)(),{format:A}=e,{isLoadingModules:h,isChangingStatus:E,isModuleActive:f,changeStatus:C}=(0,s.el)("wordads"),b=c.m.find((({tag:e})=>e===A)),v=e=>{switch(e){case"leaderboard":return g;case"mobile_leaderboard":return m;case"wideskyscraper":return d;default:return p}};let k;return k=f?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(u.Z,{attributes:e,setAttributes:t}),(0,r.createElement)("div",{className:`wp-block-jetpack-wordads jetpack-wordads-${A}`},(0,r.createElement)("div",{className:"jetpack-wordads__ad",style:{width:b.width,height:b.height,backgroundImage:`url( ${v(A)} )`,backgroundSize:"cover"}}))):h?(0,r.createElement)(a.ZP,null,(0,r.createElement)(l.c,null)):(0,r.createElement)(i.W,{changeStatus:C,isModuleActive:f,isLoading:E}),(0,r.createElement)("div",n,k)}},3432:(e,t,n)=>{"use strict";var r=n(31985),a=n(99787),s=n(53193);(0,r.S)(a,{edit:s.Z,save:()=>null})},1020:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(55609),s=n(65736),o=n(50354);const i=(0,s.__)("Pick an ad format","jetpack");function l({value:e,onChange:t}){return(0,r.createElement)(a.Dropdown,{placement:"bottom-start",renderToggle:({onToggle:e,isOpen:t})=>(0,r.createElement)(a.ToolbarGroup,{controls:[{icon:(0,r.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(a.Path,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)(a.Path,{d:"M1 9h2V7H1v2zm0 4h2v-2H1v2zm0-8h2V3c-1.1 0-2 .9-2 2zm8 16h2v-2H9v2zm-8-4h2v-2H1v2zm2 4v-2H1c0 1.1.9 2 2 2zM21 3h-8v6h10V5c0-1.1-.9-2-2-2zm0 14h2v-2h-2v2zM9 5h2V3H9v2zM5 21h2v-2H5v2zM5 5h2V3H5v2zm16 16c1.1 0 2-.9 2-2h-2v2zm0-8h2v-2h-2v2zm-8 8h2v-2h-2v2zm4 0h2v-2h-2v2z"})),title:i,onClick:e,extraProps:{"aria-expanded":t},className:"wp-block-jetpack-wordads__format-picker-icon"}]}),renderContent:({onClose:n})=>(0,r.createElement)(a.NavigableMenu,{className:"wp-block-jetpack-wordads__format-picker"},o.m.map((({tag:s,name:o,icon:i})=>(0,r.createElement)(a.MenuItem,{className:s===e?"is-active":void 0,icon:i,isSelected:s===e,key:s,onClick:()=>{t(s),n()},role:"menuitemcheckbox"},o))))})}},78680:(e,t,n)=>{"use strict";n.d(t,{L:()=>d});var r=n(82674),a=n.n(r),s=n(51806),o=n(86989),i=n.n(o),l=n(94333),c=n(92694),u=(n(80425),n(85921),n(63066),n(92713),n(54414),n(36215),n(31657),n(23984),n(14688),n(7652),n(29692),n(1949));function d(e){if(!u)return!1;const t=u.beta||[],n=e.replace(/jetpack\//,"");return t.includes(e)||t.includes(n)}i().use(((e,t)=>{if("cors"===e.mode)return t(e);if(e.url)try{const n=new URL(e.url,location.href);if(n.protocol!==location.protocol||n.hostname!==location.hostname||n.port!==location.port)return t(e)}catch{return t(e)}return e.headers||(e.headers={}),e.headers["x-wp-api-fetch-from-editor"]="true",t(e)})),(0,c.addFilter)("blocks.registerBlockType","jetpack/label-beta-blocks-title",(function(e,t){if(!d(t))return e;const{title:n,keywords:r}=e,a="(beta)",s="beta",o={...e};return n&&(o.title=n.toLowerCase().endsWith(a)?n:`${e.title} ${a}`),Array.isArray(r)&&(o.keywords=r.includes(s)?r:[...r,s]),o}));const p=(0,l.createHigherOrderComponent)((e=>t=>{if(t?.clientRootId)return(0,s.createElement)(e,t);const{name:n}=t;return d(n)?(0,s.createElement)(e,a()({},t,{className:"is-beta-extension"})):(0,s.createElement)(e,t)}),"withBetaClassName");(0,c.addFilter)("editor.BlockListBlock","jetpack/label-beta-extensions",p)},6460:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),s=n(81427);const __=a.__,o={name:"descript",title:"Descript",icon:s.h,keywords:[__("descript","jetpack")],description:__("Embed a Descript Item.","jetpack"),patterns:[/^https:\/\/share.descript.com\/(view|embed)\/\w+/i],attributes:{providerNameSlug:"descript",responsive:!0}};(0,r.registerBlockVariation)("core/embed",o)},5166:(e,t,n)=>{"use strict";var r=n(92694),a=n(65736),s=n(70355),o=n(81427);const __=a.__,_x=a._x,i={name:"facebook",title:"Facebook",icon:{src:o.Vq,foreground:(0,s.m)()},keywords:[_x("social","block search term","jetpack")],description:__("Embed a Facebook post.","jetpack"),patterns:[/^https?:\/\/www\.facebook.com\/.+/i],attributes:{providerNameSlug:"facebook",previewable:!1,responsive:!0}};(0,r.addFilter)("blocks.registerBlockType","reactivateFacebookEmbedBlockVariation",(function(e,t){if("core/embed"!==t||!e.variations)return e;const n=e.variations.filter((e=>e.name!==i.name));return e.variations=[...n,i],e}))},36215:(e,t,n)=>{"use strict";n(5166),n(20970),n(25467),n(91128),n(6460)},20970:(e,t,n)=>{"use strict";var r=n(92694),a=n(65736),s=n(70355),o=n(81427),i=n(12923);const __=a.__,_x=a._x,l={name:"instagram",title:"Instagram",icon:{src:o.yu,foreground:(0,s.m)()},keywords:[_x("image","block search term","jetpack"),_x("social","block search term","jetpack")],description:__("Embed an Instagram post.","jetpack"),patterns:[/^https?:\/\/(www\.)?instagr(\.am|am\.com)\/.+/i],attributes:{providerNameSlug:"instagram",responsive:!0}};(0,r.addFilter)("blocks.registerBlockType","reactivateInstagramEmbedBlockVariation",(function(e,t){if("core/embed"!==t||!e.variations||!(0,i.Z)())return e;const n=e.variations.filter((e=>e.name!==l.name));return e.variations=[...n,l],e}))},25467:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),s=n(81427);const __=a.__,o={name:"loom",title:"Loom",icon:s.zf,keywords:[__("video","jetpack")],description:__("Embed a Loom video.","jetpack"),patterns:[/^https?:\/\/(www\.)?loom\.com\/share\/.+/i],attributes:{providerNameSlug:"loom",responsive:!0}};(0,r.registerBlockVariation)("core/embed",o)},91128:(e,t,n)=>{"use strict";var r=n(4981),a=n(65736),s=n(81427);const __=a.__,o={name:"smartframe",title:"SmartFrame",icon:s.Ae,keywords:[__("smartframe","jetpack")],description:__("Embed a SmartFrame Image.","jetpack"),patterns:[/^https?:\/\/(.*?).smartframe.(io|net)\/.*/i],attributes:{providerNameSlug:"smartframe",responsive:!0}};(0,r.registerBlockVariation)("core/embed",o)},31657:(e,t,n)=>{"use strict";var r=n(4981),a=n(92694),s=n(6512);const o={from:[{type:"block",isMultiBlock:!1,blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>!!t?.raw&&"jetpack_widget_social_icons"===e,transform:({instance:e})=>{let t=[];return e.raw.icons.forEach((e=>{const n=new URL(e.url.includes(":")?e.url:"https://"+e.url),a=n.hostname?n.hostname:n.protocol,o=s.Z.find((e=>a.includes(e.url)||e.url.includes(a))),i=(0,r.createBlock)("core/social-link",{service:o?o.name:"chain",url:e.url});t=[...t,i]})),(0,r.createBlock)("core/social-links",{},t)}}]};(0,a.addFilter)("blocks.registerBlockType","addTransformToSocialLinksWidget",(function(e,t){return"core/social-links"!==t||(e.transforms=o),e}))},6512:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r=[{name:"wordpress",url:["wordpress."]},{name:"fivehundredpx",url:["500px.com"]},{name:"amazon",url:["amazon."]},{name:"bandcamp",url:["bandcamp.com"]},{name:"behance",url:["behance.net"]},{name:"codepen",url:["codepen.io"]},{name:"deviantart",url:["deviantart.com"]},{name:"dribbble",url:["dribbble.com"]},{name:"dropbox",url:["dropbox.com"]},{name:"etsy",url:["etsy.com"]},{name:"facebook",url:["facebook.com"]},{name:"flickr",url:["flickr.com"]},{name:"foursquare",url:["foursquare.com"]},{name:"goodreads",url:["goodreads.com"]},{name:"google",url:["google."]},{name:"github",url:["github.com"]},{name:"instagram",url:["instagram.com"]},{name:"lastfm",url:["last.fm"]},{name:"linkedin",url:["linkedin.com"]},{name:"mail",url:["mailto:"]},{name:"linkedin",url:["linkedin.com"]},{name:"mastodon",url:["mastodon.social"]},{name:"meetup",url:["meetup.com"]},{name:"medium",url:["medium.com"]},{name:"patreon",url:["patreon.com"]},{name:"pinterest",url:["pinterest."]},{name:"pocket",url:["getpocket.com"]},{name:"reddit",url:["reddit.com"]},{name:"skype",url:["skype.com","skype:"]},{name:"snapchat",url:["snapchat.com"]},{name:"soundcloud",url:["soundcloud.com"]},{name:"spotify",url:["spotify.com"]},{name:"telegram",url:["telegram.me","t.me"]},{name:"tiktok",url:["tiktok.com"]},{name:"tumblr",url:["tumblr.com"]},{name:"twitch",url:["twitch.tv"]},{name:"twitter",url:["twitter.com"]},{name:"vimeo",url:["vimeo.com"]},{name:"vk",url:["vk.com"]},{name:"yelp",url:["yelp.com"]},{name:"youtube",url:["youtube.com"]}]},87950:(e,t,n)=>{"use strict";n.d(t,{L:()=>o,x:()=>s});var r=n(51806),a=n(69307);const s=(0,a.createContext)(),o=({onBannerVisibilityChange:e,hasParentBanner:t,children:n})=>(0,r.createElement)(s.Provider,{value:{onBannerVisibilityChange:e,hasParentBanner:t},children:n})},23984:(e,t,n)=>{"use strict";var r=n(13419),a=n(47701),s=n.n(a),o=n(92694),i=n(65736),l=n(92819),c=n(30371),u=n(7832),d=n(42770),p=n(27003);const __=i.__,m=[];(0,o.addFilter)("blocks.registerBlockType","jetpack/paid-block",((e,t)=>((0,r.X1)(t)&&(m.includes(t)||m.push(t),e.keywords=(0,l.uniq)([...e.keywords,"premium",__("premium","jetpack")]),(0,r.HD)(t)||(e.icon=(0,d.Z)(e.icon)),e.attributes.shouldDisplayFrontendBanner||(e.attributes.shouldDisplayFrontendBanner={type:"boolean",default:!0}),"core/cover"!==t&&(e.supports={...e.supports,__experimentalExposeControlsToChildren:!0})),e))),(0,o.addFilter)("blocks.registerBlockType","jetpack/paid-block-with-upgrade-banner",p.v),(0,o.addFilter)("editor.MediaPlaceholder","jetpack/paid-block-media-placeholder",c.Z),(0,o.addFilter)("editor.MediaReplaceFlow","jetpack/paid-block-media-placeholder",u.Z),s()((function(){(0,r.FK)()&&document.body.classList.add("jetpack-enable-upgrade-nudge")}))},30371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(82674),a=n.n(r),s=n(51806),o=n(13419),i=n(52175),l=n(94333),c=n(69307),u=n(11317),d=n(87950);const p=(0,l.createHigherOrderComponent)((e=>t=>{const{name:n}=(0,i.useBlockEditContext)(),r=(0,o.m3)(n);if(!r?.mediaPlaceholder||!(0,o.X1)(n))return(0,s.createElement)(e,t);const{fileType:l}=r,{onError:p}=t,{onBannerVisibilityChange:m}=(0,c.useContext)(d.x),g=(0,c.useCallback)((e=>m(e?.length&&(0,u.Qu)(e[0],l))),[l,m]),A=(0,c.useCallback)((e=>{const t=e?.[0]?.props?.children;return(0,u.Qu)(t,l)?g([t]):p(e)}),[g,l,p]);return(0,s.createElement)("div",{className:"paid-block-media-placeholder"},(0,s.createElement)(e,a()({},t,{onFilesPreUpload:g,onError:A})))}),"withMediaPlaceholderUpgradable")},7832:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(82674),a=n.n(r),s=n(51806),o=n(13419),i=n(52175),l=n(94333),c=n(69307),u=n(11317),d=n(87950);const p=(0,l.createHigherOrderComponent)((e=>t=>{const{name:n}=(0,i.useBlockEditContext)(),r=(0,o.m3)(n),l=(0,c.useRef)();if(!r?.mediaReplaceFlow||!(0,o.X1)(n))return(0,s.createElement)(e,t);const{fileType:p}=r,{onBannerVisibilityChange:m}=(0,c.useContext)(d.x);return(0,s.createElement)(e,a()({},t,{onFilesUpload:e=>{l.current=e?.length?e[0]:null,m(e?.length&&(0,u.Qu)(e[0],p))},createNotice:(e,n,r)=>{if((0,u.Qu)(l.current,p))return l.current=null,null;t.createNotice(e,n,r)}}))}),"withMediaReplaceFlowUpgradable")},95796:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(51806),a=n(55609);const s=({cx:e=0,cy:t=0,r:n=4,fill:s="#e34c84",stroke:o="#ffffff",strokeWidth:i="2"})=>(0,r.createElement)(a.SVG,{className:"jetpack-paid-block-symbol"},(0,r.createElement)(a.Circle,{cx:e,cy:t,r:n,fill:s,stroke:o,strokeWidth:i}))},42770:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i,p:()=>l});var r=n(51806),a=n(13419),s=n(95796);const o=e=>{const t=(0,r.createElement)(s.Z,{key:"paid-symbol"});return e?.src?{...e,src:(0,r.createElement)(r.Fragment,null,e.src,t)}:(0,r.createElement)(r.Fragment,null,e,t)},i=o;function l(e,t){return(0,a.X1)(e)?o(t):t}},66316:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(51806),a=n(9818),s=n(65736),o=n(26546),i=n(78798);const __=s.__,_x=s._x,l=__("Premium Block","jetpack"),/** translators: %s: name of the plan. */
c=__("Upgrade to %s to use this premium block","jetpack"),u=(__("Upgrade your plan to use this premium block","jetpack"),_x("Upgrade","Call to action to buy a new plan","jetpack")),d=({onRedirect:e,align:t,className:n,title:d=l,description:p=null,buttonText:m=u,visible:g=!0,requiredPlan:A,context:h})=>{const[E,f,C]=(0,i.Z)(A,e),b=(0,a.useSelect)((e=>{if(p)return p;const t=e("wordpress-com/plans"),n=t&&t.getPlan(A);return n?(0,s.sprintf)(c,n.product_name_short):null}),[p]);return b&&(0,r.createElement)(o.p,{align:t,buttonText:m,checkoutUrl:E,className:n,context:h,description:b,goToCheckoutPage:f,isRedirecting:C,title:d,visible:g})}},38140:(e,t,n)=>{"use strict";n.d(t,{W:()=>a,v:()=>r});const r=({plan:e,blockName:t,context:n,tracks:r})=>{r.recordEvent("jetpack_editor_block_upgrade_click",{plan:e,block:t,context:n})},a=({plan:e,blockName:t,context:n,tracks:r})=>{r.recordEvent("jetpack_editor_block_upgrade_banner_impression",{plan:e,block:t,context:n})}},27003:(e,t,n)=>{"use strict";n.d(t,{v:()=>m});var r=n(51806),a=n(13419),s=n(52175),o=n(94333),i=n(9818),l=n(69307),c=n(87950),u=n(66316),d=n(38140);const p=(0,o.createHigherOrderComponent)((e=>t=>{const{name:n,clientId:o,isSelected:p,attributes:m,setAttributes:g}=t||{},A=(0,a.Rl)(n);if(!A)return(0,r.createElement)(e,t);const h=(0,a.HD)(n),E=(0,a.m3)(n),[f,C]=(0,l.useState)(!h),[b,v]=(0,l.useState)(!1),k="editor-canvas",B=(0,i.useSelect)((e=>e("core/block-editor").hasSelectedInnerBlock(o,!0)),[]),{hasParentBanner:y}=(0,l.useContext)(c.x)||{},w=(p||B)&&f&&!y,{tracks:_}=(0,a.z$)(),I=(0,l.useMemo)((()=>({plan:A,blockName:n,context:k,tracks:_})),[A,n,_]);(0,l.useEffect)((()=>{w&&v(!0)}),[w,v]),(0,l.useEffect)((()=>{!b&&w&&(0,d.W)(I)}),[b,I,w]),(0,l.useEffect)((()=>C(!h)),[m,C,h]),(0,l.useEffect)((()=>{g({shouldDisplayFrontendBanner:!y})}),[g,y]);const j=(0,s.useBlockProps)();return(0,r.createElement)(c.L,{onBannerVisibilityChange:C,hasParentBanner:w},(0,r.createElement)("div",{ref:j.ref,style:{"max-width":"unset"}},(0,r.createElement)(u.ZP,{className:`is-${n.replace(/\//,"-")}-paid-block`,title:null,align:m?.align,visible:w,description:E?.description,requiredPlan:A,context:k,onRedirect:()=>(0,d.v)(I)}),(0,r.createElement)(e,t)))}),"withUpgradeBanner");function m(e,t){return(0,a.Rl)(t)?{...e,edit:p(e.edit)}:e}},90607:(e,t,n)=>{"use strict";n.d(t,{Z:()=>y});var r=n(51806),a=n(13419),s=n(55609),o=n(72067),i=n(65736),l=n(51128),c=n.n(l),u=(n(99196),n(63206)),d=n(18135),p=n(34613),m=n(77371),g=n(75317),A=n(75554),h=n(84102),E=n(30664),f=n(16597);const __=i.__,C=c()("jetpack-ai-assistant-plugin:sidebar"),b=window?.Jetpack_Editor_Initial_State?.available_blocks?.["ai-assistant-usage-panel"]?.available||!1,v=window?.Jetpack_Editor_Initial_State?.available_blocks?.["ai-featured-image-generator"]?.available||!1,k=window?.Jetpack_Editor_Initial_State?.available_blocks?.["ai-title-optimization"]?.available||!1,B=({placement:e,requireUpgrade:t,upgradeType:n})=>{const{checkoutUrl:a}=(0,u.Z)();return(0,r.createElement)(r.Fragment,null,k&&(0,r.createElement)(s.PanelRow,{className:"jetpack-ai-title-optimization__header"},(0,r.createElement)(s.BaseControl,{label:__("Optimize Publishing","jetpack")},(0,r.createElement)(A.Z,{placement:e,busy:!1,disabled:t}))),(0,r.createElement)(s.PanelRow,{className:"jetpack-ai-proofread-control__header"},(0,r.createElement)(s.BaseControl,{label:__("AI feedback on post","jetpack")},(0,r.createElement)(g.Z,{busy:!1,disabled:t}))),v&&(0,r.createElement)(s.PanelRow,{className:"jetpack-ai-featured-image-control__header"},(0,r.createElement)(s.BaseControl,{label:__("AI Featured Image","jetpack")},(0,r.createElement)(m.Z,{busy:!1,disabled:t,placement:e}))),t&&!b&&(0,r.createElement)(s.PanelRow,null,(0,r.createElement)(f.Z,{placement:e,type:n,upgradeUrl:a})),b&&(0,r.createElement)(s.PanelRow,null,(0,r.createElement)(h.Z,{placement:e})))};function y(){const{requireUpgrade:e,upgradeType:t,currentTier:n}=(0,d.Z)(),{checkoutUrl:i}=(0,u.Z)(),{tracks:l}=(0,a.z$)(),c=__("AI Assistant","jetpack");return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(p.Z,null,(0,r.createElement)(s.PanelBody,{title:c,initialOpen:!1,onToggle:e=>{var t;e&&(t=E.bA,C(t),l.recordEvent("jetpack_ai_panel_open",{placement:t}))}},(0,r.createElement)(B,{placement:E.bA,requireUpgrade:e,upgradeType:t}))),(0,r.createElement)(o.PluginDocumentSettingPanel,{icon:(0,r.createElement)(a.Pm,null),title:c,name:"jetpack-ai-assistant"},(0,r.createElement)(B,{placement:E.cG,requireUpgrade:e,upgradeType:t})),(0,r.createElement)(o.PluginPrePublishPanel,{title:c,icon:(0,r.createElement)(a.Pm,null),initialOpen:!1},(0,r.createElement)(r.Fragment,null,k&&(0,r.createElement)(A.Z,{placement:E.jm,busy:!1,disabled:e}),(0,r.createElement)(g.Z,{busy:!1,disabled:e}),e&&(0,r.createElement)(f.Z,{placement:E.jm,type:t,currentTier:n,upgradeUrl:i}))))}},30664:(e,t,n)=>{"use strict";n.d(t,{bA:()=>r,cG:()=>a,jm:()=>s});const r="jetpack-sidebar",a="document-settings",s="pre-publish"},16597:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(13419),s=n(55609),o=n(69307),i=n(65736);const __=i.__;function l({onClick:e,type:t,placement:n="",currentTier:l,upgradeUrl:c}){const{tracks:u}=(0,a.z$)(),d=(0,o.useCallback)((t=>{u.recordEvent("jetpack_ai_upgrade_button",{placement:n}),e?.(t)}),[e,u,n]),p=l?.value&&1!==l?.value?l.limit:20,m=__("You have reached the limit of 20 free requests. Upgrade to continue generating feedback. ","jetpack"),g=(0,i.sprintf)(/* translators: number is the request limit for the current tier/plan */
-__("You have reached the limit of %d requests . Upgrade to continue generating feedback. ","jetpack"),p),A=(0,o.createInterpolateElement)(__("You've reached the Jetpack AI rate limit. Please reach out to your VIP account team. ","jetpack"),{strong:(0,r.createElement)("strong",null)}),h=(0,o.createInterpolateElement)(20===p?m:g,{strong:(0,r.createElement)("strong",null),button:(0,r.createElement)(s.Button,{variant:"link",onClick:d,href:c,target:"_blank"})});return(0,r.createElement)("p",null,"vip"===t?A:h)}},30494:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(51806),a=n(55609),s=n(65736),o=n(61074),i=n(52800),l=n(46936),c=n(65235),u=n.n(c),d=n(69282);const __=s.__;function p({children:e,isDotted:t=!1}){const n=(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:`data:image/png;base64,${d.U}`,alt:""});return(0,r.createElement)("div",{className:"ai-assistant-featured-image__blank"},n,(0,r.createElement)("div",{className:u()("ai-assistant-featured-image__blank-content",{"is-dotted":t})},e))}function m({images:e,current:t,handlePreviousImage:n,handleNextImage:s,actions:c=null}){const d=(0,r.createElement)("button",{className:"ai-carrousel__prev",onClick:n},(0,r.createElement)(o.Z,{icon:i.Z,className:u()("ai-carrousel__prev-icon",{"is-disabled":0===t})})),m=(0,r.createElement)("button",{className:"ai-carrousel__next",onClick:s},(0,r.createElement)(o.Z,{icon:l.Z,className:u()("ai-carrousel__next-icon",{"is-disabled":t+1===e.length})}));return(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-images"},e.length>1&&d,e.map((({image:e,generating:n,error:s},o)=>(0,r.createElement)("div",{key:"image:"+o,className:u()("ai-assistant-featured-image__carrousel-image-container",{"is-current":t===o,"is-prev":t>o})},n?(0,r.createElement)(p,null,(0,r.createElement)(a.Spinner,{style:{width:"50px",height:"50px"}})):(0,r.createElement)(r.Fragment,null,s?(0,r.createElement)(p,{isDotted:!0},(0,r.createElement)("div",{className:"ai-assistant-featured-image__error"},__("An error occurred while generating the image. Please, try again!","jetpack"),s?.message&&(0,r.createElement)("span",{className:"ai-assistant-featured-image__error-message"},s?.message))):(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:e,alt:""}))))),e.length>1&&m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-footer"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-counter"},d,t+1," / ",e.length,m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-actions"},c)))}},77371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>j,h:()=>y});var r=n(51806),a=n(42290),s=n(13419),o=n(55609),i=n(9818),l=n(69307),c=n(65736),u=n(61074),d=n(15381),p=n(5246),m=n(18135),g=n(28788),A=n(23795),h=n(45975),E=n(84944),f=n(30664),C=n(78116),b=n(30494),v=n(62815);const __=c.__,k="ai-image-generator",B="featured-post-image",y="media-source-dropdown",w=(0,g.$)("ai-assistant-experimental-image-generation-support"),_=w?"stable-diffusion":"dall-e-3",I=(0,s.Ug)()?"atomic":(0,s.Wp)()?"simple":"jetpack";function j({busy:e,disabled:t,placement:n,onClose:g=(()=>{})}){const{toggleEditorPanelOpened:j}=(0,i.useDispatch)("core/edit-post"),{editPost:x,toggleEditorPanelOpened:S}=(0,i.useDispatch)("core/editor"),{clearSelectedBlock:Q}=(0,i.useDispatch)("core/block-editor"),[N,P]=(0,l.useState)(!1),[R,T]=(0,l.useState)([{generating:!0}]),[Z,L]=(0,l.useState)(0),M=(0,l.useRef)(0),[D,F]=(0,l.useState)(""),z=(0,l.useRef)(!1),{enableComplementaryArea:O}=(0,i.useDispatch)("core/interface"),{generateImage:U,generateImageWithStableDiffusion:H}=(0,a.Rc)(),{saveToMediaLibrary:V}=(0,E.Z)(),{tracks:q}=(0,s.z$)(),{recordEvent:G}=q,$=R[Z],W=R[M.current],{requireUpgrade:J,requestsCount:Y,requestsLimit:K,currentTier:X,increaseRequestsCount:ee,costs:te}=(0,m.Z)(),ne=(0,A.U_)(X),re=w?te?.[B]?.stableDiffusion??1:te?.[B]?.image,ae=ne===A.hp,se=K-Ye("core/editor").isEditorPanelOpened??e("core/edit-post").isEditorPanelOpened),[]),ce=(0,l.useCallback)((()=>{ee(re)}),[ee,re]),ue=(0,l.useCallback)(((e,t)=>{T((n=>{const r=[...n];return r[t]={...r[t],...e},r})),e.error&&G("jetpack_ai_featured_image_generation_error",{placement:n,error:e.error?.message,model:_,site_type:I})}),[n,G]),de=(0,l.useCallback)((()=>{L(Math.max(Z-1,0))}),[Z,L]),pe=(0,l.useCallback)((()=>{L(Math.min(Z+1,R.length-1))}),[Z,R.length]),me=(0,l.useCallback)((()=>{if(ue({generating:!0,error:null},M.current),se)return void ue({generating:!1,error:new Error(__("You don't have enough requests to generate another image.","jetpack"))},M.current);if(!D&&!oe)return void ue({generating:!1,error:new Error(__("No content to generate image. Please type custom instructions and try again.","jetpack"))},M.current);(w?H({feature:B,postContent:oe,userPrompt:D}):U({feature:B,postContent:oe,responseFormat:"b64_json",userPrompt:D})).then((e=>{if(e.data.length>0){const t="data:image/png;base64,"+e.data[0].b64_json;ue({image:t},M.current),ce(),V(t).then((e=>{ue({libraryId:e.id,generating:!1},M.current),M.current+=1})).catch((()=>{ue({generating:!1},M.current),M.current+=1}))}})).catch((e=>{ue({generating:!1,error:e},M.current)}))}),[se,ue,U,H,oe,D,ce,V]),ge=(0,l.useCallback)((()=>{P(!N)}),[N,P]),Ae=(0,l.useCallback)((()=>{ge(),g?.()}),[ge,g]),he=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_generate_image",{placement:n,model:_,site_type:I}),ge(),me()}),[ge,me,G,n]),Ee=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_generate_another_image",{placement:n,model:_,site_type:I}),me(),L((e=>e+1))}),[me,G,n]),fe=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_try_again",{placement:n,model:_,site_type:I}),me()}),[me,G,n]),Ce=(0,l.useCallback)((e=>{F(e.target.value)}),[F]),be=(0,l.useCallback)((()=>(Q(),O("core/edit-post","edit-post/document"))),[Q,O]),ve=(0,l.useCallback)((()=>{G("jetpack_ai_featured_image_generation_use_image",{placement:n,model:_,site_type:I});const e=e=>{x({featured_media:e}),Ae(),setTimeout((()=>{const e=le("featured-image"),t=le("post-status");be().then((()=>{e||ie("featured-image"),t||ie("post-status")}))}),500)};R[Z].libraryId?e(R[Z].libraryId):V(R[Z].image).then((t=>{e(t.id)}))}),[Z,x,R,le,G,V,ie,be,Ae,n]);(0,l.useEffect)((()=>{n===y&&(z.current||(z.current=!0,he()))}),[n,he]);const ke=__("Generate a featured image with AI","jetpack"),Be=__("1 request per image","jetpack"),ye=(0,c.sprintf)(
+__("You have reached the limit of %d requests . Upgrade to continue generating feedback. ","jetpack"),p),A=(0,o.createInterpolateElement)(__("You've reached the Jetpack AI rate limit. Please reach out to your VIP account team. ","jetpack"),{strong:(0,r.createElement)("strong",null)}),h=(0,o.createInterpolateElement)(20===p?m:g,{strong:(0,r.createElement)("strong",null),button:(0,r.createElement)(s.Button,{variant:"link",onClick:d,href:c,target:"_blank"})});return(0,r.createElement)("p",null,"vip"===t?A:h)}},30494:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(51806),a=n(55609),s=n(65736),o=n(61074),i=n(52800),l=n(46936),c=n(65235),u=n.n(c),d=n(69282);const __=s.__;function p({children:e,isDotted:t=!1}){const n=(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:`data:image/png;base64,${d.U}`,alt:""});return(0,r.createElement)("div",{className:"ai-assistant-featured-image__blank"},n,(0,r.createElement)("div",{className:u()("ai-assistant-featured-image__blank-content",{"is-dotted":t})},e))}function m({images:e,current:t,handlePreviousImage:n,handleNextImage:s,actions:c=null}){const d=(0,r.createElement)("button",{className:"ai-carrousel__prev",onClick:n},(0,r.createElement)(o.Z,{icon:i.Z,className:u()("ai-carrousel__prev-icon",{"is-disabled":0===t})})),m=(0,r.createElement)("button",{className:"ai-carrousel__next",onClick:s},(0,r.createElement)(o.Z,{icon:l.Z,className:u()("ai-carrousel__next-icon",{"is-disabled":t+1===e.length})}));return(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-images"},e.length>1&&d,e.map((({image:e,generating:n,error:s},o)=>(0,r.createElement)("div",{key:"image:"+o,className:u()("ai-assistant-featured-image__carrousel-image-container",{"is-current":t===o,"is-prev":t>o})},n?(0,r.createElement)(p,null,(0,r.createElement)(a.Spinner,{style:{width:"50px",height:"50px"}})):(0,r.createElement)(r.Fragment,null,s?(0,r.createElement)(p,{isDotted:!0},(0,r.createElement)("div",{className:"ai-assistant-featured-image__error"},__("An error occurred while generating the image. Please, try again!","jetpack"),s?.message&&(0,r.createElement)("span",{className:"ai-assistant-featured-image__error-message"},s?.message))):(0,r.createElement)("img",{className:"ai-assistant-featured-image__carrousel-image",src:e,alt:""}))))),e.length>1&&m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-footer"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-counter"},d,t+1," / ",e.length,m),(0,r.createElement)("div",{className:"ai-assistant-featured-image__carrousel-actions"},c)))}},77371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>I,h:()=>B});var r=n(51806),a=n(42290),s=n(13419),o=n(55609),i=n(9818),l=n(69307),c=n(65736),u=n(61074),d=n(15381),p=n(5246),m=n(18135),g=n(23795),A=n(45975),h=n(84944),E=n(30664),f=n(78116),C=n(30494),b=n(62815);const __=c.__,v="ai-image-generator",k="featured-post-image",B="media-source-dropdown",y="stable-diffusion",w="dall-e-3",_=(0,s.Ug)()?"atomic":(0,s.Wp)()?"simple":"jetpack";function I({busy:e,disabled:t,placement:n,onClose:I=(()=>{})}){const{toggleEditorPanelOpened:j}=(0,i.useDispatch)("core/edit-post"),{editPost:x,toggleEditorPanelOpened:S}=(0,i.useDispatch)("core/editor"),{clearSelectedBlock:Q}=(0,i.useDispatch)("core/block-editor"),[N,P]=(0,l.useState)(!1),[R,T]=(0,l.useState)([{generating:!0}]),[Z,L]=(0,l.useState)(0),M=(0,l.useRef)(0),[D,F]=(0,l.useState)(""),z=(0,l.useRef)(!1),{enableComplementaryArea:O}=(0,i.useDispatch)("core/interface"),{generateImageWithParameters:U}=(0,a.Rc)(),{saveToMediaLibrary:H}=(0,h.Z)(),{tracks:V}=(0,s.z$)(),{recordEvent:q}=V,G=R[Z],$=R[M.current],{requireUpgrade:W,requestsCount:J,requestsLimit:Y,currentTier:K,increaseRequestsCount:X,costs:ee}=(0,m.Z)(),te=(0,g.U_)(K),ne=ee?.[k]?.activeModel??10,re=ne===ee?.[k]?.stableDiffusion?y:w,ae=te===g.hp,se=Y-Je("core/editor").isEditorPanelOpened??e("core/edit-post").isEditorPanelOpened),[]),ce=(0,l.useCallback)((()=>{X(ne)}),[X,ne]),ue=(0,l.useCallback)(((e,t)=>{T((n=>{const r=[...n];return r[t]={...r[t],...e},r})),e.error&&q("jetpack_ai_featured_image_generation_error",{placement:n,error:e.error?.message,model:re,site_type:_})}),[n,q,re]),de=(0,l.useCallback)((()=>{L(Math.max(Z-1,0))}),[Z,L]),pe=(0,l.useCallback)((()=>{L(Math.min(Z+1,R.length-1))}),[Z,R.length]),me=(0,l.useCallback)((()=>{if(ue({generating:!0,error:null},M.current),se)return void ue({generating:!1,error:new Error(__("You don't have enough requests to generate another image.","jetpack"))},M.current);if(!D&&!oe)return void ue({generating:!1,error:new Error(__("No content to generate image. Please type custom instructions and try again.","jetpack"))},M.current);U({feature:k,size:"1792x1024",responseFormat:"b64_json",style:"photographic",messages:[{role:"jetpack-ai",context:{type:"featured-image-generation",request:D||null,content:oe}}]}).then((e=>{if(e.data.length>0){const t="data:image/png;base64,"+e.data[0].b64_json;ue({image:t},M.current),ce(),H(t).then((e=>{ue({libraryId:e.id,generating:!1},M.current),M.current+=1})).catch((()=>{ue({generating:!1},M.current),M.current+=1}))}})).catch((e=>{ue({generating:!1,error:e},M.current)}))}),[se,ue,U,oe,D,ce,H]),ge=(0,l.useCallback)((()=>{P(!N)}),[N,P]),Ae=(0,l.useCallback)((()=>{ge(),I?.()}),[ge,I]),he=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_generate_image",{placement:n,model:re,site_type:_}),ge(),me()}),[ge,me,q,n,re]),Ee=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_generate_another_image",{placement:n,model:re,site_type:_}),me(),L((e=>e+1))}),[me,q,n,re]),fe=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_try_again",{placement:n,model:re,site_type:_}),me()}),[me,q,n,re]),Ce=(0,l.useCallback)((e=>{F(e.target.value)}),[F]),be=(0,l.useCallback)((()=>(Q(),O("core/edit-post","edit-post/document"))),[Q,O]),ve=(0,l.useCallback)((()=>{q("jetpack_ai_featured_image_generation_use_image",{placement:n,model:re,site_type:_});const e=e=>{x({featured_media:e}),Ae(),setTimeout((()=>{const e=le("featured-image"),t=le("post-status");be().then((()=>{e||ie("featured-image"),t||ie("post-status")}))}),500)};R[Z].libraryId?e(R[Z].libraryId):H(R[Z].image).then((t=>{e(t.id)}))}),[Z,x,R,le,q,H,ie,be,Ae,n,re]);(0,l.useEffect)((()=>{n===B&&(z.current||(z.current=!0,he()))}),[n,he]);const ke=__("Generate a featured image with AI","jetpack"),Be=__("1 request per image","jetpack"),ye=(0,c.sprintf)(
// Translators: %d is the cost of generating one image.
-__("%d requests per image","jetpack"),re),we=1===re?Be:ye,_e=(0,r.createElement)(o.Button,{onClick:ve,variant:"primary",isBusy:$?.generating,disabled:!$?.image},__("Set as featured image","jetpack"));return(0,r.createElement)("div",null,(n===f.bA||n===f.cG)&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",null,__("Create and use an AI generated featured image for your post.","jetpack")),(0,r.createElement)(o.Button,{onClick:he,isBusy:e,disabled:!oe||t||se,variant:"secondary"},__("Generate image","jetpack"))),N&&(0,r.createElement)(C.Z,{handleClose:Ae,title:ke},(0,r.createElement)("div",{className:"ai-assistant-featured-image__content"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt-textarea"},(0,r.createElement)("textarea",{disabled:se||W?.generating,maxLength:1e3,rows:2,onChange:Ce,placeholder:__("Include optional instructions to generate a new image","jetpack")}))),(J||se)&&!W?.generating&&(0,r.createElement)(p.Z,{description:se?(0,c.sprintf)(
+__("%d requests per image","jetpack"),ne),we=1===ne?Be:ye,_e=(0,r.createElement)(o.Button,{onClick:ve,variant:"primary",isBusy:G?.generating,disabled:!G?.image},__("Set as featured image","jetpack"));return(0,r.createElement)("div",null,(n===E.bA||n===E.cG)&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",null,__("Create and use an AI generated featured image for your post.","jetpack")),(0,r.createElement)(o.Button,{onClick:he,isBusy:e,disabled:!oe||t||se,variant:"secondary"},__("Generate image","jetpack"))),N&&(0,r.createElement)(f.Z,{handleClose:Ae,title:ke},(0,r.createElement)("div",{className:"ai-assistant-featured-image__content"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__user-prompt-textarea"},(0,r.createElement)("textarea",{disabled:se||$?.generating,maxLength:1e3,rows:2,onChange:Ce,placeholder:__("Include optional instructions to generate a new image","jetpack")}))),(W||se)&&!$?.generating&&(0,r.createElement)(p.Z,{description:se?(0,c.sprintf)(
// Translators: %d is the cost of generating a featured image.
-__("Featured image generation costs %d requests per image. You don't have enough requests to generate another image.","jetpack"),re):null,placement:k,useLightNudge:!0}),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-left"},!ae&&re&&K&&(0,r.createElement)(v.Z,{cost:re,currentLimit:K,currentUsage:Y})),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-right"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__action-buttons"},W?.error?(0,r.createElement)(o.Button,{onClick:fe,variant:"secondary",disabled:!D&&!oe},__("Try again","jetpack")):(0,r.createElement)(o.Tooltip,{text:we,placement:"bottom"},(0,r.createElement)(o.Button,{onClick:Ee,variant:"secondary",isBusy:W?.generating,disabled:se||W?.generating||!D&&!oe},__("Generate again","jetpack")))))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__image-canvas"},(0,r.createElement)(b.Z,{images:R,current:Z,handlePreviousImage:de,handleNextImage:pe,actions:_e}))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__footer"},(0,r.createElement)(o.Button,{variant:"link",className:"ai-assistant-featured-image__feedback-button",href:"https://jetpack.com/redirect/?source=jetpack-ai-feedback",target:"_blank"},(0,r.createElement)("span",null,__("Provide feedback","jetpack")),(0,r.createElement)(u.Z,{icon:d.Z,className:"icon"})))))}},62815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(69307),s=n(65736);const __=s.__;function o({currentLimit:e,currentUsage:t,cost:n}){const o=e-t,i=(0,a.createInterpolateElement)(
+__("Featured image generation costs %d requests per image. You don't have enough requests to generate another image.","jetpack"),ne):null,placement:v,useLightNudge:!0}),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-left"},!ae&&ne&&Y&&(0,r.createElement)(b.Z,{cost:ne,currentLimit:Y,currentUsage:J})),(0,r.createElement)("div",{className:"ai-assistant-featured-image__actions-right"},(0,r.createElement)("div",{className:"ai-assistant-featured-image__action-buttons"},$?.error?(0,r.createElement)(o.Button,{onClick:fe,variant:"secondary",disabled:!D&&!oe},__("Try again","jetpack")):(0,r.createElement)(o.Tooltip,{text:we,placement:"bottom"},(0,r.createElement)(o.Button,{onClick:Ee,variant:"secondary",isBusy:$?.generating,disabled:se||$?.generating||!D&&!oe},__("Generate again","jetpack")))))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__image-canvas"},(0,r.createElement)(C.Z,{images:R,current:Z,handlePreviousImage:de,handleNextImage:pe,actions:_e}))),(0,r.createElement)("div",{className:"ai-assistant-featured-image__footer"},(0,r.createElement)(o.Button,{variant:"link",className:"ai-assistant-featured-image__feedback-button",href:"https://jetpack.com/redirect/?source=jetpack-ai-feedback",target:"_blank"},(0,r.createElement)("span",null,__("Provide feedback","jetpack")),(0,r.createElement)(u.Z,{icon:d.Z,className:"icon"})))))}},62815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(51806),a=n(69307),s=n(65736);const __=s.__;function o({currentLimit:e,currentUsage:t,cost:n}){const o=e-t,i=(0,a.createInterpolateElement)(
// Translators: %d is the cost of one image.
// Translators: %d is the cost of one image.
(0,s.sprintf)(__("Requests needed: %d ","jetpack"),n),{counter:(0,r.createElement)("span",null)}),l=(0,a.createInterpolateElement)(
diff --git a/extensions/plugins/ai-assistant-plugin/components/featured-image/index.tsx b/extensions/plugins/ai-assistant-plugin/components/featured-image/index.tsx
index 389bb69750..2e354ec85f 100644
--- a/extensions/plugins/ai-assistant-plugin/components/featured-image/index.tsx
+++ b/extensions/plugins/ai-assistant-plugin/components/featured-image/index.tsx
@@ -18,7 +18,6 @@ import { Icon, external } from '@wordpress/icons';
import './style.scss';
import UpgradePrompt from '../../../../blocks/ai-assistant/components/upgrade-prompt';
import useAiFeature from '../../../../blocks/ai-assistant/hooks/use-ai-feature';
-import { getFeatureAvailability } from '../../../../blocks/ai-assistant/lib/utils/get-feature-availability';
import { PLAN_TYPE_UNLIMITED, usePlanType } from '../../../../shared/use-plan-type';
import usePostContent from '../../hooks/use-post-content';
import useSaveToMediaLibrary from '../../hooks/use-save-to-media-library';
@@ -34,17 +33,8 @@ const FEATURED_IMAGE_UPGRADE_PROMPT_PLACEMENT = 'ai-image-generator';
const FEATURED_IMAGE_FEATURE_NAME = 'featured-post-image';
export const FEATURED_IMAGE_PLACEMENT_MEDIA_SOURCE_DROPDOWN = 'media-source-dropdown';
-/**
- * Control experimental image generation for the featured image.
- */
-const AI_ASSISTANT_EXPERIMENTAL_IMAGE_GENERATION_SUPPORT =
- 'ai-assistant-experimental-image-generation-support';
-const isAiAssistantExperimentalImageGenerationSupportEnabled = getFeatureAvailability(
- AI_ASSISTANT_EXPERIMENTAL_IMAGE_GENERATION_SUPPORT
-);
-const IMAGE_GENERATION_MODEL = isAiAssistantExperimentalImageGenerationSupportEnabled
- ? 'stable-diffusion'
- : 'dall-e-3';
+const IMAGE_GENERATION_MODEL_STABLE_DIFFUSION = 'stable-diffusion';
+const IMAGE_GENERATION_MODEL_DALL_E_3 = 'dall-e-3';
/**
* Determine the site type for tracking purposes.
*
@@ -86,7 +76,7 @@ export default function FeaturedImage( {
const triggeredAutoGeneration = useRef( false );
const { enableComplementaryArea } = useDispatch( 'core/interface' );
- const { generateImage, generateImageWithStableDiffusion } = useImageGenerator();
+ const { generateImageWithParameters } = useImageGenerator();
const { saveToMediaLibrary } = useSaveToMediaLibrary();
const { tracks } = useAnalytics();
const { recordEvent } = tracks;
@@ -104,9 +94,11 @@ export default function FeaturedImage( {
costs,
} = useAiFeature();
const planType = usePlanType( currentTier );
- const featuredImageCost = isAiAssistantExperimentalImageGenerationSupportEnabled
- ? costs?.[ FEATURED_IMAGE_FEATURE_NAME ]?.stableDiffusion ?? 1
- : costs?.[ FEATURED_IMAGE_FEATURE_NAME ]?.image;
+ const featuredImageCost = costs?.[ FEATURED_IMAGE_FEATURE_NAME ]?.activeModel ?? 10;
+ const featuredImageActiveModel =
+ featuredImageCost === costs?.[ FEATURED_IMAGE_FEATURE_NAME ]?.stableDiffusion
+ ? IMAGE_GENERATION_MODEL_STABLE_DIFFUSION
+ : IMAGE_GENERATION_MODEL_DALL_E_3;
const isUnlimited = planType === PLAN_TYPE_UNLIMITED;
const requestsBalance = requestsLimit - requestsCount;
const notEnoughRequests = requestsBalance < featuredImageCost;
@@ -150,12 +142,12 @@ export default function FeaturedImage( {
recordEvent( 'jetpack_ai_featured_image_generation_error', {
placement,
error: data.error?.message,
- model: IMAGE_GENERATION_MODEL,
+ model: featuredImageActiveModel,
site_type: SITE_TYPE,
} );
}
},
- [ placement, recordEvent ]
+ [ placement, recordEvent, featuredImageActiveModel ]
);
const handlePreviousImage = useCallback( () => {
@@ -203,19 +195,25 @@ export default function FeaturedImage( {
return;
}
- /** Decide between standard or experimental generation */
- const generateImagePromise = isAiAssistantExperimentalImageGenerationSupportEnabled
- ? generateImageWithStableDiffusion( {
- feature: FEATURED_IMAGE_FEATURE_NAME,
- postContent,
- userPrompt,
- } )
- : generateImage( {
- feature: FEATURED_IMAGE_FEATURE_NAME,
- postContent,
- responseFormat: 'b64_json',
- userPrompt,
- } );
+ /**
+ * Make a generic call to backend and let it decide the model.
+ */
+ const generateImagePromise = generateImageWithParameters( {
+ feature: FEATURED_IMAGE_FEATURE_NAME,
+ size: '1792x1024', // the size, when the generation happens with DALL-E-3
+ responseFormat: 'b64_json', // the response format, when the generation happens with DALL-E-3
+ style: 'photographic', // the style of the image, when the generation happens with Stable Diffusion
+ messages: [
+ {
+ role: 'jetpack-ai',
+ context: {
+ type: 'featured-image-generation',
+ request: userPrompt ? userPrompt : null,
+ content: postContent,
+ },
+ },
+ ],
+ } );
generateImagePromise
.then( result => {
@@ -240,8 +238,7 @@ export default function FeaturedImage( {
}, [
notEnoughRequests,
updateImages,
- generateImage,
- generateImageWithStableDiffusion,
+ generateImageWithParameters,
postContent,
userPrompt,
updateRequestsCount,
@@ -261,36 +258,42 @@ export default function FeaturedImage( {
// track the generate image event
recordEvent( 'jetpack_ai_featured_image_generation_generate_image', {
placement,
- model: IMAGE_GENERATION_MODEL,
+ model: featuredImageActiveModel,
site_type: SITE_TYPE,
} );
toggleFeaturedImageModal();
processImageGeneration();
- }, [ toggleFeaturedImageModal, processImageGeneration, recordEvent, placement ] );
+ }, [
+ toggleFeaturedImageModal,
+ processImageGeneration,
+ recordEvent,
+ placement,
+ featuredImageActiveModel,
+ ] );
const handleRegenerate = useCallback( () => {
// track the regenerate image event
recordEvent( 'jetpack_ai_featured_image_generation_generate_another_image', {
placement,
- model: IMAGE_GENERATION_MODEL,
+ model: featuredImageActiveModel,
site_type: SITE_TYPE,
} );
processImageGeneration();
setCurrent( crrt => crrt + 1 );
- }, [ processImageGeneration, recordEvent, placement ] );
+ }, [ processImageGeneration, recordEvent, placement, featuredImageActiveModel ] );
const handleTryAgain = useCallback( () => {
// track the try again event
recordEvent( 'jetpack_ai_featured_image_generation_try_again', {
placement,
- model: IMAGE_GENERATION_MODEL,
+ model: featuredImageActiveModel,
site_type: SITE_TYPE,
} );
processImageGeneration();
- }, [ processImageGeneration, recordEvent, placement ] );
+ }, [ processImageGeneration, recordEvent, placement, featuredImageActiveModel ] );
const handleUserPromptChange = useCallback(
( e: React.ChangeEvent< HTMLTextAreaElement > ) => {
@@ -309,7 +312,7 @@ export default function FeaturedImage( {
// track the accept/use image event
recordEvent( 'jetpack_ai_featured_image_generation_use_image', {
placement,
- model: IMAGE_GENERATION_MODEL,
+ model: featuredImageActiveModel,
site_type: SITE_TYPE,
} );
@@ -355,6 +358,7 @@ export default function FeaturedImage( {
triggerComplementaryArea,
handleModalClose,
placement,
+ featuredImageActiveModel,
] );
/**