1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[34453],{47442:(e,t,r)=>{r.d(t,{AH:()=>n,ZE:()=>c,rV:()=>o,rr:()=>E,vM:()=>u,yT:()=>d});var i=r(98734),a=r(44193);let o=0x200000000,n=1200,d=.5,c=0xf00000,u=0x6400000,p=i.Yj().url("mediaUrl must be a valid URL.").refine(e=>{try{return"https:"===new URL(e).protocol}catch(e){return!1}},"mediaUrl must be an https URL."),s={mediaDataBase64:i.Yj().min(1).optional(),mediaUrl:p.optional(),fileName:i.Yj().trim().min(1).optional()};i.gM("mediaType",[i.Ik({mediaType:i.eu("image"),...s,mimeType:i.Yj().regex(/^image\//).optional()}),i.Ik({mediaType:i.eu("video"),...s,mimeType:i.Yj().regex(/^video\//,"A video upload must carry its own video media type."),durationSeconds:i.ai().min(d,"A video must run at least ".concat(d," seconds.")).max(n,"A video must be no longer than ".concat(n/60," minutes.")).optional()})]).superRefine((e,t)=>{let r=void 0!==e.mediaDataBase64;r===(void 0!==e.mediaUrl)&&t.addIssue({code:a.eq.custom,path:r?["mediaUrl"]:["mediaDataBase64"],message:"Provide exactly one media source: mediaDataBase64 (inline base64 bytes) or mediaUrl (a public https URL)."})});let l=[[".mp4","video/mp4"],[".mov","video/quicktime"],[".m4v","video/x-m4v"]];function E(e,t){var r,i;if(e&&e.startsWith("video/"))return e;let a=(null!=t?t:"").toLowerCase();return null!=(i=null==(r=l.find(e=>{let[t]=e;return a.endsWith(t)}))?void 0:r[1])?i:null}},64475:(e,t,r)=>{r.d(t,{DI:()=>o,Gu:()=>l,JE:()=>u,Mu:()=>s,p3:()=>c,rl:()=>a});var i=r(98734);i.k5(["PROMOTED_TWEETS","PROMOTED_ACCOUNT"]);let a=["APP_ENGAGEMENTS","APP_INSTALLS","REACH","FOLLOWERS","ENGAGEMENTS","VIDEO_VIEWS","PREROLL_VIEWS","WEBSITE_CLICKS"],o={productTypeMismatch:"TWITTER_OBJECTIVE_PRODUCT_TYPE_MISMATCH",deliveryUnverified:"TWITTER_OBJECTIVE_DELIVERY_UNVERIFIED",goalUnverified:"TWITTER_OBJECTIVE_GOAL_UNVERIFIED",payByUnverified:"TWITTER_OBJECTIVE_PAY_BY_UNVERIFIED",categoryRequired:"TWITTER_OBJECTIVE_CATEGORY_REQUIRED",appRequired:"TWITTER_OBJECTIVE_APP_REQUIRED",placementObjectiveMismatch:"TWITTER_PLACEMENT_OBJECTIVE_MISMATCH",objectiveCreativeMismatch:"TWITTER_OBJECTIVE_CREATIVE_MISMATCH",startTimeRequired:"TWITTER_LINE_ITEM_START_TIME_REQUIRED",dailyBudgetRequired:"TWITTER_LINE_ITEM_DAILY_BUDGET_REQUIRED",contractViolation:"TWITTER_LINE_ITEM_CONTRACT_VIOLATION"},n=[{objective:"REACH",productType:"PROMOTED_TWEETS",productTypeEvidence:"accepted_at_create",delivery:{goal:"MAX_REACH",payBy:"IMPRESSION"},requiresCategory:!1,requiresApp:!1,requiredCreative:null,refusedPlacements:[]},{objective:"ENGAGEMENTS",productType:"PROMOTED_TWEETS",productTypeEvidence:"accepted_at_create",delivery:{goal:"ENGAGEMENT",payBy:"ENGAGEMENT"},requiresCategory:!1,requiresApp:!1,requiredCreative:null,refusedPlacements:["TWITTER_REPLIES"]},{objective:"VIDEO_VIEWS",productType:"PROMOTED_TWEETS",productTypeEvidence:"accepted_at_create",delivery:{goal:"VIDEO_VIEW",payBy:"VIEW"},requiresCategory:!1,requiresApp:!1,requiredCreative:["video","gif"],requiredCreativeEvidence:"provider_refusal",refusedPlacements:["TWITTER_REPLIES"]},{objective:"WEBSITE_CLICKS",productType:"PROMOTED_TWEETS",productTypeEvidence:"accepted_at_create",delivery:{goal:"LINK_CLICKS",payBy:"LINK_CLICK"},requiresCategory:!1,requiresApp:!1,requiredCreative:null,refusedPlacements:[]},{objective:"FOLLOWERS",productType:"PROMOTED_ACCOUNT",productTypeEvidence:"named_in_provider_refusal",delivery:null,requiresCategory:!1,requiresApp:!1,requiredCreative:null,refusedPlacements:["TWITTER_REPLIES"],providerRefusal:"Line item with objective FOLLOWERS must be one of product types [PROMOTED_ACCOUNT], but it is PROMOTED_TWEETS"},{objective:"PREROLL_VIEWS",productType:"PROMOTED_TWEETS",productTypeEvidence:"accepted_at_create",delivery:null,requiresCategory:!0,requiresApp:!1,requiredCreative:["video"],requiredCreativeEvidence:"documented_prose",refusedPlacements:["TWITTER_REPLIES"],providerRefusal:"You must select an IAB category that describes your brand."},{objective:"APP_INSTALLS",productType:"PROMOTED_TWEETS",productTypeEvidence:"accepted_at_create",delivery:null,requiresCategory:!1,requiresApp:!0,requiredCreative:null,refusedPlacements:[],providerRefusal:"You need to choose an app for your ad group."},{objective:"APP_ENGAGEMENTS",productType:"PROMOTED_TWEETS",productTypeEvidence:"accepted_at_create",delivery:null,requiresCategory:!1,requiresApp:!0,requiredCreative:null,refusedPlacements:["TWITTER_REPLIES"],providerRefusal:"You need to choose an app for your ad group."}],d=new Map(n.map(e=>[e.objective,e]));function c(e){let t=d.get(e);if(!t)throw Error("No X line-item contract row for objective ".concat(e));return t}function u(e){return c(e).productType}Object.freeze(Object.fromEntries(n.filter(e=>null!==e.delivery).map(e=>[e.objective,e.delivery])));let p=i.YO(i.Yj().trim().min(1));function s(e){var t;let r=e.map(e=>"gif"===e?"GIF":e);return r.length<=1?null!=(t=r[0])?t:"media":"".concat(r.slice(0,-1).join(", ")," or ").concat(r[r.length-1])}function l(e){let t=d.get(e.objective);if(!(null==t?void 0:t.requiredCreative)||"existing_post"===e.mediaTypes||e.mediaTypes.some(e=>t.requiredCreative.includes(e)))return[];let r=s(t.requiredCreative);return[{code:o.objectiveCreativeMismatch,reason:"An ad on a ".concat(t.objective," ad group must promote a post carrying a ").concat(r,"."),remediation:"Add a ".concat(r," to this ad, or create this ad group with a different objective.")}]}i.gM("objective",n.map(function(e){return i.Ik({objective:i.eu(e.objective),productType:i.eu(e.productType),goal:e.delivery?i.eu(e.delivery.goal).optional():i.Zm().optional(),payBy:e.delivery?i.eu(e.delivery.payBy).optional():i.Zm().optional(),categories:e.requiresCategory?p.min(1):p.optional(),iosAppStoreIdentifier:i.Yj().trim().min(1).optional(),androidAppStoreIdentifier:i.Yj().trim().min(1).optional()})}))},68970:(e,t,r)=>{r.d(t,{F0:()=>u,F6:()=>p,Iz:()=>E,SA:()=>l,aU:()=>s,aY:()=>a,eV:()=>d,ej:()=>c}),r(69020);let i={campaigns:"/api/twitter/campaigns",lineItems:"/api/twitter/line-items",promotedTweets:"/api/twitter/promoted-tweets",media:"/api/twitter/media",targetingCriteria:"/api/twitter/targeting-criteria"};
1class a extends Error{constructor(e,t,r){super(t),this.name="TwitterPublisherGatewayError",this.code=e,this.remediation=r}}async function o(e,t,r){var i,o,n,d,c;let u=await (null!=(i=r.fetcher)?i:fetch)((c=r.baseUrl)?new URL(e,c).toString():e,{method:"POST",headers:function(e){let t=new Headers(e);return t.has("Content-Type")||t.set("Content-Type","application/json"),t}(r.headers),body:JSON.stringify(t)}),p=await u.json().catch(()=>({}));if(!u.ok)throw new a(null!=(o=p.code)?o:"TWITTER_PUBLISHER_ERROR",null!=(n=p.reason)?n:"X publisher route ".concat(e," failed"),null!=(d=p.remediation)?d:"Retry the request. If it persists, reconnect X in Settings.");return p}function n(e,t){let r=function(e){var t;let r=null!=(t=e.entity)?t:e.data,i=Array.isArray(r)?r[0]:r;if(!i||"object"!=typeof i)throw new a("INVALID_PUBLISHER_RESPONSE","X publisher route did not return an entity.","Retry the request. If it persists, inspect the route response contract.");return i}(e);for(let e of t){let t=r[e];if(("string"==typeof t||"number"==typeof t)&&String(t).length>0)return String(t)}throw new a("INVALID_PUBLISHER_RESPONSE","X publisher route did not return any of: ".concat(t.join(", "),"."),"Retry the request. If it persists, inspect the route response contract.")}function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{createCampaign:async t=>n(await o(i.campaigns,t,e),["id"]),createLineItem:async t=>n(await o(i.lineItems,t,e),["id"]),createPromotedTweet:async t=>n(await o(i.promotedTweets,t,e),["id"]),createNullcastPost:async t=>n(await o(i.promotedTweets,t,e),["id_str","id"]),uploadImage:async t=>n(await o(i.media,t,e),["media_key","media_id_string","id"]),async applyTargetingCriteria(t){var r;let a=await o(i.targetingCriteria,t,e),n=null!=(r=a.entity)?r:a.data;return Array.isArray(n)?n.length:+!!n}}}async function c(e,t,r,i){return d({headers:i}).createCampaign({organization_id:e,account_id:t,campaign_payload:r})}
1async function u(e,t,r,i){return d({headers:i}).createLineItem({organization_id:e,account_id:t,line_item_payload:r})}async function p(e,t,r,i){return d({headers:i}).createPromotedTweet({organization_id:e,account_id:t,operation:"promote",promoted_tweet_payload:r})}async function s(e,t,r,i){return d({headers:i}).createNullcastPost({organization_id:e,account_id:t,operation:"create_nullcast_post",post_payload:r})}async function l(e,t,r,i){return d({headers:i}).applyTargetingCriteria({organization_id:e,account_id:t,targeting_payload:r})}async function E(e,t,r,i){return d({headers:i}).uploadImage({organization_id:e,account_id:t,media_payload:r})}},69020:(e,t,r)=>{r(95704)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.